diff --git a/.gitignore b/.gitignore index 99dcfcf7..6739bb2b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ **/*~ **/*.tmproj -_build +**/*.pyc +**/_build +**/_output diff --git a/.travis.yml b/.travis.yml index 8df6e941..adcc169b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,30 @@ language: c++ +language: python +python: + - "2.7" -sudo: off +sudo: on -install: ./interpreter/travis/install-ocaml.sh +before_install: + - curl -sS https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add - + - echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list + - sudo apt-get update -qq -script: ./interpreter/travis/build-test.sh +install: + - ./interpreter/meta/travis/install-ocaml.sh + - sudo pip install sphinx==1.7.9 + - sudo apt-get install texlive-full yarn + - git clone https://github.com/tabatkins/bikeshed.git + - pip install --editable $PWD/bikeshed + - bikeshed update -os: - - linux - - osx +script: + - ./interpreter/meta/travis/build-test.sh + - bash ./document/travis-deploy.sh + +os: linux + +env: + global: + - ENCRYPTION_LABEL: "5d9ec396f41d" + - COMMIT_AUTHOR_EMAIL: "noreply@webassembly.org" diff --git a/LICENSE b/LICENSE index 8f71f43f..de2cac69 100644 --- a/LICENSE +++ b/LICENSE @@ -1,202 +1,8 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ +Please see the LICENSE file in each top-level directory for the terms applicable to that directory and its relative sub-directories. - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. +The relevant directories and licenses are: +document/ - W3C Software and Document Notice and License +interpreter/ - Apache License 2.0 +test/ - Apache License 2.0 +papers/ - Creative Commons Attribution 4.0 International License diff --git a/README.md b/README.md index a987ee7c..5f17800d 100644 --- a/README.md +++ b/README.md @@ -7,14 +7,26 @@ holds a [proposal](https://github.com/WebAssembly/exception-handling/blob/master/proposals/Exceptions.md) for adding exception handling to WebAssembly. -The repository is a copy -of [WebAssembly/spec](https://github.com/WebAssembly/spec). +The repository is a clone +of [WebAssembly/spec](https://github.com/WebAssembly/spec), and is rebased on the spec of its dependent proposal [WebAssembly/reference-types](https://github.com/WebAssembly/reference-types). -The remainder of the document is contents of the -original [README.md](https://github.com/WebAssembly/spec/blob/master/README.md) +The remainder of the document is contents of the [README.md](https://github.com/WebAssembly/reference-types/blob/master/README.md) document of that repository. -## spec +# Reference Types Proposal for WebAssembly + +[![Build Status](https://travis-ci.org/WebAssembly/reference-types.svg?branch=master)](https://travis-ci.org/WebAssembly/reference-types) + +This repository is a clone of [github.com/WebAssembly/spec/](https://github.com/WebAssembly/spec/). +It is meant for discussion, prototype specification and implementation of a proposal to add support for basic reference types to WebAssembly. + +* See the [overview](proposals/reference-types/Overview.md) for a summary of the proposal. + +* See the [modified spec](https://webassembly.github.io/reference-types/core/) for details. + +Original `README` from upstream repository follows... + +# spec This repository holds a prototypical reference implementation for WebAssembly, which is currently serving as the official specification. Eventually, we expect diff --git a/document/js-api/index.bs b/document/js-api/index.bs index c72be764..87598c6f 100644 --- a/document/js-api/index.bs +++ b/document/js-api/index.bs @@ -6,7 +6,7 @@ Status: ED Level: 1 TR: https://www.w3.org/TR/wasm-js-api-1/ ED: https://webassembly.github.io/spec/js-api/ -Editor: Daniel Ehrenberg (Igalia) +Editor: Ms2ger (Igalia) Repository: WebAssembly/spec Markup Shorthands: css no, markdown yes Abstract: This document provides an explicit JavaScript API for interacting with WebAssembly. @@ -85,7 +85,10 @@ urlPrefix: https://tc39.github.io/ecma262/; spec: ECMASCRIPT text: the Number value; url: sec-ecmascript-language-types-number-type text: NumberToRawBytes; url: sec-numbertorawbytes text: Built-in Function Objects; url: sec-built-in-function-objects -urlPrefix: https://webassembly.github.io/reference-types/core/; spec: WebAssembly; type: dfn + text: NativeError Object Structure; url: sec-nativeerror-object-structure + type: abstract-op + text: CreateMethodProperty; url: sec-createmethodproperty +urlPrefix: https://webassembly.github.io/spec/core/; spec: WebAssembly; type: dfn url: valid/modules.html#valid-module text: valid text: WebAssembly module validation @@ -149,6 +152,7 @@ urlPrefix: https://webassembly.github.io/reference-types/core/; spec: WebAssembl url: syntax/types.html#syntax-reftype text: anyref text: funcref + text: nullref text: function element; url: exec/runtime.html#syntax-funcelem text: import component; url: syntax/modules.html#imports text: external value; url: exec/runtime.html#syntax-externval @@ -174,6 +178,9 @@ urlPrefix: https://webassembly.github.io/reference-types/core/; spec: WebAssembl text: 𝗆𝗈𝖽𝗎𝗅𝖾; url: exec/runtime.html#syntax-frame text: 𝗆𝖾𝗆𝖺𝖽𝖽𝗋𝗌; url: exec/runtime.html#syntax-moduleinst text: sequence; url: syntax/conventions.html#grammar-notation +urlPrefix: https://heycam.github.io/webidl/; spec: WebIDL + type: dfn + text: create a namespace object; url: create-a-namespace-object + + This API privides a way to access WebAssembly [[WEBASSEMBLY]] through a bridge to explicitly construct modules from JavaScript [[ECMASCRIPT]].

Sample API Usage

@@ -692,6 +705,7 @@ Immediately after a WebAssembly [=memory.grow=] instruction executes, perform th
 enum TableKind {
+  "nullref",
   "anyref",
   "anyfunc",
   // Note: More values may be added in future iterations,
@@ -856,6 +870,10 @@ which can be simultaneously referenced by multiple {{Instance}} objects. Each
     1. If |s| equals "i64", return [=𝗂𝟨𝟦=].
     1. If |s| equals "f32", return [=𝖿𝟥𝟤=].
     1. If |s| equals "f64", return [=𝖿𝟨𝟦=].
+    1. If |s| equals "anyref", return [=anyref=].
+    1. If |s| equals "funcref", return [=funcref=].
+    1. If |s| equals "nullref", return [=nullref=].
+    1. Assert: This step is not reached.
 
 
 
@@ -864,7 +882,7 @@ which can be simultaneously referenced by multiple {{Instance}} objects. Each 1. If |valuetype| equals [=𝗂𝟨𝟦=], return [=𝗂𝟨𝟦.𝖼𝗈𝗇𝗌𝗍=] 0. 1. If |valuetype| equals [=𝖿𝟥𝟤=], return [=𝖿𝟥𝟤.𝖼𝗈𝗇𝗌𝗍=] 0. 1. If |valuetype| equals [=𝖿𝟨𝟦=], return [=𝖿𝟨𝟦.𝖼𝗈𝗇𝗌𝗍=] 0. - 1. Assert: This step is not reached. + 1. Else, return [=ref.null=].
@@ -986,12 +1004,11 @@ Note: [=call an Exported Function|Calling an Exported Function=] executes in the Note: Exported Functions do not have a \[[Construct]] method and thus it is not possible to call one with the `new` operator.
- To run a host function from the JavaScript object |func| and type |functype|, perform the following steps: + To run a host function from the JavaScript object |func|, type |functype|, and [=list=] of [=WebAssembly values=] |arguments|, perform the following steps: 1. Let [|parameters|] → [|results|] be |functype|. 1. Assert: |results|'s [=list/size=] is at most one. 1. If either |parameters| or |results| contains [=𝗂𝟨𝟦=], throw a {{TypeError}}. - 1. Let |arguments| be a [=list=] of the arguments of the invocation of this function. 1. Let |jsArguments| be an empty [=list=]. 1. For each |arg| in |arguments|, 1. [=list/Append=] ! [=ToJSValue=](|arg|) to |jsArguments|. @@ -1003,15 +1020,16 @@ Note: Exported Functions do not have a \[[Construct]] method and thus it is not
To create a host function from the JavaScript object |func| and type |functype|, perform the following steps: - 1. Let |hostfunc| be a [=host function=] which performs the following steps when called: - 1. Let |result| be the result of [=run a host function|running a host function=] from |func| and |functype|. - 1. Assert: |result|.\[[Type]] is throw or return. - 1. If |result|.\[[Type]] is [=throw=], then trigger a WebAssembly trap, and propagate |result|.\[[Value]] to the enclosing JavaScript. + 1. Assert: [=IsCallable=](|func|). + 1. Let |hostfunc| be a [=host function=] which performs the following steps when called with arguments |arguments|: + 1. Let |result| be the result of [=run a host function|running a host function=] from |func|, |functype|, and |arguments|. + 1. Assert: |result|.\[[Type]] is throw or return. + 1. If |result|.\[[Type]] is throw, then trigger a WebAssembly trap, and propagate |result|.\[[Value]] to the enclosing JavaScript. 1. Otherwise, return |result|.\[[Value]]. 1. Let |store| be the [=surrounding agent=]'s [=associated store=]. 1. Let (|store|, |funcaddr|) be [=func_alloc=](|store|, |functype|, |hostfunc|). 1. Set the [=surrounding agent=]'s [=associated store=] to |store|. - 1. Return |funcaddr| + 1. Return |funcaddr|.
@@ -1051,11 +1069,14 @@ The algorithm ToWebAssemblyValue(|v|, |type|, |error|) coerces a Java 1. If |type| is [=𝖿𝟨𝟦=], 1. Let |f64| be ? [=ToNumber=](|v|). 1. Return [=𝖿𝟨𝟦.𝖼𝗈𝗇𝗌𝗍=] |f64|. +1. Assert: |type| is a reference type. 1. If |type| is [=anyref=], - 1. Return the result of [=allocating a host address=] for |v|. + 1. Do nothing. 1. If |type| is [=funcref=], 1. If |v| is not an [=Exported function=] or null, throw |error|. - 1. Return the result of [=allocating a host address=] for |v|. +1. If |type| is [=nullref=], + 1. If |v| is not null, throw |error|. +1. Return the result of [=allocating a host address=] for |v|.
@@ -1077,21 +1098,23 @@ The algorithm ToWebAssemblyValue(|v|, |type|, |error|) coerces a Java

Error Objects

-WebAssembly defines the following Error classes: {{CompileError}}, {{LinkError}}, and {{RuntimeError}}. WebAssembly errors have the following custom bindings: -- Unlike normal interface types, the interface prototype object for these exception classes must have as its \[[Prototype]] the intrinsic object [=%ErrorPrototype%=]. -- The constructor and properties of WebAssembly errors is as specified for {{NativeError}}. -- If an implementation gives native Error objects special powers or nonstandard properties (such as a stack property), it should also expose those on these exception instances. +WebAssembly defines the following Error classes: CompileError, LinkError, and RuntimeError. -
-[LegacyNamespace=WebAssembly]
-interface CompileError { };
+
+When the [=namespace object=] for the {{WebAssembly}} namespace is [=create a namespace object|created=], the following steps must be run: -[LegacyNamespace=WebAssembly] -interface LinkError { }; +1. Let |namespaceObject| the [=namespace object=]. +1. [=list/iterate|For each=] |error| of « "CompileError", "LinkError", "RuntimeError" », + 1. Let |constructor| be a new object, implementing the [=NativeError Object Structure=], with NativeError set to |error|. + 1. ! [$CreateMethodProperty$](|namespaceObject|, |error|, |constructor|). + +
+ +Note: This defines {{CompileError}}, {{LinkError}}, and {{RuntimeError}} classes on the {{WebAssembly}} namespace, which are produced by the APIs defined in this specification. +They expose the same interface as native JavaScript errors like {{TypeError}} and {{RangeError}}. + +Note: It is not currently possible to define this behavior using Web IDL. -[LegacyNamespace=WebAssembly] -interface RuntimeError { }; -

Error Condition Mappings to JavaScript

diff --git a/interpreter/.gitignore b/interpreter/.gitignore index 6c3de62c..0a02ff70 100644 --- a/interpreter/.gitignore +++ b/interpreter/.gitignore @@ -9,4 +9,5 @@ *.mlpack _build wasm +wasm.debug diff --git a/interpreter/LICENSE b/interpreter/LICENSE new file mode 100644 index 00000000..8f71f43f --- /dev/null +++ b/interpreter/LICENSE @@ -0,0 +1,202 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/interpreter/Makefile b/interpreter/Makefile index 4aab9150..629018a6 100644 --- a/interpreter/Makefile +++ b/interpreter/Makefile @@ -10,51 +10,66 @@ # Configuration NAME = wasm -UNOPT = $(NAME) -OPT = $(NAME).opt +UNOPT = $(NAME).debug +OPT = $(NAME) LIB = $(NAME) ZIP = $(NAME).zip JSLIB = wast.js WINMAKE = winmake.bat -DIRS = util spec text host host/import +DIRS = util syntax binary text valid runtime exec script host main LIBS = bigarray -FLAGS = -cflags '-w +a-4-27-42-44-45 -warn-error +a' +FLAGS = -cflags '-w +a-3-4-27-42-44-45 -warn-error +a' OCB = ocamlbuild $(FLAGS) $(DIRS:%=-I %) $(LIBS:%=-libs %) JS = # set to JS shell command to run JS tests # Main targets -.PHONY: unopt opt libunopt libopt all land zip +.PHONY: default opt unopt libopt libunopt jslib all land zip -unopt: $(UNOPT) +default: opt +debug: unopt opt: $(OPT) -libunopt: _build/$(LIB).cmo +unopt: $(UNOPT) libopt: _build/$(LIB).cmx +libunopt: _build/$(LIB).cmo +jslib: $(JSLIB) all: unopt opt libunopt libopt test -land: all $(WINMAKE) +land: $(WINMAKE) all zip: $(ZIP) # Building executable -$(UNOPT): main.d.byte +empty = +space = $(empty) $(empty) +comma = , + +.INTERMEDIATE: _tags +_tags: + echo >$@ "true: bin_annot" + echo >>$@ "true: debug" + echo >>$@ "<{$(subst $(space),$(comma),$(DIRS))}/*.cmx>: for-pack($(PACK))" + +$(UNOPT): main.byte mv $< $@ $(OPT): main.native mv $< $@ -.PHONY: main.d.byte main.native -main.d.byte: +.PHONY: main.byte main.native +main.byte: _tags $(OCB) -quiet $@ -main.native: +main.native: _tags $(OCB) -quiet $@ # Building library +PACK = $(shell echo `echo $(LIB) | sed 's/^\(.\).*$$/\\1/g' | tr [:lower:] [:upper:]``echo $(LIB) | sed 's/^.\(.*\)$$/\\1/g'`) + .INTERMEDIATE: $(LIB).mlpack $(LIB).mlpack: $(DIRS) ls $(DIRS:%=%/*.ml*) \ @@ -63,10 +78,10 @@ $(LIB).mlpack: $(DIRS) | sort | uniq \ >$@ -_build/$(LIB).cmo: $(LIB).mlpack +_build/$(LIB).cmo: $(LIB).mlpack _tags $(OCB) -quiet $(LIB).cmo -_build/$(LIB).cmx: $(LIB).mlpack +_build/$(LIB).cmx: $(LIB).mlpack _tags $(OCB) -quiet $(LIB).cmx @@ -75,8 +90,8 @@ _build/$(LIB).cmx: $(LIB).mlpack .PHONY: $(JSLIB) $(JSLIB): $(UNOPT) mkdir -p _build/jslib/src - cp jslib/* _build/jslib - cp $(DIRS:%=_build/%/*.ml*) jslib/*.ml _build/jslib/src + cp meta/jslib/* _build/jslib + cp $(DIRS:%=_build/%/*.ml*) meta/jslib/*.ml _build/jslib/src rm _build/jslib/src/*.ml[^i] (cd _build/jslib; ./build.sh ../../$@) @@ -87,32 +102,43 @@ $(WINMAKE): clean echo rem Auto-generated from Makefile! >$@ echo set NAME=$(NAME) >>$@ echo if \'%1\' neq \'\' set NAME=%1 >>$@ - $(OCB) main.d.byte \ + $(OCB) main.byte \ | grep -v ocamldep \ | grep -v mkdir \ | sed s:`which ocaml`:ocaml:g \ - | sed s:host/main.d.byte:%NAME%.exe: \ + | sed s:main/main.d.byte:%NAME%.exe: \ >>$@ -# Miscellaneous targets +# Executing test suite -.PHONY: test clean +.PHONY: test debugtest -$(ZIP): $(WINMAKE) - git archive --format=zip --prefix=$(NAME)/ -o $@ HEAD +test: $(OPT) + ../test/core/run.py --wasm `pwd`/$(OPT) $(if $(JS),--js '$(JS)',) +debugtest: $(UNOPT) + ../test/core/run.py --wasm `pwd`/$(UNOPT) $(if $(JS),--js '$(JS)',) + +test/%: $(OPT) + ../test/core/run.py --wasm `pwd`/$(OPT) $(if $(JS),--js '$(JS)',) $(@:test/%=../test/core/%.wast) +debugtest/%: $(UNOPT) + ../test/core/run.py --wasm `pwd`/$(UNOPT) $(if $(JS),--js '$(JS)',) $(@:debugtest/%=../test/core/%.wast) + +run/%: $(OPT) + ./$(OPT) $(@:run/%=../test/core/%.wast) +debug/%: $(UNOPT) + ./$(UNOPT) $(@:debug/%=../test/core/%.wast) -test: $(NAME) - ../test/core/run.py --wasm `pwd`/$(NAME) $(if $(JS),--js '$(JS)',) -test/%: $(NAME) - ../test/core/run.py --wasm `pwd`/$(NAME) $(if $(JS),--js '$(JS)',) $(@:test/%=../test/core/%.wast) +# Miscellaneous targets + +.PHONY: clean -run/%: $(NAME) - ./$(NAME) $(@:run/%=../test/core/%.wast) +$(ZIP): $(WINMAKE) + git archive --format=zip --prefix=$(NAME)/ -o $@ HEAD clean: - rm -rf _build/jslib + rm -rf _build/jslib $(LIB).mlpack _tags $(OCB) -clean @@ -126,9 +152,9 @@ check: ocamlfind query $(LIBS) install: _build/$(LIB).cmx _build/$(LIB).cmo - ocamlfind install wasm findlib/META _build/wasm.o \ + ocamlfind install $(LIB) meta/findlib/META _build/$(LIB).o \ $(wildcard _build/$(LIB).cm*) \ $(wildcard $(DIRS:%=%/*.mli)) uninstall: - ocamlfind remove wasm + ocamlfind remove $(LIB) diff --git a/interpreter/README.md b/interpreter/README.md index c0b42b77..77c6a543 100644 --- a/interpreter/README.md +++ b/interpreter/README.md @@ -1,6 +1,6 @@ -# WebAssembly Interpreter +# WebAssembly Reference Interpreter -This repository implements a reference interpreter for WebAssembly. It is written for clarity and simplicity, _not_ speed. It is intended as a playground for trying out ideas and a device for nailing down the exact semantics, and as a proxy for the (yet to be produced) formal specification of WebAssembly. For that purpose, the code is written in a fairly declarative, "speccy" way. +This repository implements a interpreter for WebAssembly. It is written for clarity and simplicity, _not_ speed. It is intended as a playground for trying out ideas and a device for nailing down the exact semantics, and as a proxy for the (yet to be produced) formal specification of WebAssembly. For that purpose, the code is written in a fairly declarative, "speccy" way. The interpreter can @@ -58,7 +58,7 @@ Either way, in order to run the test suite you'll need to have Python installed. #### Cross-compiling the Interpreter to JavaScript #### -The Makefile also provides a target to compile (parts of) the interpreter into a (Javacript library)[javascript-library]: +The Makefile also provides a target to compile (parts of) the interpreter into a [JavaScript library](#javascript-library): ``` make wast.js ``` @@ -75,7 +75,7 @@ You can call the executable with wasm [option | file ...] ``` -where `file`, depending on its extension, either should be an S-expression script file (see below) to be run, or a binary module file to be loaded. +where `file`, depending on its extension, either should be a binary (`.wasm`) or textual (`.wat`) module file to be loaded, or a script file (`.wast`, see below) to be run. By default, the interpreter validates all modules. The `-u` option selects "unchecked mode", which skips validation and runs code as is. @@ -86,8 +86,8 @@ Runtime type errors will be captured and reported appropriately. A file prefixed by `-o` is taken to be an output file. Depending on its extension, this will write out the preceding module definition in either S-expression or binary format. This option can be used to convert between the two in both directions, e.g.: ``` -wasm -d module.wast -o module.wasm -wasm -d module.wasm -o module.wast +wasm -d module.wat -o module.wasm +wasm -d module.wasm -o module.wat ``` In the second case, the produced script contains exactly one module definition. @@ -107,7 +107,6 @@ The first creates a new test scripts where all embedded modules are converted to The last invocation produces an equivalent, self-contained JavaScript test file. The flag `-h` can be used to omit the test harness from the converted file; it then is the client's responsibility to provide versions of the necessary functions. -By default, the generated script will not require `assert_soft_invalid` (see below) to detect validation failures. Use the `-c` flag ("checked hard") to activate these assertions for full validity checks. #### Command Line Expressions @@ -119,10 +118,10 @@ wasm module.wasm -e '(invoke "foo")' #### Interactive Mode -If neither a file nor any of the previous options is given, you'll land in the REPL and can enter script commands interactively. You can also get into the REPL by explicitly passing `-` as a file name. You can do that in combination to giving a module file, so that you can then invoke its exports interactively, e.g.: +If neither a file nor any of the previous options is given, you'll land in the REPL and can enter script commands interactively. You can also get into the REPL by explicitly passing `-` as a file name. You can do that in combination to giving a module or script file, so that you can then invoke its exports interactively, e.g.: ``` -wasm module.wast - +wasm module.wat - ``` See `wasm -h` for (the few) additional options. @@ -130,7 +129,7 @@ See `wasm -h` for (the few) additional options. #### JavaScript Library #### -The file `wast.js` generated by the respective (Makefile target)[cross-compiling-the-interpreter-to-javascript] is a self-contained JavaScript library for making the [S-expression syntax](s-expression-syntax) available directly within JavaScript. +The file `wast.js` generated by the respective [Makefile target](#cross-compiling-the-interpreter-to-javascript) is a self-contained JavaScript library for making the [S-expression syntax](#s-expression-syntax) available directly within JavaScript. It provides a global object named `WebAssemblyText` that currently provides two methods, ``` WebAssemblyText.encode(source) @@ -143,7 +142,7 @@ which pretty-prints a binary back into a canonicalised S-expression string. For example: ``` -let source = '(module (func (export "f") (param i32 i32) (result i32) (i32.add (get_local 0) (get_local 1))))' +let source = '(module (func (export "f") (param i32 i32) (result i32) (i32.add (local.get 0) (local.get 1))))' let binary = WebAssemblyText.encode(source) (new WebAssembly.Instance(new WebAssembly.Module(binary))).exports.f(3, 4) @@ -153,7 +152,7 @@ WebAssemblyText.decode(binary) // => // (module // (type $0 (func (param i32 i32) (result i32))) -// (func $0 (type 0) (get_local 0) (get_local 1) (i32.add)) +// (func $0 (type 0) (local.get 0) (local.get 1) (i32.add)) // (export "f" (func 0)) // ) ``` @@ -161,47 +160,53 @@ WebAssemblyText.decode(binary) ## S-Expression Syntax -The implementation consumes a WebAssembly AST given in S-expression syntax. Here is an overview of the grammar of types, expressions, functions, and modules, mirroring what's described in the [design doc](https://github.com/WebAssembly/design/blob/master/Semantics.md): +The implementation consumes a WebAssembly AST given in S-expression syntax. Here is an overview of the grammar of types, expressions, functions, and modules, mirroring what's described in the [design doc](https://github.com/WebAssembly/design/blob/master/Semantics.md). +Note: The grammar is shown here for convenience, the definite source is the [specification of the text format](https://webassembly.github.io/spec/core/text/). ``` -value: | -var: | -name: $( | | _ | . | + | - | * | / | \ | ^ | ~ | = | < | > | ! | ? | @ | # | $ | % | & | | | : | ' | `)+ -string: "( | \n | \t | \\ | \' | \" | \)*" +num: (_? )* +hexnum: (_? )* +nat: | 0x +int: | + | - +float: .?(e|E )? | 0x.?(p|P )? +name: $( | | _ | . | + | - | * | / | \ | ^ | ~ | = | < | > | ! | ? | @ | # | $ | % | & | | | : | ' | `)+ +string: "( | \n | \t | \\ | \' | \" | \ | \u{+})*" -type: i32 | i64 | f32 | f64 -elem_type: anyfunc +num: | +var: | unop: ctz | clz | popcnt | ... binop: add | sub | mul | ... relop: eq | ne | lt | ... -sign: s|u +sign: s|u offset: offset= align: align=(1|2|4|8|...) -cvtop: trunc_s | trunc_u | extend_s | extend_u | ... +cvtop: trunc | extend | wrap | ... -block_sig : * -func_sig: ( type )? * * -global_sig: | ( mut ) -table_sig: ? -memory_sig: ? +num_type: i32 | i64 | f32 | f64 +ref_type: anyref | funcref | nullref +val_type: num_type | ref_type +block_type : ( result * )* +func_type: ( type )? * * +global_type: | ( mut ) +table_type: ? +memory_type: ? expr: ( ) ( + ) ;; = + () - ( block ? ? * ) - ( loop ? ? * ) - ( if ? ? ( then * ) ( else * )? ) - ( if ? ? ( then * ) ( else * )? ) ;; = (if ? ? (then *) (else *)?) - ( if ? ? ? ) ;; = (if ? ? (then ) (else ?)) + ( block ? * ) + ( loop ? * ) + ( if ? ( then * ) ( else * )? ) + ( if ? + ( then * ) ( else * )? ) ;; = + (if ? (then *) (else *)?) instr: ;; = () - block ? ? * end ? ;; = (block ? ? *) - loop ? ? * end ? ;; = (loop ? ? *) - if ? ? * end ? ;; = (if ? ? (then *)) - if ? ? * else ? * end ? ;; = (if ? ? (then *) (else *)) + block ? * end ? ;; = (block ? *) + loop ? * end ? ;; = (loop ? *) + if ? * end ? ;; = (if ? (then *)) + if ? * else ? * end ? ;; = (if ? (then *) (else *)) op: unreachable @@ -211,65 +216,74 @@ op: br_table + return call - call_indirect + call_indirect drop select - get_local - set_local - tee_local - get_global - set_global - .load((8|16|32)_)? ? ? - .store(8|16|32)? ? ? - current_memory - grow_memory - .const - . - . - . - . - ./ - -func: ( func ? * * ) - ( func ? ( export ) * * ) ;; = (export (func )) (func ? * *) - ( func ? ( import ) ) ;; = (import ? (func )) -param: ( param * ) | ( param ) -result: ( result ) -local: ( local * ) | ( local ) - -global: ( global ? * ) - ( global ? ( export ) * ) ;; = (export (global )) (global ? *) - ( global ? ( import ) ) ;; = (import ? (global )) -table: ( table ? ) - ( table ? ( export ) ) ;; = (export (table )) (table ? ) - ( table ? ( import ) ) ;; = (import ? (table )) - ( table ? ( export )? ( elem * ) ) ;; = (table ? ( export )? ) (elem (i32.const 0) *) + local.get + local.set + local.tee + global.get + global.set + table.get + table.set + table.size + table.grow + table.fill + .load((8|16|32)_)? ? ? + .store(8|16|32)? ? ? + memory.size + memory.grow + ref.null + ref.isnull + ref.func + .const + . + . + . + . + ._(_)? + +func: ( func ? * * ) + ( func ? ( export ) <...> ) ;; = (export (func )) (func ? <...>) + ( func ? ( import ) ) ;; = (import ? (func )) +param: ( param * ) | ( param ) +result: ( result * ) +local: ( local * ) | ( local ) + +global: ( global ? * ) + ( global ? ( export ) <...> ) ;; = (export (global )) (global ? <...>) + ( global ? ( import ) ) ;; = (import ? (global )) +table: ( table ? ) + ( table ? ( export ) <...> ) ;; = (export (table )) (table ? <...>) + ( table ? ( import ) ) ;; = (import ? (table )) + ( table ? ( export )* ( elem * ) ) ;; = (table ? ( export )* ) (elem (i32.const 0) *) elem: ( elem ? (offset * ) * ) ( elem ? * ) ;; = (elem ? (offset ) *) -memory: ( memory ? ) - ( memory ? ( export ) ) ;; = (export (memory )) (memory ? ) - ( memory ? ( import ) ) ;; = (import ? (memory )) - ( memory ? ( export )? ( data * ) ;; = (memory ? ( export )? ) (data (i32.const 0) *) +memory: ( memory ? ) + ( memory ? ( export ) <...> ) ;; = (export (memory ))+ (memory ? <...>) + ( memory ? ( import ) ) ;; = (import ? (memory )) + ( memory ? ( export )* ( data * ) ) ;; = (memory ? ( export )* ) (data (i32.const 0) *) data: ( data ? ( offset * ) * ) ( data ? * ) ;; = (data ? (offset ) *) start: ( start ) -typedef: ( type ? ( func ) ) +typedef: ( type ? ( func * * ) ) import: ( import ) -imkind: ( func ? ) - ( global ? ) - ( table ? ) - ( memory ? ) +imkind: ( func ? ) + ( global ? ) + ( table ? ) + ( memory ? ) export: ( export ) exkind: ( func ) ( global ) ( table ) ( memory ) -module: ( module ? * * * * ? ? * * * ? ) - ( module ? + ) +module: ( module ? * * * *
* ? * * * ? ) + * * * *
* ? * * * ? ;; = + ( module * * * *
* ? * * * ? ) ``` Here, productions marked with respective comments are abbreviation forms for equivalent expansions (see the explanation of the AST below). @@ -278,11 +292,11 @@ For raw instructions, the syntax allows omitting the parentheses around the oper Any form of naming via `` and `` (including expression labels) is merely notational convenience of this text format. The actual AST has no names, and all bindings are referred to via ordered numeric indices; consequently, names are immediately resolved in the parser and replaced by indices. Indices can also be used directly in the text format. -A module of the form `(module +)` is given in binary form and will be decoded from the (concatenation of the) strings. - The segment strings in the memory field are used to initialize the consecutive memory at the given offset. The `` in the expansion of the two short-hand forms for `table` and `memory` is the minimal size that can hold the segment: the number of ``s for tables, and the accumulative length of the strings rounded up to page size for memories. +In addition to the grammar rules above, the fields of a module may appear in any order, except that all imports must occur before the first proper definition of a function, table, memory, or global. + Comments can be written in one of two ways: ``` @@ -309,18 +323,28 @@ module with given failure string ;; assert result of an action ;; meta command +module: + ... + ( module ? binary * ) ;; module in binary format (may be malformed) + ( module ? quote * ) ;; module quoted in text (may be malformed) + action: - ( invoke ? * ) ;; invoke function export + ( invoke ? * ) ;; invoke function export ( get ? ) ;; get global export +const: + ( .const ) ;; number value + ( ref.null ) ;; null reference + ( ref.host ) ;; host reference + assertion: - ( assert_return * ) ;; assert action has expected results + ( assert_return * ) ;; assert action has expected results ( assert_return_canonical_nan ) ;; assert action results in NaN in a canonical form ( assert_return_arithmetic_nan ) ;; assert action results in NaN with 1 in MSB of fraction field ( assert_trap ) ;; assert action traps with given failure string + ( assert_exhaustion ) ;; assert action exhausts system resources ( assert_malformed ) ;; assert module cannot be decoded with given failure string ( assert_invalid ) ;; assert module is invalid with given failure string - ( assert_soft_invalid ) ;; assert module is for cases that are not required to be checked ( assert_unlinkable ) ;; assert module fails to link ( assert_trap ) ;; assert module traps on instantiation @@ -333,31 +357,46 @@ Commands are executed in sequence. Commands taking an optional module name refer After a module is _registered_ under a string name it is available for importing in other modules. +The script format supports additional syntax for defining modules. +A module of the form `(module binary *)` is given in binary form and will be decoded from the (concatenation of the) strings. +A module of the form `(module quote *)` is given in textual form and will be parsed from the (concatenation of the) strings. In both cases, decoding/parsing happens when the command is executed, not when the script is parsed, so that meta commands like `assert_malformed` can be used to check expected errors. + There are also a number of meta commands. The `script` command is a simple mechanism to name sub-scripts themselves. This is mainly useful for converting scripts with the `output` command. Commands inside a `script` will be executed normally, but nested meta are expanded in place (`input`, recursively) or elided (`output`) in the named script. -The `input` and `output` meta commands determine the requested file format from the file name extension. They can handle both `.wast` and `.wasm` files. In the case of input, a `.wast` script will be recursively executed. Output additionally handles `.js` as a target, which will convert the referenced script to an equivalent, self-contained JavaScript runner. It also recognises `.bin.wast` specially, which creates a script where module definitions are in binary. +The `input` and `output` meta commands determine the requested file format from the file name extension. They can handle both `.wasm`, `.wat`, and `.wast` files. In the case of input, a `.wast` script will be recursively executed. Output additionally handles `.js` as a target, which will convert the referenced script to an equivalent, self-contained JavaScript runner. It also recognises `.bin.wast` specially, which creates a script where module definitions are in binary. The interpreter supports a "dry" mode (flag `-d`), in which modules are only validated. In this mode, all actions and assertions are ignored. It also supports an "unchecked" mode (flag `-u`), in which module definitions are not validated before use. -Finally, "checked hard" mode (flag `-c`), will require `assert_soft_valid` assertions to succeed. When outputing JavaScript scripts, this flag also controls how the created script implements this assertions. ## Abstract Syntax -The abstract WebAssembly syntax, as described above and in the [design doc](https://github.com/WebAssembly/design/blob/master/Semantics.md), is defined in [ast.ml](spec/ast.ml). +The abstract WebAssembly syntax, as described above and in the [design doc](https://github.com/WebAssembly/design/blob/master/Semantics.md), is defined in [ast.ml](syntax/ast.ml). -However, to simplify the implementation, this AST representation represents some of the inner structure of the operators more explicitly. The mapping from the operators as given in the design doc to their structured form is defined in [operators.ml](spec/operators.ml). +However, to simplify the implementation, this AST representation represents some of the inner structure of the operators more explicitly. The mapping from the operators as given in the design doc to their structured form is defined in [operators.ml](syntax/operators.ml). ## Implementation -The implementation is split into four directories: +The implementation is split into several directories: + +* `syntax`: the definition of abstract syntax; corresponds to the "Structure" section of the language specification + +* `valid`: validation of code and modules; corresponds to the "Validation" section of the language specification + +* `runtime`: the definition of runtime structures; corresponds to the "Execution/Runtime" section of the language specification + +* `exec`: execution and module instantiation; corresponds to the "Execution" section of the language specification + +* `binary`: encoding and decoding of the binary format; corresponds to the "Binary Format" section of the language specification + +* `text`: parsing and printing the S-expressions text format; corresponds to the "Text Format" section of the language specification -* `spec`: the part of the implementation that corresponds to the actual language specification. +* `script`: abstract syntax and execution of the extended script language -* `text`: parsing and printing the S-expressions text format. +* `host`: definition of host environment modules -* `host`: infrastructure for loading and running scripts and defining host environment modules. +* `main`: main program * `util`: utility libraries. @@ -373,7 +412,7 @@ The implementation consists of the following parts: * *Validator* (`valid.ml[i]`). Does a recursive walk of the AST, passing down the *expected* type for expressions, and checking each expression against that. An expected empty type can be matched by any result, corresponding to implicit dropping of unused values (e.g. in a block). -* *Evaluator* (`eval.ml[i]`, `values.ml`, `instance.ml`, `eval_numeric.ml[i]`, `int.ml`, `float.ml`, `table.ml[i]`, `memory.ml[i]`, and a few more). Implements evaluation as a small-step semantics that rewrites a program one computation step at a time. +* *Evaluator* (`eval.ml[i]`, `values.ml`, `func.ml[i]`, `table.ml[i]`, `memory.ml[i]`, `global.ml[i]`, `instance.ml`, `eval_numeric.ml[i]`, `int.ml`, `float.ml`, and a few more). Implements evaluation as a small-step semantics that rewrites a program one computation step at a time. * *JS Generator* (`js.ml[i]`). Converts a script to equivalent JavaScript. diff --git a/interpreter/_tags b/interpreter/_tags deleted file mode 100644 index 2ad0cbd8..00000000 --- a/interpreter/_tags +++ /dev/null @@ -1,2 +0,0 @@ -true: bin_annot -<{util,spec,text,host,host/import}/*.cmx>: for-pack(Wasm) diff --git a/interpreter/spec/decode.ml b/interpreter/binary/decode.ml similarity index 79% rename from interpreter/spec/decode.ml rename to interpreter/binary/decode.ml index 2cca1245..674240bb 100644 --- a/interpreter/spec/decode.ml +++ b/interpreter/binary/decode.ml @@ -16,7 +16,7 @@ let pos s = !(s.pos) let eos s = (pos s = len s) let check n s = if pos s + n > len s then raise EOS -let skip n s = check n s; s.pos := !(s.pos) + n +let skip n s = if n < 0 then raise EOS else check n s; s.pos := !(s.pos) + n let read s = Char.code (s.bytes.[!(s.pos)]) let peek s = if eos s then None else Some (read s) @@ -39,7 +39,7 @@ let error s pos msg = raise (Code (region s pos pos, msg)) let require b s pos msg = if not b then error s pos msg let guard f s = - try f s with EOS -> error s (len s) "unexpected end of binary or function" + try f s with EOS -> error s (len s) "unexpected end of section or function" let get = guard get let get_string n = guard (get_string n) @@ -47,6 +47,8 @@ let skip n = guard (skip n) let expect b s msg = require (guard get s = b) s (pos s - 1) msg let illegal s pos b = error s pos ("illegal opcode " ^ string_of_byte b) +let illegal2 s pos b1 b2 = + error s pos ("illegal opcode " ^ string_of_byte b1 ^ " " ^ string_of_byte b2) let at f s = let left = pos s in @@ -72,8 +74,8 @@ let u32 s = Int32.(add lo (shift_left hi 16)) let u64 s = - let lo = Int64.of_int32 (u32 s) in - let hi = Int64.of_int32 (u32 s) in + let lo = I64_convert.extend_i32_u (u32 s) in + let hi = I64_convert.extend_i32_u (u32 s) in Int64.(add lo (shift_left hi 32)) let rec vuN n s = @@ -86,7 +88,7 @@ let rec vuN n s = let rec vsN n s = require (n > 0) s (pos s) "integer representation too long"; let b = u8 s in - let mask = (-1 lsl n) land 0x7f in + let mask = (-1 lsl (n - 1)) land 0x7f in require (n >= 7 || b land mask = 0 || b land mask = mask) s (pos s - 1) "integer too large"; let x = Int64.of_int (b land 0x7f) in @@ -105,7 +107,7 @@ let f64 s = F64.of_bits (u64 s) let len32 s = let pos = pos s in let n = vu32 s in - if n <= Int32.of_int (len s) then Int32.to_int n else + if I32.le_u n (Int32.of_int (len s)) then Int32.to_int n else error s pos "length out of bounds" let bool s = (vu1 s = 1) @@ -114,6 +116,11 @@ let rec list f n s = if n = 0 then [] else let x = f s in x :: list f (n - 1) s let opt f b s = if b then Some (f s) else None let vec f s = let n = len32 s in list f n s +let name s = + let pos = pos s in + try Utf8.decode (string s) with Utf8.Utf8 -> + error s pos "invalid UTF-8 encoding" + let sized f s = let size = len32 s in let start = pos s in @@ -126,18 +133,25 @@ let sized f s = open Types -let value_type s = +let num_type s = match vs7 s with | -0x01 -> I32Type | -0x02 -> I64Type | -0x03 -> F32Type | -0x04 -> F64Type - | _ -> error s (pos s - 1) "invalid value type" + | _ -> error s (pos s - 1) "invalid number type" -let elem_type s = +let ref_type s = match vs7 s with - | -0x10 -> AnyFuncType - | _ -> error s (pos s - 1) "invalid element type" + | -0x10 -> FuncRefType + | -0x11 -> AnyRefType + | -0x12 -> NullRefType + | _ -> error s (pos s - 1) "invalid reference type" + +let value_type s = + match peek s with + | Some n when n > 0x70 -> NumType (num_type s) + | _ -> RefType (ref_type s) let stack_type s = match peek s with @@ -159,7 +173,7 @@ let limits vu s = {min; max} let table_type s = - let t = elem_type s in + let t = ref_type s in let lim = limits vu32 s in TableType (lim, t) @@ -238,24 +252,27 @@ let rec instr s = | 0x10 -> call (at var s) | 0x11 -> + let y = at var s in let x = at var s in - expect 0x00 s "zero flag expected"; - call_indirect x + call_indirect x y | 0x12 | 0x13 | 0x14 | 0x15 | 0x16 | 0x17 | 0x18 | 0x19 as b -> illegal s pos b | 0x1a -> drop - | 0x1b -> select + | 0x1b -> select None + | 0x1c -> select (Some (vec value_type s)) - | 0x1c | 0x1d | 0x1e | 0x1f as b -> illegal s pos b + | 0x1d | 0x1e | 0x1f as b -> illegal s pos b - | 0x20 -> get_local (at var s) - | 0x21 -> set_local (at var s) - | 0x22 -> tee_local (at var s) - | 0x23 -> get_global (at var s) - | 0x24 -> set_global (at var s) + | 0x20 -> local_get (at var s) + | 0x21 -> local_set (at var s) + | 0x22 -> local_tee (at var s) + | 0x23 -> global_get (at var s) + | 0x24 -> global_set (at var s) + | 0x25 -> table_get (at var s) + | 0x26 -> table_set (at var s) - | 0x25 | 0x26 | 0x27 as b -> illegal s pos b + | 0x27 as b -> illegal s pos b | 0x28 -> let a, o = memop s in i32_load a o | 0x29 -> let a, o = memop s in i64_load a o @@ -284,10 +301,10 @@ let rec instr s = | 0x3f -> expect 0x00 s "zero flag expected"; - current_memory + memory_size | 0x40 -> expect 0x00 s "zero flag expected"; - grow_memory + memory_grow | 0x41 -> i32_const (at vs32 s) | 0x42 -> i64_const (at vs64 s) @@ -401,25 +418,25 @@ let rec instr s = | 0xa6 -> f64_copysign | 0xa7 -> i32_wrap_i64 - | 0xa8 -> i32_trunc_s_f32 - | 0xa9 -> i32_trunc_u_f32 - | 0xaa -> i32_trunc_s_f64 - | 0xab -> i32_trunc_u_f64 - | 0xac -> i64_extend_s_i32 - | 0xad -> i64_extend_u_i32 - | 0xae -> i64_trunc_s_f32 - | 0xaf -> i64_trunc_u_f32 - | 0xb0 -> i64_trunc_s_f64 - | 0xb1 -> i64_trunc_u_f64 - | 0xb2 -> f32_convert_s_i32 - | 0xb3 -> f32_convert_u_i32 - | 0xb4 -> f32_convert_s_i64 - | 0xb5 -> f32_convert_u_i64 + | 0xa8 -> i32_trunc_f32_s + | 0xa9 -> i32_trunc_f32_u + | 0xaa -> i32_trunc_f64_s + | 0xab -> i32_trunc_f64_u + | 0xac -> i64_extend_i32_s + | 0xad -> i64_extend_i32_u + | 0xae -> i64_trunc_f32_s + | 0xaf -> i64_trunc_f32_u + | 0xb0 -> i64_trunc_f64_s + | 0xb1 -> i64_trunc_f64_u + | 0xb2 -> f32_convert_i32_s + | 0xb3 -> f32_convert_i32_u + | 0xb4 -> f32_convert_i64_s + | 0xb5 -> f32_convert_i64_u | 0xb6 -> f32_demote_f64 - | 0xb7 -> f64_convert_s_i32 - | 0xb8 -> f64_convert_u_i32 - | 0xb9 -> f64_convert_s_i64 - | 0xba -> f64_convert_u_i64 + | 0xb7 -> f64_convert_i32_s + | 0xb8 -> f64_convert_i32_u + | 0xb9 -> f64_convert_i64_s + | 0xba -> f64_convert_i64_u | 0xbb -> f64_promote_f32 | 0xbc -> i32_reinterpret_f32 @@ -427,6 +444,23 @@ let rec instr s = | 0xbe -> f32_reinterpret_i32 | 0xbf -> f64_reinterpret_i64 + | 0xc0 | 0xc1 | 0xc2 | 0xc3 | 0xc4 | 0xc5 | 0xc6 | 0xc7 + | 0xc8 | 0xc9 | 0xca | 0xcb | 0xcc | 0xcd | 0xce | 0xcf as b -> illegal s pos b + + (* TODO: Allocate more adequate opcodes *) + | 0xd0 -> ref_null + | 0xd1 -> ref_is_null + | 0xd2 -> ref_func (at var s) + + | 0xfc as b1 -> + (match op s with + | 0x0f -> table_grow (at var s) + | 0x10 -> table_size (at var s) + | 0x11 -> table_fill (at var s) + + | b2 -> illegal2 s pos b1 b2 + ) + | b -> illegal s pos b and instr_block s = List.rev (instr_block' s []) @@ -476,8 +510,10 @@ let section tag f default s = (* Type section *) +let type_ s = at func_type s + let type_section s = - section `TypeSection (vec func_type) [] s + section `TypeSection (vec type_) [] s (* Import section *) @@ -491,8 +527,8 @@ let import_desc s = | _ -> error s (pos s - 1) "invalid import kind" let import s = - let module_name = string s in - let item_name = string s in + let module_name = name s in + let item_name = name s in let idesc = at import_desc s in {module_name; item_name; idesc} @@ -515,6 +551,10 @@ let table s = let table_section s = section `TableSection (vec (at table)) [] s +let elem_kind s = + match vs7 s with + | 0x00 -> FuncRefType + | _ -> error s (pos s - 1) "invalid elem kind" (* Memory section *) @@ -548,7 +588,7 @@ let export_desc s = | _ -> error s (pos s - 1) "invalid export kind" let export s = - let name = string s in + let name = name s in let edesc = at export_desc s in {name; edesc} @@ -565,12 +605,17 @@ let start_section s = (* Code section *) let local s = - let n = len32 s in + let n = vu32 s in let t = value_type s in - Lib.List.make n t + n, t let code _ s = - let locals = List.flatten (vec local s) in + let pos = pos s in + let nts = vec local s in + let ns = List.map (fun (n, _) -> I64_convert.extend_i32_u n) nts in + require (I64.lt_u (List.fold_left I64.add 0L ns) 0x1_0000_0000L) + s pos "too many locals"; + let locals = List.flatten (List.map (Lib.Fun.uncurry Lib.List32.make) nts) in let body = instr_block s in end_ s; {locals; body; ftype = Source.((-1l) @@ Source.no_region)} @@ -581,14 +626,24 @@ let code_section s = (* Element section *) -let segment dat s = - let index = at var s in - let offset = const s in - let init = dat s in - {index; offset; init} +let segment dat kind s = + let pos = pos s in + match vu32 s with + | 0l -> + let index = Source.(0l @@ Source.no_region) in + let offset = const s in + let init = dat s in + {index; offset; init} + | 2l -> + let index = at var s in + let offset = const s in + let _ = kind s in + let init = dat s in + {index; offset; init} + | _ -> error s pos "invalid segment kind" let table_segment s = - segment (vec (at var)) s + segment (vec (at var)) elem_kind s let elem_section s = section `ElemSection (vec (at table_segment)) [] s @@ -597,7 +652,7 @@ let elem_section s = (* Data section *) let memory_segment s = - segment string s + segment string (fun s -> ()) s let data_section s = section `DataSection (vec (at memory_segment)) [] s @@ -607,7 +662,7 @@ let data_section s = let custom size s = let start = pos s in - let _id = string s in + let _id = name s in skip (size - (pos s - start)) s; true diff --git a/interpreter/binary/decode.mli b/interpreter/binary/decode.mli new file mode 100644 index 00000000..96a204ed --- /dev/null +++ b/interpreter/binary/decode.mli @@ -0,0 +1,3 @@ +exception Code of Source.region * string + +val decode : string -> string -> Ast.module_ (* raises Code *) diff --git a/interpreter/spec/encode.ml b/interpreter/binary/encode.ml similarity index 83% rename from interpreter/spec/encode.ml rename to interpreter/binary/encode.ml index c93e71ed..f44df215 100644 --- a/interpreter/spec/encode.ml +++ b/interpreter/binary/encode.ml @@ -71,6 +71,7 @@ let encode m = let bool b = vu1 (if b then 1 else 0) let string bs = len (String.length bs); put_string s bs + let name n = string (Utf8.encode n) let list f xs = List.iter f xs let opt f xo = Lib.Option.app f xo let vec f xs = len (List.length xs); list f xs @@ -89,14 +90,21 @@ let encode m = open Types - let value_type = function + let num_type = function | I32Type -> vs7 (-0x01) | I64Type -> vs7 (-0x02) | F32Type -> vs7 (-0x03) | F64Type -> vs7 (-0x04) - let elem_type = function - | AnyFuncType -> vs7 (-0x10) + let ref_type = function + | FuncRefType -> vs7 (-0x10) + | AnyRefType -> vs7 (-0x11) + | NullRefType -> vs7 (-0x12) + + let value_type = function + | NumType t -> num_type t + | RefType t -> ref_type t + | BotType -> assert false let stack_type = function | [] -> vs7 (-0x40) @@ -106,13 +114,14 @@ let encode m = "cannot encode stack type with arity > 1 (yet)" let func_type = function - | FuncType (ins, out) -> vs7 (-0x20); vec value_type ins; vec value_type out + | FuncType (ins, out) -> + vs7 (-0x20); vec value_type ins; vec value_type out let limits vu {min; max} = bool (max <> None); vu min; opt vu max let table_type = function - | TableType (lim, t) -> elem_type t; limits vu32 lim + | TableType (lim, t) -> ref_type t; limits vu32 lim let memory_type = function | MemoryType lim -> limits vu32 lim @@ -155,42 +164,49 @@ let encode m = | BrTable (xs, x) -> op 0x0e; vec var xs; var x | Return -> op 0x0f | Call x -> op 0x10; var x - | CallIndirect x -> op 0x11; var x; u8 0x00 + | CallIndirect (x, y) -> op 0x11; var y; var x | Drop -> op 0x1a - | Select -> op 0x1b + | Select None -> op 0x1b + | Select (Some ts) -> op 0x1c; vec value_type ts - | GetLocal x -> op 0x20; var x - | SetLocal x -> op 0x21; var x - | TeeLocal x -> op 0x22; var x - | GetGlobal x -> op 0x23; var x - | SetGlobal x -> op 0x24; var x + | LocalGet x -> op 0x20; var x + | LocalSet x -> op 0x21; var x + | LocalTee x -> op 0x22; var x + | GlobalGet x -> op 0x23; var x + | GlobalSet x -> op 0x24; var x + + | TableGet x -> op 0x25; var x + | TableSet x -> op 0x26; var x + | TableSize x -> op 0xfc; op 0x10; var x + | TableGrow x -> op 0xfc; op 0x0f; var x + | TableFill x -> op 0xfc; op 0x11; var x | Load ({ty = I32Type; sz = None; _} as mo) -> op 0x28; memop mo | Load ({ty = I64Type; sz = None; _} as mo) -> op 0x29; memop mo | Load ({ty = F32Type; sz = None; _} as mo) -> op 0x2a; memop mo | Load ({ty = F64Type; sz = None; _} as mo) -> op 0x2b; memop mo - | Load ({ty = I32Type; sz = Some (Mem8, SX); _} as mo) -> + | Load ({ty = I32Type; sz = Some (Pack8, SX); _} as mo) -> op 0x2c; memop mo - | Load ({ty = I32Type; sz = Some (Mem8, ZX); _} as mo) -> + | Load ({ty = I32Type; sz = Some (Pack8, ZX); _} as mo) -> op 0x2d; memop mo - | Load ({ty = I32Type; sz = Some (Mem16, SX); _} as mo) -> + | Load ({ty = I32Type; sz = Some (Pack16, SX); _} as mo) -> op 0x2e; memop mo - | Load ({ty = I32Type; sz = Some (Mem16, ZX); _} as mo) -> + | Load ({ty = I32Type; sz = Some (Pack16, ZX); _} as mo) -> op 0x2f; memop mo - | Load {ty = I32Type; sz = Some (Mem32, _); _} -> + | Load {ty = I32Type; sz = Some (Pack32, _); _} -> assert false - | Load ({ty = I64Type; sz = Some (Mem8, SX); _} as mo) -> + | Load ({ty = I64Type; sz = Some (Pack8, SX); _} as mo) -> op 0x30; memop mo - | Load ({ty = I64Type; sz = Some (Mem8, ZX); _} as mo) -> + | Load ({ty = I64Type; sz = Some (Pack8, ZX); _} as mo) -> op 0x31; memop mo - | Load ({ty = I64Type; sz = Some (Mem16, SX); _} as mo) -> + | Load ({ty = I64Type; sz = Some (Pack16, SX); _} as mo) -> op 0x32; memop mo - | Load ({ty = I64Type; sz = Some (Mem16, ZX); _} as mo) -> + | Load ({ty = I64Type; sz = Some (Pack16, ZX); _} as mo) -> op 0x33; memop mo - | Load ({ty = I64Type; sz = Some (Mem32, SX); _} as mo) -> + | Load ({ty = I64Type; sz = Some (Pack32, SX); _} as mo) -> op 0x34; memop mo - | Load ({ty = I64Type; sz = Some (Mem32, ZX); _} as mo) -> + | Load ({ty = I64Type; sz = Some (Pack32, ZX); _} as mo) -> op 0x35; memop mo | Load {ty = F32Type | F64Type; sz = Some _; _} -> assert false @@ -199,16 +215,16 @@ let encode m = | Store ({ty = I64Type; sz = None; _} as mo) -> op 0x37; memop mo | Store ({ty = F32Type; sz = None; _} as mo) -> op 0x38; memop mo | Store ({ty = F64Type; sz = None; _} as mo) -> op 0x39; memop mo - | Store ({ty = I32Type; sz = Some Mem8; _} as mo) -> op 0x3a; memop mo - | Store ({ty = I32Type; sz = Some Mem16; _} as mo) -> op 0x3b; memop mo - | Store {ty = I32Type; sz = Some Mem32; _} -> assert false - | Store ({ty = I64Type; sz = Some Mem8; _} as mo) -> op 0x3c; memop mo - | Store ({ty = I64Type; sz = Some Mem16; _} as mo) -> op 0x3d; memop mo - | Store ({ty = I64Type; sz = Some Mem32; _} as mo) -> op 0x3e; memop mo + | Store ({ty = I32Type; sz = Some Pack8; _} as mo) -> op 0x3a; memop mo + | Store ({ty = I32Type; sz = Some Pack16; _} as mo) -> op 0x3b; memop mo + | Store {ty = I32Type; sz = Some Pack32; _} -> assert false + | Store ({ty = I64Type; sz = Some Pack8; _} as mo) -> op 0x3c; memop mo + | Store ({ty = I64Type; sz = Some Pack16; _} as mo) -> op 0x3d; memop mo + | Store ({ty = I64Type; sz = Some Pack32; _} as mo) -> op 0x3e; memop mo | Store {ty = F32Type | F64Type; sz = Some _; _} -> assert false - | CurrentMemory -> op 0x3f; u8 0x00 - | GrowMemory -> op 0x40; u8 0x00 + | MemorySize -> op 0x3f; u8 0x00 + | MemoryGrow -> op 0x40; u8 0x00 | Const {it = I32 c; _} -> op 0x41; vs32 c | Const {it = I64 c; _} -> op 0x42; vs64 c @@ -362,6 +378,11 @@ let encode m = | Convert (F64 F64Op.DemoteF64) -> assert false | Convert (F64 F64Op.ReinterpretInt) -> op 0xbf + (* TODO: Allocate more adequate opcodes *) + | RefNull -> op 0xd0 + | RefIsNull -> op 0xd1 + | RefFunc x -> op 0xd2; var x + let const c = list instr c.it; end_ () @@ -377,8 +398,10 @@ let encode m = end (* Type section *) + let type_ t = func_type t.it + let type_section ts = - section 1 (vec func_type) ts (ts <> []) + section 1 (vec type_) ts (ts <> []) (* Import section *) let import_desc d = @@ -390,7 +413,7 @@ let encode m = let import im = let {module_name; item_name; idesc} = im.it in - string module_name; string item_name; import_desc idesc + name module_name; name item_name; import_desc idesc let import_section ims = section 2 (vec import) ims (ims <> []) @@ -434,8 +457,8 @@ let encode m = | GlobalExport x -> u8 3; var x let export ex = - let {name; edesc} = ex.it in - string name; export_desc edesc + let {name = n; edesc} = ex.it in + name n; export_desc edesc let export_section exs = section 7 (vec export) exs (exs <> []) @@ -467,8 +490,11 @@ let encode m = (* Element section *) let segment dat seg = - let {index; offset; init} = seg.it in - var index; const offset; dat init + match seg.it with + | {index; offset; init} when index.it = 0l -> + u8 0x00; const offset; dat init + | {index; offset; init} -> + u8 0x02; var index; const offset; u8 0x00; dat init let table_segment seg = segment (vec var) seg diff --git a/interpreter/spec/encode.mli b/interpreter/binary/encode.mli similarity index 100% rename from interpreter/spec/encode.mli rename to interpreter/binary/encode.mli diff --git a/interpreter/binary/utf8.ml b/interpreter/binary/utf8.ml new file mode 100644 index 00000000..5cf17997 --- /dev/null +++ b/interpreter/binary/utf8.ml @@ -0,0 +1,42 @@ +exception Utf8 + +let con n = 0x80 lor (n land 0x3f) + +let rec encode ns = Lib.String.implode (List.map Char.chr (encode' ns)) +and encode' = function + | [] -> [] + | n::ns when n < 0 -> + raise Utf8 + | n::ns when n < 0x80 -> + n :: encode' ns + | n::ns when n < 0x800 -> + 0xc0 lor (n lsr 6) :: con n :: encode' ns + | n::ns when n < 0x10000 -> + 0xe0 lor (n lsr 12) :: con (n lsr 6) :: con n :: encode' ns + | n::ns when n < 0x110000 -> + 0xf0 lor (n lsr 18) :: con (n lsr 12) :: con (n lsr 6) :: con n + :: encode' ns + | _ -> + raise Utf8 + +let con b = if b land 0xc0 = 0x80 then b land 0x3f else raise Utf8 +let code min n = + if n < min || (0xd800 <= n && n < 0xe000) || n >= 0x110000 then raise Utf8 + else n + +let rec decode s = decode' (List.map Char.code (Lib.String.explode s)) +and decode' = function + | [] -> [] + | b1::bs when b1 < 0x80 -> + code 0x0 b1 :: decode' bs + | b1::bs when b1 < 0xc0 -> + raise Utf8 + | b1::b2::bs when b1 < 0xe0 -> + code 0x80 ((b1 land 0x1f) lsl 6 + con b2) :: decode' bs + | b1::b2::b3::bs when b1 < 0xf0 -> + code 0x800 ((b1 land 0x0f) lsl 12 + con b2 lsl 6 + con b3) :: decode' bs + | b1::b2::b3::b4::bs when b1 < 0xf8 -> + code 0x10000 ((b1 land 0x07) lsl 18 + con b2 lsl 12 + con b3 lsl 6 + con b4) + :: decode' bs + | _ -> + raise Utf8 diff --git a/interpreter/binary/utf8.mli b/interpreter/binary/utf8.mli new file mode 100644 index 00000000..3b5994a3 --- /dev/null +++ b/interpreter/binary/utf8.mli @@ -0,0 +1,4 @@ +exception Utf8 + +val decode : string -> int list (* raises Utf8 *) +val encode : int list -> string (* raises Utf8 *) diff --git a/interpreter/exec/eval.ml b/interpreter/exec/eval.ml new file mode 100644 index 00000000..f690761b --- /dev/null +++ b/interpreter/exec/eval.ml @@ -0,0 +1,502 @@ +open Values +open Types +open Instance +open Ast +open Source + + +(* Errors *) + +module Link = Error.Make () +module Trap = Error.Make () +module Crash = Error.Make () +module Exhaustion = Error.Make () + +exception Link = Link.Error +exception Trap = Trap.Error +exception Crash = Crash.Error (* failure that cannot happen in valid code *) +exception Exhaustion = Exhaustion.Error + +let table_error at = function + | Table.Bounds -> "out of bounds table access" + | Table.SizeOverflow -> "table size overflow" + | Table.SizeLimit -> "table size limit reached" + | Table.Type -> Crash.error at "type mismatch at table access" + | exn -> raise exn + +let memory_error at = function + | Memory.Bounds -> "out of bounds memory access" + | Memory.SizeOverflow -> "memory size overflow" + | Memory.SizeLimit -> "memory size limit reached" + | Memory.Type -> Crash.error at "type mismatch at memory access" + | exn -> raise exn + +let numeric_error at = function + | Numeric_error.IntegerOverflow -> "integer overflow" + | Numeric_error.IntegerDivideByZero -> "integer divide by zero" + | Numeric_error.InvalidConversionToInteger -> "invalid conversion to integer" + | Eval_numeric.TypeError (i, v, t) -> + Crash.error at + ("type error, expected " ^ Types.string_of_num_type t ^ " as operand " ^ + string_of_int i ^ ", got " ^ Types.string_of_num_type (type_of_num v)) + | exn -> raise exn + + +(* Administrative Expressions & Configurations *) + +type 'a stack = 'a list + +type frame = +{ + inst : module_inst; + locals : value ref list; +} + +type code = value stack * admin_instr list + +and admin_instr = admin_instr' phrase +and admin_instr' = + | Plain of instr' + | Invoke of func_inst + | Trapping of string + | Returning of value stack + | Breaking of int32 * value stack + | Label of int * instr list * code + | Frame of int * frame * code + +type config = +{ + frame : frame; + code : code; + budget : int; (* to model stack overflow *) +} + +let frame inst locals = {inst; locals} +let config inst vs es = {frame = frame inst []; code = vs, es; budget = 300} + +let plain e = Plain e.it @@ e.at + +let lookup category list x = + try Lib.List32.nth list x.it with Failure _ -> + Crash.error x.at ("undefined " ^ category ^ " " ^ Int32.to_string x.it) + +let type_ (inst : module_inst) x = lookup "type" inst.types x +let func (inst : module_inst) x = lookup "function" inst.funcs x +let table (inst : module_inst) x = lookup "table" inst.tables x +let memory (inst : module_inst) x = lookup "memory" inst.memories x +let global (inst : module_inst) x = lookup "global" inst.globals x +let local (frame : frame) x = lookup "local" frame.locals x + +let any_ref inst x i at = + try Table.load (table inst x) i with Table.Bounds -> + Trap.error at ("undefined element " ^ Int32.to_string i) + +let func_ref inst x i at = + match any_ref inst x i at with + | FuncRef f -> f + | NullRef -> Trap.error at ("uninitialized element " ^ Int32.to_string i) + | _ -> Crash.error at ("type mismatch for element " ^ Int32.to_string i) + +let take n (vs : 'a stack) at = + try Lib.List.take n vs with Failure _ -> Crash.error at "stack underflow" + +let drop n (vs : 'a stack) at = + try Lib.List.drop n vs with Failure _ -> Crash.error at "stack underflow" + + +(* Evaluation *) + +(* + * Conventions: + * e : instr + * v : value + * es : instr list + * vs : value stack + * c : config + *) + +let rec step (c : config) : config = + let {frame; code = vs, es; _} = c in + let e = List.hd es in + let vs', es' = + match e.it, vs with + | Plain e', vs -> + (match e', vs with + | Unreachable, vs -> + vs, [Trapping "unreachable executed" @@ e.at] + + | Nop, vs -> + vs, [] + + | Block (ts, es'), vs -> + vs, [Label (List.length ts, [], ([], List.map plain es')) @@ e.at] + + | Loop (ts, es'), vs -> + vs, [Label (0, [e' @@ e.at], ([], List.map plain es')) @@ e.at] + + | If (ts, es1, es2), Num (I32 0l) :: vs' -> + vs', [Plain (Block (ts, es2)) @@ e.at] + + | If (ts, es1, es2), Num (I32 i) :: vs' -> + vs', [Plain (Block (ts, es1)) @@ e.at] + + | Br x, vs -> + [], [Breaking (x.it, vs) @@ e.at] + + | BrIf x, Num (I32 0l) :: vs' -> + vs', [] + + | BrIf x, Num (I32 i) :: vs' -> + vs', [Plain (Br x) @@ e.at] + + | BrTable (xs, x), Num (I32 i) :: vs' + when I32.ge_u i (Lib.List32.length xs) -> + vs', [Plain (Br x) @@ e.at] + + | BrTable (xs, x), Num (I32 i) :: vs' -> + vs', [Plain (Br (Lib.List32.nth xs i)) @@ e.at] + + | Return, vs -> + [], [Returning vs @@ e.at] + + | Call x, vs -> + vs, [Invoke (func frame.inst x) @@ e.at] + + | CallIndirect (x, y), Num (I32 i) :: vs -> + let func = func_ref frame.inst x i e.at in + if type_ frame.inst y <> Func.type_of func then + vs, [Trapping "indirect call type mismatch" @@ e.at] + else + vs, [Invoke func @@ e.at] + + | Drop, v :: vs' -> + vs', [] + + | Select _, Num (I32 0l) :: v2 :: v1 :: vs' -> + v2 :: vs', [] + + | Select _, Num (I32 i) :: v2 :: v1 :: vs' -> + v1 :: vs', [] + + | LocalGet x, vs -> + !(local frame x) :: vs, [] + + | LocalSet x, v :: vs' -> + local frame x := v; + vs', [] + + | LocalTee x, v :: vs' -> + local frame x := v; + v :: vs', [] + + | GlobalGet x, vs -> + Global.load (global frame.inst x) :: vs, [] + + | GlobalSet x, v :: vs' -> + (try Global.store (global frame.inst x) v; vs', [] + with Global.NotMutable -> Crash.error e.at "write to immutable global" + | Global.Type -> Crash.error e.at "type mismatch at global write") + + | TableGet x, Num (I32 i) :: vs' -> + (try Ref (Table.load (table frame.inst x) i) :: vs', [] + with exn -> vs', [Trapping (table_error e.at exn) @@ e.at]) + + | TableSet x, Ref r :: Num (I32 i) :: vs' -> + (try Table.store (table frame.inst x) i r; vs', [] + with exn -> vs', [Trapping (table_error e.at exn) @@ e.at]) + + | TableSize x, vs -> + Num (I32 (Table.size (table frame.inst x))) :: vs, [] + + | TableGrow x, Num (I32 delta) :: Ref r :: vs' -> + let tab = table frame.inst x in + let old_size = Table.size tab in + let result = + try Table.grow tab delta r; old_size + with Table.SizeOverflow | Table.SizeLimit | Table.OutOfMemory -> -1l + in Num (I32 result) :: vs', [] + + | TableFill x, Num (I32 0l) :: Ref r :: Num (I32 i) :: vs' -> + if I32.gt_u i (Table.size (table frame.inst x)) then + vs', [Trapping (table_error e.at Table.Bounds) @@ e.at] + else + vs', [] + + | TableFill x, Num (I32 n) :: Ref r :: Num (I32 i) :: vs' -> + assert (I32.lt_u i 0xffff_ffffl); + Ref r :: Num (I32 i) :: + Num (I32 (I32.sub n 1l)) :: Ref r :: Num (I32 (I32.add i 1l)) :: vs', + [Plain (TableSet x) @@ e.at; Plain (TableFill x) @@ e.at] + + | Load {offset; ty; sz; _}, Num (I32 i) :: vs' -> + let mem = memory frame.inst (0l @@ e.at) in + let addr = I64_convert.extend_i32_u i in + (try + let n = + match sz with + | None -> Memory.load_num mem addr offset ty + | Some (sz, ext) -> Memory.load_packed sz ext mem addr offset ty + in Num n :: vs', [] + with exn -> vs', [Trapping (memory_error e.at exn) @@ e.at]) + + | Store {offset; sz; _}, Num n :: Num (I32 i) :: vs' -> + let mem = memory frame.inst (0l @@ e.at) in + let addr = I64_convert.extend_i32_u i in + (try + (match sz with + | None -> Memory.store_num mem addr offset n + | Some sz -> Memory.store_packed sz mem addr offset n + ); + vs', [] + with exn -> vs', [Trapping (memory_error e.at exn) @@ e.at]); + + | MemorySize, vs -> + let mem = memory frame.inst (0l @@ e.at) in + Num (I32 (Memory.size mem)) :: vs, [] + + | MemoryGrow, Num (I32 delta) :: vs' -> + let mem = memory frame.inst (0l @@ e.at) in + let old_size = Memory.size mem in + let result = + try Memory.grow mem delta; old_size + with Memory.SizeOverflow | Memory.SizeLimit | Memory.OutOfMemory -> -1l + in Num (I32 result) :: vs', [] + + | RefNull, vs' -> + Ref NullRef :: vs', [] + + | RefIsNull, Ref NullRef :: vs' -> + Num (I32 1l) :: vs', [] + + | RefIsNull, v :: vs' -> + Num (I32 0l) :: vs', [] + + | RefFunc x, vs' -> + let f = func frame.inst x in + Ref (FuncRef f) :: vs', [] + + | Const n, vs -> + Num n.it :: vs, [] + + | Test testop, Num n :: vs' -> + (try value_of_bool (Eval_numeric.eval_testop testop n) :: vs', [] + with exn -> vs', [Trapping (numeric_error e.at exn) @@ e.at]) + + | Compare relop, Num n2 :: Num n1 :: vs' -> + (try value_of_bool (Eval_numeric.eval_relop relop n1 n2) :: vs', [] + with exn -> vs', [Trapping (numeric_error e.at exn) @@ e.at]) + + | Unary unop, Num n :: vs' -> + (try Num (Eval_numeric.eval_unop unop n) :: vs', [] + with exn -> vs', [Trapping (numeric_error e.at exn) @@ e.at]) + + | Binary binop, Num n2 :: Num n1 :: vs' -> + (try Num (Eval_numeric.eval_binop binop n1 n2) :: vs', [] + with exn -> vs', [Trapping (numeric_error e.at exn) @@ e.at]) + + | Convert cvtop, Num n :: vs' -> + (try Num (Eval_numeric.eval_cvtop cvtop n) :: vs', [] + with exn -> vs', [Trapping (numeric_error e.at exn) @@ e.at]) + + | _ -> + let s1 = string_of_values (List.rev vs) in + let s2 = string_of_value_types (List.map type_of_value (List.rev vs)) in + Crash.error e.at + ("missing or ill-typed operand on stack (" ^ s1 ^ " : " ^ s2 ^ ")") + ) + + | Trapping msg, vs -> + assert false + + | Returning vs', vs -> + Crash.error e.at "undefined frame" + + | Breaking (k, vs'), vs -> + Crash.error e.at "undefined label" + + | Label (n, es0, (vs', [])), vs -> + vs' @ vs, [] + + | Label (n, es0, (vs', {it = Trapping msg; at} :: es')), vs -> + vs, [Trapping msg @@ at] + + | Label (n, es0, (vs', {it = Returning vs0; at} :: es')), vs -> + vs, [Returning vs0 @@ at] + + | Label (n, es0, (vs', {it = Breaking (0l, vs0); at} :: es')), vs -> + take n vs0 e.at @ vs, List.map plain es0 + + | Label (n, es0, (vs', {it = Breaking (k, vs0); at} :: es')), vs -> + vs, [Breaking (Int32.sub k 1l, vs0) @@ at] + + | Label (n, es0, code'), vs -> + let c' = step {c with code = code'} in + vs, [Label (n, es0, c'.code) @@ e.at] + + | Frame (n, frame', (vs', [])), vs -> + vs' @ vs, [] + + | Frame (n, frame', (vs', {it = Trapping msg; at} :: es')), vs -> + vs, [Trapping msg @@ at] + + | Frame (n, frame', (vs', {it = Returning vs0; at} :: es')), vs -> + take n vs0 e.at @ vs, [] + + | Frame (n, frame', code'), vs -> + let c' = step {frame = frame'; code = code'; budget = c.budget - 1} in + vs, [Frame (n, c'.frame, c'.code) @@ e.at] + + | Invoke func, vs when c.budget = 0 -> + Exhaustion.error e.at "call stack exhausted" + + | Invoke func, vs -> + let FuncType (ins, out) = Func.type_of func in + let n = List.length ins in + let args, vs' = take n vs e.at, drop n vs e.at in + (match func with + | Func.AstFunc (t, inst', f) -> + let locals' = List.rev args @ List.map default_value f.it.locals in + let code' = [], [Plain (Block (out, f.it.body)) @@ f.at] in + let frame' = {inst = !inst'; locals = List.map ref locals'} in + vs', [Frame (List.length out, frame', code') @@ e.at] + + | Func.HostFunc (t, f) -> + try List.rev (f (List.rev args)) @ vs', [] + with Crash (_, msg) -> Crash.error e.at msg + ) + in {c with code = vs', es' @ List.tl es} + + +let rec eval (c : config) : value stack = + match c.code with + | vs, [] -> + vs + + | vs, {it = Trapping msg; at} :: _ -> + Trap.error at msg + + | vs, es -> + eval (step c) + + +(* Functions & Constants *) + +let invoke (func : func_inst) (vs : value list) : value list = + let at = match func with Func.AstFunc (_, _, f) -> f.at | _ -> no_region in + let FuncType (ins, out) = Func.type_of func in + if List.length vs <> List.length ins then + Crash.error at "wrong number of arguments"; + if not (List.for_all2 (fun v -> match_value_type (type_of_value v)) vs ins) then + Crash.error at "wrong types of arguments"; + let c = config empty_module_inst (List.rev vs) [Invoke func @@ at] in + try List.rev (eval c) with Stack_overflow -> + Exhaustion.error at "call stack exhausted" + +let eval_const (inst : module_inst) (const : const) : value = + let c = config inst [] (List.map plain const.it) in + match eval c with + | [v] -> v + | vs -> Crash.error const.at "wrong number of results on stack" + +let i32 (v : value) at = + match v with + | Num (I32 i) -> i + | _ -> Crash.error at "type error: i32 value expected" + + +(* Modules *) + +let create_func (inst : module_inst) (f : func) : func_inst = + Func.alloc (type_ inst f.it.ftype) (ref inst) f + +let create_table (inst : module_inst) (tab : table) : table_inst = + let {ttype} = tab.it in + Table.alloc ttype NullRef + +let create_memory (inst : module_inst) (mem : memory) : memory_inst = + let {mtype} = mem.it in + Memory.alloc mtype + +let create_global (inst : module_inst) (glob : global) : global_inst = + let {gtype; value} = glob.it in + let v = eval_const inst value in + Global.alloc gtype v + +let create_export (inst : module_inst) (ex : export) : export_inst = + let {name; edesc} = ex.it in + let ext = + match edesc.it with + | FuncExport x -> ExternFunc (func inst x) + | TableExport x -> ExternTable (table inst x) + | MemoryExport x -> ExternMemory (memory inst x) + | GlobalExport x -> ExternGlobal (global inst x) + in name, ext + + +let init_func (inst : module_inst) (func : func_inst) = + match func with + | Func.AstFunc (_, inst_ref, _) -> inst_ref := inst + | _ -> assert false + +let init_table (inst : module_inst) (seg : table_segment) = + let {index; offset = const; init} = seg.it in + let tab = table inst index in + let offset = i32 (eval_const inst const) const.at in + let end_ = Int32.(add offset (of_int (List.length init))) in + let bound = Table.size tab in + if I32.lt_u bound end_ || I32.lt_u end_ offset then + Link.error seg.at "elements segment does not fit table"; + fun () -> + Table.blit tab offset (List.map (fun x -> FuncRef (func inst x)) init) + +let init_memory (inst : module_inst) (seg : memory_segment) = + let {index; offset = const; init} = seg.it in + let mem = memory inst index in + let offset' = i32 (eval_const inst const) const.at in + let offset = I64_convert.extend_i32_u offset' in + let end_ = Int64.(add offset (of_int (String.length init))) in + let bound = Memory.bound mem in + if I64.lt_u bound end_ || I64.lt_u end_ offset then + Link.error seg.at "data segment does not fit memory"; + fun () -> Memory.store_bytes mem offset init + + +let add_import (m : module_) (ext : extern) (im : import) (inst : module_inst) + : module_inst = + if not (match_extern_type (extern_type_of ext) (import_type m im)) then + Link.error im.at "incompatible import type"; + match ext with + | ExternFunc func -> {inst with funcs = func :: inst.funcs} + | ExternTable tab -> {inst with tables = tab :: inst.tables} + | ExternMemory mem -> {inst with memories = mem :: inst.memories} + | ExternGlobal glob -> {inst with globals = glob :: inst.globals} + +let init (m : module_) (exts : extern list) : module_inst = + let + { imports; tables; memories; globals; funcs; types; + exports; elems; data; start + } = m.it + in + if List.length exts <> List.length imports then + Link.error m.at "wrong number of imports provided for initialisation"; + let inst0 = + { (List.fold_right2 (add_import m) exts imports empty_module_inst) with + types = List.map (fun type_ -> type_.it) types } + in + let fs = List.map (create_func inst0) funcs in + let inst1 = {inst0 with funcs = inst0.funcs @ fs} in + let inst2 = + { inst1 with + tables = inst1.tables @ List.map (create_table inst1) tables; + memories = inst1.memories @ List.map (create_memory inst1) memories; + globals = inst1.globals @ List.map (create_global inst1) globals; + } + in + let inst = {inst2 with exports = List.map (create_export inst2) exports} in + List.iter (init_func inst) fs; + let init_elems = List.map (init_table inst) elems in + let init_datas = List.map (init_memory inst) data in + List.iter (fun f -> f ()) init_elems; + List.iter (fun f -> f ()) init_datas; + Lib.Option.app (fun x -> ignore (invoke (func inst x) [])) start; + inst diff --git a/interpreter/spec/eval.mli b/interpreter/exec/eval.mli similarity index 57% rename from interpreter/spec/eval.mli rename to interpreter/exec/eval.mli index f36e1dd1..825cc74f 100644 --- a/interpreter/spec/eval.mli +++ b/interpreter/exec/eval.mli @@ -6,5 +6,5 @@ exception Trap of Source.region * string exception Crash of Source.region * string exception Exhaustion of Source.region * string -val init : Ast.module_ -> extern list -> instance (* raises Link, Trap *) -val invoke : closure -> value list -> value list (* raises Trap *) +val init : Ast.module_ -> extern list -> module_inst (* raises Link, Trap *) +val invoke : func_inst -> value list -> value list (* raises Trap *) diff --git a/interpreter/exec/eval_numeric.ml b/interpreter/exec/eval_numeric.ml new file mode 100644 index 00000000..02945579 --- /dev/null +++ b/interpreter/exec/eval_numeric.ml @@ -0,0 +1,229 @@ +open Types +open Values + + +(* Injection & projection *) + +exception TypeError of int * num * num_type + +module type NumType = +sig + type t + val to_num : t -> num + val of_num : int -> num -> t +end + +module I32Num = +struct + type t = I32.t + let to_num i = I32 i + let of_num n = function I32 i -> i | v -> raise (TypeError (n, v, I32Type)) +end + +module I64Num = +struct + type t = I64.t + let to_num i = I64 i + let of_num n = function I64 i -> i | v -> raise (TypeError (n, v, I64Type)) +end + +module F32Num = +struct + type t = F32.t + let to_num i = F32 i + let of_num n = function F32 z -> z | v -> raise (TypeError (n, v, F32Type)) +end + +module F64Num = +struct + type t = F64.t + let to_num i = F64 i + let of_num n = function F64 z -> z | v -> raise (TypeError (n, v, F64Type)) +end + + +(* Int operators *) + +module IntOp (IXX : Int.S) (Num : NumType with type t = IXX.t) = +struct + open Ast.IntOp + open Num + + let unop op = + let f = match op with + | Clz -> IXX.clz + | Ctz -> IXX.ctz + | Popcnt -> IXX.popcnt + in fun v -> to_num (f (of_num 1 v)) + + let binop op = + let f = match op with + | Add -> IXX.add + | Sub -> IXX.sub + | Mul -> IXX.mul + | DivS -> IXX.div_s + | DivU -> IXX.div_u + | RemS -> IXX.rem_s + | RemU -> IXX.rem_u + | And -> IXX.and_ + | Or -> IXX.or_ + | Xor -> IXX.xor + | Shl -> IXX.shl + | ShrU -> IXX.shr_u + | ShrS -> IXX.shr_s + | Rotl -> IXX.rotl + | Rotr -> IXX.rotr + in fun v1 v2 -> to_num (f (of_num 1 v1) (of_num 2 v2)) + + let testop op = + let f = match op with + | Eqz -> IXX.eqz + in fun v -> f (of_num 1 v) + + let relop op = + let f = match op with + | Eq -> IXX.eq + | Ne -> IXX.ne + | LtS -> IXX.lt_s + | LtU -> IXX.lt_u + | LeS -> IXX.le_s + | LeU -> IXX.le_u + | GtS -> IXX.gt_s + | GtU -> IXX.gt_u + | GeS -> IXX.ge_s + | GeU -> IXX.ge_u + in fun v1 v2 -> f (of_num 1 v1) (of_num 2 v2) +end + +module I32Op = IntOp (I32) (I32Num) +module I64Op = IntOp (I64) (I64Num) + + +(* Float operators *) + +module FloatOp (FXX : Float.S) (Num : NumType with type t = FXX.t) = +struct + open Ast.FloatOp + open Num + + let unop op = + let f = match op with + | Neg -> FXX.neg + | Abs -> FXX.abs + | Sqrt -> FXX.sqrt + | Ceil -> FXX.ceil + | Floor -> FXX.floor + | Trunc -> FXX.trunc + | Nearest -> FXX.nearest + in fun v -> to_num (f (of_num 1 v)) + + let binop op = + let f = match op with + | Add -> FXX.add + | Sub -> FXX.sub + | Mul -> FXX.mul + | Div -> FXX.div + | Min -> FXX.min + | Max -> FXX.max + | CopySign -> FXX.copysign + in fun v1 v2 -> to_num (f (of_num 1 v1) (of_num 2 v2)) + + let testop op = assert false + + let relop op = + let f = match op with + | Eq -> FXX.eq + | Ne -> FXX.ne + | Lt -> FXX.lt + | Le -> FXX.le + | Gt -> FXX.gt + | Ge -> FXX.ge + in fun v1 v2 -> f (of_num 1 v1) (of_num 2 v2) +end + +module F32Op = FloatOp (F32) (F32Num) +module F64Op = FloatOp (F64) (F64Num) + + +(* Conversion operators *) + +module I32CvtOp = +struct + open Ast.IntOp + + let cvtop op v = + let i = match op with + | WrapI64 -> I32_convert.wrap_i64 (I64Num.of_num 1 v) + | TruncSF32 -> I32_convert.trunc_f32_s (F32Num.of_num 1 v) + | TruncUF32 -> I32_convert.trunc_f32_u (F32Num.of_num 1 v) + | TruncSF64 -> I32_convert.trunc_f64_s (F64Num.of_num 1 v) + | TruncUF64 -> I32_convert.trunc_f64_u (F64Num.of_num 1 v) + | ReinterpretFloat -> I32_convert.reinterpret_f32 (F32Num.of_num 1 v) + | ExtendSI32 -> raise (TypeError (1, v, I32Type)) + | ExtendUI32 -> raise (TypeError (1, v, I32Type)) + in I32Num.to_num i +end + +module I64CvtOp = +struct + open Ast.IntOp + + let cvtop op v = + let i = match op with + | ExtendSI32 -> I64_convert.extend_i32_s (I32Num.of_num 1 v) + | ExtendUI32 -> I64_convert.extend_i32_u (I32Num.of_num 1 v) + | TruncSF32 -> I64_convert.trunc_f32_s (F32Num.of_num 1 v) + | TruncUF32 -> I64_convert.trunc_f32_u (F32Num.of_num 1 v) + | TruncSF64 -> I64_convert.trunc_f64_s (F64Num.of_num 1 v) + | TruncUF64 -> I64_convert.trunc_f64_u (F64Num.of_num 1 v) + | ReinterpretFloat -> I64_convert.reinterpret_f64 (F64Num.of_num 1 v) + | WrapI64 -> raise (TypeError (1, v, I64Type)) + in I64Num.to_num i +end + +module F32CvtOp = +struct + open Ast.FloatOp + + let cvtop op v = + let z = match op with + | DemoteF64 -> F32_convert.demote_f64 (F64Num.of_num 1 v) + | ConvertSI32 -> F32_convert.convert_i32_s (I32Num.of_num 1 v) + | ConvertUI32 -> F32_convert.convert_i32_u (I32Num.of_num 1 v) + | ConvertSI64 -> F32_convert.convert_i64_s (I64Num.of_num 1 v) + | ConvertUI64 -> F32_convert.convert_i64_u (I64Num.of_num 1 v) + | ReinterpretInt -> F32_convert.reinterpret_i32 (I32Num.of_num 1 v) + | PromoteF32 -> raise (TypeError (1, v, F32Type)) + in F32Num.to_num z +end + +module F64CvtOp = +struct + open Ast.FloatOp + + let cvtop op v = + let z = match op with + | PromoteF32 -> F64_convert.promote_f32 (F32Num.of_num 1 v) + | ConvertSI32 -> F64_convert.convert_i32_s (I32Num.of_num 1 v) + | ConvertUI32 -> F64_convert.convert_i32_u (I32Num.of_num 1 v) + | ConvertSI64 -> F64_convert.convert_i64_s (I64Num.of_num 1 v) + | ConvertUI64 -> F64_convert.convert_i64_u (I64Num.of_num 1 v) + | ReinterpretInt -> F64_convert.reinterpret_i64 (I64Num.of_num 1 v) + | DemoteF64 -> raise (TypeError (1, v, F64Type)) + in F64Num.to_num z +end + + +(* Dispatch *) + +let op i32 i64 f32 f64 = function + | I32 x -> i32 x + | I64 x -> i64 x + | F32 x -> f32 x + | F64 x -> f64 x + +let eval_unop = op I32Op.unop I64Op.unop F32Op.unop F64Op.unop +let eval_binop = op I32Op.binop I64Op.binop F32Op.binop F64Op.binop +let eval_testop = op I32Op.testop I64Op.testop F32Op.testop F64Op.testop +let eval_relop = op I32Op.relop I64Op.relop F32Op.relop F64Op.relop +let eval_cvtop = op I32CvtOp.cvtop I64CvtOp.cvtop F32CvtOp.cvtop F64CvtOp.cvtop diff --git a/interpreter/exec/eval_numeric.mli b/interpreter/exec/eval_numeric.mli new file mode 100644 index 00000000..969e4474 --- /dev/null +++ b/interpreter/exec/eval_numeric.mli @@ -0,0 +1,9 @@ +open Values + +exception TypeError of int * num * Types.num_type + +val eval_unop : Ast.unop -> num -> num +val eval_binop : Ast.binop -> num -> num -> num +val eval_testop : Ast.testop -> num -> bool +val eval_relop : Ast.relop -> num -> num -> bool +val eval_cvtop : Ast.cvtop -> num -> num diff --git a/interpreter/spec/f32.ml b/interpreter/exec/f32.ml similarity index 54% rename from interpreter/spec/f32.ml rename to interpreter/exec/f32.ml index ae54cf72..5f26a039 100644 --- a/interpreter/spec/f32.ml +++ b/interpreter/exec/f32.ml @@ -4,11 +4,11 @@ * "When is double rounding innocuous?" by Samuel A. Figueroa. *) include Float.Make - (struct + (struct include Int32 - let pos_nan = 0x7fc00000l - let neg_nan = 0xffc00000l - let bare_nan = 0x7f800000l - let print_nan_significand_digits a = - Printf.sprintf "%lx" (abs (Int32.logxor bare_nan a)) + let mantissa = 23 + let pos_nan = 0x7fc0_0000l + let neg_nan = 0xffc0_0000l + let bare_nan = 0x7f80_0000l + let to_hex_string = Printf.sprintf "%lx" end) diff --git a/interpreter/exec/f32_convert.ml b/interpreter/exec/f32_convert.ml new file mode 100644 index 00000000..9036877a --- /dev/null +++ b/interpreter/exec/f32_convert.ml @@ -0,0 +1,47 @@ +(* WebAssembly-compatible type conversions to f32 implementation *) + +let demote_f64 x = + let xf = F64.to_float x in + if xf = xf then F32.of_float xf else + let nan64bits = F64.to_bits x in + let sign_field = Int64.(shift_left (shift_right_logical nan64bits 63) 31) in + let significand_field = Int64.(shift_right_logical (shift_left nan64bits 12) 41) in + let fields = Int64.logor sign_field significand_field in + let nan32bits = Int32.logor 0x7fc0_0000l (I32_convert.wrap_i64 fields) in + F32.of_bits nan32bits + +let convert_i32_s x = + F32.of_float (Int32.to_float x) + +(* + * Similar to convert_i64_u below, the high half of the i32 range are beyond + * the range where f32 can represent odd numbers, though we do need to adjust + * the least significant bit to round correctly. + *) +let convert_i32_u x = + F32.of_float Int32.( + if x >= zero then to_float x else + to_float (logor (shift_right_logical x 1) (logand x 1l)) *. 2.0 + ) + +(* + * Values that are too large would get rounded when represented in f64, + * but double rounding via i64->f64->f32 can produce inaccurate results. + * Hence, for large values we shift right but make sure to accumulate the lost + * bits in the least signifant bit, such that rounding still is correct. + *) +let convert_i64_s x = + F32.of_float Int64.( + if abs x < 0x10_0000_0000_0000L then to_float x else + let r = if logand x 0xfffL = 0L then 0L else 1L in + to_float (logor (shift_right x 12) r) *. (* TODO(ocaml-4.03): 0x1p12 *) 4096.0 + ) + +let convert_i64_u x = + F32.of_float Int64.( + if I64.lt_u x 0x10_0000_0000_0000L then to_float x else + let r = if logand x 0xfffL = 0L then 0L else 1L in + to_float (logor (shift_right_logical x 12) r) *. (* TODO(ocaml-4.03): 0x1p12 *) 4096.0 + ) + +let reinterpret_i32 = F32.of_bits diff --git a/interpreter/exec/f32_convert.mli b/interpreter/exec/f32_convert.mli new file mode 100644 index 00000000..1b1b579d --- /dev/null +++ b/interpreter/exec/f32_convert.mli @@ -0,0 +1,8 @@ +(* WebAssembly-compatible type conversions to f32 implementation *) + +val demote_f64 : F64.t -> F32.t +val convert_i32_s : I32.t -> F32.t +val convert_i32_u : I32.t -> F32.t +val convert_i64_s : I64.t -> F32.t +val convert_i64_u : I64.t -> F32.t +val reinterpret_i32 : I32.t -> F32.t diff --git a/interpreter/exec/f64.ml b/interpreter/exec/f64.ml new file mode 100644 index 00000000..623150fe --- /dev/null +++ b/interpreter/exec/f64.ml @@ -0,0 +1,9 @@ +include Float.Make + (struct + include Int64 + let mantissa = 52 + let pos_nan = 0x7ff8_0000_0000_0000L + let neg_nan = 0xfff8_0000_0000_0000L + let bare_nan = 0x7ff0_0000_0000_0000L + let to_hex_string = Printf.sprintf "%Lx" + end) diff --git a/interpreter/spec/f64_convert.ml b/interpreter/exec/f64_convert.ml similarity index 70% rename from interpreter/spec/f64_convert.ml rename to interpreter/exec/f64_convert.ml index 1403d2f0..cd6fc3f1 100644 --- a/interpreter/spec/f64_convert.ml +++ b/interpreter/exec/f64_convert.ml @@ -3,14 +3,14 @@ let promote_f32 x = let xf = F32.to_float x in if xf = xf then F64.of_float xf else - let nan32bits = I64_convert.extend_u_i32 (F32.to_bits x) in + let nan32bits = I64_convert.extend_i32_u (F32.to_bits x) in let sign_field = Int64.(shift_left (shift_right_logical nan32bits 31) 63) in let significand_field = Int64.(shift_right_logical (shift_left nan32bits 41) 12) in let fields = Int64.logor sign_field significand_field in - let nan64bits = Int64.logor 0x7ff8000000000000L fields in + let nan64bits = Int64.logor 0x7ff8_0000_0000_0000L fields in F64.of_bits nan64bits -let convert_s_i32 x = +let convert_i32_s x = F64.of_float (Int32.to_float x) (* @@ -18,10 +18,10 @@ let convert_s_i32 x = * within the range where f32 can represent odd numbers, so we can't do the * shift. Instead, we can use int64 signed arithmetic. *) -let convert_u_i32 x = - F64.of_float Int64.(to_float (logand (of_int32 x) 0x00000000ffffffffL)) +let convert_i32_u x = + F64.of_float Int64.(to_float (logand (of_int32 x) 0x0000_0000_ffff_ffffL)) -let convert_s_i64 x = +let convert_i64_s x = F64.of_float (Int64.to_float x) (* @@ -30,9 +30,10 @@ let convert_s_i64 x = * numbers, so we can shift the value right, adjust the least significant * bit to round correctly, do a conversion, and then scale it back up. *) -let convert_u_i64 x = - F64.of_float - Int64.(if x >= zero then to_float x else - to_float (logor (shift_right_logical x 1) (logand x 1L)) *. 2.0) +let convert_i64_u x = + F64.of_float Int64.( + if x >= zero then to_float x else + to_float (logor (shift_right_logical x 1) (logand x 1L)) *. 2.0 + ) let reinterpret_i64 = F64.of_bits diff --git a/interpreter/exec/f64_convert.mli b/interpreter/exec/f64_convert.mli new file mode 100644 index 00000000..9ed693be --- /dev/null +++ b/interpreter/exec/f64_convert.mli @@ -0,0 +1,8 @@ +(* WebAssembly-compatible type conversions to f64 implementation *) + +val promote_f32 : F32.t -> F64.t +val convert_i32_s : I32.t -> F64.t +val convert_i32_u : I32.t -> F64.t +val convert_i64_s : I64.t -> F64.t +val convert_i64_u : I64.t -> F64.t +val reinterpret_i64 : I64.t -> F64.t diff --git a/interpreter/exec/float.ml b/interpreter/exec/float.ml new file mode 100644 index 00000000..ee84b467 --- /dev/null +++ b/interpreter/exec/float.ml @@ -0,0 +1,354 @@ +module type RepType = +sig + type t + + val mantissa : int + + val zero : t + val min_int : t + val max_int : t + + val pos_nan : t + val neg_nan : t + val bare_nan : t + + val bits_of_float : float -> t + val float_of_bits : t -> float + val of_string : string -> t + val to_string : t -> string + val to_hex_string : t -> string + + val lognot : t -> t + val logand : t -> t -> t + val logor : t -> t -> t + val logxor : t -> t -> t +end + +module type S = +sig + type t + type bits + val pos_nan : t + val neg_nan : t + val of_float : float -> t + val to_float : t -> float + val of_string : string -> t + val to_string : t -> string + val of_bits : bits -> t + val to_bits : t -> bits + val add : t -> t -> t + val sub : t -> t -> t + val mul : t -> t -> t + val div : t -> t -> t + val sqrt : t -> t + val min : t -> t -> t + val max : t -> t -> t + val ceil : t -> t + val floor : t -> t + val trunc : t -> t + val nearest : t -> t + val abs : t -> t + val neg : t -> t + val copysign : t -> t -> t + val eq : t -> t -> bool + val ne : t -> t -> bool + val lt : t -> t -> bool + val le : t -> t -> bool + val gt : t -> t -> bool + val ge : t -> t -> bool + val zero : t +end + +module Make (Rep : RepType) : S with type bits = Rep.t = +struct + let _ = assert (Rep.mantissa <= 52) + + type t = Rep.t + type bits = Rep.t + + let pos_inf = Rep.bits_of_float (1.0 /. 0.0) + let neg_inf = Rep.bits_of_float (-. (1.0 /. 0.0)) + let pos_nan = Rep.pos_nan + let neg_nan = Rep.neg_nan + let bare_nan = Rep.bare_nan + + let of_float = Rep.bits_of_float + let to_float = Rep.float_of_bits + + let of_bits x = x + let to_bits x = x + + let is_inf x = x = pos_inf || x = neg_inf + let is_nan x = let xf = Rep.float_of_bits x in xf <> xf + + (* + * When the result of an arithmetic operation is NaN, the most significant + * bit of the significand field is set. + *) + let canonicalize_nan x = Rep.logor x Rep.pos_nan + + (* + * When the result of a binary operation is NaN, the resulting NaN is computed + * from one of the NaN inputs, if there is one. If both are NaN, one is + * selected nondeterminstically. If neither, we use a default NaN value. + *) + let determine_binary_nan x y = + (* + * TODO: There are two nondeterministic things we could do here. When both + * x and y are NaN, we can nondeterministically pick which to return. And + * when neither is NaN, we can nondeterministically pick whether to return + * pos_nan or neg_nan. + *) + let nan = + if is_nan x then x else + if is_nan y then y else Rep.pos_nan + in canonicalize_nan nan + + (* + * When the result of a unary operation is NaN, the resulting NaN is computed + * from one of the NaN input, if there it is NaN. Otherwise, we use a default + * NaN value. + *) + let determine_unary_nan x = + (* + * TODO: There is one nondeterministic thing we could do here. When the + * operand is not NaN, we can nondeterministically pick whether to return + * pos_nan or neg_nan. + *) + let nan = if is_nan x then x else Rep.pos_nan in + canonicalize_nan nan + + let binary x op y = + let xf = to_float x in + let yf = to_float y in + let t = op xf yf in + if t = t then of_float t else determine_binary_nan x y + + let unary op x = + let t = op (to_float x) in + if t = t then of_float t else determine_unary_nan x + + let zero = of_float 0.0 + + let add x y = binary x (+.) y + let sub x y = binary x (-.) y + let mul x y = binary x ( *.) y + let div x y = binary x (/.) y + + let sqrt x = unary Pervasives.sqrt x + + let ceil x = unary Pervasives.ceil x + let floor x = unary Pervasives.floor x + + let trunc x = + let xf = to_float x in + (* preserve the sign of zero *) + if xf = 0.0 then x else + (* trunc is either ceil or floor depending on which one is toward zero *) + let f = if xf < 0.0 then Pervasives.ceil xf else Pervasives.floor xf in + let result = of_float f in + if is_nan result then determine_unary_nan result else result + + let nearest x = + let xf = to_float x in + (* preserve the sign of zero *) + if xf = 0.0 then x else + (* nearest is either ceil or floor depending on which is nearest or even *) + let u = Pervasives.ceil xf in + let d = Pervasives.floor xf in + let um = abs_float (xf -. u) in + let dm = abs_float (xf -. d) in + let u_or_d = + um < dm || + um = dm && let h = u /. 2. in Pervasives.floor h = h + in + let f = if u_or_d then u else d in + let result = of_float f in + if is_nan result then determine_unary_nan result else result + + let min x y = + let xf = to_float x in + let yf = to_float y in + (* min -0 0 is -0 *) + if xf = yf then Rep.logor x y else + if xf < yf then x else + if xf > yf then y else + determine_binary_nan x y + + let max x y = + let xf = to_float x in + let yf = to_float y in + (* max -0 0 is 0 *) + if xf = yf then Rep.logand x y else + if xf > yf then x else + if xf < yf then y else + determine_binary_nan x y + + (* abs, neg, copysign are purely bitwise operations, even on NaN values *) + let abs x = + Rep.logand x Rep.max_int + + let neg x = + Rep.logxor x Rep.min_int + + let copysign x y = + Rep.logor (abs x) (Rep.logand y Rep.min_int) + + let eq x y = (to_float x = to_float y) + let ne x y = (to_float x <> to_float y) + let lt x y = (to_float x < to_float y) + let gt x y = (to_float x > to_float y) + let le x y = (to_float x <= to_float y) + let ge x y = (to_float x >= to_float y) + + (* + * Compare mantissa of two floats in string representation (hex or dec). + * This is a gross hack to detect rounding during parsing of floats. + *) + let is_hex c = ('0' <= c && c <= '9') || ('A' <= c && c <= 'F') + let is_exp hex c = (c = if hex then 'P' else 'E') + let at_end hex s i = (i = String.length s) || is_exp hex s.[i] + + let rec skip_non_hex s i = (* to skip sign, 'x', '.', '_', etc. *) + if at_end true s i || is_hex s.[i] then i else skip_non_hex s (i + 1) + + let rec skip_zeroes s i = + let i' = skip_non_hex s i in + if at_end true s i' || s.[i'] <> '0' then i' else skip_zeroes s (i' + 1) + + let rec compare_mantissa_str' hex s1 i1 s2 i2 = + let i1' = skip_non_hex s1 i1 in + let i2' = skip_non_hex s2 i2 in + match at_end hex s1 i1', at_end hex s2 i2' with + | true, true -> 0 + | true, false -> if at_end hex s2 (skip_zeroes s2 i2') then 0 else -1 + | false, true -> if at_end hex s1 (skip_zeroes s1 i1') then 0 else +1 + | false, false -> + match compare s1.[i1'] s2.[i2'] with + | 0 -> compare_mantissa_str' hex s1 (i1' + 1) s2 (i2' + 1) + | n -> n + + let compare_mantissa_str hex s1 s2 = + let s1' = String.uppercase s1 in + let s2' = String.uppercase s2 in + compare_mantissa_str' hex s1' (skip_zeroes s1' 0) s2' (skip_zeroes s2' 0) + + (* + * Convert a string to a float in target precision by going through + * OCaml's 64 bit floats. This may incur double rounding errors in edge + * cases, i.e., when rounding to target precision involves a tie that + * was created by earlier rounding during parsing to float. If both + * end up rounding in the same direction, we would "over round". + * This function tries to detect this case and correct accordingly. + *) + let float_of_string_prevent_double_rounding s = + (* First parse to a 64 bit float. *) + let z = float_of_string s in + (* If value is already infinite we are done. *) + if abs_float z = 1.0 /. 0.0 then z else + (* Else, bit twiddling to see what rounding to target precision will do. *) + let open Int64 in + let bits = bits_of_float z in + let lsb = shift_left 1L (52 - Rep.mantissa) in + (* Check for tie, i.e. whether the bits right of target LSB are 10000... *) + let tie = shift_right lsb 1 in + let mask = lognot (shift_left (-1L) (52 - Rep.mantissa)) in + (* If we have no tie, we are good. *) + if logand bits mask <> tie then z else + (* Else, define epsilon to be the value of the tie bit. *) + let exp = float_of_bits (logand bits 0xfff0_0000_0000_0000L) in + let eps = float_of_bits (logor tie (bits_of_float exp)) -. exp in + (* Convert 64 bit float back to string to compare to input. *) + let hex = String.contains s 'x' in + let s' = + if not hex then Printf.sprintf "%.*g" (String.length s) z else + let m = logor (logand bits 0xf_ffff_ffff_ffffL) 0x10_0000_0000_0000L in + (* Shift mantissa to match msb position in most significant hex digit *) + let i = skip_zeroes (String.uppercase s) 0 in + if i = String.length s then Printf.sprintf "%.*g" (String.length s) z else + let sh = + match s.[i] with '1' -> 0 | '2'..'3' -> 1 | '4'..'7' -> 2 | _ -> 3 in + Printf.sprintf "%Lx" (shift_left m sh) + in + (* - If mantissa became larger, float was rounded up to tie already; + * round-to-even might round up again: sub epsilon to round down. + * - If mantissa became smaller, float was rounded down to tie already; + * round-to-even migth round down again: add epsilon to round up. + * - If tie is not the result of prior rounding, then we are good. + *) + match compare_mantissa_str hex s s' with + | -1 -> z -. eps + | +1 -> z +. eps + | _ -> z + + let of_signless_string s = + if s = "inf" then + pos_inf + else if s = "nan" then + pos_nan + else if String.length s > 6 && String.sub s 0 6 = "nan:0x" then + let x = Rep.of_string (String.sub s 4 (String.length s - 4)) in + if x = Rep.zero then + raise (Failure "nan payload must not be zero") + else if Rep.logand x bare_nan <> Rep.zero then + raise (Failure "nan payload must not overlap with exponent bits") + else if x < Rep.zero then + raise (Failure "nan payload must not overlap with sign bit") + else + Rep.logor x bare_nan + else + (* TODO(ocmal-4.03): replace buffer hack with this: + let s' = String.concat "" (String.split_on_char '_' s) in + *) + let buf = Buffer.create (String.length s) in + for i = 0 to String.length s - 1 do + if s.[i] <> '_' then Buffer.add_char buf s.[i] + done; + let s' = Buffer.contents buf in + let x = of_float (float_of_string_prevent_double_rounding s') in + if is_inf x then failwith "of_string" else x + + let of_string s = + if s = "" then + failwith "of_string" + else if s.[0] = '+' || s.[0] = '-' then + let x = of_signless_string (String.sub s 1 (String.length s - 1)) in + if s.[0] = '+' then x else neg x + else + of_signless_string s + + (* String conversion that groups digits for readability *) + + let is_digit c = '0' <= c && c <= '9' + let isnt_digit c = not (is_digit c) + + let rec add_digits buf s i j k = + if i < j then begin + if k = 0 then Buffer.add_char buf '_'; + Buffer.add_char buf s.[i]; + add_digits buf s (i + 1) j ((k + 2) mod 3) + end + + let group_digits s = + let len = String.length s in + let mant = Lib.Option.get (Lib.String.find_from_opt is_digit s 0) len in + let point = Lib.Option.get (Lib.String.find_from_opt isnt_digit s mant) len in + let frac = Lib.Option.get (Lib.String.find_from_opt is_digit s point) len in + let exp = Lib.Option.get (Lib.String.find_from_opt isnt_digit s frac) len in + let buf = Buffer.create (len*4/3) in + Buffer.add_substring buf s 0 mant; + add_digits buf s mant point ((point - mant) mod 3 + 3); + Buffer.add_substring buf s point (frac - point); + add_digits buf s frac exp 3; + Buffer.add_substring buf s exp (len - exp); + Buffer.contents buf + + let to_string x = + (if x < Rep.zero then "-" else "") ^ + if is_nan x then + let payload = Rep.logand (abs x) (Rep.lognot bare_nan) in + "nan:0x" ^ Rep.to_hex_string payload + else + let s = Printf.sprintf "%.17g" (to_float (abs x)) in + group_digits (if s.[String.length s - 1] = '.' then s ^ "0" else s) +end diff --git a/interpreter/spec/i32.ml b/interpreter/exec/i32.ml similarity index 100% rename from interpreter/spec/i32.ml rename to interpreter/exec/i32.ml diff --git a/interpreter/spec/i32_convert.ml b/interpreter/exec/i32_convert.ml similarity index 93% rename from interpreter/spec/i32_convert.ml rename to interpreter/exec/i32_convert.ml index e6de75cb..ac4b0f89 100644 --- a/interpreter/spec/i32_convert.ml +++ b/interpreter/exec/i32_convert.ml @@ -2,7 +2,7 @@ let wrap_i64 x = Int64.to_int32 x -let trunc_s_f32 x = +let trunc_f32_s x = if F32.ne x x then raise Numeric_error.InvalidConversionToInteger else @@ -12,7 +12,7 @@ let trunc_s_f32 x = else Int32.of_float xf -let trunc_u_f32 x = +let trunc_f32_u x = if F32.ne x x then raise Numeric_error.InvalidConversionToInteger else @@ -22,7 +22,7 @@ let trunc_u_f32 x = else Int64.(to_int32 (of_float xf)) -let trunc_s_f64 x = +let trunc_f64_s x = if F64.ne x x then raise Numeric_error.InvalidConversionToInteger else @@ -32,7 +32,7 @@ let trunc_s_f64 x = else Int32.of_float xf -let trunc_u_f64 x = +let trunc_f64_u x = if F64.ne x x then raise Numeric_error.InvalidConversionToInteger else diff --git a/interpreter/spec/i32_convert.mli b/interpreter/exec/i32_convert.mli similarity index 50% rename from interpreter/spec/i32_convert.mli rename to interpreter/exec/i32_convert.mli index 2737aadd..20e4eb40 100644 --- a/interpreter/spec/i32_convert.mli +++ b/interpreter/exec/i32_convert.mli @@ -1,8 +1,8 @@ (* WebAssembly-compatible type conversions to i32 implementation *) val wrap_i64 : I64.t -> I32.t -val trunc_s_f32 : F32.t -> I32.t -val trunc_u_f32 : F32.t -> I32.t -val trunc_s_f64 : F64.t -> I32.t -val trunc_u_f64 : F64.t -> I32.t +val trunc_f32_s : F32.t -> I32.t +val trunc_f32_u : F32.t -> I32.t +val trunc_f64_s : F64.t -> I32.t +val trunc_f64_u : F64.t -> I32.t val reinterpret_f32 : F32.t -> I32.t diff --git a/interpreter/spec/i64.ml b/interpreter/exec/i64.ml similarity index 100% rename from interpreter/spec/i64.ml rename to interpreter/exec/i64.ml diff --git a/interpreter/spec/i64_convert.ml b/interpreter/exec/i64_convert.ml similarity index 75% rename from interpreter/spec/i64_convert.ml rename to interpreter/exec/i64_convert.ml index 7ea8ee6e..0919d324 100644 --- a/interpreter/spec/i64_convert.ml +++ b/interpreter/exec/i64_convert.ml @@ -1,10 +1,10 @@ (* WebAssembly-compatible type conversions to i64 implementation *) -let extend_s_i32 x = Int64.of_int32 x +let extend_i32_s x = Int64.of_int32 x -let extend_u_i32 x = Int64.logand (Int64.of_int32 x) 0x00000000ffffffffL +let extend_i32_u x = Int64.logand (Int64.of_int32 x) 0x0000_0000_ffff_ffffL -let trunc_s_f32 x = +let trunc_f32_s x = if F32.ne x x then raise Numeric_error.InvalidConversionToInteger else @@ -14,7 +14,7 @@ let trunc_s_f32 x = else Int64.of_float xf -let trunc_u_f32 x = +let trunc_f32_u x = if F32.ne x x then raise Numeric_error.InvalidConversionToInteger else @@ -22,11 +22,11 @@ let trunc_u_f32 x = if xf >= -.Int64.(to_float min_int) *. 2.0 || xf <= -1.0 then raise Numeric_error.IntegerOverflow else if xf >= -.Int64.(to_float min_int) then - Int64.(logxor (of_float (xf -. 9223372036854775808.0)) min_int) + Int64.(logxor (of_float (xf -. (* TODO(ocaml-4.03): 0x1p63 *) 9223372036854775808.0)) min_int) else Int64.of_float xf -let trunc_s_f64 x = +let trunc_f64_s x = if F64.ne x x then raise Numeric_error.InvalidConversionToInteger else @@ -36,7 +36,7 @@ let trunc_s_f64 x = else Int64.of_float xf -let trunc_u_f64 x = +let trunc_f64_u x = if F64.ne x x then raise Numeric_error.InvalidConversionToInteger else @@ -44,7 +44,7 @@ let trunc_u_f64 x = if xf >= -.Int64.(to_float min_int) *. 2.0 || xf <= -1.0 then raise Numeric_error.IntegerOverflow else if xf >= -.Int64.(to_float min_int) then - Int64.(logxor (of_float (xf -. 9223372036854775808.0)) min_int) + Int64.(logxor (of_float (xf -. (* TODO(ocaml-4.03): 0x1p63 *) 9223372036854775808.0)) min_int) else Int64.of_float xf diff --git a/interpreter/exec/i64_convert.mli b/interpreter/exec/i64_convert.mli new file mode 100644 index 00000000..02a0ce45 --- /dev/null +++ b/interpreter/exec/i64_convert.mli @@ -0,0 +1,9 @@ +(* WebAssembly-compatible type conversions to i64 implementation *) + +val extend_i32_s : I32.t -> I64.t +val extend_i32_u : I32.t -> I64.t +val trunc_f32_s : F32.t -> I64.t +val trunc_f32_u : F32.t -> I64.t +val trunc_f64_s : F64.t -> I64.t +val trunc_f64_u : F64.t -> I64.t +val reinterpret_f64 : F64.t -> I64.t diff --git a/interpreter/spec/int.ml b/interpreter/exec/int.ml similarity index 90% rename from interpreter/spec/int.ml rename to interpreter/exec/int.ml index a2574fe3..81674b15 100644 --- a/interpreter/spec/int.ml +++ b/interpreter/exec/int.ml @@ -175,7 +175,7 @@ struct let rec loop acc n = if n = Rep.zero then Rep.bitwidth - else if and_ n (Rep.shift_left Rep.one (Rep.bitwidth - 1)) = Rep.zero then + else if and_ n (Rep.shift_left Rep.one (Rep.bitwidth - 1)) = zero then loop (1 + acc) (Rep.shift_left n 1) else acc @@ -217,13 +217,6 @@ struct let of_int_s = Rep.of_int let of_int_u i = and_ (Rep.of_int i) (or_ (shl (Rep.of_int max_int) one) one) - let to_string_s = Rep.to_string - let to_string_u i = - if i >= Rep.zero then - to_string_s i - else - to_string_s (div_u i ten) ^ to_string_s (rem_u i ten) - (* String conversion that allows leading signs and unsigned values *) let require b = if not b then failwith "of_string" @@ -245,12 +238,14 @@ struct let len = String.length s in let rec parse_hex i num = if i = len then num else + if s.[i] = '_' then parse_hex (i + 1) num else let digit = of_int (hex_digit s.[i]) in require (le_u num (shr_u minus_one (of_int 4))); parse_hex (i + 1) (logor (shift_left num 4) digit) in let rec parse_dec i num = if i = len then num else + if s.[i] = '_' then parse_dec (i + 1) num else let digit = of_int (dec_digit s.[i]) in require (lt_u num max_upper || num = max_upper && le_u digit max_lower); parse_dec (i + 1) (add (mul num ten) digit) @@ -279,4 +274,28 @@ struct let n = of_string s in require (s.[0] != '+' && s.[0] != '-'); n + + (* String conversion that groups digits for readability *) + + let rec add_digits buf s i j k = + if i < j then begin + if k = 0 then Buffer.add_char buf '_'; + Buffer.add_char buf s.[i]; + add_digits buf s (i + 1) j ((k + 2) mod 3) + end + + let group_digits s = + let len = String.length s in + let num = if s.[0] = '-' then 1 else 0 in + let buf = Buffer.create (len*4/3) in + Buffer.add_substring buf s 0 num; + add_digits buf s num len ((len - num) mod 3 + 3); + Buffer.contents buf + + let to_string_s i = group_digits (Rep.to_string i) + let to_string_u i = + if i >= Rep.zero then + group_digits (Rep.to_string i) + else + group_digits (Rep.to_string (div_u i ten) ^ Rep.to_string (rem_u i ten)) end diff --git a/interpreter/spec/numeric_error.ml b/interpreter/exec/numeric_error.ml similarity index 100% rename from interpreter/spec/numeric_error.ml rename to interpreter/exec/numeric_error.ml diff --git a/interpreter/host/import/env.ml b/interpreter/host/env.ml similarity index 72% rename from interpreter/host/import/env.ml rename to interpreter/host/env.ml index 9414fd17..58239d10 100644 --- a/interpreter/host/import/env.ml +++ b/interpreter/host/env.ml @@ -14,7 +14,7 @@ let error msg = raise (Eval.Crash (Source.no_region, msg)) let type_error v t = error ("type error, expected " ^ string_of_value_type t ^ - ", got " ^ string_of_value_type (type_of v)) + ", got " ^ string_of_value_type (type_of_value v)) let empty = function | [] -> () @@ -26,8 +26,8 @@ let single = function | vs -> error "type error, too many arguments" let int = function - | I32 i -> Int32.to_int i - | v -> type_error v I32Type + | Num (I32 i) -> Int32.to_int i + | v -> type_error v (NumType I32Type) let abort vs = @@ -40,7 +40,7 @@ let exit vs = let lookup name t = - match name, t with - | "abort", ExternalFuncType t -> ExternalFunc (HostFunc (t, abort)) - | "exit", ExternalFuncType t -> ExternalFunc (HostFunc (t, exit)) + match Utf8.encode name, t with + | "abort", ExternFuncType t -> ExternFunc (Func.alloc_host t abort) + | "exit", ExternFuncType t -> ExternFunc (Func.alloc_host t exit) | _ -> raise Not_found diff --git a/interpreter/host/import/spectest.ml b/interpreter/host/import/spectest.ml deleted file mode 100644 index de953751..00000000 --- a/interpreter/host/import/spectest.ml +++ /dev/null @@ -1,39 +0,0 @@ -(* - * Simple collection of functions useful for writing test cases. - *) - -open Types -open Values -open Instance - - -let global (GlobalType (t, _)) = - match t with - | I32Type -> I32 666l - | I64Type -> I64 666L - | F32Type -> F32 (F32.of_float 666.6) - | F64Type -> F64 (F64.of_float 666.6) - -let table = Table.create AnyFuncType {min = 10l; max = Some 20l} -let memory = Memory.create {min = 1l; max = Some 2l} - -let print_value v = - Printf.printf "%s : %s\n" - (Values.string_of_value v) (Types.string_of_value_type (Values.type_of v)) - -let print (FuncType (_, out)) vs = - List.iter print_value vs; - flush_all (); - List.map default_value out - - -let lookup name t = - match name, t with - | "print", ExternalFuncType t -> ExternalFunc (HostFunc (t, print t)) - | "print", _ -> - let t = FuncType ([], []) in ExternalFunc (HostFunc (t, print t)) - | "global", ExternalGlobalType t -> ExternalGlobal (global t) - | "global", _ -> ExternalGlobal (global (GlobalType (I32Type, Immutable))) - | "table", _ -> ExternalTable table - | "memory", _ -> ExternalMemory memory - | _ -> raise Not_found diff --git a/interpreter/host/js.ml b/interpreter/host/js.ml deleted file mode 100644 index fff314c2..00000000 --- a/interpreter/host/js.ml +++ /dev/null @@ -1,395 +0,0 @@ -open Types -open Ast -open Script -open Source - - -(* Harness *) - -let harness = - "'use strict';\n" ^ - "\n" ^ - "let spectest = {\n" ^ - " print: print || ((...xs) => console.log(...xs)),\n" ^ - " global: 666,\n" ^ - " table: " ^ - "new WebAssembly.Table({initial: 10, maximum: 20, element: 'anyfunc'})," ^ - " memory: new WebAssembly.Memory({initial: 1, maximum: 2})," ^ - "};\n" ^ - "\n" ^ - "let registry = {spectest};\n" ^ - "\n" ^ - "function register(name, instance) {\n" ^ - " registry[name] = instance.exports;\n" ^ - "}\n" ^ - "\n" ^ - "function module(bytes, valid = true) {\n" ^ - " let buffer = new ArrayBuffer(bytes.length);\n" ^ - " let view = new Uint8Array(buffer);\n" ^ - " for (let i = 0; i < bytes.length; ++i) {\n" ^ - " view[i] = bytes.charCodeAt(i);\n" ^ - " }\n" ^ - " let validated;\n" ^ - " try {\n" ^ - " validated = WebAssembly.validate(buffer);\n" ^ - " } catch (e) {\n" ^ - " throw new Error(\"Wasm validate throws\");\n" ^ - " }\n" ^ - " if (validated !== valid) {\n" ^ - " throw new Error(\"Wasm validate failure\" + " ^ - "(valid ? \"\" : \" expected\"));\n" ^ - " }\n" ^ - " return new WebAssembly.Module(buffer);\n" ^ - "}\n" ^ - "\n" ^ - "function instance(bytes, imports = registry) {\n" ^ - " return new WebAssembly.Instance(module(bytes), imports);\n" ^ - "}\n" ^ - "\n" ^ - "function call(instance, name, args) {\n" ^ - " return instance.exports[name](...args);\n" ^ - "}\n" ^ - "\n" ^ - "function get(instance, name) {\n" ^ - " return instance.exports[name];\n" ^ - "}\n" ^ - "\n" ^ - "function exports(name, instance) {\n" ^ - " return {[name]: instance.exports};\n" ^ - "}\n" ^ - "\n" ^ - "function run(action) {\n" ^ - " action();\n" ^ - "}\n" ^ - "\n" ^ - "function assert_malformed(bytes) {\n" ^ - " try { module(bytes, false) } catch (e) {\n" ^ - " if (e instanceof WebAssembly.CompileError) return;\n" ^ - " }\n" ^ - " throw new Error(\"Wasm decoding failure expected\");\n" ^ - "}\n" ^ - "\n" ^ - "function assert_invalid(bytes) {\n" ^ - " try { module(bytes, false) } catch (e) {\n" ^ - " if (e instanceof WebAssembly.CompileError) return;\n" ^ - " }\n" ^ - " throw new Error(\"Wasm validation failure expected\");\n" ^ - "}\n" ^ - "\n" ^ - "function assert_unlinkable(bytes) {\n" ^ - " let mod = module(bytes);\n" ^ - " try { new WebAssembly.Instance(mod, registry) } catch (e) {\n" ^ - " if (e instanceof WebAssembly.LinkError) return;\n" ^ - " }\n" ^ - " throw new Error(\"Wasm linking failure expected\");\n" ^ - "}\n" ^ - "\n" ^ - "function assert_uninstantiable(bytes) {\n" ^ - " let mod = module(bytes);\n" ^ - " try { new WebAssembly.Instance(mod, registry) } catch (e) {\n" ^ - " if (e instanceof WebAssembly.RuntimeError) return;\n" ^ - " }\n" ^ - " throw new Error(\"Wasm trap expected\");\n" ^ - "}\n" ^ - "\n" ^ - "function assert_trap(action) {\n" ^ - " try { action() } catch (e) {\n" ^ - " if (e instanceof WebAssembly.RuntimeError) return;\n" ^ - " }\n" ^ - " throw new Error(\"Wasm trap expected\");\n" ^ - "}\n" ^ - "\n" ^ - "let StackOverflow;\n" ^ - "try { (function f() { 1 + f() })() } catch (e) { StackOverflow = e.constructor }\n" ^ - "\n" ^ - "function assert_exhaustion(action) {\n" ^ - " try { action() } catch (e) {\n" ^ - " if (e instanceof StackOverflow) return;\n" ^ - " }\n" ^ - " throw new Error(\"Wasm resource exhaustion expected\");\n" ^ - "}\n" ^ - "\n" ^ - "function assert_return(action, expected) {\n" ^ - " let actual = action();\n" ^ - " if (!Object.is(actual, expected)) {\n" ^ - " throw new Error(\"Wasm return value \" + expected + \" expected, got \" + actual);\n" ^ - " };\n" ^ - "}\n" ^ - "\n" ^ - "function assert_return_canonical_nan(action) {\n" ^ - " let actual = action();\n" ^ - " // Note that JS can't reliably distinguish different NaN values,\n" ^ - " // so there's no good way to test that it's a canonical NaN.\n" ^ - " if (!Number.isNaN(actual)) {\n" ^ - " throw new Error(\"Wasm return value NaN expected, got \" + actual);\n" ^ - " };\n" ^ - "}\n" ^ - "\n" ^ - "function assert_return_arithmetic_nan(action) {\n" ^ - " // Note that JS can't reliably distinguish different NaN values,\n" ^ - " // so there's no good way to test for specific bitpatterns here.\n" ^ - " let actual = action();\n" ^ - " if (!Number.isNaN(actual)) {\n" ^ - " throw new Error(\"Wasm return value NaN expected, got \" + actual);\n" ^ - " };\n" ^ - "}\n" ^ - "\n" - - -(* Context *) - -module Map = Map.Make(String) - -type exports = external_type Map.t -type modules = {mutable env : exports Map.t; mutable current : int} - -let exports m : exports = - List.fold_left - (fun map exp -> Map.add exp.it.name (export_type m exp) map) - Map.empty m.it.exports - -let modules () : modules = {env = Map.empty; current = 0} - -let current_var (mods : modules) = "$" ^ string_of_int mods.current -let of_var_opt (mods : modules) = function - | None -> current_var mods - | Some x -> x.it - -let bind (mods : modules) x_opt m = - let exports = exports m in - mods.current <- mods.current + 1; - mods.env <- Map.add (of_var_opt mods x_opt) exports mods.env; - if x_opt <> None then mods.env <- Map.add (current_var mods) exports mods.env - -let lookup (mods : modules) x_opt name at = - let exports = - try Map.find (of_var_opt mods x_opt) mods.env with Not_found -> - raise (Eval.Crash (at, - if x_opt = None then "no module defined within script" - else "unknown module " ^ of_var_opt mods x_opt ^ " within script")) - in try Map.find name exports with Not_found -> - raise (Eval.Crash (at, "unknown export \"" ^ name ^ "\" within module")) - - -(* Wrappers *) - -let eq_of = function - | I32Type -> Values.I32 I32Op.Eq - | I64Type -> Values.I64 I64Op.Eq - | F32Type -> Values.F32 F32Op.Eq - | F64Type -> Values.F64 F64Op.Eq - -let and_of = function - | I32Type | F32Type -> Values.I32 I32Op.And - | I64Type | F64Type -> Values.I64 I64Op.And - -let reinterpret_of = function - | I32Type -> I32Type, Nop - | I64Type -> I64Type, Nop - | F32Type -> I32Type, Convert (Values.I32 I32Op.ReinterpretFloat) - | F64Type -> I64Type, Convert (Values.I64 I64Op.ReinterpretFloat) - -let canonical_nan_of = function - | I32Type | F32Type -> Values.I32 (F32.to_bits F32.pos_nan) - | I64Type | F64Type -> Values.I64 (F64.to_bits F64.pos_nan) - -let abs_mask_of = function - | I32Type | F32Type -> Values.I32 Int32.max_int - | I64Type | F64Type -> Values.I64 Int64.max_int - -let invoke t lits at = - [t], FuncImport (1l @@ at) @@ at, - List.map (fun lit -> Const lit @@ at) lits @ [Call (0l @@ at) @@ at] - -let get t at = - [], GlobalImport t @@ at, [GetGlobal (0l @@ at) @@ at] - -let run ts at = - [], [] - -let assert_return lits ts at = - let test lit = - let t', reinterpret = reinterpret_of (Values.type_of lit.it) in - [ reinterpret @@ at; - Const lit @@ at; - reinterpret @@ at; - Compare (eq_of t') @@ at; - Test (Values.I32 I32Op.Eqz) @@ at; - BrIf (0l @@ at) @@ at ] - in [], List.flatten (List.rev_map test lits) - -let assert_return_nan_bitpattern nan_bitmask_of ts at = - let test t = - let t', reinterpret = reinterpret_of t in - [ reinterpret @@ at; - Const (nan_bitmask_of t' @@ at) @@ at; - Binary (and_of t') @@ at; - Const (canonical_nan_of t' @@ at) @@ at; - Compare (eq_of t') @@ at; - Test (Values.I32 I32Op.Eqz) @@ at; - BrIf (0l @@ at) @@ at ] - in [], List.flatten (List.rev_map test ts) - -let assert_return_canonical_nan = - (* The result may only differ from the canonical NaN in its sign bit *) - assert_return_nan_bitpattern abs_mask_of - -let assert_return_arithmetic_nan = - (* The result can be any NaN that's one everywhere the canonical NaN is one *) - assert_return_nan_bitpattern canonical_nan_of - -let wrap module_name item_name wrap_action wrap_assertion at = - let itypes, idesc, action = wrap_action at in - let locals, assertion = wrap_assertion at in - let item = Lib.List32.length itypes @@ at in - let types = FuncType ([], []) :: itypes in - let imports = [{module_name; item_name; idesc} @@ at] in - let edesc = FuncExport item @@ at in - let exports = [{name = "run"; edesc} @@ at] in - let body = - [ Block ([], action @ assertion @ [Return @@ at]) @@ at; - Unreachable @@ at ] - in - let funcs = [{ftype = 0l @@ at; locals; body} @@ at] in - let m = {empty_module with types; funcs; imports; exports} @@ at in - Encode.encode m - - -let is_js_value_type = function - | I32Type -> true - | I64Type | F32Type | F64Type -> false - -let is_js_global_type = function - | GlobalType (t, mut) -> is_js_value_type t && mut = Immutable - -let is_js_func_type = function - | FuncType (ins, out) -> List.for_all is_js_value_type (ins @ out) - - -(* Script conversion *) - -let add_hex_char buf c = Printf.bprintf buf "\\x%02x" (Char.code c) -let add_char buf c = - if c < '\x20' || c >= '\x7f' then - add_hex_char buf c - else begin - if c = '\"' || c = '\\' then Buffer.add_char buf '\\'; - Buffer.add_char buf c - end - -let of_string_with add_char s = - let buf = Buffer.create (4 * String.length s + 2) in - Buffer.add_char buf '\"'; - String.iter (add_char buf) s; - Buffer.add_char buf '\"'; - Buffer.contents buf - -let of_bytes = of_string_with add_hex_char -let of_string = of_string_with add_char - -let of_float z = - match string_of_float z with - | "nan" -> "NaN" - | "-nan" -> "-NaN" - | "inf" -> "Infinity" - | "-inf" -> "-Infinity" - | s -> s - -let of_literal lit = - match lit.it with - | Values.I32 i -> I32.to_string_s i - | Values.I64 i -> "int64(\"" ^ I64.to_string_s i ^ "\")" - | Values.F32 z -> of_float (F32.to_float z) - | Values.F64 z -> of_float (F64.to_float z) - -let of_definition def = - let bs = - match def.it with - | Textual m -> Encode.encode m - | Encoded (_, bs) -> bs - in of_bytes bs - -let of_wrapper mods x_opt name wrap_action wrap_assertion at = - let x = of_var_opt mods x_opt in - let bs = wrap x name wrap_action wrap_assertion at in - "call(instance(" ^ of_bytes bs ^ ", " ^ - "exports(" ^ of_string x ^ ", " ^ x ^ ")), " ^ " \"run\", [])" - -let of_action mods act = - match act.it with - | Invoke (x_opt, name, lits) -> - "call(" ^ of_var_opt mods x_opt ^ ", " ^ of_string name ^ ", " ^ - "[" ^ String.concat ", " (List.map of_literal lits) ^ "])", - (match lookup mods x_opt name act.at with - | ExternalFuncType ft when not (is_js_func_type ft) -> - let FuncType (_, out) = ft in - Some (of_wrapper mods x_opt name (invoke ft lits), out) - | _ -> None - ) - | Get (x_opt, name) -> - "get(" ^ of_var_opt mods x_opt ^ ", " ^ of_string name ^ ")", - (match lookup mods x_opt name act.at with - | ExternalGlobalType gt when not (is_js_global_type gt) -> - let GlobalType (t, _) = gt in - Some (of_wrapper mods x_opt name (get gt), [t]) - | _ -> None - ) - -let of_assertion' mods act name args wrapper_opt = - let act_js, act_wrapper_opt = of_action mods act in - let js = name ^ "(() => " ^ act_js ^ String.concat ", " ("" :: args) ^ ")" in - match act_wrapper_opt with - | None -> js ^ ";" - | Some (act_wrapper, out) -> - let run_name, wrapper = - match wrapper_opt with - | None -> name, run - | Some wrapper -> "run", wrapper - in run_name ^ "(() => " ^ act_wrapper (wrapper out) act.at ^ "); // " ^ js - -let of_assertion mods ass = - match ass.it with - | AssertMalformed (def, _) -> - "assert_malformed(" ^ of_definition def ^ ");" - | AssertInvalid (def, _) -> - "assert_invalid(" ^ of_definition def ^ ");" - | AssertUnlinkable (def, _) -> - "assert_unlinkable(" ^ of_definition def ^ ");" - | AssertUninstantiable (def, _) -> - "assert_uninstantiable(" ^ of_definition def ^ ");" - | AssertReturn (act, lits) -> - of_assertion' mods act "assert_return" (List.map of_literal lits) - (Some (assert_return lits)) - | AssertReturnCanonicalNaN act -> - of_assertion' mods act "assert_return_canonical_nan" [] (Some assert_return_canonical_nan) - | AssertReturnArithmeticNaN act -> - of_assertion' mods act "assert_return_arithmetic_nan" [] (Some assert_return_arithmetic_nan) - | AssertTrap (act, _) -> - of_assertion' mods act "assert_trap" [] None - | AssertExhaustion (act, _) -> - of_assertion' mods act "assert_exhaustion" [] None - -let of_command mods cmd = - "\n// " ^ Filename.basename cmd.at.left.file ^ - ":" ^ string_of_int cmd.at.left.line ^ "\n" ^ - match cmd.it with - | Module (x_opt, def) -> - let m = - match def.it with - | Textual m -> m - | Encoded (_, bs) -> Decode.decode "binary" bs - in bind mods x_opt m; - "let " ^ current_var mods ^ " = instance(" ^ of_definition def ^ ");\n" ^ - (if x_opt = None then "" else - "let " ^ of_var_opt mods x_opt ^ " = " ^ current_var mods ^ ";\n") - | Register (name, x_opt) -> - "register(" ^ of_string name ^ ", " ^ of_var_opt mods x_opt ^ ")\n" - | Action act -> - of_assertion' mods act "run" [] None ^ "\n" - | Assertion ass -> - of_assertion mods ass ^ "\n" - | Meta _ -> assert false - -let of_script scr = - (if !Flags.harness then harness else "") ^ - String.concat "" (List.map (of_command (modules ())) scr) diff --git a/interpreter/host/spectest.ml b/interpreter/host/spectest.ml new file mode 100644 index 00000000..a8d32aa5 --- /dev/null +++ b/interpreter/host/spectest.ml @@ -0,0 +1,52 @@ +(* + * Simple collection of functions useful for writing test cases. + *) + +open Types +open Values +open Instance + + +let global (GlobalType (t, _) as gt) = + let v = + match t with + | NumType I32Type -> Num (I32 666l) + | NumType I64Type -> Num (I64 666L) + | NumType F32Type -> Num (F32 (F32.of_float 666.6)) + | NumType F64Type -> Num (F64 (F64.of_float 666.6)) + | RefType _ -> Ref NullRef + | BotType -> assert false + in Global.alloc gt v + +let table = + Table.alloc (TableType ({min = 10l; max = Some 20l}, FuncRefType)) NullRef +let memory = Memory.alloc (MemoryType {min = 1l; max = Some 2l}) +let func f t = Func.alloc_host t (f t) + +let print_value v = + Printf.printf "%s : %s\n" + (Values.string_of_value v) + (Types.string_of_value_type (Values.type_of_value v)) + +let print (FuncType (_, out)) vs = + List.iter print_value vs; + flush_all (); + List.map default_value out + + +let lookup name t = + match Utf8.encode name, t with + | "print", _ -> ExternFunc (func print (FuncType ([], []))) + | "print_i32", _ -> ExternFunc (func print (FuncType ([NumType I32Type], []))) + | "print_i32_f32", _ -> + ExternFunc (func print (FuncType ([NumType I32Type; NumType F32Type], []))) + | "print_f64_f64", _ -> + ExternFunc (func print (FuncType ([NumType F64Type; NumType F64Type], []))) + | "print_f32", _ -> ExternFunc (func print (FuncType ([NumType F32Type], []))) + | "print_f64", _ -> ExternFunc (func print (FuncType ([NumType F64Type], []))) + | "global_i32", _ -> ExternGlobal (global (GlobalType (NumType I32Type, Immutable))) + | "global_f32", _ -> ExternGlobal (global (GlobalType (NumType F32Type, Immutable))) + | "global_f64", _ -> ExternGlobal (global (GlobalType (NumType F64Type, Immutable))) + | "table", _ -> ExternTable table + | "memory", _ -> ExternMemory memory + | _ -> raise Not_found diff --git a/interpreter/host/flags.ml b/interpreter/main/flags.ml similarity index 100% rename from interpreter/host/flags.ml rename to interpreter/main/flags.ml diff --git a/interpreter/host/main.ml b/interpreter/main/main.ml similarity index 87% rename from interpreter/host/main.ml rename to interpreter/main/main.ml index 5e62cab1..38b7bdc1 100644 --- a/interpreter/host/main.ml +++ b/interpreter/main/main.ml @@ -1,14 +1,12 @@ let name = "wasm" -let version = "0.7" +let version = "1.0" let configure () = - Import.register "spectest" Spectest.lookup; - Import.register "env" Env.lookup + Import.register (Utf8.decode "spectest") Spectest.lookup; + Import.register (Utf8.decode "env") Env.lookup let banner () = - print_endline - (name ^ "-" ^ Printf.sprintf "0x%lX" Encode.version ^ - " " ^ version ^ " reference interpreter") + print_endline (name ^ " " ^ version ^ " reference interpreter") let usage = "Usage: " ^ name ^ " [option] [file ...]" diff --git a/interpreter/findlib/META b/interpreter/meta/findlib/META similarity index 100% rename from interpreter/findlib/META rename to interpreter/meta/findlib/META diff --git a/interpreter/jslib/bsconfig.json b/interpreter/meta/jslib/bsconfig.json similarity index 100% rename from interpreter/jslib/bsconfig.json rename to interpreter/meta/jslib/bsconfig.json diff --git a/interpreter/jslib/build.sh b/interpreter/meta/jslib/build.sh similarity index 87% rename from interpreter/jslib/build.sh rename to interpreter/meta/jslib/build.sh index 2928d0cf..14471217 100755 --- a/interpreter/jslib/build.sh +++ b/interpreter/meta/jslib/build.sh @@ -31,7 +31,7 @@ echo " for file in $* do echo 1>&2 Including $file - name=`basename $file | sed s/.js//g` + name=`basename $file | sed s/[.]js//g` echo " _registry['$name'] = function() {     let exports = {}; @@ -70,23 +70,23 @@ echo " " } +echo 1>&2 ==== Preparing ==== +npm link bs-platform + echo 1>&2 ==== Compiling ==== -BSPATH=`which bsb` -BPATH=`dirname $BSPATH`/../lib/js -echo 1>&2 BSPATH = $BSPATH bsb || exit 1 -cp `dirname $BSPATH`/../lib/js/*.js lib/js/src echo 1>&2 ==== Linking full version ==== LOG=1 -link lib/js/src/*.js >temp.js || exit 1 +FILES='node_modules/bs-platform/lib/js/*.js lib/js/src/*.js' +link $FILES >temp.js || exit 1 echo 1>&2 ==== Running for dependencies ==== -node temp.js >temp.log || exit 1 +node temp.js | tee temp.log || exit 1 echo 1>&2 ==== Linking stripped version ==== used='' -for file in `ls lib/js/src/*.js` +for file in `ls $FILES` do if grep -q `basename $file | sed s/.js//g` temp.log then diff --git a/interpreter/jslib/wasm.ml b/interpreter/meta/jslib/wasm.ml similarity index 100% rename from interpreter/jslib/wasm.ml rename to interpreter/meta/jslib/wasm.ml diff --git a/interpreter/travis/build-test.sh b/interpreter/meta/travis/build-test.sh similarity index 80% rename from interpreter/travis/build-test.sh rename to interpreter/meta/travis/build-test.sh index 50d6b9b4..4b2b68d9 100755 --- a/interpreter/travis/build-test.sh +++ b/interpreter/meta/travis/build-test.sh @@ -5,7 +5,7 @@ set -x # Move to a location relative to the script so it runs # from anywhere. -cd $(dirname ${BASH_SOURCE[0]})/.. +cd $(dirname ${BASH_SOURCE[0]})/../.. export PATH=$PWD/../ocaml/install/bin:$PATH diff --git a/interpreter/meta/travis/install-ocaml.sh b/interpreter/meta/travis/install-ocaml.sh new file mode 100755 index 00000000..fa2c6c4f --- /dev/null +++ b/interpreter/meta/travis/install-ocaml.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +set -e + +download_from_gh_archive() { + local project=$1; + local version=$2; + local sha=$3; + + curl https://github.com/ocaml/${project}/archive/${version}.tar.gz -OL + CHECKSUM=$(shasum -a 256 ${version}.tar.gz | awk '{ print $1 }') + if [ ${CHECKSUM} != ${sha} ]; then + echo "Bad checksum ${project} download checksum!" + exit 1 + fi + tar xfz ${version}.tar.gz +} + +# Move to a location relative to the script so it runs +# from anywhere. Go three levels down to get out of interpreter/ +# and into the top-level dir, since we'll run ocamlbuild +# inside of interpreter/ and it goes pear-shaped if it +# encounters ocaml's own build directory. +cd $(dirname ${BASH_SOURCE[0]})/../../.. + +PREFIX=$PWD/ocaml/install + +rm -rf ocaml +mkdir ocaml +cd ocaml +mkdir install + +download_from_gh_archive ocaml 4.05.0 e5d8a6f629020c580473d8afcfcb06c3966d01929f7b734f41dc0c737cd8ea3f +cd ocaml-4.05.0 +./configure -prefix ${PREFIX} +make world.opt +make install +cd .. + +PATH=${PREFIX}/bin:${PATH} + +download_from_gh_archive ocamlbuild 0.11.0 1717edc841c9b98072e410f1b0bc8b84444b4b35ed3b4949ce2bec17c60103ee +cd ocamlbuild-0.11.0 +make configure +make +make install diff --git a/interpreter/runtime/func.ml b/interpreter/runtime/func.ml new file mode 100644 index 00000000..461cdc5b --- /dev/null +++ b/interpreter/runtime/func.ml @@ -0,0 +1,14 @@ +open Types +open Values + +type 'inst t = 'inst func +and 'inst func = + | AstFunc of func_type * 'inst * Ast.func + | HostFunc of func_type * (value list -> value list) + +let alloc ft inst f = AstFunc (ft, inst, f) +let alloc_host ft f = HostFunc (ft, f) + +let type_of = function + | AstFunc (ft, _, _) -> ft + | HostFunc (ft, _) -> ft diff --git a/interpreter/runtime/func.mli b/interpreter/runtime/func.mli new file mode 100644 index 00000000..d5346263 --- /dev/null +++ b/interpreter/runtime/func.mli @@ -0,0 +1,11 @@ +open Types +open Values + +type 'inst t = 'inst func +and 'inst func = + | AstFunc of func_type * 'inst * Ast.func + | HostFunc of func_type * (value list -> value list) + +val alloc : func_type -> 'inst -> Ast.func -> 'inst func +val alloc_host : func_type -> (value list -> value list) -> 'inst func +val type_of : 'inst func -> func_type diff --git a/interpreter/runtime/global.ml b/interpreter/runtime/global.ml new file mode 100644 index 00000000..181399e0 --- /dev/null +++ b/interpreter/runtime/global.ml @@ -0,0 +1,24 @@ +open Types +open Values + +type global = {ty : global_type; mutable content : value} +type t = global + +exception Type +exception NotMutable + +let alloc (GlobalType (t, _) as ty) v = + if not (match_value_type (type_of_value v) t) then raise Type; + {ty; content = v} + +let type_of glob = + glob.ty + +let load glob = + glob.content + +let store glob v = + let GlobalType (t, mut) = glob.ty in + if mut <> Mutable then raise NotMutable; + if not (match_value_type (type_of_value v) t) then raise Type; + glob.content <- v diff --git a/interpreter/runtime/global.mli b/interpreter/runtime/global.mli new file mode 100644 index 00000000..75c52faf --- /dev/null +++ b/interpreter/runtime/global.mli @@ -0,0 +1,14 @@ +open Types +open Values + +type global +type t = global + +exception Type +exception NotMutable + +val alloc : global_type -> value -> global (* raises Type *) +val type_of : global -> global_type + +val load : global -> value +val store : global -> value -> unit (* raises Type, NotMutable *) diff --git a/interpreter/runtime/instance.ml b/interpreter/runtime/instance.ml new file mode 100644 index 00000000..6288d111 --- /dev/null +++ b/interpreter/runtime/instance.ml @@ -0,0 +1,56 @@ +open Types + +type module_inst = +{ + types : func_type list; + funcs : func_inst list; + tables : table_inst list; + memories : memory_inst list; + globals : global_inst list; + exports : export_inst list; +} + +and func_inst = module_inst ref Func.t +and table_inst = Table.t +and memory_inst = Memory.t +and global_inst = Global.t +and export_inst = Ast.name * extern + +and extern = + | ExternFunc of func_inst + | ExternTable of table_inst + | ExternMemory of memory_inst + | ExternGlobal of global_inst + + +(* Reference type extensions *) + +type Values.ref_ += FuncRef of func_inst + +let () = + let type_of_ref' = !Values.type_of_ref' in + Values.type_of_ref' := function + | FuncRef _ -> FuncRefType + | r -> type_of_ref' r + +let () = + let string_of_ref' = !Values.string_of_ref' in + Values.string_of_ref' := function + | FuncRef _ -> "func" + | r -> string_of_ref' r + + +(* Auxiliary functions *) + +let empty_module_inst = + { types = []; funcs = []; tables = []; memories = []; globals = []; + exports = [] } + +let extern_type_of = function + | ExternFunc func -> ExternFuncType (Func.type_of func) + | ExternTable tab -> ExternTableType (Table.type_of tab) + | ExternMemory mem -> ExternMemoryType (Memory.type_of mem) + | ExternGlobal glob -> ExternGlobalType (Global.type_of glob) + +let export inst name = + try Some (List.assoc name inst.exports) with Not_found -> None diff --git a/interpreter/runtime/memory.ml b/interpreter/runtime/memory.ml new file mode 100644 index 00000000..c72ef0c3 --- /dev/null +++ b/interpreter/runtime/memory.ml @@ -0,0 +1,150 @@ +open Bigarray +open Lib.Bigarray +open Types +open Values + +type size = int32 (* number of pages *) +type address = int64 +type offset = int32 + +type pack_size = Pack8 | Pack16 | Pack32 +type extension = SX | ZX + +type memory' = (int, int8_unsigned_elt, c_layout) Array1.t +type memory = {mutable ty : memory_type; mutable content : memory'} +type t = memory + +exception Type +exception Bounds +exception SizeOverflow +exception SizeLimit +exception OutOfMemory + +let page_size = 0x10000L (* 64 KiB *) + +let packed_size = function + | Pack8 -> 1 + | Pack16 -> 2 + | Pack32 -> 4 + +let valid_limits {min; max} = + match max with + | None -> true + | Some m -> I32.le_u min m + +let create n = + if I32.gt_u n 0x10000l then raise SizeOverflow else + try + let size = Int64.(mul (of_int32 n) page_size) in + let mem = Array1_64.create Int8_unsigned C_layout size in + Array1.fill mem 0; + mem + with Out_of_memory -> raise OutOfMemory + +let alloc (MemoryType lim as ty) = + if not (valid_limits lim) then raise Type; + {ty; content = create lim.min} + +let bound mem = + Array1_64.dim mem.content + +let size mem = + Int64.(to_int32 (div (bound mem) page_size)) + +let type_of mem = + mem.ty + +let grow mem delta = + let MemoryType lim = mem.ty in + assert (lim.min = size mem); + let old_size = lim.min in + let new_size = Int32.add old_size delta in + if I32.gt_u old_size new_size then raise SizeOverflow else + let lim' = {lim with min = new_size} in + if not (valid_limits lim') then raise SizeLimit else + let after = create new_size in + let dim = Array1_64.dim mem.content in + Array1.blit (Array1_64.sub mem.content 0L dim) (Array1_64.sub after 0L dim); + mem.ty <- MemoryType lim'; + mem.content <- after + +let load_byte mem a = + try Array1_64.get mem.content a with Invalid_argument _ -> raise Bounds + +let store_byte mem a b = + try Array1_64.set mem.content a b with Invalid_argument _ -> raise Bounds + +let load_bytes mem a n = + let buf = Buffer.create n in + for i = 0 to n - 1 do + Buffer.add_char buf (Char.chr (load_byte mem Int64.(add a (of_int i)))) + done; + Buffer.contents buf + +let store_bytes mem a bs = + for i = String.length bs - 1 downto 0 do + store_byte mem Int64.(add a (of_int i)) (Char.code bs.[i]) + done + +let effective_address a o = + let ea = Int64.(add a (of_int32 o)) in + if I64.lt_u ea a then raise Bounds; + ea + +let loadn mem a o n = + assert (n > 0 && n <= 8); + let rec loop a n = + if n = 0 then 0L else begin + let x = Int64.(shift_left (loop (add a 1L) (n - 1)) 8) in + Int64.logor (Int64.of_int (load_byte mem a)) x + end + in loop (effective_address a o) n + +let storen mem a o n x = + assert (n > 0 && n <= 8); + let rec loop a n x = + if n > 0 then begin + Int64.(loop (add a 1L) (n - 1) (shift_right x 8)); + store_byte mem a (Int64.to_int x land 0xff) + end + in loop (effective_address a o) n x + +let load_num mem a o t = + let n = loadn mem a o (Types.size t) in + match t with + | I32Type -> I32 (Int64.to_int32 n) + | I64Type -> I64 n + | F32Type -> F32 (F32.of_bits (Int64.to_int32 n)) + | F64Type -> F64 (F64.of_bits n) + +let store_num mem a o n = + let x = + match n with + | I32 x -> Int64.of_int32 x + | I64 x -> x + | F32 x -> Int64.of_int32 (F32.to_bits x) + | F64 x -> F64.to_bits x + in storen mem a o (Types.size (Values.type_of_num n)) x + +let extend x n = function + | ZX -> x + | SX -> let sh = 64 - 8 * n in Int64.(shift_right (shift_left x sh) sh) + +let load_packed sz ext mem a o t = + assert (packed_size sz <= Types.size t); + let w = packed_size sz in + let x = extend (loadn mem a o w) w ext in + match t with + | I32Type -> I32 (Int64.to_int32 x) + | I64Type -> I64 x + | _ -> raise Type + +let store_packed sz mem a o n = + assert (packed_size sz <= Types.size (Values.type_of_num n)); + let w = packed_size sz in + let x = + match n with + | I32 x -> Int64.of_int32 x + | I64 x -> x + | _ -> raise Type + in storen mem a o w x diff --git a/interpreter/runtime/memory.mli b/interpreter/runtime/memory.mli new file mode 100644 index 00000000..6fe9d32f --- /dev/null +++ b/interpreter/runtime/memory.mli @@ -0,0 +1,44 @@ +open Types +open Values + +type memory +type t = memory + +type size = int32 (* number of pages *) +type address = int64 +type offset = int32 + +type pack_size = Pack8 | Pack16 | Pack32 +type extension = SX | ZX + +exception Type +exception Bounds +exception SizeOverflow +exception SizeLimit +exception OutOfMemory + +val page_size : int64 +val packed_size : pack_size -> int + +val alloc : memory_type -> memory (* raises Type, SizeOverflow, OutOfMemory *) +val type_of : memory -> memory_type +val size : memory -> size +val bound : memory -> address +val grow : memory -> size -> unit + (* raises SizeLimit, SizeOverflow, OutOfMemory *) + +val load_byte : memory -> address -> int (* raises Bounds *) +val store_byte : memory -> address -> int -> unit (* raises Bounds *) +val load_bytes : memory -> address -> int -> string (* raises Bounds *) +val store_bytes : memory -> address -> string -> unit (* raises Bounds *) + +val load_num : + memory -> address -> offset -> num_type -> num (* raises Bounds *) +val store_num : + memory -> address -> offset -> num -> unit (* raises Bounds *) +val load_packed : + pack_size -> extension -> memory -> address -> offset -> num_type -> num + (* raises Type, Bounds *) +val store_packed : + pack_size -> memory -> address -> offset -> num -> unit + (* raises Type, Bounds *) diff --git a/interpreter/runtime/table.ml b/interpreter/runtime/table.ml new file mode 100644 index 00000000..db7dacee --- /dev/null +++ b/interpreter/runtime/table.ml @@ -0,0 +1,59 @@ +open Types +open Values + +type size = int32 +type index = int32 + +type table = {mutable ty : table_type; mutable content : ref_ array} +type t = table + +exception Type +exception Bounds +exception SizeOverflow +exception SizeLimit +exception OutOfMemory + +let valid_limits {min; max} = + match max with + | None -> true + | Some m -> I32.le_u min m + +let create size r = + try Lib.Array32.make size r + with Out_of_memory | Invalid_argument _ -> raise OutOfMemory + +let alloc (TableType (lim, _) as ty) r = + if not (valid_limits lim) then raise Type; + {ty; content = create lim.min r} + +let size tab = + Lib.Array32.length tab.content + +let type_of tab = + tab.ty + +let grow tab delta r = + let TableType (lim, t) = tab.ty in + assert (lim.min = size tab); + let old_size = lim.min in + let new_size = Int32.add old_size delta in + if I32.gt_u old_size new_size then raise SizeOverflow else + let lim' = {lim with min = new_size} in + if not (valid_limits lim') then raise SizeLimit else + let after = create new_size r in + Array.blit tab.content 0 after 0 (Array.length tab.content); + tab.ty <- TableType (lim', t); + tab.content <- after + +let load tab i = + try Lib.Array32.get tab.content i with Invalid_argument _ -> raise Bounds + +let store tab i r = + let TableType (lim, t) = tab.ty in + if not (match_ref_type (type_of_ref r) t) then raise Type; + try Lib.Array32.set tab.content i r with Invalid_argument _ -> raise Bounds + +let blit tab offset rs = + let data = Array.of_list rs in + try Lib.Array32.blit data 0l tab.content offset (Lib.Array32.length data) + with Invalid_argument _ -> raise Bounds diff --git a/interpreter/runtime/table.mli b/interpreter/runtime/table.mli new file mode 100644 index 00000000..b452afcb --- /dev/null +++ b/interpreter/runtime/table.mli @@ -0,0 +1,24 @@ +open Types +open Values + +type table +type t = table + +type size = int32 +type index = int32 + +exception Type +exception Bounds +exception SizeOverflow +exception SizeLimit +exception OutOfMemory + +val alloc : table_type -> ref_ -> table (* raises Type, OutOfMemory *) +val type_of : table -> table_type +val size : table -> size +val grow : table -> size -> ref_ -> unit + (* raises SizeOverflow, SizeLimit, OutOfMemory *) + +val load : table -> index -> ref_ (* raises Bounds *) +val store : table -> index -> ref_ -> unit (* raises Type, Bounds *) +val blit : table -> index -> ref_ list -> unit (* raises Bounds *) diff --git a/interpreter/host/import.ml b/interpreter/script/import.ml similarity index 73% rename from interpreter/host/import.ml rename to interpreter/script/import.ml index 31595b67..c9e65eaf 100644 --- a/interpreter/host/import.ml +++ b/interpreter/script/import.ml @@ -4,7 +4,7 @@ open Ast module Unknown = Error.Make () exception Unknown = Unknown.Error (* indicates unknown import name *) -module Registry = Map.Make(String) +module Registry = Map.Make(struct type t = Ast.name let compare = compare end) let registry = ref Registry.empty let register name lookup = registry := Registry.add name lookup !registry @@ -14,6 +14,7 @@ let lookup (m : module_) (im : import) : Instance.extern = let t = import_type m im in try Registry.find module_name !registry item_name t with Not_found -> Unknown.error im.at - ("unknown import \"" ^ module_name ^ "." ^ item_name ^ "\"") + ("unknown import \"" ^ string_of_name module_name ^ + "\".\"" ^ string_of_name item_name ^ "\"") let link m = List.map (lookup m) m.it.imports diff --git a/interpreter/host/import.mli b/interpreter/script/import.mli similarity index 59% rename from interpreter/host/import.mli rename to interpreter/script/import.mli index 9310553d..7919297e 100644 --- a/interpreter/host/import.mli +++ b/interpreter/script/import.mli @@ -3,6 +3,6 @@ exception Unknown of Source.region * string val link : Ast.module_ -> Instance.extern list (* raises Unknown *) val register : - string -> - (string -> Types.external_type -> Instance.extern (* raise Not_found *)) -> + Ast.name -> + (Ast.name -> Types.extern_type -> Instance.extern (* raises Not_found *)) -> unit diff --git a/interpreter/script/js.ml b/interpreter/script/js.ml new file mode 100644 index 00000000..6f5c3e6c --- /dev/null +++ b/interpreter/script/js.ml @@ -0,0 +1,532 @@ +open Types +open Ast +open Script +open Source + + +(* Harness *) + +let harness = +{| +'use strict'; + +let hostrefs = {}; +let hostsym = Symbol("hostref"); +function hostref(s) { + if (! (s in hostrefs)) hostrefs[s] = {[hostsym]: s}; + return hostrefs[s]; +} +function is_hostref(x) { + return (x !== null && hostsym in x) ? 1 : 0; +} +function is_funcref(x) { + return typeof x === "function" ? 1 : 0; +} +function eq_ref(x, y) { + return x === y ? 1 : 0; +} + +let spectest = { + hostref: hostref, + is_hostref: is_hostref, + is_funcref: is_funcref, + eq_ref: eq_ref, + print: console.log.bind(console), + print_i32: console.log.bind(console), + print_i32_f32: console.log.bind(console), + print_f64_f64: console.log.bind(console), + print_f32: console.log.bind(console), + print_f64: console.log.bind(console), + global_i32: 666, + global_f32: 666, + global_f64: 666, + table: new WebAssembly.Table({initial: 10, maximum: 20, element: 'anyfunc'}), + memory: new WebAssembly.Memory({initial: 1, maximum: 2}) +}; + +let handler = { + get(target, prop) { + return (prop in target) ? target[prop] : {}; + } +}; +let registry = new Proxy({spectest}, handler); + +function register(name, instance) { + registry[name] = instance.exports; +} + +function module(bytes, valid = true) { + let buffer = new ArrayBuffer(bytes.length); + let view = new Uint8Array(buffer); + for (let i = 0; i < bytes.length; ++i) { + view[i] = bytes.charCodeAt(i); + } + let validated; + try { + validated = WebAssembly.validate(buffer); + } catch (e) { + throw new Error("Wasm validate throws"); + } + if (validated !== valid) { + throw new Error("Wasm validate failure" + (valid ? "" : " expected")); + } + return new WebAssembly.Module(buffer); +} + +function instance(bytes, imports = registry) { + return new WebAssembly.Instance(module(bytes), imports); +} + +function call(instance, name, args) { + return instance.exports[name](...args); +} + +function get(instance, name) { + let v = instance.exports[name]; + return (v instanceof WebAssembly.Global) ? v.value : v; +} + +function exports(instance) { + return {module: instance.exports, spectest: spectest}; +} + +function run(action) { + action(); +} + +function assert_malformed(bytes) { + try { module(bytes, false) } catch (e) { + if (e instanceof WebAssembly.CompileError) return; + } + throw new Error("Wasm decoding failure expected"); +} + +function assert_invalid(bytes) { + try { module(bytes, false) } catch (e) { + if (e instanceof WebAssembly.CompileError) return; + } + throw new Error("Wasm validation failure expected"); +} + +function assert_unlinkable(bytes) { + let mod = module(bytes); + try { new WebAssembly.Instance(mod, registry) } catch (e) { + if (e instanceof WebAssembly.LinkError) return; + } + throw new Error("Wasm linking failure expected"); +} + +function assert_uninstantiable(bytes) { + let mod = module(bytes); + try { new WebAssembly.Instance(mod, registry) } catch (e) { + if (e instanceof WebAssembly.RuntimeError) return; + } + throw new Error("Wasm trap expected"); +} + +function assert_trap(action) { + try { action() } catch (e) { + if (e instanceof WebAssembly.RuntimeError) return; + } + throw new Error("Wasm trap expected"); +} + +let StackOverflow; +try { (function f() { 1 + f() })() } catch (e) { StackOverflow = e.constructor } + +function assert_exhaustion(action) { + try { action() } catch (e) { + if (e instanceof StackOverflow) return; + } + throw new Error("Wasm resource exhaustion expected"); +} + +function assert_return(action, expected) { + let actual = action(); + if (!Object.is(actual, expected)) { + throw new Error("Wasm return value " + expected + " expected, got " + actual); + }; +} + +function assert_return_canonical_nan(action) { + let actual = action(); + // Note that JS can't reliably distinguish different NaN values, + // so there's no good way to test that it's a canonical NaN. + if (!Number.isNaN(actual)) { + throw new Error("Wasm return value NaN expected, got " + actual); + }; +} + +function assert_return_arithmetic_nan(action) { + // Note that JS can't reliably distinguish different NaN values, + // so there's no good way to test for specific bitpatterns here. + let actual = action(); + if (!Number.isNaN(actual)) { + throw new Error("Wasm return value NaN expected, got " + actual); + }; +} + +function assert_return_ref(action) { + let actual = action(); + if (actual === null || typeof actual !== "object" && typeof actual !== "function") { + throw new Error("Wasm reference return value expected, got " + actual); + }; +} + +function assert_return_func(action) { + let actual = action(); + if (typeof actual !== "function") { + throw new Error("Wasm function return value expected, got " + actual); + }; +} +|} + + +(* Context *) + +module NameMap = Map.Make(struct type t = Ast.name let compare = compare end) +module Map = Map.Make(String) + +type exports = extern_type NameMap.t +type modules = {mutable env : exports Map.t; mutable current : int} + +let exports m : exports = + List.fold_left + (fun map exp -> NameMap.add exp.it.name (export_type m exp) map) + NameMap.empty m.it.exports + +let modules () : modules = {env = Map.empty; current = 0} + +let current_var (mods : modules) = "$" ^ string_of_int mods.current +let of_var_opt (mods : modules) = function + | None -> current_var mods + | Some x -> x.it + +let bind (mods : modules) x_opt m = + let exports = exports m in + mods.current <- mods.current + 1; + mods.env <- Map.add (of_var_opt mods x_opt) exports mods.env; + if x_opt <> None then mods.env <- Map.add (current_var mods) exports mods.env + +let lookup (mods : modules) x_opt name at = + let exports = + try Map.find (of_var_opt mods x_opt) mods.env with Not_found -> + raise (Eval.Crash (at, + if x_opt = None then "no module defined within script" + else "unknown module " ^ of_var_opt mods x_opt ^ " within script")) + in try NameMap.find name exports with Not_found -> + raise (Eval.Crash (at, "unknown export \"" ^ + string_of_name name ^ "\" within module")) + + +(* Wrappers *) + +let subject_idx = 0l +let hostref_idx = 1l +let _is_hostref_idx = 2l +let is_funcref_idx = 3l +let eq_ref_idx = 4l +let subject_type_idx = 5l + +let eq_of = function + | I32Type -> Values.I32 I32Op.Eq + | I64Type -> Values.I64 I64Op.Eq + | F32Type -> Values.F32 F32Op.Eq + | F64Type -> Values.F64 F64Op.Eq + +let and_of = function + | I32Type | F32Type -> Values.I32 I32Op.And + | I64Type | F64Type -> Values.I64 I64Op.And + +let reinterpret_of = function + | I32Type -> I32Type, Nop + | I64Type -> I64Type, Nop + | F32Type -> I32Type, Convert (Values.I32 I32Op.ReinterpretFloat) + | F64Type -> I64Type, Convert (Values.I64 I64Op.ReinterpretFloat) + +let canonical_nan_of = function + | I32Type | F32Type -> Values.I32 (F32.to_bits F32.pos_nan) + | I64Type | F64Type -> Values.I64 (F64.to_bits F64.pos_nan) + +let abs_mask_of = function + | I32Type | F32Type -> Values.I32 Int32.max_int + | I64Type | F64Type -> Values.I64 Int64.max_int + +let value v = + match v.it with + | Values.Num num -> [Const (num @@ v.at) @@ v.at] + | Values.Ref Values.NullRef -> [RefNull @@ v.at] + | Values.Ref (HostRef n) -> + [Const (Values.I32 n @@ v.at) @@ v.at; Call (hostref_idx @@ v.at) @@ v.at] + | Values.Ref _ -> assert false + +let invoke ft vs at = + [ft @@ at], FuncImport (subject_type_idx @@ at) @@ at, + List.concat (List.map value vs) @ [Call (subject_idx @@ at) @@ at] + +let get t at = + [], GlobalImport t @@ at, [GlobalGet (subject_idx @@ at) @@ at] + +let run ts at = + [], [] + +let assert_return vs ts at = + let test v = + match v.it with + | Values.Num num -> + let t', reinterpret = reinterpret_of (Values.type_of_num num) in + [ reinterpret @@ at; + Const (num @@ v.at) @@ at; + reinterpret @@ at; + Compare (eq_of t') @@ at; + Test (Values.I32 I32Op.Eqz) @@ at; + BrIf (0l @@ at) @@ at ] + | Values.Ref Values.NullRef -> + [ RefIsNull @@ at; + Test (Values.I32 I32Op.Eqz) @@ at; + BrIf (0l @@ at) @@ at ] + | Values.Ref (HostRef n) -> + [ Const (Values.I32 n @@ at) @@ at; + Call (hostref_idx @@ at) @@ at; + Call (eq_ref_idx @@ at) @@ at; + Test (Values.I32 I32Op.Eqz) @@ at; + BrIf (0l @@ at) @@ at ] + | _ -> assert false + in [], List.flatten (List.rev_map test vs) + +let assert_return_nan_bitpattern nan_bitmask_of ts at = + let test = function + | NumType t -> + let t', reinterpret = reinterpret_of t in + [ reinterpret @@ at; + Const (nan_bitmask_of t' @@ at) @@ at; + Binary (and_of t') @@ at; + Const (canonical_nan_of t' @@ at) @@ at; + Compare (eq_of t') @@ at; + Test (Values.I32 I32Op.Eqz) @@ at; + BrIf (0l @@ at) @@ at ] + | RefType _ -> [Br (0l @@ at) @@ at] + | BotType -> assert false + in [], List.flatten (List.rev_map test ts) + +let assert_return_canonical_nan = assert_return_nan_bitpattern abs_mask_of +let assert_return_arithmetic_nan = assert_return_nan_bitpattern canonical_nan_of + +let assert_return_ref ts at = + let test = function + | NumType _ -> [Br (0l @@ at) @@ at] + | RefType _ -> + [ RefIsNull @@ at; + BrIf (0l @@ at) @@ at ] + | BotType -> assert false + in [], List.flatten (List.rev_map test ts) + +let assert_return_func ts at = + let test = function + | NumType _ -> [Br (0l @@ at) @@ at] + | RefType _ -> + [ Call (is_funcref_idx @@ at) @@ at; + Test (Values.I32 I32Op.Eqz) @@ at; + BrIf (0l @@ at) @@ at ] + | BotType -> assert false + in [], List.flatten (List.rev_map test ts) + +let wrap item_name wrap_action wrap_assertion at = + let itypes, idesc, action = wrap_action at in + let locals, assertion = wrap_assertion at in + let types = + (FuncType ([], []) @@ at) :: + (FuncType ([NumType I32Type], [RefType AnyRefType]) @@ at) :: + (FuncType ([RefType AnyRefType], [NumType I32Type]) @@ at) :: + (FuncType ([RefType AnyRefType], [NumType I32Type]) @@ at) :: + (FuncType ([RefType AnyRefType; RefType AnyRefType], [NumType I32Type]) @@ at) :: + itypes + in + let imports = + [ {module_name = Utf8.decode "module"; item_name; idesc} @@ at; + {module_name = Utf8.decode "spectest"; item_name = Utf8.decode "hostref"; + idesc = FuncImport (1l @@ at) @@ at} @@ at; + {module_name = Utf8.decode "spectest"; item_name = Utf8.decode "is_hostref"; + idesc = FuncImport (2l @@ at) @@ at} @@ at; + {module_name = Utf8.decode "spectest"; item_name = Utf8.decode "is_funcref"; + idesc = FuncImport (3l @@ at) @@ at} @@ at; + {module_name = Utf8.decode "spectest"; item_name = Utf8.decode "eq_ref"; + idesc = FuncImport (4l @@ at) @@ at} @@ at ] + in + let item = + List.fold_left + (fun i im -> + match im.it.idesc.it with FuncImport _ -> Int32.add i 1l | _ -> i + ) 0l imports @@ at + in + let edesc = FuncExport item @@ at in + let exports = [{name = Utf8.decode "run"; edesc} @@ at] in + let body = + [ Block ([], action @ assertion @ [Return @@ at]) @@ at; + Unreachable @@ at ] + in + let funcs = [{ftype = 0l @@ at; locals; body} @@ at] in + let m = {empty_module with types; funcs; imports; exports} @@ at in + Encode.encode m + + +let is_js_num_type = function + | I32Type -> true + | I64Type | F32Type | F64Type -> false + +let is_js_value_type = function + | NumType t -> is_js_num_type t + | RefType t -> true + | BotType -> assert false + +let is_js_global_type = function + | GlobalType (t, mut) -> is_js_value_type t && mut = Immutable + +let is_js_func_type = function + | FuncType (ins, out) -> List.for_all is_js_value_type (ins @ out) + + +(* Script conversion *) + +let add_hex_char buf c = Printf.bprintf buf "\\x%02x" (Char.code c) +let add_char buf c = + if c < '\x20' || c >= '\x7f' then + add_hex_char buf c + else begin + if c = '\"' || c = '\\' then Buffer.add_char buf '\\'; + Buffer.add_char buf c + end +let add_unicode_char buf uc = + if uc < 0x20 || uc >= 0x7f then + Printf.bprintf buf "\\u{%02x}" uc + else + add_char buf (Char.chr uc) + +let of_string_with iter add_char s = + let buf = Buffer.create 256 in + Buffer.add_char buf '\"'; + iter (add_char buf) s; + Buffer.add_char buf '\"'; + Buffer.contents buf + +let of_bytes = of_string_with String.iter add_hex_char +let of_name = of_string_with List.iter add_unicode_char + +let of_float z = + match string_of_float z with + | "nan" -> "NaN" + | "-nan" -> "-NaN" + | "inf" -> "Infinity" + | "-inf" -> "-Infinity" + | s -> s + +let of_value v = + let open Values in + match v.it with + | Num (I32 i) -> I32.to_string_s i + | Num (I64 i) -> "int64(\"" ^ I64.to_string_s i ^ "\")" + | Num (F32 z) -> of_float (F32.to_float z) + | Num (F64 z) -> of_float (F64.to_float z) + | Ref NullRef -> "null" + | Ref (HostRef n) -> "hostref(" ^ Int32.to_string n ^ ")" + | _ -> assert false + +let rec of_definition def = + match def.it with + | Textual m -> of_bytes (Encode.encode m) + | Encoded (_, bs) -> of_bytes bs + | Quoted (_, s) -> + try of_definition (Parse.string_to_module s) with Parse.Syntax _ -> + of_bytes "" + +let of_wrapper mods x_opt name wrap_action wrap_assertion at = + let x = of_var_opt mods x_opt in + let bs = wrap name wrap_action wrap_assertion at in + "call(instance(" ^ of_bytes bs ^ ", " ^ + "exports(" ^ x ^ ")), " ^ " \"run\", [])" + +let of_action mods act = + match act.it with + | Invoke (x_opt, name, vs) -> + "call(" ^ of_var_opt mods x_opt ^ ", " ^ of_name name ^ ", " ^ + "[" ^ String.concat ", " (List.map of_value vs) ^ "])", + (match lookup mods x_opt name act.at with + | ExternFuncType ft when not (is_js_func_type ft) -> + let FuncType (_, out) = ft in + Some (of_wrapper mods x_opt name (invoke ft vs), out) + | _ -> None + ) + | Get (x_opt, name) -> + "get(" ^ of_var_opt mods x_opt ^ ", " ^ of_name name ^ ")", + (match lookup mods x_opt name act.at with + | ExternGlobalType gt when not (is_js_global_type gt) -> + let GlobalType (t, _) = gt in + Some (of_wrapper mods x_opt name (get gt), [t]) + | _ -> None + ) + +let of_assertion' mods act name args wrapper_opt = + let act_js, act_wrapper_opt = of_action mods act in + let js = name ^ "(() => " ^ act_js ^ String.concat ", " ("" :: args) ^ ")" in + match act_wrapper_opt with + | None -> js ^ ";" + | Some (act_wrapper, out) -> + let run_name, wrapper = + match wrapper_opt with + | None -> name, run + | Some wrapper -> "run", wrapper + in run_name ^ "(() => " ^ act_wrapper (wrapper out) act.at ^ "); // " ^ js + +let of_assertion mods ass = + match ass.it with + | AssertMalformed (def, _) -> + "assert_malformed(" ^ of_definition def ^ ");" + | AssertInvalid (def, _) -> + "assert_invalid(" ^ of_definition def ^ ");" + | AssertUnlinkable (def, _) -> + "assert_unlinkable(" ^ of_definition def ^ ");" + | AssertUninstantiable (def, _) -> + "assert_uninstantiable(" ^ of_definition def ^ ");" + | AssertReturn (act, vs) -> + of_assertion' mods act "assert_return" (List.map of_value vs) + (Some (assert_return vs)) + | AssertReturnCanonicalNaN act -> + of_assertion' mods act "assert_return_canonical_nan" [] + (Some assert_return_canonical_nan) + | AssertReturnArithmeticNaN act -> + of_assertion' mods act "assert_return_arithmetic_nan" [] + (Some assert_return_arithmetic_nan) + | AssertReturnRef act -> + of_assertion' mods act "assert_return_ref" [] (Some assert_return_ref) + | AssertReturnFunc act -> + of_assertion' mods act "assert_return_func" [] (Some assert_return_func) + | AssertTrap (act, _) -> + of_assertion' mods act "assert_trap" [] None + | AssertExhaustion (act, _) -> + of_assertion' mods act "assert_exhaustion" [] None + +let of_command mods cmd = + "\n// " ^ Filename.basename cmd.at.left.file ^ + ":" ^ string_of_int cmd.at.left.line ^ "\n" ^ + match cmd.it with + | Module (x_opt, def) -> + let rec unquote def = + match def.it with + | Textual m -> m + | Encoded (_, bs) -> Decode.decode "binary" bs + | Quoted (_, s) -> unquote (Parse.string_to_module s) + in bind mods x_opt (unquote def); + "let " ^ current_var mods ^ " = instance(" ^ of_definition def ^ ");\n" ^ + (if x_opt = None then "" else + "let " ^ of_var_opt mods x_opt ^ " = " ^ current_var mods ^ ";\n") + | Register (name, x_opt) -> + "register(" ^ of_name name ^ ", " ^ of_var_opt mods x_opt ^ ")\n" + | Action act -> + of_assertion' mods act "run" [] None ^ "\n" + | Assertion ass -> + of_assertion mods ass ^ "\n" + | Meta _ -> assert false + +let of_script scr = + (if !Flags.harness then harness else "") ^ + String.concat "" (List.map (of_command (modules ())) scr) diff --git a/interpreter/host/js.mli b/interpreter/script/js.mli similarity index 100% rename from interpreter/host/js.mli rename to interpreter/script/js.mli diff --git a/interpreter/host/run.ml b/interpreter/script/run.ml similarity index 73% rename from interpreter/host/run.ml rename to interpreter/script/run.ml index 3e041c9a..949c4c0b 100644 --- a/interpreter/host/run.ml +++ b/interpreter/script/run.ml @@ -4,6 +4,7 @@ open Source (* Errors & Tracing *) +module Script = Error.Make () module Abort = Error.Make () module Assert = Error.Make () module IO = Error.Make () @@ -18,17 +19,20 @@ let trace name = if !Flags.trace then print_endline ("-- " ^ name) (* File types *) let binary_ext = "wasm" -let binary_sexpr_ext = "bin.wast" -let sexpr_ext = "wast" +let sexpr_ext = "wat" +let script_binary_ext = "bin.wast" +let script_ext = "wast" let js_ext = "js" -let dispatch_file_ext on_binary on_binary_sexpr on_sexpr on_js file = +let dispatch_file_ext on_binary on_sexpr on_script_binary on_script on_js file = if Filename.check_suffix file binary_ext then on_binary file - else if Filename.check_suffix file binary_sexpr_ext then - on_binary_sexpr file else if Filename.check_suffix file sexpr_ext then on_sexpr file + else if Filename.check_suffix file script_binary_ext then + on_script_binary file + else if Filename.check_suffix file script_ext then + on_script file else if Filename.check_suffix file js_ext then on_js file else @@ -47,7 +51,15 @@ let create_binary_file file _ get_module = close_out oc with exn -> close_out oc; raise exn -let create_sexpr_file mode file get_script _ = +let create_sexpr_file file _ get_module = + trace ("Writing (" ^ file ^ ")..."); + let oc = open_out file in + try + Print.module_ oc !Flags.width (get_module ()); + close_out oc + with exn -> close_out oc; raise exn + +let create_script_file mode file get_script _ = trace ("Writing (" ^ file ^ ")..."); let oc = open_out file in try @@ -68,8 +80,9 @@ let create_js_file file get_script _ = let output_file = dispatch_file_ext create_binary_file - (create_sexpr_file `Binary) - (create_sexpr_file `Textual) + create_sexpr_file + (create_script_file `Binary) + (create_script_file `Textual) create_js_file let output_stdout get_module = @@ -100,25 +113,31 @@ let input_from get_script run = | Eval.Exhaustion (at, msg) -> error at "resource exhaustion" msg | Eval.Crash (at, msg) -> error at "runtime crash" msg | Encode.Code (at, msg) -> error at "encoding error" msg + | Script.Error (at, msg) -> error at "script error" msg | IO (at, msg) -> error at "i/o error" msg | Assert (at, msg) -> error at "assertion failure" msg | Abort _ -> false -let input_sexpr name lexbuf start run = +let input_script start name lexbuf run = input_from (fun _ -> Parse.parse name lexbuf start) run +let input_sexpr name lexbuf run = + input_from (fun _ -> + let var_opt, def = Parse.parse name lexbuf Parse.Module in + [Module (var_opt, def) @@ no_region]) run + let input_binary name buf run = let open Source in input_from (fun _ -> [Module (None, Encoded (name, buf) @@ no_region) @@ no_region]) run -let input_sexpr_file file run = +let input_sexpr_file input file run = trace ("Loading (" ^ file ^ ")..."); let ic = open_in file in try let lexbuf = Lexing.from_channel ic in trace "Parsing..."; - let success = input_sexpr file lexbuf Parse.Script run in + let success = input file lexbuf run in close_in ic; success with exn -> close_in ic; raise exn @@ -142,8 +161,9 @@ let input_js_file file run = let input_file file run = dispatch_file_ext input_binary_file - input_sexpr_file - input_sexpr_file + (input_sexpr_file input_sexpr) + (input_sexpr_file (input_script Parse.Script)) + (input_sexpr_file (input_script Parse.Script)) input_js_file file run @@ -151,7 +171,7 @@ let input_string string run = trace ("Running (\"" ^ String.escaped string ^ "\")..."); let lexbuf = Lexing.from_string string in trace "Parsing..."; - input_sexpr "string" lexbuf Parse.Script run + input_script Parse.Script "string" lexbuf run (* Interactive *) @@ -175,7 +195,7 @@ let lexbuf_stdin buf len = let input_stdin run = let lexbuf = Lexing.from_function lexbuf_stdin in let rec loop () = - let success = input_sexpr "stdin" lexbuf Parse.Script1 run in + let success = input_script Parse.Script1 "stdin" lexbuf run in if not success then Lexing.flush_input lexbuf; if Lexing.(lexbuf.lex_curr_pos >= lexbuf.lex_buffer_len - 1) then continuing := false; @@ -192,25 +212,26 @@ let print_import m im = let open Types in let category, annotation = match Ast.import_type m im with - | ExternalFuncType t -> "func", string_of_func_type t - | ExternalTableType t -> "table", string_of_table_type t - | ExternalMemoryType t -> "memory", string_of_memory_type t - | ExternalGlobalType t -> "global", string_of_global_type t + | ExternFuncType t -> "func", string_of_func_type t + | ExternTableType t -> "table", string_of_table_type t + | ExternMemoryType t -> "memory", string_of_memory_type t + | ExternGlobalType t -> "global", string_of_global_type t in - Printf.printf " import %s %S %S : %s\n" - category im.it.Ast.module_name im.it.Ast.item_name annotation + Printf.printf " import %s \"%s\" \"%s\" : %s\n" + category (Ast.string_of_name im.it.Ast.module_name) + (Ast.string_of_name im.it.Ast.item_name) annotation let print_export m ex = let open Types in let category, annotation = match Ast.export_type m ex with - | ExternalFuncType t -> "func", string_of_func_type t - | ExternalTableType t -> "table", string_of_table_type t - | ExternalMemoryType t -> "memory", string_of_memory_type t - | ExternalGlobalType t -> "global", string_of_global_type t + | ExternFuncType t -> "func", string_of_func_type t + | ExternTableType t -> "table", string_of_table_type t + | ExternMemoryType t -> "memory", string_of_memory_type t + | ExternGlobalType t -> "global", string_of_global_type t in - Printf.printf " export %s %S : %s\n" - category (String.escaped ex.it.Ast.name) annotation + Printf.printf " export %s \"%s\" : %s\n" + category (Ast.string_of_name ex.it.Ast.name) annotation let print_module x_opt m = Printf.printf "module%s :\n" @@ -220,7 +241,7 @@ let print_module x_opt m = flush_all () let print_result vs = - let ts = List.map Values.type_of vs in + let ts = List.map Values.type_of_value vs in Printf.printf "%s : %s\n" (Values.string_of_values vs) (Types.string_of_value_types ts); flush_all () @@ -233,8 +254,8 @@ module Map = Map.Make(String) let quote : script ref = ref [] let scripts : script Map.t ref = ref Map.empty let modules : Ast.module_ Map.t ref = ref Map.empty -let instances : Instance.instance Map.t ref = ref Map.empty -let registry : Instance.instance Map.t ref = ref Map.empty +let instances : Instance.module_inst Map.t ref = ref Map.empty +let registry : Instance.module_inst Map.t ref = ref Map.empty let bind map x_opt y = let map' = @@ -262,30 +283,41 @@ let lookup_registry module_name item_name _t = (* Running *) -let run_definition def = +let rec run_definition def = match def.it with | Textual m -> m | Encoded (name, bs) -> trace "Decoding..."; Decode.decode name bs + | Quoted (_, s) -> + trace "Parsing quote..."; + let def' = Parse.string_to_module s in + run_definition def' let run_action act = match act.it with | Invoke (x_opt, name, vs) -> - trace ("Invoking function \"" ^ name ^ "\"..."); + trace ("Invoking function \"" ^ Ast.string_of_name name ^ "\"..."); let inst = lookup_instance x_opt act.at in (match Instance.export inst name with - | Some (Instance.ExternalFunc f) -> + | Some (Instance.ExternFunc f) -> + let Types.FuncType (ins, out) = Func.type_of f in + if List.length vs <> List.length ins then + Script.error act.at "wrong number of arguments"; + List.iter2 (fun v t -> + if not (Types.match_value_type (Values.type_of_value v.it) t) then + Script.error v.at "wrong type of argument" + ) vs ins; Eval.invoke f (List.map (fun v -> v.it) vs) | Some _ -> Assert.error act.at "export is not a function" | None -> Assert.error act.at "undefined export" ) | Get (x_opt, name) -> - trace ("Getting global \"" ^ name ^ "\"..."); + trace ("Getting global \"" ^ Ast.string_of_name name ^ "\"..."); let inst = lookup_instance x_opt act.at in (match Instance.export inst name with - | Some (Instance.ExternalGlobal v) -> [v] + | Some (Instance.ExternGlobal gl) -> [Global.load gl] | Some _ -> Assert.error act.at "export is not a global" | None -> Assert.error act.at "undefined export" ) @@ -298,7 +330,10 @@ let assert_result at correct got print_expect expect = end let assert_message at name msg re = - if String.sub msg 0 (String.length re) <> re then begin + if + String.length msg < String.length re || + String.sub msg 0 (String.length re) <> re + then begin print_endline ("Result: \"" ^ msg ^ "\""); print_endline ("Expect: \"" ^ re ^ "\""); Assert.error at ("wrong " ^ name ^ " error") @@ -310,7 +345,8 @@ let run_assertion ass = trace "Asserting malformed..."; (match ignore (run_definition def) with | exception Decode.Code (_, msg) -> assert_message ass.at "decoding" msg re - | _ -> Assert.error ass.at "expected decoding error" + | exception Parse.Syntax (_, msg) -> assert_message ass.at "parsing" msg re + | _ -> Assert.error ass.at "expected decoding/parsing error" ) | AssertInvalid (def, re) -> @@ -360,9 +396,10 @@ let run_assertion ass = trace ("Asserting return..."); let got_vs = run_action act in let is_canonical_nan = + let open Values in match got_vs with - | [Values.F32 got_f32] -> got_f32 = F32.pos_nan || got_f32 = F32.neg_nan - | [Values.F64 got_f64] -> got_f64 = F64.pos_nan || got_f64 = F64.neg_nan + | [Num (F32 got_f32)] -> got_f32 = F32.pos_nan || got_f32 = F32.neg_nan + | [Num (F64 got_f64)] -> got_f64 = F64.pos_nan || got_f64 = F64.neg_nan | _ -> false in assert_result ass.at is_canonical_nan got_vs print_endline "nan" @@ -370,15 +407,37 @@ let run_assertion ass = trace ("Asserting return..."); let got_vs = run_action act in let is_arithmetic_nan = - (* Accept any NaN that's one everywhere pos_nan is one *) + let open Values in match got_vs with - | [Values.F32 got_f32] -> let pos_nan = F32.to_bits F32.pos_nan in + | [Num (F32 got_f32)] -> + let pos_nan = F32.to_bits F32.pos_nan in Int32.logand (F32.to_bits got_f32) pos_nan = pos_nan - | [Values.F64 got_f64] -> let pos_nan = F64.to_bits F64.pos_nan in + | [Num (F64 got_f64)] -> + let pos_nan = F64.to_bits F64.pos_nan in Int64.logand (F64.to_bits got_f64) pos_nan = pos_nan | _ -> false in assert_result ass.at is_arithmetic_nan got_vs print_endline "nan" + | AssertReturnRef act -> + trace ("Asserting return..."); + let got_vs = run_action act in + let is_ref = + let open Values in + match got_vs with + | [Ref r] -> r <> NullRef + | _ -> false + in assert_result ass.at is_ref got_vs print_endline "ref" + + | AssertReturnFunc act -> + trace ("Asserting return..."); + let got_vs = run_action act in + let is_func = + let open Values in + match got_vs with + | [Ref r] -> r <> NullRef + | _ -> false + in assert_result ass.at is_func got_vs print_endline "func" + | AssertTrap (act, re) -> trace ("Asserting trap..."); (match run_action act with @@ -419,10 +478,10 @@ let rec run_command cmd = | Register (name, x_opt) -> quote := cmd :: !quote; if not !Flags.dry then begin - trace ("Registering module \"" ^ name ^ "\"..."); + trace ("Registering module \"" ^ Ast.string_of_name name ^ "\"..."); let inst = lookup_instance x_opt cmd.at in - registry := Map.add name inst !registry; - Import.register name (lookup_registry name) + registry := Map.add (Utf8.encode name) inst !registry; + Import.register name (lookup_registry (Utf8.encode name)) end | Action act -> diff --git a/interpreter/host/run.mli b/interpreter/script/run.mli similarity index 100% rename from interpreter/host/run.mli rename to interpreter/script/run.mli diff --git a/interpreter/text/script.ml b/interpreter/script/script.ml similarity index 59% rename from interpreter/text/script.ml rename to interpreter/script/script.ml index faa87e76..17393603 100644 --- a/interpreter/text/script.ml +++ b/interpreter/script/script.ml @@ -1,14 +1,18 @@ type var = string Source.phrase +type Values.ref_ += HostRef of int32 +type value = Values.value Source.phrase + type definition = definition' Source.phrase and definition' = | Textual of Ast.module_ | Encoded of string * string + | Quoted of string * string type action = action' Source.phrase and action' = - | Invoke of var option * string * Ast.literal list - | Get of var option * string + | Invoke of var option * Ast.name * value list + | Get of var option * Ast.name type assertion = assertion' Source.phrase and assertion' = @@ -16,16 +20,18 @@ and assertion' = | AssertInvalid of definition * string | AssertUnlinkable of definition * string | AssertUninstantiable of definition * string - | AssertReturn of action * Ast.literal list + | AssertReturn of action * value list | AssertReturnCanonicalNaN of action | AssertReturnArithmeticNaN of action + | AssertReturnRef of action + | AssertReturnFunc of action | AssertTrap of action * string | AssertExhaustion of action * string type command = command' Source.phrase and command' = | Module of var option * definition - | Register of string * var option + | Register of Ast.name * var option | Action of action | Assertion of assertion | Meta of meta @@ -39,3 +45,16 @@ and meta' = and script = command list exception Syntax of Source.region * string + + +let () = + let type_of_ref' = !Values.type_of_ref' in + Values.type_of_ref' := function + | HostRef _ -> Types.AnyRefType + | r -> type_of_ref' r + +let () = + let string_of_ref' = !Values.string_of_ref' in + Values.string_of_ref' := function + | HostRef n -> "ref " ^ Int32.to_string n + | r -> string_of_ref' r diff --git a/interpreter/spec/decode.mli b/interpreter/spec/decode.mli deleted file mode 100644 index 30a731b9..00000000 --- a/interpreter/spec/decode.mli +++ /dev/null @@ -1,3 +0,0 @@ -exception Code of Source.region * string - -val decode : string -> string -> Ast.module_ (* raise Code *) diff --git a/interpreter/spec/eval.ml b/interpreter/spec/eval.ml deleted file mode 100644 index 0511801b..00000000 --- a/interpreter/spec/eval.ml +++ /dev/null @@ -1,452 +0,0 @@ -open Values -open Types -open Instance -open Ast -open Source - - -(* Errors *) - -module Link = Error.Make () -module Trap = Error.Make () -module Crash = Error.Make () -module Exhaustion = Error.Make () - -exception Link = Link.Error -exception Trap = Trap.Error -exception Crash = Crash.Error (* failure that cannot happen in valid code *) -exception Exhaustion = Exhaustion.Error - -let memory_error at = function - | Memory.Bounds -> "out of bounds memory access" - | Memory.SizeOverflow -> "memory size overflow" - | Memory.SizeLimit -> "memory size limit reached" - | Memory.Type -> Crash.error at "type mismatch at memory access" - | exn -> raise exn - -let numeric_error at = function - | Numeric_error.IntegerOverflow -> "integer overflow" - | Numeric_error.IntegerDivideByZero -> "integer divide by zero" - | Numeric_error.InvalidConversionToInteger -> "invalid conversion to integer" - | Eval_numeric.TypeError (i, v, t) -> - Crash.error at - ("type error, expected " ^ Types.string_of_value_type t ^ " as operand " ^ - string_of_int i ^ ", got " ^ Types.string_of_value_type (type_of v)) - | exn -> raise exn - - -(* Administrative Expressions & Configurations *) - -type 'a stack = 'a list - -type admin_instr = admin_instr' phrase -and admin_instr' = - | Plain of instr' - | Trapped of string - | Break of int32 * value stack - | Label of stack_type * instr list * value stack * admin_instr list - | Local of instance * value ref list * value stack * admin_instr list - | Invoke of closure - -type config = -{ - locals : value ref list; - values : value stack; - instrs : admin_instr list; - depth : int; (* needed for return *) - budget : int; (* needed to model stack overflow *) -} - -let config vs es = - {locals = []; values = vs; instrs = es; depth = 0; budget = 300} - -let plain e = Plain e.it @@ e.at - -let lookup category list x = - try Lib.List32.nth list x.it with Failure _ -> - Crash.error x.at ("undefined " ^ category ^ " " ^ Int32.to_string x.it) - -let type_ (inst : instance) x = lookup "type" inst.module_.it.types x -let func (inst : instance) x = lookup "function" inst.funcs x -let table (inst : instance) x = lookup "table" inst.tables x -let memory (inst : instance) x = lookup "memory" inst.memories x -let global (inst : instance) x = lookup "global" inst.globals x -let local (locals : value ref list) x = lookup "local" locals x - -let elem inst x i at = - match Table.load (table inst x) i with - | Table.Uninitialized -> - Trap.error at ("uninitialized element " ^ Int32.to_string i) - | f -> f - | exception Table.Bounds -> - Trap.error at ("undefined element " ^ Int32.to_string i) - -let func_elem inst x i at = - match elem inst x i at with - | Func f -> f - | _ -> Crash.error at ("type mismatch for element " ^ Int32.to_string i) - -let func_type_of = function - | AstFunc (inst, f) -> lookup "type" (!inst).module_.it.types f.it.ftype - | HostFunc (t, _) -> t - -let take n (vs : 'a stack) at = - try Lib.List.take n vs with Failure _ -> Crash.error at "stack underflow" - -let drop n (vs : 'a stack) at = - try Lib.List.drop n vs with Failure _ -> Crash.error at "stack underflow" - - -(* Evaluation *) - -(* - * Conventions: - * e : instr - * v : value - * es : instr list - * vs : value stack - * c : config - *) - -let rec step (inst : instance) (c : config) : config = - let e = List.hd c.instrs in - let vs', es' = - match e.it, c.values with - | Plain e', vs -> - (match e', vs with - | Unreachable, vs -> - vs, [Trapped "unreachable executed" @@ e.at] - - | Nop, vs -> - vs, [] - - | Block (ts, es'), vs -> - vs, [Label (ts, [], [], List.map plain es') @@ e.at] - - | Loop (ts, es'), vs -> - vs, [Label ([], [e' @@ e.at], [], List.map plain es') @@ e.at] - - | If (ts, es1, es2), I32 0l :: vs' -> - vs', [Plain (Block (ts, es2)) @@ e.at] - - | If (ts, es1, es2), I32 i :: vs' -> - vs', [Plain (Block (ts, es1)) @@ e.at] - - | Br x, vs -> - [], [Break (x.it, vs) @@ e.at] - - | BrIf x, I32 0l :: vs' -> - vs', [] - - | BrIf x, I32 i :: vs' -> - vs', [Plain (Br x) @@ e.at] - - | BrTable (xs, x), I32 i :: vs' when I32.ge_u i (Lib.List32.length xs) -> - vs', [Plain (Br x) @@ e.at] - - | BrTable (xs, x), I32 i :: vs' -> - vs', [Plain (Br (Lib.List32.nth xs i)) @@ e.at] - - | Return, vs -> - vs, [Plain (Br ((Int32.of_int (c.depth - 1)) @@ e.at)) @@ e.at] - - | Call x, vs -> - vs, [Invoke (func inst x) @@ e.at] - - | CallIndirect x, I32 i :: vs -> - let clos = func_elem inst (0l @@ e.at) i e.at in - if type_ inst x <> func_type_of clos then - Trap.error e.at "indirect call signature mismatch"; - vs, [Invoke clos @@ e.at] - - | Drop, v :: vs' -> - vs', [] - - | Select, I32 0l :: v2 :: v1 :: vs' -> - v2 :: vs', [] - - | Select, I32 i :: v2 :: v1 :: vs' -> - v1 :: vs', [] - - | GetLocal x, vs -> - !(local c.locals x) :: vs, [] - - | SetLocal x, v :: vs' -> - local c.locals x := v; - vs', [] - - | TeeLocal x, v :: vs' -> - local c.locals x := v; - v :: vs', [] - - | GetGlobal x, vs -> - !(global inst x) :: vs, [] - - | SetGlobal x, v :: vs' -> - global inst x := v; - vs', [] - - | Load {offset; ty; sz; _}, I32 i :: vs' -> - let mem = memory inst (0l @@ e.at) in - let addr = I64_convert.extend_u_i32 i in - (try - let v = - match sz with - | None -> Memory.load mem addr offset ty - | Some (sz, ext) -> Memory.load_packed sz ext mem addr offset ty - in v :: vs', [] - with exn -> vs', [Trapped (memory_error e.at exn) @@ e.at]) - - | Store {offset; sz; _}, v :: I32 i :: vs' -> - let mem = memory inst (0l @@ e.at) in - let addr = I64_convert.extend_u_i32 i in - (try - (match sz with - | None -> Memory.store mem addr offset v - | Some sz -> Memory.store_packed sz mem addr offset v - ); - vs', [] - with exn -> vs', [Trapped (memory_error e.at exn) @@ e.at]); - - | CurrentMemory, vs -> - let mem = memory inst (0l @@ e.at) in - I32 (Memory.size mem) :: vs, [] - - | GrowMemory, I32 delta :: vs' -> - let mem = memory inst (0l @@ e.at) in - let old_size = Memory.size mem in - let result = - try Memory.grow mem delta; old_size - with Memory.SizeOverflow | Memory.SizeLimit | Memory.OutOfMemory -> -1l - in I32 result :: vs', [] - - | Const v, vs -> - v.it :: vs, [] - - | Test testop, v :: vs' -> - (try value_of_bool (Eval_numeric.eval_testop testop v) :: vs', [] - with exn -> vs', [Trapped (numeric_error e.at exn) @@ e.at]) - - | Compare relop, v2 :: v1 :: vs' -> - (try value_of_bool (Eval_numeric.eval_relop relop v1 v2) :: vs', [] - with exn -> vs', [Trapped (numeric_error e.at exn) @@ e.at]) - - | Unary unop, v :: vs' -> - (try Eval_numeric.eval_unop unop v :: vs', [] - with exn -> vs', [Trapped (numeric_error e.at exn) @@ e.at]) - - | Binary binop, v2 :: v1 :: vs' -> - (try Eval_numeric.eval_binop binop v1 v2 :: vs', [] - with exn -> vs', [Trapped (numeric_error e.at exn) @@ e.at]) - - | Convert cvtop, v :: vs' -> - (try Eval_numeric.eval_cvtop cvtop v :: vs', [] - with exn -> vs', [Trapped (numeric_error e.at exn) @@ e.at]) - - | _ -> - let s1 = string_of_values (List.rev vs) in - let s2 = string_of_value_types (List.map type_of (List.rev vs)) in - Crash.error e.at - ("missing or ill-typed operand on stack (" ^ s1 ^ " : " ^ s2 ^ ")") - ) - - | Trapped msg, vs -> - assert false - - | Break (k, vs'), vs -> - Crash.error e.at "undefined label" - - | Label (ts, es0, vs', []), vs -> - vs' @ vs, [] - - | Label (ts, es0, vs', {it = Trapped msg; at} :: es'), vs -> - vs, [Trapped msg @@ at] - - | Label (ts, es0, vs', {it = Break (0l, vs0); at} :: es'), vs -> - take (List.length ts) vs0 e.at @ vs, List.map plain es0 - - | Label (ts, es0, vs', {it = Break (k, vs0); at} :: es'), vs -> - vs, [Break (Int32.sub k 1l, vs0) @@ at] - - | Label (ts, es0, values, instrs), vs -> - let c' = step inst {c with values; instrs; depth = c.depth + 1} in - vs, [Label (ts, es0, c'.values, c'.instrs) @@ e.at] - - | Local (inst', locals, vs', []), vs -> - vs' @ vs, [] - - | Local (inst', locals, vs', {it = Trapped msg; at} :: es'), vs -> - vs, [Trapped msg @@ at] - - | Local (inst', locals, values, instrs), vs -> - let c' = step inst' {locals; values; instrs; depth = 0; budget = c.budget - 1} in - vs, [Local (inst', c'.locals, c'.values, c'.instrs) @@ e.at] - - | Invoke clos, vs when c.budget = 0 -> - Exhaustion.error e.at "call stack exhausted" - - | Invoke clos, vs -> - let FuncType (ins, out) = func_type_of clos in - let n = List.length ins in - let args, vs' = take n vs e.at, drop n vs e.at in - (match clos with - | AstFunc (inst', f) -> - let locals' = List.rev args @ List.map default_value f.it.locals in - let instrs' = [Plain (Block (out, f.it.body)) @@ f.at] in - vs', [Local (!inst', List.map ref locals', [], instrs') @@ e.at] - - | HostFunc (t, f) -> - try List.rev (f (List.rev args)) @ vs', [] - with Crash (_, msg) -> Crash.error e.at msg - ) - in {c with values = vs'; instrs = es' @ List.tl c.instrs} - - -let rec eval (inst : instance) (c : config) : value stack = - match c.instrs with - | [] -> - c.values - - | {it = Trapped msg; at} :: _ -> - Trap.error at msg - - | es -> - eval inst (step inst c) - - -(* Functions & Constants *) - -let invoke (clos : closure) (vs : value list) : value list = - let at = match clos with AstFunc (_, f) -> f.at | HostFunc _ -> no_region in - let FuncType (ins, out) = func_type_of clos in - if List.length vs <> List.length ins then - Crash.error at "wrong number of arguments"; - let inst = instance (empty_module @@ at) in - let c = config (List.rev vs) [Invoke clos @@ at] in - try List.rev (eval inst c) - with Stack_overflow -> Exhaustion.error at "call stack exhausted" - -let eval_const (inst : instance) (const : const) : value = - let c = config [] (List.map plain const.it) in - match eval inst c with - | [v] -> v - | vs -> Crash.error const.at "wrong number of results on stack" - -let i32 (v : value) at = - match v with - | I32 i -> i - | _ -> Crash.error at "type error: i32 value expected" - - -(* Modules *) - -let create_closure (m : module_) (f : func) = - AstFunc (ref (instance m), f) - -let create_table (tab : table) = - let {ttype = TableType (lim, t)} = tab.it in - Table.create t lim - -let create_memory (mem : memory) = - let {mtype = MemoryType lim} = mem.it in - Memory.create lim - -let create_global (glob : global) = - let {gtype = GlobalType (t, _); _} = glob.it in - ref (default_value t) - -let init_closure (inst : instance) (clos : closure) = - match clos with - | AstFunc (inst_ref, _) -> inst_ref := inst - | _ -> assert false - -let init_table (inst : instance) (seg : table_segment) = - let {index; offset = const; init} = seg.it in - let tab = table inst index in - let offset = i32 (eval_const inst const) const.at in - let end_ = Int32.(add offset (of_int (List.length init))) in - let bound = Table.size tab in - if I32.lt_u bound end_ || I32.lt_u end_ offset then - Link.error seg.at "elements segment does not fit table"; - fun () -> Table.blit tab offset (List.map (fun x -> Func (func inst x)) init) - -let init_memory (inst : instance) (seg : memory_segment) = - let {index; offset = const; init} = seg.it in - let mem = memory inst index in - let offset' = i32 (eval_const inst const) const.at in - let offset = I64_convert.extend_u_i32 offset' in - let end_ = Int64.(add offset (of_int (String.length init))) in - let bound = Memory.bound mem in - if I64.lt_u bound end_ || I64.lt_u end_ offset then - Link.error seg.at "data segment does not fit memory"; - fun () -> Memory.blit mem offset init - -let init_global (inst : instance) (ref : value ref) (glob : global) = - let {value; _} = glob.it in - ref := eval_const inst value - -let check_limits actual expected at = - if I32.lt_u actual.min expected.min then - Link.error at "actual size smaller than declared"; - if - match actual.max, expected.max with - | _, None -> false - | None, Some _ -> true - | Some i, Some j -> I32.gt_u i j - then Link.error at "maximum size larger than declared" - -let add_import (ext : extern) (im : import) (inst : instance) : instance = - let {idesc; _} = im.it in - match ext, idesc.it with - | ExternalFunc clos, FuncImport x when func_type_of clos = type_ inst x -> - {inst with funcs = clos :: inst.funcs} - | ExternalTable tab, TableImport (TableType (lim, t)) - when Table.elem_type tab = t -> - check_limits (Table.limits tab) lim idesc.at; - {inst with tables = tab :: inst.tables} - | ExternalMemory mem, MemoryImport (MemoryType lim) -> - check_limits (Memory.limits mem) lim idesc.at; - {inst with memories = mem :: inst.memories} - | ExternalGlobal v, GlobalImport (GlobalType (t, _)) when type_of v = t -> - {inst with globals = ref v :: inst.globals} - | _ -> - Link.error idesc.at "type mismatch" - -let add_export (inst : instance) (ex : export) (map : extern ExportMap.t) - : extern ExportMap.t = - let {name; edesc} = ex.it in - let ext = - match edesc.it with - | FuncExport x -> ExternalFunc (func inst x) - | TableExport x -> ExternalTable (table inst x) - | MemoryExport x -> ExternalMemory (memory inst x) - | GlobalExport x -> ExternalGlobal !(global inst x) - in ExportMap.add name ext map - -let init (m : module_) (exts : extern list) : instance = - let - { imports; tables; memories; globals; funcs; - exports; elems; data; start; _ - } = m.it - in - if List.length exts <> List.length imports then - Link.error m.at "wrong number of imports provided for initialisation"; - let fs = List.map (create_closure m) funcs in - let gs = List.map create_global globals in - let inst = - List.fold_right2 add_import exts imports - { (instance m) with - funcs = fs; - tables = List.map create_table tables; - memories = List.map create_memory memories; - globals = gs; - } - in - List.iter2 (init_global inst) gs globals; - List.iter (init_closure inst) fs; - let init_elems = List.map (init_table inst) elems in - let init_datas = List.map (init_memory inst) data in - List.iter (fun f -> f ()) init_elems; - List.iter (fun f -> f ()) init_datas; - Lib.Option.app (fun x -> ignore (invoke (func inst x) [])) start; - {inst with exports = List.fold_right (add_export inst) exports inst.exports} diff --git a/interpreter/spec/eval_numeric.ml b/interpreter/spec/eval_numeric.ml deleted file mode 100644 index dd402558..00000000 --- a/interpreter/spec/eval_numeric.ml +++ /dev/null @@ -1,197 +0,0 @@ -open Types -open Values - - -(* Runtime type errors *) - -exception TypeError of int * value * value_type - -let of_arg f n v = - try f v with Value t -> raise (TypeError (n, v, t)) - - -(* Int operators *) - -module IntOp (IXX : Int.S) (Value : ValueType with type t = IXX.t) = -struct - open Ast.IntOp - - let to_value = Value.to_value - let of_value = of_arg Value.of_value - - let unop op = - let f = match op with - | Clz -> IXX.clz - | Ctz -> IXX.ctz - | Popcnt -> IXX.popcnt - in fun v -> to_value (f (of_value 1 v)) - - let binop op = - let f = match op with - | Add -> IXX.add - | Sub -> IXX.sub - | Mul -> IXX.mul - | DivS -> IXX.div_s - | DivU -> IXX.div_u - | RemS -> IXX.rem_s - | RemU -> IXX.rem_u - | And -> IXX.and_ - | Or -> IXX.or_ - | Xor -> IXX.xor - | Shl -> IXX.shl - | ShrU -> IXX.shr_u - | ShrS -> IXX.shr_s - | Rotl -> IXX.rotl - | Rotr -> IXX.rotr - in fun v1 v2 -> to_value (f (of_value 1 v1) (of_value 2 v2)) - - let testop op = - let f = match op with - | Eqz -> IXX.eqz - in fun v -> f (of_value 1 v) - - let relop op = - let f = match op with - | Eq -> IXX.eq - | Ne -> IXX.ne - | LtS -> IXX.lt_s - | LtU -> IXX.lt_u - | LeS -> IXX.le_s - | LeU -> IXX.le_u - | GtS -> IXX.gt_s - | GtU -> IXX.gt_u - | GeS -> IXX.ge_s - | GeU -> IXX.ge_u - in fun v1 v2 -> f (of_value 1 v1) (of_value 2 v2) -end - -module I32Op = IntOp (I32) (Values.I32Value) -module I64Op = IntOp (I64) (Values.I64Value) - - -(* Float operators *) - -module FloatOp (FXX : Float.S) (Value : ValueType with type t = FXX.t) = -struct - open Ast.FloatOp - - let to_value = Value.to_value - let of_value = of_arg Value.of_value - - let unop op = - let f = match op with - | Neg -> FXX.neg - | Abs -> FXX.abs - | Sqrt -> FXX.sqrt - | Ceil -> FXX.ceil - | Floor -> FXX.floor - | Trunc -> FXX.trunc - | Nearest -> FXX.nearest - in fun v -> to_value (f (of_value 1 v)) - - let binop op = - let f = match op with - | Add -> FXX.add - | Sub -> FXX.sub - | Mul -> FXX.mul - | Div -> FXX.div - | Min -> FXX.min - | Max -> FXX.max - | CopySign -> FXX.copysign - in fun v1 v2 -> to_value (f (of_value 1 v1) (of_value 2 v2)) - - let testop op = assert false - - let relop op = - let f = match op with - | Eq -> FXX.eq - | Ne -> FXX.ne - | Lt -> FXX.lt - | Le -> FXX.le - | Gt -> FXX.gt - | Ge -> FXX.ge - in fun v1 v2 -> f (of_value 1 v1) (of_value 2 v2) -end - -module F32Op = FloatOp (F32) (Values.F32Value) -module F64Op = FloatOp (F64) (Values.F64Value) - - -(* Conversion operators *) - -module I32CvtOp = -struct - open Ast.IntOp - - let cvtop op v = - match op with - | WrapI64 -> I32 (I32_convert.wrap_i64 (I64Op.of_value 1 v)) - | TruncSF32 -> I32 (I32_convert.trunc_s_f32 (F32Op.of_value 1 v)) - | TruncUF32 -> I32 (I32_convert.trunc_u_f32 (F32Op.of_value 1 v)) - | TruncSF64 -> I32 (I32_convert.trunc_s_f64 (F64Op.of_value 1 v)) - | TruncUF64 -> I32 (I32_convert.trunc_u_f64 (F64Op.of_value 1 v)) - | ReinterpretFloat -> I32 (I32_convert.reinterpret_f32 (F32Op.of_value 1 v)) - | ExtendSI32 -> raise (TypeError (1, v, I32Type)) - | ExtendUI32 -> raise (TypeError (1, v, I32Type)) -end - -module I64CvtOp = -struct - open Ast.IntOp - - let cvtop op v = - match op with - | ExtendSI32 -> I64 (I64_convert.extend_s_i32 (I32Op.of_value 1 v)) - | ExtendUI32 -> I64 (I64_convert.extend_u_i32 (I32Op.of_value 1 v)) - | TruncSF32 -> I64 (I64_convert.trunc_s_f32 (F32Op.of_value 1 v)) - | TruncUF32 -> I64 (I64_convert.trunc_u_f32 (F32Op.of_value 1 v)) - | TruncSF64 -> I64 (I64_convert.trunc_s_f64 (F64Op.of_value 1 v)) - | TruncUF64 -> I64 (I64_convert.trunc_u_f64 (F64Op.of_value 1 v)) - | ReinterpretFloat -> I64 (I64_convert.reinterpret_f64 (F64Op.of_value 1 v)) - | WrapI64 -> raise (TypeError (1, v, I64Type)) -end - -module F32CvtOp = -struct - open Ast.FloatOp - - let cvtop op v = - match op with - | DemoteF64 -> F32 (F32_convert.demote_f64 (F64Op.of_value 1 v)) - | ConvertSI32 -> F32 (F32_convert.convert_s_i32 (I32Op.of_value 1 v)) - | ConvertUI32 -> F32 (F32_convert.convert_u_i32 (I32Op.of_value 1 v)) - | ConvertSI64 -> F32 (F32_convert.convert_s_i64 (I64Op.of_value 1 v)) - | ConvertUI64 -> F32 (F32_convert.convert_u_i64 (I64Op.of_value 1 v)) - | ReinterpretInt -> F32 (F32_convert.reinterpret_i32 (I32Op.of_value 1 v)) - | PromoteF32 -> raise (TypeError (1, v, F32Type)) -end - -module F64CvtOp = -struct - open Ast.FloatOp - - let cvtop op v = - match op with - | PromoteF32 -> F64 (F64_convert.promote_f32 (F32Op.of_value 1 v)) - | ConvertSI32 -> F64 (F64_convert.convert_s_i32 (I32Op.of_value 1 v)) - | ConvertUI32 -> F64 (F64_convert.convert_u_i32 (I32Op.of_value 1 v)) - | ConvertSI64 -> F64 (F64_convert.convert_s_i64 (I64Op.of_value 1 v)) - | ConvertUI64 -> F64 (F64_convert.convert_u_i64 (I64Op.of_value 1 v)) - | ReinterpretInt -> F64 (F64_convert.reinterpret_i64 (I64Op.of_value 1 v)) - | DemoteF64 -> raise (TypeError (1, v, F64Type)) -end - - -(* Dispatch *) - -let op i32 i64 f32 f64 = function - | I32 x -> i32 x - | I64 x -> i64 x - | F32 x -> f32 x - | F64 x -> f64 x - -let eval_unop = op I32Op.unop I64Op.unop F32Op.unop F64Op.unop -let eval_binop = op I32Op.binop I64Op.binop F32Op.binop F64Op.binop -let eval_testop = op I32Op.testop I64Op.testop F32Op.testop F64Op.testop -let eval_relop = op I32Op.relop I64Op.relop F32Op.relop F64Op.relop -let eval_cvtop = op I32CvtOp.cvtop I64CvtOp.cvtop F32CvtOp.cvtop F64CvtOp.cvtop diff --git a/interpreter/spec/eval_numeric.mli b/interpreter/spec/eval_numeric.mli deleted file mode 100644 index 7435b3c6..00000000 --- a/interpreter/spec/eval_numeric.mli +++ /dev/null @@ -1,9 +0,0 @@ -open Values - -exception TypeError of int * value * Types.value_type - -val eval_unop : Ast.unop -> value -> value -val eval_binop : Ast.binop -> value -> value -> value -val eval_testop : Ast.testop -> value -> bool -val eval_relop : Ast.relop -> value -> value -> bool -val eval_cvtop : Ast.cvtop -> value -> value diff --git a/interpreter/spec/f32_convert.ml b/interpreter/spec/f32_convert.ml deleted file mode 100644 index 78730010..00000000 --- a/interpreter/spec/f32_convert.ml +++ /dev/null @@ -1,41 +0,0 @@ -(* WebAssembly-compatible type conversions to f32 implementation *) - -let demote_f64 x = - let xf = F64.to_float x in - if xf = xf then F32.of_float xf else - let nan64bits = F64.to_bits x in - let sign_field = Int64.(shift_left (shift_right_logical nan64bits 63) 31) in - let significand_field = Int64.(shift_right_logical (shift_left nan64bits 12) 41) in - let fields = Int64.logor sign_field significand_field in - let nan32bits = Int32.logor 0x7fc00000l (I32_convert.wrap_i64 fields) in - F32.of_bits nan32bits - -let convert_s_i32 x = - F32.of_float (Int32.to_float x) - -(* - * Similar to convert_u_i64 below, the high half of the i32 range are beyond - * the range where f32 can represent odd numbers, though we do need to adjust - * the least significant bit to round correctly. - *) -let convert_u_i32 x = - F32.of_float - Int32.(if x >= zero then to_float x else - to_float (logor (shift_right_logical x 1) (logand x 1l)) *. 2.0) - -let convert_s_i64 x = - F32.of_float (Int64.to_float x) - -(* - * Values in the low half of the int64 range can be converted with a signed - * conversion. The high half is beyond the range where f32 can represent odd - * numbers, so we can shift the value right, do a conversion, and then scale it - * back up, without worrying about losing the least-significant digit. - *) -let convert_u_i64 x = - F32.of_float (if x >= Int64.zero then - Int64.to_float x - else - Int64.(to_float (shift_right_logical x 1) *. 2.0)) - -let reinterpret_i32 = F32.of_bits diff --git a/interpreter/spec/f32_convert.mli b/interpreter/spec/f32_convert.mli deleted file mode 100644 index bcff3589..00000000 --- a/interpreter/spec/f32_convert.mli +++ /dev/null @@ -1,8 +0,0 @@ -(* WebAssembly-compatible type conversions to f32 implementation *) - -val demote_f64 : F64.t -> F32.t -val convert_s_i32 : I32.t -> F32.t -val convert_u_i32 : I32.t -> F32.t -val convert_s_i64 : I64.t -> F32.t -val convert_u_i64 : I64.t -> F32.t -val reinterpret_i32 : I32.t -> F32.t diff --git a/interpreter/spec/f64.ml b/interpreter/spec/f64.ml deleted file mode 100644 index 7ca281d4..00000000 --- a/interpreter/spec/f64.ml +++ /dev/null @@ -1,9 +0,0 @@ -include Float.Make - (struct - include Int64 - let pos_nan = 0x7ff8000000000000L - let neg_nan = 0xfff8000000000000L - let bare_nan = 0x7ff0000000000000L - let print_nan_significand_digits a = - Printf.sprintf "%Lx" (abs (Int64.logxor bare_nan a)) - end) diff --git a/interpreter/spec/f64_convert.mli b/interpreter/spec/f64_convert.mli deleted file mode 100644 index a1209a3e..00000000 --- a/interpreter/spec/f64_convert.mli +++ /dev/null @@ -1,8 +0,0 @@ -(* WebAssembly-compatible type conversions to f64 implementation *) - -val promote_f32 : F32.t -> F64.t -val convert_s_i32 : I32.t -> F64.t -val convert_u_i32 : I32.t -> F64.t -val convert_s_i64 : I64.t -> F64.t -val convert_u_i64 : I64.t -> F64.t -val reinterpret_i64 : I64.t -> F64.t diff --git a/interpreter/spec/float.ml b/interpreter/spec/float.ml deleted file mode 100644 index a2f2f007..00000000 --- a/interpreter/spec/float.ml +++ /dev/null @@ -1,229 +0,0 @@ -module type RepType = -sig - type t - - val pos_nan : t - val neg_nan : t - val bits_of_float : float -> t - val float_of_bits : t -> float - val of_string : string -> t - val to_string : t -> string - - val logand : t -> t -> t - val logor : t -> t -> t - val logxor : t -> t -> t - - val min_int : t - val max_int : t - - val zero : t - val bare_nan : t - val print_nan_significand_digits : t -> string -end - -module type S = -sig - type t - type bits - val pos_nan : t - val neg_nan : t - val of_float : float -> t - val to_float : t -> float - val of_string : string -> t - val to_string : t -> string - val of_bits : bits -> t - val to_bits : t -> bits - val add : t -> t -> t - val sub : t -> t -> t - val mul : t -> t -> t - val div : t -> t -> t - val sqrt : t -> t - val min : t -> t -> t - val max : t -> t -> t - val ceil : t -> t - val floor : t -> t - val trunc : t -> t - val nearest : t -> t - val abs : t -> t - val neg : t -> t - val copysign : t -> t -> t - val eq : t -> t -> bool - val ne : t -> t -> bool - val lt : t -> t -> bool - val le : t -> t -> bool - val gt : t -> t -> bool - val ge : t -> t -> bool - val zero : t -end - -module Make (Rep : RepType) : S with type bits = Rep.t = -struct - type t = Rep.t - type bits = Rep.t - - let pos_nan = Rep.pos_nan - let neg_nan = Rep.neg_nan - let bare_nan = Rep.bare_nan - - let of_float = Rep.bits_of_float - let to_float = Rep.float_of_bits - - let of_bits x = x - let to_bits x = x - - let is_nan x = let xf = Rep.float_of_bits x in xf <> xf - - (* - * When the result of an arithmetic operation is NaN, the most significant - * bit of the significand field is set. - *) - let canonicalize_nan x = Rep.logor x Rep.pos_nan - - (* - * When the result of a binary operation is NaN, the resulting NaN is computed - * from one of the NaN inputs, if there is one. If both are NaN, one is - * selected nondeterminstically. If neither, we use a default NaN value. - *) - let determine_binary_nan x y = - (* - * TODO: There are two nondeterministic things we could do here. When both - * x and y are NaN, we can nondeterministically pick which to return. And - * when neither is NaN, we can nondeterministically pick whether to return - * pos_nan or neg_nan. - *) - let nan = - if is_nan x then x else - if is_nan y then y else Rep.pos_nan - in canonicalize_nan nan - - (* - * When the result of a unary operation is NaN, the resulting NaN is computed - * from one of the NaN input, if there it is NaN. Otherwise, we use a default - * NaN value. - *) - let determine_unary_nan x = - (* - * TODO: There is one nondeterministic thing we could do here. When the - * operand is not NaN, we can nondeterministically pick whether to return - * pos_nan or neg_nan. - *) - let nan = if is_nan x then x else Rep.pos_nan in - canonicalize_nan nan - - let binary x op y = - let xf = to_float x in - let yf = to_float y in - let t = op xf yf in - if t = t then of_float t else determine_binary_nan x y - - let unary op x = - let t = op (to_float x) in - if t = t then of_float t else determine_unary_nan x - - let zero = of_float 0.0 - - let add x y = binary x (+.) y - let sub x y = binary x (-.) y - let mul x y = binary x ( *.) y - let div x y = binary x (/.) y - - let sqrt x = unary Pervasives.sqrt x - - let ceil x = unary Pervasives.ceil x - let floor x = unary Pervasives.floor x - - let trunc x = - let xf = to_float x in - (* preserve the sign of zero *) - if xf = 0.0 then x else - (* trunc is either ceil or floor depending on which one is toward zero *) - let f = if xf < 0.0 then Pervasives.ceil xf else Pervasives.floor xf in - let result = of_float f in - if is_nan result then determine_unary_nan result else result - - let nearest x = - let xf = to_float x in - (* preserve the sign of zero *) - if xf = 0.0 then x else - (* nearest is either ceil or floor depending on which is nearest or even *) - let u = Pervasives.ceil xf in - let d = Pervasives.floor xf in - let um = abs_float (xf -. u) in - let dm = abs_float (xf -. d) in - let u_or_d = - um < dm || - um = dm && let h = u /. 2. in Pervasives.floor h = h - in - let f = if u_or_d then u else d in - let result = of_float f in - if is_nan result then determine_unary_nan result else result - - let min x y = - let xf = to_float x in - let yf = to_float y in - (* min -0 0 is -0 *) - if xf = yf then Rep.logor x y else - if xf < yf then x else - if xf > yf then y else - determine_binary_nan x y - - let max x y = - let xf = to_float x in - let yf = to_float y in - (* max -0 0 is 0 *) - if xf = yf then Rep.logand x y else - if xf > yf then x else - if xf < yf then y else - determine_binary_nan x y - - (* abs, neg, and copysign are purely bitwise operations, even on NaN values *) - let abs x = - Rep.logand x Rep.max_int - - let neg x = - Rep.logxor x Rep.min_int - - let copysign x y = - Rep.logor (abs x) (Rep.logand y Rep.min_int) - - let eq x y = (to_float x = to_float y) - let ne x y = (to_float x <> to_float y) - let lt x y = (to_float x < to_float y) - let gt x y = (to_float x > to_float y) - let le x y = (to_float x <= to_float y) - let ge x y = (to_float x >= to_float y) - - let of_signless_string x len = - if x <> "nan" && len > 6 && String.sub x 0 6 = "nan:0x" then - let s = Rep.of_string (String.sub x 4 (len - 4)) in - if s = Rep.zero then - raise (Failure "nan payload must not be zero") - else if Rep.logand s bare_nan <> Rep.zero then - raise (Failure "nan payload must not overlap with exponent bits") - else if s < Rep.zero then - raise (Failure "nan payload must not overlap with sign bit") - else - Rep.logor s bare_nan - else - (* TODO: OCaml's float_of_string is insufficient *) - of_float (float_of_string x) - - let of_string x = - let len = String.length x in - if len > 0 && x.[0] = '-' then - neg (of_signless_string (String.sub x 1 (len - 1)) (len - 1)) - else if len > 0 && x.[0] = '+' then - of_signless_string (String.sub x 1 (len - 1)) (len - 1) - else - of_signless_string x len - - let to_string x = - (if x < Rep.zero then "-" else "") ^ - let a = abs x in - if is_nan a then - "nan:0x" ^ Rep.print_nan_significand_digits a - else - (* TODO: use sprintf "%h" once we have upgraded to OCaml 4.03 *) - string_of_float (to_float a) -end - diff --git a/interpreter/spec/i64_convert.mli b/interpreter/spec/i64_convert.mli deleted file mode 100644 index 50a3b3a3..00000000 --- a/interpreter/spec/i64_convert.mli +++ /dev/null @@ -1,9 +0,0 @@ -(* WebAssembly-compatible type conversions to i64 implementation *) - -val extend_s_i32 : I32.t -> I64.t -val extend_u_i32 : I32.t -> I64.t -val trunc_s_f32 : F32.t -> I64.t -val trunc_u_f32 : F32.t -> I64.t -val trunc_s_f64 : F64.t -> I64.t -val trunc_u_f64 : F64.t -> I64.t -val reinterpret_f64 : F64.t -> I64.t diff --git a/interpreter/spec/instance.ml b/interpreter/spec/instance.ml deleted file mode 100644 index 8c468bc9..00000000 --- a/interpreter/spec/instance.ml +++ /dev/null @@ -1,34 +0,0 @@ -open Values - -module ExportMap = Map.Make(String) - -type global = value ref - -type closure = - | AstFunc of instance ref * Ast.func - | HostFunc of Types.func_type * (value list -> value list) - -and extern = - | ExternalFunc of closure - | ExternalTable of Table.t - | ExternalMemory of Memory.t - | ExternalGlobal of value - -and instance = -{ - module_ : Ast.module_; - funcs : closure list; - tables : Table.t list; - memories : Memory.t list; - globals : global list; - exports : extern ExportMap.t; -} - -type Table.elem += Func of closure - -let instance m = - { module_ = m; funcs = []; tables = []; memories = []; globals = []; - exports = ExportMap.empty } - -let export inst name = - try Some (ExportMap.find name inst.exports) with Not_found -> None diff --git a/interpreter/spec/memory.ml b/interpreter/spec/memory.ml deleted file mode 100644 index 82e2b6a3..00000000 --- a/interpreter/spec/memory.ml +++ /dev/null @@ -1,147 +0,0 @@ -open Bigarray -open Lib.Bigarray -open Types -open Values - -type size = int32 (* number of pages *) -type address = int64 -type offset = int32 - -type mem_size = Mem8 | Mem16 | Mem32 -type extension = SX | ZX - -type value = Values.value -type value_type = Types.value_type -type 'a limits = 'a Types.limits - -type memory' = (int, int8_unsigned_elt, c_layout) Array1.t -type memory = {mutable content : memory'; max : size option} -type t = memory - -exception Type -exception Bounds -exception SizeOverflow -exception SizeLimit -exception OutOfMemory - -let page_size = 0x10000L (* 64 KiB *) - -let mem_size = function - | Mem8 -> 1 - | Mem16 -> 2 - | Mem32 -> 4 - -let within_limits n = function - | None -> true - | Some max -> I32.le_u n max - -let create' n = - if I32.gt_u n 0x10000l then raise SizeOverflow else - try - let size = Int64.(mul (of_int32 n) page_size) in - let mem = Array1_64.create Int8_unsigned C_layout size in - Array1.fill mem 0; - mem - with Out_of_memory -> raise OutOfMemory - -let create {min; max} = - assert (within_limits min max); - {content = create' min; max} - -let bound mem = - Array1_64.dim mem.content - -let size mem = - Int64.(to_int32 (div (bound mem) page_size)) - -let limits mem = - {min = size mem; max = mem.max} - -let grow mem delta = - let old_size = size mem in - let new_size = Int32.add old_size delta in - if I32.gt_u old_size new_size then raise SizeOverflow else - if not (within_limits new_size mem.max) then raise SizeLimit else - let after = create' new_size in - let dim = Array1_64.dim mem.content in - Array1.blit (Array1_64.sub mem.content 0L dim) (Array1_64.sub after 0L dim); - mem.content <- after - -let effective_address a o = - let ea = Int64.(add a (of_int32 o)) in - if I64.lt_u ea a then raise Bounds; - ea - -let loadn mem n ea = - assert (n > 0 && n <= 8); - let rec loop mem n i = - if n = 0 then 0L else - let rest = Int64.(shift_left (loop mem (n - 1) (add i 1L)) 8) in - let byte = Int64.of_int (Array1_64.get mem.content i) in - Int64.logor byte rest - in - try loop mem n ea with Invalid_argument _ -> raise Bounds - -let storen mem n ea v = - assert (n > 0 && n <= 8); - let rec loop mem n i v = - if n > 0 then begin - Int64.(loop mem (n - 1) (add i 1L) (shift_right v 8)); - Array1_64.set mem.content i (Int64.to_int v land 255) - end - in - try loop mem n ea v with Invalid_argument _ -> raise Bounds - -let load mem a o t = - let ea = effective_address a o in - match t with - | I32Type -> I32 (Int64.to_int32 (loadn mem 4 ea)) - | I64Type -> I64 (loadn mem 8 ea) - | F32Type -> F32 (F32.of_bits (Int64.to_int32 (loadn mem 4 ea))) - | F64Type -> F64 (F64.of_bits (loadn mem 8 ea)) - -let store mem a o v = - let ea = effective_address a o in - match v with - | I32 x -> storen mem 4 ea (Int64.of_int32 x) - | I64 x -> storen mem 8 ea x - | F32 x -> storen mem 4 ea (Int64.of_int32 (F32.to_bits x)) - | F64 x -> storen mem 8 ea (F64.to_bits x) - -let loadn_sx mem n ea = - assert (n > 0 && n <= 8); - let v = loadn mem n ea in - let shift = 64 - (8 * n) in - Int64.(shift_right (shift_left v shift) shift) - -let load_packed sz ext mem a o t = - let ea = effective_address a o in - match sz, ext, t with - | Mem8, ZX, I32Type -> I32 (Int64.to_int32 (loadn mem 1 ea)) - | Mem8, SX, I32Type -> I32 (Int64.to_int32 (loadn_sx mem 1 ea)) - | Mem8, ZX, I64Type -> I64 (loadn mem 1 ea) - | Mem8, SX, I64Type -> I64 (loadn_sx mem 1 ea) - | Mem16, ZX, I32Type -> I32 (Int64.to_int32 (loadn mem 2 ea)) - | Mem16, SX, I32Type -> I32 (Int64.to_int32 (loadn_sx mem 2 ea)) - | Mem16, ZX, I64Type -> I64 (loadn mem 2 ea) - | Mem16, SX, I64Type -> I64 (loadn_sx mem 2 ea) - | Mem32, ZX, I64Type -> I64 (loadn mem 4 ea) - | Mem32, SX, I64Type -> I64 (loadn_sx mem 4 ea) - | _ -> raise Type - -let store_packed sz mem a o v = - let ea = effective_address a o in - match sz, v with - | Mem8, I32 x -> storen mem 1 ea (Int64.of_int32 x) - | Mem8, I64 x -> storen mem 1 ea x - | Mem16, I32 x -> storen mem 2 ea (Int64.of_int32 x) - | Mem16, I64 x -> storen mem 2 ea x - | Mem32, I64 x -> storen mem 4 ea x - | _ -> raise Type - -let blit mem addr data = - try - for i = String.length data - 1 downto 0 do - Array1_64.set mem.content Int64.(add addr (of_int i)) (Char.code data.[i]) - done - with Invalid_argument _ -> raise Bounds diff --git a/interpreter/spec/memory.mli b/interpreter/spec/memory.mli deleted file mode 100644 index 1ee64524..00000000 --- a/interpreter/spec/memory.mli +++ /dev/null @@ -1,38 +0,0 @@ -type memory -type t = memory - -type size = int32 (* number of pages *) -type address = int64 -type offset = int32 - -type mem_size = Mem8 | Mem16 | Mem32 -type extension = SX | ZX - -type value = Values.value -type value_type = Types.value_type -type 'a limits = 'a Types.limits - -exception Type -exception Bounds -exception SizeOverflow -exception SizeLimit -exception OutOfMemory - -val page_size : int64 -val mem_size : mem_size -> int - -val create : size limits -> memory (* raise SizeOverflow, OutOfMemory *) -val size : memory -> size -val bound : memory -> address -val limits : memory -> size limits -val grow : memory -> size -> unit - (* raise SizeLimit, SizeOverflow, OutOfMemory *) - -val load : memory -> address -> offset -> value_type -> value (* raise Bounds *) -val store : memory -> address -> offset -> value -> unit (* raise Bounds *) -val load_packed : - mem_size -> extension -> memory -> address -> offset -> value_type -> value - (* raise Type, Bounds *) -val store_packed : mem_size -> memory -> address -> offset -> value -> unit - (* raise Type, Bounds *) -val blit : memory -> address -> string -> unit (* raise Bouunds *) diff --git a/interpreter/spec/table.ml b/interpreter/spec/table.ml deleted file mode 100644 index fd7c7f2e..00000000 --- a/interpreter/spec/table.ml +++ /dev/null @@ -1,58 +0,0 @@ -open Types - -type size = int32 -type index = int32 - -type elem = .. -type elem += Uninitialized -type elem_type = Types.elem_type -type 'a limits = 'a Types.limits - -type table' = elem array -type table = - {mutable content : table'; max : size option; elem_type : elem_type} -type t = table - -exception Bounds -exception SizeOverflow -exception SizeLimit - -let elem_type tab = tab.elem_type - -let within_limits size = function - | None -> true - | Some max -> I32.le_u size max - -let create' size = - try Lib.Array32.make size Uninitialized - with Invalid_argument _ -> raise Out_of_memory - -let create elem_type {min; max} = - assert (within_limits min max); - {content = create' min; max; elem_type} - -let size tab = - Lib.Array32.length tab.content - -let limits tab = - {min = size tab; max = tab.max} - -let grow tab delta = - let old_size = size tab in - let new_size = Int32.add old_size delta in - if I32.gt_u old_size new_size then raise SizeOverflow else - if not (within_limits new_size tab.max) then raise SizeLimit else - let after = create' new_size in - Array.blit tab.content 0 after 0 (Array.length tab.content); - tab.content <- after - -let load tab i = - try Lib.Array32.get tab.content i with Invalid_argument _ -> raise Bounds - -let store tab i v = - try Lib.Array32.set tab.content i v with Invalid_argument _ -> raise Bounds - -let blit tab offset elems = - let data = Array.of_list elems in - try Lib.Array32.blit data 0l tab.content offset (Lib.Array32.length data) - with Invalid_argument _ -> raise Bounds diff --git a/interpreter/spec/table.mli b/interpreter/spec/table.mli deleted file mode 100644 index 9f41f34f..00000000 --- a/interpreter/spec/table.mli +++ /dev/null @@ -1,24 +0,0 @@ -type table -type t = table - -type size = int32 -type index = int32 - -type elem = .. -type elem += Uninitialized -type elem_type = Types.elem_type -type 'a limits = 'a Types.limits - -exception Bounds -exception SizeOverflow -exception SizeLimit - -val create : elem_type -> size limits -> table -val elem_type : table -> elem_type -val size : table -> size -val limits : table -> size limits -val grow : table -> size -> unit (* raise SizeOverflow, SizeLimit *) - -val load : table -> index -> elem (* raise Bounds *) -val store : table -> index -> elem -> unit (* raise Bounds *) -val blit : table -> index -> elem list -> unit (* raise Bounds *) diff --git a/interpreter/spec/types.ml b/interpreter/spec/types.ml deleted file mode 100644 index 9dc6e25d..00000000 --- a/interpreter/spec/types.ml +++ /dev/null @@ -1,83 +0,0 @@ -(* Types *) - -type value_type = I32Type | I64Type | F32Type | F64Type -type elem_type = AnyFuncType -type stack_type = value_type list -type func_type = FuncType of stack_type * stack_type - -type 'a limits = {min : 'a; max : 'a option} -type mutability = Immutable | Mutable -type table_type = TableType of Int32.t limits * elem_type -type memory_type = MemoryType of Int32.t limits -type global_type = GlobalType of value_type * mutability -type external_type = - | ExternalFuncType of func_type - | ExternalTableType of table_type - | ExternalMemoryType of memory_type - | ExternalGlobalType of global_type - - -(* Attributes *) - -let size = function - | I32Type | F32Type -> 4 - | I64Type | F64Type -> 8 - - -(* Filters *) - -let rec funcs = function - | [] -> [] - | ExternalFuncType ft :: ets -> ft :: funcs ets - | _ :: ets -> funcs ets - -let rec tables = function - | [] -> [] - | ExternalTableType tt :: ets -> tt :: tables ets - | _ :: ets -> tables ets - -let rec memories = function - | [] -> [] - | ExternalMemoryType mt :: ets -> mt :: memories ets - | _ :: ets -> memories ets - -let rec globals = function - | [] -> [] - | ExternalGlobalType ft :: ets -> ft :: globals ets - | _ :: ets -> globals ets - - -(* String conversion *) - -let string_of_value_type = function - | I32Type -> "i32" - | I64Type -> "i64" - | F32Type -> "f32" - | F64Type -> "f64" - -let string_of_value_types = function - | [t] -> string_of_value_type t - | ts -> "[" ^ String.concat " " (List.map string_of_value_type ts) ^ "]" - -let string_of_elem_type = function - | AnyFuncType -> "anyfunc" - -let string_of_limits {min; max} = - I32.to_string_u min ^ - (match max with None -> "" | Some n -> " " ^ I32.to_string_u n) - -let string_of_memory_type = function - | MemoryType lim -> string_of_limits lim - -let string_of_table_type = function - | TableType (lim, t) -> string_of_limits lim ^ " " ^ string_of_elem_type t - -let string_of_global_type = function - | GlobalType (t, Immutable) -> string_of_value_type t - | GlobalType (t, Mutable) -> "(mut " ^ string_of_value_type t ^ ")" - -let string_of_stack_type ts = - "[" ^ String.concat " " (List.map string_of_value_type ts) ^ "]" - -let string_of_func_type (FuncType (ins, out)) = - string_of_stack_type ins ^ " -> " ^ string_of_stack_type out diff --git a/interpreter/spec/valid.mli b/interpreter/spec/valid.mli deleted file mode 100644 index 3db17e28..00000000 --- a/interpreter/spec/valid.mli +++ /dev/null @@ -1,3 +0,0 @@ -exception Invalid of Source.region * string - -val check_module : Ast.module_ -> unit (* raise Invalid *) diff --git a/interpreter/spec/values.ml b/interpreter/spec/values.ml deleted file mode 100644 index dedc14ab..00000000 --- a/interpreter/spec/values.ml +++ /dev/null @@ -1,79 +0,0 @@ -open Types - - -(* Values and operators *) - -type ('i32, 'i64, 'f32, 'f64) op = - I32 of 'i32 | I64 of 'i64 | F32 of 'f32 | F64 of 'f64 - -type value = (I32.t, I64.t, F32.t, F64.t) op - - -(* Typing *) - -let type_of = function - | I32 _ -> I32Type - | I64 _ -> I64Type - | F32 _ -> F32Type - | F64 _ -> F64Type - -let default_value = function - | I32Type -> I32 I32.zero - | I64Type -> I64 I64.zero - | F32Type -> F32 F32.zero - | F64Type -> F64 F64.zero - - -(* Conversion *) - -let value_of_bool b = I32 (if b then 1l else 0l) - -let string_of_value = function - | I32 i -> I32.to_string_s i - | I64 i -> I64.to_string_s i - | F32 z -> F32.to_string z - | F64 z -> F64.to_string z - -let string_of_values = function - | [v] -> string_of_value v - | vs -> "[" ^ String.concat " " (List.map string_of_value vs) ^ "]" - - -(* Injection & projection *) - -exception Value of value_type - -module type ValueType = -sig - type t - val to_value : t -> value - val of_value : value -> t (* raise Value *) -end - -module I32Value = -struct - type t = I32.t - let to_value i = I32 i - let of_value = function I32 i -> i | _ -> raise (Value I32Type) -end - -module I64Value = -struct - type t = I64.t - let to_value i = I64 i - let of_value = function I64 i -> i | _ -> raise (Value I64Type) -end - -module F32Value = -struct - type t = F32.t - let to_value i = F32 i - let of_value = function F32 z -> z | _ -> raise (Value F32Type) -end - -module F64Value = -struct - type t = F64.t - let to_value i = F64 i - let of_value = function F64 z -> z | _ -> raise (Value F64Type) -end diff --git a/interpreter/spec/ast.ml b/interpreter/syntax/ast.ml similarity index 68% rename from interpreter/spec/ast.ml rename to interpreter/syntax/ast.ml index 94822eb7..06e75c39 100644 --- a/interpreter/spec/ast.ml +++ b/interpreter/syntax/ast.ml @@ -55,21 +55,23 @@ type testop = (I32Op.testop, I64Op.testop, F32Op.testop, F64Op.testop) Values.op type relop = (I32Op.relop, I64Op.relop, F32Op.relop, F64Op.relop) Values.op type cvtop = (I32Op.cvtop, I64Op.cvtop, F32Op.cvtop, F64Op.cvtop) Values.op -type 'a memop = - {ty : value_type; align : int; offset : Memory.offset; sz : 'a option} -type loadop = (Memory.mem_size * Memory.extension) memop -type storeop = Memory.mem_size memop +type 'a memop = {ty : num_type; align : int; offset : int32; sz : 'a option} +type loadop = (Memory.pack_size * Memory.extension) memop +type storeop = Memory.pack_size memop (* Expressions *) type var = int32 Source.phrase -type literal = Values.value Source.phrase +type literal = Values.num Source.phrase +type name = int list type instr = instr' Source.phrase and instr' = | Unreachable (* trap unconditionally *) | Nop (* do nothing *) + | Drop (* forget a value *) + | Select of value_type list option (* branchless conditional *) | Block of stack_type * instr list (* execute in sequence *) | Loop of stack_type * instr list (* loop header *) | If of stack_type * instr list * instr list (* conditional *) @@ -78,18 +80,24 @@ and instr' = | BrTable of var list * var (* indexed break *) | Return (* break from function body *) | Call of var (* call function *) - | CallIndirect of var (* call function through table *) - | Drop (* forget a value *) - | Select (* branchless conditional *) - | GetLocal of var (* read local variable *) - | SetLocal of var (* write local variable *) - | TeeLocal of var (* write local variable and keep value *) - | GetGlobal of var (* read global variable *) - | SetGlobal of var (* write global variable *) + | CallIndirect of var * var (* call function through table *) + | LocalGet of var (* read local variable *) + | LocalSet of var (* write local variable *) + | LocalTee of var (* write local variable and keep value *) + | GlobalGet of var (* read global variable *) + | GlobalSet of var (* write global variable *) + | TableGet of var (* read table element *) + | TableSet of var (* write table element *) + | TableSize of var (* size of table *) + | TableGrow of var (* grow table *) + | TableFill of var (* fill table with unique value *) | Load of loadop (* read memory at address *) | Store of storeop (* write memory at address *) - | CurrentMemory (* size of linear memory *) - | GrowMemory (* grow linear memory *) + | MemorySize (* size of linear memory *) + | MemoryGrow (* grow linear memory *) + | RefNull (* null reference *) + | RefIsNull (* null test *) + | RefFunc of var (* function reference *) | Const of literal (* constant *) | Test of testop (* numeric test *) | Compare of relop (* numeric comparison *) @@ -146,6 +154,8 @@ type memory_segment = string segment (* Modules *) +type type_ = func_type Source.phrase + type export_desc = export_desc' Source.phrase and export_desc' = | FuncExport of var @@ -156,7 +166,7 @@ and export_desc' = type export = export' Source.phrase and export' = { - name : string; + name : name; edesc : export_desc; } @@ -170,15 +180,15 @@ and import_desc' = type import = import' Source.phrase and import' = { - module_name : string; - item_name : string; + module_name : name; + item_name : name; idesc : import_desc; } type module_ = module_' Source.phrase and module_' = { - types : func_type list; + types : type_ list; globals : global list; tables : table list; memories : memory list; @@ -209,29 +219,46 @@ let empty_module = open Source -let import_type (m : module_) (im : import) : external_type = +let func_type_for (m : module_) (x : var) : func_type = + (Lib.List32.nth m.it.types x.it).it + +let import_type (m : module_) (im : import) : extern_type = let {idesc; _} = im.it in match idesc.it with - | FuncImport x -> ExternalFuncType (Lib.List32.nth m.it.types x.it) - | TableImport t -> ExternalTableType t - | MemoryImport t -> ExternalMemoryType t - | GlobalImport t -> ExternalGlobalType t + | FuncImport x -> ExternFuncType (func_type_for m x) + | TableImport t -> ExternTableType t + | MemoryImport t -> ExternMemoryType t + | GlobalImport t -> ExternGlobalType t -let export_type (m : module_) (ex : export) : external_type = +let export_type (m : module_) (ex : export) : extern_type = let {edesc; _} = ex.it in let its = List.map (import_type m) m.it.imports in let open Lib.List32 in match edesc.it with | FuncExport x -> let fts = - funcs its @ List.map (fun f -> nth m.it.types f.it.ftype.it) m.it.funcs - in ExternalFuncType (nth fts x.it) + funcs its @ List.map (fun f -> func_type_for m f.it.ftype) m.it.funcs + in ExternFuncType (nth fts x.it) | TableExport x -> let tts = tables its @ List.map (fun t -> t.it.ttype) m.it.tables in - ExternalTableType (nth tts x.it) + ExternTableType (nth tts x.it) | MemoryExport x -> let mts = memories its @ List.map (fun m -> m.it.mtype) m.it.memories in - ExternalMemoryType (nth mts x.it) + ExternMemoryType (nth mts x.it) | GlobalExport x -> let gts = globals its @ List.map (fun g -> g.it.gtype) m.it.globals in - ExternalGlobalType (nth gts x.it) + ExternGlobalType (nth gts x.it) + +let string_of_name n = + let b = Buffer.create 16 in + let escape uc = + if uc < 0x20 || uc >= 0x7f then + Buffer.add_string b (Printf.sprintf "\\u{%02x}" uc) + else begin + let c = Char.chr uc in + if c = '\"' || c = '\\' then Buffer.add_char b '\\'; + Buffer.add_char b c + end + in + List.iter escape n; + Buffer.contents b diff --git a/interpreter/spec/operators.ml b/interpreter/syntax/operators.ml similarity index 70% rename from interpreter/spec/operators.ml rename to interpreter/syntax/operators.ml index b207b193..2ff649b6 100644 --- a/interpreter/spec/operators.ml +++ b/interpreter/syntax/operators.ml @@ -9,67 +9,76 @@ let i32_const n = Const (I32 n.it @@ n.at) let i64_const n = Const (I64 n.it @@ n.at) let f32_const n = Const (F32 n.it @@ n.at) let f64_const n = Const (F64 n.it @@ n.at) +let ref_null = RefNull +let ref_func x = RefFunc x +let ref_is_null = RefIsNull let unreachable = Unreachable let nop = Nop let drop = Drop +let select t = Select t let block ts es = Block (ts, es) let loop ts es = Loop (ts, es) let br x = Br x let br_if x = BrIf x let br_table xs x = BrTable (xs, x) -let return = Return let if_ ts es1 es2 = If (ts, es1, es2) -let select = Select +let return = Return let call x = Call x -let call_indirect x = CallIndirect x +let call_indirect x y = CallIndirect (x, y) + +let local_get x = LocalGet x +let local_set x = LocalSet x +let local_tee x = LocalTee x +let global_get x = GlobalGet x +let global_set x = GlobalSet x -let get_local x = GetLocal x -let set_local x = SetLocal x -let tee_local x = TeeLocal x -let get_global x = GetGlobal x -let set_global x = SetGlobal x +let table_get x = TableGet x +let table_set x = TableSet x +let table_size x = TableSize x +let table_grow x = TableGrow x +let table_fill x = TableFill x let i32_load align offset = Load {ty = I32Type; align; offset; sz = None} let i64_load align offset = Load {ty = I64Type; align; offset; sz = None} let f32_load align offset = Load {ty = F32Type; align; offset; sz = None} let f64_load align offset = Load {ty = F64Type; align; offset; sz = None} let i32_load8_s align offset = - Load {ty = I32Type; align; offset; sz = Some (Mem8, SX)} + Load {ty = I32Type; align; offset; sz = Some (Pack8, SX)} let i32_load8_u align offset = - Load {ty = I32Type; align; offset; sz = Some (Mem8, ZX)} + Load {ty = I32Type; align; offset; sz = Some (Pack8, ZX)} let i32_load16_s align offset = - Load {ty = I32Type; align; offset; sz = Some (Mem16, SX)} + Load {ty = I32Type; align; offset; sz = Some (Pack16, SX)} let i32_load16_u align offset = - Load {ty = I32Type; align; offset; sz = Some (Mem16, ZX)} + Load {ty = I32Type; align; offset; sz = Some (Pack16, ZX)} let i64_load8_s align offset = - Load {ty = I64Type; align; offset; sz = Some (Mem8, SX)} + Load {ty = I64Type; align; offset; sz = Some (Pack8, SX)} let i64_load8_u align offset = - Load {ty = I64Type; align; offset; sz = Some (Mem8, ZX)} + Load {ty = I64Type; align; offset; sz = Some (Pack8, ZX)} let i64_load16_s align offset = - Load {ty = I64Type; align; offset; sz = Some (Mem16, SX)} + Load {ty = I64Type; align; offset; sz = Some (Pack16, SX)} let i64_load16_u align offset = - Load {ty = I64Type; align; offset; sz = Some (Mem16, ZX)} + Load {ty = I64Type; align; offset; sz = Some (Pack16, ZX)} let i64_load32_s align offset = - Load {ty = I64Type; align; offset; sz = Some (Mem32, SX)} + Load {ty = I64Type; align; offset; sz = Some (Pack32, SX)} let i64_load32_u align offset = - Load {ty = I64Type; align; offset; sz = Some (Mem32, ZX)} + Load {ty = I64Type; align; offset; sz = Some (Pack32, ZX)} let i32_store align offset = Store {ty = I32Type; align; offset; sz = None} let i64_store align offset = Store {ty = I64Type; align; offset; sz = None} let f32_store align offset = Store {ty = F32Type; align; offset; sz = None} let f64_store align offset = Store {ty = F64Type; align; offset; sz = None} let i32_store8 align offset = - Store {ty = I32Type; align; offset; sz = Some Mem8} + Store {ty = I32Type; align; offset; sz = Some Pack8} let i32_store16 align offset = - Store {ty = I32Type; align; offset; sz = Some Mem16} + Store {ty = I32Type; align; offset; sz = Some Pack16} let i64_store8 align offset = - Store {ty = I64Type; align; offset; sz = Some Mem8} + Store {ty = I64Type; align; offset; sz = Some Pack8} let i64_store16 align offset = - Store {ty = I64Type; align; offset; sz = Some Mem16} + Store {ty = I64Type; align; offset; sz = Some Pack16} let i64_store32 align offset = - Store {ty = I64Type; align; offset; sz = Some Mem32} + Store {ty = I64Type; align; offset; sz = Some Pack32} let i32_clz = Unary (I32 I32Op.Clz) let i32_ctz = Unary (I32 I32Op.Ctz) @@ -174,31 +183,31 @@ let f64_gt = Compare (F64 F64Op.Gt) let f64_ge = Compare (F64 F64Op.Ge) let i32_wrap_i64 = Convert (I32 I32Op.WrapI64) -let i32_trunc_s_f32 = Convert (I32 I32Op.TruncSF32) -let i32_trunc_u_f32 = Convert (I32 I32Op.TruncUF32) -let i32_trunc_s_f64 = Convert (I32 I32Op.TruncSF64) -let i32_trunc_u_f64 = Convert (I32 I32Op.TruncUF64) -let i64_extend_s_i32 = Convert (I64 I64Op.ExtendSI32) -let i64_extend_u_i32 = Convert (I64 I64Op.ExtendUI32) -let i64_trunc_s_f32 = Convert (I64 I64Op.TruncSF32) -let i64_trunc_u_f32 = Convert (I64 I64Op.TruncUF32) -let i64_trunc_s_f64 = Convert (I64 I64Op.TruncSF64) -let i64_trunc_u_f64 = Convert (I64 I64Op.TruncUF64) -let f32_convert_s_i32 = Convert (F32 F32Op.ConvertSI32) -let f32_convert_u_i32 = Convert (F32 F32Op.ConvertUI32) -let f32_convert_s_i64 = Convert (F32 F32Op.ConvertSI64) -let f32_convert_u_i64 = Convert (F32 F32Op.ConvertUI64) +let i32_trunc_f32_s = Convert (I32 I32Op.TruncSF32) +let i32_trunc_f32_u = Convert (I32 I32Op.TruncUF32) +let i32_trunc_f64_s = Convert (I32 I32Op.TruncSF64) +let i32_trunc_f64_u = Convert (I32 I32Op.TruncUF64) +let i64_extend_i32_s = Convert (I64 I64Op.ExtendSI32) +let i64_extend_i32_u = Convert (I64 I64Op.ExtendUI32) +let i64_trunc_f32_s = Convert (I64 I64Op.TruncSF32) +let i64_trunc_f32_u = Convert (I64 I64Op.TruncUF32) +let i64_trunc_f64_s = Convert (I64 I64Op.TruncSF64) +let i64_trunc_f64_u = Convert (I64 I64Op.TruncUF64) +let f32_convert_i32_s = Convert (F32 F32Op.ConvertSI32) +let f32_convert_i32_u = Convert (F32 F32Op.ConvertUI32) +let f32_convert_i64_s = Convert (F32 F32Op.ConvertSI64) +let f32_convert_i64_u = Convert (F32 F32Op.ConvertUI64) let f32_demote_f64 = Convert (F32 F32Op.DemoteF64) -let f64_convert_s_i32 = Convert (F64 F64Op.ConvertSI32) -let f64_convert_u_i32 = Convert (F64 F64Op.ConvertUI32) -let f64_convert_s_i64 = Convert (F64 F64Op.ConvertSI64) -let f64_convert_u_i64 = Convert (F64 F64Op.ConvertUI64) +let f64_convert_i32_s = Convert (F64 F64Op.ConvertSI32) +let f64_convert_i32_u = Convert (F64 F64Op.ConvertUI32) +let f64_convert_i64_s = Convert (F64 F64Op.ConvertSI64) +let f64_convert_i64_u = Convert (F64 F64Op.ConvertUI64) let f64_promote_f32 = Convert (F64 F64Op.PromoteF32) let i32_reinterpret_f32 = Convert (I32 I32Op.ReinterpretFloat) let i64_reinterpret_f64 = Convert (I64 I64Op.ReinterpretFloat) let f32_reinterpret_i32 = Convert (F32 F32Op.ReinterpretInt) let f64_reinterpret_i64 = Convert (F64 F64Op.ReinterpretInt) -let current_memory = CurrentMemory -let grow_memory = GrowMemory +let memory_size = MemorySize +let memory_grow = MemoryGrow diff --git a/interpreter/syntax/types.ml b/interpreter/syntax/types.ml new file mode 100644 index 00000000..fb3f13b1 --- /dev/null +++ b/interpreter/syntax/types.ml @@ -0,0 +1,142 @@ +(* Types *) + +type num_type = I32Type | I64Type | F32Type | F64Type +type ref_type = NullRefType | AnyRefType | FuncRefType +type value_type = NumType of num_type | RefType of ref_type | BotType +type stack_type = value_type list +type func_type = FuncType of stack_type * stack_type + +type 'a limits = {min : 'a; max : 'a option} +type mutability = Immutable | Mutable +type table_type = TableType of Int32.t limits * ref_type +type memory_type = MemoryType of Int32.t limits +type global_type = GlobalType of value_type * mutability +type extern_type = + | ExternFuncType of func_type + | ExternTableType of table_type + | ExternMemoryType of memory_type + | ExternGlobalType of global_type + + +(* Attributes *) + +let size = function + | I32Type | F32Type -> 4 + | I64Type | F64Type -> 8 + + +(* Subtyping *) + +let match_num_type t1 t2 = + t1 = t2 + +let match_ref_type t1 t2 = + match t1, t2 with + | _, AnyRefType -> true + | NullRefType, _ -> true + | _, _ -> t1 = t2 + +let match_value_type t1 t2 = + match t1, t2 with + | NumType t1', NumType t2' -> match_num_type t1' t2' + | RefType t1', RefType t2' -> match_ref_type t1' t2' + | BotType, _ -> true + | _, _ -> false + +let match_limits lim1 lim2 = + I32.ge_u lim1.min lim2.min && + match lim1.max, lim2.max with + | _, None -> true + | None, Some _ -> false + | Some i, Some j -> I32.le_u i j + +let match_func_type ft1 ft2 = + ft1 = ft2 + +let match_table_type (TableType (lim1, et1)) (TableType (lim2, et2)) = + et1 = et2 && match_limits lim1 lim2 + +let match_memory_type (MemoryType lim1) (MemoryType lim2) = + match_limits lim1 lim2 + +let match_global_type (GlobalType (t1, mut1)) (GlobalType (t2, mut2)) = + mut1 = mut2 && + (t1 = t2 || mut2 = Immutable && match_value_type t1 t2) + +let match_extern_type et1 et2 = + match et1, et2 with + | ExternFuncType ft1, ExternFuncType ft2 -> match_func_type ft1 ft2 + | ExternTableType tt1, ExternTableType tt2 -> match_table_type tt1 tt2 + | ExternMemoryType mt1, ExternMemoryType mt2 -> match_memory_type mt1 mt2 + | ExternGlobalType gt1, ExternGlobalType gt2 -> match_global_type gt1 gt2 + | _, _ -> false + +let is_num_type = function + | NumType _ | BotType -> true + | RefType _ -> false + +let is_ref_type = function + | NumType _ -> false + | RefType _ | BotType -> true + + +(* Filters *) + +let funcs = + Lib.List.map_filter (function ExternFuncType t -> Some t | _ -> None) +let tables = + Lib.List.map_filter (function ExternTableType t -> Some t | _ -> None) +let memories = + Lib.List.map_filter (function ExternMemoryType t -> Some t | _ -> None) +let globals = + Lib.List.map_filter (function ExternGlobalType t -> Some t | _ -> None) + + +(* String conversion *) + +let string_of_num_type = function + | I32Type -> "i32" + | I64Type -> "i64" + | F32Type -> "f32" + | F64Type -> "f64" + +let string_of_ref_type = function + | NullRefType -> "nullref" + | AnyRefType -> "anyref" + | FuncRefType -> "funcref" + +let string_of_value_type = function + | NumType t -> string_of_num_type t + | RefType t -> string_of_ref_type t + | BotType -> "impossible" + +let string_of_value_types = function + | [t] -> string_of_value_type t + | ts -> "[" ^ String.concat " " (List.map string_of_value_type ts) ^ "]" + + +let string_of_limits {min; max} = + I32.to_string_u min ^ + (match max with None -> "" | Some n -> " " ^ I32.to_string_u n) + +let string_of_memory_type = function + | MemoryType lim -> string_of_limits lim + +let string_of_table_type = function + | TableType (lim, t) -> string_of_limits lim ^ " " ^ string_of_ref_type t + +let string_of_global_type = function + | GlobalType (t, Immutable) -> string_of_value_type t + | GlobalType (t, Mutable) -> "(mut " ^ string_of_value_type t ^ ")" + +let string_of_stack_type ts = + "[" ^ String.concat " " (List.map string_of_value_type ts) ^ "]" + +let string_of_func_type (FuncType (ins, out)) = + string_of_stack_type ins ^ " -> " ^ string_of_stack_type out + +let string_of_extern_type = function + | ExternFuncType ft -> "func " ^ string_of_func_type ft + | ExternTableType tt -> "table " ^ string_of_table_type tt + | ExternMemoryType mt -> "memory " ^ string_of_memory_type mt + | ExternGlobalType gt -> "global " ^ string_of_global_type gt diff --git a/interpreter/syntax/values.ml b/interpreter/syntax/values.ml new file mode 100644 index 00000000..cf5c6cb8 --- /dev/null +++ b/interpreter/syntax/values.ml @@ -0,0 +1,69 @@ +open Types + + +(* Values and operators *) + +type ('i32, 'i64, 'f32, 'f64) op = + I32 of 'i32 | I64 of 'i64 | F32 of 'f32 | F64 of 'f64 + +type num = (I32.t, I64.t, F32.t, F64.t) op + +type ref_ = .. +type ref_ += NullRef + +type value = Num of num | Ref of ref_ + + +(* Typing *) + +let type_of_num = function + | I32 _ -> I32Type + | I64 _ -> I64Type + | F32 _ -> F32Type + | F64 _ -> F64Type + +let type_of_ref' = ref (function NullRef -> NullRefType | _ -> AnyRefType) +let type_of_ref r = !type_of_ref' r + +let type_of_value = function + | Num n -> NumType (type_of_num n) + | Ref r -> RefType (type_of_ref r) + + +(* Defaults *) + +let default_num = function + | I32Type -> I32 I32.zero + | I64Type -> I64 I64.zero + | F32Type -> F32 F32.zero + | F64Type -> F64 F64.zero + +let default_ref = function + | _ -> NullRef + +let default_value = function + | NumType t' -> Num (default_num t') + | RefType t' -> Ref (default_ref t') + | BotType -> assert false + + +(* Conversion *) + +let value_of_bool b = Num (I32 (if b then 1l else 0l)) + +let string_of_num = function + | I32 i -> I32.to_string_s i + | I64 i -> I64.to_string_s i + | F32 z -> F32.to_string z + | F64 z -> F64.to_string z + +let string_of_ref' = ref (function NullRef -> "null" | _ -> "ref") +let string_of_ref r = !string_of_ref' r + +let string_of_value = function + | Num n -> string_of_num n + | Ref r -> string_of_ref r + +let string_of_values = function + | [v] -> string_of_value v + | vs -> "[" ^ String.concat " " (List.map string_of_value vs) ^ "]" diff --git a/interpreter/text/arrange.ml b/interpreter/text/arrange.ml index 18bc51f4..8bc9b632 100644 --- a/interpreter/text/arrange.ml +++ b/interpreter/text/arrange.ml @@ -12,23 +12,28 @@ let nat n = I32.to_string_u (I32.of_int_u n) let nat32 = I32.to_string_u let add_hex_char buf c = Printf.bprintf buf "\\%02x" (Char.code c) -let add_char buf c = - if c < '\x20' || c >= '\x7f' then - add_hex_char buf c - else begin - if c = '\"' || c = '\\' then Buffer.add_char buf '\\'; - Buffer.add_char buf c - end - -let string_with add_char s = - let buf = Buffer.create (3 * String.length s + 2) in +let add_char buf = function + | '\n' -> Buffer.add_string buf "\\n" + | '\t' -> Buffer.add_string buf "\\t" + | '\"' -> Buffer.add_string buf "\\\"" + | '\\' -> Buffer.add_string buf "\\\\" + | c when '\x20' <= c && c < '\x7f' -> Buffer.add_char buf c + | c -> add_hex_char buf c +let add_unicode_char buf = function + | (0x09 | 0x0a) as uc -> add_char buf (Char.chr uc) + | uc when 0x20 <= uc && uc < 0x7f -> add_char buf (Char.chr uc) + | uc -> Printf.bprintf buf "\\u{%02x}" uc + +let string_with iter add_char s = + let buf = Buffer.create 256 in Buffer.add_char buf '\"'; - String.iter (add_char buf) s; + iter (add_char buf) s; Buffer.add_char buf '\"'; Buffer.contents buf -let bytes = string_with add_hex_char -let string = string_with add_char +let bytes = string_with String.iter add_hex_char +let string = string_with String.iter add_char +let name = string_with List.iter add_unicode_char let list_of_opt = function None -> [] | Some x -> [x] @@ -43,16 +48,20 @@ let break_bytes s = let ss = Lib.String.breakup s 16 in list (atom bytes) ss +let break_string s = + let ss, s' = Lib.List.split_last (Lib.String.split s '\n') in + list (atom string) (List.map (fun s -> s ^ "\n") ss @ [s']) + (* Types *) +let num_type t = string_of_num_type t +let ref_type t = string_of_ref_type t let value_type t = string_of_value_type t -let elem_type t = string_of_elem_type t - let decls kind ts = tab kind (atom value_type) ts -let stack_type ts = list (atom value_type) ts +let stack_type ts = decls "result" ts let func_type (FuncType (ins, out)) = Node ("func", decls "param" ins @ decls "result" out) @@ -111,14 +120,14 @@ struct | Rotr -> "rotr" let cvtop xx = function - | ExtendSI32 -> "extend_s/i32" - | ExtendUI32 -> "extend_u/i32" - | WrapI64 -> "wrap/i64" - | TruncSF32 -> "trunc_s/f32" - | TruncUF32 -> "trunc_u/f32" - | TruncSF64 -> "trunc_s/f64" - | TruncUF64 -> "trunc_u/f64" - | ReinterpretFloat -> "reinterpret/f" ^ xx + | ExtendSI32 -> "extend_i32_s" + | ExtendUI32 -> "extend_i32_u" + | WrapI64 -> "wrap_i64" + | TruncSF32 -> "trunc_f32_s" + | TruncUF32 -> "trunc_f32_u" + | TruncSF64 -> "trunc_f64_s" + | TruncUF64 -> "trunc_f64_u" + | ReinterpretFloat -> "reinterpret_f" ^ xx end module FloatOp = @@ -154,17 +163,17 @@ struct | CopySign -> "copysign" let cvtop xx = function - | ConvertSI32 -> "convert_s/i32" - | ConvertUI32 -> "convert_u/i32" - | ConvertSI64 -> "convert_s/i64" - | ConvertUI64 -> "convert_u/i64" - | PromoteF32 -> "promote/f32" - | DemoteF64 -> "demote/f64" - | ReinterpretInt -> "reinterpret/i" ^ xx + | ConvertSI32 -> "convert_i32_s" + | ConvertUI32 -> "convert_i32_u" + | ConvertSI64 -> "convert_i64_s" + | ConvertUI64 -> "convert_i64_u" + | PromoteF32 -> "promote_f32" + | DemoteF64 -> "demote_f64" + | ReinterpretInt -> "reinterpret_i" ^ xx end let oper (intop, floatop) op = - value_type (type_of op) ^ "." ^ + num_type (type_of_num op) ^ "." ^ (match op with | I32 o -> intop "32" o | I64 o -> intop "64" o @@ -178,42 +187,47 @@ let testop = oper (IntOp.testop, FloatOp.testop) let relop = oper (IntOp.relop, FloatOp.relop) let cvtop = oper (IntOp.cvtop, FloatOp.cvtop) -let mem_size = function - | Memory.Mem8 -> "8" - | Memory.Mem16 -> "16" - | Memory.Mem32 -> "32" +let pack_size = function + | Memory.Pack8 -> "8" + | Memory.Pack16 -> "16" + | Memory.Pack32 -> "32" let extension = function | Memory.SX -> "_s" | Memory.ZX -> "_u" -let memop name {ty; align; offset; _} = - value_type ty ^ "." ^ name ^ +let memop name {ty; align; offset; _} sz = + num_type ty ^ "." ^ name ^ (if offset = 0l then "" else " offset=" ^ nat32 offset) ^ - (if 1 lsl align = size ty then "" else " align=" ^ nat (1 lsl align)) + (if 1 lsl align = sz then "" else " align=" ^ nat (1 lsl align)) let loadop op = match op.sz with - | None -> memop "load" op - | Some (sz, ext) -> memop ("load" ^ mem_size sz ^ extension ext) op + | None -> memop "load" op (size op.ty) + | Some (sz, ext) -> + memop ("load" ^ pack_size sz ^ extension ext) op (Memory.packed_size sz) let storeop op = match op.sz with - | None -> memop "store" op - | Some sz -> memop ("store" ^ mem_size sz) op + | None -> memop "store" op (size op.ty) + | Some sz -> memop ("store" ^ pack_size sz) op (Memory.packed_size sz) (* Expressions *) let var x = nat32 x.it -let value v = string_of_value v.it -let constop v = value_type (type_of v.it) ^ ".const" +let num v = string_of_num v.it +let constop v = num_type (type_of_num v.it) ^ ".const" let rec instr e = let head, inner = match e.it with | Unreachable -> "unreachable", [] | Nop -> "nop", [] + | Drop -> "drop", [] + | Select None -> "select", [] + | Select (Some []) -> "select", [Node ("result", [])] + | Select (Some ts) -> "select", decls "result" ts | Block (ts, es) -> "block", stack_type ts @ list instr es | Loop (ts, es) -> "loop", stack_type ts @ list instr es | If (ts, es1, es2) -> @@ -225,19 +239,26 @@ let rec instr e = "br_table " ^ String.concat " " (list var (xs @ [x])), [] | Return -> "return", [] | Call x -> "call " ^ var x, [] - | CallIndirect x -> "call_indirect " ^ var x, [] - | Drop -> "drop", [] - | Select -> "select", [] - | GetLocal x -> "get_local " ^ var x, [] - | SetLocal x -> "set_local " ^ var x, [] - | TeeLocal x -> "tee_local " ^ var x, [] - | GetGlobal x -> "get_global " ^ var x, [] - | SetGlobal x -> "set_global " ^ var x, [] + | CallIndirect (x, y) -> + "call_indirect " ^ var x, [Node ("type " ^ var y, [])] + | LocalGet x -> "local.get " ^ var x, [] + | LocalSet x -> "local.set " ^ var x, [] + | LocalTee x -> "local.tee " ^ var x, [] + | GlobalGet x -> "global.get " ^ var x, [] + | GlobalSet x -> "global.set " ^ var x, [] + | TableGet x -> "table.get " ^ var x, [] + | TableSet x -> "table.set " ^ var x, [] + | TableSize x -> "table.size " ^ var x, [] + | TableGrow x -> "table.grow " ^ var x, [] + | TableFill x -> "table.fill " ^ var x, [] | Load op -> loadop op, [] | Store op -> storeop op, [] - | CurrentMemory -> "current_memory", [] - | GrowMemory -> "grow_memory", [] - | Const lit -> constop lit ^ " " ^ value lit, [] + | MemorySize -> "memory.size", [] + | MemoryGrow -> "memory.grow", [] + | RefNull -> "ref.null", [] + | RefIsNull -> "ref.is_null", [] + | RefFunc x -> "ref.func " ^ var x, [] + | Const lit -> constop lit ^ " " ^ num lit, [] | Test op -> testop op, [] | Compare op -> relop op, [] | Unary op -> unop op, [] @@ -273,7 +294,7 @@ let start x = Node ("start " ^ var x, []) let table off i tab = let {ttype = TableType (lim, t)} = tab.it in Node ("table $" ^ nat (off + i) ^ " " ^ limits nat32 lim, - [atom elem_type t] + [atom ref_type t] ) let memory off i mem = @@ -293,21 +314,24 @@ let data seg = (* Modules *) -let typedef i t = - Node ("type $" ^ nat i, [struct_type t]) +let typedef i ty = + Node ("type $" ^ nat i, [struct_type ty.it]) -let import_desc i d = +let import_desc fx tx mx gx d = match d.it with | FuncImport x -> - Node ("func $" ^ nat i, [Node ("type", [atom var x])]) - | TableImport t -> table 0 i ({ttype = t} @@ d.at) - | MemoryImport t -> memory 0 i ({mtype = t} @@ d.at) - | GlobalImport t -> Node ("global $" ^ nat i, [global_type t]) - -let import i im = + incr fx; Node ("func $" ^ nat (!fx - 1), [Node ("type", [atom var x])]) + | TableImport t -> + incr tx; table 0 (!tx - 1) ({ttype = t} @@ d.at) + | MemoryImport t -> + incr mx; memory 0 (!mx - 1) ({mtype = t} @@ d.at) + | GlobalImport t -> + incr gx; Node ("global $" ^ nat (!gx - 1), [global_type t]) + +let import fx tx mx gx im = let {module_name; item_name; idesc} = im.it in Node ("import", - [atom string module_name; atom string item_name; import_desc i idesc] + [atom name module_name; atom name item_name; import_desc fx tx mx gx idesc] ) let export_desc d = @@ -318,8 +342,8 @@ let export_desc d = | GlobalExport x -> Node ("global", [atom var x]) let export ex = - let {name; edesc} = ex.it in - Node ("export", [atom string name; export_desc edesc]) + let {name = n; edesc} = ex.it in + Node ("export", [atom name n; export_desc edesc]) let global off i g = let {gtype; value} = g.it in @@ -332,30 +356,19 @@ let var_opt = function | None -> "" | Some x -> " " ^ x.it -let is_func_import im = - match im.it.idesc.it with FuncImport _ -> true | _ -> false -let is_table_import im = - match im.it.idesc.it with TableImport _ -> true | _ -> false -let is_memory_import im = - match im.it.idesc.it with MemoryImport _ -> true | _ -> false -let is_global_import im = - match im.it.idesc.it with GlobalImport _ -> true | _ -> false - let module_with_var_opt x_opt m = - let func_imports = List.filter is_func_import m.it.imports in - let table_imports = List.filter is_table_import m.it.imports in - let memory_imports = List.filter is_memory_import m.it.imports in - let global_imports = List.filter is_global_import m.it.imports in + let fx = ref 0 in + let tx = ref 0 in + let mx = ref 0 in + let gx = ref 0 in + let imports = list (import fx tx mx gx) m.it.imports in Node ("module" ^ var_opt x_opt, listi typedef m.it.types @ - listi import table_imports @ - listi import memory_imports @ - listi import global_imports @ - listi import func_imports @ - listi (table (List.length table_imports)) m.it.tables @ - listi (memory (List.length memory_imports)) m.it.memories @ - listi (global (List.length global_imports)) m.it.globals @ - listi (func_with_index (List.length func_imports)) m.it.funcs @ + imports @ + listi (table !tx) m.it.tables @ + listi (memory !mx) m.it.memories @ + listi (global !gx) m.it.globals @ + listi (func_with_index !fx) m.it.funcs @ list export m.it.exports @ opt start m.it.start @ list elems m.it.elems @ @@ -363,42 +376,58 @@ let module_with_var_opt x_opt m = ) let binary_module_with_var_opt x_opt bs = - Node ("module" ^ var_opt x_opt, break_bytes bs) + Node ("module" ^ var_opt x_opt ^ " binary", break_bytes bs) + +let quoted_module_with_var_opt x_opt s = + Node ("module" ^ var_opt x_opt ^ " quote", break_string s) let module_ = module_with_var_opt None (* Scripts *) -let literal lit = - match lit.it with - | Values.I32 i -> Node ("i32.const " ^ I32.to_string_s i, []) - | Values.I64 i -> Node ("i64.const " ^ I64.to_string_s i, []) - | Values.F32 z -> Node ("f32.const " ^ F32.to_string z, []) - | Values.F64 z -> Node ("f64.const " ^ F64.to_string z, []) +let value v = + match v.it with + | Num (Values.I32 i) -> Node ("i32.const " ^ I32.to_string_s i, []) + | Num (Values.I64 i) -> Node ("i64.const " ^ I64.to_string_s i, []) + | Num (Values.F32 z) -> Node ("f32.const " ^ F32.to_string z, []) + | Num (Values.F64 z) -> Node ("f64.const " ^ F64.to_string z, []) + | Ref NullRef -> Node ("ref.null", []) + | Ref (HostRef n) -> Node ("ref.host " ^ Int32.to_string n, []) + | _ -> assert false let definition mode x_opt def = - match mode, def.it with - | `Textual, _ | `Original, Textual _ -> - let m = - match def.it with - | Textual m -> m - | Encoded (_, bs) -> Decode.decode "" bs - in module_with_var_opt x_opt m - | `Binary, _ | `Original, Encoded _ -> - let bs = + try + match mode with + | `Textual -> + let rec unquote def = + match def.it with + | Textual m -> m + | Encoded (_, bs) -> Decode.decode "" bs + | Quoted (_, s) -> unquote (Parse.string_to_module s) + in module_with_var_opt x_opt (unquote def) + | `Binary -> + let rec unquote def = + match def.it with + | Textual m -> Encode.encode m + | Encoded (_, bs) -> Encode.encode (Decode.decode "" bs) + | Quoted (_, s) -> unquote (Parse.string_to_module s) + in binary_module_with_var_opt x_opt (unquote def) + | `Original -> match def.it with - | Textual m -> Encode.encode m - | Encoded (_, bs) -> bs - in binary_module_with_var_opt x_opt bs + | Textual m -> module_with_var_opt x_opt m + | Encoded (_, bs) -> binary_module_with_var_opt x_opt bs + | Quoted (_, s) -> quoted_module_with_var_opt x_opt s + with Parse.Syntax _ -> + quoted_module_with_var_opt x_opt "" -let access x_opt name = - String.concat " " [var_opt x_opt; string name] +let access x_opt n = + String.concat " " [var_opt x_opt; name n] let action act = match act.it with - | Invoke (x_opt, name, lits) -> - Node ("invoke" ^ access x_opt name, List.map literal lits) + | Invoke (x_opt, name, vs) -> + Node ("invoke" ^ access x_opt name, List.map value vs) | Get (x_opt, name) -> Node ("get" ^ access x_opt name, []) @@ -412,12 +441,16 @@ let assertion mode ass = Node ("assert_unlinkable", [definition mode None def; Atom (string re)]) | AssertUninstantiable (def, re) -> Node ("assert_trap", [definition mode None def; Atom (string re)]) - | AssertReturn (act, lits) -> - Node ("assert_return", action act :: List.map literal lits) + | AssertReturn (act, vs) -> + Node ("assert_return", action act :: List.map value vs) | AssertReturnCanonicalNaN act -> Node ("assert_return_canonical_nan", [action act]) | AssertReturnArithmeticNaN act -> Node ("assert_return_arithmetic_nan", [action act]) + | AssertReturnRef act -> + Node ("assert_return_ref", [action act]) + | AssertReturnFunc act -> + Node ("assert_return_func", [action act]) | AssertTrap (act, re) -> Node ("assert_trap", [action act; Atom (string re)]) | AssertExhaustion (act, re) -> @@ -426,8 +459,8 @@ let assertion mode ass = let command mode cmd = match cmd.it with | Module (x_opt, def) -> definition mode x_opt def - | Register (name, x_opt) -> - Node ("register " ^ string name ^ var_opt x_opt, []) + | Register (n, x_opt) -> + Node ("register " ^ name n ^ var_opt x_opt, []) | Action act -> action act | Assertion ass -> assertion mode ass | Meta _ -> assert false diff --git a/interpreter/text/lexer.mll b/interpreter/text/lexer.mll index 70f4a9c3..9a5cf166 100644 --- a/interpreter/text/lexer.mll +++ b/interpreter/text/lexer.mll @@ -18,26 +18,34 @@ let error_nest start lexbuf msg = lexbuf.Lexing.lex_start_p <- start; error lexbuf msg -let text s = +let string s = let b = Buffer.create (String.length s) in let i = ref 1 in while !i < String.length s - 1 do let c = if s.[!i] <> '\\' then s.[!i] else match (incr i; s.[!i]) with | 'n' -> '\n' + | 'r' -> '\r' | 't' -> '\t' | '\\' -> '\\' | '\'' -> '\'' | '\"' -> '\"' - | d -> + | 'u' -> + let j = !i + 2 in + i := String.index_from s j '}'; + let n = int_of_string ("0x" ^ String.sub s j (!i - j)) in + let bs = Utf8.encode [n] in + Buffer.add_substring b bs 0 (String.length bs - 1); + bs.[String.length bs - 1] + | h -> incr i; - Char.chr (int_of_string ("0x" ^ String.make 1 d ^ String.make 1 s.[!i])) + Char.chr (int_of_string ("0x" ^ String.make 1 h ^ String.make 1 s.[!i])) in Buffer.add_char b c; incr i done; Buffer.contents b -let value_type = function +let num_type = function | "i32" -> Types.I32Type | "i64" -> Types.I64Type | "f32" -> Types.F32Type @@ -80,31 +88,54 @@ let ext e s u = let opt = Lib.Option.get } -let space = [' ''\t'] +let sign = '+' | '-' let digit = ['0'-'9'] let hexdigit = ['0'-'9''a'-'f''A'-'F'] +let num = digit ('_'? digit)* +let hexnum = hexdigit ('_'? hexdigit)* + let letter = ['a'-'z''A'-'Z'] -let symbol = ['+''-''*''/''\\''^''~''=''<''>''!''?''@''#''$''%''&''|'':''`''.'] -let tick = '\'' -let escape = ['n''t''\\''\'''\"'] +let symbol = + ['+''-''*''/''\\''^''~''=''<''>''!''?''@''#''$''%''&''|'':''`''.''\''] + +let space = [' ''\t''\n''\r'] +let ascii = ['\x00'-'\x7f'] +let ascii_no_nl = ['\x00'-'\x09''\x0b'-'\x7f'] +let utf8cont = ['\x80'-'\xbf'] +let utf8enc = + ['\xc2'-'\xdf'] utf8cont + | ['\xe0'] ['\xa0'-'\xbf'] utf8cont + | ['\xed'] ['\x80'-'\x9f'] utf8cont + | ['\xe1'-'\xec''\xee'-'\xef'] utf8cont utf8cont + | ['\xf0'] ['\x90'-'\xbf'] utf8cont utf8cont + | ['\xf4'] ['\x80'-'\x8f'] utf8cont utf8cont + | ['\xf1'-'\xf3'] utf8cont utf8cont utf8cont +let utf8 = ascii | utf8enc +let utf8_no_nl = ascii_no_nl | utf8enc + +let escape = ['n''r''t''\\''\'''\"'] let character = - [^'"''\\''\x00'-'\x1f''\x7f'] | '\\'escape | '\\'hexdigit hexdigit + [^'"''\\''\x00'-'\x1f''\x7f'-'\xff'] + | utf8enc + | '\\'escape + | '\\'hexdigit hexdigit + | "\\u{" hexnum '}' -let sign = ('+' | '-') -let num = digit+ -let hexnum = "0x" hexdigit+ -let nat = num | hexnum +let nat = num | "0x" hexnum let int = sign nat +let frac = num +let hexfrac = hexnum let float = - sign? num '.' digit* - | sign? num ('.' digit*)? ('e' | 'E') sign? num - | sign? "0x" hexdigit+ '.'? hexdigit* ('e' | 'E' | 'p') sign? digit+ + sign? num '.' frac? + | sign? num ('.' frac?)? ('e' | 'E') sign? num + | sign? "0x" hexnum '.' hexfrac? + | sign? "0x" hexnum ('.' hexfrac?)? ('p' | 'P') sign? num | sign? "inf" - | sign? "infinity" | sign? "nan" - | sign? "nan:0x" hexdigit+ -let text = '"' character* '"' -let name = '$' (letter | digit | '_' | tick | symbol)+ + | sign? "nan:" "0x" hexnum +let string = '"' character* '"' +let name = '$' (letter | digit | '_' | symbol)+ +let reserved = ([^'\"''('')'';'] # space)+ (* hack for table size *) let ixx = "i" ("32" | "64") let fxx = "f" ("32" | "64") @@ -117,17 +148,24 @@ let mem_size = "8" | "16" | "32" rule token = parse | "(" { LPAR } | ")" { RPAR } + | nat as s { NAT s } | int as s { INT s } | float as s { FLOAT s } - | text as s { TEXT (text s) } - | '"'character*('\n'|eof) { error lexbuf "unclosed text literal" } + + | string as s { STRING (string s) } + | '"'character*('\n'|eof) { error lexbuf "unclosed string literal" } | '"'character*['\x00'-'\x09''\x0b'-'\x1f''\x7f'] - { error lexbuf "illegal control character in text literal" } + { error lexbuf "illegal control character in string literal" } | '"'character*'\\'_ { error_nest (Lexing.lexeme_end_p lexbuf) lexbuf "illegal escape" } - | (nxx as t) { VALUE_TYPE (value_type t) } + | "anyref" { ANYREF } + | "funcref" { FUNCREF } + | "nullref" { NULLREF } + | (nxx as t) { NUM_TYPE (num_type t) } + | "mut" { MUT } + | (nxx as t)".const" { let open Source in CONST (numop t @@ -140,8 +178,10 @@ rule token = parse (fun s -> let n = F64.of_string s.it in f64_const (n @@ s.at), Values.F64 n)) } - | "anyfunc" { ANYFUNC } - | "mut" { MUT } + | "ref.null" { REF_NULL } + | "ref.func" { REF_FUNC } + | "ref.host" { REF_HOST } + | "ref.is_null" { REF_IS_NULL } | "nop" { NOP } | "unreachable" { UNREACHABLE } @@ -160,11 +200,17 @@ rule token = parse | "call" { CALL } | "call_indirect" { CALL_INDIRECT } - | "get_local" { GET_LOCAL } - | "set_local" { SET_LOCAL } - | "tee_local" { TEE_LOCAL } - | "get_global" { GET_GLOBAL } - | "set_global" { SET_GLOBAL } + | "local.get" { LOCAL_GET } + | "local.set" { LOCAL_SET } + | "local.tee" { LOCAL_TEE } + | "global.get" { GLOBAL_GET } + | "global.set" { GLOBAL_SET } + + | "table.get" { TABLE_GET } + | "table.set" { TABLE_SET } + | "table.size" { TABLE_SIZE } + | "table.grow" { TABLE_GROW } + | "table.fill" { TABLE_FILL } | (nxx as t)".load" { LOAD (fun a o -> @@ -255,34 +301,34 @@ rule token = parse | (fxx as t)".gt" { COMPARE (floatop t f32_gt f64_gt) } | (fxx as t)".ge" { COMPARE (floatop t f32_ge f64_ge) } - | "i32.wrap/i64" { CONVERT i32_wrap_i64 } - | "i64.extend_s/i32" { CONVERT i64_extend_s_i32 } - | "i64.extend_u/i32" { CONVERT i64_extend_u_i32 } - | "f32.demote/f64" { CONVERT f32_demote_f64 } - | "f64.promote/f32" { CONVERT f64_promote_f32 } - | (ixx as t)".trunc_s/f32" - { CONVERT (intop t i32_trunc_s_f32 i64_trunc_s_f32) } - | (ixx as t)".trunc_u/f32" - { CONVERT (intop t i32_trunc_u_f32 i64_trunc_u_f32) } - | (ixx as t)".trunc_s/f64" - { CONVERT (intop t i32_trunc_s_f64 i64_trunc_s_f64) } - | (ixx as t)".trunc_u/f64" - { CONVERT (intop t i32_trunc_u_f64 i64_trunc_u_f64) } - | (fxx as t)".convert_s/i32" - { CONVERT (floatop t f32_convert_s_i32 f64_convert_s_i32) } - | (fxx as t)".convert_u/i32" - { CONVERT (floatop t f32_convert_u_i32 f64_convert_u_i32) } - | (fxx as t)".convert_s/i64" - { CONVERT (floatop t f32_convert_s_i64 f64_convert_s_i64) } - | (fxx as t)".convert_u/i64" - { CONVERT (floatop t f32_convert_u_i64 f64_convert_u_i64) } - | "f32.reinterpret/i32" { CONVERT f32_reinterpret_i32 } - | "f64.reinterpret/i64" { CONVERT f64_reinterpret_i64 } - | "i32.reinterpret/f32" { CONVERT i32_reinterpret_f32 } - | "i64.reinterpret/f64" { CONVERT i64_reinterpret_f64 } - - | "current_memory" { CURRENT_MEMORY } - | "grow_memory" { GROW_MEMORY } + | "i32.wrap_i64" { CONVERT i32_wrap_i64 } + | "i64.extend_i32_s" { CONVERT i64_extend_i32_s } + | "i64.extend_i32_u" { CONVERT i64_extend_i32_u } + | "f32.demote_f64" { CONVERT f32_demote_f64 } + | "f64.promote_f32" { CONVERT f64_promote_f32 } + | (ixx as t)".trunc_f32_s" + { CONVERT (intop t i32_trunc_f32_s i64_trunc_f32_s) } + | (ixx as t)".trunc_f32_u" + { CONVERT (intop t i32_trunc_f32_u i64_trunc_f32_u) } + | (ixx as t)".trunc_f64_s" + { CONVERT (intop t i32_trunc_f64_s i64_trunc_f64_s) } + | (ixx as t)".trunc_f64_u" + { CONVERT (intop t i32_trunc_f64_u i64_trunc_f64_u) } + | (fxx as t)".convert_i32_s" + { CONVERT (floatop t f32_convert_i32_s f64_convert_i32_s) } + | (fxx as t)".convert_i32_u" + { CONVERT (floatop t f32_convert_i32_u f64_convert_i32_u) } + | (fxx as t)".convert_i64_s" + { CONVERT (floatop t f32_convert_i64_s f64_convert_i64_s) } + | (fxx as t)".convert_i64_u" + { CONVERT (floatop t f32_convert_i64_u f64_convert_i64_u) } + | "f32.reinterpret_i32" { CONVERT f32_reinterpret_i32 } + | "f64.reinterpret_i64" { CONVERT f64_reinterpret_i64 } + | "i32.reinterpret_f32" { CONVERT i32_reinterpret_f32 } + | "i64.reinterpret_f64" { CONVERT i64_reinterpret_f64 } + + | "memory.size" { MEMORY_SIZE } + | "memory.grow" { MEMORY_GROW } | "type" { TYPE } | "func" { FUNC } @@ -291,7 +337,6 @@ rule token = parse | "result" { RESULT } | "local" { LOCAL } | "global" { GLOBAL } - | "module" { MODULE } | "table" { TABLE } | "memory" { MEMORY } | "elem" { ELEM } @@ -300,6 +345,10 @@ rule token = parse | "import" { IMPORT } | "export" { EXPORT } + | "module" { MODULE } + | "binary" { BIN } + | "quote" { QUOTE } + | "script" { SCRIPT } | "register" { REGISTER } | "invoke" { INVOKE } @@ -310,6 +359,8 @@ rule token = parse | "assert_return" { ASSERT_RETURN } | "assert_return_canonical_nan" { ASSERT_RETURN_CANONICAL_NAN } | "assert_return_arithmetic_nan" { ASSERT_RETURN_ARITHMETIC_NAN } + | "assert_return_ref" { ASSERT_RETURN_REF } + | "assert_return_func" { ASSERT_RETURN_FUNC } | "assert_trap" { ASSERT_TRAP } | "assert_exhaustion" { ASSERT_EXHAUSTION } | "input" { INPUT } @@ -317,17 +368,22 @@ rule token = parse | name as s { VAR s } - | ";;"[^'\n']*eof { EOF } - | ";;"[^'\n']*'\n' { Lexing.new_line lexbuf; token lexbuf } + | ";;"utf8_no_nl*eof { EOF } + | ";;"utf8_no_nl*'\n' { Lexing.new_line lexbuf; token lexbuf } + | ";;"utf8_no_nl* { token lexbuf (* causes error on following position *) } | "(;" { comment (Lexing.lexeme_start_p lexbuf) lexbuf; token lexbuf } - | space { token lexbuf } + | space#'\n' { token lexbuf } | '\n' { Lexing.new_line lexbuf; token lexbuf } | eof { EOF } - | _ { error lexbuf "unknown operator" } + + | reserved { error lexbuf "unknown operator" } + | utf8 { error lexbuf "malformed operator" } + | _ { error lexbuf "malformed UTF-8 encoding" } and comment start = parse | ";)" { () } | "(;" { comment (Lexing.lexeme_start_p lexbuf) lexbuf; comment start lexbuf } | '\n' { Lexing.new_line lexbuf; comment start lexbuf } | eof { error_nest start lexbuf "unclosed comment" } - | _ { comment start lexbuf } + | utf8 { comment start lexbuf } + | _ { error lexbuf "malformed UTF-8 encoding" } diff --git a/interpreter/text/parse.ml b/interpreter/text/parse.ml index f0be3370..71c4cc4a 100644 --- a/interpreter/text/parse.ml +++ b/interpreter/text/parse.ml @@ -1,5 +1,5 @@ type 'a start = - | Module : Script.definition start + | Module : (Script.var option * Script.definition) start | Script : Script.script start | Script1 : Script.script start @@ -25,4 +25,4 @@ let string_to start s = parse "string" lexbuf start let string_to_script s = string_to Script s -let string_to_module s = string_to Module s +let string_to_module s = snd (string_to Module s) diff --git a/interpreter/text/parse.mli b/interpreter/text/parse.mli index 46e7e67c..89f8e580 100644 --- a/interpreter/text/parse.mli +++ b/interpreter/text/parse.mli @@ -1,11 +1,11 @@ type 'a start = - | Module : Script.definition start + | Module : (Script.var option * Script.definition) start | Script : Script.script start | Script1 : Script.script start exception Syntax of Source.region * string -val parse : string -> Lexing.lexbuf -> 'a start -> 'a (* raise Syntax *) +val parse : string -> Lexing.lexbuf -> 'a start -> 'a (* raises Syntax *) -val string_to_script : string -> Script.script (* raise Syntax *) -val string_to_module : string -> Script.definition (* raise Syntax *) +val string_to_script : string -> Script.script (* raises Syntax *) +val string_to_module : string -> Script.definition (* raises Syntax *) diff --git a/interpreter/text/parser.mly b/interpreter/text/parser.mly index e784a59c..c42b3cd3 100644 --- a/interpreter/text/parser.mly +++ b/interpreter/text/parser.mly @@ -48,6 +48,9 @@ let nat s at = let nat32 s at = try I32.of_string_u s with Failure _ -> error at "i32 constant out of range" +let name s at = + try Utf8.decode s with Utf8.Utf8 -> error at "invalid UTF-8 encoding" + (* Symbolic variables *) @@ -56,8 +59,8 @@ module VarMap = Map.Make(String) type space = {mutable map : int32 VarMap.t; mutable count : int32} let empty () = {map = VarMap.empty; count = 0l} -type types = {mutable tmap : int32 VarMap.t; mutable tlist : Types.func_type list} -let empty_types () = {tmap = VarMap.empty; tlist = []} +type types = {space : space; mutable list : type_ list} +let empty_types () = {space = empty (); list = []} type context = { types : types; tables : space; memories : space; @@ -71,14 +74,11 @@ let empty_context () = let enter_func (c : context) = {c with labels = VarMap.empty; locals = empty ()} -let type_ (c : context) x = - try VarMap.find x.it c.types.tmap - with Not_found -> error x.at ("unknown type " ^ x.it) - let lookup category space x = try VarMap.find x.it space.map with Not_found -> error x.at ("unknown " ^ category ^ " " ^ x.it) +let type_ (c : context) x = lookup "type" c.types.space x let func (c : context) x = lookup "function" c.funcs x let local (c : context) x = lookup "local" c.locals x let global (c : context) x = lookup "global" c.globals x @@ -88,15 +88,10 @@ let label (c : context) x = try VarMap.find x.it c.labels with Not_found -> error x.at ("unknown label " ^ x.it) -let bind_type (c : context) x ty = - if VarMap.mem x.it c.types.tmap then - error x.at ("duplicate type " ^ x.it); - c.types.tmap <- - VarMap.add x.it (Lib.List32.length c.types.tlist) c.types.tmap; - c.types.tlist <- c.types.tlist @ [ty] +let func_type (c : context) x = + try (Lib.List32.nth c.types.list x.it).it + with Failure _ -> error x.at ("unknown type " ^ Int32.to_string x.it) -let anon_type (c : context) ty = - c.types.tlist <- c.types.tlist @ [ty] let bind category space x = if VarMap.mem x.it space.map then @@ -108,6 +103,9 @@ let bind category space x = error x.at ("too many " ^ category ^ " bindings"); i +let bind_type (c : context) x ty = + c.types.list <- c.types.list @ [ty]; + bind "type" c.types.space x let bind_func (c : context) x = bind "function" c.funcs x let bind_local (c : context) x = bind "local" c.locals x let bind_global (c : context) x = bind "global" c.globals x @@ -123,6 +121,9 @@ let anon category space n = error no_region ("too many " ^ category ^ " bindings"); i +let anon_type (c : context) ty = + c.types.list <- c.types.list @ [ty]; + anon "type" c.types.space 1l let anon_func (c : context) = anon "function" c.funcs 1l let anon_locals (c : context) ts = ignore (anon "local" c.locals (Lib.List32.length ts)) @@ -132,48 +133,47 @@ let anon_memory (c : context) = anon "memory" c.memories 1l let anon_label (c : context) = {c with labels = VarMap.map (Int32.add 1l) c.labels} -let empty_type = FuncType ([], []) +let inline_type (c : context) ft at = + match Lib.List.index_where (fun ty -> ty.it = ft) c.types.list with + | Some i -> Int32.of_int i @@ at + | None -> anon_type c (ft @@ at) @@ at -let explicit_sig (c : context) var_sem ty at = - let x = var_sem c type_ in - if - x.it < Lib.List32.length c.types.tlist && - ty <> empty_type && - ty <> Lib.List32.nth c.types.tlist x.it - then - error at "signature mismatch"; +let inline_type_explicit (c : context) x ft at = + if ft <> FuncType ([], []) && ft <> func_type c x then + error at "inline function type does not match explicit type"; x -let inline_type (c : context) ty at = - match Lib.List.index_of ty c.types.tlist with - | Some i -> Int32.of_int i @@ at - | None -> - let i = Lib.List32.length c.types.tlist in ignore (anon_type c ty); i @@ at - %} -%token NAT INT FLOAT TEXT VAR VALUE_TYPE ANYFUNC MUT LPAR RPAR -%token NOP DROP BLOCK END IF THEN ELSE SELECT LOOP BR BR_IF BR_TABLE +%token LPAR RPAR +%token NAT INT FLOAT STRING VAR +%token ANYREF NULLREF FUNCREF NUM_TYPE MUT +%token UNREACHABLE NOP DROP SELECT +%token BLOCK END IF THEN ELSE LOOP BR BR_IF BR_TABLE %token CALL CALL_INDIRECT RETURN -%token GET_LOCAL SET_LOCAL TEE_LOCAL GET_GLOBAL SET_GLOBAL +%token LOCAL_GET LOCAL_SET LOCAL_TEE GLOBAL_GET GLOBAL_SET +%token TABLE_GET TABLE_SET TABLE_SIZE TABLE_GROW TABLE_FILL +%token MEMORY_SIZE MEMORY_GROW %token LOAD STORE OFFSET_EQ_NAT ALIGN_EQ_NAT -%token CONST UNARY BINARY COMPARE CONVERT -%token UNREACHABLE CURRENT_MEMORY GROW_MEMORY +%token CONST UNARY BINARY TEST COMPARE CONVERT +%token REF_NULL REF_FUNC REF_HOST REF_IS_NULL %token FUNC START TYPE PARAM RESULT LOCAL GLOBAL -%token MODULE TABLE ELEM MEMORY DATA OFFSET IMPORT EXPORT TABLE +%token TABLE ELEM MEMORY DATA OFFSET IMPORT EXPORT TABLE +%token MODULE BIN QUOTE %token SCRIPT REGISTER INVOKE GET %token ASSERT_MALFORMED ASSERT_INVALID ASSERT_SOFT_INVALID ASSERT_UNLINKABLE -%token ASSERT_RETURN ASSERT_RETURN_CANONICAL_NAN ASSERT_RETURN_ARITHMETIC_NAN ASSERT_TRAP ASSERT_EXHAUSTION +%token ASSERT_RETURN ASSERT_RETURN_CANONICAL_NAN ASSERT_RETURN_ARITHMETIC_NAN +%token ASSERT_RETURN_REF ASSERT_RETURN_FUNC ASSERT_TRAP ASSERT_EXHAUSTION %token INPUT OUTPUT %token EOF %token NAT %token INT %token FLOAT -%token TEXT +%token STRING %token VAR -%token VALUE_TYPE -%token Ast.instr' * Values.value> CONST +%token NUM_TYPE +%token Ast.instr' * Values.num> CONST %token UNARY %token BINARY %token TEST @@ -190,49 +190,58 @@ let inline_type (c : context) ty at = %start script script1 module1 %type script %type script1 -%type module1 +%type module1 %% /* Auxiliaries */ -text_list : +name : + | STRING { name $1 (at ()) } + +string_list : | /* empty */ { "" } - | text_list TEXT { $1 ^ $2 } + | string_list STRING { $1 ^ $2 } /* Types */ +ref_type : + | ANYREF { AnyRefType } + | FUNCREF { FuncRefType } + | NULLREF { NullRefType } + +value_type : + | NUM_TYPE { NumType $1 } + | ref_type { RefType $1 } + value_type_list : | /* empty */ { [] } - | VALUE_TYPE value_type_list { $1 :: $2 } - -elem_type : - | ANYFUNC { AnyFuncType } + | value_type value_type_list { $1 :: $2 } global_type : - | VALUE_TYPE { GlobalType ($1, Immutable) } - | LPAR MUT VALUE_TYPE RPAR { GlobalType ($3, Mutable) } + | value_type { GlobalType ($1, Immutable) } + | LPAR MUT value_type RPAR { GlobalType ($3, Mutable) } -func_type : - | LPAR FUNC func_sig RPAR { $3 } +def_type : + | LPAR FUNC func_type RPAR { $3 } -func_sig : +func_type : | /* empty */ { FuncType ([], []) } - | LPAR RESULT value_type_list RPAR func_sig + | LPAR RESULT value_type_list RPAR func_type { let FuncType (ins, out) = $5 in if ins <> [] then error (at ()) "result before parameter"; FuncType (ins, $3 @ out) } - | LPAR PARAM value_type_list RPAR func_sig + | LPAR PARAM value_type_list RPAR func_type { let FuncType (ins, out) = $5 in FuncType ($3 @ ins, out) } - | LPAR PARAM bind_var VALUE_TYPE RPAR func_sig /* Sugar */ + | LPAR PARAM bind_var value_type RPAR func_type /* Sugar */ { let FuncType (ins, out) = $6 in FuncType ($4 :: ins, out) } -table_sig : - | limits elem_type { TableType ($1, $2) } +table_type : + | limits ref_type { TableType ($1, $2) } -memory_sig : +memory_type : | limits { MemoryType $1 } limits : @@ -297,12 +306,15 @@ align_opt : instr : | plain_instr { let at = at () in fun c -> [$1 c @@ at] } + | select_instr_instr { fun c -> let e, es = $1 c in e :: es } + | call_instr_instr { fun c -> let e, es = $1 c in e :: es } | block_instr { let at = at () in fun c -> [$1 c @@ at] } | expr { $1 } /* Sugar */ plain_instr : | UNREACHABLE { fun c -> unreachable } | NOP { fun c -> nop } + | DROP { fun c -> drop } | BR var { fun c -> br ($2 c label) } | BR_IF var { fun c -> br_if ($2 c label) } | BR_TABLE var var_list @@ -310,18 +322,23 @@ plain_instr : br_table xs x } | RETURN { fun c -> return } | CALL var { fun c -> call ($2 c func) } - | CALL_INDIRECT var { fun c -> call_indirect ($2 c type_) } - | DROP { fun c -> drop } - | SELECT { fun c -> select } - | GET_LOCAL var { fun c -> get_local ($2 c local) } - | SET_LOCAL var { fun c -> set_local ($2 c local) } - | TEE_LOCAL var { fun c -> tee_local ($2 c local) } - | GET_GLOBAL var { fun c -> get_global ($2 c global) } - | SET_GLOBAL var { fun c -> set_global ($2 c global) } + | LOCAL_GET var { fun c -> local_get ($2 c local) } + | LOCAL_SET var { fun c -> local_set ($2 c local) } + | LOCAL_TEE var { fun c -> local_tee ($2 c local) } + | GLOBAL_GET var { fun c -> global_get ($2 c global) } + | GLOBAL_SET var { fun c -> global_set ($2 c global) } + | TABLE_GET var { fun c -> table_get ($2 c table) } + | TABLE_SET var { fun c -> table_set ($2 c table) } + | TABLE_SIZE var { fun c -> table_size ($2 c table) } + | TABLE_GROW var { fun c -> table_grow ($2 c table) } + | TABLE_FILL var { fun c -> table_fill ($2 c table) } | LOAD offset_opt align_opt { fun c -> $1 $3 $2 } | STORE offset_opt align_opt { fun c -> $1 $3 $2 } - | CURRENT_MEMORY { fun c -> current_memory } - | GROW_MEMORY { fun c -> grow_memory } + | MEMORY_SIZE { fun c -> memory_size } + | MEMORY_GROW { fun c -> memory_grow } + | REF_NULL { fun c -> ref_null } + | REF_IS_NULL { fun c -> ref_is_null } + | REF_FUNC var { fun c -> ref_func ($2 c func) } | CONST literal { fun c -> fst (literal $1 $2) } | TEST { fun c -> $1 } | COMPARE { fun c -> $1 } @@ -329,6 +346,93 @@ plain_instr : | BINARY { fun c -> $1 } | CONVERT { fun c -> $1 } + +select_instr : + | SELECT select_instr_results + { let at = at () in fun c -> let b, ts = $2 in + select (if b then (Some ts) else None) @@ at } + +select_instr_results : + | LPAR RESULT value_type_list RPAR select_instr_results + { let _, ts = $5 in true, $3 @ ts } + | /* empty */ + { false, [] } + +select_instr_instr : + | SELECT select_instr_results_instr + { let at1 = ati 1 in + fun c -> let b, ts, es = $2 c in + select (if b then (Some ts) else None) @@ at1, es } + +select_instr_results_instr : + | LPAR RESULT value_type_list RPAR select_instr_results_instr + { fun c -> let _, ts, es = $5 c in true, $3 @ ts, es } + | instr + { fun c -> false, [], $1 c } + + +call_instr : + | CALL_INDIRECT var call_instr_type + { let at = at () in fun c -> call_indirect ($2 c table) ($3 c) @@ at } + | CALL_INDIRECT call_instr_type /* Sugar */ + { let at = at () in fun c -> call_indirect (0l @@ at) ($2 c) @@ at } + +call_instr_type : + | type_use call_instr_params + { let at1 = ati 1 in + fun c -> + match $2 c with + | FuncType ([], []) -> $1 c type_ + | ft -> inline_type_explicit c ($1 c type_) ft at1 } + | call_instr_params + { let at = at () in fun c -> inline_type c ($1 c) at } + +call_instr_params : + | LPAR PARAM value_type_list RPAR call_instr_params + { fun c -> let FuncType (ts1, ts2) = $5 c in FuncType ($3 @ ts1, ts2) } + | call_instr_results + { fun c -> FuncType ([], $1 c) } + +call_instr_results : + | LPAR RESULT value_type_list RPAR call_instr_results + { fun c -> $3 @ $5 c } + | /* empty */ + { fun c -> [] } + + +call_instr_instr : + | CALL_INDIRECT var call_instr_type_instr + { let at1 = ati 1 in + fun c -> let x, es = $3 c in call_indirect ($2 c table) x @@ at1, es } + | CALL_INDIRECT call_instr_type_instr /* Sugar */ + { let at1 = ati 1 in + fun c -> let x, es = $2 c in call_indirect (0l @@ at1) x @@ at1, es } + +call_instr_type_instr : + | type_use call_instr_params_instr + { let at1 = ati 1 in + fun c -> + match $2 c with + | FuncType ([], []), es -> $1 c type_, es + | ft, es -> inline_type_explicit c ($1 c type_) ft at1, es } + | call_instr_params_instr + { let at = at () in + fun c -> let ft, es = $1 c in inline_type c ft at, es } + +call_instr_params_instr : + | LPAR PARAM value_type_list RPAR call_instr_params_instr + { fun c -> + let FuncType (ts1, ts2), es = $5 c in FuncType ($3 @ ts1, ts2), es } + | call_instr_results_instr + { fun c -> let ts, es = $1 c in FuncType ([], ts), es } + +call_instr_results_instr : + | LPAR RESULT value_type_list RPAR call_instr_results_instr + { fun c -> let ts, es = $5 c in $3 @ ts, es } + | instr + { fun c -> [], $1 c } + + block_instr : | BLOCK labeling_opt block END labeling_end_opt { fun c -> let c' = $2 c $5 in let ts, es = $3 c' in block ts es } @@ -340,45 +444,88 @@ block_instr : { fun c -> let c' = $2 c ($5 @ $8) in let ts, es1 = $3 c' in if_ ts es1 ($6 c') } +block_type : + | LPAR RESULT value_type RPAR { [$3] } + block : - | value_type_list instr_list { fun c -> $1, $2 c } + | block_type instr_list + { fun c -> $1, $2 c } + | instr_list { fun c -> [], $1 c } expr : /* Sugar */ | LPAR expr1 RPAR { let at = at () in fun c -> let es, e' = $2 c in es @ [e' @@ at] } expr1 : /* Sugar */ - | plain_instr expr_list { fun c -> snd ($2 c), $1 c } + | plain_instr expr_list { fun c -> $2 c, $1 c } + | SELECT select_expr_results + { fun c -> let b, ts, es = $2 c in es, select (if b then (Some ts) else None) } + | CALL_INDIRECT var call_expr_type + { fun c -> let x, es = $3 c in es, call_indirect ($2 c table) x } + | CALL_INDIRECT call_expr_type /* Sugar */ + { let at1 = ati 1 in + fun c -> let x, es = $2 c in es, call_indirect (0l @@ at1) x } | BLOCK labeling_opt block { fun c -> let c' = $2 c [] in let ts, es = $3 c' in [], block ts es } | LOOP labeling_opt block { fun c -> let c' = $2 c [] in let ts, es = $3 c' in [], loop ts es } - | IF labeling_opt value_type_list if_ + | IF labeling_opt if_block { fun c -> let c' = $2 c [] in - let es, es1, es2 = $4 c c' in es, if_ $3 es1 es2 } + let ts, (es, es1, es2) = $3 c c' in es, if_ ts es1 es2 } + +select_expr_results : + | LPAR RESULT value_type_list RPAR select_expr_results + { fun c -> let _, ts, es = $5 c in true, $3 @ ts, es } + | expr_list + { fun c -> false, [], $1 c } + +call_expr_type : + | type_use call_expr_params + { let at1 = ati 1 in + fun c -> + match $2 c with + | FuncType ([], []), es -> $1 c type_, es + | ft, es -> inline_type_explicit c ($1 c type_) ft at1, es } + | call_expr_params + { let at1 = ati 1 in + fun c -> let ft, es = $1 c in inline_type c ft at1, es } + +call_expr_params : + | LPAR PARAM value_type_list RPAR call_expr_params + { fun c -> + let FuncType (ts1, ts2), es = $5 c in FuncType ($3 @ ts1, ts2), es } + | call_expr_results + { fun c -> let ts, es = $1 c in FuncType ([], ts), es } + +call_expr_results : + | LPAR RESULT value_type_list RPAR call_expr_results + { fun c -> let ts, es = $5 c in $3 @ ts, es } + | expr_list + { fun c -> [], $1 c } + + +if_block : + | block_type if_block { fun c c' -> let ts, ess = $2 c c' in $1 @ ts, ess } + | if_ { fun c c' -> [], $1 c c' } if_ : - | LPAR THEN instr_list RPAR LPAR ELSE instr_list RPAR + | expr if_ + { fun c c' -> let es = $1 c in let es0, es1, es2 = $2 c c' in + es @ es0, es1, es2 } + | LPAR THEN instr_list RPAR LPAR ELSE instr_list RPAR /* Sugar */ { fun c c' -> [], $3 c', $7 c' } | LPAR THEN instr_list RPAR /* Sugar */ { fun c c' -> [], $3 c', [] } - | expr LPAR THEN instr_list RPAR LPAR ELSE instr_list RPAR /* Sugar */ - { fun c c' -> $1 c, $4 c', $8 c' } - | expr LPAR THEN instr_list RPAR /* Sugar */ - { fun c c' -> $1 c, $4 c', [] } - | expr expr expr /* Sugar */ - { fun c c' -> $1 c, $2 c', $3 c' } - | expr expr /* Sugar */ - { fun c c' -> $1 c, $2 c', [] } instr_list : | /* empty */ { fun c -> [] } + | select_instr { fun c -> [$1 c] } + | call_instr { fun c -> [$1 c] } | instr instr_list { fun c -> $1 c @ $2 c } expr_list : - | /* empty */ { fun c -> 0, [] } - | expr expr_list - { fun c -> let es1 = $1 c and n, es2 = $2 c in n + 1, es1 @ es2 } + | /* empty */ { fun c -> [] } + | expr expr_list { fun c -> $1 c @ $2 c } const_expr : | instr_list { let at = at () in fun c -> $1 c @@ at } @@ -386,63 +533,75 @@ const_expr : /* Functions */ +func : + | LPAR FUNC bind_var_opt func_fields RPAR + { let at = at () in + fun c -> let x = $3 c anon_func bind_func @@ at in fun () -> $4 c x at } + func_fields : - | func_body { $1 } - | LPAR RESULT value_type_list RPAR func_body - { let FuncType (ins, out) = fst $5 in - FuncType (ins, $3 @ out), fun c -> snd $5 c } - | LPAR PARAM value_type_list RPAR func_fields + | type_use func_fields_body + { fun c x at -> + let t = inline_type_explicit c ($1 c type_) (fst $2) at in + [{(snd $2 (enter_func c)) with ftype = t} @@ at], [], [] } + | func_fields_body /* Sugar */ + { fun c x at -> + let t = inline_type c (fst $1) at in + [{(snd $1 (enter_func c)) with ftype = t} @@ at], [], [] } + | inline_import type_use func_fields_import /* Sugar */ + { fun c x at -> + let t = inline_type_explicit c ($2 c type_) $3 at in + [], + [{ module_name = fst $1; item_name = snd $1; + idesc = FuncImport t @@ at } @@ at ], [] } + | inline_import func_fields_import /* Sugar */ + { fun c x at -> + let t = inline_type c $2 at in + [], + [{ module_name = fst $1; item_name = snd $1; + idesc = FuncImport t @@ at } @@ at ], [] } + | inline_export func_fields /* Sugar */ + { fun c x at -> + let fns, ims, exs = $2 c x at in fns, ims, $1 (FuncExport x) c :: exs } + +func_fields_import : /* Sugar */ + | func_fields_import_result { $1 } + | LPAR PARAM value_type_list RPAR func_fields_import + { let FuncType (ins, out) = $5 in FuncType ($3 @ ins, out) } + | LPAR PARAM bind_var value_type RPAR func_fields_import /* Sugar */ + { let FuncType (ins, out) = $6 in FuncType ($4 :: ins, out) } + +func_fields_import_result : /* Sugar */ + | /* empty */ { FuncType ([], []) } + | LPAR RESULT value_type_list RPAR func_fields_import_result + { let FuncType (ins, out) = $5 in FuncType (ins, $3 @ out) } + +func_fields_body : + | func_result_body { $1 } + | LPAR PARAM value_type_list RPAR func_fields_body { let FuncType (ins, out) = fst $5 in FuncType ($3 @ ins, out), - fun c -> ignore (anon_locals c $3); (snd $5) c } - | LPAR PARAM bind_var VALUE_TYPE RPAR func_fields /* Sugar */ + fun c -> ignore (anon_locals c $3); snd $5 c } + | LPAR PARAM bind_var value_type RPAR func_fields_body /* Sugar */ { let FuncType (ins, out) = fst $6 in FuncType ($4 :: ins, out), - fun c -> ignore (bind_local c $3); (snd $6) c } + fun c -> ignore (bind_local c $3); snd $6 c } + +func_result_body : + | func_body { FuncType ([], []), $1 } + | LPAR RESULT value_type_list RPAR func_result_body + { let FuncType (ins, out) = fst $5 in + FuncType (ins, $3 @ out), snd $5 } func_body : | instr_list - { empty_type, - fun c -> let c' = anon_label c in + { fun c -> let c' = anon_label c in {ftype = -1l @@ at(); locals = []; body = $1 c'} } | LPAR LOCAL value_type_list RPAR func_body - { fst $5, - fun c -> ignore (anon_locals c $3); let f = (snd $5) c in - {f with locals = $3 @ f.locals} } - | LPAR LOCAL bind_var VALUE_TYPE RPAR func_body /* Sugar */ - { fst $6, - fun c -> ignore (bind_local c $3); let f = (snd $6) c in - {f with locals = $4 :: f.locals} } - -func : - | LPAR FUNC bind_var_opt inline_export type_use func_fields RPAR - { let at = at () in - fun c -> - let x = $3 c anon_func bind_func @@ at in - let t = explicit_sig c $5 (fst $6) at in - (fun () -> {(snd $6 (enter_func c)) with ftype = t} @@ at), - $4 (FuncExport x) c } - /* Duplicate above for empty inline_export_opt to avoid LR(1) conflict. */ - | LPAR FUNC bind_var_opt type_use func_fields RPAR - { let at = at () in - fun c -> ignore ($3 c anon_func bind_func); - let t = explicit_sig c $4 (fst $5) at in - (fun () -> {(snd $5 (enter_func c)) with ftype = t} @@ at), - [] } - | LPAR FUNC bind_var_opt inline_export func_fields RPAR /* Sugar */ - { let at = at () in - fun c -> - let x = $3 c anon_func bind_func @@ at in - let t = inline_type c (fst $5) at in - (fun () -> {(snd $5 (enter_func c)) with ftype = t} @@ at), - $4 (FuncExport x) c } - /* Duplicate above for empty inline_export_opt to avoid LR(1) conflict. */ - | LPAR FUNC bind_var_opt func_fields RPAR /* Sugar */ - { let at = at () in - fun c -> ignore ($3 c anon_func bind_func); - let t = inline_type c (fst $4) at in - (fun () -> {(snd $4 (enter_func c)) with ftype = t} @@ at), - [] } + { fun c -> ignore (anon_locals c $3); let f = $5 c in + {f with locals = $3 @ f.locals} } + | LPAR LOCAL bind_var value_type RPAR func_body /* Sugar */ + { fun c -> ignore (bind_local c $3); let f = $6 c in + {f with locals = $4 :: f.locals} } /* Tables, Memories & Globals */ @@ -460,63 +619,79 @@ elem : fun c -> {index = 0l @@ at; offset = $3 c; init = $4 c func} @@ at } table : - | LPAR TABLE bind_var_opt inline_export_opt table_sig RPAR + | LPAR TABLE bind_var_opt table_fields RPAR { let at = at () in fun c -> let x = $3 c anon_table bind_table @@ at in - fun () -> {ttype = $5} @@ at, [], $4 (TableExport x) c } - | LPAR TABLE bind_var_opt inline_export_opt elem_type - LPAR ELEM var_list RPAR RPAR /* Sugar */ - { let at = at () in - fun c -> let x = $3 c anon_table bind_table @@ at in - fun () -> - let init = $8 c func in let size = Int32.of_int (List.length init) in - {ttype = TableType ({min = size; max = Some size}, $5)} @@ at, + fun () -> $4 c x at } + +table_fields : + | table_type + { fun c x at -> [{ttype = $1} @@ at], [], [], [] } + | inline_import table_type /* Sugar */ + { fun c x at -> + [], [], + [{ module_name = fst $1; item_name = snd $1; + idesc = TableImport $2 @@ at } @@ at], [] } + | inline_export table_fields /* Sugar */ + { fun c x at -> let tabs, elems, ims, exs = $2 c x at in + tabs, elems, ims, $1 (TableExport x) c :: exs } + | ref_type LPAR ELEM var_list RPAR /* Sugar */ + { fun c x at -> + let init = $4 c func in let size = Int32.of_int (List.length init) in + [{ttype = TableType ({min = size; max = Some size}, $1)} @@ at], [{index = x; offset = [i32_const (0l @@ at) @@ at] @@ at; init} @@ at], - $4 (TableExport x) c } + [], [] } data : - | LPAR DATA var offset text_list RPAR + | LPAR DATA var offset string_list RPAR { let at = at () in fun c -> {index = $3 c memory; offset = $4 c; init = $5} @@ at } - | LPAR DATA offset text_list RPAR /* Sugar */ + | LPAR DATA offset string_list RPAR /* Sugar */ { let at = at () in fun c -> {index = 0l @@ at; offset = $3 c; init = $4} @@ at } memory : - | LPAR MEMORY bind_var_opt inline_export_opt memory_sig RPAR - { let at = at () in - fun c -> let x = $3 c anon_memory bind_memory @@ at in - {mtype = $5} @@ at, [], $4 (MemoryExport x) c } - | LPAR MEMORY bind_var_opt inline_export LPAR DATA text_list RPAR RPAR - /* Sugar */ - { let at = at () in - fun c -> let x = $3 c anon_memory bind_memory @@ at in - let size = Int32.(div (add (of_int (String.length $7)) 65535l) 65536l) in - {mtype = MemoryType {min = size; max = Some size}} @@ at, - [{index = x; - offset = [i32_const (0l @@ at) @@ at] @@ at; init = $7} @@ at], - $4 (MemoryExport x) c } - /* Duplicate above for empty inline_export_opt to avoid LR(1) conflict. */ - | LPAR MEMORY bind_var_opt LPAR DATA text_list RPAR RPAR /* Sugar */ + | LPAR MEMORY bind_var_opt memory_fields RPAR { let at = at () in fun c -> let x = $3 c anon_memory bind_memory @@ at in - let size = Int32.(div (add (of_int (String.length $6)) 65535l) 65536l) in - {mtype = MemoryType {min = size; max = Some size}} @@ at, + fun () -> $4 c x at } + +memory_fields : + | memory_type + { fun c x at -> [{mtype = $1} @@ at], [], [], [] } + | inline_import memory_type /* Sugar */ + { fun c x at -> + [], [], + [{ module_name = fst $1; item_name = snd $1; + idesc = MemoryImport $2 @@ at } @@ at], [] } + | inline_export memory_fields /* Sugar */ + { fun c x at -> let mems, data, ims, exs = $2 c x at in + mems, data, ims, $1 (MemoryExport x) c :: exs } + | LPAR DATA string_list RPAR /* Sugar */ + { fun c x at -> + let size = Int32.(div (add (of_int (String.length $3)) 65535l) 65536l) in + [{mtype = MemoryType {min = size; max = Some size}} @@ at], [{index = x; - offset = [i32_const (0l @@ at) @@ at] @@ at; init = $6} @@ at], - [] } + offset = [i32_const (0l @@ at) @@ at] @@ at; init = $3} @@ at], + [], [] } global : - | LPAR GLOBAL bind_var_opt inline_export global_type const_expr RPAR + | LPAR GLOBAL bind_var_opt global_fields RPAR { let at = at () in fun c -> let x = $3 c anon_global bind_global @@ at in - (fun () -> {gtype = $5; value = $6 c} @@ at), - $4 (GlobalExport x) c } - /* Duplicate above for empty inline_export_opt to avoid LR(1) conflict. */ - | LPAR GLOBAL bind_var_opt global_type const_expr RPAR - { let at = at () in - fun c -> ignore ($3 c anon_global bind_global); - (fun () -> {gtype = $4; value = $5 c} @@ at), [] } + fun () -> $4 c x at } + +global_fields : + | global_type const_expr + { fun c x at -> [{gtype = $1; value = $2 c} @@ at], [], [] } + | inline_import global_type /* Sugar */ + { fun c x at -> + [], + [{ module_name = fst $1; item_name = snd $1; + idesc = GlobalImport $2 @@ at } @@ at], [] } + | inline_export global_fields /* Sugar */ + { fun c x at -> let globs, ims, exs = $2 c x at in + globs, ims, $1 (GlobalExport x) c :: exs } /* Imports & Exports */ @@ -524,50 +699,29 @@ global : import_desc : | LPAR FUNC bind_var_opt type_use RPAR { fun c -> ignore ($3 c anon_func bind_func); - FuncImport ($4 c type_) } - | LPAR FUNC bind_var_opt func_sig RPAR /* Sugar */ + fun () -> FuncImport ($4 c type_) } + | LPAR FUNC bind_var_opt func_type RPAR /* Sugar */ { let at4 = ati 4 in fun c -> ignore ($3 c anon_func bind_func); - FuncImport (inline_type c $4 at4) } - | LPAR TABLE bind_var_opt table_sig RPAR - { fun c -> ignore ($3 c anon_table bind_table); TableImport $4 } - | LPAR MEMORY bind_var_opt memory_sig RPAR - { fun c -> ignore ($3 c anon_memory bind_memory); MemoryImport $4 } + fun () -> FuncImport (inline_type c $4 at4) } + | LPAR TABLE bind_var_opt table_type RPAR + { fun c -> ignore ($3 c anon_table bind_table); + fun () -> TableImport $4 } + | LPAR MEMORY bind_var_opt memory_type RPAR + { fun c -> ignore ($3 c anon_memory bind_memory); + fun () -> MemoryImport $4 } | LPAR GLOBAL bind_var_opt global_type RPAR - { fun c -> ignore ($3 c anon_global bind_global); GlobalImport $4 } + { fun c -> ignore ($3 c anon_global bind_global); + fun () -> GlobalImport $4 } import : - | LPAR IMPORT TEXT TEXT import_desc RPAR - { let at = at () and at5 = ati 5 in - fun c -> {module_name = $3; item_name = $4; idesc = $5 c @@ at5} @@ at } - | LPAR FUNC bind_var_opt inline_import type_use RPAR /* Sugar */ - { let at = at () in - fun c -> ignore ($3 c anon_func bind_func); - { module_name = fst $4; item_name = snd $4; - idesc = FuncImport ($5 c type_) @@ at } @@ at } - | LPAR FUNC bind_var_opt inline_import func_sig RPAR /* Sugar */ + | LPAR IMPORT name name import_desc RPAR { let at = at () and at5 = ati 5 in - fun c -> ignore ($3 c anon_func bind_func); - { module_name = fst $4; item_name = snd $4; - idesc = FuncImport (inline_type c $5 at5) @@ at } @@ at } - | LPAR TABLE bind_var_opt inline_import table_sig RPAR /* Sugar */ - { let at = at () in - fun c -> ignore ($3 c anon_table bind_table); - { module_name = fst $4; item_name = snd $4; - idesc = TableImport $5 @@ at } @@ at } - | LPAR MEMORY bind_var_opt inline_import memory_sig RPAR /* Sugar */ - { let at = at () in - fun c -> ignore ($3 c anon_memory bind_memory); - { module_name = fst $4; item_name = snd $4; - idesc = MemoryImport $5 @@ at } @@ at } - | LPAR GLOBAL bind_var_opt inline_import global_type RPAR /* Sugar */ - { let at = at () in - fun c -> ignore ($3 c anon_global bind_global); - { module_name = fst $4; item_name = snd $4; - idesc = GlobalImport $5 @@ at } @@ at } + fun c -> let df = $5 c in + fun () -> {module_name = $3; item_name = $4; idesc = df () @@ at5} @@ at } inline_import : - | LPAR IMPORT TEXT TEXT RPAR { $3, $4 } + | LPAR IMPORT name name RPAR { $3, $4 } export_desc : | LPAR FUNC var RPAR { fun c -> FuncExport ($3 c func) } @@ -576,25 +730,24 @@ export_desc : | LPAR GLOBAL var RPAR { fun c -> GlobalExport ($3 c global) } export : - | LPAR EXPORT TEXT export_desc RPAR + | LPAR EXPORT name export_desc RPAR { let at = at () and at4 = ati 4 in fun c -> {name = $3; edesc = $4 c @@ at4} @@ at } -inline_export_opt : - | /* empty */ { fun d c -> [] } - | inline_export { $1 } - inline_export : - | LPAR EXPORT TEXT RPAR - { let at = at () in fun d c -> [{name = $3; edesc = d @@ at} @@ at] } + | LPAR EXPORT name RPAR + { let at = at () in fun d c -> {name = $3; edesc = d @@ at} @@ at } /* Modules */ +type_ : + | def_type { $1 @@ at () } + type_def : - | LPAR TYPE func_type RPAR + | LPAR TYPE type_ RPAR { fun c -> anon_type c $3 } - | LPAR TYPE bind_var func_type RPAR /* Sugar */ + | LPAR TYPE bind_var type_ RPAR /* Sugar */ { fun c -> bind_type c $3 $4 } start : @@ -603,52 +756,76 @@ start : module_fields : | /* empty */ - { fun (c : context) -> {empty_module with types = c.types.tlist} } + { fun (c : context) () -> {empty_module with types = c.types.list} } + | module_fields1 { $1 } + +module_fields1 : | type_def module_fields - { fun c -> $1 c; $2 c } + { fun c -> ignore ($1 c); $2 c } | global module_fields - { fun c -> let g, exs = $1 c in let m = $2 c in - if m.imports <> [] then + { fun c -> let gf = $1 c in let mf = $2 c in + fun () -> let globs, ims, exs = gf () in let m = mf () in + if globs <> [] && m.imports <> [] then error (List.hd m.imports).at "import after global definition"; - {m with globals = g () :: m.globals; exports = exs @ m.exports} } + { m with globals = globs @ m.globals; + imports = ims @ m.imports; exports = exs @ m.exports } } | table module_fields - { fun c -> let t = $1 c in let m = $2 c in let tab, elems, exs = t () in - if m.imports <> [] then + { fun c -> let tf = $1 c in let mf = $2 c in + fun () -> let tabs, elems, ims, exs = tf () in let m = mf () in + if tabs <> [] && m.imports <> [] then error (List.hd m.imports).at "import after table definition"; - {m with tables = tab :: m.tables; elems = elems @ m.elems; exports = exs @ m.exports} } + { m with tables = tabs @ m.tables; elems = elems @ m.elems; + imports = ims @ m.imports; exports = exs @ m.exports } } | memory module_fields - { fun c -> let mem, data, exs = $1 c in let m = $2 c in - if m.imports <> [] then + { fun c -> let mmf = $1 c in let mf = $2 c in + fun () -> let mems, data, ims, exs = mmf () in let m = mf () in + if mems <> [] && m.imports <> [] then error (List.hd m.imports).at "import after memory definition"; - {m with memories = mem :: m.memories; data = data @ m.data; exports = exs @ m.exports} } + { m with memories = mems @ m.memories; data = data @ m.data; + imports = ims @ m.imports; exports = exs @ m.exports } } | func module_fields - { fun c -> let f, exs = $1 c in let m = $2 c in let func = f () in - if m.imports <> [] then + { fun c -> let ff = $1 c in let mf = $2 c in + fun () -> let funcs, ims, exs = ff () in let m = mf () in + if funcs <> [] && m.imports <> [] then error (List.hd m.imports).at "import after function definition"; - {m with funcs = func :: m.funcs; exports = exs @ m.exports} } + { m with funcs = funcs @ m.funcs; + imports = ims @ m.imports; exports = exs @ m.exports } } | elem module_fields - { fun c -> let m = $2 c in + { fun c -> let mf = $2 c in + fun () -> let m = mf () in {m with elems = $1 c :: m.elems} } | data module_fields - { fun c -> let m = $2 c in + { fun c -> let mf = $2 c in + fun () -> let m = mf () in {m with data = $1 c :: m.data} } | start module_fields - { fun c -> let m = $2 c in let x = $1 c in + { fun c -> let mf = $2 c in + fun () -> let m = mf () in let x = $1 c in match m.start with | Some _ -> error x.at "multiple start sections" | None -> {m with start = Some x} } | import module_fields - { fun c -> let i = $1 c in let m = $2 c in - {m with imports = i :: m.imports} } + { fun c -> let imf = $1 c in let mf = $2 c in + fun () -> let im = imf () in let m = mf () in + {m with imports = im :: m.imports} } | export module_fields - { fun c -> let m = $2 c in + { fun c -> let mf = $2 c in + fun () -> let m = mf () in {m with exports = $1 c :: m.exports} } +module_var_opt : + | /* empty */ { None } + | VAR { Some ($1 @@ at ()) } /* Sugar */ + module_ : - | LPAR MODULE script_var_opt module_fields RPAR - { $3, Textual ($4 (empty_context ()) @@ at ()) @@ at () } - | LPAR MODULE script_var_opt TEXT text_list RPAR - { $3, Encoded ("binary", $4 ^ $5) @@ at() } + | LPAR MODULE module_var_opt module_fields RPAR + { $3, Textual ($4 (empty_context ()) () @@ at ()) @@ at () } + +inline_module : /* Sugar */ + | module_fields { Textual ($1 (empty_context ()) () @@ at ()) @@ at () } + +inline_module1 : /* Sugar */ + | module_fields1 { Textual ($1 (empty_context ()) () @@ at ()) @@ at () } /* Scripts */ @@ -657,32 +834,41 @@ script_var_opt : | /* empty */ { None } | VAR { Some ($1 @@ at ()) } /* Sugar */ +script_module : + | module_ { $1 } + | LPAR MODULE module_var_opt BIN string_list RPAR + { $3, Encoded (string_of_region (at()), $5) @@ at() } + | LPAR MODULE module_var_opt QUOTE string_list RPAR + { $3, Quoted (string_of_region (at()), $5) @@ at() } + action : - | LPAR INVOKE script_var_opt TEXT const_list RPAR + | LPAR INVOKE module_var_opt name const_list RPAR { Invoke ($3, $4, $5) @@ at () } - | LPAR GET script_var_opt TEXT RPAR + | LPAR GET module_var_opt name RPAR { Get ($3, $4) @@ at() } assertion : - | LPAR ASSERT_MALFORMED module_ TEXT RPAR + | LPAR ASSERT_MALFORMED script_module STRING RPAR { AssertMalformed (snd $3, $4) @@ at () } - | LPAR ASSERT_INVALID module_ TEXT RPAR + | LPAR ASSERT_INVALID script_module STRING RPAR { AssertInvalid (snd $3, $4) @@ at () } - | LPAR ASSERT_UNLINKABLE module_ TEXT RPAR + | LPAR ASSERT_UNLINKABLE script_module STRING RPAR { AssertUnlinkable (snd $3, $4) @@ at () } - | LPAR ASSERT_TRAP module_ TEXT RPAR + | LPAR ASSERT_TRAP script_module STRING RPAR { AssertUninstantiable (snd $3, $4) @@ at () } | LPAR ASSERT_RETURN action const_list RPAR { AssertReturn ($3, $4) @@ at () } | LPAR ASSERT_RETURN_CANONICAL_NAN action RPAR { AssertReturnCanonicalNaN $3 @@ at () } | LPAR ASSERT_RETURN_ARITHMETIC_NAN action RPAR { AssertReturnArithmeticNaN $3 @@ at () } - | LPAR ASSERT_TRAP action TEXT RPAR { AssertTrap ($3, $4) @@ at () } - | LPAR ASSERT_EXHAUSTION action TEXT RPAR { AssertExhaustion ($3, $4) @@ at () } + | LPAR ASSERT_RETURN_REF action RPAR { AssertReturnRef $3 @@ at () } + | LPAR ASSERT_RETURN_FUNC action RPAR { AssertReturnFunc $3 @@ at () } + | LPAR ASSERT_TRAP action STRING RPAR { AssertTrap ($3, $4) @@ at () } + | LPAR ASSERT_EXHAUSTION action STRING RPAR { AssertExhaustion ($3, $4) @@ at () } cmd : | action { Action $1 @@ at () } | assertion { Assertion $1 @@ at () } - | module_ { Module (fst $1, snd $1) @@ at () } - | LPAR REGISTER TEXT script_var_opt RPAR { Register ($3, $4) @@ at () } + | script_module { Module (fst $1, snd $1) @@ at () } + | LPAR REGISTER name module_var_opt RPAR { Register ($3, $4) @@ at () } | meta { Meta $1 @@ at () } cmd_list : @@ -691,12 +877,14 @@ cmd_list : meta : | LPAR SCRIPT script_var_opt cmd_list RPAR { Script ($3, $4) @@ at () } - | LPAR INPUT script_var_opt TEXT RPAR { Input ($3, $4) @@ at () } - | LPAR OUTPUT script_var_opt TEXT RPAR { Output ($3, Some $4) @@ at () } + | LPAR INPUT script_var_opt STRING RPAR { Input ($3, $4) @@ at () } + | LPAR OUTPUT script_var_opt STRING RPAR { Output ($3, Some $4) @@ at () } | LPAR OUTPUT script_var_opt RPAR { Output ($3, None) @@ at () } const : - | LPAR CONST literal RPAR { snd (literal $2 $3) @@ ati 3 } + | LPAR CONST literal RPAR { Values.Num (snd (literal $2 $3)) @@ at () } + | LPAR REF_NULL RPAR { Values.Ref Values.NullRef @@ at () } + | LPAR REF_HOST NAT RPAR { Values.Ref (HostRef (nat32 $3 (ati 3))) @@ at () } const_list : | /* empty */ { [] } @@ -704,10 +892,12 @@ const_list : script : | cmd_list EOF { $1 } + | inline_module1 EOF { [Module (None, $1) @@ at ()] } /* Sugar */ script1 : | cmd { [$1] } module1 : - | module_ EOF { snd $1 } + | module_ EOF { $1 } + | inline_module EOF { None, $1 } /* Sugar */ %% diff --git a/interpreter/travis/install-ocaml.sh b/interpreter/travis/install-ocaml.sh deleted file mode 100755 index 187a1604..00000000 --- a/interpreter/travis/install-ocaml.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash - -set -e - -# Move to a location relative to the script so it runs -# from anywhere. Go two levels down to get out of interpreter/ -# and into the top-level dir, since we'll run ocamlbuild -# inside of interpreter/ and it goes pear-shaped if it -# encounters ocaml's own build directory. -cd $(dirname ${BASH_SOURCE[0]})/../.. - -rm -rf ocaml -mkdir ocaml -cd ocaml -curl https://wasm.storage.googleapis.com/ocaml-4.02.2.tar.gz -O -CHECKSUM=$(shasum -a 256 ocaml-4.02.2.tar.gz | awk '{ print $1 }') -if [ ${CHECKSUM} != \ - 9d50c91ba2d2040281c6e47254c0c2b74d91315dd85cc59b84c5138c3a7ba78c ]; then - echo "Bad checksum ocaml download checksum!" - exit 1 -fi -tar xfz ocaml-4.02.2.tar.gz -cd ocaml-4.02.2 -./configure -prefix $PWD/../install -make world.opt -mkdir ../install -make install diff --git a/interpreter/util/lib.ml b/interpreter/util/lib.ml index 284329ec..2b196384 100644 --- a/interpreter/util/lib.ml +++ b/interpreter/util/lib.ml @@ -1,17 +1,68 @@ module Fun = struct + let curry f x y = f (x, y) + let uncurry f (x, y) = f x y + let rec repeat n f x = if n = 0 then () else (f x; repeat (n - 1) f x) end +module Int = +struct + let log2 n = + if n <= 0 then failwith "log2"; + let rec loop acc n = if n = 1 then acc else loop (acc + 1) (n lsr 1) in + loop 0 n + + let is_power_of_two n = + if n < 0 then failwith "is_power_of_two"; + n <> 0 && n land (n - 1) = 0 +end + +module String = +struct + let implode cs = + let buf = Buffer.create 80 in + List.iter (Buffer.add_char buf) cs; + Buffer.contents buf + + let explode s = + let cs = ref [] in + for i = String.length s - 1 downto 0 do cs := s.[i] :: !cs done; + !cs + + let split s c = + let len = String.length s in + let rec loop i = + if i > len then [] else + let j = try String.index_from s i c with Not_found -> len in + String.sub s i (j - i) :: loop (j + 1) + in loop 0 + + let breakup s n = + let rec loop i = + let len = min n (String.length s - i) in + if len = 0 then [] else String.sub s i len :: loop (i + len) + in loop 0 + + let rec find_from_opt f s i = + if i = String.length s then + None + else if f s.[i] then + Some i + else + find_from_opt f s (i + 1) +end + module List = struct - let rec make n x = - if n = 0 then [] else x :: make (n - 1) x + let rec make n x = make' n x [] + and make' n x xs = + if n = 0 then xs else make' (n - 1) x (x::xs) - let rec table n f = table' 0 n f - and table' i n f = - if i = n then [] else f i :: table' (i + 1) n f + let rec table n f = table' n f [] + and table' n f xs = + if n = 0 then xs else table' (n - 1) f (f (n - 1) :: xs) let rec take n xs = match n, xs with @@ -35,16 +86,29 @@ struct | x::xs -> let ys, y = split_last xs in x::ys, y | [] -> failwith "split_last" - let rec index_of x xs = index_of' x xs 0 - and index_of' x xs i = + let rec index_where p xs = index_where' p xs 0 + and index_where' p xs i = match xs with | [] -> None - | y::xs' when x = y -> Some i - | y::xs' -> index_of' x xs' (i+1) + | x::xs' when p x -> Some i + | x::xs' -> index_where' p xs' (i+1) + + let index_of x = index_where ((=) x) + + let rec map_filter f = function + | [] -> [] + | x::xs -> + match f x with + | None -> map_filter f xs + | Some y -> y :: map_filter f xs end module List32 = struct + let rec make n x = make' n x [] + and make' n x xs = + if n = 0l then xs else make' (Int32.sub n 1l) x (x::xs) + let rec length xs = length' xs 0l and length' xs n = match xs with @@ -120,6 +184,11 @@ struct | Some y -> y | None -> x + let force o = + match o with + | Some y -> y + | None -> raise (Invalid_argument "Option.force") + let map f = function | Some x -> Some (f x) | None -> None @@ -128,24 +197,3 @@ struct | Some x -> f x | None -> () end - -module Int = -struct - let log2 n = - if n <= 0 then failwith "log2"; - let rec loop acc n = if n = 1 then acc else loop (acc + 1) (n lsr 1) in - loop 0 n - - let is_power_of_two n = - if n < 0 then failwith "is_power_of_two"; - n <> 0 && n land (n - 1) = 0 -end - -module String = -struct - let breakup s n = - let rec loop i = - let len = min n (String.length s - i) in - if len = 0 then [] else String.sub s i len :: loop (i + len) - in loop 0 -end diff --git a/interpreter/util/lib.mli b/interpreter/util/lib.mli index 293070c0..cace75cd 100644 --- a/interpreter/util/lib.mli +++ b/interpreter/util/lib.mli @@ -2,6 +2,9 @@ module Fun : sig + val curry : ('a * 'b -> 'c) -> ('a -> 'b -> 'c) + val uncurry : ('a -> 'b -> 'c) -> ('a * 'b -> 'c) + val repeat : int -> ('a -> unit) -> 'a -> unit end @@ -9,21 +12,24 @@ module List : sig val make : int -> 'a -> 'a list val table : int -> (int -> 'a) -> 'a list - val take : int -> 'a list -> 'a list (* raise Failure *) - val drop : int -> 'a list -> 'a list (* raise Failure *) + val take : int -> 'a list -> 'a list (* raises Failure *) + val drop : int -> 'a list -> 'a list (* raises Failure *) - val last : 'a list -> 'a (* raise Failure *) - val split_last : 'a list -> 'a list * 'a (* raise Failure *) + val last : 'a list -> 'a (* raises Failure *) + val split_last : 'a list -> 'a list * 'a (* raises Failure *) val index_of : 'a -> 'a list -> int option + val index_where : ('a -> bool) -> 'a list -> int option + val map_filter : ('a -> 'b option) -> 'a list -> 'b list end module List32 : sig + val make : int32 -> 'a -> 'a list val length : 'a list -> int32 - val nth : 'a list -> int32 -> 'a (* raise Failure *) - val take : int32 -> 'a list -> 'a list (* raise Failure *) - val drop : int32 -> 'a list -> 'a list (* raise Failure *) + val nth : 'a list -> int32 -> 'a (* raises Failure *) + val take : int32 -> 'a list -> 'a list (* raises Failure *) + val drop : int32 -> 'a list -> 'a list (* raises Failure *) end module Array32 : @@ -52,6 +58,7 @@ end module Option : sig val get : 'a option -> 'a -> 'a + val force : 'a option -> 'a (* raises Invalid_argument *) val map : ('a -> 'b) -> 'a option -> 'b option val app : ('a -> unit) -> 'a option -> unit end @@ -64,5 +71,9 @@ end module String : sig + val implode : char list -> string + val explode : string -> char list + val split : string -> char -> string list val breakup : string -> int -> string list + val find_from_opt : (char -> bool) -> string -> int -> int option end diff --git a/interpreter/spec/valid.ml b/interpreter/valid/valid.ml similarity index 62% rename from interpreter/spec/valid.ml rename to interpreter/valid/valid.ml index 77ce2c01..bb8f7bea 100644 --- a/interpreter/spec/valid.ml +++ b/interpreter/valid/valid.ml @@ -16,7 +16,6 @@ let require b at s = if not b then error at s type context = { - module_ : module_; types : func_type list; funcs : func_type list; tables : table_type list; @@ -27,8 +26,8 @@ type context = labels : stack_type list; } -let context m = - { module_ = m; types = []; funcs = []; tables = []; memories = []; +let empty_context = + { types = []; funcs = []; tables = []; memories = []; globals = []; locals = []; results = []; labels = [] } let lookup category list x = @@ -37,11 +36,11 @@ let lookup category list x = let type_ (c : context) x = lookup "type" c.types x let func (c : context) x = lookup "function" c.funcs x -let local (c : context) x = lookup "local" c.locals x -let global (c : context) x = lookup "global" c.globals x -let label (c : context) x = lookup "label" c.labels x let table (c : context) x = lookup "table" c.tables x let memory (c : context) x = lookup "memory" c.memories x +let global (c : context) x = lookup "global" c.globals x +let local (c : context) x = lookup "local" c.locals x +let label (c : context) x = lookup "label" c.labels x (* Stack typing *) @@ -56,32 +55,25 @@ let memory (c : context) x = lookup "memory" c.memories x *) type ellipses = NoEllipses | Ellipses -type infer_stack_type = ellipses * value_type option list +type infer_stack_type = ellipses * value_type list type op_type = {ins : infer_stack_type; outs : infer_stack_type} -let known = List.map (fun t -> Some t) -let stack ts = (NoEllipses, known ts) -let (-~>) ts1 ts2 = {ins = NoEllipses, ts1; outs = NoEllipses, ts2} -let (-->) ts1 ts2 = {ins = NoEllipses, known ts1; outs = NoEllipses, known ts2} -let (-->...) ts1 ts2 = {ins = Ellipses, known ts1; outs = Ellipses, known ts2} - -let string_of_infer_type t = - Lib.Option.get (Lib.Option.map string_of_value_type t) "_" -let string_of_infer_types ts = - "[" ^ String.concat " " (List.map string_of_infer_type ts) ^ "]" +let stack ts = (NoEllipses, ts) +let (-->) ts1 ts2 = {ins = NoEllipses, ts1; outs = NoEllipses, ts2} +let (-->...) ts1 ts2 = {ins = Ellipses, ts1; outs = Ellipses, ts2} -let eq_ty t1 t2 = (t1 = t2 || t1 = None || t2 = None) let check_stack ts1 ts2 at = - require (List.length ts1 = List.length ts2 && List.for_all2 eq_ty ts1 ts2) at - ("type mismatch: operator requires " ^ string_of_infer_types ts1 ^ - " but stack has " ^ string_of_infer_types ts2) + require + (List.length ts1 = List.length ts2 && List.for_all2 match_value_type ts1 ts2) at + ("type mismatch: operator requires " ^ string_of_stack_type ts2 ^ + " but stack has " ^ string_of_stack_type ts1) let pop (ell1, ts1) (ell2, ts2) at = let n1 = List.length ts1 in let n2 = List.length ts2 in let n = min n1 n2 in let n3 = if ell2 = Ellipses then (n1 - n) else 0 in - check_stack ts1 (Lib.List.make n3 None @ Lib.List.drop (n2 - n) ts2) at; + check_stack (Lib.List.make n3 BotType @ Lib.List.drop (n2 - n) ts2) ts1 at; (ell2, if ell1 = Ellipses then [] else Lib.List.take (n2 - n) ts2) let push (ell1, ts1) (ell2, ts2) = @@ -90,16 +82,16 @@ let push (ell1, ts1) (ell2, ts2) = ts2 @ ts1 let peek i (ell, ts) = - try List.nth (List.rev ts) i with Failure _ -> None + try List.nth (List.rev ts) i with Failure _ -> BotType (* Type Synthesis *) -let type_value = Values.type_of -let type_unop = Values.type_of -let type_binop = Values.type_of -let type_testop = Values.type_of -let type_relop = Values.type_of +let type_num = Values.type_of_num +let type_unop = Values.type_of_num +let type_binop = Values.type_of_num +let type_testop = Values.type_of_num +let type_relop = Values.type_of_num let type_cvtop at = function | Values.I32 cvtop -> @@ -139,14 +131,14 @@ let type_cvtop at = function (* Expressions *) let check_memop (c : context) (memop : 'a memop) get_sz at = - ignore (memory c (0l @@ at)); + let _mt = memory c (0l @@ at) in let size = match get_sz memop.sz with | None -> size memop.ty | Some sz -> - require (memop.ty = I64Type || sz <> Memory.Mem32) at + require (memop.ty = I64Type || sz <> Memory.Pack32) at "memory size too big"; - Memory.mem_size sz + Memory.packed_size sz in require (1 lsl memop.align <= size) at "alignment must not be larger than natural" @@ -154,6 +146,7 @@ let check_memop (c : context) (memop : 'a memop) get_sz at = let check_arity n at = require (n <= 1) at "invalid result arity, larger than 1 is not (yet) allowed" + (* * Conventions: * c : context @@ -182,6 +175,21 @@ let rec check_instr (c : context) (e : instr) (s : infer_stack_type) : op_type = | Nop -> [] --> [] + | Drop -> + [peek 0 s] --> [] + + | Select None -> + let t = peek 1 s in + require (is_num_type t) e.at + ("type mismatch: instruction requires numeric type" ^ + " but stack has " ^ string_of_value_type t); + [t; t; NumType I32Type] --> [t] + + | Select (Some ts) -> + check_arity (List.length ts) e.at; + require (List.length ts <> 0) e.at "invalid result arity, 0 is not (yet) allowed"; + (ts @ ts @ [NumType I32Type]) --> ts + | Block (ts, es) -> check_arity (List.length ts) e.at; check_block {c with labels = ts :: c.labels} es ts e.at; @@ -196,18 +204,20 @@ let rec check_instr (c : context) (e : instr) (s : infer_stack_type) : op_type = check_arity (List.length ts) e.at; check_block {c with labels = ts :: c.labels} es1 ts e.at; check_block {c with labels = ts :: c.labels} es2 ts e.at; - [I32Type] --> ts + [NumType I32Type] --> ts | Br x -> label c x -->... [] | BrIf x -> - (label c x @ [I32Type]) --> label c x + (label c x @ [NumType I32Type]) --> label c x | BrTable (xs, x) -> - let ts = label c x in - List.iter (fun x' -> check_stack (known ts) (known (label c x')) x'.at) xs; - (label c x @ [I32Type]) -->... [] + let n = List.length (label c x) in + let ts = Lib.List.table n (fun i -> peek (i + 1) s) in + check_stack ts (label c x) x.at; + List.iter (fun x' -> check_stack ts (label c x') x'.at) xs; + (ts @ [NumType I32Type]) -->... [] | Return -> c.results -->... [] @@ -216,75 +226,101 @@ let rec check_instr (c : context) (e : instr) (s : infer_stack_type) : op_type = let FuncType (ins, out) = func c x in ins --> out - | CallIndirect x -> - ignore (table c (0l @@ e.at)); - let FuncType (ins, out) = type_ c x in - (ins @ [I32Type]) --> out + | CallIndirect (x, y) -> + let TableType (lim, t) = table c x in + let FuncType (ins, out) = type_ c y in + require (match_ref_type t FuncRefType) x.at + ("type mismatch: instruction requires table of functions" ^ + " but table has " ^ string_of_ref_type t); + (ins @ [NumType I32Type]) --> out - | Drop -> - [peek 0 s] -~> [] - - | Select -> - let t = peek 1 s in - [t; t; Some I32Type] -~> [t] - - | GetLocal x -> + | LocalGet x -> [] --> [local c x] - | SetLocal x -> + | LocalSet x -> [local c x] --> [] - | TeeLocal x -> + | LocalTee x -> [local c x] --> [local c x] - | GetGlobal x -> - let GlobalType (t, mut) = global c x in + | GlobalGet x -> + let GlobalType (t, _mut) = global c x in [] --> [t] - | SetGlobal x -> + | GlobalSet x -> let GlobalType (t, mut) = global c x in require (mut = Mutable) x.at "global is immutable"; [t] --> [] + | TableGet x -> + let TableType (_lim, t) = table c x in + [NumType I32Type] --> [RefType t] + + | TableSet x -> + let TableType (_lim, t) = table c x in + [NumType I32Type; RefType t] --> [] + + | TableSize x -> + let _tt = table c x in + [] --> [NumType I32Type] + + | TableGrow x -> + let TableType (_lim, t) = table c x in + [RefType t; NumType I32Type] --> [NumType I32Type] + + | TableFill x -> + let TableType (_lim, t) = table c x in + [NumType I32Type; RefType t; NumType I32Type] --> [] + | Load memop -> check_memop c memop (Lib.Option.map fst) e.at; - [I32Type] --> [memop.ty] + [NumType I32Type] --> [NumType memop.ty] | Store memop -> check_memop c memop (fun sz -> sz) e.at; - [I32Type; memop.ty] --> [] + [NumType I32Type; NumType memop.ty] --> [] + + | MemorySize -> + let _mt = memory c (0l @@ e.at) in + [] --> [NumType I32Type] + + | MemoryGrow -> + let _mt = memory c (0l @@ e.at) in + [NumType I32Type] --> [NumType I32Type] + + | RefNull -> + [] --> [RefType NullRefType] - | CurrentMemory -> - ignore (memory c (0l @@ e.at)); - [] --> [I32Type] + | RefIsNull -> + [RefType AnyRefType] --> [NumType I32Type] - | GrowMemory -> - ignore (memory c (0l @@ e.at)); - [I32Type] --> [I32Type] + | RefFunc x -> + let _ft = func c x in + [] --> [RefType FuncRefType] | Const v -> - let t = type_value v.it in + let t = NumType (type_num v.it) in [] --> [t] | Test testop -> - let t = type_testop testop in - [t] --> [I32Type] + let t = NumType (type_testop testop) in + [t] --> [NumType I32Type] | Compare relop -> - let t = type_relop relop in - [t; t] --> [I32Type] + let t = NumType (type_relop relop) in + [t; t] --> [NumType I32Type] | Unary unop -> - let t = type_unop unop in + let t = NumType (type_unop unop) in [t] --> [t] | Binary binop -> - let t = type_binop binop in + let t = NumType (type_binop binop) in [t; t] --> [t] | Convert cvtop -> let t1, t2 = type_cvtop e.at cvtop in - [t1] --> [t2] + [NumType t1] --> [NumType t2] and check_seq (c : context) (es : instr list) : infer_stack_type = match es with @@ -302,7 +338,51 @@ and check_block (c : context) (es : instr list) (ts : stack_type) at = let s' = pop (stack ts) s at in require (snd s' = []) at ("type mismatch: operator requires " ^ string_of_stack_type ts ^ - " but stack has " ^ string_of_infer_types (snd s')) + " but stack has " ^ string_of_stack_type (snd s)) + + +(* Types *) + +let check_limits {min; max} range at msg = + require (I64.le_u (Int64.of_int32 min) range) at msg; + match max with + | None -> () + | Some max -> + require (I64.le_u (Int64.of_int32 max) range) at msg; + require (I32.le_u min max) at + "size minimum must not be greater than maximum" + +let check_num_type (t : num_type) at = + () + +let check_ref_type (t : ref_type) at = + () + +let check_value_type (t : value_type) at = + match t with + | NumType t' -> check_num_type t' at + | RefType t' -> check_ref_type t' at + | BotType -> () + +let check_func_type (ft : func_type) at = + let FuncType (ins, out) = ft in + List.iter (fun t -> check_value_type t at) ins; + List.iter (fun t -> check_value_type t at) out; + check_arity (List.length out) at + +let check_table_type (tt : table_type) at = + let TableType (lim, t) = tt in + check_limits lim 0x1_0000_0000L at "table size must be at most 2^32"; + check_ref_type t at + +let check_memory_type (mt : memory_type) at = + let MemoryType lim = mt in + check_limits lim 0x1_0000L at + "memory size must be at most 65536 pages (4GiB)" + +let check_global_type (gt : global_type) at = + let GlobalType (t, mut) = gt in + check_value_type t at (* Functions & Constants *) @@ -319,18 +399,22 @@ and check_block (c : context) (es : instr list) (ts : stack_type) at = * x : variable *) +let check_type (t : type_) = + check_func_type t.it t.at + let check_func (c : context) (f : func) = let {ftype; locals; body} = f.it in let FuncType (ins, out) = type_ c ftype in - check_arity (List.length out) f.at; let c' = {c with locals = ins @ locals; results = out; labels = [out]} in check_block c' body out f.at let is_const (c : context) (e : instr) = match e.it with + | RefNull + | RefFunc _ | Const _ -> true - | GetGlobal x -> let GlobalType (_, mut) = global c x in mut = Immutable + | GlobalGet x -> let GlobalType (_, mut) = global c x in mut = Immutable | _ -> false let check_const (c : context) (const : const) (t : value_type) = @@ -341,44 +425,24 @@ let check_const (c : context) (const : const) (t : value_type) = (* Tables, Memories, & Globals *) -let check_table_type (t : table_type) at = - let TableType ({min; max}, _) = t in - match max with - | None -> () - | Some max -> - require (I32.le_u min max) at - "table size minimum must not be greater than maximum" - let check_table (c : context) (tab : table) = let {ttype} = tab.it in check_table_type ttype tab.at -let check_memory_type (t : memory_type) at = - let MemoryType {min; max} = t in - require (I32.le_u min 65536l) at - "memory size must be at most 65536 pages (4GiB)"; - match max with - | None -> () - | Some max -> - require (I32.le_u max 65536l) at - "memory size must be at most 65536 pages (4GiB)"; - require (I32.le_u min max) at - "memory size minimum must not be greater than maximum" - let check_memory (c : context) (mem : memory) = let {mtype} = mem.it in check_memory_type mtype mem.at let check_elem (c : context) (seg : table_segment) = let {index; offset; init} = seg.it in - check_const c offset I32Type; - ignore (table c index); - ignore (List.map (func c) init) + let _tt = table c index in + let _xs = List.map (func c) init in + check_const c offset (NumType I32Type) let check_data (c : context) (seg : memory_segment) = let {index; offset; init} = seg.it in - check_const c offset I32Type; - ignore (memory c index) + let _mt = memory c index in + check_const c offset (NumType I32Type) let check_global (c : context) (glob : global) = let {gtype; value} = glob.it in @@ -399,17 +463,17 @@ let check_import (im : import) (c : context) : context = match idesc.it with | FuncImport x -> {c with funcs = type_ c x :: c.funcs} - | TableImport t -> - check_table_type t idesc.at; {c with tables = t :: c.tables} - | MemoryImport t -> - check_memory_type t idesc.at; {c with memories = t :: c.memories} - | GlobalImport t -> - let GlobalType (_, mut) = t in - require (mut = Immutable) idesc.at - "mutable globals cannot be imported (yet)"; - {c with globals = t :: c.globals} - -module NameSet = Set.Make(String) + | TableImport tt -> + check_table_type tt idesc.at; + {c with tables = tt :: c.tables} + | MemoryImport mt -> + check_memory_type mt idesc.at; + {c with memories = mt :: c.memories} + | GlobalImport gt -> + check_global_type gt idesc.at; + {c with globals = gt :: c.globals} + +module NameSet = Set.Make(struct type t = Ast.name let compare = compare end) let check_export (c : context) (set : NameSet.t) (ex : export) : NameSet.t = let {name; edesc} = ex.it in @@ -417,10 +481,7 @@ let check_export (c : context) (set : NameSet.t) (ex : export) : NameSet.t = | FuncExport x -> ignore (func c x) | TableExport x -> ignore (table c x) | MemoryExport x -> ignore (memory c x) - | GlobalExport x -> - let GlobalType (_, mut) = global c x in - require (mut = Immutable) edesc.at - "mutable globals cannot be exported (yet)" + | GlobalExport x -> ignore (global c x) ); require (not (NameSet.mem name set)) ex.at "duplicate export name"; NameSet.add name set @@ -430,7 +491,10 @@ let check_module (m : module_) = { types; imports; tables; memories; globals; funcs; start; elems; data; exports } = m.it in - let c0 = List.fold_right check_import imports {(context m) with types} in + let c0 = + List.fold_right check_import imports + {empty_context with types = List.map (fun ty -> ty.it) types} + in let c1 = { c0 with funcs = c0.funcs @ List.map (fun f -> type_ c0 f.it.ftype) funcs; @@ -441,6 +505,7 @@ let check_module (m : module_) = let c = { c1 with globals = c1.globals @ List.map (fun g -> g.it.gtype) globals } in + List.iter check_type types; List.iter (check_global c1) globals; List.iter (check_table c1) tables; List.iter (check_memory c1) memories; @@ -449,7 +514,5 @@ let check_module (m : module_) = List.iter (check_func c) funcs; check_start c start; ignore (List.fold_left (check_export c) NameSet.empty exports); - require (List.length c.tables <= 1) m.at - "multiple tables are not allowed (yet)"; require (List.length c.memories <= 1) m.at "multiple memories are not allowed (yet)" diff --git a/interpreter/valid/valid.mli b/interpreter/valid/valid.mli new file mode 100644 index 00000000..5827ae56 --- /dev/null +++ b/interpreter/valid/valid.mli @@ -0,0 +1,3 @@ +exception Invalid of Source.region * string + +val check_module : Ast.module_ -> unit (* raises Invalid *) diff --git a/interpreter/winmake.bat b/interpreter/winmake.bat index e86d1198..6ff7e8ca 100644 --- a/interpreter/winmake.bat +++ b/interpreter/winmake.bat @@ -1,86 +1,75 @@ rem Auto-generated from Makefile! set NAME=wasm if '%1' neq '' set NAME=%1 -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -bin-annot -I spec -I util -I host -I text -I host/import -o spec/numeric_error.cmo spec/numeric_error.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -bin-annot -I spec -I util -I host -I text -I host/import -o spec/int.cmo spec/int.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -bin-annot -I spec -I util -I host -I text -I host/import -o spec/i32.cmo spec/i32.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -bin-annot -I spec -I util -I host -I text -I host/import -o spec/float.cmo spec/float.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -bin-annot -I spec -I util -I host -I text -I host/import -o spec/types.cmo spec/types.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -bin-annot -I spec -I util -I host -I text -I host/import -o spec/f32.cmo spec/f32.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -bin-annot -I spec -I util -I host -I text -I host/import -o spec/f64.cmo spec/f64.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -bin-annot -I spec -I util -I host -I text -I host/import -o spec/i64.cmo spec/i64.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -bin-annot -I spec -I util -I host -I text -I host/import -o spec/values.cmo spec/values.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -bin-annot -I util -I spec -I host -I text -I host/import -o util/lib.cmi util/lib.mli -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -bin-annot -I spec -I util -I host -I text -I host/import -o spec/memory.cmi spec/memory.mli -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -bin-annot -I util -I spec -I host -I text -I host/import -o util/source.cmi util/source.mli -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -bin-annot -I spec -I util -I host -I text -I host/import -o spec/ast.cmo spec/ast.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -bin-annot -I spec -I util -I host -I text -I host/import -o spec/table.cmi spec/table.mli -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -bin-annot -I spec -I util -I host -I text -I host/import -o spec/instance.cmo spec/instance.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -bin-annot -I spec -I util -I host -I text -I host/import -o spec/eval.cmi spec/eval.mli -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -bin-annot -I spec -I util -I host -I text -I host/import -o spec/encode.cmi spec/encode.mli -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -bin-annot -I host/import -I util -I spec -I host -I text -o host/import/env.cmo host/import/env.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -bin-annot -I host -I util -I spec -I text -I host/import -o host/flags.cmo host/flags.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -bin-annot -I host -I util -I spec -I text -I host/import -o host/import.cmi host/import.mli -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -bin-annot -I host -I util -I spec -I text -I host/import -o host/run.cmi host/run.mli -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -bin-annot -I host/import -I util -I spec -I host -I text -o host/import/spectest.cmo host/import/spectest.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -bin-annot -I host -I util -I spec -I text -I host/import -o host/main.cmo host/main.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -bin-annot -I host -I util -I spec -I text -I host/import -o host/main.d.cmo host/main.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -bin-annot -I util -I spec -I host -I text -I host/import -o util/error.cmi util/error.mli -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -bin-annot -I text -I util -I spec -I host -I host/import -o text/script.cmo text/script.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -bin-annot -I spec -I util -I host -I text -I host/import -o spec/decode.cmi spec/decode.mli -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -bin-annot -I host -I util -I spec -I text -I host/import -o host/js.cmi host/js.mli -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -bin-annot -I text -I util -I spec -I host -I host/import -o text/parse.cmi text/parse.mli -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -bin-annot -I text -I util -I spec -I host -I host/import -o text/print.cmi text/print.mli -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -bin-annot -I spec -I util -I host -I text -I host/import -o spec/valid.cmi spec/valid.mli -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -bin-annot -I spec -I util -I host -I text -I host/import -o spec/encode.d.cmo spec/encode.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -bin-annot -I host/import -I util -I spec -I host -I text -o host/import/env.d.cmo host/import/env.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -bin-annot -I host -I util -I spec -I text -I host/import -o host/flags.d.cmo host/flags.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -bin-annot -I host -I util -I spec -I text -I host/import -o host/import.d.cmo host/import.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -bin-annot -I host -I util -I spec -I text -I host/import -o host/run.d.cmo host/run.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -bin-annot -I host/import -I util -I spec -I host -I text -o host/import/spectest.d.cmo host/import/spectest.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -bin-annot -I spec -I util -I host -I text -I host/import -o spec/ast.d.cmo spec/ast.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -bin-annot -I util -I spec -I host -I text -I host/import -o util/error.d.cmo util/error.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -bin-annot -I spec -I util -I host -I text -I host/import -o spec/f32.d.cmo spec/f32.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -bin-annot -I spec -I util -I host -I text -I host/import -o spec/f64.d.cmo spec/f64.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -bin-annot -I spec -I util -I host -I text -I host/import -o spec/i32.d.cmo spec/i32.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -bin-annot -I util -I spec -I host -I text -I host/import -o util/lib.d.cmo util/lib.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -bin-annot -I spec -I util -I host -I text -I host/import -o spec/memory.d.cmo spec/memory.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -bin-annot -I util -I spec -I host -I text -I host/import -o util/source.d.cmo util/source.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -bin-annot -I spec -I util -I host -I text -I host/import -o spec/types.d.cmo spec/types.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -bin-annot -I spec -I util -I host -I text -I host/import -o spec/values.d.cmo spec/values.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -bin-annot -I spec -I util -I host -I text -I host/import -o spec/i64.d.cmo spec/i64.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -bin-annot -I spec -I util -I host -I text -I host/import -o spec/float.d.cmo spec/float.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -bin-annot -I spec -I util -I host -I text -I host/import -o spec/int.d.cmo spec/int.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -bin-annot -I spec -I util -I host -I text -I host/import -o spec/numeric_error.d.cmo spec/numeric_error.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -bin-annot -I spec -I util -I host -I text -I host/import -o spec/eval_numeric.cmi spec/eval_numeric.mli -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -bin-annot -I spec -I util -I host -I text -I host/import -o spec/i64_convert.cmi spec/i64_convert.mli -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -bin-annot -I spec -I util -I host -I text -I host/import -o spec/eval.d.cmo spec/eval.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -bin-annot -I spec -I util -I host -I text -I host/import -o spec/instance.d.cmo spec/instance.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -bin-annot -I spec -I util -I host -I text -I host/import -o spec/f32_convert.cmi spec/f32_convert.mli -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -bin-annot -I spec -I util -I host -I text -I host/import -o spec/f64_convert.cmi spec/f64_convert.mli -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -bin-annot -I spec -I util -I host -I text -I host/import -o spec/i32_convert.cmi spec/i32_convert.mli -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -bin-annot -I spec -I util -I host -I text -I host/import -o spec/eval_numeric.d.cmo spec/eval_numeric.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -bin-annot -I spec -I util -I host -I text -I host/import -o spec/i64_convert.d.cmo spec/i64_convert.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -bin-annot -I spec -I util -I host -I text -I host/import -o spec/table.d.cmo spec/table.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -bin-annot -I spec -I util -I host -I text -I host/import -o spec/f32_convert.d.cmo spec/f32_convert.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -bin-annot -I spec -I util -I host -I text -I host/import -o spec/f64_convert.d.cmo spec/f64_convert.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -bin-annot -I spec -I util -I host -I text -I host/import -o spec/i32_convert.d.cmo spec/i32_convert.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -bin-annot -I spec -I util -I host -I text -I host/import -o spec/operators.cmo spec/operators.ml +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I exec -I main -I syntax -I text -I binary -I script -I runtime -I util -I host -I valid -o exec/numeric_error.cmo exec/numeric_error.ml +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I exec -I main -I syntax -I text -I binary -I script -I runtime -I util -I host -I valid -o exec/int.cmo exec/int.ml +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I util -I main -I syntax -I text -I binary -I exec -I script -I runtime -I host -I valid -o util/lib.cmi util/lib.mli +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I exec -I main -I syntax -I text -I binary -I script -I runtime -I util -I host -I valid -o exec/i32.cmo exec/i32.ml +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I exec -I main -I syntax -I text -I binary -I script -I runtime -I util -I host -I valid -o exec/float.cmo exec/float.ml +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I syntax -I main -I text -I binary -I exec -I script -I runtime -I util -I host -I valid -o syntax/types.cmo syntax/types.ml +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I exec -I main -I syntax -I text -I binary -I script -I runtime -I util -I host -I valid -o exec/f32.cmo exec/f32.ml +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I exec -I main -I syntax -I text -I binary -I script -I runtime -I util -I host -I valid -o exec/f64.cmo exec/f64.ml +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I exec -I main -I syntax -I text -I binary -I script -I runtime -I util -I host -I valid -o exec/i64.cmo exec/i64.ml +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I syntax -I main -I text -I binary -I exec -I script -I runtime -I util -I host -I valid -o syntax/values.cmo syntax/values.ml +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I runtime -I main -I syntax -I text -I binary -I exec -I script -I util -I host -I valid -o runtime/memory.cmi runtime/memory.mli +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I util -I main -I syntax -I text -I binary -I exec -I script -I runtime -I host -I valid -o util/source.cmi util/source.mli +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I syntax -I main -I text -I binary -I exec -I script -I runtime -I util -I host -I valid -o syntax/ast.cmo syntax/ast.ml +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I runtime -I main -I syntax -I text -I binary -I exec -I script -I util -I host -I valid -o runtime/func.cmi runtime/func.mli +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I runtime -I main -I syntax -I text -I binary -I exec -I script -I util -I host -I valid -o runtime/global.cmi runtime/global.mli +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I runtime -I main -I syntax -I text -I binary -I exec -I script -I util -I host -I valid -o runtime/table.cmi runtime/table.mli +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I runtime -I main -I syntax -I text -I binary -I exec -I script -I util -I host -I valid -o runtime/instance.cmo runtime/instance.ml +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I exec -I main -I syntax -I text -I binary -I script -I runtime -I util -I host -I valid -o exec/eval.cmi exec/eval.mli +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I binary -I main -I syntax -I text -I exec -I script -I runtime -I util -I host -I valid -o binary/utf8.cmi binary/utf8.mli +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I host -I main -I syntax -I text -I binary -I exec -I script -I runtime -I util -I valid -o host/env.cmo host/env.ml +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I main -I syntax -I text -I binary -I exec -I script -I runtime -I util -I host -I valid -o main/flags.cmo main/flags.ml +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I script -I main -I syntax -I text -I binary -I exec -I runtime -I util -I host -I valid -o script/import.cmi script/import.mli +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I script -I main -I syntax -I text -I binary -I exec -I runtime -I util -I host -I valid -o script/run.cmi script/run.mli +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I host -I main -I syntax -I text -I binary -I exec -I script -I runtime -I util -I valid -o host/spectest.cmo host/spectest.ml +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I main -I syntax -I text -I binary -I exec -I script -I runtime -I util -I host -I valid -o main/main.cmo main/main.ml +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I util -I main -I syntax -I text -I binary -I exec -I script -I runtime -I host -I valid -o util/error.cmi util/error.mli +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I script -I main -I syntax -I text -I binary -I exec -I runtime -I util -I host -I valid -o script/script.cmo script/script.ml +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I binary -I main -I syntax -I text -I exec -I script -I runtime -I util -I host -I valid -o binary/decode.cmi binary/decode.mli +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I binary -I main -I syntax -I text -I exec -I script -I runtime -I util -I host -I valid -o binary/encode.cmi binary/encode.mli +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I script -I main -I syntax -I text -I binary -I exec -I runtime -I util -I host -I valid -o script/js.cmi script/js.mli +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I text -I main -I syntax -I binary -I exec -I script -I runtime -I util -I host -I valid -o text/parse.cmi text/parse.mli +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I text -I main -I syntax -I binary -I exec -I script -I runtime -I util -I host -I valid -o text/print.cmi text/print.mli +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I valid -I main -I syntax -I text -I binary -I exec -I script -I runtime -I util -I host -o valid/valid.cmi valid/valid.mli +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I script -I main -I syntax -I text -I binary -I exec -I runtime -I util -I host -I valid -o script/import.cmo script/import.ml +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I script -I main -I syntax -I text -I binary -I exec -I runtime -I util -I host -I valid -o script/run.cmo script/run.ml +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I binary -I main -I syntax -I text -I exec -I script -I runtime -I util -I host -I valid -o binary/utf8.cmo binary/utf8.ml +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I exec -I main -I syntax -I text -I binary -I script -I runtime -I util -I host -I valid -o exec/eval_numeric.cmi exec/eval_numeric.mli +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I exec -I main -I syntax -I text -I binary -I script -I runtime -I util -I host -I valid -o exec/i64_convert.cmi exec/i64_convert.mli +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I exec -I main -I syntax -I text -I binary -I script -I runtime -I util -I host -I valid -o exec/eval.cmo exec/eval.ml +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I runtime -I main -I syntax -I text -I binary -I exec -I script -I util -I host -I valid -o runtime/func.cmo runtime/func.ml +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I util -I main -I syntax -I text -I binary -I exec -I script -I runtime -I host -I valid -o util/source.cmo util/source.ml +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I exec -I main -I syntax -I text -I binary -I script -I runtime -I util -I host -I valid -o exec/f32_convert.cmi exec/f32_convert.mli +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I exec -I main -I syntax -I text -I binary -I script -I runtime -I util -I host -I valid -o exec/f64_convert.cmi exec/f64_convert.mli +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I exec -I main -I syntax -I text -I binary -I script -I runtime -I util -I host -I valid -o exec/i32_convert.cmi exec/i32_convert.mli +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I util -I main -I syntax -I text -I binary -I exec -I script -I runtime -I host -I valid -o util/error.cmo util/error.ml +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I exec -I main -I syntax -I text -I binary -I script -I runtime -I util -I host -I valid -o exec/eval_numeric.cmo exec/eval_numeric.ml +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I runtime -I main -I syntax -I text -I binary -I exec -I script -I util -I host -I valid -o runtime/global.cmo runtime/global.ml +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I exec -I main -I syntax -I text -I binary -I script -I runtime -I util -I host -I valid -o exec/i64_convert.cmo exec/i64_convert.ml +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I util -I main -I syntax -I text -I binary -I exec -I script -I runtime -I host -I valid -o util/lib.cmo util/lib.ml +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I runtime -I main -I syntax -I text -I binary -I exec -I script -I util -I host -I valid -o runtime/memory.cmo runtime/memory.ml +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I runtime -I main -I syntax -I text -I binary -I exec -I script -I util -I host -I valid -o runtime/table.cmo runtime/table.ml +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I exec -I main -I syntax -I text -I binary -I script -I runtime -I util -I host -I valid -o exec/f32_convert.cmo exec/f32_convert.ml +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I exec -I main -I syntax -I text -I binary -I script -I runtime -I util -I host -I valid -o exec/f64_convert.cmo exec/f64_convert.ml +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I exec -I main -I syntax -I text -I binary -I script -I runtime -I util -I host -I valid -o exec/i32_convert.cmo exec/i32_convert.ml +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I syntax -I main -I text -I binary -I exec -I script -I runtime -I util -I host -I valid -o syntax/operators.cmo syntax/operators.ml ocamlyacc text/parser.mly -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -bin-annot -I text -I util -I spec -I host -I host/import -o text/parser.cmi text/parser.mli -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -bin-annot -I text -I util -I spec -I host -I host/import -o text/lexer.cmi text/lexer.mli -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -bin-annot -I util -I spec -I host -I text -I host/import -o util/sexpr.cmi util/sexpr.mli -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -bin-annot -I text -I util -I spec -I host -I host/import -o text/arrange.cmi text/arrange.mli -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -bin-annot -I spec -I util -I host -I text -I host/import -o spec/decode.d.cmo spec/decode.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -bin-annot -I host -I util -I spec -I text -I host/import -o host/js.d.cmo host/js.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -bin-annot -I text -I util -I spec -I host -I host/import -o text/parse.d.cmo text/parse.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -bin-annot -I text -I util -I spec -I host -I host/import -o text/print.d.cmo text/print.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -bin-annot -I text -I util -I spec -I host -I host/import -o text/script.d.cmo text/script.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -bin-annot -I spec -I util -I host -I text -I host/import -o spec/valid.d.cmo spec/valid.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -bin-annot -I spec -I util -I host -I text -I host/import -o spec/operators.d.cmo spec/operators.ml +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I text -I main -I syntax -I binary -I exec -I script -I runtime -I util -I host -I valid -o text/parser.cmi text/parser.mli +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I text -I main -I syntax -I binary -I exec -I script -I runtime -I util -I host -I valid -o text/lexer.cmi text/lexer.mli +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I util -I main -I syntax -I text -I binary -I exec -I script -I runtime -I host -I valid -o util/sexpr.cmi util/sexpr.mli +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I text -I main -I syntax -I binary -I exec -I script -I runtime -I util -I host -I valid -o text/arrange.cmi text/arrange.mli +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I binary -I main -I syntax -I text -I exec -I script -I runtime -I util -I host -I valid -o binary/decode.cmo binary/decode.ml +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I binary -I main -I syntax -I text -I exec -I script -I runtime -I util -I host -I valid -o binary/encode.cmo binary/encode.ml +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I script -I main -I syntax -I text -I binary -I exec -I runtime -I util -I host -I valid -o script/js.cmo script/js.ml +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I text -I main -I syntax -I binary -I exec -I script -I runtime -I util -I host -I valid -o text/parse.cmo text/parse.ml +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I text -I main -I syntax -I binary -I exec -I script -I runtime -I util -I host -I valid -o text/print.cmo text/print.ml +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I valid -I main -I syntax -I text -I binary -I exec -I script -I runtime -I util -I host -o valid/valid.cmo valid/valid.ml ocamllex.opt -q text/lexer.mll -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -bin-annot -I text -I util -I spec -I host -I host/import -o text/lexer.d.cmo text/lexer.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -bin-annot -I text -I util -I spec -I host -I host/import -o text/parser.d.cmo text/parser.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -bin-annot -I text -I util -I spec -I host -I host/import -o text/arrange.d.cmo text/arrange.ml -ocamlc.opt -c -w +a-4-27-42-44-45 -warn-error +a -g -bin-annot -I util -I spec -I host -I text -I host/import -o util/sexpr.d.cmo util/sexpr.ml -ocamlc.opt str.cma bigarray.cma -g host/flags.d.cmo spec/float.d.cmo spec/f32.d.cmo spec/f64.d.cmo spec/numeric_error.d.cmo spec/int.d.cmo spec/i32.d.cmo spec/i64.d.cmo spec/types.d.cmo spec/values.d.cmo util/lib.d.cmo spec/memory.d.cmo util/source.d.cmo spec/ast.d.cmo spec/table.d.cmo spec/instance.d.cmo util/error.d.cmo host/import.d.cmo spec/i32_convert.d.cmo spec/f32_convert.d.cmo spec/i64_convert.d.cmo spec/f64_convert.d.cmo spec/eval_numeric.d.cmo spec/eval.d.cmo host/import/env.d.cmo host/import/spectest.d.cmo spec/encode.d.cmo spec/operators.d.cmo spec/decode.d.cmo text/script.d.cmo host/js.d.cmo spec/valid.d.cmo text/parser.d.cmo text/lexer.d.cmo text/parse.d.cmo util/sexpr.d.cmo text/arrange.d.cmo text/print.d.cmo host/run.d.cmo host/main.d.cmo -o %NAME%.exe +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I text -I main -I syntax -I binary -I exec -I script -I runtime -I util -I host -I valid -o text/lexer.cmo text/lexer.ml +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I text -I main -I syntax -I binary -I exec -I script -I runtime -I util -I host -I valid -o text/parser.cmo text/parser.ml +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I text -I main -I syntax -I binary -I exec -I script -I runtime -I util -I host -I valid -o text/arrange.cmo text/arrange.ml +ocamlc.opt -c -w +a-3-4-27-42-44-45 -warn-error +a -I util -I main -I syntax -I text -I binary -I exec -I script -I runtime -I host -I valid -o util/sexpr.cmo util/sexpr.ml +ocamlc.opt bigarray.cma -I util -I binary -I exec -I syntax -I runtime -I host -I main -I script -I text -I valid util/lib.cmo binary/utf8.cmo exec/float.cmo exec/f32.cmo exec/f64.cmo exec/numeric_error.cmo exec/int.cmo exec/i32.cmo exec/i64.cmo exec/i32_convert.cmo exec/f32_convert.cmo exec/i64_convert.cmo exec/f64_convert.cmo syntax/types.cmo syntax/values.cmo runtime/memory.cmo util/source.cmo syntax/ast.cmo exec/eval_numeric.cmo runtime/func.cmo runtime/global.cmo runtime/table.cmo runtime/instance.cmo util/error.cmo exec/eval.cmo host/env.cmo host/spectest.cmo main/flags.cmo script/import.cmo binary/encode.cmo syntax/operators.cmo binary/decode.cmo script/script.cmo text/parser.cmo text/lexer.cmo text/parse.cmo script/js.cmo util/sexpr.cmo text/arrange.cmo text/print.cmo valid/valid.cmo script/run.cmo main/main.cmo -o main/main.byte diff --git a/papers/LICENSE b/papers/LICENSE new file mode 100644 index 00000000..4aee8d7c --- /dev/null +++ b/papers/LICENSE @@ -0,0 +1 @@ +This work is licensed under the Creative Commons Attribution 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/ or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA. diff --git a/papers/README.md b/papers/README.md new file mode 100644 index 00000000..ecccea67 --- /dev/null +++ b/papers/README.md @@ -0,0 +1,15 @@ +* [Bringing the Web up to Speed with WebAssembly](pldi2017.pdf) + + Andreas Haas, Andreas Rossberg, Derek Schuff, Ben Titzer, Dan Gohman, Luke Wagner, Alon Zakai, JF Bastien, Michael Holman + + ACM-SIGPLAN Conference on Programming Language Design and Implementation (PLDI 2017) + + *Describes the WebAssembly design, its formalisation, and initial implementations.* + +* [Weakening WebAssembly](oopsla2019.pdf) + + Conrad Watt, Andreas Rossberg, Jean Pichon-Pharabod + + ACM-SIGPLAN Conference on Object-Oriented Programming, Systems, Language and Architectures (OOSPLA 2019) + + *Describes and formalises the extension of WebAssembly with threads and a suitable memory model.* diff --git a/papers/oopsla2019.pdf b/papers/oopsla2019.pdf new file mode 100644 index 00000000..2dafc72d Binary files /dev/null and b/papers/oopsla2019.pdf differ diff --git a/test/LICENSE b/test/LICENSE new file mode 100644 index 00000000..8f71f43f --- /dev/null +++ b/test/LICENSE @@ -0,0 +1,202 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "{}" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright {yyyy} {name of copyright owner} + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + diff --git a/test/README.md b/test/README.md index 82f499e4..9749eb54 100644 --- a/test/README.md +++ b/test/README.md @@ -1,13 +1,10 @@ -This directory contains the WebAssembly test suite. It is split into two +This directory contains the WebAssembly test suite. It is split into three directories: * [`core/`](core/), tests for the core semantics * [`js-api/`](js-api/), tests for the JavaScript API. * [`html/`](html/), tests for the JavaScript API in a DOM environment. -A [landing page](out/index.html) contains a condensed version made of all -these tests, converted to HTML. - A list of to-do's can be found [here](Todo.md). ## Multi-stage testing @@ -20,7 +17,7 @@ runnning all of them in HTML. The HTML tests are just [Web Platform Tests](http://testthewebforward.org) using the -[testharness.js](http://testthewebforward.org/docs/testharness-library.html) +[testharness.js](https://web-platform-tests.org/writing-tests/testharness-api.html) library. Each wast test gets its equivalent JS test, and each JS test (including wast diff --git a/test/Todo.md b/test/Todo.md index b98f989e..99e24643 100644 --- a/test/Todo.md +++ b/test/Todo.md @@ -4,14 +4,7 @@ have a link to an open issue/PR, or be obvious. Comments/corrections/additions welcome. Linear memory semantics: - - test that newly allocated memory (program start and `grow_memory`) is zeroed - - test that `grow_memory` does a full 32-bit unsigned check for page-size divisibility - - test that load/store addreses are full int32 (or int64), and not OCaml int - - test that when allocating 4GiB, accessing index -1 fails - - test that too-big `grow_memory` fails appropriately - - test that too-big linear memory initial allocation fails - test that one can clobber the entire contents of the linear memory without corrupting: call stack, local variables, program execution. - - test that an i64 store with 4-byte alignment that's 4 bytes out of bounds traps without storing anything. Misc optimizer bait: - test that the scheduler doesn't move a trapping div past a call which may not return diff --git a/test/build.py b/test/build.py index e2b81c16..243b8bd0 100755 --- a/test/build.py +++ b/test/build.py @@ -9,11 +9,10 @@ import multiprocessing as mp SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__)) -WASM_EXEC = os.path.join(SCRIPT_DIR, '..', 'interpreter', 'wasm') +INTERPRETER_DIR = os.path.join(SCRIPT_DIR, '..', 'interpreter') +WASM_EXEC = os.path.join(INTERPRETER_DIR, 'wasm') WAST_TESTS_DIR = os.path.join(SCRIPT_DIR, 'core') -JS_TESTS_DIR = os.path.join(SCRIPT_DIR, 'js-api') -HTML_TESTS_DIR = os.path.join(SCRIPT_DIR, 'html') HARNESS_DIR = os.path.join(SCRIPT_DIR, 'harness') HARNESS_FILES = ['testharness.js', 'testharnessreport.js', 'testharness.css'] @@ -22,9 +21,15 @@ # Helpers. def run(*cmd): return subprocess.run(cmd, + text=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True) +def call(*cmd): + return subprocess.call(cmd, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + universal_newlines=True) # Preconditions. def ensure_remove_dir(path): @@ -35,16 +40,23 @@ def ensure_empty_dir(path): ensure_remove_dir(path) os.mkdir(path) +def compile_wasm_interpreter(): + print("Recompiling the wasm interpreter...") + result = call('make', '-C', INTERPRETER_DIR, 'clean', 'default') + if result != 0: + print("Couldn't recompile wasm spec interpreter") + sys.exit(1) + print("Done!") + def ensure_wasm_executable(path_to_wasm): """ Ensure we have built the wasm spec interpreter. """ - result = run(path_to_wasm, '-v', '-e', '') - if result.returncode != 0: + result = call(path_to_wasm, '-v', '-e', '') + if result != 0: print('Unable to run the wasm executable') sys.exit(1) - # JS harness. def convert_one_wast_file(inputs): wast_file, js_file = inputs @@ -68,16 +80,15 @@ def convert_wast_to_js(out_js_dir): pool = mp.Pool(processes=8) for result in pool.imap_unordered(convert_one_wast_file, inputs): if result.returncode != 0: - print('Error when compiling {} to JS: {}', wast_file, result.stdout) - -def build_js(out_js_dir, include_harness=False): - print('Building JS...') - convert_wast_to_js(out_js_dir) - - print('Copying JS tests to the JS out dir...') - for js_file in glob.glob(os.path.join(JS_TESTS_DIR, '*.js')): - shutil.copy(js_file, out_js_dir) - + print('Error when compiling to JS:') + print(result.args) + if result.stdout: + # stderr is piped to stdout via `run`, so we only need to + # worry about stdout + print(result.stdout) + return [js_file for (wast_file, js_file) in inputs] + +def copy_harness_files(out_js_dir, include_harness): harness_dir = os.path.join(out_js_dir, 'harness') ensure_empty_dir(harness_dir) @@ -87,6 +98,10 @@ def build_js(out_js_dir, include_harness=False): continue shutil.copy(js_file, harness_dir) +def build_js(out_js_dir): + print('Building JS...') + convert_wast_to_js(out_js_dir) + copy_harness_files(out_js_dir, False) print('Done building JS.') # HTML harness. @@ -100,9 +115,7 @@ def build_js(out_js_dir, include_harness=False): - - - +
""" @@ -112,75 +125,68 @@ def build_js(out_js_dir, include_harness=False): """ -def build_html_js(out_dir, js_dir, include_harness=False): - if js_dir is None: - ensure_empty_dir(out_dir) - build_js(out_dir, include_harness) - else: - print('Copying JS files into the HTML dir...') - ensure_remove_dir(out_dir) - def ignore(_src, names): - if include_harness: - return [] - return [name for name in names if os.path.basename(name) in HARNESS_FILES] - shutil.copytree(js_dir, out_dir, ignore=ignore) - print('Done copying JS files into the HTML dir.') - - for js_file in glob.glob(os.path.join(HTML_TESTS_DIR, '*.js')): - shutil.copy(js_file, out_dir) - -def build_html_from_js(js_html_dir, html_dir): - for js_file in glob.glob(os.path.join(js_html_dir, '*.js')): +def wrap_single_test(js_file): + test_func_name = os.path.basename(js_file).replace('.', '_').replace('-', '_') + + content = "(function {}() {{\n".format(test_func_name) + with open(js_file, 'r') as f: + content += f.read() + content += "reinitializeRegistry();\n})();\n" + + with open(js_file, 'w') as f: + f.write(content) + +def build_html_js(out_dir): + ensure_empty_dir(out_dir) + copy_harness_files(out_dir, True) + + tests = convert_wast_to_js(out_dir) + for js_file in tests: + wrap_single_test(js_file) + return tests + +def build_html_from_js(tests, html_dir, use_sync): + for js_file in tests: js_filename = os.path.basename(js_file) html_filename = js_filename + '.html' html_file = os.path.join(html_dir, html_filename) + js_harness = "sync_index.js" if use_sync else "async_index.js" with open(html_file, 'w+') as f: content = HTML_HEADER.replace('{PREFIX}', './js/harness') \ - .replace('{WPT_PREFIX}', WPT_URL_PREFIX) + .replace('{WPT_PREFIX}', './js/harness') \ + .replace('{JS_HARNESS}', js_harness) content += " ".replace('{SCRIPT}', js_filename) content += HTML_BOTTOM f.write(content) -def build_html(html_dir, js_dir): +def build_html(html_dir, js_dir, use_sync): print("Building HTML tests...") js_html_dir = os.path.join(html_dir, 'js') - build_html_js(js_html_dir, js_dir) + tests = build_html_js(js_html_dir) print('Building WPT tests from JS tests...') - build_html_from_js(js_html_dir, html_dir) + build_html_from_js(tests, html_dir, use_sync) print("Done building HTML tests.") # Front page harness. -def wrap_single_test(js_file): - test_func_name = os.path.basename(js_file).replace('.', '_').replace('-', '_') - - content = ["(function {}() {{".format(test_func_name)] - with open(js_file, 'r') as f: - content += f.readlines() - content.append('reinitializeRegistry();') - content.append('})();') - - with open(js_file, 'w') as f: - f.write('\n'.join(content)) - -def build_front_page(out_dir, js_dir): +def build_front_page(out_dir, js_dir, use_sync): print('Building front page containing all the HTML tests...') js_out_dir = os.path.join(out_dir, 'js') - build_html_js(js_out_dir, js_dir, include_harness=True) - for js_file in glob.glob(os.path.join(js_out_dir, '*.js')): - wrap_single_test(js_file) + tests = build_html_js(js_out_dir) front_page = os.path.join(out_dir, 'index.html') + js_harness = "sync_index.js" if use_sync else "async_index.js" with open(front_page, 'w+') as f: content = HTML_HEADER.replace('{PREFIX}', './js/harness') \ - .replace('{WPT_PREFIX}', './js/harness') - for js_file in glob.glob(os.path.join(js_out_dir, '*.js')): + .replace('{WPT_PREFIX}', './js/harness')\ + .replace('{JS_HARNESS}', js_harness) + for js_file in tests: filename = os.path.basename(js_file) content += " \n".replace('{SCRIPT}', filename) content += HTML_BOTTOM @@ -208,31 +214,49 @@ def process_args(): help="Relative path to the output directory for the front page.", type=str) - return parser.parse_args() + parser.add_argument('--dont-recompile', + action="store_const", + dest="compile", + help="Don't recompile the wasm spec interpreter (by default, it is)", + const=False, + default=True) + + parser.add_argument('--use-sync', + action="store_const", + dest="use_sync", + help="Let the tests use the synchronous JS API (by default, it does not)", + const=True, + default=False) + + return parser.parse_args(), parser if __name__ == '__main__': - args = process_args() + args, parser = process_args() js_dir = args.js_dir html_dir = args.html_dir front_dir = args.front_dir - ensure_wasm_executable(WASM_EXEC) - if front_dir is None and js_dir is None and html_dir is None: - print('At least one mode must be selected.') + print('At least one mode must be selected.\n') + parser.print_help() sys.exit(1) + if args.compile: + compile_wasm_interpreter() + + ensure_wasm_executable(WASM_EXEC) + if js_dir is not None: ensure_empty_dir(js_dir) build_js(js_dir) if html_dir is not None: ensure_empty_dir(html_dir) - build_html(html_dir, js_dir) + build_html(html_dir, js_dir, args.use_sync) if front_dir is not None: ensure_empty_dir(front_dir) - build_front_page(front_dir, js_dir) + build_front_page(front_dir, js_dir, args.use_sync) print('Done!') diff --git a/test/core/README.md b/test/core/README.md index 8f509b0a..31915146 100644 --- a/test/core/README.md +++ b/test/core/README.md @@ -1,4 +1,4 @@ -This directory contains tests for the core WebAssembly semantics, as described in [Semantics.md](https://github.com/WebAssembly/design/blob/master/Semantics.md) and specified by the [spec interpreter](https://github.com/WebAssembly/spec/blob/master/interpreter/spec). +This directory contains tests for the core WebAssembly semantics, as described in [Semantics.md](https://github.com/WebAssembly/design/blob/master/Semantics.md) and specified by the [spec interpreter](https://github.com/WebAssembly/spec/blob/master/interpreter). Tests are written in the [S-Expression script format](https://github.com/WebAssembly/spec/blob/master/interpreter/README.md#s-expression-syntax) defined by the interpreter. diff --git a/test/core/address-offset-range.fail.wast b/test/core/address-offset-range.fail.wast deleted file mode 100644 index 127327a2..00000000 --- a/test/core/address-offset-range.fail.wast +++ /dev/null @@ -1,4 +0,0 @@ -(module - (memory 1) - (func $bad (drop (i32.load offset=4294967296 (i32.const 0)))) -) diff --git a/test/core/address.wast b/test/core/address.wast index 4f8e3498..e071cca5 100644 --- a/test/core/address.wast +++ b/test/core/address.wast @@ -1,34 +1,589 @@ +;; Load i32 data with different offset/align arguments + (module - (import "spectest" "print" (func $print (param i32))) + (memory 1) + (data (i32.const 0) "abcdefghijklmnopqrstuvwxyz") + + (func (export "8u_good1") (param $i i32) (result i32) + (i32.load8_u offset=0 (local.get $i)) ;; 97 'a' + ) + (func (export "8u_good2") (param $i i32) (result i32) + (i32.load8_u align=1 (local.get $i)) ;; 97 'a' + ) + (func (export "8u_good3") (param $i i32) (result i32) + (i32.load8_u offset=1 align=1 (local.get $i)) ;; 98 'b' + ) + (func (export "8u_good4") (param $i i32) (result i32) + (i32.load8_u offset=2 align=1 (local.get $i)) ;; 99 'c' + ) + (func (export "8u_good5") (param $i i32) (result i32) + (i32.load8_u offset=25 align=1 (local.get $i)) ;; 122 'z' + ) + + (func (export "8s_good1") (param $i i32) (result i32) + (i32.load8_s offset=0 (local.get $i)) ;; 97 'a' + ) + (func (export "8s_good2") (param $i i32) (result i32) + (i32.load8_s align=1 (local.get $i)) ;; 97 'a' + ) + (func (export "8s_good3") (param $i i32) (result i32) + (i32.load8_s offset=1 align=1 (local.get $i)) ;; 98 'b' + ) + (func (export "8s_good4") (param $i i32) (result i32) + (i32.load8_s offset=2 align=1 (local.get $i)) ;; 99 'c' + ) + (func (export "8s_good5") (param $i i32) (result i32) + (i32.load8_s offset=25 align=1 (local.get $i)) ;; 122 'z' + ) + + (func (export "16u_good1") (param $i i32) (result i32) + (i32.load16_u offset=0 (local.get $i)) ;; 25185 'ab' + ) + (func (export "16u_good2") (param $i i32) (result i32) + (i32.load16_u align=1 (local.get $i)) ;; 25185 'ab' + ) + (func (export "16u_good3") (param $i i32) (result i32) + (i32.load16_u offset=1 align=1 (local.get $i)) ;; 25442 'bc' + ) + (func (export "16u_good4") (param $i i32) (result i32) + (i32.load16_u offset=2 align=2 (local.get $i)) ;; 25699 'cd' + ) + (func (export "16u_good5") (param $i i32) (result i32) + (i32.load16_u offset=25 align=2 (local.get $i)) ;; 122 'z\0' + ) + + (func (export "16s_good1") (param $i i32) (result i32) + (i32.load16_s offset=0 (local.get $i)) ;; 25185 'ab' + ) + (func (export "16s_good2") (param $i i32) (result i32) + (i32.load16_s align=1 (local.get $i)) ;; 25185 'ab' + ) + (func (export "16s_good3") (param $i i32) (result i32) + (i32.load16_s offset=1 align=1 (local.get $i)) ;; 25442 'bc' + ) + (func (export "16s_good4") (param $i i32) (result i32) + (i32.load16_s offset=2 align=2 (local.get $i)) ;; 25699 'cd' + ) + (func (export "16s_good5") (param $i i32) (result i32) + (i32.load16_s offset=25 align=2 (local.get $i)) ;; 122 'z\0' + ) + + (func (export "32_good1") (param $i i32) (result i32) + (i32.load offset=0 (local.get $i)) ;; 1684234849 'abcd' + ) + (func (export "32_good2") (param $i i32) (result i32) + (i32.load align=1 (local.get $i)) ;; 1684234849 'abcd' + ) + (func (export "32_good3") (param $i i32) (result i32) + (i32.load offset=1 align=1 (local.get $i)) ;; 1701077858 'bcde' + ) + (func (export "32_good4") (param $i i32) (result i32) + (i32.load offset=2 align=2 (local.get $i)) ;; 1717920867 'cdef' + ) + (func (export "32_good5") (param $i i32) (result i32) + (i32.load offset=25 align=4 (local.get $i)) ;; 122 'z\0\0\0' + ) + + (func (export "8u_bad") (param $i i32) + (drop (i32.load8_u offset=4294967295 (local.get $i))) + ) + (func (export "8s_bad") (param $i i32) + (drop (i32.load8_s offset=4294967295 (local.get $i))) + ) + (func (export "16u_bad") (param $i i32) + (drop (i32.load16_u offset=4294967295 (local.get $i))) + ) + (func (export "16s_bad") (param $i i32) + (drop (i32.load16_s offset=4294967295 (local.get $i))) + ) + (func (export "32_bad") (param $i i32) + (drop (i32.load offset=4294967295 (local.get $i))) + ) +) +(assert_return (invoke "8u_good1" (i32.const 0)) (i32.const 97)) +(assert_return (invoke "8u_good2" (i32.const 0)) (i32.const 97)) +(assert_return (invoke "8u_good3" (i32.const 0)) (i32.const 98)) +(assert_return (invoke "8u_good4" (i32.const 0)) (i32.const 99)) +(assert_return (invoke "8u_good5" (i32.const 0)) (i32.const 122)) + +(assert_return (invoke "8s_good1" (i32.const 0)) (i32.const 97)) +(assert_return (invoke "8s_good2" (i32.const 0)) (i32.const 97)) +(assert_return (invoke "8s_good3" (i32.const 0)) (i32.const 98)) +(assert_return (invoke "8s_good4" (i32.const 0)) (i32.const 99)) +(assert_return (invoke "8s_good5" (i32.const 0)) (i32.const 122)) + +(assert_return (invoke "16u_good1" (i32.const 0)) (i32.const 25185)) +(assert_return (invoke "16u_good2" (i32.const 0)) (i32.const 25185)) +(assert_return (invoke "16u_good3" (i32.const 0)) (i32.const 25442)) +(assert_return (invoke "16u_good4" (i32.const 0)) (i32.const 25699)) +(assert_return (invoke "16u_good5" (i32.const 0)) (i32.const 122)) + +(assert_return (invoke "16s_good1" (i32.const 0)) (i32.const 25185)) +(assert_return (invoke "16s_good2" (i32.const 0)) (i32.const 25185)) +(assert_return (invoke "16s_good3" (i32.const 0)) (i32.const 25442)) +(assert_return (invoke "16s_good4" (i32.const 0)) (i32.const 25699)) +(assert_return (invoke "16s_good5" (i32.const 0)) (i32.const 122)) + +(assert_return (invoke "32_good1" (i32.const 0)) (i32.const 1684234849)) +(assert_return (invoke "32_good2" (i32.const 0)) (i32.const 1684234849)) +(assert_return (invoke "32_good3" (i32.const 0)) (i32.const 1701077858)) +(assert_return (invoke "32_good4" (i32.const 0)) (i32.const 1717920867)) +(assert_return (invoke "32_good5" (i32.const 0)) (i32.const 122)) + +(assert_return (invoke "8u_good1" (i32.const 65507)) (i32.const 0)) +(assert_return (invoke "8u_good2" (i32.const 65507)) (i32.const 0)) +(assert_return (invoke "8u_good3" (i32.const 65507)) (i32.const 0)) +(assert_return (invoke "8u_good4" (i32.const 65507)) (i32.const 0)) +(assert_return (invoke "8u_good5" (i32.const 65507)) (i32.const 0)) + +(assert_return (invoke "8s_good1" (i32.const 65507)) (i32.const 0)) +(assert_return (invoke "8s_good2" (i32.const 65507)) (i32.const 0)) +(assert_return (invoke "8s_good3" (i32.const 65507)) (i32.const 0)) +(assert_return (invoke "8s_good4" (i32.const 65507)) (i32.const 0)) +(assert_return (invoke "8s_good5" (i32.const 65507)) (i32.const 0)) + +(assert_return (invoke "16u_good1" (i32.const 65507)) (i32.const 0)) +(assert_return (invoke "16u_good2" (i32.const 65507)) (i32.const 0)) +(assert_return (invoke "16u_good3" (i32.const 65507)) (i32.const 0)) +(assert_return (invoke "16u_good4" (i32.const 65507)) (i32.const 0)) +(assert_return (invoke "16u_good5" (i32.const 65507)) (i32.const 0)) + +(assert_return (invoke "16s_good1" (i32.const 65507)) (i32.const 0)) +(assert_return (invoke "16s_good2" (i32.const 65507)) (i32.const 0)) +(assert_return (invoke "16s_good3" (i32.const 65507)) (i32.const 0)) +(assert_return (invoke "16s_good4" (i32.const 65507)) (i32.const 0)) +(assert_return (invoke "16s_good5" (i32.const 65507)) (i32.const 0)) + +(assert_return (invoke "32_good1" (i32.const 65507)) (i32.const 0)) +(assert_return (invoke "32_good2" (i32.const 65507)) (i32.const 0)) +(assert_return (invoke "32_good3" (i32.const 65507)) (i32.const 0)) +(assert_return (invoke "32_good4" (i32.const 65507)) (i32.const 0)) +(assert_return (invoke "32_good5" (i32.const 65507)) (i32.const 0)) + +(assert_return (invoke "8u_good1" (i32.const 65508)) (i32.const 0)) +(assert_return (invoke "8u_good2" (i32.const 65508)) (i32.const 0)) +(assert_return (invoke "8u_good3" (i32.const 65508)) (i32.const 0)) +(assert_return (invoke "8u_good4" (i32.const 65508)) (i32.const 0)) +(assert_return (invoke "8u_good5" (i32.const 65508)) (i32.const 0)) + +(assert_return (invoke "8s_good1" (i32.const 65508)) (i32.const 0)) +(assert_return (invoke "8s_good2" (i32.const 65508)) (i32.const 0)) +(assert_return (invoke "8s_good3" (i32.const 65508)) (i32.const 0)) +(assert_return (invoke "8s_good4" (i32.const 65508)) (i32.const 0)) +(assert_return (invoke "8s_good5" (i32.const 65508)) (i32.const 0)) + +(assert_return (invoke "16u_good1" (i32.const 65508)) (i32.const 0)) +(assert_return (invoke "16u_good2" (i32.const 65508)) (i32.const 0)) +(assert_return (invoke "16u_good3" (i32.const 65508)) (i32.const 0)) +(assert_return (invoke "16u_good4" (i32.const 65508)) (i32.const 0)) +(assert_return (invoke "16u_good5" (i32.const 65508)) (i32.const 0)) + +(assert_return (invoke "16s_good1" (i32.const 65508)) (i32.const 0)) +(assert_return (invoke "16s_good2" (i32.const 65508)) (i32.const 0)) +(assert_return (invoke "16s_good3" (i32.const 65508)) (i32.const 0)) +(assert_return (invoke "16s_good4" (i32.const 65508)) (i32.const 0)) +(assert_return (invoke "16s_good5" (i32.const 65508)) (i32.const 0)) + +(assert_return (invoke "32_good1" (i32.const 65508)) (i32.const 0)) +(assert_return (invoke "32_good2" (i32.const 65508)) (i32.const 0)) +(assert_return (invoke "32_good3" (i32.const 65508)) (i32.const 0)) +(assert_return (invoke "32_good4" (i32.const 65508)) (i32.const 0)) +(assert_trap (invoke "32_good5" (i32.const 65508)) "out of bounds memory access") + +(assert_trap (invoke "8u_bad" (i32.const 0)) "out of bounds memory access") +(assert_trap (invoke "8s_bad" (i32.const 0)) "out of bounds memory access") +(assert_trap (invoke "16u_bad" (i32.const 0)) "out of bounds memory access") +(assert_trap (invoke "16s_bad" (i32.const 0)) "out of bounds memory access") +(assert_trap (invoke "32_bad" (i32.const 0)) "out of bounds memory access") + +(assert_trap (invoke "8u_bad" (i32.const 1)) "out of bounds memory access") +(assert_trap (invoke "8s_bad" (i32.const 1)) "out of bounds memory access") +(assert_trap (invoke "16u_bad" (i32.const 1)) "out of bounds memory access") +(assert_trap (invoke "16s_bad" (i32.const 1)) "out of bounds memory access") +(assert_trap (invoke "32_bad" (i32.const 1)) "out of bounds memory access") + +(assert_malformed + (module quote + "(memory 1)" + "(func (drop (i32.load offset=4294967296 (i32.const 0))))" + ) + "i32 constant" +) + +;; Load i64 data with different offset/align arguments + +(module (memory 1) (data (i32.const 0) "abcdefghijklmnopqrstuvwxyz") - (func (export "good") (param $i i32) - (call $print (i32.load8_u offset=0 (get_local $i))) ;; 97 'a' - (call $print (i32.load8_u offset=1 (get_local $i))) ;; 98 'b' - (call $print (i32.load8_u offset=2 (get_local $i))) ;; 99 'c' - (call $print (i32.load8_u offset=25 (get_local $i))) ;; 122 'z' + (func (export "8u_good1") (param $i i32) (result i64) + (i64.load8_u offset=0 (local.get $i)) ;; 97 'a' + ) + (func (export "8u_good2") (param $i i32) (result i64) + (i64.load8_u align=1 (local.get $i)) ;; 97 'a' + ) + (func (export "8u_good3") (param $i i32) (result i64) + (i64.load8_u offset=1 align=1 (local.get $i)) ;; 98 'b' + ) + (func (export "8u_good4") (param $i i32) (result i64) + (i64.load8_u offset=2 align=1 (local.get $i)) ;; 99 'c' + ) + (func (export "8u_good5") (param $i i32) (result i64) + (i64.load8_u offset=25 align=1 (local.get $i)) ;; 122 'z' + ) + + (func (export "8s_good1") (param $i i32) (result i64) + (i64.load8_s offset=0 (local.get $i)) ;; 97 'a' + ) + (func (export "8s_good2") (param $i i32) (result i64) + (i64.load8_s align=1 (local.get $i)) ;; 97 'a' + ) + (func (export "8s_good3") (param $i i32) (result i64) + (i64.load8_s offset=1 align=1 (local.get $i)) ;; 98 'b' + ) + (func (export "8s_good4") (param $i i32) (result i64) + (i64.load8_s offset=2 align=1 (local.get $i)) ;; 99 'c' + ) + (func (export "8s_good5") (param $i i32) (result i64) + (i64.load8_s offset=25 align=1 (local.get $i)) ;; 122 'z' + ) + + (func (export "16u_good1") (param $i i32) (result i64) + (i64.load16_u offset=0 (local.get $i)) ;; 25185 'ab' + ) + (func (export "16u_good2") (param $i i32) (result i64) + (i64.load16_u align=1 (local.get $i)) ;; 25185 'ab' + ) + (func (export "16u_good3") (param $i i32) (result i64) + (i64.load16_u offset=1 align=1 (local.get $i)) ;; 25442 'bc' + ) + (func (export "16u_good4") (param $i i32) (result i64) + (i64.load16_u offset=2 align=2 (local.get $i)) ;; 25699 'cd' + ) + (func (export "16u_good5") (param $i i32) (result i64) + (i64.load16_u offset=25 align=2 (local.get $i)) ;; 122 'z\0' + ) + + (func (export "16s_good1") (param $i i32) (result i64) + (i64.load16_s offset=0 (local.get $i)) ;; 25185 'ab' + ) + (func (export "16s_good2") (param $i i32) (result i64) + (i64.load16_s align=1 (local.get $i)) ;; 25185 'ab' + ) + (func (export "16s_good3") (param $i i32) (result i64) + (i64.load16_s offset=1 align=1 (local.get $i)) ;; 25442 'bc' + ) + (func (export "16s_good4") (param $i i32) (result i64) + (i64.load16_s offset=2 align=2 (local.get $i)) ;; 25699 'cd' + ) + (func (export "16s_good5") (param $i i32) (result i64) + (i64.load16_s offset=25 align=2 (local.get $i)) ;; 122 'z\0' + ) + + (func (export "32u_good1") (param $i i32) (result i64) + (i64.load32_u offset=0 (local.get $i)) ;; 1684234849 'abcd' + ) + (func (export "32u_good2") (param $i i32) (result i64) + (i64.load32_u align=1 (local.get $i)) ;; 1684234849 'abcd' + ) + (func (export "32u_good3") (param $i i32) (result i64) + (i64.load32_u offset=1 align=1 (local.get $i)) ;; 1701077858 'bcde' + ) + (func (export "32u_good4") (param $i i32) (result i64) + (i64.load32_u offset=2 align=2 (local.get $i)) ;; 1717920867 'cdef' + ) + (func (export "32u_good5") (param $i i32) (result i64) + (i64.load32_u offset=25 align=4 (local.get $i)) ;; 122 'z\0\0\0' + ) + + (func (export "32s_good1") (param $i i32) (result i64) + (i64.load32_s offset=0 (local.get $i)) ;; 1684234849 'abcd' + ) + (func (export "32s_good2") (param $i i32) (result i64) + (i64.load32_s align=1 (local.get $i)) ;; 1684234849 'abcd' + ) + (func (export "32s_good3") (param $i i32) (result i64) + (i64.load32_s offset=1 align=1 (local.get $i)) ;; 1701077858 'bcde' + ) + (func (export "32s_good4") (param $i i32) (result i64) + (i64.load32_s offset=2 align=2 (local.get $i)) ;; 1717920867 'cdef' + ) + (func (export "32s_good5") (param $i i32) (result i64) + (i64.load32_s offset=25 align=4 (local.get $i)) ;; 122 'z\0\0\0' + ) + + (func (export "64_good1") (param $i i32) (result i64) + (i64.load offset=0 (local.get $i)) ;; 0x6867666564636261 'abcdefgh' + ) + (func (export "64_good2") (param $i i32) (result i64) + (i64.load align=1 (local.get $i)) ;; 0x6867666564636261 'abcdefgh' + ) + (func (export "64_good3") (param $i i32) (result i64) + (i64.load offset=1 align=1 (local.get $i)) ;; 0x6968676665646362 'bcdefghi' + ) + (func (export "64_good4") (param $i i32) (result i64) + (i64.load offset=2 align=2 (local.get $i)) ;; 0x6a69686766656463 'cdefghij' + ) + (func (export "64_good5") (param $i i32) (result i64) + (i64.load offset=25 align=8 (local.get $i)) ;; 122 'z\0\0\0\0\0\0\0' + ) + + (func (export "8u_bad") (param $i i32) + (drop (i64.load8_u offset=4294967295 (local.get $i))) + ) + (func (export "8s_bad") (param $i i32) + (drop (i64.load8_s offset=4294967295 (local.get $i))) + ) + (func (export "16u_bad") (param $i i32) + (drop (i64.load16_u offset=4294967295 (local.get $i))) + ) + (func (export "16s_bad") (param $i i32) + (drop (i64.load16_s offset=4294967295 (local.get $i))) + ) + (func (export "32u_bad") (param $i i32) + (drop (i64.load32_u offset=4294967295 (local.get $i))) + ) + (func (export "32s_bad") (param $i i32) + (drop (i64.load32_s offset=4294967295 (local.get $i))) + ) + (func (export "64_bad") (param $i i32) + (drop (i64.load offset=4294967295 (local.get $i))) + ) +) + +(assert_return (invoke "8u_good1" (i32.const 0)) (i64.const 97)) +(assert_return (invoke "8u_good2" (i32.const 0)) (i64.const 97)) +(assert_return (invoke "8u_good3" (i32.const 0)) (i64.const 98)) +(assert_return (invoke "8u_good4" (i32.const 0)) (i64.const 99)) +(assert_return (invoke "8u_good5" (i32.const 0)) (i64.const 122)) + +(assert_return (invoke "8s_good1" (i32.const 0)) (i64.const 97)) +(assert_return (invoke "8s_good2" (i32.const 0)) (i64.const 97)) +(assert_return (invoke "8s_good3" (i32.const 0)) (i64.const 98)) +(assert_return (invoke "8s_good4" (i32.const 0)) (i64.const 99)) +(assert_return (invoke "8s_good5" (i32.const 0)) (i64.const 122)) + +(assert_return (invoke "16u_good1" (i32.const 0)) (i64.const 25185)) +(assert_return (invoke "16u_good2" (i32.const 0)) (i64.const 25185)) +(assert_return (invoke "16u_good3" (i32.const 0)) (i64.const 25442)) +(assert_return (invoke "16u_good4" (i32.const 0)) (i64.const 25699)) +(assert_return (invoke "16u_good5" (i32.const 0)) (i64.const 122)) + +(assert_return (invoke "16s_good1" (i32.const 0)) (i64.const 25185)) +(assert_return (invoke "16s_good2" (i32.const 0)) (i64.const 25185)) +(assert_return (invoke "16s_good3" (i32.const 0)) (i64.const 25442)) +(assert_return (invoke "16s_good4" (i32.const 0)) (i64.const 25699)) +(assert_return (invoke "16s_good5" (i32.const 0)) (i64.const 122)) + +(assert_return (invoke "32u_good1" (i32.const 0)) (i64.const 1684234849)) +(assert_return (invoke "32u_good2" (i32.const 0)) (i64.const 1684234849)) +(assert_return (invoke "32u_good3" (i32.const 0)) (i64.const 1701077858)) +(assert_return (invoke "32u_good4" (i32.const 0)) (i64.const 1717920867)) +(assert_return (invoke "32u_good5" (i32.const 0)) (i64.const 122)) + +(assert_return (invoke "32s_good1" (i32.const 0)) (i64.const 1684234849)) +(assert_return (invoke "32s_good2" (i32.const 0)) (i64.const 1684234849)) +(assert_return (invoke "32s_good3" (i32.const 0)) (i64.const 1701077858)) +(assert_return (invoke "32s_good4" (i32.const 0)) (i64.const 1717920867)) +(assert_return (invoke "32s_good5" (i32.const 0)) (i64.const 122)) + +(assert_return (invoke "64_good1" (i32.const 0)) (i64.const 0x6867666564636261)) +(assert_return (invoke "64_good2" (i32.const 0)) (i64.const 0x6867666564636261)) +(assert_return (invoke "64_good3" (i32.const 0)) (i64.const 0x6968676665646362)) +(assert_return (invoke "64_good4" (i32.const 0)) (i64.const 0x6a69686766656463)) +(assert_return (invoke "64_good5" (i32.const 0)) (i64.const 122)) + +(assert_return (invoke "8u_good1" (i32.const 65503)) (i64.const 0)) +(assert_return (invoke "8u_good2" (i32.const 65503)) (i64.const 0)) +(assert_return (invoke "8u_good3" (i32.const 65503)) (i64.const 0)) +(assert_return (invoke "8u_good4" (i32.const 65503)) (i64.const 0)) +(assert_return (invoke "8u_good5" (i32.const 65503)) (i64.const 0)) - (call $print (i32.load16_u offset=0 (get_local $i))) ;; 25185 'ab' - (call $print (i32.load16_u align=1 (get_local $i))) ;; 25185 'ab' - (call $print (i32.load16_u offset=1 align=1 (get_local $i))) ;; 25442 'bc' - (call $print (i32.load16_u offset=2 (get_local $i))) ;; 25699 'cd' - (call $print (i32.load16_u offset=25 align=1 (get_local $i))) ;; 122 'z\0' +(assert_return (invoke "8s_good1" (i32.const 65503)) (i64.const 0)) +(assert_return (invoke "8s_good2" (i32.const 65503)) (i64.const 0)) +(assert_return (invoke "8s_good3" (i32.const 65503)) (i64.const 0)) +(assert_return (invoke "8s_good4" (i32.const 65503)) (i64.const 0)) +(assert_return (invoke "8s_good5" (i32.const 65503)) (i64.const 0)) - (call $print (i32.load offset=0 (get_local $i))) ;; 1684234849 'abcd' - (call $print (i32.load offset=1 align=1 (get_local $i))) ;; 1701077858 'bcde' - (call $print (i32.load offset=2 align=2 (get_local $i))) ;; 1717920867 'cdef' - (call $print (i32.load offset=25 align=1 (get_local $i))) ;; 122 'z\0\0\0' +(assert_return (invoke "16u_good1" (i32.const 65503)) (i64.const 0)) +(assert_return (invoke "16u_good2" (i32.const 65503)) (i64.const 0)) +(assert_return (invoke "16u_good3" (i32.const 65503)) (i64.const 0)) +(assert_return (invoke "16u_good4" (i32.const 65503)) (i64.const 0)) +(assert_return (invoke "16u_good5" (i32.const 65503)) (i64.const 0)) + +(assert_return (invoke "16s_good1" (i32.const 65503)) (i64.const 0)) +(assert_return (invoke "16s_good2" (i32.const 65503)) (i64.const 0)) +(assert_return (invoke "16s_good3" (i32.const 65503)) (i64.const 0)) +(assert_return (invoke "16s_good4" (i32.const 65503)) (i64.const 0)) +(assert_return (invoke "16s_good5" (i32.const 65503)) (i64.const 0)) + +(assert_return (invoke "32u_good1" (i32.const 65503)) (i64.const 0)) +(assert_return (invoke "32u_good2" (i32.const 65503)) (i64.const 0)) +(assert_return (invoke "32u_good3" (i32.const 65503)) (i64.const 0)) +(assert_return (invoke "32u_good4" (i32.const 65503)) (i64.const 0)) +(assert_return (invoke "32u_good5" (i32.const 65503)) (i64.const 0)) + +(assert_return (invoke "32s_good1" (i32.const 65503)) (i64.const 0)) +(assert_return (invoke "32s_good2" (i32.const 65503)) (i64.const 0)) +(assert_return (invoke "32s_good3" (i32.const 65503)) (i64.const 0)) +(assert_return (invoke "32s_good4" (i32.const 65503)) (i64.const 0)) +(assert_return (invoke "32s_good5" (i32.const 65503)) (i64.const 0)) + +(assert_return (invoke "64_good1" (i32.const 65503)) (i64.const 0)) +(assert_return (invoke "64_good2" (i32.const 65503)) (i64.const 0)) +(assert_return (invoke "64_good3" (i32.const 65503)) (i64.const 0)) +(assert_return (invoke "64_good4" (i32.const 65503)) (i64.const 0)) +(assert_return (invoke "64_good5" (i32.const 65503)) (i64.const 0)) + +(assert_return (invoke "8u_good1" (i32.const 65504)) (i64.const 0)) +(assert_return (invoke "8u_good2" (i32.const 65504)) (i64.const 0)) +(assert_return (invoke "8u_good3" (i32.const 65504)) (i64.const 0)) +(assert_return (invoke "8u_good4" (i32.const 65504)) (i64.const 0)) +(assert_return (invoke "8u_good5" (i32.const 65504)) (i64.const 0)) + +(assert_return (invoke "8s_good1" (i32.const 65504)) (i64.const 0)) +(assert_return (invoke "8s_good2" (i32.const 65504)) (i64.const 0)) +(assert_return (invoke "8s_good3" (i32.const 65504)) (i64.const 0)) +(assert_return (invoke "8s_good4" (i32.const 65504)) (i64.const 0)) +(assert_return (invoke "8s_good5" (i32.const 65504)) (i64.const 0)) + +(assert_return (invoke "16u_good1" (i32.const 65504)) (i64.const 0)) +(assert_return (invoke "16u_good2" (i32.const 65504)) (i64.const 0)) +(assert_return (invoke "16u_good3" (i32.const 65504)) (i64.const 0)) +(assert_return (invoke "16u_good4" (i32.const 65504)) (i64.const 0)) +(assert_return (invoke "16u_good5" (i32.const 65504)) (i64.const 0)) + +(assert_return (invoke "16s_good1" (i32.const 65504)) (i64.const 0)) +(assert_return (invoke "16s_good2" (i32.const 65504)) (i64.const 0)) +(assert_return (invoke "16s_good3" (i32.const 65504)) (i64.const 0)) +(assert_return (invoke "16s_good4" (i32.const 65504)) (i64.const 0)) +(assert_return (invoke "16s_good5" (i32.const 65504)) (i64.const 0)) + +(assert_return (invoke "32u_good1" (i32.const 65504)) (i64.const 0)) +(assert_return (invoke "32u_good2" (i32.const 65504)) (i64.const 0)) +(assert_return (invoke "32u_good3" (i32.const 65504)) (i64.const 0)) +(assert_return (invoke "32u_good4" (i32.const 65504)) (i64.const 0)) +(assert_return (invoke "32u_good5" (i32.const 65504)) (i64.const 0)) + +(assert_return (invoke "32s_good1" (i32.const 65504)) (i64.const 0)) +(assert_return (invoke "32s_good2" (i32.const 65504)) (i64.const 0)) +(assert_return (invoke "32s_good3" (i32.const 65504)) (i64.const 0)) +(assert_return (invoke "32s_good4" (i32.const 65504)) (i64.const 0)) +(assert_return (invoke "32s_good5" (i32.const 65504)) (i64.const 0)) + +(assert_return (invoke "64_good1" (i32.const 65504)) (i64.const 0)) +(assert_return (invoke "64_good2" (i32.const 65504)) (i64.const 0)) +(assert_return (invoke "64_good3" (i32.const 65504)) (i64.const 0)) +(assert_return (invoke "64_good4" (i32.const 65504)) (i64.const 0)) +(assert_trap (invoke "64_good5" (i32.const 65504)) "out of bounds memory access") + +(assert_trap (invoke "8u_bad" (i32.const 0)) "out of bounds memory access") +(assert_trap (invoke "8s_bad" (i32.const 0)) "out of bounds memory access") +(assert_trap (invoke "16u_bad" (i32.const 0)) "out of bounds memory access") +(assert_trap (invoke "16s_bad" (i32.const 0)) "out of bounds memory access") +(assert_trap (invoke "32u_bad" (i32.const 0)) "out of bounds memory access") +(assert_trap (invoke "32s_bad" (i32.const 0)) "out of bounds memory access") +(assert_trap (invoke "64_bad" (i32.const 0)) "out of bounds memory access") + +(assert_trap (invoke "8u_bad" (i32.const 1)) "out of bounds memory access") +(assert_trap (invoke "8s_bad" (i32.const 1)) "out of bounds memory access") +(assert_trap (invoke "16u_bad" (i32.const 1)) "out of bounds memory access") +(assert_trap (invoke "16s_bad" (i32.const 1)) "out of bounds memory access") +(assert_trap (invoke "32u_bad" (i32.const 0)) "out of bounds memory access") +(assert_trap (invoke "32s_bad" (i32.const 0)) "out of bounds memory access") +(assert_trap (invoke "64_bad" (i32.const 1)) "out of bounds memory access") + +;; Load f32 data with different offset/align arguments + +(module + (memory 1) + (data (i32.const 0) "\00\00\00\00\00\00\a0\7f\01\00\d0\7f") + + (func (export "32_good1") (param $i i32) (result f32) + (f32.load offset=0 (local.get $i)) ;; 0.0 '\00\00\00\00' + ) + (func (export "32_good2") (param $i i32) (result f32) + (f32.load align=1 (local.get $i)) ;; 0.0 '\00\00\00\00' + ) + (func (export "32_good3") (param $i i32) (result f32) + (f32.load offset=1 align=1 (local.get $i)) ;; 0.0 '\00\00\00\00' ) + (func (export "32_good4") (param $i i32) (result f32) + (f32.load offset=2 align=2 (local.get $i)) ;; 0.0 '\00\00\00\00' + ) + (func (export "32_good5") (param $i i32) (result f32) + (f32.load offset=8 align=4 (local.get $i)) ;; nan:0x500001 '\01\00\d0\7f' + ) + (func (export "32_bad") (param $i i32) + (drop (f32.load offset=4294967295 (local.get $i))) + ) +) + +(assert_return (invoke "32_good1" (i32.const 0)) (f32.const 0.0)) +(assert_return (invoke "32_good2" (i32.const 0)) (f32.const 0.0)) +(assert_return (invoke "32_good3" (i32.const 0)) (f32.const 0.0)) +(assert_return (invoke "32_good4" (i32.const 0)) (f32.const 0.0)) +(assert_return (invoke "32_good5" (i32.const 0)) (f32.const nan:0x500001)) + +(assert_return (invoke "32_good1" (i32.const 65524)) (f32.const 0.0)) +(assert_return (invoke "32_good2" (i32.const 65524)) (f32.const 0.0)) +(assert_return (invoke "32_good3" (i32.const 65524)) (f32.const 0.0)) +(assert_return (invoke "32_good4" (i32.const 65524)) (f32.const 0.0)) +(assert_return (invoke "32_good5" (i32.const 65524)) (f32.const 0.0)) + +(assert_return (invoke "32_good1" (i32.const 65525)) (f32.const 0.0)) +(assert_return (invoke "32_good2" (i32.const 65525)) (f32.const 0.0)) +(assert_return (invoke "32_good3" (i32.const 65525)) (f32.const 0.0)) +(assert_return (invoke "32_good4" (i32.const 65525)) (f32.const 0.0)) +(assert_trap (invoke "32_good5" (i32.const 65525)) "out of bounds memory access") + +(assert_trap (invoke "32_bad" (i32.const 0)) "out of bounds memory access") +(assert_trap (invoke "32_bad" (i32.const 1)) "out of bounds memory access") + +;; Load f64 data with different offset/align arguments + +(module + (memory 1) + (data (i32.const 0) "\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\f4\7f\01\00\00\00\00\00\fc\7f") - (func (export "bad") (param $i i32) - (drop (i32.load offset=4294967295 (get_local $i))) + (func (export "64_good1") (param $i i32) (result f64) + (f64.load offset=0 (local.get $i)) ;; 0.0 '\00\00\00\00\00\00\00\00' + ) + (func (export "64_good2") (param $i i32) (result f64) + (f64.load align=1 (local.get $i)) ;; 0.0 '\00\00\00\00\00\00\00\00' + ) + (func (export "64_good3") (param $i i32) (result f64) + (f64.load offset=1 align=1 (local.get $i)) ;; 0.0 '\00\00\00\00\00\00\00\00' + ) + (func (export "64_good4") (param $i i32) (result f64) + (f64.load offset=2 align=2 (local.get $i)) ;; 0.0 '\00\00\00\00\00\00\00\00' + ) + (func (export "64_good5") (param $i i32) (result f64) + (f64.load offset=18 align=8 (local.get $i)) ;; nan:0xc000000000001 '\01\00\00\00\00\00\fc\7f' + ) + (func (export "64_bad") (param $i i32) + (drop (f64.load offset=4294967295 (local.get $i))) ) ) -(invoke "good" (i32.const 0)) -(invoke "good" (i32.const 65507)) -(assert_trap (invoke "good" (i32.const 65508)) "out of bounds memory access") -(assert_trap (invoke "bad" (i32.const 0)) "out of bounds memory access") -(assert_trap (invoke "bad" (i32.const 1)) "out of bounds memory access") +(assert_return (invoke "64_good1" (i32.const 0)) (f64.const 0.0)) +(assert_return (invoke "64_good2" (i32.const 0)) (f64.const 0.0)) +(assert_return (invoke "64_good3" (i32.const 0)) (f64.const 0.0)) +(assert_return (invoke "64_good4" (i32.const 0)) (f64.const 0.0)) +(assert_return (invoke "64_good5" (i32.const 0)) (f64.const nan:0xc000000000001)) + +(assert_return (invoke "64_good1" (i32.const 65510)) (f64.const 0.0)) +(assert_return (invoke "64_good2" (i32.const 65510)) (f64.const 0.0)) +(assert_return (invoke "64_good3" (i32.const 65510)) (f64.const 0.0)) +(assert_return (invoke "64_good4" (i32.const 65510)) (f64.const 0.0)) +(assert_return (invoke "64_good5" (i32.const 65510)) (f64.const 0.0)) + +(assert_return (invoke "64_good1" (i32.const 65511)) (f64.const 0.0)) +(assert_return (invoke "64_good2" (i32.const 65511)) (f64.const 0.0)) +(assert_return (invoke "64_good3" (i32.const 65511)) (f64.const 0.0)) +(assert_return (invoke "64_good4" (i32.const 65511)) (f64.const 0.0)) +(assert_trap (invoke "64_good5" (i32.const 65511)) "out of bounds memory access") + +(assert_trap (invoke "64_bad" (i32.const 0)) "out of bounds memory access") +(assert_trap (invoke "64_bad" (i32.const 1)) "out of bounds memory access") diff --git a/test/core/align.wast b/test/core/align.wast new file mode 100644 index 00000000..93064649 --- /dev/null +++ b/test/core/align.wast @@ -0,0 +1,866 @@ +;; Test alignment annotation rules + +(module (memory 0) (func (drop (i32.load8_s align=1 (i32.const 0))))) +(module (memory 0) (func (drop (i32.load8_u align=1 (i32.const 0))))) +(module (memory 0) (func (drop (i32.load16_s align=2 (i32.const 0))))) +(module (memory 0) (func (drop (i32.load16_u align=2 (i32.const 0))))) +(module (memory 0) (func (drop (i32.load align=4 (i32.const 0))))) +(module (memory 0) (func (drop (i64.load8_s align=1 (i32.const 0))))) +(module (memory 0) (func (drop (i64.load8_u align=1 (i32.const 0))))) +(module (memory 0) (func (drop (i64.load16_s align=2 (i32.const 0))))) +(module (memory 0) (func (drop (i64.load16_u align=2 (i32.const 0))))) +(module (memory 0) (func (drop (i64.load32_s align=4 (i32.const 0))))) +(module (memory 0) (func (drop (i64.load32_u align=4 (i32.const 0))))) +(module (memory 0) (func (drop (i64.load align=8 (i32.const 0))))) +(module (memory 0) (func (drop (f32.load align=4 (i32.const 0))))) +(module (memory 0) (func (drop (f64.load align=8 (i32.const 0))))) +(module (memory 0) (func (i32.store8 align=1 (i32.const 0) (i32.const 1)))) +(module (memory 0) (func (i32.store16 align=2 (i32.const 0) (i32.const 1)))) +(module (memory 0) (func (i32.store align=4 (i32.const 0) (i32.const 1)))) +(module (memory 0) (func (i64.store8 align=1 (i32.const 0) (i64.const 1)))) +(module (memory 0) (func (i64.store16 align=2 (i32.const 0) (i64.const 1)))) +(module (memory 0) (func (i64.store32 align=4 (i32.const 0) (i64.const 1)))) +(module (memory 0) (func (i64.store align=8 (i32.const 0) (i64.const 1)))) +(module (memory 0) (func (f32.store align=4 (i32.const 0) (f32.const 1.0)))) +(module (memory 0) (func (f64.store align=8 (i32.const 0) (f64.const 1.0)))) + +(assert_malformed + (module quote + "(module (memory 0) (func (drop (i32.load8_s align=0 (i32.const 0)))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (drop (i32.load8_s align=7 (i32.const 0)))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (drop (i32.load8_u align=0 (i32.const 0)))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (drop (i32.load8_u align=7 (i32.const 0)))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (drop (i32.load16_s align=0 (i32.const 0)))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (drop (i32.load16_s align=7 (i32.const 0)))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (drop (i32.load16_u align=0 (i32.const 0)))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (drop (i32.load16_u align=7 (i32.const 0)))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (drop (i32.load align=0 (i32.const 0)))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (drop (i32.load align=7 (i32.const 0)))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (drop (i64.load8_s align=0 (i32.const 0)))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (drop (i64.load8_s align=7 (i32.const 0)))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (drop (i64.load8_u align=0 (i32.const 0)))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (drop (i64.load8_u align=7 (i32.const 0)))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (drop (i64.load16_s align=0 (i32.const 0)))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (drop (i64.load16_s align=7 (i32.const 0)))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (drop (i64.load16_u align=0 (i32.const 0)))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (drop (i64.load16_u align=7 (i32.const 0)))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (drop (i64.load32_s align=0 (i32.const 0)))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (drop (i64.load32_s align=7 (i32.const 0)))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (drop (i64.load32_u align=0 (i32.const 0)))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (drop (i64.load32_u align=7 (i32.const 0)))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (drop (i64.load align=0 (i32.const 0)))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (drop (i64.load align=7 (i32.const 0)))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (drop (f32.load align=0 (i32.const 0)))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (drop (f32.load align=7 (i32.const 0)))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (drop (f64.load align=0 (i32.const 0)))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (drop (f64.load align=7 (i32.const 0)))))" + ) + "alignment" +) + +(assert_malformed + (module quote + "(module (memory 0) (func (i32.store8 align=0 (i32.const 0) (i32.const 0))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (i32.store8 align=7 (i32.const 0) (i32.const 0))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (i32.store16 align=0 (i32.const 0) (i32.const 0))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (i32.store16 align=7 (i32.const 0) (i32.const 0))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (i32.store align=0 (i32.const 0) (i32.const 0))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (i32.store align=7 (i32.const 0) (i32.const 0))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (i64.store8 align=0 (i32.const 0) (i64.const 0))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (i64.store8 align=7 (i32.const 0) (i64.const 0))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (i64.store16 align=0 (i32.const 0) (i64.const 0))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (i64.store16 align=7 (i32.const 0) (i64.const 0))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (i64.store32 align=0 (i32.const 0) (i64.const 0))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (i64.store32 align=7 (i32.const 0) (i64.const 0))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (i64.store align=0 (i32.const 0) (i64.const 0))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (i64.store align=7 (i32.const 0) (i64.const 0))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (f32.store align=0 (i32.const 0) (f32.const 0))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (f32.store align=7 (i32.const 0) (f32.const 0))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (f64.store align=0 (i32.const 0) (f32.const 0))))" + ) + "alignment" +) +(assert_malformed + (module quote + "(module (memory 0) (func (f64.store align=7 (i32.const 0) (f32.const 0))))" + ) + "alignment" +) + +(assert_invalid + (module (memory 0) (func (drop (i32.load8_s align=2 (i32.const 0))))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (drop (i32.load8_u align=2 (i32.const 0))))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (drop (i32.load16_s align=4 (i32.const 0))))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (drop (i32.load16_u align=4 (i32.const 0))))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (drop (i32.load align=8 (i32.const 0))))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (drop (i64.load8_s align=2 (i32.const 0))))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (drop (i64.load8_u align=2 (i32.const 0))))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (drop (i64.load16_s align=4 (i32.const 0))))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (drop (i64.load16_u align=4 (i32.const 0))))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (drop (i64.load32_s align=8 (i32.const 0))))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (drop (i64.load32_u align=8 (i32.const 0))))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (drop (i64.load align=16 (i32.const 0))))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (drop (f32.load align=8 (i32.const 0))))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (drop (f64.load align=16 (i32.const 0))))) + "alignment must not be larger than natural" +) + +(assert_invalid + (module (memory 0) (func (drop (i32.load8_s align=2 (i32.const 0))))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (drop (i32.load8_u align=2 (i32.const 0))))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (drop (i32.load16_s align=4 (i32.const 0))))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (drop (i32.load16_u align=4 (i32.const 0))))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (drop (i32.load align=8 (i32.const 0))))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (drop (i64.load8_s align=2 (i32.const 0))))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (drop (i64.load8_u align=2 (i32.const 0))))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (drop (i64.load16_s align=4 (i32.const 0))))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (drop (i64.load16_u align=4 (i32.const 0))))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (drop (i64.load32_s align=8 (i32.const 0))))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (drop (i64.load32_u align=8 (i32.const 0))))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (drop (i64.load align=16 (i32.const 0))))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (drop (f32.load align=8 (i32.const 0))))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (drop (f64.load align=16 (i32.const 0))))) + "alignment must not be larger than natural" +) + +(assert_invalid + (module (memory 0) (func (i32.store8 align=2 (i32.const 0) (i32.const 0)))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (i32.store16 align=4 (i32.const 0) (i32.const 0)))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (i32.store align=8 (i32.const 0) (i32.const 0)))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (i64.store8 align=2 (i32.const 0) (i64.const 0)))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (i64.store16 align=4 (i32.const 0) (i64.const 0)))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (i64.store32 align=8 (i32.const 0) (i64.const 0)))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (i64.store align=16 (i32.const 0) (i64.const 0)))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (f32.store align=8 (i32.const 0) (f32.const 0)))) + "alignment must not be larger than natural" +) +(assert_invalid + (module (memory 0) (func (f64.store align=16 (i32.const 0) (f64.const 0)))) + "alignment must not be larger than natural" +) + +;; Test aligned and unaligned read/write + +(module + (memory 1) + + ;; $default: natural alignment, $1: align=1, $2: align=2, $4: align=4, $8: align=8 + + (func (export "f32_align_switch") (param i32) (result f32) + (local f32 f32) + (local.set 1 (f32.const 10.0)) + (block $4 + (block $2 + (block $1 + (block $default + (block $0 + (br_table $0 $default $1 $2 $4 (local.get 0)) + ) ;; 0 + (f32.store (i32.const 0) (local.get 1)) + (local.set 2 (f32.load (i32.const 0))) + (br $4) + ) ;; default + (f32.store align=1 (i32.const 0) (local.get 1)) + (local.set 2 (f32.load align=1 (i32.const 0))) + (br $4) + ) ;; 1 + (f32.store align=2 (i32.const 0) (local.get 1)) + (local.set 2 (f32.load align=2 (i32.const 0))) + (br $4) + ) ;; 2 + (f32.store align=4 (i32.const 0) (local.get 1)) + (local.set 2 (f32.load align=4 (i32.const 0))) + ) ;; 4 + (local.get 2) + ) + + (func (export "f64_align_switch") (param i32) (result f64) + (local f64 f64) + (local.set 1 (f64.const 10.0)) + (block $8 + (block $4 + (block $2 + (block $1 + (block $default + (block $0 + (br_table $0 $default $1 $2 $4 $8 (local.get 0)) + ) ;; 0 + (f64.store (i32.const 0) (local.get 1)) + (local.set 2 (f64.load (i32.const 0))) + (br $8) + ) ;; default + (f64.store align=1 (i32.const 0) (local.get 1)) + (local.set 2 (f64.load align=1 (i32.const 0))) + (br $8) + ) ;; 1 + (f64.store align=2 (i32.const 0) (local.get 1)) + (local.set 2 (f64.load align=2 (i32.const 0))) + (br $8) + ) ;; 2 + (f64.store align=4 (i32.const 0) (local.get 1)) + (local.set 2 (f64.load align=4 (i32.const 0))) + (br $8) + ) ;; 4 + (f64.store align=8 (i32.const 0) (local.get 1)) + (local.set 2 (f64.load align=8 (i32.const 0))) + ) ;; 8 + (local.get 2) + ) + + ;; $8s: i32/i64.load8_s, $8u: i32/i64.load8_u, $16s: i32/i64.load16_s, $16u: i32/i64.load16_u, $32: i32.load + ;; $32s: i64.load32_s, $32u: i64.load32_u, $64: i64.load + + (func (export "i32_align_switch") (param i32 i32) (result i32) + (local i32 i32) + (local.set 2 (i32.const 10)) + (block $32 + (block $16u + (block $16s + (block $8u + (block $8s + (block $0 + (br_table $0 $8s $8u $16s $16u $32 (local.get 0)) + ) ;; 0 + (if (i32.eq (local.get 1) (i32.const 0)) + (then + (i32.store8 (i32.const 0) (local.get 2)) + (local.set 3 (i32.load8_s (i32.const 0))) + ) + ) + (if (i32.eq (local.get 1) (i32.const 1)) + (then + (i32.store8 align=1 (i32.const 0) (local.get 2)) + (local.set 3 (i32.load8_s align=1 (i32.const 0))) + ) + ) + (br $32) + ) ;; 8s + (if (i32.eq (local.get 1) (i32.const 0)) + (then + (i32.store8 (i32.const 0) (local.get 2)) + (local.set 3 (i32.load8_u (i32.const 0))) + ) + ) + (if (i32.eq (local.get 1) (i32.const 1)) + (then + (i32.store8 align=1 (i32.const 0) (local.get 2)) + (local.set 3 (i32.load8_u align=1 (i32.const 0))) + ) + ) + (br $32) + ) ;; 8u + (if (i32.eq (local.get 1) (i32.const 0)) + (then + (i32.store16 (i32.const 0) (local.get 2)) + (local.set 3 (i32.load16_s (i32.const 0))) + ) + ) + (if (i32.eq (local.get 1) (i32.const 1)) + (then + (i32.store16 align=1 (i32.const 0) (local.get 2)) + (local.set 3 (i32.load16_s align=1 (i32.const 0))) + ) + ) + (if (i32.eq (local.get 1) (i32.const 2)) + (then + (i32.store16 align=2 (i32.const 0) (local.get 2)) + (local.set 3 (i32.load16_s align=2 (i32.const 0))) + ) + ) + (br $32) + ) ;; 16s + (if (i32.eq (local.get 1) (i32.const 0)) + (then + (i32.store16 (i32.const 0) (local.get 2)) + (local.set 3 (i32.load16_u (i32.const 0))) + ) + ) + (if (i32.eq (local.get 1) (i32.const 1)) + (then + (i32.store16 align=1 (i32.const 0) (local.get 2)) + (local.set 3 (i32.load16_u align=1 (i32.const 0))) + ) + ) + (if (i32.eq (local.get 1) (i32.const 2)) + (then + (i32.store16 align=2 (i32.const 0) (local.get 2)) + (local.set 3 (i32.load16_u align=2 (i32.const 0))) + ) + ) + (br $32) + ) ;; 16u + (if (i32.eq (local.get 1) (i32.const 0)) + (then + (i32.store (i32.const 0) (local.get 2)) + (local.set 3 (i32.load (i32.const 0))) + ) + ) + (if (i32.eq (local.get 1) (i32.const 1)) + (then + (i32.store align=1 (i32.const 0) (local.get 2)) + (local.set 3 (i32.load align=1 (i32.const 0))) + ) + ) + (if (i32.eq (local.get 1) (i32.const 2)) + (then + (i32.store align=2 (i32.const 0) (local.get 2)) + (local.set 3 (i32.load align=2 (i32.const 0))) + ) + ) + (if (i32.eq (local.get 1) (i32.const 4)) + (then + (i32.store align=4 (i32.const 0) (local.get 2)) + (local.set 3 (i32.load align=4 (i32.const 0))) + ) + ) + ) ;; 32 + (local.get 3) + ) + + (func (export "i64_align_switch") (param i32 i32) (result i64) + (local i64 i64) + (local.set 2 (i64.const 10)) + (block $64 + (block $32u + (block $32s + (block $16u + (block $16s + (block $8u + (block $8s + (block $0 + (br_table $0 $8s $8u $16s $16u $32s $32u $64 (local.get 0)) + ) ;; 0 + (if (i32.eq (local.get 1) (i32.const 0)) + (then + (i64.store8 (i32.const 0) (local.get 2)) + (local.set 3 (i64.load8_s (i32.const 0))) + ) + ) + (if (i32.eq (local.get 1) (i32.const 1)) + (then + (i64.store8 align=1 (i32.const 0) (local.get 2)) + (local.set 3 (i64.load8_s align=1 (i32.const 0))) + ) + ) + (br $64) + ) ;; 8s + (if (i32.eq (local.get 1) (i32.const 0)) + (then + (i64.store8 (i32.const 0) (local.get 2)) + (local.set 3 (i64.load8_u (i32.const 0))) + ) + ) + (if (i32.eq (local.get 1) (i32.const 1)) + (then + (i64.store8 align=1 (i32.const 0) (local.get 2)) + (local.set 3 (i64.load8_u align=1 (i32.const 0))) + ) + ) + (br $64) + ) ;; 8u + (if (i32.eq (local.get 1) (i32.const 0)) + (then + (i64.store16 (i32.const 0) (local.get 2)) + (local.set 3 (i64.load16_s (i32.const 0))) + ) + ) + (if (i32.eq (local.get 1) (i32.const 1)) + (then + (i64.store16 align=1 (i32.const 0) (local.get 2)) + (local.set 3 (i64.load16_s align=1 (i32.const 0))) + ) + ) + (if (i32.eq (local.get 1) (i32.const 2)) + (then + (i64.store16 align=2 (i32.const 0) (local.get 2)) + (local.set 3 (i64.load16_s align=2 (i32.const 0))) + ) + ) + (br $64) + ) ;; 16s + (if (i32.eq (local.get 1) (i32.const 0)) + (then + (i64.store16 (i32.const 0) (local.get 2)) + (local.set 3 (i64.load16_u (i32.const 0))) + ) + ) + (if (i32.eq (local.get 1) (i32.const 1)) + (then + (i64.store16 align=1 (i32.const 0) (local.get 2)) + (local.set 3 (i64.load16_u align=1 (i32.const 0))) + ) + ) + (if (i32.eq (local.get 1) (i32.const 2)) + (then + (i64.store16 align=2 (i32.const 0) (local.get 2)) + (local.set 3 (i64.load16_u align=2 (i32.const 0))) + ) + ) + (br $64) + ) ;; 16u + (if (i32.eq (local.get 1) (i32.const 0)) + (then + (i64.store32 (i32.const 0) (local.get 2)) + (local.set 3 (i64.load32_s (i32.const 0))) + ) + ) + (if (i32.eq (local.get 1) (i32.const 1)) + (then + (i64.store32 align=1 (i32.const 0) (local.get 2)) + (local.set 3 (i64.load32_s align=1 (i32.const 0))) + ) + ) + (if (i32.eq (local.get 1) (i32.const 2)) + (then + (i64.store32 align=2 (i32.const 0) (local.get 2)) + (local.set 3 (i64.load32_s align=2 (i32.const 0))) + ) + ) + (if (i32.eq (local.get 1) (i32.const 4)) + (then + (i64.store32 align=4 (i32.const 0) (local.get 2)) + (local.set 3 (i64.load32_s align=4 (i32.const 0))) + ) + ) + (br $64) + ) ;; 32s + (if (i32.eq (local.get 1) (i32.const 0)) + (then + (i64.store32 (i32.const 0) (local.get 2)) + (local.set 3 (i64.load32_u (i32.const 0))) + ) + ) + (if (i32.eq (local.get 1) (i32.const 1)) + (then + (i64.store32 align=1 (i32.const 0) (local.get 2)) + (local.set 3 (i64.load32_u align=1 (i32.const 0))) + ) + ) + (if (i32.eq (local.get 1) (i32.const 2)) + (then + (i64.store32 align=2 (i32.const 0) (local.get 2)) + (local.set 3 (i64.load32_u align=2 (i32.const 0))) + ) + ) + (if (i32.eq (local.get 1) (i32.const 4)) + (then + (i64.store32 align=4 (i32.const 0) (local.get 2)) + (local.set 3 (i64.load32_u align=4 (i32.const 0))) + ) + ) + (br $64) + ) ;; 32u + (if (i32.eq (local.get 1) (i32.const 0)) + (then + (i64.store (i32.const 0) (local.get 2)) + (local.set 3 (i64.load (i32.const 0))) + ) + ) + (if (i32.eq (local.get 1) (i32.const 1)) + (then + (i64.store align=1 (i32.const 0) (local.get 2)) + (local.set 3 (i64.load align=1 (i32.const 0))) + ) + ) + (if (i32.eq (local.get 1) (i32.const 2)) + (then + (i64.store align=2 (i32.const 0) (local.get 2)) + (local.set 3 (i64.load align=2 (i32.const 0))) + ) + ) + (if (i32.eq (local.get 1) (i32.const 4)) + (then + (i64.store align=4 (i32.const 0) (local.get 2)) + (local.set 3 (i64.load align=4 (i32.const 0))) + ) + ) + (if (i32.eq (local.get 1) (i32.const 8)) + (then + (i64.store align=8 (i32.const 0) (local.get 2)) + (local.set 3 (i64.load align=8 (i32.const 0))) + ) + ) + ) ;; 64 + (local.get 3) + ) +) + +(assert_return (invoke "f32_align_switch" (i32.const 0)) (f32.const 10.0)) +(assert_return (invoke "f32_align_switch" (i32.const 1)) (f32.const 10.0)) +(assert_return (invoke "f32_align_switch" (i32.const 2)) (f32.const 10.0)) +(assert_return (invoke "f32_align_switch" (i32.const 3)) (f32.const 10.0)) + +(assert_return (invoke "f64_align_switch" (i32.const 0)) (f64.const 10.0)) +(assert_return (invoke "f64_align_switch" (i32.const 1)) (f64.const 10.0)) +(assert_return (invoke "f64_align_switch" (i32.const 2)) (f64.const 10.0)) +(assert_return (invoke "f64_align_switch" (i32.const 3)) (f64.const 10.0)) +(assert_return (invoke "f64_align_switch" (i32.const 4)) (f64.const 10.0)) + +(assert_return (invoke "i32_align_switch" (i32.const 0) (i32.const 0)) (i32.const 10)) +(assert_return (invoke "i32_align_switch" (i32.const 0) (i32.const 1)) (i32.const 10)) +(assert_return (invoke "i32_align_switch" (i32.const 1) (i32.const 0)) (i32.const 10)) +(assert_return (invoke "i32_align_switch" (i32.const 1) (i32.const 1)) (i32.const 10)) +(assert_return (invoke "i32_align_switch" (i32.const 2) (i32.const 0)) (i32.const 10)) +(assert_return (invoke "i32_align_switch" (i32.const 2) (i32.const 1)) (i32.const 10)) +(assert_return (invoke "i32_align_switch" (i32.const 2) (i32.const 2)) (i32.const 10)) +(assert_return (invoke "i32_align_switch" (i32.const 3) (i32.const 0)) (i32.const 10)) +(assert_return (invoke "i32_align_switch" (i32.const 3) (i32.const 1)) (i32.const 10)) +(assert_return (invoke "i32_align_switch" (i32.const 3) (i32.const 2)) (i32.const 10)) +(assert_return (invoke "i32_align_switch" (i32.const 4) (i32.const 0)) (i32.const 10)) +(assert_return (invoke "i32_align_switch" (i32.const 4) (i32.const 1)) (i32.const 10)) +(assert_return (invoke "i32_align_switch" (i32.const 4) (i32.const 2)) (i32.const 10)) +(assert_return (invoke "i32_align_switch" (i32.const 4) (i32.const 4)) (i32.const 10)) + +(assert_return (invoke "i64_align_switch" (i32.const 0) (i32.const 0)) (i64.const 10)) +(assert_return (invoke "i64_align_switch" (i32.const 0) (i32.const 1)) (i64.const 10)) +(assert_return (invoke "i64_align_switch" (i32.const 1) (i32.const 0)) (i64.const 10)) +(assert_return (invoke "i64_align_switch" (i32.const 1) (i32.const 1)) (i64.const 10)) +(assert_return (invoke "i64_align_switch" (i32.const 2) (i32.const 0)) (i64.const 10)) +(assert_return (invoke "i64_align_switch" (i32.const 2) (i32.const 1)) (i64.const 10)) +(assert_return (invoke "i64_align_switch" (i32.const 2) (i32.const 2)) (i64.const 10)) +(assert_return (invoke "i64_align_switch" (i32.const 3) (i32.const 0)) (i64.const 10)) +(assert_return (invoke "i64_align_switch" (i32.const 3) (i32.const 1)) (i64.const 10)) +(assert_return (invoke "i64_align_switch" (i32.const 3) (i32.const 2)) (i64.const 10)) +(assert_return (invoke "i64_align_switch" (i32.const 4) (i32.const 0)) (i64.const 10)) +(assert_return (invoke "i64_align_switch" (i32.const 4) (i32.const 1)) (i64.const 10)) +(assert_return (invoke "i64_align_switch" (i32.const 4) (i32.const 2)) (i64.const 10)) +(assert_return (invoke "i64_align_switch" (i32.const 4) (i32.const 4)) (i64.const 10)) +(assert_return (invoke "i64_align_switch" (i32.const 5) (i32.const 0)) (i64.const 10)) +(assert_return (invoke "i64_align_switch" (i32.const 5) (i32.const 1)) (i64.const 10)) +(assert_return (invoke "i64_align_switch" (i32.const 5) (i32.const 2)) (i64.const 10)) +(assert_return (invoke "i64_align_switch" (i32.const 5) (i32.const 4)) (i64.const 10)) +(assert_return (invoke "i64_align_switch" (i32.const 6) (i32.const 0)) (i64.const 10)) +(assert_return (invoke "i64_align_switch" (i32.const 6) (i32.const 1)) (i64.const 10)) +(assert_return (invoke "i64_align_switch" (i32.const 6) (i32.const 2)) (i64.const 10)) +(assert_return (invoke "i64_align_switch" (i32.const 6) (i32.const 4)) (i64.const 10)) +(assert_return (invoke "i64_align_switch" (i32.const 6) (i32.const 8)) (i64.const 10)) + +;; Test that an i64 store with 4-byte alignment that's 4 bytes out of bounds traps without storing anything + +(module + (memory 1) + (func (export "store") (param i32 i64) + (i64.store align=4 (local.get 0) (local.get 1)) + ) + (func (export "load") (param i32) (result i32) + (i32.load (local.get 0)) + ) +) + +(assert_trap (invoke "store" (i32.const 65532) (i64.const -1)) "out of bounds memory access") +;; No memory was changed +(assert_return (invoke "load" (i32.const 65532)) (i32.const 0)) diff --git a/test/core/binary-leb128.wast b/test/core/binary-leb128.wast new file mode 100644 index 00000000..9afcb540 --- /dev/null +++ b/test/core/binary-leb128.wast @@ -0,0 +1,963 @@ +;; Unsigned LEB128 can have non-minimal length +(module binary + "\00asm" "\01\00\00\00" + "\05\04\01" ;; Memory section with 1 entry + "\00\82\00" ;; no max, minimum 2 +) +(module binary + "\00asm" "\01\00\00\00" + "\05\07\01" ;; Memory section with 1 entry + "\00\82\80\80\80\00" ;; no max, minimum 2 +) +(module binary + "\00asm" "\01\00\00\00" + "\05\06\01" ;; Memory section with 1 entry + "\01\82\00" ;; minimum 2 + "\82\00" ;; max 2 +) +(module binary + "\00asm" "\01\00\00\00" + "\05\09\01" ;; Memory section with 1 entry + "\01\82\00" ;; minimum 2 + "\82\80\80\80\00" ;; max 2 +) +(module binary + "\00asm" "\01\00\00\00" + "\05\03\01" ;; Memory section with 1 entry + "\00\00" ;; no max, minimum 0 + "\0b\07\01" ;; Data section with 1 entry + "\80\00" ;; Memory index 0, encoded with 2 bytes + "\41\00\0b\00" ;; (i32.const 0) with contents "" +) +(module binary + "\00asm" "\01\00\00\00" + "\04\04\01" ;; Table section with 1 entry + "\70\00\00" ;; no max, minimum 0, funcref + "\09\07\01" ;; Element section with 1 entry + "\80\00" ;; Table index 0, encoded with 2 bytes + "\41\00\0b\00" ;; (i32.const 0) with no elements +) +(module binary + "\00asm" "\01\00\00\00" + "\00" ;; custom section + "\8a\00" ;; section size 10, encoded with 2 bytes + "\01" ;; name byte count + "1" ;; name + "23456789" ;; sequence of bytes +) +(module binary + "\00asm" "\01\00\00\00" + "\00" ;; custom section + "\0b" ;; section size + "\88\00" ;; name byte count 8, encoded with 2 bytes + "12345678" ;; name + "9" ;; sequence of bytes +) +(module binary + "\00asm" "\01\00\00\00" + "\01\08\01" ;; type section + "\60" ;; func type + "\82\00" ;; num params 2, encoded with 2 bytes + "\7f\7e" ;; param type + "\01" ;; num results + "\7f" ;; result type +) +(module binary + "\00asm" "\01\00\00\00" + "\01\08\01" ;; type section + "\60" ;; func type + "\02" ;; num params + "\7f\7e" ;; param type + "\81\00" ;; num results 1, encoded with 2 bytes + "\7f" ;; result type +) +(module binary + "\00asm" "\01\00\00\00" + "\01\05\01" ;; type section + "\60\01\7f\00" ;; function type + "\02\17\01" ;; import section + "\88\00" ;; module name length 8, encoded with 2 bytes + "\73\70\65\63\74\65\73\74" ;; module name + "\09" ;; entity name length + "\70\72\69\6e\74\5f\69\33\32" ;; entity name + "\00" ;; import kind + "\00" ;; import signature index +) +(module binary + "\00asm" "\01\00\00\00" + "\01\05\01" ;; type section + "\60\01\7f\00" ;; function type + "\02\17\01" ;; import section + "\08" ;; module name length + "\73\70\65\63\74\65\73\74" ;; module name + "\89\00" ;; entity name length 9, encoded with 2 bytes + "\70\72\69\6e\74\5f\69\33\32" ;; entity name + "\00" ;; import kind + "\00" ;; import signature index +) +(module binary + "\00asm" "\01\00\00\00" + "\01\05\01" ;; type section + "\60\01\7f\00" ;; function type + "\02\17\01" ;; import section + "\08" ;; module name length + "\73\70\65\63\74\65\73\74" ;; module name + "\09" ;; entity name length 9 + "\70\72\69\6e\74\5f\69\33\32" ;; entity name + "\00" ;; import kind + "\80\00" ;; import signature index, encoded with 2 bytes +) +(module binary + "\00asm" "\01\00\00\00" + "\01\04\01" ;; type section + "\60\00\00" ;; function type + "\03\03\01" ;; function section + "\80\00" ;; function 0 signature index, encoded with 2 bytes + "\0a\04\01" ;; code section + "\02\00\0b" ;; function body +) +(module binary + "\00asm" "\01\00\00\00" + "\01\04\01" ;; type section + "\60\00\00" ;; fun type + "\03\02\01\00" ;; function section + "\07\07\01" ;; export section + "\82\00" ;; string length 2, encoded with 2 bytes + "\66\31" ;; export name f1 + "\00" ;; export kind + "\00" ;; export func index + "\0a\04\01" ;; code section + "\02\00\0b" ;; function body +) +(module binary + "\00asm" "\01\00\00\00" + "\01\04\01" ;; type section + "\60\00\00" ;; fun type + "\03\02\01\00" ;; function section + "\07\07\01" ;; export section + "\02" ;; string length 2 + "\66\31" ;; export name f1 + "\00" ;; export kind + "\80\00" ;; export func index, encoded with 2 bytes + "\0a\04\01" ;; code section + "\02\00\0b" ;; function body +) +(module binary + "\00asm" "\01\00\00\00" + "\01\04\01" ;; type section + "\60\00\00" ;; fun type + "\03\02\01\00" ;; function section + "\0a" ;; code section + "\05" ;; section size + "\81\00" ;; num functions, encoded with 2 bytes + "\02\00\0b" ;; function body +) + +;; Signed LEB128 can have non-minimal length +(module binary + "\00asm" "\01\00\00\00" + "\06\07\01" ;; Global section with 1 entry + "\7f\00" ;; i32, immutable + "\41\80\00" ;; i32.const 0 + "\0b" ;; end +) +(module binary + "\00asm" "\01\00\00\00" + "\06\07\01" ;; Global section with 1 entry + "\7f\00" ;; i32, immutable + "\41\ff\7f" ;; i32.const -1 + "\0b" ;; end +) +(module binary + "\00asm" "\01\00\00\00" + "\06\0a\01" ;; Global section with 1 entry + "\7f\00" ;; i32, immutable + "\41\80\80\80\80\00" ;; i32.const 0 + "\0b" ;; end +) +(module binary + "\00asm" "\01\00\00\00" + "\06\0a\01" ;; Global section with 1 entry + "\7f\00" ;; i32, immutable + "\41\ff\ff\ff\ff\7f" ;; i32.const -1 + "\0b" ;; end +) + +(module binary + "\00asm" "\01\00\00\00" + "\06\07\01" ;; Global section with 1 entry + "\7e\00" ;; i64, immutable + "\42\80\00" ;; i64.const 0 with unused bits set + "\0b" ;; end +) +(module binary + "\00asm" "\01\00\00\00" + "\06\07\01" ;; Global section with 1 entry + "\7e\00" ;; i64, immutable + "\42\ff\7f" ;; i64.const -1 with unused bits unset + "\0b" ;; end +) +(module binary + "\00asm" "\01\00\00\00" + "\06\0f\01" ;; Global section with 1 entry + "\7e\00" ;; i64, immutable + "\42\80\80\80\80\80\80\80\80\80\00" ;; i64.const 0 with unused bits set + "\0b" ;; end +) +(module binary + "\00asm" "\01\00\00\00" + "\06\0f\01" ;; Global section with 1 entry + "\7e\00" ;; i64, immutable + "\42\ff\ff\ff\ff\ff\ff\ff\ff\ff\7f" ;; i64.const -1 with unused bits unset + "\0b" ;; end +) + +;; Unsigned LEB128 must not be overlong +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\05\08\01" ;; Memory section with 1 entry + "\00\82\80\80\80\80\00" ;; no max, minimum 2 with one byte too many + ) + "integer representation too long" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\05\0a\01" ;; Memory section with 1 entry + "\01\82\00" ;; minimum 2 + "\82\80\80\80\80\00" ;; max 2 with one byte too many + ) + "integer representation too long" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\05\03\01" ;; Memory section with 1 entry + "\00\00" ;; no max, minimum 0 + "\0b\0b\01" ;; Data section with 1 entry + "\80\80\80\80\80\00" ;; Memory index 0 with one byte too many + "\41\00\0b\00" ;; (i32.const 0) with contents "" + ) + "integer representation too long" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\04\04\01" ;; Table section with 1 entry + "\70\00\00" ;; no max, minimum 0, funcref + "\09\0b\01" ;; Element section with 1 entry + "\80\80\80\80\80\00" ;; Table index 0 with one byte too many + "\41\00\0b\00" ;; (i32.const 0) with no elements + ) + "integer representation too long" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00" ;; custom section + "\83\80\80\80\80\00" ;; section size 3 with one byte too many + "\01" ;; name byte count + "1" ;; name + "2" ;; sequence of bytes + ) + "integer representation too long" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00" ;; custom section + "\0A" ;; section size + "\83\80\80\80\80\00" ;; name byte count 3 with one byte too many + "123" ;; name + "4" ;; sequence of bytes + ) + "integer representation too long" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\0c\01" ;; type section + "\60" ;; func type + "\82\80\80\80\80\00" ;; num params 2 with one byte too many + "\7f\7e" ;; param type + "\01" ;; num result + "\7f" ;; result type + ) + "integer representation too long" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\08\01" ;; type section + "\60" ;; func type + "\02" ;; num params + "\7f\7e" ;; param type + "\81\80\80\80\80\00" ;; num result 1 with one byte too many + "\7f" ;; result type + ) + "integer representation too long" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\05\01" ;; type section + "\60\01\7f\00" ;; function type + "\02\1b\01" ;; import section + "\88\80\80\80\80\00" ;; module name length 8 with one byte too many + "\73\70\65\63\74\65\73\74" ;; module name + "\09" ;; entity name length + "\70\72\69\6e\74\5f\69\33\32" ;; entity name + "\00" ;; import kind + "\00" ;; import signature index + ) + "integer representation too long" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\05\01" ;; type section + "\60\01\7f\00" ;; function type + "\02\1b\01" ;; import section + "\08" ;; module name length + "\73\70\65\63\74\65\73\74" ;; module name + "\89\80\80\80\80\00" ;; entity name length 9 with one byte too many + "\70\72\69\6e\74\5f\69\33\32" ;; entity name + "\00" ;; import kind + "\00" ;; import signature index + ) + "integer representation too long" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\05\01" ;; type section + "\60\01\7f\00" ;; function type + "\02\1b\01" ;; import section + "\08" ;; module name length + "\73\70\65\63\74\65\73\74" ;; module name + "\09" ;; entity name length 9 + "\70\72\69\6e\74\5f\69\33\32" ;; entity name + "\00" ;; import kind + "\80\80\80\80\80\00" ;; import signature index 0 with one byte too many + ) + "integer representation too long" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\04\01" ;; type section + "\60\00\00" ;; function type + "\03\03\01" ;; function section + "\80\80\80\80\80\00" ;; function 0 signature index with one byte too many + "\0a\04\01" ;; code section + "\02\00\0b" ;; function body + ) + "integer representation too long" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\04\01" ;; type section + "\60\00\00" ;; fun type + "\03\02\01\00" ;; function section + "\07\0b\01" ;; export section + "\82\80\80\80\80\00" ;; string length 2 with one byte too many + "\66\31" ;; export name f1 + "\00" ;; export kind + "\00" ;; export func index + "\0a\04\01" ;; code section + "\02\00\0b" ;; function body + ) + "integer representation too long" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\04\01" ;; type section + "\60\00\00" ;; fun type + "\03\02\01\00" ;; function section + "\07\0b\01" ;; export section + "\02" ;; string length 2 + "\66\31" ;; export name f1 + "\00" ;; export kind + "\80\80\80\80\80\00" ;; export func index 0 with one byte too many + "\0a\04\01" ;; code section + "\02\00\0b" ;; function body + ) + "integer representation too long" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\04\01" ;; type section + "\60\00\00" ;; fun type + "\03\02\01\00" ;; function section + "\0a" ;; code section + "\05" ;; section size + "\81\80\80\80\80\00" ;; num functions 1 with one byte too many + "\02\00\0b" ;; function body + ) + "integer representation too long" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\04\01\60\00\00" ;; Type section + "\03\02\01\00" ;; Function section + "\05\03\01\00\01" ;; Memory section + "\0a\11\01" ;; Code section + ;; function 0 + "\0f\01\01" ;; local type count + "\7f" ;; i32 + "\41\00" ;; i32.const 0 + "\28" ;; i32.load + "\02" ;; alignment 2 + "\82\80\80\80\80\00" ;; offset 2 with one byte too many + "\1a" ;; drop + "\0b" ;; end + ) + "integer representation too long" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\04\01\60\00\00" ;; Type section + "\03\02\01\00" ;; Function section + "\05\03\01\00\01" ;; Memory section + "\0a\11\01" ;; Code section + ;; function 0 + "\0f\01\01" ;; local type count + "\7f" ;; i32 + "\41\00" ;; i32.const 0 + "\28" ;; i32.load + "\82\80\80\80\80\00" ;; alignment 2 with one byte too many + "\00" ;; offset 0 + "\1a" ;; drop + "\0b" ;; end + ) + "integer representation too long" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\04\01\60\00\00" ;; Type section + "\03\02\01\00" ;; Function section + "\05\03\01\00\01" ;; Memory section + "\0a\12\01" ;; Code section + ;; function 0 + "\10\01\01" ;; local type count + "\7f" ;; i32 + "\41\00" ;; i32.const 0 + "\41\03" ;; i32.const 3 + "\36" ;; i32.store + "\82\80\80\80\80\00" ;; alignment 2 with one byte too many + "\03" ;; offset 3 + "\0b" ;; end + ) + "integer representation too long" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\04\01\60\00\00" ;; Type section + "\03\02\01\00" ;; Function section + "\05\03\01\00\01" ;; Memory section + "\0a\12\01" ;; Code section + ;; function 0 + "\10\01\01" ;; local type count + "\7f" ;; i32 + "\41\00" ;; i32.const 0 + "\41\03" ;; i32.const 3 + "\36" ;; i32.store + "\02" ;; alignment 2 + "\82\80\80\80\80\00" ;; offset 2 with one byte too many + "\0b" ;; end + ) + "integer representation too long" +) + +;; Signed LEB128 must not be overlong +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\06\0b\01" ;; Global section with 1 entry + "\7f\00" ;; i32, immutable + "\41\80\80\80\80\80\00" ;; i32.const 0 with one byte too many + "\0b" ;; end + ) + "integer representation too long" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\06\0b\01" ;; Global section with 1 entry + "\7f\00" ;; i32, immutable + "\41\ff\ff\ff\ff\ff\7f" ;; i32.const -1 with one byte too many + "\0b" ;; end + ) + "integer representation too long" +) + +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\06\10\01" ;; Global section with 1 entry + "\7e\00" ;; i64, immutable + "\42\80\80\80\80\80\80\80\80\80\80\00" ;; i64.const 0 with one byte too many + "\0b" ;; end + ) + "integer representation too long" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\06\10\01" ;; Global section with 1 entry + "\7e\00" ;; i64, immutable + "\42\ff\ff\ff\ff\ff\ff\ff\ff\ff\ff\7f" ;; i64.const -1 with one byte too many + "\0b" ;; end + ) + "integer representation too long" +) + +;; Unsigned LEB128s zero-extend +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\05\07\01" ;; Memory section with 1 entry + "\00\82\80\80\80\70" ;; no max, minimum 2 with unused bits set + ) + "integer too large" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\05\07\01" ;; Memory section with 1 entry + "\00\82\80\80\80\40" ;; no max, minimum 2 with some unused bits set + ) + "integer too large" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\05\09\01" ;; Memory section with 1 entry + "\01\82\00" ;; minimum 2 + "\82\80\80\80\10" ;; max 2 with unused bits set + ) + "integer too large" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\05\09\01" ;; Memory section with 1 entry + "\01\82\00" ;; minimum 2 + "\82\80\80\80\40" ;; max 2 with some unused bits set + ) + "integer too large" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\05\03\01" ;; Memory section with 1 entry + "\00\00" ;; no max, minimum 0 + "\0b\0a\01" ;; Data section with 1 entry + "\80\80\80\80\10" ;; Memory index 0 with unused bits set + "\41\00\0b\00" ;; (i32.const 0) with contents "" + ) + "integer too large" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\04\04\01" ;; Table section with 1 entry + "\70\00\00" ;; no max, minimum 0, funcref + "\09\0a\01" ;; Element section with 1 entry + "\80\80\80\80\10" ;; Table index 0 with unused bits set + "\41\00\0b\00" ;; (i32.const 0) with no elements + ) + "integer too large" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00" ;; custom section + "\83\80\80\80\10" ;; section size 3 with unused bits set + "\01" ;; name byte count + "1" ;; name + "2" ;; sequence of bytes + ) + "integer too large" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00" ;; custom section + "\09" ;; section size + "\83\80\80\80\40" ;; name byte count 3 with unused bits set + "123" ;; name + "4" ;; sequence of bytes + ) + "integer too large" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\0b\01" ;; type section + "\60" ;; func type + "\82\80\80\80\10" ;; num params 2 with unused bits set + "\7f\7e" ;; param type + "\01" ;; num result + "\7f" ;; result type + ) + "integer too large" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\0b\01" ;; type section + "\60" ;; func type + "\02" ;; num params + "\7f\7e" ;; param type + "\81\80\80\80\40" ;; num result 1 with unused bits set + "\7f" ;; result type + ) + "integer too large" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\05\01" ;; type section + "\60\01\7f\00" ;; function type + "\02\1a\01" ;; import section + "\88\80\80\80\10" ;; module name length 8 with unused bits set + "\73\70\65\63\74\65\73\74" ;; module name + "\09" ;; entity name length + "\70\72\69\6e\74\5f\69\33\32" ;; entity name + "\00" ;; import kind + "\00" ;; import signature index + ) + "integer too large" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\05\01" ;; type section + "\60\01\7f\00" ;; function type + "\02\1a\01" ;; import section + "\08" ;; module name length + "\73\70\65\63\74\65\73\74" ;; module name + "\89\80\80\80\40" ;; entity name length 9 with unused bits set + "\70\72\69\6e\74\5f\69\33\32" ;; entity name + "\00" ;; import kind + "\00" ;; import signature index + ) + "integer too large" +) +(assert_malformed +(module binary + "\00asm" "\01\00\00\00" + "\01\05\01" ;; type section + "\60\01\7f\00" ;; function type + "\02\1a\01" ;; import section + "\08" ;; module name length + "\73\70\65\63\74\65\73\74" ;; module name + "\09" ;; entity name length 9 + "\70\72\69\6e\74\5f\69\33\32" ;; entity name + "\00" ;; import kind + "\80\80\80\80\10" ;; import signature index 0 with unused bits set +) + "integer too large" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\04\01" ;; type section + "\60\00\00" ;; function type + "\03\06\01" ;; function section + "\80\80\80\80\10" ;; function 0 signature index with unused bits set + "\0a\04\01" ;; code section + "\02\00\0b" ;; function body + ) + "integer too large" +) + +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\04\01" ;; type section + "\60\00\00" ;; fun type + "\03\02\01\00" ;; function section + "\07\0a\01" ;; export section + "\82\80\80\80\10" ;; string length 2 with unused bits set + "\66\31" ;; export name f1 + "\00" ;; export kind + "\00" ;; export func index + "\0a\04\01" ;; code section + "\02\00\0b" ;; function body + ) + "integer too large" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\04\01" ;; type section + "\60\00\00" ;; fun type + "\03\02\01\00" ;; function section + "\07\0a\01" ;; export section + "\02" ;; string length 2 + "\66\31" ;; export name f1 + "\00" ;; export kind + "\80\80\80\80\10" ;; export func index with unused bits set + "\0a\04\01" ;; code section + "\02\00\0b" ;; function body + ) + "integer too large" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\04\01" ;; type section + "\60\00\00" ;; fun type + "\03\02\01\00" ;; function section + "\0a" ;; code section + "\08" ;; section size + "\81\80\80\80\10" ;; num functions 1 with unused bits set + "\02\00\0b" ;; function body + ) + "integer too large" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\04\01\60\00\00" ;; Type section + "\03\02\01\00" ;; Function section + "\05\03\01\00\01" ;; Memory section + "\0a\10\01" ;; Code section + ;; function 0 + "\0e\01\01" ;; local type count + "\7f" ;; i32 + "\41\00" ;; i32.const 0 + "\28" ;; i32.load + "\02" ;; alignment 2 + "\82\80\80\80\10" ;; offset 2 with unused bits set + "\1a" ;; drop + "\0b" ;; end + ) + "integer too large" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\04\01\60\00\00" ;; Type section + "\03\02\01\00" ;; Function section + "\05\03\01\00\01" ;; Memory section + "\0a\10\01" ;; Code section + ;; function 0 + "\0e\01\01" ;; local type count + "\7f" ;; i32 + "\41\00" ;; i32.const 0 + "\28" ;; i32.load + "\02" ;; alignment 2 + "\82\80\80\80\40" ;; offset 2 with some unused bits set + "\1a" ;; drop + "\0b" ;; end + ) + "integer too large" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\04\01\60\00\00" ;; Type section + "\03\02\01\00" ;; Function section + "\05\03\01\00\01" ;; Memory section + "\0a\10\01" ;; Code section + "\0e\01\01" ;; local type count + "\7f" ;; i32 + "\41\00" ;; i32.const 0 + "\28" ;; i32.load + "\82\80\80\80\10" ;; alignment 2 with unused bits set + "\00" ;; offset 0 + "\1a" ;; drop + "\0b" ;; end + ) + "integer too large" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\04\01\60\00\00" ;; Type section + "\03\02\01\00" ;; Function section + "\05\03\01\00\01" ;; Memory section + "\0a\10\01" ;; Code section + ;; function 0 + "\0e\01\01" ;; local type count + "\7f" ;; i32 + "\41\00" ;; i32.const 0 + "\28" ;; i32.load + "\82\80\80\80\40" ;; alignment 2 with some unused bits set + "\00" ;; offset 0 + "\1a" ;; drop + "\0b" ;; end + ) + "integer too large" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\04\01\60\00\00" ;; Type section + "\03\02\01\00" ;; Function section + "\05\03\01\00\01" ;; Memory section + "\0a\11\01" ;; Code section + ;; function 0 + "\0f\01\01" ;; local type count + "\7f" ;; i32 + "\41\00" ;; i32.const 0 + "\41\03" ;; i32.const 3 + "\36" ;; i32.store + "\82\80\80\80\10" ;; alignment 2 with unused bits set + "\03" ;; offset 3 + "\0b" ;; end + ) + "integer too large" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\04\01\60\00\00" ;; Type section + "\03\02\01\00" ;; Function section + "\05\03\01\00\01" ;; Memory section + "\0a\11\01" ;; Code section + ;; function 0 + "\0f\01\01" ;; local type count + "\7f" ;; i32 + "\41\00" ;; i32.const 0 + "\41\03" ;; i32.const 3 + "\36" ;; i32.store + "\82\80\80\80\40" ;; alignment 2 with some unused bits set + "\03" ;; offset 3 + "\0b" ;; end + ) + "integer too large" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\04\01\60\00\00" ;; Type section + "\03\02\01\00" ;; Function section + "\05\03\01\00\01" ;; Memory section + "\0a\11\01" ;; Code section + ;; function 0 + "\0f\01\01" ;; local type count + "\7f" ;; i32 + "\41\00" ;; i32.const 0 + "\41\03" ;; i32.const 3 + "\36" ;; i32.store + "\03" ;; alignment 2 + "\82\80\80\80\10" ;; offset 2 with unused bits set + "\0b" ;; end + ) + "integer too large" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\04\01\60\00\00" ;; Type section + "\03\02\01\00" ;; Function section + "\05\03\01\00\01" ;; Memory section + "\0a\11\01" ;; Code section + + ;; function 0 + "\0f\01\01" ;; local type count + "\7f" ;; i32 + "\41\00" ;; i32.const 0 + "\41\03" ;; i32.const 3 + "\36" ;; i32.store + "\02" ;; alignment 2 + "\82\80\80\80\40" ;; offset 2 with some unused bits set + "\0b" ;; end + ) + "integer too large" +) + +;; Signed LEB128s sign-extend +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\06\0a\01" ;; Global section with 1 entry + "\7f\00" ;; i32, immutable + "\41\80\80\80\80\70" ;; i32.const 0 with unused bits set + "\0b" ;; end + ) + "integer too large" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\06\0a\01" ;; Global section with 1 entry + "\7f\00" ;; i32, immutable + "\41\ff\ff\ff\ff\0f" ;; i32.const -1 with unused bits unset + "\0b" ;; end + ) + "integer too large" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\06\0a\01" ;; Global section with 1 entry + "\7f\00" ;; i32, immutable + "\41\80\80\80\80\1f" ;; i32.const 0 with some unused bits set + "\0b" ;; end + ) + "integer too large" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\06\0a\01" ;; Global section with 1 entry + "\7f\00" ;; i32, immutable + "\41\ff\ff\ff\ff\4f" ;; i32.const -1 with some unused bits unset + "\0b" ;; end + ) + "integer too large" +) + +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\06\0f\01" ;; Global section with 1 entry + "\7e\00" ;; i64, immutable + "\42\80\80\80\80\80\80\80\80\80\7e" ;; i64.const 0 with unused bits set + "\0b" ;; end + ) + "integer too large" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\06\0f\01" ;; Global section with 1 entry + "\7e\00" ;; i64, immutable + "\42\ff\ff\ff\ff\ff\ff\ff\ff\ff\01" ;; i64.const -1 with unused bits unset + "\0b" ;; end + ) + "integer too large" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\06\0f\01" ;; Global section with 1 entry + "\7e\00" ;; i64, immutable + "\42\80\80\80\80\80\80\80\80\80\02" ;; i64.const 0 with some unused bits set + "\0b" ;; end + ) + "integer too large" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\06\0f\01" ;; Global section with 1 entry + "\7e\00" ;; i64, immutable + "\42\ff\ff\ff\ff\ff\ff\ff\ff\ff\41" ;; i64.const -1 with some unused bits unset + "\0b" ;; end + ) + "integer too large" +) diff --git a/test/core/binary.wast b/test/core/binary.wast index 39022396..9f27273e 100644 --- a/test/core/binary.wast +++ b/test/core/binary.wast @@ -1,19 +1,1198 @@ -(module "\00asm\01\00\00\00") -(module "\00asm" "\01\00\00\00") -(module $M1 "\00asm\01\00\00\00") -(module $M2 "\00asm" "\01\00\00\00") - -(assert_malformed (module "") "unexpected end") -(assert_malformed (module "\01") "unexpected end") -(assert_malformed (module "\00as") "unexpected end") -(assert_malformed (module "asm\00") "magic header not detected") -(assert_malformed (module "msa\00") "magic header not detected") -(assert_malformed (module "msa\00\01\00\00\00") "magic header not detected") -(assert_malformed (module "msa\00\00\00\00\01") "magic header not detected") - -(assert_malformed (module "\00asm") "unexpected end") -(assert_malformed (module "\00asm\01") "unexpected end") -(assert_malformed (module "\00asm\01\00\00") "unexpected end") -(assert_malformed (module "\00asm\0d\00\00\00") "unknown binary version") -(assert_malformed (module "\00asm\0e\00\00\00") "unknown binary version") -(assert_malformed (module "\00asm\00\00\00\01") "unknown binary version") +(module binary "\00asm\01\00\00\00") +(module binary "\00asm" "\01\00\00\00") +(module $M1 binary "\00asm\01\00\00\00") +(module $M2 binary "\00asm" "\01\00\00\00") + +(assert_malformed (module binary "") "unexpected end") +(assert_malformed (module binary "\01") "unexpected end") +(assert_malformed (module binary "\00as") "unexpected end") +(assert_malformed (module binary "asm\00") "magic header not detected") +(assert_malformed (module binary "msa\00") "magic header not detected") +(assert_malformed (module binary "msa\00\01\00\00\00") "magic header not detected") +(assert_malformed (module binary "msa\00\00\00\00\01") "magic header not detected") +(assert_malformed (module binary "asm\01\00\00\00\00") "magic header not detected") +(assert_malformed (module binary "wasm\01\00\00\00") "magic header not detected") +(assert_malformed (module binary "\7fasm\01\00\00\00") "magic header not detected") +(assert_malformed (module binary "\80asm\01\00\00\00") "magic header not detected") +(assert_malformed (module binary "\82asm\01\00\00\00") "magic header not detected") +(assert_malformed (module binary "\ffasm\01\00\00\00") "magic header not detected") + +;; 8-byte endian-reversed. +(assert_malformed (module binary "\00\00\00\01msa\00") "magic header not detected") + +;; Middle-endian byte orderings. +(assert_malformed (module binary "a\00ms\00\01\00\00") "magic header not detected") +(assert_malformed (module binary "sm\00a\00\00\01\00") "magic header not detected") + +;; Upper-cased. +(assert_malformed (module binary "\00ASM\01\00\00\00") "magic header not detected") + +;; EBCDIC-encoded magic. +(assert_malformed (module binary "\00\81\a2\94\01\00\00\00") "magic header not detected") + +;; Leading UTF-8 BOM. +(assert_malformed (module binary "\ef\bb\bf\00asm\01\00\00\00") "magic header not detected") + +;; Malformed binary version. +(assert_malformed (module binary "\00asm") "unexpected end") +(assert_malformed (module binary "\00asm\01") "unexpected end") +(assert_malformed (module binary "\00asm\01\00\00") "unexpected end") +(assert_malformed (module binary "\00asm\00\00\00\00") "unknown binary version") +(assert_malformed (module binary "\00asm\0d\00\00\00") "unknown binary version") +(assert_malformed (module binary "\00asm\0e\00\00\00") "unknown binary version") +(assert_malformed (module binary "\00asm\00\01\00\00") "unknown binary version") +(assert_malformed (module binary "\00asm\00\00\01\00") "unknown binary version") +(assert_malformed (module binary "\00asm\00\00\00\01") "unknown binary version") + +;; Unsigned LEB128 can have non-minimal length +(module binary + "\00asm" "\01\00\00\00" + "\05\04\01" ;; Memory section with 1 entry + "\00\82\00" ;; no max, minimum 2 +) +(module binary + "\00asm" "\01\00\00\00" + "\05\07\01" ;; Memory section with 1 entry + "\00\82\80\80\80\00" ;; no max, minimum 2 +) + +;; Signed LEB128 can have non-minimal length +(module binary + "\00asm" "\01\00\00\00" + "\06\07\01" ;; Global section with 1 entry + "\7f\00" ;; i32, immutable + "\41\80\00" ;; i32.const 0 + "\0b" ;; end +) +(module binary + "\00asm" "\01\00\00\00" + "\06\07\01" ;; Global section with 1 entry + "\7f\00" ;; i32, immutable + "\41\ff\7f" ;; i32.const -1 + "\0b" ;; end +) +(module binary + "\00asm" "\01\00\00\00" + "\06\0a\01" ;; Global section with 1 entry + "\7f\00" ;; i32, immutable + "\41\80\80\80\80\00" ;; i32.const 0 + "\0b" ;; end +) +(module binary + "\00asm" "\01\00\00\00" + "\06\0a\01" ;; Global section with 1 entry + "\7f\00" ;; i32, immutable + "\41\ff\ff\ff\ff\7f" ;; i32.const -1 + "\0b" ;; end +) + +(module binary + "\00asm" "\01\00\00\00" + "\06\07\01" ;; Global section with 1 entry + "\7e\00" ;; i64, immutable + "\42\80\00" ;; i64.const 0 with unused bits set + "\0b" ;; end +) +(module binary + "\00asm" "\01\00\00\00" + "\06\07\01" ;; Global section with 1 entry + "\7e\00" ;; i64, immutable + "\42\ff\7f" ;; i64.const -1 with unused bits unset + "\0b" ;; end +) +(module binary + "\00asm" "\01\00\00\00" + "\06\0f\01" ;; Global section with 1 entry + "\7e\00" ;; i64, immutable + "\42\80\80\80\80\80\80\80\80\80\00" ;; i64.const 0 with unused bits set + "\0b" ;; end +) +(module binary + "\00asm" "\01\00\00\00" + "\06\0f\01" ;; Global section with 1 entry + "\7e\00" ;; i64, immutable + "\42\ff\ff\ff\ff\ff\ff\ff\ff\ff\7f" ;; i64.const -1 with unused bits unset + "\0b" ;; end +) + +(module binary + "\00asm" "\01\00\00\00" + "\05\03\01" ;; Memory section with 1 entry + "\00\00" ;; no max, minimum 0 + "\0b\06\01" ;; Data section with 1 entry + "\00" ;; Memory index 0 + "\41\00\0b\00" ;; (i32.const 0) with contents "" +) + +(module binary + "\00asm" "\01\00\00\00" + "\04\04\01" ;; Table section with 1 entry + "\70\00\00" ;; no max, minimum 0, funcref + "\09\06\01" ;; Element section with 1 entry + "\00" ;; Table index 0 + "\41\00\0b\00" ;; (i32.const 0) with no elements +) + +;; Element segment table index can have non-minimal length +(module binary + "\00asm" "\01\00\00\00" + "\04\04\01" ;; Table section with 1 entry + "\70\00\00" ;; no max, minimum 0, funcref + "\09\09\01" ;; Element section with 1 entry + "\02\80\00" ;; Table index 0, encoded with 2 bytes + "\41\00\0b\00\00" ;; (i32.const 0) with no elements +) + +;; Unsigned LEB128 must not be overlong +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\05\08\01" ;; Memory section with 1 entry + "\00\82\80\80\80\80\00" ;; no max, minimum 2 with one byte too many + ) + "integer representation too long" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\04\01\60\00\00" ;; Type section + "\03\02\01\00" ;; Function section + "\05\03\01\00\01" ;; Memory section + "\0a\11\01" ;; Code section + ;; function 0 + "\0f\01\01" ;; local type count + "\7f" ;; i32 + "\41\00" ;; i32.const 0 + "\28" ;; i32.load + "\02" ;; alignment 2 + "\82\80\80\80\80\00" ;; offset 2 with one byte too many + "\1a" ;; drop + "\0b" ;; end + ) + "integer representation too long" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\04\01\60\00\00" ;; Type section + "\03\02\01\00" ;; Function section + "\05\03\01\00\01" ;; Memory section + "\0a\11\01" ;; Code section + ;; function 0 + "\0f\01\01" ;; local type count + "\7f" ;; i32 + "\41\00" ;; i32.const 0 + "\28" ;; i32.load + "\82\80\80\80\80\00" ;; alignment 2 with one byte too many + "\00" ;; offset 0 + "\1a" ;; drop + "\0b" ;; end + ) + "integer representation too long" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\04\01\60\00\00" ;; Type section + "\03\02\01\00" ;; Function section + "\05\03\01\00\01" ;; Memory section + "\0a\12\01" ;; Code section + ;; function 0 + "\10\01\01" ;; local type count + "\7f" ;; i32 + "\41\00" ;; i32.const 0 + "\41\03" ;; i32.const 3 + "\36" ;; i32.store + "\82\80\80\80\80\00" ;; alignment 2 with one byte too many + "\03" ;; offset 3 + "\0b" ;; end + ) + "integer representation too long" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\04\01\60\00\00" ;; Type section + "\03\02\01\00" ;; Function section + "\05\03\01\00\01" ;; Memory section + "\0a\12\01" ;; Code section + ;; function 0 + "\10\01\01" ;; local type count + "\7f" ;; i32 + "\41\00" ;; i32.const 0 + "\41\03" ;; i32.const 3 + "\36" ;; i32.store + "\02" ;; alignment 2 + "\82\80\80\80\80\00" ;; offset 2 with one byte too many + "\0b" ;; end + ) + "integer representation too long" +) + +;; Signed LEB128 must not be overlong +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\06\0b\01" ;; Global section with 1 entry + "\7f\00" ;; i32, immutable + "\41\80\80\80\80\80\00" ;; i32.const 0 with one byte too many + "\0b" ;; end + ) + "integer representation too long" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\06\0b\01" ;; Global section with 1 entry + "\7f\00" ;; i32, immutable + "\41\ff\ff\ff\ff\ff\7f" ;; i32.const -1 with one byte too many + "\0b" ;; end + ) + "integer representation too long" +) + +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\06\10\01" ;; Global section with 1 entry + "\7e\00" ;; i64, immutable + "\42\80\80\80\80\80\80\80\80\80\80\00" ;; i64.const 0 with one byte too many + "\0b" ;; end + ) + "integer representation too long" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\06\10\01" ;; Global section with 1 entry + "\7e\00" ;; i64, immutable + "\42\ff\ff\ff\ff\ff\ff\ff\ff\ff\ff\7f" ;; i64.const -1 with one byte too many + "\0b" ;; end + ) + "integer representation too long" +) + +;; Unsigned LEB128s zero-extend +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\05\07\01" ;; Memory section with 1 entry + "\00\82\80\80\80\70" ;; no max, minimum 2 with unused bits set + ) + "integer too large" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\05\07\01" ;; Memory section with 1 entry + "\00\82\80\80\80\40" ;; no max, minimum 2 with some unused bits set + ) + "integer too large" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\04\01\60\00\00" ;; Type section + "\03\02\01\00" ;; Function section + "\05\03\01\00\01" ;; Memory section + "\0a\10\01" ;; Code section + ;; function 0 + "\0e\01\01" ;; local type count + "\7f" ;; i32 + "\41\00" ;; i32.const 0 + "\28" ;; i32.load + "\02" ;; alignment 2 + "\82\80\80\80\10" ;; offset 2 with unused bits set + "\1a" ;; drop + "\0b" ;; end + ) + "integer too large" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\04\01\60\00\00" ;; Type section + "\03\02\01\00" ;; Function section + "\05\03\01\00\01" ;; Memory section + "\0a\10\01" ;; Code section + ;; function 0 + "\0e\01\01" ;; local type count + "\7f" ;; i32 + "\41\00" ;; i32.const 0 + "\28" ;; i32.load + "\02" ;; alignment 2 + "\82\80\80\80\40" ;; offset 2 with some unused bits set + "\1a" ;; drop + "\0b" ;; end + ) + "integer too large" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\04\01\60\00\00" ;; Type section + "\03\02\01\00" ;; Function section + "\05\03\01\00\01" ;; Memory section + "\0a\10\01" ;; Code section + "\0e\01\01" ;; local type count + "\7f" ;; i32 + "\41\00" ;; i32.const 0 + "\28" ;; i32.load + "\82\80\80\80\10" ;; alignment 2 with unused bits set + "\00" ;; offset 0 + "\1a" ;; drop + "\0b" ;; end + ) + "integer too large" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\04\01\60\00\00" ;; Type section + "\03\02\01\00" ;; Function section + "\05\03\01\00\01" ;; Memory section + "\0a\10\01" ;; Code section + ;; function 0 + "\0e\01\01" ;; local type count + "\7f" ;; i32 + "\41\00" ;; i32.const 0 + "\28" ;; i32.load + "\82\80\80\80\40" ;; alignment 2 with some unused bits set + "\00" ;; offset 0 + "\1a" ;; drop + "\0b" ;; end + ) + "integer too large" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\04\01\60\00\00" ;; Type section + "\03\02\01\00" ;; Function section + "\05\03\01\00\01" ;; Memory section + "\0a\11\01" ;; Code section + ;; function 0 + "\0f\01\01" ;; local type count + "\7f" ;; i32 + "\41\00" ;; i32.const 0 + "\41\03" ;; i32.const 3 + "\36" ;; i32.store + "\82\80\80\80\10" ;; alignment 2 with unused bits set + "\03" ;; offset 3 + "\0b" ;; end + ) + "integer too large" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\04\01\60\00\00" ;; Type section + "\03\02\01\00" ;; Function section + "\05\03\01\00\01" ;; Memory section + "\0a\11\01" ;; Code section + ;; function 0 + "\0f\01\01" ;; local type count + "\7f" ;; i32 + "\41\00" ;; i32.const 0 + "\41\03" ;; i32.const 3 + "\36" ;; i32.store + "\82\80\80\80\40" ;; alignment 2 with some unused bits set + "\03" ;; offset 3 + "\0b" ;; end + ) + "integer too large" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\04\01\60\00\00" ;; Type section + "\03\02\01\00" ;; Function section + "\05\03\01\00\01" ;; Memory section + "\0a\11\01" ;; Code section + ;; function 0 + "\0f\01\01" ;; local type count + "\7f" ;; i32 + "\41\00" ;; i32.const 0 + "\41\03" ;; i32.const 3 + "\36" ;; i32.store + "\03" ;; alignment 2 + "\82\80\80\80\10" ;; offset 2 with unused bits set + "\0b" ;; end + ) + "integer too large" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\04\01\60\00\00" ;; Type section + "\03\02\01\00" ;; Function section + "\05\03\01\00\01" ;; Memory section + "\0a\11\01" ;; Code section + + ;; function 0 + "\0f\01\01" ;; local type count + "\7f" ;; i32 + "\41\00" ;; i32.const 0 + "\41\03" ;; i32.const 3 + "\36" ;; i32.store + "\02" ;; alignment 2 + "\82\80\80\80\40" ;; offset 2 with some unused bits set + "\0b" ;; end + ) + "integer too large" +) + +;; Signed LEB128s sign-extend +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\06\0a\01" ;; Global section with 1 entry + "\7f\00" ;; i32, immutable + "\41\80\80\80\80\70" ;; i32.const 0 with unused bits set + "\0b" ;; end + ) + "integer too large" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\06\0a\01" ;; Global section with 1 entry + "\7f\00" ;; i32, immutable + "\41\ff\ff\ff\ff\0f" ;; i32.const -1 with unused bits unset + "\0b" ;; end + ) + "integer too large" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\06\0a\01" ;; Global section with 1 entry + "\7f\00" ;; i32, immutable + "\41\80\80\80\80\1f" ;; i32.const 0 with some unused bits set + "\0b" ;; end + ) + "integer too large" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\06\0a\01" ;; Global section with 1 entry + "\7f\00" ;; i32, immutable + "\41\ff\ff\ff\ff\4f" ;; i32.const -1 with some unused bits unset + "\0b" ;; end + ) + "integer too large" +) + +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\06\0f\01" ;; Global section with 1 entry + "\7e\00" ;; i64, immutable + "\42\80\80\80\80\80\80\80\80\80\7e" ;; i64.const 0 with unused bits set + "\0b" ;; end + ) + "integer too large" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\06\0f\01" ;; Global section with 1 entry + "\7e\00" ;; i64, immutable + "\42\ff\ff\ff\ff\ff\ff\ff\ff\ff\01" ;; i64.const -1 with unused bits unset + "\0b" ;; end + ) + "integer too large" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\06\0f\01" ;; Global section with 1 entry + "\7e\00" ;; i64, immutable + "\42\80\80\80\80\80\80\80\80\80\02" ;; i64.const 0 with some unused bits set + "\0b" ;; end + ) + "integer too large" +) +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\06\0f\01" ;; Global section with 1 entry + "\7e\00" ;; i64, immutable + "\42\ff\ff\ff\ff\ff\ff\ff\ff\ff\41" ;; i64.const -1 with some unused bits unset + "\0b" ;; end + ) + "integer too large" +) + +;; memory.grow reserved byte equal to zero. +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\04\01\60\00\00" ;; Type section + "\03\02\01\00" ;; Function section + "\05\03\01\00\00" ;; Memory section + "\0a\09\01" ;; Code section + + ;; function 0 + "\07\00" + "\41\00" ;; i32.const 0 + "\40" ;; memory.grow + "\01" ;; memory.grow reserved byte is not equal to zero! + "\1a" ;; drop + "\0b" ;; end + ) + "zero flag expected" +) + +;; memory.grow reserved byte should not be a "long" LEB128 zero. +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\04\01\60\00\00" ;; Type section + "\03\02\01\00" ;; Function section + "\05\03\01\00\00" ;; Memory section + "\0a\0a\01" ;; Code section + + ;; function 0 + "\08\00" + "\41\00" ;; i32.const 0 + "\40" ;; memory.grow + "\80\00" ;; memory.grow reserved byte + "\1a" ;; drop + "\0b" ;; end + ) + "zero flag expected" +) + +;; Same as above for 3, 4, and 5-byte zero encodings. +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\04\01\60\00\00" ;; Type section + "\03\02\01\00" ;; Function section + "\05\03\01\00\00" ;; Memory section + "\0a\0b\01" ;; Code section + + ;; function 0 + "\09\00" + "\41\00" ;; i32.const 0 + "\40" ;; memory.grow + "\80\80\00" ;; memory.grow reserved byte + "\1a" ;; drop + "\0b" ;; end + ) + "zero flag expected" +) + +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\04\01\60\00\00" ;; Type section + "\03\02\01\00" ;; Function section + "\05\03\01\00\00" ;; Memory section + "\0a\0c\01" ;; Code section + + ;; function 0 + "\0a\00" + "\41\00" ;; i32.const 0 + "\40" ;; memory.grow + "\80\80\80\00" ;; memory.grow reserved byte + "\1a" ;; drop + "\0b" ;; end + ) + "zero flag expected" +) + +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\04\01\60\00\00" ;; Type section + "\03\02\01\00" ;; Function section + "\05\03\01\00\00" ;; Memory section + "\0a\0d\01" ;; Code section + + ;; function 0 + "\0b\00" + "\41\00" ;; i32.const 0 + "\40" ;; memory.grow + "\80\80\80\80\00" ;; memory.grow reserved byte + "\1a" ;; drop + "\0b" ;; end + ) + "zero flag expected" +) + +;; memory.size reserved byte equal to zero. +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\04\01\60\00\00" ;; Type section + "\03\02\01\00" ;; Function section + "\05\03\01\00\00" ;; Memory section + "\0a\07\01" ;; Code section + + ;; function 0 + "\05\00" + "\3f" ;; memory.size + "\01" ;; memory.size reserved byte is not equal to zero! + "\1a" ;; drop + "\0b" ;; end + ) + "zero flag expected" +) + +;; memory.size reserved byte should not be a "long" LEB128 zero. +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\04\01\60\00\00" ;; Type section + "\03\02\01\00" ;; Function section + "\05\03\01\00\00" ;; Memory section + "\0a\08\01" ;; Code section + + ;; function 0 + "\06\00" + "\3f" ;; memory.size + "\80\00" ;; memory.size reserved byte + "\1a" ;; drop + "\0b" ;; end + ) + "zero flag expected" +) + +;; Same as above for 3, 4, and 5-byte zero encodings. +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\04\01\60\00\00" ;; Type section + "\03\02\01\00" ;; Function section + "\05\03\01\00\00" ;; Memory section + "\0a\09\01" ;; Code section + + ;; function 0 + "\07\00" + "\3f" ;; memory.size + "\80\80\00" ;; memory.size reserved byte + "\1a" ;; drop + "\0b" ;; end + ) + "zero flag expected" +) + +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\04\01\60\00\00" ;; Type section + "\03\02\01\00" ;; Function section + "\05\03\01\00\00" ;; Memory section + "\0a\0a\01" ;; Code section + + ;; function 0 + "\08\00" + "\3f" ;; memory.size + "\80\80\80\00" ;; memory.size reserved byte + "\1a" ;; drop + "\0b" ;; end + ) + "zero flag expected" +) + +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\04\01\60\00\00" ;; Type section + "\03\02\01\00" ;; Function section + "\05\03\01\00\00" ;; Memory section + "\0a\0b\01" ;; Code section + + ;; function 0 + "\09\00" + "\3f" ;; memory.size + "\80\80\80\80\00" ;; memory.size reserved byte + "\1a" ;; drop + "\0b" ;; end + ) + "zero flag expected" +) + +;; No more than 2^32 locals. +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\04\01\60\00\00" ;; Type section + "\03\02\01\00" ;; Function section + "\0a\0c\01" ;; Code section + + ;; function 0 + "\0a\02" + "\ff\ff\ff\ff\0f\7f" ;; 0xFFFFFFFF i32 + "\02\7e" ;; 0x00000002 i64 + "\0b" ;; end + ) + "too many locals" +) + +;; Local count can be 0. +(module binary + "\00asm" "\01\00\00\00" + "\01\04\01\60\00\00" ;; Type section + "\03\02\01\00" ;; Function section + "\0a\0a\01" ;; Code section + + ;; function 0 + "\08\03" + "\00\7f" ;; 0 i32 + "\00\7e" ;; 0 i64 + "\02\7d" ;; 2 f32 + "\0b" ;; end +) + +;; Function section has non-zero count, but code section is absent. +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\04\01\60\00\00" ;; Type section + "\03\03\02\00\00" ;; Function section with 2 functions + ) + "function and code section have inconsistent lengths" +) + +;; Code section has non-zero count, but function section is absent. +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\0a\04\01\02\00\0b" ;; Code section with 1 empty function + ) + "function and code section have inconsistent lengths" +) + +;; Function section count > code section count +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\04\01\60\00\00" ;; Type section + "\03\03\02\00\00" ;; Function section with 2 functions + "\0a\04\01\02\00\0b" ;; Code section with 1 empty function + ) + "function and code section have inconsistent lengths" +) + +;; Function section count < code section count +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\04\01\60\00\00" ;; Type section + "\03\02\01\00" ;; Function section with 1 function + "\0a\07\02\02\00\0b\02\00\0b" ;; Code section with 2 empty functions + ) + "function and code section have inconsistent lengths" +) + +;; Function section has zero count, and code section is absent. +(module binary + "\00asm" "\01\00\00\00" + "\03\01\00" ;; Function section with 0 functions +) + +;; Code section has zero count, and function section is absent. +(module binary + "\00asm" "\01\00\00\00" + "\0a\01\00" ;; Code section with 0 functions +) + +;; Type count can be zero +(module binary + "\00asm" "\01\00\00\00" + "\01\01\00" ;; type count can be zero +) + +;; 2 type declared, 1 given +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\07\02" ;; type section with inconsistent count (2 declared, 1 given) + "\60\00\00" ;; 1st type + ;; "\60\00\00" ;; 2nd type (missed) + ) + "unexpected end of section or function" +) + +;; 1 type declared, 2 given +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\07\01" ;; type section with inconsistent count (1 declared, 2 given) + "\60\00\00" ;; 1st type + "\60\00\00" ;; 2nd type (redundant) + ) + "section size mismatch" +) + +;; Import count can be zero +(module binary + "\00asm" "\01\00\00\00" + "\01\05\01" ;; type section + "\60\01\7f\00" ;; type 0 + "\02\01\00" ;; import count can be zero +) + +;; 2 import declared, 1 given +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\05\01" ;; type section + "\60\01\7f\00" ;; type 0 + "\02\16\02" ;; import section with inconsistent count (2 declared, 1 given) + ;; 1st import + "\08" ;; string length + "\73\70\65\63\74\65\73\74" ;; spectest + "\09" ;; string length + "\70\72\69\6e\74\5f\69\33\32" ;; print_i32 + "\00\00" ;; import kind, import signature index + ;; 2nd import + ;; (missed) + ) + "unexpected end of section or function" +) + +;; 1 import declared, 2 given +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\09\02" ;; type section + "\60\01\7f\00" ;; type 0 + "\60\01\7d\00" ;; type 1 + "\02\2b\01" ;; import section with inconsistent count (1 declared, 2 given) + ;; 1st import + "\08" ;; string length + "\73\70\65\63\74\65\73\74" ;; spectest + "\09" ;; string length + "\70\72\69\6e\74\5f\69\33\32" ;; print_i32 + "\00\00" ;; import kind, import signature index + ;; 2nd import + ;; (redundant) + "\08" ;; string length + "\73\70\65\63\74\65\73\74" ;; spectest + "\09" ;; string length + "\70\72\69\6e\74\5f\66\33\32" ;; print_f32 + "\00\01" ;; import kind, import signature index + ) + "section size mismatch" +) + +;; Table count can be zero +(module binary + "\00asm" "\01\00\00\00" + "\04\01\00" ;; table count can be zero +) + +;; 1 table declared, 0 given +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\04\01\01" ;; table section with inconsistent count (1 declared, 0 given) + ;; "\70\01\00\00" ;; table entity + ) + "unexpected end of section or function" +) + +;; Memory count can be zero +(module binary + "\00asm" "\01\00\00\00" + "\05\01\00" ;; memory count can be zero +) + +;; 1 memory declared, 0 given +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\05\01\01" ;; memory section with inconsistent count (1 declared, 0 given) + ;; "\00\00" ;; memory 0 (missed) + ) + "unexpected end of section or function" +) + +;; Global count can be zero +(module binary + "\00asm" "\01\00\00\00" + "\06\01\00" ;; global count can be zero +) + +;; 2 global declared, 1 given +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\06\06\02" ;; global section with inconsistent count (2 declared, 1 given) + "\7f\00\41\00\0b" ;; global 0 + ;; "\7f\00\41\00\0b" ;; global 1 (missed) + ) + "unexpected end of section or function" +) + +;; 1 global declared, 2 given +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\06\0b\01" ;; global section with inconsistent count (1 declared, 2 given) + "\7f\00\41\00\0b" ;; global 0 + "\7f\00\41\00\0b" ;; global 1 (redundant) + ) + "section size mismatch" +) + +;; Export count can be 0 +(module binary + "\00asm" "\01\00\00\00" + "\01\04\01" ;; type section + "\60\00\00" ;; type 0 + "\03\03\02\00\00" ;; func section + "\07\01\00" ;; export count can be zero + "\0a\07\02" ;; code section + "\02\00\0b" ;; function body 0 + "\02\00\0b" ;; function body 1 +) + +;; 2 export declared, 1 given +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\04\01" ;; type section + "\60\00\00" ;; type 0 + "\03\03\02\00\00" ;; func section + "\07\06\02" ;; export section with inconsistent count (2 declared, 1 given) + "\02" ;; export 0 + "\66\31" ;; export name + "\00\00" ;; export kind, export func index + ;; "\02" ;; export 1 (missed) + ;; "\66\32" ;; export name + ;; "\00\01" ;; export kind, export func index + "\0a\07\02" ;; code section + "\02\00\0b" ;; function body 0 + "\02\00\0b" ;; function body 1 + ) + "unexpected end of section or function" +) + +;; 1 export declared, 2 given +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\04\01" ;; type section + "\60\00\00" ;; type 0 + "\03\03\02\00\00" ;; func section + "\07\0b\01" ;; export section with inconsistent count (1 declared, 2 given) + "\02" ;; export 0 + "\66\31" ;; export name + "\00\00" ;; export kind, export func index + "\02" ;; export 1 (redundant) + "\66\32" ;; export name + "\00\01" ;; export kind, export func index + "\0a\07\02" ;; code section + "\02\00\0b" ;; function body 0 + "\02\00\0b" ;; function body 1 + ) + "section size mismatch" +) + +;; elem segment count can be zero +(module binary + "\00asm" "\01\00\00\00" + "\01\04\01" ;; type section + "\60\00\00" ;; type 0 + "\03\02\01\00" ;; func section + "\04\04\01" ;; table section + "\70\00\01" ;; table 0 + "\09\01\00" ;; elem segment count can be zero + "\0a\04\01" ;; code section + "\02\00\0b" ;; function body +) + +;; 2 elem segment declared, 1 given +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\04\01" ;; type section + "\60\00\00" ;; type 0 + "\03\02\01\00" ;; func section + "\04\04\01" ;; table section + "\70\00\01" ;; table 0 + "\09\07\02" ;; elem with inconsistent segment count (2 declared, 1 given) + "\00\41\00\0b\01\00" ;; elem 0 + ;; "\00\41\00\0b\01\00" ;; elem 1 (missed) + "\0a\04\01" ;; code section + "\02\00\0b" ;; function body + ) + "invalid segment kind" +) + +;; 1 elem segment declared, 2 given +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\04\01" ;; type section + "\60\00\00" ;; type 0 + "\03\02\01\00" ;; func section + "\04\04\01" ;; table section + "\70\00\01" ;; table 0 + "\09\0d\01" ;; elem with inconsistent segment count (1 declared, 2 given) + "\00\41\00\0b\01\00" ;; elem 0 + "\00\41\00\0b\01\00" ;; elem 1 (redundant) + "\0a\04\01" ;; code section + "\02\00\0b" ;; function body + ) + "section size mismatch" +) + +;; data segment count can be zero +(module binary + "\00asm" "\01\00\00\00" + "\05\03\01" ;; memory section + "\00\01" ;; memory 0 + "\0b\01\00" ;; data segment count can be zero +) + +;; 2 data segment declared, 1 given +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\05\03\01" ;; memory section + "\00\01" ;; memory 0 + "\0b\07\02" ;; data with inconsistent segment count (2 declared, 1 given) + "\00\41\00\0b\01\61" ;; data 0 + ;; "\00\41\01\0b\01\62" ;; data 1 (missed) + ) + "unexpected end of section or function" +) + +;; 1 data segment declared, 2 given +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\05\03\01" ;; memory section + "\00\01" ;; memory 0 + "\0b\0d\01" ;; data with inconsistent segment count (1 declared, 2 given) + "\00\41\00\0b\01\61" ;; data 0 + "\00\41\01\0b\01\62" ;; data 1 (redundant) + ) + "section size mismatch" +) + +;; data segment has 7 bytes declared, but 6 bytes given +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\05\03\01" ;; memory section + "\00\01" ;; memory 0 + "\0b\0c\01" ;; data section + "\00\41\03\0b" ;; data segment 0 + "\07" ;; data segment size with inconsistent lengths (7 declared, 6 given) + "\61\62\63\64\65\66" ;; 6 bytes given + ) + "unexpected end of section or function" +) + +;; data segment has 5 bytes declared, but 6 bytes given +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\05\03\01" ;; memory section + "\00\01" ;; memory 0 + "\0b\0c\01" ;; data section + "\00\41\00\0b" ;; data segment 0 + "\05" ;; data segment size with inconsistent lengths (5 declared, 6 given) + "\61\62\63\64\65\66" ;; 6 bytes given + ) + "section size mismatch" +) + +;; br_table target count can be zero +(module binary + "\00asm" "\01\00\00\00" + "\01\04\01" ;; type section + "\60\00\00" ;; type 0 + "\03\02\01\00" ;; func section + "\0a\11\01" ;; code section + "\0f\00" ;; func 0 + "\02\40" ;; block 0 + "\41\01" ;; condition of if 0 + "\04\40" ;; if 0 + "\41\01" ;; index of br_table element + "\0e\00" ;; br_table target count can be zero + "\02" ;; break depth for default + "\0b\0b\0b" ;; end +) + +;; 2 br_table target declared, 1 given +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\04\01" ;; type section + "\60\00\00" ;; type 0 + "\03\02\01\00" ;; func section + "\0a\12\01" ;; code section + "\10\00" ;; func 0 + "\02\40" ;; block 0 + "\41\01" ;; condition of if 0 + "\04\40" ;; if 0 + "\41\01" ;; index of br_table element + "\0e\02" ;; br_table with inconsistent target count (2 declared, 1 given) + "\00" ;; break depth 0 + ;; "\01" ;; break depth 1 (missed) + "\02" ;; break depth for default + "\0b\0b\0b" ;; end + ) + "unexpected end of section or function" +) + +;; 1 br_table target declared, 2 given +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\04\01" ;; type section + "\60\00\00" ;; type 0 + "\03\02\01\00" ;; func section + "\0a\12\01" ;; code section + "\11\00" ;; func 0 + "\02\40" ;; block 0 + "\41\01" ;; condition of if 0 + "\04\40" ;; if 0 + "\41\01" ;; index of br_table element + "\0e\01" ;; br_table with inconsistent target count (1 declared, 2 given) + "\00" ;; break depth 0 + "\01" ;; break depth 1 + "\02" ;; break depth for default + "\0b\0b\0b" ;; end + ) + "invalid reference type" +) + +;; Start section +(module binary + "\00asm" "\01\00\00\00" + "\01\04\01\60\00\00" ;; Type section + "\03\02\01\00" ;; Function section + "\08\01\00" ;; Start section: function 0 + + "\0a\04\01" ;; Code section + ;; function 0 + "\02\00" + "\0b" ;; end +) + +;; Multiple start sections +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\01\04\01\60\00\00" ;; Type section + "\03\02\01\00" ;; Function section + "\08\01\00" ;; Start section: function 0 + "\08\01\00" ;; Start section: function 0 + + "\0a\04\01" ;; Code section + ;; function 0 + "\02\00" + "\0b" ;; end + ) + "junk after last section" +) diff --git a/test/core/block-end-label-mismatch.fail.wast b/test/core/block-end-label-mismatch.fail.wast deleted file mode 100644 index 8eeaaff9..00000000 --- a/test/core/block-end-label-mismatch.fail.wast +++ /dev/null @@ -1 +0,0 @@ -(module (func block $a end $l)) diff --git a/test/core/block-end-label-superfluous.fail.wast b/test/core/block-end-label-superfluous.fail.wast deleted file mode 100644 index f33b8f59..00000000 --- a/test/core/block-end-label-superfluous.fail.wast +++ /dev/null @@ -1 +0,0 @@ -(module (func block end $l)) diff --git a/test/core/block.wast b/test/core/block.wast index cb7935c5..625dd98f 100644 --- a/test/core/block.wast +++ b/test/core/block.wast @@ -2,6 +2,8 @@ (module ;; Auxiliary definition + (memory 1) + (func $dummy) (func (export "empty") @@ -11,53 +13,189 @@ (func (export "singular") (result i32) (block (nop)) - (block i32 (i32.const 7)) + (block (result i32) (i32.const 7)) ) (func (export "multi") (result i32) (block (call $dummy) (call $dummy) (call $dummy) (call $dummy)) - (block i32 (call $dummy) (call $dummy) (call $dummy) (i32.const 8)) + (block (result i32) (call $dummy) (call $dummy) (call $dummy) (i32.const 8)) ) (func (export "nested") (result i32) - (block i32 + (block (result i32) (block (call $dummy) (block) (nop)) - (block i32 (call $dummy) (i32.const 9)) + (block (result i32) (call $dummy) (i32.const 9)) ) ) (func (export "deep") (result i32) - (block i32 (block i32 (block i32 (block i32 (block i32 (block i32 - (block i32 (block i32 (block i32 (block i32 (block i32 (block i32 - (block i32 (block i32 (block i32 (block i32 (block i32 (block i32 - (block i32 (block i32 (block i32 (block i32 (block i32 (block i32 - (block i32 (block i32 (block i32 (block i32 (block i32 (block i32 - (block i32 (block i32 (block i32 (block i32 (block i32 (block i32 - (block i32 (block i32 (call $dummy) (i32.const 150))) - )))))) - )))))) - )))))) - )))))) - )))))) - )))))) + (block (result i32) (block (result i32) + (block (result i32) (block (result i32) + (block (result i32) (block (result i32) + (block (result i32) (block (result i32) + (block (result i32) (block (result i32) + (block (result i32) (block (result i32) + (block (result i32) (block (result i32) + (block (result i32) (block (result i32) + (block (result i32) (block (result i32) + (block (result i32) (block (result i32) + (block (result i32) (block (result i32) + (block (result i32) (block (result i32) + (block (result i32) (block (result i32) + (block (result i32) (block (result i32) + (block (result i32) (block (result i32) + (block (result i32) (block (result i32) + (block (result i32) (block (result i32) + (block (result i32) (block (result i32) + (block (result i32) (block (result i32) + (call $dummy) (i32.const 150) + )) + )) + )) + )) + )) + )) + )) + )) + )) + )) + )) + )) + )) + )) + )) + )) + )) + )) + )) + ) + + (func (export "as-select-first") (result i32) + (select (block (result i32) (i32.const 1)) (i32.const 2) (i32.const 3)) + ) + (func (export "as-select-mid") (result i32) + (select (i32.const 2) (block (result i32) (i32.const 1)) (i32.const 3)) + ) + (func (export "as-select-last") (result i32) + (select (i32.const 2) (i32.const 3) (block (result i32) (i32.const 1))) + ) + + (func (export "as-loop-first") (result i32) + (loop (result i32) (block (result i32) (i32.const 1)) (call $dummy) (call $dummy)) + ) + (func (export "as-loop-mid") (result i32) + (loop (result i32) (call $dummy) (block (result i32) (i32.const 1)) (call $dummy)) + ) + (func (export "as-loop-last") (result i32) + (loop (result i32) (call $dummy) (call $dummy) (block (result i32) (i32.const 1))) + ) + + (func (export "as-if-condition") + (block (result i32) (i32.const 1)) (if (then (call $dummy))) + ) + (func (export "as-if-then") (result i32) + (if (result i32) (i32.const 1) (then (block (result i32) (i32.const 1))) (else (i32.const 2))) + ) + (func (export "as-if-else") (result i32) + (if (result i32) (i32.const 1) (then (i32.const 2)) (else (block (result i32) (i32.const 1)))) + ) + + (func (export "as-br_if-first") (result i32) + (block (result i32) (br_if 0 (block (result i32) (i32.const 1)) (i32.const 2))) + ) + (func (export "as-br_if-last") (result i32) + (block (result i32) (br_if 0 (i32.const 2) (block (result i32) (i32.const 1)))) + ) + + (func (export "as-br_table-first") (result i32) + (block (result i32) (block (result i32) (i32.const 1)) (i32.const 2) (br_table 0 0)) + ) + (func (export "as-br_table-last") (result i32) + (block (result i32) (i32.const 2) (block (result i32) (i32.const 1)) (br_table 0 0)) + ) + + (func $func (param i32 i32) (result i32) (local.get 0)) + (type $check (func (param i32 i32) (result i32))) + (table funcref (elem $func)) + (func (export "as-call_indirect-first") (result i32) + (block (result i32) + (call_indirect (type $check) + (block (result i32) (i32.const 1)) (i32.const 2) (i32.const 0) + ) + ) + ) + (func (export "as-call_indirect-mid") (result i32) + (block (result i32) + (call_indirect (type $check) + (i32.const 2) (block (result i32) (i32.const 1)) (i32.const 0) + ) + ) + ) + (func (export "as-call_indirect-last") (result i32) + (block (result i32) + (call_indirect (type $check) + (i32.const 1) (i32.const 2) (block (result i32) (i32.const 0)) + ) + ) + ) + + (func (export "as-store-first") + (block (result i32) (i32.const 1)) (i32.const 1) (i32.store) + ) + (func (export "as-store-last") + (i32.const 10) (block (result i32) (i32.const 1)) (i32.store) + ) + + (func (export "as-memory.grow-value") (result i32) + (memory.grow (block (result i32) (i32.const 1))) + ) + + (func $f (param i32) (result i32) (local.get 0)) + + (func (export "as-call-value") (result i32) + (call $f (block (result i32) (i32.const 1))) + ) + (func (export "as-return-value") (result i32) + (block (result i32) (i32.const 1)) (return) + ) + (func (export "as-drop-operand") + (drop (block (result i32) (i32.const 1))) + ) + (func (export "as-br-value") (result i32) + (block (result i32) (br 0 (block (result i32) (i32.const 1)))) + ) + (func (export "as-local.set-value") (result i32) + (local i32) (local.set 0 (block (result i32) (i32.const 1))) (local.get 0) + ) + (func (export "as-local.tee-value") (result i32) + (local i32) (local.tee 0 (block (result i32) (i32.const 1))) + ) + (global $a (mut i32) (i32.const 10)) + (func (export "as-global.set-value") (result i32) + (global.set $a (block (result i32) (i32.const 1))) + (global.get $a) + ) + + (func (export "as-load-operand") (result i32) + (i32.load (block (result i32) (i32.const 1))) ) (func (export "as-unary-operand") (result i32) - (i32.ctz (block i32 (call $dummy) (i32.const 13))) + (i32.ctz (block (result i32) (call $dummy) (i32.const 13))) ) (func (export "as-binary-operand") (result i32) (i32.mul - (block i32 (call $dummy) (i32.const 3)) - (block i32 (call $dummy) (i32.const 4)) + (block (result i32) (call $dummy) (i32.const 3)) + (block (result i32) (call $dummy) (i32.const 4)) ) ) (func (export "as-test-operand") (result i32) - (i32.eqz (block i32 (call $dummy) (i32.const 13))) + (i32.eqz (block (result i32) (call $dummy) (i32.const 13))) ) (func (export "as-compare-operand") (result i32) (f32.gt - (block f32 (call $dummy) (f32.const 3)) - (block f32 (call $dummy) (f32.const 3)) + (block (result f32) (call $dummy) (f32.const 3)) + (block (result f32) (call $dummy) (f32.const 3)) ) ) @@ -69,10 +207,10 @@ (i32.const 19) ) (func (export "break-value") (result i32) - (block i32 (br 0 (i32.const 18)) (i32.const 19)) + (block (result i32) (br 0 (i32.const 18)) (i32.const 19)) ) (func (export "break-repeated") (result i32) - (block i32 + (block (result i32) (br 0 (i32.const 18)) (br 0 (i32.const 19)) (drop (br_if 0 (i32.const 20) (i32.const 0))) @@ -85,29 +223,29 @@ ) (func (export "break-inner") (result i32) (local i32) - (set_local 0 (i32.const 0)) - (set_local 0 (i32.add (get_local 0) (block i32 (block i32 (br 1 (i32.const 0x1)))))) - (set_local 0 (i32.add (get_local 0) (block i32 (block (br 0)) (i32.const 0x2)))) - (set_local 0 - (i32.add (get_local 0) (block i32 (i32.ctz (br 0 (i32.const 0x4))))) + (local.set 0 (i32.const 0)) + (local.set 0 (i32.add (local.get 0) (block (result i32) (block (result i32) (br 1 (i32.const 0x1)))))) + (local.set 0 (i32.add (local.get 0) (block (result i32) (block (br 0)) (i32.const 0x2)))) + (local.set 0 + (i32.add (local.get 0) (block (result i32) (i32.ctz (br 0 (i32.const 0x4))))) ) - (set_local 0 - (i32.add (get_local 0) (block i32 (i32.ctz (block i32 (br 1 (i32.const 0x8)))))) + (local.set 0 + (i32.add (local.get 0) (block (result i32) (i32.ctz (block (result i32) (br 1 (i32.const 0x8)))))) ) - (get_local 0) + (local.get 0) ) (func (export "effects") (result i32) (local i32) (block - (set_local 0 (i32.const 1)) - (set_local 0 (i32.mul (get_local 0) (i32.const 3))) - (set_local 0 (i32.sub (get_local 0) (i32.const 5))) - (set_local 0 (i32.mul (get_local 0) (i32.const 7))) + (local.set 0 (i32.const 1)) + (local.set 0 (i32.mul (local.get 0) (i32.const 3))) + (local.set 0 (i32.sub (local.get 0) (i32.const 5))) + (local.set 0 (i32.mul (local.get 0) (i32.const 7))) (br 0) - (set_local 0 (i32.mul (get_local 0) (i32.const 100))) + (local.set 0 (i32.mul (local.get 0) (i32.const 100))) ) - (i32.eq (get_local 0) (i32.const -14)) + (i32.eq (local.get 0) (i32.const -14)) ) ) @@ -117,6 +255,41 @@ (assert_return (invoke "nested") (i32.const 9)) (assert_return (invoke "deep") (i32.const 150)) +(assert_return (invoke "as-select-first") (i32.const 1)) +(assert_return (invoke "as-select-mid") (i32.const 2)) +(assert_return (invoke "as-select-last") (i32.const 2)) + +(assert_return (invoke "as-loop-first") (i32.const 1)) +(assert_return (invoke "as-loop-mid") (i32.const 1)) +(assert_return (invoke "as-loop-last") (i32.const 1)) + +(assert_return (invoke "as-if-condition")) +(assert_return (invoke "as-if-then") (i32.const 1)) +(assert_return (invoke "as-if-else") (i32.const 2)) + +(assert_return (invoke "as-br_if-first") (i32.const 1)) +(assert_return (invoke "as-br_if-last") (i32.const 2)) + +(assert_return (invoke "as-br_table-first") (i32.const 1)) +(assert_return (invoke "as-br_table-last") (i32.const 2)) + +(assert_return (invoke "as-call_indirect-first") (i32.const 1)) +(assert_return (invoke "as-call_indirect-mid") (i32.const 2)) +(assert_return (invoke "as-call_indirect-last") (i32.const 1)) + +(assert_return (invoke "as-store-first")) +(assert_return (invoke "as-store-last")) + +(assert_return (invoke "as-memory.grow-value") (i32.const 1)) +(assert_return (invoke "as-call-value") (i32.const 1)) +(assert_return (invoke "as-return-value") (i32.const 1)) +(assert_return (invoke "as-drop-operand")) +(assert_return (invoke "as-br-value") (i32.const 1)) +(assert_return (invoke "as-local.set-value") (i32.const 1)) +(assert_return (invoke "as-local.tee-value") (i32.const 1)) +(assert_return (invoke "as-global.set-value") (i32.const 1)) +(assert_return (invoke "as-load-operand") (i32.const 1)) + (assert_return (invoke "as-unary-operand") (i32.const 0)) (assert_return (invoke "as-binary-operand") (i32.const 12)) (assert_return (invoke "as-test-operand") (i32.const 0)) @@ -147,115 +320,801 @@ ) (assert_invalid - (module (func $type-value-num-vs-void + (module (func $type-value-i32-vs-void (block (i32.const 1)) )) "type mismatch" ) (assert_invalid - (module (func $type-value-empty-vs-num (result i32) - (block i32) + (module (func $type-value-i64-vs-void + (block (i64.const 1)) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-value-f32-vs-void + (block (f32.const 1.0)) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-value-f64-vs-void + (block (f64.const 1.0)) + )) + "type mismatch" +) + +(assert_invalid + (module (func $type-value-empty-vs-i32 (result i32) + (block (result i32)) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-value-empty-vs-i64 (result i64) + (block (result i64)) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-value-empty-vs-f32 (result f32) + (block (result f32)) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-value-empty-vs-f64 (result f64) + (block (result f64)) + )) + "type mismatch" +) + +(assert_invalid + (module + (func $type-value-empty-in-block + (i32.const 0) + (block (block (result i32)) (drop)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-value-empty-in-loop + (i32.const 0) + (loop (block (result i32)) (drop)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-value-empty-in-then + (i32.const 0) (i32.const 0) + (if (then (block (result i32)) (drop))) + ) + ) + "type mismatch" +) + +(assert_invalid + (module (func $type-value-void-vs-i32 (result i32) + (block (result i32) (nop)) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-value-void-vs-i64 (result i64) + (block (result i64) (nop)) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-value-void-vs-f32 (result f32) + (block (result f32) (nop)) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-value-void-vs-f64 (result f64) + (block (result f64) (nop)) + )) + "type mismatch" +) + +(assert_invalid + (module (func $type-value-i32-vs-i64 (result i32) + (block (result i32) (i64.const 0)) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-value-i32-vs-f32 (result i32) + (block (result i32) (f32.const 0.0)) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-value-i32-vs-f64 (result i32) + (block (result i32) (f64.const 0.0)) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-value-i64-vs-i32 (result i64) + (block (result i64) (i32.const 0)) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-value-i64-vs-f32 (result i64) + (block (result i64) (f32.const 0.0)) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-value-i64-vs-f64 (result i64) + (block (result i64) (f64.const 0.0)) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-value-f32-vs-i32 (result f32) + (block (result f32) (i32.const 0)) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-value-f32-vs-i64 (result f32) + (block (result f32) (i64.const 0)) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-value-f32-vs-f64 (result f32) + (block (result f32) (f64.const 0.0)) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-value-f64-vs-i32 (result f64) + (block (result f64) (i32.const 0)) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-value-f64-vs-i64 (result f64) + (block (result f64) (i64.const 0)) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-value-f64-vs-f32 (result f32) + (block (result f64) (f32.const 0.0)) + )) + "type mismatch" +) + +(assert_invalid + (module (func $type-value-unreached-select-i32-i64 (result i32) + (block (result i64) (select (unreachable) (unreachable) (unreachable))) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-value-unreached-select-i32-f32 (result i32) + (block (result f32) (select (unreachable) (unreachable) (unreachable))) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-value-unreached-select-i32-f64 (result i32) + (block (result f64) (select (unreachable) (unreachable) (unreachable))) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-value-unreached-select-i64-i32 (result i64) + (block (result i32) (select (unreachable) (unreachable) (unreachable))) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-value-unreached-select-i64-f32 (result i64) + (block (result f32) (select (unreachable) (unreachable) (unreachable))) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-value-unreached-select-i64-f64 (result i64) + (block (result f64) (select (unreachable) (unreachable) (unreachable))) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-value-unreached-select-f32-i32 (result f32) + (block (result i32) (select (unreachable) (unreachable) (unreachable))) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-value-unreached-select-f32-i64 (result f32) + (block (result i64) (select (unreachable) (unreachable) (unreachable))) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-value-unreached-select-f32-f64 (result f32) + (block (result f64) (select (unreachable) (unreachable) (unreachable))) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-value-unreached-select-f64-i32 (result f64) + (block (result i32) (select (unreachable) (unreachable) (unreachable))) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-value-unreached-select-f64-i64 (result f64) + (block (result i64) (select (unreachable) (unreachable) (unreachable))) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-value-unreached-select-f64-f32 (result f64) + (block (result f32) (select (unreachable) (unreachable) (unreachable))) + )) + "type mismatch" +) + +(assert_invalid + (module (func $type-break-last-void-vs-i32 (result i32) + (block (result i32) (br 0)) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-break-last-void-vs-i64 (result i64) + (block (result i64) (br 0)) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-break-last-void-vs-f32 (result f32) + (block (result f32) (br 0)) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-break-last-void-vs-f64 (result f64) + (block (result f64) (br 0)) + )) + "type mismatch" +) + +(assert_invalid + (module (func $type-break-empty-vs-i32 (result i32) + (block (result i32) (br 0) (i32.const 1)) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-break-empty-vs-i64 (result i64) + (block (result i64) (br 0) (i64.const 1)) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-break-empty-vs-f32 (result f32) + (block (result f32) (br 0) (f32.const 1.0)) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-break-empty-vs-f64 (result f64) + (block (result f64) (br 0) (f64.const 1.0)) + )) + "type mismatch" +) + +(assert_invalid + (module (func $type-break-void-vs-i32 (result i32) + (block (result i32) (br 0 (nop)) (i32.const 1)) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-break-void-vs-i64 (result i64) + (block (result i64) (br 0 (nop)) (i64.const 1)) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-break-void-vs-f32 (result f32) + (block (result f32) (br 0 (nop)) (f32.const 1.0)) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-break-void-vs-f64 (result f64) + (block (result f64) (br 0 (nop)) (f64.const 1.0)) + )) + "type mismatch" +) + +(assert_invalid + (module (func $type-break-i32-vs-i64 (result i32) + (block (result i32) (br 0 (i64.const 1)) (i32.const 1)) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-break-i32-vs-f32 (result i32) + (block (result i32) (br 0 (f32.const 1.0)) (i32.const 1)) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-break-i32-vs-f64 (result i32) + (block (result i32) (br 0 (f64.const 1.0)) (i32.const 1)) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-break-i64-vs-i32 (result i64) + (block (result i64) (br 0 (i32.const 1)) (i64.const 1)) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-break-i64-vs-f32 (result i64) + (block (result i64) (br 0 (f32.const 1.0)) (i64.const 1)) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-break-i64-vs-f64 (result i64) + (block (result i64) (br 0 (f64.const 1.0)) (i64.const 1)) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-break-f32-vs-i32 (result f32) + (block (result f32) (br 0 (i32.const 1)) (f32.const 1.0)) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-break-f32-vs-i64 (result f32) + (block (result f32) (br 0 (i64.const 1)) (f32.const 1.0)) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-break-f32-vs-f64 (result f32) + (block (result f32) (br 0 (f64.const 1.0)) (f32.const 1.0)) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-break-f64-vs-i32 (result f64) + (block (result i64) (br 0 (i32.const 1)) (f64.const 1.0)) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-break-f64-vs-i64 (result f64) + (block (result f64) (br 0 (i64.const 1)) (f64.const 1.0)) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-break-f64-vs-f32 (result f64) + (block (result f64) (br 0 (f32.const 1.0)) (f64.const 1)) + )) + "type mismatch" +) + +(assert_invalid + (module (func $type-break-first-void-vs-i32 (result i32) + (block (result i32) (br 0 (nop)) (br 0 (i32.const 1))) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-break-first-void-vs-i64 (result i64) + (block (result i64) (br 0 (nop)) (br 0 (i64.const 1))) )) "type mismatch" ) (assert_invalid - (module (func $type-value-void-vs-num (result i32) - (block i32 (nop)) + (module (func $type-break-first-void-vs-f32 (result f32) + (block (result f32) (br 0 (nop)) (br 0 (f32.const 1.0))) )) "type mismatch" ) (assert_invalid - (module (func $type-value-num-vs-num (result i32) - (block i32 (f32.const 0)) + (module (func $type-break-first-void-vs-f64 (result f64) + (block (result f64) (br 0 (nop)) (br 0 (f64.const 1.0))) + )) + "type mismatch" +) + +(assert_invalid + (module (func $type-break-first-i32-vs-i64 (result i32) + (block (result i32) (br 0 (i64.const 1)) (br 0 (i32.const 1))) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-break-first-i32-vs-f32 (result i32) + (block (result i32) (br 0 (f32.const 1.0)) (br 0 (i32.const 1))) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-break-first-i32-vs-f64 (result i32) + (block (result i32) (br 0 (f64.const 1.0)) (br 0 (i32.const 1))) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-break-first-i64-vs-i32 (result i64) + (block (result i64) (br 0 (i32.const 1)) (br 0 (i64.const 1))) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-break-first-i64-vs-f32 (result i64) + (block (result i64) (br 0 (f32.const 1.0)) (br 0 (i64.const 1))) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-break-first-i64-vs-f64 (result i64) + (block (result i64) (br 0 (f64.const 1.0)) (br 0 (i64.const 1))) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-break-first-f32-vs-i32 (result f32) + (block (result f32) (br 0 (i32.const 1)) (br 0 (f32.const 1.0))) )) "type mismatch" ) (assert_invalid - (module (func $type-value-unreached-select (result i32) - (block i64 (select (unreachable) (unreachable) (unreachable))) + (module (func $type-break-first-f32-vs-i64 (result f32) + (block (result f32) (br 0 (i64.const 1)) (br 0 (f32.const 1.0))) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-break-first-f32-vs-f64 (result f32) + (block (result f32) (br 0 (f64.const 1.0)) (br 0 (f32.const 1.0))) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-break-first-f64-vs-i32 (result f64) + (block (result f64) (br 0 (i32.const 1)) (br 0 (f64.const 1.0))) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-break-first-f64-vs-i64 (result f64) + (block (result f64) (br 0 (i64.const 1)) (br 0 (f64.const 1.0))) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-break-first-f64-vs-f32 (result f64) + (block (result f64) (br 0 (f32.const 1.0)) (br 0 (f64.const 1.0))) )) "type mismatch" ) (assert_invalid - (module (func $type-break-last-void-vs-num (result i32) - (block i32 (br 0)) + (module (func $type-break-nested-i32-vs-void + (block (result i32) (block (result i32) (br 1 (i32.const 1))) (br 0)) )) "type mismatch" ) (assert_invalid - (module (func $type-break-empty-vs-num (result i32) - (block i32 (br 0) (i32.const 1)) + (module (func $type-break-nested-i64-vs-void + (block (result i64) (block (result i64) (br 1 (i64.const 1))) (br 0)) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-break-nested-f32-vs-void + (block (result f32) (block (result f32) (br 1 (f32.const 1.0))) (br 0)) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-break-nested-f64-vs-void + (block (result f64) (block (result f64) (br 1 (f64.const 1.0))) (br 0)) )) "type mismatch" ) (assert_invalid - (module (func $type-break-void-vs-num (result i32) - (block i32 (br 0 (nop)) (i32.const 1)) + (module (func $type-break-nested-empty-vs-i32 (result i32) + (block (result i32) (block (br 1)) (br 0 (i32.const 1))) )) "type mismatch" ) (assert_invalid - (module (func $type-break-num-vs-num (result i32) - (block i32 (br 0 (i64.const 1)) (i32.const 1)) + (module (func $type-break-nested-empty-vs-i64 (result i64) + (block (result i64) (block (br 1)) (br 0 (i64.const 1))) )) "type mismatch" ) (assert_invalid - (module (func $type-break-first-void-vs-num (result i32) - (block i32 (br 0 (nop)) (br 0 (i32.const 1))) + (module (func $type-break-nested-empty-vs-f32 (result f32) + (block (result f32) (block (br 1)) (br 0 (f32.const 1.0))) )) "type mismatch" ) (assert_invalid - (module (func $type-break-first-num-vs-num (result i32) - (block i32 (br 0 (i64.const 1)) (br 0 (i32.const 1))) + (module (func $type-break-nested-empty-vs-f64 (result f64) + (block (result f64) (block (br 1)) (br 0 (f64.const 1))) )) "type mismatch" ) (assert_invalid - (module (func $type-break-nested-num-vs-void - (block i32 (block i32 (br 1 (i32.const 1))) (br 0)) + (module (func $type-break-nested-void-vs-i32 (result i32) + (block (result i32) (block (result i32) (br 1 (nop))) (br 0 (i32.const 1))) )) "type mismatch" ) (assert_invalid - (module (func $type-break-nested-empty-vs-num (result i32) - (block i32 (block (br 1)) (br 0 (i32.const 1))) + (module (func $type-break-nested-void-vs-i64 (result i64) + (block (result i64) (block (result i64) (br 1 (nop))) (br 0 (i64.const 1))) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-break-nested-void-vs-f32 (result f32) + (block (result f32) (block (result f32) (br 1 (nop))) (br 0 (f32.const 1.0))) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-break-nested-void-vs-f64 (result f64) + (block (result f64) (block (result f64) (br 1 (nop))) (br 0 (f64.const 1.0))) )) "type mismatch" ) (assert_invalid - (module (func $type-break-nested-void-vs-num (result i32) - (block i32 (block i32 (br 1 (nop))) (br 0 (i32.const 1))) + (module (func $type-break-nested-i32-vs-i64 (result i32) + (block (result i32) + (block (result i32) (br 1 (i64.const 1))) (br 0 (i32.const 1)) + ) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-break-nested-i32-vs-f32 (result i32) + (block (result i32) + (block (result i32) (br 1 (f32.const 1.0))) (br 0 (i32.const 1)) + ) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-break-nested-i32-vs-f64 (result i32) + (block (result i32) + (block (result i32) (br 1 (f64.const 1.0))) (br 0 (i32.const 1)) + ) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-break-nested-i64-vs-i32 (result i64) + (block (result i64) + (block (result i64) (br 1 (i32.const 1))) (br 0 (i64.const 1)) + ) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-break-nested-i64-vs-f32 (result i64) + (block (result i64) + (block (result i64) (br 1 (f32.const 1.0))) (br 0 (i64.const 1)) + ) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-break-nested-i64-vs-f64 (result i64) + (block (result i64) + (block (result i64) (br 1 (f64.const 1.0))) (br 0 (i64.const 1)) + ) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-break-nested-f32-vs-i32 (result f32) + (block (result f32) + (block (result f32) (br 1 (i32.const 1))) (br 0 (f32.const 1.0)) + ) )) "type mismatch" ) (assert_invalid - (module (func $type-break-nested-num-vs-num (result i32) - (block i32 (block i32 (br 1 (i64.const 1))) (br 0 (i32.const 1))) + (module (func $type-break-nested-f32-vs-i64 (result f32) + (block (result f32) + (block (result f32) (br 1 (i64.const 1))) (br 0 (f32.const 1.0)) + ) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-break-nested-f32-vs-f64 (result f32) + (block (result f32) + (block (result f32) (br 1 (f64.const 1.0))) (br 0 (f32.const 1.0)) + ) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-break-nested-f64-vs-i32 (result f64) + (block (result f64) + (block (result f64) (br 1 (i32.const 1))) (br 0 (f64.const 1.0)) + ) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-break-nested-f64-vs-i64 (result f64) + (block (result f64) + (block (result f64) (br 1 (i64.const 1))) (br 0 (f64.const 1.0)) + ) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-break-nested-f64-vs-f32 (result f64) + (block (result f64) + (block (result f64) (br 1 (f32.const 1.0))) (br 0 (f64.const 1.0)) + ) )) "type mismatch" ) (assert_invalid - (module (func $type-break-operand-empty-vs-num (result i32) + (module (func $type-break-operand-empty-vs-i32 (result i32) (i32.ctz (block (br 0))) )) "type mismatch" ) (assert_invalid - (module (func $type-break-operand-void-vs-num (result i32) + (module (func $type-break-operand-empty-vs-i64 (result i64) + (i64.ctz (block (br 0))) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-break-operand-empty-vs-f32 (result f32) + (f32.floor (block (br 0))) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-break-operand-empty-vs-f64 (result f64) + (f64.floor (block (br 0))) + )) + "type mismatch" +) + +(assert_invalid + (module (func $type-break-operand-void-vs-i32 (result i32) + (i32.ctz (block (br 0 (nop)))) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-break-operand-void-vs-i64 (result i64) (i64.ctz (block (br 0 (nop)))) )) "type mismatch" ) (assert_invalid - (module (func $type-break-operand-num-vs-num (result i32) + (module (func $type-break-operand-void-vs-f32 (result f32) + (f32.floor (block (br 0 (nop)))) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-break-operand-void-vs-f64 (result f64) + (f64.floor (block (br 0 (nop)))) + )) + "type mismatch" +) + +(assert_invalid + (module (func $type-break-operand-i32-vs-i64 (result i32) (i64.ctz (block (br 0 (i64.const 9)))) )) "type mismatch" ) +(assert_invalid + (module (func $type-break-operand-i32-vs-f32 (result i32) + (f32.floor (block (br 0 (f32.const 9.0)))) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-break-operand-i32-vs-f64 (result i32) + (f64.floor (block (br 0 (f64.const 9.0)))) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-break-operand-i64-vs-i32 (result i64) + (i32.ctz (block (br 0 (i32.const 9)))) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-break-operand-i64-vs-f32 (result i64) + (f32.floor (block (br 0 (f32.const 9.0)))) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-break-operand-i64-vs-f64 (result i64) + (f64.floor (block (br 0 (f64.const 9.0)))) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-break-operand-f32-vs-i32 (result f32) + (i32.ctz (block (br 0 (i32.const 9)))) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-break-operand-f32-vs-i64 (result f32) + (i64.ctz (block (br 0 (i64.const 9)))) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-break-operand-f32-vs-f64 (result f32) + (f64.floor (block (br 0 (f64.const 9.0)))) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-break-operand-f64-vs-i32 (result f64) + (i32.ctz (block (br 0 (i32.const 9)))) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-break-operand-f64-vs-i64 (result f64) + (i64.ctz (block (br 0 (i64.const 9)))) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-break-operand-f64-vs-f32 (result f64) + (f32.floor (block (br 0 (f32.const 9.0)))) + )) + "type mismatch" +) + + +(assert_malformed + (module quote "(func block end $l)") + "mismatching label" +) +(assert_malformed + (module quote "(func block $a end $l)") + "mismatching label" +) diff --git a/test/core/br.wast b/test/core/br.wast index 8d1c7e10..98a3a34b 100644 --- a/test/core/br.wast +++ b/test/core/br.wast @@ -10,16 +10,16 @@ (func (export "type-f64") (block (drop (f64.neg (br 0))))) (func (export "type-i32-value") (result i32) - (block i32 (i32.ctz (br 0 (i32.const 1)))) + (block (result i32) (i32.ctz (br 0 (i32.const 1)))) ) (func (export "type-i64-value") (result i64) - (block i64 (i64.ctz (br 0 (i64.const 2)))) + (block (result i64) (i64.ctz (br 0 (i64.const 2)))) ) (func (export "type-f32-value") (result f32) - (block f32 (f32.neg (br 0 (f32.const 3)))) + (block (result f32) (f32.neg (br 0 (f32.const 3)))) ) (func (export "type-f64-value") (result f64) - (block f64 (f64.neg (br 0 (f64.const 4)))) + (block (result f64) (f64.neg (br 0 (f64.const 4)))) ) (func (export "as-block-first") @@ -32,33 +32,37 @@ (block (nop) (call $dummy) (br 0)) ) (func (export "as-block-value") (result i32) - (block i32 (nop) (call $dummy) (br 0 (i32.const 2))) + (block (result i32) (nop) (call $dummy) (br 0 (i32.const 2))) ) (func (export "as-loop-first") (result i32) - (block i32 (loop i32 (br 1 (i32.const 3)) (i32.const 2))) + (block (result i32) (loop (result i32) (br 1 (i32.const 3)) (i32.const 2))) ) (func (export "as-loop-mid") (result i32) - (block i32 (loop i32 (call $dummy) (br 1 (i32.const 4)) (i32.const 2))) + (block (result i32) + (loop (result i32) (call $dummy) (br 1 (i32.const 4)) (i32.const 2)) + ) ) (func (export "as-loop-last") (result i32) - (block i32 (loop i32 (nop) (call $dummy) (br 1 (i32.const 5)))) + (block (result i32) + (loop (result i32) (nop) (call $dummy) (br 1 (i32.const 5))) + ) ) (func (export "as-br-value") (result i32) - (block i32 (br 0 (br 0 (i32.const 9)))) + (block (result i32) (br 0 (br 0 (i32.const 9)))) ) (func (export "as-br_if-cond") (block (br_if 0 (br 0))) ) (func (export "as-br_if-value") (result i32) - (block i32 + (block (result i32) (drop (br_if 0 (br 0 (i32.const 8)) (i32.const 1))) (i32.const 7) ) ) (func (export "as-br_if-value-cond") (result i32) - (block i32 + (block (result i32) (drop (br_if 0 (i32.const 6) (br 0 (i32.const 9)))) (i32.const 7) ) ) @@ -67,146 +71,188 @@ (block (br_table 0 0 0 (br 0))) ) (func (export "as-br_table-value") (result i32) - (block i32 + (block (result i32) (br_table 0 0 0 (br 0 (i32.const 10)) (i32.const 1)) (i32.const 7) ) ) (func (export "as-br_table-value-index") (result i32) - (block i32 + (block (result i32) (br_table 0 0 (i32.const 6) (br 0 (i32.const 11))) (i32.const 7) ) ) (func (export "as-return-value") (result i64) - (block i64 (return (br 0 (i64.const 7)))) + (block (result i64) (return (br 0 (i64.const 7)))) ) (func (export "as-if-cond") (result i32) - (block i32 (if i32 (br 0 (i32.const 2)) (i32.const 0) (i32.const 1))) + (block (result i32) + (if (result i32) (br 0 (i32.const 2)) + (then (i32.const 0)) + (else (i32.const 1)) + ) + ) ) (func (export "as-if-then") (param i32 i32) (result i32) - (block i32 (if i32 (get_local 0) (br 1 (i32.const 3)) (get_local 1))) + (block (result i32) + (if (result i32) (local.get 0) + (then (br 1 (i32.const 3))) + (else (local.get 1)) + ) + ) ) (func (export "as-if-else") (param i32 i32) (result i32) - (block i32 (if i32 (get_local 0) (get_local 1) (br 1 (i32.const 4)))) + (block (result i32) + (if (result i32) (local.get 0) + (then (local.get 1)) + (else (br 1 (i32.const 4))) + ) + ) ) (func (export "as-select-first") (param i32 i32) (result i32) - (block i32 (select (br 0 (i32.const 5)) (get_local 0) (get_local 1))) + (block (result i32) + (select (br 0 (i32.const 5)) (local.get 0) (local.get 1)) + ) ) (func (export "as-select-second") (param i32 i32) (result i32) - (block i32 (select (get_local 0) (br 0 (i32.const 6)) (get_local 1))) + (block (result i32) + (select (local.get 0) (br 0 (i32.const 6)) (local.get 1)) + ) ) (func (export "as-select-cond") (result i32) - (block i32 (select (i32.const 0) (i32.const 1) (br 0 (i32.const 7)))) + (block (result i32) + (select (i32.const 0) (i32.const 1) (br 0 (i32.const 7))) + ) ) (func $f (param i32 i32 i32) (result i32) (i32.const -1)) (func (export "as-call-first") (result i32) - (block i32 (call $f (br 0 (i32.const 12)) (i32.const 2) (i32.const 3))) + (block (result i32) + (call $f (br 0 (i32.const 12)) (i32.const 2) (i32.const 3)) + ) ) (func (export "as-call-mid") (result i32) - (block i32 (call $f (i32.const 1) (br 0 (i32.const 13)) (i32.const 3))) + (block (result i32) + (call $f (i32.const 1) (br 0 (i32.const 13)) (i32.const 3)) + ) ) (func (export "as-call-last") (result i32) - (block i32 (call $f (i32.const 1) (i32.const 2) (br 0 (i32.const 14)))) + (block (result i32) + (call $f (i32.const 1) (i32.const 2) (br 0 (i32.const 14))) + ) ) (type $sig (func (param i32 i32 i32) (result i32))) - (table anyfunc (elem $f)) + (table funcref (elem $f)) (func (export "as-call_indirect-func") (result i32) - (block i32 - (call_indirect $sig + (block (result i32) + (call_indirect (type $sig) (br 0 (i32.const 20)) (i32.const 1) (i32.const 2) (i32.const 3) ) ) ) (func (export "as-call_indirect-first") (result i32) - (block i32 - (call_indirect $sig + (block (result i32) + (call_indirect (type $sig) (i32.const 0) (br 0 (i32.const 21)) (i32.const 2) (i32.const 3) ) ) ) (func (export "as-call_indirect-mid") (result i32) - (block i32 - (call_indirect $sig + (block (result i32) + (call_indirect (type $sig) (i32.const 0) (i32.const 1) (br 0 (i32.const 22)) (i32.const 3) ) ) ) (func (export "as-call_indirect-last") (result i32) - (block i32 - (call_indirect $sig + (block (result i32) + (call_indirect (type $sig) (i32.const 0) (i32.const 1) (i32.const 2) (br 0 (i32.const 23)) ) ) ) - (func (export "as-set_local-value") (result i32) (local f32) - (block i32 (set_local 0 (br 0 (i32.const 17))) (i32.const -1)) + (func (export "as-local.set-value") (result i32) (local f32) + (block (result i32) (local.set 0 (br 0 (i32.const 17))) (i32.const -1)) + ) + (func (export "as-local.tee-value") (result i32) (local i32) + (block (result i32) (local.tee 0 (br 0 (i32.const 1)))) + ) + (global $a (mut i32) (i32.const 10)) + (func (export "as-global.set-value") (result i32) + (block (result i32) (global.set $a (br 0 (i32.const 1)))) ) (memory 1) (func (export "as-load-address") (result f32) - (block f32 (f32.load (br 0 (f32.const 1.7)))) + (block (result f32) (f32.load (br 0 (f32.const 1.7)))) ) (func (export "as-loadN-address") (result i64) - (block i64 (i64.load8_s (br 0 (i64.const 30)))) + (block (result i64) (i64.load8_s (br 0 (i64.const 30)))) ) (func (export "as-store-address") (result i32) - (block i32 (f64.store (br 0 (i32.const 30)) (f64.const 7)) (i32.const -1)) + (block (result i32) + (f64.store (br 0 (i32.const 30)) (f64.const 7)) (i32.const -1) + ) ) (func (export "as-store-value") (result i32) - (block i32 (i64.store (i32.const 2) (br 0 (i32.const 31))) (i32.const -1)) + (block (result i32) + (i64.store (i32.const 2) (br 0 (i32.const 31))) (i32.const -1) + ) ) (func (export "as-storeN-address") (result i32) - (block i32 (i32.store8 (br 0 (i32.const 32)) (i32.const 7)) (i32.const -1)) + (block (result i32) + (i32.store8 (br 0 (i32.const 32)) (i32.const 7)) (i32.const -1) + ) ) (func (export "as-storeN-value") (result i32) - (block i32 (i64.store16 (i32.const 2) (br 0 (i32.const 33))) (i32.const -1)) + (block (result i32) + (i64.store16 (i32.const 2) (br 0 (i32.const 33))) (i32.const -1) + ) ) (func (export "as-unary-operand") (result f32) - (block f32 (f32.neg (br 0 (f32.const 3.4)))) + (block (result f32) (f32.neg (br 0 (f32.const 3.4)))) ) (func (export "as-binary-left") (result i32) - (block i32 (i32.add (br 0 (i32.const 3)) (i32.const 10))) + (block (result i32) (i32.add (br 0 (i32.const 3)) (i32.const 10))) ) (func (export "as-binary-right") (result i64) - (block i64 (i64.sub (i64.const 10) (br 0 (i64.const 45)))) + (block (result i64) (i64.sub (i64.const 10) (br 0 (i64.const 45)))) ) (func (export "as-test-operand") (result i32) - (block i32 (i32.eqz (br 0 (i32.const 44)))) + (block (result i32) (i32.eqz (br 0 (i32.const 44)))) ) (func (export "as-compare-left") (result i32) - (block i32 (f64.le (br 0 (i32.const 43)) (f64.const 10))) + (block (result i32) (f64.le (br 0 (i32.const 43)) (f64.const 10))) ) (func (export "as-compare-right") (result i32) - (block i32 (f32.ne (f32.const 10) (br 0 (i32.const 42)))) + (block (result i32) (f32.ne (f32.const 10) (br 0 (i32.const 42)))) ) (func (export "as-convert-operand") (result i32) - (block i32 (i32.wrap/i64 (br 0 (i32.const 41)))) + (block (result i32) (i32.wrap_i64 (br 0 (i32.const 41)))) ) - (func (export "as-grow_memory-size") (result i32) - (block i32 (grow_memory (br 0 (i32.const 40)))) + (func (export "as-memory.grow-size") (result i32) + (block (result i32) (memory.grow (br 0 (i32.const 40)))) ) (func (export "nested-block-value") (result i32) (i32.add (i32.const 1) - (block i32 + (block (result i32) (call $dummy) (i32.add (i32.const 4) (br 0 (i32.const 8))) ) @@ -216,10 +262,10 @@ (func (export "nested-br-value") (result i32) (i32.add (i32.const 1) - (block i32 + (block (result i32) (drop (i32.const 2)) (drop - (block i32 + (block (result i32) (drop (i32.const 4)) (br 0 (br 1 (i32.const 8))) ) @@ -232,10 +278,10 @@ (func (export "nested-br_if-value") (result i32) (i32.add (i32.const 1) - (block i32 + (block (result i32) (drop (i32.const 2)) (drop - (block i32 + (block (result i32) (drop (i32.const 4)) (drop (br_if 0 (br 1 (i32.const 8)) (i32.const 1))) (i32.const 32) @@ -249,7 +295,7 @@ (func (export "nested-br_if-value-cond") (result i32) (i32.add (i32.const 1) - (block i32 + (block (result i32) (drop (i32.const 2)) (drop (br_if 0 (i32.const 4) (br 0 (i32.const 8)))) (i32.const 16) @@ -260,10 +306,10 @@ (func (export "nested-br_table-value") (result i32) (i32.add (i32.const 1) - (block i32 + (block (result i32) (drop (i32.const 2)) (drop - (block i32 + (block (result i32) (drop (i32.const 4)) (br_table 0 (br 1 (i32.const 8)) (i32.const 1)) ) @@ -276,7 +322,7 @@ (func (export "nested-br_table-value-index") (result i32) (i32.add (i32.const 1) - (block i32 + (block (result i32) (drop (i32.const 2)) (br_table 0 (i32.const 4) (br 0 (i32.const 8))) (i32.const 16) @@ -337,7 +383,9 @@ (assert_return (invoke "as-call_indirect-mid") (i32.const 22)) (assert_return (invoke "as-call_indirect-last") (i32.const 23)) -(assert_return (invoke "as-set_local-value") (i32.const 17)) +(assert_return (invoke "as-local.set-value") (i32.const 17)) +(assert_return (invoke "as-local.tee-value") (i32.const 1)) +(assert_return (invoke "as-global.set-value") (i32.const 1)) (assert_return (invoke "as-load-address") (f32.const 1.7)) (assert_return (invoke "as-loadN-address") (i64.const 30)) @@ -359,7 +407,7 @@ (assert_return (invoke "as-convert-operand") (i32.const 41)) -(assert_return (invoke "as-grow_memory-size") (i32.const 40)) +(assert_return (invoke "as-memory.grow-size") (i32.const 40)) (assert_return (invoke "nested-block-value") (i32.const 9)) (assert_return (invoke "nested-br-value") (i32.const 9)) @@ -370,30 +418,180 @@ (assert_invalid (module (func $type-arg-empty-vs-num (result i32) - (block i32 (br 0) (i32.const 1)) + (block (result i32) (br 0) (i32.const 1)) )) "type mismatch" ) (assert_invalid (module (func $type-arg-void-vs-num (result i32) - (block i32 (br 0 (nop)) (i32.const 1)) + (block (result i32) (br 0 (nop)) (i32.const 1)) )) "type mismatch" ) (assert_invalid (module (func $type-arg-void-vs-num-nested (result i32) - (block i32 (i32.const 0) (block (br 1))) + (block (result i32) (i32.const 0) (block (br 1))) )) "type mismatch" ) (assert_invalid (module (func $type-arg-num-vs-num (result i32) - (block i32 (br 0 (i64.const 1)) (i32.const 1)) + (block (result i32) (br 0 (i64.const 1)) (i32.const 1)) )) "type mismatch" ) +(assert_invalid + (module + (func $type-arg-empty-in-br + (i32.const 0) + (block (result i32) (br 0 (br 0))) (i32.eqz) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-arg-empty-in-br_if + (i32.const 0) + (block (result i32) (br_if 0 (br 0) (i32.const 1))) (i32.eqz) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-arg-empty-in-br_table + (i32.const 0) + (block (result i32) (br_table 0 (br 0))) (i32.eqz) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-arg-empty-in-return + (block (result i32) + (return (br 0)) + ) + (i32.eqz) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-arg-empty-in-select + (block (result i32) + (select (br 0) (i32.const 1) (i32.const 2)) + ) + (i32.eqz) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-arg-empty-in-call + (block (result i32) + (call 1 (br 0)) + ) + (i32.eqz) (drop) + ) + (func (param i32) (result i32) (local.get 0)) + ) + "type mismatch" +) +(assert_invalid + (module + (func $f (param i32) (result i32) (local.get 0)) + (type $sig (func (param i32) (result i32))) + (table funcref (elem $f)) + (func $type-arg-empty-in-call_indirect + (block (result i32) + (call_indirect (type $sig) + (br 0) (i32.const 0) + ) + ) + (i32.eqz) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-arg-empty-in-local.set + (local i32) + (block (result i32) + (local.set 0 (br 0)) (local.get 0) + ) + (i32.eqz) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-arg-empty-in-local.tee + (local i32) + (block (result i32) + (local.tee 0 (br 0)) + ) + (i32.eqz) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (global $x (mut i32) (i32.const 0)) + (func $type-arg-empty-in-global.set + (block (result i32) + (global.set $x (br 0)) (global.get $x) + ) + (i32.eqz) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 0) + (func $type-arg-empty-in-memory.grow + (block (result i32) + (memory.grow (br 0)) + ) + (i32.eqz) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 1) + (func $type-arg-empty-in-load + (block (result i32) + (i32.load (br 0)) + ) + (i32.eqz) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 1) + (func $type-arg-empty-in-store + (block (result i32) + (i32.store (br 0) (i32.const 0)) + ) + (i32.eqz) (drop) + ) + ) + "type mismatch" +) + (assert_invalid (module (func $unbound-label (br 1))) "unknown label" diff --git a/test/core/br_if.wast b/test/core/br_if.wast index 6fcfc649..fba5deb9 100644 --- a/test/core/br_if.wast +++ b/test/core/br_if.wast @@ -3,55 +3,284 @@ (module (func $dummy) + (func (export "type-i32") + (block (drop (i32.ctz (br_if 0 (i32.const 0) (i32.const 1))))) + ) + (func (export "type-i64") + (block (drop (i64.ctz (br_if 0 (i64.const 0) (i32.const 1))))) + ) + (func (export "type-f32") + (block (drop (f32.neg (br_if 0 (f32.const 0) (i32.const 1))))) + ) + (func (export "type-f64") + (block (drop (f64.neg (br_if 0 (f64.const 0) (i32.const 1))))) + ) + + (func (export "type-i32-value") (result i32) + (block (result i32) (i32.ctz (br_if 0 (i32.const 1) (i32.const 1)))) + ) + (func (export "type-i64-value") (result i64) + (block (result i64) (i64.ctz (br_if 0 (i64.const 2) (i32.const 1)))) + ) + (func (export "type-f32-value") (result f32) + (block (result f32) (f32.neg (br_if 0 (f32.const 3) (i32.const 1)))) + ) + (func (export "type-f64-value") (result f64) + (block (result f64) (f64.neg (br_if 0 (f64.const 4) (i32.const 1)))) + ) + (func (export "as-block-first") (param i32) (result i32) - (block (br_if 0 (get_local 0)) (return (i32.const 2))) (i32.const 3) + (block (br_if 0 (local.get 0)) (return (i32.const 2))) (i32.const 3) ) (func (export "as-block-mid") (param i32) (result i32) - (block (call $dummy) (br_if 0 (get_local 0)) (return (i32.const 2))) + (block (call $dummy) (br_if 0 (local.get 0)) (return (i32.const 2))) (i32.const 3) ) (func (export "as-block-last") (param i32) - (block (call $dummy) (call $dummy) (br_if 0 (get_local 0))) + (block (call $dummy) (call $dummy) (br_if 0 (local.get 0))) ) (func (export "as-block-first-value") (param i32) (result i32) - (block i32 (drop (br_if 0 (i32.const 10) (get_local 0))) (return (i32.const 11))) + (block (result i32) + (drop (br_if 0 (i32.const 10) (local.get 0))) (return (i32.const 11)) + ) ) (func (export "as-block-mid-value") (param i32) (result i32) - (block i32 (call $dummy) (drop (br_if 0 (i32.const 20) (get_local 0))) (return (i32.const 21))) + (block (result i32) + (call $dummy) + (drop (br_if 0 (i32.const 20) (local.get 0))) + (return (i32.const 21)) + ) ) (func (export "as-block-last-value") (param i32) (result i32) - (block i32 - (call $dummy) (call $dummy) (br_if 0 (i32.const 11) (get_local 0)) + (block (result i32) + (call $dummy) (call $dummy) (br_if 0 (i32.const 11) (local.get 0)) ) ) (func (export "as-loop-first") (param i32) (result i32) - (block (loop (br_if 1 (get_local 0)) (return (i32.const 2)))) (i32.const 3) + (block (loop (br_if 1 (local.get 0)) (return (i32.const 2)))) (i32.const 3) ) (func (export "as-loop-mid") (param i32) (result i32) - (block (loop (call $dummy) (br_if 1 (get_local 0)) (return (i32.const 2)))) + (block (loop (call $dummy) (br_if 1 (local.get 0)) (return (i32.const 2)))) (i32.const 4) ) (func (export "as-loop-last") (param i32) - (loop (call $dummy) (br_if 1 (get_local 0))) + (loop (call $dummy) (br_if 1 (local.get 0))) ) + (func (export "as-br-value") (result i32) + (block (result i32) (br 0 (br_if 0 (i32.const 1) (i32.const 2)))) + ) + + (func (export "as-br_if-cond") + (block (br_if 0 (br_if 0 (i32.const 1) (i32.const 1)))) + ) + (func (export "as-br_if-value") (result i32) + (block (result i32) + (drop (br_if 0 (br_if 0 (i32.const 1) (i32.const 2)) (i32.const 3))) + (i32.const 4) + ) + ) + (func (export "as-br_if-value-cond") (param i32) (result i32) + (block (result i32) + (drop (br_if 0 (i32.const 2) (br_if 0 (i32.const 1) (local.get 0)))) + (i32.const 4) + ) + ) + + (func (export "as-br_table-index") + (block (br_table 0 0 0 (br_if 0 (i32.const 1) (i32.const 2)))) + ) + (func (export "as-br_table-value") (result i32) + (block (result i32) + (br_table 0 0 0 (br_if 0 (i32.const 1) (i32.const 2)) (i32.const 3)) (i32.const 4) + ) + ) + (func (export "as-br_table-value-index") (result i32) + (block (result i32) + (br_table 0 0 (i32.const 2) (br_if 0 (i32.const 1) (i32.const 3))) (i32.const 4) + ) + ) + (func (export "as-return-value") (result i64) + (block (result i64) (return (br_if 0 (i64.const 1) (i32.const 2)))) + ) + + (func (export "as-if-cond") (param i32) (result i32) + (block (result i32) + (if (result i32) + (br_if 0 (i32.const 1) (local.get 0)) + (then (i32.const 2)) + (else (i32.const 3)) + ) + ) + ) (func (export "as-if-then") (param i32 i32) - (block (if (get_local 0) (br_if 1 (get_local 1)) (call $dummy))) + (block + (if (local.get 0) (then (br_if 1 (local.get 1))) (else (call $dummy))) + ) ) (func (export "as-if-else") (param i32 i32) - (block (if (get_local 0) (call $dummy) (br_if 1 (get_local 1)))) + (block + (if (local.get 0) (then (call $dummy)) (else (br_if 1 (local.get 1)))) + ) + ) + + (func (export "as-select-first") (param i32) (result i32) + (block (result i32) + (select (br_if 0 (i32.const 3) (i32.const 10)) (i32.const 2) (local.get 0)) + ) + ) + (func (export "as-select-second") (param i32) (result i32) + (block (result i32) + (select (i32.const 1) (br_if 0 (i32.const 3) (i32.const 10)) (local.get 0)) + ) + ) + (func (export "as-select-cond") (result i32) + (block (result i32) + (select (i32.const 1) (i32.const 2) (br_if 0 (i32.const 3) (i32.const 10))) + ) + ) + + (func $f (param i32 i32 i32) (result i32) (i32.const -1)) + (func (export "as-call-first") (result i32) + (block (result i32) + (call $f + (br_if 0 (i32.const 12) (i32.const 1)) (i32.const 2) (i32.const 3) + ) + ) + ) + (func (export "as-call-mid") (result i32) + (block (result i32) + (call $f + (i32.const 1) (br_if 0 (i32.const 13) (i32.const 1)) (i32.const 3) + ) + ) + ) + (func (export "as-call-last") (result i32) + (block (result i32) + (call $f + (i32.const 1) (i32.const 2) (br_if 0 (i32.const 14) (i32.const 1)) + ) + ) + ) + + (func $func (param i32 i32 i32) (result i32) (local.get 0)) + (type $check (func (param i32 i32 i32) (result i32))) + (table funcref (elem $func)) + (func (export "as-call_indirect-func") (result i32) + (block (result i32) + (call_indirect (type $check) + (br_if 0 (i32.const 4) (i32.const 10)) + (i32.const 1) (i32.const 2) (i32.const 0) + ) + ) + ) + + (func (export "as-call_indirect-first") (result i32) + (block (result i32) + (call_indirect (type $check) + (i32.const 1) (br_if 0 (i32.const 4) (i32.const 10)) (i32.const 2) (i32.const 0) + ) + ) + ) + (func (export "as-call_indirect-mid") (result i32) + (block (result i32) + (call_indirect (type $check) + (i32.const 1) (i32.const 2) (br_if 0 (i32.const 4) (i32.const 10)) (i32.const 0) + ) + ) + ) + (func (export "as-call_indirect-last") (result i32) + (block (result i32) + (call_indirect (type $check) + (i32.const 1) (i32.const 2) (i32.const 3) (br_if 0 (i32.const 4) (i32.const 10)) + ) + ) + ) + + (func (export "as-local.set-value") (param i32) (result i32) + (local i32) + (block (result i32) + (local.set 0 (br_if 0 (i32.const 17) (local.get 0))) + (i32.const -1) + ) + ) + (func (export "as-local.tee-value") (param i32) (result i32) + (block (result i32) + (local.tee 0 (br_if 0 (i32.const 1) (local.get 0))) + (return (i32.const -1)) + ) + ) + (global $a (mut i32) (i32.const 10)) + (func (export "as-global.set-value") (param i32) (result i32) + (block (result i32) + (global.set $a (br_if 0 (i32.const 1) (local.get 0))) + (return (i32.const -1)) + ) + ) + + (memory 1) + (func (export "as-load-address") (result i32) + (block (result i32) (i32.load (br_if 0 (i32.const 1) (i32.const 1)))) + ) + (func (export "as-loadN-address") (result i32) + (block (result i32) (i32.load8_s (br_if 0 (i32.const 30) (i32.const 1)))) + ) + + (func (export "as-store-address") (result i32) + (block (result i32) + (i32.store (br_if 0 (i32.const 30) (i32.const 1)) (i32.const 7)) (i32.const -1) + ) + ) + (func (export "as-store-value") (result i32) + (block (result i32) + (i32.store (i32.const 2) (br_if 0 (i32.const 31) (i32.const 1))) (i32.const -1) + ) + ) + + (func (export "as-storeN-address") (result i32) + (block (result i32) + (i32.store8 (br_if 0 (i32.const 32) (i32.const 1)) (i32.const 7)) (i32.const -1) + ) + ) + (func (export "as-storeN-value") (result i32) + (block (result i32) + (i32.store16 (i32.const 2) (br_if 0 (i32.const 33) (i32.const 1))) (i32.const -1) + ) + ) + + (func (export "as-unary-operand") (result f64) + (block (result f64) (f64.neg (br_if 0 (f64.const 1.0) (i32.const 1)))) + ) + (func (export "as-binary-left") (result i32) + (block (result i32) (i32.add (br_if 0 (i32.const 1) (i32.const 1)) (i32.const 10))) + ) + (func (export "as-binary-right") (result i32) + (block (result i32) (i32.sub (i32.const 10) (br_if 0 (i32.const 1) (i32.const 1)))) + ) + (func (export "as-test-operand") (result i32) + (block (result i32) (i32.eqz (br_if 0 (i32.const 0) (i32.const 1)))) + ) + (func (export "as-compare-left") (result i32) + (block (result i32) (i32.le_u (br_if 0 (i32.const 1) (i32.const 1)) (i32.const 10))) + ) + (func (export "as-compare-right") (result i32) + (block (result i32) (i32.ne (i32.const 10) (br_if 0 (i32.const 1) (i32.const 42)))) + ) + + (func (export "as-memory.grow-size") (result i32) + (block (result i32) (memory.grow (br_if 0 (i32.const 1) (i32.const 1)))) ) (func (export "nested-block-value") (param i32) (result i32) (i32.add (i32.const 1) - (block i32 + (block (result i32) (drop (i32.const 2)) (i32.add (i32.const 4) - (block i32 - (drop (br_if 1 (i32.const 8) (get_local 0))) + (block (result i32) + (drop (br_if 1 (i32.const 8) (local.get 0))) (i32.const 16) ) ) @@ -62,10 +291,12 @@ (func (export "nested-br-value") (param i32) (result i32) (i32.add (i32.const 1) - (block i32 + (block (result i32) (drop (i32.const 2)) (br 0 - (block i32 (drop (br_if 1 (i32.const 8) (get_local 0))) (i32.const 4)) + (block (result i32) + (drop (br_if 1 (i32.const 8) (local.get 0))) (i32.const 4) + ) ) (i32.const 16) ) @@ -75,10 +306,12 @@ (func (export "nested-br_if-value") (param i32) (result i32) (i32.add (i32.const 1) - (block i32 + (block (result i32) (drop (i32.const 2)) (drop (br_if 0 - (block i32 (drop (br_if 1 (i32.const 8) (get_local 0))) (i32.const 4)) + (block (result i32) + (drop (br_if 1 (i32.const 8) (local.get 0))) (i32.const 4) + ) (i32.const 1) )) (i32.const 16) @@ -89,11 +322,13 @@ (func (export "nested-br_if-value-cond") (param i32) (result i32) (i32.add (i32.const 1) - (block i32 + (block (result i32) (drop (i32.const 2)) (drop (br_if 0 (i32.const 4) - (block i32 (drop (br_if 1 (i32.const 8) (get_local 0))) (i32.const 1)) + (block (result i32) + (drop (br_if 1 (i32.const 8) (local.get 0))) (i32.const 1) + ) )) (i32.const 16) ) @@ -103,10 +338,12 @@ (func (export "nested-br_table-value") (param i32) (result i32) (i32.add (i32.const 1) - (block i32 + (block (result i32) (drop (i32.const 2)) (br_table 0 - (block i32 (drop (br_if 1 (i32.const 8) (get_local 0))) (i32.const 4)) + (block (result i32) + (drop (br_if 1 (i32.const 8) (local.get 0))) (i32.const 4) + ) (i32.const 1) ) (i32.const 16) @@ -117,24 +354,42 @@ (func (export "nested-br_table-value-index") (param i32) (result i32) (i32.add (i32.const 1) - (block i32 + (block (result i32) (drop (i32.const 2)) (br_table 0 (i32.const 4) - (block i32 (drop (br_if 1 (i32.const 8) (get_local 0))) (i32.const 1)) + (block (result i32) + (drop (br_if 1 (i32.const 8) (local.get 0))) (i32.const 1) + ) ) (i32.const 16) ) ) ) + ) +(assert_return (invoke "type-i32")) +(assert_return (invoke "type-i64")) +(assert_return (invoke "type-f32")) +(assert_return (invoke "type-f64")) + +(assert_return (invoke "type-i32-value") (i32.const 1)) +(assert_return (invoke "type-i64-value") (i64.const 2)) +(assert_return (invoke "type-f32-value") (f32.const 3)) +(assert_return (invoke "type-f64-value") (f64.const 4)) + (assert_return (invoke "as-block-first" (i32.const 0)) (i32.const 2)) (assert_return (invoke "as-block-first" (i32.const 1)) (i32.const 3)) (assert_return (invoke "as-block-mid" (i32.const 0)) (i32.const 2)) (assert_return (invoke "as-block-mid" (i32.const 1)) (i32.const 3)) (assert_return (invoke "as-block-last" (i32.const 0))) (assert_return (invoke "as-block-last" (i32.const 1))) + +(assert_return (invoke "as-block-first-value" (i32.const 0)) (i32.const 11)) +(assert_return (invoke "as-block-first-value" (i32.const 1)) (i32.const 10)) +(assert_return (invoke "as-block-mid-value" (i32.const 0)) (i32.const 21)) +(assert_return (invoke "as-block-mid-value" (i32.const 1)) (i32.const 20)) (assert_return (invoke "as-block-last-value" (i32.const 0)) (i32.const 11)) (assert_return (invoke "as-block-last-value" (i32.const 1)) (i32.const 11)) @@ -145,6 +400,21 @@ (assert_return (invoke "as-loop-last" (i32.const 0))) (assert_return (invoke "as-loop-last" (i32.const 1))) +(assert_return (invoke "as-br-value") (i32.const 1)) + +(assert_return (invoke "as-br_if-cond")) +(assert_return (invoke "as-br_if-value") (i32.const 1)) +(assert_return (invoke "as-br_if-value-cond" (i32.const 0)) (i32.const 2)) +(assert_return (invoke "as-br_if-value-cond" (i32.const 1)) (i32.const 1)) + +(assert_return (invoke "as-br_table-index")) +(assert_return (invoke "as-br_table-value") (i32.const 1)) +(assert_return (invoke "as-br_table-value-index") (i32.const 1)) + +(assert_return (invoke "as-return-value") (i64.const 1)) + +(assert_return (invoke "as-if-cond" (i32.const 0)) (i32.const 2)) +(assert_return (invoke "as-if-cond" (i32.const 1)) (i32.const 1)) (assert_return (invoke "as-if-then" (i32.const 0) (i32.const 0))) (assert_return (invoke "as-if-then" (i32.const 4) (i32.const 0))) (assert_return (invoke "as-if-then" (i32.const 0) (i32.const 1))) @@ -154,6 +424,46 @@ (assert_return (invoke "as-if-else" (i32.const 0) (i32.const 1))) (assert_return (invoke "as-if-else" (i32.const 3) (i32.const 1))) +(assert_return (invoke "as-select-first" (i32.const 0)) (i32.const 3)) +(assert_return (invoke "as-select-first" (i32.const 1)) (i32.const 3)) +(assert_return (invoke "as-select-second" (i32.const 0)) (i32.const 3)) +(assert_return (invoke "as-select-second" (i32.const 1)) (i32.const 3)) +(assert_return (invoke "as-select-cond") (i32.const 3)) + +(assert_return (invoke "as-call-first") (i32.const 12)) +(assert_return (invoke "as-call-mid") (i32.const 13)) +(assert_return (invoke "as-call-last") (i32.const 14)) + +(assert_return (invoke "as-call_indirect-func") (i32.const 4)) +(assert_return (invoke "as-call_indirect-first") (i32.const 4)) +(assert_return (invoke "as-call_indirect-mid") (i32.const 4)) +(assert_return (invoke "as-call_indirect-last") (i32.const 4)) + +(assert_return (invoke "as-local.set-value" (i32.const 0)) (i32.const -1)) +(assert_return (invoke "as-local.set-value" (i32.const 1)) (i32.const 17)) + +(assert_return (invoke "as-local.tee-value" (i32.const 0)) (i32.const -1)) +(assert_return (invoke "as-local.tee-value" (i32.const 1)) (i32.const 1)) + +(assert_return (invoke "as-global.set-value" (i32.const 0)) (i32.const -1)) +(assert_return (invoke "as-global.set-value" (i32.const 1)) (i32.const 1)) + +(assert_return (invoke "as-load-address") (i32.const 1)) +(assert_return (invoke "as-loadN-address") (i32.const 30)) + +(assert_return (invoke "as-store-address") (i32.const 30)) +(assert_return (invoke "as-store-value") (i32.const 31)) +(assert_return (invoke "as-storeN-address") (i32.const 32)) +(assert_return (invoke "as-storeN-value") (i32.const 33)) + +(assert_return (invoke "as-unary-operand") (f64.const 1.0)) +(assert_return (invoke "as-binary-left") (i32.const 1)) +(assert_return (invoke "as-binary-right") (i32.const 1)) +(assert_return (invoke "as-test-operand") (i32.const 0)) +(assert_return (invoke "as-compare-left") (i32.const 1)) +(assert_return (invoke "as-compare-right") (i32.const 1)) +(assert_return (invoke "as-memory.grow-size") (i32.const 1)) + (assert_return (invoke "nested-block-value" (i32.const 0)) (i32.const 21)) (assert_return (invoke "nested-block-value" (i32.const 1)) (i32.const 9)) (assert_return (invoke "nested-br-value" (i32.const 0)) (i32.const 5)) @@ -203,13 +513,13 @@ (assert_invalid (module (func $type-false-arg-void-vs-num (result i32) - (block i32 (br_if 0 (i32.const 0)) (i32.const 1)) + (block (result i32) (br_if 0 (i32.const 0)) (i32.const 1)) )) "type mismatch" ) (assert_invalid (module (func $type-true-arg-void-vs-num (result i32) - (block i32 (br_if 0 (i32.const 1)) (i32.const 1)) + (block (result i32) (br_if 0 (i32.const 1)) (i32.const 1)) )) "type mismatch" ) @@ -228,29 +538,39 @@ (assert_invalid (module (func $type-false-arg-void-vs-num (result i32) - (block i32 (br_if 0 (nop) (i32.const 0)) (i32.const 1)) + (block (result i32) (br_if 0 (nop) (i32.const 0)) (i32.const 1)) )) "type mismatch" ) (assert_invalid (module (func $type-true-arg-void-vs-num (result i32) - (block i32 (br_if 0 (nop) (i32.const 1)) (i32.const 1)) + (block (result i32) (br_if 0 (nop) (i32.const 1)) (i32.const 1)) )) "type mismatch" ) (assert_invalid (module (func $type-false-arg-num-vs-num (result i32) - (block i32 (drop (br_if 0 (i64.const 1) (i32.const 0))) (i32.const 1)) + (block (result i32) + (drop (br_if 0 (i64.const 1) (i32.const 0))) (i32.const 1) + ) )) "type mismatch" ) (assert_invalid (module (func $type-true-arg-num-vs-num (result i32) - (block i32 (drop (br_if 0 (i64.const 1) (i32.const 0))) (i32.const 1)) + (block (result i32) + (drop (br_if 0 (i64.const 1) (i32.const 0))) (i32.const 1) + ) )) "type mismatch" ) +(assert_invalid + (module (func $type-cond-empty-vs-i32 + (block (br_if 0)) + )) + "type mismatch" +) (assert_invalid (module (func $type-cond-void-vs-i32 (block (br_if 0 (nop))) @@ -265,23 +585,71 @@ ) (assert_invalid (module (func $type-arg-cond-void-vs-i32 (result i32) - (block i32 (br_if 0 (i32.const 0) (nop)) (i32.const 1)) + (block (result i32) (br_if 0 (i32.const 0) (nop)) (i32.const 1)) )) "type mismatch" ) (assert_invalid (module (func $type-arg-void-vs-num-nested (result i32) - (block i32 (i32.const 0) (block (br_if 1 (i32.const 1)))) + (block (result i32) (i32.const 0) (block (br_if 1 (i32.const 1)))) )) "type mismatch" ) (assert_invalid (module (func $type-arg-cond-num-vs-i32 (result i32) - (block i32 (br_if 0 (i32.const 0) (i64.const 0)) (i32.const 1)) + (block (result i32) (br_if 0 (i32.const 0) (i64.const 0)) (i32.const 1)) )) "type mismatch" ) +(assert_invalid + (module + (func $type-1st-cond-empty-in-then + (block + (i32.const 0) (i32.const 0) + (if (result i32) (then (br_if 0))) + ) + (i32.eqz) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-2nd-cond-empty-in-then + (block + (i32.const 0) (i32.const 0) + (if (result i32) (then (br_if 0 (i32.const 1)))) + ) + (i32.eqz) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-1st-cond-empty-in-return + (block (result i32) + (return (br_if 0)) + ) + (i32.eqz) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-2nd-cond-empty-in-return + (block (result i32) + (return (br_if 0 (i32.const 1))) + ) + (i32.eqz) (drop) + ) + ) + "type mismatch" +) + + (assert_invalid (module (func $unbound-label (br_if 1 (i32.const 1)))) "unknown label" diff --git a/test/core/br_table.wast b/test/core/br_table.wast index 19a236f8..4ac79de6 100644 --- a/test/core/br_table.wast +++ b/test/core/br_table.wast @@ -18,30 +18,32 @@ ) (func (export "type-i32-value") (result i32) - (block i32 (i32.ctz (br_table 0 0 (i32.const 1) (i32.const 0)))) + (block (result i32) (i32.ctz (br_table 0 0 (i32.const 1) (i32.const 0)))) ) (func (export "type-i64-value") (result i64) - (block i64 (i64.ctz (br_table 0 0 (i64.const 2) (i32.const 0)))) + (block (result i64) (i64.ctz (br_table 0 0 (i64.const 2) (i32.const 0)))) ) (func (export "type-f32-value") (result f32) - (block f32 (f32.neg (br_table 0 0 (f32.const 3) (i32.const 0)))) + (block (result f32) (f32.neg (br_table 0 0 (f32.const 3) (i32.const 0)))) ) (func (export "type-f64-value") (result f64) - (block f64 (f64.neg (br_table 0 0 (f64.const 4) (i32.const 0)))) + (block (result f64) (f64.neg (br_table 0 0 (f64.const 4) (i32.const 0)))) ) (func (export "empty") (param i32) (result i32) - (block (br_table 0 (get_local 0)) (return (i32.const 21))) + (block (br_table 0 (local.get 0)) (return (i32.const 21))) (i32.const 22) ) (func (export "empty-value") (param i32) (result i32) - (block i32 (br_table 0 (i32.const 33) (get_local 0)) (i32.const 31)) + (block (result i32) + (br_table 0 (i32.const 33) (local.get 0)) (i32.const 31) + ) ) (func (export "singleton") (param i32) (result i32) (block (block - (br_table 1 0 (get_local 0)) + (br_table 1 0 (local.get 0)) (return (i32.const 21)) ) (return (i32.const 20)) @@ -50,10 +52,10 @@ ) (func (export "singleton-value") (param i32) (result i32) - (block i32 + (block (result i32) (drop - (block i32 - (br_table 0 1 (i32.const 33) (get_local 0)) + (block (result i32) + (br_table 0 1 (i32.const 33) (local.get 0)) (return (i32.const 31)) ) ) @@ -67,7 +69,7 @@ (block (block (block - (br_table 3 2 1 0 4 (get_local 0)) + (br_table 3 2 1 0 4 (local.get 0)) (return (i32.const 99)) ) (return (i32.const 100)) @@ -83,23 +85,23 @@ (func (export "multiple-value") (param i32) (result i32) (local i32) - (set_local 1 (block i32 - (set_local 1 (block i32 - (set_local 1 (block i32 - (set_local 1 (block i32 - (set_local 1 (block i32 - (br_table 3 2 1 0 4 (i32.const 200) (get_local 0)) - (return (i32.add (get_local 1) (i32.const 99))) + (local.set 1 (block (result i32) + (local.set 1 (block (result i32) + (local.set 1 (block (result i32) + (local.set 1 (block (result i32) + (local.set 1 (block (result i32) + (br_table 3 2 1 0 4 (i32.const 200) (local.get 0)) + (return (i32.add (local.get 1) (i32.const 99))) )) - (return (i32.add (get_local 1) (i32.const 10))) + (return (i32.add (local.get 1) (i32.const 10))) )) - (return (i32.add (get_local 1) (i32.const 11))) + (return (i32.add (local.get 1) (i32.const 11))) )) - (return (i32.add (get_local 1) (i32.const 12))) + (return (i32.add (local.get 1) (i32.const 12))) )) - (return (i32.add (get_local 1) (i32.const 13))) + (return (i32.add (local.get 1) (i32.const 13))) )) - (i32.add (get_local 1) (i32.const 14)) + (i32.add (local.get 1) (i32.const 14)) ) (func (export "large") (param i32) (result i32) @@ -830,7 +832,7 @@ 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 - (get_local 0) + (local.get 0) ) (return (i32.const -1)) ) @@ -849,38 +851,42 @@ (block (nop) (call $dummy) (br_table 0 0 0 (i32.const 0))) ) (func (export "as-block-value") (result i32) - (block i32 (nop) (call $dummy) (br_table 0 0 0 (i32.const 2) (i32.const 0))) + (block (result i32) + (nop) (call $dummy) (br_table 0 0 0 (i32.const 2) (i32.const 0)) + ) ) (func (export "as-loop-first") (result i32) - (loop i32 (br_table 1 1 (i32.const 3) (i32.const 0)) (i32.const 1)) + (loop (result i32) (br_table 1 1 (i32.const 3) (i32.const 0)) (i32.const 1)) ) (func (export "as-loop-mid") (result i32) - (loop i32 + (loop (result i32) (call $dummy) (br_table 1 1 1 (i32.const 4) (i32.const -1)) (i32.const 2) ) ) (func (export "as-loop-last") (result i32) - (loop i32 (nop) (call $dummy) (br_table 1 1 1 (i32.const 5) (i32.const 1))) + (loop (result i32) + (nop) (call $dummy) (br_table 1 1 1 (i32.const 5) (i32.const 1)) + ) ) (func (export "as-br-value") (result i32) - (block i32 (br 0 (br 0 (i32.const 9)))) + (block (result i32) (br 0 (br_table 0 (i32.const 9) (i32.const 0)))) ) (func (export "as-br_if-cond") (block (br_if 0 (br_table 0 0 0 (i32.const 1)))) ) (func (export "as-br_if-value") (result i32) - (block i32 + (block (result i32) (drop (br_if 0 (br_table 0 (i32.const 8) (i32.const 0)) (i32.const 1))) (i32.const 7) ) ) (func (export "as-br_if-value-cond") (result i32) - (block i32 + (block (result i32) (drop (br_if 0 (i32.const 6) (br_table 0 0 (i32.const 9) (i32.const 0)))) (i32.const 7) ) @@ -890,66 +896,66 @@ (block (br_table 0 0 0 (br_table 0 (i32.const 1)))) ) (func (export "as-br_table-value") (result i32) - (block i32 + (block (result i32) (br_table 0 0 0 (br_table 0 (i32.const 10) (i32.const 0)) (i32.const 1)) (i32.const 7) ) ) (func (export "as-br_table-value-index") (result i32) - (block i32 + (block (result i32) (br_table 0 0 (i32.const 6) (br_table 0 (i32.const 11) (i32.const 1))) (i32.const 7) ) ) (func (export "as-return-value") (result i64) - (block i64 (return (br_table 0 (i64.const 7) (i32.const 0)))) + (block (result i64) (return (br_table 0 (i64.const 7) (i32.const 0)))) ) (func (export "as-if-cond") (result i32) - (block i32 - (if i32 + (block (result i32) + (if (result i32) (br_table 0 (i32.const 2) (i32.const 0)) - (i32.const 0) - (i32.const 1) + (then (i32.const 0)) + (else (i32.const 1)) ) ) ) (func (export "as-if-then") (param i32 i32) (result i32) - (block i32 - (if i32 - (get_local 0) - (br_table 1 (i32.const 3) (i32.const 0)) - (get_local 1) + (block (result i32) + (if (result i32) + (local.get 0) + (then (br_table 1 (i32.const 3) (i32.const 0))) + (else (local.get 1)) ) ) ) (func (export "as-if-else") (param i32 i32) (result i32) - (block i32 - (if i32 - (get_local 0) - (get_local 1) - (br_table 1 0 (i32.const 4) (i32.const 0)) + (block (result i32) + (if (result i32) + (local.get 0) + (then (local.get 1)) + (else (br_table 1 0 (i32.const 4) (i32.const 0))) ) ) ) (func (export "as-select-first") (param i32 i32) (result i32) - (block i32 + (block (result i32) (select - (br_table 0 (i32.const 5) (i32.const 0)) (get_local 0) (get_local 1) + (br_table 0 (i32.const 5) (i32.const 0)) (local.get 0) (local.get 1) ) ) ) (func (export "as-select-second") (param i32 i32) (result i32) - (block i32 + (block (result i32) (select - (get_local 0) (br_table 0 (i32.const 6) (i32.const 1)) (get_local 1) + (local.get 0) (br_table 0 (i32.const 6) (i32.const 1)) (local.get 1) ) ) ) (func (export "as-select-cond") (result i32) - (block i32 + (block (result i32) (select (i32.const 0) (i32.const 1) (br_table 0 (i32.const 7) (i32.const 1)) ) @@ -958,21 +964,21 @@ (func $f (param i32 i32 i32) (result i32) (i32.const -1)) (func (export "as-call-first") (result i32) - (block i32 + (block (result i32) (call $f (br_table 0 (i32.const 12) (i32.const 1)) (i32.const 2) (i32.const 3) ) ) ) (func (export "as-call-mid") (result i32) - (block i32 + (block (result i32) (call $f (i32.const 1) (br_table 0 (i32.const 13) (i32.const 1)) (i32.const 3) ) ) ) (func (export "as-call-last") (result i32) - (block i32 + (block (result i32) (call $f (i32.const 1) (i32.const 2) (br_table 0 (i32.const 14) (i32.const 1)) ) @@ -980,133 +986,149 @@ ) (type $sig (func (param i32 i32 i32) (result i32))) - (table anyfunc (elem $f)) + (table funcref (elem $f)) (func (export "as-call_indirect-first") (result i32) - (block i32 - (call_indirect $sig + (block (result i32) + (call_indirect (type $sig) (br_table 0 (i32.const 20) (i32.const 1)) (i32.const 1) (i32.const 2) (i32.const 3) ) ) ) (func (export "as-call_indirect-mid") (result i32) - (block i32 - (call_indirect $sig + (block (result i32) + (call_indirect (type $sig) (i32.const 0) (br_table 0 (i32.const 21) (i32.const 1)) (i32.const 2) (i32.const 3) ) ) ) (func (export "as-call_indirect-last") (result i32) - (block i32 - (call_indirect $sig + (block (result i32) + (call_indirect (type $sig) (i32.const 0) (i32.const 1) (br_table 0 (i32.const 22) (i32.const 1)) (i32.const 3) ) ) ) (func (export "as-call_indirect-func") (result i32) - (block i32 - (call_indirect $sig + (block (result i32) + (call_indirect (type $sig) (i32.const 0) (i32.const 1) (i32.const 2) (br_table 0 (i32.const 23) (i32.const 1)) ) ) ) - (func (export "as-set_local-value") (result i32) + (func (export "as-local.set-value") (result i32) (local f32) - (block i32 - (set_local 0 (br_table 0 (i32.const 17) (i32.const 1))) + (block (result i32) + (local.set 0 (br_table 0 (i32.const 17) (i32.const 1))) + (i32.const -1) + ) + ) + (func (export "as-local.tee-value") (result i32) + (local i32) + (block (result i32) + (local.set 0 (br_table 0 (i32.const 1) (i32.const 1))) + (i32.const -1) + ) + ) + (global $a (mut i32) (i32.const 10)) + (func (export "as-global.set-value") (result i32) + (block (result i32) + (global.set $a (br_table 0 (i32.const 1) (i32.const 1))) (i32.const -1) ) ) (memory 1) (func (export "as-load-address") (result f32) - (block f32 (f32.load (br_table 0 (f32.const 1.7) (i32.const 1)))) + (block (result f32) (f32.load (br_table 0 (f32.const 1.7) (i32.const 1)))) ) (func (export "as-loadN-address") (result i64) - (block i64 (i64.load8_s (br_table 0 (i64.const 30) (i32.const 1)))) + (block (result i64) (i64.load8_s (br_table 0 (i64.const 30) (i32.const 1)))) ) (func (export "as-store-address") (result i32) - (block i32 + (block (result i32) (f64.store (br_table 0 (i32.const 30) (i32.const 1)) (f64.const 7)) (i32.const -1) ) ) (func (export "as-store-value") (result i32) - (block i32 + (block (result i32) (i64.store (i32.const 2) (br_table 0 (i32.const 31) (i32.const 1))) (i32.const -1) ) ) (func (export "as-storeN-address") (result i32) - (block i32 + (block (result i32) (i32.store8 (br_table 0 (i32.const 32) (i32.const 0)) (i32.const 7)) (i32.const -1) ) ) (func (export "as-storeN-value") (result i32) - (block i32 + (block (result i32) (i64.store16 (i32.const 2) (br_table 0 (i32.const 33) (i32.const 0))) (i32.const -1) ) ) (func (export "as-unary-operand") (result f32) - (block f32 (f32.neg (br_table 0 (f32.const 3.4) (i32.const 0)))) + (block (result f32) (f32.neg (br_table 0 (f32.const 3.4) (i32.const 0)))) ) (func (export "as-binary-left") (result i32) - (block i32 + (block (result i32) (i32.add (br_table 0 0 (i32.const 3) (i32.const 0)) (i32.const 10)) ) ) (func (export "as-binary-right") (result i64) - (block i64 + (block (result i64) (i64.sub (i64.const 10) (br_table 0 (i64.const 45) (i32.const 0))) ) ) (func (export "as-test-operand") (result i32) - (block i32 (i32.eqz (br_table 0 (i32.const 44) (i32.const 0)))) + (block (result i32) (i32.eqz (br_table 0 (i32.const 44) (i32.const 0)))) ) (func (export "as-compare-left") (result i32) - (block i32 + (block (result i32) (f64.le (br_table 0 0 (i32.const 43) (i32.const 0)) (f64.const 10)) ) ) (func (export "as-compare-right") (result i32) - (block i32 + (block (result i32) (f32.ne (f32.const 10) (br_table 0 (i32.const 42) (i32.const 0))) ) ) (func (export "as-convert-operand") (result i32) - (block i32 (i32.wrap/i64 (br_table 0 (i32.const 41) (i32.const 0)))) + (block (result i32) + (i32.wrap_i64 (br_table 0 (i32.const 41) (i32.const 0))) + ) ) - (func (export "as-grow_memory-size") (result i32) - (block i32 (grow_memory (br_table 0 (i32.const 40) (i32.const 0)))) + (func (export "as-memory.grow-size") (result i32) + (block (result i32) (memory.grow (br_table 0 (i32.const 40) (i32.const 0)))) ) (func (export "nested-block-value") (param i32) (result i32) - (block i32 + (block (result i32) (drop (i32.const -1)) (i32.add (i32.const 1) - (block i32 + (block (result i32) (i32.add (i32.const 2) - (block i32 + (block (result i32) (drop (i32.const 4)) (i32.add (i32.const 8) - (br_table 0 1 2 (i32.const 16) (get_local 0)) + (br_table 0 1 2 (i32.const 16) (local.get 0)) ) ) ) @@ -1116,15 +1138,15 @@ ) (func (export "nested-br-value") (param i32) (result i32) - (block i32 + (block (result i32) (i32.add (i32.const 1) - (block i32 + (block (result i32) (drop (i32.const 2)) (drop - (block i32 + (block (result i32) (drop (i32.const 4)) - (br 0 (br_table 2 1 0 (i32.const 8) (get_local 0))) + (br 0 (br_table 2 1 0 (i32.const 8) (local.get 0))) ) ) (i32.const 16) @@ -1134,17 +1156,17 @@ ) (func (export "nested-br_if-value") (param i32) (result i32) - (block i32 + (block (result i32) (i32.add (i32.const 1) - (block i32 + (block (result i32) (drop (i32.const 2)) (drop - (block i32 + (block (result i32) (drop (i32.const 4)) (drop (br_if 0 - (br_table 0 1 2 (i32.const 8) (get_local 0)) + (br_table 0 1 2 (i32.const 8) (local.get 0)) (i32.const 1) ) ) @@ -1158,13 +1180,13 @@ ) (func (export "nested-br_if-value-cond") (param i32) (result i32) - (block i32 + (block (result i32) (i32.add (i32.const 1) - (block i32 + (block (result i32) (drop (i32.const 2)) (drop - (br_if 0 (i32.const 4) (br_table 0 1 0 (i32.const 8) (get_local 0))) + (br_if 0 (i32.const 4) (br_table 0 1 0 (i32.const 8) (local.get 0))) ) (i32.const 16) ) @@ -1173,15 +1195,15 @@ ) (func (export "nested-br_table-value") (param i32) (result i32) - (block i32 + (block (result i32) (i32.add (i32.const 1) - (block i32 + (block (result i32) (drop (i32.const 2)) (drop - (block i32 + (block (result i32) (drop (i32.const 4)) - (br_table 0 (br_table 0 1 2 (i32.const 8) (get_local 0)) (i32.const 1)) + (br_table 0 (br_table 0 1 2 (i32.const 8) (local.get 0)) (i32.const 1)) (i32.const 32) ) ) @@ -1192,12 +1214,12 @@ ) (func (export "nested-br_table-value-index") (param i32) (result i32) - (block i32 + (block (result i32) (i32.add (i32.const 1) - (block i32 + (block (result i32) (drop (i32.const 2)) - (br_table 0 (i32.const 4) (br_table 0 1 0 (i32.const 8) (get_local 0))) + (br_table 0 (i32.const 4) (br_table 0 1 0 (i32.const 8) (local.get 0))) (i32.const 16) ) ) @@ -1205,21 +1227,88 @@ ) (func (export "nested-br_table-loop-block") (param i32) (result i32) - (set_local 0 - (loop i32 + (local.set 0 + (loop (result i32) (block - (br_table 1 0 0 (get_local 0)) + (br_table 1 0 0 (local.get 0)) ) (i32.const 0) ) ) - (loop i32 + (loop (result i32) (block - (br_table 0 1 1 (get_local 0)) + (br_table 0 1 1 (local.get 0)) ) (i32.const 3) ) ) + + (func (export "meet-anyref") (param i32) (param anyref) (result anyref) + (block $l1 (result anyref) + (block $l2 (result anyref) + (br_table $l1 $l2 $l1 (local.get 1) (local.get 0)) + ) + ) + ) + + (func (export "meet-funcref-1") (param i32) (result anyref) + (block $l1 (result anyref) + (block $l2 (result funcref) + (br_table $l1 $l1 $l2 (table.get 0 (i32.const 0)) (local.get 0)) + ) + ) + ) + (func (export "meet-funcref-2") (param i32) (result anyref) + (block $l1 (result anyref) + (block $l2 (result funcref) + (br_table $l2 $l2 $l1 (table.get 0 (i32.const 0)) (local.get 0)) + ) + ) + ) + (func (export "meet-funcref-3") (param i32) (result anyref) + (block $l1 (result anyref) + (block $l2 (result funcref) + (br_table $l2 $l1 $l2 (table.get 0 (i32.const 0)) (local.get 0)) + ) + ) + ) + (func (export "meet-funcref-4") (param i32) (result anyref) + (block $l1 (result anyref) + (block $l2 (result funcref) + (br_table $l1 $l2 $l1 (table.get 0 (i32.const 0)) (local.get 0)) + ) + ) + ) + + (func (export "meet-nullref") (param i32) (result funcref) + (block $l1 (result funcref) + (block $l2 (result nullref) + (br_table $l1 $l2 $l1 (ref.null) (local.get 0)) + ) + ) + ) + + (func (export "meet-multi-ref") (param i32) (result anyref) + (block $l1 (result anyref) + (block $l2 (result funcref) + (block $l3 (result nullref) + (br_table $l3 $l2 $l1 (ref.null) (local.get 0)) + ) + ) + ) + ) + + (func (export "meet-bottom") + (block (result f64) + (block (result f32) + (unreachable) + (br_table 0 1 1 (i32.const 1)) + ) + (drop) + (f64.const 0) + ) + (drop) + ) ) (assert_return (invoke "type-i32")) @@ -1333,7 +1422,9 @@ (assert_return (invoke "as-call_indirect-last") (i32.const 22)) (assert_return (invoke "as-call_indirect-func") (i32.const 23)) -(assert_return (invoke "as-set_local-value") (i32.const 17)) +(assert_return (invoke "as-local.set-value") (i32.const 17)) +(assert_return (invoke "as-local.tee-value") (i32.const 1)) +(assert_return (invoke "as-global.set-value") (i32.const 1)) (assert_return (invoke "as-load-address") (f32.const 1.7)) (assert_return (invoke "as-loadN-address") (i64.const 30)) @@ -1355,7 +1446,7 @@ (assert_return (invoke "as-convert-operand") (i32.const 41)) -(assert_return (invoke "as-grow_memory-size") (i32.const 40)) +(assert_return (invoke "as-memory.grow-size") (i32.const 40)) (assert_return (invoke "nested-block-value" (i32.const 0)) (i32.const 19)) (assert_return (invoke "nested-block-value" (i32.const 1)) (i32.const 17)) @@ -1401,6 +1492,23 @@ (assert_return (invoke "nested-br_table-loop-block" (i32.const 1)) (i32.const 3)) +(assert_return (invoke "meet-anyref" (i32.const 0) (ref.host 1)) (ref.host 1)) +(assert_return (invoke "meet-anyref" (i32.const 1) (ref.host 1)) (ref.host 1)) +(assert_return (invoke "meet-anyref" (i32.const 2) (ref.host 1)) (ref.host 1)) + +(assert_return_func (invoke "meet-funcref-1" (i32.const 0))) +(assert_return_func (invoke "meet-funcref-1" (i32.const 1))) +(assert_return_func (invoke "meet-funcref-1" (i32.const 2))) +(assert_return_func (invoke "meet-funcref-2" (i32.const 0))) +(assert_return_func (invoke "meet-funcref-2" (i32.const 1))) +(assert_return_func (invoke "meet-funcref-2" (i32.const 2))) +(assert_return_func (invoke "meet-funcref-3" (i32.const 0))) +(assert_return_func (invoke "meet-funcref-3" (i32.const 1))) +(assert_return_func (invoke "meet-funcref-3" (i32.const 2))) +(assert_return_func (invoke "meet-funcref-4" (i32.const 0))) +(assert_return_func (invoke "meet-funcref-4" (i32.const 1))) +(assert_return_func (invoke "meet-funcref-4" (i32.const 2))) + (assert_invalid (module (func $type-arg-void-vs-num (result i32) (block (br_table 0 (i32.const 1)) (i32.const 1)) @@ -1408,22 +1516,31 @@ "type mismatch" ) +(assert_invalid + (module (func $type-arg-empty-vs-num (result i32) + (block (br_table 0) (i32.const 1)) + )) + "type mismatch" +) + (assert_invalid (module (func $type-arg-void-vs-num (result i32) - (block i32 (br_table 0 (nop) (i32.const 1)) (i32.const 1)) + (block (result i32) (br_table 0 (nop) (i32.const 1)) (i32.const 1)) )) "type mismatch" ) (assert_invalid (module (func $type-arg-num-vs-num (result i32) - (block i32 (br_table 0 0 0 (i64.const 1) (i32.const 1)) (i32.const 1)) + (block (result i32) + (br_table 0 0 0 (i64.const 1) (i32.const 1)) (i32.const 1) + ) )) "type mismatch" ) (assert_invalid (module (func $type-arg-num-vs-arg-num (block - (block f32 + (block (result f32) (br_table 0 1 (f32.const 0) (i32.const 0)) ) (drop) @@ -1446,19 +1563,89 @@ ) (assert_invalid (module (func $type-arg-index-void-vs-i32 (result i32) - (block i32 (br_table 0 0 (i32.const 0) (nop)) (i32.const 1)) + (block (result i32) (br_table 0 0 (i32.const 0) (nop)) (i32.const 1)) )) "type mismatch" ) (assert_invalid (module (func $type-arg-void-vs-num-nested (result i32) - (block i32 (i32.const 0) (block (br_table 1 (i32.const 0)))) + (block (result i32) (i32.const 0) (block (br_table 1 (i32.const 0)))) )) "type mismatch" ) (assert_invalid (module (func $type-arg-index-num-vs-i32 (result i32) - (block i32 (br_table 0 0 (i32.const 0) (i64.const 0)) (i32.const 1)) + (block (result i32) + (br_table 0 0 (i32.const 0) (i64.const 0)) (i32.const 1) + ) + )) + "type mismatch" +) + +(assert_invalid + (module (func $type-arg-void-vs-num (result i32) + (block (br_table 0 (i32.const 1)) (i32.const 1)) + )) + "type mismatch" +) + +(assert_invalid + (module + (func $type-arg-index-empty-in-then + (block + (i32.const 0) (i32.const 0) + (if (result i32) (then (br_table 0))) + ) + (i32.eqz) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-arg-value-empty-in-then + (block + (i32.const 0) (i32.const 0) + (if (result i32) (then (br_table 0 (i32.const 1)))) + ) + (i32.eqz) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-arg-index-empty-in-return + (block (result i32) + (return (br_table 0)) + ) + (i32.eqz) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-arg-value-empty-in-return + (block (result i32) + (return (br_table 0 (i32.const 1))) + ) + (i32.eqz) (drop) + ) + ) + "type mismatch" +) + +(assert_invalid + (module (func $meet-bottom (param i32) (result anyref) + (block $l1 (result anyref) + (drop + (block $l2 (result i32) + (br_table $l2 $l1 $l2 (ref.null) (local.get 0)) + ) + ) + (ref.null) + ) )) "type mismatch" ) diff --git a/test/core/call.wast b/test/core/call.wast index 612daf20..3e4d6d56 100644 --- a/test/core/call.wast +++ b/test/core/call.wast @@ -7,15 +7,15 @@ (func $const-f32 (result f32) (f32.const 0xf32)) (func $const-f64 (result f64) (f64.const 0xf64)) - (func $id-i32 (param i32) (result i32) (get_local 0)) - (func $id-i64 (param i64) (result i64) (get_local 0)) - (func $id-f32 (param f32) (result f32) (get_local 0)) - (func $id-f64 (param f64) (result f64) (get_local 0)) + (func $id-i32 (param i32) (result i32) (local.get 0)) + (func $id-i64 (param i64) (result i64) (local.get 0)) + (func $id-f32 (param f32) (result f32) (local.get 0)) + (func $id-f64 (param f64) (result f64) (local.get 0)) - (func $f32-i32 (param f32 i32) (result i32) (get_local 1)) - (func $i32-i64 (param i32 i64) (result i64) (get_local 1)) - (func $f64-f32 (param f64 f32) (result f32) (get_local 1)) - (func $i64-f64 (param i64 f64) (result f64) (get_local 1)) + (func $f32-i32 (param f32 i32) (result i32) (local.get 1)) + (func $i32-i64 (param i32 i64) (result i64) (local.get 1)) + (func $f64-f32 (param f64 f32) (result f32) (local.get 1)) + (func $i64-f64 (param i64 f64) (result f64) (local.get 1)) ;; Typing @@ -45,42 +45,51 @@ ;; Recursion (func $fac (export "fac") (param i64) (result i64) - (if i64 (i64.eqz (get_local 0)) - (i64.const 1) - (i64.mul (get_local 0) (call $fac (i64.sub (get_local 0) (i64.const 1)))) + (if (result i64) (i64.eqz (local.get 0)) + (then (i64.const 1)) + (else + (i64.mul + (local.get 0) + (call $fac (i64.sub (local.get 0) (i64.const 1))) + ) + ) ) ) (func $fac-acc (export "fac-acc") (param i64 i64) (result i64) - (if i64 (i64.eqz (get_local 0)) - (get_local 1) - (call $fac-acc - (i64.sub (get_local 0) (i64.const 1)) - (i64.mul (get_local 0) (get_local 1)) + (if (result i64) (i64.eqz (local.get 0)) + (then (local.get 1)) + (else + (call $fac-acc + (i64.sub (local.get 0) (i64.const 1)) + (i64.mul (local.get 0) (local.get 1)) + ) ) ) ) (func $fib (export "fib") (param i64) (result i64) - (if i64 (i64.le_u (get_local 0) (i64.const 1)) - (i64.const 1) - (i64.add - (call $fib (i64.sub (get_local 0) (i64.const 2))) - (call $fib (i64.sub (get_local 0) (i64.const 1))) + (if (result i64) (i64.le_u (local.get 0) (i64.const 1)) + (then (i64.const 1)) + (else + (i64.add + (call $fib (i64.sub (local.get 0) (i64.const 2))) + (call $fib (i64.sub (local.get 0) (i64.const 1))) + ) ) ) ) (func $even (export "even") (param i64) (result i32) - (if i32 (i64.eqz (get_local 0)) - (i32.const 44) - (call $odd (i64.sub (get_local 0) (i64.const 1))) + (if (result i32) (i64.eqz (local.get 0)) + (then (i32.const 44)) + (else (call $odd (i64.sub (local.get 0) (i64.const 1)))) ) ) (func $odd (export "odd") (param i64) (result i32) - (if i32 (i64.eqz (get_local 0)) - (i32.const 99) - (call $even (i64.sub (get_local 0) (i64.const 1))) + (if (result i32) (i64.eqz (local.get 0)) + (then (i32.const 99)) + (else (call $even (i64.sub (local.get 0) (i64.const 1)))) ) ) @@ -97,6 +106,125 @@ (func $mutual-runaway1 (export "mutual-runaway") (call $mutual-runaway2)) (func $mutual-runaway2 (call $mutual-runaway1)) + + ;; As parameter of control constructs and instructions + + (memory 1) + + (func (export "as-select-first") (result i32) + (select (call $const-i32) (i32.const 2) (i32.const 3)) + ) + (func (export "as-select-mid") (result i32) + (select (i32.const 2) (call $const-i32) (i32.const 3)) + ) + (func (export "as-select-last") (result i32) + (select (i32.const 2) (i32.const 3) (call $const-i32)) + ) + + (func (export "as-if-condition") (result i32) + (if (result i32) (call $const-i32) (then (i32.const 1)) (else (i32.const 2))) + ) + + (func (export "as-br_if-first") (result i32) + (block (result i32) (br_if 0 (call $const-i32) (i32.const 2))) + ) + (func (export "as-br_if-last") (result i32) + (block (result i32) (br_if 0 (i32.const 2) (call $const-i32))) + ) + + (func (export "as-br_table-first") (result i32) + (block (result i32) (call $const-i32) (i32.const 2) (br_table 0 0)) + ) + (func (export "as-br_table-last") (result i32) + (block (result i32) (i32.const 2) (call $const-i32) (br_table 0 0)) + ) + + (func $func (param i32 i32) (result i32) (local.get 0)) + (type $check (func (param i32 i32) (result i32))) + (table funcref (elem $func)) + (func (export "as-call_indirect-first") (result i32) + (block (result i32) + (call_indirect (type $check) + (call $const-i32) (i32.const 2) (i32.const 0) + ) + ) + ) + (func (export "as-call_indirect-mid") (result i32) + (block (result i32) + (call_indirect (type $check) + (i32.const 2) (call $const-i32) (i32.const 0) + ) + ) + ) + (func (export "as-call_indirect-last") (result i32) + (block (result i32) + (call_indirect (type $check) + (i32.const 1) (i32.const 2) (call $const-i32) + ) + ) + ) + + (func (export "as-store-first") + (call $const-i32) (i32.const 1) (i32.store) + ) + (func (export "as-store-last") + (i32.const 10) (call $const-i32) (i32.store) + ) + + (func (export "as-memory.grow-value") (result i32) + (memory.grow (call $const-i32)) + ) + (func (export "as-return-value") (result i32) + (call $const-i32) (return) + ) + (func (export "as-drop-operand") + (call $const-i32) (drop) + ) + (func (export "as-br-value") (result i32) + (block (result i32) (br 0 (call $const-i32))) + ) + (func (export "as-local.set-value") (result i32) + (local i32) (local.set 0 (call $const-i32)) (local.get 0) + ) + (func (export "as-local.tee-value") (result i32) + (local i32) (local.tee 0 (call $const-i32)) + ) + (global $a (mut i32) (i32.const 10)) + (func (export "as-global.set-value") (result i32) + (global.set $a (call $const-i32)) + (global.get $a) + ) + (func (export "as-load-operand") (result i32) + (i32.load (call $const-i32)) + ) + + (func $dummy (param i32) (result i32) (local.get 0)) + (func $du (param f32) (result f32) (local.get 0)) + (func (export "as-unary-operand") (result f32) + (block (result f32) (f32.sqrt (call $du (f32.const 0x0p+0)))) + ) + + (func (export "as-binary-left") (result i32) + (block (result i32) (i32.add (call $dummy (i32.const 1)) (i32.const 10))) + ) + (func (export "as-binary-right") (result i32) + (block (result i32) (i32.sub (i32.const 10) (call $dummy (i32.const 1)))) + ) + + (func (export "as-test-operand") (result i32) + (block (result i32) (i32.eqz (call $dummy (i32.const 1)))) + ) + + (func (export "as-compare-left") (result i32) + (block (result i32) (i32.le_u (call $dummy (i32.const 1)) (i32.const 10))) + ) + (func (export "as-compare-right") (result i32) + (block (result i32) (i32.ne (i32.const 10) (call $dummy (i32.const 1)))) + ) + + (func (export "as-convert-operand") (result i64) + (block (result i64) (i64.extend_i32_s (call $dummy (i32.const 1)))) + ) ) (assert_return (invoke "type-i32") (i32.const 0x132)) @@ -144,6 +272,41 @@ (assert_exhaustion (invoke "runaway") "call stack exhausted") (assert_exhaustion (invoke "mutual-runaway") "call stack exhausted") +(assert_return (invoke "as-select-first") (i32.const 0x132)) +(assert_return (invoke "as-select-mid") (i32.const 2)) +(assert_return (invoke "as-select-last") (i32.const 2)) + +(assert_return (invoke "as-if-condition") (i32.const 1)) + +(assert_return (invoke "as-br_if-first") (i32.const 0x132)) +(assert_return (invoke "as-br_if-last") (i32.const 2)) + +(assert_return (invoke "as-br_table-first") (i32.const 0x132)) +(assert_return (invoke "as-br_table-last") (i32.const 2)) + +(assert_return (invoke "as-call_indirect-first") (i32.const 0x132)) +(assert_return (invoke "as-call_indirect-mid") (i32.const 2)) +(assert_trap (invoke "as-call_indirect-last") "undefined element") + +(assert_return (invoke "as-store-first")) +(assert_return (invoke "as-store-last")) + +(assert_return (invoke "as-memory.grow-value") (i32.const 1)) +(assert_return (invoke "as-return-value") (i32.const 0x132)) +(assert_return (invoke "as-drop-operand")) +(assert_return (invoke "as-br-value") (i32.const 0x132)) +(assert_return (invoke "as-local.set-value") (i32.const 0x132)) +(assert_return (invoke "as-local.tee-value") (i32.const 0x132)) +(assert_return (invoke "as-global.set-value") (i32.const 0x132)) +(assert_return (invoke "as-load-operand") (i32.const 1)) + +(assert_return (invoke "as-unary-operand") (f32.const 0x0p+0)) +(assert_return (invoke "as-binary-left") (i32.const 11)) +(assert_return (invoke "as-binary-right") (i32.const 9)) +(assert_return (invoke "as-test-operand") (i32.const 0)) +(assert_return (invoke "as-compare-left") (i32.const 1)) +(assert_return (invoke "as-compare-right") (i32.const 1)) +(assert_return (invoke "as-convert-operand") (i64.const 1)) ;; Invalid typing @@ -220,6 +383,61 @@ "type mismatch" ) +(assert_invalid + (module + (func $type-first-empty-in-block + (block (call 1)) + ) + (func (param i32)) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-second-empty-in-block + (block (call 1 (i32.const 0))) + ) + (func (param i32 i32)) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-first-empty-in-loop + (loop (call 1)) + ) + (func (param i32)) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-second-empty-in-loop + (loop (call 1 (i32.const 0))) + ) + (func (param i32 i32)) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-first-empty-in-then + (if (i32.const 0) (then (call 1))) + ) + (func (param i32)) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-second-empty-in-then + (if (i32.const 0) (then (call 1 (i32.const 0)))) + ) + (func (param i32 i32)) + ) + "type mismatch" +) + ;; Unbound function diff --git a/test/core/call_indirect.wast b/test/core/call_indirect.wast index f42ffeda..87d1df75 100644 --- a/test/core/call_indirect.wast +++ b/test/core/call_indirect.wast @@ -25,126 +25,280 @@ (func $const-f32 (type $out-f32) (f32.const 0xf32)) (func $const-f64 (type $out-f64) (f64.const 0xf64)) - (func $id-i32 (type $over-i32) (get_local 0)) - (func $id-i64 (type $over-i64) (get_local 0)) - (func $id-f32 (type $over-f32) (get_local 0)) - (func $id-f64 (type $over-f64) (get_local 0)) - - (func $i32-i64 (type $i32-i64) (get_local 1)) - (func $i64-f64 (type $i64-f64) (get_local 1)) - (func $f32-i32 (type $f32-i32) (get_local 1)) - (func $f64-f32 (type $f64-f32) (get_local 1)) - - (func $over-i32-duplicate (type $over-i32-duplicate) (get_local 0)) - (func $over-i64-duplicate (type $over-i64-duplicate) (get_local 0)) - (func $over-f32-duplicate (type $over-f32-duplicate) (get_local 0)) - (func $over-f64-duplicate (type $over-f64-duplicate) (get_local 0)) - - (table anyfunc + (func $id-i32 (type $over-i32) (local.get 0)) + (func $id-i64 (type $over-i64) (local.get 0)) + (func $id-f32 (type $over-f32) (local.get 0)) + (func $id-f64 (type $over-f64) (local.get 0)) + + (func $i32-i64 (type $i32-i64) (local.get 1)) + (func $i64-f64 (type $i64-f64) (local.get 1)) + (func $f32-i32 (type $f32-i32) (local.get 1)) + (func $f64-f32 (type $f64-f32) (local.get 1)) + + (func $over-i32-duplicate (type $over-i32-duplicate) (local.get 0)) + (func $over-i64-duplicate (type $over-i64-duplicate) (local.get 0)) + (func $over-f32-duplicate (type $over-f32-duplicate) (local.get 0)) + (func $over-f64-duplicate (type $over-f64-duplicate) (local.get 0)) + + (table funcref (elem $const-i32 $const-i64 $const-f32 $const-f64 $id-i32 $id-i64 $id-f32 $id-f64 $f32-i32 $i32-i64 $f64-f32 $i64-f64 - $fac $fib $even $odd + $fac-i64 $fib-i64 $even $odd $runaway $mutual-runaway1 $mutual-runaway2 $over-i32-duplicate $over-i64-duplicate $over-f32-duplicate $over-f64-duplicate + $fac-i32 $fac-f32 $fac-f64 + $fib-i32 $fib-f32 $fib-f64 ) ) + ;; Syntax + + (func + (call_indirect (i32.const 0)) + (call_indirect (param i64) (i64.const 0) (i32.const 0)) + (call_indirect (param i64) (param) (param f64 i32 i64) + (i64.const 0) (f64.const 0) (i32.const 0) (i64.const 0) (i32.const 0) + ) + (call_indirect (result) (i32.const 0)) + (drop (i32.eqz (call_indirect (result i32) (i32.const 0)))) + (drop (i32.eqz (call_indirect (result i32) (result) (i32.const 0)))) + (drop (i32.eqz + (call_indirect (param i64) (result i32) (i64.const 0) (i32.const 0)) + )) + (drop (i32.eqz + (call_indirect + (param) (param i64) (param) (param f64 i32 i64) (param) (param) + (result) (result i32) (result) (result) + (i64.const 0) (f64.const 0) (i32.const 0) (i64.const 0) (i32.const 0) + ) + )) + (drop (i64.eqz + (call_indirect (type $over-i64) (param i64) (result i64) + (i64.const 0) (i32.const 0) + ) + )) + ) + ;; Typing - (func (export "type-i32") (result i32) (call_indirect $out-i32 (i32.const 0))) - (func (export "type-i64") (result i64) (call_indirect $out-i64 (i32.const 1))) - (func (export "type-f32") (result f32) (call_indirect $out-f32 (i32.const 2))) - (func (export "type-f64") (result f64) (call_indirect $out-f64 (i32.const 3))) + (func (export "type-i32") (result i32) + (call_indirect (type $out-i32) (i32.const 0)) + ) + (func (export "type-i64") (result i64) + (call_indirect (type $out-i64) (i32.const 1)) + ) + (func (export "type-f32") (result f32) + (call_indirect (type $out-f32) (i32.const 2)) + ) + (func (export "type-f64") (result f64) + (call_indirect (type $out-f64) (i32.const 3)) + ) (func (export "type-index") (result i64) - (call_indirect $over-i64 (i64.const 100) (i32.const 5)) + (call_indirect (type $over-i64) (i64.const 100) (i32.const 5)) ) (func (export "type-first-i32") (result i32) - (call_indirect $over-i32 (i32.const 32) (i32.const 4)) + (call_indirect (type $over-i32) (i32.const 32) (i32.const 4)) ) (func (export "type-first-i64") (result i64) - (call_indirect $over-i64 (i64.const 64) (i32.const 5)) + (call_indirect (type $over-i64) (i64.const 64) (i32.const 5)) ) (func (export "type-first-f32") (result f32) - (call_indirect $over-f32 (f32.const 1.32) (i32.const 6)) + (call_indirect (type $over-f32) (f32.const 1.32) (i32.const 6)) ) (func (export "type-first-f64") (result f64) - (call_indirect $over-f64 (f64.const 1.64) (i32.const 7)) + (call_indirect (type $over-f64) (f64.const 1.64) (i32.const 7)) ) (func (export "type-second-i32") (result i32) - (call_indirect $f32-i32 (f32.const 32.1) (i32.const 32) (i32.const 8)) + (call_indirect (type $f32-i32) (f32.const 32.1) (i32.const 32) (i32.const 8)) ) (func (export "type-second-i64") (result i64) - (call_indirect $i32-i64 (i32.const 32) (i64.const 64) (i32.const 9)) + (call_indirect (type $i32-i64) (i32.const 32) (i64.const 64) (i32.const 9)) ) (func (export "type-second-f32") (result f32) - (call_indirect $f64-f32 (f64.const 64) (f32.const 32) (i32.const 10)) + (call_indirect (type $f64-f32) (f64.const 64) (f32.const 32) (i32.const 10)) ) (func (export "type-second-f64") (result f64) - (call_indirect $i64-f64 (i64.const 64) (f64.const 64.1) (i32.const 11)) + (call_indirect (type $i64-f64) (i64.const 64) (f64.const 64.1) (i32.const 11)) ) ;; Dispatch (func (export "dispatch") (param i32 i64) (result i64) - (call_indirect $over-i64 (get_local 1) (get_local 0)) + (call_indirect (type $over-i64) (local.get 1) (local.get 0)) ) - (func (export "dispatch-structural") (param i32) (result i64) - (call_indirect $over-i64-duplicate (i64.const 9) (get_local 0)) + (func (export "dispatch-structural-i64") (param i32) (result i64) + (call_indirect (type $over-i64-duplicate) (i64.const 9) (local.get 0)) + ) + (func (export "dispatch-structural-i32") (param i32) (result i32) + (call_indirect (type $over-i32-duplicate) (i32.const 9) (local.get 0)) + ) + (func (export "dispatch-structural-f32") (param i32) (result f32) + (call_indirect (type $over-f32-duplicate) (f32.const 9.0) (local.get 0)) + ) + (func (export "dispatch-structural-f64") (param i32) (result f64) + (call_indirect (type $over-f64-duplicate) (f64.const 9.0) (local.get 0)) ) ;; Recursion - (func $fac (export "fac") (type $over-i64) - (if i64 (i64.eqz (get_local 0)) - (i64.const 1) - (i64.mul - (get_local 0) - (call_indirect $over-i64 - (i64.sub (get_local 0) (i64.const 1)) - (i32.const 12) + (func $fac-i64 (export "fac-i64") (type $over-i64) + (if (result i64) (i64.eqz (local.get 0)) + (then (i64.const 1)) + (else + (i64.mul + (local.get 0) + (call_indirect (type $over-i64) + (i64.sub (local.get 0) (i64.const 1)) + (i32.const 12) + ) + ) + ) + ) + ) + + (func $fib-i64 (export "fib-i64") (type $over-i64) + (if (result i64) (i64.le_u (local.get 0) (i64.const 1)) + (then (i64.const 1)) + (else + (i64.add + (call_indirect (type $over-i64) + (i64.sub (local.get 0) (i64.const 2)) + (i32.const 13) + ) + (call_indirect (type $over-i64) + (i64.sub (local.get 0) (i64.const 1)) + (i32.const 13) + ) + ) + ) + ) + ) + + (func $fac-i32 (export "fac-i32") (type $over-i32) + (if (result i32) (i32.eqz (local.get 0)) + (then (i32.const 1)) + (else + (i32.mul + (local.get 0) + (call_indirect (type $over-i32) + (i32.sub (local.get 0) (i32.const 1)) + (i32.const 23) + ) ) ) ) ) - (func $fib (export "fib") (type $over-i64) - (if i64 (i64.le_u (get_local 0) (i64.const 1)) - (i64.const 1) - (i64.add - (call_indirect $over-i64 - (i64.sub (get_local 0) (i64.const 2)) - (i32.const 13) + (func $fac-f32 (export "fac-f32") (type $over-f32) + (if (result f32) (f32.eq (local.get 0) (f32.const 0.0)) + (then (f32.const 1.0)) + (else + (f32.mul + (local.get 0) + (call_indirect (type $over-f32) + (f32.sub (local.get 0) (f32.const 1.0)) + (i32.const 24) + ) ) - (call_indirect $over-i64 - (i64.sub (get_local 0) (i64.const 1)) - (i32.const 13) + ) + ) + ) + + (func $fac-f64 (export "fac-f64") (type $over-f64) + (if (result f64) (f64.eq (local.get 0) (f64.const 0.0)) + (then (f64.const 1.0)) + (else + (f64.mul + (local.get 0) + (call_indirect (type $over-f64) + (f64.sub (local.get 0) (f64.const 1.0)) + (i32.const 25) + ) + ) + ) + ) + ) + + (func $fib-i32 (export "fib-i32") (type $over-i32) + (if (result i32) (i32.le_u (local.get 0) (i32.const 1)) + (then (i32.const 1)) + (else + (i32.add + (call_indirect (type $over-i32) + (i32.sub (local.get 0) (i32.const 2)) + (i32.const 26) + ) + (call_indirect (type $over-i32) + (i32.sub (local.get 0) (i32.const 1)) + (i32.const 26) + ) + ) + ) + ) + ) + + (func $fib-f32 (export "fib-f32") (type $over-f32) + (if (result f32) (f32.le (local.get 0) (f32.const 1.0)) + (then (f32.const 1.0)) + (else + (f32.add + (call_indirect (type $over-f32) + (f32.sub (local.get 0) (f32.const 2.0)) + (i32.const 27) + ) + (call_indirect (type $over-f32) + (f32.sub (local.get 0) (f32.const 1.0)) + (i32.const 27) + ) + ) + ) + ) + ) + + (func $fib-f64 (export "fib-f64") (type $over-f64) + (if (result f64) (f64.le (local.get 0) (f64.const 1.0)) + (then (f64.const 1.0)) + (else + (f64.add + (call_indirect (type $over-f64) + (f64.sub (local.get 0) (f64.const 2.0)) + (i32.const 28) + ) + (call_indirect (type $over-f64) + (f64.sub (local.get 0) (f64.const 1.0)) + (i32.const 28) + ) ) ) ) ) (func $even (export "even") (param i32) (result i32) - (if i32 (i32.eqz (get_local 0)) - (i32.const 44) - (call_indirect $over-i32 - (i32.sub (get_local 0) (i32.const 1)) - (i32.const 15) + (if (result i32) (i32.eqz (local.get 0)) + (then (i32.const 44)) + (else + (call_indirect (type $over-i32) + (i32.sub (local.get 0) (i32.const 1)) + (i32.const 15) + ) ) ) ) (func $odd (export "odd") (param i32) (result i32) - (if i32 (i32.eqz (get_local 0)) - (i32.const 99) - (call_indirect $over-i32 - (i32.sub (get_local 0) (i32.const 1)) - (i32.const 14) + (if (result i32) (i32.eqz (local.get 0)) + (then (i32.const 99)) + (else + (call_indirect (type $over-i32) + (i32.sub (local.get 0) (i32.const 1)) + (i32.const 14) + ) ) ) ) @@ -158,10 +312,136 @@ ;; implementations and be incompatible with implementations that don't do ;; it (or don't do it under the same circumstances). - (func $runaway (export "runaway") (call_indirect $proc (i32.const 16))) + (func $runaway (export "runaway") (call_indirect (type $proc) (i32.const 16))) + + (func $mutual-runaway1 (export "mutual-runaway") (call_indirect (type $proc) (i32.const 18))) + (func $mutual-runaway2 (call_indirect (type $proc) (i32.const 17))) + + ;; As parameter of control constructs and instructions + + (memory 1) + + (func (export "as-select-first") (result i32) + (select (call_indirect (type $out-i32) (i32.const 0)) (i32.const 2) (i32.const 3)) + ) + (func (export "as-select-mid") (result i32) + (select (i32.const 2) (call_indirect (type $out-i32) (i32.const 0)) (i32.const 3)) + ) + (func (export "as-select-last") (result i32) + (select (i32.const 2) (i32.const 3) (call_indirect (type $out-i32) (i32.const 0))) + ) + + (func (export "as-if-condition") (result i32) + (if (result i32) (call_indirect (type $out-i32) (i32.const 0)) (then (i32.const 1)) (else (i32.const 2))) + ) + + (func (export "as-br_if-first") (result i64) + (block (result i64) (br_if 0 (call_indirect (type $out-i64) (i32.const 1)) (i32.const 2))) + ) + (func (export "as-br_if-last") (result i32) + (block (result i32) (br_if 0 (i32.const 2) (call_indirect (type $out-i32) (i32.const 0)))) + ) + + (func (export "as-br_table-first") (result f32) + (block (result f32) (call_indirect (type $out-f32) (i32.const 2)) (i32.const 2) (br_table 0 0)) + ) + (func (export "as-br_table-last") (result i32) + (block (result i32) (i32.const 2) (call_indirect (type $out-i32) (i32.const 0)) (br_table 0 0)) + ) + + (func (export "as-store-first") + (call_indirect (type $out-i32) (i32.const 0)) (i32.const 1) (i32.store) + ) + (func (export "as-store-last") + (i32.const 10) (call_indirect (type $out-f64) (i32.const 3)) (f64.store) + ) + + (func (export "as-memory.grow-value") (result i32) + (memory.grow (call_indirect (type $out-i32) (i32.const 0))) + ) + (func (export "as-return-value") (result i32) + (call_indirect (type $over-i32) (i32.const 1) (i32.const 4)) (return) + ) + (func (export "as-drop-operand") + (call_indirect (type $over-i64) (i64.const 1) (i32.const 5)) (drop) + ) + (func (export "as-br-value") (result f32) + (block (result f32) (br 0 (call_indirect (type $over-f32) (f32.const 1) (i32.const 6)))) + ) + (func (export "as-local.set-value") (result f64) + (local f64) (local.set 0 (call_indirect (type $over-f64) (f64.const 1) (i32.const 7))) (local.get 0) + ) + (func (export "as-local.tee-value") (result f64) + (local f64) (local.tee 0 (call_indirect (type $over-f64) (f64.const 1) (i32.const 7))) + ) + (global $a (mut f64) (f64.const 10.0)) + (func (export "as-global.set-value") (result f64) + (global.set $a (call_indirect (type $over-f64) (f64.const 1.0) (i32.const 7))) + (global.get $a) + ) + + (func (export "as-load-operand") (result i32) + (i32.load (call_indirect (type $out-i32) (i32.const 0))) + ) + + (func (export "as-unary-operand") (result f32) + (block (result f32) + (f32.sqrt + (call_indirect (type $over-f32) (f32.const 0x0p+0) (i32.const 6)) + ) + ) + ) + + (func (export "as-binary-left") (result i32) + (block (result i32) + (i32.add + (call_indirect (type $over-i32) (i32.const 1) (i32.const 4)) + (i32.const 10) + ) + ) + ) + (func (export "as-binary-right") (result i32) + (block (result i32) + (i32.sub + (i32.const 10) + (call_indirect (type $over-i32) (i32.const 1) (i32.const 4)) + ) + ) + ) + + (func (export "as-test-operand") (result i32) + (block (result i32) + (i32.eqz + (call_indirect (type $over-i32) (i32.const 1) (i32.const 4)) + ) + ) + ) + + (func (export "as-compare-left") (result i32) + (block (result i32) + (i32.le_u + (call_indirect (type $over-i32) (i32.const 1) (i32.const 4)) + (i32.const 10) + ) + ) + ) + (func (export "as-compare-right") (result i32) + (block (result i32) + (i32.ne + (i32.const 10) + (call_indirect (type $over-i32) (i32.const 1) (i32.const 4)) + ) + ) + ) + + (func (export "as-convert-operand") (result i64) + (block (result i64) + (i64.extend_i32_s + (call_indirect (type $over-i32) (i32.const 1) (i32.const 4)) + ) + ) + ) - (func $mutual-runaway1 (export "mutual-runaway") (call_indirect $proc (i32.const 18))) - (func $mutual-runaway2 (call_indirect $proc (i32.const 17))) ) (assert_return (invoke "type-i32") (i32.const 0x132)) @@ -186,29 +466,83 @@ (assert_return (invoke "dispatch" (i32.const 12) (i64.const 5)) (i64.const 120)) (assert_return (invoke "dispatch" (i32.const 13) (i64.const 5)) (i64.const 8)) (assert_return (invoke "dispatch" (i32.const 20) (i64.const 2)) (i64.const 2)) -(assert_trap (invoke "dispatch" (i32.const 0) (i64.const 2)) "indirect call signature mismatch") -(assert_trap (invoke "dispatch" (i32.const 15) (i64.const 2)) "indirect call signature mismatch") -(assert_trap (invoke "dispatch" (i32.const 23) (i64.const 2)) "undefined element") +(assert_trap (invoke "dispatch" (i32.const 0) (i64.const 2)) "indirect call type mismatch") +(assert_trap (invoke "dispatch" (i32.const 15) (i64.const 2)) "indirect call type mismatch") +(assert_trap (invoke "dispatch" (i32.const 29) (i64.const 2)) "undefined element") (assert_trap (invoke "dispatch" (i32.const -1) (i64.const 2)) "undefined element") (assert_trap (invoke "dispatch" (i32.const 1213432423) (i64.const 2)) "undefined element") -(assert_return (invoke "dispatch-structural" (i32.const 5)) (i64.const 9)) -(assert_return (invoke "dispatch-structural" (i32.const 5)) (i64.const 9)) -(assert_return (invoke "dispatch-structural" (i32.const 12)) (i64.const 362880)) -(assert_return (invoke "dispatch-structural" (i32.const 20)) (i64.const 9)) -(assert_trap (invoke "dispatch-structural" (i32.const 11)) "indirect call signature mismatch") -(assert_trap (invoke "dispatch-structural" (i32.const 22)) "indirect call signature mismatch") - -(assert_return (invoke "fac" (i64.const 0)) (i64.const 1)) -(assert_return (invoke "fac" (i64.const 1)) (i64.const 1)) -(assert_return (invoke "fac" (i64.const 5)) (i64.const 120)) -(assert_return (invoke "fac" (i64.const 25)) (i64.const 7034535277573963776)) - -(assert_return (invoke "fib" (i64.const 0)) (i64.const 1)) -(assert_return (invoke "fib" (i64.const 1)) (i64.const 1)) -(assert_return (invoke "fib" (i64.const 2)) (i64.const 2)) -(assert_return (invoke "fib" (i64.const 5)) (i64.const 8)) -(assert_return (invoke "fib" (i64.const 20)) (i64.const 10946)) +(assert_return (invoke "dispatch-structural-i64" (i32.const 5)) (i64.const 9)) +(assert_return (invoke "dispatch-structural-i64" (i32.const 12)) (i64.const 362880)) +(assert_return (invoke "dispatch-structural-i64" (i32.const 13)) (i64.const 55)) +(assert_return (invoke "dispatch-structural-i64" (i32.const 20)) (i64.const 9)) +(assert_trap (invoke "dispatch-structural-i64" (i32.const 11)) "indirect call type mismatch") +(assert_trap (invoke "dispatch-structural-i64" (i32.const 22)) "indirect call type mismatch") + +(assert_return (invoke "dispatch-structural-i32" (i32.const 4)) (i32.const 9)) +(assert_return (invoke "dispatch-structural-i32" (i32.const 23)) (i32.const 362880)) +(assert_return (invoke "dispatch-structural-i32" (i32.const 26)) (i32.const 55)) +(assert_return (invoke "dispatch-structural-i32" (i32.const 19)) (i32.const 9)) +(assert_trap (invoke "dispatch-structural-i32" (i32.const 9)) "indirect call type mismatch") +(assert_trap (invoke "dispatch-structural-i32" (i32.const 21)) "indirect call type mismatch") + +(assert_return (invoke "dispatch-structural-f32" (i32.const 6)) (f32.const 9.0)) +(assert_return (invoke "dispatch-structural-f32" (i32.const 24)) (f32.const 362880.0)) +(assert_return (invoke "dispatch-structural-f32" (i32.const 27)) (f32.const 55.0)) +(assert_return (invoke "dispatch-structural-f32" (i32.const 21)) (f32.const 9.0)) +(assert_trap (invoke "dispatch-structural-f32" (i32.const 8)) "indirect call type mismatch") +(assert_trap (invoke "dispatch-structural-f32" (i32.const 19)) "indirect call type mismatch") + +(assert_return (invoke "dispatch-structural-f64" (i32.const 7)) (f64.const 9.0)) +(assert_return (invoke "dispatch-structural-f64" (i32.const 25)) (f64.const 362880.0)) +(assert_return (invoke "dispatch-structural-f64" (i32.const 28)) (f64.const 55.0)) +(assert_return (invoke "dispatch-structural-f64" (i32.const 22)) (f64.const 9.0)) +(assert_trap (invoke "dispatch-structural-f64" (i32.const 10)) "indirect call type mismatch") +(assert_trap (invoke "dispatch-structural-f64" (i32.const 18)) "indirect call type mismatch") + +(assert_return (invoke "fac-i64" (i64.const 0)) (i64.const 1)) +(assert_return (invoke "fac-i64" (i64.const 1)) (i64.const 1)) +(assert_return (invoke "fac-i64" (i64.const 5)) (i64.const 120)) +(assert_return (invoke "fac-i64" (i64.const 25)) (i64.const 7034535277573963776)) + +(assert_return (invoke "fac-i32" (i32.const 0)) (i32.const 1)) +(assert_return (invoke "fac-i32" (i32.const 1)) (i32.const 1)) +(assert_return (invoke "fac-i32" (i32.const 5)) (i32.const 120)) +(assert_return (invoke "fac-i32" (i32.const 10)) (i32.const 3628800)) + +(assert_return (invoke "fac-f32" (f32.const 0.0)) (f32.const 1.0)) +(assert_return (invoke "fac-f32" (f32.const 1.0)) (f32.const 1.0)) +(assert_return (invoke "fac-f32" (f32.const 5.0)) (f32.const 120.0)) +(assert_return (invoke "fac-f32" (f32.const 10.0)) (f32.const 3628800.0)) + +(assert_return (invoke "fac-f64" (f64.const 0.0)) (f64.const 1.0)) +(assert_return (invoke "fac-f64" (f64.const 1.0)) (f64.const 1.0)) +(assert_return (invoke "fac-f64" (f64.const 5.0)) (f64.const 120.0)) +(assert_return (invoke "fac-f64" (f64.const 10.0)) (f64.const 3628800.0)) + +(assert_return (invoke "fib-i64" (i64.const 0)) (i64.const 1)) +(assert_return (invoke "fib-i64" (i64.const 1)) (i64.const 1)) +(assert_return (invoke "fib-i64" (i64.const 2)) (i64.const 2)) +(assert_return (invoke "fib-i64" (i64.const 5)) (i64.const 8)) +(assert_return (invoke "fib-i64" (i64.const 20)) (i64.const 10946)) + +(assert_return (invoke "fib-i32" (i32.const 0)) (i32.const 1)) +(assert_return (invoke "fib-i32" (i32.const 1)) (i32.const 1)) +(assert_return (invoke "fib-i32" (i32.const 2)) (i32.const 2)) +(assert_return (invoke "fib-i32" (i32.const 5)) (i32.const 8)) +(assert_return (invoke "fib-i32" (i32.const 20)) (i32.const 10946)) + +(assert_return (invoke "fib-f32" (f32.const 0.0)) (f32.const 1.0)) +(assert_return (invoke "fib-f32" (f32.const 1.0)) (f32.const 1.0)) +(assert_return (invoke "fib-f32" (f32.const 2.0)) (f32.const 2.0)) +(assert_return (invoke "fib-f32" (f32.const 5.0)) (f32.const 8.0)) +(assert_return (invoke "fib-f32" (f32.const 20.0)) (f32.const 10946.0)) + +(assert_return (invoke "fib-f64" (f64.const 0.0)) (f64.const 1.0)) +(assert_return (invoke "fib-f64" (f64.const 1.0)) (f64.const 1.0)) +(assert_return (invoke "fib-f64" (f64.const 2.0)) (f64.const 2.0)) +(assert_return (invoke "fib-f64" (f64.const 5.0)) (f64.const 8.0)) +(assert_return (invoke "fib-f64" (f64.const 20.0)) (f64.const 10946.0)) (assert_return (invoke "even" (i32.const 0)) (i32.const 44)) (assert_return (invoke "even" (i32.const 1)) (i32.const 99)) @@ -222,13 +556,166 @@ (assert_exhaustion (invoke "runaway") "call stack exhausted") (assert_exhaustion (invoke "mutual-runaway") "call stack exhausted") +(assert_return (invoke "as-select-first") (i32.const 0x132)) +(assert_return (invoke "as-select-mid") (i32.const 2)) +(assert_return (invoke "as-select-last") (i32.const 2)) + +(assert_return (invoke "as-if-condition") (i32.const 1)) + +(assert_return (invoke "as-br_if-first") (i64.const 0x164)) +(assert_return (invoke "as-br_if-last") (i32.const 2)) + +(assert_return (invoke "as-br_table-first") (f32.const 0xf32)) +(assert_return (invoke "as-br_table-last") (i32.const 2)) + +(assert_return (invoke "as-store-first")) +(assert_return (invoke "as-store-last")) + +(assert_return (invoke "as-memory.grow-value") (i32.const 1)) +(assert_return (invoke "as-return-value") (i32.const 1)) +(assert_return (invoke "as-drop-operand")) +(assert_return (invoke "as-br-value") (f32.const 1)) +(assert_return (invoke "as-local.set-value") (f64.const 1)) +(assert_return (invoke "as-local.tee-value") (f64.const 1)) +(assert_return (invoke "as-global.set-value") (f64.const 1.0)) +(assert_return (invoke "as-load-operand") (i32.const 1)) + +(assert_return (invoke "as-unary-operand") (f32.const 0x0p+0)) +(assert_return (invoke "as-binary-left") (i32.const 11)) +(assert_return (invoke "as-binary-right") (i32.const 9)) +(assert_return (invoke "as-test-operand") (i32.const 0)) +(assert_return (invoke "as-compare-left") (i32.const 1)) +(assert_return (invoke "as-compare-right") (i32.const 1)) +(assert_return (invoke "as-convert-operand") (i64.const 1)) + +;; Invalid syntax + +(assert_malformed + (module quote + "(type $sig (func (param i32) (result i32)))" + "(table 0 funcref)" + "(func (result i32)" + " (call_indirect (type $sig) (result i32) (param i32)" + " (i32.const 0) (i32.const 0)" + " )" + ")" + ) + "unexpected token" +) +(assert_malformed + (module quote + "(type $sig (func (param i32) (result i32)))" + "(table 0 funcref)" + "(func (result i32)" + " (call_indirect (param i32) (type $sig) (result i32)" + " (i32.const 0) (i32.const 0)" + " )" + ")" + ) + "unexpected token" +) +(assert_malformed + (module quote + "(type $sig (func (param i32) (result i32)))" + "(table 0 funcref)" + "(func (result i32)" + " (call_indirect (param i32) (result i32) (type $sig)" + " (i32.const 0) (i32.const 0)" + " )" + ")" + ) + "unexpected token" +) +(assert_malformed + (module quote + "(type $sig (func (param i32) (result i32)))" + "(table 0 funcref)" + "(func (result i32)" + " (call_indirect (result i32) (type $sig) (param i32)" + " (i32.const 0) (i32.const 0)" + " )" + ")" + ) + "unexpected token" +) +(assert_malformed + (module quote + "(type $sig (func (param i32) (result i32)))" + "(table 0 funcref)" + "(func (result i32)" + " (call_indirect (result i32) (param i32) (type $sig)" + " (i32.const 0) (i32.const 0)" + " )" + ")" + ) + "unexpected token" +) +(assert_malformed + (module quote + "(table 0 funcref)" + "(func (result i32)" + " (call_indirect (result i32) (param i32) (i32.const 0) (i32.const 0))" + ")" + ) + "unexpected token" +) + +(assert_malformed + (module quote + "(table 0 funcref)" + "(func (call_indirect (param $x i32) (i32.const 0) (i32.const 0)))" + ) + "unexpected token" +) +(assert_malformed + (module quote + "(type $sig (func))" + "(table 0 funcref)" + "(func (result i32)" + " (call_indirect (type $sig) (result i32) (i32.const 0))" + ")" + ) + "inline function type" +) +(assert_malformed + (module quote + "(type $sig (func (param i32) (result i32)))" + "(table 0 funcref)" + "(func (result i32)" + " (call_indirect (type $sig) (result i32) (i32.const 0))" + ")" + ) + "inline function type" +) +(assert_malformed + (module quote + "(type $sig (func (param i32) (result i32)))" + "(table 0 funcref)" + "(func" + " (call_indirect (type $sig) (param i32) (i32.const 0) (i32.const 0))" + ")" + ) + "inline function type" +) +(assert_malformed + (module quote + "(type $sig (func (param i32 i32) (result i32)))" + "(table 0 funcref)" + "(func (result i32)" + " (call_indirect (type $sig) (param i32) (result i32)" + " (i32.const 0) (i32.const 0)" + " )" + ")" + ) + "inline function type" +) ;; Invalid typing (assert_invalid (module (type (func)) - (func $no-table (call_indirect 0 (i32.const 0))) + (func $no-table (call_indirect (type 0) (i32.const 0))) ) "unknown table" ) @@ -236,16 +723,16 @@ (assert_invalid (module (type (func)) - (table 0 anyfunc) - (func $type-void-vs-num (i32.eqz (call_indirect 0 (i32.const 0)))) + (table 0 funcref) + (func $type-void-vs-num (i32.eqz (call_indirect (type 0) (i32.const 0)))) ) "type mismatch" ) (assert_invalid (module (type (func (result i64))) - (table 0 anyfunc) - (func $type-num-vs-num (i32.eqz (call_indirect 0 (i32.const 0)))) + (table 0 funcref) + (func $type-num-vs-num (i32.eqz (call_indirect (type 0) (i32.const 0)))) ) "type mismatch" ) @@ -253,33 +740,33 @@ (assert_invalid (module (type (func (param i32))) - (table 0 anyfunc) - (func $arity-0-vs-1 (call_indirect 0 (i32.const 0))) + (table 0 funcref) + (func $arity-0-vs-1 (call_indirect (type 0) (i32.const 0))) ) "type mismatch" ) (assert_invalid (module (type (func (param f64 i32))) - (table 0 anyfunc) - (func $arity-0-vs-2 (call_indirect 0 (i32.const 0))) + (table 0 funcref) + (func $arity-0-vs-2 (call_indirect (type 0) (i32.const 0))) ) "type mismatch" ) (assert_invalid (module (type (func)) - (table 0 anyfunc) - (func $arity-1-vs-0 (call_indirect 0 (i32.const 1) (i32.const 0))) + (table 0 funcref) + (func $arity-1-vs-0 (call_indirect (type 0) (i32.const 1) (i32.const 0))) ) "type mismatch" ) (assert_invalid (module (type (func)) - (table 0 anyfunc) + (table 0 funcref) (func $arity-2-vs-0 - (call_indirect 0 (f64.const 2) (i32.const 1) (i32.const 0)) + (call_indirect (type 0) (f64.const 2) (i32.const 1) (i32.const 0)) ) ) "type mismatch" @@ -288,16 +775,16 @@ (assert_invalid (module (type (func (param i32))) - (table 0 anyfunc) - (func $type-func-void-vs-i32 (call_indirect 0 (i32.const 1) (nop))) + (table 0 funcref) + (func $type-func-void-vs-i32 (call_indirect (type 0) (i32.const 1) (nop))) ) "type mismatch" ) (assert_invalid (module (type (func (param i32))) - (table 0 anyfunc) - (func $type-func-num-vs-i32 (call_indirect 0 (i32.const 0) (i64.const 1))) + (table 0 funcref) + (func $type-func-num-vs-i32 (call_indirect (type 0) (i32.const 0) (i64.const 1))) ) "type mismatch" ) @@ -305,9 +792,9 @@ (assert_invalid (module (type (func (param i32 i32))) - (table 0 anyfunc) + (table 0 funcref) (func $type-first-void-vs-num - (call_indirect 0 (nop) (i32.const 1) (i32.const 0)) + (call_indirect (type 0) (nop) (i32.const 1) (i32.const 0)) ) ) "type mismatch" @@ -315,9 +802,9 @@ (assert_invalid (module (type (func (param i32 i32))) - (table 0 anyfunc) + (table 0 funcref) (func $type-second-void-vs-num - (call_indirect 0 (i32.const 1) (nop) (i32.const 0)) + (call_indirect (type 0) (i32.const 1) (nop) (i32.const 0)) ) ) "type mismatch" @@ -325,9 +812,9 @@ (assert_invalid (module (type (func (param i32 f64))) - (table 0 anyfunc) + (table 0 funcref) (func $type-first-num-vs-num - (call_indirect 0 (f64.const 1) (i32.const 1) (i32.const 0)) + (call_indirect (type 0) (f64.const 1) (i32.const 1) (i32.const 0)) ) ) "type mismatch" @@ -335,66 +822,121 @@ (assert_invalid (module (type (func (param f64 i32))) - (table 0 anyfunc) + (table 0 funcref) (func $type-second-num-vs-num - (call_indirect 0 (i32.const 1) (f64.const 1) (i32.const 0)) + (call_indirect (type 0) (i32.const 1) (f64.const 1) (i32.const 0)) ) ) "type mismatch" ) - -;; Unbound type - (assert_invalid (module - (table 0 anyfunc) - (func $unbound-type (call_indirect 1 (i32.const 0))) + (func $f (param i32)) + (type $sig (func (param i32))) + (table funcref (elem $f)) + (func $type-first-empty-in-block + (block + (call_indirect (type $sig) (i32.const 0)) + ) + ) ) - "unknown type" + "type mismatch" ) (assert_invalid (module - (table 0 anyfunc) - (func $large-type (call_indirect 1012321300 (i32.const 0))) + (func $f (param i32 i32)) + (type $sig (func (param i32 i32))) + (table funcref (elem $f)) + (func $type-second-empty-in-block + (block + (call_indirect (type $sig) (i32.const 0) (i32.const 0)) + ) + ) ) - "unknown type" + "type mismatch" +) +(assert_invalid + (module + (func $f (param i32)) + (type $sig (func (param i32))) + (table funcref (elem $f)) + (func $type-first-empty-in-loop + (loop + (call_indirect (type $sig) (i32.const 0)) + ) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $f (param i32 i32)) + (type $sig (func (param i32 i32))) + (table funcref (elem $f)) + (func $type-second-empty-in-loop + (loop + (call_indirect (type $sig) (i32.const 0) (i32.const 0)) + ) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $f (param i32)) + (type $sig (func (param i32))) + (table funcref (elem $f)) + (func $type-first-empty-in-then + (i32.const 0) (i32.const 0) + (if + (then + (call_indirect (type $sig) (i32.const 0)) + ) + ) + ) + ) + "type mismatch" ) - - -;; Unbound function in table - (assert_invalid - (module (table anyfunc (elem 0 0))) - "unknown function 0" + (module + (func $f (param i32 i32)) + (type $sig (func (param i32 i32))) + (table funcref (elem $f)) + (func $type-second-empty-in-then + (i32.const 0) (i32.const 0) + (if + (then + (call_indirect (type $sig) (i32.const 0) (i32.const 0)) + ) + ) + ) + ) + "type mismatch" ) -;; Invalid bounds for elements +;; Unbound type -(assert_unlinkable +(assert_invalid (module - (table 10 anyfunc) - (elem (i32.const 10) $f) - (func $f) + (table 0 funcref) + (func $unbound-type (call_indirect (type 1) (i32.const 0))) ) - "elements segment does not fit" + "unknown type" ) - -(assert_unlinkable +(assert_invalid (module - (table 10 anyfunc) - (elem (i32.const -1) $f) - (func $f) + (table 0 funcref) + (func $large-type (call_indirect (type 1012321300) (i32.const 0))) ) - "elements segment does not fit" + "unknown type" ) -(assert_unlinkable - (module - (table 10 anyfunc) - (elem (i32.const -10) $f) - (func $f) - ) - "elements segment does not fit" + +;; Unbound function in table + +(assert_invalid + (module (table funcref (elem 0 0))) + "unknown function" ) diff --git a/test/core/comments.wast b/test/core/comments.wast index 07a6298c..90a64b42 100644 Binary files a/test/core/comments.wast and b/test/core/comments.wast differ diff --git a/test/core/const.wast b/test/core/const.wast new file mode 100644 index 00000000..6e8931a0 --- /dev/null +++ b/test/core/const.wast @@ -0,0 +1,1046 @@ +;; Test t.const instructions + +;; Syntax error + +(module (func (i32.const 0_123_456_789) drop)) +(module (func (i32.const 0x0_9acf_fBDF) drop)) +(assert_malformed + (module quote "(func (i32.const) drop)") + "unexpected token" +) +(assert_malformed + (module quote "(func (i32.const 0x) drop)") + "unknown operator" +) +(assert_malformed + (module quote "(func (i32.const 1x) drop)") + "unknown operator" +) +(assert_malformed + (module quote "(func (i32.const 0xg) drop)") + "unknown operator" +) + +(module (func (i64.const 0_123_456_789) drop)) +(module (func (i64.const 0x0125_6789_ADEF_bcef) drop)) +(assert_malformed + (module quote "(func (i64.const) drop)") + "unexpected token" +) +(assert_malformed + (module quote "(func (i64.const 0x) drop)") + "unknown operator" +) +(assert_malformed + (module quote "(func (i64.const 1x) drop)") + "unknown operator" +) +(assert_malformed + (module quote "(func (i64.const 0xg) drop)") + "unknown operator" +) + +(module (func (f32.const 0123456789) drop)) +(module (func (f32.const 0123456789e019) drop)) +(module (func (f32.const 0123456789e+019) drop)) +(module (func (f32.const 0123456789e-019) drop)) +(module (func (f32.const 0123456789.) drop)) +(module (func (f32.const 0123456789.e019) drop)) +(module (func (f32.const 0123456789.e+019) drop)) +(module (func (f32.const 0123456789.e-019) drop)) +(module (func (f32.const 0123456789.0123456789) drop)) +(module (func (f32.const 0123456789.0123456789e019) drop)) +(module (func (f32.const 0123456789.0123456789e+019) drop)) +(module (func (f32.const 0123456789.0123456789e-019) drop)) +(module (func (f32.const 0x0123456789ABCDEF) drop)) +(module (func (f32.const 0x0123456789ABCDEFp019) drop)) +(module (func (f32.const 0x0123456789ABCDEFp+019) drop)) +(module (func (f32.const 0x0123456789ABCDEFp-019) drop)) +(module (func (f32.const 0x0123456789ABCDEF.) drop)) +(module (func (f32.const 0x0123456789ABCDEF.p019) drop)) +(module (func (f32.const 0x0123456789ABCDEF.p+019) drop)) +(module (func (f32.const 0x0123456789ABCDEF.p-019) drop)) +(module (func (f32.const 0x0123456789ABCDEF.019aF) drop)) +(module (func (f32.const 0x0123456789ABCDEF.019aFp019) drop)) +(module (func (f32.const 0x0123456789ABCDEF.019aFp+019) drop)) +(module (func (f32.const 0x0123456789ABCDEF.019aFp-019) drop)) +(assert_malformed + (module quote "(func (f32.const) drop)") + "unexpected token" +) +(assert_malformed + (module quote "(func (f32.const .0) drop)") + "unknown operator" +) +(assert_malformed + (module quote "(func (f32.const .0e0) drop)") + "unknown operator" +) +(assert_malformed + (module quote "(func (f32.const 0e) drop)") + "unknown operator" +) +(assert_malformed + (module quote "(func (f32.const 0e+) drop)") + "unknown operator" +) +(assert_malformed + (module quote "(func (f32.const 0.0e) drop)") + "unknown operator" +) +(assert_malformed + (module quote "(func (f32.const 0.0e-) drop)") + "unknown operator" +) +(assert_malformed + (module quote "(func (f32.const 0x) drop)") + "unknown operator" +) +(assert_malformed + (module quote "(func (f32.const 1x) drop)") + "unknown operator" +) +(assert_malformed + (module quote "(func (f32.const 0xg) drop)") + "unknown operator" +) +(assert_malformed + (module quote "(func (f32.const 0x.) drop)") + "unknown operator" +) +(assert_malformed + (module quote "(func (f32.const 0x0.g) drop)") + "unknown operator" +) +(assert_malformed + (module quote "(func (f32.const 0x0p) drop)") + "unknown operator" +) +(assert_malformed + (module quote "(func (f32.const 0x0p+) drop)") + "unknown operator" +) +(assert_malformed + (module quote "(func (f32.const 0x0p-) drop)") + "unknown operator" +) +(assert_malformed + (module quote "(func (f32.const 0x0.0p) drop)") + "unknown operator" +) +(assert_malformed + (module quote "(func (f32.const 0x0.0p+) drop)") + "unknown operator" +) +(assert_malformed + (module quote "(func (f32.const 0x0.0p-) drop)") + "unknown operator" +) +(assert_malformed + (module quote "(func (f32.const 0x0pA) drop)") + "unknown operator" +) + + +(module (func (f64.const 0123456789) drop)) +(module (func (f64.const 0123456789e019) drop)) +(module (func (f64.const 0123456789e+019) drop)) +(module (func (f64.const 0123456789e-019) drop)) +(module (func (f64.const 0123456789.) drop)) +(module (func (f64.const 0123456789.e019) drop)) +(module (func (f64.const 0123456789.e+019) drop)) +(module (func (f64.const 0123456789.e-019) drop)) +(module (func (f64.const 0123456789.0123456789) drop)) +(module (func (f64.const 0123456789.0123456789e019) drop)) +(module (func (f64.const 0123456789.0123456789e+019) drop)) +(module (func (f64.const 0123456789.0123456789e-019) drop)) +(module (func (f64.const 0x0123456789ABCDEFabcdef) drop)) +(module (func (f64.const 0x0123456789ABCDEFabcdefp019) drop)) +(module (func (f64.const 0x0123456789ABCDEFabcdefp+019) drop)) +(module (func (f64.const 0x0123456789ABCDEFabcdefp-019) drop)) +(module (func (f64.const 0x0123456789ABCDEFabcdef.) drop)) +(module (func (f64.const 0x0123456789ABCDEFabcdef.p019) drop)) +(module (func (f64.const 0x0123456789ABCDEFabcdef.p+019) drop)) +(module (func (f64.const 0x0123456789ABCDEFabcdef.p-019) drop)) +(module (func (f64.const 0x0123456789ABCDEFabcdef.0123456789ABCDEFabcdef) drop)) +(module (func (f64.const 0x0123456789ABCDEFabcdef.0123456789ABCDEFabcdefp019) drop)) +(module (func (f64.const 0x0123456789ABCDEFabcdef.0123456789ABCDEFabcdefp+019) drop)) +(module (func (f64.const 0x0123456789ABCDEFabcdef.0123456789ABCDEFabcdefp-019) drop)) +(assert_malformed + (module quote "(func (f64.const) drop)") + "unexpected token" +) +(assert_malformed + (module quote "(func (f64.const .0) drop)") + "unknown operator" +) +(assert_malformed + (module quote "(func (f64.const .0e0) drop)") + "unknown operator" +) +(assert_malformed + (module quote "(func (f64.const 0e) drop)") + "unknown operator" +) +(assert_malformed + (module quote "(func (f64.const 0e+) drop)") + "unknown operator" +) +(assert_malformed + (module quote "(func (f64.const 0.0e) drop)") + "unknown operator" +) +(assert_malformed + (module quote "(func (f64.const 0.0e-) drop)") + "unknown operator" +) +(assert_malformed + (module quote "(func (f64.const 0x) drop)") + "unknown operator" +) +(assert_malformed + (module quote "(func (f64.const 1x) drop)") + "unknown operator" +) +(assert_malformed + (module quote "(func (f64.const 0xg) drop)") + "unknown operator" +) +(assert_malformed + (module quote "(func (f64.const 0x.) drop)") + "unknown operator" +) +(assert_malformed + (module quote "(func (f64.const 0x0.g) drop)") + "unknown operator" +) +(assert_malformed + (module quote "(func (f64.const 0x0p) drop)") + "unknown operator" +) +(assert_malformed + (module quote "(func (f64.const 0x0p+) drop)") + "unknown operator" +) +(assert_malformed + (module quote "(func (f64.const 0x0p-) drop)") + "unknown operator" +) +(assert_malformed + (module quote "(func (f64.const 0x0.0p) drop)") + "unknown operator" +) +(assert_malformed + (module quote "(func (f64.const 0x0.0p+) drop)") + "unknown operator" +) +(assert_malformed + (module quote "(func (f64.const 0x0.0p-) drop)") + "unknown operator" +) +(assert_malformed + (module quote "(func (f64.const 0x0pA) drop)") + "unknown operator" +) + + +;; Range error + +(module (func (i32.const 0xffffffff) drop)) +(module (func (i32.const -0x80000000) drop)) +(assert_malformed + (module quote "(func (i32.const 0x100000000) drop)") + "constant out of range" +) +(assert_malformed + (module quote "(func (i32.const -0x80000001) drop)") + "constant out of range" +) + +(module (func (i32.const 4294967295) drop)) +(module (func (i32.const -2147483648) drop)) +(assert_malformed + (module quote "(func (i32.const 4294967296) drop)") + "constant out of range" +) +(assert_malformed + (module quote "(func (i32.const -2147483649) drop)") + "constant out of range" +) + +(module (func (i64.const 0xffffffffffffffff) drop)) +(module (func (i64.const -0x8000000000000000) drop)) +(assert_malformed + (module quote "(func (i64.const 0x10000000000000000) drop)") + "constant out of range" +) +(assert_malformed + (module quote "(func (i64.const -0x8000000000000001) drop)") + "constant out of range" +) + +(module (func (i64.const 18446744073709551615) drop)) +(module (func (i64.const -9223372036854775808) drop)) +(assert_malformed + (module quote "(func (i64.const 18446744073709551616) drop)") + "constant out of range" +) +(assert_malformed + (module quote "(func (i64.const -9223372036854775809) drop)") + "constant out of range" +) + +(module (func (f32.const 0x1p127) drop)) +(module (func (f32.const -0x1p127) drop)) +(module (func (f32.const 0x1.fffffep127) drop)) +(module (func (f32.const -0x1.fffffep127) drop)) +(module (func (f32.const 0x1.fffffe7p127) drop)) +(module (func (f32.const -0x1.fffffe7p127) drop)) +(module (func (f32.const 0x1.fffffefffffff8000000p127) drop)) +(module (func (f32.const -0x1.fffffefffffff8000000p127) drop)) +(module (func (f32.const 0x1.fffffefffffffffffffp127) drop)) +(module (func (f32.const -0x1.fffffefffffffffffffp127) drop)) +(assert_malformed + (module quote "(func (f32.const 0x1p128) drop)") + "constant out of range" +) +(assert_malformed + (module quote "(func (f32.const -0x1p128) drop)") + "constant out of range" +) +(assert_malformed + (module quote "(func (f32.const 0x1.ffffffp127) drop)") + "constant out of range" +) +(assert_malformed + (module quote "(func (f32.const -0x1.ffffffp127) drop)") + "constant out of range" +) + +(module (func (f32.const 1e38) drop)) +(module (func (f32.const -1e38) drop)) +(assert_malformed + (module quote "(func (f32.const 1e39) drop)") + "constant out of range" +) +(assert_malformed + (module quote "(func (f32.const -1e39) drop)") + "constant out of range" +) + +(module (func (f32.const 340282356779733623858607532500980858880) drop)) +(module (func (f32.const -340282356779733623858607532500980858880) drop)) +(assert_malformed + (module quote "(func (f32.const 340282356779733661637539395458142568448) drop)") + "constant out of range" +) +(assert_malformed + (module quote "(func (f32.const -340282356779733661637539395458142568448) drop)") + "constant out of range" +) + +(module (func (f64.const 0x1p1023) drop)) +(module (func (f64.const -0x1p1023) drop)) +(module (func (f64.const 0x1.fffffffffffffp1023) drop)) +(module (func (f64.const -0x1.fffffffffffffp1023) drop)) +(module (func (f64.const 0x1.fffffffffffff7p1023) drop)) +(module (func (f64.const -0x1.fffffffffffff7p1023) drop)) +(module (func (f64.const 0x1.fffffffffffff7ffffffp1023) drop)) +(module (func (f64.const -0x1.fffffffffffff7ffffffp1023) drop)) +(assert_malformed + (module quote "(func (f64.const 0x1p1024) drop)") + "constant out of range" +) +(assert_malformed + (module quote "(func (f64.const -0x1p1024) drop)") + "constant out of range" +) +(assert_malformed + (module quote "(func (f64.const 0x1.fffffffffffff8p1023) drop)") + "constant out of range" +) +(assert_malformed + (module quote "(func (f64.const -0x1.fffffffffffff8p1023) drop)") + "constant out of range" +) + +(module (func (f64.const 1e308) drop)) +(module (func (f64.const -1e308) drop)) +(assert_malformed + (module quote "(func (f64.const 1e309) drop)") + "constant out of range" +) +(assert_malformed + (module quote "(func (f64.const -1e309) drop)") + "constant out of range" +) + +(module (func (f64.const 179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368) drop)) +(module (func (f64.const -179769313486231570814527423731704356798070567525844996598917476803157260780028538760589558632766878171540458953514382464234321326889464182768467546703537516986049910576551282076245490090389328944075868508455133942304583236903222948165808559332123348274797826204144723168738177180919299881250404026184124858368) drop)) +(assert_malformed + (module quote "(func (f64.const 269653970229347356221791135597556535197105851288767494898376215204735891170042808140884337949150317257310688430271573696351481990334196274152701320055306275479074865864826923114368235135583993416113802762682700913456874855354834422248712838998185022412196739306217084753107265771378949821875606039276187287552) drop)") + "constant out of range" +) +(assert_malformed + (module quote "(func (f64.const -269653970229347356221791135597556535197105851288767494898376215204735891170042808140884337949150317257310688430271573696351481990334196274152701320055306275479074865864826923114368235135583993416113802762682700913456874855354834422248712838998185022412196739306217084753107265771378949821875606039276187287552) drop)") + "constant out of range" +) + +(module (func (f32.const nan:0x1) drop)) +(module (func (f64.const nan:0x1) drop)) +(module (func (f32.const nan:0x7f_ffff) drop)) +(module (func (f64.const nan:0xf_ffff_ffff_ffff) drop)) + +(assert_malformed + (module quote "(func (f32.const nan:1) drop)") + "unknown operator" +) +(assert_malformed + (module quote "(func (f64.const nan:1) drop)") + "unknown operator" +) + +(assert_malformed + (module quote "(func (f32.const nan:0x0) drop)") + "constant out of range" +) +(assert_malformed + (module quote "(func (f64.const nan:0x0) drop)") + "constant out of range" +) + +(assert_malformed + (module quote "(func (f32.const nan:0x80_0000) drop)") + "constant out of range" +) +(assert_malformed + (module quote "(func (f64.const nan:0x10_0000_0000_0000) drop)") + "constant out of range" +) + + +;; Rounding behaviour + +;; f32, small exponent +(module (func (export "f") (result f32) (f32.const +0x1.00000100000000000p-50))) +(assert_return (invoke "f") (f32.const +0x1.000000p-50)) +(module (func (export "f") (result f32) (f32.const -0x1.00000100000000000p-50))) +(assert_return (invoke "f") (f32.const -0x1.000000p-50)) +(module (func (export "f") (result f32) (f32.const +0x1.00000100000000001p-50))) +(assert_return (invoke "f") (f32.const +0x1.000002p-50)) +(module (func (export "f") (result f32) (f32.const -0x1.00000100000000001p-50))) +(assert_return (invoke "f") (f32.const -0x1.000002p-50)) +(module (func (export "f") (result f32) (f32.const +0x1.000001fffffffffffp-50))) +(assert_return (invoke "f") (f32.const +0x1.000002p-50)) +(module (func (export "f") (result f32) (f32.const -0x1.000001fffffffffffp-50))) +(assert_return (invoke "f") (f32.const -0x1.000002p-50)) +(module (func (export "f") (result f32) (f32.const +0x1.00000200000000000p-50))) +(assert_return (invoke "f") (f32.const +0x1.000002p-50)) +(module (func (export "f") (result f32) (f32.const -0x1.00000200000000000p-50))) +(assert_return (invoke "f") (f32.const -0x1.000002p-50)) +(module (func (export "f") (result f32) (f32.const +0x1.00000200000000001p-50))) +(assert_return (invoke "f") (f32.const +0x1.000002p-50)) +(module (func (export "f") (result f32) (f32.const -0x1.00000200000000001p-50))) +(assert_return (invoke "f") (f32.const -0x1.000002p-50)) +(module (func (export "f") (result f32) (f32.const +0x1.000002fffffffffffp-50))) +(assert_return (invoke "f") (f32.const +0x1.000002p-50)) +(module (func (export "f") (result f32) (f32.const -0x1.000002fffffffffffp-50))) +(assert_return (invoke "f") (f32.const -0x1.000002p-50)) +(module (func (export "f") (result f32) (f32.const +0x1.00000300000000000p-50))) +(assert_return (invoke "f") (f32.const +0x1.000004p-50)) +(module (func (export "f") (result f32) (f32.const -0x1.00000300000000000p-50))) +(assert_return (invoke "f") (f32.const -0x1.000004p-50)) +(module (func (export "f") (result f32) (f32.const +0x1.00000300000000001p-50))) +(assert_return (invoke "f") (f32.const +0x1.000004p-50)) +(module (func (export "f") (result f32) (f32.const -0x1.00000300000000001p-50))) +(assert_return (invoke "f") (f32.const -0x1.000004p-50)) +(module (func (export "f") (result f32) (f32.const +0x1.000003fffffffffffp-50))) +(assert_return (invoke "f") (f32.const +0x1.000004p-50)) +(module (func (export "f") (result f32) (f32.const -0x1.000003fffffffffffp-50))) +(assert_return (invoke "f") (f32.const -0x1.000004p-50)) +(module (func (export "f") (result f32) (f32.const +0x1.00000400000000000p-50))) +(assert_return (invoke "f") (f32.const +0x1.000004p-50)) +(module (func (export "f") (result f32) (f32.const -0x1.00000400000000000p-50))) +(assert_return (invoke "f") (f32.const -0x1.000004p-50)) +(module (func (export "f") (result f32) (f32.const +0x1.00000400000000001p-50))) +(assert_return (invoke "f") (f32.const +0x1.000004p-50)) +(module (func (export "f") (result f32) (f32.const -0x1.00000400000000001p-50))) +(assert_return (invoke "f") (f32.const -0x1.000004p-50)) +(module (func (export "f") (result f32) (f32.const +0x1.000004fffffffffffp-50))) +(assert_return (invoke "f") (f32.const +0x1.000004p-50)) +(module (func (export "f") (result f32) (f32.const -0x1.000004fffffffffffp-50))) +(assert_return (invoke "f") (f32.const -0x1.000004p-50)) +(module (func (export "f") (result f32) (f32.const +0x1.00000500000000000p-50))) +(assert_return (invoke "f") (f32.const +0x1.000004p-50)) +(module (func (export "f") (result f32) (f32.const -0x1.00000500000000000p-50))) +(assert_return (invoke "f") (f32.const -0x1.000004p-50)) +(module (func (export "f") (result f32) (f32.const +0x1.00000500000000001p-50))) +(assert_return (invoke "f") (f32.const +0x1.000006p-50)) +(module (func (export "f") (result f32) (f32.const -0x1.00000500000000001p-50))) +(assert_return (invoke "f") (f32.const -0x1.000006p-50)) + +(module (func (export "f") (result f32) (f32.const +0x4000.004000000p-64))) +(assert_return (invoke "f") (f32.const +0x1.000000p-50)) +(module (func (export "f") (result f32) (f32.const -0x4000.004000000p-64))) +(assert_return (invoke "f") (f32.const -0x1.000000p-50)) +(module (func (export "f") (result f32) (f32.const +0x4000.004000001p-64))) +(assert_return (invoke "f") (f32.const +0x1.000002p-50)) +(module (func (export "f") (result f32) (f32.const -0x4000.004000001p-64))) +(assert_return (invoke "f") (f32.const -0x1.000002p-50)) +(module (func (export "f") (result f32) (f32.const +0x4000.007ffffffp-64))) +(assert_return (invoke "f") (f32.const +0x1.000002p-50)) +(module (func (export "f") (result f32) (f32.const -0x4000.007ffffffp-64))) +(assert_return (invoke "f") (f32.const -0x1.000002p-50)) +(module (func (export "f") (result f32) (f32.const +0x4000.008000000p-64))) +(assert_return (invoke "f") (f32.const +0x1.000002p-50)) +(module (func (export "f") (result f32) (f32.const -0x4000.008000000p-64))) +(assert_return (invoke "f") (f32.const -0x1.000002p-50)) +(module (func (export "f") (result f32) (f32.const +0x4000.008000001p-64))) +(assert_return (invoke "f") (f32.const +0x1.000002p-50)) +(module (func (export "f") (result f32) (f32.const -0x4000.008000001p-64))) +(assert_return (invoke "f") (f32.const -0x1.000002p-50)) +(module (func (export "f") (result f32) (f32.const +0x4000.00bffffffp-64))) +(assert_return (invoke "f") (f32.const +0x1.000002p-50)) +(module (func (export "f") (result f32) (f32.const -0x4000.00bffffffp-64))) +(assert_return (invoke "f") (f32.const -0x1.000002p-50)) +(module (func (export "f") (result f32) (f32.const +0x4000.00c000000p-64))) +(assert_return (invoke "f") (f32.const +0x1.000004p-50)) +(module (func (export "f") (result f32) (f32.const -0x4000.00c000000p-64))) +(assert_return (invoke "f") (f32.const -0x1.000004p-50)) +(module (func (export "f") (result f32) (f32.const +0x4000.00c000001p-64))) +(assert_return (invoke "f") (f32.const +0x1.000004p-50)) +(module (func (export "f") (result f32) (f32.const -0x4000.00c000001p-64))) +(assert_return (invoke "f") (f32.const -0x1.000004p-50)) +(module (func (export "f") (result f32) (f32.const +0x4000.00fffffffp-64))) +(assert_return (invoke "f") (f32.const +0x1.000004p-50)) +(module (func (export "f") (result f32) (f32.const -0x4000.00fffffffp-64))) +(assert_return (invoke "f") (f32.const -0x1.000004p-50)) +(module (func (export "f") (result f32) (f32.const +0x4000.010000001p-64))) +(assert_return (invoke "f") (f32.const +0x1.000004p-50)) +(module (func (export "f") (result f32) (f32.const -0x4000.010000001p-64))) +(assert_return (invoke "f") (f32.const -0x1.000004p-50)) +(module (func (export "f") (result f32) (f32.const +0x4000.013ffffffp-64))) +(assert_return (invoke "f") (f32.const +0x1.000004p-50)) +(module (func (export "f") (result f32) (f32.const -0x4000.013ffffffp-64))) +(assert_return (invoke "f") (f32.const -0x1.000004p-50)) +(module (func (export "f") (result f32) (f32.const +0x4000.014000001p-64))) +(assert_return (invoke "f") (f32.const +0x1.000006p-50)) +(module (func (export "f") (result f32) (f32.const -0x4000.014000001p-64))) +(assert_return (invoke "f") (f32.const -0x1.000006p-50)) + +(module (func (export "f") (result f32) (f32.const +8.8817847263968443573e-16))) +(assert_return (invoke "f") (f32.const +0x1.000000p-50)) +(module (func (export "f") (result f32) (f32.const -8.8817847263968443573e-16))) +(assert_return (invoke "f") (f32.const -0x1.000000p-50)) +(module (func (export "f") (result f32) (f32.const +8.8817847263968443574e-16))) +(assert_return (invoke "f") (f32.const +0x1.000002p-50)) +(module (func (export "f") (result f32) (f32.const -8.8817847263968443574e-16))) +(assert_return (invoke "f") (f32.const -0x1.000002p-50)) +(module (func (export "f") (result f32) (f32.const +8.8817857851880284252e-16))) +(assert_return (invoke "f") (f32.const +0x1.000002p-50)) +(module (func (export "f") (result f32) (f32.const -8.8817857851880284252e-16))) +(assert_return (invoke "f") (f32.const -0x1.000002p-50)) +(module (func (export "f") (result f32) (f32.const +8.8817857851880284253e-16))) +(assert_return (invoke "f") (f32.const +0x1.000004p-50)) +(module (func (export "f") (result f32) (f32.const -8.8817857851880284253e-16))) +(assert_return (invoke "f") (f32.const -0x1.000004p-50)) + +;; f32, large exponent +(module (func (export "f") (result f32) (f32.const +0x1.00000100000000000p+50))) +(assert_return (invoke "f") (f32.const +0x1.000000p+50)) +(module (func (export "f") (result f32) (f32.const -0x1.00000100000000000p+50))) +(assert_return (invoke "f") (f32.const -0x1.000000p+50)) +(module (func (export "f") (result f32) (f32.const +0x1.00000100000000001p+50))) +(assert_return (invoke "f") (f32.const +0x1.000002p+50)) +(module (func (export "f") (result f32) (f32.const -0x1.00000100000000001p+50))) +(assert_return (invoke "f") (f32.const -0x1.000002p+50)) +(module (func (export "f") (result f32) (f32.const +0x1.000001fffffffffffp+50))) +(assert_return (invoke "f") (f32.const +0x1.000002p+50)) +(module (func (export "f") (result f32) (f32.const -0x1.000001fffffffffffp+50))) +(assert_return (invoke "f") (f32.const -0x1.000002p+50)) +(module (func (export "f") (result f32) (f32.const +0x1.00000200000000000p+50))) +(assert_return (invoke "f") (f32.const +0x1.000002p+50)) +(module (func (export "f") (result f32) (f32.const -0x1.00000200000000000p+50))) +(assert_return (invoke "f") (f32.const -0x1.000002p+50)) +(module (func (export "f") (result f32) (f32.const +0x1.00000200000000001p+50))) +(assert_return (invoke "f") (f32.const +0x1.000002p+50)) +(module (func (export "f") (result f32) (f32.const -0x1.00000200000000001p+50))) +(assert_return (invoke "f") (f32.const -0x1.000002p+50)) +(module (func (export "f") (result f32) (f32.const +0x1.000002fffffffffffp+50))) +(assert_return (invoke "f") (f32.const +0x1.000002p+50)) +(module (func (export "f") (result f32) (f32.const -0x1.000002fffffffffffp+50))) +(assert_return (invoke "f") (f32.const -0x1.000002p+50)) +(module (func (export "f") (result f32) (f32.const +0x1.00000300000000000p+50))) +(assert_return (invoke "f") (f32.const +0x1.000004p+50)) +(module (func (export "f") (result f32) (f32.const -0x1.00000300000000000p+50))) +(assert_return (invoke "f") (f32.const -0x1.000004p+50)) +(module (func (export "f") (result f32) (f32.const +0x1.00000300000000001p+50))) +(assert_return (invoke "f") (f32.const +0x1.000004p+50)) +(module (func (export "f") (result f32) (f32.const -0x1.00000300000000001p+50))) +(assert_return (invoke "f") (f32.const -0x1.000004p+50)) +(module (func (export "f") (result f32) (f32.const +0x1.000003fffffffffffp+50))) +(assert_return (invoke "f") (f32.const +0x1.000004p+50)) +(module (func (export "f") (result f32) (f32.const -0x1.000003fffffffffffp+50))) +(assert_return (invoke "f") (f32.const -0x1.000004p+50)) +(module (func (export "f") (result f32) (f32.const +0x1.00000400000000000p+50))) +(assert_return (invoke "f") (f32.const +0x1.000004p+50)) +(module (func (export "f") (result f32) (f32.const -0x1.00000400000000000p+50))) +(assert_return (invoke "f") (f32.const -0x1.000004p+50)) +(module (func (export "f") (result f32) (f32.const +0x1.00000400000000001p+50))) +(assert_return (invoke "f") (f32.const +0x1.000004p+50)) +(module (func (export "f") (result f32) (f32.const -0x1.00000400000000001p+50))) +(assert_return (invoke "f") (f32.const -0x1.000004p+50)) +(module (func (export "f") (result f32) (f32.const +0x1.000004fffffffffffp+50))) +(assert_return (invoke "f") (f32.const +0x1.000004p+50)) +(module (func (export "f") (result f32) (f32.const -0x1.000004fffffffffffp+50))) +(assert_return (invoke "f") (f32.const -0x1.000004p+50)) +(module (func (export "f") (result f32) (f32.const +0x1.00000500000000000p+50))) +(assert_return (invoke "f") (f32.const +0x1.000004p+50)) +(module (func (export "f") (result f32) (f32.const -0x1.00000500000000000p+50))) +(assert_return (invoke "f") (f32.const -0x1.000004p+50)) +(module (func (export "f") (result f32) (f32.const +0x1.00000500000000001p+50))) +(assert_return (invoke "f") (f32.const +0x1.000006p+50)) +(module (func (export "f") (result f32) (f32.const -0x1.00000500000000001p+50))) +(assert_return (invoke "f") (f32.const -0x1.000006p+50)) + +(module (func (export "f") (result f32) (f32.const +0x4000004000000))) +(assert_return (invoke "f") (f32.const +0x1.000000p+50)) +(module (func (export "f") (result f32) (f32.const -0x4000004000000))) +(assert_return (invoke "f") (f32.const -0x1.000000p+50)) +(module (func (export "f") (result f32) (f32.const +0x4000004000001))) +(assert_return (invoke "f") (f32.const +0x1.000002p+50)) +(module (func (export "f") (result f32) (f32.const -0x4000004000001))) +(assert_return (invoke "f") (f32.const -0x1.000002p+50)) +(module (func (export "f") (result f32) (f32.const +0x4000007ffffff))) +(assert_return (invoke "f") (f32.const +0x1.000002p+50)) +(module (func (export "f") (result f32) (f32.const -0x4000007ffffff))) +(assert_return (invoke "f") (f32.const -0x1.000002p+50)) +(module (func (export "f") (result f32) (f32.const +0x4000008000000))) +(assert_return (invoke "f") (f32.const +0x1.000002p+50)) +(module (func (export "f") (result f32) (f32.const -0x4000008000000))) +(assert_return (invoke "f") (f32.const -0x1.000002p+50)) +(module (func (export "f") (result f32) (f32.const +0x4000008000001))) +(assert_return (invoke "f") (f32.const +0x1.000002p+50)) +(module (func (export "f") (result f32) (f32.const -0x4000008000001))) +(assert_return (invoke "f") (f32.const -0x1.000002p+50)) +(module (func (export "f") (result f32) (f32.const +0x400000bffffff))) +(assert_return (invoke "f") (f32.const +0x1.000002p+50)) +(module (func (export "f") (result f32) (f32.const -0x400000bffffff))) +(assert_return (invoke "f") (f32.const -0x1.000002p+50)) +(module (func (export "f") (result f32) (f32.const +0x400000c000000))) +(assert_return (invoke "f") (f32.const +0x1.000004p+50)) +(module (func (export "f") (result f32) (f32.const -0x400000c000000))) +(assert_return (invoke "f") (f32.const -0x1.000004p+50)) + +(module (func (export "f") (result f32) (f32.const +1125899973951488))) +(assert_return (invoke "f") (f32.const +0x1.000000p+50)) +(module (func (export "f") (result f32) (f32.const -1125899973951488))) +(assert_return (invoke "f") (f32.const -0x1.000000p+50)) +(module (func (export "f") (result f32) (f32.const +1125899973951489))) +(assert_return (invoke "f") (f32.const +0x1.000002p+50)) +(module (func (export "f") (result f32) (f32.const -1125899973951489))) +(assert_return (invoke "f") (f32.const -0x1.000002p+50)) +(module (func (export "f") (result f32) (f32.const +1125900108169215))) +(assert_return (invoke "f") (f32.const +0x1.000002p+50)) +(module (func (export "f") (result f32) (f32.const -1125900108169215))) +(assert_return (invoke "f") (f32.const -0x1.000002p+50)) +(module (func (export "f") (result f32) (f32.const +1125900108169216))) +(assert_return (invoke "f") (f32.const +0x1.000004p+50)) +(module (func (export "f") (result f32) (f32.const -1125900108169216))) +(assert_return (invoke "f") (f32.const -0x1.000004p+50)) + +;; f32, subnormal +(module (func (export "f") (result f32) (f32.const +0x0.00000100000000000p-126))) +(assert_return (invoke "f") (f32.const +0x0.000000p-126)) +(module (func (export "f") (result f32) (f32.const -0x0.00000100000000000p-126))) +(assert_return (invoke "f") (f32.const -0x0.000000p-126)) +(module (func (export "f") (result f32) (f32.const +0x0.00000100000000001p-126))) +(assert_return (invoke "f") (f32.const +0x0.000002p-126)) +(module (func (export "f") (result f32) (f32.const -0x0.00000100000000001p-126))) +(assert_return (invoke "f") (f32.const -0x0.000002p-126)) +(module (func (export "f") (result f32) (f32.const +0x0.000001fffffffffffp-126))) +(assert_return (invoke "f") (f32.const +0x0.000002p-126)) +(module (func (export "f") (result f32) (f32.const -0x0.000001fffffffffffp-126))) +(assert_return (invoke "f") (f32.const -0x0.000002p-126)) +(module (func (export "f") (result f32) (f32.const +0x0.00000200000000000p-126))) +(assert_return (invoke "f") (f32.const +0x0.000002p-126)) +(module (func (export "f") (result f32) (f32.const -0x0.00000200000000000p-126))) +(assert_return (invoke "f") (f32.const -0x0.000002p-126)) +(module (func (export "f") (result f32) (f32.const +0x0.00000200000000001p-126))) +(assert_return (invoke "f") (f32.const +0x0.000002p-126)) +(module (func (export "f") (result f32) (f32.const -0x0.00000200000000001p-126))) +(assert_return (invoke "f") (f32.const -0x0.000002p-126)) +(module (func (export "f") (result f32) (f32.const +0x0.000002fffffffffffp-126))) +(assert_return (invoke "f") (f32.const +0x0.000002p-126)) +(module (func (export "f") (result f32) (f32.const -0x0.000002fffffffffffp-126))) +(assert_return (invoke "f") (f32.const -0x0.000002p-126)) +(module (func (export "f") (result f32) (f32.const +0x0.00000300000000000p-126))) +(assert_return (invoke "f") (f32.const +0x0.000004p-126)) +(module (func (export "f") (result f32) (f32.const -0x0.00000300000000000p-126))) +(assert_return (invoke "f") (f32.const -0x0.000004p-126)) +(module (func (export "f") (result f32) (f32.const +0x0.00000300000000001p-126))) +(assert_return (invoke "f") (f32.const +0x0.000004p-126)) +(module (func (export "f") (result f32) (f32.const -0x0.00000300000000001p-126))) +(assert_return (invoke "f") (f32.const -0x0.000004p-126)) +(module (func (export "f") (result f32) (f32.const +0x0.000003fffffffffffp-126))) +(assert_return (invoke "f") (f32.const +0x0.000004p-126)) +(module (func (export "f") (result f32) (f32.const -0x0.000003fffffffffffp-126))) +(assert_return (invoke "f") (f32.const -0x0.000004p-126)) +(module (func (export "f") (result f32) (f32.const +0x0.00000400000000000p-126))) +(assert_return (invoke "f") (f32.const +0x0.000004p-126)) +(module (func (export "f") (result f32) (f32.const -0x0.00000400000000000p-126))) +(assert_return (invoke "f") (f32.const -0x0.000004p-126)) +(module (func (export "f") (result f32) (f32.const +0x0.00000400000000001p-126))) +(assert_return (invoke "f") (f32.const +0x0.000004p-126)) +(module (func (export "f") (result f32) (f32.const -0x0.00000400000000001p-126))) +(assert_return (invoke "f") (f32.const -0x0.000004p-126)) +(module (func (export "f") (result f32) (f32.const +0x0.000004fffffffffffp-126))) +(assert_return (invoke "f") (f32.const +0x0.000004p-126)) +(module (func (export "f") (result f32) (f32.const -0x0.000004fffffffffffp-126))) +(assert_return (invoke "f") (f32.const -0x0.000004p-126)) +(module (func (export "f") (result f32) (f32.const +0x0.00000500000000000p-126))) +(assert_return (invoke "f") (f32.const +0x0.000004p-126)) +(module (func (export "f") (result f32) (f32.const -0x0.00000500000000000p-126))) +(assert_return (invoke "f") (f32.const -0x0.000004p-126)) +(module (func (export "f") (result f32) (f32.const +0x0.00000500000000001p-126))) +(assert_return (invoke "f") (f32.const +0x0.000006p-126)) +(module (func (export "f") (result f32) (f32.const -0x0.00000500000000001p-126))) +(assert_return (invoke "f") (f32.const -0x0.000006p-126)) + +;; f32, round down at limit to infinity +(module (func (export "f") (result f32) (f32.const +0x1.fffffe8p127))) +(assert_return (invoke "f") (f32.const +0x1.fffffep127)) +(module (func (export "f") (result f32) (f32.const -0x1.fffffe8p127))) +(assert_return (invoke "f") (f32.const -0x1.fffffep127)) +(module (func (export "f") (result f32) (f32.const +0x1.fffffefffffff8p127))) +(assert_return (invoke "f") (f32.const +0x1.fffffep127)) +(module (func (export "f") (result f32) (f32.const -0x1.fffffefffffff8p127))) +(assert_return (invoke "f") (f32.const -0x1.fffffep127)) +(module (func (export "f") (result f32) (f32.const +0x1.fffffefffffffffffp127))) +(assert_return (invoke "f") (f32.const +0x1.fffffep127)) +(module (func (export "f") (result f32) (f32.const -0x1.fffffefffffffffffp127))) +(assert_return (invoke "f") (f32.const -0x1.fffffep127)) + +;; f64, small exponent +(module (func (export "f") (result f64) (f64.const +0x1.000000000000080000000000p-600))) +(assert_return (invoke "f") (f64.const +0x1.0000000000000p-600)) +(module (func (export "f") (result f64) (f64.const -0x1.000000000000080000000000p-600))) +(assert_return (invoke "f") (f64.const -0x1.0000000000000p-600)) +(module (func (export "f") (result f64) (f64.const +0x1.000000000000080000000001p-600))) +(assert_return (invoke "f") (f64.const +0x1.0000000000001p-600)) +(module (func (export "f") (result f64) (f64.const -0x1.000000000000080000000001p-600))) +(assert_return (invoke "f") (f64.const -0x1.0000000000001p-600)) +(module (func (export "f") (result f64) (f64.const +0x1.0000000000000fffffffffffp-600))) +(assert_return (invoke "f") (f64.const +0x1.0000000000001p-600)) +(module (func (export "f") (result f64) (f64.const -0x1.0000000000000fffffffffffp-600))) +(assert_return (invoke "f") (f64.const -0x1.0000000000001p-600)) +(module (func (export "f") (result f64) (f64.const +0x1.000000000000100000000000p-600))) +(assert_return (invoke "f") (f64.const +0x1.0000000000001p-600)) +(module (func (export "f") (result f64) (f64.const -0x1.000000000000100000000000p-600))) +(assert_return (invoke "f") (f64.const -0x1.0000000000001p-600)) +(module (func (export "f") (result f64) (f64.const +0x1.000000000000100000000001p-600))) +(assert_return (invoke "f") (f64.const +0x1.0000000000001p-600)) +(module (func (export "f") (result f64) (f64.const -0x1.000000000000100000000001p-600))) +(assert_return (invoke "f") (f64.const -0x1.0000000000001p-600)) +(module (func (export "f") (result f64) (f64.const +0x1.00000000000017ffffffffffp-600))) +(assert_return (invoke "f") (f64.const +0x1.0000000000001p-600)) +(module (func (export "f") (result f64) (f64.const -0x1.00000000000017ffffffffffp-600))) +(assert_return (invoke "f") (f64.const -0x1.0000000000001p-600)) +(module (func (export "f") (result f64) (f64.const +0x1.000000000000180000000000p-600))) +(assert_return (invoke "f") (f64.const +0x1.0000000000002p-600)) +(module (func (export "f") (result f64) (f64.const -0x1.000000000000180000000000p-600))) +(assert_return (invoke "f") (f64.const -0x1.0000000000002p-600)) +(module (func (export "f") (result f64) (f64.const +0x1.000000000000180000000001p-600))) +(assert_return (invoke "f") (f64.const +0x1.0000000000002p-600)) +(module (func (export "f") (result f64) (f64.const -0x1.000000000000180000000001p-600))) +(assert_return (invoke "f") (f64.const -0x1.0000000000002p-600)) +(module (func (export "f") (result f64) (f64.const +0x1.0000000000001fffffffffffp-600))) +(assert_return (invoke "f") (f64.const +0x1.0000000000002p-600)) +(module (func (export "f") (result f64) (f64.const -0x1.0000000000001fffffffffffp-600))) +(assert_return (invoke "f") (f64.const -0x1.0000000000002p-600)) +(module (func (export "f") (result f64) (f64.const +0x1.000000000000200000000000p-600))) +(assert_return (invoke "f") (f64.const +0x1.0000000000002p-600)) +(module (func (export "f") (result f64) (f64.const -0x1.000000000000200000000000p-600))) +(assert_return (invoke "f") (f64.const -0x1.0000000000002p-600)) +(module (func (export "f") (result f64) (f64.const +0x1.000000000000200000000001p-600))) +(assert_return (invoke "f") (f64.const +0x1.0000000000002p-600)) +(module (func (export "f") (result f64) (f64.const -0x1.000000000000200000000001p-600))) +(assert_return (invoke "f") (f64.const -0x1.0000000000002p-600)) +(module (func (export "f") (result f64) (f64.const +0x1.00000000000027ffffffffffp-600))) +(assert_return (invoke "f") (f64.const +0x1.0000000000002p-600)) +(module (func (export "f") (result f64) (f64.const -0x1.00000000000027ffffffffffp-600))) +(assert_return (invoke "f") (f64.const -0x1.0000000000002p-600)) +(module (func (export "f") (result f64) (f64.const +0x1.000000000000280000000001p-600))) +(assert_return (invoke "f") (f64.const +0x1.0000000000003p-600)) +(module (func (export "f") (result f64) (f64.const -0x1.000000000000280000000001p-600))) +(assert_return (invoke "f") (f64.const -0x1.0000000000003p-600)) + +(module (func (export "f") (result f64) (f64.const +0x8000000.000000400000000000p-627))) +(assert_return (invoke "f") (f64.const +0x1.0000000000000p-600)) +(module (func (export "f") (result f64) (f64.const -0x8000000.000000400000000000p-627))) +(assert_return (invoke "f") (f64.const -0x1.0000000000000p-600)) +(module (func (export "f") (result f64) (f64.const +0x8000000.000000400000000001p-627))) +(assert_return (invoke "f") (f64.const +0x1.0000000000001p-600)) +(module (func (export "f") (result f64) (f64.const -0x8000000.000000400000000001p-627))) +(assert_return (invoke "f") (f64.const -0x1.0000000000001p-600)) +(module (func (export "f") (result f64) (f64.const +0x8000000.0000007fffffffffffp-627))) +(assert_return (invoke "f") (f64.const +0x1.0000000000001p-600)) +(module (func (export "f") (result f64) (f64.const -0x8000000.0000007fffffffffffp-627))) +(assert_return (invoke "f") (f64.const -0x1.0000000000001p-600)) +(module (func (export "f") (result f64) (f64.const +0x8000000.000000800000000000p-627))) +(assert_return (invoke "f") (f64.const +0x1.0000000000001p-600)) +(module (func (export "f") (result f64) (f64.const -0x8000000.000000800000000000p-627))) +(assert_return (invoke "f") (f64.const -0x1.0000000000001p-600)) +(module (func (export "f") (result f64) (f64.const +0x8000000.000000800000000001p-627))) +(assert_return (invoke "f") (f64.const +0x1.0000000000001p-600)) +(module (func (export "f") (result f64) (f64.const -0x8000000.000000800000000001p-627))) +(assert_return (invoke "f") (f64.const -0x1.0000000000001p-600)) +(module (func (export "f") (result f64) (f64.const +0x8000000.000000bfffffffffffp-627))) +(assert_return (invoke "f") (f64.const +0x1.0000000000001p-600)) +(module (func (export "f") (result f64) (f64.const -0x8000000.000000bfffffffffffp-627))) +(assert_return (invoke "f") (f64.const -0x1.0000000000001p-600)) +(module (func (export "f") (result f64) (f64.const +0x8000000.000000c00000000000p-627))) +(assert_return (invoke "f") (f64.const +0x1.0000000000002p-600)) +(module (func (export "f") (result f64) (f64.const -0x8000000.000000c00000000000p-627))) +(assert_return (invoke "f") (f64.const -0x1.0000000000002p-600)) +(module (func (export "f") (result f64) (f64.const +0x8000000.000000c00000000001p-627))) +(assert_return (invoke "f") (f64.const +0x1.0000000000002p-600)) +(module (func (export "f") (result f64) (f64.const -0x8000000.000000c00000000001p-627))) +(assert_return (invoke "f") (f64.const -0x1.0000000000002p-600)) +(module (func (export "f") (result f64) (f64.const +0x8000000.000000ffffffffffffp-627))) +(assert_return (invoke "f") (f64.const +0x1.0000000000002p-600)) +(module (func (export "f") (result f64) (f64.const -0x8000000.000000ffffffffffffp-627))) +(assert_return (invoke "f") (f64.const -0x1.0000000000002p-600)) +(module (func (export "f") (result f64) (f64.const +0x8000000.000001000000000000p-627))) +(assert_return (invoke "f") (f64.const +0x1.0000000000002p-600)) +(module (func (export "f") (result f64) (f64.const -0x8000000.000001000000000000p-627))) +(assert_return (invoke "f") (f64.const -0x1.0000000000002p-600)) +(module (func (export "f") (result f64) (f64.const +0x8000000.000001000000000001p-627))) +(assert_return (invoke "f") (f64.const +0x1.0000000000002p-600)) +(module (func (export "f") (result f64) (f64.const -0x8000000.000001000000000001p-627))) +(assert_return (invoke "f") (f64.const -0x1.0000000000002p-600)) +(module (func (export "f") (result f64) (f64.const +0x8000000.0000013fffffffffffp-627))) +(assert_return (invoke "f") (f64.const +0x1.0000000000002p-600)) +(module (func (export "f") (result f64) (f64.const -0x8000000.0000013fffffffffffp-627))) +(assert_return (invoke "f") (f64.const -0x1.0000000000002p-600)) +(module (func (export "f") (result f64) (f64.const +0x8000000.000001400000000001p-627))) +(assert_return (invoke "f") (f64.const +0x1.0000000000003p-600)) +(module (func (export "f") (result f64) (f64.const -0x8000000.000001400000000001p-627))) +(assert_return (invoke "f") (f64.const -0x1.0000000000003p-600)) + +(module (func (export "f") (result f64) (f64.const +5.3575430359313371995e+300))) +(assert_return (invoke "f") (f64.const +0x1.0000000000000p+999)) +(module (func (export "f") (result f64) (f64.const -5.3575430359313371995e+300))) +(assert_return (invoke "f") (f64.const -0x1.0000000000000p+999)) +(module (func (export "f") (result f64) (f64.const +5.3575430359313371996e+300))) +(assert_return (invoke "f") (f64.const +0x1.0000000000001p+999)) +(module (func (export "f") (result f64) (f64.const -5.3575430359313371996e+300))) +(assert_return (invoke "f") (f64.const -0x1.0000000000001p+999)) +(module (func (export "f") (result f64) (f64.const +5.3575430359313383891e+300))) +(assert_return (invoke "f") (f64.const +0x1.0000000000001p+999)) +(module (func (export "f") (result f64) (f64.const -5.3575430359313383891e+300))) +(assert_return (invoke "f") (f64.const -0x1.0000000000001p+999)) +(module (func (export "f") (result f64) (f64.const +5.3575430359313383892e+300))) +(assert_return (invoke "f") (f64.const +0x1.0000000000002p+999)) +(module (func (export "f") (result f64) (f64.const -5.3575430359313383892e+300))) +(assert_return (invoke "f") (f64.const -0x1.0000000000002p+999)) + +;; f64, large exponent +(module (func (export "f") (result f64) (f64.const +0x1.000000000000080000000000p+600))) +(assert_return (invoke "f") (f64.const +0x1.0000000000000p+600)) +(module (func (export "f") (result f64) (f64.const -0x1.000000000000080000000000p+600))) +(assert_return (invoke "f") (f64.const -0x1.0000000000000p+600)) +(module (func (export "f") (result f64) (f64.const +0x1.000000000000080000000001p+600))) +(assert_return (invoke "f") (f64.const +0x1.0000000000001p+600)) +(module (func (export "f") (result f64) (f64.const -0x1.000000000000080000000001p+600))) +(assert_return (invoke "f") (f64.const -0x1.0000000000001p+600)) +(module (func (export "f") (result f64) (f64.const +0x1.0000000000000fffffffffffp+600))) +(assert_return (invoke "f") (f64.const +0x1.0000000000001p+600)) +(module (func (export "f") (result f64) (f64.const -0x1.0000000000000fffffffffffp+600))) +(assert_return (invoke "f") (f64.const -0x1.0000000000001p+600)) +(module (func (export "f") (result f64) (f64.const +0x1.000000000000100000000000p+600))) +(assert_return (invoke "f") (f64.const +0x1.0000000000001p+600)) +(module (func (export "f") (result f64) (f64.const -0x1.000000000000100000000000p+600))) +(assert_return (invoke "f") (f64.const -0x1.0000000000001p+600)) +(module (func (export "f") (result f64) (f64.const +0x1.000000000000100000000001p+600))) +(assert_return (invoke "f") (f64.const +0x1.0000000000001p+600)) +(module (func (export "f") (result f64) (f64.const -0x1.000000000000100000000001p+600))) +(assert_return (invoke "f") (f64.const -0x1.0000000000001p+600)) +(module (func (export "f") (result f64) (f64.const +0x1.00000000000017ffffffffffp+600))) +(assert_return (invoke "f") (f64.const +0x1.0000000000001p+600)) +(module (func (export "f") (result f64) (f64.const -0x1.00000000000017ffffffffffp+600))) +(assert_return (invoke "f") (f64.const -0x1.0000000000001p+600)) +(module (func (export "f") (result f64) (f64.const +0x1.000000000000180000000000p+600))) +(assert_return (invoke "f") (f64.const +0x1.0000000000002p+600)) +(module (func (export "f") (result f64) (f64.const -0x1.000000000000180000000000p+600))) +(assert_return (invoke "f") (f64.const -0x1.0000000000002p+600)) +(module (func (export "f") (result f64) (f64.const +0x1.000000000000180000000001p+600))) +(assert_return (invoke "f") (f64.const +0x1.0000000000002p+600)) +(module (func (export "f") (result f64) (f64.const -0x1.000000000000180000000001p+600))) +(assert_return (invoke "f") (f64.const -0x1.0000000000002p+600)) +(module (func (export "f") (result f64) (f64.const +0x1.0000000000001fffffffffffp+600))) +(assert_return (invoke "f") (f64.const +0x1.0000000000002p+600)) +(module (func (export "f") (result f64) (f64.const -0x1.0000000000001fffffffffffp+600))) +(assert_return (invoke "f") (f64.const -0x1.0000000000002p+600)) +(module (func (export "f") (result f64) (f64.const +0x1.000000000000200000000000p+600))) +(assert_return (invoke "f") (f64.const +0x1.0000000000002p+600)) +(module (func (export "f") (result f64) (f64.const -0x1.000000000000200000000000p+600))) +(assert_return (invoke "f") (f64.const -0x1.0000000000002p+600)) +(module (func (export "f") (result f64) (f64.const +0x1.000000000000200000000001p+600))) +(assert_return (invoke "f") (f64.const +0x1.0000000000002p+600)) +(module (func (export "f") (result f64) (f64.const -0x1.000000000000200000000001p+600))) +(assert_return (invoke "f") (f64.const -0x1.0000000000002p+600)) +(module (func (export "f") (result f64) (f64.const +0x1.00000000000027ffffffffffp+600))) +(assert_return (invoke "f") (f64.const +0x1.0000000000002p+600)) +(module (func (export "f") (result f64) (f64.const -0x1.00000000000027ffffffffffp+600))) +(assert_return (invoke "f") (f64.const -0x1.0000000000002p+600)) +(module (func (export "f") (result f64) (f64.const +0x1.000000000000280000000000p+600))) +(assert_return (invoke "f") (f64.const +0x1.0000000000002p+600)) +(module (func (export "f") (result f64) (f64.const -0x1.000000000000280000000000p+600))) +(assert_return (invoke "f") (f64.const -0x1.0000000000002p+600)) +(module (func (export "f") (result f64) (f64.const +0x1.000000000000280000000001p+600))) +(assert_return (invoke "f") (f64.const +0x1.0000000000003p+600)) +(module (func (export "f") (result f64) (f64.const -0x1.000000000000280000000001p+600))) +(assert_return (invoke "f") (f64.const -0x1.0000000000003p+600)) + +(module (func (export "f") (result f64) (f64.const +0x2000000000000100000000000))) +(assert_return (invoke "f") (f64.const +0x1.0000000000000p+97)) +(module (func (export "f") (result f64) (f64.const -0x2000000000000100000000000))) +(assert_return (invoke "f") (f64.const -0x1.0000000000000p+97)) +(module (func (export "f") (result f64) (f64.const +0x2000000000000100000000001))) +(assert_return (invoke "f") (f64.const +0x1.0000000000001p+97)) +(module (func (export "f") (result f64) (f64.const -0x2000000000000100000000001))) +(assert_return (invoke "f") (f64.const -0x1.0000000000001p+97)) +(module (func (export "f") (result f64) (f64.const +0x20000000000001fffffffffff))) +(assert_return (invoke "f") (f64.const +0x1.0000000000001p+97)) +(module (func (export "f") (result f64) (f64.const -0x20000000000001fffffffffff))) +(assert_return (invoke "f") (f64.const -0x1.0000000000001p+97)) +(module (func (export "f") (result f64) (f64.const +0x2000000000000200000000000))) +(assert_return (invoke "f") (f64.const +0x1.0000000000001p+97)) +(module (func (export "f") (result f64) (f64.const -0x2000000000000200000000000))) +(assert_return (invoke "f") (f64.const -0x1.0000000000001p+97)) +(module (func (export "f") (result f64) (f64.const +0x2000000000000200000000001))) +(assert_return (invoke "f") (f64.const +0x1.0000000000001p+97)) +(module (func (export "f") (result f64) (f64.const -0x2000000000000200000000001))) +(assert_return (invoke "f") (f64.const -0x1.0000000000001p+97)) +(module (func (export "f") (result f64) (f64.const +0x20000000000002fffffffffff))) +(assert_return (invoke "f") (f64.const +0x1.0000000000001p+97)) +(module (func (export "f") (result f64) (f64.const -0x20000000000002fffffffffff))) +(assert_return (invoke "f") (f64.const -0x1.0000000000001p+97)) +(module (func (export "f") (result f64) (f64.const +0x2000000000000300000000000))) +(assert_return (invoke "f") (f64.const +0x1.0000000000002p+97)) +(module (func (export "f") (result f64) (f64.const -0x2000000000000300000000000))) +(assert_return (invoke "f") (f64.const -0x1.0000000000002p+97)) +(module (func (export "f") (result f64) (f64.const +0x2000000000000300000000001))) +(assert_return (invoke "f") (f64.const +0x1.0000000000002p+97)) +(module (func (export "f") (result f64) (f64.const -0x2000000000000300000000001))) +(assert_return (invoke "f") (f64.const -0x1.0000000000002p+97)) +(module (func (export "f") (result f64) (f64.const +0x20000000000003fffffffffff))) +(assert_return (invoke "f") (f64.const +0x1.0000000000002p+97)) +(module (func (export "f") (result f64) (f64.const -0x20000000000003fffffffffff))) +(assert_return (invoke "f") (f64.const -0x1.0000000000002p+97)) +(module (func (export "f") (result f64) (f64.const +0x2000000000000400000000000))) +(assert_return (invoke "f") (f64.const +0x1.0000000000002p+97)) +(module (func (export "f") (result f64) (f64.const -0x2000000000000400000000000))) +(assert_return (invoke "f") (f64.const -0x1.0000000000002p+97)) +(module (func (export "f") (result f64) (f64.const +0x2000000000000400000000001))) +(assert_return (invoke "f") (f64.const +0x1.0000000000002p+97)) +(module (func (export "f") (result f64) (f64.const -0x2000000000000400000000001))) +(assert_return (invoke "f") (f64.const -0x1.0000000000002p+97)) +(module (func (export "f") (result f64) (f64.const +0x20000000000004fffffffffff))) +(assert_return (invoke "f") (f64.const +0x1.0000000000002p+97)) +(module (func (export "f") (result f64) (f64.const -0x20000000000004fffffffffff))) +(assert_return (invoke "f") (f64.const -0x1.0000000000002p+97)) +(module (func (export "f") (result f64) (f64.const +0x2000000000000500000000000))) +(assert_return (invoke "f") (f64.const +0x1.0000000000002p+97)) +(module (func (export "f") (result f64) (f64.const -0x2000000000000500000000000))) +(assert_return (invoke "f") (f64.const -0x1.0000000000002p+97)) +(module (func (export "f") (result f64) (f64.const +0x2000000000000500000000001))) +(assert_return (invoke "f") (f64.const +0x1.0000000000003p+97)) +(module (func (export "f") (result f64) (f64.const -0x2000000000000500000000001))) +(assert_return (invoke "f") (f64.const -0x1.0000000000003p+97)) + +(module (func (export "f") (result f64) (f64.const +1152921504606847104))) +(assert_return (invoke "f") (f64.const +0x1.0000000000000p+60)) +(module (func (export "f") (result f64) (f64.const -1152921504606847104))) +(assert_return (invoke "f") (f64.const -0x1.0000000000000p+60)) +(module (func (export "f") (result f64) (f64.const +1152921504606847105))) +(assert_return (invoke "f") (f64.const +0x1.0000000000001p+60)) +(module (func (export "f") (result f64) (f64.const -1152921504606847105))) +(assert_return (invoke "f") (f64.const -0x1.0000000000001p+60)) +(module (func (export "f") (result f64) (f64.const +1152921504606847359))) +(assert_return (invoke "f") (f64.const +0x1.0000000000001p+60)) +(module (func (export "f") (result f64) (f64.const -1152921504606847359))) +(assert_return (invoke "f") (f64.const -0x1.0000000000001p+60)) +(module (func (export "f") (result f64) (f64.const +1152921504606847360))) +(assert_return (invoke "f") (f64.const +0x1.0000000000002p+60)) +(module (func (export "f") (result f64) (f64.const -1152921504606847360))) +(assert_return (invoke "f") (f64.const -0x1.0000000000002p+60)) + +;; f64, subnormal +(module (func (export "f") (result f64) (f64.const +0x0.000000000000080000000000p-1022))) +(assert_return (invoke "f") (f64.const +0x0.0000000000000p-1022)) +(module (func (export "f") (result f64) (f64.const -0x0.000000000000080000000000p-1022))) +(assert_return (invoke "f") (f64.const -0x0.0000000000000p-1022)) +(module (func (export "f") (result f64) (f64.const +0x0.000000000000080000000001p-1022))) +(assert_return (invoke "f") (f64.const +0x0.0000000000001p-1022)) +(module (func (export "f") (result f64) (f64.const -0x0.000000000000080000000001p-1022))) +(assert_return (invoke "f") (f64.const -0x0.0000000000001p-1022)) +(module (func (export "f") (result f64) (f64.const +0x0.0000000000000fffffffffffp-1022))) +(assert_return (invoke "f") (f64.const +0x0.0000000000001p-1022)) +(module (func (export "f") (result f64) (f64.const -0x0.0000000000000fffffffffffp-1022))) +(assert_return (invoke "f") (f64.const -0x0.0000000000001p-1022)) +(module (func (export "f") (result f64) (f64.const +0x0.000000000000100000000000p-1022))) +(assert_return (invoke "f") (f64.const +0x0.0000000000001p-1022)) +(module (func (export "f") (result f64) (f64.const -0x0.000000000000100000000000p-1022))) +(assert_return (invoke "f") (f64.const -0x0.0000000000001p-1022)) +(module (func (export "f") (result f64) (f64.const +0x0.000000000000100000000001p-1022))) +(assert_return (invoke "f") (f64.const +0x0.0000000000001p-1022)) +(module (func (export "f") (result f64) (f64.const -0x0.000000000000100000000001p-1022))) +(assert_return (invoke "f") (f64.const -0x0.0000000000001p-1022)) +(module (func (export "f") (result f64) (f64.const +0x0.00000000000017ffffffffffp-1022))) +(assert_return (invoke "f") (f64.const +0x0.0000000000001p-1022)) +(module (func (export "f") (result f64) (f64.const -0x0.00000000000017ffffffffffp-1022))) +(assert_return (invoke "f") (f64.const -0x0.0000000000001p-1022)) +(module (func (export "f") (result f64) (f64.const +0x0.000000000000180000000000p-1022))) +(assert_return (invoke "f") (f64.const +0x0.0000000000002p-1022)) +(module (func (export "f") (result f64) (f64.const -0x0.000000000000180000000000p-1022))) +(assert_return (invoke "f") (f64.const -0x0.0000000000002p-1022)) +(module (func (export "f") (result f64) (f64.const +0x0.000000000000180000000001p-1022))) +(assert_return (invoke "f") (f64.const +0x0.0000000000002p-1022)) +(module (func (export "f") (result f64) (f64.const -0x0.000000000000180000000001p-1022))) +(assert_return (invoke "f") (f64.const -0x0.0000000000002p-1022)) +(module (func (export "f") (result f64) (f64.const +0x0.0000000000001fffffffffffp-1022))) +(assert_return (invoke "f") (f64.const +0x0.0000000000002p-1022)) +(module (func (export "f") (result f64) (f64.const -0x0.0000000000001fffffffffffp-1022))) +(assert_return (invoke "f") (f64.const -0x0.0000000000002p-1022)) +(module (func (export "f") (result f64) (f64.const +0x0.000000000000200000000000p-1022))) +(assert_return (invoke "f") (f64.const +0x0.0000000000002p-1022)) +(module (func (export "f") (result f64) (f64.const -0x0.000000000000200000000000p-1022))) +(assert_return (invoke "f") (f64.const -0x0.0000000000002p-1022)) +(module (func (export "f") (result f64) (f64.const +0x0.000000000000200000000001p-1022))) +(assert_return (invoke "f") (f64.const +0x0.0000000000002p-1022)) +(module (func (export "f") (result f64) (f64.const -0x0.000000000000200000000001p-1022))) +(assert_return (invoke "f") (f64.const -0x0.0000000000002p-1022)) +(module (func (export "f") (result f64) (f64.const +0x0.00000000000027ffffffffffp-1022))) +(assert_return (invoke "f") (f64.const +0x0.0000000000002p-1022)) +(module (func (export "f") (result f64) (f64.const -0x0.00000000000027ffffffffffp-1022))) +(assert_return (invoke "f") (f64.const -0x0.0000000000002p-1022)) +(module (func (export "f") (result f64) (f64.const +0x0.000000000000280000000000p-1022))) +(assert_return (invoke "f") (f64.const +0x0.0000000000002p-1022)) +(module (func (export "f") (result f64) (f64.const -0x0.000000000000280000000000p-1022))) +(assert_return (invoke "f") (f64.const -0x0.0000000000002p-1022)) +(module (func (export "f") (result f64) (f64.const +0x1.000000000000280000000001p-1022))) +(assert_return (invoke "f") (f64.const +0x1.0000000000003p-1022)) +(module (func (export "f") (result f64) (f64.const -0x1.000000000000280000000001p-1022))) +(assert_return (invoke "f") (f64.const -0x1.0000000000003p-1022)) + +;; f64, round down at limit to infinity +(module (func (export "f") (result f64) (f64.const +0x1.fffffffffffff4p1023))) +(assert_return (invoke "f") (f64.const +0x1.fffffffffffffp1023)) +(module (func (export "f") (result f64) (f64.const -0x1.fffffffffffff4p1023))) +(assert_return (invoke "f") (f64.const -0x1.fffffffffffffp1023)) +(module (func (export "f") (result f64) (f64.const +0x1.fffffffffffff7ffffffp1023))) +(assert_return (invoke "f") (f64.const +0x1.fffffffffffffp1023)) +(module (func (export "f") (result f64) (f64.const -0x1.fffffffffffff7ffffffp1023))) +(assert_return (invoke "f") (f64.const -0x1.fffffffffffffp1023)) diff --git a/test/core/conversions.wast b/test/core/conversions.wast index e3c49b5d..c0ae54a5 100644 --- a/test/core/conversions.wast +++ b/test/core/conversions.wast @@ -1,44 +1,44 @@ (module - (func (export "i64.extend_s_i32") (param $x i32) (result i64) (i64.extend_s/i32 (get_local $x))) - (func (export "i64.extend_u_i32") (param $x i32) (result i64) (i64.extend_u/i32 (get_local $x))) - (func (export "i32.wrap_i64") (param $x i64) (result i32) (i32.wrap/i64 (get_local $x))) - (func (export "i32.trunc_s_f32") (param $x f32) (result i32) (i32.trunc_s/f32 (get_local $x))) - (func (export "i32.trunc_u_f32") (param $x f32) (result i32) (i32.trunc_u/f32 (get_local $x))) - (func (export "i32.trunc_s_f64") (param $x f64) (result i32) (i32.trunc_s/f64 (get_local $x))) - (func (export "i32.trunc_u_f64") (param $x f64) (result i32) (i32.trunc_u/f64 (get_local $x))) - (func (export "i64.trunc_s_f32") (param $x f32) (result i64) (i64.trunc_s/f32 (get_local $x))) - (func (export "i64.trunc_u_f32") (param $x f32) (result i64) (i64.trunc_u/f32 (get_local $x))) - (func (export "i64.trunc_s_f64") (param $x f64) (result i64) (i64.trunc_s/f64 (get_local $x))) - (func (export "i64.trunc_u_f64") (param $x f64) (result i64) (i64.trunc_u/f64 (get_local $x))) - (func (export "f32.convert_s_i32") (param $x i32) (result f32) (f32.convert_s/i32 (get_local $x))) - (func (export "f32.convert_s_i64") (param $x i64) (result f32) (f32.convert_s/i64 (get_local $x))) - (func (export "f64.convert_s_i32") (param $x i32) (result f64) (f64.convert_s/i32 (get_local $x))) - (func (export "f64.convert_s_i64") (param $x i64) (result f64) (f64.convert_s/i64 (get_local $x))) - (func (export "f32.convert_u_i32") (param $x i32) (result f32) (f32.convert_u/i32 (get_local $x))) - (func (export "f32.convert_u_i64") (param $x i64) (result f32) (f32.convert_u/i64 (get_local $x))) - (func (export "f64.convert_u_i32") (param $x i32) (result f64) (f64.convert_u/i32 (get_local $x))) - (func (export "f64.convert_u_i64") (param $x i64) (result f64) (f64.convert_u/i64 (get_local $x))) - (func (export "f64.promote_f32") (param $x f32) (result f64) (f64.promote/f32 (get_local $x))) - (func (export "f32.demote_f64") (param $x f64) (result f32) (f32.demote/f64 (get_local $x))) - (func (export "f32.reinterpret_i32") (param $x i32) (result f32) (f32.reinterpret/i32 (get_local $x))) - (func (export "f64.reinterpret_i64") (param $x i64) (result f64) (f64.reinterpret/i64 (get_local $x))) - (func (export "i32.reinterpret_f32") (param $x f32) (result i32) (i32.reinterpret/f32 (get_local $x))) - (func (export "i64.reinterpret_f64") (param $x f64) (result i64) (i64.reinterpret/f64 (get_local $x))) + (func (export "i64.extend_i32_s") (param $x i32) (result i64) (i64.extend_i32_s (local.get $x))) + (func (export "i64.extend_i32_u") (param $x i32) (result i64) (i64.extend_i32_u (local.get $x))) + (func (export "i32.wrap_i64") (param $x i64) (result i32) (i32.wrap_i64 (local.get $x))) + (func (export "i32.trunc_f32_s") (param $x f32) (result i32) (i32.trunc_f32_s (local.get $x))) + (func (export "i32.trunc_f32_u") (param $x f32) (result i32) (i32.trunc_f32_u (local.get $x))) + (func (export "i32.trunc_f64_s") (param $x f64) (result i32) (i32.trunc_f64_s (local.get $x))) + (func (export "i32.trunc_f64_u") (param $x f64) (result i32) (i32.trunc_f64_u (local.get $x))) + (func (export "i64.trunc_f32_s") (param $x f32) (result i64) (i64.trunc_f32_s (local.get $x))) + (func (export "i64.trunc_f32_u") (param $x f32) (result i64) (i64.trunc_f32_u (local.get $x))) + (func (export "i64.trunc_f64_s") (param $x f64) (result i64) (i64.trunc_f64_s (local.get $x))) + (func (export "i64.trunc_f64_u") (param $x f64) (result i64) (i64.trunc_f64_u (local.get $x))) + (func (export "f32.convert_i32_s") (param $x i32) (result f32) (f32.convert_i32_s (local.get $x))) + (func (export "f32.convert_i64_s") (param $x i64) (result f32) (f32.convert_i64_s (local.get $x))) + (func (export "f64.convert_i32_s") (param $x i32) (result f64) (f64.convert_i32_s (local.get $x))) + (func (export "f64.convert_i64_s") (param $x i64) (result f64) (f64.convert_i64_s (local.get $x))) + (func (export "f32.convert_i32_u") (param $x i32) (result f32) (f32.convert_i32_u (local.get $x))) + (func (export "f32.convert_i64_u") (param $x i64) (result f32) (f32.convert_i64_u (local.get $x))) + (func (export "f64.convert_i32_u") (param $x i32) (result f64) (f64.convert_i32_u (local.get $x))) + (func (export "f64.convert_i64_u") (param $x i64) (result f64) (f64.convert_i64_u (local.get $x))) + (func (export "f64.promote_f32") (param $x f32) (result f64) (f64.promote_f32 (local.get $x))) + (func (export "f32.demote_f64") (param $x f64) (result f32) (f32.demote_f64 (local.get $x))) + (func (export "f32.reinterpret_i32") (param $x i32) (result f32) (f32.reinterpret_i32 (local.get $x))) + (func (export "f64.reinterpret_i64") (param $x i64) (result f64) (f64.reinterpret_i64 (local.get $x))) + (func (export "i32.reinterpret_f32") (param $x f32) (result i32) (i32.reinterpret_f32 (local.get $x))) + (func (export "i64.reinterpret_f64") (param $x f64) (result i64) (i64.reinterpret_f64 (local.get $x))) ) -(assert_return (invoke "i64.extend_s_i32" (i32.const 0)) (i64.const 0)) -(assert_return (invoke "i64.extend_s_i32" (i32.const 10000)) (i64.const 10000)) -(assert_return (invoke "i64.extend_s_i32" (i32.const -10000)) (i64.const -10000)) -(assert_return (invoke "i64.extend_s_i32" (i32.const -1)) (i64.const -1)) -(assert_return (invoke "i64.extend_s_i32" (i32.const 0x7fffffff)) (i64.const 0x000000007fffffff)) -(assert_return (invoke "i64.extend_s_i32" (i32.const 0x80000000)) (i64.const 0xffffffff80000000)) +(assert_return (invoke "i64.extend_i32_s" (i32.const 0)) (i64.const 0)) +(assert_return (invoke "i64.extend_i32_s" (i32.const 10000)) (i64.const 10000)) +(assert_return (invoke "i64.extend_i32_s" (i32.const -10000)) (i64.const -10000)) +(assert_return (invoke "i64.extend_i32_s" (i32.const -1)) (i64.const -1)) +(assert_return (invoke "i64.extend_i32_s" (i32.const 0x7fffffff)) (i64.const 0x000000007fffffff)) +(assert_return (invoke "i64.extend_i32_s" (i32.const 0x80000000)) (i64.const 0xffffffff80000000)) -(assert_return (invoke "i64.extend_u_i32" (i32.const 0)) (i64.const 0)) -(assert_return (invoke "i64.extend_u_i32" (i32.const 10000)) (i64.const 10000)) -(assert_return (invoke "i64.extend_u_i32" (i32.const -10000)) (i64.const 0x00000000ffffd8f0)) -(assert_return (invoke "i64.extend_u_i32" (i32.const -1)) (i64.const 0xffffffff)) -(assert_return (invoke "i64.extend_u_i32" (i32.const 0x7fffffff)) (i64.const 0x000000007fffffff)) -(assert_return (invoke "i64.extend_u_i32" (i32.const 0x80000000)) (i64.const 0x0000000080000000)) +(assert_return (invoke "i64.extend_i32_u" (i32.const 0)) (i64.const 0)) +(assert_return (invoke "i64.extend_i32_u" (i32.const 10000)) (i64.const 10000)) +(assert_return (invoke "i64.extend_i32_u" (i32.const -10000)) (i64.const 0x00000000ffffd8f0)) +(assert_return (invoke "i64.extend_i32_u" (i32.const -1)) (i64.const 0xffffffff)) +(assert_return (invoke "i64.extend_i32_u" (i32.const 0x7fffffff)) (i64.const 0x000000007fffffff)) +(assert_return (invoke "i64.extend_i32_u" (i32.const 0x80000000)) (i64.const 0x0000000080000000)) (assert_return (invoke "i32.wrap_i64" (i64.const -1)) (i32.const -1)) (assert_return (invoke "i32.wrap_i64" (i64.const -100000)) (i32.const -100000)) @@ -53,282 +53,292 @@ (assert_return (invoke "i32.wrap_i64" (i64.const 0x0000000100000000)) (i32.const 0x00000000)) (assert_return (invoke "i32.wrap_i64" (i64.const 0x0000000100000001)) (i32.const 0x00000001)) -(assert_return (invoke "i32.trunc_s_f32" (f32.const 0.0)) (i32.const 0)) -(assert_return (invoke "i32.trunc_s_f32" (f32.const -0.0)) (i32.const 0)) -(assert_return (invoke "i32.trunc_s_f32" (f32.const 0x1p-149)) (i32.const 0)) -(assert_return (invoke "i32.trunc_s_f32" (f32.const -0x1p-149)) (i32.const 0)) -(assert_return (invoke "i32.trunc_s_f32" (f32.const 1.0)) (i32.const 1)) -(assert_return (invoke "i32.trunc_s_f32" (f32.const 0x1.19999ap+0)) (i32.const 1)) -(assert_return (invoke "i32.trunc_s_f32" (f32.const 1.5)) (i32.const 1)) -(assert_return (invoke "i32.trunc_s_f32" (f32.const -1.0)) (i32.const -1)) -(assert_return (invoke "i32.trunc_s_f32" (f32.const -0x1.19999ap+0)) (i32.const -1)) -(assert_return (invoke "i32.trunc_s_f32" (f32.const -1.5)) (i32.const -1)) -(assert_return (invoke "i32.trunc_s_f32" (f32.const -1.9)) (i32.const -1)) -(assert_return (invoke "i32.trunc_s_f32" (f32.const -2.0)) (i32.const -2)) -(assert_return (invoke "i32.trunc_s_f32" (f32.const 2147483520.0)) (i32.const 2147483520)) -(assert_return (invoke "i32.trunc_s_f32" (f32.const -2147483648.0)) (i32.const -2147483648)) -(assert_trap (invoke "i32.trunc_s_f32" (f32.const 2147483648.0)) "integer overflow") -(assert_trap (invoke "i32.trunc_s_f32" (f32.const -2147483904.0)) "integer overflow") -(assert_trap (invoke "i32.trunc_s_f32" (f32.const infinity)) "integer overflow") -(assert_trap (invoke "i32.trunc_s_f32" (f32.const -infinity)) "integer overflow") -(assert_trap (invoke "i32.trunc_s_f32" (f32.const nan)) "invalid conversion to integer") -(assert_trap (invoke "i32.trunc_s_f32" (f32.const nan:0x200000)) "invalid conversion to integer") -(assert_trap (invoke "i32.trunc_s_f32" (f32.const -nan)) "invalid conversion to integer") -(assert_trap (invoke "i32.trunc_s_f32" (f32.const -nan:0x200000)) "invalid conversion to integer") +(assert_return (invoke "i32.trunc_f32_s" (f32.const 0.0)) (i32.const 0)) +(assert_return (invoke "i32.trunc_f32_s" (f32.const -0.0)) (i32.const 0)) +(assert_return (invoke "i32.trunc_f32_s" (f32.const 0x1p-149)) (i32.const 0)) +(assert_return (invoke "i32.trunc_f32_s" (f32.const -0x1p-149)) (i32.const 0)) +(assert_return (invoke "i32.trunc_f32_s" (f32.const 1.0)) (i32.const 1)) +(assert_return (invoke "i32.trunc_f32_s" (f32.const 0x1.19999ap+0)) (i32.const 1)) +(assert_return (invoke "i32.trunc_f32_s" (f32.const 1.5)) (i32.const 1)) +(assert_return (invoke "i32.trunc_f32_s" (f32.const -1.0)) (i32.const -1)) +(assert_return (invoke "i32.trunc_f32_s" (f32.const -0x1.19999ap+0)) (i32.const -1)) +(assert_return (invoke "i32.trunc_f32_s" (f32.const -1.5)) (i32.const -1)) +(assert_return (invoke "i32.trunc_f32_s" (f32.const -1.9)) (i32.const -1)) +(assert_return (invoke "i32.trunc_f32_s" (f32.const -2.0)) (i32.const -2)) +(assert_return (invoke "i32.trunc_f32_s" (f32.const 2147483520.0)) (i32.const 2147483520)) +(assert_return (invoke "i32.trunc_f32_s" (f32.const -2147483648.0)) (i32.const -2147483648)) +(assert_trap (invoke "i32.trunc_f32_s" (f32.const 2147483648.0)) "integer overflow") +(assert_trap (invoke "i32.trunc_f32_s" (f32.const -2147483904.0)) "integer overflow") +(assert_trap (invoke "i32.trunc_f32_s" (f32.const inf)) "integer overflow") +(assert_trap (invoke "i32.trunc_f32_s" (f32.const -inf)) "integer overflow") +(assert_trap (invoke "i32.trunc_f32_s" (f32.const nan)) "invalid conversion to integer") +(assert_trap (invoke "i32.trunc_f32_s" (f32.const nan:0x200000)) "invalid conversion to integer") +(assert_trap (invoke "i32.trunc_f32_s" (f32.const -nan)) "invalid conversion to integer") +(assert_trap (invoke "i32.trunc_f32_s" (f32.const -nan:0x200000)) "invalid conversion to integer") -(assert_return (invoke "i32.trunc_u_f32" (f32.const 0.0)) (i32.const 0)) -(assert_return (invoke "i32.trunc_u_f32" (f32.const -0.0)) (i32.const 0)) -(assert_return (invoke "i32.trunc_u_f32" (f32.const 0x1p-149)) (i32.const 0)) -(assert_return (invoke "i32.trunc_u_f32" (f32.const -0x1p-149)) (i32.const 0)) -(assert_return (invoke "i32.trunc_u_f32" (f32.const 1.0)) (i32.const 1)) -(assert_return (invoke "i32.trunc_u_f32" (f32.const 0x1.19999ap+0)) (i32.const 1)) -(assert_return (invoke "i32.trunc_u_f32" (f32.const 1.5)) (i32.const 1)) -(assert_return (invoke "i32.trunc_u_f32" (f32.const 1.9)) (i32.const 1)) -(assert_return (invoke "i32.trunc_u_f32" (f32.const 2.0)) (i32.const 2)) -(assert_return (invoke "i32.trunc_u_f32" (f32.const 2147483648)) (i32.const -2147483648)) ;; 0x1.00000p+31 -> 8000 0000 -(assert_return (invoke "i32.trunc_u_f32" (f32.const 4294967040.0)) (i32.const -256)) -(assert_return (invoke "i32.trunc_u_f32" (f32.const -0x1.ccccccp-1)) (i32.const 0)) -(assert_return (invoke "i32.trunc_u_f32" (f32.const -0x1.fffffep-1)) (i32.const 0)) -(assert_trap (invoke "i32.trunc_u_f32" (f32.const 4294967296.0)) "integer overflow") -(assert_trap (invoke "i32.trunc_u_f32" (f32.const -1.0)) "integer overflow") -(assert_trap (invoke "i32.trunc_u_f32" (f32.const infinity)) "integer overflow") -(assert_trap (invoke "i32.trunc_u_f32" (f32.const -infinity)) "integer overflow") -(assert_trap (invoke "i32.trunc_u_f32" (f32.const nan)) "invalid conversion to integer") -(assert_trap (invoke "i32.trunc_u_f32" (f32.const nan:0x200000)) "invalid conversion to integer") -(assert_trap (invoke "i32.trunc_u_f32" (f32.const -nan)) "invalid conversion to integer") -(assert_trap (invoke "i32.trunc_u_f32" (f32.const -nan:0x200000)) "invalid conversion to integer") +(assert_return (invoke "i32.trunc_f32_u" (f32.const 0.0)) (i32.const 0)) +(assert_return (invoke "i32.trunc_f32_u" (f32.const -0.0)) (i32.const 0)) +(assert_return (invoke "i32.trunc_f32_u" (f32.const 0x1p-149)) (i32.const 0)) +(assert_return (invoke "i32.trunc_f32_u" (f32.const -0x1p-149)) (i32.const 0)) +(assert_return (invoke "i32.trunc_f32_u" (f32.const 1.0)) (i32.const 1)) +(assert_return (invoke "i32.trunc_f32_u" (f32.const 0x1.19999ap+0)) (i32.const 1)) +(assert_return (invoke "i32.trunc_f32_u" (f32.const 1.5)) (i32.const 1)) +(assert_return (invoke "i32.trunc_f32_u" (f32.const 1.9)) (i32.const 1)) +(assert_return (invoke "i32.trunc_f32_u" (f32.const 2.0)) (i32.const 2)) +(assert_return (invoke "i32.trunc_f32_u" (f32.const 2147483648)) (i32.const -2147483648)) ;; 0x1.00000p+31 -> 8000 0000 +(assert_return (invoke "i32.trunc_f32_u" (f32.const 4294967040.0)) (i32.const -256)) +(assert_return (invoke "i32.trunc_f32_u" (f32.const -0x1.ccccccp-1)) (i32.const 0)) +(assert_return (invoke "i32.trunc_f32_u" (f32.const -0x1.fffffep-1)) (i32.const 0)) +(assert_trap (invoke "i32.trunc_f32_u" (f32.const 4294967296.0)) "integer overflow") +(assert_trap (invoke "i32.trunc_f32_u" (f32.const -1.0)) "integer overflow") +(assert_trap (invoke "i32.trunc_f32_u" (f32.const inf)) "integer overflow") +(assert_trap (invoke "i32.trunc_f32_u" (f32.const -inf)) "integer overflow") +(assert_trap (invoke "i32.trunc_f32_u" (f32.const nan)) "invalid conversion to integer") +(assert_trap (invoke "i32.trunc_f32_u" (f32.const nan:0x200000)) "invalid conversion to integer") +(assert_trap (invoke "i32.trunc_f32_u" (f32.const -nan)) "invalid conversion to integer") +(assert_trap (invoke "i32.trunc_f32_u" (f32.const -nan:0x200000)) "invalid conversion to integer") -(assert_return (invoke "i32.trunc_s_f64" (f64.const 0.0)) (i32.const 0)) -(assert_return (invoke "i32.trunc_s_f64" (f64.const -0.0)) (i32.const 0)) -(assert_return (invoke "i32.trunc_s_f64" (f64.const 0x0.0000000000001p-1022)) (i32.const 0)) -(assert_return (invoke "i32.trunc_s_f64" (f64.const -0x0.0000000000001p-1022)) (i32.const 0)) -(assert_return (invoke "i32.trunc_s_f64" (f64.const 1.0)) (i32.const 1)) -(assert_return (invoke "i32.trunc_s_f64" (f64.const 0x1.199999999999ap+0)) (i32.const 1)) -(assert_return (invoke "i32.trunc_s_f64" (f64.const 1.5)) (i32.const 1)) -(assert_return (invoke "i32.trunc_s_f64" (f64.const -1.0)) (i32.const -1)) -(assert_return (invoke "i32.trunc_s_f64" (f64.const -0x1.199999999999ap+0)) (i32.const -1)) -(assert_return (invoke "i32.trunc_s_f64" (f64.const -1.5)) (i32.const -1)) -(assert_return (invoke "i32.trunc_s_f64" (f64.const -1.9)) (i32.const -1)) -(assert_return (invoke "i32.trunc_s_f64" (f64.const -2.0)) (i32.const -2)) -(assert_return (invoke "i32.trunc_s_f64" (f64.const 2147483647.0)) (i32.const 2147483647)) -(assert_return (invoke "i32.trunc_s_f64" (f64.const -2147483648.0)) (i32.const -2147483648)) -(assert_trap (invoke "i32.trunc_s_f64" (f64.const 2147483648.0)) "integer overflow") -(assert_trap (invoke "i32.trunc_s_f64" (f64.const -2147483649.0)) "integer overflow") -(assert_trap (invoke "i32.trunc_s_f64" (f64.const infinity)) "integer overflow") -(assert_trap (invoke "i32.trunc_s_f64" (f64.const -infinity)) "integer overflow") -(assert_trap (invoke "i32.trunc_s_f64" (f64.const nan)) "invalid conversion to integer") -(assert_trap (invoke "i32.trunc_s_f64" (f64.const nan:0x4000000000000)) "invalid conversion to integer") -(assert_trap (invoke "i32.trunc_s_f64" (f64.const -nan)) "invalid conversion to integer") -(assert_trap (invoke "i32.trunc_s_f64" (f64.const -nan:0x4000000000000)) "invalid conversion to integer") +(assert_return (invoke "i32.trunc_f64_s" (f64.const 0.0)) (i32.const 0)) +(assert_return (invoke "i32.trunc_f64_s" (f64.const -0.0)) (i32.const 0)) +(assert_return (invoke "i32.trunc_f64_s" (f64.const 0x0.0000000000001p-1022)) (i32.const 0)) +(assert_return (invoke "i32.trunc_f64_s" (f64.const -0x0.0000000000001p-1022)) (i32.const 0)) +(assert_return (invoke "i32.trunc_f64_s" (f64.const 1.0)) (i32.const 1)) +(assert_return (invoke "i32.trunc_f64_s" (f64.const 0x1.199999999999ap+0)) (i32.const 1)) +(assert_return (invoke "i32.trunc_f64_s" (f64.const 1.5)) (i32.const 1)) +(assert_return (invoke "i32.trunc_f64_s" (f64.const -1.0)) (i32.const -1)) +(assert_return (invoke "i32.trunc_f64_s" (f64.const -0x1.199999999999ap+0)) (i32.const -1)) +(assert_return (invoke "i32.trunc_f64_s" (f64.const -1.5)) (i32.const -1)) +(assert_return (invoke "i32.trunc_f64_s" (f64.const -1.9)) (i32.const -1)) +(assert_return (invoke "i32.trunc_f64_s" (f64.const -2.0)) (i32.const -2)) +(assert_return (invoke "i32.trunc_f64_s" (f64.const 2147483647.0)) (i32.const 2147483647)) +(assert_return (invoke "i32.trunc_f64_s" (f64.const -2147483648.0)) (i32.const -2147483648)) +(assert_trap (invoke "i32.trunc_f64_s" (f64.const 2147483648.0)) "integer overflow") +(assert_trap (invoke "i32.trunc_f64_s" (f64.const -2147483649.0)) "integer overflow") +(assert_trap (invoke "i32.trunc_f64_s" (f64.const inf)) "integer overflow") +(assert_trap (invoke "i32.trunc_f64_s" (f64.const -inf)) "integer overflow") +(assert_trap (invoke "i32.trunc_f64_s" (f64.const nan)) "invalid conversion to integer") +(assert_trap (invoke "i32.trunc_f64_s" (f64.const nan:0x4000000000000)) "invalid conversion to integer") +(assert_trap (invoke "i32.trunc_f64_s" (f64.const -nan)) "invalid conversion to integer") +(assert_trap (invoke "i32.trunc_f64_s" (f64.const -nan:0x4000000000000)) "invalid conversion to integer") -(assert_return (invoke "i32.trunc_u_f64" (f64.const 0.0)) (i32.const 0)) -(assert_return (invoke "i32.trunc_u_f64" (f64.const -0.0)) (i32.const 0)) -(assert_return (invoke "i32.trunc_u_f64" (f64.const 0x0.0000000000001p-1022)) (i32.const 0)) -(assert_return (invoke "i32.trunc_u_f64" (f64.const -0x0.0000000000001p-1022)) (i32.const 0)) -(assert_return (invoke "i32.trunc_u_f64" (f64.const 1.0)) (i32.const 1)) -(assert_return (invoke "i32.trunc_u_f64" (f64.const 0x1.199999999999ap+0)) (i32.const 1)) -(assert_return (invoke "i32.trunc_u_f64" (f64.const 1.5)) (i32.const 1)) -(assert_return (invoke "i32.trunc_u_f64" (f64.const 1.9)) (i32.const 1)) -(assert_return (invoke "i32.trunc_u_f64" (f64.const 2.0)) (i32.const 2)) -(assert_return (invoke "i32.trunc_u_f64" (f64.const 2147483648)) (i32.const -2147483648)) ;; 0x1.00000p+31 -> 8000 0000 -(assert_return (invoke "i32.trunc_u_f64" (f64.const 4294967295.0)) (i32.const -1)) -(assert_return (invoke "i32.trunc_u_f64" (f64.const -0x1.ccccccccccccdp-1)) (i32.const 0)) -(assert_return (invoke "i32.trunc_u_f64" (f64.const -0x1.fffffffffffffp-1)) (i32.const 0)) -(assert_return (invoke "i32.trunc_u_f64" (f64.const 1e8)) (i32.const 100000000)) -(assert_trap (invoke "i32.trunc_u_f64" (f64.const 4294967296.0)) "integer overflow") -(assert_trap (invoke "i32.trunc_u_f64" (f64.const -1.0)) "integer overflow") -(assert_trap (invoke "i32.trunc_u_f64" (f64.const 1e16)) "integer overflow") -(assert_trap (invoke "i32.trunc_u_f64" (f64.const 1e30)) "integer overflow") -(assert_trap (invoke "i32.trunc_u_f64" (f64.const 9223372036854775808)) "integer overflow") -(assert_trap (invoke "i32.trunc_u_f64" (f64.const infinity)) "integer overflow") -(assert_trap (invoke "i32.trunc_u_f64" (f64.const -infinity)) "integer overflow") -(assert_trap (invoke "i32.trunc_u_f64" (f64.const nan)) "invalid conversion to integer") -(assert_trap (invoke "i32.trunc_u_f64" (f64.const nan:0x4000000000000)) "invalid conversion to integer") -(assert_trap (invoke "i32.trunc_u_f64" (f64.const -nan)) "invalid conversion to integer") -(assert_trap (invoke "i32.trunc_u_f64" (f64.const -nan:0x4000000000000)) "invalid conversion to integer") +(assert_return (invoke "i32.trunc_f64_u" (f64.const 0.0)) (i32.const 0)) +(assert_return (invoke "i32.trunc_f64_u" (f64.const -0.0)) (i32.const 0)) +(assert_return (invoke "i32.trunc_f64_u" (f64.const 0x0.0000000000001p-1022)) (i32.const 0)) +(assert_return (invoke "i32.trunc_f64_u" (f64.const -0x0.0000000000001p-1022)) (i32.const 0)) +(assert_return (invoke "i32.trunc_f64_u" (f64.const 1.0)) (i32.const 1)) +(assert_return (invoke "i32.trunc_f64_u" (f64.const 0x1.199999999999ap+0)) (i32.const 1)) +(assert_return (invoke "i32.trunc_f64_u" (f64.const 1.5)) (i32.const 1)) +(assert_return (invoke "i32.trunc_f64_u" (f64.const 1.9)) (i32.const 1)) +(assert_return (invoke "i32.trunc_f64_u" (f64.const 2.0)) (i32.const 2)) +(assert_return (invoke "i32.trunc_f64_u" (f64.const 2147483648)) (i32.const -2147483648)) ;; 0x1.00000p+31 -> 8000 0000 +(assert_return (invoke "i32.trunc_f64_u" (f64.const 4294967295.0)) (i32.const -1)) +(assert_return (invoke "i32.trunc_f64_u" (f64.const -0x1.ccccccccccccdp-1)) (i32.const 0)) +(assert_return (invoke "i32.trunc_f64_u" (f64.const -0x1.fffffffffffffp-1)) (i32.const 0)) +(assert_return (invoke "i32.trunc_f64_u" (f64.const 1e8)) (i32.const 100000000)) +(assert_trap (invoke "i32.trunc_f64_u" (f64.const 4294967296.0)) "integer overflow") +(assert_trap (invoke "i32.trunc_f64_u" (f64.const -1.0)) "integer overflow") +(assert_trap (invoke "i32.trunc_f64_u" (f64.const 1e16)) "integer overflow") +(assert_trap (invoke "i32.trunc_f64_u" (f64.const 1e30)) "integer overflow") +(assert_trap (invoke "i32.trunc_f64_u" (f64.const 9223372036854775808)) "integer overflow") +(assert_trap (invoke "i32.trunc_f64_u" (f64.const inf)) "integer overflow") +(assert_trap (invoke "i32.trunc_f64_u" (f64.const -inf)) "integer overflow") +(assert_trap (invoke "i32.trunc_f64_u" (f64.const nan)) "invalid conversion to integer") +(assert_trap (invoke "i32.trunc_f64_u" (f64.const nan:0x4000000000000)) "invalid conversion to integer") +(assert_trap (invoke "i32.trunc_f64_u" (f64.const -nan)) "invalid conversion to integer") +(assert_trap (invoke "i32.trunc_f64_u" (f64.const -nan:0x4000000000000)) "invalid conversion to integer") -(assert_return (invoke "i64.trunc_s_f32" (f32.const 0.0)) (i64.const 0)) -(assert_return (invoke "i64.trunc_s_f32" (f32.const -0.0)) (i64.const 0)) -(assert_return (invoke "i64.trunc_s_f32" (f32.const 0x1p-149)) (i64.const 0)) -(assert_return (invoke "i64.trunc_s_f32" (f32.const -0x1p-149)) (i64.const 0)) -(assert_return (invoke "i64.trunc_s_f32" (f32.const 1.0)) (i64.const 1)) -(assert_return (invoke "i64.trunc_s_f32" (f32.const 0x1.19999ap+0)) (i64.const 1)) -(assert_return (invoke "i64.trunc_s_f32" (f32.const 1.5)) (i64.const 1)) -(assert_return (invoke "i64.trunc_s_f32" (f32.const -1.0)) (i64.const -1)) -(assert_return (invoke "i64.trunc_s_f32" (f32.const -0x1.19999ap+0)) (i64.const -1)) -(assert_return (invoke "i64.trunc_s_f32" (f32.const -1.5)) (i64.const -1)) -(assert_return (invoke "i64.trunc_s_f32" (f32.const -1.9)) (i64.const -1)) -(assert_return (invoke "i64.trunc_s_f32" (f32.const -2.0)) (i64.const -2)) -(assert_return (invoke "i64.trunc_s_f32" (f32.const 4294967296)) (i64.const 4294967296)) ;; 0x1.00000p+32 -> 1 0000 0000 -(assert_return (invoke "i64.trunc_s_f32" (f32.const -4294967296)) (i64.const -4294967296)) ;; -0x1.00000p+32 -> ffff ffff 0000 0000 -(assert_return (invoke "i64.trunc_s_f32" (f32.const 9223371487098961920.0)) (i64.const 9223371487098961920)) -(assert_return (invoke "i64.trunc_s_f32" (f32.const -9223372036854775808.0)) (i64.const -9223372036854775808)) -(assert_trap (invoke "i64.trunc_s_f32" (f32.const 9223372036854775808.0)) "integer overflow") -(assert_trap (invoke "i64.trunc_s_f32" (f32.const -9223373136366403584.0)) "integer overflow") -(assert_trap (invoke "i64.trunc_s_f32" (f32.const infinity)) "integer overflow") -(assert_trap (invoke "i64.trunc_s_f32" (f32.const -infinity)) "integer overflow") -(assert_trap (invoke "i64.trunc_s_f32" (f32.const nan)) "invalid conversion to integer") -(assert_trap (invoke "i64.trunc_s_f32" (f32.const nan:0x200000)) "invalid conversion to integer") -(assert_trap (invoke "i64.trunc_s_f32" (f32.const -nan)) "invalid conversion to integer") -(assert_trap (invoke "i64.trunc_s_f32" (f32.const -nan:0x200000)) "invalid conversion to integer") +(assert_return (invoke "i64.trunc_f32_s" (f32.const 0.0)) (i64.const 0)) +(assert_return (invoke "i64.trunc_f32_s" (f32.const -0.0)) (i64.const 0)) +(assert_return (invoke "i64.trunc_f32_s" (f32.const 0x1p-149)) (i64.const 0)) +(assert_return (invoke "i64.trunc_f32_s" (f32.const -0x1p-149)) (i64.const 0)) +(assert_return (invoke "i64.trunc_f32_s" (f32.const 1.0)) (i64.const 1)) +(assert_return (invoke "i64.trunc_f32_s" (f32.const 0x1.19999ap+0)) (i64.const 1)) +(assert_return (invoke "i64.trunc_f32_s" (f32.const 1.5)) (i64.const 1)) +(assert_return (invoke "i64.trunc_f32_s" (f32.const -1.0)) (i64.const -1)) +(assert_return (invoke "i64.trunc_f32_s" (f32.const -0x1.19999ap+0)) (i64.const -1)) +(assert_return (invoke "i64.trunc_f32_s" (f32.const -1.5)) (i64.const -1)) +(assert_return (invoke "i64.trunc_f32_s" (f32.const -1.9)) (i64.const -1)) +(assert_return (invoke "i64.trunc_f32_s" (f32.const -2.0)) (i64.const -2)) +(assert_return (invoke "i64.trunc_f32_s" (f32.const 4294967296)) (i64.const 4294967296)) ;; 0x1.00000p+32 -> 1 0000 0000 +(assert_return (invoke "i64.trunc_f32_s" (f32.const -4294967296)) (i64.const -4294967296)) ;; -0x1.00000p+32 -> ffff ffff 0000 0000 +(assert_return (invoke "i64.trunc_f32_s" (f32.const 9223371487098961920.0)) (i64.const 9223371487098961920)) +(assert_return (invoke "i64.trunc_f32_s" (f32.const -9223372036854775808.0)) (i64.const -9223372036854775808)) +(assert_trap (invoke "i64.trunc_f32_s" (f32.const 9223372036854775808.0)) "integer overflow") +(assert_trap (invoke "i64.trunc_f32_s" (f32.const -9223373136366403584.0)) "integer overflow") +(assert_trap (invoke "i64.trunc_f32_s" (f32.const inf)) "integer overflow") +(assert_trap (invoke "i64.trunc_f32_s" (f32.const -inf)) "integer overflow") +(assert_trap (invoke "i64.trunc_f32_s" (f32.const nan)) "invalid conversion to integer") +(assert_trap (invoke "i64.trunc_f32_s" (f32.const nan:0x200000)) "invalid conversion to integer") +(assert_trap (invoke "i64.trunc_f32_s" (f32.const -nan)) "invalid conversion to integer") +(assert_trap (invoke "i64.trunc_f32_s" (f32.const -nan:0x200000)) "invalid conversion to integer") -(assert_return (invoke "i64.trunc_u_f32" (f32.const 0.0)) (i64.const 0)) -(assert_return (invoke "i64.trunc_u_f32" (f32.const -0.0)) (i64.const 0)) -(assert_return (invoke "i64.trunc_u_f32" (f32.const 0x1p-149)) (i64.const 0)) -(assert_return (invoke "i64.trunc_u_f32" (f32.const -0x1p-149)) (i64.const 0)) -(assert_return (invoke "i64.trunc_u_f32" (f32.const 1.0)) (i64.const 1)) -(assert_return (invoke "i64.trunc_u_f32" (f32.const 0x1.19999ap+0)) (i64.const 1)) -(assert_return (invoke "i64.trunc_u_f32" (f32.const 1.5)) (i64.const 1)) -(assert_return (invoke "i64.trunc_u_f32" (f32.const 4294967296)) (i64.const 4294967296)) -(assert_return (invoke "i64.trunc_u_f32" (f32.const 18446742974197923840.0)) (i64.const -1099511627776)) -(assert_return (invoke "i64.trunc_u_f32" (f32.const -0x1.ccccccp-1)) (i64.const 0)) -(assert_return (invoke "i64.trunc_u_f32" (f32.const -0x1.fffffep-1)) (i64.const 0)) -(assert_trap (invoke "i64.trunc_u_f32" (f32.const 18446744073709551616.0)) "integer overflow") -(assert_trap (invoke "i64.trunc_u_f32" (f32.const -1.0)) "integer overflow") -(assert_trap (invoke "i64.trunc_u_f32" (f32.const infinity)) "integer overflow") -(assert_trap (invoke "i64.trunc_u_f32" (f32.const -infinity)) "integer overflow") -(assert_trap (invoke "i64.trunc_u_f32" (f32.const nan)) "invalid conversion to integer") -(assert_trap (invoke "i64.trunc_u_f32" (f32.const nan:0x200000)) "invalid conversion to integer") -(assert_trap (invoke "i64.trunc_u_f32" (f32.const -nan)) "invalid conversion to integer") -(assert_trap (invoke "i64.trunc_u_f32" (f32.const -nan:0x200000)) "invalid conversion to integer") +(assert_return (invoke "i64.trunc_f32_u" (f32.const 0.0)) (i64.const 0)) +(assert_return (invoke "i64.trunc_f32_u" (f32.const -0.0)) (i64.const 0)) +(assert_return (invoke "i64.trunc_f32_u" (f32.const 0x1p-149)) (i64.const 0)) +(assert_return (invoke "i64.trunc_f32_u" (f32.const -0x1p-149)) (i64.const 0)) +(assert_return (invoke "i64.trunc_f32_u" (f32.const 1.0)) (i64.const 1)) +(assert_return (invoke "i64.trunc_f32_u" (f32.const 0x1.19999ap+0)) (i64.const 1)) +(assert_return (invoke "i64.trunc_f32_u" (f32.const 1.5)) (i64.const 1)) +(assert_return (invoke "i64.trunc_f32_u" (f32.const 4294967296)) (i64.const 4294967296)) +(assert_return (invoke "i64.trunc_f32_u" (f32.const 18446742974197923840.0)) (i64.const -1099511627776)) +(assert_return (invoke "i64.trunc_f32_u" (f32.const -0x1.ccccccp-1)) (i64.const 0)) +(assert_return (invoke "i64.trunc_f32_u" (f32.const -0x1.fffffep-1)) (i64.const 0)) +(assert_trap (invoke "i64.trunc_f32_u" (f32.const 18446744073709551616.0)) "integer overflow") +(assert_trap (invoke "i64.trunc_f32_u" (f32.const -1.0)) "integer overflow") +(assert_trap (invoke "i64.trunc_f32_u" (f32.const inf)) "integer overflow") +(assert_trap (invoke "i64.trunc_f32_u" (f32.const -inf)) "integer overflow") +(assert_trap (invoke "i64.trunc_f32_u" (f32.const nan)) "invalid conversion to integer") +(assert_trap (invoke "i64.trunc_f32_u" (f32.const nan:0x200000)) "invalid conversion to integer") +(assert_trap (invoke "i64.trunc_f32_u" (f32.const -nan)) "invalid conversion to integer") +(assert_trap (invoke "i64.trunc_f32_u" (f32.const -nan:0x200000)) "invalid conversion to integer") -(assert_return (invoke "i64.trunc_s_f64" (f64.const 0.0)) (i64.const 0)) -(assert_return (invoke "i64.trunc_s_f64" (f64.const -0.0)) (i64.const 0)) -(assert_return (invoke "i64.trunc_s_f64" (f64.const 0x0.0000000000001p-1022)) (i64.const 0)) -(assert_return (invoke "i64.trunc_s_f64" (f64.const -0x0.0000000000001p-1022)) (i64.const 0)) -(assert_return (invoke "i64.trunc_s_f64" (f64.const 1.0)) (i64.const 1)) -(assert_return (invoke "i64.trunc_s_f64" (f64.const 0x1.199999999999ap+0)) (i64.const 1)) -(assert_return (invoke "i64.trunc_s_f64" (f64.const 1.5)) (i64.const 1)) -(assert_return (invoke "i64.trunc_s_f64" (f64.const -1.0)) (i64.const -1)) -(assert_return (invoke "i64.trunc_s_f64" (f64.const -0x1.199999999999ap+0)) (i64.const -1)) -(assert_return (invoke "i64.trunc_s_f64" (f64.const -1.5)) (i64.const -1)) -(assert_return (invoke "i64.trunc_s_f64" (f64.const -1.9)) (i64.const -1)) -(assert_return (invoke "i64.trunc_s_f64" (f64.const -2.0)) (i64.const -2)) -(assert_return (invoke "i64.trunc_s_f64" (f64.const 4294967296)) (i64.const 4294967296)) ;; 0x1.00000p+32 -> 1 0000 0000 -(assert_return (invoke "i64.trunc_s_f64" (f64.const -4294967296)) (i64.const -4294967296)) ;; -0x1.00000p+32 -> ffff ffff 0000 0000 -(assert_return (invoke "i64.trunc_s_f64" (f64.const 9223372036854774784.0)) (i64.const 9223372036854774784)) -(assert_return (invoke "i64.trunc_s_f64" (f64.const -9223372036854775808.0)) (i64.const -9223372036854775808)) -(assert_trap (invoke "i64.trunc_s_f64" (f64.const 9223372036854775808.0)) "integer overflow") -(assert_trap (invoke "i64.trunc_s_f64" (f64.const -9223372036854777856.0)) "integer overflow") -(assert_trap (invoke "i64.trunc_s_f64" (f64.const infinity)) "integer overflow") -(assert_trap (invoke "i64.trunc_s_f64" (f64.const -infinity)) "integer overflow") -(assert_trap (invoke "i64.trunc_s_f64" (f64.const nan)) "invalid conversion to integer") -(assert_trap (invoke "i64.trunc_s_f64" (f64.const nan:0x4000000000000)) "invalid conversion to integer") -(assert_trap (invoke "i64.trunc_s_f64" (f64.const -nan)) "invalid conversion to integer") -(assert_trap (invoke "i64.trunc_s_f64" (f64.const -nan:0x4000000000000)) "invalid conversion to integer") +(assert_return (invoke "i64.trunc_f64_s" (f64.const 0.0)) (i64.const 0)) +(assert_return (invoke "i64.trunc_f64_s" (f64.const -0.0)) (i64.const 0)) +(assert_return (invoke "i64.trunc_f64_s" (f64.const 0x0.0000000000001p-1022)) (i64.const 0)) +(assert_return (invoke "i64.trunc_f64_s" (f64.const -0x0.0000000000001p-1022)) (i64.const 0)) +(assert_return (invoke "i64.trunc_f64_s" (f64.const 1.0)) (i64.const 1)) +(assert_return (invoke "i64.trunc_f64_s" (f64.const 0x1.199999999999ap+0)) (i64.const 1)) +(assert_return (invoke "i64.trunc_f64_s" (f64.const 1.5)) (i64.const 1)) +(assert_return (invoke "i64.trunc_f64_s" (f64.const -1.0)) (i64.const -1)) +(assert_return (invoke "i64.trunc_f64_s" (f64.const -0x1.199999999999ap+0)) (i64.const -1)) +(assert_return (invoke "i64.trunc_f64_s" (f64.const -1.5)) (i64.const -1)) +(assert_return (invoke "i64.trunc_f64_s" (f64.const -1.9)) (i64.const -1)) +(assert_return (invoke "i64.trunc_f64_s" (f64.const -2.0)) (i64.const -2)) +(assert_return (invoke "i64.trunc_f64_s" (f64.const 4294967296)) (i64.const 4294967296)) ;; 0x1.00000p+32 -> 1 0000 0000 +(assert_return (invoke "i64.trunc_f64_s" (f64.const -4294967296)) (i64.const -4294967296)) ;; -0x1.00000p+32 -> ffff ffff 0000 0000 +(assert_return (invoke "i64.trunc_f64_s" (f64.const 9223372036854774784.0)) (i64.const 9223372036854774784)) +(assert_return (invoke "i64.trunc_f64_s" (f64.const -9223372036854775808.0)) (i64.const -9223372036854775808)) +(assert_trap (invoke "i64.trunc_f64_s" (f64.const 9223372036854775808.0)) "integer overflow") +(assert_trap (invoke "i64.trunc_f64_s" (f64.const -9223372036854777856.0)) "integer overflow") +(assert_trap (invoke "i64.trunc_f64_s" (f64.const inf)) "integer overflow") +(assert_trap (invoke "i64.trunc_f64_s" (f64.const -inf)) "integer overflow") +(assert_trap (invoke "i64.trunc_f64_s" (f64.const nan)) "invalid conversion to integer") +(assert_trap (invoke "i64.trunc_f64_s" (f64.const nan:0x4000000000000)) "invalid conversion to integer") +(assert_trap (invoke "i64.trunc_f64_s" (f64.const -nan)) "invalid conversion to integer") +(assert_trap (invoke "i64.trunc_f64_s" (f64.const -nan:0x4000000000000)) "invalid conversion to integer") -(assert_return (invoke "i64.trunc_u_f64" (f64.const 0.0)) (i64.const 0)) -(assert_return (invoke "i64.trunc_u_f64" (f64.const -0.0)) (i64.const 0)) -(assert_return (invoke "i64.trunc_u_f64" (f64.const 0x0.0000000000001p-1022)) (i64.const 0)) -(assert_return (invoke "i64.trunc_u_f64" (f64.const -0x0.0000000000001p-1022)) (i64.const 0)) -(assert_return (invoke "i64.trunc_u_f64" (f64.const 1.0)) (i64.const 1)) -(assert_return (invoke "i64.trunc_u_f64" (f64.const 0x1.199999999999ap+0)) (i64.const 1)) -(assert_return (invoke "i64.trunc_u_f64" (f64.const 1.5)) (i64.const 1)) -(assert_return (invoke "i64.trunc_u_f64" (f64.const 4294967295)) (i64.const 0xffffffff)) -(assert_return (invoke "i64.trunc_u_f64" (f64.const 4294967296)) (i64.const 0x100000000)) -(assert_return (invoke "i64.trunc_u_f64" (f64.const 18446744073709549568.0)) (i64.const -2048)) -(assert_return (invoke "i64.trunc_u_f64" (f64.const -0x1.ccccccccccccdp-1)) (i64.const 0)) -(assert_return (invoke "i64.trunc_u_f64" (f64.const -0x1.fffffffffffffp-1)) (i64.const 0)) -(assert_return (invoke "i64.trunc_u_f64" (f64.const 1e8)) (i64.const 100000000)) -(assert_return (invoke "i64.trunc_u_f64" (f64.const 1e16)) (i64.const 10000000000000000)) -(assert_return (invoke "i64.trunc_u_f64" (f64.const 9223372036854775808)) (i64.const -9223372036854775808)) -(assert_trap (invoke "i64.trunc_u_f64" (f64.const 18446744073709551616.0)) "integer overflow") -(assert_trap (invoke "i64.trunc_u_f64" (f64.const -1.0)) "integer overflow") -(assert_trap (invoke "i64.trunc_u_f64" (f64.const infinity)) "integer overflow") -(assert_trap (invoke "i64.trunc_u_f64" (f64.const -infinity)) "integer overflow") -(assert_trap (invoke "i64.trunc_u_f64" (f64.const nan)) "invalid conversion to integer") -(assert_trap (invoke "i64.trunc_u_f64" (f64.const nan:0x4000000000000)) "invalid conversion to integer") -(assert_trap (invoke "i64.trunc_u_f64" (f64.const -nan)) "invalid conversion to integer") -(assert_trap (invoke "i64.trunc_u_f64" (f64.const -nan:0x4000000000000)) "invalid conversion to integer") +(assert_return (invoke "i64.trunc_f64_u" (f64.const 0.0)) (i64.const 0)) +(assert_return (invoke "i64.trunc_f64_u" (f64.const -0.0)) (i64.const 0)) +(assert_return (invoke "i64.trunc_f64_u" (f64.const 0x0.0000000000001p-1022)) (i64.const 0)) +(assert_return (invoke "i64.trunc_f64_u" (f64.const -0x0.0000000000001p-1022)) (i64.const 0)) +(assert_return (invoke "i64.trunc_f64_u" (f64.const 1.0)) (i64.const 1)) +(assert_return (invoke "i64.trunc_f64_u" (f64.const 0x1.199999999999ap+0)) (i64.const 1)) +(assert_return (invoke "i64.trunc_f64_u" (f64.const 1.5)) (i64.const 1)) +(assert_return (invoke "i64.trunc_f64_u" (f64.const 4294967295)) (i64.const 0xffffffff)) +(assert_return (invoke "i64.trunc_f64_u" (f64.const 4294967296)) (i64.const 0x100000000)) +(assert_return (invoke "i64.trunc_f64_u" (f64.const 18446744073709549568.0)) (i64.const -2048)) +(assert_return (invoke "i64.trunc_f64_u" (f64.const -0x1.ccccccccccccdp-1)) (i64.const 0)) +(assert_return (invoke "i64.trunc_f64_u" (f64.const -0x1.fffffffffffffp-1)) (i64.const 0)) +(assert_return (invoke "i64.trunc_f64_u" (f64.const 1e8)) (i64.const 100000000)) +(assert_return (invoke "i64.trunc_f64_u" (f64.const 1e16)) (i64.const 10000000000000000)) +(assert_return (invoke "i64.trunc_f64_u" (f64.const 9223372036854775808)) (i64.const -9223372036854775808)) +(assert_trap (invoke "i64.trunc_f64_u" (f64.const 18446744073709551616.0)) "integer overflow") +(assert_trap (invoke "i64.trunc_f64_u" (f64.const -1.0)) "integer overflow") +(assert_trap (invoke "i64.trunc_f64_u" (f64.const inf)) "integer overflow") +(assert_trap (invoke "i64.trunc_f64_u" (f64.const -inf)) "integer overflow") +(assert_trap (invoke "i64.trunc_f64_u" (f64.const nan)) "invalid conversion to integer") +(assert_trap (invoke "i64.trunc_f64_u" (f64.const nan:0x4000000000000)) "invalid conversion to integer") +(assert_trap (invoke "i64.trunc_f64_u" (f64.const -nan)) "invalid conversion to integer") +(assert_trap (invoke "i64.trunc_f64_u" (f64.const -nan:0x4000000000000)) "invalid conversion to integer") -(assert_return (invoke "f32.convert_s_i32" (i32.const 1)) (f32.const 1.0)) -(assert_return (invoke "f32.convert_s_i32" (i32.const -1)) (f32.const -1.0)) -(assert_return (invoke "f32.convert_s_i32" (i32.const 0)) (f32.const 0.0)) -(assert_return (invoke "f32.convert_s_i32" (i32.const 2147483647)) (f32.const 2147483648)) -(assert_return (invoke "f32.convert_s_i32" (i32.const -2147483648)) (f32.const -2147483648)) -(assert_return (invoke "f32.convert_s_i32" (i32.const 1234567890)) (f32.const 0x1.26580cp+30)) +(assert_return (invoke "f32.convert_i32_s" (i32.const 1)) (f32.const 1.0)) +(assert_return (invoke "f32.convert_i32_s" (i32.const -1)) (f32.const -1.0)) +(assert_return (invoke "f32.convert_i32_s" (i32.const 0)) (f32.const 0.0)) +(assert_return (invoke "f32.convert_i32_s" (i32.const 2147483647)) (f32.const 2147483648)) +(assert_return (invoke "f32.convert_i32_s" (i32.const -2147483648)) (f32.const -2147483648)) +(assert_return (invoke "f32.convert_i32_s" (i32.const 1234567890)) (f32.const 0x1.26580cp+30)) ;; Test rounding directions. -(assert_return (invoke "f32.convert_s_i32" (i32.const 16777217)) (f32.const 16777216.0)) -(assert_return (invoke "f32.convert_s_i32" (i32.const -16777217)) (f32.const -16777216.0)) -(assert_return (invoke "f32.convert_s_i32" (i32.const 16777219)) (f32.const 16777220.0)) -(assert_return (invoke "f32.convert_s_i32" (i32.const -16777219)) (f32.const -16777220.0)) +(assert_return (invoke "f32.convert_i32_s" (i32.const 16777217)) (f32.const 16777216.0)) +(assert_return (invoke "f32.convert_i32_s" (i32.const -16777217)) (f32.const -16777216.0)) +(assert_return (invoke "f32.convert_i32_s" (i32.const 16777219)) (f32.const 16777220.0)) +(assert_return (invoke "f32.convert_i32_s" (i32.const -16777219)) (f32.const -16777220.0)) -(assert_return (invoke "f32.convert_s_i64" (i64.const 1)) (f32.const 1.0)) -(assert_return (invoke "f32.convert_s_i64" (i64.const -1)) (f32.const -1.0)) -(assert_return (invoke "f32.convert_s_i64" (i64.const 0)) (f32.const 0.0)) -(assert_return (invoke "f32.convert_s_i64" (i64.const 9223372036854775807)) (f32.const 9223372036854775807)) -(assert_return (invoke "f32.convert_s_i64" (i64.const -9223372036854775808)) (f32.const -9223372036854775808)) -(assert_return (invoke "f32.convert_s_i64" (i64.const 314159265358979)) (f32.const 0x1.1db9e8p+48)) ;; PI +(assert_return (invoke "f32.convert_i64_s" (i64.const 1)) (f32.const 1.0)) +(assert_return (invoke "f32.convert_i64_s" (i64.const -1)) (f32.const -1.0)) +(assert_return (invoke "f32.convert_i64_s" (i64.const 0)) (f32.const 0.0)) +(assert_return (invoke "f32.convert_i64_s" (i64.const 9223372036854775807)) (f32.const 9223372036854775807)) +(assert_return (invoke "f32.convert_i64_s" (i64.const -9223372036854775808)) (f32.const -9223372036854775808)) +(assert_return (invoke "f32.convert_i64_s" (i64.const 314159265358979)) (f32.const 0x1.1db9e8p+48)) ;; PI ;; Test rounding directions. -(assert_return (invoke "f32.convert_s_i64" (i64.const 16777217)) (f32.const 16777216.0)) -(assert_return (invoke "f32.convert_s_i64" (i64.const -16777217)) (f32.const -16777216.0)) -(assert_return (invoke "f32.convert_s_i64" (i64.const 16777219)) (f32.const 16777220.0)) -(assert_return (invoke "f32.convert_s_i64" (i64.const -16777219)) (f32.const -16777220.0)) +(assert_return (invoke "f32.convert_i64_s" (i64.const 16777217)) (f32.const 16777216.0)) +(assert_return (invoke "f32.convert_i64_s" (i64.const -16777217)) (f32.const -16777216.0)) +(assert_return (invoke "f32.convert_i64_s" (i64.const 16777219)) (f32.const 16777220.0)) +(assert_return (invoke "f32.convert_i64_s" (i64.const -16777219)) (f32.const -16777220.0)) -(assert_return (invoke "f64.convert_s_i32" (i32.const 1)) (f64.const 1.0)) -(assert_return (invoke "f64.convert_s_i32" (i32.const -1)) (f64.const -1.0)) -(assert_return (invoke "f64.convert_s_i32" (i32.const 0)) (f64.const 0.0)) -(assert_return (invoke "f64.convert_s_i32" (i32.const 2147483647)) (f64.const 2147483647)) -(assert_return (invoke "f64.convert_s_i32" (i32.const -2147483648)) (f64.const -2147483648)) -(assert_return (invoke "f64.convert_s_i32" (i32.const 987654321)) (f64.const 987654321)) +(assert_return (invoke "f32.convert_i64_s" (i64.const 0x7fffff4000000001)) (f32.const 0x1.fffffep+62)) +(assert_return (invoke "f32.convert_i64_s" (i64.const 0x8000004000000001)) (f32.const -0x1.fffffep+62)) +(assert_return (invoke "f32.convert_i64_s" (i64.const 0x0020000020000001)) (f32.const 0x1.000002p+53)) +(assert_return (invoke "f32.convert_i64_s" (i64.const 0xffdfffffdfffffff)) (f32.const -0x1.000002p+53)) -(assert_return (invoke "f64.convert_s_i64" (i64.const 1)) (f64.const 1.0)) -(assert_return (invoke "f64.convert_s_i64" (i64.const -1)) (f64.const -1.0)) -(assert_return (invoke "f64.convert_s_i64" (i64.const 0)) (f64.const 0.0)) -(assert_return (invoke "f64.convert_s_i64" (i64.const 9223372036854775807)) (f64.const 9223372036854775807)) -(assert_return (invoke "f64.convert_s_i64" (i64.const -9223372036854775808)) (f64.const -9223372036854775808)) -(assert_return (invoke "f64.convert_s_i64" (i64.const 4669201609102990)) (f64.const 4669201609102990)) ;; Feigenbaum +(assert_return (invoke "f64.convert_i32_s" (i32.const 1)) (f64.const 1.0)) +(assert_return (invoke "f64.convert_i32_s" (i32.const -1)) (f64.const -1.0)) +(assert_return (invoke "f64.convert_i32_s" (i32.const 0)) (f64.const 0.0)) +(assert_return (invoke "f64.convert_i32_s" (i32.const 2147483647)) (f64.const 2147483647)) +(assert_return (invoke "f64.convert_i32_s" (i32.const -2147483648)) (f64.const -2147483648)) +(assert_return (invoke "f64.convert_i32_s" (i32.const 987654321)) (f64.const 987654321)) + +(assert_return (invoke "f64.convert_i64_s" (i64.const 1)) (f64.const 1.0)) +(assert_return (invoke "f64.convert_i64_s" (i64.const -1)) (f64.const -1.0)) +(assert_return (invoke "f64.convert_i64_s" (i64.const 0)) (f64.const 0.0)) +(assert_return (invoke "f64.convert_i64_s" (i64.const 9223372036854775807)) (f64.const 9223372036854775807)) +(assert_return (invoke "f64.convert_i64_s" (i64.const -9223372036854775808)) (f64.const -9223372036854775808)) +(assert_return (invoke "f64.convert_i64_s" (i64.const 4669201609102990)) (f64.const 4669201609102990)) ;; Feigenbaum ;; Test rounding directions. -(assert_return (invoke "f64.convert_s_i64" (i64.const 9007199254740993)) (f64.const 9007199254740992)) -(assert_return (invoke "f64.convert_s_i64" (i64.const -9007199254740993)) (f64.const -9007199254740992)) -(assert_return (invoke "f64.convert_s_i64" (i64.const 9007199254740995)) (f64.const 9007199254740996)) -(assert_return (invoke "f64.convert_s_i64" (i64.const -9007199254740995)) (f64.const -9007199254740996)) +(assert_return (invoke "f64.convert_i64_s" (i64.const 9007199254740993)) (f64.const 9007199254740992)) +(assert_return (invoke "f64.convert_i64_s" (i64.const -9007199254740993)) (f64.const -9007199254740992)) +(assert_return (invoke "f64.convert_i64_s" (i64.const 9007199254740995)) (f64.const 9007199254740996)) +(assert_return (invoke "f64.convert_i64_s" (i64.const -9007199254740995)) (f64.const -9007199254740996)) -(assert_return (invoke "f32.convert_u_i32" (i32.const 1)) (f32.const 1.0)) -(assert_return (invoke "f32.convert_u_i32" (i32.const 0)) (f32.const 0.0)) -(assert_return (invoke "f32.convert_u_i32" (i32.const 2147483647)) (f32.const 2147483648)) -(assert_return (invoke "f32.convert_u_i32" (i32.const -2147483648)) (f32.const 2147483648)) -(assert_return (invoke "f32.convert_u_i32" (i32.const 0x12345678)) (f32.const 0x1.234568p+28)) -(assert_return (invoke "f32.convert_u_i32" (i32.const 0xffffffff)) (f32.const 4294967296.0)) -(assert_return (invoke "f32.convert_u_i32" (i32.const 0x80000080)) (f32.const 0x1.000000p+31)) -(assert_return (invoke "f32.convert_u_i32" (i32.const 0x80000081)) (f32.const 0x1.000002p+31)) -(assert_return (invoke "f32.convert_u_i32" (i32.const 0x80000082)) (f32.const 0x1.000002p+31)) -(assert_return (invoke "f32.convert_u_i32" (i32.const 0xfffffe80)) (f32.const 0x1.fffffcp+31)) -(assert_return (invoke "f32.convert_u_i32" (i32.const 0xfffffe81)) (f32.const 0x1.fffffep+31)) -(assert_return (invoke "f32.convert_u_i32" (i32.const 0xfffffe82)) (f32.const 0x1.fffffep+31)) +(assert_return (invoke "f32.convert_i32_u" (i32.const 1)) (f32.const 1.0)) +(assert_return (invoke "f32.convert_i32_u" (i32.const 0)) (f32.const 0.0)) +(assert_return (invoke "f32.convert_i32_u" (i32.const 2147483647)) (f32.const 2147483648)) +(assert_return (invoke "f32.convert_i32_u" (i32.const -2147483648)) (f32.const 2147483648)) +(assert_return (invoke "f32.convert_i32_u" (i32.const 0x12345678)) (f32.const 0x1.234568p+28)) +(assert_return (invoke "f32.convert_i32_u" (i32.const 0xffffffff)) (f32.const 4294967296.0)) +(assert_return (invoke "f32.convert_i32_u" (i32.const 0x80000080)) (f32.const 0x1.000000p+31)) +(assert_return (invoke "f32.convert_i32_u" (i32.const 0x80000081)) (f32.const 0x1.000002p+31)) +(assert_return (invoke "f32.convert_i32_u" (i32.const 0x80000082)) (f32.const 0x1.000002p+31)) +(assert_return (invoke "f32.convert_i32_u" (i32.const 0xfffffe80)) (f32.const 0x1.fffffcp+31)) +(assert_return (invoke "f32.convert_i32_u" (i32.const 0xfffffe81)) (f32.const 0x1.fffffep+31)) +(assert_return (invoke "f32.convert_i32_u" (i32.const 0xfffffe82)) (f32.const 0x1.fffffep+31)) ;; Test rounding directions. -(assert_return (invoke "f32.convert_u_i32" (i32.const 16777217)) (f32.const 16777216.0)) -(assert_return (invoke "f32.convert_u_i32" (i32.const 16777219)) (f32.const 16777220.0)) +(assert_return (invoke "f32.convert_i32_u" (i32.const 16777217)) (f32.const 16777216.0)) +(assert_return (invoke "f32.convert_i32_u" (i32.const 16777219)) (f32.const 16777220.0)) -(assert_return (invoke "f32.convert_u_i64" (i64.const 1)) (f32.const 1.0)) -(assert_return (invoke "f32.convert_u_i64" (i64.const 0)) (f32.const 0.0)) -(assert_return (invoke "f32.convert_u_i64" (i64.const 9223372036854775807)) (f32.const 9223372036854775807)) -(assert_return (invoke "f32.convert_u_i64" (i64.const -9223372036854775808)) (f32.const 9223372036854775808)) -(assert_return (invoke "f32.convert_u_i64" (i64.const 0xffffffffffffffff)) (f32.const 18446744073709551616.0)) +(assert_return (invoke "f32.convert_i64_u" (i64.const 1)) (f32.const 1.0)) +(assert_return (invoke "f32.convert_i64_u" (i64.const 0)) (f32.const 0.0)) +(assert_return (invoke "f32.convert_i64_u" (i64.const 9223372036854775807)) (f32.const 9223372036854775807)) +(assert_return (invoke "f32.convert_i64_u" (i64.const -9223372036854775808)) (f32.const 9223372036854775808)) +(assert_return (invoke "f32.convert_i64_u" (i64.const 0xffffffffffffffff)) (f32.const 18446744073709551616.0)) ;; Test rounding directions. -(assert_return (invoke "f32.convert_u_i64" (i64.const 16777217)) (f32.const 16777216.0)) -(assert_return (invoke "f32.convert_u_i64" (i64.const 16777219)) (f32.const 16777220.0)) +(assert_return (invoke "f32.convert_i64_u" (i64.const 16777217)) (f32.const 16777216.0)) +(assert_return (invoke "f32.convert_i64_u" (i64.const 16777219)) (f32.const 16777220.0)) + +(assert_return (invoke "f32.convert_i64_u" (i64.const 0x0020000020000001)) (f32.const 0x1.000002p+53)) +(assert_return (invoke "f32.convert_i64_u" (i64.const 0x7fffffbfffffffff)) (f32.const 0x1.fffffep+62)) +(assert_return (invoke "f32.convert_i64_u" (i64.const 0x8000008000000001)) (f32.const 0x1.000002p+63)) +(assert_return (invoke "f32.convert_i64_u" (i64.const 0xfffffe8000000001)) (f32.const 0x1.fffffep+63)) -(assert_return (invoke "f64.convert_u_i32" (i32.const 1)) (f64.const 1.0)) -(assert_return (invoke "f64.convert_u_i32" (i32.const 0)) (f64.const 0.0)) -(assert_return (invoke "f64.convert_u_i32" (i32.const 2147483647)) (f64.const 2147483647)) -(assert_return (invoke "f64.convert_u_i32" (i32.const -2147483648)) (f64.const 2147483648)) -(assert_return (invoke "f64.convert_u_i32" (i32.const 0xffffffff)) (f64.const 4294967295.0)) +(assert_return (invoke "f64.convert_i32_u" (i32.const 1)) (f64.const 1.0)) +(assert_return (invoke "f64.convert_i32_u" (i32.const 0)) (f64.const 0.0)) +(assert_return (invoke "f64.convert_i32_u" (i32.const 2147483647)) (f64.const 2147483647)) +(assert_return (invoke "f64.convert_i32_u" (i32.const -2147483648)) (f64.const 2147483648)) +(assert_return (invoke "f64.convert_i32_u" (i32.const 0xffffffff)) (f64.const 4294967295.0)) -(assert_return (invoke "f64.convert_u_i64" (i64.const 1)) (f64.const 1.0)) -(assert_return (invoke "f64.convert_u_i64" (i64.const 0)) (f64.const 0.0)) -(assert_return (invoke "f64.convert_u_i64" (i64.const 9223372036854775807)) (f64.const 9223372036854775807)) -(assert_return (invoke "f64.convert_u_i64" (i64.const -9223372036854775808)) (f64.const 9223372036854775808)) -(assert_return (invoke "f64.convert_u_i64" (i64.const 0xffffffffffffffff)) (f64.const 18446744073709551616.0)) -(assert_return (invoke "f64.convert_u_i64" (i64.const 0x8000000000000400)) (f64.const 0x1.0000000000000p+63)) -(assert_return (invoke "f64.convert_u_i64" (i64.const 0x8000000000000401)) (f64.const 0x1.0000000000001p+63)) -(assert_return (invoke "f64.convert_u_i64" (i64.const 0x8000000000000402)) (f64.const 0x1.0000000000001p+63)) -(assert_return (invoke "f64.convert_u_i64" (i64.const 0xfffffffffffff400)) (f64.const 0x1.ffffffffffffep+63)) -(assert_return (invoke "f64.convert_u_i64" (i64.const 0xfffffffffffff401)) (f64.const 0x1.fffffffffffffp+63)) -(assert_return (invoke "f64.convert_u_i64" (i64.const 0xfffffffffffff402)) (f64.const 0x1.fffffffffffffp+63)) +(assert_return (invoke "f64.convert_i64_u" (i64.const 1)) (f64.const 1.0)) +(assert_return (invoke "f64.convert_i64_u" (i64.const 0)) (f64.const 0.0)) +(assert_return (invoke "f64.convert_i64_u" (i64.const 9223372036854775807)) (f64.const 9223372036854775807)) +(assert_return (invoke "f64.convert_i64_u" (i64.const -9223372036854775808)) (f64.const 9223372036854775808)) +(assert_return (invoke "f64.convert_i64_u" (i64.const 0xffffffffffffffff)) (f64.const 18446744073709551616.0)) +(assert_return (invoke "f64.convert_i64_u" (i64.const 0x8000000000000400)) (f64.const 0x1.0000000000000p+63)) +(assert_return (invoke "f64.convert_i64_u" (i64.const 0x8000000000000401)) (f64.const 0x1.0000000000001p+63)) +(assert_return (invoke "f64.convert_i64_u" (i64.const 0x8000000000000402)) (f64.const 0x1.0000000000001p+63)) +(assert_return (invoke "f64.convert_i64_u" (i64.const 0xfffffffffffff400)) (f64.const 0x1.ffffffffffffep+63)) +(assert_return (invoke "f64.convert_i64_u" (i64.const 0xfffffffffffff401)) (f64.const 0x1.fffffffffffffp+63)) +(assert_return (invoke "f64.convert_i64_u" (i64.const 0xfffffffffffff402)) (f64.const 0x1.fffffffffffffp+63)) ;; Test rounding directions. -(assert_return (invoke "f64.convert_u_i64" (i64.const 9007199254740993)) (f64.const 9007199254740992)) -(assert_return (invoke "f64.convert_u_i64" (i64.const 9007199254740995)) (f64.const 9007199254740996)) +(assert_return (invoke "f64.convert_i64_u" (i64.const 9007199254740993)) (f64.const 9007199254740992)) +(assert_return (invoke "f64.convert_i64_u" (i64.const 9007199254740995)) (f64.const 9007199254740996)) (assert_return (invoke "f64.promote_f32" (f32.const 0.0)) (f64.const 0.0)) (assert_return (invoke "f64.promote_f32" (f32.const -0.0)) (f64.const -0.0)) @@ -342,8 +352,8 @@ (assert_return (invoke "f64.promote_f32" (f32.const 0x1p-119)) (f64.const 0x1p-119)) ;; Generated randomly by picking a random float. (assert_return (invoke "f64.promote_f32" (f32.const 0x1.8f867ep+125)) (f64.const 6.6382536710104395e+37)) -(assert_return (invoke "f64.promote_f32" (f32.const infinity)) (f64.const infinity)) -(assert_return (invoke "f64.promote_f32" (f32.const -infinity)) (f64.const -infinity)) +(assert_return (invoke "f64.promote_f32" (f32.const inf)) (f64.const inf)) +(assert_return (invoke "f64.promote_f32" (f32.const -inf)) (f64.const -inf)) (assert_return_canonical_nan (invoke "f64.promote_f32" (f32.const nan))) (assert_return_arithmetic_nan (invoke "f64.promote_f32" (f32.const nan:0x200000))) (assert_return_canonical_nan (invoke "f64.promote_f32" (f32.const -nan))) @@ -369,12 +379,12 @@ (assert_return (invoke "f32.demote_f64" (f64.const -0x1.fffffep+127)) (f32.const -0x1.fffffep+127)) (assert_return (invoke "f32.demote_f64" (f64.const 0x1.fffffefffffffp+127)) (f32.const 0x1.fffffep+127)) (assert_return (invoke "f32.demote_f64" (f64.const -0x1.fffffefffffffp+127)) (f32.const -0x1.fffffep+127)) -(assert_return (invoke "f32.demote_f64" (f64.const 0x1.ffffffp+127)) (f32.const infinity)) -(assert_return (invoke "f32.demote_f64" (f64.const -0x1.ffffffp+127)) (f32.const -infinity)) +(assert_return (invoke "f32.demote_f64" (f64.const 0x1.ffffffp+127)) (f32.const inf)) +(assert_return (invoke "f32.demote_f64" (f64.const -0x1.ffffffp+127)) (f32.const -inf)) (assert_return (invoke "f32.demote_f64" (f64.const 0x1p-119)) (f32.const 0x1p-119)) (assert_return (invoke "f32.demote_f64" (f64.const 0x1.8f867ep+125)) (f32.const 0x1.8f867ep+125)) -(assert_return (invoke "f32.demote_f64" (f64.const infinity)) (f32.const infinity)) -(assert_return (invoke "f32.demote_f64" (f64.const -infinity)) (f32.const -infinity)) +(assert_return (invoke "f32.demote_f64" (f64.const inf)) (f32.const inf)) +(assert_return (invoke "f32.demote_f64" (f64.const -inf)) (f32.const -inf)) (assert_return (invoke "f32.demote_f64" (f64.const 0x1.0000000000001p+0)) (f32.const 1.0)) (assert_return (invoke "f32.demote_f64" (f64.const 0x1.fffffffffffffp-1)) (f32.const 1.0)) (assert_return (invoke "f32.demote_f64" (f64.const 0x1.0000010000000p+0)) (f32.const 0x1.000000p+0)) @@ -408,8 +418,8 @@ (assert_return (invoke "f32.reinterpret_i32" (i32.const -1)) (f32.const -nan:0x7fffff)) (assert_return (invoke "f32.reinterpret_i32" (i32.const 123456789)) (f32.const 0x1.b79a2ap-113)) (assert_return (invoke "f32.reinterpret_i32" (i32.const -2147483647)) (f32.const -0x1p-149)) -(assert_return (invoke "f32.reinterpret_i32" (i32.const 0x7f800000)) (f32.const infinity)) -(assert_return (invoke "f32.reinterpret_i32" (i32.const 0xff800000)) (f32.const -infinity)) +(assert_return (invoke "f32.reinterpret_i32" (i32.const 0x7f800000)) (f32.const inf)) +(assert_return (invoke "f32.reinterpret_i32" (i32.const 0xff800000)) (f32.const -inf)) (assert_return (invoke "f32.reinterpret_i32" (i32.const 0x7fc00000)) (f32.const nan)) (assert_return (invoke "f32.reinterpret_i32" (i32.const 0xffc00000)) (f32.const -nan)) (assert_return (invoke "f32.reinterpret_i32" (i32.const 0x7fa00000)) (f32.const nan:0x200000)) @@ -421,8 +431,8 @@ (assert_return (invoke "f64.reinterpret_i64" (i64.const 0x8000000000000000)) (f64.const -0.0)) (assert_return (invoke "f64.reinterpret_i64" (i64.const 1234567890)) (f64.const 0x0.00000499602d2p-1022)) (assert_return (invoke "f64.reinterpret_i64" (i64.const -9223372036854775807)) (f64.const -0x0.0000000000001p-1022)) -(assert_return (invoke "f64.reinterpret_i64" (i64.const 0x7ff0000000000000)) (f64.const infinity)) -(assert_return (invoke "f64.reinterpret_i64" (i64.const 0xfff0000000000000)) (f64.const -infinity)) +(assert_return (invoke "f64.reinterpret_i64" (i64.const 0x7ff0000000000000)) (f64.const inf)) +(assert_return (invoke "f64.reinterpret_i64" (i64.const 0xfff0000000000000)) (f64.const -inf)) (assert_return (invoke "f64.reinterpret_i64" (i64.const 0x7ff8000000000000)) (f64.const nan)) (assert_return (invoke "f64.reinterpret_i64" (i64.const 0xfff8000000000000)) (f64.const -nan)) (assert_return (invoke "f64.reinterpret_i64" (i64.const 0x7ff4000000000000)) (f64.const nan:0x4000000000000)) @@ -437,8 +447,8 @@ (assert_return (invoke "i32.reinterpret_f32" (f32.const 3.1415926)) (i32.const 1078530010)) (assert_return (invoke "i32.reinterpret_f32" (f32.const 0x1.fffffep+127)) (i32.const 2139095039)) (assert_return (invoke "i32.reinterpret_f32" (f32.const -0x1.fffffep+127)) (i32.const -8388609)) -(assert_return (invoke "i32.reinterpret_f32" (f32.const infinity)) (i32.const 0x7f800000)) -(assert_return (invoke "i32.reinterpret_f32" (f32.const -infinity)) (i32.const 0xff800000)) +(assert_return (invoke "i32.reinterpret_f32" (f32.const inf)) (i32.const 0x7f800000)) +(assert_return (invoke "i32.reinterpret_f32" (f32.const -inf)) (i32.const 0xff800000)) (assert_return (invoke "i32.reinterpret_f32" (f32.const nan)) (i32.const 0x7fc00000)) (assert_return (invoke "i32.reinterpret_f32" (f32.const -nan)) (i32.const 0xffc00000)) (assert_return (invoke "i32.reinterpret_f32" (f32.const nan:0x200000)) (i32.const 0x7fa00000)) @@ -453,9 +463,37 @@ (assert_return (invoke "i64.reinterpret_f64" (f64.const 3.14159265358979)) (i64.const 4614256656552045841)) (assert_return (invoke "i64.reinterpret_f64" (f64.const 0x1.fffffffffffffp+1023)) (i64.const 9218868437227405311)) (assert_return (invoke "i64.reinterpret_f64" (f64.const -0x1.fffffffffffffp+1023)) (i64.const -4503599627370497)) -(assert_return (invoke "i64.reinterpret_f64" (f64.const infinity)) (i64.const 0x7ff0000000000000)) -(assert_return (invoke "i64.reinterpret_f64" (f64.const -infinity)) (i64.const 0xfff0000000000000)) +(assert_return (invoke "i64.reinterpret_f64" (f64.const inf)) (i64.const 0x7ff0000000000000)) +(assert_return (invoke "i64.reinterpret_f64" (f64.const -inf)) (i64.const 0xfff0000000000000)) (assert_return (invoke "i64.reinterpret_f64" (f64.const nan)) (i64.const 0x7ff8000000000000)) (assert_return (invoke "i64.reinterpret_f64" (f64.const -nan)) (i64.const 0xfff8000000000000)) (assert_return (invoke "i64.reinterpret_f64" (f64.const nan:0x4000000000000)) (i64.const 0x7ff4000000000000)) (assert_return (invoke "i64.reinterpret_f64" (f64.const -nan:0x4000000000000)) (i64.const 0xfff4000000000000)) + +;; Type check + +(assert_invalid (module (func (result i32) (i32.wrap_i64 (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i32) (i32.trunc_f32_s (i64.const 0)))) "type mismatch") +(assert_invalid (module (func (result i32) (i32.trunc_f32_u (i64.const 0)))) "type mismatch") +(assert_invalid (module (func (result i32) (i32.trunc_f64_s (i64.const 0)))) "type mismatch") +(assert_invalid (module (func (result i32) (i32.trunc_f64_u (i64.const 0)))) "type mismatch") +(assert_invalid (module (func (result i32) (i32.reinterpret_f32 (i64.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.extend_i32_s (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.extend_i32_u (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.trunc_f32_s (i32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.trunc_f32_u (i32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.trunc_f64_s (i32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.trunc_f64_u (i32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.reinterpret_f64 (i32.const 0)))) "type mismatch") +(assert_invalid (module (func (result f32) (f32.convert_i32_s (i64.const 0)))) "type mismatch") +(assert_invalid (module (func (result f32) (f32.convert_i32_u (i64.const 0)))) "type mismatch") +(assert_invalid (module (func (result f32) (f32.convert_i64_s (i32.const 0)))) "type mismatch") +(assert_invalid (module (func (result f32) (f32.convert_i64_u (i32.const 0)))) "type mismatch") +(assert_invalid (module (func (result f32) (f32.demote_f64 (i32.const 0)))) "type mismatch") +(assert_invalid (module (func (result f32) (f32.reinterpret_i32 (i64.const 0)))) "type mismatch") +(assert_invalid (module (func (result f64) (f64.convert_i32_s (i64.const 0)))) "type mismatch") +(assert_invalid (module (func (result f64) (f64.convert_i32_u (i64.const 0)))) "type mismatch") +(assert_invalid (module (func (result f64) (f64.convert_i64_s (i32.const 0)))) "type mismatch") +(assert_invalid (module (func (result f64) (f64.convert_i64_u (i32.const 0)))) "type mismatch") +(assert_invalid (module (func (result f64) (f64.promote_f32 (i32.const 0)))) "type mismatch") +(assert_invalid (module (func (result f64) (f64.reinterpret_i64 (i32.const 0)))) "type mismatch") diff --git a/test/core/custom_section.wast b/test/core/custom.wast similarity index 80% rename from test/core/custom_section.wast rename to test/core/custom.wast index f087a9d2..fb04f2f6 100644 --- a/test/core/custom_section.wast +++ b/test/core/custom.wast @@ -1,4 +1,4 @@ -(module +(module binary "\00asm" "\01\00\00\00" "\00\24\10" "a custom section" "this is the payload" "\00\20\10" "a custom section" "this is payload" @@ -6,9 +6,12 @@ "\00\10\00" "" "this is payload" "\00\01\00" "" "" "\00\24\10" "\00\00custom sectio\00" "this is the payload" + "\00\24\10" "\ef\bb\bfa custom sect" "this is the payload" + "\00\24\10" "a custom sect\e2\8c\a3" "this is the payload" + "\00\1f\16" "module within a module" "\00asm" "\01\00\00\00" ) -(module +(module binary "\00asm" "\01\00\00\00" "\00\0e\06" "custom" "payload" "\00\0e\06" "custom" "payload" @@ -44,7 +47,7 @@ "\00\0e\06" "custom" "payload" ) -(module +(module binary "\00asm" "\01\00\00\00" "\01\07\01\60\02\7f\7f\01\7f" ;; type section "\00\1a\06" "custom" "this is the payload" ;; custom section @@ -55,7 +58,15 @@ ) (assert_malformed - (module + (module binary + "\00asm" "\01\00\00\00" + "\00" + ) + "unexpected end" +) + +(assert_malformed + (module binary "\00asm" "\01\00\00\00" "\00\00" ) @@ -63,7 +74,15 @@ ) (assert_malformed - (module + (module binary + "\00asm" "\01\00\00\00" + "\00\00\00\05\01\00\07\00\00" + ) + "unexpected end" +) + +(assert_malformed + (module binary "\00asm" "\01\00\00\00" "\00\26\10" "a custom section" "this is the payload" ) @@ -71,7 +90,7 @@ ) (assert_malformed - (module + (module binary "\00asm" "\01\00\00\00" "\00\25\10" "a custom section" "this is the payload" "\00\24\10" "a custom section" "this is the payload" @@ -80,7 +99,7 @@ ) (assert_malformed - (module + (module binary "\00asm" "\01\00\00\00" "\01\07\01\60\02\7f\7f\01\7f" ;; type section "\00\25\10" "a custom section" "this is the payload" ;; invalid length! @@ -90,3 +109,12 @@ ) "function and code section have inconsistent lengths" ) + +;; Test concatenated modules. +(assert_malformed + (module binary + "\00asm\01\00\00\00" + "\00asm\01\00\00\00" + ) + "length out of bounds" +) diff --git a/test/core/data.wast b/test/core/data.wast new file mode 100644 index 00000000..7d694541 --- /dev/null +++ b/test/core/data.wast @@ -0,0 +1,335 @@ +;; Test the data section + +;; Syntax + +(module + (memory $m 1) + (data (i32.const 0)) + (data (i32.const 1) "a" "" "bcd") + (data (offset (i32.const 0))) + (data (offset (i32.const 0)) "" "a" "bc" "") + (data 0 (i32.const 0)) + (data 0x0 (i32.const 1) "a" "" "bcd") + (data 0x000 (offset (i32.const 0))) + (data 0 (offset (i32.const 0)) "" "a" "bc" "") + (data $m (i32.const 0)) + (data $m (i32.const 1) "a" "" "bcd") + (data $m (offset (i32.const 0))) + (data $m (offset (i32.const 0)) "" "a" "bc" "") +) + +;; Basic use + +(module + (memory 1) + (data (i32.const 0) "a") +) +(module + (import "spectest" "memory" (memory 1)) + (data (i32.const 0) "a") +) + +(module + (memory 1) + (data (i32.const 0) "a") + (data (i32.const 3) "b") + (data (i32.const 100) "cde") + (data (i32.const 5) "x") + (data (i32.const 3) "c") +) +(module + (import "spectest" "memory" (memory 1)) + (data (i32.const 0) "a") + (data (i32.const 1) "b") + (data (i32.const 2) "cde") + (data (i32.const 3) "f") + (data (i32.const 2) "g") + (data (i32.const 1) "h") +) + +(module + (global (import "spectest" "global_i32") i32) + (memory 1) + (data (global.get 0) "a") +) +(module + (global (import "spectest" "global_i32") i32) + (import "spectest" "memory" (memory 1)) + (data (global.get 0) "a") +) + +(module + (global $g (import "spectest" "global_i32") i32) + (memory 1) + (data (global.get $g) "a") +) +(module + (global $g (import "spectest" "global_i32") i32) + (import "spectest" "memory" (memory 1)) + (data (global.get $g) "a") +) + +;; Use of internal globals in constant expressions is not allowed in MVP. +;; (module (memory 1) (data (global.get 0) "a") (global i32 (i32.const 0))) +;; (module (memory 1) (data (global.get $g) "a") (global $g i32 (i32.const 0))) + +;; Corner cases + +(module + (memory 1) + (data (i32.const 0) "a") + (data (i32.const 0xffff) "b") +) +(module + (import "spectest" "memory" (memory 1)) + (data (i32.const 0) "a") + (data (i32.const 0xffff) "b") +) + +(module + (memory 2) + (data (i32.const 0x1_ffff) "a") +) + +(module + (memory 0) + (data (i32.const 0)) +) +(module + (import "spectest" "memory" (memory 0)) + (data (i32.const 0)) +) + +(module + (memory 0 0) + (data (i32.const 0)) +) + +(module + (memory 1) + (data (i32.const 0x1_0000) "") +) + +(module + (memory 0) + (data (i32.const 0) "" "") +) +(module + (import "spectest" "memory" (memory 0)) + (data (i32.const 0) "" "") +) + +(module + (memory 0 0) + (data (i32.const 0) "" "") +) + +(module + (import "spectest" "memory" (memory 0)) + (data (i32.const 0) "a") +) + +(module + (import "spectest" "memory" (memory 0 3)) + (data (i32.const 0) "a") +) + +(module + (global (import "spectest" "global_i32") i32) + (import "spectest" "memory" (memory 0)) + (data (global.get 0) "a") +) + +(module + (global (import "spectest" "global_i32") i32) + (import "spectest" "memory" (memory 0 3)) + (data (global.get 0) "a") +) + +(module + (import "spectest" "memory" (memory 0)) + (data (i32.const 1) "a") +) + +(module + (import "spectest" "memory" (memory 0 3)) + (data (i32.const 1) "a") +) + +;; Invalid bounds for data + +(assert_unlinkable + (module + (memory 0) + (data (i32.const 0) "a") + ) + "data segment does not fit" +) + +(assert_unlinkable + (module + (memory 0 0) + (data (i32.const 0) "a") + ) + "data segment does not fit" +) + +(assert_unlinkable + (module + (memory 0 1) + (data (i32.const 0) "a") + ) + "data segment does not fit" +) + +(assert_unlinkable + (module + (memory 0) + (data (i32.const 1)) + ) + "data segment does not fit" +) + +(assert_unlinkable + (module + (memory 0 1) + (data (i32.const 1)) + ) + "data segment does not fit" +) + +;; This seems to cause a time-out on Travis. +(;assert_unlinkable + (module + (memory 0x10000) + (data (i32.const 0xffffffff) "ab") + ) + "" ;; either out of memory or segment does not fit +;) + +(assert_unlinkable + (module + (global (import "spectest" "global_i32") i32) + (memory 0) + (data (global.get 0) "a") + ) + "data segment does not fit" +) + +(assert_unlinkable + (module + (memory 1 2) + (data (i32.const 0x1_0000) "a") + ) + "data segment does not fit" +) +(assert_unlinkable + (module + (import "spectest" "memory" (memory 1)) + (data (i32.const 0x1_0000) "a") + ) + "data segment does not fit" +) + +(assert_unlinkable + (module + (memory 2) + (data (i32.const 0x2_0000) "a") + ) + "data segment does not fit" +) + +(assert_unlinkable + (module + (memory 2 3) + (data (i32.const 0x2_0000) "a") + ) + "data segment does not fit" +) + +(assert_unlinkable + (module + (memory 1) + (data (i32.const -1) "a") + ) + "data segment does not fit" +) +(assert_unlinkable + (module + (import "spectest" "memory" (memory 1)) + (data (i32.const -1) "a") + ) + "data segment does not fit" +) + +(assert_unlinkable + (module + (memory 2) + (data (i32.const -100) "a") + ) + "data segment does not fit" +) +(assert_unlinkable + (module + (import "spectest" "memory" (memory 1)) + (data (i32.const -100) "a") + ) + "data segment does not fit" +) + +;; Data without memory + +(assert_invalid + (module + (data (i32.const 0) "") + ) + "unknown memory" +) + +;; Invalid offsets + +(assert_invalid + (module + (memory 1) + (data (i64.const 0)) + ) + "type mismatch" +) + +(assert_invalid + (module + (memory 1) + (data (i32.ctz (i32.const 0))) + ) + "constant expression required" +) + +(assert_invalid + (module + (memory 1) + (data (nop)) + ) + "constant expression required" +) + +(assert_invalid + (module + (memory 1) + (data (offset (nop) (i32.const 0))) + ) + "constant expression required" +) + +(assert_invalid + (module + (memory 1) + (data (offset (i32.const 0) (nop))) + ) + "constant expression required" +) + +;; Use of internal globals in constant expressions is not allowed in MVP. +;; (assert_invalid +;; (module (memory 1) (data (global.get $g)) (global $g (mut i32) (i32.const 0))) +;; "constant expression required" +;; ) diff --git a/test/core/elem.wast b/test/core/elem.wast new file mode 100644 index 00000000..1ea2b061 --- /dev/null +++ b/test/core/elem.wast @@ -0,0 +1,381 @@ +;; Test the element section + +;; Syntax +(module + (table $t 10 funcref) + (func $f) + (elem (i32.const 0)) + (elem (i32.const 0) $f $f) + (elem (offset (i32.const 0))) + (elem (offset (i32.const 0)) $f $f) + (elem 0 (i32.const 0)) + (elem 0x0 (i32.const 0) $f $f) + (elem 0x000 (offset (i32.const 0))) + (elem 0 (offset (i32.const 0)) $f $f) + (elem $t (i32.const 0)) + (elem $t (i32.const 0) $f $f) + (elem $t (offset (i32.const 0))) + (elem $t (offset (i32.const 0)) $f $f) +) + +;; Basic use + +(module + (table 10 funcref) + (func $f) + (elem (i32.const 0) $f) +) +(module + (import "spectest" "table" (table 10 funcref)) + (func $f) + (elem (i32.const 0) $f) +) + +(module + (table 10 funcref) + (func $f) + (elem (i32.const 0) $f) + (elem (i32.const 3) $f) + (elem (i32.const 7) $f) + (elem (i32.const 5) $f) + (elem (i32.const 3) $f) +) +(module + (import "spectest" "table" (table 10 funcref)) + (func $f) + (elem (i32.const 9) $f) + (elem (i32.const 3) $f) + (elem (i32.const 7) $f) + (elem (i32.const 3) $f) + (elem (i32.const 5) $f) +) + +(module + (global (import "spectest" "global_i32") i32) + (table 1000 funcref) + (func $f) + (elem (global.get 0) $f) +) + +(module + (global $g (import "spectest" "global_i32") i32) + (table 1000 funcref) + (func $f) + (elem (global.get $g) $f) +) + +(module + (type $out-i32 (func (result i32))) + (table 10 funcref) + (elem (i32.const 7) $const-i32-a) + (elem (i32.const 9) $const-i32-b) + (func $const-i32-a (type $out-i32) (i32.const 65)) + (func $const-i32-b (type $out-i32) (i32.const 66)) + (func (export "call-7") (type $out-i32) + (call_indirect (type $out-i32) (i32.const 7)) + ) + (func (export "call-9") (type $out-i32) + (call_indirect (type $out-i32) (i32.const 9)) + ) +) +(assert_return (invoke "call-7") (i32.const 65)) +(assert_return (invoke "call-9") (i32.const 66)) + +;; Corner cases + +(module + (table 10 funcref) + (func $f) + (elem (i32.const 9) $f) +) +(module + (import "spectest" "table" (table 10 funcref)) + (func $f) + (elem (i32.const 9) $f) +) + +(module + (table 0 funcref) + (elem (i32.const 0)) +) +(module + (import "spectest" "table" (table 0 funcref)) + (elem (i32.const 0)) +) + +(module + (table 0 0 funcref) + (elem (i32.const 0)) +) + +(module + (table 20 funcref) + (elem (i32.const 20)) +) + +(module + (import "spectest" "table" (table 0 funcref)) + (func $f) + (elem (i32.const 0) $f) +) + +(module + (import "spectest" "table" (table 0 100 funcref)) + (func $f) + (elem (i32.const 0) $f) +) + +(module + (import "spectest" "table" (table 0 funcref)) + (func $f) + (elem (i32.const 1) $f) +) + +(module + (import "spectest" "table" (table 0 30 funcref)) + (func $f) + (elem (i32.const 1) $f) +) + +;; Invalid bounds for elements + +(assert_unlinkable + (module + (table 0 funcref) + (func $f) + (elem (i32.const 0) $f) + ) + "elements segment does not fit" +) + +(assert_unlinkable + (module + (table 0 0 funcref) + (func $f) + (elem (i32.const 0) $f) + ) + "elements segment does not fit" +) + +(assert_unlinkable + (module + (table 0 1 funcref) + (func $f) + (elem (i32.const 0) $f) + ) + "elements segment does not fit" +) + +(assert_unlinkable + (module + (table 0 funcref) + (elem (i32.const 1)) + ) + "elements segment does not fit" +) + +(assert_unlinkable + (module + (table 10 funcref) + (func $f) + (elem (i32.const 10) $f) + ) + "elements segment does not fit" +) +(assert_unlinkable + (module + (import "spectest" "table" (table 10 funcref)) + (func $f) + (elem (i32.const 10) $f) + ) + "elements segment does not fit" +) + +(assert_unlinkable + (module + (table 10 20 funcref) + (func $f) + (elem (i32.const 10) $f) + ) + "elements segment does not fit" +) +(assert_unlinkable + (module + (import "spectest" "table" (table 10 funcref)) + (func $f) + (elem (i32.const 10) $f) + ) + "elements segment does not fit" +) + +(assert_unlinkable + (module + (table 10 funcref) + (func $f) + (elem (i32.const -1) $f) + ) + "elements segment does not fit" +) +(assert_unlinkable + (module + (import "spectest" "table" (table 10 funcref)) + (func $f) + (elem (i32.const -1) $f) + ) + "elements segment does not fit" +) + +(assert_unlinkable + (module + (table 10 funcref) + (func $f) + (elem (i32.const -10) $f) + ) + "elements segment does not fit" +) +(assert_unlinkable + (module + (import "spectest" "table" (table 10 funcref)) + (func $f) + (elem (i32.const -10) $f) + ) + "elements segment does not fit" +) + +;; Element without table + +(assert_invalid + (module + (func $f) + (elem (i32.const 0) $f) + ) + "unknown table" +) + +;; Invalid offsets + +(assert_invalid + (module + (table 1 funcref) + (elem (i64.const 0)) + ) + "type mismatch" +) + +(assert_invalid + (module + (table 1 funcref) + (elem (i32.ctz (i32.const 0))) + ) + "constant expression required" +) + +(assert_invalid + (module + (table 1 funcref) + (elem (nop)) + ) + "constant expression required" +) + +(assert_invalid + (module + (table 1 funcref) + (elem (offset (nop) (i32.const 0))) + ) + "constant expression required" +) + +(assert_invalid + (module + (table 1 funcref) + (elem (offset (i32.const 0) (nop))) + ) + "constant expression required" +) + +;; Use of internal globals in constant expressions is not allowed in MVP. +;; (assert_invalid +;; (module (memory 1) (data (global.get $g)) (global $g (mut i32) (i32.const 0))) +;; "constant expression required" +;; ) + +;; Two elements target the same slot + +(module + (type $out-i32 (func (result i32))) + (table 10 funcref) + (elem (i32.const 9) $const-i32-a) + (elem (i32.const 9) $const-i32-b) + (func $const-i32-a (type $out-i32) (i32.const 65)) + (func $const-i32-b (type $out-i32) (i32.const 66)) + (func (export "call-overwritten") (type $out-i32) + (call_indirect (type $out-i32) (i32.const 9)) + ) +) +(assert_return (invoke "call-overwritten") (i32.const 66)) + +(module + (type $out-i32 (func (result i32))) + (import "spectest" "table" (table 10 funcref)) + (elem (i32.const 9) $const-i32-a) + (elem (i32.const 9) $const-i32-b) + (func $const-i32-a (type $out-i32) (i32.const 65)) + (func $const-i32-b (type $out-i32) (i32.const 66)) + (func (export "call-overwritten-element") (type $out-i32) + (call_indirect (type $out-i32) (i32.const 9)) + ) +) +(assert_return (invoke "call-overwritten-element") (i32.const 66)) + +;; Element sections across multiple modules change the same table + +(module $module1 + (type $out-i32 (func (result i32))) + (table (export "shared-table") 10 funcref) + (elem (i32.const 8) $const-i32-a) + (elem (i32.const 9) $const-i32-b) + (func $const-i32-a (type $out-i32) (i32.const 65)) + (func $const-i32-b (type $out-i32) (i32.const 66)) + (func (export "call-7") (type $out-i32) + (call_indirect (type $out-i32) (i32.const 7)) + ) + (func (export "call-8") (type $out-i32) + (call_indirect (type $out-i32) (i32.const 8)) + ) + (func (export "call-9") (type $out-i32) + (call_indirect (type $out-i32) (i32.const 9)) + ) +) + +(register "module1" $module1) + +(assert_trap (invoke $module1 "call-7") "uninitialized element") +(assert_return (invoke $module1 "call-8") (i32.const 65)) +(assert_return (invoke $module1 "call-9") (i32.const 66)) + +(module $module2 + (type $out-i32 (func (result i32))) + (import "module1" "shared-table" (table 10 funcref)) + (elem (i32.const 7) $const-i32-c) + (elem (i32.const 8) $const-i32-d) + (func $const-i32-c (type $out-i32) (i32.const 67)) + (func $const-i32-d (type $out-i32) (i32.const 68)) +) + +(assert_return (invoke $module1 "call-7") (i32.const 67)) +(assert_return (invoke $module1 "call-8") (i32.const 68)) +(assert_return (invoke $module1 "call-9") (i32.const 66)) + +(module $module3 + (type $out-i32 (func (result i32))) + (import "module1" "shared-table" (table 10 funcref)) + (elem (i32.const 8) $const-i32-e) + (elem (i32.const 9) $const-i32-f) + (func $const-i32-e (type $out-i32) (i32.const 69)) + (func $const-i32-f (type $out-i32) (i32.const 70)) +) + +(assert_return (invoke $module1 "call-7") (i32.const 67)) +(assert_return (invoke $module1 "call-8") (i32.const 69)) +(assert_return (invoke $module1 "call-9") (i32.const 70)) diff --git a/test/core/endianness.wast b/test/core/endianness.wast index 8dc0c2e2..4f28a168 100644 --- a/test/core/endianness.wast +++ b/test/core/endianness.wast @@ -3,130 +3,130 @@ ;; Stores an i16 value in little-endian-format (func $i16_store_little (param $address i32) (param $value i32) - (i32.store8 (get_local $address) (get_local $value)) - (i32.store8 (i32.add (get_local $address) (i32.const 1)) (i32.shr_u (get_local $value) (i32.const 8))) + (i32.store8 (local.get $address) (local.get $value)) + (i32.store8 (i32.add (local.get $address) (i32.const 1)) (i32.shr_u (local.get $value) (i32.const 8))) ) ;; Stores an i32 value in little-endian format (func $i32_store_little (param $address i32) (param $value i32) - (call $i16_store_little (get_local $address) (get_local $value)) - (call $i16_store_little (i32.add (get_local $address) (i32.const 2)) (i32.shr_u (get_local $value) (i32.const 16))) + (call $i16_store_little (local.get $address) (local.get $value)) + (call $i16_store_little (i32.add (local.get $address) (i32.const 2)) (i32.shr_u (local.get $value) (i32.const 16))) ) ;; Stores an i64 value in little-endian format (func $i64_store_little (param $address i32) (param $value i64) - (call $i32_store_little (get_local $address) (i32.wrap/i64 (get_local $value))) - (call $i32_store_little (i32.add (get_local $address) (i32.const 4)) (i32.wrap/i64 (i64.shr_u (get_local $value) (i64.const 32)))) + (call $i32_store_little (local.get $address) (i32.wrap_i64 (local.get $value))) + (call $i32_store_little (i32.add (local.get $address) (i32.const 4)) (i32.wrap_i64 (i64.shr_u (local.get $value) (i64.const 32)))) ) ;; Loads an i16 value in little-endian format (func $i16_load_little (param $address i32) (result i32) (i32.or - (i32.load8_u (get_local $address)) - (i32.shl (i32.load8_u (i32.add (get_local $address) (i32.const 1))) (i32.const 8)) + (i32.load8_u (local.get $address)) + (i32.shl (i32.load8_u (i32.add (local.get $address) (i32.const 1))) (i32.const 8)) ) ) ;; Loads an i32 value in little-endian format (func $i32_load_little (param $address i32) (result i32) (i32.or - (call $i16_load_little (get_local $address)) - (i32.shl (call $i16_load_little (i32.add (get_local $address) (i32.const 2))) (i32.const 16)) + (call $i16_load_little (local.get $address)) + (i32.shl (call $i16_load_little (i32.add (local.get $address) (i32.const 2))) (i32.const 16)) ) ) ;; Loads an i64 value in little-endian format (func $i64_load_little (param $address i32) (result i64) (i64.or - (i64.extend_u/i32 (call $i32_load_little (get_local $address))) - (i64.shl (i64.extend_u/i32 (call $i32_load_little (i32.add (get_local $address) (i32.const 4)))) (i64.const 32)) + (i64.extend_i32_u (call $i32_load_little (local.get $address))) + (i64.shl (i64.extend_i32_u (call $i32_load_little (i32.add (local.get $address) (i32.const 4)))) (i64.const 32)) ) ) (func (export "i32_load16_s") (param $value i32) (result i32) - (call $i16_store_little (i32.const 0) (get_local $value)) + (call $i16_store_little (i32.const 0) (local.get $value)) (i32.load16_s (i32.const 0)) ) (func (export "i32_load16_u") (param $value i32) (result i32) - (call $i16_store_little (i32.const 0) (get_local $value)) + (call $i16_store_little (i32.const 0) (local.get $value)) (i32.load16_u (i32.const 0)) ) (func (export "i32_load") (param $value i32) (result i32) - (call $i32_store_little (i32.const 0) (get_local $value)) + (call $i32_store_little (i32.const 0) (local.get $value)) (i32.load (i32.const 0)) ) (func (export "i64_load16_s") (param $value i64) (result i64) - (call $i16_store_little (i32.const 0) (i32.wrap/i64 (get_local $value))) + (call $i16_store_little (i32.const 0) (i32.wrap_i64 (local.get $value))) (i64.load16_s (i32.const 0)) ) (func (export "i64_load16_u") (param $value i64) (result i64) - (call $i16_store_little (i32.const 0) (i32.wrap/i64 (get_local $value))) + (call $i16_store_little (i32.const 0) (i32.wrap_i64 (local.get $value))) (i64.load16_u (i32.const 0)) ) (func (export "i64_load32_s") (param $value i64) (result i64) - (call $i32_store_little (i32.const 0) (i32.wrap/i64 (get_local $value))) + (call $i32_store_little (i32.const 0) (i32.wrap_i64 (local.get $value))) (i64.load32_s (i32.const 0)) ) (func (export "i64_load32_u") (param $value i64) (result i64) - (call $i32_store_little (i32.const 0) (i32.wrap/i64 (get_local $value))) + (call $i32_store_little (i32.const 0) (i32.wrap_i64 (local.get $value))) (i64.load32_u (i32.const 0)) ) (func (export "i64_load") (param $value i64) (result i64) - (call $i64_store_little (i32.const 0) (get_local $value)) + (call $i64_store_little (i32.const 0) (local.get $value)) (i64.load (i32.const 0)) ) (func (export "f32_load") (param $value f32) (result f32) - (call $i32_store_little (i32.const 0) (i32.reinterpret/f32 (get_local $value))) + (call $i32_store_little (i32.const 0) (i32.reinterpret_f32 (local.get $value))) (f32.load (i32.const 0)) ) (func (export "f64_load") (param $value f64) (result f64) - (call $i64_store_little (i32.const 0) (i64.reinterpret/f64 (get_local $value))) + (call $i64_store_little (i32.const 0) (i64.reinterpret_f64 (local.get $value))) (f64.load (i32.const 0)) ) (func (export "i32_store16") (param $value i32) (result i32) - (i32.store16 (i32.const 0) (get_local $value)) + (i32.store16 (i32.const 0) (local.get $value)) (call $i16_load_little (i32.const 0)) ) (func (export "i32_store") (param $value i32) (result i32) - (i32.store (i32.const 0) (get_local $value)) + (i32.store (i32.const 0) (local.get $value)) (call $i32_load_little (i32.const 0)) ) (func (export "i64_store16") (param $value i64) (result i64) - (i64.store16 (i32.const 0) (get_local $value)) - (i64.extend_u/i32 (call $i16_load_little (i32.const 0))) + (i64.store16 (i32.const 0) (local.get $value)) + (i64.extend_i32_u (call $i16_load_little (i32.const 0))) ) (func (export "i64_store32") (param $value i64) (result i64) - (i64.store32 (i32.const 0) (get_local $value)) - (i64.extend_u/i32 (call $i32_load_little (i32.const 0))) + (i64.store32 (i32.const 0) (local.get $value)) + (i64.extend_i32_u (call $i32_load_little (i32.const 0))) ) (func (export "i64_store") (param $value i64) (result i64) - (i64.store (i32.const 0) (get_local $value)) + (i64.store (i32.const 0) (local.get $value)) (call $i64_load_little (i32.const 0)) ) (func (export "f32_store") (param $value f32) (result f32) - (f32.store (i32.const 0) (get_local $value)) - (f32.reinterpret/i32 (call $i32_load_little (i32.const 0))) + (f32.store (i32.const 0) (local.get $value)) + (f32.reinterpret_i32 (call $i32_load_little (i32.const 0))) ) (func (export "f64_store") (param $value f64) (result f64) - (f64.store (i32.const 0) (get_local $value)) - (f64.reinterpret/i64 (call $i64_load_little (i32.const 0))) + (f64.store (i32.const 0) (local.get $value)) + (f64.reinterpret_i64 (call $i64_load_little (i32.const 0))) ) ) diff --git a/test/core/expected-output/address.wast.log b/test/core/expected-output/address.wast.log deleted file mode 100644 index c2e44336..00000000 --- a/test/core/expected-output/address.wast.log +++ /dev/null @@ -1,38 +0,0 @@ -97 : i32 -98 : i32 -99 : i32 -122 : i32 -25185 : i32 -25185 : i32 -25442 : i32 -25699 : i32 -122 : i32 -1684234849 : i32 -1701077858 : i32 -1717920867 : i32 -122 : i32 -0 : i32 -0 : i32 -0 : i32 -0 : i32 -0 : i32 -0 : i32 -0 : i32 -0 : i32 -0 : i32 -0 : i32 -0 : i32 -0 : i32 -0 : i32 -0 : i32 -0 : i32 -0 : i32 -0 : i32 -0 : i32 -0 : i32 -0 : i32 -0 : i32 -0 : i32 -0 : i32 -0 : i32 -0 : i32 diff --git a/test/core/expected-output/func_ptrs.wast.log b/test/core/expected-output/func_ptrs.wast.log deleted file mode 100644 index 8f757d3c..00000000 --- a/test/core/expected-output/func_ptrs.wast.log +++ /dev/null @@ -1 +0,0 @@ -83 : i32 diff --git a/test/core/expected-output/if-label-scope.fail.wast.log b/test/core/expected-output/if-label-scope.fail.wast.log deleted file mode 100644 index a3e1d79e..00000000 --- a/test/core/expected-output/if-label-scope.fail.wast.log +++ /dev/null @@ -1 +0,0 @@ -test/if-label-scope.fail.wast:1.26-1.28: syntax error: unknown label $l diff --git a/test/core/expected-output/imports.wast.log b/test/core/expected-output/imports.wast.log deleted file mode 100644 index d16cd93f..00000000 --- a/test/core/expected-output/imports.wast.log +++ /dev/null @@ -1,12 +0,0 @@ -13 : i32 -14 : i32 -42. : f32 -13 : i32 -13 : i32 -13. : f32 -13 : i32 -25. : f64 -53. : f64 -24. : f64 -24. : f64 -24. : f64 diff --git a/test/core/expected-output/names.wast.log b/test/core/expected-output/names.wast.log deleted file mode 100644 index b694f303..00000000 --- a/test/core/expected-output/names.wast.log +++ /dev/null @@ -1,2 +0,0 @@ -42 : i32 -123 : i32 diff --git a/test/core/expected-output/start.wast.log b/test/core/expected-output/start.wast.log deleted file mode 100644 index f74aa584..00000000 --- a/test/core/expected-output/start.wast.log +++ /dev/null @@ -1,2 +0,0 @@ -1 : i32 -2 : i32 diff --git a/test/core/exports.wast b/test/core/exports.wast index e3a0052a..a099172a 100644 --- a/test/core/exports.wast +++ b/test/core/exports.wast @@ -5,6 +5,8 @@ (module (func) (func) (export "a" (func 0)) (export "b" (func 1))) (module (func (export "a"))) +(module (func (export "a") (export "b") (export "c"))) +(module (func (export "a") (export "b") (param i32))) (module (func) (export "a" (func 0))) (module (func $a (export "a"))) (module (func $a) (export "a" (func $a))) @@ -14,7 +16,7 @@ (module $Func (export "e" (func $f)) (func $f (param $n i32) (result i32) - (return (i32.add (get_local $n) (i32.const 1))) + (return (i32.add (local.get $n) (i32.const 1))) ) ) (assert_return (invoke "e" (i32.const 42)) (i32.const 43)) @@ -40,7 +42,7 @@ "duplicate export name" ) (assert_invalid - (module (func) (table 0 anyfunc) (export "a" (func 0)) (export "a" (table 0))) + (module (func) (table 0 funcref) (export "a" (func 0)) (export "a" (table 0))) "duplicate export name" ) (assert_invalid @@ -89,7 +91,7 @@ "duplicate export name" ) (assert_invalid - (module (global i32 (i32.const 0)) (table 0 anyfunc) (export "a" (global 0)) (export "a" (table 0))) + (module (global i32 (i32.const 0)) (table 0 funcref) (export "a" (global 0)) (export "a" (table 0))) "duplicate export name" ) (assert_invalid @@ -100,49 +102,47 @@ ;; Tables -(module (table 0 anyfunc) (export "a" (table 0))) -(module (table 0 anyfunc) (export "a" (table 0)) (export "b" (table 0))) -;; No multiple tables yet. -;; (module (table 0 anyfunc) (table 0 anyfunc) (export "a" (table 0)) (export "b" (table 1))) - -(module (table (export "a") 0 anyfunc)) -(module (table (export "a") 0 1 anyfunc)) -(module (table 0 anyfunc) (export "a" (table 0))) -(module (table 0 1 anyfunc) (export "a" (table 0))) -(module (table $a (export "a") 0 anyfunc)) -(module (table $a (export "a") 0 1 anyfunc)) -(module (table $a 0 anyfunc) (export "a" (table $a))) -(module (table $a 0 1 anyfunc) (export "a" (table $a))) -(module (export "a" (table 0)) (table 0 anyfunc)) -(module (export "a" (table 0)) (table 0 1 anyfunc)) -(module (export "a" (table $a)) (table $a 0 anyfunc)) -(module (export "a" (table $a)) (table $a 0 1 anyfunc)) +(module (table 0 funcref) (export "a" (table 0))) +(module (table 0 funcref) (export "a" (table 0)) (export "b" (table 0))) +(module (table 0 funcref) (table 0 funcref) (export "a" (table 0)) (export "b" (table 1))) + +(module (table (export "a") 0 funcref)) +(module (table (export "a") 0 1 funcref)) +(module (table 0 funcref) (export "a" (table 0))) +(module (table 0 1 funcref) (export "a" (table 0))) +(module (table $a (export "a") 0 funcref)) +(module (table $a (export "a") 0 1 funcref)) +(module (table $a 0 funcref) (export "a" (table $a))) +(module (table $a 0 1 funcref) (export "a" (table $a))) +(module (export "a" (table 0)) (table 0 funcref)) +(module (export "a" (table 0)) (table 0 1 funcref)) +(module (export "a" (table $a)) (table $a 0 funcref)) +(module (export "a" (table $a)) (table $a 0 1 funcref)) (; TODO: access table ;) (assert_invalid - (module (table 0 anyfunc) (export "a" (table 1))) + (module (table 0 funcref) (export "a" (table 1))) "unknown table" ) (assert_invalid - (module (table 0 anyfunc) (export "a" (table 0)) (export "a" (table 0))) + (module (table 0 funcref) (export "a" (table 0)) (export "a" (table 0))) + "duplicate export name" +) +(assert_invalid + (module (table 0 funcref) (table 0 funcref) (export "a" (table 0)) (export "a" (table 1))) "duplicate export name" ) -;; No multiple tables yet. -;; (assert_invalid -;; (module (table 0 anyfunc) (table 0 anyfunc) (export "a" (table 0)) (export "a" (table 1))) -;; "duplicate export name" -;; ) (assert_invalid - (module (table 0 anyfunc) (func) (export "a" (table 0)) (export "a" (func 0))) + (module (table 0 funcref) (func) (export "a" (table 0)) (export "a" (func 0))) "duplicate export name" ) (assert_invalid - (module (table 0 anyfunc) (global i32 (i32.const 0)) (export "a" (table 0)) (export "a" (global 0))) + (module (table 0 funcref) (global i32 (i32.const 0)) (export "a" (table 0)) (export "a" (global 0))) "duplicate export name" ) (assert_invalid - (module (table 0 anyfunc) (memory 0) (export "a" (table 0)) (export "a" (memory 0))) + (module (table 0 funcref) (memory 0) (export "a" (table 0)) (export "a" (memory 0))) "duplicate export name" ) @@ -191,6 +191,6 @@ "duplicate export name" ) (assert_invalid - (module (memory 0) (table 0 anyfunc) (export "a" (memory 0)) (export "a" (table 0))) + (module (memory 0) (table 0 funcref) (export "a" (memory 0)) (export "a" (table 0))) "duplicate export name" ) diff --git a/test/core/f32.load32.fail.wast b/test/core/f32.load32.fail.wast deleted file mode 100644 index 31336453..00000000 --- a/test/core/f32.load32.fail.wast +++ /dev/null @@ -1 +0,0 @@ -(module (memory 1) (func (param i32) (result f32) (f32.load32 (get_local 0)))) diff --git a/test/core/f32.load64.fail.wast b/test/core/f32.load64.fail.wast deleted file mode 100644 index da94668f..00000000 --- a/test/core/f32.load64.fail.wast +++ /dev/null @@ -1 +0,0 @@ -(module (memory 1) (func (param i32) (result f32) (f32.load64 (get_local 0)))) diff --git a/test/core/f32.store32.fail.wast b/test/core/f32.store32.fail.wast deleted file mode 100644 index 3daf6eb3..00000000 --- a/test/core/f32.store32.fail.wast +++ /dev/null @@ -1 +0,0 @@ -(module (memory 1) (func (param i32) (param f32) (f32.store32 (get_local 0) (get_local 1)))) diff --git a/test/core/f32.store64.fail.wast b/test/core/f32.store64.fail.wast deleted file mode 100644 index b2c47bb9..00000000 --- a/test/core/f32.store64.fail.wast +++ /dev/null @@ -1 +0,0 @@ -(module (memory 1) (func (param i32) (param f64) (f32.store64 (get_local 0) (get_local 1)))) diff --git a/test/core/f32.wast b/test/core/f32.wast index 672eca76..4f0881c2 100644 --- a/test/core/f32.wast +++ b/test/core/f32.wast @@ -3,17 +3,17 @@ ;; f32_bitwise.wast and f32_cmp.wast). (module - (func (export "add") (param $x f32) (param $y f32) (result f32) (f32.add (get_local $x) (get_local $y))) - (func (export "sub") (param $x f32) (param $y f32) (result f32) (f32.sub (get_local $x) (get_local $y))) - (func (export "mul") (param $x f32) (param $y f32) (result f32) (f32.mul (get_local $x) (get_local $y))) - (func (export "div") (param $x f32) (param $y f32) (result f32) (f32.div (get_local $x) (get_local $y))) - (func (export "sqrt") (param $x f32) (result f32) (f32.sqrt (get_local $x))) - (func (export "min") (param $x f32) (param $y f32) (result f32) (f32.min (get_local $x) (get_local $y))) - (func (export "max") (param $x f32) (param $y f32) (result f32) (f32.max (get_local $x) (get_local $y))) - (func (export "ceil") (param $x f32) (result f32) (f32.ceil (get_local $x))) - (func (export "floor") (param $x f32) (result f32) (f32.floor (get_local $x))) - (func (export "trunc") (param $x f32) (result f32) (f32.trunc (get_local $x))) - (func (export "nearest") (param $x f32) (result f32) (f32.nearest (get_local $x))) + (func (export "add") (param $x f32) (param $y f32) (result f32) (f32.add (local.get $x) (local.get $y))) + (func (export "sub") (param $x f32) (param $y f32) (result f32) (f32.sub (local.get $x) (local.get $y))) + (func (export "mul") (param $x f32) (param $y f32) (result f32) (f32.mul (local.get $x) (local.get $y))) + (func (export "div") (param $x f32) (param $y f32) (result f32) (f32.div (local.get $x) (local.get $y))) + (func (export "sqrt") (param $x f32) (result f32) (f32.sqrt (local.get $x))) + (func (export "min") (param $x f32) (param $y f32) (result f32) (f32.min (local.get $x) (local.get $y))) + (func (export "max") (param $x f32) (param $y f32) (result f32) (f32.max (local.get $x) (local.get $y))) + (func (export "ceil") (param $x f32) (result f32) (f32.ceil (local.get $x))) + (func (export "floor") (param $x f32) (result f32) (f32.floor (local.get $x))) + (func (export "trunc") (param $x f32) (result f32) (f32.trunc (local.get $x))) + (func (export "nearest") (param $x f32) (result f32) (f32.nearest (local.get $x))) ) (assert_return (invoke "add" (f32.const -0x0p+0) (f32.const -0x0p+0)) (f32.const -0x0p+0)) @@ -44,10 +44,10 @@ (assert_return (invoke "add" (f32.const -0x0p+0) (f32.const 0x1.fffffep+127)) (f32.const 0x1.fffffep+127)) (assert_return (invoke "add" (f32.const 0x0p+0) (f32.const -0x1.fffffep+127)) (f32.const -0x1.fffffep+127)) (assert_return (invoke "add" (f32.const 0x0p+0) (f32.const 0x1.fffffep+127)) (f32.const 0x1.fffffep+127)) -(assert_return (invoke "add" (f32.const -0x0p+0) (f32.const -infinity)) (f32.const -infinity)) -(assert_return (invoke "add" (f32.const -0x0p+0) (f32.const infinity)) (f32.const infinity)) -(assert_return (invoke "add" (f32.const 0x0p+0) (f32.const -infinity)) (f32.const -infinity)) -(assert_return (invoke "add" (f32.const 0x0p+0) (f32.const infinity)) (f32.const infinity)) +(assert_return (invoke "add" (f32.const -0x0p+0) (f32.const -inf)) (f32.const -inf)) +(assert_return (invoke "add" (f32.const -0x0p+0) (f32.const inf)) (f32.const inf)) +(assert_return (invoke "add" (f32.const 0x0p+0) (f32.const -inf)) (f32.const -inf)) +(assert_return (invoke "add" (f32.const 0x0p+0) (f32.const inf)) (f32.const inf)) (assert_return_canonical_nan (invoke "add" (f32.const -0x0p+0) (f32.const -nan))) (assert_return_arithmetic_nan (invoke "add" (f32.const -0x0p+0) (f32.const -nan:0x200000))) (assert_return_canonical_nan (invoke "add" (f32.const -0x0p+0) (f32.const nan))) @@ -84,10 +84,10 @@ (assert_return (invoke "add" (f32.const -0x1p-149) (f32.const 0x1.fffffep+127)) (f32.const 0x1.fffffep+127)) (assert_return (invoke "add" (f32.const 0x1p-149) (f32.const -0x1.fffffep+127)) (f32.const -0x1.fffffep+127)) (assert_return (invoke "add" (f32.const 0x1p-149) (f32.const 0x1.fffffep+127)) (f32.const 0x1.fffffep+127)) -(assert_return (invoke "add" (f32.const -0x1p-149) (f32.const -infinity)) (f32.const -infinity)) -(assert_return (invoke "add" (f32.const -0x1p-149) (f32.const infinity)) (f32.const infinity)) -(assert_return (invoke "add" (f32.const 0x1p-149) (f32.const -infinity)) (f32.const -infinity)) -(assert_return (invoke "add" (f32.const 0x1p-149) (f32.const infinity)) (f32.const infinity)) +(assert_return (invoke "add" (f32.const -0x1p-149) (f32.const -inf)) (f32.const -inf)) +(assert_return (invoke "add" (f32.const -0x1p-149) (f32.const inf)) (f32.const inf)) +(assert_return (invoke "add" (f32.const 0x1p-149) (f32.const -inf)) (f32.const -inf)) +(assert_return (invoke "add" (f32.const 0x1p-149) (f32.const inf)) (f32.const inf)) (assert_return_canonical_nan (invoke "add" (f32.const -0x1p-149) (f32.const -nan))) (assert_return_arithmetic_nan (invoke "add" (f32.const -0x1p-149) (f32.const -nan:0x200000))) (assert_return_canonical_nan (invoke "add" (f32.const -0x1p-149) (f32.const nan))) @@ -124,10 +124,10 @@ (assert_return (invoke "add" (f32.const -0x1p-126) (f32.const 0x1.fffffep+127)) (f32.const 0x1.fffffep+127)) (assert_return (invoke "add" (f32.const 0x1p-126) (f32.const -0x1.fffffep+127)) (f32.const -0x1.fffffep+127)) (assert_return (invoke "add" (f32.const 0x1p-126) (f32.const 0x1.fffffep+127)) (f32.const 0x1.fffffep+127)) -(assert_return (invoke "add" (f32.const -0x1p-126) (f32.const -infinity)) (f32.const -infinity)) -(assert_return (invoke "add" (f32.const -0x1p-126) (f32.const infinity)) (f32.const infinity)) -(assert_return (invoke "add" (f32.const 0x1p-126) (f32.const -infinity)) (f32.const -infinity)) -(assert_return (invoke "add" (f32.const 0x1p-126) (f32.const infinity)) (f32.const infinity)) +(assert_return (invoke "add" (f32.const -0x1p-126) (f32.const -inf)) (f32.const -inf)) +(assert_return (invoke "add" (f32.const -0x1p-126) (f32.const inf)) (f32.const inf)) +(assert_return (invoke "add" (f32.const 0x1p-126) (f32.const -inf)) (f32.const -inf)) +(assert_return (invoke "add" (f32.const 0x1p-126) (f32.const inf)) (f32.const inf)) (assert_return_canonical_nan (invoke "add" (f32.const -0x1p-126) (f32.const -nan))) (assert_return_arithmetic_nan (invoke "add" (f32.const -0x1p-126) (f32.const -nan:0x200000))) (assert_return_canonical_nan (invoke "add" (f32.const -0x1p-126) (f32.const nan))) @@ -164,10 +164,10 @@ (assert_return (invoke "add" (f32.const -0x1p-1) (f32.const 0x1.fffffep+127)) (f32.const 0x1.fffffep+127)) (assert_return (invoke "add" (f32.const 0x1p-1) (f32.const -0x1.fffffep+127)) (f32.const -0x1.fffffep+127)) (assert_return (invoke "add" (f32.const 0x1p-1) (f32.const 0x1.fffffep+127)) (f32.const 0x1.fffffep+127)) -(assert_return (invoke "add" (f32.const -0x1p-1) (f32.const -infinity)) (f32.const -infinity)) -(assert_return (invoke "add" (f32.const -0x1p-1) (f32.const infinity)) (f32.const infinity)) -(assert_return (invoke "add" (f32.const 0x1p-1) (f32.const -infinity)) (f32.const -infinity)) -(assert_return (invoke "add" (f32.const 0x1p-1) (f32.const infinity)) (f32.const infinity)) +(assert_return (invoke "add" (f32.const -0x1p-1) (f32.const -inf)) (f32.const -inf)) +(assert_return (invoke "add" (f32.const -0x1p-1) (f32.const inf)) (f32.const inf)) +(assert_return (invoke "add" (f32.const 0x1p-1) (f32.const -inf)) (f32.const -inf)) +(assert_return (invoke "add" (f32.const 0x1p-1) (f32.const inf)) (f32.const inf)) (assert_return_canonical_nan (invoke "add" (f32.const -0x1p-1) (f32.const -nan))) (assert_return_arithmetic_nan (invoke "add" (f32.const -0x1p-1) (f32.const -nan:0x200000))) (assert_return_canonical_nan (invoke "add" (f32.const -0x1p-1) (f32.const nan))) @@ -204,10 +204,10 @@ (assert_return (invoke "add" (f32.const -0x1p+0) (f32.const 0x1.fffffep+127)) (f32.const 0x1.fffffep+127)) (assert_return (invoke "add" (f32.const 0x1p+0) (f32.const -0x1.fffffep+127)) (f32.const -0x1.fffffep+127)) (assert_return (invoke "add" (f32.const 0x1p+0) (f32.const 0x1.fffffep+127)) (f32.const 0x1.fffffep+127)) -(assert_return (invoke "add" (f32.const -0x1p+0) (f32.const -infinity)) (f32.const -infinity)) -(assert_return (invoke "add" (f32.const -0x1p+0) (f32.const infinity)) (f32.const infinity)) -(assert_return (invoke "add" (f32.const 0x1p+0) (f32.const -infinity)) (f32.const -infinity)) -(assert_return (invoke "add" (f32.const 0x1p+0) (f32.const infinity)) (f32.const infinity)) +(assert_return (invoke "add" (f32.const -0x1p+0) (f32.const -inf)) (f32.const -inf)) +(assert_return (invoke "add" (f32.const -0x1p+0) (f32.const inf)) (f32.const inf)) +(assert_return (invoke "add" (f32.const 0x1p+0) (f32.const -inf)) (f32.const -inf)) +(assert_return (invoke "add" (f32.const 0x1p+0) (f32.const inf)) (f32.const inf)) (assert_return_canonical_nan (invoke "add" (f32.const -0x1p+0) (f32.const -nan))) (assert_return_arithmetic_nan (invoke "add" (f32.const -0x1p+0) (f32.const -nan:0x200000))) (assert_return_canonical_nan (invoke "add" (f32.const -0x1p+0) (f32.const nan))) @@ -244,10 +244,10 @@ (assert_return (invoke "add" (f32.const -0x1.921fb6p+2) (f32.const 0x1.fffffep+127)) (f32.const 0x1.fffffep+127)) (assert_return (invoke "add" (f32.const 0x1.921fb6p+2) (f32.const -0x1.fffffep+127)) (f32.const -0x1.fffffep+127)) (assert_return (invoke "add" (f32.const 0x1.921fb6p+2) (f32.const 0x1.fffffep+127)) (f32.const 0x1.fffffep+127)) -(assert_return (invoke "add" (f32.const -0x1.921fb6p+2) (f32.const -infinity)) (f32.const -infinity)) -(assert_return (invoke "add" (f32.const -0x1.921fb6p+2) (f32.const infinity)) (f32.const infinity)) -(assert_return (invoke "add" (f32.const 0x1.921fb6p+2) (f32.const -infinity)) (f32.const -infinity)) -(assert_return (invoke "add" (f32.const 0x1.921fb6p+2) (f32.const infinity)) (f32.const infinity)) +(assert_return (invoke "add" (f32.const -0x1.921fb6p+2) (f32.const -inf)) (f32.const -inf)) +(assert_return (invoke "add" (f32.const -0x1.921fb6p+2) (f32.const inf)) (f32.const inf)) +(assert_return (invoke "add" (f32.const 0x1.921fb6p+2) (f32.const -inf)) (f32.const -inf)) +(assert_return (invoke "add" (f32.const 0x1.921fb6p+2) (f32.const inf)) (f32.const inf)) (assert_return_canonical_nan (invoke "add" (f32.const -0x1.921fb6p+2) (f32.const -nan))) (assert_return_arithmetic_nan (invoke "add" (f32.const -0x1.921fb6p+2) (f32.const -nan:0x200000))) (assert_return_canonical_nan (invoke "add" (f32.const -0x1.921fb6p+2) (f32.const nan))) @@ -280,14 +280,14 @@ (assert_return (invoke "add" (f32.const -0x1.fffffep+127) (f32.const 0x1.921fb6p+2)) (f32.const -0x1.fffffep+127)) (assert_return (invoke "add" (f32.const 0x1.fffffep+127) (f32.const -0x1.921fb6p+2)) (f32.const 0x1.fffffep+127)) (assert_return (invoke "add" (f32.const 0x1.fffffep+127) (f32.const 0x1.921fb6p+2)) (f32.const 0x1.fffffep+127)) -(assert_return (invoke "add" (f32.const -0x1.fffffep+127) (f32.const -0x1.fffffep+127)) (f32.const -infinity)) +(assert_return (invoke "add" (f32.const -0x1.fffffep+127) (f32.const -0x1.fffffep+127)) (f32.const -inf)) (assert_return (invoke "add" (f32.const -0x1.fffffep+127) (f32.const 0x1.fffffep+127)) (f32.const 0x0p+0)) (assert_return (invoke "add" (f32.const 0x1.fffffep+127) (f32.const -0x1.fffffep+127)) (f32.const 0x0p+0)) -(assert_return (invoke "add" (f32.const 0x1.fffffep+127) (f32.const 0x1.fffffep+127)) (f32.const infinity)) -(assert_return (invoke "add" (f32.const -0x1.fffffep+127) (f32.const -infinity)) (f32.const -infinity)) -(assert_return (invoke "add" (f32.const -0x1.fffffep+127) (f32.const infinity)) (f32.const infinity)) -(assert_return (invoke "add" (f32.const 0x1.fffffep+127) (f32.const -infinity)) (f32.const -infinity)) -(assert_return (invoke "add" (f32.const 0x1.fffffep+127) (f32.const infinity)) (f32.const infinity)) +(assert_return (invoke "add" (f32.const 0x1.fffffep+127) (f32.const 0x1.fffffep+127)) (f32.const inf)) +(assert_return (invoke "add" (f32.const -0x1.fffffep+127) (f32.const -inf)) (f32.const -inf)) +(assert_return (invoke "add" (f32.const -0x1.fffffep+127) (f32.const inf)) (f32.const inf)) +(assert_return (invoke "add" (f32.const 0x1.fffffep+127) (f32.const -inf)) (f32.const -inf)) +(assert_return (invoke "add" (f32.const 0x1.fffffep+127) (f32.const inf)) (f32.const inf)) (assert_return_canonical_nan (invoke "add" (f32.const -0x1.fffffep+127) (f32.const -nan))) (assert_return_arithmetic_nan (invoke "add" (f32.const -0x1.fffffep+127) (f32.const -nan:0x200000))) (assert_return_canonical_nan (invoke "add" (f32.const -0x1.fffffep+127) (f32.const nan))) @@ -296,46 +296,46 @@ (assert_return_arithmetic_nan (invoke "add" (f32.const 0x1.fffffep+127) (f32.const -nan:0x200000))) (assert_return_canonical_nan (invoke "add" (f32.const 0x1.fffffep+127) (f32.const nan))) (assert_return_arithmetic_nan (invoke "add" (f32.const 0x1.fffffep+127) (f32.const nan:0x200000))) -(assert_return (invoke "add" (f32.const -infinity) (f32.const -0x0p+0)) (f32.const -infinity)) -(assert_return (invoke "add" (f32.const -infinity) (f32.const 0x0p+0)) (f32.const -infinity)) -(assert_return (invoke "add" (f32.const infinity) (f32.const -0x0p+0)) (f32.const infinity)) -(assert_return (invoke "add" (f32.const infinity) (f32.const 0x0p+0)) (f32.const infinity)) -(assert_return (invoke "add" (f32.const -infinity) (f32.const -0x1p-149)) (f32.const -infinity)) -(assert_return (invoke "add" (f32.const -infinity) (f32.const 0x1p-149)) (f32.const -infinity)) -(assert_return (invoke "add" (f32.const infinity) (f32.const -0x1p-149)) (f32.const infinity)) -(assert_return (invoke "add" (f32.const infinity) (f32.const 0x1p-149)) (f32.const infinity)) -(assert_return (invoke "add" (f32.const -infinity) (f32.const -0x1p-126)) (f32.const -infinity)) -(assert_return (invoke "add" (f32.const -infinity) (f32.const 0x1p-126)) (f32.const -infinity)) -(assert_return (invoke "add" (f32.const infinity) (f32.const -0x1p-126)) (f32.const infinity)) -(assert_return (invoke "add" (f32.const infinity) (f32.const 0x1p-126)) (f32.const infinity)) -(assert_return (invoke "add" (f32.const -infinity) (f32.const -0x1p-1)) (f32.const -infinity)) -(assert_return (invoke "add" (f32.const -infinity) (f32.const 0x1p-1)) (f32.const -infinity)) -(assert_return (invoke "add" (f32.const infinity) (f32.const -0x1p-1)) (f32.const infinity)) -(assert_return (invoke "add" (f32.const infinity) (f32.const 0x1p-1)) (f32.const infinity)) -(assert_return (invoke "add" (f32.const -infinity) (f32.const -0x1p+0)) (f32.const -infinity)) -(assert_return (invoke "add" (f32.const -infinity) (f32.const 0x1p+0)) (f32.const -infinity)) -(assert_return (invoke "add" (f32.const infinity) (f32.const -0x1p+0)) (f32.const infinity)) -(assert_return (invoke "add" (f32.const infinity) (f32.const 0x1p+0)) (f32.const infinity)) -(assert_return (invoke "add" (f32.const -infinity) (f32.const -0x1.921fb6p+2)) (f32.const -infinity)) -(assert_return (invoke "add" (f32.const -infinity) (f32.const 0x1.921fb6p+2)) (f32.const -infinity)) -(assert_return (invoke "add" (f32.const infinity) (f32.const -0x1.921fb6p+2)) (f32.const infinity)) -(assert_return (invoke "add" (f32.const infinity) (f32.const 0x1.921fb6p+2)) (f32.const infinity)) -(assert_return (invoke "add" (f32.const -infinity) (f32.const -0x1.fffffep+127)) (f32.const -infinity)) -(assert_return (invoke "add" (f32.const -infinity) (f32.const 0x1.fffffep+127)) (f32.const -infinity)) -(assert_return (invoke "add" (f32.const infinity) (f32.const -0x1.fffffep+127)) (f32.const infinity)) -(assert_return (invoke "add" (f32.const infinity) (f32.const 0x1.fffffep+127)) (f32.const infinity)) -(assert_return (invoke "add" (f32.const -infinity) (f32.const -infinity)) (f32.const -infinity)) -(assert_return_canonical_nan (invoke "add" (f32.const -infinity) (f32.const infinity))) -(assert_return_canonical_nan (invoke "add" (f32.const infinity) (f32.const -infinity))) -(assert_return (invoke "add" (f32.const infinity) (f32.const infinity)) (f32.const infinity)) -(assert_return_canonical_nan (invoke "add" (f32.const -infinity) (f32.const -nan))) -(assert_return_arithmetic_nan (invoke "add" (f32.const -infinity) (f32.const -nan:0x200000))) -(assert_return_canonical_nan (invoke "add" (f32.const -infinity) (f32.const nan))) -(assert_return_arithmetic_nan (invoke "add" (f32.const -infinity) (f32.const nan:0x200000))) -(assert_return_canonical_nan (invoke "add" (f32.const infinity) (f32.const -nan))) -(assert_return_arithmetic_nan (invoke "add" (f32.const infinity) (f32.const -nan:0x200000))) -(assert_return_canonical_nan (invoke "add" (f32.const infinity) (f32.const nan))) -(assert_return_arithmetic_nan (invoke "add" (f32.const infinity) (f32.const nan:0x200000))) +(assert_return (invoke "add" (f32.const -inf) (f32.const -0x0p+0)) (f32.const -inf)) +(assert_return (invoke "add" (f32.const -inf) (f32.const 0x0p+0)) (f32.const -inf)) +(assert_return (invoke "add" (f32.const inf) (f32.const -0x0p+0)) (f32.const inf)) +(assert_return (invoke "add" (f32.const inf) (f32.const 0x0p+0)) (f32.const inf)) +(assert_return (invoke "add" (f32.const -inf) (f32.const -0x1p-149)) (f32.const -inf)) +(assert_return (invoke "add" (f32.const -inf) (f32.const 0x1p-149)) (f32.const -inf)) +(assert_return (invoke "add" (f32.const inf) (f32.const -0x1p-149)) (f32.const inf)) +(assert_return (invoke "add" (f32.const inf) (f32.const 0x1p-149)) (f32.const inf)) +(assert_return (invoke "add" (f32.const -inf) (f32.const -0x1p-126)) (f32.const -inf)) +(assert_return (invoke "add" (f32.const -inf) (f32.const 0x1p-126)) (f32.const -inf)) +(assert_return (invoke "add" (f32.const inf) (f32.const -0x1p-126)) (f32.const inf)) +(assert_return (invoke "add" (f32.const inf) (f32.const 0x1p-126)) (f32.const inf)) +(assert_return (invoke "add" (f32.const -inf) (f32.const -0x1p-1)) (f32.const -inf)) +(assert_return (invoke "add" (f32.const -inf) (f32.const 0x1p-1)) (f32.const -inf)) +(assert_return (invoke "add" (f32.const inf) (f32.const -0x1p-1)) (f32.const inf)) +(assert_return (invoke "add" (f32.const inf) (f32.const 0x1p-1)) (f32.const inf)) +(assert_return (invoke "add" (f32.const -inf) (f32.const -0x1p+0)) (f32.const -inf)) +(assert_return (invoke "add" (f32.const -inf) (f32.const 0x1p+0)) (f32.const -inf)) +(assert_return (invoke "add" (f32.const inf) (f32.const -0x1p+0)) (f32.const inf)) +(assert_return (invoke "add" (f32.const inf) (f32.const 0x1p+0)) (f32.const inf)) +(assert_return (invoke "add" (f32.const -inf) (f32.const -0x1.921fb6p+2)) (f32.const -inf)) +(assert_return (invoke "add" (f32.const -inf) (f32.const 0x1.921fb6p+2)) (f32.const -inf)) +(assert_return (invoke "add" (f32.const inf) (f32.const -0x1.921fb6p+2)) (f32.const inf)) +(assert_return (invoke "add" (f32.const inf) (f32.const 0x1.921fb6p+2)) (f32.const inf)) +(assert_return (invoke "add" (f32.const -inf) (f32.const -0x1.fffffep+127)) (f32.const -inf)) +(assert_return (invoke "add" (f32.const -inf) (f32.const 0x1.fffffep+127)) (f32.const -inf)) +(assert_return (invoke "add" (f32.const inf) (f32.const -0x1.fffffep+127)) (f32.const inf)) +(assert_return (invoke "add" (f32.const inf) (f32.const 0x1.fffffep+127)) (f32.const inf)) +(assert_return (invoke "add" (f32.const -inf) (f32.const -inf)) (f32.const -inf)) +(assert_return_canonical_nan (invoke "add" (f32.const -inf) (f32.const inf))) +(assert_return_canonical_nan (invoke "add" (f32.const inf) (f32.const -inf))) +(assert_return (invoke "add" (f32.const inf) (f32.const inf)) (f32.const inf)) +(assert_return_canonical_nan (invoke "add" (f32.const -inf) (f32.const -nan))) +(assert_return_arithmetic_nan (invoke "add" (f32.const -inf) (f32.const -nan:0x200000))) +(assert_return_canonical_nan (invoke "add" (f32.const -inf) (f32.const nan))) +(assert_return_arithmetic_nan (invoke "add" (f32.const -inf) (f32.const nan:0x200000))) +(assert_return_canonical_nan (invoke "add" (f32.const inf) (f32.const -nan))) +(assert_return_arithmetic_nan (invoke "add" (f32.const inf) (f32.const -nan:0x200000))) +(assert_return_canonical_nan (invoke "add" (f32.const inf) (f32.const nan))) +(assert_return_arithmetic_nan (invoke "add" (f32.const inf) (f32.const nan:0x200000))) (assert_return_canonical_nan (invoke "add" (f32.const -nan) (f32.const -0x0p+0))) (assert_return_arithmetic_nan (invoke "add" (f32.const -nan:0x200000) (f32.const -0x0p+0))) (assert_return_canonical_nan (invoke "add" (f32.const -nan) (f32.const 0x0p+0))) @@ -392,14 +392,14 @@ (assert_return_arithmetic_nan (invoke "add" (f32.const nan:0x200000) (f32.const -0x1.fffffep+127))) (assert_return_canonical_nan (invoke "add" (f32.const nan) (f32.const 0x1.fffffep+127))) (assert_return_arithmetic_nan (invoke "add" (f32.const nan:0x200000) (f32.const 0x1.fffffep+127))) -(assert_return_canonical_nan (invoke "add" (f32.const -nan) (f32.const -infinity))) -(assert_return_arithmetic_nan (invoke "add" (f32.const -nan:0x200000) (f32.const -infinity))) -(assert_return_canonical_nan (invoke "add" (f32.const -nan) (f32.const infinity))) -(assert_return_arithmetic_nan (invoke "add" (f32.const -nan:0x200000) (f32.const infinity))) -(assert_return_canonical_nan (invoke "add" (f32.const nan) (f32.const -infinity))) -(assert_return_arithmetic_nan (invoke "add" (f32.const nan:0x200000) (f32.const -infinity))) -(assert_return_canonical_nan (invoke "add" (f32.const nan) (f32.const infinity))) -(assert_return_arithmetic_nan (invoke "add" (f32.const nan:0x200000) (f32.const infinity))) +(assert_return_canonical_nan (invoke "add" (f32.const -nan) (f32.const -inf))) +(assert_return_arithmetic_nan (invoke "add" (f32.const -nan:0x200000) (f32.const -inf))) +(assert_return_canonical_nan (invoke "add" (f32.const -nan) (f32.const inf))) +(assert_return_arithmetic_nan (invoke "add" (f32.const -nan:0x200000) (f32.const inf))) +(assert_return_canonical_nan (invoke "add" (f32.const nan) (f32.const -inf))) +(assert_return_arithmetic_nan (invoke "add" (f32.const nan:0x200000) (f32.const -inf))) +(assert_return_canonical_nan (invoke "add" (f32.const nan) (f32.const inf))) +(assert_return_arithmetic_nan (invoke "add" (f32.const nan:0x200000) (f32.const inf))) (assert_return_canonical_nan (invoke "add" (f32.const -nan) (f32.const -nan))) (assert_return_arithmetic_nan (invoke "add" (f32.const -nan:0x200000) (f32.const -nan))) (assert_return_arithmetic_nan (invoke "add" (f32.const -nan) (f32.const -nan:0x200000))) @@ -444,10 +444,10 @@ (assert_return (invoke "sub" (f32.const -0x0p+0) (f32.const 0x1.fffffep+127)) (f32.const -0x1.fffffep+127)) (assert_return (invoke "sub" (f32.const 0x0p+0) (f32.const -0x1.fffffep+127)) (f32.const 0x1.fffffep+127)) (assert_return (invoke "sub" (f32.const 0x0p+0) (f32.const 0x1.fffffep+127)) (f32.const -0x1.fffffep+127)) -(assert_return (invoke "sub" (f32.const -0x0p+0) (f32.const -infinity)) (f32.const infinity)) -(assert_return (invoke "sub" (f32.const -0x0p+0) (f32.const infinity)) (f32.const -infinity)) -(assert_return (invoke "sub" (f32.const 0x0p+0) (f32.const -infinity)) (f32.const infinity)) -(assert_return (invoke "sub" (f32.const 0x0p+0) (f32.const infinity)) (f32.const -infinity)) +(assert_return (invoke "sub" (f32.const -0x0p+0) (f32.const -inf)) (f32.const inf)) +(assert_return (invoke "sub" (f32.const -0x0p+0) (f32.const inf)) (f32.const -inf)) +(assert_return (invoke "sub" (f32.const 0x0p+0) (f32.const -inf)) (f32.const inf)) +(assert_return (invoke "sub" (f32.const 0x0p+0) (f32.const inf)) (f32.const -inf)) (assert_return_canonical_nan (invoke "sub" (f32.const -0x0p+0) (f32.const -nan))) (assert_return_arithmetic_nan (invoke "sub" (f32.const -0x0p+0) (f32.const -nan:0x200000))) (assert_return_canonical_nan (invoke "sub" (f32.const -0x0p+0) (f32.const nan))) @@ -484,10 +484,10 @@ (assert_return (invoke "sub" (f32.const -0x1p-149) (f32.const 0x1.fffffep+127)) (f32.const -0x1.fffffep+127)) (assert_return (invoke "sub" (f32.const 0x1p-149) (f32.const -0x1.fffffep+127)) (f32.const 0x1.fffffep+127)) (assert_return (invoke "sub" (f32.const 0x1p-149) (f32.const 0x1.fffffep+127)) (f32.const -0x1.fffffep+127)) -(assert_return (invoke "sub" (f32.const -0x1p-149) (f32.const -infinity)) (f32.const infinity)) -(assert_return (invoke "sub" (f32.const -0x1p-149) (f32.const infinity)) (f32.const -infinity)) -(assert_return (invoke "sub" (f32.const 0x1p-149) (f32.const -infinity)) (f32.const infinity)) -(assert_return (invoke "sub" (f32.const 0x1p-149) (f32.const infinity)) (f32.const -infinity)) +(assert_return (invoke "sub" (f32.const -0x1p-149) (f32.const -inf)) (f32.const inf)) +(assert_return (invoke "sub" (f32.const -0x1p-149) (f32.const inf)) (f32.const -inf)) +(assert_return (invoke "sub" (f32.const 0x1p-149) (f32.const -inf)) (f32.const inf)) +(assert_return (invoke "sub" (f32.const 0x1p-149) (f32.const inf)) (f32.const -inf)) (assert_return_canonical_nan (invoke "sub" (f32.const -0x1p-149) (f32.const -nan))) (assert_return_arithmetic_nan (invoke "sub" (f32.const -0x1p-149) (f32.const -nan:0x200000))) (assert_return_canonical_nan (invoke "sub" (f32.const -0x1p-149) (f32.const nan))) @@ -524,10 +524,10 @@ (assert_return (invoke "sub" (f32.const -0x1p-126) (f32.const 0x1.fffffep+127)) (f32.const -0x1.fffffep+127)) (assert_return (invoke "sub" (f32.const 0x1p-126) (f32.const -0x1.fffffep+127)) (f32.const 0x1.fffffep+127)) (assert_return (invoke "sub" (f32.const 0x1p-126) (f32.const 0x1.fffffep+127)) (f32.const -0x1.fffffep+127)) -(assert_return (invoke "sub" (f32.const -0x1p-126) (f32.const -infinity)) (f32.const infinity)) -(assert_return (invoke "sub" (f32.const -0x1p-126) (f32.const infinity)) (f32.const -infinity)) -(assert_return (invoke "sub" (f32.const 0x1p-126) (f32.const -infinity)) (f32.const infinity)) -(assert_return (invoke "sub" (f32.const 0x1p-126) (f32.const infinity)) (f32.const -infinity)) +(assert_return (invoke "sub" (f32.const -0x1p-126) (f32.const -inf)) (f32.const inf)) +(assert_return (invoke "sub" (f32.const -0x1p-126) (f32.const inf)) (f32.const -inf)) +(assert_return (invoke "sub" (f32.const 0x1p-126) (f32.const -inf)) (f32.const inf)) +(assert_return (invoke "sub" (f32.const 0x1p-126) (f32.const inf)) (f32.const -inf)) (assert_return_canonical_nan (invoke "sub" (f32.const -0x1p-126) (f32.const -nan))) (assert_return_arithmetic_nan (invoke "sub" (f32.const -0x1p-126) (f32.const -nan:0x200000))) (assert_return_canonical_nan (invoke "sub" (f32.const -0x1p-126) (f32.const nan))) @@ -564,10 +564,10 @@ (assert_return (invoke "sub" (f32.const -0x1p-1) (f32.const 0x1.fffffep+127)) (f32.const -0x1.fffffep+127)) (assert_return (invoke "sub" (f32.const 0x1p-1) (f32.const -0x1.fffffep+127)) (f32.const 0x1.fffffep+127)) (assert_return (invoke "sub" (f32.const 0x1p-1) (f32.const 0x1.fffffep+127)) (f32.const -0x1.fffffep+127)) -(assert_return (invoke "sub" (f32.const -0x1p-1) (f32.const -infinity)) (f32.const infinity)) -(assert_return (invoke "sub" (f32.const -0x1p-1) (f32.const infinity)) (f32.const -infinity)) -(assert_return (invoke "sub" (f32.const 0x1p-1) (f32.const -infinity)) (f32.const infinity)) -(assert_return (invoke "sub" (f32.const 0x1p-1) (f32.const infinity)) (f32.const -infinity)) +(assert_return (invoke "sub" (f32.const -0x1p-1) (f32.const -inf)) (f32.const inf)) +(assert_return (invoke "sub" (f32.const -0x1p-1) (f32.const inf)) (f32.const -inf)) +(assert_return (invoke "sub" (f32.const 0x1p-1) (f32.const -inf)) (f32.const inf)) +(assert_return (invoke "sub" (f32.const 0x1p-1) (f32.const inf)) (f32.const -inf)) (assert_return_canonical_nan (invoke "sub" (f32.const -0x1p-1) (f32.const -nan))) (assert_return_arithmetic_nan (invoke "sub" (f32.const -0x1p-1) (f32.const -nan:0x200000))) (assert_return_canonical_nan (invoke "sub" (f32.const -0x1p-1) (f32.const nan))) @@ -604,10 +604,10 @@ (assert_return (invoke "sub" (f32.const -0x1p+0) (f32.const 0x1.fffffep+127)) (f32.const -0x1.fffffep+127)) (assert_return (invoke "sub" (f32.const 0x1p+0) (f32.const -0x1.fffffep+127)) (f32.const 0x1.fffffep+127)) (assert_return (invoke "sub" (f32.const 0x1p+0) (f32.const 0x1.fffffep+127)) (f32.const -0x1.fffffep+127)) -(assert_return (invoke "sub" (f32.const -0x1p+0) (f32.const -infinity)) (f32.const infinity)) -(assert_return (invoke "sub" (f32.const -0x1p+0) (f32.const infinity)) (f32.const -infinity)) -(assert_return (invoke "sub" (f32.const 0x1p+0) (f32.const -infinity)) (f32.const infinity)) -(assert_return (invoke "sub" (f32.const 0x1p+0) (f32.const infinity)) (f32.const -infinity)) +(assert_return (invoke "sub" (f32.const -0x1p+0) (f32.const -inf)) (f32.const inf)) +(assert_return (invoke "sub" (f32.const -0x1p+0) (f32.const inf)) (f32.const -inf)) +(assert_return (invoke "sub" (f32.const 0x1p+0) (f32.const -inf)) (f32.const inf)) +(assert_return (invoke "sub" (f32.const 0x1p+0) (f32.const inf)) (f32.const -inf)) (assert_return_canonical_nan (invoke "sub" (f32.const -0x1p+0) (f32.const -nan))) (assert_return_arithmetic_nan (invoke "sub" (f32.const -0x1p+0) (f32.const -nan:0x200000))) (assert_return_canonical_nan (invoke "sub" (f32.const -0x1p+0) (f32.const nan))) @@ -644,10 +644,10 @@ (assert_return (invoke "sub" (f32.const -0x1.921fb6p+2) (f32.const 0x1.fffffep+127)) (f32.const -0x1.fffffep+127)) (assert_return (invoke "sub" (f32.const 0x1.921fb6p+2) (f32.const -0x1.fffffep+127)) (f32.const 0x1.fffffep+127)) (assert_return (invoke "sub" (f32.const 0x1.921fb6p+2) (f32.const 0x1.fffffep+127)) (f32.const -0x1.fffffep+127)) -(assert_return (invoke "sub" (f32.const -0x1.921fb6p+2) (f32.const -infinity)) (f32.const infinity)) -(assert_return (invoke "sub" (f32.const -0x1.921fb6p+2) (f32.const infinity)) (f32.const -infinity)) -(assert_return (invoke "sub" (f32.const 0x1.921fb6p+2) (f32.const -infinity)) (f32.const infinity)) -(assert_return (invoke "sub" (f32.const 0x1.921fb6p+2) (f32.const infinity)) (f32.const -infinity)) +(assert_return (invoke "sub" (f32.const -0x1.921fb6p+2) (f32.const -inf)) (f32.const inf)) +(assert_return (invoke "sub" (f32.const -0x1.921fb6p+2) (f32.const inf)) (f32.const -inf)) +(assert_return (invoke "sub" (f32.const 0x1.921fb6p+2) (f32.const -inf)) (f32.const inf)) +(assert_return (invoke "sub" (f32.const 0x1.921fb6p+2) (f32.const inf)) (f32.const -inf)) (assert_return_canonical_nan (invoke "sub" (f32.const -0x1.921fb6p+2) (f32.const -nan))) (assert_return_arithmetic_nan (invoke "sub" (f32.const -0x1.921fb6p+2) (f32.const -nan:0x200000))) (assert_return_canonical_nan (invoke "sub" (f32.const -0x1.921fb6p+2) (f32.const nan))) @@ -681,13 +681,13 @@ (assert_return (invoke "sub" (f32.const 0x1.fffffep+127) (f32.const -0x1.921fb6p+2)) (f32.const 0x1.fffffep+127)) (assert_return (invoke "sub" (f32.const 0x1.fffffep+127) (f32.const 0x1.921fb6p+2)) (f32.const 0x1.fffffep+127)) (assert_return (invoke "sub" (f32.const -0x1.fffffep+127) (f32.const -0x1.fffffep+127)) (f32.const 0x0p+0)) -(assert_return (invoke "sub" (f32.const -0x1.fffffep+127) (f32.const 0x1.fffffep+127)) (f32.const -infinity)) -(assert_return (invoke "sub" (f32.const 0x1.fffffep+127) (f32.const -0x1.fffffep+127)) (f32.const infinity)) +(assert_return (invoke "sub" (f32.const -0x1.fffffep+127) (f32.const 0x1.fffffep+127)) (f32.const -inf)) +(assert_return (invoke "sub" (f32.const 0x1.fffffep+127) (f32.const -0x1.fffffep+127)) (f32.const inf)) (assert_return (invoke "sub" (f32.const 0x1.fffffep+127) (f32.const 0x1.fffffep+127)) (f32.const 0x0p+0)) -(assert_return (invoke "sub" (f32.const -0x1.fffffep+127) (f32.const -infinity)) (f32.const infinity)) -(assert_return (invoke "sub" (f32.const -0x1.fffffep+127) (f32.const infinity)) (f32.const -infinity)) -(assert_return (invoke "sub" (f32.const 0x1.fffffep+127) (f32.const -infinity)) (f32.const infinity)) -(assert_return (invoke "sub" (f32.const 0x1.fffffep+127) (f32.const infinity)) (f32.const -infinity)) +(assert_return (invoke "sub" (f32.const -0x1.fffffep+127) (f32.const -inf)) (f32.const inf)) +(assert_return (invoke "sub" (f32.const -0x1.fffffep+127) (f32.const inf)) (f32.const -inf)) +(assert_return (invoke "sub" (f32.const 0x1.fffffep+127) (f32.const -inf)) (f32.const inf)) +(assert_return (invoke "sub" (f32.const 0x1.fffffep+127) (f32.const inf)) (f32.const -inf)) (assert_return_canonical_nan (invoke "sub" (f32.const -0x1.fffffep+127) (f32.const -nan))) (assert_return_arithmetic_nan (invoke "sub" (f32.const -0x1.fffffep+127) (f32.const -nan:0x200000))) (assert_return_canonical_nan (invoke "sub" (f32.const -0x1.fffffep+127) (f32.const nan))) @@ -696,46 +696,46 @@ (assert_return_arithmetic_nan (invoke "sub" (f32.const 0x1.fffffep+127) (f32.const -nan:0x200000))) (assert_return_canonical_nan (invoke "sub" (f32.const 0x1.fffffep+127) (f32.const nan))) (assert_return_arithmetic_nan (invoke "sub" (f32.const 0x1.fffffep+127) (f32.const nan:0x200000))) -(assert_return (invoke "sub" (f32.const -infinity) (f32.const -0x0p+0)) (f32.const -infinity)) -(assert_return (invoke "sub" (f32.const -infinity) (f32.const 0x0p+0)) (f32.const -infinity)) -(assert_return (invoke "sub" (f32.const infinity) (f32.const -0x0p+0)) (f32.const infinity)) -(assert_return (invoke "sub" (f32.const infinity) (f32.const 0x0p+0)) (f32.const infinity)) -(assert_return (invoke "sub" (f32.const -infinity) (f32.const -0x1p-149)) (f32.const -infinity)) -(assert_return (invoke "sub" (f32.const -infinity) (f32.const 0x1p-149)) (f32.const -infinity)) -(assert_return (invoke "sub" (f32.const infinity) (f32.const -0x1p-149)) (f32.const infinity)) -(assert_return (invoke "sub" (f32.const infinity) (f32.const 0x1p-149)) (f32.const infinity)) -(assert_return (invoke "sub" (f32.const -infinity) (f32.const -0x1p-126)) (f32.const -infinity)) -(assert_return (invoke "sub" (f32.const -infinity) (f32.const 0x1p-126)) (f32.const -infinity)) -(assert_return (invoke "sub" (f32.const infinity) (f32.const -0x1p-126)) (f32.const infinity)) -(assert_return (invoke "sub" (f32.const infinity) (f32.const 0x1p-126)) (f32.const infinity)) -(assert_return (invoke "sub" (f32.const -infinity) (f32.const -0x1p-1)) (f32.const -infinity)) -(assert_return (invoke "sub" (f32.const -infinity) (f32.const 0x1p-1)) (f32.const -infinity)) -(assert_return (invoke "sub" (f32.const infinity) (f32.const -0x1p-1)) (f32.const infinity)) -(assert_return (invoke "sub" (f32.const infinity) (f32.const 0x1p-1)) (f32.const infinity)) -(assert_return (invoke "sub" (f32.const -infinity) (f32.const -0x1p+0)) (f32.const -infinity)) -(assert_return (invoke "sub" (f32.const -infinity) (f32.const 0x1p+0)) (f32.const -infinity)) -(assert_return (invoke "sub" (f32.const infinity) (f32.const -0x1p+0)) (f32.const infinity)) -(assert_return (invoke "sub" (f32.const infinity) (f32.const 0x1p+0)) (f32.const infinity)) -(assert_return (invoke "sub" (f32.const -infinity) (f32.const -0x1.921fb6p+2)) (f32.const -infinity)) -(assert_return (invoke "sub" (f32.const -infinity) (f32.const 0x1.921fb6p+2)) (f32.const -infinity)) -(assert_return (invoke "sub" (f32.const infinity) (f32.const -0x1.921fb6p+2)) (f32.const infinity)) -(assert_return (invoke "sub" (f32.const infinity) (f32.const 0x1.921fb6p+2)) (f32.const infinity)) -(assert_return (invoke "sub" (f32.const -infinity) (f32.const -0x1.fffffep+127)) (f32.const -infinity)) -(assert_return (invoke "sub" (f32.const -infinity) (f32.const 0x1.fffffep+127)) (f32.const -infinity)) -(assert_return (invoke "sub" (f32.const infinity) (f32.const -0x1.fffffep+127)) (f32.const infinity)) -(assert_return (invoke "sub" (f32.const infinity) (f32.const 0x1.fffffep+127)) (f32.const infinity)) -(assert_return_canonical_nan (invoke "sub" (f32.const -infinity) (f32.const -infinity))) -(assert_return (invoke "sub" (f32.const -infinity) (f32.const infinity)) (f32.const -infinity)) -(assert_return (invoke "sub" (f32.const infinity) (f32.const -infinity)) (f32.const infinity)) -(assert_return_canonical_nan (invoke "sub" (f32.const infinity) (f32.const infinity))) -(assert_return_canonical_nan (invoke "sub" (f32.const -infinity) (f32.const -nan))) -(assert_return_arithmetic_nan (invoke "sub" (f32.const -infinity) (f32.const -nan:0x200000))) -(assert_return_canonical_nan (invoke "sub" (f32.const -infinity) (f32.const nan))) -(assert_return_arithmetic_nan (invoke "sub" (f32.const -infinity) (f32.const nan:0x200000))) -(assert_return_canonical_nan (invoke "sub" (f32.const infinity) (f32.const -nan))) -(assert_return_arithmetic_nan (invoke "sub" (f32.const infinity) (f32.const -nan:0x200000))) -(assert_return_canonical_nan (invoke "sub" (f32.const infinity) (f32.const nan))) -(assert_return_arithmetic_nan (invoke "sub" (f32.const infinity) (f32.const nan:0x200000))) +(assert_return (invoke "sub" (f32.const -inf) (f32.const -0x0p+0)) (f32.const -inf)) +(assert_return (invoke "sub" (f32.const -inf) (f32.const 0x0p+0)) (f32.const -inf)) +(assert_return (invoke "sub" (f32.const inf) (f32.const -0x0p+0)) (f32.const inf)) +(assert_return (invoke "sub" (f32.const inf) (f32.const 0x0p+0)) (f32.const inf)) +(assert_return (invoke "sub" (f32.const -inf) (f32.const -0x1p-149)) (f32.const -inf)) +(assert_return (invoke "sub" (f32.const -inf) (f32.const 0x1p-149)) (f32.const -inf)) +(assert_return (invoke "sub" (f32.const inf) (f32.const -0x1p-149)) (f32.const inf)) +(assert_return (invoke "sub" (f32.const inf) (f32.const 0x1p-149)) (f32.const inf)) +(assert_return (invoke "sub" (f32.const -inf) (f32.const -0x1p-126)) (f32.const -inf)) +(assert_return (invoke "sub" (f32.const -inf) (f32.const 0x1p-126)) (f32.const -inf)) +(assert_return (invoke "sub" (f32.const inf) (f32.const -0x1p-126)) (f32.const inf)) +(assert_return (invoke "sub" (f32.const inf) (f32.const 0x1p-126)) (f32.const inf)) +(assert_return (invoke "sub" (f32.const -inf) (f32.const -0x1p-1)) (f32.const -inf)) +(assert_return (invoke "sub" (f32.const -inf) (f32.const 0x1p-1)) (f32.const -inf)) +(assert_return (invoke "sub" (f32.const inf) (f32.const -0x1p-1)) (f32.const inf)) +(assert_return (invoke "sub" (f32.const inf) (f32.const 0x1p-1)) (f32.const inf)) +(assert_return (invoke "sub" (f32.const -inf) (f32.const -0x1p+0)) (f32.const -inf)) +(assert_return (invoke "sub" (f32.const -inf) (f32.const 0x1p+0)) (f32.const -inf)) +(assert_return (invoke "sub" (f32.const inf) (f32.const -0x1p+0)) (f32.const inf)) +(assert_return (invoke "sub" (f32.const inf) (f32.const 0x1p+0)) (f32.const inf)) +(assert_return (invoke "sub" (f32.const -inf) (f32.const -0x1.921fb6p+2)) (f32.const -inf)) +(assert_return (invoke "sub" (f32.const -inf) (f32.const 0x1.921fb6p+2)) (f32.const -inf)) +(assert_return (invoke "sub" (f32.const inf) (f32.const -0x1.921fb6p+2)) (f32.const inf)) +(assert_return (invoke "sub" (f32.const inf) (f32.const 0x1.921fb6p+2)) (f32.const inf)) +(assert_return (invoke "sub" (f32.const -inf) (f32.const -0x1.fffffep+127)) (f32.const -inf)) +(assert_return (invoke "sub" (f32.const -inf) (f32.const 0x1.fffffep+127)) (f32.const -inf)) +(assert_return (invoke "sub" (f32.const inf) (f32.const -0x1.fffffep+127)) (f32.const inf)) +(assert_return (invoke "sub" (f32.const inf) (f32.const 0x1.fffffep+127)) (f32.const inf)) +(assert_return_canonical_nan (invoke "sub" (f32.const -inf) (f32.const -inf))) +(assert_return (invoke "sub" (f32.const -inf) (f32.const inf)) (f32.const -inf)) +(assert_return (invoke "sub" (f32.const inf) (f32.const -inf)) (f32.const inf)) +(assert_return_canonical_nan (invoke "sub" (f32.const inf) (f32.const inf))) +(assert_return_canonical_nan (invoke "sub" (f32.const -inf) (f32.const -nan))) +(assert_return_arithmetic_nan (invoke "sub" (f32.const -inf) (f32.const -nan:0x200000))) +(assert_return_canonical_nan (invoke "sub" (f32.const -inf) (f32.const nan))) +(assert_return_arithmetic_nan (invoke "sub" (f32.const -inf) (f32.const nan:0x200000))) +(assert_return_canonical_nan (invoke "sub" (f32.const inf) (f32.const -nan))) +(assert_return_arithmetic_nan (invoke "sub" (f32.const inf) (f32.const -nan:0x200000))) +(assert_return_canonical_nan (invoke "sub" (f32.const inf) (f32.const nan))) +(assert_return_arithmetic_nan (invoke "sub" (f32.const inf) (f32.const nan:0x200000))) (assert_return_canonical_nan (invoke "sub" (f32.const -nan) (f32.const -0x0p+0))) (assert_return_arithmetic_nan (invoke "sub" (f32.const -nan:0x200000) (f32.const -0x0p+0))) (assert_return_canonical_nan (invoke "sub" (f32.const -nan) (f32.const 0x0p+0))) @@ -792,14 +792,14 @@ (assert_return_arithmetic_nan (invoke "sub" (f32.const nan:0x200000) (f32.const -0x1.fffffep+127))) (assert_return_canonical_nan (invoke "sub" (f32.const nan) (f32.const 0x1.fffffep+127))) (assert_return_arithmetic_nan (invoke "sub" (f32.const nan:0x200000) (f32.const 0x1.fffffep+127))) -(assert_return_canonical_nan (invoke "sub" (f32.const -nan) (f32.const -infinity))) -(assert_return_arithmetic_nan (invoke "sub" (f32.const -nan:0x200000) (f32.const -infinity))) -(assert_return_canonical_nan (invoke "sub" (f32.const -nan) (f32.const infinity))) -(assert_return_arithmetic_nan (invoke "sub" (f32.const -nan:0x200000) (f32.const infinity))) -(assert_return_canonical_nan (invoke "sub" (f32.const nan) (f32.const -infinity))) -(assert_return_arithmetic_nan (invoke "sub" (f32.const nan:0x200000) (f32.const -infinity))) -(assert_return_canonical_nan (invoke "sub" (f32.const nan) (f32.const infinity))) -(assert_return_arithmetic_nan (invoke "sub" (f32.const nan:0x200000) (f32.const infinity))) +(assert_return_canonical_nan (invoke "sub" (f32.const -nan) (f32.const -inf))) +(assert_return_arithmetic_nan (invoke "sub" (f32.const -nan:0x200000) (f32.const -inf))) +(assert_return_canonical_nan (invoke "sub" (f32.const -nan) (f32.const inf))) +(assert_return_arithmetic_nan (invoke "sub" (f32.const -nan:0x200000) (f32.const inf))) +(assert_return_canonical_nan (invoke "sub" (f32.const nan) (f32.const -inf))) +(assert_return_arithmetic_nan (invoke "sub" (f32.const nan:0x200000) (f32.const -inf))) +(assert_return_canonical_nan (invoke "sub" (f32.const nan) (f32.const inf))) +(assert_return_arithmetic_nan (invoke "sub" (f32.const nan:0x200000) (f32.const inf))) (assert_return_canonical_nan (invoke "sub" (f32.const -nan) (f32.const -nan))) (assert_return_arithmetic_nan (invoke "sub" (f32.const -nan:0x200000) (f32.const -nan))) (assert_return_arithmetic_nan (invoke "sub" (f32.const -nan) (f32.const -nan:0x200000))) @@ -844,10 +844,10 @@ (assert_return (invoke "mul" (f32.const -0x0p+0) (f32.const 0x1.fffffep+127)) (f32.const -0x0p+0)) (assert_return (invoke "mul" (f32.const 0x0p+0) (f32.const -0x1.fffffep+127)) (f32.const -0x0p+0)) (assert_return (invoke "mul" (f32.const 0x0p+0) (f32.const 0x1.fffffep+127)) (f32.const 0x0p+0)) -(assert_return_canonical_nan (invoke "mul" (f32.const -0x0p+0) (f32.const -infinity))) -(assert_return_canonical_nan (invoke "mul" (f32.const -0x0p+0) (f32.const infinity))) -(assert_return_canonical_nan (invoke "mul" (f32.const 0x0p+0) (f32.const -infinity))) -(assert_return_canonical_nan (invoke "mul" (f32.const 0x0p+0) (f32.const infinity))) +(assert_return_canonical_nan (invoke "mul" (f32.const -0x0p+0) (f32.const -inf))) +(assert_return_canonical_nan (invoke "mul" (f32.const -0x0p+0) (f32.const inf))) +(assert_return_canonical_nan (invoke "mul" (f32.const 0x0p+0) (f32.const -inf))) +(assert_return_canonical_nan (invoke "mul" (f32.const 0x0p+0) (f32.const inf))) (assert_return_canonical_nan (invoke "mul" (f32.const -0x0p+0) (f32.const -nan))) (assert_return_arithmetic_nan (invoke "mul" (f32.const -0x0p+0) (f32.const -nan:0x200000))) (assert_return_canonical_nan (invoke "mul" (f32.const -0x0p+0) (f32.const nan))) @@ -884,10 +884,10 @@ (assert_return (invoke "mul" (f32.const -0x1p-149) (f32.const 0x1.fffffep+127)) (f32.const -0x1.fffffep-22)) (assert_return (invoke "mul" (f32.const 0x1p-149) (f32.const -0x1.fffffep+127)) (f32.const -0x1.fffffep-22)) (assert_return (invoke "mul" (f32.const 0x1p-149) (f32.const 0x1.fffffep+127)) (f32.const 0x1.fffffep-22)) -(assert_return (invoke "mul" (f32.const -0x1p-149) (f32.const -infinity)) (f32.const infinity)) -(assert_return (invoke "mul" (f32.const -0x1p-149) (f32.const infinity)) (f32.const -infinity)) -(assert_return (invoke "mul" (f32.const 0x1p-149) (f32.const -infinity)) (f32.const -infinity)) -(assert_return (invoke "mul" (f32.const 0x1p-149) (f32.const infinity)) (f32.const infinity)) +(assert_return (invoke "mul" (f32.const -0x1p-149) (f32.const -inf)) (f32.const inf)) +(assert_return (invoke "mul" (f32.const -0x1p-149) (f32.const inf)) (f32.const -inf)) +(assert_return (invoke "mul" (f32.const 0x1p-149) (f32.const -inf)) (f32.const -inf)) +(assert_return (invoke "mul" (f32.const 0x1p-149) (f32.const inf)) (f32.const inf)) (assert_return_canonical_nan (invoke "mul" (f32.const -0x1p-149) (f32.const -nan))) (assert_return_arithmetic_nan (invoke "mul" (f32.const -0x1p-149) (f32.const -nan:0x200000))) (assert_return_canonical_nan (invoke "mul" (f32.const -0x1p-149) (f32.const nan))) @@ -924,10 +924,10 @@ (assert_return (invoke "mul" (f32.const -0x1p-126) (f32.const 0x1.fffffep+127)) (f32.const -0x1.fffffep+1)) (assert_return (invoke "mul" (f32.const 0x1p-126) (f32.const -0x1.fffffep+127)) (f32.const -0x1.fffffep+1)) (assert_return (invoke "mul" (f32.const 0x1p-126) (f32.const 0x1.fffffep+127)) (f32.const 0x1.fffffep+1)) -(assert_return (invoke "mul" (f32.const -0x1p-126) (f32.const -infinity)) (f32.const infinity)) -(assert_return (invoke "mul" (f32.const -0x1p-126) (f32.const infinity)) (f32.const -infinity)) -(assert_return (invoke "mul" (f32.const 0x1p-126) (f32.const -infinity)) (f32.const -infinity)) -(assert_return (invoke "mul" (f32.const 0x1p-126) (f32.const infinity)) (f32.const infinity)) +(assert_return (invoke "mul" (f32.const -0x1p-126) (f32.const -inf)) (f32.const inf)) +(assert_return (invoke "mul" (f32.const -0x1p-126) (f32.const inf)) (f32.const -inf)) +(assert_return (invoke "mul" (f32.const 0x1p-126) (f32.const -inf)) (f32.const -inf)) +(assert_return (invoke "mul" (f32.const 0x1p-126) (f32.const inf)) (f32.const inf)) (assert_return_canonical_nan (invoke "mul" (f32.const -0x1p-126) (f32.const -nan))) (assert_return_arithmetic_nan (invoke "mul" (f32.const -0x1p-126) (f32.const -nan:0x200000))) (assert_return_canonical_nan (invoke "mul" (f32.const -0x1p-126) (f32.const nan))) @@ -964,10 +964,10 @@ (assert_return (invoke "mul" (f32.const -0x1p-1) (f32.const 0x1.fffffep+127)) (f32.const -0x1.fffffep+126)) (assert_return (invoke "mul" (f32.const 0x1p-1) (f32.const -0x1.fffffep+127)) (f32.const -0x1.fffffep+126)) (assert_return (invoke "mul" (f32.const 0x1p-1) (f32.const 0x1.fffffep+127)) (f32.const 0x1.fffffep+126)) -(assert_return (invoke "mul" (f32.const -0x1p-1) (f32.const -infinity)) (f32.const infinity)) -(assert_return (invoke "mul" (f32.const -0x1p-1) (f32.const infinity)) (f32.const -infinity)) -(assert_return (invoke "mul" (f32.const 0x1p-1) (f32.const -infinity)) (f32.const -infinity)) -(assert_return (invoke "mul" (f32.const 0x1p-1) (f32.const infinity)) (f32.const infinity)) +(assert_return (invoke "mul" (f32.const -0x1p-1) (f32.const -inf)) (f32.const inf)) +(assert_return (invoke "mul" (f32.const -0x1p-1) (f32.const inf)) (f32.const -inf)) +(assert_return (invoke "mul" (f32.const 0x1p-1) (f32.const -inf)) (f32.const -inf)) +(assert_return (invoke "mul" (f32.const 0x1p-1) (f32.const inf)) (f32.const inf)) (assert_return_canonical_nan (invoke "mul" (f32.const -0x1p-1) (f32.const -nan))) (assert_return_arithmetic_nan (invoke "mul" (f32.const -0x1p-1) (f32.const -nan:0x200000))) (assert_return_canonical_nan (invoke "mul" (f32.const -0x1p-1) (f32.const nan))) @@ -1004,10 +1004,10 @@ (assert_return (invoke "mul" (f32.const -0x1p+0) (f32.const 0x1.fffffep+127)) (f32.const -0x1.fffffep+127)) (assert_return (invoke "mul" (f32.const 0x1p+0) (f32.const -0x1.fffffep+127)) (f32.const -0x1.fffffep+127)) (assert_return (invoke "mul" (f32.const 0x1p+0) (f32.const 0x1.fffffep+127)) (f32.const 0x1.fffffep+127)) -(assert_return (invoke "mul" (f32.const -0x1p+0) (f32.const -infinity)) (f32.const infinity)) -(assert_return (invoke "mul" (f32.const -0x1p+0) (f32.const infinity)) (f32.const -infinity)) -(assert_return (invoke "mul" (f32.const 0x1p+0) (f32.const -infinity)) (f32.const -infinity)) -(assert_return (invoke "mul" (f32.const 0x1p+0) (f32.const infinity)) (f32.const infinity)) +(assert_return (invoke "mul" (f32.const -0x1p+0) (f32.const -inf)) (f32.const inf)) +(assert_return (invoke "mul" (f32.const -0x1p+0) (f32.const inf)) (f32.const -inf)) +(assert_return (invoke "mul" (f32.const 0x1p+0) (f32.const -inf)) (f32.const -inf)) +(assert_return (invoke "mul" (f32.const 0x1p+0) (f32.const inf)) (f32.const inf)) (assert_return_canonical_nan (invoke "mul" (f32.const -0x1p+0) (f32.const -nan))) (assert_return_arithmetic_nan (invoke "mul" (f32.const -0x1p+0) (f32.const -nan:0x200000))) (assert_return_canonical_nan (invoke "mul" (f32.const -0x1p+0) (f32.const nan))) @@ -1040,14 +1040,14 @@ (assert_return (invoke "mul" (f32.const -0x1.921fb6p+2) (f32.const 0x1.921fb6p+2)) (f32.const -0x1.3bd3cep+5)) (assert_return (invoke "mul" (f32.const 0x1.921fb6p+2) (f32.const -0x1.921fb6p+2)) (f32.const -0x1.3bd3cep+5)) (assert_return (invoke "mul" (f32.const 0x1.921fb6p+2) (f32.const 0x1.921fb6p+2)) (f32.const 0x1.3bd3cep+5)) -(assert_return (invoke "mul" (f32.const -0x1.921fb6p+2) (f32.const -0x1.fffffep+127)) (f32.const infinity)) -(assert_return (invoke "mul" (f32.const -0x1.921fb6p+2) (f32.const 0x1.fffffep+127)) (f32.const -infinity)) -(assert_return (invoke "mul" (f32.const 0x1.921fb6p+2) (f32.const -0x1.fffffep+127)) (f32.const -infinity)) -(assert_return (invoke "mul" (f32.const 0x1.921fb6p+2) (f32.const 0x1.fffffep+127)) (f32.const infinity)) -(assert_return (invoke "mul" (f32.const -0x1.921fb6p+2) (f32.const -infinity)) (f32.const infinity)) -(assert_return (invoke "mul" (f32.const -0x1.921fb6p+2) (f32.const infinity)) (f32.const -infinity)) -(assert_return (invoke "mul" (f32.const 0x1.921fb6p+2) (f32.const -infinity)) (f32.const -infinity)) -(assert_return (invoke "mul" (f32.const 0x1.921fb6p+2) (f32.const infinity)) (f32.const infinity)) +(assert_return (invoke "mul" (f32.const -0x1.921fb6p+2) (f32.const -0x1.fffffep+127)) (f32.const inf)) +(assert_return (invoke "mul" (f32.const -0x1.921fb6p+2) (f32.const 0x1.fffffep+127)) (f32.const -inf)) +(assert_return (invoke "mul" (f32.const 0x1.921fb6p+2) (f32.const -0x1.fffffep+127)) (f32.const -inf)) +(assert_return (invoke "mul" (f32.const 0x1.921fb6p+2) (f32.const 0x1.fffffep+127)) (f32.const inf)) +(assert_return (invoke "mul" (f32.const -0x1.921fb6p+2) (f32.const -inf)) (f32.const inf)) +(assert_return (invoke "mul" (f32.const -0x1.921fb6p+2) (f32.const inf)) (f32.const -inf)) +(assert_return (invoke "mul" (f32.const 0x1.921fb6p+2) (f32.const -inf)) (f32.const -inf)) +(assert_return (invoke "mul" (f32.const 0x1.921fb6p+2) (f32.const inf)) (f32.const inf)) (assert_return_canonical_nan (invoke "mul" (f32.const -0x1.921fb6p+2) (f32.const -nan))) (assert_return_arithmetic_nan (invoke "mul" (f32.const -0x1.921fb6p+2) (f32.const -nan:0x200000))) (assert_return_canonical_nan (invoke "mul" (f32.const -0x1.921fb6p+2) (f32.const nan))) @@ -1076,18 +1076,18 @@ (assert_return (invoke "mul" (f32.const -0x1.fffffep+127) (f32.const 0x1p+0)) (f32.const -0x1.fffffep+127)) (assert_return (invoke "mul" (f32.const 0x1.fffffep+127) (f32.const -0x1p+0)) (f32.const -0x1.fffffep+127)) (assert_return (invoke "mul" (f32.const 0x1.fffffep+127) (f32.const 0x1p+0)) (f32.const 0x1.fffffep+127)) -(assert_return (invoke "mul" (f32.const -0x1.fffffep+127) (f32.const -0x1.921fb6p+2)) (f32.const infinity)) -(assert_return (invoke "mul" (f32.const -0x1.fffffep+127) (f32.const 0x1.921fb6p+2)) (f32.const -infinity)) -(assert_return (invoke "mul" (f32.const 0x1.fffffep+127) (f32.const -0x1.921fb6p+2)) (f32.const -infinity)) -(assert_return (invoke "mul" (f32.const 0x1.fffffep+127) (f32.const 0x1.921fb6p+2)) (f32.const infinity)) -(assert_return (invoke "mul" (f32.const -0x1.fffffep+127) (f32.const -0x1.fffffep+127)) (f32.const infinity)) -(assert_return (invoke "mul" (f32.const -0x1.fffffep+127) (f32.const 0x1.fffffep+127)) (f32.const -infinity)) -(assert_return (invoke "mul" (f32.const 0x1.fffffep+127) (f32.const -0x1.fffffep+127)) (f32.const -infinity)) -(assert_return (invoke "mul" (f32.const 0x1.fffffep+127) (f32.const 0x1.fffffep+127)) (f32.const infinity)) -(assert_return (invoke "mul" (f32.const -0x1.fffffep+127) (f32.const -infinity)) (f32.const infinity)) -(assert_return (invoke "mul" (f32.const -0x1.fffffep+127) (f32.const infinity)) (f32.const -infinity)) -(assert_return (invoke "mul" (f32.const 0x1.fffffep+127) (f32.const -infinity)) (f32.const -infinity)) -(assert_return (invoke "mul" (f32.const 0x1.fffffep+127) (f32.const infinity)) (f32.const infinity)) +(assert_return (invoke "mul" (f32.const -0x1.fffffep+127) (f32.const -0x1.921fb6p+2)) (f32.const inf)) +(assert_return (invoke "mul" (f32.const -0x1.fffffep+127) (f32.const 0x1.921fb6p+2)) (f32.const -inf)) +(assert_return (invoke "mul" (f32.const 0x1.fffffep+127) (f32.const -0x1.921fb6p+2)) (f32.const -inf)) +(assert_return (invoke "mul" (f32.const 0x1.fffffep+127) (f32.const 0x1.921fb6p+2)) (f32.const inf)) +(assert_return (invoke "mul" (f32.const -0x1.fffffep+127) (f32.const -0x1.fffffep+127)) (f32.const inf)) +(assert_return (invoke "mul" (f32.const -0x1.fffffep+127) (f32.const 0x1.fffffep+127)) (f32.const -inf)) +(assert_return (invoke "mul" (f32.const 0x1.fffffep+127) (f32.const -0x1.fffffep+127)) (f32.const -inf)) +(assert_return (invoke "mul" (f32.const 0x1.fffffep+127) (f32.const 0x1.fffffep+127)) (f32.const inf)) +(assert_return (invoke "mul" (f32.const -0x1.fffffep+127) (f32.const -inf)) (f32.const inf)) +(assert_return (invoke "mul" (f32.const -0x1.fffffep+127) (f32.const inf)) (f32.const -inf)) +(assert_return (invoke "mul" (f32.const 0x1.fffffep+127) (f32.const -inf)) (f32.const -inf)) +(assert_return (invoke "mul" (f32.const 0x1.fffffep+127) (f32.const inf)) (f32.const inf)) (assert_return_canonical_nan (invoke "mul" (f32.const -0x1.fffffep+127) (f32.const -nan))) (assert_return_arithmetic_nan (invoke "mul" (f32.const -0x1.fffffep+127) (f32.const -nan:0x200000))) (assert_return_canonical_nan (invoke "mul" (f32.const -0x1.fffffep+127) (f32.const nan))) @@ -1096,46 +1096,46 @@ (assert_return_arithmetic_nan (invoke "mul" (f32.const 0x1.fffffep+127) (f32.const -nan:0x200000))) (assert_return_canonical_nan (invoke "mul" (f32.const 0x1.fffffep+127) (f32.const nan))) (assert_return_arithmetic_nan (invoke "mul" (f32.const 0x1.fffffep+127) (f32.const nan:0x200000))) -(assert_return_canonical_nan (invoke "mul" (f32.const -infinity) (f32.const -0x0p+0))) -(assert_return_canonical_nan (invoke "mul" (f32.const -infinity) (f32.const 0x0p+0))) -(assert_return_canonical_nan (invoke "mul" (f32.const infinity) (f32.const -0x0p+0))) -(assert_return_canonical_nan (invoke "mul" (f32.const infinity) (f32.const 0x0p+0))) -(assert_return (invoke "mul" (f32.const -infinity) (f32.const -0x1p-149)) (f32.const infinity)) -(assert_return (invoke "mul" (f32.const -infinity) (f32.const 0x1p-149)) (f32.const -infinity)) -(assert_return (invoke "mul" (f32.const infinity) (f32.const -0x1p-149)) (f32.const -infinity)) -(assert_return (invoke "mul" (f32.const infinity) (f32.const 0x1p-149)) (f32.const infinity)) -(assert_return (invoke "mul" (f32.const -infinity) (f32.const -0x1p-126)) (f32.const infinity)) -(assert_return (invoke "mul" (f32.const -infinity) (f32.const 0x1p-126)) (f32.const -infinity)) -(assert_return (invoke "mul" (f32.const infinity) (f32.const -0x1p-126)) (f32.const -infinity)) -(assert_return (invoke "mul" (f32.const infinity) (f32.const 0x1p-126)) (f32.const infinity)) -(assert_return (invoke "mul" (f32.const -infinity) (f32.const -0x1p-1)) (f32.const infinity)) -(assert_return (invoke "mul" (f32.const -infinity) (f32.const 0x1p-1)) (f32.const -infinity)) -(assert_return (invoke "mul" (f32.const infinity) (f32.const -0x1p-1)) (f32.const -infinity)) -(assert_return (invoke "mul" (f32.const infinity) (f32.const 0x1p-1)) (f32.const infinity)) -(assert_return (invoke "mul" (f32.const -infinity) (f32.const -0x1p+0)) (f32.const infinity)) -(assert_return (invoke "mul" (f32.const -infinity) (f32.const 0x1p+0)) (f32.const -infinity)) -(assert_return (invoke "mul" (f32.const infinity) (f32.const -0x1p+0)) (f32.const -infinity)) -(assert_return (invoke "mul" (f32.const infinity) (f32.const 0x1p+0)) (f32.const infinity)) -(assert_return (invoke "mul" (f32.const -infinity) (f32.const -0x1.921fb6p+2)) (f32.const infinity)) -(assert_return (invoke "mul" (f32.const -infinity) (f32.const 0x1.921fb6p+2)) (f32.const -infinity)) -(assert_return (invoke "mul" (f32.const infinity) (f32.const -0x1.921fb6p+2)) (f32.const -infinity)) -(assert_return (invoke "mul" (f32.const infinity) (f32.const 0x1.921fb6p+2)) (f32.const infinity)) -(assert_return (invoke "mul" (f32.const -infinity) (f32.const -0x1.fffffep+127)) (f32.const infinity)) -(assert_return (invoke "mul" (f32.const -infinity) (f32.const 0x1.fffffep+127)) (f32.const -infinity)) -(assert_return (invoke "mul" (f32.const infinity) (f32.const -0x1.fffffep+127)) (f32.const -infinity)) -(assert_return (invoke "mul" (f32.const infinity) (f32.const 0x1.fffffep+127)) (f32.const infinity)) -(assert_return (invoke "mul" (f32.const -infinity) (f32.const -infinity)) (f32.const infinity)) -(assert_return (invoke "mul" (f32.const -infinity) (f32.const infinity)) (f32.const -infinity)) -(assert_return (invoke "mul" (f32.const infinity) (f32.const -infinity)) (f32.const -infinity)) -(assert_return (invoke "mul" (f32.const infinity) (f32.const infinity)) (f32.const infinity)) -(assert_return_canonical_nan (invoke "mul" (f32.const -infinity) (f32.const -nan))) -(assert_return_arithmetic_nan (invoke "mul" (f32.const -infinity) (f32.const -nan:0x200000))) -(assert_return_canonical_nan (invoke "mul" (f32.const -infinity) (f32.const nan))) -(assert_return_arithmetic_nan (invoke "mul" (f32.const -infinity) (f32.const nan:0x200000))) -(assert_return_canonical_nan (invoke "mul" (f32.const infinity) (f32.const -nan))) -(assert_return_arithmetic_nan (invoke "mul" (f32.const infinity) (f32.const -nan:0x200000))) -(assert_return_canonical_nan (invoke "mul" (f32.const infinity) (f32.const nan))) -(assert_return_arithmetic_nan (invoke "mul" (f32.const infinity) (f32.const nan:0x200000))) +(assert_return_canonical_nan (invoke "mul" (f32.const -inf) (f32.const -0x0p+0))) +(assert_return_canonical_nan (invoke "mul" (f32.const -inf) (f32.const 0x0p+0))) +(assert_return_canonical_nan (invoke "mul" (f32.const inf) (f32.const -0x0p+0))) +(assert_return_canonical_nan (invoke "mul" (f32.const inf) (f32.const 0x0p+0))) +(assert_return (invoke "mul" (f32.const -inf) (f32.const -0x1p-149)) (f32.const inf)) +(assert_return (invoke "mul" (f32.const -inf) (f32.const 0x1p-149)) (f32.const -inf)) +(assert_return (invoke "mul" (f32.const inf) (f32.const -0x1p-149)) (f32.const -inf)) +(assert_return (invoke "mul" (f32.const inf) (f32.const 0x1p-149)) (f32.const inf)) +(assert_return (invoke "mul" (f32.const -inf) (f32.const -0x1p-126)) (f32.const inf)) +(assert_return (invoke "mul" (f32.const -inf) (f32.const 0x1p-126)) (f32.const -inf)) +(assert_return (invoke "mul" (f32.const inf) (f32.const -0x1p-126)) (f32.const -inf)) +(assert_return (invoke "mul" (f32.const inf) (f32.const 0x1p-126)) (f32.const inf)) +(assert_return (invoke "mul" (f32.const -inf) (f32.const -0x1p-1)) (f32.const inf)) +(assert_return (invoke "mul" (f32.const -inf) (f32.const 0x1p-1)) (f32.const -inf)) +(assert_return (invoke "mul" (f32.const inf) (f32.const -0x1p-1)) (f32.const -inf)) +(assert_return (invoke "mul" (f32.const inf) (f32.const 0x1p-1)) (f32.const inf)) +(assert_return (invoke "mul" (f32.const -inf) (f32.const -0x1p+0)) (f32.const inf)) +(assert_return (invoke "mul" (f32.const -inf) (f32.const 0x1p+0)) (f32.const -inf)) +(assert_return (invoke "mul" (f32.const inf) (f32.const -0x1p+0)) (f32.const -inf)) +(assert_return (invoke "mul" (f32.const inf) (f32.const 0x1p+0)) (f32.const inf)) +(assert_return (invoke "mul" (f32.const -inf) (f32.const -0x1.921fb6p+2)) (f32.const inf)) +(assert_return (invoke "mul" (f32.const -inf) (f32.const 0x1.921fb6p+2)) (f32.const -inf)) +(assert_return (invoke "mul" (f32.const inf) (f32.const -0x1.921fb6p+2)) (f32.const -inf)) +(assert_return (invoke "mul" (f32.const inf) (f32.const 0x1.921fb6p+2)) (f32.const inf)) +(assert_return (invoke "mul" (f32.const -inf) (f32.const -0x1.fffffep+127)) (f32.const inf)) +(assert_return (invoke "mul" (f32.const -inf) (f32.const 0x1.fffffep+127)) (f32.const -inf)) +(assert_return (invoke "mul" (f32.const inf) (f32.const -0x1.fffffep+127)) (f32.const -inf)) +(assert_return (invoke "mul" (f32.const inf) (f32.const 0x1.fffffep+127)) (f32.const inf)) +(assert_return (invoke "mul" (f32.const -inf) (f32.const -inf)) (f32.const inf)) +(assert_return (invoke "mul" (f32.const -inf) (f32.const inf)) (f32.const -inf)) +(assert_return (invoke "mul" (f32.const inf) (f32.const -inf)) (f32.const -inf)) +(assert_return (invoke "mul" (f32.const inf) (f32.const inf)) (f32.const inf)) +(assert_return_canonical_nan (invoke "mul" (f32.const -inf) (f32.const -nan))) +(assert_return_arithmetic_nan (invoke "mul" (f32.const -inf) (f32.const -nan:0x200000))) +(assert_return_canonical_nan (invoke "mul" (f32.const -inf) (f32.const nan))) +(assert_return_arithmetic_nan (invoke "mul" (f32.const -inf) (f32.const nan:0x200000))) +(assert_return_canonical_nan (invoke "mul" (f32.const inf) (f32.const -nan))) +(assert_return_arithmetic_nan (invoke "mul" (f32.const inf) (f32.const -nan:0x200000))) +(assert_return_canonical_nan (invoke "mul" (f32.const inf) (f32.const nan))) +(assert_return_arithmetic_nan (invoke "mul" (f32.const inf) (f32.const nan:0x200000))) (assert_return_canonical_nan (invoke "mul" (f32.const -nan) (f32.const -0x0p+0))) (assert_return_arithmetic_nan (invoke "mul" (f32.const -nan:0x200000) (f32.const -0x0p+0))) (assert_return_canonical_nan (invoke "mul" (f32.const -nan) (f32.const 0x0p+0))) @@ -1192,14 +1192,14 @@ (assert_return_arithmetic_nan (invoke "mul" (f32.const nan:0x200000) (f32.const -0x1.fffffep+127))) (assert_return_canonical_nan (invoke "mul" (f32.const nan) (f32.const 0x1.fffffep+127))) (assert_return_arithmetic_nan (invoke "mul" (f32.const nan:0x200000) (f32.const 0x1.fffffep+127))) -(assert_return_canonical_nan (invoke "mul" (f32.const -nan) (f32.const -infinity))) -(assert_return_arithmetic_nan (invoke "mul" (f32.const -nan:0x200000) (f32.const -infinity))) -(assert_return_canonical_nan (invoke "mul" (f32.const -nan) (f32.const infinity))) -(assert_return_arithmetic_nan (invoke "mul" (f32.const -nan:0x200000) (f32.const infinity))) -(assert_return_canonical_nan (invoke "mul" (f32.const nan) (f32.const -infinity))) -(assert_return_arithmetic_nan (invoke "mul" (f32.const nan:0x200000) (f32.const -infinity))) -(assert_return_canonical_nan (invoke "mul" (f32.const nan) (f32.const infinity))) -(assert_return_arithmetic_nan (invoke "mul" (f32.const nan:0x200000) (f32.const infinity))) +(assert_return_canonical_nan (invoke "mul" (f32.const -nan) (f32.const -inf))) +(assert_return_arithmetic_nan (invoke "mul" (f32.const -nan:0x200000) (f32.const -inf))) +(assert_return_canonical_nan (invoke "mul" (f32.const -nan) (f32.const inf))) +(assert_return_arithmetic_nan (invoke "mul" (f32.const -nan:0x200000) (f32.const inf))) +(assert_return_canonical_nan (invoke "mul" (f32.const nan) (f32.const -inf))) +(assert_return_arithmetic_nan (invoke "mul" (f32.const nan:0x200000) (f32.const -inf))) +(assert_return_canonical_nan (invoke "mul" (f32.const nan) (f32.const inf))) +(assert_return_arithmetic_nan (invoke "mul" (f32.const nan:0x200000) (f32.const inf))) (assert_return_canonical_nan (invoke "mul" (f32.const -nan) (f32.const -nan))) (assert_return_arithmetic_nan (invoke "mul" (f32.const -nan:0x200000) (f32.const -nan))) (assert_return_arithmetic_nan (invoke "mul" (f32.const -nan) (f32.const -nan:0x200000))) @@ -1244,10 +1244,10 @@ (assert_return (invoke "div" (f32.const -0x0p+0) (f32.const 0x1.fffffep+127)) (f32.const -0x0p+0)) (assert_return (invoke "div" (f32.const 0x0p+0) (f32.const -0x1.fffffep+127)) (f32.const -0x0p+0)) (assert_return (invoke "div" (f32.const 0x0p+0) (f32.const 0x1.fffffep+127)) (f32.const 0x0p+0)) -(assert_return (invoke "div" (f32.const -0x0p+0) (f32.const -infinity)) (f32.const 0x0p+0)) -(assert_return (invoke "div" (f32.const -0x0p+0) (f32.const infinity)) (f32.const -0x0p+0)) -(assert_return (invoke "div" (f32.const 0x0p+0) (f32.const -infinity)) (f32.const -0x0p+0)) -(assert_return (invoke "div" (f32.const 0x0p+0) (f32.const infinity)) (f32.const 0x0p+0)) +(assert_return (invoke "div" (f32.const -0x0p+0) (f32.const -inf)) (f32.const 0x0p+0)) +(assert_return (invoke "div" (f32.const -0x0p+0) (f32.const inf)) (f32.const -0x0p+0)) +(assert_return (invoke "div" (f32.const 0x0p+0) (f32.const -inf)) (f32.const -0x0p+0)) +(assert_return (invoke "div" (f32.const 0x0p+0) (f32.const inf)) (f32.const 0x0p+0)) (assert_return_canonical_nan (invoke "div" (f32.const -0x0p+0) (f32.const -nan))) (assert_return_arithmetic_nan (invoke "div" (f32.const -0x0p+0) (f32.const -nan:0x200000))) (assert_return_canonical_nan (invoke "div" (f32.const -0x0p+0) (f32.const nan))) @@ -1256,10 +1256,10 @@ (assert_return_arithmetic_nan (invoke "div" (f32.const 0x0p+0) (f32.const -nan:0x200000))) (assert_return_canonical_nan (invoke "div" (f32.const 0x0p+0) (f32.const nan))) (assert_return_arithmetic_nan (invoke "div" (f32.const 0x0p+0) (f32.const nan:0x200000))) -(assert_return (invoke "div" (f32.const -0x1p-149) (f32.const -0x0p+0)) (f32.const infinity)) -(assert_return (invoke "div" (f32.const -0x1p-149) (f32.const 0x0p+0)) (f32.const -infinity)) -(assert_return (invoke "div" (f32.const 0x1p-149) (f32.const -0x0p+0)) (f32.const -infinity)) -(assert_return (invoke "div" (f32.const 0x1p-149) (f32.const 0x0p+0)) (f32.const infinity)) +(assert_return (invoke "div" (f32.const -0x1p-149) (f32.const -0x0p+0)) (f32.const inf)) +(assert_return (invoke "div" (f32.const -0x1p-149) (f32.const 0x0p+0)) (f32.const -inf)) +(assert_return (invoke "div" (f32.const 0x1p-149) (f32.const -0x0p+0)) (f32.const -inf)) +(assert_return (invoke "div" (f32.const 0x1p-149) (f32.const 0x0p+0)) (f32.const inf)) (assert_return (invoke "div" (f32.const -0x1p-149) (f32.const -0x1p-149)) (f32.const 0x1p+0)) (assert_return (invoke "div" (f32.const -0x1p-149) (f32.const 0x1p-149)) (f32.const -0x1p+0)) (assert_return (invoke "div" (f32.const 0x1p-149) (f32.const -0x1p-149)) (f32.const -0x1p+0)) @@ -1284,10 +1284,10 @@ (assert_return (invoke "div" (f32.const -0x1p-149) (f32.const 0x1.fffffep+127)) (f32.const -0x0p+0)) (assert_return (invoke "div" (f32.const 0x1p-149) (f32.const -0x1.fffffep+127)) (f32.const -0x0p+0)) (assert_return (invoke "div" (f32.const 0x1p-149) (f32.const 0x1.fffffep+127)) (f32.const 0x0p+0)) -(assert_return (invoke "div" (f32.const -0x1p-149) (f32.const -infinity)) (f32.const 0x0p+0)) -(assert_return (invoke "div" (f32.const -0x1p-149) (f32.const infinity)) (f32.const -0x0p+0)) -(assert_return (invoke "div" (f32.const 0x1p-149) (f32.const -infinity)) (f32.const -0x0p+0)) -(assert_return (invoke "div" (f32.const 0x1p-149) (f32.const infinity)) (f32.const 0x0p+0)) +(assert_return (invoke "div" (f32.const -0x1p-149) (f32.const -inf)) (f32.const 0x0p+0)) +(assert_return (invoke "div" (f32.const -0x1p-149) (f32.const inf)) (f32.const -0x0p+0)) +(assert_return (invoke "div" (f32.const 0x1p-149) (f32.const -inf)) (f32.const -0x0p+0)) +(assert_return (invoke "div" (f32.const 0x1p-149) (f32.const inf)) (f32.const 0x0p+0)) (assert_return_canonical_nan (invoke "div" (f32.const -0x1p-149) (f32.const -nan))) (assert_return_arithmetic_nan (invoke "div" (f32.const -0x1p-149) (f32.const -nan:0x200000))) (assert_return_canonical_nan (invoke "div" (f32.const -0x1p-149) (f32.const nan))) @@ -1296,10 +1296,10 @@ (assert_return_arithmetic_nan (invoke "div" (f32.const 0x1p-149) (f32.const -nan:0x200000))) (assert_return_canonical_nan (invoke "div" (f32.const 0x1p-149) (f32.const nan))) (assert_return_arithmetic_nan (invoke "div" (f32.const 0x1p-149) (f32.const nan:0x200000))) -(assert_return (invoke "div" (f32.const -0x1p-126) (f32.const -0x0p+0)) (f32.const infinity)) -(assert_return (invoke "div" (f32.const -0x1p-126) (f32.const 0x0p+0)) (f32.const -infinity)) -(assert_return (invoke "div" (f32.const 0x1p-126) (f32.const -0x0p+0)) (f32.const -infinity)) -(assert_return (invoke "div" (f32.const 0x1p-126) (f32.const 0x0p+0)) (f32.const infinity)) +(assert_return (invoke "div" (f32.const -0x1p-126) (f32.const -0x0p+0)) (f32.const inf)) +(assert_return (invoke "div" (f32.const -0x1p-126) (f32.const 0x0p+0)) (f32.const -inf)) +(assert_return (invoke "div" (f32.const 0x1p-126) (f32.const -0x0p+0)) (f32.const -inf)) +(assert_return (invoke "div" (f32.const 0x1p-126) (f32.const 0x0p+0)) (f32.const inf)) (assert_return (invoke "div" (f32.const -0x1p-126) (f32.const -0x1p-149)) (f32.const 0x1p+23)) (assert_return (invoke "div" (f32.const -0x1p-126) (f32.const 0x1p-149)) (f32.const -0x1p+23)) (assert_return (invoke "div" (f32.const 0x1p-126) (f32.const -0x1p-149)) (f32.const -0x1p+23)) @@ -1324,10 +1324,10 @@ (assert_return (invoke "div" (f32.const -0x1p-126) (f32.const 0x1.fffffep+127)) (f32.const -0x0p+0)) (assert_return (invoke "div" (f32.const 0x1p-126) (f32.const -0x1.fffffep+127)) (f32.const -0x0p+0)) (assert_return (invoke "div" (f32.const 0x1p-126) (f32.const 0x1.fffffep+127)) (f32.const 0x0p+0)) -(assert_return (invoke "div" (f32.const -0x1p-126) (f32.const -infinity)) (f32.const 0x0p+0)) -(assert_return (invoke "div" (f32.const -0x1p-126) (f32.const infinity)) (f32.const -0x0p+0)) -(assert_return (invoke "div" (f32.const 0x1p-126) (f32.const -infinity)) (f32.const -0x0p+0)) -(assert_return (invoke "div" (f32.const 0x1p-126) (f32.const infinity)) (f32.const 0x0p+0)) +(assert_return (invoke "div" (f32.const -0x1p-126) (f32.const -inf)) (f32.const 0x0p+0)) +(assert_return (invoke "div" (f32.const -0x1p-126) (f32.const inf)) (f32.const -0x0p+0)) +(assert_return (invoke "div" (f32.const 0x1p-126) (f32.const -inf)) (f32.const -0x0p+0)) +(assert_return (invoke "div" (f32.const 0x1p-126) (f32.const inf)) (f32.const 0x0p+0)) (assert_return_canonical_nan (invoke "div" (f32.const -0x1p-126) (f32.const -nan))) (assert_return_arithmetic_nan (invoke "div" (f32.const -0x1p-126) (f32.const -nan:0x200000))) (assert_return_canonical_nan (invoke "div" (f32.const -0x1p-126) (f32.const nan))) @@ -1336,14 +1336,14 @@ (assert_return_arithmetic_nan (invoke "div" (f32.const 0x1p-126) (f32.const -nan:0x200000))) (assert_return_canonical_nan (invoke "div" (f32.const 0x1p-126) (f32.const nan))) (assert_return_arithmetic_nan (invoke "div" (f32.const 0x1p-126) (f32.const nan:0x200000))) -(assert_return (invoke "div" (f32.const -0x1p-1) (f32.const -0x0p+0)) (f32.const infinity)) -(assert_return (invoke "div" (f32.const -0x1p-1) (f32.const 0x0p+0)) (f32.const -infinity)) -(assert_return (invoke "div" (f32.const 0x1p-1) (f32.const -0x0p+0)) (f32.const -infinity)) -(assert_return (invoke "div" (f32.const 0x1p-1) (f32.const 0x0p+0)) (f32.const infinity)) -(assert_return (invoke "div" (f32.const -0x1p-1) (f32.const -0x1p-149)) (f32.const infinity)) -(assert_return (invoke "div" (f32.const -0x1p-1) (f32.const 0x1p-149)) (f32.const -infinity)) -(assert_return (invoke "div" (f32.const 0x1p-1) (f32.const -0x1p-149)) (f32.const -infinity)) -(assert_return (invoke "div" (f32.const 0x1p-1) (f32.const 0x1p-149)) (f32.const infinity)) +(assert_return (invoke "div" (f32.const -0x1p-1) (f32.const -0x0p+0)) (f32.const inf)) +(assert_return (invoke "div" (f32.const -0x1p-1) (f32.const 0x0p+0)) (f32.const -inf)) +(assert_return (invoke "div" (f32.const 0x1p-1) (f32.const -0x0p+0)) (f32.const -inf)) +(assert_return (invoke "div" (f32.const 0x1p-1) (f32.const 0x0p+0)) (f32.const inf)) +(assert_return (invoke "div" (f32.const -0x1p-1) (f32.const -0x1p-149)) (f32.const inf)) +(assert_return (invoke "div" (f32.const -0x1p-1) (f32.const 0x1p-149)) (f32.const -inf)) +(assert_return (invoke "div" (f32.const 0x1p-1) (f32.const -0x1p-149)) (f32.const -inf)) +(assert_return (invoke "div" (f32.const 0x1p-1) (f32.const 0x1p-149)) (f32.const inf)) (assert_return (invoke "div" (f32.const -0x1p-1) (f32.const -0x1p-126)) (f32.const 0x1p+125)) (assert_return (invoke "div" (f32.const -0x1p-1) (f32.const 0x1p-126)) (f32.const -0x1p+125)) (assert_return (invoke "div" (f32.const 0x1p-1) (f32.const -0x1p-126)) (f32.const -0x1p+125)) @@ -1364,10 +1364,10 @@ (assert_return (invoke "div" (f32.const -0x1p-1) (f32.const 0x1.fffffep+127)) (f32.const -0x1p-129)) (assert_return (invoke "div" (f32.const 0x1p-1) (f32.const -0x1.fffffep+127)) (f32.const -0x1p-129)) (assert_return (invoke "div" (f32.const 0x1p-1) (f32.const 0x1.fffffep+127)) (f32.const 0x1p-129)) -(assert_return (invoke "div" (f32.const -0x1p-1) (f32.const -infinity)) (f32.const 0x0p+0)) -(assert_return (invoke "div" (f32.const -0x1p-1) (f32.const infinity)) (f32.const -0x0p+0)) -(assert_return (invoke "div" (f32.const 0x1p-1) (f32.const -infinity)) (f32.const -0x0p+0)) -(assert_return (invoke "div" (f32.const 0x1p-1) (f32.const infinity)) (f32.const 0x0p+0)) +(assert_return (invoke "div" (f32.const -0x1p-1) (f32.const -inf)) (f32.const 0x0p+0)) +(assert_return (invoke "div" (f32.const -0x1p-1) (f32.const inf)) (f32.const -0x0p+0)) +(assert_return (invoke "div" (f32.const 0x1p-1) (f32.const -inf)) (f32.const -0x0p+0)) +(assert_return (invoke "div" (f32.const 0x1p-1) (f32.const inf)) (f32.const 0x0p+0)) (assert_return_canonical_nan (invoke "div" (f32.const -0x1p-1) (f32.const -nan))) (assert_return_arithmetic_nan (invoke "div" (f32.const -0x1p-1) (f32.const -nan:0x200000))) (assert_return_canonical_nan (invoke "div" (f32.const -0x1p-1) (f32.const nan))) @@ -1376,14 +1376,14 @@ (assert_return_arithmetic_nan (invoke "div" (f32.const 0x1p-1) (f32.const -nan:0x200000))) (assert_return_canonical_nan (invoke "div" (f32.const 0x1p-1) (f32.const nan))) (assert_return_arithmetic_nan (invoke "div" (f32.const 0x1p-1) (f32.const nan:0x200000))) -(assert_return (invoke "div" (f32.const -0x1p+0) (f32.const -0x0p+0)) (f32.const infinity)) -(assert_return (invoke "div" (f32.const -0x1p+0) (f32.const 0x0p+0)) (f32.const -infinity)) -(assert_return (invoke "div" (f32.const 0x1p+0) (f32.const -0x0p+0)) (f32.const -infinity)) -(assert_return (invoke "div" (f32.const 0x1p+0) (f32.const 0x0p+0)) (f32.const infinity)) -(assert_return (invoke "div" (f32.const -0x1p+0) (f32.const -0x1p-149)) (f32.const infinity)) -(assert_return (invoke "div" (f32.const -0x1p+0) (f32.const 0x1p-149)) (f32.const -infinity)) -(assert_return (invoke "div" (f32.const 0x1p+0) (f32.const -0x1p-149)) (f32.const -infinity)) -(assert_return (invoke "div" (f32.const 0x1p+0) (f32.const 0x1p-149)) (f32.const infinity)) +(assert_return (invoke "div" (f32.const -0x1p+0) (f32.const -0x0p+0)) (f32.const inf)) +(assert_return (invoke "div" (f32.const -0x1p+0) (f32.const 0x0p+0)) (f32.const -inf)) +(assert_return (invoke "div" (f32.const 0x1p+0) (f32.const -0x0p+0)) (f32.const -inf)) +(assert_return (invoke "div" (f32.const 0x1p+0) (f32.const 0x0p+0)) (f32.const inf)) +(assert_return (invoke "div" (f32.const -0x1p+0) (f32.const -0x1p-149)) (f32.const inf)) +(assert_return (invoke "div" (f32.const -0x1p+0) (f32.const 0x1p-149)) (f32.const -inf)) +(assert_return (invoke "div" (f32.const 0x1p+0) (f32.const -0x1p-149)) (f32.const -inf)) +(assert_return (invoke "div" (f32.const 0x1p+0) (f32.const 0x1p-149)) (f32.const inf)) (assert_return (invoke "div" (f32.const -0x1p+0) (f32.const -0x1p-126)) (f32.const 0x1p+126)) (assert_return (invoke "div" (f32.const -0x1p+0) (f32.const 0x1p-126)) (f32.const -0x1p+126)) (assert_return (invoke "div" (f32.const 0x1p+0) (f32.const -0x1p-126)) (f32.const -0x1p+126)) @@ -1404,10 +1404,10 @@ (assert_return (invoke "div" (f32.const -0x1p+0) (f32.const 0x1.fffffep+127)) (f32.const -0x1p-128)) (assert_return (invoke "div" (f32.const 0x1p+0) (f32.const -0x1.fffffep+127)) (f32.const -0x1p-128)) (assert_return (invoke "div" (f32.const 0x1p+0) (f32.const 0x1.fffffep+127)) (f32.const 0x1p-128)) -(assert_return (invoke "div" (f32.const -0x1p+0) (f32.const -infinity)) (f32.const 0x0p+0)) -(assert_return (invoke "div" (f32.const -0x1p+0) (f32.const infinity)) (f32.const -0x0p+0)) -(assert_return (invoke "div" (f32.const 0x1p+0) (f32.const -infinity)) (f32.const -0x0p+0)) -(assert_return (invoke "div" (f32.const 0x1p+0) (f32.const infinity)) (f32.const 0x0p+0)) +(assert_return (invoke "div" (f32.const -0x1p+0) (f32.const -inf)) (f32.const 0x0p+0)) +(assert_return (invoke "div" (f32.const -0x1p+0) (f32.const inf)) (f32.const -0x0p+0)) +(assert_return (invoke "div" (f32.const 0x1p+0) (f32.const -inf)) (f32.const -0x0p+0)) +(assert_return (invoke "div" (f32.const 0x1p+0) (f32.const inf)) (f32.const 0x0p+0)) (assert_return_canonical_nan (invoke "div" (f32.const -0x1p+0) (f32.const -nan))) (assert_return_arithmetic_nan (invoke "div" (f32.const -0x1p+0) (f32.const -nan:0x200000))) (assert_return_canonical_nan (invoke "div" (f32.const -0x1p+0) (f32.const nan))) @@ -1416,18 +1416,18 @@ (assert_return_arithmetic_nan (invoke "div" (f32.const 0x1p+0) (f32.const -nan:0x200000))) (assert_return_canonical_nan (invoke "div" (f32.const 0x1p+0) (f32.const nan))) (assert_return_arithmetic_nan (invoke "div" (f32.const 0x1p+0) (f32.const nan:0x200000))) -(assert_return (invoke "div" (f32.const -0x1.921fb6p+2) (f32.const -0x0p+0)) (f32.const infinity)) -(assert_return (invoke "div" (f32.const -0x1.921fb6p+2) (f32.const 0x0p+0)) (f32.const -infinity)) -(assert_return (invoke "div" (f32.const 0x1.921fb6p+2) (f32.const -0x0p+0)) (f32.const -infinity)) -(assert_return (invoke "div" (f32.const 0x1.921fb6p+2) (f32.const 0x0p+0)) (f32.const infinity)) -(assert_return (invoke "div" (f32.const -0x1.921fb6p+2) (f32.const -0x1p-149)) (f32.const infinity)) -(assert_return (invoke "div" (f32.const -0x1.921fb6p+2) (f32.const 0x1p-149)) (f32.const -infinity)) -(assert_return (invoke "div" (f32.const 0x1.921fb6p+2) (f32.const -0x1p-149)) (f32.const -infinity)) -(assert_return (invoke "div" (f32.const 0x1.921fb6p+2) (f32.const 0x1p-149)) (f32.const infinity)) -(assert_return (invoke "div" (f32.const -0x1.921fb6p+2) (f32.const -0x1p-126)) (f32.const infinity)) -(assert_return (invoke "div" (f32.const -0x1.921fb6p+2) (f32.const 0x1p-126)) (f32.const -infinity)) -(assert_return (invoke "div" (f32.const 0x1.921fb6p+2) (f32.const -0x1p-126)) (f32.const -infinity)) -(assert_return (invoke "div" (f32.const 0x1.921fb6p+2) (f32.const 0x1p-126)) (f32.const infinity)) +(assert_return (invoke "div" (f32.const -0x1.921fb6p+2) (f32.const -0x0p+0)) (f32.const inf)) +(assert_return (invoke "div" (f32.const -0x1.921fb6p+2) (f32.const 0x0p+0)) (f32.const -inf)) +(assert_return (invoke "div" (f32.const 0x1.921fb6p+2) (f32.const -0x0p+0)) (f32.const -inf)) +(assert_return (invoke "div" (f32.const 0x1.921fb6p+2) (f32.const 0x0p+0)) (f32.const inf)) +(assert_return (invoke "div" (f32.const -0x1.921fb6p+2) (f32.const -0x1p-149)) (f32.const inf)) +(assert_return (invoke "div" (f32.const -0x1.921fb6p+2) (f32.const 0x1p-149)) (f32.const -inf)) +(assert_return (invoke "div" (f32.const 0x1.921fb6p+2) (f32.const -0x1p-149)) (f32.const -inf)) +(assert_return (invoke "div" (f32.const 0x1.921fb6p+2) (f32.const 0x1p-149)) (f32.const inf)) +(assert_return (invoke "div" (f32.const -0x1.921fb6p+2) (f32.const -0x1p-126)) (f32.const inf)) +(assert_return (invoke "div" (f32.const -0x1.921fb6p+2) (f32.const 0x1p-126)) (f32.const -inf)) +(assert_return (invoke "div" (f32.const 0x1.921fb6p+2) (f32.const -0x1p-126)) (f32.const -inf)) +(assert_return (invoke "div" (f32.const 0x1.921fb6p+2) (f32.const 0x1p-126)) (f32.const inf)) (assert_return (invoke "div" (f32.const -0x1.921fb6p+2) (f32.const -0x1p-1)) (f32.const 0x1.921fb6p+3)) (assert_return (invoke "div" (f32.const -0x1.921fb6p+2) (f32.const 0x1p-1)) (f32.const -0x1.921fb6p+3)) (assert_return (invoke "div" (f32.const 0x1.921fb6p+2) (f32.const -0x1p-1)) (f32.const -0x1.921fb6p+3)) @@ -1444,10 +1444,10 @@ (assert_return (invoke "div" (f32.const -0x1.921fb6p+2) (f32.const 0x1.fffffep+127)) (f32.const -0x1.921fb8p-126)) (assert_return (invoke "div" (f32.const 0x1.921fb6p+2) (f32.const -0x1.fffffep+127)) (f32.const -0x1.921fb8p-126)) (assert_return (invoke "div" (f32.const 0x1.921fb6p+2) (f32.const 0x1.fffffep+127)) (f32.const 0x1.921fb8p-126)) -(assert_return (invoke "div" (f32.const -0x1.921fb6p+2) (f32.const -infinity)) (f32.const 0x0p+0)) -(assert_return (invoke "div" (f32.const -0x1.921fb6p+2) (f32.const infinity)) (f32.const -0x0p+0)) -(assert_return (invoke "div" (f32.const 0x1.921fb6p+2) (f32.const -infinity)) (f32.const -0x0p+0)) -(assert_return (invoke "div" (f32.const 0x1.921fb6p+2) (f32.const infinity)) (f32.const 0x0p+0)) +(assert_return (invoke "div" (f32.const -0x1.921fb6p+2) (f32.const -inf)) (f32.const 0x0p+0)) +(assert_return (invoke "div" (f32.const -0x1.921fb6p+2) (f32.const inf)) (f32.const -0x0p+0)) +(assert_return (invoke "div" (f32.const 0x1.921fb6p+2) (f32.const -inf)) (f32.const -0x0p+0)) +(assert_return (invoke "div" (f32.const 0x1.921fb6p+2) (f32.const inf)) (f32.const 0x0p+0)) (assert_return_canonical_nan (invoke "div" (f32.const -0x1.921fb6p+2) (f32.const -nan))) (assert_return_arithmetic_nan (invoke "div" (f32.const -0x1.921fb6p+2) (f32.const -nan:0x200000))) (assert_return_canonical_nan (invoke "div" (f32.const -0x1.921fb6p+2) (f32.const nan))) @@ -1456,22 +1456,22 @@ (assert_return_arithmetic_nan (invoke "div" (f32.const 0x1.921fb6p+2) (f32.const -nan:0x200000))) (assert_return_canonical_nan (invoke "div" (f32.const 0x1.921fb6p+2) (f32.const nan))) (assert_return_arithmetic_nan (invoke "div" (f32.const 0x1.921fb6p+2) (f32.const nan:0x200000))) -(assert_return (invoke "div" (f32.const -0x1.fffffep+127) (f32.const -0x0p+0)) (f32.const infinity)) -(assert_return (invoke "div" (f32.const -0x1.fffffep+127) (f32.const 0x0p+0)) (f32.const -infinity)) -(assert_return (invoke "div" (f32.const 0x1.fffffep+127) (f32.const -0x0p+0)) (f32.const -infinity)) -(assert_return (invoke "div" (f32.const 0x1.fffffep+127) (f32.const 0x0p+0)) (f32.const infinity)) -(assert_return (invoke "div" (f32.const -0x1.fffffep+127) (f32.const -0x1p-149)) (f32.const infinity)) -(assert_return (invoke "div" (f32.const -0x1.fffffep+127) (f32.const 0x1p-149)) (f32.const -infinity)) -(assert_return (invoke "div" (f32.const 0x1.fffffep+127) (f32.const -0x1p-149)) (f32.const -infinity)) -(assert_return (invoke "div" (f32.const 0x1.fffffep+127) (f32.const 0x1p-149)) (f32.const infinity)) -(assert_return (invoke "div" (f32.const -0x1.fffffep+127) (f32.const -0x1p-126)) (f32.const infinity)) -(assert_return (invoke "div" (f32.const -0x1.fffffep+127) (f32.const 0x1p-126)) (f32.const -infinity)) -(assert_return (invoke "div" (f32.const 0x1.fffffep+127) (f32.const -0x1p-126)) (f32.const -infinity)) -(assert_return (invoke "div" (f32.const 0x1.fffffep+127) (f32.const 0x1p-126)) (f32.const infinity)) -(assert_return (invoke "div" (f32.const -0x1.fffffep+127) (f32.const -0x1p-1)) (f32.const infinity)) -(assert_return (invoke "div" (f32.const -0x1.fffffep+127) (f32.const 0x1p-1)) (f32.const -infinity)) -(assert_return (invoke "div" (f32.const 0x1.fffffep+127) (f32.const -0x1p-1)) (f32.const -infinity)) -(assert_return (invoke "div" (f32.const 0x1.fffffep+127) (f32.const 0x1p-1)) (f32.const infinity)) +(assert_return (invoke "div" (f32.const -0x1.fffffep+127) (f32.const -0x0p+0)) (f32.const inf)) +(assert_return (invoke "div" (f32.const -0x1.fffffep+127) (f32.const 0x0p+0)) (f32.const -inf)) +(assert_return (invoke "div" (f32.const 0x1.fffffep+127) (f32.const -0x0p+0)) (f32.const -inf)) +(assert_return (invoke "div" (f32.const 0x1.fffffep+127) (f32.const 0x0p+0)) (f32.const inf)) +(assert_return (invoke "div" (f32.const -0x1.fffffep+127) (f32.const -0x1p-149)) (f32.const inf)) +(assert_return (invoke "div" (f32.const -0x1.fffffep+127) (f32.const 0x1p-149)) (f32.const -inf)) +(assert_return (invoke "div" (f32.const 0x1.fffffep+127) (f32.const -0x1p-149)) (f32.const -inf)) +(assert_return (invoke "div" (f32.const 0x1.fffffep+127) (f32.const 0x1p-149)) (f32.const inf)) +(assert_return (invoke "div" (f32.const -0x1.fffffep+127) (f32.const -0x1p-126)) (f32.const inf)) +(assert_return (invoke "div" (f32.const -0x1.fffffep+127) (f32.const 0x1p-126)) (f32.const -inf)) +(assert_return (invoke "div" (f32.const 0x1.fffffep+127) (f32.const -0x1p-126)) (f32.const -inf)) +(assert_return (invoke "div" (f32.const 0x1.fffffep+127) (f32.const 0x1p-126)) (f32.const inf)) +(assert_return (invoke "div" (f32.const -0x1.fffffep+127) (f32.const -0x1p-1)) (f32.const inf)) +(assert_return (invoke "div" (f32.const -0x1.fffffep+127) (f32.const 0x1p-1)) (f32.const -inf)) +(assert_return (invoke "div" (f32.const 0x1.fffffep+127) (f32.const -0x1p-1)) (f32.const -inf)) +(assert_return (invoke "div" (f32.const 0x1.fffffep+127) (f32.const 0x1p-1)) (f32.const inf)) (assert_return (invoke "div" (f32.const -0x1.fffffep+127) (f32.const -0x1p+0)) (f32.const 0x1.fffffep+127)) (assert_return (invoke "div" (f32.const -0x1.fffffep+127) (f32.const 0x1p+0)) (f32.const -0x1.fffffep+127)) (assert_return (invoke "div" (f32.const 0x1.fffffep+127) (f32.const -0x1p+0)) (f32.const -0x1.fffffep+127)) @@ -1484,10 +1484,10 @@ (assert_return (invoke "div" (f32.const -0x1.fffffep+127) (f32.const 0x1.fffffep+127)) (f32.const -0x1p+0)) (assert_return (invoke "div" (f32.const 0x1.fffffep+127) (f32.const -0x1.fffffep+127)) (f32.const -0x1p+0)) (assert_return (invoke "div" (f32.const 0x1.fffffep+127) (f32.const 0x1.fffffep+127)) (f32.const 0x1p+0)) -(assert_return (invoke "div" (f32.const -0x1.fffffep+127) (f32.const -infinity)) (f32.const 0x0p+0)) -(assert_return (invoke "div" (f32.const -0x1.fffffep+127) (f32.const infinity)) (f32.const -0x0p+0)) -(assert_return (invoke "div" (f32.const 0x1.fffffep+127) (f32.const -infinity)) (f32.const -0x0p+0)) -(assert_return (invoke "div" (f32.const 0x1.fffffep+127) (f32.const infinity)) (f32.const 0x0p+0)) +(assert_return (invoke "div" (f32.const -0x1.fffffep+127) (f32.const -inf)) (f32.const 0x0p+0)) +(assert_return (invoke "div" (f32.const -0x1.fffffep+127) (f32.const inf)) (f32.const -0x0p+0)) +(assert_return (invoke "div" (f32.const 0x1.fffffep+127) (f32.const -inf)) (f32.const -0x0p+0)) +(assert_return (invoke "div" (f32.const 0x1.fffffep+127) (f32.const inf)) (f32.const 0x0p+0)) (assert_return_canonical_nan (invoke "div" (f32.const -0x1.fffffep+127) (f32.const -nan))) (assert_return_arithmetic_nan (invoke "div" (f32.const -0x1.fffffep+127) (f32.const -nan:0x200000))) (assert_return_canonical_nan (invoke "div" (f32.const -0x1.fffffep+127) (f32.const nan))) @@ -1496,46 +1496,46 @@ (assert_return_arithmetic_nan (invoke "div" (f32.const 0x1.fffffep+127) (f32.const -nan:0x200000))) (assert_return_canonical_nan (invoke "div" (f32.const 0x1.fffffep+127) (f32.const nan))) (assert_return_arithmetic_nan (invoke "div" (f32.const 0x1.fffffep+127) (f32.const nan:0x200000))) -(assert_return (invoke "div" (f32.const -infinity) (f32.const -0x0p+0)) (f32.const infinity)) -(assert_return (invoke "div" (f32.const -infinity) (f32.const 0x0p+0)) (f32.const -infinity)) -(assert_return (invoke "div" (f32.const infinity) (f32.const -0x0p+0)) (f32.const -infinity)) -(assert_return (invoke "div" (f32.const infinity) (f32.const 0x0p+0)) (f32.const infinity)) -(assert_return (invoke "div" (f32.const -infinity) (f32.const -0x1p-149)) (f32.const infinity)) -(assert_return (invoke "div" (f32.const -infinity) (f32.const 0x1p-149)) (f32.const -infinity)) -(assert_return (invoke "div" (f32.const infinity) (f32.const -0x1p-149)) (f32.const -infinity)) -(assert_return (invoke "div" (f32.const infinity) (f32.const 0x1p-149)) (f32.const infinity)) -(assert_return (invoke "div" (f32.const -infinity) (f32.const -0x1p-126)) (f32.const infinity)) -(assert_return (invoke "div" (f32.const -infinity) (f32.const 0x1p-126)) (f32.const -infinity)) -(assert_return (invoke "div" (f32.const infinity) (f32.const -0x1p-126)) (f32.const -infinity)) -(assert_return (invoke "div" (f32.const infinity) (f32.const 0x1p-126)) (f32.const infinity)) -(assert_return (invoke "div" (f32.const -infinity) (f32.const -0x1p-1)) (f32.const infinity)) -(assert_return (invoke "div" (f32.const -infinity) (f32.const 0x1p-1)) (f32.const -infinity)) -(assert_return (invoke "div" (f32.const infinity) (f32.const -0x1p-1)) (f32.const -infinity)) -(assert_return (invoke "div" (f32.const infinity) (f32.const 0x1p-1)) (f32.const infinity)) -(assert_return (invoke "div" (f32.const -infinity) (f32.const -0x1p+0)) (f32.const infinity)) -(assert_return (invoke "div" (f32.const -infinity) (f32.const 0x1p+0)) (f32.const -infinity)) -(assert_return (invoke "div" (f32.const infinity) (f32.const -0x1p+0)) (f32.const -infinity)) -(assert_return (invoke "div" (f32.const infinity) (f32.const 0x1p+0)) (f32.const infinity)) -(assert_return (invoke "div" (f32.const -infinity) (f32.const -0x1.921fb6p+2)) (f32.const infinity)) -(assert_return (invoke "div" (f32.const -infinity) (f32.const 0x1.921fb6p+2)) (f32.const -infinity)) -(assert_return (invoke "div" (f32.const infinity) (f32.const -0x1.921fb6p+2)) (f32.const -infinity)) -(assert_return (invoke "div" (f32.const infinity) (f32.const 0x1.921fb6p+2)) (f32.const infinity)) -(assert_return (invoke "div" (f32.const -infinity) (f32.const -0x1.fffffep+127)) (f32.const infinity)) -(assert_return (invoke "div" (f32.const -infinity) (f32.const 0x1.fffffep+127)) (f32.const -infinity)) -(assert_return (invoke "div" (f32.const infinity) (f32.const -0x1.fffffep+127)) (f32.const -infinity)) -(assert_return (invoke "div" (f32.const infinity) (f32.const 0x1.fffffep+127)) (f32.const infinity)) -(assert_return_canonical_nan (invoke "div" (f32.const -infinity) (f32.const -infinity))) -(assert_return_canonical_nan (invoke "div" (f32.const -infinity) (f32.const infinity))) -(assert_return_canonical_nan (invoke "div" (f32.const infinity) (f32.const -infinity))) -(assert_return_canonical_nan (invoke "div" (f32.const infinity) (f32.const infinity))) -(assert_return_canonical_nan (invoke "div" (f32.const -infinity) (f32.const -nan))) -(assert_return_arithmetic_nan (invoke "div" (f32.const -infinity) (f32.const -nan:0x200000))) -(assert_return_canonical_nan (invoke "div" (f32.const -infinity) (f32.const nan))) -(assert_return_arithmetic_nan (invoke "div" (f32.const -infinity) (f32.const nan:0x200000))) -(assert_return_canonical_nan (invoke "div" (f32.const infinity) (f32.const -nan))) -(assert_return_arithmetic_nan (invoke "div" (f32.const infinity) (f32.const -nan:0x200000))) -(assert_return_canonical_nan (invoke "div" (f32.const infinity) (f32.const nan))) -(assert_return_arithmetic_nan (invoke "div" (f32.const infinity) (f32.const nan:0x200000))) +(assert_return (invoke "div" (f32.const -inf) (f32.const -0x0p+0)) (f32.const inf)) +(assert_return (invoke "div" (f32.const -inf) (f32.const 0x0p+0)) (f32.const -inf)) +(assert_return (invoke "div" (f32.const inf) (f32.const -0x0p+0)) (f32.const -inf)) +(assert_return (invoke "div" (f32.const inf) (f32.const 0x0p+0)) (f32.const inf)) +(assert_return (invoke "div" (f32.const -inf) (f32.const -0x1p-149)) (f32.const inf)) +(assert_return (invoke "div" (f32.const -inf) (f32.const 0x1p-149)) (f32.const -inf)) +(assert_return (invoke "div" (f32.const inf) (f32.const -0x1p-149)) (f32.const -inf)) +(assert_return (invoke "div" (f32.const inf) (f32.const 0x1p-149)) (f32.const inf)) +(assert_return (invoke "div" (f32.const -inf) (f32.const -0x1p-126)) (f32.const inf)) +(assert_return (invoke "div" (f32.const -inf) (f32.const 0x1p-126)) (f32.const -inf)) +(assert_return (invoke "div" (f32.const inf) (f32.const -0x1p-126)) (f32.const -inf)) +(assert_return (invoke "div" (f32.const inf) (f32.const 0x1p-126)) (f32.const inf)) +(assert_return (invoke "div" (f32.const -inf) (f32.const -0x1p-1)) (f32.const inf)) +(assert_return (invoke "div" (f32.const -inf) (f32.const 0x1p-1)) (f32.const -inf)) +(assert_return (invoke "div" (f32.const inf) (f32.const -0x1p-1)) (f32.const -inf)) +(assert_return (invoke "div" (f32.const inf) (f32.const 0x1p-1)) (f32.const inf)) +(assert_return (invoke "div" (f32.const -inf) (f32.const -0x1p+0)) (f32.const inf)) +(assert_return (invoke "div" (f32.const -inf) (f32.const 0x1p+0)) (f32.const -inf)) +(assert_return (invoke "div" (f32.const inf) (f32.const -0x1p+0)) (f32.const -inf)) +(assert_return (invoke "div" (f32.const inf) (f32.const 0x1p+0)) (f32.const inf)) +(assert_return (invoke "div" (f32.const -inf) (f32.const -0x1.921fb6p+2)) (f32.const inf)) +(assert_return (invoke "div" (f32.const -inf) (f32.const 0x1.921fb6p+2)) (f32.const -inf)) +(assert_return (invoke "div" (f32.const inf) (f32.const -0x1.921fb6p+2)) (f32.const -inf)) +(assert_return (invoke "div" (f32.const inf) (f32.const 0x1.921fb6p+2)) (f32.const inf)) +(assert_return (invoke "div" (f32.const -inf) (f32.const -0x1.fffffep+127)) (f32.const inf)) +(assert_return (invoke "div" (f32.const -inf) (f32.const 0x1.fffffep+127)) (f32.const -inf)) +(assert_return (invoke "div" (f32.const inf) (f32.const -0x1.fffffep+127)) (f32.const -inf)) +(assert_return (invoke "div" (f32.const inf) (f32.const 0x1.fffffep+127)) (f32.const inf)) +(assert_return_canonical_nan (invoke "div" (f32.const -inf) (f32.const -inf))) +(assert_return_canonical_nan (invoke "div" (f32.const -inf) (f32.const inf))) +(assert_return_canonical_nan (invoke "div" (f32.const inf) (f32.const -inf))) +(assert_return_canonical_nan (invoke "div" (f32.const inf) (f32.const inf))) +(assert_return_canonical_nan (invoke "div" (f32.const -inf) (f32.const -nan))) +(assert_return_arithmetic_nan (invoke "div" (f32.const -inf) (f32.const -nan:0x200000))) +(assert_return_canonical_nan (invoke "div" (f32.const -inf) (f32.const nan))) +(assert_return_arithmetic_nan (invoke "div" (f32.const -inf) (f32.const nan:0x200000))) +(assert_return_canonical_nan (invoke "div" (f32.const inf) (f32.const -nan))) +(assert_return_arithmetic_nan (invoke "div" (f32.const inf) (f32.const -nan:0x200000))) +(assert_return_canonical_nan (invoke "div" (f32.const inf) (f32.const nan))) +(assert_return_arithmetic_nan (invoke "div" (f32.const inf) (f32.const nan:0x200000))) (assert_return_canonical_nan (invoke "div" (f32.const -nan) (f32.const -0x0p+0))) (assert_return_arithmetic_nan (invoke "div" (f32.const -nan:0x200000) (f32.const -0x0p+0))) (assert_return_canonical_nan (invoke "div" (f32.const -nan) (f32.const 0x0p+0))) @@ -1592,14 +1592,14 @@ (assert_return_arithmetic_nan (invoke "div" (f32.const nan:0x200000) (f32.const -0x1.fffffep+127))) (assert_return_canonical_nan (invoke "div" (f32.const nan) (f32.const 0x1.fffffep+127))) (assert_return_arithmetic_nan (invoke "div" (f32.const nan:0x200000) (f32.const 0x1.fffffep+127))) -(assert_return_canonical_nan (invoke "div" (f32.const -nan) (f32.const -infinity))) -(assert_return_arithmetic_nan (invoke "div" (f32.const -nan:0x200000) (f32.const -infinity))) -(assert_return_canonical_nan (invoke "div" (f32.const -nan) (f32.const infinity))) -(assert_return_arithmetic_nan (invoke "div" (f32.const -nan:0x200000) (f32.const infinity))) -(assert_return_canonical_nan (invoke "div" (f32.const nan) (f32.const -infinity))) -(assert_return_arithmetic_nan (invoke "div" (f32.const nan:0x200000) (f32.const -infinity))) -(assert_return_canonical_nan (invoke "div" (f32.const nan) (f32.const infinity))) -(assert_return_arithmetic_nan (invoke "div" (f32.const nan:0x200000) (f32.const infinity))) +(assert_return_canonical_nan (invoke "div" (f32.const -nan) (f32.const -inf))) +(assert_return_arithmetic_nan (invoke "div" (f32.const -nan:0x200000) (f32.const -inf))) +(assert_return_canonical_nan (invoke "div" (f32.const -nan) (f32.const inf))) +(assert_return_arithmetic_nan (invoke "div" (f32.const -nan:0x200000) (f32.const inf))) +(assert_return_canonical_nan (invoke "div" (f32.const nan) (f32.const -inf))) +(assert_return_arithmetic_nan (invoke "div" (f32.const nan:0x200000) (f32.const -inf))) +(assert_return_canonical_nan (invoke "div" (f32.const nan) (f32.const inf))) +(assert_return_arithmetic_nan (invoke "div" (f32.const nan:0x200000) (f32.const inf))) (assert_return_canonical_nan (invoke "div" (f32.const -nan) (f32.const -nan))) (assert_return_arithmetic_nan (invoke "div" (f32.const -nan:0x200000) (f32.const -nan))) (assert_return_arithmetic_nan (invoke "div" (f32.const -nan) (f32.const -nan:0x200000))) @@ -1644,10 +1644,10 @@ (assert_return (invoke "min" (f32.const -0x0p+0) (f32.const 0x1.fffffep+127)) (f32.const -0x0p+0)) (assert_return (invoke "min" (f32.const 0x0p+0) (f32.const -0x1.fffffep+127)) (f32.const -0x1.fffffep+127)) (assert_return (invoke "min" (f32.const 0x0p+0) (f32.const 0x1.fffffep+127)) (f32.const 0x0p+0)) -(assert_return (invoke "min" (f32.const -0x0p+0) (f32.const -infinity)) (f32.const -infinity)) -(assert_return (invoke "min" (f32.const -0x0p+0) (f32.const infinity)) (f32.const -0x0p+0)) -(assert_return (invoke "min" (f32.const 0x0p+0) (f32.const -infinity)) (f32.const -infinity)) -(assert_return (invoke "min" (f32.const 0x0p+0) (f32.const infinity)) (f32.const 0x0p+0)) +(assert_return (invoke "min" (f32.const -0x0p+0) (f32.const -inf)) (f32.const -inf)) +(assert_return (invoke "min" (f32.const -0x0p+0) (f32.const inf)) (f32.const -0x0p+0)) +(assert_return (invoke "min" (f32.const 0x0p+0) (f32.const -inf)) (f32.const -inf)) +(assert_return (invoke "min" (f32.const 0x0p+0) (f32.const inf)) (f32.const 0x0p+0)) (assert_return_canonical_nan (invoke "min" (f32.const -0x0p+0) (f32.const -nan))) (assert_return_arithmetic_nan (invoke "min" (f32.const -0x0p+0) (f32.const -nan:0x200000))) (assert_return_canonical_nan (invoke "min" (f32.const -0x0p+0) (f32.const nan))) @@ -1684,10 +1684,10 @@ (assert_return (invoke "min" (f32.const -0x1p-149) (f32.const 0x1.fffffep+127)) (f32.const -0x1p-149)) (assert_return (invoke "min" (f32.const 0x1p-149) (f32.const -0x1.fffffep+127)) (f32.const -0x1.fffffep+127)) (assert_return (invoke "min" (f32.const 0x1p-149) (f32.const 0x1.fffffep+127)) (f32.const 0x1p-149)) -(assert_return (invoke "min" (f32.const -0x1p-149) (f32.const -infinity)) (f32.const -infinity)) -(assert_return (invoke "min" (f32.const -0x1p-149) (f32.const infinity)) (f32.const -0x1p-149)) -(assert_return (invoke "min" (f32.const 0x1p-149) (f32.const -infinity)) (f32.const -infinity)) -(assert_return (invoke "min" (f32.const 0x1p-149) (f32.const infinity)) (f32.const 0x1p-149)) +(assert_return (invoke "min" (f32.const -0x1p-149) (f32.const -inf)) (f32.const -inf)) +(assert_return (invoke "min" (f32.const -0x1p-149) (f32.const inf)) (f32.const -0x1p-149)) +(assert_return (invoke "min" (f32.const 0x1p-149) (f32.const -inf)) (f32.const -inf)) +(assert_return (invoke "min" (f32.const 0x1p-149) (f32.const inf)) (f32.const 0x1p-149)) (assert_return_canonical_nan (invoke "min" (f32.const -0x1p-149) (f32.const -nan))) (assert_return_arithmetic_nan (invoke "min" (f32.const -0x1p-149) (f32.const -nan:0x200000))) (assert_return_canonical_nan (invoke "min" (f32.const -0x1p-149) (f32.const nan))) @@ -1724,10 +1724,10 @@ (assert_return (invoke "min" (f32.const -0x1p-126) (f32.const 0x1.fffffep+127)) (f32.const -0x1p-126)) (assert_return (invoke "min" (f32.const 0x1p-126) (f32.const -0x1.fffffep+127)) (f32.const -0x1.fffffep+127)) (assert_return (invoke "min" (f32.const 0x1p-126) (f32.const 0x1.fffffep+127)) (f32.const 0x1p-126)) -(assert_return (invoke "min" (f32.const -0x1p-126) (f32.const -infinity)) (f32.const -infinity)) -(assert_return (invoke "min" (f32.const -0x1p-126) (f32.const infinity)) (f32.const -0x1p-126)) -(assert_return (invoke "min" (f32.const 0x1p-126) (f32.const -infinity)) (f32.const -infinity)) -(assert_return (invoke "min" (f32.const 0x1p-126) (f32.const infinity)) (f32.const 0x1p-126)) +(assert_return (invoke "min" (f32.const -0x1p-126) (f32.const -inf)) (f32.const -inf)) +(assert_return (invoke "min" (f32.const -0x1p-126) (f32.const inf)) (f32.const -0x1p-126)) +(assert_return (invoke "min" (f32.const 0x1p-126) (f32.const -inf)) (f32.const -inf)) +(assert_return (invoke "min" (f32.const 0x1p-126) (f32.const inf)) (f32.const 0x1p-126)) (assert_return_canonical_nan (invoke "min" (f32.const -0x1p-126) (f32.const -nan))) (assert_return_arithmetic_nan (invoke "min" (f32.const -0x1p-126) (f32.const -nan:0x200000))) (assert_return_canonical_nan (invoke "min" (f32.const -0x1p-126) (f32.const nan))) @@ -1764,10 +1764,10 @@ (assert_return (invoke "min" (f32.const -0x1p-1) (f32.const 0x1.fffffep+127)) (f32.const -0x1p-1)) (assert_return (invoke "min" (f32.const 0x1p-1) (f32.const -0x1.fffffep+127)) (f32.const -0x1.fffffep+127)) (assert_return (invoke "min" (f32.const 0x1p-1) (f32.const 0x1.fffffep+127)) (f32.const 0x1p-1)) -(assert_return (invoke "min" (f32.const -0x1p-1) (f32.const -infinity)) (f32.const -infinity)) -(assert_return (invoke "min" (f32.const -0x1p-1) (f32.const infinity)) (f32.const -0x1p-1)) -(assert_return (invoke "min" (f32.const 0x1p-1) (f32.const -infinity)) (f32.const -infinity)) -(assert_return (invoke "min" (f32.const 0x1p-1) (f32.const infinity)) (f32.const 0x1p-1)) +(assert_return (invoke "min" (f32.const -0x1p-1) (f32.const -inf)) (f32.const -inf)) +(assert_return (invoke "min" (f32.const -0x1p-1) (f32.const inf)) (f32.const -0x1p-1)) +(assert_return (invoke "min" (f32.const 0x1p-1) (f32.const -inf)) (f32.const -inf)) +(assert_return (invoke "min" (f32.const 0x1p-1) (f32.const inf)) (f32.const 0x1p-1)) (assert_return_canonical_nan (invoke "min" (f32.const -0x1p-1) (f32.const -nan))) (assert_return_arithmetic_nan (invoke "min" (f32.const -0x1p-1) (f32.const -nan:0x200000))) (assert_return_canonical_nan (invoke "min" (f32.const -0x1p-1) (f32.const nan))) @@ -1804,10 +1804,10 @@ (assert_return (invoke "min" (f32.const -0x1p+0) (f32.const 0x1.fffffep+127)) (f32.const -0x1p+0)) (assert_return (invoke "min" (f32.const 0x1p+0) (f32.const -0x1.fffffep+127)) (f32.const -0x1.fffffep+127)) (assert_return (invoke "min" (f32.const 0x1p+0) (f32.const 0x1.fffffep+127)) (f32.const 0x1p+0)) -(assert_return (invoke "min" (f32.const -0x1p+0) (f32.const -infinity)) (f32.const -infinity)) -(assert_return (invoke "min" (f32.const -0x1p+0) (f32.const infinity)) (f32.const -0x1p+0)) -(assert_return (invoke "min" (f32.const 0x1p+0) (f32.const -infinity)) (f32.const -infinity)) -(assert_return (invoke "min" (f32.const 0x1p+0) (f32.const infinity)) (f32.const 0x1p+0)) +(assert_return (invoke "min" (f32.const -0x1p+0) (f32.const -inf)) (f32.const -inf)) +(assert_return (invoke "min" (f32.const -0x1p+0) (f32.const inf)) (f32.const -0x1p+0)) +(assert_return (invoke "min" (f32.const 0x1p+0) (f32.const -inf)) (f32.const -inf)) +(assert_return (invoke "min" (f32.const 0x1p+0) (f32.const inf)) (f32.const 0x1p+0)) (assert_return_canonical_nan (invoke "min" (f32.const -0x1p+0) (f32.const -nan))) (assert_return_arithmetic_nan (invoke "min" (f32.const -0x1p+0) (f32.const -nan:0x200000))) (assert_return_canonical_nan (invoke "min" (f32.const -0x1p+0) (f32.const nan))) @@ -1844,10 +1844,10 @@ (assert_return (invoke "min" (f32.const -0x1.921fb6p+2) (f32.const 0x1.fffffep+127)) (f32.const -0x1.921fb6p+2)) (assert_return (invoke "min" (f32.const 0x1.921fb6p+2) (f32.const -0x1.fffffep+127)) (f32.const -0x1.fffffep+127)) (assert_return (invoke "min" (f32.const 0x1.921fb6p+2) (f32.const 0x1.fffffep+127)) (f32.const 0x1.921fb6p+2)) -(assert_return (invoke "min" (f32.const -0x1.921fb6p+2) (f32.const -infinity)) (f32.const -infinity)) -(assert_return (invoke "min" (f32.const -0x1.921fb6p+2) (f32.const infinity)) (f32.const -0x1.921fb6p+2)) -(assert_return (invoke "min" (f32.const 0x1.921fb6p+2) (f32.const -infinity)) (f32.const -infinity)) -(assert_return (invoke "min" (f32.const 0x1.921fb6p+2) (f32.const infinity)) (f32.const 0x1.921fb6p+2)) +(assert_return (invoke "min" (f32.const -0x1.921fb6p+2) (f32.const -inf)) (f32.const -inf)) +(assert_return (invoke "min" (f32.const -0x1.921fb6p+2) (f32.const inf)) (f32.const -0x1.921fb6p+2)) +(assert_return (invoke "min" (f32.const 0x1.921fb6p+2) (f32.const -inf)) (f32.const -inf)) +(assert_return (invoke "min" (f32.const 0x1.921fb6p+2) (f32.const inf)) (f32.const 0x1.921fb6p+2)) (assert_return_canonical_nan (invoke "min" (f32.const -0x1.921fb6p+2) (f32.const -nan))) (assert_return_arithmetic_nan (invoke "min" (f32.const -0x1.921fb6p+2) (f32.const -nan:0x200000))) (assert_return_canonical_nan (invoke "min" (f32.const -0x1.921fb6p+2) (f32.const nan))) @@ -1884,10 +1884,10 @@ (assert_return (invoke "min" (f32.const -0x1.fffffep+127) (f32.const 0x1.fffffep+127)) (f32.const -0x1.fffffep+127)) (assert_return (invoke "min" (f32.const 0x1.fffffep+127) (f32.const -0x1.fffffep+127)) (f32.const -0x1.fffffep+127)) (assert_return (invoke "min" (f32.const 0x1.fffffep+127) (f32.const 0x1.fffffep+127)) (f32.const 0x1.fffffep+127)) -(assert_return (invoke "min" (f32.const -0x1.fffffep+127) (f32.const -infinity)) (f32.const -infinity)) -(assert_return (invoke "min" (f32.const -0x1.fffffep+127) (f32.const infinity)) (f32.const -0x1.fffffep+127)) -(assert_return (invoke "min" (f32.const 0x1.fffffep+127) (f32.const -infinity)) (f32.const -infinity)) -(assert_return (invoke "min" (f32.const 0x1.fffffep+127) (f32.const infinity)) (f32.const 0x1.fffffep+127)) +(assert_return (invoke "min" (f32.const -0x1.fffffep+127) (f32.const -inf)) (f32.const -inf)) +(assert_return (invoke "min" (f32.const -0x1.fffffep+127) (f32.const inf)) (f32.const -0x1.fffffep+127)) +(assert_return (invoke "min" (f32.const 0x1.fffffep+127) (f32.const -inf)) (f32.const -inf)) +(assert_return (invoke "min" (f32.const 0x1.fffffep+127) (f32.const inf)) (f32.const 0x1.fffffep+127)) (assert_return_canonical_nan (invoke "min" (f32.const -0x1.fffffep+127) (f32.const -nan))) (assert_return_arithmetic_nan (invoke "min" (f32.const -0x1.fffffep+127) (f32.const -nan:0x200000))) (assert_return_canonical_nan (invoke "min" (f32.const -0x1.fffffep+127) (f32.const nan))) @@ -1896,46 +1896,46 @@ (assert_return_arithmetic_nan (invoke "min" (f32.const 0x1.fffffep+127) (f32.const -nan:0x200000))) (assert_return_canonical_nan (invoke "min" (f32.const 0x1.fffffep+127) (f32.const nan))) (assert_return_arithmetic_nan (invoke "min" (f32.const 0x1.fffffep+127) (f32.const nan:0x200000))) -(assert_return (invoke "min" (f32.const -infinity) (f32.const -0x0p+0)) (f32.const -infinity)) -(assert_return (invoke "min" (f32.const -infinity) (f32.const 0x0p+0)) (f32.const -infinity)) -(assert_return (invoke "min" (f32.const infinity) (f32.const -0x0p+0)) (f32.const -0x0p+0)) -(assert_return (invoke "min" (f32.const infinity) (f32.const 0x0p+0)) (f32.const 0x0p+0)) -(assert_return (invoke "min" (f32.const -infinity) (f32.const -0x1p-149)) (f32.const -infinity)) -(assert_return (invoke "min" (f32.const -infinity) (f32.const 0x1p-149)) (f32.const -infinity)) -(assert_return (invoke "min" (f32.const infinity) (f32.const -0x1p-149)) (f32.const -0x1p-149)) -(assert_return (invoke "min" (f32.const infinity) (f32.const 0x1p-149)) (f32.const 0x1p-149)) -(assert_return (invoke "min" (f32.const -infinity) (f32.const -0x1p-126)) (f32.const -infinity)) -(assert_return (invoke "min" (f32.const -infinity) (f32.const 0x1p-126)) (f32.const -infinity)) -(assert_return (invoke "min" (f32.const infinity) (f32.const -0x1p-126)) (f32.const -0x1p-126)) -(assert_return (invoke "min" (f32.const infinity) (f32.const 0x1p-126)) (f32.const 0x1p-126)) -(assert_return (invoke "min" (f32.const -infinity) (f32.const -0x1p-1)) (f32.const -infinity)) -(assert_return (invoke "min" (f32.const -infinity) (f32.const 0x1p-1)) (f32.const -infinity)) -(assert_return (invoke "min" (f32.const infinity) (f32.const -0x1p-1)) (f32.const -0x1p-1)) -(assert_return (invoke "min" (f32.const infinity) (f32.const 0x1p-1)) (f32.const 0x1p-1)) -(assert_return (invoke "min" (f32.const -infinity) (f32.const -0x1p+0)) (f32.const -infinity)) -(assert_return (invoke "min" (f32.const -infinity) (f32.const 0x1p+0)) (f32.const -infinity)) -(assert_return (invoke "min" (f32.const infinity) (f32.const -0x1p+0)) (f32.const -0x1p+0)) -(assert_return (invoke "min" (f32.const infinity) (f32.const 0x1p+0)) (f32.const 0x1p+0)) -(assert_return (invoke "min" (f32.const -infinity) (f32.const -0x1.921fb6p+2)) (f32.const -infinity)) -(assert_return (invoke "min" (f32.const -infinity) (f32.const 0x1.921fb6p+2)) (f32.const -infinity)) -(assert_return (invoke "min" (f32.const infinity) (f32.const -0x1.921fb6p+2)) (f32.const -0x1.921fb6p+2)) -(assert_return (invoke "min" (f32.const infinity) (f32.const 0x1.921fb6p+2)) (f32.const 0x1.921fb6p+2)) -(assert_return (invoke "min" (f32.const -infinity) (f32.const -0x1.fffffep+127)) (f32.const -infinity)) -(assert_return (invoke "min" (f32.const -infinity) (f32.const 0x1.fffffep+127)) (f32.const -infinity)) -(assert_return (invoke "min" (f32.const infinity) (f32.const -0x1.fffffep+127)) (f32.const -0x1.fffffep+127)) -(assert_return (invoke "min" (f32.const infinity) (f32.const 0x1.fffffep+127)) (f32.const 0x1.fffffep+127)) -(assert_return (invoke "min" (f32.const -infinity) (f32.const -infinity)) (f32.const -infinity)) -(assert_return (invoke "min" (f32.const -infinity) (f32.const infinity)) (f32.const -infinity)) -(assert_return (invoke "min" (f32.const infinity) (f32.const -infinity)) (f32.const -infinity)) -(assert_return (invoke "min" (f32.const infinity) (f32.const infinity)) (f32.const infinity)) -(assert_return_canonical_nan (invoke "min" (f32.const -infinity) (f32.const -nan))) -(assert_return_arithmetic_nan (invoke "min" (f32.const -infinity) (f32.const -nan:0x200000))) -(assert_return_canonical_nan (invoke "min" (f32.const -infinity) (f32.const nan))) -(assert_return_arithmetic_nan (invoke "min" (f32.const -infinity) (f32.const nan:0x200000))) -(assert_return_canonical_nan (invoke "min" (f32.const infinity) (f32.const -nan))) -(assert_return_arithmetic_nan (invoke "min" (f32.const infinity) (f32.const -nan:0x200000))) -(assert_return_canonical_nan (invoke "min" (f32.const infinity) (f32.const nan))) -(assert_return_arithmetic_nan (invoke "min" (f32.const infinity) (f32.const nan:0x200000))) +(assert_return (invoke "min" (f32.const -inf) (f32.const -0x0p+0)) (f32.const -inf)) +(assert_return (invoke "min" (f32.const -inf) (f32.const 0x0p+0)) (f32.const -inf)) +(assert_return (invoke "min" (f32.const inf) (f32.const -0x0p+0)) (f32.const -0x0p+0)) +(assert_return (invoke "min" (f32.const inf) (f32.const 0x0p+0)) (f32.const 0x0p+0)) +(assert_return (invoke "min" (f32.const -inf) (f32.const -0x1p-149)) (f32.const -inf)) +(assert_return (invoke "min" (f32.const -inf) (f32.const 0x1p-149)) (f32.const -inf)) +(assert_return (invoke "min" (f32.const inf) (f32.const -0x1p-149)) (f32.const -0x1p-149)) +(assert_return (invoke "min" (f32.const inf) (f32.const 0x1p-149)) (f32.const 0x1p-149)) +(assert_return (invoke "min" (f32.const -inf) (f32.const -0x1p-126)) (f32.const -inf)) +(assert_return (invoke "min" (f32.const -inf) (f32.const 0x1p-126)) (f32.const -inf)) +(assert_return (invoke "min" (f32.const inf) (f32.const -0x1p-126)) (f32.const -0x1p-126)) +(assert_return (invoke "min" (f32.const inf) (f32.const 0x1p-126)) (f32.const 0x1p-126)) +(assert_return (invoke "min" (f32.const -inf) (f32.const -0x1p-1)) (f32.const -inf)) +(assert_return (invoke "min" (f32.const -inf) (f32.const 0x1p-1)) (f32.const -inf)) +(assert_return (invoke "min" (f32.const inf) (f32.const -0x1p-1)) (f32.const -0x1p-1)) +(assert_return (invoke "min" (f32.const inf) (f32.const 0x1p-1)) (f32.const 0x1p-1)) +(assert_return (invoke "min" (f32.const -inf) (f32.const -0x1p+0)) (f32.const -inf)) +(assert_return (invoke "min" (f32.const -inf) (f32.const 0x1p+0)) (f32.const -inf)) +(assert_return (invoke "min" (f32.const inf) (f32.const -0x1p+0)) (f32.const -0x1p+0)) +(assert_return (invoke "min" (f32.const inf) (f32.const 0x1p+0)) (f32.const 0x1p+0)) +(assert_return (invoke "min" (f32.const -inf) (f32.const -0x1.921fb6p+2)) (f32.const -inf)) +(assert_return (invoke "min" (f32.const -inf) (f32.const 0x1.921fb6p+2)) (f32.const -inf)) +(assert_return (invoke "min" (f32.const inf) (f32.const -0x1.921fb6p+2)) (f32.const -0x1.921fb6p+2)) +(assert_return (invoke "min" (f32.const inf) (f32.const 0x1.921fb6p+2)) (f32.const 0x1.921fb6p+2)) +(assert_return (invoke "min" (f32.const -inf) (f32.const -0x1.fffffep+127)) (f32.const -inf)) +(assert_return (invoke "min" (f32.const -inf) (f32.const 0x1.fffffep+127)) (f32.const -inf)) +(assert_return (invoke "min" (f32.const inf) (f32.const -0x1.fffffep+127)) (f32.const -0x1.fffffep+127)) +(assert_return (invoke "min" (f32.const inf) (f32.const 0x1.fffffep+127)) (f32.const 0x1.fffffep+127)) +(assert_return (invoke "min" (f32.const -inf) (f32.const -inf)) (f32.const -inf)) +(assert_return (invoke "min" (f32.const -inf) (f32.const inf)) (f32.const -inf)) +(assert_return (invoke "min" (f32.const inf) (f32.const -inf)) (f32.const -inf)) +(assert_return (invoke "min" (f32.const inf) (f32.const inf)) (f32.const inf)) +(assert_return_canonical_nan (invoke "min" (f32.const -inf) (f32.const -nan))) +(assert_return_arithmetic_nan (invoke "min" (f32.const -inf) (f32.const -nan:0x200000))) +(assert_return_canonical_nan (invoke "min" (f32.const -inf) (f32.const nan))) +(assert_return_arithmetic_nan (invoke "min" (f32.const -inf) (f32.const nan:0x200000))) +(assert_return_canonical_nan (invoke "min" (f32.const inf) (f32.const -nan))) +(assert_return_arithmetic_nan (invoke "min" (f32.const inf) (f32.const -nan:0x200000))) +(assert_return_canonical_nan (invoke "min" (f32.const inf) (f32.const nan))) +(assert_return_arithmetic_nan (invoke "min" (f32.const inf) (f32.const nan:0x200000))) (assert_return_canonical_nan (invoke "min" (f32.const -nan) (f32.const -0x0p+0))) (assert_return_arithmetic_nan (invoke "min" (f32.const -nan:0x200000) (f32.const -0x0p+0))) (assert_return_canonical_nan (invoke "min" (f32.const -nan) (f32.const 0x0p+0))) @@ -1992,14 +1992,14 @@ (assert_return_arithmetic_nan (invoke "min" (f32.const nan:0x200000) (f32.const -0x1.fffffep+127))) (assert_return_canonical_nan (invoke "min" (f32.const nan) (f32.const 0x1.fffffep+127))) (assert_return_arithmetic_nan (invoke "min" (f32.const nan:0x200000) (f32.const 0x1.fffffep+127))) -(assert_return_canonical_nan (invoke "min" (f32.const -nan) (f32.const -infinity))) -(assert_return_arithmetic_nan (invoke "min" (f32.const -nan:0x200000) (f32.const -infinity))) -(assert_return_canonical_nan (invoke "min" (f32.const -nan) (f32.const infinity))) -(assert_return_arithmetic_nan (invoke "min" (f32.const -nan:0x200000) (f32.const infinity))) -(assert_return_canonical_nan (invoke "min" (f32.const nan) (f32.const -infinity))) -(assert_return_arithmetic_nan (invoke "min" (f32.const nan:0x200000) (f32.const -infinity))) -(assert_return_canonical_nan (invoke "min" (f32.const nan) (f32.const infinity))) -(assert_return_arithmetic_nan (invoke "min" (f32.const nan:0x200000) (f32.const infinity))) +(assert_return_canonical_nan (invoke "min" (f32.const -nan) (f32.const -inf))) +(assert_return_arithmetic_nan (invoke "min" (f32.const -nan:0x200000) (f32.const -inf))) +(assert_return_canonical_nan (invoke "min" (f32.const -nan) (f32.const inf))) +(assert_return_arithmetic_nan (invoke "min" (f32.const -nan:0x200000) (f32.const inf))) +(assert_return_canonical_nan (invoke "min" (f32.const nan) (f32.const -inf))) +(assert_return_arithmetic_nan (invoke "min" (f32.const nan:0x200000) (f32.const -inf))) +(assert_return_canonical_nan (invoke "min" (f32.const nan) (f32.const inf))) +(assert_return_arithmetic_nan (invoke "min" (f32.const nan:0x200000) (f32.const inf))) (assert_return_canonical_nan (invoke "min" (f32.const -nan) (f32.const -nan))) (assert_return_arithmetic_nan (invoke "min" (f32.const -nan:0x200000) (f32.const -nan))) (assert_return_arithmetic_nan (invoke "min" (f32.const -nan) (f32.const -nan:0x200000))) @@ -2044,10 +2044,10 @@ (assert_return (invoke "max" (f32.const -0x0p+0) (f32.const 0x1.fffffep+127)) (f32.const 0x1.fffffep+127)) (assert_return (invoke "max" (f32.const 0x0p+0) (f32.const -0x1.fffffep+127)) (f32.const 0x0p+0)) (assert_return (invoke "max" (f32.const 0x0p+0) (f32.const 0x1.fffffep+127)) (f32.const 0x1.fffffep+127)) -(assert_return (invoke "max" (f32.const -0x0p+0) (f32.const -infinity)) (f32.const -0x0p+0)) -(assert_return (invoke "max" (f32.const -0x0p+0) (f32.const infinity)) (f32.const infinity)) -(assert_return (invoke "max" (f32.const 0x0p+0) (f32.const -infinity)) (f32.const 0x0p+0)) -(assert_return (invoke "max" (f32.const 0x0p+0) (f32.const infinity)) (f32.const infinity)) +(assert_return (invoke "max" (f32.const -0x0p+0) (f32.const -inf)) (f32.const -0x0p+0)) +(assert_return (invoke "max" (f32.const -0x0p+0) (f32.const inf)) (f32.const inf)) +(assert_return (invoke "max" (f32.const 0x0p+0) (f32.const -inf)) (f32.const 0x0p+0)) +(assert_return (invoke "max" (f32.const 0x0p+0) (f32.const inf)) (f32.const inf)) (assert_return_canonical_nan (invoke "max" (f32.const -0x0p+0) (f32.const -nan))) (assert_return_arithmetic_nan (invoke "max" (f32.const -0x0p+0) (f32.const -nan:0x200000))) (assert_return_canonical_nan (invoke "max" (f32.const -0x0p+0) (f32.const nan))) @@ -2084,10 +2084,10 @@ (assert_return (invoke "max" (f32.const -0x1p-149) (f32.const 0x1.fffffep+127)) (f32.const 0x1.fffffep+127)) (assert_return (invoke "max" (f32.const 0x1p-149) (f32.const -0x1.fffffep+127)) (f32.const 0x1p-149)) (assert_return (invoke "max" (f32.const 0x1p-149) (f32.const 0x1.fffffep+127)) (f32.const 0x1.fffffep+127)) -(assert_return (invoke "max" (f32.const -0x1p-149) (f32.const -infinity)) (f32.const -0x1p-149)) -(assert_return (invoke "max" (f32.const -0x1p-149) (f32.const infinity)) (f32.const infinity)) -(assert_return (invoke "max" (f32.const 0x1p-149) (f32.const -infinity)) (f32.const 0x1p-149)) -(assert_return (invoke "max" (f32.const 0x1p-149) (f32.const infinity)) (f32.const infinity)) +(assert_return (invoke "max" (f32.const -0x1p-149) (f32.const -inf)) (f32.const -0x1p-149)) +(assert_return (invoke "max" (f32.const -0x1p-149) (f32.const inf)) (f32.const inf)) +(assert_return (invoke "max" (f32.const 0x1p-149) (f32.const -inf)) (f32.const 0x1p-149)) +(assert_return (invoke "max" (f32.const 0x1p-149) (f32.const inf)) (f32.const inf)) (assert_return_canonical_nan (invoke "max" (f32.const -0x1p-149) (f32.const -nan))) (assert_return_arithmetic_nan (invoke "max" (f32.const -0x1p-149) (f32.const -nan:0x200000))) (assert_return_canonical_nan (invoke "max" (f32.const -0x1p-149) (f32.const nan))) @@ -2124,10 +2124,10 @@ (assert_return (invoke "max" (f32.const -0x1p-126) (f32.const 0x1.fffffep+127)) (f32.const 0x1.fffffep+127)) (assert_return (invoke "max" (f32.const 0x1p-126) (f32.const -0x1.fffffep+127)) (f32.const 0x1p-126)) (assert_return (invoke "max" (f32.const 0x1p-126) (f32.const 0x1.fffffep+127)) (f32.const 0x1.fffffep+127)) -(assert_return (invoke "max" (f32.const -0x1p-126) (f32.const -infinity)) (f32.const -0x1p-126)) -(assert_return (invoke "max" (f32.const -0x1p-126) (f32.const infinity)) (f32.const infinity)) -(assert_return (invoke "max" (f32.const 0x1p-126) (f32.const -infinity)) (f32.const 0x1p-126)) -(assert_return (invoke "max" (f32.const 0x1p-126) (f32.const infinity)) (f32.const infinity)) +(assert_return (invoke "max" (f32.const -0x1p-126) (f32.const -inf)) (f32.const -0x1p-126)) +(assert_return (invoke "max" (f32.const -0x1p-126) (f32.const inf)) (f32.const inf)) +(assert_return (invoke "max" (f32.const 0x1p-126) (f32.const -inf)) (f32.const 0x1p-126)) +(assert_return (invoke "max" (f32.const 0x1p-126) (f32.const inf)) (f32.const inf)) (assert_return_canonical_nan (invoke "max" (f32.const -0x1p-126) (f32.const -nan))) (assert_return_arithmetic_nan (invoke "max" (f32.const -0x1p-126) (f32.const -nan:0x200000))) (assert_return_canonical_nan (invoke "max" (f32.const -0x1p-126) (f32.const nan))) @@ -2164,10 +2164,10 @@ (assert_return (invoke "max" (f32.const -0x1p-1) (f32.const 0x1.fffffep+127)) (f32.const 0x1.fffffep+127)) (assert_return (invoke "max" (f32.const 0x1p-1) (f32.const -0x1.fffffep+127)) (f32.const 0x1p-1)) (assert_return (invoke "max" (f32.const 0x1p-1) (f32.const 0x1.fffffep+127)) (f32.const 0x1.fffffep+127)) -(assert_return (invoke "max" (f32.const -0x1p-1) (f32.const -infinity)) (f32.const -0x1p-1)) -(assert_return (invoke "max" (f32.const -0x1p-1) (f32.const infinity)) (f32.const infinity)) -(assert_return (invoke "max" (f32.const 0x1p-1) (f32.const -infinity)) (f32.const 0x1p-1)) -(assert_return (invoke "max" (f32.const 0x1p-1) (f32.const infinity)) (f32.const infinity)) +(assert_return (invoke "max" (f32.const -0x1p-1) (f32.const -inf)) (f32.const -0x1p-1)) +(assert_return (invoke "max" (f32.const -0x1p-1) (f32.const inf)) (f32.const inf)) +(assert_return (invoke "max" (f32.const 0x1p-1) (f32.const -inf)) (f32.const 0x1p-1)) +(assert_return (invoke "max" (f32.const 0x1p-1) (f32.const inf)) (f32.const inf)) (assert_return_canonical_nan (invoke "max" (f32.const -0x1p-1) (f32.const -nan))) (assert_return_arithmetic_nan (invoke "max" (f32.const -0x1p-1) (f32.const -nan:0x200000))) (assert_return_canonical_nan (invoke "max" (f32.const -0x1p-1) (f32.const nan))) @@ -2204,10 +2204,10 @@ (assert_return (invoke "max" (f32.const -0x1p+0) (f32.const 0x1.fffffep+127)) (f32.const 0x1.fffffep+127)) (assert_return (invoke "max" (f32.const 0x1p+0) (f32.const -0x1.fffffep+127)) (f32.const 0x1p+0)) (assert_return (invoke "max" (f32.const 0x1p+0) (f32.const 0x1.fffffep+127)) (f32.const 0x1.fffffep+127)) -(assert_return (invoke "max" (f32.const -0x1p+0) (f32.const -infinity)) (f32.const -0x1p+0)) -(assert_return (invoke "max" (f32.const -0x1p+0) (f32.const infinity)) (f32.const infinity)) -(assert_return (invoke "max" (f32.const 0x1p+0) (f32.const -infinity)) (f32.const 0x1p+0)) -(assert_return (invoke "max" (f32.const 0x1p+0) (f32.const infinity)) (f32.const infinity)) +(assert_return (invoke "max" (f32.const -0x1p+0) (f32.const -inf)) (f32.const -0x1p+0)) +(assert_return (invoke "max" (f32.const -0x1p+0) (f32.const inf)) (f32.const inf)) +(assert_return (invoke "max" (f32.const 0x1p+0) (f32.const -inf)) (f32.const 0x1p+0)) +(assert_return (invoke "max" (f32.const 0x1p+0) (f32.const inf)) (f32.const inf)) (assert_return_canonical_nan (invoke "max" (f32.const -0x1p+0) (f32.const -nan))) (assert_return_arithmetic_nan (invoke "max" (f32.const -0x1p+0) (f32.const -nan:0x200000))) (assert_return_canonical_nan (invoke "max" (f32.const -0x1p+0) (f32.const nan))) @@ -2244,10 +2244,10 @@ (assert_return (invoke "max" (f32.const -0x1.921fb6p+2) (f32.const 0x1.fffffep+127)) (f32.const 0x1.fffffep+127)) (assert_return (invoke "max" (f32.const 0x1.921fb6p+2) (f32.const -0x1.fffffep+127)) (f32.const 0x1.921fb6p+2)) (assert_return (invoke "max" (f32.const 0x1.921fb6p+2) (f32.const 0x1.fffffep+127)) (f32.const 0x1.fffffep+127)) -(assert_return (invoke "max" (f32.const -0x1.921fb6p+2) (f32.const -infinity)) (f32.const -0x1.921fb6p+2)) -(assert_return (invoke "max" (f32.const -0x1.921fb6p+2) (f32.const infinity)) (f32.const infinity)) -(assert_return (invoke "max" (f32.const 0x1.921fb6p+2) (f32.const -infinity)) (f32.const 0x1.921fb6p+2)) -(assert_return (invoke "max" (f32.const 0x1.921fb6p+2) (f32.const infinity)) (f32.const infinity)) +(assert_return (invoke "max" (f32.const -0x1.921fb6p+2) (f32.const -inf)) (f32.const -0x1.921fb6p+2)) +(assert_return (invoke "max" (f32.const -0x1.921fb6p+2) (f32.const inf)) (f32.const inf)) +(assert_return (invoke "max" (f32.const 0x1.921fb6p+2) (f32.const -inf)) (f32.const 0x1.921fb6p+2)) +(assert_return (invoke "max" (f32.const 0x1.921fb6p+2) (f32.const inf)) (f32.const inf)) (assert_return_canonical_nan (invoke "max" (f32.const -0x1.921fb6p+2) (f32.const -nan))) (assert_return_arithmetic_nan (invoke "max" (f32.const -0x1.921fb6p+2) (f32.const -nan:0x200000))) (assert_return_canonical_nan (invoke "max" (f32.const -0x1.921fb6p+2) (f32.const nan))) @@ -2284,10 +2284,10 @@ (assert_return (invoke "max" (f32.const -0x1.fffffep+127) (f32.const 0x1.fffffep+127)) (f32.const 0x1.fffffep+127)) (assert_return (invoke "max" (f32.const 0x1.fffffep+127) (f32.const -0x1.fffffep+127)) (f32.const 0x1.fffffep+127)) (assert_return (invoke "max" (f32.const 0x1.fffffep+127) (f32.const 0x1.fffffep+127)) (f32.const 0x1.fffffep+127)) -(assert_return (invoke "max" (f32.const -0x1.fffffep+127) (f32.const -infinity)) (f32.const -0x1.fffffep+127)) -(assert_return (invoke "max" (f32.const -0x1.fffffep+127) (f32.const infinity)) (f32.const infinity)) -(assert_return (invoke "max" (f32.const 0x1.fffffep+127) (f32.const -infinity)) (f32.const 0x1.fffffep+127)) -(assert_return (invoke "max" (f32.const 0x1.fffffep+127) (f32.const infinity)) (f32.const infinity)) +(assert_return (invoke "max" (f32.const -0x1.fffffep+127) (f32.const -inf)) (f32.const -0x1.fffffep+127)) +(assert_return (invoke "max" (f32.const -0x1.fffffep+127) (f32.const inf)) (f32.const inf)) +(assert_return (invoke "max" (f32.const 0x1.fffffep+127) (f32.const -inf)) (f32.const 0x1.fffffep+127)) +(assert_return (invoke "max" (f32.const 0x1.fffffep+127) (f32.const inf)) (f32.const inf)) (assert_return_canonical_nan (invoke "max" (f32.const -0x1.fffffep+127) (f32.const -nan))) (assert_return_arithmetic_nan (invoke "max" (f32.const -0x1.fffffep+127) (f32.const -nan:0x200000))) (assert_return_canonical_nan (invoke "max" (f32.const -0x1.fffffep+127) (f32.const nan))) @@ -2296,46 +2296,46 @@ (assert_return_arithmetic_nan (invoke "max" (f32.const 0x1.fffffep+127) (f32.const -nan:0x200000))) (assert_return_canonical_nan (invoke "max" (f32.const 0x1.fffffep+127) (f32.const nan))) (assert_return_arithmetic_nan (invoke "max" (f32.const 0x1.fffffep+127) (f32.const nan:0x200000))) -(assert_return (invoke "max" (f32.const -infinity) (f32.const -0x0p+0)) (f32.const -0x0p+0)) -(assert_return (invoke "max" (f32.const -infinity) (f32.const 0x0p+0)) (f32.const 0x0p+0)) -(assert_return (invoke "max" (f32.const infinity) (f32.const -0x0p+0)) (f32.const infinity)) -(assert_return (invoke "max" (f32.const infinity) (f32.const 0x0p+0)) (f32.const infinity)) -(assert_return (invoke "max" (f32.const -infinity) (f32.const -0x1p-149)) (f32.const -0x1p-149)) -(assert_return (invoke "max" (f32.const -infinity) (f32.const 0x1p-149)) (f32.const 0x1p-149)) -(assert_return (invoke "max" (f32.const infinity) (f32.const -0x1p-149)) (f32.const infinity)) -(assert_return (invoke "max" (f32.const infinity) (f32.const 0x1p-149)) (f32.const infinity)) -(assert_return (invoke "max" (f32.const -infinity) (f32.const -0x1p-126)) (f32.const -0x1p-126)) -(assert_return (invoke "max" (f32.const -infinity) (f32.const 0x1p-126)) (f32.const 0x1p-126)) -(assert_return (invoke "max" (f32.const infinity) (f32.const -0x1p-126)) (f32.const infinity)) -(assert_return (invoke "max" (f32.const infinity) (f32.const 0x1p-126)) (f32.const infinity)) -(assert_return (invoke "max" (f32.const -infinity) (f32.const -0x1p-1)) (f32.const -0x1p-1)) -(assert_return (invoke "max" (f32.const -infinity) (f32.const 0x1p-1)) (f32.const 0x1p-1)) -(assert_return (invoke "max" (f32.const infinity) (f32.const -0x1p-1)) (f32.const infinity)) -(assert_return (invoke "max" (f32.const infinity) (f32.const 0x1p-1)) (f32.const infinity)) -(assert_return (invoke "max" (f32.const -infinity) (f32.const -0x1p+0)) (f32.const -0x1p+0)) -(assert_return (invoke "max" (f32.const -infinity) (f32.const 0x1p+0)) (f32.const 0x1p+0)) -(assert_return (invoke "max" (f32.const infinity) (f32.const -0x1p+0)) (f32.const infinity)) -(assert_return (invoke "max" (f32.const infinity) (f32.const 0x1p+0)) (f32.const infinity)) -(assert_return (invoke "max" (f32.const -infinity) (f32.const -0x1.921fb6p+2)) (f32.const -0x1.921fb6p+2)) -(assert_return (invoke "max" (f32.const -infinity) (f32.const 0x1.921fb6p+2)) (f32.const 0x1.921fb6p+2)) -(assert_return (invoke "max" (f32.const infinity) (f32.const -0x1.921fb6p+2)) (f32.const infinity)) -(assert_return (invoke "max" (f32.const infinity) (f32.const 0x1.921fb6p+2)) (f32.const infinity)) -(assert_return (invoke "max" (f32.const -infinity) (f32.const -0x1.fffffep+127)) (f32.const -0x1.fffffep+127)) -(assert_return (invoke "max" (f32.const -infinity) (f32.const 0x1.fffffep+127)) (f32.const 0x1.fffffep+127)) -(assert_return (invoke "max" (f32.const infinity) (f32.const -0x1.fffffep+127)) (f32.const infinity)) -(assert_return (invoke "max" (f32.const infinity) (f32.const 0x1.fffffep+127)) (f32.const infinity)) -(assert_return (invoke "max" (f32.const -infinity) (f32.const -infinity)) (f32.const -infinity)) -(assert_return (invoke "max" (f32.const -infinity) (f32.const infinity)) (f32.const infinity)) -(assert_return (invoke "max" (f32.const infinity) (f32.const -infinity)) (f32.const infinity)) -(assert_return (invoke "max" (f32.const infinity) (f32.const infinity)) (f32.const infinity)) -(assert_return_canonical_nan (invoke "max" (f32.const -infinity) (f32.const -nan))) -(assert_return_arithmetic_nan (invoke "max" (f32.const -infinity) (f32.const -nan:0x200000))) -(assert_return_canonical_nan (invoke "max" (f32.const -infinity) (f32.const nan))) -(assert_return_arithmetic_nan (invoke "max" (f32.const -infinity) (f32.const nan:0x200000))) -(assert_return_canonical_nan (invoke "max" (f32.const infinity) (f32.const -nan))) -(assert_return_arithmetic_nan (invoke "max" (f32.const infinity) (f32.const -nan:0x200000))) -(assert_return_canonical_nan (invoke "max" (f32.const infinity) (f32.const nan))) -(assert_return_arithmetic_nan (invoke "max" (f32.const infinity) (f32.const nan:0x200000))) +(assert_return (invoke "max" (f32.const -inf) (f32.const -0x0p+0)) (f32.const -0x0p+0)) +(assert_return (invoke "max" (f32.const -inf) (f32.const 0x0p+0)) (f32.const 0x0p+0)) +(assert_return (invoke "max" (f32.const inf) (f32.const -0x0p+0)) (f32.const inf)) +(assert_return (invoke "max" (f32.const inf) (f32.const 0x0p+0)) (f32.const inf)) +(assert_return (invoke "max" (f32.const -inf) (f32.const -0x1p-149)) (f32.const -0x1p-149)) +(assert_return (invoke "max" (f32.const -inf) (f32.const 0x1p-149)) (f32.const 0x1p-149)) +(assert_return (invoke "max" (f32.const inf) (f32.const -0x1p-149)) (f32.const inf)) +(assert_return (invoke "max" (f32.const inf) (f32.const 0x1p-149)) (f32.const inf)) +(assert_return (invoke "max" (f32.const -inf) (f32.const -0x1p-126)) (f32.const -0x1p-126)) +(assert_return (invoke "max" (f32.const -inf) (f32.const 0x1p-126)) (f32.const 0x1p-126)) +(assert_return (invoke "max" (f32.const inf) (f32.const -0x1p-126)) (f32.const inf)) +(assert_return (invoke "max" (f32.const inf) (f32.const 0x1p-126)) (f32.const inf)) +(assert_return (invoke "max" (f32.const -inf) (f32.const -0x1p-1)) (f32.const -0x1p-1)) +(assert_return (invoke "max" (f32.const -inf) (f32.const 0x1p-1)) (f32.const 0x1p-1)) +(assert_return (invoke "max" (f32.const inf) (f32.const -0x1p-1)) (f32.const inf)) +(assert_return (invoke "max" (f32.const inf) (f32.const 0x1p-1)) (f32.const inf)) +(assert_return (invoke "max" (f32.const -inf) (f32.const -0x1p+0)) (f32.const -0x1p+0)) +(assert_return (invoke "max" (f32.const -inf) (f32.const 0x1p+0)) (f32.const 0x1p+0)) +(assert_return (invoke "max" (f32.const inf) (f32.const -0x1p+0)) (f32.const inf)) +(assert_return (invoke "max" (f32.const inf) (f32.const 0x1p+0)) (f32.const inf)) +(assert_return (invoke "max" (f32.const -inf) (f32.const -0x1.921fb6p+2)) (f32.const -0x1.921fb6p+2)) +(assert_return (invoke "max" (f32.const -inf) (f32.const 0x1.921fb6p+2)) (f32.const 0x1.921fb6p+2)) +(assert_return (invoke "max" (f32.const inf) (f32.const -0x1.921fb6p+2)) (f32.const inf)) +(assert_return (invoke "max" (f32.const inf) (f32.const 0x1.921fb6p+2)) (f32.const inf)) +(assert_return (invoke "max" (f32.const -inf) (f32.const -0x1.fffffep+127)) (f32.const -0x1.fffffep+127)) +(assert_return (invoke "max" (f32.const -inf) (f32.const 0x1.fffffep+127)) (f32.const 0x1.fffffep+127)) +(assert_return (invoke "max" (f32.const inf) (f32.const -0x1.fffffep+127)) (f32.const inf)) +(assert_return (invoke "max" (f32.const inf) (f32.const 0x1.fffffep+127)) (f32.const inf)) +(assert_return (invoke "max" (f32.const -inf) (f32.const -inf)) (f32.const -inf)) +(assert_return (invoke "max" (f32.const -inf) (f32.const inf)) (f32.const inf)) +(assert_return (invoke "max" (f32.const inf) (f32.const -inf)) (f32.const inf)) +(assert_return (invoke "max" (f32.const inf) (f32.const inf)) (f32.const inf)) +(assert_return_canonical_nan (invoke "max" (f32.const -inf) (f32.const -nan))) +(assert_return_arithmetic_nan (invoke "max" (f32.const -inf) (f32.const -nan:0x200000))) +(assert_return_canonical_nan (invoke "max" (f32.const -inf) (f32.const nan))) +(assert_return_arithmetic_nan (invoke "max" (f32.const -inf) (f32.const nan:0x200000))) +(assert_return_canonical_nan (invoke "max" (f32.const inf) (f32.const -nan))) +(assert_return_arithmetic_nan (invoke "max" (f32.const inf) (f32.const -nan:0x200000))) +(assert_return_canonical_nan (invoke "max" (f32.const inf) (f32.const nan))) +(assert_return_arithmetic_nan (invoke "max" (f32.const inf) (f32.const nan:0x200000))) (assert_return_canonical_nan (invoke "max" (f32.const -nan) (f32.const -0x0p+0))) (assert_return_arithmetic_nan (invoke "max" (f32.const -nan:0x200000) (f32.const -0x0p+0))) (assert_return_canonical_nan (invoke "max" (f32.const -nan) (f32.const 0x0p+0))) @@ -2392,14 +2392,14 @@ (assert_return_arithmetic_nan (invoke "max" (f32.const nan:0x200000) (f32.const -0x1.fffffep+127))) (assert_return_canonical_nan (invoke "max" (f32.const nan) (f32.const 0x1.fffffep+127))) (assert_return_arithmetic_nan (invoke "max" (f32.const nan:0x200000) (f32.const 0x1.fffffep+127))) -(assert_return_canonical_nan (invoke "max" (f32.const -nan) (f32.const -infinity))) -(assert_return_arithmetic_nan (invoke "max" (f32.const -nan:0x200000) (f32.const -infinity))) -(assert_return_canonical_nan (invoke "max" (f32.const -nan) (f32.const infinity))) -(assert_return_arithmetic_nan (invoke "max" (f32.const -nan:0x200000) (f32.const infinity))) -(assert_return_canonical_nan (invoke "max" (f32.const nan) (f32.const -infinity))) -(assert_return_arithmetic_nan (invoke "max" (f32.const nan:0x200000) (f32.const -infinity))) -(assert_return_canonical_nan (invoke "max" (f32.const nan) (f32.const infinity))) -(assert_return_arithmetic_nan (invoke "max" (f32.const nan:0x200000) (f32.const infinity))) +(assert_return_canonical_nan (invoke "max" (f32.const -nan) (f32.const -inf))) +(assert_return_arithmetic_nan (invoke "max" (f32.const -nan:0x200000) (f32.const -inf))) +(assert_return_canonical_nan (invoke "max" (f32.const -nan) (f32.const inf))) +(assert_return_arithmetic_nan (invoke "max" (f32.const -nan:0x200000) (f32.const inf))) +(assert_return_canonical_nan (invoke "max" (f32.const nan) (f32.const -inf))) +(assert_return_arithmetic_nan (invoke "max" (f32.const nan:0x200000) (f32.const -inf))) +(assert_return_canonical_nan (invoke "max" (f32.const nan) (f32.const inf))) +(assert_return_arithmetic_nan (invoke "max" (f32.const nan:0x200000) (f32.const inf))) (assert_return_canonical_nan (invoke "max" (f32.const -nan) (f32.const -nan))) (assert_return_arithmetic_nan (invoke "max" (f32.const -nan:0x200000) (f32.const -nan))) (assert_return_arithmetic_nan (invoke "max" (f32.const -nan) (f32.const -nan:0x200000))) @@ -2430,8 +2430,8 @@ (assert_return (invoke "sqrt" (f32.const 0x1.921fb6p+2)) (f32.const 0x1.40d932p+1)) (assert_return_canonical_nan (invoke "sqrt" (f32.const -0x1.fffffep+127))) (assert_return (invoke "sqrt" (f32.const 0x1.fffffep+127)) (f32.const 0x1.fffffep+63)) -(assert_return_canonical_nan (invoke "sqrt" (f32.const -infinity))) -(assert_return (invoke "sqrt" (f32.const infinity)) (f32.const infinity)) +(assert_return_canonical_nan (invoke "sqrt" (f32.const -inf))) +(assert_return (invoke "sqrt" (f32.const inf)) (f32.const inf)) (assert_return_canonical_nan (invoke "sqrt" (f32.const -nan))) (assert_return_arithmetic_nan (invoke "sqrt" (f32.const -nan:0x200000))) (assert_return_canonical_nan (invoke "sqrt" (f32.const nan))) @@ -2450,8 +2450,8 @@ (assert_return (invoke "floor" (f32.const 0x1.921fb6p+2)) (f32.const 0x1.8p+2)) (assert_return (invoke "floor" (f32.const -0x1.fffffep+127)) (f32.const -0x1.fffffep+127)) (assert_return (invoke "floor" (f32.const 0x1.fffffep+127)) (f32.const 0x1.fffffep+127)) -(assert_return (invoke "floor" (f32.const -infinity)) (f32.const -infinity)) -(assert_return (invoke "floor" (f32.const infinity)) (f32.const infinity)) +(assert_return (invoke "floor" (f32.const -inf)) (f32.const -inf)) +(assert_return (invoke "floor" (f32.const inf)) (f32.const inf)) (assert_return_canonical_nan (invoke "floor" (f32.const -nan))) (assert_return_arithmetic_nan (invoke "floor" (f32.const -nan:0x200000))) (assert_return_canonical_nan (invoke "floor" (f32.const nan))) @@ -2470,8 +2470,8 @@ (assert_return (invoke "ceil" (f32.const 0x1.921fb6p+2)) (f32.const 0x1.cp+2)) (assert_return (invoke "ceil" (f32.const -0x1.fffffep+127)) (f32.const -0x1.fffffep+127)) (assert_return (invoke "ceil" (f32.const 0x1.fffffep+127)) (f32.const 0x1.fffffep+127)) -(assert_return (invoke "ceil" (f32.const -infinity)) (f32.const -infinity)) -(assert_return (invoke "ceil" (f32.const infinity)) (f32.const infinity)) +(assert_return (invoke "ceil" (f32.const -inf)) (f32.const -inf)) +(assert_return (invoke "ceil" (f32.const inf)) (f32.const inf)) (assert_return_canonical_nan (invoke "ceil" (f32.const -nan))) (assert_return_arithmetic_nan (invoke "ceil" (f32.const -nan:0x200000))) (assert_return_canonical_nan (invoke "ceil" (f32.const nan))) @@ -2490,8 +2490,8 @@ (assert_return (invoke "trunc" (f32.const 0x1.921fb6p+2)) (f32.const 0x1.8p+2)) (assert_return (invoke "trunc" (f32.const -0x1.fffffep+127)) (f32.const -0x1.fffffep+127)) (assert_return (invoke "trunc" (f32.const 0x1.fffffep+127)) (f32.const 0x1.fffffep+127)) -(assert_return (invoke "trunc" (f32.const -infinity)) (f32.const -infinity)) -(assert_return (invoke "trunc" (f32.const infinity)) (f32.const infinity)) +(assert_return (invoke "trunc" (f32.const -inf)) (f32.const -inf)) +(assert_return (invoke "trunc" (f32.const inf)) (f32.const inf)) (assert_return_canonical_nan (invoke "trunc" (f32.const -nan))) (assert_return_arithmetic_nan (invoke "trunc" (f32.const -nan:0x200000))) (assert_return_canonical_nan (invoke "trunc" (f32.const nan))) @@ -2510,9 +2510,24 @@ (assert_return (invoke "nearest" (f32.const 0x1.921fb6p+2)) (f32.const 0x1.8p+2)) (assert_return (invoke "nearest" (f32.const -0x1.fffffep+127)) (f32.const -0x1.fffffep+127)) (assert_return (invoke "nearest" (f32.const 0x1.fffffep+127)) (f32.const 0x1.fffffep+127)) -(assert_return (invoke "nearest" (f32.const -infinity)) (f32.const -infinity)) -(assert_return (invoke "nearest" (f32.const infinity)) (f32.const infinity)) +(assert_return (invoke "nearest" (f32.const -inf)) (f32.const -inf)) +(assert_return (invoke "nearest" (f32.const inf)) (f32.const inf)) (assert_return_canonical_nan (invoke "nearest" (f32.const -nan))) (assert_return_arithmetic_nan (invoke "nearest" (f32.const -nan:0x200000))) (assert_return_canonical_nan (invoke "nearest" (f32.const nan))) (assert_return_arithmetic_nan (invoke "nearest" (f32.const nan:0x200000))) + + +;; Type check + +(assert_invalid (module (func (result f32) (f32.add (i64.const 0) (f64.const 0)))) "type mismatch") +(assert_invalid (module (func (result f32) (f32.div (i64.const 0) (f64.const 0)))) "type mismatch") +(assert_invalid (module (func (result f32) (f32.max (i64.const 0) (f64.const 0)))) "type mismatch") +(assert_invalid (module (func (result f32) (f32.min (i64.const 0) (f64.const 0)))) "type mismatch") +(assert_invalid (module (func (result f32) (f32.mul (i64.const 0) (f64.const 0)))) "type mismatch") +(assert_invalid (module (func (result f32) (f32.sub (i64.const 0) (f64.const 0)))) "type mismatch") +(assert_invalid (module (func (result f32) (f32.ceil (i64.const 0)))) "type mismatch") +(assert_invalid (module (func (result f32) (f32.floor (i64.const 0)))) "type mismatch") +(assert_invalid (module (func (result f32) (f32.nearest (i64.const 0)))) "type mismatch") +(assert_invalid (module (func (result f32) (f32.sqrt (i64.const 0)))) "type mismatch") +(assert_invalid (module (func (result f32) (f32.trunc (i64.const 0)))) "type mismatch") diff --git a/test/core/f32_bitwise.wast b/test/core/f32_bitwise.wast index 473dba83..8554d674 100644 --- a/test/core/f32_bitwise.wast +++ b/test/core/f32_bitwise.wast @@ -2,9 +2,9 @@ ;; values. (module - (func (export "abs") (param $x f32) (result f32) (f32.abs (get_local $x))) - (func (export "neg") (param $x f32) (result f32) (f32.neg (get_local $x))) - (func (export "copysign") (param $x f32) (param $y f32) (result f32) (f32.copysign (get_local $x) (get_local $y))) + (func (export "abs") (param $x f32) (result f32) (f32.abs (local.get $x))) + (func (export "neg") (param $x f32) (result f32) (f32.neg (local.get $x))) + (func (export "copysign") (param $x f32) (param $y f32) (result f32) (f32.copysign (local.get $x) (local.get $y))) ) (assert_return (invoke "copysign" (f32.const -0x0p+0) (f32.const -0x0p+0)) (f32.const -0x0p+0)) @@ -35,10 +35,10 @@ (assert_return (invoke "copysign" (f32.const -0x0p+0) (f32.const 0x1.fffffep+127)) (f32.const 0x0p+0)) (assert_return (invoke "copysign" (f32.const 0x0p+0) (f32.const -0x1.fffffep+127)) (f32.const -0x0p+0)) (assert_return (invoke "copysign" (f32.const 0x0p+0) (f32.const 0x1.fffffep+127)) (f32.const 0x0p+0)) -(assert_return (invoke "copysign" (f32.const -0x0p+0) (f32.const -infinity)) (f32.const -0x0p+0)) -(assert_return (invoke "copysign" (f32.const -0x0p+0) (f32.const infinity)) (f32.const 0x0p+0)) -(assert_return (invoke "copysign" (f32.const 0x0p+0) (f32.const -infinity)) (f32.const -0x0p+0)) -(assert_return (invoke "copysign" (f32.const 0x0p+0) (f32.const infinity)) (f32.const 0x0p+0)) +(assert_return (invoke "copysign" (f32.const -0x0p+0) (f32.const -inf)) (f32.const -0x0p+0)) +(assert_return (invoke "copysign" (f32.const -0x0p+0) (f32.const inf)) (f32.const 0x0p+0)) +(assert_return (invoke "copysign" (f32.const 0x0p+0) (f32.const -inf)) (f32.const -0x0p+0)) +(assert_return (invoke "copysign" (f32.const 0x0p+0) (f32.const inf)) (f32.const 0x0p+0)) (assert_return (invoke "copysign" (f32.const -0x0p+0) (f32.const -nan)) (f32.const -0x0p+0)) (assert_return (invoke "copysign" (f32.const -0x0p+0) (f32.const nan)) (f32.const 0x0p+0)) (assert_return (invoke "copysign" (f32.const 0x0p+0) (f32.const -nan)) (f32.const -0x0p+0)) @@ -71,10 +71,10 @@ (assert_return (invoke "copysign" (f32.const -0x1p-149) (f32.const 0x1.fffffep+127)) (f32.const 0x1p-149)) (assert_return (invoke "copysign" (f32.const 0x1p-149) (f32.const -0x1.fffffep+127)) (f32.const -0x1p-149)) (assert_return (invoke "copysign" (f32.const 0x1p-149) (f32.const 0x1.fffffep+127)) (f32.const 0x1p-149)) -(assert_return (invoke "copysign" (f32.const -0x1p-149) (f32.const -infinity)) (f32.const -0x1p-149)) -(assert_return (invoke "copysign" (f32.const -0x1p-149) (f32.const infinity)) (f32.const 0x1p-149)) -(assert_return (invoke "copysign" (f32.const 0x1p-149) (f32.const -infinity)) (f32.const -0x1p-149)) -(assert_return (invoke "copysign" (f32.const 0x1p-149) (f32.const infinity)) (f32.const 0x1p-149)) +(assert_return (invoke "copysign" (f32.const -0x1p-149) (f32.const -inf)) (f32.const -0x1p-149)) +(assert_return (invoke "copysign" (f32.const -0x1p-149) (f32.const inf)) (f32.const 0x1p-149)) +(assert_return (invoke "copysign" (f32.const 0x1p-149) (f32.const -inf)) (f32.const -0x1p-149)) +(assert_return (invoke "copysign" (f32.const 0x1p-149) (f32.const inf)) (f32.const 0x1p-149)) (assert_return (invoke "copysign" (f32.const -0x1p-149) (f32.const -nan)) (f32.const -0x1p-149)) (assert_return (invoke "copysign" (f32.const -0x1p-149) (f32.const nan)) (f32.const 0x1p-149)) (assert_return (invoke "copysign" (f32.const 0x1p-149) (f32.const -nan)) (f32.const -0x1p-149)) @@ -107,10 +107,10 @@ (assert_return (invoke "copysign" (f32.const -0x1p-126) (f32.const 0x1.fffffep+127)) (f32.const 0x1p-126)) (assert_return (invoke "copysign" (f32.const 0x1p-126) (f32.const -0x1.fffffep+127)) (f32.const -0x1p-126)) (assert_return (invoke "copysign" (f32.const 0x1p-126) (f32.const 0x1.fffffep+127)) (f32.const 0x1p-126)) -(assert_return (invoke "copysign" (f32.const -0x1p-126) (f32.const -infinity)) (f32.const -0x1p-126)) -(assert_return (invoke "copysign" (f32.const -0x1p-126) (f32.const infinity)) (f32.const 0x1p-126)) -(assert_return (invoke "copysign" (f32.const 0x1p-126) (f32.const -infinity)) (f32.const -0x1p-126)) -(assert_return (invoke "copysign" (f32.const 0x1p-126) (f32.const infinity)) (f32.const 0x1p-126)) +(assert_return (invoke "copysign" (f32.const -0x1p-126) (f32.const -inf)) (f32.const -0x1p-126)) +(assert_return (invoke "copysign" (f32.const -0x1p-126) (f32.const inf)) (f32.const 0x1p-126)) +(assert_return (invoke "copysign" (f32.const 0x1p-126) (f32.const -inf)) (f32.const -0x1p-126)) +(assert_return (invoke "copysign" (f32.const 0x1p-126) (f32.const inf)) (f32.const 0x1p-126)) (assert_return (invoke "copysign" (f32.const -0x1p-126) (f32.const -nan)) (f32.const -0x1p-126)) (assert_return (invoke "copysign" (f32.const -0x1p-126) (f32.const nan)) (f32.const 0x1p-126)) (assert_return (invoke "copysign" (f32.const 0x1p-126) (f32.const -nan)) (f32.const -0x1p-126)) @@ -143,10 +143,10 @@ (assert_return (invoke "copysign" (f32.const -0x1p-1) (f32.const 0x1.fffffep+127)) (f32.const 0x1p-1)) (assert_return (invoke "copysign" (f32.const 0x1p-1) (f32.const -0x1.fffffep+127)) (f32.const -0x1p-1)) (assert_return (invoke "copysign" (f32.const 0x1p-1) (f32.const 0x1.fffffep+127)) (f32.const 0x1p-1)) -(assert_return (invoke "copysign" (f32.const -0x1p-1) (f32.const -infinity)) (f32.const -0x1p-1)) -(assert_return (invoke "copysign" (f32.const -0x1p-1) (f32.const infinity)) (f32.const 0x1p-1)) -(assert_return (invoke "copysign" (f32.const 0x1p-1) (f32.const -infinity)) (f32.const -0x1p-1)) -(assert_return (invoke "copysign" (f32.const 0x1p-1) (f32.const infinity)) (f32.const 0x1p-1)) +(assert_return (invoke "copysign" (f32.const -0x1p-1) (f32.const -inf)) (f32.const -0x1p-1)) +(assert_return (invoke "copysign" (f32.const -0x1p-1) (f32.const inf)) (f32.const 0x1p-1)) +(assert_return (invoke "copysign" (f32.const 0x1p-1) (f32.const -inf)) (f32.const -0x1p-1)) +(assert_return (invoke "copysign" (f32.const 0x1p-1) (f32.const inf)) (f32.const 0x1p-1)) (assert_return (invoke "copysign" (f32.const -0x1p-1) (f32.const -nan)) (f32.const -0x1p-1)) (assert_return (invoke "copysign" (f32.const -0x1p-1) (f32.const nan)) (f32.const 0x1p-1)) (assert_return (invoke "copysign" (f32.const 0x1p-1) (f32.const -nan)) (f32.const -0x1p-1)) @@ -179,10 +179,10 @@ (assert_return (invoke "copysign" (f32.const -0x1p+0) (f32.const 0x1.fffffep+127)) (f32.const 0x1p+0)) (assert_return (invoke "copysign" (f32.const 0x1p+0) (f32.const -0x1.fffffep+127)) (f32.const -0x1p+0)) (assert_return (invoke "copysign" (f32.const 0x1p+0) (f32.const 0x1.fffffep+127)) (f32.const 0x1p+0)) -(assert_return (invoke "copysign" (f32.const -0x1p+0) (f32.const -infinity)) (f32.const -0x1p+0)) -(assert_return (invoke "copysign" (f32.const -0x1p+0) (f32.const infinity)) (f32.const 0x1p+0)) -(assert_return (invoke "copysign" (f32.const 0x1p+0) (f32.const -infinity)) (f32.const -0x1p+0)) -(assert_return (invoke "copysign" (f32.const 0x1p+0) (f32.const infinity)) (f32.const 0x1p+0)) +(assert_return (invoke "copysign" (f32.const -0x1p+0) (f32.const -inf)) (f32.const -0x1p+0)) +(assert_return (invoke "copysign" (f32.const -0x1p+0) (f32.const inf)) (f32.const 0x1p+0)) +(assert_return (invoke "copysign" (f32.const 0x1p+0) (f32.const -inf)) (f32.const -0x1p+0)) +(assert_return (invoke "copysign" (f32.const 0x1p+0) (f32.const inf)) (f32.const 0x1p+0)) (assert_return (invoke "copysign" (f32.const -0x1p+0) (f32.const -nan)) (f32.const -0x1p+0)) (assert_return (invoke "copysign" (f32.const -0x1p+0) (f32.const nan)) (f32.const 0x1p+0)) (assert_return (invoke "copysign" (f32.const 0x1p+0) (f32.const -nan)) (f32.const -0x1p+0)) @@ -215,10 +215,10 @@ (assert_return (invoke "copysign" (f32.const -0x1.921fb6p+2) (f32.const 0x1.fffffep+127)) (f32.const 0x1.921fb6p+2)) (assert_return (invoke "copysign" (f32.const 0x1.921fb6p+2) (f32.const -0x1.fffffep+127)) (f32.const -0x1.921fb6p+2)) (assert_return (invoke "copysign" (f32.const 0x1.921fb6p+2) (f32.const 0x1.fffffep+127)) (f32.const 0x1.921fb6p+2)) -(assert_return (invoke "copysign" (f32.const -0x1.921fb6p+2) (f32.const -infinity)) (f32.const -0x1.921fb6p+2)) -(assert_return (invoke "copysign" (f32.const -0x1.921fb6p+2) (f32.const infinity)) (f32.const 0x1.921fb6p+2)) -(assert_return (invoke "copysign" (f32.const 0x1.921fb6p+2) (f32.const -infinity)) (f32.const -0x1.921fb6p+2)) -(assert_return (invoke "copysign" (f32.const 0x1.921fb6p+2) (f32.const infinity)) (f32.const 0x1.921fb6p+2)) +(assert_return (invoke "copysign" (f32.const -0x1.921fb6p+2) (f32.const -inf)) (f32.const -0x1.921fb6p+2)) +(assert_return (invoke "copysign" (f32.const -0x1.921fb6p+2) (f32.const inf)) (f32.const 0x1.921fb6p+2)) +(assert_return (invoke "copysign" (f32.const 0x1.921fb6p+2) (f32.const -inf)) (f32.const -0x1.921fb6p+2)) +(assert_return (invoke "copysign" (f32.const 0x1.921fb6p+2) (f32.const inf)) (f32.const 0x1.921fb6p+2)) (assert_return (invoke "copysign" (f32.const -0x1.921fb6p+2) (f32.const -nan)) (f32.const -0x1.921fb6p+2)) (assert_return (invoke "copysign" (f32.const -0x1.921fb6p+2) (f32.const nan)) (f32.const 0x1.921fb6p+2)) (assert_return (invoke "copysign" (f32.const 0x1.921fb6p+2) (f32.const -nan)) (f32.const -0x1.921fb6p+2)) @@ -251,50 +251,50 @@ (assert_return (invoke "copysign" (f32.const -0x1.fffffep+127) (f32.const 0x1.fffffep+127)) (f32.const 0x1.fffffep+127)) (assert_return (invoke "copysign" (f32.const 0x1.fffffep+127) (f32.const -0x1.fffffep+127)) (f32.const -0x1.fffffep+127)) (assert_return (invoke "copysign" (f32.const 0x1.fffffep+127) (f32.const 0x1.fffffep+127)) (f32.const 0x1.fffffep+127)) -(assert_return (invoke "copysign" (f32.const -0x1.fffffep+127) (f32.const -infinity)) (f32.const -0x1.fffffep+127)) -(assert_return (invoke "copysign" (f32.const -0x1.fffffep+127) (f32.const infinity)) (f32.const 0x1.fffffep+127)) -(assert_return (invoke "copysign" (f32.const 0x1.fffffep+127) (f32.const -infinity)) (f32.const -0x1.fffffep+127)) -(assert_return (invoke "copysign" (f32.const 0x1.fffffep+127) (f32.const infinity)) (f32.const 0x1.fffffep+127)) +(assert_return (invoke "copysign" (f32.const -0x1.fffffep+127) (f32.const -inf)) (f32.const -0x1.fffffep+127)) +(assert_return (invoke "copysign" (f32.const -0x1.fffffep+127) (f32.const inf)) (f32.const 0x1.fffffep+127)) +(assert_return (invoke "copysign" (f32.const 0x1.fffffep+127) (f32.const -inf)) (f32.const -0x1.fffffep+127)) +(assert_return (invoke "copysign" (f32.const 0x1.fffffep+127) (f32.const inf)) (f32.const 0x1.fffffep+127)) (assert_return (invoke "copysign" (f32.const -0x1.fffffep+127) (f32.const -nan)) (f32.const -0x1.fffffep+127)) (assert_return (invoke "copysign" (f32.const -0x1.fffffep+127) (f32.const nan)) (f32.const 0x1.fffffep+127)) (assert_return (invoke "copysign" (f32.const 0x1.fffffep+127) (f32.const -nan)) (f32.const -0x1.fffffep+127)) (assert_return (invoke "copysign" (f32.const 0x1.fffffep+127) (f32.const nan)) (f32.const 0x1.fffffep+127)) -(assert_return (invoke "copysign" (f32.const -infinity) (f32.const -0x0p+0)) (f32.const -infinity)) -(assert_return (invoke "copysign" (f32.const -infinity) (f32.const 0x0p+0)) (f32.const infinity)) -(assert_return (invoke "copysign" (f32.const infinity) (f32.const -0x0p+0)) (f32.const -infinity)) -(assert_return (invoke "copysign" (f32.const infinity) (f32.const 0x0p+0)) (f32.const infinity)) -(assert_return (invoke "copysign" (f32.const -infinity) (f32.const -0x1p-149)) (f32.const -infinity)) -(assert_return (invoke "copysign" (f32.const -infinity) (f32.const 0x1p-149)) (f32.const infinity)) -(assert_return (invoke "copysign" (f32.const infinity) (f32.const -0x1p-149)) (f32.const -infinity)) -(assert_return (invoke "copysign" (f32.const infinity) (f32.const 0x1p-149)) (f32.const infinity)) -(assert_return (invoke "copysign" (f32.const -infinity) (f32.const -0x1p-126)) (f32.const -infinity)) -(assert_return (invoke "copysign" (f32.const -infinity) (f32.const 0x1p-126)) (f32.const infinity)) -(assert_return (invoke "copysign" (f32.const infinity) (f32.const -0x1p-126)) (f32.const -infinity)) -(assert_return (invoke "copysign" (f32.const infinity) (f32.const 0x1p-126)) (f32.const infinity)) -(assert_return (invoke "copysign" (f32.const -infinity) (f32.const -0x1p-1)) (f32.const -infinity)) -(assert_return (invoke "copysign" (f32.const -infinity) (f32.const 0x1p-1)) (f32.const infinity)) -(assert_return (invoke "copysign" (f32.const infinity) (f32.const -0x1p-1)) (f32.const -infinity)) -(assert_return (invoke "copysign" (f32.const infinity) (f32.const 0x1p-1)) (f32.const infinity)) -(assert_return (invoke "copysign" (f32.const -infinity) (f32.const -0x1p+0)) (f32.const -infinity)) -(assert_return (invoke "copysign" (f32.const -infinity) (f32.const 0x1p+0)) (f32.const infinity)) -(assert_return (invoke "copysign" (f32.const infinity) (f32.const -0x1p+0)) (f32.const -infinity)) -(assert_return (invoke "copysign" (f32.const infinity) (f32.const 0x1p+0)) (f32.const infinity)) -(assert_return (invoke "copysign" (f32.const -infinity) (f32.const -0x1.921fb6p+2)) (f32.const -infinity)) -(assert_return (invoke "copysign" (f32.const -infinity) (f32.const 0x1.921fb6p+2)) (f32.const infinity)) -(assert_return (invoke "copysign" (f32.const infinity) (f32.const -0x1.921fb6p+2)) (f32.const -infinity)) -(assert_return (invoke "copysign" (f32.const infinity) (f32.const 0x1.921fb6p+2)) (f32.const infinity)) -(assert_return (invoke "copysign" (f32.const -infinity) (f32.const -0x1.fffffep+127)) (f32.const -infinity)) -(assert_return (invoke "copysign" (f32.const -infinity) (f32.const 0x1.fffffep+127)) (f32.const infinity)) -(assert_return (invoke "copysign" (f32.const infinity) (f32.const -0x1.fffffep+127)) (f32.const -infinity)) -(assert_return (invoke "copysign" (f32.const infinity) (f32.const 0x1.fffffep+127)) (f32.const infinity)) -(assert_return (invoke "copysign" (f32.const -infinity) (f32.const -infinity)) (f32.const -infinity)) -(assert_return (invoke "copysign" (f32.const -infinity) (f32.const infinity)) (f32.const infinity)) -(assert_return (invoke "copysign" (f32.const infinity) (f32.const -infinity)) (f32.const -infinity)) -(assert_return (invoke "copysign" (f32.const infinity) (f32.const infinity)) (f32.const infinity)) -(assert_return (invoke "copysign" (f32.const -infinity) (f32.const -nan)) (f32.const -infinity)) -(assert_return (invoke "copysign" (f32.const -infinity) (f32.const nan)) (f32.const infinity)) -(assert_return (invoke "copysign" (f32.const infinity) (f32.const -nan)) (f32.const -infinity)) -(assert_return (invoke "copysign" (f32.const infinity) (f32.const nan)) (f32.const infinity)) +(assert_return (invoke "copysign" (f32.const -inf) (f32.const -0x0p+0)) (f32.const -inf)) +(assert_return (invoke "copysign" (f32.const -inf) (f32.const 0x0p+0)) (f32.const inf)) +(assert_return (invoke "copysign" (f32.const inf) (f32.const -0x0p+0)) (f32.const -inf)) +(assert_return (invoke "copysign" (f32.const inf) (f32.const 0x0p+0)) (f32.const inf)) +(assert_return (invoke "copysign" (f32.const -inf) (f32.const -0x1p-149)) (f32.const -inf)) +(assert_return (invoke "copysign" (f32.const -inf) (f32.const 0x1p-149)) (f32.const inf)) +(assert_return (invoke "copysign" (f32.const inf) (f32.const -0x1p-149)) (f32.const -inf)) +(assert_return (invoke "copysign" (f32.const inf) (f32.const 0x1p-149)) (f32.const inf)) +(assert_return (invoke "copysign" (f32.const -inf) (f32.const -0x1p-126)) (f32.const -inf)) +(assert_return (invoke "copysign" (f32.const -inf) (f32.const 0x1p-126)) (f32.const inf)) +(assert_return (invoke "copysign" (f32.const inf) (f32.const -0x1p-126)) (f32.const -inf)) +(assert_return (invoke "copysign" (f32.const inf) (f32.const 0x1p-126)) (f32.const inf)) +(assert_return (invoke "copysign" (f32.const -inf) (f32.const -0x1p-1)) (f32.const -inf)) +(assert_return (invoke "copysign" (f32.const -inf) (f32.const 0x1p-1)) (f32.const inf)) +(assert_return (invoke "copysign" (f32.const inf) (f32.const -0x1p-1)) (f32.const -inf)) +(assert_return (invoke "copysign" (f32.const inf) (f32.const 0x1p-1)) (f32.const inf)) +(assert_return (invoke "copysign" (f32.const -inf) (f32.const -0x1p+0)) (f32.const -inf)) +(assert_return (invoke "copysign" (f32.const -inf) (f32.const 0x1p+0)) (f32.const inf)) +(assert_return (invoke "copysign" (f32.const inf) (f32.const -0x1p+0)) (f32.const -inf)) +(assert_return (invoke "copysign" (f32.const inf) (f32.const 0x1p+0)) (f32.const inf)) +(assert_return (invoke "copysign" (f32.const -inf) (f32.const -0x1.921fb6p+2)) (f32.const -inf)) +(assert_return (invoke "copysign" (f32.const -inf) (f32.const 0x1.921fb6p+2)) (f32.const inf)) +(assert_return (invoke "copysign" (f32.const inf) (f32.const -0x1.921fb6p+2)) (f32.const -inf)) +(assert_return (invoke "copysign" (f32.const inf) (f32.const 0x1.921fb6p+2)) (f32.const inf)) +(assert_return (invoke "copysign" (f32.const -inf) (f32.const -0x1.fffffep+127)) (f32.const -inf)) +(assert_return (invoke "copysign" (f32.const -inf) (f32.const 0x1.fffffep+127)) (f32.const inf)) +(assert_return (invoke "copysign" (f32.const inf) (f32.const -0x1.fffffep+127)) (f32.const -inf)) +(assert_return (invoke "copysign" (f32.const inf) (f32.const 0x1.fffffep+127)) (f32.const inf)) +(assert_return (invoke "copysign" (f32.const -inf) (f32.const -inf)) (f32.const -inf)) +(assert_return (invoke "copysign" (f32.const -inf) (f32.const inf)) (f32.const inf)) +(assert_return (invoke "copysign" (f32.const inf) (f32.const -inf)) (f32.const -inf)) +(assert_return (invoke "copysign" (f32.const inf) (f32.const inf)) (f32.const inf)) +(assert_return (invoke "copysign" (f32.const -inf) (f32.const -nan)) (f32.const -inf)) +(assert_return (invoke "copysign" (f32.const -inf) (f32.const nan)) (f32.const inf)) +(assert_return (invoke "copysign" (f32.const inf) (f32.const -nan)) (f32.const -inf)) +(assert_return (invoke "copysign" (f32.const inf) (f32.const nan)) (f32.const inf)) (assert_return (invoke "copysign" (f32.const -nan) (f32.const -0x0p+0)) (f32.const -nan)) (assert_return (invoke "copysign" (f32.const -nan) (f32.const 0x0p+0)) (f32.const nan)) (assert_return (invoke "copysign" (f32.const nan) (f32.const -0x0p+0)) (f32.const -nan)) @@ -323,10 +323,10 @@ (assert_return (invoke "copysign" (f32.const -nan) (f32.const 0x1.fffffep+127)) (f32.const nan)) (assert_return (invoke "copysign" (f32.const nan) (f32.const -0x1.fffffep+127)) (f32.const -nan)) (assert_return (invoke "copysign" (f32.const nan) (f32.const 0x1.fffffep+127)) (f32.const nan)) -(assert_return (invoke "copysign" (f32.const -nan) (f32.const -infinity)) (f32.const -nan)) -(assert_return (invoke "copysign" (f32.const -nan) (f32.const infinity)) (f32.const nan)) -(assert_return (invoke "copysign" (f32.const nan) (f32.const -infinity)) (f32.const -nan)) -(assert_return (invoke "copysign" (f32.const nan) (f32.const infinity)) (f32.const nan)) +(assert_return (invoke "copysign" (f32.const -nan) (f32.const -inf)) (f32.const -nan)) +(assert_return (invoke "copysign" (f32.const -nan) (f32.const inf)) (f32.const nan)) +(assert_return (invoke "copysign" (f32.const nan) (f32.const -inf)) (f32.const -nan)) +(assert_return (invoke "copysign" (f32.const nan) (f32.const inf)) (f32.const nan)) (assert_return (invoke "copysign" (f32.const -nan) (f32.const -nan)) (f32.const -nan)) (assert_return (invoke "copysign" (f32.const -nan) (f32.const nan)) (f32.const nan)) (assert_return (invoke "copysign" (f32.const nan) (f32.const -nan)) (f32.const -nan)) @@ -345,8 +345,8 @@ (assert_return (invoke "abs" (f32.const 0x1.921fb6p+2)) (f32.const 0x1.921fb6p+2)) (assert_return (invoke "abs" (f32.const -0x1.fffffep+127)) (f32.const 0x1.fffffep+127)) (assert_return (invoke "abs" (f32.const 0x1.fffffep+127)) (f32.const 0x1.fffffep+127)) -(assert_return (invoke "abs" (f32.const -infinity)) (f32.const infinity)) -(assert_return (invoke "abs" (f32.const infinity)) (f32.const infinity)) +(assert_return (invoke "abs" (f32.const -inf)) (f32.const inf)) +(assert_return (invoke "abs" (f32.const inf)) (f32.const inf)) (assert_return (invoke "abs" (f32.const -nan)) (f32.const nan)) (assert_return (invoke "abs" (f32.const nan)) (f32.const nan)) (assert_return (invoke "neg" (f32.const -0x0p+0)) (f32.const 0x0p+0)) @@ -363,7 +363,14 @@ (assert_return (invoke "neg" (f32.const 0x1.921fb6p+2)) (f32.const -0x1.921fb6p+2)) (assert_return (invoke "neg" (f32.const -0x1.fffffep+127)) (f32.const 0x1.fffffep+127)) (assert_return (invoke "neg" (f32.const 0x1.fffffep+127)) (f32.const -0x1.fffffep+127)) -(assert_return (invoke "neg" (f32.const -infinity)) (f32.const infinity)) -(assert_return (invoke "neg" (f32.const infinity)) (f32.const -infinity)) +(assert_return (invoke "neg" (f32.const -inf)) (f32.const inf)) +(assert_return (invoke "neg" (f32.const inf)) (f32.const -inf)) (assert_return (invoke "neg" (f32.const -nan)) (f32.const nan)) (assert_return (invoke "neg" (f32.const nan)) (f32.const -nan)) + + +;; Type check + +(assert_invalid (module (func (result f32) (f32.copysign (i64.const 0) (f64.const 0)))) "type mismatch") +(assert_invalid (module (func (result f32) (f32.abs (i64.const 0)))) "type mismatch") +(assert_invalid (module (func (result f32) (f32.neg (i64.const 0)))) "type mismatch") diff --git a/test/core/f32_cmp.wast b/test/core/f32_cmp.wast index 7ad68bfd..0dd7167c 100644 --- a/test/core/f32_cmp.wast +++ b/test/core/f32_cmp.wast @@ -2,12 +2,12 @@ ;; special values. (module - (func (export "eq") (param $x f32) (param $y f32) (result i32) (f32.eq (get_local $x) (get_local $y))) - (func (export "ne") (param $x f32) (param $y f32) (result i32) (f32.ne (get_local $x) (get_local $y))) - (func (export "lt") (param $x f32) (param $y f32) (result i32) (f32.lt (get_local $x) (get_local $y))) - (func (export "le") (param $x f32) (param $y f32) (result i32) (f32.le (get_local $x) (get_local $y))) - (func (export "gt") (param $x f32) (param $y f32) (result i32) (f32.gt (get_local $x) (get_local $y))) - (func (export "ge") (param $x f32) (param $y f32) (result i32) (f32.ge (get_local $x) (get_local $y))) + (func (export "eq") (param $x f32) (param $y f32) (result i32) (f32.eq (local.get $x) (local.get $y))) + (func (export "ne") (param $x f32) (param $y f32) (result i32) (f32.ne (local.get $x) (local.get $y))) + (func (export "lt") (param $x f32) (param $y f32) (result i32) (f32.lt (local.get $x) (local.get $y))) + (func (export "le") (param $x f32) (param $y f32) (result i32) (f32.le (local.get $x) (local.get $y))) + (func (export "gt") (param $x f32) (param $y f32) (result i32) (f32.gt (local.get $x) (local.get $y))) + (func (export "ge") (param $x f32) (param $y f32) (result i32) (f32.ge (local.get $x) (local.get $y))) ) (assert_return (invoke "eq" (f32.const -0x0p+0) (f32.const -0x0p+0)) (i32.const 1)) @@ -38,10 +38,10 @@ (assert_return (invoke "eq" (f32.const -0x0p+0) (f32.const 0x1.fffffep+127)) (i32.const 0)) (assert_return (invoke "eq" (f32.const 0x0p+0) (f32.const -0x1.fffffep+127)) (i32.const 0)) (assert_return (invoke "eq" (f32.const 0x0p+0) (f32.const 0x1.fffffep+127)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const -0x0p+0) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const -0x0p+0) (f32.const infinity)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const 0x0p+0) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const 0x0p+0) (f32.const infinity)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const -0x0p+0) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const -0x0p+0) (f32.const inf)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const 0x0p+0) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const 0x0p+0) (f32.const inf)) (i32.const 0)) (assert_return (invoke "eq" (f32.const -0x0p+0) (f32.const -nan)) (i32.const 0)) (assert_return (invoke "eq" (f32.const -0x0p+0) (f32.const -nan:0x200000)) (i32.const 0)) (assert_return (invoke "eq" (f32.const -0x0p+0) (f32.const nan)) (i32.const 0)) @@ -78,10 +78,10 @@ (assert_return (invoke "eq" (f32.const -0x1p-149) (f32.const 0x1.fffffep+127)) (i32.const 0)) (assert_return (invoke "eq" (f32.const 0x1p-149) (f32.const -0x1.fffffep+127)) (i32.const 0)) (assert_return (invoke "eq" (f32.const 0x1p-149) (f32.const 0x1.fffffep+127)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const -0x1p-149) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const -0x1p-149) (f32.const infinity)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const 0x1p-149) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const 0x1p-149) (f32.const infinity)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const -0x1p-149) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const -0x1p-149) (f32.const inf)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const 0x1p-149) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const 0x1p-149) (f32.const inf)) (i32.const 0)) (assert_return (invoke "eq" (f32.const -0x1p-149) (f32.const -nan)) (i32.const 0)) (assert_return (invoke "eq" (f32.const -0x1p-149) (f32.const -nan:0x200000)) (i32.const 0)) (assert_return (invoke "eq" (f32.const -0x1p-149) (f32.const nan)) (i32.const 0)) @@ -118,10 +118,10 @@ (assert_return (invoke "eq" (f32.const -0x1p-126) (f32.const 0x1.fffffep+127)) (i32.const 0)) (assert_return (invoke "eq" (f32.const 0x1p-126) (f32.const -0x1.fffffep+127)) (i32.const 0)) (assert_return (invoke "eq" (f32.const 0x1p-126) (f32.const 0x1.fffffep+127)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const -0x1p-126) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const -0x1p-126) (f32.const infinity)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const 0x1p-126) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const 0x1p-126) (f32.const infinity)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const -0x1p-126) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const -0x1p-126) (f32.const inf)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const 0x1p-126) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const 0x1p-126) (f32.const inf)) (i32.const 0)) (assert_return (invoke "eq" (f32.const -0x1p-126) (f32.const -nan)) (i32.const 0)) (assert_return (invoke "eq" (f32.const -0x1p-126) (f32.const -nan:0x200000)) (i32.const 0)) (assert_return (invoke "eq" (f32.const -0x1p-126) (f32.const nan)) (i32.const 0)) @@ -158,10 +158,10 @@ (assert_return (invoke "eq" (f32.const -0x1p-1) (f32.const 0x1.fffffep+127)) (i32.const 0)) (assert_return (invoke "eq" (f32.const 0x1p-1) (f32.const -0x1.fffffep+127)) (i32.const 0)) (assert_return (invoke "eq" (f32.const 0x1p-1) (f32.const 0x1.fffffep+127)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const -0x1p-1) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const -0x1p-1) (f32.const infinity)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const 0x1p-1) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const 0x1p-1) (f32.const infinity)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const -0x1p-1) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const -0x1p-1) (f32.const inf)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const 0x1p-1) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const 0x1p-1) (f32.const inf)) (i32.const 0)) (assert_return (invoke "eq" (f32.const -0x1p-1) (f32.const -nan)) (i32.const 0)) (assert_return (invoke "eq" (f32.const -0x1p-1) (f32.const -nan:0x200000)) (i32.const 0)) (assert_return (invoke "eq" (f32.const -0x1p-1) (f32.const nan)) (i32.const 0)) @@ -198,10 +198,10 @@ (assert_return (invoke "eq" (f32.const -0x1p+0) (f32.const 0x1.fffffep+127)) (i32.const 0)) (assert_return (invoke "eq" (f32.const 0x1p+0) (f32.const -0x1.fffffep+127)) (i32.const 0)) (assert_return (invoke "eq" (f32.const 0x1p+0) (f32.const 0x1.fffffep+127)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const -0x1p+0) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const -0x1p+0) (f32.const infinity)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const 0x1p+0) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const 0x1p+0) (f32.const infinity)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const -0x1p+0) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const -0x1p+0) (f32.const inf)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const 0x1p+0) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const 0x1p+0) (f32.const inf)) (i32.const 0)) (assert_return (invoke "eq" (f32.const -0x1p+0) (f32.const -nan)) (i32.const 0)) (assert_return (invoke "eq" (f32.const -0x1p+0) (f32.const -nan:0x200000)) (i32.const 0)) (assert_return (invoke "eq" (f32.const -0x1p+0) (f32.const nan)) (i32.const 0)) @@ -238,10 +238,10 @@ (assert_return (invoke "eq" (f32.const -0x1.921fb6p+2) (f32.const 0x1.fffffep+127)) (i32.const 0)) (assert_return (invoke "eq" (f32.const 0x1.921fb6p+2) (f32.const -0x1.fffffep+127)) (i32.const 0)) (assert_return (invoke "eq" (f32.const 0x1.921fb6p+2) (f32.const 0x1.fffffep+127)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const -0x1.921fb6p+2) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const -0x1.921fb6p+2) (f32.const infinity)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const 0x1.921fb6p+2) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const 0x1.921fb6p+2) (f32.const infinity)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const -0x1.921fb6p+2) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const -0x1.921fb6p+2) (f32.const inf)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const 0x1.921fb6p+2) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const 0x1.921fb6p+2) (f32.const inf)) (i32.const 0)) (assert_return (invoke "eq" (f32.const -0x1.921fb6p+2) (f32.const -nan)) (i32.const 0)) (assert_return (invoke "eq" (f32.const -0x1.921fb6p+2) (f32.const -nan:0x200000)) (i32.const 0)) (assert_return (invoke "eq" (f32.const -0x1.921fb6p+2) (f32.const nan)) (i32.const 0)) @@ -278,10 +278,10 @@ (assert_return (invoke "eq" (f32.const -0x1.fffffep+127) (f32.const 0x1.fffffep+127)) (i32.const 0)) (assert_return (invoke "eq" (f32.const 0x1.fffffep+127) (f32.const -0x1.fffffep+127)) (i32.const 0)) (assert_return (invoke "eq" (f32.const 0x1.fffffep+127) (f32.const 0x1.fffffep+127)) (i32.const 1)) -(assert_return (invoke "eq" (f32.const -0x1.fffffep+127) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const -0x1.fffffep+127) (f32.const infinity)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const 0x1.fffffep+127) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const 0x1.fffffep+127) (f32.const infinity)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const -0x1.fffffep+127) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const -0x1.fffffep+127) (f32.const inf)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const 0x1.fffffep+127) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const 0x1.fffffep+127) (f32.const inf)) (i32.const 0)) (assert_return (invoke "eq" (f32.const -0x1.fffffep+127) (f32.const -nan)) (i32.const 0)) (assert_return (invoke "eq" (f32.const -0x1.fffffep+127) (f32.const -nan:0x200000)) (i32.const 0)) (assert_return (invoke "eq" (f32.const -0x1.fffffep+127) (f32.const nan)) (i32.const 0)) @@ -290,46 +290,46 @@ (assert_return (invoke "eq" (f32.const 0x1.fffffep+127) (f32.const -nan:0x200000)) (i32.const 0)) (assert_return (invoke "eq" (f32.const 0x1.fffffep+127) (f32.const nan)) (i32.const 0)) (assert_return (invoke "eq" (f32.const 0x1.fffffep+127) (f32.const nan:0x200000)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const -infinity) (f32.const -0x0p+0)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const -infinity) (f32.const 0x0p+0)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const infinity) (f32.const -0x0p+0)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const infinity) (f32.const 0x0p+0)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const -infinity) (f32.const -0x1p-149)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const -infinity) (f32.const 0x1p-149)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const infinity) (f32.const -0x1p-149)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const infinity) (f32.const 0x1p-149)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const -infinity) (f32.const -0x1p-126)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const -infinity) (f32.const 0x1p-126)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const infinity) (f32.const -0x1p-126)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const infinity) (f32.const 0x1p-126)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const -infinity) (f32.const -0x1p-1)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const -infinity) (f32.const 0x1p-1)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const infinity) (f32.const -0x1p-1)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const infinity) (f32.const 0x1p-1)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const -infinity) (f32.const -0x1p+0)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const -infinity) (f32.const 0x1p+0)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const infinity) (f32.const -0x1p+0)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const infinity) (f32.const 0x1p+0)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const -infinity) (f32.const -0x1.921fb6p+2)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const -infinity) (f32.const 0x1.921fb6p+2)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const infinity) (f32.const -0x1.921fb6p+2)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const infinity) (f32.const 0x1.921fb6p+2)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const -infinity) (f32.const -0x1.fffffep+127)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const -infinity) (f32.const 0x1.fffffep+127)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const infinity) (f32.const -0x1.fffffep+127)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const infinity) (f32.const 0x1.fffffep+127)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const -infinity) (f32.const -infinity)) (i32.const 1)) -(assert_return (invoke "eq" (f32.const -infinity) (f32.const infinity)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const infinity) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const infinity) (f32.const infinity)) (i32.const 1)) -(assert_return (invoke "eq" (f32.const -infinity) (f32.const -nan)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const -infinity) (f32.const -nan:0x200000)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const -infinity) (f32.const nan)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const -infinity) (f32.const nan:0x200000)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const infinity) (f32.const -nan)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const infinity) (f32.const -nan:0x200000)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const infinity) (f32.const nan)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const infinity) (f32.const nan:0x200000)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const -inf) (f32.const -0x0p+0)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const -inf) (f32.const 0x0p+0)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const inf) (f32.const -0x0p+0)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const inf) (f32.const 0x0p+0)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const -inf) (f32.const -0x1p-149)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const -inf) (f32.const 0x1p-149)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const inf) (f32.const -0x1p-149)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const inf) (f32.const 0x1p-149)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const -inf) (f32.const -0x1p-126)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const -inf) (f32.const 0x1p-126)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const inf) (f32.const -0x1p-126)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const inf) (f32.const 0x1p-126)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const -inf) (f32.const -0x1p-1)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const -inf) (f32.const 0x1p-1)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const inf) (f32.const -0x1p-1)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const inf) (f32.const 0x1p-1)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const -inf) (f32.const -0x1p+0)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const -inf) (f32.const 0x1p+0)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const inf) (f32.const -0x1p+0)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const inf) (f32.const 0x1p+0)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const -inf) (f32.const -0x1.921fb6p+2)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const -inf) (f32.const 0x1.921fb6p+2)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const inf) (f32.const -0x1.921fb6p+2)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const inf) (f32.const 0x1.921fb6p+2)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const -inf) (f32.const -0x1.fffffep+127)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const -inf) (f32.const 0x1.fffffep+127)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const inf) (f32.const -0x1.fffffep+127)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const inf) (f32.const 0x1.fffffep+127)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const -inf) (f32.const -inf)) (i32.const 1)) +(assert_return (invoke "eq" (f32.const -inf) (f32.const inf)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const inf) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const inf) (f32.const inf)) (i32.const 1)) +(assert_return (invoke "eq" (f32.const -inf) (f32.const -nan)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const -inf) (f32.const -nan:0x200000)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const -inf) (f32.const nan)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const -inf) (f32.const nan:0x200000)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const inf) (f32.const -nan)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const inf) (f32.const -nan:0x200000)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const inf) (f32.const nan)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const inf) (f32.const nan:0x200000)) (i32.const 0)) (assert_return (invoke "eq" (f32.const -nan) (f32.const -0x0p+0)) (i32.const 0)) (assert_return (invoke "eq" (f32.const -nan:0x200000) (f32.const -0x0p+0)) (i32.const 0)) (assert_return (invoke "eq" (f32.const -nan) (f32.const 0x0p+0)) (i32.const 0)) @@ -386,14 +386,14 @@ (assert_return (invoke "eq" (f32.const nan:0x200000) (f32.const -0x1.fffffep+127)) (i32.const 0)) (assert_return (invoke "eq" (f32.const nan) (f32.const 0x1.fffffep+127)) (i32.const 0)) (assert_return (invoke "eq" (f32.const nan:0x200000) (f32.const 0x1.fffffep+127)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const -nan) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const -nan:0x200000) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const -nan) (f32.const infinity)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const -nan:0x200000) (f32.const infinity)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const nan) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const nan:0x200000) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const nan) (f32.const infinity)) (i32.const 0)) -(assert_return (invoke "eq" (f32.const nan:0x200000) (f32.const infinity)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const -nan) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const -nan:0x200000) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const -nan) (f32.const inf)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const -nan:0x200000) (f32.const inf)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const nan) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const nan:0x200000) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const nan) (f32.const inf)) (i32.const 0)) +(assert_return (invoke "eq" (f32.const nan:0x200000) (f32.const inf)) (i32.const 0)) (assert_return (invoke "eq" (f32.const -nan) (f32.const -nan)) (i32.const 0)) (assert_return (invoke "eq" (f32.const -nan:0x200000) (f32.const -nan)) (i32.const 0)) (assert_return (invoke "eq" (f32.const -nan) (f32.const -nan:0x200000)) (i32.const 0)) @@ -438,10 +438,10 @@ (assert_return (invoke "ne" (f32.const -0x0p+0) (f32.const 0x1.fffffep+127)) (i32.const 1)) (assert_return (invoke "ne" (f32.const 0x0p+0) (f32.const -0x1.fffffep+127)) (i32.const 1)) (assert_return (invoke "ne" (f32.const 0x0p+0) (f32.const 0x1.fffffep+127)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const -0x0p+0) (f32.const -infinity)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const -0x0p+0) (f32.const infinity)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const 0x0p+0) (f32.const -infinity)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const 0x0p+0) (f32.const infinity)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const -0x0p+0) (f32.const -inf)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const -0x0p+0) (f32.const inf)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const 0x0p+0) (f32.const -inf)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const 0x0p+0) (f32.const inf)) (i32.const 1)) (assert_return (invoke "ne" (f32.const -0x0p+0) (f32.const -nan)) (i32.const 1)) (assert_return (invoke "ne" (f32.const -0x0p+0) (f32.const -nan:0x200000)) (i32.const 1)) (assert_return (invoke "ne" (f32.const -0x0p+0) (f32.const nan)) (i32.const 1)) @@ -478,10 +478,10 @@ (assert_return (invoke "ne" (f32.const -0x1p-149) (f32.const 0x1.fffffep+127)) (i32.const 1)) (assert_return (invoke "ne" (f32.const 0x1p-149) (f32.const -0x1.fffffep+127)) (i32.const 1)) (assert_return (invoke "ne" (f32.const 0x1p-149) (f32.const 0x1.fffffep+127)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const -0x1p-149) (f32.const -infinity)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const -0x1p-149) (f32.const infinity)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const 0x1p-149) (f32.const -infinity)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const 0x1p-149) (f32.const infinity)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const -0x1p-149) (f32.const -inf)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const -0x1p-149) (f32.const inf)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const 0x1p-149) (f32.const -inf)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const 0x1p-149) (f32.const inf)) (i32.const 1)) (assert_return (invoke "ne" (f32.const -0x1p-149) (f32.const -nan)) (i32.const 1)) (assert_return (invoke "ne" (f32.const -0x1p-149) (f32.const -nan:0x200000)) (i32.const 1)) (assert_return (invoke "ne" (f32.const -0x1p-149) (f32.const nan)) (i32.const 1)) @@ -518,10 +518,10 @@ (assert_return (invoke "ne" (f32.const -0x1p-126) (f32.const 0x1.fffffep+127)) (i32.const 1)) (assert_return (invoke "ne" (f32.const 0x1p-126) (f32.const -0x1.fffffep+127)) (i32.const 1)) (assert_return (invoke "ne" (f32.const 0x1p-126) (f32.const 0x1.fffffep+127)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const -0x1p-126) (f32.const -infinity)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const -0x1p-126) (f32.const infinity)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const 0x1p-126) (f32.const -infinity)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const 0x1p-126) (f32.const infinity)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const -0x1p-126) (f32.const -inf)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const -0x1p-126) (f32.const inf)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const 0x1p-126) (f32.const -inf)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const 0x1p-126) (f32.const inf)) (i32.const 1)) (assert_return (invoke "ne" (f32.const -0x1p-126) (f32.const -nan)) (i32.const 1)) (assert_return (invoke "ne" (f32.const -0x1p-126) (f32.const -nan:0x200000)) (i32.const 1)) (assert_return (invoke "ne" (f32.const -0x1p-126) (f32.const nan)) (i32.const 1)) @@ -558,10 +558,10 @@ (assert_return (invoke "ne" (f32.const -0x1p-1) (f32.const 0x1.fffffep+127)) (i32.const 1)) (assert_return (invoke "ne" (f32.const 0x1p-1) (f32.const -0x1.fffffep+127)) (i32.const 1)) (assert_return (invoke "ne" (f32.const 0x1p-1) (f32.const 0x1.fffffep+127)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const -0x1p-1) (f32.const -infinity)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const -0x1p-1) (f32.const infinity)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const 0x1p-1) (f32.const -infinity)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const 0x1p-1) (f32.const infinity)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const -0x1p-1) (f32.const -inf)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const -0x1p-1) (f32.const inf)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const 0x1p-1) (f32.const -inf)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const 0x1p-1) (f32.const inf)) (i32.const 1)) (assert_return (invoke "ne" (f32.const -0x1p-1) (f32.const -nan)) (i32.const 1)) (assert_return (invoke "ne" (f32.const -0x1p-1) (f32.const -nan:0x200000)) (i32.const 1)) (assert_return (invoke "ne" (f32.const -0x1p-1) (f32.const nan)) (i32.const 1)) @@ -598,10 +598,10 @@ (assert_return (invoke "ne" (f32.const -0x1p+0) (f32.const 0x1.fffffep+127)) (i32.const 1)) (assert_return (invoke "ne" (f32.const 0x1p+0) (f32.const -0x1.fffffep+127)) (i32.const 1)) (assert_return (invoke "ne" (f32.const 0x1p+0) (f32.const 0x1.fffffep+127)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const -0x1p+0) (f32.const -infinity)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const -0x1p+0) (f32.const infinity)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const 0x1p+0) (f32.const -infinity)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const 0x1p+0) (f32.const infinity)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const -0x1p+0) (f32.const -inf)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const -0x1p+0) (f32.const inf)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const 0x1p+0) (f32.const -inf)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const 0x1p+0) (f32.const inf)) (i32.const 1)) (assert_return (invoke "ne" (f32.const -0x1p+0) (f32.const -nan)) (i32.const 1)) (assert_return (invoke "ne" (f32.const -0x1p+0) (f32.const -nan:0x200000)) (i32.const 1)) (assert_return (invoke "ne" (f32.const -0x1p+0) (f32.const nan)) (i32.const 1)) @@ -638,10 +638,10 @@ (assert_return (invoke "ne" (f32.const -0x1.921fb6p+2) (f32.const 0x1.fffffep+127)) (i32.const 1)) (assert_return (invoke "ne" (f32.const 0x1.921fb6p+2) (f32.const -0x1.fffffep+127)) (i32.const 1)) (assert_return (invoke "ne" (f32.const 0x1.921fb6p+2) (f32.const 0x1.fffffep+127)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const -0x1.921fb6p+2) (f32.const -infinity)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const -0x1.921fb6p+2) (f32.const infinity)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const 0x1.921fb6p+2) (f32.const -infinity)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const 0x1.921fb6p+2) (f32.const infinity)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const -0x1.921fb6p+2) (f32.const -inf)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const -0x1.921fb6p+2) (f32.const inf)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const 0x1.921fb6p+2) (f32.const -inf)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const 0x1.921fb6p+2) (f32.const inf)) (i32.const 1)) (assert_return (invoke "ne" (f32.const -0x1.921fb6p+2) (f32.const -nan)) (i32.const 1)) (assert_return (invoke "ne" (f32.const -0x1.921fb6p+2) (f32.const -nan:0x200000)) (i32.const 1)) (assert_return (invoke "ne" (f32.const -0x1.921fb6p+2) (f32.const nan)) (i32.const 1)) @@ -678,10 +678,10 @@ (assert_return (invoke "ne" (f32.const -0x1.fffffep+127) (f32.const 0x1.fffffep+127)) (i32.const 1)) (assert_return (invoke "ne" (f32.const 0x1.fffffep+127) (f32.const -0x1.fffffep+127)) (i32.const 1)) (assert_return (invoke "ne" (f32.const 0x1.fffffep+127) (f32.const 0x1.fffffep+127)) (i32.const 0)) -(assert_return (invoke "ne" (f32.const -0x1.fffffep+127) (f32.const -infinity)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const -0x1.fffffep+127) (f32.const infinity)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const 0x1.fffffep+127) (f32.const -infinity)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const 0x1.fffffep+127) (f32.const infinity)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const -0x1.fffffep+127) (f32.const -inf)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const -0x1.fffffep+127) (f32.const inf)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const 0x1.fffffep+127) (f32.const -inf)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const 0x1.fffffep+127) (f32.const inf)) (i32.const 1)) (assert_return (invoke "ne" (f32.const -0x1.fffffep+127) (f32.const -nan)) (i32.const 1)) (assert_return (invoke "ne" (f32.const -0x1.fffffep+127) (f32.const -nan:0x200000)) (i32.const 1)) (assert_return (invoke "ne" (f32.const -0x1.fffffep+127) (f32.const nan)) (i32.const 1)) @@ -690,46 +690,46 @@ (assert_return (invoke "ne" (f32.const 0x1.fffffep+127) (f32.const -nan:0x200000)) (i32.const 1)) (assert_return (invoke "ne" (f32.const 0x1.fffffep+127) (f32.const nan)) (i32.const 1)) (assert_return (invoke "ne" (f32.const 0x1.fffffep+127) (f32.const nan:0x200000)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const -infinity) (f32.const -0x0p+0)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const -infinity) (f32.const 0x0p+0)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const infinity) (f32.const -0x0p+0)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const infinity) (f32.const 0x0p+0)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const -infinity) (f32.const -0x1p-149)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const -infinity) (f32.const 0x1p-149)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const infinity) (f32.const -0x1p-149)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const infinity) (f32.const 0x1p-149)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const -infinity) (f32.const -0x1p-126)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const -infinity) (f32.const 0x1p-126)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const infinity) (f32.const -0x1p-126)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const infinity) (f32.const 0x1p-126)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const -infinity) (f32.const -0x1p-1)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const -infinity) (f32.const 0x1p-1)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const infinity) (f32.const -0x1p-1)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const infinity) (f32.const 0x1p-1)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const -infinity) (f32.const -0x1p+0)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const -infinity) (f32.const 0x1p+0)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const infinity) (f32.const -0x1p+0)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const infinity) (f32.const 0x1p+0)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const -infinity) (f32.const -0x1.921fb6p+2)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const -infinity) (f32.const 0x1.921fb6p+2)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const infinity) (f32.const -0x1.921fb6p+2)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const infinity) (f32.const 0x1.921fb6p+2)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const -infinity) (f32.const -0x1.fffffep+127)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const -infinity) (f32.const 0x1.fffffep+127)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const infinity) (f32.const -0x1.fffffep+127)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const infinity) (f32.const 0x1.fffffep+127)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const -infinity) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "ne" (f32.const -infinity) (f32.const infinity)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const infinity) (f32.const -infinity)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const infinity) (f32.const infinity)) (i32.const 0)) -(assert_return (invoke "ne" (f32.const -infinity) (f32.const -nan)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const -infinity) (f32.const -nan:0x200000)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const -infinity) (f32.const nan)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const -infinity) (f32.const nan:0x200000)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const infinity) (f32.const -nan)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const infinity) (f32.const -nan:0x200000)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const infinity) (f32.const nan)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const infinity) (f32.const nan:0x200000)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const -inf) (f32.const -0x0p+0)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const -inf) (f32.const 0x0p+0)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const inf) (f32.const -0x0p+0)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const inf) (f32.const 0x0p+0)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const -inf) (f32.const -0x1p-149)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const -inf) (f32.const 0x1p-149)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const inf) (f32.const -0x1p-149)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const inf) (f32.const 0x1p-149)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const -inf) (f32.const -0x1p-126)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const -inf) (f32.const 0x1p-126)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const inf) (f32.const -0x1p-126)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const inf) (f32.const 0x1p-126)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const -inf) (f32.const -0x1p-1)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const -inf) (f32.const 0x1p-1)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const inf) (f32.const -0x1p-1)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const inf) (f32.const 0x1p-1)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const -inf) (f32.const -0x1p+0)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const -inf) (f32.const 0x1p+0)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const inf) (f32.const -0x1p+0)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const inf) (f32.const 0x1p+0)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const -inf) (f32.const -0x1.921fb6p+2)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const -inf) (f32.const 0x1.921fb6p+2)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const inf) (f32.const -0x1.921fb6p+2)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const inf) (f32.const 0x1.921fb6p+2)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const -inf) (f32.const -0x1.fffffep+127)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const -inf) (f32.const 0x1.fffffep+127)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const inf) (f32.const -0x1.fffffep+127)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const inf) (f32.const 0x1.fffffep+127)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const -inf) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "ne" (f32.const -inf) (f32.const inf)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const inf) (f32.const -inf)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const inf) (f32.const inf)) (i32.const 0)) +(assert_return (invoke "ne" (f32.const -inf) (f32.const -nan)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const -inf) (f32.const -nan:0x200000)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const -inf) (f32.const nan)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const -inf) (f32.const nan:0x200000)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const inf) (f32.const -nan)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const inf) (f32.const -nan:0x200000)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const inf) (f32.const nan)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const inf) (f32.const nan:0x200000)) (i32.const 1)) (assert_return (invoke "ne" (f32.const -nan) (f32.const -0x0p+0)) (i32.const 1)) (assert_return (invoke "ne" (f32.const -nan:0x200000) (f32.const -0x0p+0)) (i32.const 1)) (assert_return (invoke "ne" (f32.const -nan) (f32.const 0x0p+0)) (i32.const 1)) @@ -786,14 +786,14 @@ (assert_return (invoke "ne" (f32.const nan:0x200000) (f32.const -0x1.fffffep+127)) (i32.const 1)) (assert_return (invoke "ne" (f32.const nan) (f32.const 0x1.fffffep+127)) (i32.const 1)) (assert_return (invoke "ne" (f32.const nan:0x200000) (f32.const 0x1.fffffep+127)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const -nan) (f32.const -infinity)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const -nan:0x200000) (f32.const -infinity)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const -nan) (f32.const infinity)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const -nan:0x200000) (f32.const infinity)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const nan) (f32.const -infinity)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const nan:0x200000) (f32.const -infinity)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const nan) (f32.const infinity)) (i32.const 1)) -(assert_return (invoke "ne" (f32.const nan:0x200000) (f32.const infinity)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const -nan) (f32.const -inf)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const -nan:0x200000) (f32.const -inf)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const -nan) (f32.const inf)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const -nan:0x200000) (f32.const inf)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const nan) (f32.const -inf)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const nan:0x200000) (f32.const -inf)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const nan) (f32.const inf)) (i32.const 1)) +(assert_return (invoke "ne" (f32.const nan:0x200000) (f32.const inf)) (i32.const 1)) (assert_return (invoke "ne" (f32.const -nan) (f32.const -nan)) (i32.const 1)) (assert_return (invoke "ne" (f32.const -nan:0x200000) (f32.const -nan)) (i32.const 1)) (assert_return (invoke "ne" (f32.const -nan) (f32.const -nan:0x200000)) (i32.const 1)) @@ -838,10 +838,10 @@ (assert_return (invoke "lt" (f32.const -0x0p+0) (f32.const 0x1.fffffep+127)) (i32.const 1)) (assert_return (invoke "lt" (f32.const 0x0p+0) (f32.const -0x1.fffffep+127)) (i32.const 0)) (assert_return (invoke "lt" (f32.const 0x0p+0) (f32.const 0x1.fffffep+127)) (i32.const 1)) -(assert_return (invoke "lt" (f32.const -0x0p+0) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "lt" (f32.const -0x0p+0) (f32.const infinity)) (i32.const 1)) -(assert_return (invoke "lt" (f32.const 0x0p+0) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "lt" (f32.const 0x0p+0) (f32.const infinity)) (i32.const 1)) +(assert_return (invoke "lt" (f32.const -0x0p+0) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "lt" (f32.const -0x0p+0) (f32.const inf)) (i32.const 1)) +(assert_return (invoke "lt" (f32.const 0x0p+0) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "lt" (f32.const 0x0p+0) (f32.const inf)) (i32.const 1)) (assert_return (invoke "lt" (f32.const -0x0p+0) (f32.const -nan)) (i32.const 0)) (assert_return (invoke "lt" (f32.const -0x0p+0) (f32.const -nan:0x200000)) (i32.const 0)) (assert_return (invoke "lt" (f32.const -0x0p+0) (f32.const nan)) (i32.const 0)) @@ -878,10 +878,10 @@ (assert_return (invoke "lt" (f32.const -0x1p-149) (f32.const 0x1.fffffep+127)) (i32.const 1)) (assert_return (invoke "lt" (f32.const 0x1p-149) (f32.const -0x1.fffffep+127)) (i32.const 0)) (assert_return (invoke "lt" (f32.const 0x1p-149) (f32.const 0x1.fffffep+127)) (i32.const 1)) -(assert_return (invoke "lt" (f32.const -0x1p-149) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "lt" (f32.const -0x1p-149) (f32.const infinity)) (i32.const 1)) -(assert_return (invoke "lt" (f32.const 0x1p-149) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "lt" (f32.const 0x1p-149) (f32.const infinity)) (i32.const 1)) +(assert_return (invoke "lt" (f32.const -0x1p-149) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "lt" (f32.const -0x1p-149) (f32.const inf)) (i32.const 1)) +(assert_return (invoke "lt" (f32.const 0x1p-149) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "lt" (f32.const 0x1p-149) (f32.const inf)) (i32.const 1)) (assert_return (invoke "lt" (f32.const -0x1p-149) (f32.const -nan)) (i32.const 0)) (assert_return (invoke "lt" (f32.const -0x1p-149) (f32.const -nan:0x200000)) (i32.const 0)) (assert_return (invoke "lt" (f32.const -0x1p-149) (f32.const nan)) (i32.const 0)) @@ -918,10 +918,10 @@ (assert_return (invoke "lt" (f32.const -0x1p-126) (f32.const 0x1.fffffep+127)) (i32.const 1)) (assert_return (invoke "lt" (f32.const 0x1p-126) (f32.const -0x1.fffffep+127)) (i32.const 0)) (assert_return (invoke "lt" (f32.const 0x1p-126) (f32.const 0x1.fffffep+127)) (i32.const 1)) -(assert_return (invoke "lt" (f32.const -0x1p-126) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "lt" (f32.const -0x1p-126) (f32.const infinity)) (i32.const 1)) -(assert_return (invoke "lt" (f32.const 0x1p-126) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "lt" (f32.const 0x1p-126) (f32.const infinity)) (i32.const 1)) +(assert_return (invoke "lt" (f32.const -0x1p-126) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "lt" (f32.const -0x1p-126) (f32.const inf)) (i32.const 1)) +(assert_return (invoke "lt" (f32.const 0x1p-126) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "lt" (f32.const 0x1p-126) (f32.const inf)) (i32.const 1)) (assert_return (invoke "lt" (f32.const -0x1p-126) (f32.const -nan)) (i32.const 0)) (assert_return (invoke "lt" (f32.const -0x1p-126) (f32.const -nan:0x200000)) (i32.const 0)) (assert_return (invoke "lt" (f32.const -0x1p-126) (f32.const nan)) (i32.const 0)) @@ -958,10 +958,10 @@ (assert_return (invoke "lt" (f32.const -0x1p-1) (f32.const 0x1.fffffep+127)) (i32.const 1)) (assert_return (invoke "lt" (f32.const 0x1p-1) (f32.const -0x1.fffffep+127)) (i32.const 0)) (assert_return (invoke "lt" (f32.const 0x1p-1) (f32.const 0x1.fffffep+127)) (i32.const 1)) -(assert_return (invoke "lt" (f32.const -0x1p-1) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "lt" (f32.const -0x1p-1) (f32.const infinity)) (i32.const 1)) -(assert_return (invoke "lt" (f32.const 0x1p-1) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "lt" (f32.const 0x1p-1) (f32.const infinity)) (i32.const 1)) +(assert_return (invoke "lt" (f32.const -0x1p-1) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "lt" (f32.const -0x1p-1) (f32.const inf)) (i32.const 1)) +(assert_return (invoke "lt" (f32.const 0x1p-1) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "lt" (f32.const 0x1p-1) (f32.const inf)) (i32.const 1)) (assert_return (invoke "lt" (f32.const -0x1p-1) (f32.const -nan)) (i32.const 0)) (assert_return (invoke "lt" (f32.const -0x1p-1) (f32.const -nan:0x200000)) (i32.const 0)) (assert_return (invoke "lt" (f32.const -0x1p-1) (f32.const nan)) (i32.const 0)) @@ -998,10 +998,10 @@ (assert_return (invoke "lt" (f32.const -0x1p+0) (f32.const 0x1.fffffep+127)) (i32.const 1)) (assert_return (invoke "lt" (f32.const 0x1p+0) (f32.const -0x1.fffffep+127)) (i32.const 0)) (assert_return (invoke "lt" (f32.const 0x1p+0) (f32.const 0x1.fffffep+127)) (i32.const 1)) -(assert_return (invoke "lt" (f32.const -0x1p+0) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "lt" (f32.const -0x1p+0) (f32.const infinity)) (i32.const 1)) -(assert_return (invoke "lt" (f32.const 0x1p+0) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "lt" (f32.const 0x1p+0) (f32.const infinity)) (i32.const 1)) +(assert_return (invoke "lt" (f32.const -0x1p+0) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "lt" (f32.const -0x1p+0) (f32.const inf)) (i32.const 1)) +(assert_return (invoke "lt" (f32.const 0x1p+0) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "lt" (f32.const 0x1p+0) (f32.const inf)) (i32.const 1)) (assert_return (invoke "lt" (f32.const -0x1p+0) (f32.const -nan)) (i32.const 0)) (assert_return (invoke "lt" (f32.const -0x1p+0) (f32.const -nan:0x200000)) (i32.const 0)) (assert_return (invoke "lt" (f32.const -0x1p+0) (f32.const nan)) (i32.const 0)) @@ -1038,10 +1038,10 @@ (assert_return (invoke "lt" (f32.const -0x1.921fb6p+2) (f32.const 0x1.fffffep+127)) (i32.const 1)) (assert_return (invoke "lt" (f32.const 0x1.921fb6p+2) (f32.const -0x1.fffffep+127)) (i32.const 0)) (assert_return (invoke "lt" (f32.const 0x1.921fb6p+2) (f32.const 0x1.fffffep+127)) (i32.const 1)) -(assert_return (invoke "lt" (f32.const -0x1.921fb6p+2) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "lt" (f32.const -0x1.921fb6p+2) (f32.const infinity)) (i32.const 1)) -(assert_return (invoke "lt" (f32.const 0x1.921fb6p+2) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "lt" (f32.const 0x1.921fb6p+2) (f32.const infinity)) (i32.const 1)) +(assert_return (invoke "lt" (f32.const -0x1.921fb6p+2) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "lt" (f32.const -0x1.921fb6p+2) (f32.const inf)) (i32.const 1)) +(assert_return (invoke "lt" (f32.const 0x1.921fb6p+2) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "lt" (f32.const 0x1.921fb6p+2) (f32.const inf)) (i32.const 1)) (assert_return (invoke "lt" (f32.const -0x1.921fb6p+2) (f32.const -nan)) (i32.const 0)) (assert_return (invoke "lt" (f32.const -0x1.921fb6p+2) (f32.const -nan:0x200000)) (i32.const 0)) (assert_return (invoke "lt" (f32.const -0x1.921fb6p+2) (f32.const nan)) (i32.const 0)) @@ -1078,10 +1078,10 @@ (assert_return (invoke "lt" (f32.const -0x1.fffffep+127) (f32.const 0x1.fffffep+127)) (i32.const 1)) (assert_return (invoke "lt" (f32.const 0x1.fffffep+127) (f32.const -0x1.fffffep+127)) (i32.const 0)) (assert_return (invoke "lt" (f32.const 0x1.fffffep+127) (f32.const 0x1.fffffep+127)) (i32.const 0)) -(assert_return (invoke "lt" (f32.const -0x1.fffffep+127) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "lt" (f32.const -0x1.fffffep+127) (f32.const infinity)) (i32.const 1)) -(assert_return (invoke "lt" (f32.const 0x1.fffffep+127) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "lt" (f32.const 0x1.fffffep+127) (f32.const infinity)) (i32.const 1)) +(assert_return (invoke "lt" (f32.const -0x1.fffffep+127) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "lt" (f32.const -0x1.fffffep+127) (f32.const inf)) (i32.const 1)) +(assert_return (invoke "lt" (f32.const 0x1.fffffep+127) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "lt" (f32.const 0x1.fffffep+127) (f32.const inf)) (i32.const 1)) (assert_return (invoke "lt" (f32.const -0x1.fffffep+127) (f32.const -nan)) (i32.const 0)) (assert_return (invoke "lt" (f32.const -0x1.fffffep+127) (f32.const -nan:0x200000)) (i32.const 0)) (assert_return (invoke "lt" (f32.const -0x1.fffffep+127) (f32.const nan)) (i32.const 0)) @@ -1090,46 +1090,46 @@ (assert_return (invoke "lt" (f32.const 0x1.fffffep+127) (f32.const -nan:0x200000)) (i32.const 0)) (assert_return (invoke "lt" (f32.const 0x1.fffffep+127) (f32.const nan)) (i32.const 0)) (assert_return (invoke "lt" (f32.const 0x1.fffffep+127) (f32.const nan:0x200000)) (i32.const 0)) -(assert_return (invoke "lt" (f32.const -infinity) (f32.const -0x0p+0)) (i32.const 1)) -(assert_return (invoke "lt" (f32.const -infinity) (f32.const 0x0p+0)) (i32.const 1)) -(assert_return (invoke "lt" (f32.const infinity) (f32.const -0x0p+0)) (i32.const 0)) -(assert_return (invoke "lt" (f32.const infinity) (f32.const 0x0p+0)) (i32.const 0)) -(assert_return (invoke "lt" (f32.const -infinity) (f32.const -0x1p-149)) (i32.const 1)) -(assert_return (invoke "lt" (f32.const -infinity) (f32.const 0x1p-149)) (i32.const 1)) -(assert_return (invoke "lt" (f32.const infinity) (f32.const -0x1p-149)) (i32.const 0)) -(assert_return (invoke "lt" (f32.const infinity) (f32.const 0x1p-149)) (i32.const 0)) -(assert_return (invoke "lt" (f32.const -infinity) (f32.const -0x1p-126)) (i32.const 1)) -(assert_return (invoke "lt" (f32.const -infinity) (f32.const 0x1p-126)) (i32.const 1)) -(assert_return (invoke "lt" (f32.const infinity) (f32.const -0x1p-126)) (i32.const 0)) -(assert_return (invoke "lt" (f32.const infinity) (f32.const 0x1p-126)) (i32.const 0)) -(assert_return (invoke "lt" (f32.const -infinity) (f32.const -0x1p-1)) (i32.const 1)) -(assert_return (invoke "lt" (f32.const -infinity) (f32.const 0x1p-1)) (i32.const 1)) -(assert_return (invoke "lt" (f32.const infinity) (f32.const -0x1p-1)) (i32.const 0)) -(assert_return (invoke "lt" (f32.const infinity) (f32.const 0x1p-1)) (i32.const 0)) -(assert_return (invoke "lt" (f32.const -infinity) (f32.const -0x1p+0)) (i32.const 1)) -(assert_return (invoke "lt" (f32.const -infinity) (f32.const 0x1p+0)) (i32.const 1)) -(assert_return (invoke "lt" (f32.const infinity) (f32.const -0x1p+0)) (i32.const 0)) -(assert_return (invoke "lt" (f32.const infinity) (f32.const 0x1p+0)) (i32.const 0)) -(assert_return (invoke "lt" (f32.const -infinity) (f32.const -0x1.921fb6p+2)) (i32.const 1)) -(assert_return (invoke "lt" (f32.const -infinity) (f32.const 0x1.921fb6p+2)) (i32.const 1)) -(assert_return (invoke "lt" (f32.const infinity) (f32.const -0x1.921fb6p+2)) (i32.const 0)) -(assert_return (invoke "lt" (f32.const infinity) (f32.const 0x1.921fb6p+2)) (i32.const 0)) -(assert_return (invoke "lt" (f32.const -infinity) (f32.const -0x1.fffffep+127)) (i32.const 1)) -(assert_return (invoke "lt" (f32.const -infinity) (f32.const 0x1.fffffep+127)) (i32.const 1)) -(assert_return (invoke "lt" (f32.const infinity) (f32.const -0x1.fffffep+127)) (i32.const 0)) -(assert_return (invoke "lt" (f32.const infinity) (f32.const 0x1.fffffep+127)) (i32.const 0)) -(assert_return (invoke "lt" (f32.const -infinity) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "lt" (f32.const -infinity) (f32.const infinity)) (i32.const 1)) -(assert_return (invoke "lt" (f32.const infinity) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "lt" (f32.const infinity) (f32.const infinity)) (i32.const 0)) -(assert_return (invoke "lt" (f32.const -infinity) (f32.const -nan)) (i32.const 0)) -(assert_return (invoke "lt" (f32.const -infinity) (f32.const -nan:0x200000)) (i32.const 0)) -(assert_return (invoke "lt" (f32.const -infinity) (f32.const nan)) (i32.const 0)) -(assert_return (invoke "lt" (f32.const -infinity) (f32.const nan:0x200000)) (i32.const 0)) -(assert_return (invoke "lt" (f32.const infinity) (f32.const -nan)) (i32.const 0)) -(assert_return (invoke "lt" (f32.const infinity) (f32.const -nan:0x200000)) (i32.const 0)) -(assert_return (invoke "lt" (f32.const infinity) (f32.const nan)) (i32.const 0)) -(assert_return (invoke "lt" (f32.const infinity) (f32.const nan:0x200000)) (i32.const 0)) +(assert_return (invoke "lt" (f32.const -inf) (f32.const -0x0p+0)) (i32.const 1)) +(assert_return (invoke "lt" (f32.const -inf) (f32.const 0x0p+0)) (i32.const 1)) +(assert_return (invoke "lt" (f32.const inf) (f32.const -0x0p+0)) (i32.const 0)) +(assert_return (invoke "lt" (f32.const inf) (f32.const 0x0p+0)) (i32.const 0)) +(assert_return (invoke "lt" (f32.const -inf) (f32.const -0x1p-149)) (i32.const 1)) +(assert_return (invoke "lt" (f32.const -inf) (f32.const 0x1p-149)) (i32.const 1)) +(assert_return (invoke "lt" (f32.const inf) (f32.const -0x1p-149)) (i32.const 0)) +(assert_return (invoke "lt" (f32.const inf) (f32.const 0x1p-149)) (i32.const 0)) +(assert_return (invoke "lt" (f32.const -inf) (f32.const -0x1p-126)) (i32.const 1)) +(assert_return (invoke "lt" (f32.const -inf) (f32.const 0x1p-126)) (i32.const 1)) +(assert_return (invoke "lt" (f32.const inf) (f32.const -0x1p-126)) (i32.const 0)) +(assert_return (invoke "lt" (f32.const inf) (f32.const 0x1p-126)) (i32.const 0)) +(assert_return (invoke "lt" (f32.const -inf) (f32.const -0x1p-1)) (i32.const 1)) +(assert_return (invoke "lt" (f32.const -inf) (f32.const 0x1p-1)) (i32.const 1)) +(assert_return (invoke "lt" (f32.const inf) (f32.const -0x1p-1)) (i32.const 0)) +(assert_return (invoke "lt" (f32.const inf) (f32.const 0x1p-1)) (i32.const 0)) +(assert_return (invoke "lt" (f32.const -inf) (f32.const -0x1p+0)) (i32.const 1)) +(assert_return (invoke "lt" (f32.const -inf) (f32.const 0x1p+0)) (i32.const 1)) +(assert_return (invoke "lt" (f32.const inf) (f32.const -0x1p+0)) (i32.const 0)) +(assert_return (invoke "lt" (f32.const inf) (f32.const 0x1p+0)) (i32.const 0)) +(assert_return (invoke "lt" (f32.const -inf) (f32.const -0x1.921fb6p+2)) (i32.const 1)) +(assert_return (invoke "lt" (f32.const -inf) (f32.const 0x1.921fb6p+2)) (i32.const 1)) +(assert_return (invoke "lt" (f32.const inf) (f32.const -0x1.921fb6p+2)) (i32.const 0)) +(assert_return (invoke "lt" (f32.const inf) (f32.const 0x1.921fb6p+2)) (i32.const 0)) +(assert_return (invoke "lt" (f32.const -inf) (f32.const -0x1.fffffep+127)) (i32.const 1)) +(assert_return (invoke "lt" (f32.const -inf) (f32.const 0x1.fffffep+127)) (i32.const 1)) +(assert_return (invoke "lt" (f32.const inf) (f32.const -0x1.fffffep+127)) (i32.const 0)) +(assert_return (invoke "lt" (f32.const inf) (f32.const 0x1.fffffep+127)) (i32.const 0)) +(assert_return (invoke "lt" (f32.const -inf) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "lt" (f32.const -inf) (f32.const inf)) (i32.const 1)) +(assert_return (invoke "lt" (f32.const inf) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "lt" (f32.const inf) (f32.const inf)) (i32.const 0)) +(assert_return (invoke "lt" (f32.const -inf) (f32.const -nan)) (i32.const 0)) +(assert_return (invoke "lt" (f32.const -inf) (f32.const -nan:0x200000)) (i32.const 0)) +(assert_return (invoke "lt" (f32.const -inf) (f32.const nan)) (i32.const 0)) +(assert_return (invoke "lt" (f32.const -inf) (f32.const nan:0x200000)) (i32.const 0)) +(assert_return (invoke "lt" (f32.const inf) (f32.const -nan)) (i32.const 0)) +(assert_return (invoke "lt" (f32.const inf) (f32.const -nan:0x200000)) (i32.const 0)) +(assert_return (invoke "lt" (f32.const inf) (f32.const nan)) (i32.const 0)) +(assert_return (invoke "lt" (f32.const inf) (f32.const nan:0x200000)) (i32.const 0)) (assert_return (invoke "lt" (f32.const -nan) (f32.const -0x0p+0)) (i32.const 0)) (assert_return (invoke "lt" (f32.const -nan:0x200000) (f32.const -0x0p+0)) (i32.const 0)) (assert_return (invoke "lt" (f32.const -nan) (f32.const 0x0p+0)) (i32.const 0)) @@ -1186,14 +1186,14 @@ (assert_return (invoke "lt" (f32.const nan:0x200000) (f32.const -0x1.fffffep+127)) (i32.const 0)) (assert_return (invoke "lt" (f32.const nan) (f32.const 0x1.fffffep+127)) (i32.const 0)) (assert_return (invoke "lt" (f32.const nan:0x200000) (f32.const 0x1.fffffep+127)) (i32.const 0)) -(assert_return (invoke "lt" (f32.const -nan) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "lt" (f32.const -nan:0x200000) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "lt" (f32.const -nan) (f32.const infinity)) (i32.const 0)) -(assert_return (invoke "lt" (f32.const -nan:0x200000) (f32.const infinity)) (i32.const 0)) -(assert_return (invoke "lt" (f32.const nan) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "lt" (f32.const nan:0x200000) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "lt" (f32.const nan) (f32.const infinity)) (i32.const 0)) -(assert_return (invoke "lt" (f32.const nan:0x200000) (f32.const infinity)) (i32.const 0)) +(assert_return (invoke "lt" (f32.const -nan) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "lt" (f32.const -nan:0x200000) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "lt" (f32.const -nan) (f32.const inf)) (i32.const 0)) +(assert_return (invoke "lt" (f32.const -nan:0x200000) (f32.const inf)) (i32.const 0)) +(assert_return (invoke "lt" (f32.const nan) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "lt" (f32.const nan:0x200000) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "lt" (f32.const nan) (f32.const inf)) (i32.const 0)) +(assert_return (invoke "lt" (f32.const nan:0x200000) (f32.const inf)) (i32.const 0)) (assert_return (invoke "lt" (f32.const -nan) (f32.const -nan)) (i32.const 0)) (assert_return (invoke "lt" (f32.const -nan:0x200000) (f32.const -nan)) (i32.const 0)) (assert_return (invoke "lt" (f32.const -nan) (f32.const -nan:0x200000)) (i32.const 0)) @@ -1238,10 +1238,10 @@ (assert_return (invoke "le" (f32.const -0x0p+0) (f32.const 0x1.fffffep+127)) (i32.const 1)) (assert_return (invoke "le" (f32.const 0x0p+0) (f32.const -0x1.fffffep+127)) (i32.const 0)) (assert_return (invoke "le" (f32.const 0x0p+0) (f32.const 0x1.fffffep+127)) (i32.const 1)) -(assert_return (invoke "le" (f32.const -0x0p+0) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "le" (f32.const -0x0p+0) (f32.const infinity)) (i32.const 1)) -(assert_return (invoke "le" (f32.const 0x0p+0) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "le" (f32.const 0x0p+0) (f32.const infinity)) (i32.const 1)) +(assert_return (invoke "le" (f32.const -0x0p+0) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "le" (f32.const -0x0p+0) (f32.const inf)) (i32.const 1)) +(assert_return (invoke "le" (f32.const 0x0p+0) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "le" (f32.const 0x0p+0) (f32.const inf)) (i32.const 1)) (assert_return (invoke "le" (f32.const -0x0p+0) (f32.const -nan)) (i32.const 0)) (assert_return (invoke "le" (f32.const -0x0p+0) (f32.const -nan:0x200000)) (i32.const 0)) (assert_return (invoke "le" (f32.const -0x0p+0) (f32.const nan)) (i32.const 0)) @@ -1278,10 +1278,10 @@ (assert_return (invoke "le" (f32.const -0x1p-149) (f32.const 0x1.fffffep+127)) (i32.const 1)) (assert_return (invoke "le" (f32.const 0x1p-149) (f32.const -0x1.fffffep+127)) (i32.const 0)) (assert_return (invoke "le" (f32.const 0x1p-149) (f32.const 0x1.fffffep+127)) (i32.const 1)) -(assert_return (invoke "le" (f32.const -0x1p-149) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "le" (f32.const -0x1p-149) (f32.const infinity)) (i32.const 1)) -(assert_return (invoke "le" (f32.const 0x1p-149) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "le" (f32.const 0x1p-149) (f32.const infinity)) (i32.const 1)) +(assert_return (invoke "le" (f32.const -0x1p-149) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "le" (f32.const -0x1p-149) (f32.const inf)) (i32.const 1)) +(assert_return (invoke "le" (f32.const 0x1p-149) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "le" (f32.const 0x1p-149) (f32.const inf)) (i32.const 1)) (assert_return (invoke "le" (f32.const -0x1p-149) (f32.const -nan)) (i32.const 0)) (assert_return (invoke "le" (f32.const -0x1p-149) (f32.const -nan:0x200000)) (i32.const 0)) (assert_return (invoke "le" (f32.const -0x1p-149) (f32.const nan)) (i32.const 0)) @@ -1318,10 +1318,10 @@ (assert_return (invoke "le" (f32.const -0x1p-126) (f32.const 0x1.fffffep+127)) (i32.const 1)) (assert_return (invoke "le" (f32.const 0x1p-126) (f32.const -0x1.fffffep+127)) (i32.const 0)) (assert_return (invoke "le" (f32.const 0x1p-126) (f32.const 0x1.fffffep+127)) (i32.const 1)) -(assert_return (invoke "le" (f32.const -0x1p-126) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "le" (f32.const -0x1p-126) (f32.const infinity)) (i32.const 1)) -(assert_return (invoke "le" (f32.const 0x1p-126) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "le" (f32.const 0x1p-126) (f32.const infinity)) (i32.const 1)) +(assert_return (invoke "le" (f32.const -0x1p-126) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "le" (f32.const -0x1p-126) (f32.const inf)) (i32.const 1)) +(assert_return (invoke "le" (f32.const 0x1p-126) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "le" (f32.const 0x1p-126) (f32.const inf)) (i32.const 1)) (assert_return (invoke "le" (f32.const -0x1p-126) (f32.const -nan)) (i32.const 0)) (assert_return (invoke "le" (f32.const -0x1p-126) (f32.const -nan:0x200000)) (i32.const 0)) (assert_return (invoke "le" (f32.const -0x1p-126) (f32.const nan)) (i32.const 0)) @@ -1358,10 +1358,10 @@ (assert_return (invoke "le" (f32.const -0x1p-1) (f32.const 0x1.fffffep+127)) (i32.const 1)) (assert_return (invoke "le" (f32.const 0x1p-1) (f32.const -0x1.fffffep+127)) (i32.const 0)) (assert_return (invoke "le" (f32.const 0x1p-1) (f32.const 0x1.fffffep+127)) (i32.const 1)) -(assert_return (invoke "le" (f32.const -0x1p-1) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "le" (f32.const -0x1p-1) (f32.const infinity)) (i32.const 1)) -(assert_return (invoke "le" (f32.const 0x1p-1) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "le" (f32.const 0x1p-1) (f32.const infinity)) (i32.const 1)) +(assert_return (invoke "le" (f32.const -0x1p-1) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "le" (f32.const -0x1p-1) (f32.const inf)) (i32.const 1)) +(assert_return (invoke "le" (f32.const 0x1p-1) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "le" (f32.const 0x1p-1) (f32.const inf)) (i32.const 1)) (assert_return (invoke "le" (f32.const -0x1p-1) (f32.const -nan)) (i32.const 0)) (assert_return (invoke "le" (f32.const -0x1p-1) (f32.const -nan:0x200000)) (i32.const 0)) (assert_return (invoke "le" (f32.const -0x1p-1) (f32.const nan)) (i32.const 0)) @@ -1398,10 +1398,10 @@ (assert_return (invoke "le" (f32.const -0x1p+0) (f32.const 0x1.fffffep+127)) (i32.const 1)) (assert_return (invoke "le" (f32.const 0x1p+0) (f32.const -0x1.fffffep+127)) (i32.const 0)) (assert_return (invoke "le" (f32.const 0x1p+0) (f32.const 0x1.fffffep+127)) (i32.const 1)) -(assert_return (invoke "le" (f32.const -0x1p+0) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "le" (f32.const -0x1p+0) (f32.const infinity)) (i32.const 1)) -(assert_return (invoke "le" (f32.const 0x1p+0) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "le" (f32.const 0x1p+0) (f32.const infinity)) (i32.const 1)) +(assert_return (invoke "le" (f32.const -0x1p+0) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "le" (f32.const -0x1p+0) (f32.const inf)) (i32.const 1)) +(assert_return (invoke "le" (f32.const 0x1p+0) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "le" (f32.const 0x1p+0) (f32.const inf)) (i32.const 1)) (assert_return (invoke "le" (f32.const -0x1p+0) (f32.const -nan)) (i32.const 0)) (assert_return (invoke "le" (f32.const -0x1p+0) (f32.const -nan:0x200000)) (i32.const 0)) (assert_return (invoke "le" (f32.const -0x1p+0) (f32.const nan)) (i32.const 0)) @@ -1438,10 +1438,10 @@ (assert_return (invoke "le" (f32.const -0x1.921fb6p+2) (f32.const 0x1.fffffep+127)) (i32.const 1)) (assert_return (invoke "le" (f32.const 0x1.921fb6p+2) (f32.const -0x1.fffffep+127)) (i32.const 0)) (assert_return (invoke "le" (f32.const 0x1.921fb6p+2) (f32.const 0x1.fffffep+127)) (i32.const 1)) -(assert_return (invoke "le" (f32.const -0x1.921fb6p+2) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "le" (f32.const -0x1.921fb6p+2) (f32.const infinity)) (i32.const 1)) -(assert_return (invoke "le" (f32.const 0x1.921fb6p+2) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "le" (f32.const 0x1.921fb6p+2) (f32.const infinity)) (i32.const 1)) +(assert_return (invoke "le" (f32.const -0x1.921fb6p+2) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "le" (f32.const -0x1.921fb6p+2) (f32.const inf)) (i32.const 1)) +(assert_return (invoke "le" (f32.const 0x1.921fb6p+2) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "le" (f32.const 0x1.921fb6p+2) (f32.const inf)) (i32.const 1)) (assert_return (invoke "le" (f32.const -0x1.921fb6p+2) (f32.const -nan)) (i32.const 0)) (assert_return (invoke "le" (f32.const -0x1.921fb6p+2) (f32.const -nan:0x200000)) (i32.const 0)) (assert_return (invoke "le" (f32.const -0x1.921fb6p+2) (f32.const nan)) (i32.const 0)) @@ -1478,10 +1478,10 @@ (assert_return (invoke "le" (f32.const -0x1.fffffep+127) (f32.const 0x1.fffffep+127)) (i32.const 1)) (assert_return (invoke "le" (f32.const 0x1.fffffep+127) (f32.const -0x1.fffffep+127)) (i32.const 0)) (assert_return (invoke "le" (f32.const 0x1.fffffep+127) (f32.const 0x1.fffffep+127)) (i32.const 1)) -(assert_return (invoke "le" (f32.const -0x1.fffffep+127) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "le" (f32.const -0x1.fffffep+127) (f32.const infinity)) (i32.const 1)) -(assert_return (invoke "le" (f32.const 0x1.fffffep+127) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "le" (f32.const 0x1.fffffep+127) (f32.const infinity)) (i32.const 1)) +(assert_return (invoke "le" (f32.const -0x1.fffffep+127) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "le" (f32.const -0x1.fffffep+127) (f32.const inf)) (i32.const 1)) +(assert_return (invoke "le" (f32.const 0x1.fffffep+127) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "le" (f32.const 0x1.fffffep+127) (f32.const inf)) (i32.const 1)) (assert_return (invoke "le" (f32.const -0x1.fffffep+127) (f32.const -nan)) (i32.const 0)) (assert_return (invoke "le" (f32.const -0x1.fffffep+127) (f32.const -nan:0x200000)) (i32.const 0)) (assert_return (invoke "le" (f32.const -0x1.fffffep+127) (f32.const nan)) (i32.const 0)) @@ -1490,46 +1490,46 @@ (assert_return (invoke "le" (f32.const 0x1.fffffep+127) (f32.const -nan:0x200000)) (i32.const 0)) (assert_return (invoke "le" (f32.const 0x1.fffffep+127) (f32.const nan)) (i32.const 0)) (assert_return (invoke "le" (f32.const 0x1.fffffep+127) (f32.const nan:0x200000)) (i32.const 0)) -(assert_return (invoke "le" (f32.const -infinity) (f32.const -0x0p+0)) (i32.const 1)) -(assert_return (invoke "le" (f32.const -infinity) (f32.const 0x0p+0)) (i32.const 1)) -(assert_return (invoke "le" (f32.const infinity) (f32.const -0x0p+0)) (i32.const 0)) -(assert_return (invoke "le" (f32.const infinity) (f32.const 0x0p+0)) (i32.const 0)) -(assert_return (invoke "le" (f32.const -infinity) (f32.const -0x1p-149)) (i32.const 1)) -(assert_return (invoke "le" (f32.const -infinity) (f32.const 0x1p-149)) (i32.const 1)) -(assert_return (invoke "le" (f32.const infinity) (f32.const -0x1p-149)) (i32.const 0)) -(assert_return (invoke "le" (f32.const infinity) (f32.const 0x1p-149)) (i32.const 0)) -(assert_return (invoke "le" (f32.const -infinity) (f32.const -0x1p-126)) (i32.const 1)) -(assert_return (invoke "le" (f32.const -infinity) (f32.const 0x1p-126)) (i32.const 1)) -(assert_return (invoke "le" (f32.const infinity) (f32.const -0x1p-126)) (i32.const 0)) -(assert_return (invoke "le" (f32.const infinity) (f32.const 0x1p-126)) (i32.const 0)) -(assert_return (invoke "le" (f32.const -infinity) (f32.const -0x1p-1)) (i32.const 1)) -(assert_return (invoke "le" (f32.const -infinity) (f32.const 0x1p-1)) (i32.const 1)) -(assert_return (invoke "le" (f32.const infinity) (f32.const -0x1p-1)) (i32.const 0)) -(assert_return (invoke "le" (f32.const infinity) (f32.const 0x1p-1)) (i32.const 0)) -(assert_return (invoke "le" (f32.const -infinity) (f32.const -0x1p+0)) (i32.const 1)) -(assert_return (invoke "le" (f32.const -infinity) (f32.const 0x1p+0)) (i32.const 1)) -(assert_return (invoke "le" (f32.const infinity) (f32.const -0x1p+0)) (i32.const 0)) -(assert_return (invoke "le" (f32.const infinity) (f32.const 0x1p+0)) (i32.const 0)) -(assert_return (invoke "le" (f32.const -infinity) (f32.const -0x1.921fb6p+2)) (i32.const 1)) -(assert_return (invoke "le" (f32.const -infinity) (f32.const 0x1.921fb6p+2)) (i32.const 1)) -(assert_return (invoke "le" (f32.const infinity) (f32.const -0x1.921fb6p+2)) (i32.const 0)) -(assert_return (invoke "le" (f32.const infinity) (f32.const 0x1.921fb6p+2)) (i32.const 0)) -(assert_return (invoke "le" (f32.const -infinity) (f32.const -0x1.fffffep+127)) (i32.const 1)) -(assert_return (invoke "le" (f32.const -infinity) (f32.const 0x1.fffffep+127)) (i32.const 1)) -(assert_return (invoke "le" (f32.const infinity) (f32.const -0x1.fffffep+127)) (i32.const 0)) -(assert_return (invoke "le" (f32.const infinity) (f32.const 0x1.fffffep+127)) (i32.const 0)) -(assert_return (invoke "le" (f32.const -infinity) (f32.const -infinity)) (i32.const 1)) -(assert_return (invoke "le" (f32.const -infinity) (f32.const infinity)) (i32.const 1)) -(assert_return (invoke "le" (f32.const infinity) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "le" (f32.const infinity) (f32.const infinity)) (i32.const 1)) -(assert_return (invoke "le" (f32.const -infinity) (f32.const -nan)) (i32.const 0)) -(assert_return (invoke "le" (f32.const -infinity) (f32.const -nan:0x200000)) (i32.const 0)) -(assert_return (invoke "le" (f32.const -infinity) (f32.const nan)) (i32.const 0)) -(assert_return (invoke "le" (f32.const -infinity) (f32.const nan:0x200000)) (i32.const 0)) -(assert_return (invoke "le" (f32.const infinity) (f32.const -nan)) (i32.const 0)) -(assert_return (invoke "le" (f32.const infinity) (f32.const -nan:0x200000)) (i32.const 0)) -(assert_return (invoke "le" (f32.const infinity) (f32.const nan)) (i32.const 0)) -(assert_return (invoke "le" (f32.const infinity) (f32.const nan:0x200000)) (i32.const 0)) +(assert_return (invoke "le" (f32.const -inf) (f32.const -0x0p+0)) (i32.const 1)) +(assert_return (invoke "le" (f32.const -inf) (f32.const 0x0p+0)) (i32.const 1)) +(assert_return (invoke "le" (f32.const inf) (f32.const -0x0p+0)) (i32.const 0)) +(assert_return (invoke "le" (f32.const inf) (f32.const 0x0p+0)) (i32.const 0)) +(assert_return (invoke "le" (f32.const -inf) (f32.const -0x1p-149)) (i32.const 1)) +(assert_return (invoke "le" (f32.const -inf) (f32.const 0x1p-149)) (i32.const 1)) +(assert_return (invoke "le" (f32.const inf) (f32.const -0x1p-149)) (i32.const 0)) +(assert_return (invoke "le" (f32.const inf) (f32.const 0x1p-149)) (i32.const 0)) +(assert_return (invoke "le" (f32.const -inf) (f32.const -0x1p-126)) (i32.const 1)) +(assert_return (invoke "le" (f32.const -inf) (f32.const 0x1p-126)) (i32.const 1)) +(assert_return (invoke "le" (f32.const inf) (f32.const -0x1p-126)) (i32.const 0)) +(assert_return (invoke "le" (f32.const inf) (f32.const 0x1p-126)) (i32.const 0)) +(assert_return (invoke "le" (f32.const -inf) (f32.const -0x1p-1)) (i32.const 1)) +(assert_return (invoke "le" (f32.const -inf) (f32.const 0x1p-1)) (i32.const 1)) +(assert_return (invoke "le" (f32.const inf) (f32.const -0x1p-1)) (i32.const 0)) +(assert_return (invoke "le" (f32.const inf) (f32.const 0x1p-1)) (i32.const 0)) +(assert_return (invoke "le" (f32.const -inf) (f32.const -0x1p+0)) (i32.const 1)) +(assert_return (invoke "le" (f32.const -inf) (f32.const 0x1p+0)) (i32.const 1)) +(assert_return (invoke "le" (f32.const inf) (f32.const -0x1p+0)) (i32.const 0)) +(assert_return (invoke "le" (f32.const inf) (f32.const 0x1p+0)) (i32.const 0)) +(assert_return (invoke "le" (f32.const -inf) (f32.const -0x1.921fb6p+2)) (i32.const 1)) +(assert_return (invoke "le" (f32.const -inf) (f32.const 0x1.921fb6p+2)) (i32.const 1)) +(assert_return (invoke "le" (f32.const inf) (f32.const -0x1.921fb6p+2)) (i32.const 0)) +(assert_return (invoke "le" (f32.const inf) (f32.const 0x1.921fb6p+2)) (i32.const 0)) +(assert_return (invoke "le" (f32.const -inf) (f32.const -0x1.fffffep+127)) (i32.const 1)) +(assert_return (invoke "le" (f32.const -inf) (f32.const 0x1.fffffep+127)) (i32.const 1)) +(assert_return (invoke "le" (f32.const inf) (f32.const -0x1.fffffep+127)) (i32.const 0)) +(assert_return (invoke "le" (f32.const inf) (f32.const 0x1.fffffep+127)) (i32.const 0)) +(assert_return (invoke "le" (f32.const -inf) (f32.const -inf)) (i32.const 1)) +(assert_return (invoke "le" (f32.const -inf) (f32.const inf)) (i32.const 1)) +(assert_return (invoke "le" (f32.const inf) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "le" (f32.const inf) (f32.const inf)) (i32.const 1)) +(assert_return (invoke "le" (f32.const -inf) (f32.const -nan)) (i32.const 0)) +(assert_return (invoke "le" (f32.const -inf) (f32.const -nan:0x200000)) (i32.const 0)) +(assert_return (invoke "le" (f32.const -inf) (f32.const nan)) (i32.const 0)) +(assert_return (invoke "le" (f32.const -inf) (f32.const nan:0x200000)) (i32.const 0)) +(assert_return (invoke "le" (f32.const inf) (f32.const -nan)) (i32.const 0)) +(assert_return (invoke "le" (f32.const inf) (f32.const -nan:0x200000)) (i32.const 0)) +(assert_return (invoke "le" (f32.const inf) (f32.const nan)) (i32.const 0)) +(assert_return (invoke "le" (f32.const inf) (f32.const nan:0x200000)) (i32.const 0)) (assert_return (invoke "le" (f32.const -nan) (f32.const -0x0p+0)) (i32.const 0)) (assert_return (invoke "le" (f32.const -nan:0x200000) (f32.const -0x0p+0)) (i32.const 0)) (assert_return (invoke "le" (f32.const -nan) (f32.const 0x0p+0)) (i32.const 0)) @@ -1586,14 +1586,14 @@ (assert_return (invoke "le" (f32.const nan:0x200000) (f32.const -0x1.fffffep+127)) (i32.const 0)) (assert_return (invoke "le" (f32.const nan) (f32.const 0x1.fffffep+127)) (i32.const 0)) (assert_return (invoke "le" (f32.const nan:0x200000) (f32.const 0x1.fffffep+127)) (i32.const 0)) -(assert_return (invoke "le" (f32.const -nan) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "le" (f32.const -nan:0x200000) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "le" (f32.const -nan) (f32.const infinity)) (i32.const 0)) -(assert_return (invoke "le" (f32.const -nan:0x200000) (f32.const infinity)) (i32.const 0)) -(assert_return (invoke "le" (f32.const nan) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "le" (f32.const nan:0x200000) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "le" (f32.const nan) (f32.const infinity)) (i32.const 0)) -(assert_return (invoke "le" (f32.const nan:0x200000) (f32.const infinity)) (i32.const 0)) +(assert_return (invoke "le" (f32.const -nan) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "le" (f32.const -nan:0x200000) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "le" (f32.const -nan) (f32.const inf)) (i32.const 0)) +(assert_return (invoke "le" (f32.const -nan:0x200000) (f32.const inf)) (i32.const 0)) +(assert_return (invoke "le" (f32.const nan) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "le" (f32.const nan:0x200000) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "le" (f32.const nan) (f32.const inf)) (i32.const 0)) +(assert_return (invoke "le" (f32.const nan:0x200000) (f32.const inf)) (i32.const 0)) (assert_return (invoke "le" (f32.const -nan) (f32.const -nan)) (i32.const 0)) (assert_return (invoke "le" (f32.const -nan:0x200000) (f32.const -nan)) (i32.const 0)) (assert_return (invoke "le" (f32.const -nan) (f32.const -nan:0x200000)) (i32.const 0)) @@ -1638,10 +1638,10 @@ (assert_return (invoke "gt" (f32.const -0x0p+0) (f32.const 0x1.fffffep+127)) (i32.const 0)) (assert_return (invoke "gt" (f32.const 0x0p+0) (f32.const -0x1.fffffep+127)) (i32.const 1)) (assert_return (invoke "gt" (f32.const 0x0p+0) (f32.const 0x1.fffffep+127)) (i32.const 0)) -(assert_return (invoke "gt" (f32.const -0x0p+0) (f32.const -infinity)) (i32.const 1)) -(assert_return (invoke "gt" (f32.const -0x0p+0) (f32.const infinity)) (i32.const 0)) -(assert_return (invoke "gt" (f32.const 0x0p+0) (f32.const -infinity)) (i32.const 1)) -(assert_return (invoke "gt" (f32.const 0x0p+0) (f32.const infinity)) (i32.const 0)) +(assert_return (invoke "gt" (f32.const -0x0p+0) (f32.const -inf)) (i32.const 1)) +(assert_return (invoke "gt" (f32.const -0x0p+0) (f32.const inf)) (i32.const 0)) +(assert_return (invoke "gt" (f32.const 0x0p+0) (f32.const -inf)) (i32.const 1)) +(assert_return (invoke "gt" (f32.const 0x0p+0) (f32.const inf)) (i32.const 0)) (assert_return (invoke "gt" (f32.const -0x0p+0) (f32.const -nan)) (i32.const 0)) (assert_return (invoke "gt" (f32.const -0x0p+0) (f32.const -nan:0x200000)) (i32.const 0)) (assert_return (invoke "gt" (f32.const -0x0p+0) (f32.const nan)) (i32.const 0)) @@ -1678,10 +1678,10 @@ (assert_return (invoke "gt" (f32.const -0x1p-149) (f32.const 0x1.fffffep+127)) (i32.const 0)) (assert_return (invoke "gt" (f32.const 0x1p-149) (f32.const -0x1.fffffep+127)) (i32.const 1)) (assert_return (invoke "gt" (f32.const 0x1p-149) (f32.const 0x1.fffffep+127)) (i32.const 0)) -(assert_return (invoke "gt" (f32.const -0x1p-149) (f32.const -infinity)) (i32.const 1)) -(assert_return (invoke "gt" (f32.const -0x1p-149) (f32.const infinity)) (i32.const 0)) -(assert_return (invoke "gt" (f32.const 0x1p-149) (f32.const -infinity)) (i32.const 1)) -(assert_return (invoke "gt" (f32.const 0x1p-149) (f32.const infinity)) (i32.const 0)) +(assert_return (invoke "gt" (f32.const -0x1p-149) (f32.const -inf)) (i32.const 1)) +(assert_return (invoke "gt" (f32.const -0x1p-149) (f32.const inf)) (i32.const 0)) +(assert_return (invoke "gt" (f32.const 0x1p-149) (f32.const -inf)) (i32.const 1)) +(assert_return (invoke "gt" (f32.const 0x1p-149) (f32.const inf)) (i32.const 0)) (assert_return (invoke "gt" (f32.const -0x1p-149) (f32.const -nan)) (i32.const 0)) (assert_return (invoke "gt" (f32.const -0x1p-149) (f32.const -nan:0x200000)) (i32.const 0)) (assert_return (invoke "gt" (f32.const -0x1p-149) (f32.const nan)) (i32.const 0)) @@ -1718,10 +1718,10 @@ (assert_return (invoke "gt" (f32.const -0x1p-126) (f32.const 0x1.fffffep+127)) (i32.const 0)) (assert_return (invoke "gt" (f32.const 0x1p-126) (f32.const -0x1.fffffep+127)) (i32.const 1)) (assert_return (invoke "gt" (f32.const 0x1p-126) (f32.const 0x1.fffffep+127)) (i32.const 0)) -(assert_return (invoke "gt" (f32.const -0x1p-126) (f32.const -infinity)) (i32.const 1)) -(assert_return (invoke "gt" (f32.const -0x1p-126) (f32.const infinity)) (i32.const 0)) -(assert_return (invoke "gt" (f32.const 0x1p-126) (f32.const -infinity)) (i32.const 1)) -(assert_return (invoke "gt" (f32.const 0x1p-126) (f32.const infinity)) (i32.const 0)) +(assert_return (invoke "gt" (f32.const -0x1p-126) (f32.const -inf)) (i32.const 1)) +(assert_return (invoke "gt" (f32.const -0x1p-126) (f32.const inf)) (i32.const 0)) +(assert_return (invoke "gt" (f32.const 0x1p-126) (f32.const -inf)) (i32.const 1)) +(assert_return (invoke "gt" (f32.const 0x1p-126) (f32.const inf)) (i32.const 0)) (assert_return (invoke "gt" (f32.const -0x1p-126) (f32.const -nan)) (i32.const 0)) (assert_return (invoke "gt" (f32.const -0x1p-126) (f32.const -nan:0x200000)) (i32.const 0)) (assert_return (invoke "gt" (f32.const -0x1p-126) (f32.const nan)) (i32.const 0)) @@ -1758,10 +1758,10 @@ (assert_return (invoke "gt" (f32.const -0x1p-1) (f32.const 0x1.fffffep+127)) (i32.const 0)) (assert_return (invoke "gt" (f32.const 0x1p-1) (f32.const -0x1.fffffep+127)) (i32.const 1)) (assert_return (invoke "gt" (f32.const 0x1p-1) (f32.const 0x1.fffffep+127)) (i32.const 0)) -(assert_return (invoke "gt" (f32.const -0x1p-1) (f32.const -infinity)) (i32.const 1)) -(assert_return (invoke "gt" (f32.const -0x1p-1) (f32.const infinity)) (i32.const 0)) -(assert_return (invoke "gt" (f32.const 0x1p-1) (f32.const -infinity)) (i32.const 1)) -(assert_return (invoke "gt" (f32.const 0x1p-1) (f32.const infinity)) (i32.const 0)) +(assert_return (invoke "gt" (f32.const -0x1p-1) (f32.const -inf)) (i32.const 1)) +(assert_return (invoke "gt" (f32.const -0x1p-1) (f32.const inf)) (i32.const 0)) +(assert_return (invoke "gt" (f32.const 0x1p-1) (f32.const -inf)) (i32.const 1)) +(assert_return (invoke "gt" (f32.const 0x1p-1) (f32.const inf)) (i32.const 0)) (assert_return (invoke "gt" (f32.const -0x1p-1) (f32.const -nan)) (i32.const 0)) (assert_return (invoke "gt" (f32.const -0x1p-1) (f32.const -nan:0x200000)) (i32.const 0)) (assert_return (invoke "gt" (f32.const -0x1p-1) (f32.const nan)) (i32.const 0)) @@ -1798,10 +1798,10 @@ (assert_return (invoke "gt" (f32.const -0x1p+0) (f32.const 0x1.fffffep+127)) (i32.const 0)) (assert_return (invoke "gt" (f32.const 0x1p+0) (f32.const -0x1.fffffep+127)) (i32.const 1)) (assert_return (invoke "gt" (f32.const 0x1p+0) (f32.const 0x1.fffffep+127)) (i32.const 0)) -(assert_return (invoke "gt" (f32.const -0x1p+0) (f32.const -infinity)) (i32.const 1)) -(assert_return (invoke "gt" (f32.const -0x1p+0) (f32.const infinity)) (i32.const 0)) -(assert_return (invoke "gt" (f32.const 0x1p+0) (f32.const -infinity)) (i32.const 1)) -(assert_return (invoke "gt" (f32.const 0x1p+0) (f32.const infinity)) (i32.const 0)) +(assert_return (invoke "gt" (f32.const -0x1p+0) (f32.const -inf)) (i32.const 1)) +(assert_return (invoke "gt" (f32.const -0x1p+0) (f32.const inf)) (i32.const 0)) +(assert_return (invoke "gt" (f32.const 0x1p+0) (f32.const -inf)) (i32.const 1)) +(assert_return (invoke "gt" (f32.const 0x1p+0) (f32.const inf)) (i32.const 0)) (assert_return (invoke "gt" (f32.const -0x1p+0) (f32.const -nan)) (i32.const 0)) (assert_return (invoke "gt" (f32.const -0x1p+0) (f32.const -nan:0x200000)) (i32.const 0)) (assert_return (invoke "gt" (f32.const -0x1p+0) (f32.const nan)) (i32.const 0)) @@ -1838,10 +1838,10 @@ (assert_return (invoke "gt" (f32.const -0x1.921fb6p+2) (f32.const 0x1.fffffep+127)) (i32.const 0)) (assert_return (invoke "gt" (f32.const 0x1.921fb6p+2) (f32.const -0x1.fffffep+127)) (i32.const 1)) (assert_return (invoke "gt" (f32.const 0x1.921fb6p+2) (f32.const 0x1.fffffep+127)) (i32.const 0)) -(assert_return (invoke "gt" (f32.const -0x1.921fb6p+2) (f32.const -infinity)) (i32.const 1)) -(assert_return (invoke "gt" (f32.const -0x1.921fb6p+2) (f32.const infinity)) (i32.const 0)) -(assert_return (invoke "gt" (f32.const 0x1.921fb6p+2) (f32.const -infinity)) (i32.const 1)) -(assert_return (invoke "gt" (f32.const 0x1.921fb6p+2) (f32.const infinity)) (i32.const 0)) +(assert_return (invoke "gt" (f32.const -0x1.921fb6p+2) (f32.const -inf)) (i32.const 1)) +(assert_return (invoke "gt" (f32.const -0x1.921fb6p+2) (f32.const inf)) (i32.const 0)) +(assert_return (invoke "gt" (f32.const 0x1.921fb6p+2) (f32.const -inf)) (i32.const 1)) +(assert_return (invoke "gt" (f32.const 0x1.921fb6p+2) (f32.const inf)) (i32.const 0)) (assert_return (invoke "gt" (f32.const -0x1.921fb6p+2) (f32.const -nan)) (i32.const 0)) (assert_return (invoke "gt" (f32.const -0x1.921fb6p+2) (f32.const -nan:0x200000)) (i32.const 0)) (assert_return (invoke "gt" (f32.const -0x1.921fb6p+2) (f32.const nan)) (i32.const 0)) @@ -1878,10 +1878,10 @@ (assert_return (invoke "gt" (f32.const -0x1.fffffep+127) (f32.const 0x1.fffffep+127)) (i32.const 0)) (assert_return (invoke "gt" (f32.const 0x1.fffffep+127) (f32.const -0x1.fffffep+127)) (i32.const 1)) (assert_return (invoke "gt" (f32.const 0x1.fffffep+127) (f32.const 0x1.fffffep+127)) (i32.const 0)) -(assert_return (invoke "gt" (f32.const -0x1.fffffep+127) (f32.const -infinity)) (i32.const 1)) -(assert_return (invoke "gt" (f32.const -0x1.fffffep+127) (f32.const infinity)) (i32.const 0)) -(assert_return (invoke "gt" (f32.const 0x1.fffffep+127) (f32.const -infinity)) (i32.const 1)) -(assert_return (invoke "gt" (f32.const 0x1.fffffep+127) (f32.const infinity)) (i32.const 0)) +(assert_return (invoke "gt" (f32.const -0x1.fffffep+127) (f32.const -inf)) (i32.const 1)) +(assert_return (invoke "gt" (f32.const -0x1.fffffep+127) (f32.const inf)) (i32.const 0)) +(assert_return (invoke "gt" (f32.const 0x1.fffffep+127) (f32.const -inf)) (i32.const 1)) +(assert_return (invoke "gt" (f32.const 0x1.fffffep+127) (f32.const inf)) (i32.const 0)) (assert_return (invoke "gt" (f32.const -0x1.fffffep+127) (f32.const -nan)) (i32.const 0)) (assert_return (invoke "gt" (f32.const -0x1.fffffep+127) (f32.const -nan:0x200000)) (i32.const 0)) (assert_return (invoke "gt" (f32.const -0x1.fffffep+127) (f32.const nan)) (i32.const 0)) @@ -1890,46 +1890,46 @@ (assert_return (invoke "gt" (f32.const 0x1.fffffep+127) (f32.const -nan:0x200000)) (i32.const 0)) (assert_return (invoke "gt" (f32.const 0x1.fffffep+127) (f32.const nan)) (i32.const 0)) (assert_return (invoke "gt" (f32.const 0x1.fffffep+127) (f32.const nan:0x200000)) (i32.const 0)) -(assert_return (invoke "gt" (f32.const -infinity) (f32.const -0x0p+0)) (i32.const 0)) -(assert_return (invoke "gt" (f32.const -infinity) (f32.const 0x0p+0)) (i32.const 0)) -(assert_return (invoke "gt" (f32.const infinity) (f32.const -0x0p+0)) (i32.const 1)) -(assert_return (invoke "gt" (f32.const infinity) (f32.const 0x0p+0)) (i32.const 1)) -(assert_return (invoke "gt" (f32.const -infinity) (f32.const -0x1p-149)) (i32.const 0)) -(assert_return (invoke "gt" (f32.const -infinity) (f32.const 0x1p-149)) (i32.const 0)) -(assert_return (invoke "gt" (f32.const infinity) (f32.const -0x1p-149)) (i32.const 1)) -(assert_return (invoke "gt" (f32.const infinity) (f32.const 0x1p-149)) (i32.const 1)) -(assert_return (invoke "gt" (f32.const -infinity) (f32.const -0x1p-126)) (i32.const 0)) -(assert_return (invoke "gt" (f32.const -infinity) (f32.const 0x1p-126)) (i32.const 0)) -(assert_return (invoke "gt" (f32.const infinity) (f32.const -0x1p-126)) (i32.const 1)) -(assert_return (invoke "gt" (f32.const infinity) (f32.const 0x1p-126)) (i32.const 1)) -(assert_return (invoke "gt" (f32.const -infinity) (f32.const -0x1p-1)) (i32.const 0)) -(assert_return (invoke "gt" (f32.const -infinity) (f32.const 0x1p-1)) (i32.const 0)) -(assert_return (invoke "gt" (f32.const infinity) (f32.const -0x1p-1)) (i32.const 1)) -(assert_return (invoke "gt" (f32.const infinity) (f32.const 0x1p-1)) (i32.const 1)) -(assert_return (invoke "gt" (f32.const -infinity) (f32.const -0x1p+0)) (i32.const 0)) -(assert_return (invoke "gt" (f32.const -infinity) (f32.const 0x1p+0)) (i32.const 0)) -(assert_return (invoke "gt" (f32.const infinity) (f32.const -0x1p+0)) (i32.const 1)) -(assert_return (invoke "gt" (f32.const infinity) (f32.const 0x1p+0)) (i32.const 1)) -(assert_return (invoke "gt" (f32.const -infinity) (f32.const -0x1.921fb6p+2)) (i32.const 0)) -(assert_return (invoke "gt" (f32.const -infinity) (f32.const 0x1.921fb6p+2)) (i32.const 0)) -(assert_return (invoke "gt" (f32.const infinity) (f32.const -0x1.921fb6p+2)) (i32.const 1)) -(assert_return (invoke "gt" (f32.const infinity) (f32.const 0x1.921fb6p+2)) (i32.const 1)) -(assert_return (invoke "gt" (f32.const -infinity) (f32.const -0x1.fffffep+127)) (i32.const 0)) -(assert_return (invoke "gt" (f32.const -infinity) (f32.const 0x1.fffffep+127)) (i32.const 0)) -(assert_return (invoke "gt" (f32.const infinity) (f32.const -0x1.fffffep+127)) (i32.const 1)) -(assert_return (invoke "gt" (f32.const infinity) (f32.const 0x1.fffffep+127)) (i32.const 1)) -(assert_return (invoke "gt" (f32.const -infinity) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "gt" (f32.const -infinity) (f32.const infinity)) (i32.const 0)) -(assert_return (invoke "gt" (f32.const infinity) (f32.const -infinity)) (i32.const 1)) -(assert_return (invoke "gt" (f32.const infinity) (f32.const infinity)) (i32.const 0)) -(assert_return (invoke "gt" (f32.const -infinity) (f32.const -nan)) (i32.const 0)) -(assert_return (invoke "gt" (f32.const -infinity) (f32.const -nan:0x200000)) (i32.const 0)) -(assert_return (invoke "gt" (f32.const -infinity) (f32.const nan)) (i32.const 0)) -(assert_return (invoke "gt" (f32.const -infinity) (f32.const nan:0x200000)) (i32.const 0)) -(assert_return (invoke "gt" (f32.const infinity) (f32.const -nan)) (i32.const 0)) -(assert_return (invoke "gt" (f32.const infinity) (f32.const -nan:0x200000)) (i32.const 0)) -(assert_return (invoke "gt" (f32.const infinity) (f32.const nan)) (i32.const 0)) -(assert_return (invoke "gt" (f32.const infinity) (f32.const nan:0x200000)) (i32.const 0)) +(assert_return (invoke "gt" (f32.const -inf) (f32.const -0x0p+0)) (i32.const 0)) +(assert_return (invoke "gt" (f32.const -inf) (f32.const 0x0p+0)) (i32.const 0)) +(assert_return (invoke "gt" (f32.const inf) (f32.const -0x0p+0)) (i32.const 1)) +(assert_return (invoke "gt" (f32.const inf) (f32.const 0x0p+0)) (i32.const 1)) +(assert_return (invoke "gt" (f32.const -inf) (f32.const -0x1p-149)) (i32.const 0)) +(assert_return (invoke "gt" (f32.const -inf) (f32.const 0x1p-149)) (i32.const 0)) +(assert_return (invoke "gt" (f32.const inf) (f32.const -0x1p-149)) (i32.const 1)) +(assert_return (invoke "gt" (f32.const inf) (f32.const 0x1p-149)) (i32.const 1)) +(assert_return (invoke "gt" (f32.const -inf) (f32.const -0x1p-126)) (i32.const 0)) +(assert_return (invoke "gt" (f32.const -inf) (f32.const 0x1p-126)) (i32.const 0)) +(assert_return (invoke "gt" (f32.const inf) (f32.const -0x1p-126)) (i32.const 1)) +(assert_return (invoke "gt" (f32.const inf) (f32.const 0x1p-126)) (i32.const 1)) +(assert_return (invoke "gt" (f32.const -inf) (f32.const -0x1p-1)) (i32.const 0)) +(assert_return (invoke "gt" (f32.const -inf) (f32.const 0x1p-1)) (i32.const 0)) +(assert_return (invoke "gt" (f32.const inf) (f32.const -0x1p-1)) (i32.const 1)) +(assert_return (invoke "gt" (f32.const inf) (f32.const 0x1p-1)) (i32.const 1)) +(assert_return (invoke "gt" (f32.const -inf) (f32.const -0x1p+0)) (i32.const 0)) +(assert_return (invoke "gt" (f32.const -inf) (f32.const 0x1p+0)) (i32.const 0)) +(assert_return (invoke "gt" (f32.const inf) (f32.const -0x1p+0)) (i32.const 1)) +(assert_return (invoke "gt" (f32.const inf) (f32.const 0x1p+0)) (i32.const 1)) +(assert_return (invoke "gt" (f32.const -inf) (f32.const -0x1.921fb6p+2)) (i32.const 0)) +(assert_return (invoke "gt" (f32.const -inf) (f32.const 0x1.921fb6p+2)) (i32.const 0)) +(assert_return (invoke "gt" (f32.const inf) (f32.const -0x1.921fb6p+2)) (i32.const 1)) +(assert_return (invoke "gt" (f32.const inf) (f32.const 0x1.921fb6p+2)) (i32.const 1)) +(assert_return (invoke "gt" (f32.const -inf) (f32.const -0x1.fffffep+127)) (i32.const 0)) +(assert_return (invoke "gt" (f32.const -inf) (f32.const 0x1.fffffep+127)) (i32.const 0)) +(assert_return (invoke "gt" (f32.const inf) (f32.const -0x1.fffffep+127)) (i32.const 1)) +(assert_return (invoke "gt" (f32.const inf) (f32.const 0x1.fffffep+127)) (i32.const 1)) +(assert_return (invoke "gt" (f32.const -inf) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "gt" (f32.const -inf) (f32.const inf)) (i32.const 0)) +(assert_return (invoke "gt" (f32.const inf) (f32.const -inf)) (i32.const 1)) +(assert_return (invoke "gt" (f32.const inf) (f32.const inf)) (i32.const 0)) +(assert_return (invoke "gt" (f32.const -inf) (f32.const -nan)) (i32.const 0)) +(assert_return (invoke "gt" (f32.const -inf) (f32.const -nan:0x200000)) (i32.const 0)) +(assert_return (invoke "gt" (f32.const -inf) (f32.const nan)) (i32.const 0)) +(assert_return (invoke "gt" (f32.const -inf) (f32.const nan:0x200000)) (i32.const 0)) +(assert_return (invoke "gt" (f32.const inf) (f32.const -nan)) (i32.const 0)) +(assert_return (invoke "gt" (f32.const inf) (f32.const -nan:0x200000)) (i32.const 0)) +(assert_return (invoke "gt" (f32.const inf) (f32.const nan)) (i32.const 0)) +(assert_return (invoke "gt" (f32.const inf) (f32.const nan:0x200000)) (i32.const 0)) (assert_return (invoke "gt" (f32.const -nan) (f32.const -0x0p+0)) (i32.const 0)) (assert_return (invoke "gt" (f32.const -nan:0x200000) (f32.const -0x0p+0)) (i32.const 0)) (assert_return (invoke "gt" (f32.const -nan) (f32.const 0x0p+0)) (i32.const 0)) @@ -1986,14 +1986,14 @@ (assert_return (invoke "gt" (f32.const nan:0x200000) (f32.const -0x1.fffffep+127)) (i32.const 0)) (assert_return (invoke "gt" (f32.const nan) (f32.const 0x1.fffffep+127)) (i32.const 0)) (assert_return (invoke "gt" (f32.const nan:0x200000) (f32.const 0x1.fffffep+127)) (i32.const 0)) -(assert_return (invoke "gt" (f32.const -nan) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "gt" (f32.const -nan:0x200000) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "gt" (f32.const -nan) (f32.const infinity)) (i32.const 0)) -(assert_return (invoke "gt" (f32.const -nan:0x200000) (f32.const infinity)) (i32.const 0)) -(assert_return (invoke "gt" (f32.const nan) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "gt" (f32.const nan:0x200000) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "gt" (f32.const nan) (f32.const infinity)) (i32.const 0)) -(assert_return (invoke "gt" (f32.const nan:0x200000) (f32.const infinity)) (i32.const 0)) +(assert_return (invoke "gt" (f32.const -nan) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "gt" (f32.const -nan:0x200000) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "gt" (f32.const -nan) (f32.const inf)) (i32.const 0)) +(assert_return (invoke "gt" (f32.const -nan:0x200000) (f32.const inf)) (i32.const 0)) +(assert_return (invoke "gt" (f32.const nan) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "gt" (f32.const nan:0x200000) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "gt" (f32.const nan) (f32.const inf)) (i32.const 0)) +(assert_return (invoke "gt" (f32.const nan:0x200000) (f32.const inf)) (i32.const 0)) (assert_return (invoke "gt" (f32.const -nan) (f32.const -nan)) (i32.const 0)) (assert_return (invoke "gt" (f32.const -nan:0x200000) (f32.const -nan)) (i32.const 0)) (assert_return (invoke "gt" (f32.const -nan) (f32.const -nan:0x200000)) (i32.const 0)) @@ -2038,10 +2038,10 @@ (assert_return (invoke "ge" (f32.const -0x0p+0) (f32.const 0x1.fffffep+127)) (i32.const 0)) (assert_return (invoke "ge" (f32.const 0x0p+0) (f32.const -0x1.fffffep+127)) (i32.const 1)) (assert_return (invoke "ge" (f32.const 0x0p+0) (f32.const 0x1.fffffep+127)) (i32.const 0)) -(assert_return (invoke "ge" (f32.const -0x0p+0) (f32.const -infinity)) (i32.const 1)) -(assert_return (invoke "ge" (f32.const -0x0p+0) (f32.const infinity)) (i32.const 0)) -(assert_return (invoke "ge" (f32.const 0x0p+0) (f32.const -infinity)) (i32.const 1)) -(assert_return (invoke "ge" (f32.const 0x0p+0) (f32.const infinity)) (i32.const 0)) +(assert_return (invoke "ge" (f32.const -0x0p+0) (f32.const -inf)) (i32.const 1)) +(assert_return (invoke "ge" (f32.const -0x0p+0) (f32.const inf)) (i32.const 0)) +(assert_return (invoke "ge" (f32.const 0x0p+0) (f32.const -inf)) (i32.const 1)) +(assert_return (invoke "ge" (f32.const 0x0p+0) (f32.const inf)) (i32.const 0)) (assert_return (invoke "ge" (f32.const -0x0p+0) (f32.const -nan)) (i32.const 0)) (assert_return (invoke "ge" (f32.const -0x0p+0) (f32.const -nan:0x200000)) (i32.const 0)) (assert_return (invoke "ge" (f32.const -0x0p+0) (f32.const nan)) (i32.const 0)) @@ -2078,10 +2078,10 @@ (assert_return (invoke "ge" (f32.const -0x1p-149) (f32.const 0x1.fffffep+127)) (i32.const 0)) (assert_return (invoke "ge" (f32.const 0x1p-149) (f32.const -0x1.fffffep+127)) (i32.const 1)) (assert_return (invoke "ge" (f32.const 0x1p-149) (f32.const 0x1.fffffep+127)) (i32.const 0)) -(assert_return (invoke "ge" (f32.const -0x1p-149) (f32.const -infinity)) (i32.const 1)) -(assert_return (invoke "ge" (f32.const -0x1p-149) (f32.const infinity)) (i32.const 0)) -(assert_return (invoke "ge" (f32.const 0x1p-149) (f32.const -infinity)) (i32.const 1)) -(assert_return (invoke "ge" (f32.const 0x1p-149) (f32.const infinity)) (i32.const 0)) +(assert_return (invoke "ge" (f32.const -0x1p-149) (f32.const -inf)) (i32.const 1)) +(assert_return (invoke "ge" (f32.const -0x1p-149) (f32.const inf)) (i32.const 0)) +(assert_return (invoke "ge" (f32.const 0x1p-149) (f32.const -inf)) (i32.const 1)) +(assert_return (invoke "ge" (f32.const 0x1p-149) (f32.const inf)) (i32.const 0)) (assert_return (invoke "ge" (f32.const -0x1p-149) (f32.const -nan)) (i32.const 0)) (assert_return (invoke "ge" (f32.const -0x1p-149) (f32.const -nan:0x200000)) (i32.const 0)) (assert_return (invoke "ge" (f32.const -0x1p-149) (f32.const nan)) (i32.const 0)) @@ -2118,10 +2118,10 @@ (assert_return (invoke "ge" (f32.const -0x1p-126) (f32.const 0x1.fffffep+127)) (i32.const 0)) (assert_return (invoke "ge" (f32.const 0x1p-126) (f32.const -0x1.fffffep+127)) (i32.const 1)) (assert_return (invoke "ge" (f32.const 0x1p-126) (f32.const 0x1.fffffep+127)) (i32.const 0)) -(assert_return (invoke "ge" (f32.const -0x1p-126) (f32.const -infinity)) (i32.const 1)) -(assert_return (invoke "ge" (f32.const -0x1p-126) (f32.const infinity)) (i32.const 0)) -(assert_return (invoke "ge" (f32.const 0x1p-126) (f32.const -infinity)) (i32.const 1)) -(assert_return (invoke "ge" (f32.const 0x1p-126) (f32.const infinity)) (i32.const 0)) +(assert_return (invoke "ge" (f32.const -0x1p-126) (f32.const -inf)) (i32.const 1)) +(assert_return (invoke "ge" (f32.const -0x1p-126) (f32.const inf)) (i32.const 0)) +(assert_return (invoke "ge" (f32.const 0x1p-126) (f32.const -inf)) (i32.const 1)) +(assert_return (invoke "ge" (f32.const 0x1p-126) (f32.const inf)) (i32.const 0)) (assert_return (invoke "ge" (f32.const -0x1p-126) (f32.const -nan)) (i32.const 0)) (assert_return (invoke "ge" (f32.const -0x1p-126) (f32.const -nan:0x200000)) (i32.const 0)) (assert_return (invoke "ge" (f32.const -0x1p-126) (f32.const nan)) (i32.const 0)) @@ -2158,10 +2158,10 @@ (assert_return (invoke "ge" (f32.const -0x1p-1) (f32.const 0x1.fffffep+127)) (i32.const 0)) (assert_return (invoke "ge" (f32.const 0x1p-1) (f32.const -0x1.fffffep+127)) (i32.const 1)) (assert_return (invoke "ge" (f32.const 0x1p-1) (f32.const 0x1.fffffep+127)) (i32.const 0)) -(assert_return (invoke "ge" (f32.const -0x1p-1) (f32.const -infinity)) (i32.const 1)) -(assert_return (invoke "ge" (f32.const -0x1p-1) (f32.const infinity)) (i32.const 0)) -(assert_return (invoke "ge" (f32.const 0x1p-1) (f32.const -infinity)) (i32.const 1)) -(assert_return (invoke "ge" (f32.const 0x1p-1) (f32.const infinity)) (i32.const 0)) +(assert_return (invoke "ge" (f32.const -0x1p-1) (f32.const -inf)) (i32.const 1)) +(assert_return (invoke "ge" (f32.const -0x1p-1) (f32.const inf)) (i32.const 0)) +(assert_return (invoke "ge" (f32.const 0x1p-1) (f32.const -inf)) (i32.const 1)) +(assert_return (invoke "ge" (f32.const 0x1p-1) (f32.const inf)) (i32.const 0)) (assert_return (invoke "ge" (f32.const -0x1p-1) (f32.const -nan)) (i32.const 0)) (assert_return (invoke "ge" (f32.const -0x1p-1) (f32.const -nan:0x200000)) (i32.const 0)) (assert_return (invoke "ge" (f32.const -0x1p-1) (f32.const nan)) (i32.const 0)) @@ -2198,10 +2198,10 @@ (assert_return (invoke "ge" (f32.const -0x1p+0) (f32.const 0x1.fffffep+127)) (i32.const 0)) (assert_return (invoke "ge" (f32.const 0x1p+0) (f32.const -0x1.fffffep+127)) (i32.const 1)) (assert_return (invoke "ge" (f32.const 0x1p+0) (f32.const 0x1.fffffep+127)) (i32.const 0)) -(assert_return (invoke "ge" (f32.const -0x1p+0) (f32.const -infinity)) (i32.const 1)) -(assert_return (invoke "ge" (f32.const -0x1p+0) (f32.const infinity)) (i32.const 0)) -(assert_return (invoke "ge" (f32.const 0x1p+0) (f32.const -infinity)) (i32.const 1)) -(assert_return (invoke "ge" (f32.const 0x1p+0) (f32.const infinity)) (i32.const 0)) +(assert_return (invoke "ge" (f32.const -0x1p+0) (f32.const -inf)) (i32.const 1)) +(assert_return (invoke "ge" (f32.const -0x1p+0) (f32.const inf)) (i32.const 0)) +(assert_return (invoke "ge" (f32.const 0x1p+0) (f32.const -inf)) (i32.const 1)) +(assert_return (invoke "ge" (f32.const 0x1p+0) (f32.const inf)) (i32.const 0)) (assert_return (invoke "ge" (f32.const -0x1p+0) (f32.const -nan)) (i32.const 0)) (assert_return (invoke "ge" (f32.const -0x1p+0) (f32.const -nan:0x200000)) (i32.const 0)) (assert_return (invoke "ge" (f32.const -0x1p+0) (f32.const nan)) (i32.const 0)) @@ -2238,10 +2238,10 @@ (assert_return (invoke "ge" (f32.const -0x1.921fb6p+2) (f32.const 0x1.fffffep+127)) (i32.const 0)) (assert_return (invoke "ge" (f32.const 0x1.921fb6p+2) (f32.const -0x1.fffffep+127)) (i32.const 1)) (assert_return (invoke "ge" (f32.const 0x1.921fb6p+2) (f32.const 0x1.fffffep+127)) (i32.const 0)) -(assert_return (invoke "ge" (f32.const -0x1.921fb6p+2) (f32.const -infinity)) (i32.const 1)) -(assert_return (invoke "ge" (f32.const -0x1.921fb6p+2) (f32.const infinity)) (i32.const 0)) -(assert_return (invoke "ge" (f32.const 0x1.921fb6p+2) (f32.const -infinity)) (i32.const 1)) -(assert_return (invoke "ge" (f32.const 0x1.921fb6p+2) (f32.const infinity)) (i32.const 0)) +(assert_return (invoke "ge" (f32.const -0x1.921fb6p+2) (f32.const -inf)) (i32.const 1)) +(assert_return (invoke "ge" (f32.const -0x1.921fb6p+2) (f32.const inf)) (i32.const 0)) +(assert_return (invoke "ge" (f32.const 0x1.921fb6p+2) (f32.const -inf)) (i32.const 1)) +(assert_return (invoke "ge" (f32.const 0x1.921fb6p+2) (f32.const inf)) (i32.const 0)) (assert_return (invoke "ge" (f32.const -0x1.921fb6p+2) (f32.const -nan)) (i32.const 0)) (assert_return (invoke "ge" (f32.const -0x1.921fb6p+2) (f32.const -nan:0x200000)) (i32.const 0)) (assert_return (invoke "ge" (f32.const -0x1.921fb6p+2) (f32.const nan)) (i32.const 0)) @@ -2278,10 +2278,10 @@ (assert_return (invoke "ge" (f32.const -0x1.fffffep+127) (f32.const 0x1.fffffep+127)) (i32.const 0)) (assert_return (invoke "ge" (f32.const 0x1.fffffep+127) (f32.const -0x1.fffffep+127)) (i32.const 1)) (assert_return (invoke "ge" (f32.const 0x1.fffffep+127) (f32.const 0x1.fffffep+127)) (i32.const 1)) -(assert_return (invoke "ge" (f32.const -0x1.fffffep+127) (f32.const -infinity)) (i32.const 1)) -(assert_return (invoke "ge" (f32.const -0x1.fffffep+127) (f32.const infinity)) (i32.const 0)) -(assert_return (invoke "ge" (f32.const 0x1.fffffep+127) (f32.const -infinity)) (i32.const 1)) -(assert_return (invoke "ge" (f32.const 0x1.fffffep+127) (f32.const infinity)) (i32.const 0)) +(assert_return (invoke "ge" (f32.const -0x1.fffffep+127) (f32.const -inf)) (i32.const 1)) +(assert_return (invoke "ge" (f32.const -0x1.fffffep+127) (f32.const inf)) (i32.const 0)) +(assert_return (invoke "ge" (f32.const 0x1.fffffep+127) (f32.const -inf)) (i32.const 1)) +(assert_return (invoke "ge" (f32.const 0x1.fffffep+127) (f32.const inf)) (i32.const 0)) (assert_return (invoke "ge" (f32.const -0x1.fffffep+127) (f32.const -nan)) (i32.const 0)) (assert_return (invoke "ge" (f32.const -0x1.fffffep+127) (f32.const -nan:0x200000)) (i32.const 0)) (assert_return (invoke "ge" (f32.const -0x1.fffffep+127) (f32.const nan)) (i32.const 0)) @@ -2290,46 +2290,46 @@ (assert_return (invoke "ge" (f32.const 0x1.fffffep+127) (f32.const -nan:0x200000)) (i32.const 0)) (assert_return (invoke "ge" (f32.const 0x1.fffffep+127) (f32.const nan)) (i32.const 0)) (assert_return (invoke "ge" (f32.const 0x1.fffffep+127) (f32.const nan:0x200000)) (i32.const 0)) -(assert_return (invoke "ge" (f32.const -infinity) (f32.const -0x0p+0)) (i32.const 0)) -(assert_return (invoke "ge" (f32.const -infinity) (f32.const 0x0p+0)) (i32.const 0)) -(assert_return (invoke "ge" (f32.const infinity) (f32.const -0x0p+0)) (i32.const 1)) -(assert_return (invoke "ge" (f32.const infinity) (f32.const 0x0p+0)) (i32.const 1)) -(assert_return (invoke "ge" (f32.const -infinity) (f32.const -0x1p-149)) (i32.const 0)) -(assert_return (invoke "ge" (f32.const -infinity) (f32.const 0x1p-149)) (i32.const 0)) -(assert_return (invoke "ge" (f32.const infinity) (f32.const -0x1p-149)) (i32.const 1)) -(assert_return (invoke "ge" (f32.const infinity) (f32.const 0x1p-149)) (i32.const 1)) -(assert_return (invoke "ge" (f32.const -infinity) (f32.const -0x1p-126)) (i32.const 0)) -(assert_return (invoke "ge" (f32.const -infinity) (f32.const 0x1p-126)) (i32.const 0)) -(assert_return (invoke "ge" (f32.const infinity) (f32.const -0x1p-126)) (i32.const 1)) -(assert_return (invoke "ge" (f32.const infinity) (f32.const 0x1p-126)) (i32.const 1)) -(assert_return (invoke "ge" (f32.const -infinity) (f32.const -0x1p-1)) (i32.const 0)) -(assert_return (invoke "ge" (f32.const -infinity) (f32.const 0x1p-1)) (i32.const 0)) -(assert_return (invoke "ge" (f32.const infinity) (f32.const -0x1p-1)) (i32.const 1)) -(assert_return (invoke "ge" (f32.const infinity) (f32.const 0x1p-1)) (i32.const 1)) -(assert_return (invoke "ge" (f32.const -infinity) (f32.const -0x1p+0)) (i32.const 0)) -(assert_return (invoke "ge" (f32.const -infinity) (f32.const 0x1p+0)) (i32.const 0)) -(assert_return (invoke "ge" (f32.const infinity) (f32.const -0x1p+0)) (i32.const 1)) -(assert_return (invoke "ge" (f32.const infinity) (f32.const 0x1p+0)) (i32.const 1)) -(assert_return (invoke "ge" (f32.const -infinity) (f32.const -0x1.921fb6p+2)) (i32.const 0)) -(assert_return (invoke "ge" (f32.const -infinity) (f32.const 0x1.921fb6p+2)) (i32.const 0)) -(assert_return (invoke "ge" (f32.const infinity) (f32.const -0x1.921fb6p+2)) (i32.const 1)) -(assert_return (invoke "ge" (f32.const infinity) (f32.const 0x1.921fb6p+2)) (i32.const 1)) -(assert_return (invoke "ge" (f32.const -infinity) (f32.const -0x1.fffffep+127)) (i32.const 0)) -(assert_return (invoke "ge" (f32.const -infinity) (f32.const 0x1.fffffep+127)) (i32.const 0)) -(assert_return (invoke "ge" (f32.const infinity) (f32.const -0x1.fffffep+127)) (i32.const 1)) -(assert_return (invoke "ge" (f32.const infinity) (f32.const 0x1.fffffep+127)) (i32.const 1)) -(assert_return (invoke "ge" (f32.const -infinity) (f32.const -infinity)) (i32.const 1)) -(assert_return (invoke "ge" (f32.const -infinity) (f32.const infinity)) (i32.const 0)) -(assert_return (invoke "ge" (f32.const infinity) (f32.const -infinity)) (i32.const 1)) -(assert_return (invoke "ge" (f32.const infinity) (f32.const infinity)) (i32.const 1)) -(assert_return (invoke "ge" (f32.const -infinity) (f32.const -nan)) (i32.const 0)) -(assert_return (invoke "ge" (f32.const -infinity) (f32.const -nan:0x200000)) (i32.const 0)) -(assert_return (invoke "ge" (f32.const -infinity) (f32.const nan)) (i32.const 0)) -(assert_return (invoke "ge" (f32.const -infinity) (f32.const nan:0x200000)) (i32.const 0)) -(assert_return (invoke "ge" (f32.const infinity) (f32.const -nan)) (i32.const 0)) -(assert_return (invoke "ge" (f32.const infinity) (f32.const -nan:0x200000)) (i32.const 0)) -(assert_return (invoke "ge" (f32.const infinity) (f32.const nan)) (i32.const 0)) -(assert_return (invoke "ge" (f32.const infinity) (f32.const nan:0x200000)) (i32.const 0)) +(assert_return (invoke "ge" (f32.const -inf) (f32.const -0x0p+0)) (i32.const 0)) +(assert_return (invoke "ge" (f32.const -inf) (f32.const 0x0p+0)) (i32.const 0)) +(assert_return (invoke "ge" (f32.const inf) (f32.const -0x0p+0)) (i32.const 1)) +(assert_return (invoke "ge" (f32.const inf) (f32.const 0x0p+0)) (i32.const 1)) +(assert_return (invoke "ge" (f32.const -inf) (f32.const -0x1p-149)) (i32.const 0)) +(assert_return (invoke "ge" (f32.const -inf) (f32.const 0x1p-149)) (i32.const 0)) +(assert_return (invoke "ge" (f32.const inf) (f32.const -0x1p-149)) (i32.const 1)) +(assert_return (invoke "ge" (f32.const inf) (f32.const 0x1p-149)) (i32.const 1)) +(assert_return (invoke "ge" (f32.const -inf) (f32.const -0x1p-126)) (i32.const 0)) +(assert_return (invoke "ge" (f32.const -inf) (f32.const 0x1p-126)) (i32.const 0)) +(assert_return (invoke "ge" (f32.const inf) (f32.const -0x1p-126)) (i32.const 1)) +(assert_return (invoke "ge" (f32.const inf) (f32.const 0x1p-126)) (i32.const 1)) +(assert_return (invoke "ge" (f32.const -inf) (f32.const -0x1p-1)) (i32.const 0)) +(assert_return (invoke "ge" (f32.const -inf) (f32.const 0x1p-1)) (i32.const 0)) +(assert_return (invoke "ge" (f32.const inf) (f32.const -0x1p-1)) (i32.const 1)) +(assert_return (invoke "ge" (f32.const inf) (f32.const 0x1p-1)) (i32.const 1)) +(assert_return (invoke "ge" (f32.const -inf) (f32.const -0x1p+0)) (i32.const 0)) +(assert_return (invoke "ge" (f32.const -inf) (f32.const 0x1p+0)) (i32.const 0)) +(assert_return (invoke "ge" (f32.const inf) (f32.const -0x1p+0)) (i32.const 1)) +(assert_return (invoke "ge" (f32.const inf) (f32.const 0x1p+0)) (i32.const 1)) +(assert_return (invoke "ge" (f32.const -inf) (f32.const -0x1.921fb6p+2)) (i32.const 0)) +(assert_return (invoke "ge" (f32.const -inf) (f32.const 0x1.921fb6p+2)) (i32.const 0)) +(assert_return (invoke "ge" (f32.const inf) (f32.const -0x1.921fb6p+2)) (i32.const 1)) +(assert_return (invoke "ge" (f32.const inf) (f32.const 0x1.921fb6p+2)) (i32.const 1)) +(assert_return (invoke "ge" (f32.const -inf) (f32.const -0x1.fffffep+127)) (i32.const 0)) +(assert_return (invoke "ge" (f32.const -inf) (f32.const 0x1.fffffep+127)) (i32.const 0)) +(assert_return (invoke "ge" (f32.const inf) (f32.const -0x1.fffffep+127)) (i32.const 1)) +(assert_return (invoke "ge" (f32.const inf) (f32.const 0x1.fffffep+127)) (i32.const 1)) +(assert_return (invoke "ge" (f32.const -inf) (f32.const -inf)) (i32.const 1)) +(assert_return (invoke "ge" (f32.const -inf) (f32.const inf)) (i32.const 0)) +(assert_return (invoke "ge" (f32.const inf) (f32.const -inf)) (i32.const 1)) +(assert_return (invoke "ge" (f32.const inf) (f32.const inf)) (i32.const 1)) +(assert_return (invoke "ge" (f32.const -inf) (f32.const -nan)) (i32.const 0)) +(assert_return (invoke "ge" (f32.const -inf) (f32.const -nan:0x200000)) (i32.const 0)) +(assert_return (invoke "ge" (f32.const -inf) (f32.const nan)) (i32.const 0)) +(assert_return (invoke "ge" (f32.const -inf) (f32.const nan:0x200000)) (i32.const 0)) +(assert_return (invoke "ge" (f32.const inf) (f32.const -nan)) (i32.const 0)) +(assert_return (invoke "ge" (f32.const inf) (f32.const -nan:0x200000)) (i32.const 0)) +(assert_return (invoke "ge" (f32.const inf) (f32.const nan)) (i32.const 0)) +(assert_return (invoke "ge" (f32.const inf) (f32.const nan:0x200000)) (i32.const 0)) (assert_return (invoke "ge" (f32.const -nan) (f32.const -0x0p+0)) (i32.const 0)) (assert_return (invoke "ge" (f32.const -nan:0x200000) (f32.const -0x0p+0)) (i32.const 0)) (assert_return (invoke "ge" (f32.const -nan) (f32.const 0x0p+0)) (i32.const 0)) @@ -2386,14 +2386,14 @@ (assert_return (invoke "ge" (f32.const nan:0x200000) (f32.const -0x1.fffffep+127)) (i32.const 0)) (assert_return (invoke "ge" (f32.const nan) (f32.const 0x1.fffffep+127)) (i32.const 0)) (assert_return (invoke "ge" (f32.const nan:0x200000) (f32.const 0x1.fffffep+127)) (i32.const 0)) -(assert_return (invoke "ge" (f32.const -nan) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "ge" (f32.const -nan:0x200000) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "ge" (f32.const -nan) (f32.const infinity)) (i32.const 0)) -(assert_return (invoke "ge" (f32.const -nan:0x200000) (f32.const infinity)) (i32.const 0)) -(assert_return (invoke "ge" (f32.const nan) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "ge" (f32.const nan:0x200000) (f32.const -infinity)) (i32.const 0)) -(assert_return (invoke "ge" (f32.const nan) (f32.const infinity)) (i32.const 0)) -(assert_return (invoke "ge" (f32.const nan:0x200000) (f32.const infinity)) (i32.const 0)) +(assert_return (invoke "ge" (f32.const -nan) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "ge" (f32.const -nan:0x200000) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "ge" (f32.const -nan) (f32.const inf)) (i32.const 0)) +(assert_return (invoke "ge" (f32.const -nan:0x200000) (f32.const inf)) (i32.const 0)) +(assert_return (invoke "ge" (f32.const nan) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "ge" (f32.const nan:0x200000) (f32.const -inf)) (i32.const 0)) +(assert_return (invoke "ge" (f32.const nan) (f32.const inf)) (i32.const 0)) +(assert_return (invoke "ge" (f32.const nan:0x200000) (f32.const inf)) (i32.const 0)) (assert_return (invoke "ge" (f32.const -nan) (f32.const -nan)) (i32.const 0)) (assert_return (invoke "ge" (f32.const -nan:0x200000) (f32.const -nan)) (i32.const 0)) (assert_return (invoke "ge" (f32.const -nan) (f32.const -nan:0x200000)) (i32.const 0)) @@ -2410,3 +2410,13 @@ (assert_return (invoke "ge" (f32.const nan:0x200000) (f32.const nan)) (i32.const 0)) (assert_return (invoke "ge" (f32.const nan) (f32.const nan:0x200000)) (i32.const 0)) (assert_return (invoke "ge" (f32.const nan:0x200000) (f32.const nan:0x200000)) (i32.const 0)) + + +;; Type check + +(assert_invalid (module (func (result f32) (f32.eq (i64.const 0) (f64.const 0)))) "type mismatch") +(assert_invalid (module (func (result f32) (f32.ge (i64.const 0) (f64.const 0)))) "type mismatch") +(assert_invalid (module (func (result f32) (f32.gt (i64.const 0) (f64.const 0)))) "type mismatch") +(assert_invalid (module (func (result f32) (f32.le (i64.const 0) (f64.const 0)))) "type mismatch") +(assert_invalid (module (func (result f32) (f32.lt (i64.const 0) (f64.const 0)))) "type mismatch") +(assert_invalid (module (func (result f32) (f32.ne (i64.const 0) (f64.const 0)))) "type mismatch") diff --git a/test/core/f64.load32.fail.wast b/test/core/f64.load32.fail.wast deleted file mode 100644 index 38811ff3..00000000 --- a/test/core/f64.load32.fail.wast +++ /dev/null @@ -1 +0,0 @@ -(module (memory 1) (func (param i32) (result f64) (f64.load32 (get_local 0)))) diff --git a/test/core/f64.load64.fail.wast b/test/core/f64.load64.fail.wast deleted file mode 100644 index f3c30ef3..00000000 --- a/test/core/f64.load64.fail.wast +++ /dev/null @@ -1 +0,0 @@ -(module (memory 1) (func (param i32) (result f64) (f64.load64 (get_local 0)))) diff --git a/test/core/f64.store32.fail.wast b/test/core/f64.store32.fail.wast deleted file mode 100644 index 92858a35..00000000 --- a/test/core/f64.store32.fail.wast +++ /dev/null @@ -1 +0,0 @@ -(module (memory 1) (func (param i32) (param f32) (f64.store32 (get_local 0) (get_local 1)))) diff --git a/test/core/f64.store64.fail.wast b/test/core/f64.store64.fail.wast deleted file mode 100644 index 2b49017f..00000000 --- a/test/core/f64.store64.fail.wast +++ /dev/null @@ -1 +0,0 @@ -(module (memory 1) (func (param i32) (param f64) (f64.store64 (get_local 0) (get_local 1)))) diff --git a/test/core/f64.wast b/test/core/f64.wast index fddd6b3c..85c8834b 100644 --- a/test/core/f64.wast +++ b/test/core/f64.wast @@ -3,17 +3,17 @@ ;; f64_bitwise.wast and f64_cmp.wast). (module - (func (export "add") (param $x f64) (param $y f64) (result f64) (f64.add (get_local $x) (get_local $y))) - (func (export "sub") (param $x f64) (param $y f64) (result f64) (f64.sub (get_local $x) (get_local $y))) - (func (export "mul") (param $x f64) (param $y f64) (result f64) (f64.mul (get_local $x) (get_local $y))) - (func (export "div") (param $x f64) (param $y f64) (result f64) (f64.div (get_local $x) (get_local $y))) - (func (export "sqrt") (param $x f64) (result f64) (f64.sqrt (get_local $x))) - (func (export "min") (param $x f64) (param $y f64) (result f64) (f64.min (get_local $x) (get_local $y))) - (func (export "max") (param $x f64) (param $y f64) (result f64) (f64.max (get_local $x) (get_local $y))) - (func (export "ceil") (param $x f64) (result f64) (f64.ceil (get_local $x))) - (func (export "floor") (param $x f64) (result f64) (f64.floor (get_local $x))) - (func (export "trunc") (param $x f64) (result f64) (f64.trunc (get_local $x))) - (func (export "nearest") (param $x f64) (result f64) (f64.nearest (get_local $x))) + (func (export "add") (param $x f64) (param $y f64) (result f64) (f64.add (local.get $x) (local.get $y))) + (func (export "sub") (param $x f64) (param $y f64) (result f64) (f64.sub (local.get $x) (local.get $y))) + (func (export "mul") (param $x f64) (param $y f64) (result f64) (f64.mul (local.get $x) (local.get $y))) + (func (export "div") (param $x f64) (param $y f64) (result f64) (f64.div (local.get $x) (local.get $y))) + (func (export "sqrt") (param $x f64) (result f64) (f64.sqrt (local.get $x))) + (func (export "min") (param $x f64) (param $y f64) (result f64) (f64.min (local.get $x) (local.get $y))) + (func (export "max") (param $x f64) (param $y f64) (result f64) (f64.max (local.get $x) (local.get $y))) + (func (export "ceil") (param $x f64) (result f64) (f64.ceil (local.get $x))) + (func (export "floor") (param $x f64) (result f64) (f64.floor (local.get $x))) + (func (export "trunc") (param $x f64) (result f64) (f64.trunc (local.get $x))) + (func (export "nearest") (param $x f64) (result f64) (f64.nearest (local.get $x))) ) (assert_return (invoke "add" (f64.const -0x0p+0) (f64.const -0x0p+0)) (f64.const -0x0p+0)) @@ -44,10 +44,10 @@ (assert_return (invoke "add" (f64.const -0x0p+0) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x1.fffffffffffffp+1023)) (assert_return (invoke "add" (f64.const 0x0p+0) (f64.const -0x1.fffffffffffffp+1023)) (f64.const -0x1.fffffffffffffp+1023)) (assert_return (invoke "add" (f64.const 0x0p+0) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x1.fffffffffffffp+1023)) -(assert_return (invoke "add" (f64.const -0x0p+0) (f64.const -infinity)) (f64.const -infinity)) -(assert_return (invoke "add" (f64.const -0x0p+0) (f64.const infinity)) (f64.const infinity)) -(assert_return (invoke "add" (f64.const 0x0p+0) (f64.const -infinity)) (f64.const -infinity)) -(assert_return (invoke "add" (f64.const 0x0p+0) (f64.const infinity)) (f64.const infinity)) +(assert_return (invoke "add" (f64.const -0x0p+0) (f64.const -inf)) (f64.const -inf)) +(assert_return (invoke "add" (f64.const -0x0p+0) (f64.const inf)) (f64.const inf)) +(assert_return (invoke "add" (f64.const 0x0p+0) (f64.const -inf)) (f64.const -inf)) +(assert_return (invoke "add" (f64.const 0x0p+0) (f64.const inf)) (f64.const inf)) (assert_return_canonical_nan (invoke "add" (f64.const -0x0p+0) (f64.const -nan))) (assert_return_arithmetic_nan (invoke "add" (f64.const -0x0p+0) (f64.const -nan:0x4000000000000))) (assert_return_canonical_nan (invoke "add" (f64.const -0x0p+0) (f64.const nan))) @@ -84,10 +84,10 @@ (assert_return (invoke "add" (f64.const -0x0.0000000000001p-1022) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x1.fffffffffffffp+1023)) (assert_return (invoke "add" (f64.const 0x0.0000000000001p-1022) (f64.const -0x1.fffffffffffffp+1023)) (f64.const -0x1.fffffffffffffp+1023)) (assert_return (invoke "add" (f64.const 0x0.0000000000001p-1022) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x1.fffffffffffffp+1023)) -(assert_return (invoke "add" (f64.const -0x0.0000000000001p-1022) (f64.const -infinity)) (f64.const -infinity)) -(assert_return (invoke "add" (f64.const -0x0.0000000000001p-1022) (f64.const infinity)) (f64.const infinity)) -(assert_return (invoke "add" (f64.const 0x0.0000000000001p-1022) (f64.const -infinity)) (f64.const -infinity)) -(assert_return (invoke "add" (f64.const 0x0.0000000000001p-1022) (f64.const infinity)) (f64.const infinity)) +(assert_return (invoke "add" (f64.const -0x0.0000000000001p-1022) (f64.const -inf)) (f64.const -inf)) +(assert_return (invoke "add" (f64.const -0x0.0000000000001p-1022) (f64.const inf)) (f64.const inf)) +(assert_return (invoke "add" (f64.const 0x0.0000000000001p-1022) (f64.const -inf)) (f64.const -inf)) +(assert_return (invoke "add" (f64.const 0x0.0000000000001p-1022) (f64.const inf)) (f64.const inf)) (assert_return_canonical_nan (invoke "add" (f64.const -0x0.0000000000001p-1022) (f64.const -nan))) (assert_return_arithmetic_nan (invoke "add" (f64.const -0x0.0000000000001p-1022) (f64.const -nan:0x4000000000000))) (assert_return_canonical_nan (invoke "add" (f64.const -0x0.0000000000001p-1022) (f64.const nan))) @@ -124,10 +124,10 @@ (assert_return (invoke "add" (f64.const -0x1p-1022) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x1.fffffffffffffp+1023)) (assert_return (invoke "add" (f64.const 0x1p-1022) (f64.const -0x1.fffffffffffffp+1023)) (f64.const -0x1.fffffffffffffp+1023)) (assert_return (invoke "add" (f64.const 0x1p-1022) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x1.fffffffffffffp+1023)) -(assert_return (invoke "add" (f64.const -0x1p-1022) (f64.const -infinity)) (f64.const -infinity)) -(assert_return (invoke "add" (f64.const -0x1p-1022) (f64.const infinity)) (f64.const infinity)) -(assert_return (invoke "add" (f64.const 0x1p-1022) (f64.const -infinity)) (f64.const -infinity)) -(assert_return (invoke "add" (f64.const 0x1p-1022) (f64.const infinity)) (f64.const infinity)) +(assert_return (invoke "add" (f64.const -0x1p-1022) (f64.const -inf)) (f64.const -inf)) +(assert_return (invoke "add" (f64.const -0x1p-1022) (f64.const inf)) (f64.const inf)) +(assert_return (invoke "add" (f64.const 0x1p-1022) (f64.const -inf)) (f64.const -inf)) +(assert_return (invoke "add" (f64.const 0x1p-1022) (f64.const inf)) (f64.const inf)) (assert_return_canonical_nan (invoke "add" (f64.const -0x1p-1022) (f64.const -nan))) (assert_return_arithmetic_nan (invoke "add" (f64.const -0x1p-1022) (f64.const -nan:0x4000000000000))) (assert_return_canonical_nan (invoke "add" (f64.const -0x1p-1022) (f64.const nan))) @@ -164,10 +164,10 @@ (assert_return (invoke "add" (f64.const -0x1p-1) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x1.fffffffffffffp+1023)) (assert_return (invoke "add" (f64.const 0x1p-1) (f64.const -0x1.fffffffffffffp+1023)) (f64.const -0x1.fffffffffffffp+1023)) (assert_return (invoke "add" (f64.const 0x1p-1) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x1.fffffffffffffp+1023)) -(assert_return (invoke "add" (f64.const -0x1p-1) (f64.const -infinity)) (f64.const -infinity)) -(assert_return (invoke "add" (f64.const -0x1p-1) (f64.const infinity)) (f64.const infinity)) -(assert_return (invoke "add" (f64.const 0x1p-1) (f64.const -infinity)) (f64.const -infinity)) -(assert_return (invoke "add" (f64.const 0x1p-1) (f64.const infinity)) (f64.const infinity)) +(assert_return (invoke "add" (f64.const -0x1p-1) (f64.const -inf)) (f64.const -inf)) +(assert_return (invoke "add" (f64.const -0x1p-1) (f64.const inf)) (f64.const inf)) +(assert_return (invoke "add" (f64.const 0x1p-1) (f64.const -inf)) (f64.const -inf)) +(assert_return (invoke "add" (f64.const 0x1p-1) (f64.const inf)) (f64.const inf)) (assert_return_canonical_nan (invoke "add" (f64.const -0x1p-1) (f64.const -nan))) (assert_return_arithmetic_nan (invoke "add" (f64.const -0x1p-1) (f64.const -nan:0x4000000000000))) (assert_return_canonical_nan (invoke "add" (f64.const -0x1p-1) (f64.const nan))) @@ -204,10 +204,10 @@ (assert_return (invoke "add" (f64.const -0x1p+0) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x1.fffffffffffffp+1023)) (assert_return (invoke "add" (f64.const 0x1p+0) (f64.const -0x1.fffffffffffffp+1023)) (f64.const -0x1.fffffffffffffp+1023)) (assert_return (invoke "add" (f64.const 0x1p+0) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x1.fffffffffffffp+1023)) -(assert_return (invoke "add" (f64.const -0x1p+0) (f64.const -infinity)) (f64.const -infinity)) -(assert_return (invoke "add" (f64.const -0x1p+0) (f64.const infinity)) (f64.const infinity)) -(assert_return (invoke "add" (f64.const 0x1p+0) (f64.const -infinity)) (f64.const -infinity)) -(assert_return (invoke "add" (f64.const 0x1p+0) (f64.const infinity)) (f64.const infinity)) +(assert_return (invoke "add" (f64.const -0x1p+0) (f64.const -inf)) (f64.const -inf)) +(assert_return (invoke "add" (f64.const -0x1p+0) (f64.const inf)) (f64.const inf)) +(assert_return (invoke "add" (f64.const 0x1p+0) (f64.const -inf)) (f64.const -inf)) +(assert_return (invoke "add" (f64.const 0x1p+0) (f64.const inf)) (f64.const inf)) (assert_return_canonical_nan (invoke "add" (f64.const -0x1p+0) (f64.const -nan))) (assert_return_arithmetic_nan (invoke "add" (f64.const -0x1p+0) (f64.const -nan:0x4000000000000))) (assert_return_canonical_nan (invoke "add" (f64.const -0x1p+0) (f64.const nan))) @@ -244,10 +244,10 @@ (assert_return (invoke "add" (f64.const -0x1.921fb54442d18p+2) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x1.fffffffffffffp+1023)) (assert_return (invoke "add" (f64.const 0x1.921fb54442d18p+2) (f64.const -0x1.fffffffffffffp+1023)) (f64.const -0x1.fffffffffffffp+1023)) (assert_return (invoke "add" (f64.const 0x1.921fb54442d18p+2) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x1.fffffffffffffp+1023)) -(assert_return (invoke "add" (f64.const -0x1.921fb54442d18p+2) (f64.const -infinity)) (f64.const -infinity)) -(assert_return (invoke "add" (f64.const -0x1.921fb54442d18p+2) (f64.const infinity)) (f64.const infinity)) -(assert_return (invoke "add" (f64.const 0x1.921fb54442d18p+2) (f64.const -infinity)) (f64.const -infinity)) -(assert_return (invoke "add" (f64.const 0x1.921fb54442d18p+2) (f64.const infinity)) (f64.const infinity)) +(assert_return (invoke "add" (f64.const -0x1.921fb54442d18p+2) (f64.const -inf)) (f64.const -inf)) +(assert_return (invoke "add" (f64.const -0x1.921fb54442d18p+2) (f64.const inf)) (f64.const inf)) +(assert_return (invoke "add" (f64.const 0x1.921fb54442d18p+2) (f64.const -inf)) (f64.const -inf)) +(assert_return (invoke "add" (f64.const 0x1.921fb54442d18p+2) (f64.const inf)) (f64.const inf)) (assert_return_canonical_nan (invoke "add" (f64.const -0x1.921fb54442d18p+2) (f64.const -nan))) (assert_return_arithmetic_nan (invoke "add" (f64.const -0x1.921fb54442d18p+2) (f64.const -nan:0x4000000000000))) (assert_return_canonical_nan (invoke "add" (f64.const -0x1.921fb54442d18p+2) (f64.const nan))) @@ -280,14 +280,14 @@ (assert_return (invoke "add" (f64.const -0x1.fffffffffffffp+1023) (f64.const 0x1.921fb54442d18p+2)) (f64.const -0x1.fffffffffffffp+1023)) (assert_return (invoke "add" (f64.const 0x1.fffffffffffffp+1023) (f64.const -0x1.921fb54442d18p+2)) (f64.const 0x1.fffffffffffffp+1023)) (assert_return (invoke "add" (f64.const 0x1.fffffffffffffp+1023) (f64.const 0x1.921fb54442d18p+2)) (f64.const 0x1.fffffffffffffp+1023)) -(assert_return (invoke "add" (f64.const -0x1.fffffffffffffp+1023) (f64.const -0x1.fffffffffffffp+1023)) (f64.const -infinity)) +(assert_return (invoke "add" (f64.const -0x1.fffffffffffffp+1023) (f64.const -0x1.fffffffffffffp+1023)) (f64.const -inf)) (assert_return (invoke "add" (f64.const -0x1.fffffffffffffp+1023) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x0p+0)) (assert_return (invoke "add" (f64.const 0x1.fffffffffffffp+1023) (f64.const -0x1.fffffffffffffp+1023)) (f64.const 0x0p+0)) -(assert_return (invoke "add" (f64.const 0x1.fffffffffffffp+1023) (f64.const 0x1.fffffffffffffp+1023)) (f64.const infinity)) -(assert_return (invoke "add" (f64.const -0x1.fffffffffffffp+1023) (f64.const -infinity)) (f64.const -infinity)) -(assert_return (invoke "add" (f64.const -0x1.fffffffffffffp+1023) (f64.const infinity)) (f64.const infinity)) -(assert_return (invoke "add" (f64.const 0x1.fffffffffffffp+1023) (f64.const -infinity)) (f64.const -infinity)) -(assert_return (invoke "add" (f64.const 0x1.fffffffffffffp+1023) (f64.const infinity)) (f64.const infinity)) +(assert_return (invoke "add" (f64.const 0x1.fffffffffffffp+1023) (f64.const 0x1.fffffffffffffp+1023)) (f64.const inf)) +(assert_return (invoke "add" (f64.const -0x1.fffffffffffffp+1023) (f64.const -inf)) (f64.const -inf)) +(assert_return (invoke "add" (f64.const -0x1.fffffffffffffp+1023) (f64.const inf)) (f64.const inf)) +(assert_return (invoke "add" (f64.const 0x1.fffffffffffffp+1023) (f64.const -inf)) (f64.const -inf)) +(assert_return (invoke "add" (f64.const 0x1.fffffffffffffp+1023) (f64.const inf)) (f64.const inf)) (assert_return_canonical_nan (invoke "add" (f64.const -0x1.fffffffffffffp+1023) (f64.const -nan))) (assert_return_arithmetic_nan (invoke "add" (f64.const -0x1.fffffffffffffp+1023) (f64.const -nan:0x4000000000000))) (assert_return_canonical_nan (invoke "add" (f64.const -0x1.fffffffffffffp+1023) (f64.const nan))) @@ -296,46 +296,46 @@ (assert_return_arithmetic_nan (invoke "add" (f64.const 0x1.fffffffffffffp+1023) (f64.const -nan:0x4000000000000))) (assert_return_canonical_nan (invoke "add" (f64.const 0x1.fffffffffffffp+1023) (f64.const nan))) (assert_return_arithmetic_nan (invoke "add" (f64.const 0x1.fffffffffffffp+1023) (f64.const nan:0x4000000000000))) -(assert_return (invoke "add" (f64.const -infinity) (f64.const -0x0p+0)) (f64.const -infinity)) -(assert_return (invoke "add" (f64.const -infinity) (f64.const 0x0p+0)) (f64.const -infinity)) -(assert_return (invoke "add" (f64.const infinity) (f64.const -0x0p+0)) (f64.const infinity)) -(assert_return (invoke "add" (f64.const infinity) (f64.const 0x0p+0)) (f64.const infinity)) -(assert_return (invoke "add" (f64.const -infinity) (f64.const -0x0.0000000000001p-1022)) (f64.const -infinity)) -(assert_return (invoke "add" (f64.const -infinity) (f64.const 0x0.0000000000001p-1022)) (f64.const -infinity)) -(assert_return (invoke "add" (f64.const infinity) (f64.const -0x0.0000000000001p-1022)) (f64.const infinity)) -(assert_return (invoke "add" (f64.const infinity) (f64.const 0x0.0000000000001p-1022)) (f64.const infinity)) -(assert_return (invoke "add" (f64.const -infinity) (f64.const -0x1p-1022)) (f64.const -infinity)) -(assert_return (invoke "add" (f64.const -infinity) (f64.const 0x1p-1022)) (f64.const -infinity)) -(assert_return (invoke "add" (f64.const infinity) (f64.const -0x1p-1022)) (f64.const infinity)) -(assert_return (invoke "add" (f64.const infinity) (f64.const 0x1p-1022)) (f64.const infinity)) -(assert_return (invoke "add" (f64.const -infinity) (f64.const -0x1p-1)) (f64.const -infinity)) -(assert_return (invoke "add" (f64.const -infinity) (f64.const 0x1p-1)) (f64.const -infinity)) -(assert_return (invoke "add" (f64.const infinity) (f64.const -0x1p-1)) (f64.const infinity)) -(assert_return (invoke "add" (f64.const infinity) (f64.const 0x1p-1)) (f64.const infinity)) -(assert_return (invoke "add" (f64.const -infinity) (f64.const -0x1p+0)) (f64.const -infinity)) -(assert_return (invoke "add" (f64.const -infinity) (f64.const 0x1p+0)) (f64.const -infinity)) -(assert_return (invoke "add" (f64.const infinity) (f64.const -0x1p+0)) (f64.const infinity)) -(assert_return (invoke "add" (f64.const infinity) (f64.const 0x1p+0)) (f64.const infinity)) -(assert_return (invoke "add" (f64.const -infinity) (f64.const -0x1.921fb54442d18p+2)) (f64.const -infinity)) -(assert_return (invoke "add" (f64.const -infinity) (f64.const 0x1.921fb54442d18p+2)) (f64.const -infinity)) -(assert_return (invoke "add" (f64.const infinity) (f64.const -0x1.921fb54442d18p+2)) (f64.const infinity)) -(assert_return (invoke "add" (f64.const infinity) (f64.const 0x1.921fb54442d18p+2)) (f64.const infinity)) -(assert_return (invoke "add" (f64.const -infinity) (f64.const -0x1.fffffffffffffp+1023)) (f64.const -infinity)) -(assert_return (invoke "add" (f64.const -infinity) (f64.const 0x1.fffffffffffffp+1023)) (f64.const -infinity)) -(assert_return (invoke "add" (f64.const infinity) (f64.const -0x1.fffffffffffffp+1023)) (f64.const infinity)) -(assert_return (invoke "add" (f64.const infinity) (f64.const 0x1.fffffffffffffp+1023)) (f64.const infinity)) -(assert_return (invoke "add" (f64.const -infinity) (f64.const -infinity)) (f64.const -infinity)) -(assert_return_canonical_nan (invoke "add" (f64.const -infinity) (f64.const infinity))) -(assert_return_canonical_nan (invoke "add" (f64.const infinity) (f64.const -infinity))) -(assert_return (invoke "add" (f64.const infinity) (f64.const infinity)) (f64.const infinity)) -(assert_return_canonical_nan (invoke "add" (f64.const -infinity) (f64.const -nan))) -(assert_return_arithmetic_nan (invoke "add" (f64.const -infinity) (f64.const -nan:0x4000000000000))) -(assert_return_canonical_nan (invoke "add" (f64.const -infinity) (f64.const nan))) -(assert_return_arithmetic_nan (invoke "add" (f64.const -infinity) (f64.const nan:0x4000000000000))) -(assert_return_canonical_nan (invoke "add" (f64.const infinity) (f64.const -nan))) -(assert_return_arithmetic_nan (invoke "add" (f64.const infinity) (f64.const -nan:0x4000000000000))) -(assert_return_canonical_nan (invoke "add" (f64.const infinity) (f64.const nan))) -(assert_return_arithmetic_nan (invoke "add" (f64.const infinity) (f64.const nan:0x4000000000000))) +(assert_return (invoke "add" (f64.const -inf) (f64.const -0x0p+0)) (f64.const -inf)) +(assert_return (invoke "add" (f64.const -inf) (f64.const 0x0p+0)) (f64.const -inf)) +(assert_return (invoke "add" (f64.const inf) (f64.const -0x0p+0)) (f64.const inf)) +(assert_return (invoke "add" (f64.const inf) (f64.const 0x0p+0)) (f64.const inf)) +(assert_return (invoke "add" (f64.const -inf) (f64.const -0x0.0000000000001p-1022)) (f64.const -inf)) +(assert_return (invoke "add" (f64.const -inf) (f64.const 0x0.0000000000001p-1022)) (f64.const -inf)) +(assert_return (invoke "add" (f64.const inf) (f64.const -0x0.0000000000001p-1022)) (f64.const inf)) +(assert_return (invoke "add" (f64.const inf) (f64.const 0x0.0000000000001p-1022)) (f64.const inf)) +(assert_return (invoke "add" (f64.const -inf) (f64.const -0x1p-1022)) (f64.const -inf)) +(assert_return (invoke "add" (f64.const -inf) (f64.const 0x1p-1022)) (f64.const -inf)) +(assert_return (invoke "add" (f64.const inf) (f64.const -0x1p-1022)) (f64.const inf)) +(assert_return (invoke "add" (f64.const inf) (f64.const 0x1p-1022)) (f64.const inf)) +(assert_return (invoke "add" (f64.const -inf) (f64.const -0x1p-1)) (f64.const -inf)) +(assert_return (invoke "add" (f64.const -inf) (f64.const 0x1p-1)) (f64.const -inf)) +(assert_return (invoke "add" (f64.const inf) (f64.const -0x1p-1)) (f64.const inf)) +(assert_return (invoke "add" (f64.const inf) (f64.const 0x1p-1)) (f64.const inf)) +(assert_return (invoke "add" (f64.const -inf) (f64.const -0x1p+0)) (f64.const -inf)) +(assert_return (invoke "add" (f64.const -inf) (f64.const 0x1p+0)) (f64.const -inf)) +(assert_return (invoke "add" (f64.const inf) (f64.const -0x1p+0)) (f64.const inf)) +(assert_return (invoke "add" (f64.const inf) (f64.const 0x1p+0)) (f64.const inf)) +(assert_return (invoke "add" (f64.const -inf) (f64.const -0x1.921fb54442d18p+2)) (f64.const -inf)) +(assert_return (invoke "add" (f64.const -inf) (f64.const 0x1.921fb54442d18p+2)) (f64.const -inf)) +(assert_return (invoke "add" (f64.const inf) (f64.const -0x1.921fb54442d18p+2)) (f64.const inf)) +(assert_return (invoke "add" (f64.const inf) (f64.const 0x1.921fb54442d18p+2)) (f64.const inf)) +(assert_return (invoke "add" (f64.const -inf) (f64.const -0x1.fffffffffffffp+1023)) (f64.const -inf)) +(assert_return (invoke "add" (f64.const -inf) (f64.const 0x1.fffffffffffffp+1023)) (f64.const -inf)) +(assert_return (invoke "add" (f64.const inf) (f64.const -0x1.fffffffffffffp+1023)) (f64.const inf)) +(assert_return (invoke "add" (f64.const inf) (f64.const 0x1.fffffffffffffp+1023)) (f64.const inf)) +(assert_return (invoke "add" (f64.const -inf) (f64.const -inf)) (f64.const -inf)) +(assert_return_canonical_nan (invoke "add" (f64.const -inf) (f64.const inf))) +(assert_return_canonical_nan (invoke "add" (f64.const inf) (f64.const -inf))) +(assert_return (invoke "add" (f64.const inf) (f64.const inf)) (f64.const inf)) +(assert_return_canonical_nan (invoke "add" (f64.const -inf) (f64.const -nan))) +(assert_return_arithmetic_nan (invoke "add" (f64.const -inf) (f64.const -nan:0x4000000000000))) +(assert_return_canonical_nan (invoke "add" (f64.const -inf) (f64.const nan))) +(assert_return_arithmetic_nan (invoke "add" (f64.const -inf) (f64.const nan:0x4000000000000))) +(assert_return_canonical_nan (invoke "add" (f64.const inf) (f64.const -nan))) +(assert_return_arithmetic_nan (invoke "add" (f64.const inf) (f64.const -nan:0x4000000000000))) +(assert_return_canonical_nan (invoke "add" (f64.const inf) (f64.const nan))) +(assert_return_arithmetic_nan (invoke "add" (f64.const inf) (f64.const nan:0x4000000000000))) (assert_return_canonical_nan (invoke "add" (f64.const -nan) (f64.const -0x0p+0))) (assert_return_arithmetic_nan (invoke "add" (f64.const -nan:0x4000000000000) (f64.const -0x0p+0))) (assert_return_canonical_nan (invoke "add" (f64.const -nan) (f64.const 0x0p+0))) @@ -392,14 +392,14 @@ (assert_return_arithmetic_nan (invoke "add" (f64.const nan:0x4000000000000) (f64.const -0x1.fffffffffffffp+1023))) (assert_return_canonical_nan (invoke "add" (f64.const nan) (f64.const 0x1.fffffffffffffp+1023))) (assert_return_arithmetic_nan (invoke "add" (f64.const nan:0x4000000000000) (f64.const 0x1.fffffffffffffp+1023))) -(assert_return_canonical_nan (invoke "add" (f64.const -nan) (f64.const -infinity))) -(assert_return_arithmetic_nan (invoke "add" (f64.const -nan:0x4000000000000) (f64.const -infinity))) -(assert_return_canonical_nan (invoke "add" (f64.const -nan) (f64.const infinity))) -(assert_return_arithmetic_nan (invoke "add" (f64.const -nan:0x4000000000000) (f64.const infinity))) -(assert_return_canonical_nan (invoke "add" (f64.const nan) (f64.const -infinity))) -(assert_return_arithmetic_nan (invoke "add" (f64.const nan:0x4000000000000) (f64.const -infinity))) -(assert_return_canonical_nan (invoke "add" (f64.const nan) (f64.const infinity))) -(assert_return_arithmetic_nan (invoke "add" (f64.const nan:0x4000000000000) (f64.const infinity))) +(assert_return_canonical_nan (invoke "add" (f64.const -nan) (f64.const -inf))) +(assert_return_arithmetic_nan (invoke "add" (f64.const -nan:0x4000000000000) (f64.const -inf))) +(assert_return_canonical_nan (invoke "add" (f64.const -nan) (f64.const inf))) +(assert_return_arithmetic_nan (invoke "add" (f64.const -nan:0x4000000000000) (f64.const inf))) +(assert_return_canonical_nan (invoke "add" (f64.const nan) (f64.const -inf))) +(assert_return_arithmetic_nan (invoke "add" (f64.const nan:0x4000000000000) (f64.const -inf))) +(assert_return_canonical_nan (invoke "add" (f64.const nan) (f64.const inf))) +(assert_return_arithmetic_nan (invoke "add" (f64.const nan:0x4000000000000) (f64.const inf))) (assert_return_canonical_nan (invoke "add" (f64.const -nan) (f64.const -nan))) (assert_return_arithmetic_nan (invoke "add" (f64.const -nan:0x4000000000000) (f64.const -nan))) (assert_return_arithmetic_nan (invoke "add" (f64.const -nan) (f64.const -nan:0x4000000000000))) @@ -444,10 +444,10 @@ (assert_return (invoke "sub" (f64.const -0x0p+0) (f64.const 0x1.fffffffffffffp+1023)) (f64.const -0x1.fffffffffffffp+1023)) (assert_return (invoke "sub" (f64.const 0x0p+0) (f64.const -0x1.fffffffffffffp+1023)) (f64.const 0x1.fffffffffffffp+1023)) (assert_return (invoke "sub" (f64.const 0x0p+0) (f64.const 0x1.fffffffffffffp+1023)) (f64.const -0x1.fffffffffffffp+1023)) -(assert_return (invoke "sub" (f64.const -0x0p+0) (f64.const -infinity)) (f64.const infinity)) -(assert_return (invoke "sub" (f64.const -0x0p+0) (f64.const infinity)) (f64.const -infinity)) -(assert_return (invoke "sub" (f64.const 0x0p+0) (f64.const -infinity)) (f64.const infinity)) -(assert_return (invoke "sub" (f64.const 0x0p+0) (f64.const infinity)) (f64.const -infinity)) +(assert_return (invoke "sub" (f64.const -0x0p+0) (f64.const -inf)) (f64.const inf)) +(assert_return (invoke "sub" (f64.const -0x0p+0) (f64.const inf)) (f64.const -inf)) +(assert_return (invoke "sub" (f64.const 0x0p+0) (f64.const -inf)) (f64.const inf)) +(assert_return (invoke "sub" (f64.const 0x0p+0) (f64.const inf)) (f64.const -inf)) (assert_return_canonical_nan (invoke "sub" (f64.const -0x0p+0) (f64.const -nan))) (assert_return_arithmetic_nan (invoke "sub" (f64.const -0x0p+0) (f64.const -nan:0x4000000000000))) (assert_return_canonical_nan (invoke "sub" (f64.const -0x0p+0) (f64.const nan))) @@ -484,10 +484,10 @@ (assert_return (invoke "sub" (f64.const -0x0.0000000000001p-1022) (f64.const 0x1.fffffffffffffp+1023)) (f64.const -0x1.fffffffffffffp+1023)) (assert_return (invoke "sub" (f64.const 0x0.0000000000001p-1022) (f64.const -0x1.fffffffffffffp+1023)) (f64.const 0x1.fffffffffffffp+1023)) (assert_return (invoke "sub" (f64.const 0x0.0000000000001p-1022) (f64.const 0x1.fffffffffffffp+1023)) (f64.const -0x1.fffffffffffffp+1023)) -(assert_return (invoke "sub" (f64.const -0x0.0000000000001p-1022) (f64.const -infinity)) (f64.const infinity)) -(assert_return (invoke "sub" (f64.const -0x0.0000000000001p-1022) (f64.const infinity)) (f64.const -infinity)) -(assert_return (invoke "sub" (f64.const 0x0.0000000000001p-1022) (f64.const -infinity)) (f64.const infinity)) -(assert_return (invoke "sub" (f64.const 0x0.0000000000001p-1022) (f64.const infinity)) (f64.const -infinity)) +(assert_return (invoke "sub" (f64.const -0x0.0000000000001p-1022) (f64.const -inf)) (f64.const inf)) +(assert_return (invoke "sub" (f64.const -0x0.0000000000001p-1022) (f64.const inf)) (f64.const -inf)) +(assert_return (invoke "sub" (f64.const 0x0.0000000000001p-1022) (f64.const -inf)) (f64.const inf)) +(assert_return (invoke "sub" (f64.const 0x0.0000000000001p-1022) (f64.const inf)) (f64.const -inf)) (assert_return_canonical_nan (invoke "sub" (f64.const -0x0.0000000000001p-1022) (f64.const -nan))) (assert_return_arithmetic_nan (invoke "sub" (f64.const -0x0.0000000000001p-1022) (f64.const -nan:0x4000000000000))) (assert_return_canonical_nan (invoke "sub" (f64.const -0x0.0000000000001p-1022) (f64.const nan))) @@ -524,10 +524,10 @@ (assert_return (invoke "sub" (f64.const -0x1p-1022) (f64.const 0x1.fffffffffffffp+1023)) (f64.const -0x1.fffffffffffffp+1023)) (assert_return (invoke "sub" (f64.const 0x1p-1022) (f64.const -0x1.fffffffffffffp+1023)) (f64.const 0x1.fffffffffffffp+1023)) (assert_return (invoke "sub" (f64.const 0x1p-1022) (f64.const 0x1.fffffffffffffp+1023)) (f64.const -0x1.fffffffffffffp+1023)) -(assert_return (invoke "sub" (f64.const -0x1p-1022) (f64.const -infinity)) (f64.const infinity)) -(assert_return (invoke "sub" (f64.const -0x1p-1022) (f64.const infinity)) (f64.const -infinity)) -(assert_return (invoke "sub" (f64.const 0x1p-1022) (f64.const -infinity)) (f64.const infinity)) -(assert_return (invoke "sub" (f64.const 0x1p-1022) (f64.const infinity)) (f64.const -infinity)) +(assert_return (invoke "sub" (f64.const -0x1p-1022) (f64.const -inf)) (f64.const inf)) +(assert_return (invoke "sub" (f64.const -0x1p-1022) (f64.const inf)) (f64.const -inf)) +(assert_return (invoke "sub" (f64.const 0x1p-1022) (f64.const -inf)) (f64.const inf)) +(assert_return (invoke "sub" (f64.const 0x1p-1022) (f64.const inf)) (f64.const -inf)) (assert_return_canonical_nan (invoke "sub" (f64.const -0x1p-1022) (f64.const -nan))) (assert_return_arithmetic_nan (invoke "sub" (f64.const -0x1p-1022) (f64.const -nan:0x4000000000000))) (assert_return_canonical_nan (invoke "sub" (f64.const -0x1p-1022) (f64.const nan))) @@ -564,10 +564,10 @@ (assert_return (invoke "sub" (f64.const -0x1p-1) (f64.const 0x1.fffffffffffffp+1023)) (f64.const -0x1.fffffffffffffp+1023)) (assert_return (invoke "sub" (f64.const 0x1p-1) (f64.const -0x1.fffffffffffffp+1023)) (f64.const 0x1.fffffffffffffp+1023)) (assert_return (invoke "sub" (f64.const 0x1p-1) (f64.const 0x1.fffffffffffffp+1023)) (f64.const -0x1.fffffffffffffp+1023)) -(assert_return (invoke "sub" (f64.const -0x1p-1) (f64.const -infinity)) (f64.const infinity)) -(assert_return (invoke "sub" (f64.const -0x1p-1) (f64.const infinity)) (f64.const -infinity)) -(assert_return (invoke "sub" (f64.const 0x1p-1) (f64.const -infinity)) (f64.const infinity)) -(assert_return (invoke "sub" (f64.const 0x1p-1) (f64.const infinity)) (f64.const -infinity)) +(assert_return (invoke "sub" (f64.const -0x1p-1) (f64.const -inf)) (f64.const inf)) +(assert_return (invoke "sub" (f64.const -0x1p-1) (f64.const inf)) (f64.const -inf)) +(assert_return (invoke "sub" (f64.const 0x1p-1) (f64.const -inf)) (f64.const inf)) +(assert_return (invoke "sub" (f64.const 0x1p-1) (f64.const inf)) (f64.const -inf)) (assert_return_canonical_nan (invoke "sub" (f64.const -0x1p-1) (f64.const -nan))) (assert_return_arithmetic_nan (invoke "sub" (f64.const -0x1p-1) (f64.const -nan:0x4000000000000))) (assert_return_canonical_nan (invoke "sub" (f64.const -0x1p-1) (f64.const nan))) @@ -604,10 +604,10 @@ (assert_return (invoke "sub" (f64.const -0x1p+0) (f64.const 0x1.fffffffffffffp+1023)) (f64.const -0x1.fffffffffffffp+1023)) (assert_return (invoke "sub" (f64.const 0x1p+0) (f64.const -0x1.fffffffffffffp+1023)) (f64.const 0x1.fffffffffffffp+1023)) (assert_return (invoke "sub" (f64.const 0x1p+0) (f64.const 0x1.fffffffffffffp+1023)) (f64.const -0x1.fffffffffffffp+1023)) -(assert_return (invoke "sub" (f64.const -0x1p+0) (f64.const -infinity)) (f64.const infinity)) -(assert_return (invoke "sub" (f64.const -0x1p+0) (f64.const infinity)) (f64.const -infinity)) -(assert_return (invoke "sub" (f64.const 0x1p+0) (f64.const -infinity)) (f64.const infinity)) -(assert_return (invoke "sub" (f64.const 0x1p+0) (f64.const infinity)) (f64.const -infinity)) +(assert_return (invoke "sub" (f64.const -0x1p+0) (f64.const -inf)) (f64.const inf)) +(assert_return (invoke "sub" (f64.const -0x1p+0) (f64.const inf)) (f64.const -inf)) +(assert_return (invoke "sub" (f64.const 0x1p+0) (f64.const -inf)) (f64.const inf)) +(assert_return (invoke "sub" (f64.const 0x1p+0) (f64.const inf)) (f64.const -inf)) (assert_return_canonical_nan (invoke "sub" (f64.const -0x1p+0) (f64.const -nan))) (assert_return_arithmetic_nan (invoke "sub" (f64.const -0x1p+0) (f64.const -nan:0x4000000000000))) (assert_return_canonical_nan (invoke "sub" (f64.const -0x1p+0) (f64.const nan))) @@ -644,10 +644,10 @@ (assert_return (invoke "sub" (f64.const -0x1.921fb54442d18p+2) (f64.const 0x1.fffffffffffffp+1023)) (f64.const -0x1.fffffffffffffp+1023)) (assert_return (invoke "sub" (f64.const 0x1.921fb54442d18p+2) (f64.const -0x1.fffffffffffffp+1023)) (f64.const 0x1.fffffffffffffp+1023)) (assert_return (invoke "sub" (f64.const 0x1.921fb54442d18p+2) (f64.const 0x1.fffffffffffffp+1023)) (f64.const -0x1.fffffffffffffp+1023)) -(assert_return (invoke "sub" (f64.const -0x1.921fb54442d18p+2) (f64.const -infinity)) (f64.const infinity)) -(assert_return (invoke "sub" (f64.const -0x1.921fb54442d18p+2) (f64.const infinity)) (f64.const -infinity)) -(assert_return (invoke "sub" (f64.const 0x1.921fb54442d18p+2) (f64.const -infinity)) (f64.const infinity)) -(assert_return (invoke "sub" (f64.const 0x1.921fb54442d18p+2) (f64.const infinity)) (f64.const -infinity)) +(assert_return (invoke "sub" (f64.const -0x1.921fb54442d18p+2) (f64.const -inf)) (f64.const inf)) +(assert_return (invoke "sub" (f64.const -0x1.921fb54442d18p+2) (f64.const inf)) (f64.const -inf)) +(assert_return (invoke "sub" (f64.const 0x1.921fb54442d18p+2) (f64.const -inf)) (f64.const inf)) +(assert_return (invoke "sub" (f64.const 0x1.921fb54442d18p+2) (f64.const inf)) (f64.const -inf)) (assert_return_canonical_nan (invoke "sub" (f64.const -0x1.921fb54442d18p+2) (f64.const -nan))) (assert_return_arithmetic_nan (invoke "sub" (f64.const -0x1.921fb54442d18p+2) (f64.const -nan:0x4000000000000))) (assert_return_canonical_nan (invoke "sub" (f64.const -0x1.921fb54442d18p+2) (f64.const nan))) @@ -681,13 +681,13 @@ (assert_return (invoke "sub" (f64.const 0x1.fffffffffffffp+1023) (f64.const -0x1.921fb54442d18p+2)) (f64.const 0x1.fffffffffffffp+1023)) (assert_return (invoke "sub" (f64.const 0x1.fffffffffffffp+1023) (f64.const 0x1.921fb54442d18p+2)) (f64.const 0x1.fffffffffffffp+1023)) (assert_return (invoke "sub" (f64.const -0x1.fffffffffffffp+1023) (f64.const -0x1.fffffffffffffp+1023)) (f64.const 0x0p+0)) -(assert_return (invoke "sub" (f64.const -0x1.fffffffffffffp+1023) (f64.const 0x1.fffffffffffffp+1023)) (f64.const -infinity)) -(assert_return (invoke "sub" (f64.const 0x1.fffffffffffffp+1023) (f64.const -0x1.fffffffffffffp+1023)) (f64.const infinity)) +(assert_return (invoke "sub" (f64.const -0x1.fffffffffffffp+1023) (f64.const 0x1.fffffffffffffp+1023)) (f64.const -inf)) +(assert_return (invoke "sub" (f64.const 0x1.fffffffffffffp+1023) (f64.const -0x1.fffffffffffffp+1023)) (f64.const inf)) (assert_return (invoke "sub" (f64.const 0x1.fffffffffffffp+1023) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x0p+0)) -(assert_return (invoke "sub" (f64.const -0x1.fffffffffffffp+1023) (f64.const -infinity)) (f64.const infinity)) -(assert_return (invoke "sub" (f64.const -0x1.fffffffffffffp+1023) (f64.const infinity)) (f64.const -infinity)) -(assert_return (invoke "sub" (f64.const 0x1.fffffffffffffp+1023) (f64.const -infinity)) (f64.const infinity)) -(assert_return (invoke "sub" (f64.const 0x1.fffffffffffffp+1023) (f64.const infinity)) (f64.const -infinity)) +(assert_return (invoke "sub" (f64.const -0x1.fffffffffffffp+1023) (f64.const -inf)) (f64.const inf)) +(assert_return (invoke "sub" (f64.const -0x1.fffffffffffffp+1023) (f64.const inf)) (f64.const -inf)) +(assert_return (invoke "sub" (f64.const 0x1.fffffffffffffp+1023) (f64.const -inf)) (f64.const inf)) +(assert_return (invoke "sub" (f64.const 0x1.fffffffffffffp+1023) (f64.const inf)) (f64.const -inf)) (assert_return_canonical_nan (invoke "sub" (f64.const -0x1.fffffffffffffp+1023) (f64.const -nan))) (assert_return_arithmetic_nan (invoke "sub" (f64.const -0x1.fffffffffffffp+1023) (f64.const -nan:0x4000000000000))) (assert_return_canonical_nan (invoke "sub" (f64.const -0x1.fffffffffffffp+1023) (f64.const nan))) @@ -696,46 +696,46 @@ (assert_return_arithmetic_nan (invoke "sub" (f64.const 0x1.fffffffffffffp+1023) (f64.const -nan:0x4000000000000))) (assert_return_canonical_nan (invoke "sub" (f64.const 0x1.fffffffffffffp+1023) (f64.const nan))) (assert_return_arithmetic_nan (invoke "sub" (f64.const 0x1.fffffffffffffp+1023) (f64.const nan:0x4000000000000))) -(assert_return (invoke "sub" (f64.const -infinity) (f64.const -0x0p+0)) (f64.const -infinity)) -(assert_return (invoke "sub" (f64.const -infinity) (f64.const 0x0p+0)) (f64.const -infinity)) -(assert_return (invoke "sub" (f64.const infinity) (f64.const -0x0p+0)) (f64.const infinity)) -(assert_return (invoke "sub" (f64.const infinity) (f64.const 0x0p+0)) (f64.const infinity)) -(assert_return (invoke "sub" (f64.const -infinity) (f64.const -0x0.0000000000001p-1022)) (f64.const -infinity)) -(assert_return (invoke "sub" (f64.const -infinity) (f64.const 0x0.0000000000001p-1022)) (f64.const -infinity)) -(assert_return (invoke "sub" (f64.const infinity) (f64.const -0x0.0000000000001p-1022)) (f64.const infinity)) -(assert_return (invoke "sub" (f64.const infinity) (f64.const 0x0.0000000000001p-1022)) (f64.const infinity)) -(assert_return (invoke "sub" (f64.const -infinity) (f64.const -0x1p-1022)) (f64.const -infinity)) -(assert_return (invoke "sub" (f64.const -infinity) (f64.const 0x1p-1022)) (f64.const -infinity)) -(assert_return (invoke "sub" (f64.const infinity) (f64.const -0x1p-1022)) (f64.const infinity)) -(assert_return (invoke "sub" (f64.const infinity) (f64.const 0x1p-1022)) (f64.const infinity)) -(assert_return (invoke "sub" (f64.const -infinity) (f64.const -0x1p-1)) (f64.const -infinity)) -(assert_return (invoke "sub" (f64.const -infinity) (f64.const 0x1p-1)) (f64.const -infinity)) -(assert_return (invoke "sub" (f64.const infinity) (f64.const -0x1p-1)) (f64.const infinity)) -(assert_return (invoke "sub" (f64.const infinity) (f64.const 0x1p-1)) (f64.const infinity)) -(assert_return (invoke "sub" (f64.const -infinity) (f64.const -0x1p+0)) (f64.const -infinity)) -(assert_return (invoke "sub" (f64.const -infinity) (f64.const 0x1p+0)) (f64.const -infinity)) -(assert_return (invoke "sub" (f64.const infinity) (f64.const -0x1p+0)) (f64.const infinity)) -(assert_return (invoke "sub" (f64.const infinity) (f64.const 0x1p+0)) (f64.const infinity)) -(assert_return (invoke "sub" (f64.const -infinity) (f64.const -0x1.921fb54442d18p+2)) (f64.const -infinity)) -(assert_return (invoke "sub" (f64.const -infinity) (f64.const 0x1.921fb54442d18p+2)) (f64.const -infinity)) -(assert_return (invoke "sub" (f64.const infinity) (f64.const -0x1.921fb54442d18p+2)) (f64.const infinity)) -(assert_return (invoke "sub" (f64.const infinity) (f64.const 0x1.921fb54442d18p+2)) (f64.const infinity)) -(assert_return (invoke "sub" (f64.const -infinity) (f64.const -0x1.fffffffffffffp+1023)) (f64.const -infinity)) -(assert_return (invoke "sub" (f64.const -infinity) (f64.const 0x1.fffffffffffffp+1023)) (f64.const -infinity)) -(assert_return (invoke "sub" (f64.const infinity) (f64.const -0x1.fffffffffffffp+1023)) (f64.const infinity)) -(assert_return (invoke "sub" (f64.const infinity) (f64.const 0x1.fffffffffffffp+1023)) (f64.const infinity)) -(assert_return_canonical_nan (invoke "sub" (f64.const -infinity) (f64.const -infinity))) -(assert_return (invoke "sub" (f64.const -infinity) (f64.const infinity)) (f64.const -infinity)) -(assert_return (invoke "sub" (f64.const infinity) (f64.const -infinity)) (f64.const infinity)) -(assert_return_canonical_nan (invoke "sub" (f64.const infinity) (f64.const infinity))) -(assert_return_canonical_nan (invoke "sub" (f64.const -infinity) (f64.const -nan))) -(assert_return_arithmetic_nan (invoke "sub" (f64.const -infinity) (f64.const -nan:0x4000000000000))) -(assert_return_canonical_nan (invoke "sub" (f64.const -infinity) (f64.const nan))) -(assert_return_arithmetic_nan (invoke "sub" (f64.const -infinity) (f64.const nan:0x4000000000000))) -(assert_return_canonical_nan (invoke "sub" (f64.const infinity) (f64.const -nan))) -(assert_return_arithmetic_nan (invoke "sub" (f64.const infinity) (f64.const -nan:0x4000000000000))) -(assert_return_canonical_nan (invoke "sub" (f64.const infinity) (f64.const nan))) -(assert_return_arithmetic_nan (invoke "sub" (f64.const infinity) (f64.const nan:0x4000000000000))) +(assert_return (invoke "sub" (f64.const -inf) (f64.const -0x0p+0)) (f64.const -inf)) +(assert_return (invoke "sub" (f64.const -inf) (f64.const 0x0p+0)) (f64.const -inf)) +(assert_return (invoke "sub" (f64.const inf) (f64.const -0x0p+0)) (f64.const inf)) +(assert_return (invoke "sub" (f64.const inf) (f64.const 0x0p+0)) (f64.const inf)) +(assert_return (invoke "sub" (f64.const -inf) (f64.const -0x0.0000000000001p-1022)) (f64.const -inf)) +(assert_return (invoke "sub" (f64.const -inf) (f64.const 0x0.0000000000001p-1022)) (f64.const -inf)) +(assert_return (invoke "sub" (f64.const inf) (f64.const -0x0.0000000000001p-1022)) (f64.const inf)) +(assert_return (invoke "sub" (f64.const inf) (f64.const 0x0.0000000000001p-1022)) (f64.const inf)) +(assert_return (invoke "sub" (f64.const -inf) (f64.const -0x1p-1022)) (f64.const -inf)) +(assert_return (invoke "sub" (f64.const -inf) (f64.const 0x1p-1022)) (f64.const -inf)) +(assert_return (invoke "sub" (f64.const inf) (f64.const -0x1p-1022)) (f64.const inf)) +(assert_return (invoke "sub" (f64.const inf) (f64.const 0x1p-1022)) (f64.const inf)) +(assert_return (invoke "sub" (f64.const -inf) (f64.const -0x1p-1)) (f64.const -inf)) +(assert_return (invoke "sub" (f64.const -inf) (f64.const 0x1p-1)) (f64.const -inf)) +(assert_return (invoke "sub" (f64.const inf) (f64.const -0x1p-1)) (f64.const inf)) +(assert_return (invoke "sub" (f64.const inf) (f64.const 0x1p-1)) (f64.const inf)) +(assert_return (invoke "sub" (f64.const -inf) (f64.const -0x1p+0)) (f64.const -inf)) +(assert_return (invoke "sub" (f64.const -inf) (f64.const 0x1p+0)) (f64.const -inf)) +(assert_return (invoke "sub" (f64.const inf) (f64.const -0x1p+0)) (f64.const inf)) +(assert_return (invoke "sub" (f64.const inf) (f64.const 0x1p+0)) (f64.const inf)) +(assert_return (invoke "sub" (f64.const -inf) (f64.const -0x1.921fb54442d18p+2)) (f64.const -inf)) +(assert_return (invoke "sub" (f64.const -inf) (f64.const 0x1.921fb54442d18p+2)) (f64.const -inf)) +(assert_return (invoke "sub" (f64.const inf) (f64.const -0x1.921fb54442d18p+2)) (f64.const inf)) +(assert_return (invoke "sub" (f64.const inf) (f64.const 0x1.921fb54442d18p+2)) (f64.const inf)) +(assert_return (invoke "sub" (f64.const -inf) (f64.const -0x1.fffffffffffffp+1023)) (f64.const -inf)) +(assert_return (invoke "sub" (f64.const -inf) (f64.const 0x1.fffffffffffffp+1023)) (f64.const -inf)) +(assert_return (invoke "sub" (f64.const inf) (f64.const -0x1.fffffffffffffp+1023)) (f64.const inf)) +(assert_return (invoke "sub" (f64.const inf) (f64.const 0x1.fffffffffffffp+1023)) (f64.const inf)) +(assert_return_canonical_nan (invoke "sub" (f64.const -inf) (f64.const -inf))) +(assert_return (invoke "sub" (f64.const -inf) (f64.const inf)) (f64.const -inf)) +(assert_return (invoke "sub" (f64.const inf) (f64.const -inf)) (f64.const inf)) +(assert_return_canonical_nan (invoke "sub" (f64.const inf) (f64.const inf))) +(assert_return_canonical_nan (invoke "sub" (f64.const -inf) (f64.const -nan))) +(assert_return_arithmetic_nan (invoke "sub" (f64.const -inf) (f64.const -nan:0x4000000000000))) +(assert_return_canonical_nan (invoke "sub" (f64.const -inf) (f64.const nan))) +(assert_return_arithmetic_nan (invoke "sub" (f64.const -inf) (f64.const nan:0x4000000000000))) +(assert_return_canonical_nan (invoke "sub" (f64.const inf) (f64.const -nan))) +(assert_return_arithmetic_nan (invoke "sub" (f64.const inf) (f64.const -nan:0x4000000000000))) +(assert_return_canonical_nan (invoke "sub" (f64.const inf) (f64.const nan))) +(assert_return_arithmetic_nan (invoke "sub" (f64.const inf) (f64.const nan:0x4000000000000))) (assert_return_canonical_nan (invoke "sub" (f64.const -nan) (f64.const -0x0p+0))) (assert_return_arithmetic_nan (invoke "sub" (f64.const -nan:0x4000000000000) (f64.const -0x0p+0))) (assert_return_canonical_nan (invoke "sub" (f64.const -nan) (f64.const 0x0p+0))) @@ -792,14 +792,14 @@ (assert_return_arithmetic_nan (invoke "sub" (f64.const nan:0x4000000000000) (f64.const -0x1.fffffffffffffp+1023))) (assert_return_canonical_nan (invoke "sub" (f64.const nan) (f64.const 0x1.fffffffffffffp+1023))) (assert_return_arithmetic_nan (invoke "sub" (f64.const nan:0x4000000000000) (f64.const 0x1.fffffffffffffp+1023))) -(assert_return_canonical_nan (invoke "sub" (f64.const -nan) (f64.const -infinity))) -(assert_return_arithmetic_nan (invoke "sub" (f64.const -nan:0x4000000000000) (f64.const -infinity))) -(assert_return_canonical_nan (invoke "sub" (f64.const -nan) (f64.const infinity))) -(assert_return_arithmetic_nan (invoke "sub" (f64.const -nan:0x4000000000000) (f64.const infinity))) -(assert_return_canonical_nan (invoke "sub" (f64.const nan) (f64.const -infinity))) -(assert_return_arithmetic_nan (invoke "sub" (f64.const nan:0x4000000000000) (f64.const -infinity))) -(assert_return_canonical_nan (invoke "sub" (f64.const nan) (f64.const infinity))) -(assert_return_arithmetic_nan (invoke "sub" (f64.const nan:0x4000000000000) (f64.const infinity))) +(assert_return_canonical_nan (invoke "sub" (f64.const -nan) (f64.const -inf))) +(assert_return_arithmetic_nan (invoke "sub" (f64.const -nan:0x4000000000000) (f64.const -inf))) +(assert_return_canonical_nan (invoke "sub" (f64.const -nan) (f64.const inf))) +(assert_return_arithmetic_nan (invoke "sub" (f64.const -nan:0x4000000000000) (f64.const inf))) +(assert_return_canonical_nan (invoke "sub" (f64.const nan) (f64.const -inf))) +(assert_return_arithmetic_nan (invoke "sub" (f64.const nan:0x4000000000000) (f64.const -inf))) +(assert_return_canonical_nan (invoke "sub" (f64.const nan) (f64.const inf))) +(assert_return_arithmetic_nan (invoke "sub" (f64.const nan:0x4000000000000) (f64.const inf))) (assert_return_canonical_nan (invoke "sub" (f64.const -nan) (f64.const -nan))) (assert_return_arithmetic_nan (invoke "sub" (f64.const -nan:0x4000000000000) (f64.const -nan))) (assert_return_arithmetic_nan (invoke "sub" (f64.const -nan) (f64.const -nan:0x4000000000000))) @@ -844,10 +844,10 @@ (assert_return (invoke "mul" (f64.const -0x0p+0) (f64.const 0x1.fffffffffffffp+1023)) (f64.const -0x0p+0)) (assert_return (invoke "mul" (f64.const 0x0p+0) (f64.const -0x1.fffffffffffffp+1023)) (f64.const -0x0p+0)) (assert_return (invoke "mul" (f64.const 0x0p+0) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x0p+0)) -(assert_return_canonical_nan (invoke "mul" (f64.const -0x0p+0) (f64.const -infinity))) -(assert_return_canonical_nan (invoke "mul" (f64.const -0x0p+0) (f64.const infinity))) -(assert_return_canonical_nan (invoke "mul" (f64.const 0x0p+0) (f64.const -infinity))) -(assert_return_canonical_nan (invoke "mul" (f64.const 0x0p+0) (f64.const infinity))) +(assert_return_canonical_nan (invoke "mul" (f64.const -0x0p+0) (f64.const -inf))) +(assert_return_canonical_nan (invoke "mul" (f64.const -0x0p+0) (f64.const inf))) +(assert_return_canonical_nan (invoke "mul" (f64.const 0x0p+0) (f64.const -inf))) +(assert_return_canonical_nan (invoke "mul" (f64.const 0x0p+0) (f64.const inf))) (assert_return_canonical_nan (invoke "mul" (f64.const -0x0p+0) (f64.const -nan))) (assert_return_arithmetic_nan (invoke "mul" (f64.const -0x0p+0) (f64.const -nan:0x4000000000000))) (assert_return_canonical_nan (invoke "mul" (f64.const -0x0p+0) (f64.const nan))) @@ -884,10 +884,10 @@ (assert_return (invoke "mul" (f64.const -0x0.0000000000001p-1022) (f64.const 0x1.fffffffffffffp+1023)) (f64.const -0x1.fffffffffffffp-51)) (assert_return (invoke "mul" (f64.const 0x0.0000000000001p-1022) (f64.const -0x1.fffffffffffffp+1023)) (f64.const -0x1.fffffffffffffp-51)) (assert_return (invoke "mul" (f64.const 0x0.0000000000001p-1022) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x1.fffffffffffffp-51)) -(assert_return (invoke "mul" (f64.const -0x0.0000000000001p-1022) (f64.const -infinity)) (f64.const infinity)) -(assert_return (invoke "mul" (f64.const -0x0.0000000000001p-1022) (f64.const infinity)) (f64.const -infinity)) -(assert_return (invoke "mul" (f64.const 0x0.0000000000001p-1022) (f64.const -infinity)) (f64.const -infinity)) -(assert_return (invoke "mul" (f64.const 0x0.0000000000001p-1022) (f64.const infinity)) (f64.const infinity)) +(assert_return (invoke "mul" (f64.const -0x0.0000000000001p-1022) (f64.const -inf)) (f64.const inf)) +(assert_return (invoke "mul" (f64.const -0x0.0000000000001p-1022) (f64.const inf)) (f64.const -inf)) +(assert_return (invoke "mul" (f64.const 0x0.0000000000001p-1022) (f64.const -inf)) (f64.const -inf)) +(assert_return (invoke "mul" (f64.const 0x0.0000000000001p-1022) (f64.const inf)) (f64.const inf)) (assert_return_canonical_nan (invoke "mul" (f64.const -0x0.0000000000001p-1022) (f64.const -nan))) (assert_return_arithmetic_nan (invoke "mul" (f64.const -0x0.0000000000001p-1022) (f64.const -nan:0x4000000000000))) (assert_return_canonical_nan (invoke "mul" (f64.const -0x0.0000000000001p-1022) (f64.const nan))) @@ -924,10 +924,10 @@ (assert_return (invoke "mul" (f64.const -0x1p-1022) (f64.const 0x1.fffffffffffffp+1023)) (f64.const -0x1.fffffffffffffp+1)) (assert_return (invoke "mul" (f64.const 0x1p-1022) (f64.const -0x1.fffffffffffffp+1023)) (f64.const -0x1.fffffffffffffp+1)) (assert_return (invoke "mul" (f64.const 0x1p-1022) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x1.fffffffffffffp+1)) -(assert_return (invoke "mul" (f64.const -0x1p-1022) (f64.const -infinity)) (f64.const infinity)) -(assert_return (invoke "mul" (f64.const -0x1p-1022) (f64.const infinity)) (f64.const -infinity)) -(assert_return (invoke "mul" (f64.const 0x1p-1022) (f64.const -infinity)) (f64.const -infinity)) -(assert_return (invoke "mul" (f64.const 0x1p-1022) (f64.const infinity)) (f64.const infinity)) +(assert_return (invoke "mul" (f64.const -0x1p-1022) (f64.const -inf)) (f64.const inf)) +(assert_return (invoke "mul" (f64.const -0x1p-1022) (f64.const inf)) (f64.const -inf)) +(assert_return (invoke "mul" (f64.const 0x1p-1022) (f64.const -inf)) (f64.const -inf)) +(assert_return (invoke "mul" (f64.const 0x1p-1022) (f64.const inf)) (f64.const inf)) (assert_return_canonical_nan (invoke "mul" (f64.const -0x1p-1022) (f64.const -nan))) (assert_return_arithmetic_nan (invoke "mul" (f64.const -0x1p-1022) (f64.const -nan:0x4000000000000))) (assert_return_canonical_nan (invoke "mul" (f64.const -0x1p-1022) (f64.const nan))) @@ -964,10 +964,10 @@ (assert_return (invoke "mul" (f64.const -0x1p-1) (f64.const 0x1.fffffffffffffp+1023)) (f64.const -0x1.fffffffffffffp+1022)) (assert_return (invoke "mul" (f64.const 0x1p-1) (f64.const -0x1.fffffffffffffp+1023)) (f64.const -0x1.fffffffffffffp+1022)) (assert_return (invoke "mul" (f64.const 0x1p-1) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x1.fffffffffffffp+1022)) -(assert_return (invoke "mul" (f64.const -0x1p-1) (f64.const -infinity)) (f64.const infinity)) -(assert_return (invoke "mul" (f64.const -0x1p-1) (f64.const infinity)) (f64.const -infinity)) -(assert_return (invoke "mul" (f64.const 0x1p-1) (f64.const -infinity)) (f64.const -infinity)) -(assert_return (invoke "mul" (f64.const 0x1p-1) (f64.const infinity)) (f64.const infinity)) +(assert_return (invoke "mul" (f64.const -0x1p-1) (f64.const -inf)) (f64.const inf)) +(assert_return (invoke "mul" (f64.const -0x1p-1) (f64.const inf)) (f64.const -inf)) +(assert_return (invoke "mul" (f64.const 0x1p-1) (f64.const -inf)) (f64.const -inf)) +(assert_return (invoke "mul" (f64.const 0x1p-1) (f64.const inf)) (f64.const inf)) (assert_return_canonical_nan (invoke "mul" (f64.const -0x1p-1) (f64.const -nan))) (assert_return_arithmetic_nan (invoke "mul" (f64.const -0x1p-1) (f64.const -nan:0x4000000000000))) (assert_return_canonical_nan (invoke "mul" (f64.const -0x1p-1) (f64.const nan))) @@ -1004,10 +1004,10 @@ (assert_return (invoke "mul" (f64.const -0x1p+0) (f64.const 0x1.fffffffffffffp+1023)) (f64.const -0x1.fffffffffffffp+1023)) (assert_return (invoke "mul" (f64.const 0x1p+0) (f64.const -0x1.fffffffffffffp+1023)) (f64.const -0x1.fffffffffffffp+1023)) (assert_return (invoke "mul" (f64.const 0x1p+0) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x1.fffffffffffffp+1023)) -(assert_return (invoke "mul" (f64.const -0x1p+0) (f64.const -infinity)) (f64.const infinity)) -(assert_return (invoke "mul" (f64.const -0x1p+0) (f64.const infinity)) (f64.const -infinity)) -(assert_return (invoke "mul" (f64.const 0x1p+0) (f64.const -infinity)) (f64.const -infinity)) -(assert_return (invoke "mul" (f64.const 0x1p+0) (f64.const infinity)) (f64.const infinity)) +(assert_return (invoke "mul" (f64.const -0x1p+0) (f64.const -inf)) (f64.const inf)) +(assert_return (invoke "mul" (f64.const -0x1p+0) (f64.const inf)) (f64.const -inf)) +(assert_return (invoke "mul" (f64.const 0x1p+0) (f64.const -inf)) (f64.const -inf)) +(assert_return (invoke "mul" (f64.const 0x1p+0) (f64.const inf)) (f64.const inf)) (assert_return_canonical_nan (invoke "mul" (f64.const -0x1p+0) (f64.const -nan))) (assert_return_arithmetic_nan (invoke "mul" (f64.const -0x1p+0) (f64.const -nan:0x4000000000000))) (assert_return_canonical_nan (invoke "mul" (f64.const -0x1p+0) (f64.const nan))) @@ -1040,14 +1040,14 @@ (assert_return (invoke "mul" (f64.const -0x1.921fb54442d18p+2) (f64.const 0x1.921fb54442d18p+2)) (f64.const -0x1.3bd3cc9be45dep+5)) (assert_return (invoke "mul" (f64.const 0x1.921fb54442d18p+2) (f64.const -0x1.921fb54442d18p+2)) (f64.const -0x1.3bd3cc9be45dep+5)) (assert_return (invoke "mul" (f64.const 0x1.921fb54442d18p+2) (f64.const 0x1.921fb54442d18p+2)) (f64.const 0x1.3bd3cc9be45dep+5)) -(assert_return (invoke "mul" (f64.const -0x1.921fb54442d18p+2) (f64.const -0x1.fffffffffffffp+1023)) (f64.const infinity)) -(assert_return (invoke "mul" (f64.const -0x1.921fb54442d18p+2) (f64.const 0x1.fffffffffffffp+1023)) (f64.const -infinity)) -(assert_return (invoke "mul" (f64.const 0x1.921fb54442d18p+2) (f64.const -0x1.fffffffffffffp+1023)) (f64.const -infinity)) -(assert_return (invoke "mul" (f64.const 0x1.921fb54442d18p+2) (f64.const 0x1.fffffffffffffp+1023)) (f64.const infinity)) -(assert_return (invoke "mul" (f64.const -0x1.921fb54442d18p+2) (f64.const -infinity)) (f64.const infinity)) -(assert_return (invoke "mul" (f64.const -0x1.921fb54442d18p+2) (f64.const infinity)) (f64.const -infinity)) -(assert_return (invoke "mul" (f64.const 0x1.921fb54442d18p+2) (f64.const -infinity)) (f64.const -infinity)) -(assert_return (invoke "mul" (f64.const 0x1.921fb54442d18p+2) (f64.const infinity)) (f64.const infinity)) +(assert_return (invoke "mul" (f64.const -0x1.921fb54442d18p+2) (f64.const -0x1.fffffffffffffp+1023)) (f64.const inf)) +(assert_return (invoke "mul" (f64.const -0x1.921fb54442d18p+2) (f64.const 0x1.fffffffffffffp+1023)) (f64.const -inf)) +(assert_return (invoke "mul" (f64.const 0x1.921fb54442d18p+2) (f64.const -0x1.fffffffffffffp+1023)) (f64.const -inf)) +(assert_return (invoke "mul" (f64.const 0x1.921fb54442d18p+2) (f64.const 0x1.fffffffffffffp+1023)) (f64.const inf)) +(assert_return (invoke "mul" (f64.const -0x1.921fb54442d18p+2) (f64.const -inf)) (f64.const inf)) +(assert_return (invoke "mul" (f64.const -0x1.921fb54442d18p+2) (f64.const inf)) (f64.const -inf)) +(assert_return (invoke "mul" (f64.const 0x1.921fb54442d18p+2) (f64.const -inf)) (f64.const -inf)) +(assert_return (invoke "mul" (f64.const 0x1.921fb54442d18p+2) (f64.const inf)) (f64.const inf)) (assert_return_canonical_nan (invoke "mul" (f64.const -0x1.921fb54442d18p+2) (f64.const -nan))) (assert_return_arithmetic_nan (invoke "mul" (f64.const -0x1.921fb54442d18p+2) (f64.const -nan:0x4000000000000))) (assert_return_canonical_nan (invoke "mul" (f64.const -0x1.921fb54442d18p+2) (f64.const nan))) @@ -1076,18 +1076,18 @@ (assert_return (invoke "mul" (f64.const -0x1.fffffffffffffp+1023) (f64.const 0x1p+0)) (f64.const -0x1.fffffffffffffp+1023)) (assert_return (invoke "mul" (f64.const 0x1.fffffffffffffp+1023) (f64.const -0x1p+0)) (f64.const -0x1.fffffffffffffp+1023)) (assert_return (invoke "mul" (f64.const 0x1.fffffffffffffp+1023) (f64.const 0x1p+0)) (f64.const 0x1.fffffffffffffp+1023)) -(assert_return (invoke "mul" (f64.const -0x1.fffffffffffffp+1023) (f64.const -0x1.921fb54442d18p+2)) (f64.const infinity)) -(assert_return (invoke "mul" (f64.const -0x1.fffffffffffffp+1023) (f64.const 0x1.921fb54442d18p+2)) (f64.const -infinity)) -(assert_return (invoke "mul" (f64.const 0x1.fffffffffffffp+1023) (f64.const -0x1.921fb54442d18p+2)) (f64.const -infinity)) -(assert_return (invoke "mul" (f64.const 0x1.fffffffffffffp+1023) (f64.const 0x1.921fb54442d18p+2)) (f64.const infinity)) -(assert_return (invoke "mul" (f64.const -0x1.fffffffffffffp+1023) (f64.const -0x1.fffffffffffffp+1023)) (f64.const infinity)) -(assert_return (invoke "mul" (f64.const -0x1.fffffffffffffp+1023) (f64.const 0x1.fffffffffffffp+1023)) (f64.const -infinity)) -(assert_return (invoke "mul" (f64.const 0x1.fffffffffffffp+1023) (f64.const -0x1.fffffffffffffp+1023)) (f64.const -infinity)) -(assert_return (invoke "mul" (f64.const 0x1.fffffffffffffp+1023) (f64.const 0x1.fffffffffffffp+1023)) (f64.const infinity)) -(assert_return (invoke "mul" (f64.const -0x1.fffffffffffffp+1023) (f64.const -infinity)) (f64.const infinity)) -(assert_return (invoke "mul" (f64.const -0x1.fffffffffffffp+1023) (f64.const infinity)) (f64.const -infinity)) -(assert_return (invoke "mul" (f64.const 0x1.fffffffffffffp+1023) (f64.const -infinity)) (f64.const -infinity)) -(assert_return (invoke "mul" (f64.const 0x1.fffffffffffffp+1023) (f64.const infinity)) (f64.const infinity)) +(assert_return (invoke "mul" (f64.const -0x1.fffffffffffffp+1023) (f64.const -0x1.921fb54442d18p+2)) (f64.const inf)) +(assert_return (invoke "mul" (f64.const -0x1.fffffffffffffp+1023) (f64.const 0x1.921fb54442d18p+2)) (f64.const -inf)) +(assert_return (invoke "mul" (f64.const 0x1.fffffffffffffp+1023) (f64.const -0x1.921fb54442d18p+2)) (f64.const -inf)) +(assert_return (invoke "mul" (f64.const 0x1.fffffffffffffp+1023) (f64.const 0x1.921fb54442d18p+2)) (f64.const inf)) +(assert_return (invoke "mul" (f64.const -0x1.fffffffffffffp+1023) (f64.const -0x1.fffffffffffffp+1023)) (f64.const inf)) +(assert_return (invoke "mul" (f64.const -0x1.fffffffffffffp+1023) (f64.const 0x1.fffffffffffffp+1023)) (f64.const -inf)) +(assert_return (invoke "mul" (f64.const 0x1.fffffffffffffp+1023) (f64.const -0x1.fffffffffffffp+1023)) (f64.const -inf)) +(assert_return (invoke "mul" (f64.const 0x1.fffffffffffffp+1023) (f64.const 0x1.fffffffffffffp+1023)) (f64.const inf)) +(assert_return (invoke "mul" (f64.const -0x1.fffffffffffffp+1023) (f64.const -inf)) (f64.const inf)) +(assert_return (invoke "mul" (f64.const -0x1.fffffffffffffp+1023) (f64.const inf)) (f64.const -inf)) +(assert_return (invoke "mul" (f64.const 0x1.fffffffffffffp+1023) (f64.const -inf)) (f64.const -inf)) +(assert_return (invoke "mul" (f64.const 0x1.fffffffffffffp+1023) (f64.const inf)) (f64.const inf)) (assert_return_canonical_nan (invoke "mul" (f64.const -0x1.fffffffffffffp+1023) (f64.const -nan))) (assert_return_arithmetic_nan (invoke "mul" (f64.const -0x1.fffffffffffffp+1023) (f64.const -nan:0x4000000000000))) (assert_return_canonical_nan (invoke "mul" (f64.const -0x1.fffffffffffffp+1023) (f64.const nan))) @@ -1096,46 +1096,46 @@ (assert_return_arithmetic_nan (invoke "mul" (f64.const 0x1.fffffffffffffp+1023) (f64.const -nan:0x4000000000000))) (assert_return_canonical_nan (invoke "mul" (f64.const 0x1.fffffffffffffp+1023) (f64.const nan))) (assert_return_arithmetic_nan (invoke "mul" (f64.const 0x1.fffffffffffffp+1023) (f64.const nan:0x4000000000000))) -(assert_return_canonical_nan (invoke "mul" (f64.const -infinity) (f64.const -0x0p+0))) -(assert_return_canonical_nan (invoke "mul" (f64.const -infinity) (f64.const 0x0p+0))) -(assert_return_canonical_nan (invoke "mul" (f64.const infinity) (f64.const -0x0p+0))) -(assert_return_canonical_nan (invoke "mul" (f64.const infinity) (f64.const 0x0p+0))) -(assert_return (invoke "mul" (f64.const -infinity) (f64.const -0x0.0000000000001p-1022)) (f64.const infinity)) -(assert_return (invoke "mul" (f64.const -infinity) (f64.const 0x0.0000000000001p-1022)) (f64.const -infinity)) -(assert_return (invoke "mul" (f64.const infinity) (f64.const -0x0.0000000000001p-1022)) (f64.const -infinity)) -(assert_return (invoke "mul" (f64.const infinity) (f64.const 0x0.0000000000001p-1022)) (f64.const infinity)) -(assert_return (invoke "mul" (f64.const -infinity) (f64.const -0x1p-1022)) (f64.const infinity)) -(assert_return (invoke "mul" (f64.const -infinity) (f64.const 0x1p-1022)) (f64.const -infinity)) -(assert_return (invoke "mul" (f64.const infinity) (f64.const -0x1p-1022)) (f64.const -infinity)) -(assert_return (invoke "mul" (f64.const infinity) (f64.const 0x1p-1022)) (f64.const infinity)) -(assert_return (invoke "mul" (f64.const -infinity) (f64.const -0x1p-1)) (f64.const infinity)) -(assert_return (invoke "mul" (f64.const -infinity) (f64.const 0x1p-1)) (f64.const -infinity)) -(assert_return (invoke "mul" (f64.const infinity) (f64.const -0x1p-1)) (f64.const -infinity)) -(assert_return (invoke "mul" (f64.const infinity) (f64.const 0x1p-1)) (f64.const infinity)) -(assert_return (invoke "mul" (f64.const -infinity) (f64.const -0x1p+0)) (f64.const infinity)) -(assert_return (invoke "mul" (f64.const -infinity) (f64.const 0x1p+0)) (f64.const -infinity)) -(assert_return (invoke "mul" (f64.const infinity) (f64.const -0x1p+0)) (f64.const -infinity)) -(assert_return (invoke "mul" (f64.const infinity) (f64.const 0x1p+0)) (f64.const infinity)) -(assert_return (invoke "mul" (f64.const -infinity) (f64.const -0x1.921fb54442d18p+2)) (f64.const infinity)) -(assert_return (invoke "mul" (f64.const -infinity) (f64.const 0x1.921fb54442d18p+2)) (f64.const -infinity)) -(assert_return (invoke "mul" (f64.const infinity) (f64.const -0x1.921fb54442d18p+2)) (f64.const -infinity)) -(assert_return (invoke "mul" (f64.const infinity) (f64.const 0x1.921fb54442d18p+2)) (f64.const infinity)) -(assert_return (invoke "mul" (f64.const -infinity) (f64.const -0x1.fffffffffffffp+1023)) (f64.const infinity)) -(assert_return (invoke "mul" (f64.const -infinity) (f64.const 0x1.fffffffffffffp+1023)) (f64.const -infinity)) -(assert_return (invoke "mul" (f64.const infinity) (f64.const -0x1.fffffffffffffp+1023)) (f64.const -infinity)) -(assert_return (invoke "mul" (f64.const infinity) (f64.const 0x1.fffffffffffffp+1023)) (f64.const infinity)) -(assert_return (invoke "mul" (f64.const -infinity) (f64.const -infinity)) (f64.const infinity)) -(assert_return (invoke "mul" (f64.const -infinity) (f64.const infinity)) (f64.const -infinity)) -(assert_return (invoke "mul" (f64.const infinity) (f64.const -infinity)) (f64.const -infinity)) -(assert_return (invoke "mul" (f64.const infinity) (f64.const infinity)) (f64.const infinity)) -(assert_return_canonical_nan (invoke "mul" (f64.const -infinity) (f64.const -nan))) -(assert_return_arithmetic_nan (invoke "mul" (f64.const -infinity) (f64.const -nan:0x4000000000000))) -(assert_return_canonical_nan (invoke "mul" (f64.const -infinity) (f64.const nan))) -(assert_return_arithmetic_nan (invoke "mul" (f64.const -infinity) (f64.const nan:0x4000000000000))) -(assert_return_canonical_nan (invoke "mul" (f64.const infinity) (f64.const -nan))) -(assert_return_arithmetic_nan (invoke "mul" (f64.const infinity) (f64.const -nan:0x4000000000000))) -(assert_return_canonical_nan (invoke "mul" (f64.const infinity) (f64.const nan))) -(assert_return_arithmetic_nan (invoke "mul" (f64.const infinity) (f64.const nan:0x4000000000000))) +(assert_return_canonical_nan (invoke "mul" (f64.const -inf) (f64.const -0x0p+0))) +(assert_return_canonical_nan (invoke "mul" (f64.const -inf) (f64.const 0x0p+0))) +(assert_return_canonical_nan (invoke "mul" (f64.const inf) (f64.const -0x0p+0))) +(assert_return_canonical_nan (invoke "mul" (f64.const inf) (f64.const 0x0p+0))) +(assert_return (invoke "mul" (f64.const -inf) (f64.const -0x0.0000000000001p-1022)) (f64.const inf)) +(assert_return (invoke "mul" (f64.const -inf) (f64.const 0x0.0000000000001p-1022)) (f64.const -inf)) +(assert_return (invoke "mul" (f64.const inf) (f64.const -0x0.0000000000001p-1022)) (f64.const -inf)) +(assert_return (invoke "mul" (f64.const inf) (f64.const 0x0.0000000000001p-1022)) (f64.const inf)) +(assert_return (invoke "mul" (f64.const -inf) (f64.const -0x1p-1022)) (f64.const inf)) +(assert_return (invoke "mul" (f64.const -inf) (f64.const 0x1p-1022)) (f64.const -inf)) +(assert_return (invoke "mul" (f64.const inf) (f64.const -0x1p-1022)) (f64.const -inf)) +(assert_return (invoke "mul" (f64.const inf) (f64.const 0x1p-1022)) (f64.const inf)) +(assert_return (invoke "mul" (f64.const -inf) (f64.const -0x1p-1)) (f64.const inf)) +(assert_return (invoke "mul" (f64.const -inf) (f64.const 0x1p-1)) (f64.const -inf)) +(assert_return (invoke "mul" (f64.const inf) (f64.const -0x1p-1)) (f64.const -inf)) +(assert_return (invoke "mul" (f64.const inf) (f64.const 0x1p-1)) (f64.const inf)) +(assert_return (invoke "mul" (f64.const -inf) (f64.const -0x1p+0)) (f64.const inf)) +(assert_return (invoke "mul" (f64.const -inf) (f64.const 0x1p+0)) (f64.const -inf)) +(assert_return (invoke "mul" (f64.const inf) (f64.const -0x1p+0)) (f64.const -inf)) +(assert_return (invoke "mul" (f64.const inf) (f64.const 0x1p+0)) (f64.const inf)) +(assert_return (invoke "mul" (f64.const -inf) (f64.const -0x1.921fb54442d18p+2)) (f64.const inf)) +(assert_return (invoke "mul" (f64.const -inf) (f64.const 0x1.921fb54442d18p+2)) (f64.const -inf)) +(assert_return (invoke "mul" (f64.const inf) (f64.const -0x1.921fb54442d18p+2)) (f64.const -inf)) +(assert_return (invoke "mul" (f64.const inf) (f64.const 0x1.921fb54442d18p+2)) (f64.const inf)) +(assert_return (invoke "mul" (f64.const -inf) (f64.const -0x1.fffffffffffffp+1023)) (f64.const inf)) +(assert_return (invoke "mul" (f64.const -inf) (f64.const 0x1.fffffffffffffp+1023)) (f64.const -inf)) +(assert_return (invoke "mul" (f64.const inf) (f64.const -0x1.fffffffffffffp+1023)) (f64.const -inf)) +(assert_return (invoke "mul" (f64.const inf) (f64.const 0x1.fffffffffffffp+1023)) (f64.const inf)) +(assert_return (invoke "mul" (f64.const -inf) (f64.const -inf)) (f64.const inf)) +(assert_return (invoke "mul" (f64.const -inf) (f64.const inf)) (f64.const -inf)) +(assert_return (invoke "mul" (f64.const inf) (f64.const -inf)) (f64.const -inf)) +(assert_return (invoke "mul" (f64.const inf) (f64.const inf)) (f64.const inf)) +(assert_return_canonical_nan (invoke "mul" (f64.const -inf) (f64.const -nan))) +(assert_return_arithmetic_nan (invoke "mul" (f64.const -inf) (f64.const -nan:0x4000000000000))) +(assert_return_canonical_nan (invoke "mul" (f64.const -inf) (f64.const nan))) +(assert_return_arithmetic_nan (invoke "mul" (f64.const -inf) (f64.const nan:0x4000000000000))) +(assert_return_canonical_nan (invoke "mul" (f64.const inf) (f64.const -nan))) +(assert_return_arithmetic_nan (invoke "mul" (f64.const inf) (f64.const -nan:0x4000000000000))) +(assert_return_canonical_nan (invoke "mul" (f64.const inf) (f64.const nan))) +(assert_return_arithmetic_nan (invoke "mul" (f64.const inf) (f64.const nan:0x4000000000000))) (assert_return_canonical_nan (invoke "mul" (f64.const -nan) (f64.const -0x0p+0))) (assert_return_arithmetic_nan (invoke "mul" (f64.const -nan:0x4000000000000) (f64.const -0x0p+0))) (assert_return_canonical_nan (invoke "mul" (f64.const -nan) (f64.const 0x0p+0))) @@ -1192,14 +1192,14 @@ (assert_return_arithmetic_nan (invoke "mul" (f64.const nan:0x4000000000000) (f64.const -0x1.fffffffffffffp+1023))) (assert_return_canonical_nan (invoke "mul" (f64.const nan) (f64.const 0x1.fffffffffffffp+1023))) (assert_return_arithmetic_nan (invoke "mul" (f64.const nan:0x4000000000000) (f64.const 0x1.fffffffffffffp+1023))) -(assert_return_canonical_nan (invoke "mul" (f64.const -nan) (f64.const -infinity))) -(assert_return_arithmetic_nan (invoke "mul" (f64.const -nan:0x4000000000000) (f64.const -infinity))) -(assert_return_canonical_nan (invoke "mul" (f64.const -nan) (f64.const infinity))) -(assert_return_arithmetic_nan (invoke "mul" (f64.const -nan:0x4000000000000) (f64.const infinity))) -(assert_return_canonical_nan (invoke "mul" (f64.const nan) (f64.const -infinity))) -(assert_return_arithmetic_nan (invoke "mul" (f64.const nan:0x4000000000000) (f64.const -infinity))) -(assert_return_canonical_nan (invoke "mul" (f64.const nan) (f64.const infinity))) -(assert_return_arithmetic_nan (invoke "mul" (f64.const nan:0x4000000000000) (f64.const infinity))) +(assert_return_canonical_nan (invoke "mul" (f64.const -nan) (f64.const -inf))) +(assert_return_arithmetic_nan (invoke "mul" (f64.const -nan:0x4000000000000) (f64.const -inf))) +(assert_return_canonical_nan (invoke "mul" (f64.const -nan) (f64.const inf))) +(assert_return_arithmetic_nan (invoke "mul" (f64.const -nan:0x4000000000000) (f64.const inf))) +(assert_return_canonical_nan (invoke "mul" (f64.const nan) (f64.const -inf))) +(assert_return_arithmetic_nan (invoke "mul" (f64.const nan:0x4000000000000) (f64.const -inf))) +(assert_return_canonical_nan (invoke "mul" (f64.const nan) (f64.const inf))) +(assert_return_arithmetic_nan (invoke "mul" (f64.const nan:0x4000000000000) (f64.const inf))) (assert_return_canonical_nan (invoke "mul" (f64.const -nan) (f64.const -nan))) (assert_return_arithmetic_nan (invoke "mul" (f64.const -nan:0x4000000000000) (f64.const -nan))) (assert_return_arithmetic_nan (invoke "mul" (f64.const -nan) (f64.const -nan:0x4000000000000))) @@ -1244,10 +1244,10 @@ (assert_return (invoke "div" (f64.const -0x0p+0) (f64.const 0x1.fffffffffffffp+1023)) (f64.const -0x0p+0)) (assert_return (invoke "div" (f64.const 0x0p+0) (f64.const -0x1.fffffffffffffp+1023)) (f64.const -0x0p+0)) (assert_return (invoke "div" (f64.const 0x0p+0) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x0p+0)) -(assert_return (invoke "div" (f64.const -0x0p+0) (f64.const -infinity)) (f64.const 0x0p+0)) -(assert_return (invoke "div" (f64.const -0x0p+0) (f64.const infinity)) (f64.const -0x0p+0)) -(assert_return (invoke "div" (f64.const 0x0p+0) (f64.const -infinity)) (f64.const -0x0p+0)) -(assert_return (invoke "div" (f64.const 0x0p+0) (f64.const infinity)) (f64.const 0x0p+0)) +(assert_return (invoke "div" (f64.const -0x0p+0) (f64.const -inf)) (f64.const 0x0p+0)) +(assert_return (invoke "div" (f64.const -0x0p+0) (f64.const inf)) (f64.const -0x0p+0)) +(assert_return (invoke "div" (f64.const 0x0p+0) (f64.const -inf)) (f64.const -0x0p+0)) +(assert_return (invoke "div" (f64.const 0x0p+0) (f64.const inf)) (f64.const 0x0p+0)) (assert_return_canonical_nan (invoke "div" (f64.const -0x0p+0) (f64.const -nan))) (assert_return_arithmetic_nan (invoke "div" (f64.const -0x0p+0) (f64.const -nan:0x4000000000000))) (assert_return_canonical_nan (invoke "div" (f64.const -0x0p+0) (f64.const nan))) @@ -1256,10 +1256,10 @@ (assert_return_arithmetic_nan (invoke "div" (f64.const 0x0p+0) (f64.const -nan:0x4000000000000))) (assert_return_canonical_nan (invoke "div" (f64.const 0x0p+0) (f64.const nan))) (assert_return_arithmetic_nan (invoke "div" (f64.const 0x0p+0) (f64.const nan:0x4000000000000))) -(assert_return (invoke "div" (f64.const -0x0.0000000000001p-1022) (f64.const -0x0p+0)) (f64.const infinity)) -(assert_return (invoke "div" (f64.const -0x0.0000000000001p-1022) (f64.const 0x0p+0)) (f64.const -infinity)) -(assert_return (invoke "div" (f64.const 0x0.0000000000001p-1022) (f64.const -0x0p+0)) (f64.const -infinity)) -(assert_return (invoke "div" (f64.const 0x0.0000000000001p-1022) (f64.const 0x0p+0)) (f64.const infinity)) +(assert_return (invoke "div" (f64.const -0x0.0000000000001p-1022) (f64.const -0x0p+0)) (f64.const inf)) +(assert_return (invoke "div" (f64.const -0x0.0000000000001p-1022) (f64.const 0x0p+0)) (f64.const -inf)) +(assert_return (invoke "div" (f64.const 0x0.0000000000001p-1022) (f64.const -0x0p+0)) (f64.const -inf)) +(assert_return (invoke "div" (f64.const 0x0.0000000000001p-1022) (f64.const 0x0p+0)) (f64.const inf)) (assert_return (invoke "div" (f64.const -0x0.0000000000001p-1022) (f64.const -0x0.0000000000001p-1022)) (f64.const 0x1p+0)) (assert_return (invoke "div" (f64.const -0x0.0000000000001p-1022) (f64.const 0x0.0000000000001p-1022)) (f64.const -0x1p+0)) (assert_return (invoke "div" (f64.const 0x0.0000000000001p-1022) (f64.const -0x0.0000000000001p-1022)) (f64.const -0x1p+0)) @@ -1284,10 +1284,10 @@ (assert_return (invoke "div" (f64.const -0x0.0000000000001p-1022) (f64.const 0x1.fffffffffffffp+1023)) (f64.const -0x0p+0)) (assert_return (invoke "div" (f64.const 0x0.0000000000001p-1022) (f64.const -0x1.fffffffffffffp+1023)) (f64.const -0x0p+0)) (assert_return (invoke "div" (f64.const 0x0.0000000000001p-1022) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x0p+0)) -(assert_return (invoke "div" (f64.const -0x0.0000000000001p-1022) (f64.const -infinity)) (f64.const 0x0p+0)) -(assert_return (invoke "div" (f64.const -0x0.0000000000001p-1022) (f64.const infinity)) (f64.const -0x0p+0)) -(assert_return (invoke "div" (f64.const 0x0.0000000000001p-1022) (f64.const -infinity)) (f64.const -0x0p+0)) -(assert_return (invoke "div" (f64.const 0x0.0000000000001p-1022) (f64.const infinity)) (f64.const 0x0p+0)) +(assert_return (invoke "div" (f64.const -0x0.0000000000001p-1022) (f64.const -inf)) (f64.const 0x0p+0)) +(assert_return (invoke "div" (f64.const -0x0.0000000000001p-1022) (f64.const inf)) (f64.const -0x0p+0)) +(assert_return (invoke "div" (f64.const 0x0.0000000000001p-1022) (f64.const -inf)) (f64.const -0x0p+0)) +(assert_return (invoke "div" (f64.const 0x0.0000000000001p-1022) (f64.const inf)) (f64.const 0x0p+0)) (assert_return_canonical_nan (invoke "div" (f64.const -0x0.0000000000001p-1022) (f64.const -nan))) (assert_return_arithmetic_nan (invoke "div" (f64.const -0x0.0000000000001p-1022) (f64.const -nan:0x4000000000000))) (assert_return_canonical_nan (invoke "div" (f64.const -0x0.0000000000001p-1022) (f64.const nan))) @@ -1296,10 +1296,10 @@ (assert_return_arithmetic_nan (invoke "div" (f64.const 0x0.0000000000001p-1022) (f64.const -nan:0x4000000000000))) (assert_return_canonical_nan (invoke "div" (f64.const 0x0.0000000000001p-1022) (f64.const nan))) (assert_return_arithmetic_nan (invoke "div" (f64.const 0x0.0000000000001p-1022) (f64.const nan:0x4000000000000))) -(assert_return (invoke "div" (f64.const -0x1p-1022) (f64.const -0x0p+0)) (f64.const infinity)) -(assert_return (invoke "div" (f64.const -0x1p-1022) (f64.const 0x0p+0)) (f64.const -infinity)) -(assert_return (invoke "div" (f64.const 0x1p-1022) (f64.const -0x0p+0)) (f64.const -infinity)) -(assert_return (invoke "div" (f64.const 0x1p-1022) (f64.const 0x0p+0)) (f64.const infinity)) +(assert_return (invoke "div" (f64.const -0x1p-1022) (f64.const -0x0p+0)) (f64.const inf)) +(assert_return (invoke "div" (f64.const -0x1p-1022) (f64.const 0x0p+0)) (f64.const -inf)) +(assert_return (invoke "div" (f64.const 0x1p-1022) (f64.const -0x0p+0)) (f64.const -inf)) +(assert_return (invoke "div" (f64.const 0x1p-1022) (f64.const 0x0p+0)) (f64.const inf)) (assert_return (invoke "div" (f64.const -0x1p-1022) (f64.const -0x0.0000000000001p-1022)) (f64.const 0x1p+52)) (assert_return (invoke "div" (f64.const -0x1p-1022) (f64.const 0x0.0000000000001p-1022)) (f64.const -0x1p+52)) (assert_return (invoke "div" (f64.const 0x1p-1022) (f64.const -0x0.0000000000001p-1022)) (f64.const -0x1p+52)) @@ -1324,10 +1324,10 @@ (assert_return (invoke "div" (f64.const -0x1p-1022) (f64.const 0x1.fffffffffffffp+1023)) (f64.const -0x0p+0)) (assert_return (invoke "div" (f64.const 0x1p-1022) (f64.const -0x1.fffffffffffffp+1023)) (f64.const -0x0p+0)) (assert_return (invoke "div" (f64.const 0x1p-1022) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x0p+0)) -(assert_return (invoke "div" (f64.const -0x1p-1022) (f64.const -infinity)) (f64.const 0x0p+0)) -(assert_return (invoke "div" (f64.const -0x1p-1022) (f64.const infinity)) (f64.const -0x0p+0)) -(assert_return (invoke "div" (f64.const 0x1p-1022) (f64.const -infinity)) (f64.const -0x0p+0)) -(assert_return (invoke "div" (f64.const 0x1p-1022) (f64.const infinity)) (f64.const 0x0p+0)) +(assert_return (invoke "div" (f64.const -0x1p-1022) (f64.const -inf)) (f64.const 0x0p+0)) +(assert_return (invoke "div" (f64.const -0x1p-1022) (f64.const inf)) (f64.const -0x0p+0)) +(assert_return (invoke "div" (f64.const 0x1p-1022) (f64.const -inf)) (f64.const -0x0p+0)) +(assert_return (invoke "div" (f64.const 0x1p-1022) (f64.const inf)) (f64.const 0x0p+0)) (assert_return_canonical_nan (invoke "div" (f64.const -0x1p-1022) (f64.const -nan))) (assert_return_arithmetic_nan (invoke "div" (f64.const -0x1p-1022) (f64.const -nan:0x4000000000000))) (assert_return_canonical_nan (invoke "div" (f64.const -0x1p-1022) (f64.const nan))) @@ -1336,14 +1336,14 @@ (assert_return_arithmetic_nan (invoke "div" (f64.const 0x1p-1022) (f64.const -nan:0x4000000000000))) (assert_return_canonical_nan (invoke "div" (f64.const 0x1p-1022) (f64.const nan))) (assert_return_arithmetic_nan (invoke "div" (f64.const 0x1p-1022) (f64.const nan:0x4000000000000))) -(assert_return (invoke "div" (f64.const -0x1p-1) (f64.const -0x0p+0)) (f64.const infinity)) -(assert_return (invoke "div" (f64.const -0x1p-1) (f64.const 0x0p+0)) (f64.const -infinity)) -(assert_return (invoke "div" (f64.const 0x1p-1) (f64.const -0x0p+0)) (f64.const -infinity)) -(assert_return (invoke "div" (f64.const 0x1p-1) (f64.const 0x0p+0)) (f64.const infinity)) -(assert_return (invoke "div" (f64.const -0x1p-1) (f64.const -0x0.0000000000001p-1022)) (f64.const infinity)) -(assert_return (invoke "div" (f64.const -0x1p-1) (f64.const 0x0.0000000000001p-1022)) (f64.const -infinity)) -(assert_return (invoke "div" (f64.const 0x1p-1) (f64.const -0x0.0000000000001p-1022)) (f64.const -infinity)) -(assert_return (invoke "div" (f64.const 0x1p-1) (f64.const 0x0.0000000000001p-1022)) (f64.const infinity)) +(assert_return (invoke "div" (f64.const -0x1p-1) (f64.const -0x0p+0)) (f64.const inf)) +(assert_return (invoke "div" (f64.const -0x1p-1) (f64.const 0x0p+0)) (f64.const -inf)) +(assert_return (invoke "div" (f64.const 0x1p-1) (f64.const -0x0p+0)) (f64.const -inf)) +(assert_return (invoke "div" (f64.const 0x1p-1) (f64.const 0x0p+0)) (f64.const inf)) +(assert_return (invoke "div" (f64.const -0x1p-1) (f64.const -0x0.0000000000001p-1022)) (f64.const inf)) +(assert_return (invoke "div" (f64.const -0x1p-1) (f64.const 0x0.0000000000001p-1022)) (f64.const -inf)) +(assert_return (invoke "div" (f64.const 0x1p-1) (f64.const -0x0.0000000000001p-1022)) (f64.const -inf)) +(assert_return (invoke "div" (f64.const 0x1p-1) (f64.const 0x0.0000000000001p-1022)) (f64.const inf)) (assert_return (invoke "div" (f64.const -0x1p-1) (f64.const -0x1p-1022)) (f64.const 0x1p+1021)) (assert_return (invoke "div" (f64.const -0x1p-1) (f64.const 0x1p-1022)) (f64.const -0x1p+1021)) (assert_return (invoke "div" (f64.const 0x1p-1) (f64.const -0x1p-1022)) (f64.const -0x1p+1021)) @@ -1364,10 +1364,10 @@ (assert_return (invoke "div" (f64.const -0x1p-1) (f64.const 0x1.fffffffffffffp+1023)) (f64.const -0x0.2p-1022)) (assert_return (invoke "div" (f64.const 0x1p-1) (f64.const -0x1.fffffffffffffp+1023)) (f64.const -0x0.2p-1022)) (assert_return (invoke "div" (f64.const 0x1p-1) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x0.2p-1022)) -(assert_return (invoke "div" (f64.const -0x1p-1) (f64.const -infinity)) (f64.const 0x0p+0)) -(assert_return (invoke "div" (f64.const -0x1p-1) (f64.const infinity)) (f64.const -0x0p+0)) -(assert_return (invoke "div" (f64.const 0x1p-1) (f64.const -infinity)) (f64.const -0x0p+0)) -(assert_return (invoke "div" (f64.const 0x1p-1) (f64.const infinity)) (f64.const 0x0p+0)) +(assert_return (invoke "div" (f64.const -0x1p-1) (f64.const -inf)) (f64.const 0x0p+0)) +(assert_return (invoke "div" (f64.const -0x1p-1) (f64.const inf)) (f64.const -0x0p+0)) +(assert_return (invoke "div" (f64.const 0x1p-1) (f64.const -inf)) (f64.const -0x0p+0)) +(assert_return (invoke "div" (f64.const 0x1p-1) (f64.const inf)) (f64.const 0x0p+0)) (assert_return_canonical_nan (invoke "div" (f64.const -0x1p-1) (f64.const -nan))) (assert_return_arithmetic_nan (invoke "div" (f64.const -0x1p-1) (f64.const -nan:0x4000000000000))) (assert_return_canonical_nan (invoke "div" (f64.const -0x1p-1) (f64.const nan))) @@ -1376,14 +1376,14 @@ (assert_return_arithmetic_nan (invoke "div" (f64.const 0x1p-1) (f64.const -nan:0x4000000000000))) (assert_return_canonical_nan (invoke "div" (f64.const 0x1p-1) (f64.const nan))) (assert_return_arithmetic_nan (invoke "div" (f64.const 0x1p-1) (f64.const nan:0x4000000000000))) -(assert_return (invoke "div" (f64.const -0x1p+0) (f64.const -0x0p+0)) (f64.const infinity)) -(assert_return (invoke "div" (f64.const -0x1p+0) (f64.const 0x0p+0)) (f64.const -infinity)) -(assert_return (invoke "div" (f64.const 0x1p+0) (f64.const -0x0p+0)) (f64.const -infinity)) -(assert_return (invoke "div" (f64.const 0x1p+0) (f64.const 0x0p+0)) (f64.const infinity)) -(assert_return (invoke "div" (f64.const -0x1p+0) (f64.const -0x0.0000000000001p-1022)) (f64.const infinity)) -(assert_return (invoke "div" (f64.const -0x1p+0) (f64.const 0x0.0000000000001p-1022)) (f64.const -infinity)) -(assert_return (invoke "div" (f64.const 0x1p+0) (f64.const -0x0.0000000000001p-1022)) (f64.const -infinity)) -(assert_return (invoke "div" (f64.const 0x1p+0) (f64.const 0x0.0000000000001p-1022)) (f64.const infinity)) +(assert_return (invoke "div" (f64.const -0x1p+0) (f64.const -0x0p+0)) (f64.const inf)) +(assert_return (invoke "div" (f64.const -0x1p+0) (f64.const 0x0p+0)) (f64.const -inf)) +(assert_return (invoke "div" (f64.const 0x1p+0) (f64.const -0x0p+0)) (f64.const -inf)) +(assert_return (invoke "div" (f64.const 0x1p+0) (f64.const 0x0p+0)) (f64.const inf)) +(assert_return (invoke "div" (f64.const -0x1p+0) (f64.const -0x0.0000000000001p-1022)) (f64.const inf)) +(assert_return (invoke "div" (f64.const -0x1p+0) (f64.const 0x0.0000000000001p-1022)) (f64.const -inf)) +(assert_return (invoke "div" (f64.const 0x1p+0) (f64.const -0x0.0000000000001p-1022)) (f64.const -inf)) +(assert_return (invoke "div" (f64.const 0x1p+0) (f64.const 0x0.0000000000001p-1022)) (f64.const inf)) (assert_return (invoke "div" (f64.const -0x1p+0) (f64.const -0x1p-1022)) (f64.const 0x1p+1022)) (assert_return (invoke "div" (f64.const -0x1p+0) (f64.const 0x1p-1022)) (f64.const -0x1p+1022)) (assert_return (invoke "div" (f64.const 0x1p+0) (f64.const -0x1p-1022)) (f64.const -0x1p+1022)) @@ -1404,10 +1404,10 @@ (assert_return (invoke "div" (f64.const -0x1p+0) (f64.const 0x1.fffffffffffffp+1023)) (f64.const -0x0.4p-1022)) (assert_return (invoke "div" (f64.const 0x1p+0) (f64.const -0x1.fffffffffffffp+1023)) (f64.const -0x0.4p-1022)) (assert_return (invoke "div" (f64.const 0x1p+0) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x0.4p-1022)) -(assert_return (invoke "div" (f64.const -0x1p+0) (f64.const -infinity)) (f64.const 0x0p+0)) -(assert_return (invoke "div" (f64.const -0x1p+0) (f64.const infinity)) (f64.const -0x0p+0)) -(assert_return (invoke "div" (f64.const 0x1p+0) (f64.const -infinity)) (f64.const -0x0p+0)) -(assert_return (invoke "div" (f64.const 0x1p+0) (f64.const infinity)) (f64.const 0x0p+0)) +(assert_return (invoke "div" (f64.const -0x1p+0) (f64.const -inf)) (f64.const 0x0p+0)) +(assert_return (invoke "div" (f64.const -0x1p+0) (f64.const inf)) (f64.const -0x0p+0)) +(assert_return (invoke "div" (f64.const 0x1p+0) (f64.const -inf)) (f64.const -0x0p+0)) +(assert_return (invoke "div" (f64.const 0x1p+0) (f64.const inf)) (f64.const 0x0p+0)) (assert_return_canonical_nan (invoke "div" (f64.const -0x1p+0) (f64.const -nan))) (assert_return_arithmetic_nan (invoke "div" (f64.const -0x1p+0) (f64.const -nan:0x4000000000000))) (assert_return_canonical_nan (invoke "div" (f64.const -0x1p+0) (f64.const nan))) @@ -1416,18 +1416,18 @@ (assert_return_arithmetic_nan (invoke "div" (f64.const 0x1p+0) (f64.const -nan:0x4000000000000))) (assert_return_canonical_nan (invoke "div" (f64.const 0x1p+0) (f64.const nan))) (assert_return_arithmetic_nan (invoke "div" (f64.const 0x1p+0) (f64.const nan:0x4000000000000))) -(assert_return (invoke "div" (f64.const -0x1.921fb54442d18p+2) (f64.const -0x0p+0)) (f64.const infinity)) -(assert_return (invoke "div" (f64.const -0x1.921fb54442d18p+2) (f64.const 0x0p+0)) (f64.const -infinity)) -(assert_return (invoke "div" (f64.const 0x1.921fb54442d18p+2) (f64.const -0x0p+0)) (f64.const -infinity)) -(assert_return (invoke "div" (f64.const 0x1.921fb54442d18p+2) (f64.const 0x0p+0)) (f64.const infinity)) -(assert_return (invoke "div" (f64.const -0x1.921fb54442d18p+2) (f64.const -0x0.0000000000001p-1022)) (f64.const infinity)) -(assert_return (invoke "div" (f64.const -0x1.921fb54442d18p+2) (f64.const 0x0.0000000000001p-1022)) (f64.const -infinity)) -(assert_return (invoke "div" (f64.const 0x1.921fb54442d18p+2) (f64.const -0x0.0000000000001p-1022)) (f64.const -infinity)) -(assert_return (invoke "div" (f64.const 0x1.921fb54442d18p+2) (f64.const 0x0.0000000000001p-1022)) (f64.const infinity)) -(assert_return (invoke "div" (f64.const -0x1.921fb54442d18p+2) (f64.const -0x1p-1022)) (f64.const infinity)) -(assert_return (invoke "div" (f64.const -0x1.921fb54442d18p+2) (f64.const 0x1p-1022)) (f64.const -infinity)) -(assert_return (invoke "div" (f64.const 0x1.921fb54442d18p+2) (f64.const -0x1p-1022)) (f64.const -infinity)) -(assert_return (invoke "div" (f64.const 0x1.921fb54442d18p+2) (f64.const 0x1p-1022)) (f64.const infinity)) +(assert_return (invoke "div" (f64.const -0x1.921fb54442d18p+2) (f64.const -0x0p+0)) (f64.const inf)) +(assert_return (invoke "div" (f64.const -0x1.921fb54442d18p+2) (f64.const 0x0p+0)) (f64.const -inf)) +(assert_return (invoke "div" (f64.const 0x1.921fb54442d18p+2) (f64.const -0x0p+0)) (f64.const -inf)) +(assert_return (invoke "div" (f64.const 0x1.921fb54442d18p+2) (f64.const 0x0p+0)) (f64.const inf)) +(assert_return (invoke "div" (f64.const -0x1.921fb54442d18p+2) (f64.const -0x0.0000000000001p-1022)) (f64.const inf)) +(assert_return (invoke "div" (f64.const -0x1.921fb54442d18p+2) (f64.const 0x0.0000000000001p-1022)) (f64.const -inf)) +(assert_return (invoke "div" (f64.const 0x1.921fb54442d18p+2) (f64.const -0x0.0000000000001p-1022)) (f64.const -inf)) +(assert_return (invoke "div" (f64.const 0x1.921fb54442d18p+2) (f64.const 0x0.0000000000001p-1022)) (f64.const inf)) +(assert_return (invoke "div" (f64.const -0x1.921fb54442d18p+2) (f64.const -0x1p-1022)) (f64.const inf)) +(assert_return (invoke "div" (f64.const -0x1.921fb54442d18p+2) (f64.const 0x1p-1022)) (f64.const -inf)) +(assert_return (invoke "div" (f64.const 0x1.921fb54442d18p+2) (f64.const -0x1p-1022)) (f64.const -inf)) +(assert_return (invoke "div" (f64.const 0x1.921fb54442d18p+2) (f64.const 0x1p-1022)) (f64.const inf)) (assert_return (invoke "div" (f64.const -0x1.921fb54442d18p+2) (f64.const -0x1p-1)) (f64.const 0x1.921fb54442d18p+3)) (assert_return (invoke "div" (f64.const -0x1.921fb54442d18p+2) (f64.const 0x1p-1)) (f64.const -0x1.921fb54442d18p+3)) (assert_return (invoke "div" (f64.const 0x1.921fb54442d18p+2) (f64.const -0x1p-1)) (f64.const -0x1.921fb54442d18p+3)) @@ -1444,10 +1444,10 @@ (assert_return (invoke "div" (f64.const -0x1.921fb54442d18p+2) (f64.const 0x1.fffffffffffffp+1023)) (f64.const -0x1.921fb54442d19p-1022)) (assert_return (invoke "div" (f64.const 0x1.921fb54442d18p+2) (f64.const -0x1.fffffffffffffp+1023)) (f64.const -0x1.921fb54442d19p-1022)) (assert_return (invoke "div" (f64.const 0x1.921fb54442d18p+2) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x1.921fb54442d19p-1022)) -(assert_return (invoke "div" (f64.const -0x1.921fb54442d18p+2) (f64.const -infinity)) (f64.const 0x0p+0)) -(assert_return (invoke "div" (f64.const -0x1.921fb54442d18p+2) (f64.const infinity)) (f64.const -0x0p+0)) -(assert_return (invoke "div" (f64.const 0x1.921fb54442d18p+2) (f64.const -infinity)) (f64.const -0x0p+0)) -(assert_return (invoke "div" (f64.const 0x1.921fb54442d18p+2) (f64.const infinity)) (f64.const 0x0p+0)) +(assert_return (invoke "div" (f64.const -0x1.921fb54442d18p+2) (f64.const -inf)) (f64.const 0x0p+0)) +(assert_return (invoke "div" (f64.const -0x1.921fb54442d18p+2) (f64.const inf)) (f64.const -0x0p+0)) +(assert_return (invoke "div" (f64.const 0x1.921fb54442d18p+2) (f64.const -inf)) (f64.const -0x0p+0)) +(assert_return (invoke "div" (f64.const 0x1.921fb54442d18p+2) (f64.const inf)) (f64.const 0x0p+0)) (assert_return_canonical_nan (invoke "div" (f64.const -0x1.921fb54442d18p+2) (f64.const -nan))) (assert_return_arithmetic_nan (invoke "div" (f64.const -0x1.921fb54442d18p+2) (f64.const -nan:0x4000000000000))) (assert_return_canonical_nan (invoke "div" (f64.const -0x1.921fb54442d18p+2) (f64.const nan))) @@ -1456,22 +1456,22 @@ (assert_return_arithmetic_nan (invoke "div" (f64.const 0x1.921fb54442d18p+2) (f64.const -nan:0x4000000000000))) (assert_return_canonical_nan (invoke "div" (f64.const 0x1.921fb54442d18p+2) (f64.const nan))) (assert_return_arithmetic_nan (invoke "div" (f64.const 0x1.921fb54442d18p+2) (f64.const nan:0x4000000000000))) -(assert_return (invoke "div" (f64.const -0x1.fffffffffffffp+1023) (f64.const -0x0p+0)) (f64.const infinity)) -(assert_return (invoke "div" (f64.const -0x1.fffffffffffffp+1023) (f64.const 0x0p+0)) (f64.const -infinity)) -(assert_return (invoke "div" (f64.const 0x1.fffffffffffffp+1023) (f64.const -0x0p+0)) (f64.const -infinity)) -(assert_return (invoke "div" (f64.const 0x1.fffffffffffffp+1023) (f64.const 0x0p+0)) (f64.const infinity)) -(assert_return (invoke "div" (f64.const -0x1.fffffffffffffp+1023) (f64.const -0x0.0000000000001p-1022)) (f64.const infinity)) -(assert_return (invoke "div" (f64.const -0x1.fffffffffffffp+1023) (f64.const 0x0.0000000000001p-1022)) (f64.const -infinity)) -(assert_return (invoke "div" (f64.const 0x1.fffffffffffffp+1023) (f64.const -0x0.0000000000001p-1022)) (f64.const -infinity)) -(assert_return (invoke "div" (f64.const 0x1.fffffffffffffp+1023) (f64.const 0x0.0000000000001p-1022)) (f64.const infinity)) -(assert_return (invoke "div" (f64.const -0x1.fffffffffffffp+1023) (f64.const -0x1p-1022)) (f64.const infinity)) -(assert_return (invoke "div" (f64.const -0x1.fffffffffffffp+1023) (f64.const 0x1p-1022)) (f64.const -infinity)) -(assert_return (invoke "div" (f64.const 0x1.fffffffffffffp+1023) (f64.const -0x1p-1022)) (f64.const -infinity)) -(assert_return (invoke "div" (f64.const 0x1.fffffffffffffp+1023) (f64.const 0x1p-1022)) (f64.const infinity)) -(assert_return (invoke "div" (f64.const -0x1.fffffffffffffp+1023) (f64.const -0x1p-1)) (f64.const infinity)) -(assert_return (invoke "div" (f64.const -0x1.fffffffffffffp+1023) (f64.const 0x1p-1)) (f64.const -infinity)) -(assert_return (invoke "div" (f64.const 0x1.fffffffffffffp+1023) (f64.const -0x1p-1)) (f64.const -infinity)) -(assert_return (invoke "div" (f64.const 0x1.fffffffffffffp+1023) (f64.const 0x1p-1)) (f64.const infinity)) +(assert_return (invoke "div" (f64.const -0x1.fffffffffffffp+1023) (f64.const -0x0p+0)) (f64.const inf)) +(assert_return (invoke "div" (f64.const -0x1.fffffffffffffp+1023) (f64.const 0x0p+0)) (f64.const -inf)) +(assert_return (invoke "div" (f64.const 0x1.fffffffffffffp+1023) (f64.const -0x0p+0)) (f64.const -inf)) +(assert_return (invoke "div" (f64.const 0x1.fffffffffffffp+1023) (f64.const 0x0p+0)) (f64.const inf)) +(assert_return (invoke "div" (f64.const -0x1.fffffffffffffp+1023) (f64.const -0x0.0000000000001p-1022)) (f64.const inf)) +(assert_return (invoke "div" (f64.const -0x1.fffffffffffffp+1023) (f64.const 0x0.0000000000001p-1022)) (f64.const -inf)) +(assert_return (invoke "div" (f64.const 0x1.fffffffffffffp+1023) (f64.const -0x0.0000000000001p-1022)) (f64.const -inf)) +(assert_return (invoke "div" (f64.const 0x1.fffffffffffffp+1023) (f64.const 0x0.0000000000001p-1022)) (f64.const inf)) +(assert_return (invoke "div" (f64.const -0x1.fffffffffffffp+1023) (f64.const -0x1p-1022)) (f64.const inf)) +(assert_return (invoke "div" (f64.const -0x1.fffffffffffffp+1023) (f64.const 0x1p-1022)) (f64.const -inf)) +(assert_return (invoke "div" (f64.const 0x1.fffffffffffffp+1023) (f64.const -0x1p-1022)) (f64.const -inf)) +(assert_return (invoke "div" (f64.const 0x1.fffffffffffffp+1023) (f64.const 0x1p-1022)) (f64.const inf)) +(assert_return (invoke "div" (f64.const -0x1.fffffffffffffp+1023) (f64.const -0x1p-1)) (f64.const inf)) +(assert_return (invoke "div" (f64.const -0x1.fffffffffffffp+1023) (f64.const 0x1p-1)) (f64.const -inf)) +(assert_return (invoke "div" (f64.const 0x1.fffffffffffffp+1023) (f64.const -0x1p-1)) (f64.const -inf)) +(assert_return (invoke "div" (f64.const 0x1.fffffffffffffp+1023) (f64.const 0x1p-1)) (f64.const inf)) (assert_return (invoke "div" (f64.const -0x1.fffffffffffffp+1023) (f64.const -0x1p+0)) (f64.const 0x1.fffffffffffffp+1023)) (assert_return (invoke "div" (f64.const -0x1.fffffffffffffp+1023) (f64.const 0x1p+0)) (f64.const -0x1.fffffffffffffp+1023)) (assert_return (invoke "div" (f64.const 0x1.fffffffffffffp+1023) (f64.const -0x1p+0)) (f64.const -0x1.fffffffffffffp+1023)) @@ -1484,10 +1484,10 @@ (assert_return (invoke "div" (f64.const -0x1.fffffffffffffp+1023) (f64.const 0x1.fffffffffffffp+1023)) (f64.const -0x1p+0)) (assert_return (invoke "div" (f64.const 0x1.fffffffffffffp+1023) (f64.const -0x1.fffffffffffffp+1023)) (f64.const -0x1p+0)) (assert_return (invoke "div" (f64.const 0x1.fffffffffffffp+1023) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x1p+0)) -(assert_return (invoke "div" (f64.const -0x1.fffffffffffffp+1023) (f64.const -infinity)) (f64.const 0x0p+0)) -(assert_return (invoke "div" (f64.const -0x1.fffffffffffffp+1023) (f64.const infinity)) (f64.const -0x0p+0)) -(assert_return (invoke "div" (f64.const 0x1.fffffffffffffp+1023) (f64.const -infinity)) (f64.const -0x0p+0)) -(assert_return (invoke "div" (f64.const 0x1.fffffffffffffp+1023) (f64.const infinity)) (f64.const 0x0p+0)) +(assert_return (invoke "div" (f64.const -0x1.fffffffffffffp+1023) (f64.const -inf)) (f64.const 0x0p+0)) +(assert_return (invoke "div" (f64.const -0x1.fffffffffffffp+1023) (f64.const inf)) (f64.const -0x0p+0)) +(assert_return (invoke "div" (f64.const 0x1.fffffffffffffp+1023) (f64.const -inf)) (f64.const -0x0p+0)) +(assert_return (invoke "div" (f64.const 0x1.fffffffffffffp+1023) (f64.const inf)) (f64.const 0x0p+0)) (assert_return_canonical_nan (invoke "div" (f64.const -0x1.fffffffffffffp+1023) (f64.const -nan))) (assert_return_arithmetic_nan (invoke "div" (f64.const -0x1.fffffffffffffp+1023) (f64.const -nan:0x4000000000000))) (assert_return_canonical_nan (invoke "div" (f64.const -0x1.fffffffffffffp+1023) (f64.const nan))) @@ -1496,46 +1496,46 @@ (assert_return_arithmetic_nan (invoke "div" (f64.const 0x1.fffffffffffffp+1023) (f64.const -nan:0x4000000000000))) (assert_return_canonical_nan (invoke "div" (f64.const 0x1.fffffffffffffp+1023) (f64.const nan))) (assert_return_arithmetic_nan (invoke "div" (f64.const 0x1.fffffffffffffp+1023) (f64.const nan:0x4000000000000))) -(assert_return (invoke "div" (f64.const -infinity) (f64.const -0x0p+0)) (f64.const infinity)) -(assert_return (invoke "div" (f64.const -infinity) (f64.const 0x0p+0)) (f64.const -infinity)) -(assert_return (invoke "div" (f64.const infinity) (f64.const -0x0p+0)) (f64.const -infinity)) -(assert_return (invoke "div" (f64.const infinity) (f64.const 0x0p+0)) (f64.const infinity)) -(assert_return (invoke "div" (f64.const -infinity) (f64.const -0x0.0000000000001p-1022)) (f64.const infinity)) -(assert_return (invoke "div" (f64.const -infinity) (f64.const 0x0.0000000000001p-1022)) (f64.const -infinity)) -(assert_return (invoke "div" (f64.const infinity) (f64.const -0x0.0000000000001p-1022)) (f64.const -infinity)) -(assert_return (invoke "div" (f64.const infinity) (f64.const 0x0.0000000000001p-1022)) (f64.const infinity)) -(assert_return (invoke "div" (f64.const -infinity) (f64.const -0x1p-1022)) (f64.const infinity)) -(assert_return (invoke "div" (f64.const -infinity) (f64.const 0x1p-1022)) (f64.const -infinity)) -(assert_return (invoke "div" (f64.const infinity) (f64.const -0x1p-1022)) (f64.const -infinity)) -(assert_return (invoke "div" (f64.const infinity) (f64.const 0x1p-1022)) (f64.const infinity)) -(assert_return (invoke "div" (f64.const -infinity) (f64.const -0x1p-1)) (f64.const infinity)) -(assert_return (invoke "div" (f64.const -infinity) (f64.const 0x1p-1)) (f64.const -infinity)) -(assert_return (invoke "div" (f64.const infinity) (f64.const -0x1p-1)) (f64.const -infinity)) -(assert_return (invoke "div" (f64.const infinity) (f64.const 0x1p-1)) (f64.const infinity)) -(assert_return (invoke "div" (f64.const -infinity) (f64.const -0x1p+0)) (f64.const infinity)) -(assert_return (invoke "div" (f64.const -infinity) (f64.const 0x1p+0)) (f64.const -infinity)) -(assert_return (invoke "div" (f64.const infinity) (f64.const -0x1p+0)) (f64.const -infinity)) -(assert_return (invoke "div" (f64.const infinity) (f64.const 0x1p+0)) (f64.const infinity)) -(assert_return (invoke "div" (f64.const -infinity) (f64.const -0x1.921fb54442d18p+2)) (f64.const infinity)) -(assert_return (invoke "div" (f64.const -infinity) (f64.const 0x1.921fb54442d18p+2)) (f64.const -infinity)) -(assert_return (invoke "div" (f64.const infinity) (f64.const -0x1.921fb54442d18p+2)) (f64.const -infinity)) -(assert_return (invoke "div" (f64.const infinity) (f64.const 0x1.921fb54442d18p+2)) (f64.const infinity)) -(assert_return (invoke "div" (f64.const -infinity) (f64.const -0x1.fffffffffffffp+1023)) (f64.const infinity)) -(assert_return (invoke "div" (f64.const -infinity) (f64.const 0x1.fffffffffffffp+1023)) (f64.const -infinity)) -(assert_return (invoke "div" (f64.const infinity) (f64.const -0x1.fffffffffffffp+1023)) (f64.const -infinity)) -(assert_return (invoke "div" (f64.const infinity) (f64.const 0x1.fffffffffffffp+1023)) (f64.const infinity)) -(assert_return_canonical_nan (invoke "div" (f64.const -infinity) (f64.const -infinity))) -(assert_return_canonical_nan (invoke "div" (f64.const -infinity) (f64.const infinity))) -(assert_return_canonical_nan (invoke "div" (f64.const infinity) (f64.const -infinity))) -(assert_return_canonical_nan (invoke "div" (f64.const infinity) (f64.const infinity))) -(assert_return_canonical_nan (invoke "div" (f64.const -infinity) (f64.const -nan))) -(assert_return_arithmetic_nan (invoke "div" (f64.const -infinity) (f64.const -nan:0x4000000000000))) -(assert_return_canonical_nan (invoke "div" (f64.const -infinity) (f64.const nan))) -(assert_return_arithmetic_nan (invoke "div" (f64.const -infinity) (f64.const nan:0x4000000000000))) -(assert_return_canonical_nan (invoke "div" (f64.const infinity) (f64.const -nan))) -(assert_return_arithmetic_nan (invoke "div" (f64.const infinity) (f64.const -nan:0x4000000000000))) -(assert_return_canonical_nan (invoke "div" (f64.const infinity) (f64.const nan))) -(assert_return_arithmetic_nan (invoke "div" (f64.const infinity) (f64.const nan:0x4000000000000))) +(assert_return (invoke "div" (f64.const -inf) (f64.const -0x0p+0)) (f64.const inf)) +(assert_return (invoke "div" (f64.const -inf) (f64.const 0x0p+0)) (f64.const -inf)) +(assert_return (invoke "div" (f64.const inf) (f64.const -0x0p+0)) (f64.const -inf)) +(assert_return (invoke "div" (f64.const inf) (f64.const 0x0p+0)) (f64.const inf)) +(assert_return (invoke "div" (f64.const -inf) (f64.const -0x0.0000000000001p-1022)) (f64.const inf)) +(assert_return (invoke "div" (f64.const -inf) (f64.const 0x0.0000000000001p-1022)) (f64.const -inf)) +(assert_return (invoke "div" (f64.const inf) (f64.const -0x0.0000000000001p-1022)) (f64.const -inf)) +(assert_return (invoke "div" (f64.const inf) (f64.const 0x0.0000000000001p-1022)) (f64.const inf)) +(assert_return (invoke "div" (f64.const -inf) (f64.const -0x1p-1022)) (f64.const inf)) +(assert_return (invoke "div" (f64.const -inf) (f64.const 0x1p-1022)) (f64.const -inf)) +(assert_return (invoke "div" (f64.const inf) (f64.const -0x1p-1022)) (f64.const -inf)) +(assert_return (invoke "div" (f64.const inf) (f64.const 0x1p-1022)) (f64.const inf)) +(assert_return (invoke "div" (f64.const -inf) (f64.const -0x1p-1)) (f64.const inf)) +(assert_return (invoke "div" (f64.const -inf) (f64.const 0x1p-1)) (f64.const -inf)) +(assert_return (invoke "div" (f64.const inf) (f64.const -0x1p-1)) (f64.const -inf)) +(assert_return (invoke "div" (f64.const inf) (f64.const 0x1p-1)) (f64.const inf)) +(assert_return (invoke "div" (f64.const -inf) (f64.const -0x1p+0)) (f64.const inf)) +(assert_return (invoke "div" (f64.const -inf) (f64.const 0x1p+0)) (f64.const -inf)) +(assert_return (invoke "div" (f64.const inf) (f64.const -0x1p+0)) (f64.const -inf)) +(assert_return (invoke "div" (f64.const inf) (f64.const 0x1p+0)) (f64.const inf)) +(assert_return (invoke "div" (f64.const -inf) (f64.const -0x1.921fb54442d18p+2)) (f64.const inf)) +(assert_return (invoke "div" (f64.const -inf) (f64.const 0x1.921fb54442d18p+2)) (f64.const -inf)) +(assert_return (invoke "div" (f64.const inf) (f64.const -0x1.921fb54442d18p+2)) (f64.const -inf)) +(assert_return (invoke "div" (f64.const inf) (f64.const 0x1.921fb54442d18p+2)) (f64.const inf)) +(assert_return (invoke "div" (f64.const -inf) (f64.const -0x1.fffffffffffffp+1023)) (f64.const inf)) +(assert_return (invoke "div" (f64.const -inf) (f64.const 0x1.fffffffffffffp+1023)) (f64.const -inf)) +(assert_return (invoke "div" (f64.const inf) (f64.const -0x1.fffffffffffffp+1023)) (f64.const -inf)) +(assert_return (invoke "div" (f64.const inf) (f64.const 0x1.fffffffffffffp+1023)) (f64.const inf)) +(assert_return_canonical_nan (invoke "div" (f64.const -inf) (f64.const -inf))) +(assert_return_canonical_nan (invoke "div" (f64.const -inf) (f64.const inf))) +(assert_return_canonical_nan (invoke "div" (f64.const inf) (f64.const -inf))) +(assert_return_canonical_nan (invoke "div" (f64.const inf) (f64.const inf))) +(assert_return_canonical_nan (invoke "div" (f64.const -inf) (f64.const -nan))) +(assert_return_arithmetic_nan (invoke "div" (f64.const -inf) (f64.const -nan:0x4000000000000))) +(assert_return_canonical_nan (invoke "div" (f64.const -inf) (f64.const nan))) +(assert_return_arithmetic_nan (invoke "div" (f64.const -inf) (f64.const nan:0x4000000000000))) +(assert_return_canonical_nan (invoke "div" (f64.const inf) (f64.const -nan))) +(assert_return_arithmetic_nan (invoke "div" (f64.const inf) (f64.const -nan:0x4000000000000))) +(assert_return_canonical_nan (invoke "div" (f64.const inf) (f64.const nan))) +(assert_return_arithmetic_nan (invoke "div" (f64.const inf) (f64.const nan:0x4000000000000))) (assert_return_canonical_nan (invoke "div" (f64.const -nan) (f64.const -0x0p+0))) (assert_return_arithmetic_nan (invoke "div" (f64.const -nan:0x4000000000000) (f64.const -0x0p+0))) (assert_return_canonical_nan (invoke "div" (f64.const -nan) (f64.const 0x0p+0))) @@ -1592,14 +1592,14 @@ (assert_return_arithmetic_nan (invoke "div" (f64.const nan:0x4000000000000) (f64.const -0x1.fffffffffffffp+1023))) (assert_return_canonical_nan (invoke "div" (f64.const nan) (f64.const 0x1.fffffffffffffp+1023))) (assert_return_arithmetic_nan (invoke "div" (f64.const nan:0x4000000000000) (f64.const 0x1.fffffffffffffp+1023))) -(assert_return_canonical_nan (invoke "div" (f64.const -nan) (f64.const -infinity))) -(assert_return_arithmetic_nan (invoke "div" (f64.const -nan:0x4000000000000) (f64.const -infinity))) -(assert_return_canonical_nan (invoke "div" (f64.const -nan) (f64.const infinity))) -(assert_return_arithmetic_nan (invoke "div" (f64.const -nan:0x4000000000000) (f64.const infinity))) -(assert_return_canonical_nan (invoke "div" (f64.const nan) (f64.const -infinity))) -(assert_return_arithmetic_nan (invoke "div" (f64.const nan:0x4000000000000) (f64.const -infinity))) -(assert_return_canonical_nan (invoke "div" (f64.const nan) (f64.const infinity))) -(assert_return_arithmetic_nan (invoke "div" (f64.const nan:0x4000000000000) (f64.const infinity))) +(assert_return_canonical_nan (invoke "div" (f64.const -nan) (f64.const -inf))) +(assert_return_arithmetic_nan (invoke "div" (f64.const -nan:0x4000000000000) (f64.const -inf))) +(assert_return_canonical_nan (invoke "div" (f64.const -nan) (f64.const inf))) +(assert_return_arithmetic_nan (invoke "div" (f64.const -nan:0x4000000000000) (f64.const inf))) +(assert_return_canonical_nan (invoke "div" (f64.const nan) (f64.const -inf))) +(assert_return_arithmetic_nan (invoke "div" (f64.const nan:0x4000000000000) (f64.const -inf))) +(assert_return_canonical_nan (invoke "div" (f64.const nan) (f64.const inf))) +(assert_return_arithmetic_nan (invoke "div" (f64.const nan:0x4000000000000) (f64.const inf))) (assert_return_canonical_nan (invoke "div" (f64.const -nan) (f64.const -nan))) (assert_return_arithmetic_nan (invoke "div" (f64.const -nan:0x4000000000000) (f64.const -nan))) (assert_return_arithmetic_nan (invoke "div" (f64.const -nan) (f64.const -nan:0x4000000000000))) @@ -1644,10 +1644,10 @@ (assert_return (invoke "min" (f64.const -0x0p+0) (f64.const 0x1.fffffffffffffp+1023)) (f64.const -0x0p+0)) (assert_return (invoke "min" (f64.const 0x0p+0) (f64.const -0x1.fffffffffffffp+1023)) (f64.const -0x1.fffffffffffffp+1023)) (assert_return (invoke "min" (f64.const 0x0p+0) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x0p+0)) -(assert_return (invoke "min" (f64.const -0x0p+0) (f64.const -infinity)) (f64.const -infinity)) -(assert_return (invoke "min" (f64.const -0x0p+0) (f64.const infinity)) (f64.const -0x0p+0)) -(assert_return (invoke "min" (f64.const 0x0p+0) (f64.const -infinity)) (f64.const -infinity)) -(assert_return (invoke "min" (f64.const 0x0p+0) (f64.const infinity)) (f64.const 0x0p+0)) +(assert_return (invoke "min" (f64.const -0x0p+0) (f64.const -inf)) (f64.const -inf)) +(assert_return (invoke "min" (f64.const -0x0p+0) (f64.const inf)) (f64.const -0x0p+0)) +(assert_return (invoke "min" (f64.const 0x0p+0) (f64.const -inf)) (f64.const -inf)) +(assert_return (invoke "min" (f64.const 0x0p+0) (f64.const inf)) (f64.const 0x0p+0)) (assert_return_canonical_nan (invoke "min" (f64.const -0x0p+0) (f64.const -nan))) (assert_return_arithmetic_nan (invoke "min" (f64.const -0x0p+0) (f64.const -nan:0x4000000000000))) (assert_return_canonical_nan (invoke "min" (f64.const -0x0p+0) (f64.const nan))) @@ -1684,10 +1684,10 @@ (assert_return (invoke "min" (f64.const -0x0.0000000000001p-1022) (f64.const 0x1.fffffffffffffp+1023)) (f64.const -0x0.0000000000001p-1022)) (assert_return (invoke "min" (f64.const 0x0.0000000000001p-1022) (f64.const -0x1.fffffffffffffp+1023)) (f64.const -0x1.fffffffffffffp+1023)) (assert_return (invoke "min" (f64.const 0x0.0000000000001p-1022) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x0.0000000000001p-1022)) -(assert_return (invoke "min" (f64.const -0x0.0000000000001p-1022) (f64.const -infinity)) (f64.const -infinity)) -(assert_return (invoke "min" (f64.const -0x0.0000000000001p-1022) (f64.const infinity)) (f64.const -0x0.0000000000001p-1022)) -(assert_return (invoke "min" (f64.const 0x0.0000000000001p-1022) (f64.const -infinity)) (f64.const -infinity)) -(assert_return (invoke "min" (f64.const 0x0.0000000000001p-1022) (f64.const infinity)) (f64.const 0x0.0000000000001p-1022)) +(assert_return (invoke "min" (f64.const -0x0.0000000000001p-1022) (f64.const -inf)) (f64.const -inf)) +(assert_return (invoke "min" (f64.const -0x0.0000000000001p-1022) (f64.const inf)) (f64.const -0x0.0000000000001p-1022)) +(assert_return (invoke "min" (f64.const 0x0.0000000000001p-1022) (f64.const -inf)) (f64.const -inf)) +(assert_return (invoke "min" (f64.const 0x0.0000000000001p-1022) (f64.const inf)) (f64.const 0x0.0000000000001p-1022)) (assert_return_canonical_nan (invoke "min" (f64.const -0x0.0000000000001p-1022) (f64.const -nan))) (assert_return_arithmetic_nan (invoke "min" (f64.const -0x0.0000000000001p-1022) (f64.const -nan:0x4000000000000))) (assert_return_canonical_nan (invoke "min" (f64.const -0x0.0000000000001p-1022) (f64.const nan))) @@ -1724,10 +1724,10 @@ (assert_return (invoke "min" (f64.const -0x1p-1022) (f64.const 0x1.fffffffffffffp+1023)) (f64.const -0x1p-1022)) (assert_return (invoke "min" (f64.const 0x1p-1022) (f64.const -0x1.fffffffffffffp+1023)) (f64.const -0x1.fffffffffffffp+1023)) (assert_return (invoke "min" (f64.const 0x1p-1022) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x1p-1022)) -(assert_return (invoke "min" (f64.const -0x1p-1022) (f64.const -infinity)) (f64.const -infinity)) -(assert_return (invoke "min" (f64.const -0x1p-1022) (f64.const infinity)) (f64.const -0x1p-1022)) -(assert_return (invoke "min" (f64.const 0x1p-1022) (f64.const -infinity)) (f64.const -infinity)) -(assert_return (invoke "min" (f64.const 0x1p-1022) (f64.const infinity)) (f64.const 0x1p-1022)) +(assert_return (invoke "min" (f64.const -0x1p-1022) (f64.const -inf)) (f64.const -inf)) +(assert_return (invoke "min" (f64.const -0x1p-1022) (f64.const inf)) (f64.const -0x1p-1022)) +(assert_return (invoke "min" (f64.const 0x1p-1022) (f64.const -inf)) (f64.const -inf)) +(assert_return (invoke "min" (f64.const 0x1p-1022) (f64.const inf)) (f64.const 0x1p-1022)) (assert_return_canonical_nan (invoke "min" (f64.const -0x1p-1022) (f64.const -nan))) (assert_return_arithmetic_nan (invoke "min" (f64.const -0x1p-1022) (f64.const -nan:0x4000000000000))) (assert_return_canonical_nan (invoke "min" (f64.const -0x1p-1022) (f64.const nan))) @@ -1764,10 +1764,10 @@ (assert_return (invoke "min" (f64.const -0x1p-1) (f64.const 0x1.fffffffffffffp+1023)) (f64.const -0x1p-1)) (assert_return (invoke "min" (f64.const 0x1p-1) (f64.const -0x1.fffffffffffffp+1023)) (f64.const -0x1.fffffffffffffp+1023)) (assert_return (invoke "min" (f64.const 0x1p-1) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x1p-1)) -(assert_return (invoke "min" (f64.const -0x1p-1) (f64.const -infinity)) (f64.const -infinity)) -(assert_return (invoke "min" (f64.const -0x1p-1) (f64.const infinity)) (f64.const -0x1p-1)) -(assert_return (invoke "min" (f64.const 0x1p-1) (f64.const -infinity)) (f64.const -infinity)) -(assert_return (invoke "min" (f64.const 0x1p-1) (f64.const infinity)) (f64.const 0x1p-1)) +(assert_return (invoke "min" (f64.const -0x1p-1) (f64.const -inf)) (f64.const -inf)) +(assert_return (invoke "min" (f64.const -0x1p-1) (f64.const inf)) (f64.const -0x1p-1)) +(assert_return (invoke "min" (f64.const 0x1p-1) (f64.const -inf)) (f64.const -inf)) +(assert_return (invoke "min" (f64.const 0x1p-1) (f64.const inf)) (f64.const 0x1p-1)) (assert_return_canonical_nan (invoke "min" (f64.const -0x1p-1) (f64.const -nan))) (assert_return_arithmetic_nan (invoke "min" (f64.const -0x1p-1) (f64.const -nan:0x4000000000000))) (assert_return_canonical_nan (invoke "min" (f64.const -0x1p-1) (f64.const nan))) @@ -1804,10 +1804,10 @@ (assert_return (invoke "min" (f64.const -0x1p+0) (f64.const 0x1.fffffffffffffp+1023)) (f64.const -0x1p+0)) (assert_return (invoke "min" (f64.const 0x1p+0) (f64.const -0x1.fffffffffffffp+1023)) (f64.const -0x1.fffffffffffffp+1023)) (assert_return (invoke "min" (f64.const 0x1p+0) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x1p+0)) -(assert_return (invoke "min" (f64.const -0x1p+0) (f64.const -infinity)) (f64.const -infinity)) -(assert_return (invoke "min" (f64.const -0x1p+0) (f64.const infinity)) (f64.const -0x1p+0)) -(assert_return (invoke "min" (f64.const 0x1p+0) (f64.const -infinity)) (f64.const -infinity)) -(assert_return (invoke "min" (f64.const 0x1p+0) (f64.const infinity)) (f64.const 0x1p+0)) +(assert_return (invoke "min" (f64.const -0x1p+0) (f64.const -inf)) (f64.const -inf)) +(assert_return (invoke "min" (f64.const -0x1p+0) (f64.const inf)) (f64.const -0x1p+0)) +(assert_return (invoke "min" (f64.const 0x1p+0) (f64.const -inf)) (f64.const -inf)) +(assert_return (invoke "min" (f64.const 0x1p+0) (f64.const inf)) (f64.const 0x1p+0)) (assert_return_canonical_nan (invoke "min" (f64.const -0x1p+0) (f64.const -nan))) (assert_return_arithmetic_nan (invoke "min" (f64.const -0x1p+0) (f64.const -nan:0x4000000000000))) (assert_return_canonical_nan (invoke "min" (f64.const -0x1p+0) (f64.const nan))) @@ -1844,10 +1844,10 @@ (assert_return (invoke "min" (f64.const -0x1.921fb54442d18p+2) (f64.const 0x1.fffffffffffffp+1023)) (f64.const -0x1.921fb54442d18p+2)) (assert_return (invoke "min" (f64.const 0x1.921fb54442d18p+2) (f64.const -0x1.fffffffffffffp+1023)) (f64.const -0x1.fffffffffffffp+1023)) (assert_return (invoke "min" (f64.const 0x1.921fb54442d18p+2) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x1.921fb54442d18p+2)) -(assert_return (invoke "min" (f64.const -0x1.921fb54442d18p+2) (f64.const -infinity)) (f64.const -infinity)) -(assert_return (invoke "min" (f64.const -0x1.921fb54442d18p+2) (f64.const infinity)) (f64.const -0x1.921fb54442d18p+2)) -(assert_return (invoke "min" (f64.const 0x1.921fb54442d18p+2) (f64.const -infinity)) (f64.const -infinity)) -(assert_return (invoke "min" (f64.const 0x1.921fb54442d18p+2) (f64.const infinity)) (f64.const 0x1.921fb54442d18p+2)) +(assert_return (invoke "min" (f64.const -0x1.921fb54442d18p+2) (f64.const -inf)) (f64.const -inf)) +(assert_return (invoke "min" (f64.const -0x1.921fb54442d18p+2) (f64.const inf)) (f64.const -0x1.921fb54442d18p+2)) +(assert_return (invoke "min" (f64.const 0x1.921fb54442d18p+2) (f64.const -inf)) (f64.const -inf)) +(assert_return (invoke "min" (f64.const 0x1.921fb54442d18p+2) (f64.const inf)) (f64.const 0x1.921fb54442d18p+2)) (assert_return_canonical_nan (invoke "min" (f64.const -0x1.921fb54442d18p+2) (f64.const -nan))) (assert_return_arithmetic_nan (invoke "min" (f64.const -0x1.921fb54442d18p+2) (f64.const -nan:0x4000000000000))) (assert_return_canonical_nan (invoke "min" (f64.const -0x1.921fb54442d18p+2) (f64.const nan))) @@ -1884,10 +1884,10 @@ (assert_return (invoke "min" (f64.const -0x1.fffffffffffffp+1023) (f64.const 0x1.fffffffffffffp+1023)) (f64.const -0x1.fffffffffffffp+1023)) (assert_return (invoke "min" (f64.const 0x1.fffffffffffffp+1023) (f64.const -0x1.fffffffffffffp+1023)) (f64.const -0x1.fffffffffffffp+1023)) (assert_return (invoke "min" (f64.const 0x1.fffffffffffffp+1023) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x1.fffffffffffffp+1023)) -(assert_return (invoke "min" (f64.const -0x1.fffffffffffffp+1023) (f64.const -infinity)) (f64.const -infinity)) -(assert_return (invoke "min" (f64.const -0x1.fffffffffffffp+1023) (f64.const infinity)) (f64.const -0x1.fffffffffffffp+1023)) -(assert_return (invoke "min" (f64.const 0x1.fffffffffffffp+1023) (f64.const -infinity)) (f64.const -infinity)) -(assert_return (invoke "min" (f64.const 0x1.fffffffffffffp+1023) (f64.const infinity)) (f64.const 0x1.fffffffffffffp+1023)) +(assert_return (invoke "min" (f64.const -0x1.fffffffffffffp+1023) (f64.const -inf)) (f64.const -inf)) +(assert_return (invoke "min" (f64.const -0x1.fffffffffffffp+1023) (f64.const inf)) (f64.const -0x1.fffffffffffffp+1023)) +(assert_return (invoke "min" (f64.const 0x1.fffffffffffffp+1023) (f64.const -inf)) (f64.const -inf)) +(assert_return (invoke "min" (f64.const 0x1.fffffffffffffp+1023) (f64.const inf)) (f64.const 0x1.fffffffffffffp+1023)) (assert_return_canonical_nan (invoke "min" (f64.const -0x1.fffffffffffffp+1023) (f64.const -nan))) (assert_return_arithmetic_nan (invoke "min" (f64.const -0x1.fffffffffffffp+1023) (f64.const -nan:0x4000000000000))) (assert_return_canonical_nan (invoke "min" (f64.const -0x1.fffffffffffffp+1023) (f64.const nan))) @@ -1896,46 +1896,46 @@ (assert_return_arithmetic_nan (invoke "min" (f64.const 0x1.fffffffffffffp+1023) (f64.const -nan:0x4000000000000))) (assert_return_canonical_nan (invoke "min" (f64.const 0x1.fffffffffffffp+1023) (f64.const nan))) (assert_return_arithmetic_nan (invoke "min" (f64.const 0x1.fffffffffffffp+1023) (f64.const nan:0x4000000000000))) -(assert_return (invoke "min" (f64.const -infinity) (f64.const -0x0p+0)) (f64.const -infinity)) -(assert_return (invoke "min" (f64.const -infinity) (f64.const 0x0p+0)) (f64.const -infinity)) -(assert_return (invoke "min" (f64.const infinity) (f64.const -0x0p+0)) (f64.const -0x0p+0)) -(assert_return (invoke "min" (f64.const infinity) (f64.const 0x0p+0)) (f64.const 0x0p+0)) -(assert_return (invoke "min" (f64.const -infinity) (f64.const -0x0.0000000000001p-1022)) (f64.const -infinity)) -(assert_return (invoke "min" (f64.const -infinity) (f64.const 0x0.0000000000001p-1022)) (f64.const -infinity)) -(assert_return (invoke "min" (f64.const infinity) (f64.const -0x0.0000000000001p-1022)) (f64.const -0x0.0000000000001p-1022)) -(assert_return (invoke "min" (f64.const infinity) (f64.const 0x0.0000000000001p-1022)) (f64.const 0x0.0000000000001p-1022)) -(assert_return (invoke "min" (f64.const -infinity) (f64.const -0x1p-1022)) (f64.const -infinity)) -(assert_return (invoke "min" (f64.const -infinity) (f64.const 0x1p-1022)) (f64.const -infinity)) -(assert_return (invoke "min" (f64.const infinity) (f64.const -0x1p-1022)) (f64.const -0x1p-1022)) -(assert_return (invoke "min" (f64.const infinity) (f64.const 0x1p-1022)) (f64.const 0x1p-1022)) -(assert_return (invoke "min" (f64.const -infinity) (f64.const -0x1p-1)) (f64.const -infinity)) -(assert_return (invoke "min" (f64.const -infinity) (f64.const 0x1p-1)) (f64.const -infinity)) -(assert_return (invoke "min" (f64.const infinity) (f64.const -0x1p-1)) (f64.const -0x1p-1)) -(assert_return (invoke "min" (f64.const infinity) (f64.const 0x1p-1)) (f64.const 0x1p-1)) -(assert_return (invoke "min" (f64.const -infinity) (f64.const -0x1p+0)) (f64.const -infinity)) -(assert_return (invoke "min" (f64.const -infinity) (f64.const 0x1p+0)) (f64.const -infinity)) -(assert_return (invoke "min" (f64.const infinity) (f64.const -0x1p+0)) (f64.const -0x1p+0)) -(assert_return (invoke "min" (f64.const infinity) (f64.const 0x1p+0)) (f64.const 0x1p+0)) -(assert_return (invoke "min" (f64.const -infinity) (f64.const -0x1.921fb54442d18p+2)) (f64.const -infinity)) -(assert_return (invoke "min" (f64.const -infinity) (f64.const 0x1.921fb54442d18p+2)) (f64.const -infinity)) -(assert_return (invoke "min" (f64.const infinity) (f64.const -0x1.921fb54442d18p+2)) (f64.const -0x1.921fb54442d18p+2)) -(assert_return (invoke "min" (f64.const infinity) (f64.const 0x1.921fb54442d18p+2)) (f64.const 0x1.921fb54442d18p+2)) -(assert_return (invoke "min" (f64.const -infinity) (f64.const -0x1.fffffffffffffp+1023)) (f64.const -infinity)) -(assert_return (invoke "min" (f64.const -infinity) (f64.const 0x1.fffffffffffffp+1023)) (f64.const -infinity)) -(assert_return (invoke "min" (f64.const infinity) (f64.const -0x1.fffffffffffffp+1023)) (f64.const -0x1.fffffffffffffp+1023)) -(assert_return (invoke "min" (f64.const infinity) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x1.fffffffffffffp+1023)) -(assert_return (invoke "min" (f64.const -infinity) (f64.const -infinity)) (f64.const -infinity)) -(assert_return (invoke "min" (f64.const -infinity) (f64.const infinity)) (f64.const -infinity)) -(assert_return (invoke "min" (f64.const infinity) (f64.const -infinity)) (f64.const -infinity)) -(assert_return (invoke "min" (f64.const infinity) (f64.const infinity)) (f64.const infinity)) -(assert_return_canonical_nan (invoke "min" (f64.const -infinity) (f64.const -nan))) -(assert_return_arithmetic_nan (invoke "min" (f64.const -infinity) (f64.const -nan:0x4000000000000))) -(assert_return_canonical_nan (invoke "min" (f64.const -infinity) (f64.const nan))) -(assert_return_arithmetic_nan (invoke "min" (f64.const -infinity) (f64.const nan:0x4000000000000))) -(assert_return_canonical_nan (invoke "min" (f64.const infinity) (f64.const -nan))) -(assert_return_arithmetic_nan (invoke "min" (f64.const infinity) (f64.const -nan:0x4000000000000))) -(assert_return_canonical_nan (invoke "min" (f64.const infinity) (f64.const nan))) -(assert_return_arithmetic_nan (invoke "min" (f64.const infinity) (f64.const nan:0x4000000000000))) +(assert_return (invoke "min" (f64.const -inf) (f64.const -0x0p+0)) (f64.const -inf)) +(assert_return (invoke "min" (f64.const -inf) (f64.const 0x0p+0)) (f64.const -inf)) +(assert_return (invoke "min" (f64.const inf) (f64.const -0x0p+0)) (f64.const -0x0p+0)) +(assert_return (invoke "min" (f64.const inf) (f64.const 0x0p+0)) (f64.const 0x0p+0)) +(assert_return (invoke "min" (f64.const -inf) (f64.const -0x0.0000000000001p-1022)) (f64.const -inf)) +(assert_return (invoke "min" (f64.const -inf) (f64.const 0x0.0000000000001p-1022)) (f64.const -inf)) +(assert_return (invoke "min" (f64.const inf) (f64.const -0x0.0000000000001p-1022)) (f64.const -0x0.0000000000001p-1022)) +(assert_return (invoke "min" (f64.const inf) (f64.const 0x0.0000000000001p-1022)) (f64.const 0x0.0000000000001p-1022)) +(assert_return (invoke "min" (f64.const -inf) (f64.const -0x1p-1022)) (f64.const -inf)) +(assert_return (invoke "min" (f64.const -inf) (f64.const 0x1p-1022)) (f64.const -inf)) +(assert_return (invoke "min" (f64.const inf) (f64.const -0x1p-1022)) (f64.const -0x1p-1022)) +(assert_return (invoke "min" (f64.const inf) (f64.const 0x1p-1022)) (f64.const 0x1p-1022)) +(assert_return (invoke "min" (f64.const -inf) (f64.const -0x1p-1)) (f64.const -inf)) +(assert_return (invoke "min" (f64.const -inf) (f64.const 0x1p-1)) (f64.const -inf)) +(assert_return (invoke "min" (f64.const inf) (f64.const -0x1p-1)) (f64.const -0x1p-1)) +(assert_return (invoke "min" (f64.const inf) (f64.const 0x1p-1)) (f64.const 0x1p-1)) +(assert_return (invoke "min" (f64.const -inf) (f64.const -0x1p+0)) (f64.const -inf)) +(assert_return (invoke "min" (f64.const -inf) (f64.const 0x1p+0)) (f64.const -inf)) +(assert_return (invoke "min" (f64.const inf) (f64.const -0x1p+0)) (f64.const -0x1p+0)) +(assert_return (invoke "min" (f64.const inf) (f64.const 0x1p+0)) (f64.const 0x1p+0)) +(assert_return (invoke "min" (f64.const -inf) (f64.const -0x1.921fb54442d18p+2)) (f64.const -inf)) +(assert_return (invoke "min" (f64.const -inf) (f64.const 0x1.921fb54442d18p+2)) (f64.const -inf)) +(assert_return (invoke "min" (f64.const inf) (f64.const -0x1.921fb54442d18p+2)) (f64.const -0x1.921fb54442d18p+2)) +(assert_return (invoke "min" (f64.const inf) (f64.const 0x1.921fb54442d18p+2)) (f64.const 0x1.921fb54442d18p+2)) +(assert_return (invoke "min" (f64.const -inf) (f64.const -0x1.fffffffffffffp+1023)) (f64.const -inf)) +(assert_return (invoke "min" (f64.const -inf) (f64.const 0x1.fffffffffffffp+1023)) (f64.const -inf)) +(assert_return (invoke "min" (f64.const inf) (f64.const -0x1.fffffffffffffp+1023)) (f64.const -0x1.fffffffffffffp+1023)) +(assert_return (invoke "min" (f64.const inf) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x1.fffffffffffffp+1023)) +(assert_return (invoke "min" (f64.const -inf) (f64.const -inf)) (f64.const -inf)) +(assert_return (invoke "min" (f64.const -inf) (f64.const inf)) (f64.const -inf)) +(assert_return (invoke "min" (f64.const inf) (f64.const -inf)) (f64.const -inf)) +(assert_return (invoke "min" (f64.const inf) (f64.const inf)) (f64.const inf)) +(assert_return_canonical_nan (invoke "min" (f64.const -inf) (f64.const -nan))) +(assert_return_arithmetic_nan (invoke "min" (f64.const -inf) (f64.const -nan:0x4000000000000))) +(assert_return_canonical_nan (invoke "min" (f64.const -inf) (f64.const nan))) +(assert_return_arithmetic_nan (invoke "min" (f64.const -inf) (f64.const nan:0x4000000000000))) +(assert_return_canonical_nan (invoke "min" (f64.const inf) (f64.const -nan))) +(assert_return_arithmetic_nan (invoke "min" (f64.const inf) (f64.const -nan:0x4000000000000))) +(assert_return_canonical_nan (invoke "min" (f64.const inf) (f64.const nan))) +(assert_return_arithmetic_nan (invoke "min" (f64.const inf) (f64.const nan:0x4000000000000))) (assert_return_canonical_nan (invoke "min" (f64.const -nan) (f64.const -0x0p+0))) (assert_return_arithmetic_nan (invoke "min" (f64.const -nan:0x4000000000000) (f64.const -0x0p+0))) (assert_return_canonical_nan (invoke "min" (f64.const -nan) (f64.const 0x0p+0))) @@ -1992,14 +1992,14 @@ (assert_return_arithmetic_nan (invoke "min" (f64.const nan:0x4000000000000) (f64.const -0x1.fffffffffffffp+1023))) (assert_return_canonical_nan (invoke "min" (f64.const nan) (f64.const 0x1.fffffffffffffp+1023))) (assert_return_arithmetic_nan (invoke "min" (f64.const nan:0x4000000000000) (f64.const 0x1.fffffffffffffp+1023))) -(assert_return_canonical_nan (invoke "min" (f64.const -nan) (f64.const -infinity))) -(assert_return_arithmetic_nan (invoke "min" (f64.const -nan:0x4000000000000) (f64.const -infinity))) -(assert_return_canonical_nan (invoke "min" (f64.const -nan) (f64.const infinity))) -(assert_return_arithmetic_nan (invoke "min" (f64.const -nan:0x4000000000000) (f64.const infinity))) -(assert_return_canonical_nan (invoke "min" (f64.const nan) (f64.const -infinity))) -(assert_return_arithmetic_nan (invoke "min" (f64.const nan:0x4000000000000) (f64.const -infinity))) -(assert_return_canonical_nan (invoke "min" (f64.const nan) (f64.const infinity))) -(assert_return_arithmetic_nan (invoke "min" (f64.const nan:0x4000000000000) (f64.const infinity))) +(assert_return_canonical_nan (invoke "min" (f64.const -nan) (f64.const -inf))) +(assert_return_arithmetic_nan (invoke "min" (f64.const -nan:0x4000000000000) (f64.const -inf))) +(assert_return_canonical_nan (invoke "min" (f64.const -nan) (f64.const inf))) +(assert_return_arithmetic_nan (invoke "min" (f64.const -nan:0x4000000000000) (f64.const inf))) +(assert_return_canonical_nan (invoke "min" (f64.const nan) (f64.const -inf))) +(assert_return_arithmetic_nan (invoke "min" (f64.const nan:0x4000000000000) (f64.const -inf))) +(assert_return_canonical_nan (invoke "min" (f64.const nan) (f64.const inf))) +(assert_return_arithmetic_nan (invoke "min" (f64.const nan:0x4000000000000) (f64.const inf))) (assert_return_canonical_nan (invoke "min" (f64.const -nan) (f64.const -nan))) (assert_return_arithmetic_nan (invoke "min" (f64.const -nan:0x4000000000000) (f64.const -nan))) (assert_return_arithmetic_nan (invoke "min" (f64.const -nan) (f64.const -nan:0x4000000000000))) @@ -2044,10 +2044,10 @@ (assert_return (invoke "max" (f64.const -0x0p+0) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x1.fffffffffffffp+1023)) (assert_return (invoke "max" (f64.const 0x0p+0) (f64.const -0x1.fffffffffffffp+1023)) (f64.const 0x0p+0)) (assert_return (invoke "max" (f64.const 0x0p+0) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x1.fffffffffffffp+1023)) -(assert_return (invoke "max" (f64.const -0x0p+0) (f64.const -infinity)) (f64.const -0x0p+0)) -(assert_return (invoke "max" (f64.const -0x0p+0) (f64.const infinity)) (f64.const infinity)) -(assert_return (invoke "max" (f64.const 0x0p+0) (f64.const -infinity)) (f64.const 0x0p+0)) -(assert_return (invoke "max" (f64.const 0x0p+0) (f64.const infinity)) (f64.const infinity)) +(assert_return (invoke "max" (f64.const -0x0p+0) (f64.const -inf)) (f64.const -0x0p+0)) +(assert_return (invoke "max" (f64.const -0x0p+0) (f64.const inf)) (f64.const inf)) +(assert_return (invoke "max" (f64.const 0x0p+0) (f64.const -inf)) (f64.const 0x0p+0)) +(assert_return (invoke "max" (f64.const 0x0p+0) (f64.const inf)) (f64.const inf)) (assert_return_canonical_nan (invoke "max" (f64.const -0x0p+0) (f64.const -nan))) (assert_return_arithmetic_nan (invoke "max" (f64.const -0x0p+0) (f64.const -nan:0x4000000000000))) (assert_return_canonical_nan (invoke "max" (f64.const -0x0p+0) (f64.const nan))) @@ -2084,10 +2084,10 @@ (assert_return (invoke "max" (f64.const -0x0.0000000000001p-1022) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x1.fffffffffffffp+1023)) (assert_return (invoke "max" (f64.const 0x0.0000000000001p-1022) (f64.const -0x1.fffffffffffffp+1023)) (f64.const 0x0.0000000000001p-1022)) (assert_return (invoke "max" (f64.const 0x0.0000000000001p-1022) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x1.fffffffffffffp+1023)) -(assert_return (invoke "max" (f64.const -0x0.0000000000001p-1022) (f64.const -infinity)) (f64.const -0x0.0000000000001p-1022)) -(assert_return (invoke "max" (f64.const -0x0.0000000000001p-1022) (f64.const infinity)) (f64.const infinity)) -(assert_return (invoke "max" (f64.const 0x0.0000000000001p-1022) (f64.const -infinity)) (f64.const 0x0.0000000000001p-1022)) -(assert_return (invoke "max" (f64.const 0x0.0000000000001p-1022) (f64.const infinity)) (f64.const infinity)) +(assert_return (invoke "max" (f64.const -0x0.0000000000001p-1022) (f64.const -inf)) (f64.const -0x0.0000000000001p-1022)) +(assert_return (invoke "max" (f64.const -0x0.0000000000001p-1022) (f64.const inf)) (f64.const inf)) +(assert_return (invoke "max" (f64.const 0x0.0000000000001p-1022) (f64.const -inf)) (f64.const 0x0.0000000000001p-1022)) +(assert_return (invoke "max" (f64.const 0x0.0000000000001p-1022) (f64.const inf)) (f64.const inf)) (assert_return_canonical_nan (invoke "max" (f64.const -0x0.0000000000001p-1022) (f64.const -nan))) (assert_return_arithmetic_nan (invoke "max" (f64.const -0x0.0000000000001p-1022) (f64.const -nan:0x4000000000000))) (assert_return_canonical_nan (invoke "max" (f64.const -0x0.0000000000001p-1022) (f64.const nan))) @@ -2124,10 +2124,10 @@ (assert_return (invoke "max" (f64.const -0x1p-1022) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x1.fffffffffffffp+1023)) (assert_return (invoke "max" (f64.const 0x1p-1022) (f64.const -0x1.fffffffffffffp+1023)) (f64.const 0x1p-1022)) (assert_return (invoke "max" (f64.const 0x1p-1022) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x1.fffffffffffffp+1023)) -(assert_return (invoke "max" (f64.const -0x1p-1022) (f64.const -infinity)) (f64.const -0x1p-1022)) -(assert_return (invoke "max" (f64.const -0x1p-1022) (f64.const infinity)) (f64.const infinity)) -(assert_return (invoke "max" (f64.const 0x1p-1022) (f64.const -infinity)) (f64.const 0x1p-1022)) -(assert_return (invoke "max" (f64.const 0x1p-1022) (f64.const infinity)) (f64.const infinity)) +(assert_return (invoke "max" (f64.const -0x1p-1022) (f64.const -inf)) (f64.const -0x1p-1022)) +(assert_return (invoke "max" (f64.const -0x1p-1022) (f64.const inf)) (f64.const inf)) +(assert_return (invoke "max" (f64.const 0x1p-1022) (f64.const -inf)) (f64.const 0x1p-1022)) +(assert_return (invoke "max" (f64.const 0x1p-1022) (f64.const inf)) (f64.const inf)) (assert_return_canonical_nan (invoke "max" (f64.const -0x1p-1022) (f64.const -nan))) (assert_return_arithmetic_nan (invoke "max" (f64.const -0x1p-1022) (f64.const -nan:0x4000000000000))) (assert_return_canonical_nan (invoke "max" (f64.const -0x1p-1022) (f64.const nan))) @@ -2164,10 +2164,10 @@ (assert_return (invoke "max" (f64.const -0x1p-1) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x1.fffffffffffffp+1023)) (assert_return (invoke "max" (f64.const 0x1p-1) (f64.const -0x1.fffffffffffffp+1023)) (f64.const 0x1p-1)) (assert_return (invoke "max" (f64.const 0x1p-1) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x1.fffffffffffffp+1023)) -(assert_return (invoke "max" (f64.const -0x1p-1) (f64.const -infinity)) (f64.const -0x1p-1)) -(assert_return (invoke "max" (f64.const -0x1p-1) (f64.const infinity)) (f64.const infinity)) -(assert_return (invoke "max" (f64.const 0x1p-1) (f64.const -infinity)) (f64.const 0x1p-1)) -(assert_return (invoke "max" (f64.const 0x1p-1) (f64.const infinity)) (f64.const infinity)) +(assert_return (invoke "max" (f64.const -0x1p-1) (f64.const -inf)) (f64.const -0x1p-1)) +(assert_return (invoke "max" (f64.const -0x1p-1) (f64.const inf)) (f64.const inf)) +(assert_return (invoke "max" (f64.const 0x1p-1) (f64.const -inf)) (f64.const 0x1p-1)) +(assert_return (invoke "max" (f64.const 0x1p-1) (f64.const inf)) (f64.const inf)) (assert_return_canonical_nan (invoke "max" (f64.const -0x1p-1) (f64.const -nan))) (assert_return_arithmetic_nan (invoke "max" (f64.const -0x1p-1) (f64.const -nan:0x4000000000000))) (assert_return_canonical_nan (invoke "max" (f64.const -0x1p-1) (f64.const nan))) @@ -2204,10 +2204,10 @@ (assert_return (invoke "max" (f64.const -0x1p+0) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x1.fffffffffffffp+1023)) (assert_return (invoke "max" (f64.const 0x1p+0) (f64.const -0x1.fffffffffffffp+1023)) (f64.const 0x1p+0)) (assert_return (invoke "max" (f64.const 0x1p+0) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x1.fffffffffffffp+1023)) -(assert_return (invoke "max" (f64.const -0x1p+0) (f64.const -infinity)) (f64.const -0x1p+0)) -(assert_return (invoke "max" (f64.const -0x1p+0) (f64.const infinity)) (f64.const infinity)) -(assert_return (invoke "max" (f64.const 0x1p+0) (f64.const -infinity)) (f64.const 0x1p+0)) -(assert_return (invoke "max" (f64.const 0x1p+0) (f64.const infinity)) (f64.const infinity)) +(assert_return (invoke "max" (f64.const -0x1p+0) (f64.const -inf)) (f64.const -0x1p+0)) +(assert_return (invoke "max" (f64.const -0x1p+0) (f64.const inf)) (f64.const inf)) +(assert_return (invoke "max" (f64.const 0x1p+0) (f64.const -inf)) (f64.const 0x1p+0)) +(assert_return (invoke "max" (f64.const 0x1p+0) (f64.const inf)) (f64.const inf)) (assert_return_canonical_nan (invoke "max" (f64.const -0x1p+0) (f64.const -nan))) (assert_return_arithmetic_nan (invoke "max" (f64.const -0x1p+0) (f64.const -nan:0x4000000000000))) (assert_return_canonical_nan (invoke "max" (f64.const -0x1p+0) (f64.const nan))) @@ -2244,10 +2244,10 @@ (assert_return (invoke "max" (f64.const -0x1.921fb54442d18p+2) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x1.fffffffffffffp+1023)) (assert_return (invoke "max" (f64.const 0x1.921fb54442d18p+2) (f64.const -0x1.fffffffffffffp+1023)) (f64.const 0x1.921fb54442d18p+2)) (assert_return (invoke "max" (f64.const 0x1.921fb54442d18p+2) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x1.fffffffffffffp+1023)) -(assert_return (invoke "max" (f64.const -0x1.921fb54442d18p+2) (f64.const -infinity)) (f64.const -0x1.921fb54442d18p+2)) -(assert_return (invoke "max" (f64.const -0x1.921fb54442d18p+2) (f64.const infinity)) (f64.const infinity)) -(assert_return (invoke "max" (f64.const 0x1.921fb54442d18p+2) (f64.const -infinity)) (f64.const 0x1.921fb54442d18p+2)) -(assert_return (invoke "max" (f64.const 0x1.921fb54442d18p+2) (f64.const infinity)) (f64.const infinity)) +(assert_return (invoke "max" (f64.const -0x1.921fb54442d18p+2) (f64.const -inf)) (f64.const -0x1.921fb54442d18p+2)) +(assert_return (invoke "max" (f64.const -0x1.921fb54442d18p+2) (f64.const inf)) (f64.const inf)) +(assert_return (invoke "max" (f64.const 0x1.921fb54442d18p+2) (f64.const -inf)) (f64.const 0x1.921fb54442d18p+2)) +(assert_return (invoke "max" (f64.const 0x1.921fb54442d18p+2) (f64.const inf)) (f64.const inf)) (assert_return_canonical_nan (invoke "max" (f64.const -0x1.921fb54442d18p+2) (f64.const -nan))) (assert_return_arithmetic_nan (invoke "max" (f64.const -0x1.921fb54442d18p+2) (f64.const -nan:0x4000000000000))) (assert_return_canonical_nan (invoke "max" (f64.const -0x1.921fb54442d18p+2) (f64.const nan))) @@ -2284,10 +2284,10 @@ (assert_return (invoke "max" (f64.const -0x1.fffffffffffffp+1023) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x1.fffffffffffffp+1023)) (assert_return (invoke "max" (f64.const 0x1.fffffffffffffp+1023) (f64.const -0x1.fffffffffffffp+1023)) (f64.const 0x1.fffffffffffffp+1023)) (assert_return (invoke "max" (f64.const 0x1.fffffffffffffp+1023) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x1.fffffffffffffp+1023)) -(assert_return (invoke "max" (f64.const -0x1.fffffffffffffp+1023) (f64.const -infinity)) (f64.const -0x1.fffffffffffffp+1023)) -(assert_return (invoke "max" (f64.const -0x1.fffffffffffffp+1023) (f64.const infinity)) (f64.const infinity)) -(assert_return (invoke "max" (f64.const 0x1.fffffffffffffp+1023) (f64.const -infinity)) (f64.const 0x1.fffffffffffffp+1023)) -(assert_return (invoke "max" (f64.const 0x1.fffffffffffffp+1023) (f64.const infinity)) (f64.const infinity)) +(assert_return (invoke "max" (f64.const -0x1.fffffffffffffp+1023) (f64.const -inf)) (f64.const -0x1.fffffffffffffp+1023)) +(assert_return (invoke "max" (f64.const -0x1.fffffffffffffp+1023) (f64.const inf)) (f64.const inf)) +(assert_return (invoke "max" (f64.const 0x1.fffffffffffffp+1023) (f64.const -inf)) (f64.const 0x1.fffffffffffffp+1023)) +(assert_return (invoke "max" (f64.const 0x1.fffffffffffffp+1023) (f64.const inf)) (f64.const inf)) (assert_return_canonical_nan (invoke "max" (f64.const -0x1.fffffffffffffp+1023) (f64.const -nan))) (assert_return_arithmetic_nan (invoke "max" (f64.const -0x1.fffffffffffffp+1023) (f64.const -nan:0x4000000000000))) (assert_return_canonical_nan (invoke "max" (f64.const -0x1.fffffffffffffp+1023) (f64.const nan))) @@ -2296,46 +2296,46 @@ (assert_return_arithmetic_nan (invoke "max" (f64.const 0x1.fffffffffffffp+1023) (f64.const -nan:0x4000000000000))) (assert_return_canonical_nan (invoke "max" (f64.const 0x1.fffffffffffffp+1023) (f64.const nan))) (assert_return_arithmetic_nan (invoke "max" (f64.const 0x1.fffffffffffffp+1023) (f64.const nan:0x4000000000000))) -(assert_return (invoke "max" (f64.const -infinity) (f64.const -0x0p+0)) (f64.const -0x0p+0)) -(assert_return (invoke "max" (f64.const -infinity) (f64.const 0x0p+0)) (f64.const 0x0p+0)) -(assert_return (invoke "max" (f64.const infinity) (f64.const -0x0p+0)) (f64.const infinity)) -(assert_return (invoke "max" (f64.const infinity) (f64.const 0x0p+0)) (f64.const infinity)) -(assert_return (invoke "max" (f64.const -infinity) (f64.const -0x0.0000000000001p-1022)) (f64.const -0x0.0000000000001p-1022)) -(assert_return (invoke "max" (f64.const -infinity) (f64.const 0x0.0000000000001p-1022)) (f64.const 0x0.0000000000001p-1022)) -(assert_return (invoke "max" (f64.const infinity) (f64.const -0x0.0000000000001p-1022)) (f64.const infinity)) -(assert_return (invoke "max" (f64.const infinity) (f64.const 0x0.0000000000001p-1022)) (f64.const infinity)) -(assert_return (invoke "max" (f64.const -infinity) (f64.const -0x1p-1022)) (f64.const -0x1p-1022)) -(assert_return (invoke "max" (f64.const -infinity) (f64.const 0x1p-1022)) (f64.const 0x1p-1022)) -(assert_return (invoke "max" (f64.const infinity) (f64.const -0x1p-1022)) (f64.const infinity)) -(assert_return (invoke "max" (f64.const infinity) (f64.const 0x1p-1022)) (f64.const infinity)) -(assert_return (invoke "max" (f64.const -infinity) (f64.const -0x1p-1)) (f64.const -0x1p-1)) -(assert_return (invoke "max" (f64.const -infinity) (f64.const 0x1p-1)) (f64.const 0x1p-1)) -(assert_return (invoke "max" (f64.const infinity) (f64.const -0x1p-1)) (f64.const infinity)) -(assert_return (invoke "max" (f64.const infinity) (f64.const 0x1p-1)) (f64.const infinity)) -(assert_return (invoke "max" (f64.const -infinity) (f64.const -0x1p+0)) (f64.const -0x1p+0)) -(assert_return (invoke "max" (f64.const -infinity) (f64.const 0x1p+0)) (f64.const 0x1p+0)) -(assert_return (invoke "max" (f64.const infinity) (f64.const -0x1p+0)) (f64.const infinity)) -(assert_return (invoke "max" (f64.const infinity) (f64.const 0x1p+0)) (f64.const infinity)) -(assert_return (invoke "max" (f64.const -infinity) (f64.const -0x1.921fb54442d18p+2)) (f64.const -0x1.921fb54442d18p+2)) -(assert_return (invoke "max" (f64.const -infinity) (f64.const 0x1.921fb54442d18p+2)) (f64.const 0x1.921fb54442d18p+2)) -(assert_return (invoke "max" (f64.const infinity) (f64.const -0x1.921fb54442d18p+2)) (f64.const infinity)) -(assert_return (invoke "max" (f64.const infinity) (f64.const 0x1.921fb54442d18p+2)) (f64.const infinity)) -(assert_return (invoke "max" (f64.const -infinity) (f64.const -0x1.fffffffffffffp+1023)) (f64.const -0x1.fffffffffffffp+1023)) -(assert_return (invoke "max" (f64.const -infinity) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x1.fffffffffffffp+1023)) -(assert_return (invoke "max" (f64.const infinity) (f64.const -0x1.fffffffffffffp+1023)) (f64.const infinity)) -(assert_return (invoke "max" (f64.const infinity) (f64.const 0x1.fffffffffffffp+1023)) (f64.const infinity)) -(assert_return (invoke "max" (f64.const -infinity) (f64.const -infinity)) (f64.const -infinity)) -(assert_return (invoke "max" (f64.const -infinity) (f64.const infinity)) (f64.const infinity)) -(assert_return (invoke "max" (f64.const infinity) (f64.const -infinity)) (f64.const infinity)) -(assert_return (invoke "max" (f64.const infinity) (f64.const infinity)) (f64.const infinity)) -(assert_return_canonical_nan (invoke "max" (f64.const -infinity) (f64.const -nan))) -(assert_return_arithmetic_nan (invoke "max" (f64.const -infinity) (f64.const -nan:0x4000000000000))) -(assert_return_canonical_nan (invoke "max" (f64.const -infinity) (f64.const nan))) -(assert_return_arithmetic_nan (invoke "max" (f64.const -infinity) (f64.const nan:0x4000000000000))) -(assert_return_canonical_nan (invoke "max" (f64.const infinity) (f64.const -nan))) -(assert_return_arithmetic_nan (invoke "max" (f64.const infinity) (f64.const -nan:0x4000000000000))) -(assert_return_canonical_nan (invoke "max" (f64.const infinity) (f64.const nan))) -(assert_return_arithmetic_nan (invoke "max" (f64.const infinity) (f64.const nan:0x4000000000000))) +(assert_return (invoke "max" (f64.const -inf) (f64.const -0x0p+0)) (f64.const -0x0p+0)) +(assert_return (invoke "max" (f64.const -inf) (f64.const 0x0p+0)) (f64.const 0x0p+0)) +(assert_return (invoke "max" (f64.const inf) (f64.const -0x0p+0)) (f64.const inf)) +(assert_return (invoke "max" (f64.const inf) (f64.const 0x0p+0)) (f64.const inf)) +(assert_return (invoke "max" (f64.const -inf) (f64.const -0x0.0000000000001p-1022)) (f64.const -0x0.0000000000001p-1022)) +(assert_return (invoke "max" (f64.const -inf) (f64.const 0x0.0000000000001p-1022)) (f64.const 0x0.0000000000001p-1022)) +(assert_return (invoke "max" (f64.const inf) (f64.const -0x0.0000000000001p-1022)) (f64.const inf)) +(assert_return (invoke "max" (f64.const inf) (f64.const 0x0.0000000000001p-1022)) (f64.const inf)) +(assert_return (invoke "max" (f64.const -inf) (f64.const -0x1p-1022)) (f64.const -0x1p-1022)) +(assert_return (invoke "max" (f64.const -inf) (f64.const 0x1p-1022)) (f64.const 0x1p-1022)) +(assert_return (invoke "max" (f64.const inf) (f64.const -0x1p-1022)) (f64.const inf)) +(assert_return (invoke "max" (f64.const inf) (f64.const 0x1p-1022)) (f64.const inf)) +(assert_return (invoke "max" (f64.const -inf) (f64.const -0x1p-1)) (f64.const -0x1p-1)) +(assert_return (invoke "max" (f64.const -inf) (f64.const 0x1p-1)) (f64.const 0x1p-1)) +(assert_return (invoke "max" (f64.const inf) (f64.const -0x1p-1)) (f64.const inf)) +(assert_return (invoke "max" (f64.const inf) (f64.const 0x1p-1)) (f64.const inf)) +(assert_return (invoke "max" (f64.const -inf) (f64.const -0x1p+0)) (f64.const -0x1p+0)) +(assert_return (invoke "max" (f64.const -inf) (f64.const 0x1p+0)) (f64.const 0x1p+0)) +(assert_return (invoke "max" (f64.const inf) (f64.const -0x1p+0)) (f64.const inf)) +(assert_return (invoke "max" (f64.const inf) (f64.const 0x1p+0)) (f64.const inf)) +(assert_return (invoke "max" (f64.const -inf) (f64.const -0x1.921fb54442d18p+2)) (f64.const -0x1.921fb54442d18p+2)) +(assert_return (invoke "max" (f64.const -inf) (f64.const 0x1.921fb54442d18p+2)) (f64.const 0x1.921fb54442d18p+2)) +(assert_return (invoke "max" (f64.const inf) (f64.const -0x1.921fb54442d18p+2)) (f64.const inf)) +(assert_return (invoke "max" (f64.const inf) (f64.const 0x1.921fb54442d18p+2)) (f64.const inf)) +(assert_return (invoke "max" (f64.const -inf) (f64.const -0x1.fffffffffffffp+1023)) (f64.const -0x1.fffffffffffffp+1023)) +(assert_return (invoke "max" (f64.const -inf) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x1.fffffffffffffp+1023)) +(assert_return (invoke "max" (f64.const inf) (f64.const -0x1.fffffffffffffp+1023)) (f64.const inf)) +(assert_return (invoke "max" (f64.const inf) (f64.const 0x1.fffffffffffffp+1023)) (f64.const inf)) +(assert_return (invoke "max" (f64.const -inf) (f64.const -inf)) (f64.const -inf)) +(assert_return (invoke "max" (f64.const -inf) (f64.const inf)) (f64.const inf)) +(assert_return (invoke "max" (f64.const inf) (f64.const -inf)) (f64.const inf)) +(assert_return (invoke "max" (f64.const inf) (f64.const inf)) (f64.const inf)) +(assert_return_canonical_nan (invoke "max" (f64.const -inf) (f64.const -nan))) +(assert_return_arithmetic_nan (invoke "max" (f64.const -inf) (f64.const -nan:0x4000000000000))) +(assert_return_canonical_nan (invoke "max" (f64.const -inf) (f64.const nan))) +(assert_return_arithmetic_nan (invoke "max" (f64.const -inf) (f64.const nan:0x4000000000000))) +(assert_return_canonical_nan (invoke "max" (f64.const inf) (f64.const -nan))) +(assert_return_arithmetic_nan (invoke "max" (f64.const inf) (f64.const -nan:0x4000000000000))) +(assert_return_canonical_nan (invoke "max" (f64.const inf) (f64.const nan))) +(assert_return_arithmetic_nan (invoke "max" (f64.const inf) (f64.const nan:0x4000000000000))) (assert_return_canonical_nan (invoke "max" (f64.const -nan) (f64.const -0x0p+0))) (assert_return_arithmetic_nan (invoke "max" (f64.const -nan:0x4000000000000) (f64.const -0x0p+0))) (assert_return_canonical_nan (invoke "max" (f64.const -nan) (f64.const 0x0p+0))) @@ -2392,14 +2392,14 @@ (assert_return_arithmetic_nan (invoke "max" (f64.const nan:0x4000000000000) (f64.const -0x1.fffffffffffffp+1023))) (assert_return_canonical_nan (invoke "max" (f64.const nan) (f64.const 0x1.fffffffffffffp+1023))) (assert_return_arithmetic_nan (invoke "max" (f64.const nan:0x4000000000000) (f64.const 0x1.fffffffffffffp+1023))) -(assert_return_canonical_nan (invoke "max" (f64.const -nan) (f64.const -infinity))) -(assert_return_arithmetic_nan (invoke "max" (f64.const -nan:0x4000000000000) (f64.const -infinity))) -(assert_return_canonical_nan (invoke "max" (f64.const -nan) (f64.const infinity))) -(assert_return_arithmetic_nan (invoke "max" (f64.const -nan:0x4000000000000) (f64.const infinity))) -(assert_return_canonical_nan (invoke "max" (f64.const nan) (f64.const -infinity))) -(assert_return_arithmetic_nan (invoke "max" (f64.const nan:0x4000000000000) (f64.const -infinity))) -(assert_return_canonical_nan (invoke "max" (f64.const nan) (f64.const infinity))) -(assert_return_arithmetic_nan (invoke "max" (f64.const nan:0x4000000000000) (f64.const infinity))) +(assert_return_canonical_nan (invoke "max" (f64.const -nan) (f64.const -inf))) +(assert_return_arithmetic_nan (invoke "max" (f64.const -nan:0x4000000000000) (f64.const -inf))) +(assert_return_canonical_nan (invoke "max" (f64.const -nan) (f64.const inf))) +(assert_return_arithmetic_nan (invoke "max" (f64.const -nan:0x4000000000000) (f64.const inf))) +(assert_return_canonical_nan (invoke "max" (f64.const nan) (f64.const -inf))) +(assert_return_arithmetic_nan (invoke "max" (f64.const nan:0x4000000000000) (f64.const -inf))) +(assert_return_canonical_nan (invoke "max" (f64.const nan) (f64.const inf))) +(assert_return_arithmetic_nan (invoke "max" (f64.const nan:0x4000000000000) (f64.const inf))) (assert_return_canonical_nan (invoke "max" (f64.const -nan) (f64.const -nan))) (assert_return_arithmetic_nan (invoke "max" (f64.const -nan:0x4000000000000) (f64.const -nan))) (assert_return_arithmetic_nan (invoke "max" (f64.const -nan) (f64.const -nan:0x4000000000000))) @@ -2430,8 +2430,8 @@ (assert_return (invoke "sqrt" (f64.const 0x1.921fb54442d18p+2)) (f64.const 0x1.40d931ff62705p+1)) (assert_return_canonical_nan (invoke "sqrt" (f64.const -0x1.fffffffffffffp+1023))) (assert_return (invoke "sqrt" (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x1.fffffffffffffp+511)) -(assert_return_canonical_nan (invoke "sqrt" (f64.const -infinity))) -(assert_return (invoke "sqrt" (f64.const infinity)) (f64.const infinity)) +(assert_return_canonical_nan (invoke "sqrt" (f64.const -inf))) +(assert_return (invoke "sqrt" (f64.const inf)) (f64.const inf)) (assert_return_canonical_nan (invoke "sqrt" (f64.const -nan))) (assert_return_arithmetic_nan (invoke "sqrt" (f64.const -nan:0x4000000000000))) (assert_return_canonical_nan (invoke "sqrt" (f64.const nan))) @@ -2450,8 +2450,8 @@ (assert_return (invoke "floor" (f64.const 0x1.921fb54442d18p+2)) (f64.const 0x1.8p+2)) (assert_return (invoke "floor" (f64.const -0x1.fffffffffffffp+1023)) (f64.const -0x1.fffffffffffffp+1023)) (assert_return (invoke "floor" (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x1.fffffffffffffp+1023)) -(assert_return (invoke "floor" (f64.const -infinity)) (f64.const -infinity)) -(assert_return (invoke "floor" (f64.const infinity)) (f64.const infinity)) +(assert_return (invoke "floor" (f64.const -inf)) (f64.const -inf)) +(assert_return (invoke "floor" (f64.const inf)) (f64.const inf)) (assert_return_canonical_nan (invoke "floor" (f64.const -nan))) (assert_return_arithmetic_nan (invoke "floor" (f64.const -nan:0x4000000000000))) (assert_return_canonical_nan (invoke "floor" (f64.const nan))) @@ -2470,8 +2470,8 @@ (assert_return (invoke "ceil" (f64.const 0x1.921fb54442d18p+2)) (f64.const 0x1.cp+2)) (assert_return (invoke "ceil" (f64.const -0x1.fffffffffffffp+1023)) (f64.const -0x1.fffffffffffffp+1023)) (assert_return (invoke "ceil" (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x1.fffffffffffffp+1023)) -(assert_return (invoke "ceil" (f64.const -infinity)) (f64.const -infinity)) -(assert_return (invoke "ceil" (f64.const infinity)) (f64.const infinity)) +(assert_return (invoke "ceil" (f64.const -inf)) (f64.const -inf)) +(assert_return (invoke "ceil" (f64.const inf)) (f64.const inf)) (assert_return_canonical_nan (invoke "ceil" (f64.const -nan))) (assert_return_arithmetic_nan (invoke "ceil" (f64.const -nan:0x4000000000000))) (assert_return_canonical_nan (invoke "ceil" (f64.const nan))) @@ -2490,8 +2490,8 @@ (assert_return (invoke "trunc" (f64.const 0x1.921fb54442d18p+2)) (f64.const 0x1.8p+2)) (assert_return (invoke "trunc" (f64.const -0x1.fffffffffffffp+1023)) (f64.const -0x1.fffffffffffffp+1023)) (assert_return (invoke "trunc" (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x1.fffffffffffffp+1023)) -(assert_return (invoke "trunc" (f64.const -infinity)) (f64.const -infinity)) -(assert_return (invoke "trunc" (f64.const infinity)) (f64.const infinity)) +(assert_return (invoke "trunc" (f64.const -inf)) (f64.const -inf)) +(assert_return (invoke "trunc" (f64.const inf)) (f64.const inf)) (assert_return_canonical_nan (invoke "trunc" (f64.const -nan))) (assert_return_arithmetic_nan (invoke "trunc" (f64.const -nan:0x4000000000000))) (assert_return_canonical_nan (invoke "trunc" (f64.const nan))) @@ -2510,9 +2510,24 @@ (assert_return (invoke "nearest" (f64.const 0x1.921fb54442d18p+2)) (f64.const 0x1.8p+2)) (assert_return (invoke "nearest" (f64.const -0x1.fffffffffffffp+1023)) (f64.const -0x1.fffffffffffffp+1023)) (assert_return (invoke "nearest" (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x1.fffffffffffffp+1023)) -(assert_return (invoke "nearest" (f64.const -infinity)) (f64.const -infinity)) -(assert_return (invoke "nearest" (f64.const infinity)) (f64.const infinity)) +(assert_return (invoke "nearest" (f64.const -inf)) (f64.const -inf)) +(assert_return (invoke "nearest" (f64.const inf)) (f64.const inf)) (assert_return_canonical_nan (invoke "nearest" (f64.const -nan))) (assert_return_arithmetic_nan (invoke "nearest" (f64.const -nan:0x4000000000000))) (assert_return_canonical_nan (invoke "nearest" (f64.const nan))) (assert_return_arithmetic_nan (invoke "nearest" (f64.const nan:0x4000000000000))) + + +;; Type check + +(assert_invalid (module (func (result f64) (f64.add (i64.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result f64) (f64.div (i64.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result f64) (f64.max (i64.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result f64) (f64.min (i64.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result f64) (f64.mul (i64.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result f64) (f64.sub (i64.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result f64) (f64.ceil (i64.const 0)))) "type mismatch") +(assert_invalid (module (func (result f64) (f64.floor (i64.const 0)))) "type mismatch") +(assert_invalid (module (func (result f64) (f64.nearest (i64.const 0)))) "type mismatch") +(assert_invalid (module (func (result f64) (f64.sqrt (i64.const 0)))) "type mismatch") +(assert_invalid (module (func (result f64) (f64.trunc (i64.const 0)))) "type mismatch") diff --git a/test/core/f64_bitwise.wast b/test/core/f64_bitwise.wast index 5b719a6e..f268a3e1 100644 --- a/test/core/f64_bitwise.wast +++ b/test/core/f64_bitwise.wast @@ -2,9 +2,9 @@ ;; values. (module - (func (export "abs") (param $x f64) (result f64) (f64.abs (get_local $x))) - (func (export "neg") (param $x f64) (result f64) (f64.neg (get_local $x))) - (func (export "copysign") (param $x f64) (param $y f64) (result f64) (f64.copysign (get_local $x) (get_local $y))) + (func (export "abs") (param $x f64) (result f64) (f64.abs (local.get $x))) + (func (export "neg") (param $x f64) (result f64) (f64.neg (local.get $x))) + (func (export "copysign") (param $x f64) (param $y f64) (result f64) (f64.copysign (local.get $x) (local.get $y))) ) (assert_return (invoke "copysign" (f64.const -0x0p+0) (f64.const -0x0p+0)) (f64.const -0x0p+0)) @@ -35,10 +35,10 @@ (assert_return (invoke "copysign" (f64.const -0x0p+0) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x0p+0)) (assert_return (invoke "copysign" (f64.const 0x0p+0) (f64.const -0x1.fffffffffffffp+1023)) (f64.const -0x0p+0)) (assert_return (invoke "copysign" (f64.const 0x0p+0) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x0p+0)) -(assert_return (invoke "copysign" (f64.const -0x0p+0) (f64.const -infinity)) (f64.const -0x0p+0)) -(assert_return (invoke "copysign" (f64.const -0x0p+0) (f64.const infinity)) (f64.const 0x0p+0)) -(assert_return (invoke "copysign" (f64.const 0x0p+0) (f64.const -infinity)) (f64.const -0x0p+0)) -(assert_return (invoke "copysign" (f64.const 0x0p+0) (f64.const infinity)) (f64.const 0x0p+0)) +(assert_return (invoke "copysign" (f64.const -0x0p+0) (f64.const -inf)) (f64.const -0x0p+0)) +(assert_return (invoke "copysign" (f64.const -0x0p+0) (f64.const inf)) (f64.const 0x0p+0)) +(assert_return (invoke "copysign" (f64.const 0x0p+0) (f64.const -inf)) (f64.const -0x0p+0)) +(assert_return (invoke "copysign" (f64.const 0x0p+0) (f64.const inf)) (f64.const 0x0p+0)) (assert_return (invoke "copysign" (f64.const -0x0p+0) (f64.const -nan)) (f64.const -0x0p+0)) (assert_return (invoke "copysign" (f64.const -0x0p+0) (f64.const nan)) (f64.const 0x0p+0)) (assert_return (invoke "copysign" (f64.const 0x0p+0) (f64.const -nan)) (f64.const -0x0p+0)) @@ -71,10 +71,10 @@ (assert_return (invoke "copysign" (f64.const -0x0.0000000000001p-1022) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x0.0000000000001p-1022)) (assert_return (invoke "copysign" (f64.const 0x0.0000000000001p-1022) (f64.const -0x1.fffffffffffffp+1023)) (f64.const -0x0.0000000000001p-1022)) (assert_return (invoke "copysign" (f64.const 0x0.0000000000001p-1022) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x0.0000000000001p-1022)) -(assert_return (invoke "copysign" (f64.const -0x0.0000000000001p-1022) (f64.const -infinity)) (f64.const -0x0.0000000000001p-1022)) -(assert_return (invoke "copysign" (f64.const -0x0.0000000000001p-1022) (f64.const infinity)) (f64.const 0x0.0000000000001p-1022)) -(assert_return (invoke "copysign" (f64.const 0x0.0000000000001p-1022) (f64.const -infinity)) (f64.const -0x0.0000000000001p-1022)) -(assert_return (invoke "copysign" (f64.const 0x0.0000000000001p-1022) (f64.const infinity)) (f64.const 0x0.0000000000001p-1022)) +(assert_return (invoke "copysign" (f64.const -0x0.0000000000001p-1022) (f64.const -inf)) (f64.const -0x0.0000000000001p-1022)) +(assert_return (invoke "copysign" (f64.const -0x0.0000000000001p-1022) (f64.const inf)) (f64.const 0x0.0000000000001p-1022)) +(assert_return (invoke "copysign" (f64.const 0x0.0000000000001p-1022) (f64.const -inf)) (f64.const -0x0.0000000000001p-1022)) +(assert_return (invoke "copysign" (f64.const 0x0.0000000000001p-1022) (f64.const inf)) (f64.const 0x0.0000000000001p-1022)) (assert_return (invoke "copysign" (f64.const -0x0.0000000000001p-1022) (f64.const -nan)) (f64.const -0x0.0000000000001p-1022)) (assert_return (invoke "copysign" (f64.const -0x0.0000000000001p-1022) (f64.const nan)) (f64.const 0x0.0000000000001p-1022)) (assert_return (invoke "copysign" (f64.const 0x0.0000000000001p-1022) (f64.const -nan)) (f64.const -0x0.0000000000001p-1022)) @@ -107,10 +107,10 @@ (assert_return (invoke "copysign" (f64.const -0x1p-1022) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x1p-1022)) (assert_return (invoke "copysign" (f64.const 0x1p-1022) (f64.const -0x1.fffffffffffffp+1023)) (f64.const -0x1p-1022)) (assert_return (invoke "copysign" (f64.const 0x1p-1022) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x1p-1022)) -(assert_return (invoke "copysign" (f64.const -0x1p-1022) (f64.const -infinity)) (f64.const -0x1p-1022)) -(assert_return (invoke "copysign" (f64.const -0x1p-1022) (f64.const infinity)) (f64.const 0x1p-1022)) -(assert_return (invoke "copysign" (f64.const 0x1p-1022) (f64.const -infinity)) (f64.const -0x1p-1022)) -(assert_return (invoke "copysign" (f64.const 0x1p-1022) (f64.const infinity)) (f64.const 0x1p-1022)) +(assert_return (invoke "copysign" (f64.const -0x1p-1022) (f64.const -inf)) (f64.const -0x1p-1022)) +(assert_return (invoke "copysign" (f64.const -0x1p-1022) (f64.const inf)) (f64.const 0x1p-1022)) +(assert_return (invoke "copysign" (f64.const 0x1p-1022) (f64.const -inf)) (f64.const -0x1p-1022)) +(assert_return (invoke "copysign" (f64.const 0x1p-1022) (f64.const inf)) (f64.const 0x1p-1022)) (assert_return (invoke "copysign" (f64.const -0x1p-1022) (f64.const -nan)) (f64.const -0x1p-1022)) (assert_return (invoke "copysign" (f64.const -0x1p-1022) (f64.const nan)) (f64.const 0x1p-1022)) (assert_return (invoke "copysign" (f64.const 0x1p-1022) (f64.const -nan)) (f64.const -0x1p-1022)) @@ -143,10 +143,10 @@ (assert_return (invoke "copysign" (f64.const -0x1p-1) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x1p-1)) (assert_return (invoke "copysign" (f64.const 0x1p-1) (f64.const -0x1.fffffffffffffp+1023)) (f64.const -0x1p-1)) (assert_return (invoke "copysign" (f64.const 0x1p-1) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x1p-1)) -(assert_return (invoke "copysign" (f64.const -0x1p-1) (f64.const -infinity)) (f64.const -0x1p-1)) -(assert_return (invoke "copysign" (f64.const -0x1p-1) (f64.const infinity)) (f64.const 0x1p-1)) -(assert_return (invoke "copysign" (f64.const 0x1p-1) (f64.const -infinity)) (f64.const -0x1p-1)) -(assert_return (invoke "copysign" (f64.const 0x1p-1) (f64.const infinity)) (f64.const 0x1p-1)) +(assert_return (invoke "copysign" (f64.const -0x1p-1) (f64.const -inf)) (f64.const -0x1p-1)) +(assert_return (invoke "copysign" (f64.const -0x1p-1) (f64.const inf)) (f64.const 0x1p-1)) +(assert_return (invoke "copysign" (f64.const 0x1p-1) (f64.const -inf)) (f64.const -0x1p-1)) +(assert_return (invoke "copysign" (f64.const 0x1p-1) (f64.const inf)) (f64.const 0x1p-1)) (assert_return (invoke "copysign" (f64.const -0x1p-1) (f64.const -nan)) (f64.const -0x1p-1)) (assert_return (invoke "copysign" (f64.const -0x1p-1) (f64.const nan)) (f64.const 0x1p-1)) (assert_return (invoke "copysign" (f64.const 0x1p-1) (f64.const -nan)) (f64.const -0x1p-1)) @@ -179,10 +179,10 @@ (assert_return (invoke "copysign" (f64.const -0x1p+0) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x1p+0)) (assert_return (invoke "copysign" (f64.const 0x1p+0) (f64.const -0x1.fffffffffffffp+1023)) (f64.const -0x1p+0)) (assert_return (invoke "copysign" (f64.const 0x1p+0) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x1p+0)) -(assert_return (invoke "copysign" (f64.const -0x1p+0) (f64.const -infinity)) (f64.const -0x1p+0)) -(assert_return (invoke "copysign" (f64.const -0x1p+0) (f64.const infinity)) (f64.const 0x1p+0)) -(assert_return (invoke "copysign" (f64.const 0x1p+0) (f64.const -infinity)) (f64.const -0x1p+0)) -(assert_return (invoke "copysign" (f64.const 0x1p+0) (f64.const infinity)) (f64.const 0x1p+0)) +(assert_return (invoke "copysign" (f64.const -0x1p+0) (f64.const -inf)) (f64.const -0x1p+0)) +(assert_return (invoke "copysign" (f64.const -0x1p+0) (f64.const inf)) (f64.const 0x1p+0)) +(assert_return (invoke "copysign" (f64.const 0x1p+0) (f64.const -inf)) (f64.const -0x1p+0)) +(assert_return (invoke "copysign" (f64.const 0x1p+0) (f64.const inf)) (f64.const 0x1p+0)) (assert_return (invoke "copysign" (f64.const -0x1p+0) (f64.const -nan)) (f64.const -0x1p+0)) (assert_return (invoke "copysign" (f64.const -0x1p+0) (f64.const nan)) (f64.const 0x1p+0)) (assert_return (invoke "copysign" (f64.const 0x1p+0) (f64.const -nan)) (f64.const -0x1p+0)) @@ -215,10 +215,10 @@ (assert_return (invoke "copysign" (f64.const -0x1.921fb54442d18p+2) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x1.921fb54442d18p+2)) (assert_return (invoke "copysign" (f64.const 0x1.921fb54442d18p+2) (f64.const -0x1.fffffffffffffp+1023)) (f64.const -0x1.921fb54442d18p+2)) (assert_return (invoke "copysign" (f64.const 0x1.921fb54442d18p+2) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x1.921fb54442d18p+2)) -(assert_return (invoke "copysign" (f64.const -0x1.921fb54442d18p+2) (f64.const -infinity)) (f64.const -0x1.921fb54442d18p+2)) -(assert_return (invoke "copysign" (f64.const -0x1.921fb54442d18p+2) (f64.const infinity)) (f64.const 0x1.921fb54442d18p+2)) -(assert_return (invoke "copysign" (f64.const 0x1.921fb54442d18p+2) (f64.const -infinity)) (f64.const -0x1.921fb54442d18p+2)) -(assert_return (invoke "copysign" (f64.const 0x1.921fb54442d18p+2) (f64.const infinity)) (f64.const 0x1.921fb54442d18p+2)) +(assert_return (invoke "copysign" (f64.const -0x1.921fb54442d18p+2) (f64.const -inf)) (f64.const -0x1.921fb54442d18p+2)) +(assert_return (invoke "copysign" (f64.const -0x1.921fb54442d18p+2) (f64.const inf)) (f64.const 0x1.921fb54442d18p+2)) +(assert_return (invoke "copysign" (f64.const 0x1.921fb54442d18p+2) (f64.const -inf)) (f64.const -0x1.921fb54442d18p+2)) +(assert_return (invoke "copysign" (f64.const 0x1.921fb54442d18p+2) (f64.const inf)) (f64.const 0x1.921fb54442d18p+2)) (assert_return (invoke "copysign" (f64.const -0x1.921fb54442d18p+2) (f64.const -nan)) (f64.const -0x1.921fb54442d18p+2)) (assert_return (invoke "copysign" (f64.const -0x1.921fb54442d18p+2) (f64.const nan)) (f64.const 0x1.921fb54442d18p+2)) (assert_return (invoke "copysign" (f64.const 0x1.921fb54442d18p+2) (f64.const -nan)) (f64.const -0x1.921fb54442d18p+2)) @@ -251,50 +251,50 @@ (assert_return (invoke "copysign" (f64.const -0x1.fffffffffffffp+1023) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x1.fffffffffffffp+1023)) (assert_return (invoke "copysign" (f64.const 0x1.fffffffffffffp+1023) (f64.const -0x1.fffffffffffffp+1023)) (f64.const -0x1.fffffffffffffp+1023)) (assert_return (invoke "copysign" (f64.const 0x1.fffffffffffffp+1023) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x1.fffffffffffffp+1023)) -(assert_return (invoke "copysign" (f64.const -0x1.fffffffffffffp+1023) (f64.const -infinity)) (f64.const -0x1.fffffffffffffp+1023)) -(assert_return (invoke "copysign" (f64.const -0x1.fffffffffffffp+1023) (f64.const infinity)) (f64.const 0x1.fffffffffffffp+1023)) -(assert_return (invoke "copysign" (f64.const 0x1.fffffffffffffp+1023) (f64.const -infinity)) (f64.const -0x1.fffffffffffffp+1023)) -(assert_return (invoke "copysign" (f64.const 0x1.fffffffffffffp+1023) (f64.const infinity)) (f64.const 0x1.fffffffffffffp+1023)) +(assert_return (invoke "copysign" (f64.const -0x1.fffffffffffffp+1023) (f64.const -inf)) (f64.const -0x1.fffffffffffffp+1023)) +(assert_return (invoke "copysign" (f64.const -0x1.fffffffffffffp+1023) (f64.const inf)) (f64.const 0x1.fffffffffffffp+1023)) +(assert_return (invoke "copysign" (f64.const 0x1.fffffffffffffp+1023) (f64.const -inf)) (f64.const -0x1.fffffffffffffp+1023)) +(assert_return (invoke "copysign" (f64.const 0x1.fffffffffffffp+1023) (f64.const inf)) (f64.const 0x1.fffffffffffffp+1023)) (assert_return (invoke "copysign" (f64.const -0x1.fffffffffffffp+1023) (f64.const -nan)) (f64.const -0x1.fffffffffffffp+1023)) (assert_return (invoke "copysign" (f64.const -0x1.fffffffffffffp+1023) (f64.const nan)) (f64.const 0x1.fffffffffffffp+1023)) (assert_return (invoke "copysign" (f64.const 0x1.fffffffffffffp+1023) (f64.const -nan)) (f64.const -0x1.fffffffffffffp+1023)) (assert_return (invoke "copysign" (f64.const 0x1.fffffffffffffp+1023) (f64.const nan)) (f64.const 0x1.fffffffffffffp+1023)) -(assert_return (invoke "copysign" (f64.const -infinity) (f64.const -0x0p+0)) (f64.const -infinity)) -(assert_return (invoke "copysign" (f64.const -infinity) (f64.const 0x0p+0)) (f64.const infinity)) -(assert_return (invoke "copysign" (f64.const infinity) (f64.const -0x0p+0)) (f64.const -infinity)) -(assert_return (invoke "copysign" (f64.const infinity) (f64.const 0x0p+0)) (f64.const infinity)) -(assert_return (invoke "copysign" (f64.const -infinity) (f64.const -0x0.0000000000001p-1022)) (f64.const -infinity)) -(assert_return (invoke "copysign" (f64.const -infinity) (f64.const 0x0.0000000000001p-1022)) (f64.const infinity)) -(assert_return (invoke "copysign" (f64.const infinity) (f64.const -0x0.0000000000001p-1022)) (f64.const -infinity)) -(assert_return (invoke "copysign" (f64.const infinity) (f64.const 0x0.0000000000001p-1022)) (f64.const infinity)) -(assert_return (invoke "copysign" (f64.const -infinity) (f64.const -0x1p-1022)) (f64.const -infinity)) -(assert_return (invoke "copysign" (f64.const -infinity) (f64.const 0x1p-1022)) (f64.const infinity)) -(assert_return (invoke "copysign" (f64.const infinity) (f64.const -0x1p-1022)) (f64.const -infinity)) -(assert_return (invoke "copysign" (f64.const infinity) (f64.const 0x1p-1022)) (f64.const infinity)) -(assert_return (invoke "copysign" (f64.const -infinity) (f64.const -0x1p-1)) (f64.const -infinity)) -(assert_return (invoke "copysign" (f64.const -infinity) (f64.const 0x1p-1)) (f64.const infinity)) -(assert_return (invoke "copysign" (f64.const infinity) (f64.const -0x1p-1)) (f64.const -infinity)) -(assert_return (invoke "copysign" (f64.const infinity) (f64.const 0x1p-1)) (f64.const infinity)) -(assert_return (invoke "copysign" (f64.const -infinity) (f64.const -0x1p+0)) (f64.const -infinity)) -(assert_return (invoke "copysign" (f64.const -infinity) (f64.const 0x1p+0)) (f64.const infinity)) -(assert_return (invoke "copysign" (f64.const infinity) (f64.const -0x1p+0)) (f64.const -infinity)) -(assert_return (invoke "copysign" (f64.const infinity) (f64.const 0x1p+0)) (f64.const infinity)) -(assert_return (invoke "copysign" (f64.const -infinity) (f64.const -0x1.921fb54442d18p+2)) (f64.const -infinity)) -(assert_return (invoke "copysign" (f64.const -infinity) (f64.const 0x1.921fb54442d18p+2)) (f64.const infinity)) -(assert_return (invoke "copysign" (f64.const infinity) (f64.const -0x1.921fb54442d18p+2)) (f64.const -infinity)) -(assert_return (invoke "copysign" (f64.const infinity) (f64.const 0x1.921fb54442d18p+2)) (f64.const infinity)) -(assert_return (invoke "copysign" (f64.const -infinity) (f64.const -0x1.fffffffffffffp+1023)) (f64.const -infinity)) -(assert_return (invoke "copysign" (f64.const -infinity) (f64.const 0x1.fffffffffffffp+1023)) (f64.const infinity)) -(assert_return (invoke "copysign" (f64.const infinity) (f64.const -0x1.fffffffffffffp+1023)) (f64.const -infinity)) -(assert_return (invoke "copysign" (f64.const infinity) (f64.const 0x1.fffffffffffffp+1023)) (f64.const infinity)) -(assert_return (invoke "copysign" (f64.const -infinity) (f64.const -infinity)) (f64.const -infinity)) -(assert_return (invoke "copysign" (f64.const -infinity) (f64.const infinity)) (f64.const infinity)) -(assert_return (invoke "copysign" (f64.const infinity) (f64.const -infinity)) (f64.const -infinity)) -(assert_return (invoke "copysign" (f64.const infinity) (f64.const infinity)) (f64.const infinity)) -(assert_return (invoke "copysign" (f64.const -infinity) (f64.const -nan)) (f64.const -infinity)) -(assert_return (invoke "copysign" (f64.const -infinity) (f64.const nan)) (f64.const infinity)) -(assert_return (invoke "copysign" (f64.const infinity) (f64.const -nan)) (f64.const -infinity)) -(assert_return (invoke "copysign" (f64.const infinity) (f64.const nan)) (f64.const infinity)) +(assert_return (invoke "copysign" (f64.const -inf) (f64.const -0x0p+0)) (f64.const -inf)) +(assert_return (invoke "copysign" (f64.const -inf) (f64.const 0x0p+0)) (f64.const inf)) +(assert_return (invoke "copysign" (f64.const inf) (f64.const -0x0p+0)) (f64.const -inf)) +(assert_return (invoke "copysign" (f64.const inf) (f64.const 0x0p+0)) (f64.const inf)) +(assert_return (invoke "copysign" (f64.const -inf) (f64.const -0x0.0000000000001p-1022)) (f64.const -inf)) +(assert_return (invoke "copysign" (f64.const -inf) (f64.const 0x0.0000000000001p-1022)) (f64.const inf)) +(assert_return (invoke "copysign" (f64.const inf) (f64.const -0x0.0000000000001p-1022)) (f64.const -inf)) +(assert_return (invoke "copysign" (f64.const inf) (f64.const 0x0.0000000000001p-1022)) (f64.const inf)) +(assert_return (invoke "copysign" (f64.const -inf) (f64.const -0x1p-1022)) (f64.const -inf)) +(assert_return (invoke "copysign" (f64.const -inf) (f64.const 0x1p-1022)) (f64.const inf)) +(assert_return (invoke "copysign" (f64.const inf) (f64.const -0x1p-1022)) (f64.const -inf)) +(assert_return (invoke "copysign" (f64.const inf) (f64.const 0x1p-1022)) (f64.const inf)) +(assert_return (invoke "copysign" (f64.const -inf) (f64.const -0x1p-1)) (f64.const -inf)) +(assert_return (invoke "copysign" (f64.const -inf) (f64.const 0x1p-1)) (f64.const inf)) +(assert_return (invoke "copysign" (f64.const inf) (f64.const -0x1p-1)) (f64.const -inf)) +(assert_return (invoke "copysign" (f64.const inf) (f64.const 0x1p-1)) (f64.const inf)) +(assert_return (invoke "copysign" (f64.const -inf) (f64.const -0x1p+0)) (f64.const -inf)) +(assert_return (invoke "copysign" (f64.const -inf) (f64.const 0x1p+0)) (f64.const inf)) +(assert_return (invoke "copysign" (f64.const inf) (f64.const -0x1p+0)) (f64.const -inf)) +(assert_return (invoke "copysign" (f64.const inf) (f64.const 0x1p+0)) (f64.const inf)) +(assert_return (invoke "copysign" (f64.const -inf) (f64.const -0x1.921fb54442d18p+2)) (f64.const -inf)) +(assert_return (invoke "copysign" (f64.const -inf) (f64.const 0x1.921fb54442d18p+2)) (f64.const inf)) +(assert_return (invoke "copysign" (f64.const inf) (f64.const -0x1.921fb54442d18p+2)) (f64.const -inf)) +(assert_return (invoke "copysign" (f64.const inf) (f64.const 0x1.921fb54442d18p+2)) (f64.const inf)) +(assert_return (invoke "copysign" (f64.const -inf) (f64.const -0x1.fffffffffffffp+1023)) (f64.const -inf)) +(assert_return (invoke "copysign" (f64.const -inf) (f64.const 0x1.fffffffffffffp+1023)) (f64.const inf)) +(assert_return (invoke "copysign" (f64.const inf) (f64.const -0x1.fffffffffffffp+1023)) (f64.const -inf)) +(assert_return (invoke "copysign" (f64.const inf) (f64.const 0x1.fffffffffffffp+1023)) (f64.const inf)) +(assert_return (invoke "copysign" (f64.const -inf) (f64.const -inf)) (f64.const -inf)) +(assert_return (invoke "copysign" (f64.const -inf) (f64.const inf)) (f64.const inf)) +(assert_return (invoke "copysign" (f64.const inf) (f64.const -inf)) (f64.const -inf)) +(assert_return (invoke "copysign" (f64.const inf) (f64.const inf)) (f64.const inf)) +(assert_return (invoke "copysign" (f64.const -inf) (f64.const -nan)) (f64.const -inf)) +(assert_return (invoke "copysign" (f64.const -inf) (f64.const nan)) (f64.const inf)) +(assert_return (invoke "copysign" (f64.const inf) (f64.const -nan)) (f64.const -inf)) +(assert_return (invoke "copysign" (f64.const inf) (f64.const nan)) (f64.const inf)) (assert_return (invoke "copysign" (f64.const -nan) (f64.const -0x0p+0)) (f64.const -nan)) (assert_return (invoke "copysign" (f64.const -nan) (f64.const 0x0p+0)) (f64.const nan)) (assert_return (invoke "copysign" (f64.const nan) (f64.const -0x0p+0)) (f64.const -nan)) @@ -323,10 +323,10 @@ (assert_return (invoke "copysign" (f64.const -nan) (f64.const 0x1.fffffffffffffp+1023)) (f64.const nan)) (assert_return (invoke "copysign" (f64.const nan) (f64.const -0x1.fffffffffffffp+1023)) (f64.const -nan)) (assert_return (invoke "copysign" (f64.const nan) (f64.const 0x1.fffffffffffffp+1023)) (f64.const nan)) -(assert_return (invoke "copysign" (f64.const -nan) (f64.const -infinity)) (f64.const -nan)) -(assert_return (invoke "copysign" (f64.const -nan) (f64.const infinity)) (f64.const nan)) -(assert_return (invoke "copysign" (f64.const nan) (f64.const -infinity)) (f64.const -nan)) -(assert_return (invoke "copysign" (f64.const nan) (f64.const infinity)) (f64.const nan)) +(assert_return (invoke "copysign" (f64.const -nan) (f64.const -inf)) (f64.const -nan)) +(assert_return (invoke "copysign" (f64.const -nan) (f64.const inf)) (f64.const nan)) +(assert_return (invoke "copysign" (f64.const nan) (f64.const -inf)) (f64.const -nan)) +(assert_return (invoke "copysign" (f64.const nan) (f64.const inf)) (f64.const nan)) (assert_return (invoke "copysign" (f64.const -nan) (f64.const -nan)) (f64.const -nan)) (assert_return (invoke "copysign" (f64.const -nan) (f64.const nan)) (f64.const nan)) (assert_return (invoke "copysign" (f64.const nan) (f64.const -nan)) (f64.const -nan)) @@ -345,8 +345,8 @@ (assert_return (invoke "abs" (f64.const 0x1.921fb54442d18p+2)) (f64.const 0x1.921fb54442d18p+2)) (assert_return (invoke "abs" (f64.const -0x1.fffffffffffffp+1023)) (f64.const 0x1.fffffffffffffp+1023)) (assert_return (invoke "abs" (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x1.fffffffffffffp+1023)) -(assert_return (invoke "abs" (f64.const -infinity)) (f64.const infinity)) -(assert_return (invoke "abs" (f64.const infinity)) (f64.const infinity)) +(assert_return (invoke "abs" (f64.const -inf)) (f64.const inf)) +(assert_return (invoke "abs" (f64.const inf)) (f64.const inf)) (assert_return (invoke "abs" (f64.const -nan)) (f64.const nan)) (assert_return (invoke "abs" (f64.const nan)) (f64.const nan)) (assert_return (invoke "neg" (f64.const -0x0p+0)) (f64.const 0x0p+0)) @@ -363,7 +363,14 @@ (assert_return (invoke "neg" (f64.const 0x1.921fb54442d18p+2)) (f64.const -0x1.921fb54442d18p+2)) (assert_return (invoke "neg" (f64.const -0x1.fffffffffffffp+1023)) (f64.const 0x1.fffffffffffffp+1023)) (assert_return (invoke "neg" (f64.const 0x1.fffffffffffffp+1023)) (f64.const -0x1.fffffffffffffp+1023)) -(assert_return (invoke "neg" (f64.const -infinity)) (f64.const infinity)) -(assert_return (invoke "neg" (f64.const infinity)) (f64.const -infinity)) +(assert_return (invoke "neg" (f64.const -inf)) (f64.const inf)) +(assert_return (invoke "neg" (f64.const inf)) (f64.const -inf)) (assert_return (invoke "neg" (f64.const -nan)) (f64.const nan)) (assert_return (invoke "neg" (f64.const nan)) (f64.const -nan)) + + +;; Type check + +(assert_invalid (module (func (result f64) (f64.copysign (i64.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result f64) (f64.abs (i64.const 0)))) "type mismatch") +(assert_invalid (module (func (result f64) (f64.neg (i64.const 0)))) "type mismatch") diff --git a/test/core/f64_cmp.wast b/test/core/f64_cmp.wast index 1c22dc41..dd79929d 100644 --- a/test/core/f64_cmp.wast +++ b/test/core/f64_cmp.wast @@ -2,12 +2,12 @@ ;; special values. (module - (func (export "eq") (param $x f64) (param $y f64) (result i32) (f64.eq (get_local $x) (get_local $y))) - (func (export "ne") (param $x f64) (param $y f64) (result i32) (f64.ne (get_local $x) (get_local $y))) - (func (export "lt") (param $x f64) (param $y f64) (result i32) (f64.lt (get_local $x) (get_local $y))) - (func (export "le") (param $x f64) (param $y f64) (result i32) (f64.le (get_local $x) (get_local $y))) - (func (export "gt") (param $x f64) (param $y f64) (result i32) (f64.gt (get_local $x) (get_local $y))) - (func (export "ge") (param $x f64) (param $y f64) (result i32) (f64.ge (get_local $x) (get_local $y))) + (func (export "eq") (param $x f64) (param $y f64) (result i32) (f64.eq (local.get $x) (local.get $y))) + (func (export "ne") (param $x f64) (param $y f64) (result i32) (f64.ne (local.get $x) (local.get $y))) + (func (export "lt") (param $x f64) (param $y f64) (result i32) (f64.lt (local.get $x) (local.get $y))) + (func (export "le") (param $x f64) (param $y f64) (result i32) (f64.le (local.get $x) (local.get $y))) + (func (export "gt") (param $x f64) (param $y f64) (result i32) (f64.gt (local.get $x) (local.get $y))) + (func (export "ge") (param $x f64) (param $y f64) (result i32) (f64.ge (local.get $x) (local.get $y))) ) (assert_return (invoke "eq" (f64.const -0x0p+0) (f64.const -0x0p+0)) (i32.const 1)) @@ -38,10 +38,10 @@ (assert_return (invoke "eq" (f64.const -0x0p+0) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) (assert_return (invoke "eq" (f64.const 0x0p+0) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 0)) (assert_return (invoke "eq" (f64.const 0x0p+0) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const -0x0p+0) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const -0x0p+0) (f64.const infinity)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const 0x0p+0) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const 0x0p+0) (f64.const infinity)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const -0x0p+0) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const -0x0p+0) (f64.const inf)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const 0x0p+0) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const 0x0p+0) (f64.const inf)) (i32.const 0)) (assert_return (invoke "eq" (f64.const -0x0p+0) (f64.const -nan)) (i32.const 0)) (assert_return (invoke "eq" (f64.const -0x0p+0) (f64.const -nan:0x4000000000000)) (i32.const 0)) (assert_return (invoke "eq" (f64.const -0x0p+0) (f64.const nan)) (i32.const 0)) @@ -78,10 +78,10 @@ (assert_return (invoke "eq" (f64.const -0x0.0000000000001p-1022) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) (assert_return (invoke "eq" (f64.const 0x0.0000000000001p-1022) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 0)) (assert_return (invoke "eq" (f64.const 0x0.0000000000001p-1022) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const -0x0.0000000000001p-1022) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const -0x0.0000000000001p-1022) (f64.const infinity)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const 0x0.0000000000001p-1022) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const 0x0.0000000000001p-1022) (f64.const infinity)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const -0x0.0000000000001p-1022) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const -0x0.0000000000001p-1022) (f64.const inf)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const 0x0.0000000000001p-1022) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const 0x0.0000000000001p-1022) (f64.const inf)) (i32.const 0)) (assert_return (invoke "eq" (f64.const -0x0.0000000000001p-1022) (f64.const -nan)) (i32.const 0)) (assert_return (invoke "eq" (f64.const -0x0.0000000000001p-1022) (f64.const -nan:0x4000000000000)) (i32.const 0)) (assert_return (invoke "eq" (f64.const -0x0.0000000000001p-1022) (f64.const nan)) (i32.const 0)) @@ -118,10 +118,10 @@ (assert_return (invoke "eq" (f64.const -0x1p-1022) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) (assert_return (invoke "eq" (f64.const 0x1p-1022) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 0)) (assert_return (invoke "eq" (f64.const 0x1p-1022) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const -0x1p-1022) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const -0x1p-1022) (f64.const infinity)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const 0x1p-1022) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const 0x1p-1022) (f64.const infinity)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const -0x1p-1022) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const -0x1p-1022) (f64.const inf)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const 0x1p-1022) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const 0x1p-1022) (f64.const inf)) (i32.const 0)) (assert_return (invoke "eq" (f64.const -0x1p-1022) (f64.const -nan)) (i32.const 0)) (assert_return (invoke "eq" (f64.const -0x1p-1022) (f64.const -nan:0x4000000000000)) (i32.const 0)) (assert_return (invoke "eq" (f64.const -0x1p-1022) (f64.const nan)) (i32.const 0)) @@ -158,10 +158,10 @@ (assert_return (invoke "eq" (f64.const -0x1p-1) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) (assert_return (invoke "eq" (f64.const 0x1p-1) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 0)) (assert_return (invoke "eq" (f64.const 0x1p-1) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const -0x1p-1) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const -0x1p-1) (f64.const infinity)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const 0x1p-1) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const 0x1p-1) (f64.const infinity)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const -0x1p-1) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const -0x1p-1) (f64.const inf)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const 0x1p-1) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const 0x1p-1) (f64.const inf)) (i32.const 0)) (assert_return (invoke "eq" (f64.const -0x1p-1) (f64.const -nan)) (i32.const 0)) (assert_return (invoke "eq" (f64.const -0x1p-1) (f64.const -nan:0x4000000000000)) (i32.const 0)) (assert_return (invoke "eq" (f64.const -0x1p-1) (f64.const nan)) (i32.const 0)) @@ -198,10 +198,10 @@ (assert_return (invoke "eq" (f64.const -0x1p+0) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) (assert_return (invoke "eq" (f64.const 0x1p+0) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 0)) (assert_return (invoke "eq" (f64.const 0x1p+0) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const -0x1p+0) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const -0x1p+0) (f64.const infinity)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const 0x1p+0) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const 0x1p+0) (f64.const infinity)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const -0x1p+0) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const -0x1p+0) (f64.const inf)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const 0x1p+0) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const 0x1p+0) (f64.const inf)) (i32.const 0)) (assert_return (invoke "eq" (f64.const -0x1p+0) (f64.const -nan)) (i32.const 0)) (assert_return (invoke "eq" (f64.const -0x1p+0) (f64.const -nan:0x4000000000000)) (i32.const 0)) (assert_return (invoke "eq" (f64.const -0x1p+0) (f64.const nan)) (i32.const 0)) @@ -238,10 +238,10 @@ (assert_return (invoke "eq" (f64.const -0x1.921fb54442d18p+2) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) (assert_return (invoke "eq" (f64.const 0x1.921fb54442d18p+2) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 0)) (assert_return (invoke "eq" (f64.const 0x1.921fb54442d18p+2) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const -0x1.921fb54442d18p+2) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const -0x1.921fb54442d18p+2) (f64.const infinity)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const 0x1.921fb54442d18p+2) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const 0x1.921fb54442d18p+2) (f64.const infinity)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const -0x1.921fb54442d18p+2) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const -0x1.921fb54442d18p+2) (f64.const inf)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const 0x1.921fb54442d18p+2) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const 0x1.921fb54442d18p+2) (f64.const inf)) (i32.const 0)) (assert_return (invoke "eq" (f64.const -0x1.921fb54442d18p+2) (f64.const -nan)) (i32.const 0)) (assert_return (invoke "eq" (f64.const -0x1.921fb54442d18p+2) (f64.const -nan:0x4000000000000)) (i32.const 0)) (assert_return (invoke "eq" (f64.const -0x1.921fb54442d18p+2) (f64.const nan)) (i32.const 0)) @@ -278,10 +278,10 @@ (assert_return (invoke "eq" (f64.const -0x1.fffffffffffffp+1023) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) (assert_return (invoke "eq" (f64.const 0x1.fffffffffffffp+1023) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 0)) (assert_return (invoke "eq" (f64.const 0x1.fffffffffffffp+1023) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 1)) -(assert_return (invoke "eq" (f64.const -0x1.fffffffffffffp+1023) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const -0x1.fffffffffffffp+1023) (f64.const infinity)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const 0x1.fffffffffffffp+1023) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const 0x1.fffffffffffffp+1023) (f64.const infinity)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const -0x1.fffffffffffffp+1023) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const -0x1.fffffffffffffp+1023) (f64.const inf)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const 0x1.fffffffffffffp+1023) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const 0x1.fffffffffffffp+1023) (f64.const inf)) (i32.const 0)) (assert_return (invoke "eq" (f64.const -0x1.fffffffffffffp+1023) (f64.const -nan)) (i32.const 0)) (assert_return (invoke "eq" (f64.const -0x1.fffffffffffffp+1023) (f64.const -nan:0x4000000000000)) (i32.const 0)) (assert_return (invoke "eq" (f64.const -0x1.fffffffffffffp+1023) (f64.const nan)) (i32.const 0)) @@ -290,46 +290,46 @@ (assert_return (invoke "eq" (f64.const 0x1.fffffffffffffp+1023) (f64.const -nan:0x4000000000000)) (i32.const 0)) (assert_return (invoke "eq" (f64.const 0x1.fffffffffffffp+1023) (f64.const nan)) (i32.const 0)) (assert_return (invoke "eq" (f64.const 0x1.fffffffffffffp+1023) (f64.const nan:0x4000000000000)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const -infinity) (f64.const -0x0p+0)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const -infinity) (f64.const 0x0p+0)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const infinity) (f64.const -0x0p+0)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const infinity) (f64.const 0x0p+0)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const -infinity) (f64.const -0x0.0000000000001p-1022)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const -infinity) (f64.const 0x0.0000000000001p-1022)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const infinity) (f64.const -0x0.0000000000001p-1022)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const infinity) (f64.const 0x0.0000000000001p-1022)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const -infinity) (f64.const -0x1p-1022)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const -infinity) (f64.const 0x1p-1022)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const infinity) (f64.const -0x1p-1022)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const infinity) (f64.const 0x1p-1022)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const -infinity) (f64.const -0x1p-1)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const -infinity) (f64.const 0x1p-1)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const infinity) (f64.const -0x1p-1)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const infinity) (f64.const 0x1p-1)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const -infinity) (f64.const -0x1p+0)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const -infinity) (f64.const 0x1p+0)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const infinity) (f64.const -0x1p+0)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const infinity) (f64.const 0x1p+0)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const -infinity) (f64.const -0x1.921fb54442d18p+2)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const -infinity) (f64.const 0x1.921fb54442d18p+2)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const infinity) (f64.const -0x1.921fb54442d18p+2)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const infinity) (f64.const 0x1.921fb54442d18p+2)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const -infinity) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const -infinity) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const infinity) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const infinity) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const -infinity) (f64.const -infinity)) (i32.const 1)) -(assert_return (invoke "eq" (f64.const -infinity) (f64.const infinity)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const infinity) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const infinity) (f64.const infinity)) (i32.const 1)) -(assert_return (invoke "eq" (f64.const -infinity) (f64.const -nan)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const -infinity) (f64.const -nan:0x4000000000000)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const -infinity) (f64.const nan)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const -infinity) (f64.const nan:0x4000000000000)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const infinity) (f64.const -nan)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const infinity) (f64.const -nan:0x4000000000000)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const infinity) (f64.const nan)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const infinity) (f64.const nan:0x4000000000000)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const -inf) (f64.const -0x0p+0)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const -inf) (f64.const 0x0p+0)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const inf) (f64.const -0x0p+0)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const inf) (f64.const 0x0p+0)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const -inf) (f64.const -0x0.0000000000001p-1022)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const -inf) (f64.const 0x0.0000000000001p-1022)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const inf) (f64.const -0x0.0000000000001p-1022)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const inf) (f64.const 0x0.0000000000001p-1022)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const -inf) (f64.const -0x1p-1022)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const -inf) (f64.const 0x1p-1022)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const inf) (f64.const -0x1p-1022)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const inf) (f64.const 0x1p-1022)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const -inf) (f64.const -0x1p-1)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const -inf) (f64.const 0x1p-1)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const inf) (f64.const -0x1p-1)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const inf) (f64.const 0x1p-1)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const -inf) (f64.const -0x1p+0)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const -inf) (f64.const 0x1p+0)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const inf) (f64.const -0x1p+0)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const inf) (f64.const 0x1p+0)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const -inf) (f64.const -0x1.921fb54442d18p+2)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const -inf) (f64.const 0x1.921fb54442d18p+2)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const inf) (f64.const -0x1.921fb54442d18p+2)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const inf) (f64.const 0x1.921fb54442d18p+2)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const -inf) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const -inf) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const inf) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const inf) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const -inf) (f64.const -inf)) (i32.const 1)) +(assert_return (invoke "eq" (f64.const -inf) (f64.const inf)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const inf) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const inf) (f64.const inf)) (i32.const 1)) +(assert_return (invoke "eq" (f64.const -inf) (f64.const -nan)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const -inf) (f64.const -nan:0x4000000000000)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const -inf) (f64.const nan)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const -inf) (f64.const nan:0x4000000000000)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const inf) (f64.const -nan)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const inf) (f64.const -nan:0x4000000000000)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const inf) (f64.const nan)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const inf) (f64.const nan:0x4000000000000)) (i32.const 0)) (assert_return (invoke "eq" (f64.const -nan) (f64.const -0x0p+0)) (i32.const 0)) (assert_return (invoke "eq" (f64.const -nan:0x4000000000000) (f64.const -0x0p+0)) (i32.const 0)) (assert_return (invoke "eq" (f64.const -nan) (f64.const 0x0p+0)) (i32.const 0)) @@ -386,14 +386,14 @@ (assert_return (invoke "eq" (f64.const nan:0x4000000000000) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 0)) (assert_return (invoke "eq" (f64.const nan) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) (assert_return (invoke "eq" (f64.const nan:0x4000000000000) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const -nan) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const -nan:0x4000000000000) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const -nan) (f64.const infinity)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const -nan:0x4000000000000) (f64.const infinity)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const nan) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const nan:0x4000000000000) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const nan) (f64.const infinity)) (i32.const 0)) -(assert_return (invoke "eq" (f64.const nan:0x4000000000000) (f64.const infinity)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const -nan) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const -nan:0x4000000000000) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const -nan) (f64.const inf)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const -nan:0x4000000000000) (f64.const inf)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const nan) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const nan:0x4000000000000) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const nan) (f64.const inf)) (i32.const 0)) +(assert_return (invoke "eq" (f64.const nan:0x4000000000000) (f64.const inf)) (i32.const 0)) (assert_return (invoke "eq" (f64.const -nan) (f64.const -nan)) (i32.const 0)) (assert_return (invoke "eq" (f64.const -nan:0x4000000000000) (f64.const -nan)) (i32.const 0)) (assert_return (invoke "eq" (f64.const -nan) (f64.const -nan:0x4000000000000)) (i32.const 0)) @@ -438,10 +438,10 @@ (assert_return (invoke "ne" (f64.const -0x0p+0) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 1)) (assert_return (invoke "ne" (f64.const 0x0p+0) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 1)) (assert_return (invoke "ne" (f64.const 0x0p+0) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const -0x0p+0) (f64.const -infinity)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const -0x0p+0) (f64.const infinity)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const 0x0p+0) (f64.const -infinity)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const 0x0p+0) (f64.const infinity)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const -0x0p+0) (f64.const -inf)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const -0x0p+0) (f64.const inf)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const 0x0p+0) (f64.const -inf)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const 0x0p+0) (f64.const inf)) (i32.const 1)) (assert_return (invoke "ne" (f64.const -0x0p+0) (f64.const -nan)) (i32.const 1)) (assert_return (invoke "ne" (f64.const -0x0p+0) (f64.const -nan:0x4000000000000)) (i32.const 1)) (assert_return (invoke "ne" (f64.const -0x0p+0) (f64.const nan)) (i32.const 1)) @@ -478,10 +478,10 @@ (assert_return (invoke "ne" (f64.const -0x0.0000000000001p-1022) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 1)) (assert_return (invoke "ne" (f64.const 0x0.0000000000001p-1022) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 1)) (assert_return (invoke "ne" (f64.const 0x0.0000000000001p-1022) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const -0x0.0000000000001p-1022) (f64.const -infinity)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const -0x0.0000000000001p-1022) (f64.const infinity)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const 0x0.0000000000001p-1022) (f64.const -infinity)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const 0x0.0000000000001p-1022) (f64.const infinity)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const -0x0.0000000000001p-1022) (f64.const -inf)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const -0x0.0000000000001p-1022) (f64.const inf)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const 0x0.0000000000001p-1022) (f64.const -inf)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const 0x0.0000000000001p-1022) (f64.const inf)) (i32.const 1)) (assert_return (invoke "ne" (f64.const -0x0.0000000000001p-1022) (f64.const -nan)) (i32.const 1)) (assert_return (invoke "ne" (f64.const -0x0.0000000000001p-1022) (f64.const -nan:0x4000000000000)) (i32.const 1)) (assert_return (invoke "ne" (f64.const -0x0.0000000000001p-1022) (f64.const nan)) (i32.const 1)) @@ -518,10 +518,10 @@ (assert_return (invoke "ne" (f64.const -0x1p-1022) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 1)) (assert_return (invoke "ne" (f64.const 0x1p-1022) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 1)) (assert_return (invoke "ne" (f64.const 0x1p-1022) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const -0x1p-1022) (f64.const -infinity)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const -0x1p-1022) (f64.const infinity)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const 0x1p-1022) (f64.const -infinity)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const 0x1p-1022) (f64.const infinity)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const -0x1p-1022) (f64.const -inf)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const -0x1p-1022) (f64.const inf)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const 0x1p-1022) (f64.const -inf)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const 0x1p-1022) (f64.const inf)) (i32.const 1)) (assert_return (invoke "ne" (f64.const -0x1p-1022) (f64.const -nan)) (i32.const 1)) (assert_return (invoke "ne" (f64.const -0x1p-1022) (f64.const -nan:0x4000000000000)) (i32.const 1)) (assert_return (invoke "ne" (f64.const -0x1p-1022) (f64.const nan)) (i32.const 1)) @@ -558,10 +558,10 @@ (assert_return (invoke "ne" (f64.const -0x1p-1) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 1)) (assert_return (invoke "ne" (f64.const 0x1p-1) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 1)) (assert_return (invoke "ne" (f64.const 0x1p-1) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const -0x1p-1) (f64.const -infinity)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const -0x1p-1) (f64.const infinity)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const 0x1p-1) (f64.const -infinity)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const 0x1p-1) (f64.const infinity)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const -0x1p-1) (f64.const -inf)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const -0x1p-1) (f64.const inf)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const 0x1p-1) (f64.const -inf)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const 0x1p-1) (f64.const inf)) (i32.const 1)) (assert_return (invoke "ne" (f64.const -0x1p-1) (f64.const -nan)) (i32.const 1)) (assert_return (invoke "ne" (f64.const -0x1p-1) (f64.const -nan:0x4000000000000)) (i32.const 1)) (assert_return (invoke "ne" (f64.const -0x1p-1) (f64.const nan)) (i32.const 1)) @@ -598,10 +598,10 @@ (assert_return (invoke "ne" (f64.const -0x1p+0) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 1)) (assert_return (invoke "ne" (f64.const 0x1p+0) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 1)) (assert_return (invoke "ne" (f64.const 0x1p+0) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const -0x1p+0) (f64.const -infinity)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const -0x1p+0) (f64.const infinity)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const 0x1p+0) (f64.const -infinity)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const 0x1p+0) (f64.const infinity)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const -0x1p+0) (f64.const -inf)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const -0x1p+0) (f64.const inf)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const 0x1p+0) (f64.const -inf)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const 0x1p+0) (f64.const inf)) (i32.const 1)) (assert_return (invoke "ne" (f64.const -0x1p+0) (f64.const -nan)) (i32.const 1)) (assert_return (invoke "ne" (f64.const -0x1p+0) (f64.const -nan:0x4000000000000)) (i32.const 1)) (assert_return (invoke "ne" (f64.const -0x1p+0) (f64.const nan)) (i32.const 1)) @@ -638,10 +638,10 @@ (assert_return (invoke "ne" (f64.const -0x1.921fb54442d18p+2) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 1)) (assert_return (invoke "ne" (f64.const 0x1.921fb54442d18p+2) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 1)) (assert_return (invoke "ne" (f64.const 0x1.921fb54442d18p+2) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const -0x1.921fb54442d18p+2) (f64.const -infinity)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const -0x1.921fb54442d18p+2) (f64.const infinity)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const 0x1.921fb54442d18p+2) (f64.const -infinity)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const 0x1.921fb54442d18p+2) (f64.const infinity)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const -0x1.921fb54442d18p+2) (f64.const -inf)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const -0x1.921fb54442d18p+2) (f64.const inf)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const 0x1.921fb54442d18p+2) (f64.const -inf)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const 0x1.921fb54442d18p+2) (f64.const inf)) (i32.const 1)) (assert_return (invoke "ne" (f64.const -0x1.921fb54442d18p+2) (f64.const -nan)) (i32.const 1)) (assert_return (invoke "ne" (f64.const -0x1.921fb54442d18p+2) (f64.const -nan:0x4000000000000)) (i32.const 1)) (assert_return (invoke "ne" (f64.const -0x1.921fb54442d18p+2) (f64.const nan)) (i32.const 1)) @@ -678,10 +678,10 @@ (assert_return (invoke "ne" (f64.const -0x1.fffffffffffffp+1023) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 1)) (assert_return (invoke "ne" (f64.const 0x1.fffffffffffffp+1023) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 1)) (assert_return (invoke "ne" (f64.const 0x1.fffffffffffffp+1023) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) -(assert_return (invoke "ne" (f64.const -0x1.fffffffffffffp+1023) (f64.const -infinity)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const -0x1.fffffffffffffp+1023) (f64.const infinity)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const 0x1.fffffffffffffp+1023) (f64.const -infinity)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const 0x1.fffffffffffffp+1023) (f64.const infinity)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const -0x1.fffffffffffffp+1023) (f64.const -inf)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const -0x1.fffffffffffffp+1023) (f64.const inf)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const 0x1.fffffffffffffp+1023) (f64.const -inf)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const 0x1.fffffffffffffp+1023) (f64.const inf)) (i32.const 1)) (assert_return (invoke "ne" (f64.const -0x1.fffffffffffffp+1023) (f64.const -nan)) (i32.const 1)) (assert_return (invoke "ne" (f64.const -0x1.fffffffffffffp+1023) (f64.const -nan:0x4000000000000)) (i32.const 1)) (assert_return (invoke "ne" (f64.const -0x1.fffffffffffffp+1023) (f64.const nan)) (i32.const 1)) @@ -690,46 +690,46 @@ (assert_return (invoke "ne" (f64.const 0x1.fffffffffffffp+1023) (f64.const -nan:0x4000000000000)) (i32.const 1)) (assert_return (invoke "ne" (f64.const 0x1.fffffffffffffp+1023) (f64.const nan)) (i32.const 1)) (assert_return (invoke "ne" (f64.const 0x1.fffffffffffffp+1023) (f64.const nan:0x4000000000000)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const -infinity) (f64.const -0x0p+0)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const -infinity) (f64.const 0x0p+0)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const infinity) (f64.const -0x0p+0)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const infinity) (f64.const 0x0p+0)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const -infinity) (f64.const -0x0.0000000000001p-1022)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const -infinity) (f64.const 0x0.0000000000001p-1022)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const infinity) (f64.const -0x0.0000000000001p-1022)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const infinity) (f64.const 0x0.0000000000001p-1022)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const -infinity) (f64.const -0x1p-1022)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const -infinity) (f64.const 0x1p-1022)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const infinity) (f64.const -0x1p-1022)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const infinity) (f64.const 0x1p-1022)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const -infinity) (f64.const -0x1p-1)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const -infinity) (f64.const 0x1p-1)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const infinity) (f64.const -0x1p-1)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const infinity) (f64.const 0x1p-1)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const -infinity) (f64.const -0x1p+0)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const -infinity) (f64.const 0x1p+0)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const infinity) (f64.const -0x1p+0)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const infinity) (f64.const 0x1p+0)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const -infinity) (f64.const -0x1.921fb54442d18p+2)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const -infinity) (f64.const 0x1.921fb54442d18p+2)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const infinity) (f64.const -0x1.921fb54442d18p+2)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const infinity) (f64.const 0x1.921fb54442d18p+2)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const -infinity) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const -infinity) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const infinity) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const infinity) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const -infinity) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "ne" (f64.const -infinity) (f64.const infinity)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const infinity) (f64.const -infinity)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const infinity) (f64.const infinity)) (i32.const 0)) -(assert_return (invoke "ne" (f64.const -infinity) (f64.const -nan)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const -infinity) (f64.const -nan:0x4000000000000)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const -infinity) (f64.const nan)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const -infinity) (f64.const nan:0x4000000000000)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const infinity) (f64.const -nan)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const infinity) (f64.const -nan:0x4000000000000)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const infinity) (f64.const nan)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const infinity) (f64.const nan:0x4000000000000)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const -inf) (f64.const -0x0p+0)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const -inf) (f64.const 0x0p+0)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const inf) (f64.const -0x0p+0)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const inf) (f64.const 0x0p+0)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const -inf) (f64.const -0x0.0000000000001p-1022)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const -inf) (f64.const 0x0.0000000000001p-1022)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const inf) (f64.const -0x0.0000000000001p-1022)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const inf) (f64.const 0x0.0000000000001p-1022)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const -inf) (f64.const -0x1p-1022)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const -inf) (f64.const 0x1p-1022)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const inf) (f64.const -0x1p-1022)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const inf) (f64.const 0x1p-1022)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const -inf) (f64.const -0x1p-1)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const -inf) (f64.const 0x1p-1)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const inf) (f64.const -0x1p-1)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const inf) (f64.const 0x1p-1)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const -inf) (f64.const -0x1p+0)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const -inf) (f64.const 0x1p+0)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const inf) (f64.const -0x1p+0)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const inf) (f64.const 0x1p+0)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const -inf) (f64.const -0x1.921fb54442d18p+2)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const -inf) (f64.const 0x1.921fb54442d18p+2)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const inf) (f64.const -0x1.921fb54442d18p+2)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const inf) (f64.const 0x1.921fb54442d18p+2)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const -inf) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const -inf) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const inf) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const inf) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const -inf) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "ne" (f64.const -inf) (f64.const inf)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const inf) (f64.const -inf)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const inf) (f64.const inf)) (i32.const 0)) +(assert_return (invoke "ne" (f64.const -inf) (f64.const -nan)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const -inf) (f64.const -nan:0x4000000000000)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const -inf) (f64.const nan)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const -inf) (f64.const nan:0x4000000000000)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const inf) (f64.const -nan)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const inf) (f64.const -nan:0x4000000000000)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const inf) (f64.const nan)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const inf) (f64.const nan:0x4000000000000)) (i32.const 1)) (assert_return (invoke "ne" (f64.const -nan) (f64.const -0x0p+0)) (i32.const 1)) (assert_return (invoke "ne" (f64.const -nan:0x4000000000000) (f64.const -0x0p+0)) (i32.const 1)) (assert_return (invoke "ne" (f64.const -nan) (f64.const 0x0p+0)) (i32.const 1)) @@ -786,14 +786,14 @@ (assert_return (invoke "ne" (f64.const nan:0x4000000000000) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 1)) (assert_return (invoke "ne" (f64.const nan) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 1)) (assert_return (invoke "ne" (f64.const nan:0x4000000000000) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const -nan) (f64.const -infinity)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const -nan:0x4000000000000) (f64.const -infinity)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const -nan) (f64.const infinity)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const -nan:0x4000000000000) (f64.const infinity)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const nan) (f64.const -infinity)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const nan:0x4000000000000) (f64.const -infinity)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const nan) (f64.const infinity)) (i32.const 1)) -(assert_return (invoke "ne" (f64.const nan:0x4000000000000) (f64.const infinity)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const -nan) (f64.const -inf)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const -nan:0x4000000000000) (f64.const -inf)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const -nan) (f64.const inf)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const -nan:0x4000000000000) (f64.const inf)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const nan) (f64.const -inf)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const nan:0x4000000000000) (f64.const -inf)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const nan) (f64.const inf)) (i32.const 1)) +(assert_return (invoke "ne" (f64.const nan:0x4000000000000) (f64.const inf)) (i32.const 1)) (assert_return (invoke "ne" (f64.const -nan) (f64.const -nan)) (i32.const 1)) (assert_return (invoke "ne" (f64.const -nan:0x4000000000000) (f64.const -nan)) (i32.const 1)) (assert_return (invoke "ne" (f64.const -nan) (f64.const -nan:0x4000000000000)) (i32.const 1)) @@ -838,10 +838,10 @@ (assert_return (invoke "lt" (f64.const -0x0p+0) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 1)) (assert_return (invoke "lt" (f64.const 0x0p+0) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 0)) (assert_return (invoke "lt" (f64.const 0x0p+0) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 1)) -(assert_return (invoke "lt" (f64.const -0x0p+0) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "lt" (f64.const -0x0p+0) (f64.const infinity)) (i32.const 1)) -(assert_return (invoke "lt" (f64.const 0x0p+0) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "lt" (f64.const 0x0p+0) (f64.const infinity)) (i32.const 1)) +(assert_return (invoke "lt" (f64.const -0x0p+0) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "lt" (f64.const -0x0p+0) (f64.const inf)) (i32.const 1)) +(assert_return (invoke "lt" (f64.const 0x0p+0) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "lt" (f64.const 0x0p+0) (f64.const inf)) (i32.const 1)) (assert_return (invoke "lt" (f64.const -0x0p+0) (f64.const -nan)) (i32.const 0)) (assert_return (invoke "lt" (f64.const -0x0p+0) (f64.const -nan:0x4000000000000)) (i32.const 0)) (assert_return (invoke "lt" (f64.const -0x0p+0) (f64.const nan)) (i32.const 0)) @@ -878,10 +878,10 @@ (assert_return (invoke "lt" (f64.const -0x0.0000000000001p-1022) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 1)) (assert_return (invoke "lt" (f64.const 0x0.0000000000001p-1022) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 0)) (assert_return (invoke "lt" (f64.const 0x0.0000000000001p-1022) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 1)) -(assert_return (invoke "lt" (f64.const -0x0.0000000000001p-1022) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "lt" (f64.const -0x0.0000000000001p-1022) (f64.const infinity)) (i32.const 1)) -(assert_return (invoke "lt" (f64.const 0x0.0000000000001p-1022) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "lt" (f64.const 0x0.0000000000001p-1022) (f64.const infinity)) (i32.const 1)) +(assert_return (invoke "lt" (f64.const -0x0.0000000000001p-1022) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "lt" (f64.const -0x0.0000000000001p-1022) (f64.const inf)) (i32.const 1)) +(assert_return (invoke "lt" (f64.const 0x0.0000000000001p-1022) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "lt" (f64.const 0x0.0000000000001p-1022) (f64.const inf)) (i32.const 1)) (assert_return (invoke "lt" (f64.const -0x0.0000000000001p-1022) (f64.const -nan)) (i32.const 0)) (assert_return (invoke "lt" (f64.const -0x0.0000000000001p-1022) (f64.const -nan:0x4000000000000)) (i32.const 0)) (assert_return (invoke "lt" (f64.const -0x0.0000000000001p-1022) (f64.const nan)) (i32.const 0)) @@ -918,10 +918,10 @@ (assert_return (invoke "lt" (f64.const -0x1p-1022) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 1)) (assert_return (invoke "lt" (f64.const 0x1p-1022) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 0)) (assert_return (invoke "lt" (f64.const 0x1p-1022) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 1)) -(assert_return (invoke "lt" (f64.const -0x1p-1022) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "lt" (f64.const -0x1p-1022) (f64.const infinity)) (i32.const 1)) -(assert_return (invoke "lt" (f64.const 0x1p-1022) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "lt" (f64.const 0x1p-1022) (f64.const infinity)) (i32.const 1)) +(assert_return (invoke "lt" (f64.const -0x1p-1022) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "lt" (f64.const -0x1p-1022) (f64.const inf)) (i32.const 1)) +(assert_return (invoke "lt" (f64.const 0x1p-1022) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "lt" (f64.const 0x1p-1022) (f64.const inf)) (i32.const 1)) (assert_return (invoke "lt" (f64.const -0x1p-1022) (f64.const -nan)) (i32.const 0)) (assert_return (invoke "lt" (f64.const -0x1p-1022) (f64.const -nan:0x4000000000000)) (i32.const 0)) (assert_return (invoke "lt" (f64.const -0x1p-1022) (f64.const nan)) (i32.const 0)) @@ -958,10 +958,10 @@ (assert_return (invoke "lt" (f64.const -0x1p-1) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 1)) (assert_return (invoke "lt" (f64.const 0x1p-1) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 0)) (assert_return (invoke "lt" (f64.const 0x1p-1) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 1)) -(assert_return (invoke "lt" (f64.const -0x1p-1) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "lt" (f64.const -0x1p-1) (f64.const infinity)) (i32.const 1)) -(assert_return (invoke "lt" (f64.const 0x1p-1) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "lt" (f64.const 0x1p-1) (f64.const infinity)) (i32.const 1)) +(assert_return (invoke "lt" (f64.const -0x1p-1) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "lt" (f64.const -0x1p-1) (f64.const inf)) (i32.const 1)) +(assert_return (invoke "lt" (f64.const 0x1p-1) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "lt" (f64.const 0x1p-1) (f64.const inf)) (i32.const 1)) (assert_return (invoke "lt" (f64.const -0x1p-1) (f64.const -nan)) (i32.const 0)) (assert_return (invoke "lt" (f64.const -0x1p-1) (f64.const -nan:0x4000000000000)) (i32.const 0)) (assert_return (invoke "lt" (f64.const -0x1p-1) (f64.const nan)) (i32.const 0)) @@ -998,10 +998,10 @@ (assert_return (invoke "lt" (f64.const -0x1p+0) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 1)) (assert_return (invoke "lt" (f64.const 0x1p+0) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 0)) (assert_return (invoke "lt" (f64.const 0x1p+0) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 1)) -(assert_return (invoke "lt" (f64.const -0x1p+0) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "lt" (f64.const -0x1p+0) (f64.const infinity)) (i32.const 1)) -(assert_return (invoke "lt" (f64.const 0x1p+0) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "lt" (f64.const 0x1p+0) (f64.const infinity)) (i32.const 1)) +(assert_return (invoke "lt" (f64.const -0x1p+0) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "lt" (f64.const -0x1p+0) (f64.const inf)) (i32.const 1)) +(assert_return (invoke "lt" (f64.const 0x1p+0) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "lt" (f64.const 0x1p+0) (f64.const inf)) (i32.const 1)) (assert_return (invoke "lt" (f64.const -0x1p+0) (f64.const -nan)) (i32.const 0)) (assert_return (invoke "lt" (f64.const -0x1p+0) (f64.const -nan:0x4000000000000)) (i32.const 0)) (assert_return (invoke "lt" (f64.const -0x1p+0) (f64.const nan)) (i32.const 0)) @@ -1038,10 +1038,10 @@ (assert_return (invoke "lt" (f64.const -0x1.921fb54442d18p+2) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 1)) (assert_return (invoke "lt" (f64.const 0x1.921fb54442d18p+2) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 0)) (assert_return (invoke "lt" (f64.const 0x1.921fb54442d18p+2) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 1)) -(assert_return (invoke "lt" (f64.const -0x1.921fb54442d18p+2) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "lt" (f64.const -0x1.921fb54442d18p+2) (f64.const infinity)) (i32.const 1)) -(assert_return (invoke "lt" (f64.const 0x1.921fb54442d18p+2) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "lt" (f64.const 0x1.921fb54442d18p+2) (f64.const infinity)) (i32.const 1)) +(assert_return (invoke "lt" (f64.const -0x1.921fb54442d18p+2) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "lt" (f64.const -0x1.921fb54442d18p+2) (f64.const inf)) (i32.const 1)) +(assert_return (invoke "lt" (f64.const 0x1.921fb54442d18p+2) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "lt" (f64.const 0x1.921fb54442d18p+2) (f64.const inf)) (i32.const 1)) (assert_return (invoke "lt" (f64.const -0x1.921fb54442d18p+2) (f64.const -nan)) (i32.const 0)) (assert_return (invoke "lt" (f64.const -0x1.921fb54442d18p+2) (f64.const -nan:0x4000000000000)) (i32.const 0)) (assert_return (invoke "lt" (f64.const -0x1.921fb54442d18p+2) (f64.const nan)) (i32.const 0)) @@ -1078,10 +1078,10 @@ (assert_return (invoke "lt" (f64.const -0x1.fffffffffffffp+1023) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 1)) (assert_return (invoke "lt" (f64.const 0x1.fffffffffffffp+1023) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 0)) (assert_return (invoke "lt" (f64.const 0x1.fffffffffffffp+1023) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) -(assert_return (invoke "lt" (f64.const -0x1.fffffffffffffp+1023) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "lt" (f64.const -0x1.fffffffffffffp+1023) (f64.const infinity)) (i32.const 1)) -(assert_return (invoke "lt" (f64.const 0x1.fffffffffffffp+1023) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "lt" (f64.const 0x1.fffffffffffffp+1023) (f64.const infinity)) (i32.const 1)) +(assert_return (invoke "lt" (f64.const -0x1.fffffffffffffp+1023) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "lt" (f64.const -0x1.fffffffffffffp+1023) (f64.const inf)) (i32.const 1)) +(assert_return (invoke "lt" (f64.const 0x1.fffffffffffffp+1023) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "lt" (f64.const 0x1.fffffffffffffp+1023) (f64.const inf)) (i32.const 1)) (assert_return (invoke "lt" (f64.const -0x1.fffffffffffffp+1023) (f64.const -nan)) (i32.const 0)) (assert_return (invoke "lt" (f64.const -0x1.fffffffffffffp+1023) (f64.const -nan:0x4000000000000)) (i32.const 0)) (assert_return (invoke "lt" (f64.const -0x1.fffffffffffffp+1023) (f64.const nan)) (i32.const 0)) @@ -1090,46 +1090,46 @@ (assert_return (invoke "lt" (f64.const 0x1.fffffffffffffp+1023) (f64.const -nan:0x4000000000000)) (i32.const 0)) (assert_return (invoke "lt" (f64.const 0x1.fffffffffffffp+1023) (f64.const nan)) (i32.const 0)) (assert_return (invoke "lt" (f64.const 0x1.fffffffffffffp+1023) (f64.const nan:0x4000000000000)) (i32.const 0)) -(assert_return (invoke "lt" (f64.const -infinity) (f64.const -0x0p+0)) (i32.const 1)) -(assert_return (invoke "lt" (f64.const -infinity) (f64.const 0x0p+0)) (i32.const 1)) -(assert_return (invoke "lt" (f64.const infinity) (f64.const -0x0p+0)) (i32.const 0)) -(assert_return (invoke "lt" (f64.const infinity) (f64.const 0x0p+0)) (i32.const 0)) -(assert_return (invoke "lt" (f64.const -infinity) (f64.const -0x0.0000000000001p-1022)) (i32.const 1)) -(assert_return (invoke "lt" (f64.const -infinity) (f64.const 0x0.0000000000001p-1022)) (i32.const 1)) -(assert_return (invoke "lt" (f64.const infinity) (f64.const -0x0.0000000000001p-1022)) (i32.const 0)) -(assert_return (invoke "lt" (f64.const infinity) (f64.const 0x0.0000000000001p-1022)) (i32.const 0)) -(assert_return (invoke "lt" (f64.const -infinity) (f64.const -0x1p-1022)) (i32.const 1)) -(assert_return (invoke "lt" (f64.const -infinity) (f64.const 0x1p-1022)) (i32.const 1)) -(assert_return (invoke "lt" (f64.const infinity) (f64.const -0x1p-1022)) (i32.const 0)) -(assert_return (invoke "lt" (f64.const infinity) (f64.const 0x1p-1022)) (i32.const 0)) -(assert_return (invoke "lt" (f64.const -infinity) (f64.const -0x1p-1)) (i32.const 1)) -(assert_return (invoke "lt" (f64.const -infinity) (f64.const 0x1p-1)) (i32.const 1)) -(assert_return (invoke "lt" (f64.const infinity) (f64.const -0x1p-1)) (i32.const 0)) -(assert_return (invoke "lt" (f64.const infinity) (f64.const 0x1p-1)) (i32.const 0)) -(assert_return (invoke "lt" (f64.const -infinity) (f64.const -0x1p+0)) (i32.const 1)) -(assert_return (invoke "lt" (f64.const -infinity) (f64.const 0x1p+0)) (i32.const 1)) -(assert_return (invoke "lt" (f64.const infinity) (f64.const -0x1p+0)) (i32.const 0)) -(assert_return (invoke "lt" (f64.const infinity) (f64.const 0x1p+0)) (i32.const 0)) -(assert_return (invoke "lt" (f64.const -infinity) (f64.const -0x1.921fb54442d18p+2)) (i32.const 1)) -(assert_return (invoke "lt" (f64.const -infinity) (f64.const 0x1.921fb54442d18p+2)) (i32.const 1)) -(assert_return (invoke "lt" (f64.const infinity) (f64.const -0x1.921fb54442d18p+2)) (i32.const 0)) -(assert_return (invoke "lt" (f64.const infinity) (f64.const 0x1.921fb54442d18p+2)) (i32.const 0)) -(assert_return (invoke "lt" (f64.const -infinity) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 1)) -(assert_return (invoke "lt" (f64.const -infinity) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 1)) -(assert_return (invoke "lt" (f64.const infinity) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 0)) -(assert_return (invoke "lt" (f64.const infinity) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) -(assert_return (invoke "lt" (f64.const -infinity) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "lt" (f64.const -infinity) (f64.const infinity)) (i32.const 1)) -(assert_return (invoke "lt" (f64.const infinity) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "lt" (f64.const infinity) (f64.const infinity)) (i32.const 0)) -(assert_return (invoke "lt" (f64.const -infinity) (f64.const -nan)) (i32.const 0)) -(assert_return (invoke "lt" (f64.const -infinity) (f64.const -nan:0x4000000000000)) (i32.const 0)) -(assert_return (invoke "lt" (f64.const -infinity) (f64.const nan)) (i32.const 0)) -(assert_return (invoke "lt" (f64.const -infinity) (f64.const nan:0x4000000000000)) (i32.const 0)) -(assert_return (invoke "lt" (f64.const infinity) (f64.const -nan)) (i32.const 0)) -(assert_return (invoke "lt" (f64.const infinity) (f64.const -nan:0x4000000000000)) (i32.const 0)) -(assert_return (invoke "lt" (f64.const infinity) (f64.const nan)) (i32.const 0)) -(assert_return (invoke "lt" (f64.const infinity) (f64.const nan:0x4000000000000)) (i32.const 0)) +(assert_return (invoke "lt" (f64.const -inf) (f64.const -0x0p+0)) (i32.const 1)) +(assert_return (invoke "lt" (f64.const -inf) (f64.const 0x0p+0)) (i32.const 1)) +(assert_return (invoke "lt" (f64.const inf) (f64.const -0x0p+0)) (i32.const 0)) +(assert_return (invoke "lt" (f64.const inf) (f64.const 0x0p+0)) (i32.const 0)) +(assert_return (invoke "lt" (f64.const -inf) (f64.const -0x0.0000000000001p-1022)) (i32.const 1)) +(assert_return (invoke "lt" (f64.const -inf) (f64.const 0x0.0000000000001p-1022)) (i32.const 1)) +(assert_return (invoke "lt" (f64.const inf) (f64.const -0x0.0000000000001p-1022)) (i32.const 0)) +(assert_return (invoke "lt" (f64.const inf) (f64.const 0x0.0000000000001p-1022)) (i32.const 0)) +(assert_return (invoke "lt" (f64.const -inf) (f64.const -0x1p-1022)) (i32.const 1)) +(assert_return (invoke "lt" (f64.const -inf) (f64.const 0x1p-1022)) (i32.const 1)) +(assert_return (invoke "lt" (f64.const inf) (f64.const -0x1p-1022)) (i32.const 0)) +(assert_return (invoke "lt" (f64.const inf) (f64.const 0x1p-1022)) (i32.const 0)) +(assert_return (invoke "lt" (f64.const -inf) (f64.const -0x1p-1)) (i32.const 1)) +(assert_return (invoke "lt" (f64.const -inf) (f64.const 0x1p-1)) (i32.const 1)) +(assert_return (invoke "lt" (f64.const inf) (f64.const -0x1p-1)) (i32.const 0)) +(assert_return (invoke "lt" (f64.const inf) (f64.const 0x1p-1)) (i32.const 0)) +(assert_return (invoke "lt" (f64.const -inf) (f64.const -0x1p+0)) (i32.const 1)) +(assert_return (invoke "lt" (f64.const -inf) (f64.const 0x1p+0)) (i32.const 1)) +(assert_return (invoke "lt" (f64.const inf) (f64.const -0x1p+0)) (i32.const 0)) +(assert_return (invoke "lt" (f64.const inf) (f64.const 0x1p+0)) (i32.const 0)) +(assert_return (invoke "lt" (f64.const -inf) (f64.const -0x1.921fb54442d18p+2)) (i32.const 1)) +(assert_return (invoke "lt" (f64.const -inf) (f64.const 0x1.921fb54442d18p+2)) (i32.const 1)) +(assert_return (invoke "lt" (f64.const inf) (f64.const -0x1.921fb54442d18p+2)) (i32.const 0)) +(assert_return (invoke "lt" (f64.const inf) (f64.const 0x1.921fb54442d18p+2)) (i32.const 0)) +(assert_return (invoke "lt" (f64.const -inf) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 1)) +(assert_return (invoke "lt" (f64.const -inf) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 1)) +(assert_return (invoke "lt" (f64.const inf) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 0)) +(assert_return (invoke "lt" (f64.const inf) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) +(assert_return (invoke "lt" (f64.const -inf) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "lt" (f64.const -inf) (f64.const inf)) (i32.const 1)) +(assert_return (invoke "lt" (f64.const inf) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "lt" (f64.const inf) (f64.const inf)) (i32.const 0)) +(assert_return (invoke "lt" (f64.const -inf) (f64.const -nan)) (i32.const 0)) +(assert_return (invoke "lt" (f64.const -inf) (f64.const -nan:0x4000000000000)) (i32.const 0)) +(assert_return (invoke "lt" (f64.const -inf) (f64.const nan)) (i32.const 0)) +(assert_return (invoke "lt" (f64.const -inf) (f64.const nan:0x4000000000000)) (i32.const 0)) +(assert_return (invoke "lt" (f64.const inf) (f64.const -nan)) (i32.const 0)) +(assert_return (invoke "lt" (f64.const inf) (f64.const -nan:0x4000000000000)) (i32.const 0)) +(assert_return (invoke "lt" (f64.const inf) (f64.const nan)) (i32.const 0)) +(assert_return (invoke "lt" (f64.const inf) (f64.const nan:0x4000000000000)) (i32.const 0)) (assert_return (invoke "lt" (f64.const -nan) (f64.const -0x0p+0)) (i32.const 0)) (assert_return (invoke "lt" (f64.const -nan:0x4000000000000) (f64.const -0x0p+0)) (i32.const 0)) (assert_return (invoke "lt" (f64.const -nan) (f64.const 0x0p+0)) (i32.const 0)) @@ -1186,14 +1186,14 @@ (assert_return (invoke "lt" (f64.const nan:0x4000000000000) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 0)) (assert_return (invoke "lt" (f64.const nan) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) (assert_return (invoke "lt" (f64.const nan:0x4000000000000) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) -(assert_return (invoke "lt" (f64.const -nan) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "lt" (f64.const -nan:0x4000000000000) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "lt" (f64.const -nan) (f64.const infinity)) (i32.const 0)) -(assert_return (invoke "lt" (f64.const -nan:0x4000000000000) (f64.const infinity)) (i32.const 0)) -(assert_return (invoke "lt" (f64.const nan) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "lt" (f64.const nan:0x4000000000000) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "lt" (f64.const nan) (f64.const infinity)) (i32.const 0)) -(assert_return (invoke "lt" (f64.const nan:0x4000000000000) (f64.const infinity)) (i32.const 0)) +(assert_return (invoke "lt" (f64.const -nan) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "lt" (f64.const -nan:0x4000000000000) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "lt" (f64.const -nan) (f64.const inf)) (i32.const 0)) +(assert_return (invoke "lt" (f64.const -nan:0x4000000000000) (f64.const inf)) (i32.const 0)) +(assert_return (invoke "lt" (f64.const nan) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "lt" (f64.const nan:0x4000000000000) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "lt" (f64.const nan) (f64.const inf)) (i32.const 0)) +(assert_return (invoke "lt" (f64.const nan:0x4000000000000) (f64.const inf)) (i32.const 0)) (assert_return (invoke "lt" (f64.const -nan) (f64.const -nan)) (i32.const 0)) (assert_return (invoke "lt" (f64.const -nan:0x4000000000000) (f64.const -nan)) (i32.const 0)) (assert_return (invoke "lt" (f64.const -nan) (f64.const -nan:0x4000000000000)) (i32.const 0)) @@ -1238,10 +1238,10 @@ (assert_return (invoke "le" (f64.const -0x0p+0) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 1)) (assert_return (invoke "le" (f64.const 0x0p+0) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 0)) (assert_return (invoke "le" (f64.const 0x0p+0) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 1)) -(assert_return (invoke "le" (f64.const -0x0p+0) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "le" (f64.const -0x0p+0) (f64.const infinity)) (i32.const 1)) -(assert_return (invoke "le" (f64.const 0x0p+0) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "le" (f64.const 0x0p+0) (f64.const infinity)) (i32.const 1)) +(assert_return (invoke "le" (f64.const -0x0p+0) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "le" (f64.const -0x0p+0) (f64.const inf)) (i32.const 1)) +(assert_return (invoke "le" (f64.const 0x0p+0) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "le" (f64.const 0x0p+0) (f64.const inf)) (i32.const 1)) (assert_return (invoke "le" (f64.const -0x0p+0) (f64.const -nan)) (i32.const 0)) (assert_return (invoke "le" (f64.const -0x0p+0) (f64.const -nan:0x4000000000000)) (i32.const 0)) (assert_return (invoke "le" (f64.const -0x0p+0) (f64.const nan)) (i32.const 0)) @@ -1278,10 +1278,10 @@ (assert_return (invoke "le" (f64.const -0x0.0000000000001p-1022) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 1)) (assert_return (invoke "le" (f64.const 0x0.0000000000001p-1022) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 0)) (assert_return (invoke "le" (f64.const 0x0.0000000000001p-1022) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 1)) -(assert_return (invoke "le" (f64.const -0x0.0000000000001p-1022) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "le" (f64.const -0x0.0000000000001p-1022) (f64.const infinity)) (i32.const 1)) -(assert_return (invoke "le" (f64.const 0x0.0000000000001p-1022) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "le" (f64.const 0x0.0000000000001p-1022) (f64.const infinity)) (i32.const 1)) +(assert_return (invoke "le" (f64.const -0x0.0000000000001p-1022) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "le" (f64.const -0x0.0000000000001p-1022) (f64.const inf)) (i32.const 1)) +(assert_return (invoke "le" (f64.const 0x0.0000000000001p-1022) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "le" (f64.const 0x0.0000000000001p-1022) (f64.const inf)) (i32.const 1)) (assert_return (invoke "le" (f64.const -0x0.0000000000001p-1022) (f64.const -nan)) (i32.const 0)) (assert_return (invoke "le" (f64.const -0x0.0000000000001p-1022) (f64.const -nan:0x4000000000000)) (i32.const 0)) (assert_return (invoke "le" (f64.const -0x0.0000000000001p-1022) (f64.const nan)) (i32.const 0)) @@ -1318,10 +1318,10 @@ (assert_return (invoke "le" (f64.const -0x1p-1022) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 1)) (assert_return (invoke "le" (f64.const 0x1p-1022) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 0)) (assert_return (invoke "le" (f64.const 0x1p-1022) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 1)) -(assert_return (invoke "le" (f64.const -0x1p-1022) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "le" (f64.const -0x1p-1022) (f64.const infinity)) (i32.const 1)) -(assert_return (invoke "le" (f64.const 0x1p-1022) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "le" (f64.const 0x1p-1022) (f64.const infinity)) (i32.const 1)) +(assert_return (invoke "le" (f64.const -0x1p-1022) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "le" (f64.const -0x1p-1022) (f64.const inf)) (i32.const 1)) +(assert_return (invoke "le" (f64.const 0x1p-1022) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "le" (f64.const 0x1p-1022) (f64.const inf)) (i32.const 1)) (assert_return (invoke "le" (f64.const -0x1p-1022) (f64.const -nan)) (i32.const 0)) (assert_return (invoke "le" (f64.const -0x1p-1022) (f64.const -nan:0x4000000000000)) (i32.const 0)) (assert_return (invoke "le" (f64.const -0x1p-1022) (f64.const nan)) (i32.const 0)) @@ -1358,10 +1358,10 @@ (assert_return (invoke "le" (f64.const -0x1p-1) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 1)) (assert_return (invoke "le" (f64.const 0x1p-1) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 0)) (assert_return (invoke "le" (f64.const 0x1p-1) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 1)) -(assert_return (invoke "le" (f64.const -0x1p-1) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "le" (f64.const -0x1p-1) (f64.const infinity)) (i32.const 1)) -(assert_return (invoke "le" (f64.const 0x1p-1) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "le" (f64.const 0x1p-1) (f64.const infinity)) (i32.const 1)) +(assert_return (invoke "le" (f64.const -0x1p-1) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "le" (f64.const -0x1p-1) (f64.const inf)) (i32.const 1)) +(assert_return (invoke "le" (f64.const 0x1p-1) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "le" (f64.const 0x1p-1) (f64.const inf)) (i32.const 1)) (assert_return (invoke "le" (f64.const -0x1p-1) (f64.const -nan)) (i32.const 0)) (assert_return (invoke "le" (f64.const -0x1p-1) (f64.const -nan:0x4000000000000)) (i32.const 0)) (assert_return (invoke "le" (f64.const -0x1p-1) (f64.const nan)) (i32.const 0)) @@ -1398,10 +1398,10 @@ (assert_return (invoke "le" (f64.const -0x1p+0) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 1)) (assert_return (invoke "le" (f64.const 0x1p+0) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 0)) (assert_return (invoke "le" (f64.const 0x1p+0) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 1)) -(assert_return (invoke "le" (f64.const -0x1p+0) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "le" (f64.const -0x1p+0) (f64.const infinity)) (i32.const 1)) -(assert_return (invoke "le" (f64.const 0x1p+0) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "le" (f64.const 0x1p+0) (f64.const infinity)) (i32.const 1)) +(assert_return (invoke "le" (f64.const -0x1p+0) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "le" (f64.const -0x1p+0) (f64.const inf)) (i32.const 1)) +(assert_return (invoke "le" (f64.const 0x1p+0) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "le" (f64.const 0x1p+0) (f64.const inf)) (i32.const 1)) (assert_return (invoke "le" (f64.const -0x1p+0) (f64.const -nan)) (i32.const 0)) (assert_return (invoke "le" (f64.const -0x1p+0) (f64.const -nan:0x4000000000000)) (i32.const 0)) (assert_return (invoke "le" (f64.const -0x1p+0) (f64.const nan)) (i32.const 0)) @@ -1438,10 +1438,10 @@ (assert_return (invoke "le" (f64.const -0x1.921fb54442d18p+2) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 1)) (assert_return (invoke "le" (f64.const 0x1.921fb54442d18p+2) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 0)) (assert_return (invoke "le" (f64.const 0x1.921fb54442d18p+2) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 1)) -(assert_return (invoke "le" (f64.const -0x1.921fb54442d18p+2) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "le" (f64.const -0x1.921fb54442d18p+2) (f64.const infinity)) (i32.const 1)) -(assert_return (invoke "le" (f64.const 0x1.921fb54442d18p+2) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "le" (f64.const 0x1.921fb54442d18p+2) (f64.const infinity)) (i32.const 1)) +(assert_return (invoke "le" (f64.const -0x1.921fb54442d18p+2) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "le" (f64.const -0x1.921fb54442d18p+2) (f64.const inf)) (i32.const 1)) +(assert_return (invoke "le" (f64.const 0x1.921fb54442d18p+2) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "le" (f64.const 0x1.921fb54442d18p+2) (f64.const inf)) (i32.const 1)) (assert_return (invoke "le" (f64.const -0x1.921fb54442d18p+2) (f64.const -nan)) (i32.const 0)) (assert_return (invoke "le" (f64.const -0x1.921fb54442d18p+2) (f64.const -nan:0x4000000000000)) (i32.const 0)) (assert_return (invoke "le" (f64.const -0x1.921fb54442d18p+2) (f64.const nan)) (i32.const 0)) @@ -1478,10 +1478,10 @@ (assert_return (invoke "le" (f64.const -0x1.fffffffffffffp+1023) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 1)) (assert_return (invoke "le" (f64.const 0x1.fffffffffffffp+1023) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 0)) (assert_return (invoke "le" (f64.const 0x1.fffffffffffffp+1023) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 1)) -(assert_return (invoke "le" (f64.const -0x1.fffffffffffffp+1023) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "le" (f64.const -0x1.fffffffffffffp+1023) (f64.const infinity)) (i32.const 1)) -(assert_return (invoke "le" (f64.const 0x1.fffffffffffffp+1023) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "le" (f64.const 0x1.fffffffffffffp+1023) (f64.const infinity)) (i32.const 1)) +(assert_return (invoke "le" (f64.const -0x1.fffffffffffffp+1023) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "le" (f64.const -0x1.fffffffffffffp+1023) (f64.const inf)) (i32.const 1)) +(assert_return (invoke "le" (f64.const 0x1.fffffffffffffp+1023) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "le" (f64.const 0x1.fffffffffffffp+1023) (f64.const inf)) (i32.const 1)) (assert_return (invoke "le" (f64.const -0x1.fffffffffffffp+1023) (f64.const -nan)) (i32.const 0)) (assert_return (invoke "le" (f64.const -0x1.fffffffffffffp+1023) (f64.const -nan:0x4000000000000)) (i32.const 0)) (assert_return (invoke "le" (f64.const -0x1.fffffffffffffp+1023) (f64.const nan)) (i32.const 0)) @@ -1490,46 +1490,46 @@ (assert_return (invoke "le" (f64.const 0x1.fffffffffffffp+1023) (f64.const -nan:0x4000000000000)) (i32.const 0)) (assert_return (invoke "le" (f64.const 0x1.fffffffffffffp+1023) (f64.const nan)) (i32.const 0)) (assert_return (invoke "le" (f64.const 0x1.fffffffffffffp+1023) (f64.const nan:0x4000000000000)) (i32.const 0)) -(assert_return (invoke "le" (f64.const -infinity) (f64.const -0x0p+0)) (i32.const 1)) -(assert_return (invoke "le" (f64.const -infinity) (f64.const 0x0p+0)) (i32.const 1)) -(assert_return (invoke "le" (f64.const infinity) (f64.const -0x0p+0)) (i32.const 0)) -(assert_return (invoke "le" (f64.const infinity) (f64.const 0x0p+0)) (i32.const 0)) -(assert_return (invoke "le" (f64.const -infinity) (f64.const -0x0.0000000000001p-1022)) (i32.const 1)) -(assert_return (invoke "le" (f64.const -infinity) (f64.const 0x0.0000000000001p-1022)) (i32.const 1)) -(assert_return (invoke "le" (f64.const infinity) (f64.const -0x0.0000000000001p-1022)) (i32.const 0)) -(assert_return (invoke "le" (f64.const infinity) (f64.const 0x0.0000000000001p-1022)) (i32.const 0)) -(assert_return (invoke "le" (f64.const -infinity) (f64.const -0x1p-1022)) (i32.const 1)) -(assert_return (invoke "le" (f64.const -infinity) (f64.const 0x1p-1022)) (i32.const 1)) -(assert_return (invoke "le" (f64.const infinity) (f64.const -0x1p-1022)) (i32.const 0)) -(assert_return (invoke "le" (f64.const infinity) (f64.const 0x1p-1022)) (i32.const 0)) -(assert_return (invoke "le" (f64.const -infinity) (f64.const -0x1p-1)) (i32.const 1)) -(assert_return (invoke "le" (f64.const -infinity) (f64.const 0x1p-1)) (i32.const 1)) -(assert_return (invoke "le" (f64.const infinity) (f64.const -0x1p-1)) (i32.const 0)) -(assert_return (invoke "le" (f64.const infinity) (f64.const 0x1p-1)) (i32.const 0)) -(assert_return (invoke "le" (f64.const -infinity) (f64.const -0x1p+0)) (i32.const 1)) -(assert_return (invoke "le" (f64.const -infinity) (f64.const 0x1p+0)) (i32.const 1)) -(assert_return (invoke "le" (f64.const infinity) (f64.const -0x1p+0)) (i32.const 0)) -(assert_return (invoke "le" (f64.const infinity) (f64.const 0x1p+0)) (i32.const 0)) -(assert_return (invoke "le" (f64.const -infinity) (f64.const -0x1.921fb54442d18p+2)) (i32.const 1)) -(assert_return (invoke "le" (f64.const -infinity) (f64.const 0x1.921fb54442d18p+2)) (i32.const 1)) -(assert_return (invoke "le" (f64.const infinity) (f64.const -0x1.921fb54442d18p+2)) (i32.const 0)) -(assert_return (invoke "le" (f64.const infinity) (f64.const 0x1.921fb54442d18p+2)) (i32.const 0)) -(assert_return (invoke "le" (f64.const -infinity) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 1)) -(assert_return (invoke "le" (f64.const -infinity) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 1)) -(assert_return (invoke "le" (f64.const infinity) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 0)) -(assert_return (invoke "le" (f64.const infinity) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) -(assert_return (invoke "le" (f64.const -infinity) (f64.const -infinity)) (i32.const 1)) -(assert_return (invoke "le" (f64.const -infinity) (f64.const infinity)) (i32.const 1)) -(assert_return (invoke "le" (f64.const infinity) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "le" (f64.const infinity) (f64.const infinity)) (i32.const 1)) -(assert_return (invoke "le" (f64.const -infinity) (f64.const -nan)) (i32.const 0)) -(assert_return (invoke "le" (f64.const -infinity) (f64.const -nan:0x4000000000000)) (i32.const 0)) -(assert_return (invoke "le" (f64.const -infinity) (f64.const nan)) (i32.const 0)) -(assert_return (invoke "le" (f64.const -infinity) (f64.const nan:0x4000000000000)) (i32.const 0)) -(assert_return (invoke "le" (f64.const infinity) (f64.const -nan)) (i32.const 0)) -(assert_return (invoke "le" (f64.const infinity) (f64.const -nan:0x4000000000000)) (i32.const 0)) -(assert_return (invoke "le" (f64.const infinity) (f64.const nan)) (i32.const 0)) -(assert_return (invoke "le" (f64.const infinity) (f64.const nan:0x4000000000000)) (i32.const 0)) +(assert_return (invoke "le" (f64.const -inf) (f64.const -0x0p+0)) (i32.const 1)) +(assert_return (invoke "le" (f64.const -inf) (f64.const 0x0p+0)) (i32.const 1)) +(assert_return (invoke "le" (f64.const inf) (f64.const -0x0p+0)) (i32.const 0)) +(assert_return (invoke "le" (f64.const inf) (f64.const 0x0p+0)) (i32.const 0)) +(assert_return (invoke "le" (f64.const -inf) (f64.const -0x0.0000000000001p-1022)) (i32.const 1)) +(assert_return (invoke "le" (f64.const -inf) (f64.const 0x0.0000000000001p-1022)) (i32.const 1)) +(assert_return (invoke "le" (f64.const inf) (f64.const -0x0.0000000000001p-1022)) (i32.const 0)) +(assert_return (invoke "le" (f64.const inf) (f64.const 0x0.0000000000001p-1022)) (i32.const 0)) +(assert_return (invoke "le" (f64.const -inf) (f64.const -0x1p-1022)) (i32.const 1)) +(assert_return (invoke "le" (f64.const -inf) (f64.const 0x1p-1022)) (i32.const 1)) +(assert_return (invoke "le" (f64.const inf) (f64.const -0x1p-1022)) (i32.const 0)) +(assert_return (invoke "le" (f64.const inf) (f64.const 0x1p-1022)) (i32.const 0)) +(assert_return (invoke "le" (f64.const -inf) (f64.const -0x1p-1)) (i32.const 1)) +(assert_return (invoke "le" (f64.const -inf) (f64.const 0x1p-1)) (i32.const 1)) +(assert_return (invoke "le" (f64.const inf) (f64.const -0x1p-1)) (i32.const 0)) +(assert_return (invoke "le" (f64.const inf) (f64.const 0x1p-1)) (i32.const 0)) +(assert_return (invoke "le" (f64.const -inf) (f64.const -0x1p+0)) (i32.const 1)) +(assert_return (invoke "le" (f64.const -inf) (f64.const 0x1p+0)) (i32.const 1)) +(assert_return (invoke "le" (f64.const inf) (f64.const -0x1p+0)) (i32.const 0)) +(assert_return (invoke "le" (f64.const inf) (f64.const 0x1p+0)) (i32.const 0)) +(assert_return (invoke "le" (f64.const -inf) (f64.const -0x1.921fb54442d18p+2)) (i32.const 1)) +(assert_return (invoke "le" (f64.const -inf) (f64.const 0x1.921fb54442d18p+2)) (i32.const 1)) +(assert_return (invoke "le" (f64.const inf) (f64.const -0x1.921fb54442d18p+2)) (i32.const 0)) +(assert_return (invoke "le" (f64.const inf) (f64.const 0x1.921fb54442d18p+2)) (i32.const 0)) +(assert_return (invoke "le" (f64.const -inf) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 1)) +(assert_return (invoke "le" (f64.const -inf) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 1)) +(assert_return (invoke "le" (f64.const inf) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 0)) +(assert_return (invoke "le" (f64.const inf) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) +(assert_return (invoke "le" (f64.const -inf) (f64.const -inf)) (i32.const 1)) +(assert_return (invoke "le" (f64.const -inf) (f64.const inf)) (i32.const 1)) +(assert_return (invoke "le" (f64.const inf) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "le" (f64.const inf) (f64.const inf)) (i32.const 1)) +(assert_return (invoke "le" (f64.const -inf) (f64.const -nan)) (i32.const 0)) +(assert_return (invoke "le" (f64.const -inf) (f64.const -nan:0x4000000000000)) (i32.const 0)) +(assert_return (invoke "le" (f64.const -inf) (f64.const nan)) (i32.const 0)) +(assert_return (invoke "le" (f64.const -inf) (f64.const nan:0x4000000000000)) (i32.const 0)) +(assert_return (invoke "le" (f64.const inf) (f64.const -nan)) (i32.const 0)) +(assert_return (invoke "le" (f64.const inf) (f64.const -nan:0x4000000000000)) (i32.const 0)) +(assert_return (invoke "le" (f64.const inf) (f64.const nan)) (i32.const 0)) +(assert_return (invoke "le" (f64.const inf) (f64.const nan:0x4000000000000)) (i32.const 0)) (assert_return (invoke "le" (f64.const -nan) (f64.const -0x0p+0)) (i32.const 0)) (assert_return (invoke "le" (f64.const -nan:0x4000000000000) (f64.const -0x0p+0)) (i32.const 0)) (assert_return (invoke "le" (f64.const -nan) (f64.const 0x0p+0)) (i32.const 0)) @@ -1586,14 +1586,14 @@ (assert_return (invoke "le" (f64.const nan:0x4000000000000) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 0)) (assert_return (invoke "le" (f64.const nan) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) (assert_return (invoke "le" (f64.const nan:0x4000000000000) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) -(assert_return (invoke "le" (f64.const -nan) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "le" (f64.const -nan:0x4000000000000) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "le" (f64.const -nan) (f64.const infinity)) (i32.const 0)) -(assert_return (invoke "le" (f64.const -nan:0x4000000000000) (f64.const infinity)) (i32.const 0)) -(assert_return (invoke "le" (f64.const nan) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "le" (f64.const nan:0x4000000000000) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "le" (f64.const nan) (f64.const infinity)) (i32.const 0)) -(assert_return (invoke "le" (f64.const nan:0x4000000000000) (f64.const infinity)) (i32.const 0)) +(assert_return (invoke "le" (f64.const -nan) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "le" (f64.const -nan:0x4000000000000) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "le" (f64.const -nan) (f64.const inf)) (i32.const 0)) +(assert_return (invoke "le" (f64.const -nan:0x4000000000000) (f64.const inf)) (i32.const 0)) +(assert_return (invoke "le" (f64.const nan) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "le" (f64.const nan:0x4000000000000) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "le" (f64.const nan) (f64.const inf)) (i32.const 0)) +(assert_return (invoke "le" (f64.const nan:0x4000000000000) (f64.const inf)) (i32.const 0)) (assert_return (invoke "le" (f64.const -nan) (f64.const -nan)) (i32.const 0)) (assert_return (invoke "le" (f64.const -nan:0x4000000000000) (f64.const -nan)) (i32.const 0)) (assert_return (invoke "le" (f64.const -nan) (f64.const -nan:0x4000000000000)) (i32.const 0)) @@ -1638,10 +1638,10 @@ (assert_return (invoke "gt" (f64.const -0x0p+0) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) (assert_return (invoke "gt" (f64.const 0x0p+0) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 1)) (assert_return (invoke "gt" (f64.const 0x0p+0) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) -(assert_return (invoke "gt" (f64.const -0x0p+0) (f64.const -infinity)) (i32.const 1)) -(assert_return (invoke "gt" (f64.const -0x0p+0) (f64.const infinity)) (i32.const 0)) -(assert_return (invoke "gt" (f64.const 0x0p+0) (f64.const -infinity)) (i32.const 1)) -(assert_return (invoke "gt" (f64.const 0x0p+0) (f64.const infinity)) (i32.const 0)) +(assert_return (invoke "gt" (f64.const -0x0p+0) (f64.const -inf)) (i32.const 1)) +(assert_return (invoke "gt" (f64.const -0x0p+0) (f64.const inf)) (i32.const 0)) +(assert_return (invoke "gt" (f64.const 0x0p+0) (f64.const -inf)) (i32.const 1)) +(assert_return (invoke "gt" (f64.const 0x0p+0) (f64.const inf)) (i32.const 0)) (assert_return (invoke "gt" (f64.const -0x0p+0) (f64.const -nan)) (i32.const 0)) (assert_return (invoke "gt" (f64.const -0x0p+0) (f64.const -nan:0x4000000000000)) (i32.const 0)) (assert_return (invoke "gt" (f64.const -0x0p+0) (f64.const nan)) (i32.const 0)) @@ -1678,10 +1678,10 @@ (assert_return (invoke "gt" (f64.const -0x0.0000000000001p-1022) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) (assert_return (invoke "gt" (f64.const 0x0.0000000000001p-1022) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 1)) (assert_return (invoke "gt" (f64.const 0x0.0000000000001p-1022) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) -(assert_return (invoke "gt" (f64.const -0x0.0000000000001p-1022) (f64.const -infinity)) (i32.const 1)) -(assert_return (invoke "gt" (f64.const -0x0.0000000000001p-1022) (f64.const infinity)) (i32.const 0)) -(assert_return (invoke "gt" (f64.const 0x0.0000000000001p-1022) (f64.const -infinity)) (i32.const 1)) -(assert_return (invoke "gt" (f64.const 0x0.0000000000001p-1022) (f64.const infinity)) (i32.const 0)) +(assert_return (invoke "gt" (f64.const -0x0.0000000000001p-1022) (f64.const -inf)) (i32.const 1)) +(assert_return (invoke "gt" (f64.const -0x0.0000000000001p-1022) (f64.const inf)) (i32.const 0)) +(assert_return (invoke "gt" (f64.const 0x0.0000000000001p-1022) (f64.const -inf)) (i32.const 1)) +(assert_return (invoke "gt" (f64.const 0x0.0000000000001p-1022) (f64.const inf)) (i32.const 0)) (assert_return (invoke "gt" (f64.const -0x0.0000000000001p-1022) (f64.const -nan)) (i32.const 0)) (assert_return (invoke "gt" (f64.const -0x0.0000000000001p-1022) (f64.const -nan:0x4000000000000)) (i32.const 0)) (assert_return (invoke "gt" (f64.const -0x0.0000000000001p-1022) (f64.const nan)) (i32.const 0)) @@ -1718,10 +1718,10 @@ (assert_return (invoke "gt" (f64.const -0x1p-1022) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) (assert_return (invoke "gt" (f64.const 0x1p-1022) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 1)) (assert_return (invoke "gt" (f64.const 0x1p-1022) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) -(assert_return (invoke "gt" (f64.const -0x1p-1022) (f64.const -infinity)) (i32.const 1)) -(assert_return (invoke "gt" (f64.const -0x1p-1022) (f64.const infinity)) (i32.const 0)) -(assert_return (invoke "gt" (f64.const 0x1p-1022) (f64.const -infinity)) (i32.const 1)) -(assert_return (invoke "gt" (f64.const 0x1p-1022) (f64.const infinity)) (i32.const 0)) +(assert_return (invoke "gt" (f64.const -0x1p-1022) (f64.const -inf)) (i32.const 1)) +(assert_return (invoke "gt" (f64.const -0x1p-1022) (f64.const inf)) (i32.const 0)) +(assert_return (invoke "gt" (f64.const 0x1p-1022) (f64.const -inf)) (i32.const 1)) +(assert_return (invoke "gt" (f64.const 0x1p-1022) (f64.const inf)) (i32.const 0)) (assert_return (invoke "gt" (f64.const -0x1p-1022) (f64.const -nan)) (i32.const 0)) (assert_return (invoke "gt" (f64.const -0x1p-1022) (f64.const -nan:0x4000000000000)) (i32.const 0)) (assert_return (invoke "gt" (f64.const -0x1p-1022) (f64.const nan)) (i32.const 0)) @@ -1758,10 +1758,10 @@ (assert_return (invoke "gt" (f64.const -0x1p-1) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) (assert_return (invoke "gt" (f64.const 0x1p-1) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 1)) (assert_return (invoke "gt" (f64.const 0x1p-1) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) -(assert_return (invoke "gt" (f64.const -0x1p-1) (f64.const -infinity)) (i32.const 1)) -(assert_return (invoke "gt" (f64.const -0x1p-1) (f64.const infinity)) (i32.const 0)) -(assert_return (invoke "gt" (f64.const 0x1p-1) (f64.const -infinity)) (i32.const 1)) -(assert_return (invoke "gt" (f64.const 0x1p-1) (f64.const infinity)) (i32.const 0)) +(assert_return (invoke "gt" (f64.const -0x1p-1) (f64.const -inf)) (i32.const 1)) +(assert_return (invoke "gt" (f64.const -0x1p-1) (f64.const inf)) (i32.const 0)) +(assert_return (invoke "gt" (f64.const 0x1p-1) (f64.const -inf)) (i32.const 1)) +(assert_return (invoke "gt" (f64.const 0x1p-1) (f64.const inf)) (i32.const 0)) (assert_return (invoke "gt" (f64.const -0x1p-1) (f64.const -nan)) (i32.const 0)) (assert_return (invoke "gt" (f64.const -0x1p-1) (f64.const -nan:0x4000000000000)) (i32.const 0)) (assert_return (invoke "gt" (f64.const -0x1p-1) (f64.const nan)) (i32.const 0)) @@ -1798,10 +1798,10 @@ (assert_return (invoke "gt" (f64.const -0x1p+0) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) (assert_return (invoke "gt" (f64.const 0x1p+0) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 1)) (assert_return (invoke "gt" (f64.const 0x1p+0) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) -(assert_return (invoke "gt" (f64.const -0x1p+0) (f64.const -infinity)) (i32.const 1)) -(assert_return (invoke "gt" (f64.const -0x1p+0) (f64.const infinity)) (i32.const 0)) -(assert_return (invoke "gt" (f64.const 0x1p+0) (f64.const -infinity)) (i32.const 1)) -(assert_return (invoke "gt" (f64.const 0x1p+0) (f64.const infinity)) (i32.const 0)) +(assert_return (invoke "gt" (f64.const -0x1p+0) (f64.const -inf)) (i32.const 1)) +(assert_return (invoke "gt" (f64.const -0x1p+0) (f64.const inf)) (i32.const 0)) +(assert_return (invoke "gt" (f64.const 0x1p+0) (f64.const -inf)) (i32.const 1)) +(assert_return (invoke "gt" (f64.const 0x1p+0) (f64.const inf)) (i32.const 0)) (assert_return (invoke "gt" (f64.const -0x1p+0) (f64.const -nan)) (i32.const 0)) (assert_return (invoke "gt" (f64.const -0x1p+0) (f64.const -nan:0x4000000000000)) (i32.const 0)) (assert_return (invoke "gt" (f64.const -0x1p+0) (f64.const nan)) (i32.const 0)) @@ -1838,10 +1838,10 @@ (assert_return (invoke "gt" (f64.const -0x1.921fb54442d18p+2) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) (assert_return (invoke "gt" (f64.const 0x1.921fb54442d18p+2) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 1)) (assert_return (invoke "gt" (f64.const 0x1.921fb54442d18p+2) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) -(assert_return (invoke "gt" (f64.const -0x1.921fb54442d18p+2) (f64.const -infinity)) (i32.const 1)) -(assert_return (invoke "gt" (f64.const -0x1.921fb54442d18p+2) (f64.const infinity)) (i32.const 0)) -(assert_return (invoke "gt" (f64.const 0x1.921fb54442d18p+2) (f64.const -infinity)) (i32.const 1)) -(assert_return (invoke "gt" (f64.const 0x1.921fb54442d18p+2) (f64.const infinity)) (i32.const 0)) +(assert_return (invoke "gt" (f64.const -0x1.921fb54442d18p+2) (f64.const -inf)) (i32.const 1)) +(assert_return (invoke "gt" (f64.const -0x1.921fb54442d18p+2) (f64.const inf)) (i32.const 0)) +(assert_return (invoke "gt" (f64.const 0x1.921fb54442d18p+2) (f64.const -inf)) (i32.const 1)) +(assert_return (invoke "gt" (f64.const 0x1.921fb54442d18p+2) (f64.const inf)) (i32.const 0)) (assert_return (invoke "gt" (f64.const -0x1.921fb54442d18p+2) (f64.const -nan)) (i32.const 0)) (assert_return (invoke "gt" (f64.const -0x1.921fb54442d18p+2) (f64.const -nan:0x4000000000000)) (i32.const 0)) (assert_return (invoke "gt" (f64.const -0x1.921fb54442d18p+2) (f64.const nan)) (i32.const 0)) @@ -1878,10 +1878,10 @@ (assert_return (invoke "gt" (f64.const -0x1.fffffffffffffp+1023) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) (assert_return (invoke "gt" (f64.const 0x1.fffffffffffffp+1023) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 1)) (assert_return (invoke "gt" (f64.const 0x1.fffffffffffffp+1023) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) -(assert_return (invoke "gt" (f64.const -0x1.fffffffffffffp+1023) (f64.const -infinity)) (i32.const 1)) -(assert_return (invoke "gt" (f64.const -0x1.fffffffffffffp+1023) (f64.const infinity)) (i32.const 0)) -(assert_return (invoke "gt" (f64.const 0x1.fffffffffffffp+1023) (f64.const -infinity)) (i32.const 1)) -(assert_return (invoke "gt" (f64.const 0x1.fffffffffffffp+1023) (f64.const infinity)) (i32.const 0)) +(assert_return (invoke "gt" (f64.const -0x1.fffffffffffffp+1023) (f64.const -inf)) (i32.const 1)) +(assert_return (invoke "gt" (f64.const -0x1.fffffffffffffp+1023) (f64.const inf)) (i32.const 0)) +(assert_return (invoke "gt" (f64.const 0x1.fffffffffffffp+1023) (f64.const -inf)) (i32.const 1)) +(assert_return (invoke "gt" (f64.const 0x1.fffffffffffffp+1023) (f64.const inf)) (i32.const 0)) (assert_return (invoke "gt" (f64.const -0x1.fffffffffffffp+1023) (f64.const -nan)) (i32.const 0)) (assert_return (invoke "gt" (f64.const -0x1.fffffffffffffp+1023) (f64.const -nan:0x4000000000000)) (i32.const 0)) (assert_return (invoke "gt" (f64.const -0x1.fffffffffffffp+1023) (f64.const nan)) (i32.const 0)) @@ -1890,46 +1890,46 @@ (assert_return (invoke "gt" (f64.const 0x1.fffffffffffffp+1023) (f64.const -nan:0x4000000000000)) (i32.const 0)) (assert_return (invoke "gt" (f64.const 0x1.fffffffffffffp+1023) (f64.const nan)) (i32.const 0)) (assert_return (invoke "gt" (f64.const 0x1.fffffffffffffp+1023) (f64.const nan:0x4000000000000)) (i32.const 0)) -(assert_return (invoke "gt" (f64.const -infinity) (f64.const -0x0p+0)) (i32.const 0)) -(assert_return (invoke "gt" (f64.const -infinity) (f64.const 0x0p+0)) (i32.const 0)) -(assert_return (invoke "gt" (f64.const infinity) (f64.const -0x0p+0)) (i32.const 1)) -(assert_return (invoke "gt" (f64.const infinity) (f64.const 0x0p+0)) (i32.const 1)) -(assert_return (invoke "gt" (f64.const -infinity) (f64.const -0x0.0000000000001p-1022)) (i32.const 0)) -(assert_return (invoke "gt" (f64.const -infinity) (f64.const 0x0.0000000000001p-1022)) (i32.const 0)) -(assert_return (invoke "gt" (f64.const infinity) (f64.const -0x0.0000000000001p-1022)) (i32.const 1)) -(assert_return (invoke "gt" (f64.const infinity) (f64.const 0x0.0000000000001p-1022)) (i32.const 1)) -(assert_return (invoke "gt" (f64.const -infinity) (f64.const -0x1p-1022)) (i32.const 0)) -(assert_return (invoke "gt" (f64.const -infinity) (f64.const 0x1p-1022)) (i32.const 0)) -(assert_return (invoke "gt" (f64.const infinity) (f64.const -0x1p-1022)) (i32.const 1)) -(assert_return (invoke "gt" (f64.const infinity) (f64.const 0x1p-1022)) (i32.const 1)) -(assert_return (invoke "gt" (f64.const -infinity) (f64.const -0x1p-1)) (i32.const 0)) -(assert_return (invoke "gt" (f64.const -infinity) (f64.const 0x1p-1)) (i32.const 0)) -(assert_return (invoke "gt" (f64.const infinity) (f64.const -0x1p-1)) (i32.const 1)) -(assert_return (invoke "gt" (f64.const infinity) (f64.const 0x1p-1)) (i32.const 1)) -(assert_return (invoke "gt" (f64.const -infinity) (f64.const -0x1p+0)) (i32.const 0)) -(assert_return (invoke "gt" (f64.const -infinity) (f64.const 0x1p+0)) (i32.const 0)) -(assert_return (invoke "gt" (f64.const infinity) (f64.const -0x1p+0)) (i32.const 1)) -(assert_return (invoke "gt" (f64.const infinity) (f64.const 0x1p+0)) (i32.const 1)) -(assert_return (invoke "gt" (f64.const -infinity) (f64.const -0x1.921fb54442d18p+2)) (i32.const 0)) -(assert_return (invoke "gt" (f64.const -infinity) (f64.const 0x1.921fb54442d18p+2)) (i32.const 0)) -(assert_return (invoke "gt" (f64.const infinity) (f64.const -0x1.921fb54442d18p+2)) (i32.const 1)) -(assert_return (invoke "gt" (f64.const infinity) (f64.const 0x1.921fb54442d18p+2)) (i32.const 1)) -(assert_return (invoke "gt" (f64.const -infinity) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 0)) -(assert_return (invoke "gt" (f64.const -infinity) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) -(assert_return (invoke "gt" (f64.const infinity) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 1)) -(assert_return (invoke "gt" (f64.const infinity) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 1)) -(assert_return (invoke "gt" (f64.const -infinity) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "gt" (f64.const -infinity) (f64.const infinity)) (i32.const 0)) -(assert_return (invoke "gt" (f64.const infinity) (f64.const -infinity)) (i32.const 1)) -(assert_return (invoke "gt" (f64.const infinity) (f64.const infinity)) (i32.const 0)) -(assert_return (invoke "gt" (f64.const -infinity) (f64.const -nan)) (i32.const 0)) -(assert_return (invoke "gt" (f64.const -infinity) (f64.const -nan:0x4000000000000)) (i32.const 0)) -(assert_return (invoke "gt" (f64.const -infinity) (f64.const nan)) (i32.const 0)) -(assert_return (invoke "gt" (f64.const -infinity) (f64.const nan:0x4000000000000)) (i32.const 0)) -(assert_return (invoke "gt" (f64.const infinity) (f64.const -nan)) (i32.const 0)) -(assert_return (invoke "gt" (f64.const infinity) (f64.const -nan:0x4000000000000)) (i32.const 0)) -(assert_return (invoke "gt" (f64.const infinity) (f64.const nan)) (i32.const 0)) -(assert_return (invoke "gt" (f64.const infinity) (f64.const nan:0x4000000000000)) (i32.const 0)) +(assert_return (invoke "gt" (f64.const -inf) (f64.const -0x0p+0)) (i32.const 0)) +(assert_return (invoke "gt" (f64.const -inf) (f64.const 0x0p+0)) (i32.const 0)) +(assert_return (invoke "gt" (f64.const inf) (f64.const -0x0p+0)) (i32.const 1)) +(assert_return (invoke "gt" (f64.const inf) (f64.const 0x0p+0)) (i32.const 1)) +(assert_return (invoke "gt" (f64.const -inf) (f64.const -0x0.0000000000001p-1022)) (i32.const 0)) +(assert_return (invoke "gt" (f64.const -inf) (f64.const 0x0.0000000000001p-1022)) (i32.const 0)) +(assert_return (invoke "gt" (f64.const inf) (f64.const -0x0.0000000000001p-1022)) (i32.const 1)) +(assert_return (invoke "gt" (f64.const inf) (f64.const 0x0.0000000000001p-1022)) (i32.const 1)) +(assert_return (invoke "gt" (f64.const -inf) (f64.const -0x1p-1022)) (i32.const 0)) +(assert_return (invoke "gt" (f64.const -inf) (f64.const 0x1p-1022)) (i32.const 0)) +(assert_return (invoke "gt" (f64.const inf) (f64.const -0x1p-1022)) (i32.const 1)) +(assert_return (invoke "gt" (f64.const inf) (f64.const 0x1p-1022)) (i32.const 1)) +(assert_return (invoke "gt" (f64.const -inf) (f64.const -0x1p-1)) (i32.const 0)) +(assert_return (invoke "gt" (f64.const -inf) (f64.const 0x1p-1)) (i32.const 0)) +(assert_return (invoke "gt" (f64.const inf) (f64.const -0x1p-1)) (i32.const 1)) +(assert_return (invoke "gt" (f64.const inf) (f64.const 0x1p-1)) (i32.const 1)) +(assert_return (invoke "gt" (f64.const -inf) (f64.const -0x1p+0)) (i32.const 0)) +(assert_return (invoke "gt" (f64.const -inf) (f64.const 0x1p+0)) (i32.const 0)) +(assert_return (invoke "gt" (f64.const inf) (f64.const -0x1p+0)) (i32.const 1)) +(assert_return (invoke "gt" (f64.const inf) (f64.const 0x1p+0)) (i32.const 1)) +(assert_return (invoke "gt" (f64.const -inf) (f64.const -0x1.921fb54442d18p+2)) (i32.const 0)) +(assert_return (invoke "gt" (f64.const -inf) (f64.const 0x1.921fb54442d18p+2)) (i32.const 0)) +(assert_return (invoke "gt" (f64.const inf) (f64.const -0x1.921fb54442d18p+2)) (i32.const 1)) +(assert_return (invoke "gt" (f64.const inf) (f64.const 0x1.921fb54442d18p+2)) (i32.const 1)) +(assert_return (invoke "gt" (f64.const -inf) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 0)) +(assert_return (invoke "gt" (f64.const -inf) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) +(assert_return (invoke "gt" (f64.const inf) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 1)) +(assert_return (invoke "gt" (f64.const inf) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 1)) +(assert_return (invoke "gt" (f64.const -inf) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "gt" (f64.const -inf) (f64.const inf)) (i32.const 0)) +(assert_return (invoke "gt" (f64.const inf) (f64.const -inf)) (i32.const 1)) +(assert_return (invoke "gt" (f64.const inf) (f64.const inf)) (i32.const 0)) +(assert_return (invoke "gt" (f64.const -inf) (f64.const -nan)) (i32.const 0)) +(assert_return (invoke "gt" (f64.const -inf) (f64.const -nan:0x4000000000000)) (i32.const 0)) +(assert_return (invoke "gt" (f64.const -inf) (f64.const nan)) (i32.const 0)) +(assert_return (invoke "gt" (f64.const -inf) (f64.const nan:0x4000000000000)) (i32.const 0)) +(assert_return (invoke "gt" (f64.const inf) (f64.const -nan)) (i32.const 0)) +(assert_return (invoke "gt" (f64.const inf) (f64.const -nan:0x4000000000000)) (i32.const 0)) +(assert_return (invoke "gt" (f64.const inf) (f64.const nan)) (i32.const 0)) +(assert_return (invoke "gt" (f64.const inf) (f64.const nan:0x4000000000000)) (i32.const 0)) (assert_return (invoke "gt" (f64.const -nan) (f64.const -0x0p+0)) (i32.const 0)) (assert_return (invoke "gt" (f64.const -nan:0x4000000000000) (f64.const -0x0p+0)) (i32.const 0)) (assert_return (invoke "gt" (f64.const -nan) (f64.const 0x0p+0)) (i32.const 0)) @@ -1986,14 +1986,14 @@ (assert_return (invoke "gt" (f64.const nan:0x4000000000000) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 0)) (assert_return (invoke "gt" (f64.const nan) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) (assert_return (invoke "gt" (f64.const nan:0x4000000000000) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) -(assert_return (invoke "gt" (f64.const -nan) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "gt" (f64.const -nan:0x4000000000000) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "gt" (f64.const -nan) (f64.const infinity)) (i32.const 0)) -(assert_return (invoke "gt" (f64.const -nan:0x4000000000000) (f64.const infinity)) (i32.const 0)) -(assert_return (invoke "gt" (f64.const nan) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "gt" (f64.const nan:0x4000000000000) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "gt" (f64.const nan) (f64.const infinity)) (i32.const 0)) -(assert_return (invoke "gt" (f64.const nan:0x4000000000000) (f64.const infinity)) (i32.const 0)) +(assert_return (invoke "gt" (f64.const -nan) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "gt" (f64.const -nan:0x4000000000000) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "gt" (f64.const -nan) (f64.const inf)) (i32.const 0)) +(assert_return (invoke "gt" (f64.const -nan:0x4000000000000) (f64.const inf)) (i32.const 0)) +(assert_return (invoke "gt" (f64.const nan) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "gt" (f64.const nan:0x4000000000000) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "gt" (f64.const nan) (f64.const inf)) (i32.const 0)) +(assert_return (invoke "gt" (f64.const nan:0x4000000000000) (f64.const inf)) (i32.const 0)) (assert_return (invoke "gt" (f64.const -nan) (f64.const -nan)) (i32.const 0)) (assert_return (invoke "gt" (f64.const -nan:0x4000000000000) (f64.const -nan)) (i32.const 0)) (assert_return (invoke "gt" (f64.const -nan) (f64.const -nan:0x4000000000000)) (i32.const 0)) @@ -2038,10 +2038,10 @@ (assert_return (invoke "ge" (f64.const -0x0p+0) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) (assert_return (invoke "ge" (f64.const 0x0p+0) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 1)) (assert_return (invoke "ge" (f64.const 0x0p+0) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) -(assert_return (invoke "ge" (f64.const -0x0p+0) (f64.const -infinity)) (i32.const 1)) -(assert_return (invoke "ge" (f64.const -0x0p+0) (f64.const infinity)) (i32.const 0)) -(assert_return (invoke "ge" (f64.const 0x0p+0) (f64.const -infinity)) (i32.const 1)) -(assert_return (invoke "ge" (f64.const 0x0p+0) (f64.const infinity)) (i32.const 0)) +(assert_return (invoke "ge" (f64.const -0x0p+0) (f64.const -inf)) (i32.const 1)) +(assert_return (invoke "ge" (f64.const -0x0p+0) (f64.const inf)) (i32.const 0)) +(assert_return (invoke "ge" (f64.const 0x0p+0) (f64.const -inf)) (i32.const 1)) +(assert_return (invoke "ge" (f64.const 0x0p+0) (f64.const inf)) (i32.const 0)) (assert_return (invoke "ge" (f64.const -0x0p+0) (f64.const -nan)) (i32.const 0)) (assert_return (invoke "ge" (f64.const -0x0p+0) (f64.const -nan:0x4000000000000)) (i32.const 0)) (assert_return (invoke "ge" (f64.const -0x0p+0) (f64.const nan)) (i32.const 0)) @@ -2078,10 +2078,10 @@ (assert_return (invoke "ge" (f64.const -0x0.0000000000001p-1022) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) (assert_return (invoke "ge" (f64.const 0x0.0000000000001p-1022) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 1)) (assert_return (invoke "ge" (f64.const 0x0.0000000000001p-1022) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) -(assert_return (invoke "ge" (f64.const -0x0.0000000000001p-1022) (f64.const -infinity)) (i32.const 1)) -(assert_return (invoke "ge" (f64.const -0x0.0000000000001p-1022) (f64.const infinity)) (i32.const 0)) -(assert_return (invoke "ge" (f64.const 0x0.0000000000001p-1022) (f64.const -infinity)) (i32.const 1)) -(assert_return (invoke "ge" (f64.const 0x0.0000000000001p-1022) (f64.const infinity)) (i32.const 0)) +(assert_return (invoke "ge" (f64.const -0x0.0000000000001p-1022) (f64.const -inf)) (i32.const 1)) +(assert_return (invoke "ge" (f64.const -0x0.0000000000001p-1022) (f64.const inf)) (i32.const 0)) +(assert_return (invoke "ge" (f64.const 0x0.0000000000001p-1022) (f64.const -inf)) (i32.const 1)) +(assert_return (invoke "ge" (f64.const 0x0.0000000000001p-1022) (f64.const inf)) (i32.const 0)) (assert_return (invoke "ge" (f64.const -0x0.0000000000001p-1022) (f64.const -nan)) (i32.const 0)) (assert_return (invoke "ge" (f64.const -0x0.0000000000001p-1022) (f64.const -nan:0x4000000000000)) (i32.const 0)) (assert_return (invoke "ge" (f64.const -0x0.0000000000001p-1022) (f64.const nan)) (i32.const 0)) @@ -2118,10 +2118,10 @@ (assert_return (invoke "ge" (f64.const -0x1p-1022) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) (assert_return (invoke "ge" (f64.const 0x1p-1022) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 1)) (assert_return (invoke "ge" (f64.const 0x1p-1022) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) -(assert_return (invoke "ge" (f64.const -0x1p-1022) (f64.const -infinity)) (i32.const 1)) -(assert_return (invoke "ge" (f64.const -0x1p-1022) (f64.const infinity)) (i32.const 0)) -(assert_return (invoke "ge" (f64.const 0x1p-1022) (f64.const -infinity)) (i32.const 1)) -(assert_return (invoke "ge" (f64.const 0x1p-1022) (f64.const infinity)) (i32.const 0)) +(assert_return (invoke "ge" (f64.const -0x1p-1022) (f64.const -inf)) (i32.const 1)) +(assert_return (invoke "ge" (f64.const -0x1p-1022) (f64.const inf)) (i32.const 0)) +(assert_return (invoke "ge" (f64.const 0x1p-1022) (f64.const -inf)) (i32.const 1)) +(assert_return (invoke "ge" (f64.const 0x1p-1022) (f64.const inf)) (i32.const 0)) (assert_return (invoke "ge" (f64.const -0x1p-1022) (f64.const -nan)) (i32.const 0)) (assert_return (invoke "ge" (f64.const -0x1p-1022) (f64.const -nan:0x4000000000000)) (i32.const 0)) (assert_return (invoke "ge" (f64.const -0x1p-1022) (f64.const nan)) (i32.const 0)) @@ -2158,10 +2158,10 @@ (assert_return (invoke "ge" (f64.const -0x1p-1) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) (assert_return (invoke "ge" (f64.const 0x1p-1) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 1)) (assert_return (invoke "ge" (f64.const 0x1p-1) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) -(assert_return (invoke "ge" (f64.const -0x1p-1) (f64.const -infinity)) (i32.const 1)) -(assert_return (invoke "ge" (f64.const -0x1p-1) (f64.const infinity)) (i32.const 0)) -(assert_return (invoke "ge" (f64.const 0x1p-1) (f64.const -infinity)) (i32.const 1)) -(assert_return (invoke "ge" (f64.const 0x1p-1) (f64.const infinity)) (i32.const 0)) +(assert_return (invoke "ge" (f64.const -0x1p-1) (f64.const -inf)) (i32.const 1)) +(assert_return (invoke "ge" (f64.const -0x1p-1) (f64.const inf)) (i32.const 0)) +(assert_return (invoke "ge" (f64.const 0x1p-1) (f64.const -inf)) (i32.const 1)) +(assert_return (invoke "ge" (f64.const 0x1p-1) (f64.const inf)) (i32.const 0)) (assert_return (invoke "ge" (f64.const -0x1p-1) (f64.const -nan)) (i32.const 0)) (assert_return (invoke "ge" (f64.const -0x1p-1) (f64.const -nan:0x4000000000000)) (i32.const 0)) (assert_return (invoke "ge" (f64.const -0x1p-1) (f64.const nan)) (i32.const 0)) @@ -2198,10 +2198,10 @@ (assert_return (invoke "ge" (f64.const -0x1p+0) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) (assert_return (invoke "ge" (f64.const 0x1p+0) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 1)) (assert_return (invoke "ge" (f64.const 0x1p+0) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) -(assert_return (invoke "ge" (f64.const -0x1p+0) (f64.const -infinity)) (i32.const 1)) -(assert_return (invoke "ge" (f64.const -0x1p+0) (f64.const infinity)) (i32.const 0)) -(assert_return (invoke "ge" (f64.const 0x1p+0) (f64.const -infinity)) (i32.const 1)) -(assert_return (invoke "ge" (f64.const 0x1p+0) (f64.const infinity)) (i32.const 0)) +(assert_return (invoke "ge" (f64.const -0x1p+0) (f64.const -inf)) (i32.const 1)) +(assert_return (invoke "ge" (f64.const -0x1p+0) (f64.const inf)) (i32.const 0)) +(assert_return (invoke "ge" (f64.const 0x1p+0) (f64.const -inf)) (i32.const 1)) +(assert_return (invoke "ge" (f64.const 0x1p+0) (f64.const inf)) (i32.const 0)) (assert_return (invoke "ge" (f64.const -0x1p+0) (f64.const -nan)) (i32.const 0)) (assert_return (invoke "ge" (f64.const -0x1p+0) (f64.const -nan:0x4000000000000)) (i32.const 0)) (assert_return (invoke "ge" (f64.const -0x1p+0) (f64.const nan)) (i32.const 0)) @@ -2238,10 +2238,10 @@ (assert_return (invoke "ge" (f64.const -0x1.921fb54442d18p+2) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) (assert_return (invoke "ge" (f64.const 0x1.921fb54442d18p+2) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 1)) (assert_return (invoke "ge" (f64.const 0x1.921fb54442d18p+2) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) -(assert_return (invoke "ge" (f64.const -0x1.921fb54442d18p+2) (f64.const -infinity)) (i32.const 1)) -(assert_return (invoke "ge" (f64.const -0x1.921fb54442d18p+2) (f64.const infinity)) (i32.const 0)) -(assert_return (invoke "ge" (f64.const 0x1.921fb54442d18p+2) (f64.const -infinity)) (i32.const 1)) -(assert_return (invoke "ge" (f64.const 0x1.921fb54442d18p+2) (f64.const infinity)) (i32.const 0)) +(assert_return (invoke "ge" (f64.const -0x1.921fb54442d18p+2) (f64.const -inf)) (i32.const 1)) +(assert_return (invoke "ge" (f64.const -0x1.921fb54442d18p+2) (f64.const inf)) (i32.const 0)) +(assert_return (invoke "ge" (f64.const 0x1.921fb54442d18p+2) (f64.const -inf)) (i32.const 1)) +(assert_return (invoke "ge" (f64.const 0x1.921fb54442d18p+2) (f64.const inf)) (i32.const 0)) (assert_return (invoke "ge" (f64.const -0x1.921fb54442d18p+2) (f64.const -nan)) (i32.const 0)) (assert_return (invoke "ge" (f64.const -0x1.921fb54442d18p+2) (f64.const -nan:0x4000000000000)) (i32.const 0)) (assert_return (invoke "ge" (f64.const -0x1.921fb54442d18p+2) (f64.const nan)) (i32.const 0)) @@ -2278,10 +2278,10 @@ (assert_return (invoke "ge" (f64.const -0x1.fffffffffffffp+1023) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) (assert_return (invoke "ge" (f64.const 0x1.fffffffffffffp+1023) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 1)) (assert_return (invoke "ge" (f64.const 0x1.fffffffffffffp+1023) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 1)) -(assert_return (invoke "ge" (f64.const -0x1.fffffffffffffp+1023) (f64.const -infinity)) (i32.const 1)) -(assert_return (invoke "ge" (f64.const -0x1.fffffffffffffp+1023) (f64.const infinity)) (i32.const 0)) -(assert_return (invoke "ge" (f64.const 0x1.fffffffffffffp+1023) (f64.const -infinity)) (i32.const 1)) -(assert_return (invoke "ge" (f64.const 0x1.fffffffffffffp+1023) (f64.const infinity)) (i32.const 0)) +(assert_return (invoke "ge" (f64.const -0x1.fffffffffffffp+1023) (f64.const -inf)) (i32.const 1)) +(assert_return (invoke "ge" (f64.const -0x1.fffffffffffffp+1023) (f64.const inf)) (i32.const 0)) +(assert_return (invoke "ge" (f64.const 0x1.fffffffffffffp+1023) (f64.const -inf)) (i32.const 1)) +(assert_return (invoke "ge" (f64.const 0x1.fffffffffffffp+1023) (f64.const inf)) (i32.const 0)) (assert_return (invoke "ge" (f64.const -0x1.fffffffffffffp+1023) (f64.const -nan)) (i32.const 0)) (assert_return (invoke "ge" (f64.const -0x1.fffffffffffffp+1023) (f64.const -nan:0x4000000000000)) (i32.const 0)) (assert_return (invoke "ge" (f64.const -0x1.fffffffffffffp+1023) (f64.const nan)) (i32.const 0)) @@ -2290,46 +2290,46 @@ (assert_return (invoke "ge" (f64.const 0x1.fffffffffffffp+1023) (f64.const -nan:0x4000000000000)) (i32.const 0)) (assert_return (invoke "ge" (f64.const 0x1.fffffffffffffp+1023) (f64.const nan)) (i32.const 0)) (assert_return (invoke "ge" (f64.const 0x1.fffffffffffffp+1023) (f64.const nan:0x4000000000000)) (i32.const 0)) -(assert_return (invoke "ge" (f64.const -infinity) (f64.const -0x0p+0)) (i32.const 0)) -(assert_return (invoke "ge" (f64.const -infinity) (f64.const 0x0p+0)) (i32.const 0)) -(assert_return (invoke "ge" (f64.const infinity) (f64.const -0x0p+0)) (i32.const 1)) -(assert_return (invoke "ge" (f64.const infinity) (f64.const 0x0p+0)) (i32.const 1)) -(assert_return (invoke "ge" (f64.const -infinity) (f64.const -0x0.0000000000001p-1022)) (i32.const 0)) -(assert_return (invoke "ge" (f64.const -infinity) (f64.const 0x0.0000000000001p-1022)) (i32.const 0)) -(assert_return (invoke "ge" (f64.const infinity) (f64.const -0x0.0000000000001p-1022)) (i32.const 1)) -(assert_return (invoke "ge" (f64.const infinity) (f64.const 0x0.0000000000001p-1022)) (i32.const 1)) -(assert_return (invoke "ge" (f64.const -infinity) (f64.const -0x1p-1022)) (i32.const 0)) -(assert_return (invoke "ge" (f64.const -infinity) (f64.const 0x1p-1022)) (i32.const 0)) -(assert_return (invoke "ge" (f64.const infinity) (f64.const -0x1p-1022)) (i32.const 1)) -(assert_return (invoke "ge" (f64.const infinity) (f64.const 0x1p-1022)) (i32.const 1)) -(assert_return (invoke "ge" (f64.const -infinity) (f64.const -0x1p-1)) (i32.const 0)) -(assert_return (invoke "ge" (f64.const -infinity) (f64.const 0x1p-1)) (i32.const 0)) -(assert_return (invoke "ge" (f64.const infinity) (f64.const -0x1p-1)) (i32.const 1)) -(assert_return (invoke "ge" (f64.const infinity) (f64.const 0x1p-1)) (i32.const 1)) -(assert_return (invoke "ge" (f64.const -infinity) (f64.const -0x1p+0)) (i32.const 0)) -(assert_return (invoke "ge" (f64.const -infinity) (f64.const 0x1p+0)) (i32.const 0)) -(assert_return (invoke "ge" (f64.const infinity) (f64.const -0x1p+0)) (i32.const 1)) -(assert_return (invoke "ge" (f64.const infinity) (f64.const 0x1p+0)) (i32.const 1)) -(assert_return (invoke "ge" (f64.const -infinity) (f64.const -0x1.921fb54442d18p+2)) (i32.const 0)) -(assert_return (invoke "ge" (f64.const -infinity) (f64.const 0x1.921fb54442d18p+2)) (i32.const 0)) -(assert_return (invoke "ge" (f64.const infinity) (f64.const -0x1.921fb54442d18p+2)) (i32.const 1)) -(assert_return (invoke "ge" (f64.const infinity) (f64.const 0x1.921fb54442d18p+2)) (i32.const 1)) -(assert_return (invoke "ge" (f64.const -infinity) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 0)) -(assert_return (invoke "ge" (f64.const -infinity) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) -(assert_return (invoke "ge" (f64.const infinity) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 1)) -(assert_return (invoke "ge" (f64.const infinity) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 1)) -(assert_return (invoke "ge" (f64.const -infinity) (f64.const -infinity)) (i32.const 1)) -(assert_return (invoke "ge" (f64.const -infinity) (f64.const infinity)) (i32.const 0)) -(assert_return (invoke "ge" (f64.const infinity) (f64.const -infinity)) (i32.const 1)) -(assert_return (invoke "ge" (f64.const infinity) (f64.const infinity)) (i32.const 1)) -(assert_return (invoke "ge" (f64.const -infinity) (f64.const -nan)) (i32.const 0)) -(assert_return (invoke "ge" (f64.const -infinity) (f64.const -nan:0x4000000000000)) (i32.const 0)) -(assert_return (invoke "ge" (f64.const -infinity) (f64.const nan)) (i32.const 0)) -(assert_return (invoke "ge" (f64.const -infinity) (f64.const nan:0x4000000000000)) (i32.const 0)) -(assert_return (invoke "ge" (f64.const infinity) (f64.const -nan)) (i32.const 0)) -(assert_return (invoke "ge" (f64.const infinity) (f64.const -nan:0x4000000000000)) (i32.const 0)) -(assert_return (invoke "ge" (f64.const infinity) (f64.const nan)) (i32.const 0)) -(assert_return (invoke "ge" (f64.const infinity) (f64.const nan:0x4000000000000)) (i32.const 0)) +(assert_return (invoke "ge" (f64.const -inf) (f64.const -0x0p+0)) (i32.const 0)) +(assert_return (invoke "ge" (f64.const -inf) (f64.const 0x0p+0)) (i32.const 0)) +(assert_return (invoke "ge" (f64.const inf) (f64.const -0x0p+0)) (i32.const 1)) +(assert_return (invoke "ge" (f64.const inf) (f64.const 0x0p+0)) (i32.const 1)) +(assert_return (invoke "ge" (f64.const -inf) (f64.const -0x0.0000000000001p-1022)) (i32.const 0)) +(assert_return (invoke "ge" (f64.const -inf) (f64.const 0x0.0000000000001p-1022)) (i32.const 0)) +(assert_return (invoke "ge" (f64.const inf) (f64.const -0x0.0000000000001p-1022)) (i32.const 1)) +(assert_return (invoke "ge" (f64.const inf) (f64.const 0x0.0000000000001p-1022)) (i32.const 1)) +(assert_return (invoke "ge" (f64.const -inf) (f64.const -0x1p-1022)) (i32.const 0)) +(assert_return (invoke "ge" (f64.const -inf) (f64.const 0x1p-1022)) (i32.const 0)) +(assert_return (invoke "ge" (f64.const inf) (f64.const -0x1p-1022)) (i32.const 1)) +(assert_return (invoke "ge" (f64.const inf) (f64.const 0x1p-1022)) (i32.const 1)) +(assert_return (invoke "ge" (f64.const -inf) (f64.const -0x1p-1)) (i32.const 0)) +(assert_return (invoke "ge" (f64.const -inf) (f64.const 0x1p-1)) (i32.const 0)) +(assert_return (invoke "ge" (f64.const inf) (f64.const -0x1p-1)) (i32.const 1)) +(assert_return (invoke "ge" (f64.const inf) (f64.const 0x1p-1)) (i32.const 1)) +(assert_return (invoke "ge" (f64.const -inf) (f64.const -0x1p+0)) (i32.const 0)) +(assert_return (invoke "ge" (f64.const -inf) (f64.const 0x1p+0)) (i32.const 0)) +(assert_return (invoke "ge" (f64.const inf) (f64.const -0x1p+0)) (i32.const 1)) +(assert_return (invoke "ge" (f64.const inf) (f64.const 0x1p+0)) (i32.const 1)) +(assert_return (invoke "ge" (f64.const -inf) (f64.const -0x1.921fb54442d18p+2)) (i32.const 0)) +(assert_return (invoke "ge" (f64.const -inf) (f64.const 0x1.921fb54442d18p+2)) (i32.const 0)) +(assert_return (invoke "ge" (f64.const inf) (f64.const -0x1.921fb54442d18p+2)) (i32.const 1)) +(assert_return (invoke "ge" (f64.const inf) (f64.const 0x1.921fb54442d18p+2)) (i32.const 1)) +(assert_return (invoke "ge" (f64.const -inf) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 0)) +(assert_return (invoke "ge" (f64.const -inf) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) +(assert_return (invoke "ge" (f64.const inf) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 1)) +(assert_return (invoke "ge" (f64.const inf) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 1)) +(assert_return (invoke "ge" (f64.const -inf) (f64.const -inf)) (i32.const 1)) +(assert_return (invoke "ge" (f64.const -inf) (f64.const inf)) (i32.const 0)) +(assert_return (invoke "ge" (f64.const inf) (f64.const -inf)) (i32.const 1)) +(assert_return (invoke "ge" (f64.const inf) (f64.const inf)) (i32.const 1)) +(assert_return (invoke "ge" (f64.const -inf) (f64.const -nan)) (i32.const 0)) +(assert_return (invoke "ge" (f64.const -inf) (f64.const -nan:0x4000000000000)) (i32.const 0)) +(assert_return (invoke "ge" (f64.const -inf) (f64.const nan)) (i32.const 0)) +(assert_return (invoke "ge" (f64.const -inf) (f64.const nan:0x4000000000000)) (i32.const 0)) +(assert_return (invoke "ge" (f64.const inf) (f64.const -nan)) (i32.const 0)) +(assert_return (invoke "ge" (f64.const inf) (f64.const -nan:0x4000000000000)) (i32.const 0)) +(assert_return (invoke "ge" (f64.const inf) (f64.const nan)) (i32.const 0)) +(assert_return (invoke "ge" (f64.const inf) (f64.const nan:0x4000000000000)) (i32.const 0)) (assert_return (invoke "ge" (f64.const -nan) (f64.const -0x0p+0)) (i32.const 0)) (assert_return (invoke "ge" (f64.const -nan:0x4000000000000) (f64.const -0x0p+0)) (i32.const 0)) (assert_return (invoke "ge" (f64.const -nan) (f64.const 0x0p+0)) (i32.const 0)) @@ -2386,14 +2386,14 @@ (assert_return (invoke "ge" (f64.const nan:0x4000000000000) (f64.const -0x1.fffffffffffffp+1023)) (i32.const 0)) (assert_return (invoke "ge" (f64.const nan) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) (assert_return (invoke "ge" (f64.const nan:0x4000000000000) (f64.const 0x1.fffffffffffffp+1023)) (i32.const 0)) -(assert_return (invoke "ge" (f64.const -nan) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "ge" (f64.const -nan:0x4000000000000) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "ge" (f64.const -nan) (f64.const infinity)) (i32.const 0)) -(assert_return (invoke "ge" (f64.const -nan:0x4000000000000) (f64.const infinity)) (i32.const 0)) -(assert_return (invoke "ge" (f64.const nan) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "ge" (f64.const nan:0x4000000000000) (f64.const -infinity)) (i32.const 0)) -(assert_return (invoke "ge" (f64.const nan) (f64.const infinity)) (i32.const 0)) -(assert_return (invoke "ge" (f64.const nan:0x4000000000000) (f64.const infinity)) (i32.const 0)) +(assert_return (invoke "ge" (f64.const -nan) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "ge" (f64.const -nan:0x4000000000000) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "ge" (f64.const -nan) (f64.const inf)) (i32.const 0)) +(assert_return (invoke "ge" (f64.const -nan:0x4000000000000) (f64.const inf)) (i32.const 0)) +(assert_return (invoke "ge" (f64.const nan) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "ge" (f64.const nan:0x4000000000000) (f64.const -inf)) (i32.const 0)) +(assert_return (invoke "ge" (f64.const nan) (f64.const inf)) (i32.const 0)) +(assert_return (invoke "ge" (f64.const nan:0x4000000000000) (f64.const inf)) (i32.const 0)) (assert_return (invoke "ge" (f64.const -nan) (f64.const -nan)) (i32.const 0)) (assert_return (invoke "ge" (f64.const -nan:0x4000000000000) (f64.const -nan)) (i32.const 0)) (assert_return (invoke "ge" (f64.const -nan) (f64.const -nan:0x4000000000000)) (i32.const 0)) @@ -2410,3 +2410,13 @@ (assert_return (invoke "ge" (f64.const nan:0x4000000000000) (f64.const nan)) (i32.const 0)) (assert_return (invoke "ge" (f64.const nan) (f64.const nan:0x4000000000000)) (i32.const 0)) (assert_return (invoke "ge" (f64.const nan:0x4000000000000) (f64.const nan:0x4000000000000)) (i32.const 0)) + + +;; Type check + +(assert_invalid (module (func (result f64) (f64.eq (i64.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result f64) (f64.ge (i64.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result f64) (f64.gt (i64.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result f64) (f64.le (i64.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result f64) (f64.lt (i64.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result f64) (f64.ne (i64.const 0) (f32.const 0)))) "type mismatch") diff --git a/test/core/fac.wast b/test/core/fac.wast index 3b388e20..ef10991a 100644 --- a/test/core/fac.wast +++ b/test/core/fac.wast @@ -1,19 +1,23 @@ (module ;; Recursive factorial (func (export "fac-rec") (param i64) (result i64) - (if i64 (i64.eq (get_local 0) (i64.const 0)) - (i64.const 1) - (i64.mul (get_local 0) (call 0 (i64.sub (get_local 0) (i64.const 1)))) + (if (result i64) (i64.eq (local.get 0) (i64.const 0)) + (then (i64.const 1)) + (else + (i64.mul (local.get 0) (call 0 (i64.sub (local.get 0) (i64.const 1)))) + ) ) ) ;; Recursive factorial named (func $fac-rec-named (export "fac-rec-named") (param $n i64) (result i64) - (if i64 (i64.eq (get_local $n) (i64.const 0)) - (i64.const 1) - (i64.mul - (get_local $n) - (call $fac-rec-named (i64.sub (get_local $n) (i64.const 1))) + (if (result i64) (i64.eq (local.get $n) (i64.const 0)) + (then (i64.const 1)) + (else + (i64.mul + (local.get $n) + (call $fac-rec-named (i64.sub (local.get $n) (i64.const 1))) + ) ) ) ) @@ -21,59 +25,59 @@ ;; Iterative factorial (func (export "fac-iter") (param i64) (result i64) (local i64 i64) - (set_local 1 (get_local 0)) - (set_local 2 (i64.const 1)) + (local.set 1 (local.get 0)) + (local.set 2 (i64.const 1)) (block (loop (if - (i64.eq (get_local 1) (i64.const 0)) - (br 2) - (block - (set_local 2 (i64.mul (get_local 1) (get_local 2))) - (set_local 1 (i64.sub (get_local 1) (i64.const 1))) + (i64.eq (local.get 1) (i64.const 0)) + (then (br 2)) + (else + (local.set 2 (i64.mul (local.get 1) (local.get 2))) + (local.set 1 (i64.sub (local.get 1) (i64.const 1))) ) ) (br 0) ) ) - (get_local 2) + (local.get 2) ) ;; Iterative factorial named (func (export "fac-iter-named") (param $n i64) (result i64) (local $i i64) (local $res i64) - (set_local $i (get_local $n)) - (set_local $res (i64.const 1)) + (local.set $i (local.get $n)) + (local.set $res (i64.const 1)) (block $done (loop $loop (if - (i64.eq (get_local $i) (i64.const 0)) - (br $done) - (block - (set_local $res (i64.mul (get_local $i) (get_local $res))) - (set_local $i (i64.sub (get_local $i) (i64.const 1))) + (i64.eq (local.get $i) (i64.const 0)) + (then (br $done)) + (else + (local.set $res (i64.mul (local.get $i) (local.get $res))) + (local.set $i (i64.sub (local.get $i) (i64.const 1))) ) ) (br $loop) ) ) - (get_local $res) + (local.get $res) ) ;; Optimized factorial. (func (export "fac-opt") (param i64) (result i64) (local i64) - (set_local 1 (i64.const 1)) + (local.set 1 (i64.const 1)) (block - (br_if 0 (i64.lt_s (get_local 0) (i64.const 2))) + (br_if 0 (i64.lt_s (local.get 0) (i64.const 2))) (loop - (set_local 1 (i64.mul (get_local 1) (get_local 0))) - (set_local 0 (i64.add (get_local 0) (i64.const -1))) - (br_if 0 (i64.gt_s (get_local 0) (i64.const 1))) + (local.set 1 (i64.mul (local.get 1) (local.get 0))) + (local.set 0 (i64.add (local.get 0) (i64.const -1))) + (br_if 0 (i64.gt_s (local.get 0) (i64.const 1))) ) ) - (get_local 1) + (local.get 1) ) ) diff --git a/test/core/float_exprs.wast b/test/core/float_exprs.wast index 9069c158..e6583634 100644 --- a/test/core/float_exprs.wast +++ b/test/core/float_exprs.wast @@ -5,7 +5,7 @@ (module (func (export "f64.no_contraction") (param $x f64) (param $y f64) (param $z f64) (result f64) - (f64.add (f64.mul (get_local $x) (get_local $y)) (get_local $z))) + (f64.add (f64.mul (local.get $x) (local.get $y)) (local.get $z))) ) (assert_return (invoke "f64.no_contraction" (f64.const -0x1.9e87ce14273afp-103) (f64.const 0x1.2515ad31db63ep+664) (f64.const 0x1.868c6685e6185p+533)) (f64.const -0x1.da94885b11493p+561)) @@ -18,9 +18,9 @@ (module (func (export "f32.no_fma") (param $x f32) (param $y f32) (param $z f32) (result f32) - (f32.add (f32.mul (get_local $x) (get_local $y)) (get_local $z))) + (f32.add (f32.mul (local.get $x) (local.get $y)) (local.get $z))) (func (export "f64.no_fma") (param $x f64) (param $y f64) (param $z f64) (result f64) - (f64.add (f64.mul (get_local $x) (get_local $y)) (get_local $z))) + (f64.add (f64.mul (local.get $x) (local.get $y)) (local.get $z))) ) (assert_return (invoke "f32.no_fma" (f32.const 0x1.a78402p+124) (f32.const 0x1.cf8548p-23) (f32.const 0x1.992adap+107)) (f32.const 0x1.a5262cp+107)) @@ -39,9 +39,9 @@ (module (func (export "f32.no_fold_add_zero") (param $x f32) (result f32) - (f32.add (get_local $x) (f32.const 0.0))) + (f32.add (local.get $x) (f32.const 0.0))) (func (export "f64.no_fold_add_zero") (param $x f64) (result f64) - (f64.add (get_local $x) (f64.const 0.0))) + (f64.add (local.get $x) (f64.const 0.0))) ) (assert_return (invoke "f32.no_fold_add_zero" (f32.const -0.0)) (f32.const 0.0)) @@ -53,9 +53,9 @@ (module (func (export "f32.no_fold_zero_sub") (param $x f32) (result f32) - (f32.sub (f32.const 0.0) (get_local $x))) + (f32.sub (f32.const 0.0) (local.get $x))) (func (export "f64.no_fold_zero_sub") (param $x f64) (result f64) - (f64.sub (f64.const 0.0) (get_local $x))) + (f64.sub (f64.const 0.0) (local.get $x))) ) (assert_return (invoke "f32.no_fold_zero_sub" (f32.const 0.0)) (f32.const 0.0)) @@ -67,9 +67,9 @@ (module (func (export "f32.no_fold_sub_zero") (param $x f32) (result f32) - (f32.sub (get_local $x) (f32.const 0.0))) + (f32.sub (local.get $x) (f32.const 0.0))) (func (export "f64.no_fold_sub_zero") (param $x f64) (result f64) - (f64.sub (get_local $x) (f64.const 0.0))) + (f64.sub (local.get $x) (f64.const 0.0))) ) (assert_return_arithmetic_nan (invoke "f32.no_fold_sub_zero" (f32.const nan:0x200000))) @@ -79,9 +79,9 @@ (module (func (export "f32.no_fold_mul_zero") (param $x f32) (result f32) - (f32.mul (get_local $x) (f32.const 0.0))) + (f32.mul (local.get $x) (f32.const 0.0))) (func (export "f64.no_fold_mul_zero") (param $x f64) (result f64) - (f64.mul (get_local $x) (f64.const 0.0))) + (f64.mul (local.get $x) (f64.const 0.0))) ) (assert_return (invoke "f32.no_fold_mul_zero" (f32.const -0.0)) (f32.const -0.0)) @@ -98,9 +98,9 @@ (module (func (export "f32.no_fold_mul_one") (param $x f32) (result f32) - (f32.mul (get_local $x) (f32.const 1.0))) + (f32.mul (local.get $x) (f32.const 1.0))) (func (export "f64.no_fold_mul_one") (param $x f64) (result f64) - (f64.mul (get_local $x) (f64.const 1.0))) + (f64.mul (local.get $x) (f64.const 1.0))) ) (assert_return_arithmetic_nan (invoke "f32.no_fold_mul_one" (f32.const nan:0x200000))) @@ -110,9 +110,9 @@ (module (func (export "f32.no_fold_zero_div") (param $x f32) (result f32) - (f32.div (f32.const 0.0) (get_local $x))) + (f32.div (f32.const 0.0) (local.get $x))) (func (export "f64.no_fold_zero_div") (param $x f64) (result f64) - (f64.div (f64.const 0.0) (get_local $x))) + (f64.div (f64.const 0.0) (local.get $x))) ) (assert_return_canonical_nan (invoke "f32.no_fold_zero_div" (f32.const 0.0))) @@ -128,9 +128,9 @@ (module (func (export "f32.no_fold_div_one") (param $x f32) (result f32) - (f32.div (get_local $x) (f32.const 1.0))) + (f32.div (local.get $x) (f32.const 1.0))) (func (export "f64.no_fold_div_one") (param $x f64) (result f64) - (f64.div (get_local $x) (f64.const 1.0))) + (f64.div (local.get $x) (f64.const 1.0))) ) (assert_return_arithmetic_nan (invoke "f32.no_fold_div_one" (f32.const nan:0x200000))) @@ -140,9 +140,9 @@ (module (func (export "f32.no_fold_div_neg1") (param $x f32) (result f32) - (f32.div (get_local $x) (f32.const -1.0))) + (f32.div (local.get $x) (f32.const -1.0))) (func (export "f64.no_fold_div_neg1") (param $x f64) (result f64) - (f64.div (get_local $x) (f64.const -1.0))) + (f64.div (local.get $x) (f64.const -1.0))) ) (assert_return_arithmetic_nan (invoke "f32.no_fold_div_neg1" (f32.const nan:0x200000))) @@ -152,9 +152,9 @@ (module (func (export "f32.no_fold_neg0_sub") (param $x f32) (result f32) - (f32.sub (f32.const -0.0) (get_local $x))) + (f32.sub (f32.const -0.0) (local.get $x))) (func (export "f64.no_fold_neg0_sub") (param $x f64) (result f64) - (f64.sub (f64.const -0.0) (get_local $x))) + (f64.sub (f64.const -0.0) (local.get $x))) ) (assert_return_arithmetic_nan (invoke "f32.no_fold_neg0_sub" (f32.const nan:0x200000))) @@ -164,9 +164,9 @@ (module (func (export "f32.no_fold_neg1_mul") (param $x f32) (result f32) - (f32.mul (f32.const -1.0) (get_local $x))) + (f32.mul (f32.const -1.0) (local.get $x))) (func (export "f64.no_fold_neg1_mul") (param $x f64) (result f64) - (f64.mul (f64.const -1.0) (get_local $x))) + (f64.mul (f64.const -1.0) (local.get $x))) ) (assert_return_arithmetic_nan (invoke "f32.no_fold_neg1_mul" (f32.const nan:0x200000))) @@ -176,9 +176,9 @@ (module (func (export "f32.no_fold_eq_self") (param $x f32) (result i32) - (f32.eq (get_local $x) (get_local $x))) + (f32.eq (local.get $x) (local.get $x))) (func (export "f64.no_fold_eq_self") (param $x f64) (result i32) - (f64.eq (get_local $x) (get_local $x))) + (f64.eq (local.get $x) (local.get $x))) ) (assert_return (invoke "f32.no_fold_eq_self" (f32.const nan)) (i32.const 0)) @@ -188,9 +188,9 @@ (module (func (export "f32.no_fold_ne_self") (param $x f32) (result i32) - (f32.ne (get_local $x) (get_local $x))) + (f32.ne (local.get $x) (local.get $x))) (func (export "f64.no_fold_ne_self") (param $x f64) (result i32) - (f64.ne (get_local $x) (get_local $x))) + (f64.ne (local.get $x) (local.get $x))) ) (assert_return (invoke "f32.no_fold_ne_self" (f32.const nan)) (i32.const 1)) @@ -200,30 +200,30 @@ (module (func (export "f32.no_fold_sub_self") (param $x f32) (result f32) - (f32.sub (get_local $x) (get_local $x))) + (f32.sub (local.get $x) (local.get $x))) (func (export "f64.no_fold_sub_self") (param $x f64) (result f64) - (f64.sub (get_local $x) (get_local $x))) + (f64.sub (local.get $x) (local.get $x))) ) -(assert_return_canonical_nan (invoke "f32.no_fold_sub_self" (f32.const infinity))) +(assert_return_canonical_nan (invoke "f32.no_fold_sub_self" (f32.const inf))) (assert_return_canonical_nan (invoke "f32.no_fold_sub_self" (f32.const nan))) -(assert_return_canonical_nan (invoke "f64.no_fold_sub_self" (f64.const infinity))) +(assert_return_canonical_nan (invoke "f64.no_fold_sub_self" (f64.const inf))) (assert_return_canonical_nan (invoke "f64.no_fold_sub_self" (f64.const nan))) ;; Test that x / x is not folded to 1.0. (module (func (export "f32.no_fold_div_self") (param $x f32) (result f32) - (f32.div (get_local $x) (get_local $x))) + (f32.div (local.get $x) (local.get $x))) (func (export "f64.no_fold_div_self") (param $x f64) (result f64) - (f64.div (get_local $x) (get_local $x))) + (f64.div (local.get $x) (local.get $x))) ) -(assert_return_canonical_nan (invoke "f32.no_fold_div_self" (f32.const infinity))) +(assert_return_canonical_nan (invoke "f32.no_fold_div_self" (f32.const inf))) (assert_return_canonical_nan (invoke "f32.no_fold_div_self" (f32.const nan))) (assert_return_canonical_nan (invoke "f32.no_fold_div_self" (f32.const 0.0))) (assert_return_canonical_nan (invoke "f32.no_fold_div_self" (f32.const -0.0))) -(assert_return_canonical_nan (invoke "f64.no_fold_div_self" (f64.const infinity))) +(assert_return_canonical_nan (invoke "f64.no_fold_div_self" (f64.const inf))) (assert_return_canonical_nan (invoke "f64.no_fold_div_self" (f64.const nan))) (assert_return_canonical_nan (invoke "f64.no_fold_div_self" (f64.const 0.0))) (assert_return_canonical_nan (invoke "f64.no_fold_div_self" (f64.const -0.0))) @@ -232,9 +232,9 @@ (module (func (export "f32.no_fold_div_3") (param $x f32) (result f32) - (f32.div (get_local $x) (f32.const 3.0))) + (f32.div (local.get $x) (f32.const 3.0))) (func (export "f64.no_fold_div_3") (param $x f64) (result f64) - (f64.div (get_local $x) (f64.const 3.0))) + (f64.div (local.get $x) (f64.const 3.0))) ) (assert_return (invoke "f32.no_fold_div_3" (f32.const -0x1.359c26p+50)) (f32.const -0x1.9cd032p+48)) @@ -252,9 +252,9 @@ (module (func (export "f32.no_factor") (param $x f32) (param $y f32) (param $z f32) (result f32) - (f32.add (f32.mul (get_local $x) (get_local $z)) (f32.mul (get_local $y) (get_local $z)))) + (f32.add (f32.mul (local.get $x) (local.get $z)) (f32.mul (local.get $y) (local.get $z)))) (func (export "f64.no_factor") (param $x f64) (param $y f64) (param $z f64) (result f64) - (f64.add (f64.mul (get_local $x) (get_local $z)) (f64.mul (get_local $y) (get_local $z)))) + (f64.add (f64.mul (local.get $x) (local.get $z)) (f64.mul (local.get $y) (local.get $z)))) ) (assert_return (invoke "f32.no_factor" (f32.const -0x1.4e2352p+40) (f32.const -0x1.842e2cp+49) (f32.const 0x1.eea602p+59)) (f32.const -0x1.77a7dp+109)) @@ -272,9 +272,9 @@ (module (func (export "f32.no_distribute") (param $x f32) (param $y f32) (param $z f32) (result f32) - (f32.mul (f32.add (get_local $x) (get_local $y)) (get_local $z))) + (f32.mul (f32.add (local.get $x) (local.get $y)) (local.get $z))) (func (export "f64.no_distribute") (param $x f64) (param $y f64) (param $z f64) (result f64) - (f64.mul (f64.add (get_local $x) (get_local $y)) (get_local $z))) + (f64.mul (f64.add (local.get $x) (local.get $y)) (local.get $z))) ) (assert_return (invoke "f32.no_distribute" (f32.const -0x1.4e2352p+40) (f32.const -0x1.842e2cp+49) (f32.const 0x1.eea602p+59)) (f32.const -0x1.77a7d2p+109)) @@ -292,9 +292,9 @@ (module (func (export "f32.no_regroup_div_mul") (param $x f32) (param $y f32) (param $z f32) (result f32) - (f32.mul (get_local $x) (f32.div (get_local $y) (get_local $z)))) + (f32.mul (local.get $x) (f32.div (local.get $y) (local.get $z)))) (func (export "f64.no_regroup_div_mul") (param $x f64) (param $y f64) (param $z f64) (result f64) - (f64.mul (get_local $x) (f64.div (get_local $y) (get_local $z)))) + (f64.mul (local.get $x) (f64.div (local.get $y) (local.get $z)))) ) (assert_return (invoke "f32.no_regroup_div_mul" (f32.const -0x1.2d14a6p-115) (f32.const -0x1.575a6cp-64) (f32.const 0x1.5cee0ep-116)) (f32.const 0x1.2844cap-63)) @@ -304,7 +304,7 @@ (assert_return (invoke "f32.no_regroup_div_mul" (f32.const 0x1.c6ae76p+112) (f32.const 0x1.fc953cp+24) (f32.const -0x1.60b3e8p+71)) (f32.const -0x1.47d0eap+66)) (assert_return (invoke "f64.no_regroup_div_mul" (f64.const 0x1.3c04b815e30bp-423) (f64.const -0x1.379646fd98127p-119) (f64.const 0x1.bddb158506031p-642)) (f64.const -0x1.b9b3301f2dd2dp+99)) (assert_return (invoke "f64.no_regroup_div_mul" (f64.const 0x1.46b3a402f86d5p+337) (f64.const 0x1.6fbf1b9e1798dp-447) (f64.const -0x1.bd9704a5a6a06p+797)) (f64.const -0x0p+0)) -(assert_return (invoke "f64.no_regroup_div_mul" (f64.const 0x1.6c9765bb4347fp-479) (f64.const 0x1.a4af42e34a141p+902) (f64.const 0x1.d2dde70eb68f9p-448)) (f64.const infinity)) +(assert_return (invoke "f64.no_regroup_div_mul" (f64.const 0x1.6c9765bb4347fp-479) (f64.const 0x1.a4af42e34a141p+902) (f64.const 0x1.d2dde70eb68f9p-448)) (f64.const inf)) (assert_return (invoke "f64.no_regroup_div_mul" (f64.const -0x1.706023645be72p+480) (f64.const -0x1.6c229f7d9101dp+611) (f64.const -0x1.4d50fa68d3d9ep+836)) (f64.const -0x1.926fa3cacc651p+255)) (assert_return (invoke "f64.no_regroup_div_mul" (f64.const 0x1.8cc63d8caf4c7p-599) (f64.const 0x1.8671ac4c35753p-878) (f64.const -0x1.ef35b1695e659p-838)) (f64.const -0x1.38d55f56406dp-639)) @@ -312,29 +312,29 @@ (module (func (export "f32.no_regroup_mul_div") (param $x f32) (param $y f32) (param $z f32) (result f32) - (f32.div (f32.mul (get_local $x) (get_local $y)) (get_local $z))) + (f32.div (f32.mul (local.get $x) (local.get $y)) (local.get $z))) (func (export "f64.no_regroup_mul_div") (param $x f64) (param $y f64) (param $z f64) (result f64) - (f64.div (f64.mul (get_local $x) (get_local $y)) (get_local $z))) + (f64.div (f64.mul (local.get $x) (local.get $y)) (local.get $z))) ) (assert_return (invoke "f32.no_regroup_mul_div" (f32.const -0x1.2d14a6p-115) (f32.const -0x1.575a6cp-64) (f32.const 0x1.5cee0ep-116)) (f32.const 0x0p+0)) (assert_return (invoke "f32.no_regroup_mul_div" (f32.const -0x1.454738p+91) (f32.const -0x1.b28a66p-115) (f32.const -0x1.f53908p+72)) (f32.const -0x1.1a00e8p-96)) (assert_return (invoke "f32.no_regroup_mul_div" (f32.const -0x1.6be56ep+16) (f32.const -0x1.b46fc6p-21) (f32.const -0x1.a51df6p-123)) (f32.const -0x1.79225ap+118)) (assert_return (invoke "f32.no_regroup_mul_div" (f32.const -0x1.c343f8p-94) (f32.const 0x1.e4d906p+73) (f32.const 0x1.be69f8p+68)) (f32.const -0x1.ea1df4p-89)) -(assert_return (invoke "f32.no_regroup_mul_div" (f32.const 0x1.c6ae76p+112) (f32.const 0x1.fc953cp+24) (f32.const -0x1.60b3e8p+71)) (f32.const -infinity)) +(assert_return (invoke "f32.no_regroup_mul_div" (f32.const 0x1.c6ae76p+112) (f32.const 0x1.fc953cp+24) (f32.const -0x1.60b3e8p+71)) (f32.const -inf)) (assert_return (invoke "f64.no_regroup_mul_div" (f64.const 0x1.3c04b815e30bp-423) (f64.const -0x1.379646fd98127p-119) (f64.const 0x1.bddb158506031p-642)) (f64.const -0x1.b9b3301f2dd2ep+99)) (assert_return (invoke "f64.no_regroup_mul_div" (f64.const 0x1.46b3a402f86d5p+337) (f64.const 0x1.6fbf1b9e1798dp-447) (f64.const -0x1.bd9704a5a6a06p+797)) (f64.const -0x1.0da0b6328e09p-907)) (assert_return (invoke "f64.no_regroup_mul_div" (f64.const 0x1.6c9765bb4347fp-479) (f64.const 0x1.a4af42e34a141p+902) (f64.const 0x1.d2dde70eb68f9p-448)) (f64.const 0x1.4886b6d9a9a79p+871)) -(assert_return (invoke "f64.no_regroup_mul_div" (f64.const -0x1.706023645be72p+480) (f64.const -0x1.6c229f7d9101dp+611) (f64.const -0x1.4d50fa68d3d9ep+836)) (f64.const -infinity)) +(assert_return (invoke "f64.no_regroup_mul_div" (f64.const -0x1.706023645be72p+480) (f64.const -0x1.6c229f7d9101dp+611) (f64.const -0x1.4d50fa68d3d9ep+836)) (f64.const -inf)) (assert_return (invoke "f64.no_regroup_mul_div" (f64.const 0x1.8cc63d8caf4c7p-599) (f64.const 0x1.8671ac4c35753p-878) (f64.const -0x1.ef35b1695e659p-838)) (f64.const -0x0p+0)) ;; Test that x+y+z+w is not reassociated. (module (func (export "f32.no_reassociate_add") (param $x f32) (param $y f32) (param $z f32) (param $w f32) (result f32) - (f32.add (f32.add (f32.add (get_local $x) (get_local $y)) (get_local $z)) (get_local $w))) + (f32.add (f32.add (f32.add (local.get $x) (local.get $y)) (local.get $z)) (local.get $w))) (func (export "f64.no_reassociate_add") (param $x f64) (param $y f64) (param $z f64) (param $w f64) (result f64) - (f64.add (f64.add (f64.add (get_local $x) (get_local $y)) (get_local $z)) (get_local $w))) + (f64.add (f64.add (f64.add (local.get $x) (local.get $y)) (local.get $z)) (local.get $w))) ) (assert_return (invoke "f32.no_reassociate_add" (f32.const -0x1.5f7ddcp+44) (f32.const 0x1.854e1p+34) (f32.const -0x1.b2068cp+47) (f32.const -0x1.209692p+41)) (f32.const -0x1.e26c76p+47)) @@ -352,9 +352,9 @@ (module (func (export "f32.no_reassociate_mul") (param $x f32) (param $y f32) (param $z f32) (param $w f32) (result f32) - (f32.mul (f32.mul (f32.mul (get_local $x) (get_local $y)) (get_local $z)) (get_local $w))) + (f32.mul (f32.mul (f32.mul (local.get $x) (local.get $y)) (local.get $z)) (local.get $w))) (func (export "f64.no_reassociate_mul") (param $x f64) (param $y f64) (param $z f64) (param $w f64) (result f64) - (f64.mul (f64.mul (f64.mul (get_local $x) (get_local $y)) (get_local $z)) (get_local $w))) + (f64.mul (f64.mul (f64.mul (local.get $x) (local.get $y)) (local.get $z)) (local.get $w))) ) (assert_return (invoke "f32.no_reassociate_mul" (f32.const 0x1.950ba8p-116) (f32.const 0x1.efdacep-33) (f32.const -0x1.5f9bcp+102) (f32.const 0x1.f04508p-56)) (f32.const -0x1.ff356ep-101)) @@ -372,23 +372,23 @@ (module (func (export "f32.no_fold_div_0") (param $x f32) (result f32) - (f32.div (get_local $x) (f32.const 0.0))) + (f32.div (local.get $x) (f32.const 0.0))) (func (export "f64.no_fold_div_0") (param $x f64) (result f64) - (f64.div (get_local $x) (f64.const 0.0))) + (f64.div (local.get $x) (f64.const 0.0))) ) -(assert_return (invoke "f32.no_fold_div_0" (f32.const 1.0)) (f32.const infinity)) -(assert_return (invoke "f32.no_fold_div_0" (f32.const -1.0)) (f32.const -infinity)) -(assert_return (invoke "f32.no_fold_div_0" (f32.const infinity)) (f32.const infinity)) -(assert_return (invoke "f32.no_fold_div_0" (f32.const -infinity)) (f32.const -infinity)) +(assert_return (invoke "f32.no_fold_div_0" (f32.const 1.0)) (f32.const inf)) +(assert_return (invoke "f32.no_fold_div_0" (f32.const -1.0)) (f32.const -inf)) +(assert_return (invoke "f32.no_fold_div_0" (f32.const inf)) (f32.const inf)) +(assert_return (invoke "f32.no_fold_div_0" (f32.const -inf)) (f32.const -inf)) (assert_return_canonical_nan (invoke "f32.no_fold_div_0" (f32.const 0))) (assert_return_canonical_nan (invoke "f32.no_fold_div_0" (f32.const -0))) (assert_return_arithmetic_nan (invoke "f32.no_fold_div_0" (f32.const nan:0x200000))) (assert_return_canonical_nan (invoke "f32.no_fold_div_0" (f32.const nan))) -(assert_return (invoke "f64.no_fold_div_0" (f64.const 1.0)) (f64.const infinity)) -(assert_return (invoke "f64.no_fold_div_0" (f64.const -1.0)) (f64.const -infinity)) -(assert_return (invoke "f64.no_fold_div_0" (f64.const infinity)) (f64.const infinity)) -(assert_return (invoke "f64.no_fold_div_0" (f64.const -infinity)) (f64.const -infinity)) +(assert_return (invoke "f64.no_fold_div_0" (f64.const 1.0)) (f64.const inf)) +(assert_return (invoke "f64.no_fold_div_0" (f64.const -1.0)) (f64.const -inf)) +(assert_return (invoke "f64.no_fold_div_0" (f64.const inf)) (f64.const inf)) +(assert_return (invoke "f64.no_fold_div_0" (f64.const -inf)) (f64.const -inf)) (assert_return_canonical_nan (invoke "f64.no_fold_div_0" (f64.const 0))) (assert_return_canonical_nan (invoke "f64.no_fold_div_0" (f64.const -0))) (assert_return_canonical_nan (invoke "f64.no_fold_div_0" (f64.const nan))) @@ -398,23 +398,23 @@ (module (func (export "f32.no_fold_div_neg0") (param $x f32) (result f32) - (f32.div (get_local $x) (f32.const -0.0))) + (f32.div (local.get $x) (f32.const -0.0))) (func (export "f64.no_fold_div_neg0") (param $x f64) (result f64) - (f64.div (get_local $x) (f64.const -0.0))) + (f64.div (local.get $x) (f64.const -0.0))) ) -(assert_return (invoke "f32.no_fold_div_neg0" (f32.const 1.0)) (f32.const -infinity)) -(assert_return (invoke "f32.no_fold_div_neg0" (f32.const -1.0)) (f32.const infinity)) -(assert_return (invoke "f32.no_fold_div_neg0" (f32.const infinity)) (f32.const -infinity)) -(assert_return (invoke "f32.no_fold_div_neg0" (f32.const -infinity)) (f32.const infinity)) +(assert_return (invoke "f32.no_fold_div_neg0" (f32.const 1.0)) (f32.const -inf)) +(assert_return (invoke "f32.no_fold_div_neg0" (f32.const -1.0)) (f32.const inf)) +(assert_return (invoke "f32.no_fold_div_neg0" (f32.const inf)) (f32.const -inf)) +(assert_return (invoke "f32.no_fold_div_neg0" (f32.const -inf)) (f32.const inf)) (assert_return_canonical_nan (invoke "f32.no_fold_div_neg0" (f32.const 0))) (assert_return_canonical_nan (invoke "f32.no_fold_div_neg0" (f32.const -0))) (assert_return_arithmetic_nan (invoke "f32.no_fold_div_neg0" (f32.const nan:0x200000))) (assert_return_canonical_nan (invoke "f32.no_fold_div_neg0" (f32.const nan))) -(assert_return (invoke "f64.no_fold_div_neg0" (f64.const 1.0)) (f64.const -infinity)) -(assert_return (invoke "f64.no_fold_div_neg0" (f64.const -1.0)) (f64.const infinity)) -(assert_return (invoke "f64.no_fold_div_neg0" (f64.const infinity)) (f64.const -infinity)) -(assert_return (invoke "f64.no_fold_div_neg0" (f64.const -infinity)) (f64.const infinity)) +(assert_return (invoke "f64.no_fold_div_neg0" (f64.const 1.0)) (f64.const -inf)) +(assert_return (invoke "f64.no_fold_div_neg0" (f64.const -1.0)) (f64.const inf)) +(assert_return (invoke "f64.no_fold_div_neg0" (f64.const inf)) (f64.const -inf)) +(assert_return (invoke "f64.no_fold_div_neg0" (f64.const -inf)) (f64.const inf)) (assert_return_canonical_nan (invoke "f64.no_fold_div_neg0" (f64.const 0))) (assert_return_canonical_nan (invoke "f64.no_fold_div_neg0" (f64.const -0))) (assert_return_canonical_nan (invoke "f64.no_fold_div_neg0" (f64.const nan))) @@ -424,11 +424,11 @@ (module (func (export "f32.no_fold_to_hypot") (param $x f32) (param $y f32) (result f32) - (f32.sqrt (f32.add (f32.mul (get_local $x) (get_local $x)) - (f32.mul (get_local $y) (get_local $y))))) + (f32.sqrt (f32.add (f32.mul (local.get $x) (local.get $x)) + (f32.mul (local.get $y) (local.get $y))))) (func (export "f64.no_fold_to_hypot") (param $x f64) (param $y f64) (result f64) - (f64.sqrt (f64.add (f64.mul (get_local $x) (get_local $x)) - (f64.mul (get_local $y) (get_local $y))))) + (f64.sqrt (f64.add (f64.mul (local.get $x) (local.get $x)) + (f64.mul (local.get $y) (local.get $y))))) ) (assert_return (invoke "f32.no_fold_to_hypot" (f32.const 0x1.c2f338p-81) (f32.const 0x1.401b5ep-68)) (f32.const 0x1.401cccp-68)) @@ -446,7 +446,7 @@ (module (func (export "f32.no_approximate_reciprocal") (param $x f32) (result f32) - (f32.div (f32.const 1.0) (get_local $x))) + (f32.div (f32.const 1.0) (local.get $x))) ) (assert_return (invoke "f32.no_approximate_reciprocal" (f32.const -0x1.2900b6p-10)) (f32.const -0x1.b950d4p+9)) @@ -459,9 +459,9 @@ (module (func (export "f32.no_approximate_reciprocal_sqrt") (param $x f32) (result f32) - (f32.div (f32.const 1.0) (f32.sqrt (get_local $x)))) + (f32.div (f32.const 1.0) (f32.sqrt (local.get $x)))) (func (export "f64.no_fuse_reciprocal_sqrt") (param $x f64) (result f64) - (f64.div (f64.const 1.0) (f64.sqrt (get_local $x)))) + (f64.div (f64.const 1.0) (f64.sqrt (local.get $x)))) ) (assert_return (invoke "f32.no_approximate_reciprocal_sqrt" (f32.const 0x1.6af12ap-43)) (f32.const 0x1.300ed4p+21)) @@ -480,7 +480,7 @@ (module (func (export "f32.no_approximate_sqrt_reciprocal") (param $x f32) (result f32) - (f32.sqrt (f32.div (f32.const 1.0) (get_local $x)))) + (f32.sqrt (f32.div (f32.const 1.0) (local.get $x)))) ) (assert_return (invoke "f32.no_approximate_sqrt_reciprocal" (f32.const 0x1.a4c986p+60)) (f32.const 0x1.8f5ac6p-31)) @@ -493,13 +493,13 @@ (module (func (export "i32.no_fold_f32_s") (param i32) (result i32) - (i32.trunc_s/f32 (f32.convert_s/i32 (get_local 0)))) + (i32.trunc_f32_s (f32.convert_i32_s (local.get 0)))) (func (export "i32.no_fold_f32_u") (param i32) (result i32) - (i32.trunc_u/f32 (f32.convert_u/i32 (get_local 0)))) + (i32.trunc_f32_u (f32.convert_i32_u (local.get 0)))) (func (export "i64.no_fold_f64_s") (param i64) (result i64) - (i64.trunc_s/f64 (f64.convert_s/i64 (get_local 0)))) + (i64.trunc_f64_s (f64.convert_i64_s (local.get 0)))) (func (export "i64.no_fold_f64_u") (param i64) (result i64) - (i64.trunc_u/f64 (f64.convert_u/i64 (get_local 0)))) + (i64.trunc_f64_u (f64.convert_i64_u (local.get 0)))) ) (assert_return (invoke "i32.no_fold_f32_s" (i32.const 0x1000000)) (i32.const 0x1000000)) @@ -522,9 +522,9 @@ (module (func (export "f32.no_fold_add_sub") (param $x f32) (param $y f32) (result f32) - (f32.sub (f32.add (get_local $x) (get_local $y)) (get_local $y))) + (f32.sub (f32.add (local.get $x) (local.get $y)) (local.get $y))) (func (export "f64.no_fold_add_sub") (param $x f64) (param $y f64) (result f64) - (f64.sub (f64.add (get_local $x) (get_local $y)) (get_local $y))) + (f64.sub (f64.add (local.get $x) (local.get $y)) (local.get $y))) ) (assert_return (invoke "f32.no_fold_add_sub" (f32.const 0x1.b553e4p-47) (f32.const -0x1.67db2cp-26)) (f32.const 0x1.cp-47)) @@ -543,9 +543,9 @@ (module (func (export "f32.no_fold_sub_add") (param $x f32) (param $y f32) (result f32) - (f32.add (f32.sub (get_local $x) (get_local $y)) (get_local $y))) + (f32.add (f32.sub (local.get $x) (local.get $y)) (local.get $y))) (func (export "f64.no_fold_sub_add") (param $x f64) (param $y f64) (result f64) - (f64.add (f64.sub (get_local $x) (get_local $y)) (get_local $y))) + (f64.add (f64.sub (local.get $x) (local.get $y)) (local.get $y))) ) (assert_return (invoke "f32.no_fold_sub_add" (f32.const -0x1.523cb8p+9) (f32.const 0x1.93096cp+8)) (f32.const -0x1.523cbap+9)) @@ -564,9 +564,9 @@ (module (func (export "f32.no_fold_mul_div") (param $x f32) (param $y f32) (result f32) - (f32.div (f32.mul (get_local $x) (get_local $y)) (get_local $y))) + (f32.div (f32.mul (local.get $x) (local.get $y)) (local.get $y))) (func (export "f64.no_fold_mul_div") (param $x f64) (param $y f64) (result f64) - (f64.div (f64.mul (get_local $x) (get_local $y)) (get_local $y))) + (f64.div (f64.mul (local.get $x) (local.get $y)) (local.get $y))) ) (assert_return (invoke "f32.no_fold_mul_div" (f32.const -0x1.cd859ap+54) (f32.const 0x1.6ca936p-47)) (f32.const -0x1.cd8598p+54)) @@ -585,9 +585,9 @@ (module (func (export "f32.no_fold_div_mul") (param $x f32) (param $y f32) (result f32) - (f32.mul (f32.div (get_local $x) (get_local $y)) (get_local $y))) + (f32.mul (f32.div (local.get $x) (local.get $y)) (local.get $y))) (func (export "f64.no_fold_div_mul") (param $x f64) (param $y f64) (result f64) - (f64.mul (f64.div (get_local $x) (get_local $y)) (get_local $y))) + (f64.mul (f64.div (local.get $x) (local.get $y)) (local.get $y))) ) (assert_return (invoke "f32.no_fold_div_mul" (f32.const -0x1.dc6364p+38) (f32.const 0x1.d630ecp+29)) (f32.const -0x1.dc6362p+38)) @@ -602,11 +602,23 @@ (assert_return (invoke "f64.no_fold_div_mul" (f64.const -0x1.e75859d2f0765p-278) (f64.const -0x1.5f19b6ab497f9p+283)) (f64.const -0x1.e75859d2f0764p-278)) (assert_return (invoke "f64.no_fold_div_mul" (f64.const -0x1.515fe9c3b5f5p+620) (f64.const 0x1.36be869c99f7ap+989)) (f64.const -0x1.515fe9c3b5f4fp+620)) +;; Test that x/2*2 is not folded to x. + +(module + (func (export "f32.no_fold_div2_mul2") (param $x f32) (result f32) + (f32.mul (f32.div (local.get $x) (f32.const 2.0)) (f32.const 2.0))) + (func (export "f64.no_fold_div2_mul2") (param $x f64) (result f64) + (f64.mul (f64.div (local.get $x) (f64.const 2.0)) (f64.const 2.0))) +) + +(assert_return (invoke "f32.no_fold_div2_mul2" (f32.const 0x1.fffffep-126)) (f32.const 0x1p-125)) +(assert_return (invoke "f64.no_fold_div2_mul2" (f64.const 0x1.fffffffffffffp-1022)) (f64.const 0x1p-1021)) + ;; Test that promote(demote(x)) is not folded to x. (module (func (export "no_fold_demote_promote") (param $x f64) (result f64) - (f64.promote/f32 (f32.demote/f64 (get_local $x)))) + (f64.promote_f32 (f32.demote_f64 (local.get $x)))) ) (assert_return (invoke "no_fold_demote_promote" (f64.const -0x1.dece272390f5dp-133)) (f64.const -0x1.decep-133)) @@ -620,7 +632,7 @@ (module (func (export "no_fold_promote_demote") (param $x f32) (result f32) - (f32.demote/f64 (f64.promote/f32 (get_local $x)))) + (f32.demote_f64 (f64.promote_f32 (local.get $x)))) ) (assert_return_arithmetic_nan (invoke "no_fold_promote_demote" (f32.const nan:0x200000))) @@ -634,16 +646,16 @@ (assert_return (invoke "no_fold_promote_demote" (f32.const -0x1p-126)) (f32.const -0x1p-126)) (assert_return (invoke "no_fold_promote_demote" (f32.const 0x1.fffffep+127)) (f32.const 0x1.fffffep+127)) (assert_return (invoke "no_fold_promote_demote" (f32.const -0x1.fffffep+127)) (f32.const -0x1.fffffep+127)) -(assert_return (invoke "no_fold_promote_demote" (f32.const infinity)) (f32.const infinity)) -(assert_return (invoke "no_fold_promote_demote" (f32.const -infinity)) (f32.const -infinity)) +(assert_return (invoke "no_fold_promote_demote" (f32.const inf)) (f32.const inf)) +(assert_return (invoke "no_fold_promote_demote" (f32.const -inf)) (f32.const -inf)) ;; Test that demote(x+promote(y)) is not folded to demote(x)+y. (module (func (export "no_demote_mixed_add") (param $x f64) (param $y f32) (result f32) - (f32.demote/f64 (f64.add (get_local $x) (f64.promote/f32 (get_local $y))))) + (f32.demote_f64 (f64.add (local.get $x) (f64.promote_f32 (local.get $y))))) (func (export "no_demote_mixed_add_commuted") (param $y f32) (param $x f64) (result f32) - (f32.demote/f64 (f64.add (f64.promote/f32 (get_local $y)) (get_local $x)))) + (f32.demote_f64 (f64.add (f64.promote_f32 (local.get $y)) (local.get $x)))) ) (assert_return (invoke "no_demote_mixed_add" (f64.const 0x1.f51a9d04854f9p-95) (f32.const 0x1.3f4e9cp-119)) (f32.const 0x1.f51a9ep-95)) @@ -662,7 +674,7 @@ (module (func (export "no_demote_mixed_sub") (param $x f64) (param $y f32) (result f32) - (f32.demote/f64 (f64.sub (get_local $x) (f64.promote/f32 (get_local $y))))) + (f32.demote_f64 (f64.sub (local.get $x) (f64.promote_f32 (local.get $y))))) ) (assert_return (invoke "no_demote_mixed_sub" (f64.const 0x1.a0a183220e9b1p+82) (f32.const 0x1.c5acf8p+61)) (f32.const 0x1.a0a174p+82)) @@ -675,37 +687,37 @@ (module (func (export "f32.i32.no_fold_trunc_s_convert_s") (param $x f32) (result f32) - (f32.convert_s/i32 (i32.trunc_s/f32 (get_local $x)))) + (f32.convert_i32_s (i32.trunc_f32_s (local.get $x)))) (func (export "f32.i32.no_fold_trunc_u_convert_s") (param $x f32) (result f32) - (f32.convert_s/i32 (i32.trunc_u/f32 (get_local $x)))) + (f32.convert_i32_s (i32.trunc_f32_u (local.get $x)))) (func (export "f32.i32.no_fold_trunc_s_convert_u") (param $x f32) (result f32) - (f32.convert_u/i32 (i32.trunc_s/f32 (get_local $x)))) + (f32.convert_i32_u (i32.trunc_f32_s (local.get $x)))) (func (export "f32.i32.no_fold_trunc_u_convert_u") (param $x f32) (result f32) - (f32.convert_u/i32 (i32.trunc_u/f32 (get_local $x)))) + (f32.convert_i32_u (i32.trunc_f32_u (local.get $x)))) (func (export "f64.i32.no_fold_trunc_s_convert_s") (param $x f64) (result f64) - (f64.convert_s/i32 (i32.trunc_s/f64 (get_local $x)))) + (f64.convert_i32_s (i32.trunc_f64_s (local.get $x)))) (func (export "f64.i32.no_fold_trunc_u_convert_s") (param $x f64) (result f64) - (f64.convert_s/i32 (i32.trunc_u/f64 (get_local $x)))) + (f64.convert_i32_s (i32.trunc_f64_u (local.get $x)))) (func (export "f64.i32.no_fold_trunc_s_convert_u") (param $x f64) (result f64) - (f64.convert_u/i32 (i32.trunc_s/f64 (get_local $x)))) + (f64.convert_i32_u (i32.trunc_f64_s (local.get $x)))) (func (export "f64.i32.no_fold_trunc_u_convert_u") (param $x f64) (result f64) - (f64.convert_u/i32 (i32.trunc_u/f64 (get_local $x)))) + (f64.convert_i32_u (i32.trunc_f64_u (local.get $x)))) (func (export "f32.i64.no_fold_trunc_s_convert_s") (param $x f32) (result f32) - (f32.convert_s/i64 (i64.trunc_s/f32 (get_local $x)))) + (f32.convert_i64_s (i64.trunc_f32_s (local.get $x)))) (func (export "f32.i64.no_fold_trunc_u_convert_s") (param $x f32) (result f32) - (f32.convert_s/i64 (i64.trunc_u/f32 (get_local $x)))) + (f32.convert_i64_s (i64.trunc_f32_u (local.get $x)))) (func (export "f32.i64.no_fold_trunc_s_convert_u") (param $x f32) (result f32) - (f32.convert_u/i64 (i64.trunc_s/f32 (get_local $x)))) + (f32.convert_i64_u (i64.trunc_f32_s (local.get $x)))) (func (export "f32.i64.no_fold_trunc_u_convert_u") (param $x f32) (result f32) - (f32.convert_u/i64 (i64.trunc_u/f32 (get_local $x)))) + (f32.convert_i64_u (i64.trunc_f32_u (local.get $x)))) (func (export "f64.i64.no_fold_trunc_s_convert_s") (param $x f64) (result f64) - (f64.convert_s/i64 (i64.trunc_s/f64 (get_local $x)))) + (f64.convert_i64_s (i64.trunc_f64_s (local.get $x)))) (func (export "f64.i64.no_fold_trunc_u_convert_s") (param $x f64) (result f64) - (f64.convert_s/i64 (i64.trunc_u/f64 (get_local $x)))) + (f64.convert_i64_s (i64.trunc_f64_u (local.get $x)))) (func (export "f64.i64.no_fold_trunc_s_convert_u") (param $x f64) (result f64) - (f64.convert_u/i64 (i64.trunc_s/f64 (get_local $x)))) + (f64.convert_i64_u (i64.trunc_f64_s (local.get $x)))) (func (export "f64.i64.no_fold_trunc_u_convert_u") (param $x f64) (result f64) - (f64.convert_u/i64 (i64.trunc_u/f64 (get_local $x)))) + (f64.convert_i64_u (i64.trunc_f64_u (local.get $x)))) ) (assert_return (invoke "f32.i32.no_fold_trunc_s_convert_s" (f32.const 1.5)) (f32.const 1.0)) @@ -750,23 +762,23 @@ (module (memory 1 1) - (func (export "init") (param $i i32) (param $x f32) (f32.store (get_local $i) (get_local $x))) + (func (export "init") (param $i i32) (param $x f32) (f32.store (local.get $i) (local.get $x))) (func (export "run") (param $n i32) (param $z f32) (local $i i32) (block $exit (loop $cont (f32.store - (get_local $i) - (f32.div (f32.load (get_local $i)) (get_local $z)) + (local.get $i) + (f32.div (f32.load (local.get $i)) (local.get $z)) ) - (set_local $i (i32.add (get_local $i) (i32.const 4))) - (br_if $cont (i32.lt_u (get_local $i) (get_local $n))) + (local.set $i (i32.add (local.get $i) (i32.const 4))) + (br_if $cont (i32.lt_u (local.get $i) (local.get $n))) ) ) ) - (func (export "check") (param $i i32) (result f32) (f32.load (get_local $i))) + (func (export "check") (param $i i32) (result f32) (f32.load (local.get $i))) ) (invoke "init" (i32.const 0) (f32.const 15.1)) @@ -785,23 +797,23 @@ (module (memory 1 1) - (func (export "init") (param $i i32) (param $x f64) (f64.store (get_local $i) (get_local $x))) + (func (export "init") (param $i i32) (param $x f64) (f64.store (local.get $i) (local.get $x))) (func (export "run") (param $n i32) (param $z f64) (local $i i32) (block $exit (loop $cont (f64.store - (get_local $i) - (f64.div (f64.load (get_local $i)) (get_local $z)) + (local.get $i) + (f64.div (f64.load (local.get $i)) (local.get $z)) ) - (set_local $i (i32.add (get_local $i) (i32.const 8))) - (br_if $cont (i32.lt_u (get_local $i) (get_local $n))) + (local.set $i (i32.add (local.get $i) (i32.const 8))) + (br_if $cont (i32.lt_u (local.get $i) (local.get $n))) ) ) ) - (func (export "check") (param $i i32) (result f64) (f64.load (get_local $i))) + (func (export "check") (param $i i32) (result f64) (f64.load (local.get $i))) ) (invoke "init" (i32.const 0) (f64.const 15.1)) @@ -821,15 +833,15 @@ ;; Test that ult/ugt/etc. aren't folded to olt/ogt/etc. (module - (func (export "f32.ult") (param $x f32) (param $y f32) (result i32) (i32.eqz (f32.ge (get_local $x) (get_local $y)))) - (func (export "f32.ule") (param $x f32) (param $y f32) (result i32) (i32.eqz (f32.gt (get_local $x) (get_local $y)))) - (func (export "f32.ugt") (param $x f32) (param $y f32) (result i32) (i32.eqz (f32.le (get_local $x) (get_local $y)))) - (func (export "f32.uge") (param $x f32) (param $y f32) (result i32) (i32.eqz (f32.lt (get_local $x) (get_local $y)))) + (func (export "f32.ult") (param $x f32) (param $y f32) (result i32) (i32.eqz (f32.ge (local.get $x) (local.get $y)))) + (func (export "f32.ule") (param $x f32) (param $y f32) (result i32) (i32.eqz (f32.gt (local.get $x) (local.get $y)))) + (func (export "f32.ugt") (param $x f32) (param $y f32) (result i32) (i32.eqz (f32.le (local.get $x) (local.get $y)))) + (func (export "f32.uge") (param $x f32) (param $y f32) (result i32) (i32.eqz (f32.lt (local.get $x) (local.get $y)))) - (func (export "f64.ult") (param $x f64) (param $y f64) (result i32) (i32.eqz (f64.ge (get_local $x) (get_local $y)))) - (func (export "f64.ule") (param $x f64) (param $y f64) (result i32) (i32.eqz (f64.gt (get_local $x) (get_local $y)))) - (func (export "f64.ugt") (param $x f64) (param $y f64) (result i32) (i32.eqz (f64.le (get_local $x) (get_local $y)))) - (func (export "f64.uge") (param $x f64) (param $y f64) (result i32) (i32.eqz (f64.lt (get_local $x) (get_local $y)))) + (func (export "f64.ult") (param $x f64) (param $y f64) (result i32) (i32.eqz (f64.ge (local.get $x) (local.get $y)))) + (func (export "f64.ule") (param $x f64) (param $y f64) (result i32) (i32.eqz (f64.gt (local.get $x) (local.get $y)))) + (func (export "f64.ugt") (param $x f64) (param $y f64) (result i32) (i32.eqz (f64.le (local.get $x) (local.get $y)))) + (func (export "f64.uge") (param $x f64) (param $y f64) (result i32) (i32.eqz (f64.lt (local.get $x) (local.get $y)))) ) (assert_return (invoke "f32.ult" (f32.const 3.0) (f32.const 2.0)) (i32.const 0)) @@ -868,15 +880,15 @@ ;; Test that x= y and friends. (module (func (export "f32.not_lt") (param $x f32) (param $y f32) (result i32) - (i32.eqz (f32.lt (get_local $x) (get_local $y)))) + (i32.eqz (f32.lt (local.get $x) (local.get $y)))) (func (export "f32.not_le") (param $x f32) (param $y f32) (result i32) - (i32.eqz (f32.le (get_local $x) (get_local $y)))) + (i32.eqz (f32.le (local.get $x) (local.get $y)))) (func (export "f32.not_gt") (param $x f32) (param $y f32) (result i32) - (i32.eqz (f32.gt (get_local $x) (get_local $y)))) + (i32.eqz (f32.gt (local.get $x) (local.get $y)))) (func (export "f32.not_ge") (param $x f32) (param $y f32) (result i32) - (i32.eqz (f32.ge (get_local $x) (get_local $y)))) + (i32.eqz (f32.ge (local.get $x) (local.get $y)))) (func (export "f64.not_lt") (param $x f64) (param $y f64) (result i32) - (i32.eqz (f64.lt (get_local $x) (get_local $y)))) + (i32.eqz (f64.lt (local.get $x) (local.get $y)))) (func (export "f64.not_le") (param $x f64) (param $y f64) (result i32) - (i32.eqz (f64.le (get_local $x) (get_local $y)))) + (i32.eqz (f64.le (local.get $x) (local.get $y)))) (func (export "f64.not_gt") (param $x f64) (param $y f64) (result i32) - (i32.eqz (f64.gt (get_local $x) (get_local $y)))) + (i32.eqz (f64.gt (local.get $x) (local.get $y)))) (func (export "f64.not_ge") (param $x f64) (param $y f64) (result i32) - (i32.eqz (f64.ge (get_local $x) (get_local $y)))) + (i32.eqz (f64.ge (local.get $x) (local.get $y)))) ) (assert_return (invoke "f32.not_lt" (f32.const nan) (f32.const 0.0)) (i32.const 1)) @@ -2089,14 +2165,14 @@ (func (export "f32.epsilon") (result f32) (local $x f32) (local $result f32) - (set_local $x (f32.const 1)) + (local.set $x (f32.const 1)) (loop $loop (br_if $loop (f32.gt (f32.add - (tee_local $x + (local.tee $x (f32.mul - (tee_local $result (get_local $x)) + (local.tee $result (local.get $x)) (f32.const 0.5) ) ) @@ -2106,20 +2182,20 @@ ) ) ) - (get_local $result) + (local.get $result) ) (func (export "f64.epsilon") (result f64) (local $x f64) (local $result f64) - (set_local $x (f64.const 1)) + (local.set $x (f64.const 1)) (loop $loop (br_if $loop (f64.gt (f64.add - (tee_local $x + (local.tee $x (f64.mul - (tee_local $result (get_local $x)) + (local.tee $result (local.get $x)) (f64.const 0.5) ) ) @@ -2129,7 +2205,7 @@ ) ) ) - (get_local $result) + (local.get $result) ) ) @@ -2141,22 +2217,22 @@ (module (func (export "f32.no_trichotomy_lt") (param $x f32) (param $y f32) (result i32) - (i32.or (f32.lt (get_local $x) (get_local $y)) (f32.ge (get_local $x) (get_local $y)))) + (i32.or (f32.lt (local.get $x) (local.get $y)) (f32.ge (local.get $x) (local.get $y)))) (func (export "f32.no_trichotomy_le") (param $x f32) (param $y f32) (result i32) - (i32.or (f32.le (get_local $x) (get_local $y)) (f32.gt (get_local $x) (get_local $y)))) + (i32.or (f32.le (local.get $x) (local.get $y)) (f32.gt (local.get $x) (local.get $y)))) (func (export "f32.no_trichotomy_gt") (param $x f32) (param $y f32) (result i32) - (i32.or (f32.gt (get_local $x) (get_local $y)) (f32.le (get_local $x) (get_local $y)))) + (i32.or (f32.gt (local.get $x) (local.get $y)) (f32.le (local.get $x) (local.get $y)))) (func (export "f32.no_trichotomy_ge") (param $x f32) (param $y f32) (result i32) - (i32.or (f32.ge (get_local $x) (get_local $y)) (f32.lt (get_local $x) (get_local $y)))) + (i32.or (f32.ge (local.get $x) (local.get $y)) (f32.lt (local.get $x) (local.get $y)))) (func (export "f64.no_trichotomy_lt") (param $x f64) (param $y f64) (result i32) - (i32.or (f64.lt (get_local $x) (get_local $y)) (f64.ge (get_local $x) (get_local $y)))) + (i32.or (f64.lt (local.get $x) (local.get $y)) (f64.ge (local.get $x) (local.get $y)))) (func (export "f64.no_trichotomy_le") (param $x f64) (param $y f64) (result i32) - (i32.or (f64.le (get_local $x) (get_local $y)) (f64.gt (get_local $x) (get_local $y)))) + (i32.or (f64.le (local.get $x) (local.get $y)) (f64.gt (local.get $x) (local.get $y)))) (func (export "f64.no_trichotomy_gt") (param $x f64) (param $y f64) (result i32) - (i32.or (f64.gt (get_local $x) (get_local $y)) (f64.le (get_local $x) (get_local $y)))) + (i32.or (f64.gt (local.get $x) (local.get $y)) (f64.le (local.get $x) (local.get $y)))) (func (export "f64.no_trichotomy_ge") (param $x f64) (param $y f64) (result i32) - (i32.or (f64.ge (get_local $x) (get_local $y)) (f64.lt (get_local $x) (get_local $y)))) + (i32.or (f64.ge (local.get $x) (local.get $y)) (f64.lt (local.get $x) (local.get $y)))) ) (assert_return (invoke "f32.no_trichotomy_lt" (f32.const 0.0) (f32.const nan)) (i32.const 0)) @@ -2174,79 +2250,79 @@ (module (func (export "f32.arithmetic_nan_bitpattern") (param $x i32) (param $y i32) (result i32) - (i32.and (i32.reinterpret/f32 + (i32.and (i32.reinterpret_f32 (f32.div - (f32.reinterpret/i32 (get_local $x)) - (f32.reinterpret/i32 (get_local $y)))) + (f32.reinterpret_i32 (local.get $x)) + (f32.reinterpret_i32 (local.get $y)))) (i32.const 0x7fc00000))) (func (export "f32.canonical_nan_bitpattern") (param $x i32) (param $y i32) (result i32) - (i32.and (i32.reinterpret/f32 + (i32.and (i32.reinterpret_f32 (f32.div - (f32.reinterpret/i32 (get_local $x)) - (f32.reinterpret/i32 (get_local $y)))) + (f32.reinterpret_i32 (local.get $x)) + (f32.reinterpret_i32 (local.get $y)))) (i32.const 0x7fffffff))) (func (export "f32.nonarithmetic_nan_bitpattern") (param $x i32) (result i32) - (i32.reinterpret/f32 (f32.neg (f32.reinterpret/i32 (get_local $x))))) + (i32.reinterpret_f32 (f32.neg (f32.reinterpret_i32 (local.get $x))))) (func (export "f64.arithmetic_nan_bitpattern") (param $x i64) (param $y i64) (result i64) - (i64.and (i64.reinterpret/f64 + (i64.and (i64.reinterpret_f64 (f64.div - (f64.reinterpret/i64 (get_local $x)) - (f64.reinterpret/i64 (get_local $y)))) + (f64.reinterpret_i64 (local.get $x)) + (f64.reinterpret_i64 (local.get $y)))) (i64.const 0x7ff8000000000000))) (func (export "f64.canonical_nan_bitpattern") (param $x i64) (param $y i64) (result i64) - (i64.and (i64.reinterpret/f64 + (i64.and (i64.reinterpret_f64 (f64.div - (f64.reinterpret/i64 (get_local $x)) - (f64.reinterpret/i64 (get_local $y)))) + (f64.reinterpret_i64 (local.get $x)) + (f64.reinterpret_i64 (local.get $y)))) (i64.const 0x7fffffffffffffff))) (func (export "f64.nonarithmetic_nan_bitpattern") (param $x i64) (result i64) - (i64.reinterpret/f64 (f64.neg (f64.reinterpret/i64 (get_local $x))))) + (i64.reinterpret_f64 (f64.neg (f64.reinterpret_i64 (local.get $x))))) ;; Versions of no_fold testcases that only care about NaN bitpatterns. (func (export "f32.no_fold_sub_zero") (param $x i32) (result i32) - (i32.and (i32.reinterpret/f32 (f32.sub (f32.reinterpret/i32 (get_local $x)) (f32.const 0.0))) + (i32.and (i32.reinterpret_f32 (f32.sub (f32.reinterpret_i32 (local.get $x)) (f32.const 0.0))) (i32.const 0x7fc00000))) (func (export "f32.no_fold_neg0_sub") (param $x i32) (result i32) - (i32.and (i32.reinterpret/f32 (f32.sub (f32.const -0.0) (f32.reinterpret/i32 (get_local $x)))) + (i32.and (i32.reinterpret_f32 (f32.sub (f32.const -0.0) (f32.reinterpret_i32 (local.get $x)))) (i32.const 0x7fc00000))) (func (export "f32.no_fold_mul_one") (param $x i32) (result i32) - (i32.and (i32.reinterpret/f32 (f32.mul (f32.reinterpret/i32 (get_local $x)) (f32.const 1.0))) + (i32.and (i32.reinterpret_f32 (f32.mul (f32.reinterpret_i32 (local.get $x)) (f32.const 1.0))) (i32.const 0x7fc00000))) (func (export "f32.no_fold_neg1_mul") (param $x i32) (result i32) - (i32.and (i32.reinterpret/f32 (f32.mul (f32.const -1.0) (f32.reinterpret/i32 (get_local $x)))) + (i32.and (i32.reinterpret_f32 (f32.mul (f32.const -1.0) (f32.reinterpret_i32 (local.get $x)))) (i32.const 0x7fc00000))) (func (export "f32.no_fold_div_one") (param $x i32) (result i32) - (i32.and (i32.reinterpret/f32 (f32.div (f32.reinterpret/i32 (get_local $x)) (f32.const 1.0))) + (i32.and (i32.reinterpret_f32 (f32.div (f32.reinterpret_i32 (local.get $x)) (f32.const 1.0))) (i32.const 0x7fc00000))) (func (export "f32.no_fold_div_neg1") (param $x i32) (result i32) - (i32.and (i32.reinterpret/f32 (f32.div (f32.reinterpret/i32 (get_local $x)) (f32.const -1.0))) + (i32.and (i32.reinterpret_f32 (f32.div (f32.reinterpret_i32 (local.get $x)) (f32.const -1.0))) (i32.const 0x7fc00000))) (func (export "f64.no_fold_sub_zero") (param $x i64) (result i64) - (i64.and (i64.reinterpret/f64 (f64.sub (f64.reinterpret/i64 (get_local $x)) (f64.const 0.0))) + (i64.and (i64.reinterpret_f64 (f64.sub (f64.reinterpret_i64 (local.get $x)) (f64.const 0.0))) (i64.const 0x7ff8000000000000))) (func (export "f64.no_fold_neg0_sub") (param $x i64) (result i64) - (i64.and (i64.reinterpret/f64 (f64.sub (f64.const -0.0) (f64.reinterpret/i64 (get_local $x)))) + (i64.and (i64.reinterpret_f64 (f64.sub (f64.const -0.0) (f64.reinterpret_i64 (local.get $x)))) (i64.const 0x7ff8000000000000))) (func (export "f64.no_fold_mul_one") (param $x i64) (result i64) - (i64.and (i64.reinterpret/f64 (f64.mul (f64.reinterpret/i64 (get_local $x)) (f64.const 1.0))) + (i64.and (i64.reinterpret_f64 (f64.mul (f64.reinterpret_i64 (local.get $x)) (f64.const 1.0))) (i64.const 0x7ff8000000000000))) (func (export "f64.no_fold_neg1_mul") (param $x i64) (result i64) - (i64.and (i64.reinterpret/f64 (f64.mul (f64.const -1.0) (f64.reinterpret/i64 (get_local $x)))) + (i64.and (i64.reinterpret_f64 (f64.mul (f64.const -1.0) (f64.reinterpret_i64 (local.get $x)))) (i64.const 0x7ff8000000000000))) (func (export "f64.no_fold_div_one") (param $x i64) (result i64) - (i64.and (i64.reinterpret/f64 (f64.div (f64.reinterpret/i64 (get_local $x)) (f64.const 1.0))) + (i64.and (i64.reinterpret_f64 (f64.div (f64.reinterpret_i64 (local.get $x)) (f64.const 1.0))) (i64.const 0x7ff8000000000000))) (func (export "f64.no_fold_div_neg1") (param $x i64) (result i64) - (i64.and (i64.reinterpret/f64 (f64.div (f64.reinterpret/i64 (get_local $x)) (f64.const -1.0))) + (i64.and (i64.reinterpret_f64 (f64.div (f64.reinterpret_i64 (local.get $x)) (f64.const -1.0))) (i64.const 0x7ff8000000000000))) (func (export "no_fold_promote_demote") (param $x i32) (result i32) - (i32.and (i32.reinterpret/f32 (f32.demote/f64 (f64.promote/f32 (f32.reinterpret/i32 (get_local $x))))) + (i32.and (i32.reinterpret_f32 (f32.demote_f64 (f64.promote_f32 (f32.reinterpret_i32 (local.get $x))))) (i32.const 0x7fc00000))) ) @@ -2293,20 +2369,20 @@ (param $y0 f64) (param $y1 f64) (param $y2 f64) (param $y3 f64) (result f64) (f64.add (f64.add (f64.add - (f64.mul (get_local $x0) (get_local $y0)) - (f64.mul (get_local $x1) (get_local $y1))) - (f64.mul (get_local $x2) (get_local $y2))) - (f64.mul (get_local $x3) (get_local $y3))) + (f64.mul (local.get $x0) (local.get $y0)) + (f64.mul (local.get $x1) (local.get $y1))) + (f64.mul (local.get $x2) (local.get $y2))) + (f64.mul (local.get $x3) (local.get $y3))) ) (func (export "with_binary_sum_collapse") (param $x0 f64) (param $x1 f64) (param $x2 f64) (param $x3 f64) (param $y0 f64) (param $y1 f64) (param $y2 f64) (param $y3 f64) (result f64) - (f64.add (f64.add (f64.mul (get_local $x0) (get_local $y0)) - (f64.mul (get_local $x1) (get_local $y1))) - (f64.add (f64.mul (get_local $x2) (get_local $y2)) - (f64.mul (get_local $x3) (get_local $y3)))) + (f64.add (f64.add (f64.mul (local.get $x0) (local.get $y0)) + (f64.mul (local.get $x1) (local.get $y1))) + (f64.add (f64.mul (local.get $x2) (local.get $y2)) + (f64.mul (local.get $x3) (local.get $y3)))) ) ) @@ -2324,12 +2400,12 @@ (module (func (export "f32.contract2fma") (param $x f32) (param $y f32) (result f32) - (f32.sqrt (f32.sub (f32.mul (get_local $x) (get_local $x)) - (f32.mul (get_local $y) (get_local $y))))) + (f32.sqrt (f32.sub (f32.mul (local.get $x) (local.get $x)) + (f32.mul (local.get $y) (local.get $y))))) (func (export "f64.contract2fma") (param $x f64) (param $y f64) (result f64) - (f64.sqrt (f64.sub (f64.mul (get_local $x) (get_local $x)) - (f64.mul (get_local $y) (get_local $y))))) + (f64.sqrt (f64.sub (f64.mul (local.get $x) (local.get $x)) + (f64.mul (local.get $y) (local.get $y))))) ) (assert_return (invoke "f32.contract2fma" (f32.const 1.0) (f32.const 1.0)) (f32.const 0.0)) @@ -2345,10 +2421,10 @@ (module (func (export "f32.division_by_small_number") (param $a f32) (param $b f32) (param $c f32) (result f32) - (f32.sub (get_local $a) (f32.div (get_local $b) (get_local $c)))) + (f32.sub (local.get $a) (f32.div (local.get $b) (local.get $c)))) (func (export "f64.division_by_small_number") (param $a f64) (param $b f64) (param $c f64) (result f64) - (f64.sub (get_local $a) (f64.div (get_local $b) (get_local $c)))) + (f64.sub (local.get $a) (f64.div (local.get $b) (local.get $c)))) ) (assert_return (invoke "f32.division_by_small_number" (f32.const 112000000) (f32.const 100000) (f32.const 0.0009)) (f32.const 888888)) @@ -2359,9 +2435,9 @@ (module (func (export "f32.golden_ratio") (param $a f32) (param $b f32) (param $c f32) (result f32) - (f32.mul (get_local 0) (f32.add (get_local 1) (f32.sqrt (get_local 2))))) + (f32.mul (local.get 0) (f32.add (local.get 1) (f32.sqrt (local.get 2))))) (func (export "f64.golden_ratio") (param $a f64) (param $b f64) (param $c f64) (result f64) - (f64.mul (get_local 0) (f64.add (get_local 1) (f64.sqrt (get_local 2))))) + (f64.mul (local.get 0) (f64.add (local.get 1) (f64.sqrt (local.get 2))))) ) (assert_return (invoke "f32.golden_ratio" (f32.const 0.5) (f32.const 1.0) (f32.const 5.0)) (f32.const 1.618034)) @@ -2373,13 +2449,13 @@ (module (func (export "f32.silver_means") (param $n f32) (result f32) (f32.mul (f32.const 0.5) - (f32.add (get_local $n) - (f32.sqrt (f32.add (f32.mul (get_local $n) (get_local $n)) + (f32.add (local.get $n) + (f32.sqrt (f32.add (f32.mul (local.get $n) (local.get $n)) (f32.const 4.0)))))) (func (export "f64.silver_means") (param $n f64) (result f64) (f64.mul (f64.const 0.5) - (f64.add (get_local $n) - (f64.sqrt (f64.add (f64.mul (get_local $n) (get_local $n)) + (f64.add (local.get $n) + (f64.sqrt (f64.add (f64.mul (local.get $n) (local.get $n)) (f64.const 4.0)))))) ) @@ -2401,7 +2477,7 @@ (module (func (export "point_four") (param $four f64) (param $ten f64) (result i32) - (f64.lt (f64.div (get_local $four) (get_local $ten)) (f64.const 0.4))) + (f64.lt (f64.div (local.get $four) (local.get $ten)) (f64.const 0.4))) ) (assert_return (invoke "point_four" (f64.const 4.0) (f64.const 10.0)) (i32.const 0)) @@ -2413,66 +2489,82 @@ (func (export "tau") (param i32) (result f64) (local f64 f64 f64 f64) f64.const 0x0p+0 - set_local 1 + local.set 1 block - get_local 0 + local.get 0 i32.const 1 i32.lt_s br_if 0 f64.const 0x1p+0 - set_local 2 + local.set 2 f64.const 0x0p+0 - set_local 3 + local.set 3 loop - get_local 1 - get_local 2 + local.get 1 + local.get 2 f64.const 0x1p+3 - get_local 3 + local.get 3 f64.const 0x1p+3 f64.mul - tee_local 4 + local.tee 4 f64.const 0x1p+0 f64.add f64.div f64.const 0x1p+2 - get_local 4 + local.get 4 f64.const 0x1p+2 f64.add f64.div f64.sub f64.const 0x1p+1 - get_local 4 + local.get 4 f64.const 0x1.4p+2 f64.add f64.div f64.sub f64.const 0x1p+1 - get_local 4 + local.get 4 f64.const 0x1.8p+2 f64.add f64.div f64.sub f64.mul f64.add - set_local 1 - get_local 3 + local.set 1 + local.get 3 f64.const 0x1p+0 f64.add - set_local 3 - get_local 2 + local.set 3 + local.get 2 f64.const 0x1p-4 f64.mul - set_local 2 - get_local 0 + local.set 2 + local.get 0 i32.const -1 i32.add - tee_local 0 + local.tee 0 br_if 0 end end - get_local 1 + local.get 1 ) ) (assert_return (invoke "tau" (i32.const 10)) (f64.const 0x1.921fb54442d14p+2)) (assert_return (invoke "tau" (i32.const 11)) (f64.const 0x1.921fb54442d18p+2)) + +;; Test that y < 0 ? x : (x + 1) is not folded to x + (y < 0). + +(module + (func (export "f32.no_fold_conditional_inc") (param $x f32) (param $y f32) (result f32) + (select (local.get $x) + (f32.add (local.get $x) (f32.const 1.0)) + (f32.lt (local.get $y) (f32.const 0.0)))) + (func (export "f64.no_fold_conditional_inc") (param $x f64) (param $y f64) (result f64) + (select (local.get $x) + (f64.add (local.get $x) (f64.const 1.0)) + (f64.lt (local.get $y) (f64.const 0.0)))) +) + +(assert_return (invoke "f32.no_fold_conditional_inc" (f32.const -0.0) (f32.const -1.0)) (f32.const -0.0)) +(assert_return (invoke "f64.no_fold_conditional_inc" (f64.const -0.0) (f64.const -1.0)) (f64.const -0.0)) diff --git a/test/core/float_literals.wast b/test/core/float_literals.wast index c69d81fb..fefb91fb 100644 --- a/test/core/float_literals.wast +++ b/test/core/float_literals.wast @@ -2,76 +2,104 @@ (module ;; f32 special values - (func (export "f32.nan") (result i32) (i32.reinterpret/f32 (f32.const nan))) - (func (export "f32.positive_nan") (result i32) (i32.reinterpret/f32 (f32.const +nan))) - (func (export "f32.negative_nan") (result i32) (i32.reinterpret/f32 (f32.const -nan))) - (func (export "f32.plain_nan") (result i32) (i32.reinterpret/f32 (f32.const nan:0x400000))) - (func (export "f32.informally_known_as_plain_snan") (result i32) (i32.reinterpret/f32 (f32.const nan:0x200000))) - (func (export "f32.all_ones_nan") (result i32) (i32.reinterpret/f32 (f32.const -nan:0x7fffff))) - (func (export "f32.misc_nan") (result i32) (i32.reinterpret/f32 (f32.const nan:0x012345))) - (func (export "f32.misc_positive_nan") (result i32) (i32.reinterpret/f32 (f32.const +nan:0x304050))) - (func (export "f32.misc_negative_nan") (result i32) (i32.reinterpret/f32 (f32.const -nan:0x2abcde))) - (func (export "f32.infinity") (result i32) (i32.reinterpret/f32 (f32.const infinity))) - (func (export "f32.positive_infinity") (result i32) (i32.reinterpret/f32 (f32.const +infinity))) - (func (export "f32.negative_infinity") (result i32) (i32.reinterpret/f32 (f32.const -infinity))) + (func (export "f32.nan") (result i32) (i32.reinterpret_f32 (f32.const nan))) + (func (export "f32.positive_nan") (result i32) (i32.reinterpret_f32 (f32.const +nan))) + (func (export "f32.negative_nan") (result i32) (i32.reinterpret_f32 (f32.const -nan))) + (func (export "f32.plain_nan") (result i32) (i32.reinterpret_f32 (f32.const nan:0x400000))) + (func (export "f32.informally_known_as_plain_snan") (result i32) (i32.reinterpret_f32 (f32.const nan:0x200000))) + (func (export "f32.all_ones_nan") (result i32) (i32.reinterpret_f32 (f32.const -nan:0x7fffff))) + (func (export "f32.misc_nan") (result i32) (i32.reinterpret_f32 (f32.const nan:0x012345))) + (func (export "f32.misc_positive_nan") (result i32) (i32.reinterpret_f32 (f32.const +nan:0x304050))) + (func (export "f32.misc_negative_nan") (result i32) (i32.reinterpret_f32 (f32.const -nan:0x2abcde))) + (func (export "f32.infinity") (result i32) (i32.reinterpret_f32 (f32.const inf))) + (func (export "f32.positive_infinity") (result i32) (i32.reinterpret_f32 (f32.const +inf))) + (func (export "f32.negative_infinity") (result i32) (i32.reinterpret_f32 (f32.const -inf))) ;; f32 numbers - (func (export "f32.zero") (result i32) (i32.reinterpret/f32 (f32.const 0x0.0p0))) - (func (export "f32.positive_zero") (result i32) (i32.reinterpret/f32 (f32.const +0x0.0p0))) - (func (export "f32.negative_zero") (result i32) (i32.reinterpret/f32 (f32.const -0x0.0p0))) - (func (export "f32.misc") (result i32) (i32.reinterpret/f32 (f32.const 0x1.921fb6p+2))) - (func (export "f32.min_positive") (result i32) (i32.reinterpret/f32 (f32.const 0x1p-149))) - (func (export "f32.min_normal") (result i32) (i32.reinterpret/f32 (f32.const 0x1p-126))) - (func (export "f32.max_finite") (result i32) (i32.reinterpret/f32 (f32.const 0x1.fffffep+127))) - (func (export "f32.max_subnormal") (result i32) (i32.reinterpret/f32 (f32.const 0x1.fffffcp-127))) - (func (export "f32.trailing_dot") (result i32) (i32.reinterpret/f32 (f32.const 0x1.p10))) + (func (export "f32.zero") (result i32) (i32.reinterpret_f32 (f32.const 0x0.0p0))) + (func (export "f32.positive_zero") (result i32) (i32.reinterpret_f32 (f32.const +0x0.0p0))) + (func (export "f32.negative_zero") (result i32) (i32.reinterpret_f32 (f32.const -0x0.0p0))) + (func (export "f32.misc") (result i32) (i32.reinterpret_f32 (f32.const 0x1.921fb6p+2))) + (func (export "f32.min_positive") (result i32) (i32.reinterpret_f32 (f32.const 0x1p-149))) + (func (export "f32.min_normal") (result i32) (i32.reinterpret_f32 (f32.const 0x1p-126))) + (func (export "f32.max_finite") (result i32) (i32.reinterpret_f32 (f32.const 0x1.fffffep+127))) + (func (export "f32.max_subnormal") (result i32) (i32.reinterpret_f32 (f32.const 0x1.fffffcp-127))) + (func (export "f32.trailing_dot") (result i32) (i32.reinterpret_f32 (f32.const 0x1.p10))) ;; f32 in decimal format - (func (export "f32_dec.zero") (result i32) (i32.reinterpret/f32 (f32.const 0.0e0))) - (func (export "f32_dec.positive_zero") (result i32) (i32.reinterpret/f32 (f32.const +0.0e0))) - (func (export "f32_dec.negative_zero") (result i32) (i32.reinterpret/f32 (f32.const -0.0e0))) - (func (export "f32_dec.misc") (result i32) (i32.reinterpret/f32 (f32.const 6.28318548202514648))) - (func (export "f32_dec.min_positive") (result i32) (i32.reinterpret/f32 (f32.const 1.4013e-45))) - (func (export "f32_dec.min_normal") (result i32) (i32.reinterpret/f32 (f32.const 1.1754944e-38))) - (func (export "f32_dec.max_subnormal") (result i32) (i32.reinterpret/f32 (f32.const 1.1754942e-38))) - (func (export "f32_dec.max_finite") (result i32) (i32.reinterpret/f32 (f32.const 3.4028234e+38))) - (func (export "f32_dec.trailing_dot") (result i32) (i32.reinterpret/f32 (f32.const 1.e10))) + (func (export "f32_dec.zero") (result i32) (i32.reinterpret_f32 (f32.const 0.0e0))) + (func (export "f32_dec.positive_zero") (result i32) (i32.reinterpret_f32 (f32.const +0.0e0))) + (func (export "f32_dec.negative_zero") (result i32) (i32.reinterpret_f32 (f32.const -0.0e0))) + (func (export "f32_dec.misc") (result i32) (i32.reinterpret_f32 (f32.const 6.28318548202514648))) + (func (export "f32_dec.min_positive") (result i32) (i32.reinterpret_f32 (f32.const 1.4013e-45))) + (func (export "f32_dec.min_normal") (result i32) (i32.reinterpret_f32 (f32.const 1.1754944e-38))) + (func (export "f32_dec.max_subnormal") (result i32) (i32.reinterpret_f32 (f32.const 1.1754942e-38))) + (func (export "f32_dec.max_finite") (result i32) (i32.reinterpret_f32 (f32.const 3.4028234e+38))) + (func (export "f32_dec.trailing_dot") (result i32) (i32.reinterpret_f32 (f32.const 1.e10))) + + ;; https://twitter.com/Archivd/status/994637336506912768 + (func (export "f32_dec.root_beer_float") (result i32) (i32.reinterpret_f32 (f32.const 1.000000119))) ;; f64 special values - (func (export "f64.nan") (result i64) (i64.reinterpret/f64 (f64.const nan))) - (func (export "f64.positive_nan") (result i64) (i64.reinterpret/f64 (f64.const +nan))) - (func (export "f64.negative_nan") (result i64) (i64.reinterpret/f64 (f64.const -nan))) - (func (export "f64.plain_nan") (result i64) (i64.reinterpret/f64 (f64.const nan:0x8000000000000))) - (func (export "f64.informally_known_as_plain_snan") (result i64) (i64.reinterpret/f64 (f64.const nan:0x4000000000000))) - (func (export "f64.all_ones_nan") (result i64) (i64.reinterpret/f64 (f64.const -nan:0xfffffffffffff))) - (func (export "f64.misc_nan") (result i64) (i64.reinterpret/f64 (f64.const nan:0x0123456789abc))) - (func (export "f64.misc_positive_nan") (result i64) (i64.reinterpret/f64 (f64.const +nan:0x3040506070809))) - (func (export "f64.misc_negative_nan") (result i64) (i64.reinterpret/f64 (f64.const -nan:0x2abcdef012345))) - (func (export "f64.infinity") (result i64) (i64.reinterpret/f64 (f64.const infinity))) - (func (export "f64.positive_infinity") (result i64) (i64.reinterpret/f64 (f64.const +infinity))) - (func (export "f64.negative_infinity") (result i64) (i64.reinterpret/f64 (f64.const -infinity))) + (func (export "f64.nan") (result i64) (i64.reinterpret_f64 (f64.const nan))) + (func (export "f64.positive_nan") (result i64) (i64.reinterpret_f64 (f64.const +nan))) + (func (export "f64.negative_nan") (result i64) (i64.reinterpret_f64 (f64.const -nan))) + (func (export "f64.plain_nan") (result i64) (i64.reinterpret_f64 (f64.const nan:0x8000000000000))) + (func (export "f64.informally_known_as_plain_snan") (result i64) (i64.reinterpret_f64 (f64.const nan:0x4000000000000))) + (func (export "f64.all_ones_nan") (result i64) (i64.reinterpret_f64 (f64.const -nan:0xfffffffffffff))) + (func (export "f64.misc_nan") (result i64) (i64.reinterpret_f64 (f64.const nan:0x0123456789abc))) + (func (export "f64.misc_positive_nan") (result i64) (i64.reinterpret_f64 (f64.const +nan:0x3040506070809))) + (func (export "f64.misc_negative_nan") (result i64) (i64.reinterpret_f64 (f64.const -nan:0x2abcdef012345))) + (func (export "f64.infinity") (result i64) (i64.reinterpret_f64 (f64.const inf))) + (func (export "f64.positive_infinity") (result i64) (i64.reinterpret_f64 (f64.const +inf))) + (func (export "f64.negative_infinity") (result i64) (i64.reinterpret_f64 (f64.const -inf))) ;; f64 numbers - (func (export "f64.zero") (result i64) (i64.reinterpret/f64 (f64.const 0x0.0p0))) - (func (export "f64.positive_zero") (result i64) (i64.reinterpret/f64 (f64.const +0x0.0p0))) - (func (export "f64.negative_zero") (result i64) (i64.reinterpret/f64 (f64.const -0x0.0p0))) - (func (export "f64.misc") (result i64) (i64.reinterpret/f64 (f64.const 0x1.921fb54442d18p+2))) - (func (export "f64.min_positive") (result i64) (i64.reinterpret/f64 (f64.const 0x0.0000000000001p-1022))) - (func (export "f64.min_normal") (result i64) (i64.reinterpret/f64 (f64.const 0x1p-1022))) - (func (export "f64.max_subnormal") (result i64) (i64.reinterpret/f64 (f64.const 0x0.fffffffffffffp-1022))) - (func (export "f64.max_finite") (result i64) (i64.reinterpret/f64 (f64.const 0x1.fffffffffffffp+1023))) - (func (export "f64.trailing_dot") (result i64) (i64.reinterpret/f64 (f64.const 0x1.p100))) + (func (export "f64.zero") (result i64) (i64.reinterpret_f64 (f64.const 0x0.0p0))) + (func (export "f64.positive_zero") (result i64) (i64.reinterpret_f64 (f64.const +0x0.0p0))) + (func (export "f64.negative_zero") (result i64) (i64.reinterpret_f64 (f64.const -0x0.0p0))) + (func (export "f64.misc") (result i64) (i64.reinterpret_f64 (f64.const 0x1.921fb54442d18p+2))) + (func (export "f64.min_positive") (result i64) (i64.reinterpret_f64 (f64.const 0x0.0000000000001p-1022))) + (func (export "f64.min_normal") (result i64) (i64.reinterpret_f64 (f64.const 0x1p-1022))) + (func (export "f64.max_subnormal") (result i64) (i64.reinterpret_f64 (f64.const 0x0.fffffffffffffp-1022))) + (func (export "f64.max_finite") (result i64) (i64.reinterpret_f64 (f64.const 0x1.fffffffffffffp+1023))) + (func (export "f64.trailing_dot") (result i64) (i64.reinterpret_f64 (f64.const 0x1.p100))) ;; f64 numbers in decimal format - (func (export "f64_dec.zero") (result i64) (i64.reinterpret/f64 (f64.const 0.0e0))) - (func (export "f64_dec.positive_zero") (result i64) (i64.reinterpret/f64 (f64.const +0.0e0))) - (func (export "f64_dec.negative_zero") (result i64) (i64.reinterpret/f64 (f64.const -0.0e0))) - (func (export "f64_dec.misc") (result i64) (i64.reinterpret/f64 (f64.const 6.28318530717958623))) - (func (export "f64_dec.min_positive") (result i64) (i64.reinterpret/f64 (f64.const 4.94066e-324))) - (func (export "f64_dec.min_normal") (result i64) (i64.reinterpret/f64 (f64.const 2.2250738585072012e-308))) - (func (export "f64_dec.max_subnormal") (result i64) (i64.reinterpret/f64 (f64.const 2.2250738585072011e-308))) - (func (export "f64_dec.max_finite") (result i64) (i64.reinterpret/f64 (f64.const 1.7976931348623157e+308))) - (func (export "f64_dec.trailing_dot") (result i64) (i64.reinterpret/f64 (f64.const 1.e100))) + (func (export "f64_dec.zero") (result i64) (i64.reinterpret_f64 (f64.const 0.0e0))) + (func (export "f64_dec.positive_zero") (result i64) (i64.reinterpret_f64 (f64.const +0.0e0))) + (func (export "f64_dec.negative_zero") (result i64) (i64.reinterpret_f64 (f64.const -0.0e0))) + (func (export "f64_dec.misc") (result i64) (i64.reinterpret_f64 (f64.const 6.28318530717958623))) + (func (export "f64_dec.min_positive") (result i64) (i64.reinterpret_f64 (f64.const 4.94066e-324))) + (func (export "f64_dec.min_normal") (result i64) (i64.reinterpret_f64 (f64.const 2.2250738585072012e-308))) + (func (export "f64_dec.max_subnormal") (result i64) (i64.reinterpret_f64 (f64.const 2.2250738585072011e-308))) + (func (export "f64_dec.max_finite") (result i64) (i64.reinterpret_f64 (f64.const 1.7976931348623157e+308))) + (func (export "f64_dec.trailing_dot") (result i64) (i64.reinterpret_f64 (f64.const 1.e100))) + + ;; https://twitter.com/Archivd/status/994637336506912768 + (func (export "f64_dec.root_beer_float") (result i64) (i64.reinterpret_f64 (f64.const 1.000000119))) + + (func (export "f32-dec-sep1") (result f32) (f32.const 1_000_000)) + (func (export "f32-dec-sep2") (result f32) (f32.const 1_0_0_0)) + (func (export "f32-dec-sep3") (result f32) (f32.const 100_3.141_592)) + (func (export "f32-dec-sep4") (result f32) (f32.const 99e+1_3)) + (func (export "f32-dec-sep5") (result f32) (f32.const 122_000.11_3_54E0_2_3)) + (func (export "f32-hex-sep1") (result f32) (f32.const 0xa_0f_00_99)) + (func (export "f32-hex-sep2") (result f32) (f32.const 0x1_a_A_0_f)) + (func (export "f32-hex-sep3") (result f32) (f32.const 0xa0_ff.f141_a59a)) + (func (export "f32-hex-sep4") (result f32) (f32.const 0xf0P+1_3)) + (func (export "f32-hex-sep5") (result f32) (f32.const 0x2a_f00a.1f_3_eep2_3)) + + (func (export "f64-dec-sep1") (result f64) (f64.const 1_000_000)) + (func (export "f64-dec-sep2") (result f64) (f64.const 1_0_0_0)) + (func (export "f64-dec-sep3") (result f64) (f64.const 100_3.141_592)) + (func (export "f64-dec-sep4") (result f64) (f64.const 99e-1_23)) + (func (export "f64-dec-sep5") (result f64) (f64.const 122_000.11_3_54e0_2_3)) + (func (export "f64-hex-sep1") (result f64) (f64.const 0xa_f00f_0000_9999)) + (func (export "f64-hex-sep2") (result f64) (f64.const 0x1_a_A_0_f)) + (func (export "f64-hex-sep3") (result f64) (f64.const 0xa0_ff.f141_a59a)) + (func (export "f64-hex-sep4") (result f64) (f64.const 0xf0P+1_3)) + (func (export "f64-hex-sep5") (result f64) (f64.const 0x2a_f00a.1f_3_eep2_3)) ) (assert_return (invoke "f32.nan") (i32.const 0x7fc00000)) @@ -104,6 +132,7 @@ (assert_return (invoke "f32_dec.max_subnormal") (i32.const 0x7fffff)) (assert_return (invoke "f32_dec.max_finite") (i32.const 0x7f7fffff)) (assert_return (invoke "f32_dec.trailing_dot") (i32.const 0x501502f9)) +(assert_return (invoke "f32_dec.root_beer_float") (i32.const 0x3f800001)) (assert_return (invoke "f64.nan") (i64.const 0x7ff8000000000000)) (assert_return (invoke "f64.positive_nan") (i64.const 0x7ff8000000000000)) @@ -135,3 +164,344 @@ (assert_return (invoke "f64_dec.max_subnormal") (i64.const 0xfffffffffffff)) (assert_return (invoke "f64_dec.max_finite") (i64.const 0x7fefffffffffffff)) (assert_return (invoke "f64_dec.trailing_dot") (i64.const 0x54b249ad2594c37d)) +(assert_return (invoke "f64_dec.root_beer_float") (i64.const 0x3ff000001ff19e24)) + +(assert_return (invoke "f32-dec-sep1") (f32.const 1000000)) +(assert_return (invoke "f32-dec-sep2") (f32.const 1000)) +(assert_return (invoke "f32-dec-sep3") (f32.const 1003.141592)) +(assert_return (invoke "f32-dec-sep4") (f32.const 99e+13)) +(assert_return (invoke "f32-dec-sep5") (f32.const 122000.11354e23)) +(assert_return (invoke "f32-hex-sep1") (f32.const 0xa0f0099)) +(assert_return (invoke "f32-hex-sep2") (f32.const 0x1aa0f)) +(assert_return (invoke "f32-hex-sep3") (f32.const 0xa0ff.f141a59a)) +(assert_return (invoke "f32-hex-sep4") (f32.const 0xf0P+13)) +(assert_return (invoke "f32-hex-sep5") (f32.const 0x2af00a.1f3eep23)) + +(assert_return (invoke "f64-dec-sep1") (f64.const 1000000)) +(assert_return (invoke "f64-dec-sep2") (f64.const 1000)) +(assert_return (invoke "f64-dec-sep3") (f64.const 1003.141592)) +(assert_return (invoke "f64-dec-sep4") (f64.const 99e-123)) +(assert_return (invoke "f64-dec-sep5") (f64.const 122000.11354e23)) +(assert_return (invoke "f64-hex-sep1") (f64.const 0xaf00f00009999)) +(assert_return (invoke "f64-hex-sep2") (f64.const 0x1aa0f)) +(assert_return (invoke "f64-hex-sep3") (f64.const 0xa0ff.f141a59a)) +(assert_return (invoke "f64-hex-sep4") (f64.const 0xf0P+13)) +(assert_return (invoke "f64-hex-sep5") (f64.const 0x2af00a.1f3eep23)) + +;; Test parsing a float from binary +(module binary + ;; (func (export "4294967249") (result f64) (f64.const 4294967249)) + "\00\61\73\6d\01\00\00\00\01\85\80\80\80\00\01\60" + "\00\01\7c\03\82\80\80\80\00\01\00\07\8e\80\80\80" + "\00\01\0a\34\32\39\34\39\36\37\32\34\39\00\00\0a" + "\91\80\80\80\00\01\8b\80\80\80\00\00\44\00\00\20" + "\fa\ff\ff\ef\41\0b" +) + +(assert_return (invoke "4294967249") (f64.const 4294967249)) + +(assert_malformed + (module quote "(global f32 (f32.const _100))") + "unknown operator" +) +(assert_malformed + (module quote "(global f32 (f32.const +_100))") + "unknown operator" +) +(assert_malformed + (module quote "(global f32 (f32.const -_100))") + "unknown operator" +) +(assert_malformed + (module quote "(global f32 (f32.const 99_))") + "unknown operator" +) +(assert_malformed + (module quote "(global f32 (f32.const 1__000))") + "unknown operator" +) +(assert_malformed + (module quote "(global f32 (f32.const _1.0))") + "unknown operator" +) +(assert_malformed + (module quote "(global f32 (f32.const 1.0_))") + "unknown operator" +) +(assert_malformed + (module quote "(global f32 (f32.const 1_.0))") + "unknown operator" +) +(assert_malformed + (module quote "(global f32 (f32.const 1._0))") + "unknown operator" +) +(assert_malformed + (module quote "(global f32 (f32.const _1e1))") + "unknown operator" +) +(assert_malformed + (module quote "(global f32 (f32.const 1e1_))") + "unknown operator" +) +(assert_malformed + (module quote "(global f32 (f32.const 1_e1))") + "unknown operator" +) +(assert_malformed + (module quote "(global f32 (f32.const 1e_1))") + "unknown operator" +) +(assert_malformed + (module quote "(global f32 (f32.const _1.0e1))") + "unknown operator" +) +(assert_malformed + (module quote "(global f32 (f32.const 1.0e1_))") + "unknown operator" +) +(assert_malformed + (module quote "(global f32 (f32.const 1.0_e1))") + "unknown operator" +) +(assert_malformed + (module quote "(global f32 (f32.const 1.0e_1))") + "unknown operator" +) +(assert_malformed + (module quote "(global f32 (f32.const 1.0e+_1))") + "unknown operator" +) +(assert_malformed + (module quote "(global f32 (f32.const 1.0e_+1))") + "unknown operator" +) +(assert_malformed + (module quote "(global f32 (f32.const _0x100))") + "unknown operator" +) +(assert_malformed + (module quote "(global f32 (f32.const 0_x100))") + "unknown operator" +) +(assert_malformed + (module quote "(global f32 (f32.const 0x_100))") + "unknown operator" +) +(assert_malformed + (module quote "(global f32 (f32.const 0x00_))") + "unknown operator" +) +(assert_malformed + (module quote "(global f32 (f32.const 0xff__ffff))") + "unknown operator" +) +(assert_malformed + (module quote "(global f32 (f32.const 0x_1.0))") + "unknown operator" +) +(assert_malformed + (module quote "(global f32 (f32.const 0x1.0_))") + "unknown operator" +) +(assert_malformed + (module quote "(global f32 (f32.const 0x1_.0))") + "unknown operator" +) +(assert_malformed + (module quote "(global f32 (f32.const 0x1._0))") + "unknown operator" +) +(assert_malformed + (module quote "(global f32 (f32.const 0x_1p1))") + "unknown operator" +) +(assert_malformed + (module quote "(global f32 (f32.const 0x1p1_))") + "unknown operator" +) +(assert_malformed + (module quote "(global f32 (f32.const 0x1_p1))") + "unknown operator" +) +(assert_malformed + (module quote "(global f32 (f32.const 0x1p_1))") + "unknown operator" +) +(assert_malformed + (module quote "(global f32 (f32.const 0x_1.0p1))") + "unknown operator" +) +(assert_malformed + (module quote "(global f32 (f32.const 0x1.0p1_))") + "unknown operator" +) +(assert_malformed + (module quote "(global f32 (f32.const 0x1.0_p1))") + "unknown operator" +) +(assert_malformed + (module quote "(global f32 (f32.const 0x1.0p_1))") + "unknown operator" +) +(assert_malformed + (module quote "(global f32 (f32.const 0x1.0p+_1))") + "unknown operator" +) +(assert_malformed + (module quote "(global f32 (f32.const 0x1.0p_+1))") + "unknown operator" +) + +(assert_malformed + (module quote "(global f64 (f64.const _100))") + "unknown operator" +) +(assert_malformed + (module quote "(global f64 (f64.const +_100))") + "unknown operator" +) +(assert_malformed + (module quote "(global f64 (f64.const -_100))") + "unknown operator" +) +(assert_malformed + (module quote "(global f64 (f64.const 99_))") + "unknown operator" +) +(assert_malformed + (module quote "(global f64 (f64.const 1__000))") + "unknown operator" +) +(assert_malformed + (module quote "(global f64 (f64.const _1.0))") + "unknown operator" +) +(assert_malformed + (module quote "(global f64 (f64.const 1.0_))") + "unknown operator" +) +(assert_malformed + (module quote "(global f64 (f64.const 1_.0))") + "unknown operator" +) +(assert_malformed + (module quote "(global f64 (f64.const 1._0))") + "unknown operator" +) +(assert_malformed + (module quote "(global f64 (f64.const _1e1))") + "unknown operator" +) +(assert_malformed + (module quote "(global f64 (f64.const 1e1_))") + "unknown operator" +) +(assert_malformed + (module quote "(global f64 (f64.const 1_e1))") + "unknown operator" +) +(assert_malformed + (module quote "(global f64 (f64.const 1e_1))") + "unknown operator" +) +(assert_malformed + (module quote "(global f64 (f64.const _1.0e1))") + "unknown operator" +) +(assert_malformed + (module quote "(global f64 (f64.const 1.0e1_))") + "unknown operator" +) +(assert_malformed + (module quote "(global f64 (f64.const 1.0_e1))") + "unknown operator" +) +(assert_malformed + (module quote "(global f64 (f64.const 1.0e_1))") + "unknown operator" +) +(assert_malformed + (module quote "(global f64 (f64.const 1.0e+_1))") + "unknown operator" +) +(assert_malformed + (module quote "(global f64 (f64.const 1.0e_+1))") + "unknown operator" +) +(assert_malformed + (module quote "(global f64 (f64.const _0x100))") + "unknown operator" +) +(assert_malformed + (module quote "(global f64 (f64.const 0_x100))") + "unknown operator" +) +(assert_malformed + (module quote "(global f64 (f64.const 0x_100))") + "unknown operator" +) +(assert_malformed + (module quote "(global f64 (f64.const 0x00_))") + "unknown operator" +) +(assert_malformed + (module quote "(global f64 (f64.const 0xff__ffff))") + "unknown operator" +) +(assert_malformed + (module quote "(global f64 (f64.const 0x_1.0))") + "unknown operator" +) +(assert_malformed + (module quote "(global f64 (f64.const 0x1.0_))") + "unknown operator" +) +(assert_malformed + (module quote "(global f64 (f64.const 0x1_.0))") + "unknown operator" +) +(assert_malformed + (module quote "(global f64 (f64.const 0x1._0))") + "unknown operator" +) +(assert_malformed + (module quote "(global f64 (f64.const 0x_1p1))") + "unknown operator" +) +(assert_malformed + (module quote "(global f64 (f64.const 0x1p1_))") + "unknown operator" +) +(assert_malformed + (module quote "(global f64 (f64.const 0x1_p1))") + "unknown operator" +) +(assert_malformed + (module quote "(global f64 (f64.const 0x1p_1))") + "unknown operator" +) +(assert_malformed + (module quote "(global f64 (f64.const 0x_1.0p1))") + "unknown operator" +) +(assert_malformed + (module quote "(global f64 (f64.const 0x1.0p1_))") + "unknown operator" +) +(assert_malformed + (module quote "(global f64 (f64.const 0x1.0_p1))") + "unknown operator" +) +(assert_malformed + (module quote "(global f64 (f64.const 0x1.0p_1))") + "unknown operator" +) +(assert_malformed + (module quote "(global f64 (f64.const 0x1.0p+_1))") + "unknown operator" +) +(assert_malformed + (module quote "(global f64 (f64.const 0x1.0p_+1))") + "unknown operator" +) diff --git a/test/core/float_misc.wast b/test/core/float_misc.wast index 4ad9bd66..1aad1a35 100644 --- a/test/core/float_misc.wast +++ b/test/core/float_misc.wast @@ -15,35 +15,35 @@ ;; covering additional miscellaneous interesting cases. (module - (func (export "f32.add") (param $x f32) (param $y f32) (result f32) (f32.add (get_local $x) (get_local $y))) - (func (export "f32.sub") (param $x f32) (param $y f32) (result f32) (f32.sub (get_local $x) (get_local $y))) - (func (export "f32.mul") (param $x f32) (param $y f32) (result f32) (f32.mul (get_local $x) (get_local $y))) - (func (export "f32.div") (param $x f32) (param $y f32) (result f32) (f32.div (get_local $x) (get_local $y))) - (func (export "f32.sqrt") (param $x f32) (result f32) (f32.sqrt (get_local $x))) - (func (export "f32.abs") (param $x f32) (result f32) (f32.abs (get_local $x))) - (func (export "f32.neg") (param $x f32) (result f32) (f32.neg (get_local $x))) - (func (export "f32.copysign") (param $x f32) (param $y f32) (result f32) (f32.copysign (get_local $x) (get_local $y))) - (func (export "f32.ceil") (param $x f32) (result f32) (f32.ceil (get_local $x))) - (func (export "f32.floor") (param $x f32) (result f32) (f32.floor (get_local $x))) - (func (export "f32.trunc") (param $x f32) (result f32) (f32.trunc (get_local $x))) - (func (export "f32.nearest") (param $x f32) (result f32) (f32.nearest (get_local $x))) - (func (export "f32.min") (param $x f32) (param $y f32) (result f32) (f32.min (get_local $x) (get_local $y))) - (func (export "f32.max") (param $x f32) (param $y f32) (result f32) (f32.max (get_local $x) (get_local $y))) - - (func (export "f64.add") (param $x f64) (param $y f64) (result f64) (f64.add (get_local $x) (get_local $y))) - (func (export "f64.sub") (param $x f64) (param $y f64) (result f64) (f64.sub (get_local $x) (get_local $y))) - (func (export "f64.mul") (param $x f64) (param $y f64) (result f64) (f64.mul (get_local $x) (get_local $y))) - (func (export "f64.div") (param $x f64) (param $y f64) (result f64) (f64.div (get_local $x) (get_local $y))) - (func (export "f64.sqrt") (param $x f64) (result f64) (f64.sqrt (get_local $x))) - (func (export "f64.abs") (param $x f64) (result f64) (f64.abs (get_local $x))) - (func (export "f64.neg") (param $x f64) (result f64) (f64.neg (get_local $x))) - (func (export "f64.copysign") (param $x f64) (param $y f64) (result f64) (f64.copysign (get_local $x) (get_local $y))) - (func (export "f64.ceil") (param $x f64) (result f64) (f64.ceil (get_local $x))) - (func (export "f64.floor") (param $x f64) (result f64) (f64.floor (get_local $x))) - (func (export "f64.trunc") (param $x f64) (result f64) (f64.trunc (get_local $x))) - (func (export "f64.nearest") (param $x f64) (result f64) (f64.nearest (get_local $x))) - (func (export "f64.min") (param $x f64) (param $y f64) (result f64) (f64.min (get_local $x) (get_local $y))) - (func (export "f64.max") (param $x f64) (param $y f64) (result f64) (f64.max (get_local $x) (get_local $y))) + (func (export "f32.add") (param $x f32) (param $y f32) (result f32) (f32.add (local.get $x) (local.get $y))) + (func (export "f32.sub") (param $x f32) (param $y f32) (result f32) (f32.sub (local.get $x) (local.get $y))) + (func (export "f32.mul") (param $x f32) (param $y f32) (result f32) (f32.mul (local.get $x) (local.get $y))) + (func (export "f32.div") (param $x f32) (param $y f32) (result f32) (f32.div (local.get $x) (local.get $y))) + (func (export "f32.sqrt") (param $x f32) (result f32) (f32.sqrt (local.get $x))) + (func (export "f32.abs") (param $x f32) (result f32) (f32.abs (local.get $x))) + (func (export "f32.neg") (param $x f32) (result f32) (f32.neg (local.get $x))) + (func (export "f32.copysign") (param $x f32) (param $y f32) (result f32) (f32.copysign (local.get $x) (local.get $y))) + (func (export "f32.ceil") (param $x f32) (result f32) (f32.ceil (local.get $x))) + (func (export "f32.floor") (param $x f32) (result f32) (f32.floor (local.get $x))) + (func (export "f32.trunc") (param $x f32) (result f32) (f32.trunc (local.get $x))) + (func (export "f32.nearest") (param $x f32) (result f32) (f32.nearest (local.get $x))) + (func (export "f32.min") (param $x f32) (param $y f32) (result f32) (f32.min (local.get $x) (local.get $y))) + (func (export "f32.max") (param $x f32) (param $y f32) (result f32) (f32.max (local.get $x) (local.get $y))) + + (func (export "f64.add") (param $x f64) (param $y f64) (result f64) (f64.add (local.get $x) (local.get $y))) + (func (export "f64.sub") (param $x f64) (param $y f64) (result f64) (f64.sub (local.get $x) (local.get $y))) + (func (export "f64.mul") (param $x f64) (param $y f64) (result f64) (f64.mul (local.get $x) (local.get $y))) + (func (export "f64.div") (param $x f64) (param $y f64) (result f64) (f64.div (local.get $x) (local.get $y))) + (func (export "f64.sqrt") (param $x f64) (result f64) (f64.sqrt (local.get $x))) + (func (export "f64.abs") (param $x f64) (result f64) (f64.abs (local.get $x))) + (func (export "f64.neg") (param $x f64) (result f64) (f64.neg (local.get $x))) + (func (export "f64.copysign") (param $x f64) (param $y f64) (result f64) (f64.copysign (local.get $x) (local.get $y))) + (func (export "f64.ceil") (param $x f64) (result f64) (f64.ceil (local.get $x))) + (func (export "f64.floor") (param $x f64) (result f64) (f64.floor (local.get $x))) + (func (export "f64.trunc") (param $x f64) (result f64) (f64.trunc (local.get $x))) + (func (export "f64.nearest") (param $x f64) (result f64) (f64.nearest (local.get $x))) + (func (export "f64.min") (param $x f64) (param $y f64) (result f64) (f64.min (local.get $x) (local.get $y))) + (func (export "f64.max") (param $x f64) (param $y f64) (result f64) (f64.max (local.get $x) (local.get $y))) ) ;; Miscellaneous values. @@ -168,9 +168,9 @@ ;; Test rounding above the greatest finite value. (assert_return (invoke "f32.add" (f32.const 0x1.fffffep+127) (f32.const 0x1.fffffep+102)) (f32.const 0x1.fffffep+127)) -(assert_return (invoke "f32.add" (f32.const 0x1.fffffep+127) (f32.const 0x1p+103)) (f32.const infinity)) +(assert_return (invoke "f32.add" (f32.const 0x1.fffffep+127) (f32.const 0x1p+103)) (f32.const inf)) (assert_return (invoke "f64.add" (f64.const 0x1.fffffffffffffp+1023) (f64.const 0x1.fffffffffffffp+969)) (f64.const 0x1.fffffffffffffp+1023)) -(assert_return (invoke "f64.add" (f64.const 0x1.fffffffffffffp+1023) (f64.const 0x1p+970)) (f64.const infinity)) +(assert_return (invoke "f64.add" (f64.const 0x1.fffffffffffffp+1023) (f64.const 0x1p+970)) (f64.const inf)) ;; Test for a historic spreadsheet bug. ;; https://blogs.office.com/2007/09/25/calculation-issue-update/ @@ -235,7 +235,7 @@ (assert_return (invoke "f64.sub" (f64.const 0x1.5e423fe8571f4p-57) (f64.const 0x1.9624ed7c162dfp-618)) (f64.const 0x1.5e423fe8571f4p-57)) ;; pow(e, π) - π -;; https://xkcd.com/217 +;; https://xkcd.com/217/ (assert_return (invoke "f32.sub" (f32.const 0x1.724046p+4) (f32.const 0x1.921fb6p+1)) (f32.const 0x1.3ffc5p+4)) (assert_return (invoke "f64.sub" (f64.const 0x1.724046eb0933ap+4) (f64.const 0x1.921fb54442d18p+1)) (f64.const 0x1.3ffc504280d97p+4)) @@ -272,8 +272,8 @@ ;; Miscellaneous values. (assert_return (invoke "f32.mul" (f32.const 1e15) (f32.const 1e15)) (f32.const 0x1.93e592p+99)) -(assert_return (invoke "f32.mul" (f32.const 1e20) (f32.const 1e20)) (f32.const infinity)) -(assert_return (invoke "f32.mul" (f32.const 1e25) (f32.const 1e25)) (f32.const infinity)) +(assert_return (invoke "f32.mul" (f32.const 1e20) (f32.const 1e20)) (f32.const inf)) +(assert_return (invoke "f32.mul" (f32.const 1e25) (f32.const 1e25)) (f32.const inf)) (assert_return (invoke "f64.mul" (f64.const 1e15) (f64.const 1e15)) (f64.const 0x1.93e5939a08ceap+99)) (assert_return (invoke "f64.mul" (f64.const 1e20) (f64.const 1e20)) (f64.const 0x1.d6329f1c35ca5p+132)) (assert_return (invoke "f64.mul" (f64.const 1e25) (f64.const 1e25)) (f64.const 0x1.11b0ec57e649bp+166)) @@ -295,7 +295,7 @@ (assert_return (invoke "f32.mul" (f32.const -0x1.b17694p+92) (f32.const -0x1.e4b56ap-97)) (f32.const 0x1.9a5baep-4)) (assert_return (invoke "f32.mul" (f32.const -0x1.1626a6p+79) (f32.const -0x1.c57d7p-75)) (f32.const 0x1.ecbaaep+4)) (assert_return (invoke "f32.mul" (f32.const 0x1.7acf72p+53) (f32.const 0x1.6c89acp+5)) (f32.const 0x1.0db556p+59)) -(assert_return (invoke "f64.mul" (f64.const -0x1.25c293f6f37e4p+425) (f64.const 0x1.f5fd4fa41c6d8p+945)) (f64.const -infinity)) +(assert_return (invoke "f64.mul" (f64.const -0x1.25c293f6f37e4p+425) (f64.const 0x1.f5fd4fa41c6d8p+945)) (f64.const -inf)) (assert_return (invoke "f64.mul" (f64.const -0x1.cc1ae79fffc5bp-986) (f64.const -0x1.c36ccc2861ca6p-219)) (f64.const 0x0p+0)) (assert_return (invoke "f64.mul" (f64.const 0x1.c0232b3e64b56p+606) (f64.const -0x1.f6939cf3affaap+106)) (f64.const -0x1.b7e3aedf190d3p+713)) (assert_return (invoke "f64.mul" (f64.const -0x1.60f289966b271p-313) (f64.const 0x1.28a5497f0c259p+583)) (f64.const -0x1.98fc50bcec259p+270)) @@ -309,12 +309,12 @@ (assert_return (invoke "f32.mul" (f32.const 0x1.936742p+30) (f32.const -0x1.a7a19p+66)) (f32.const -0x1.4dc71ap+97)) (assert_return (invoke "f64.mul" (f64.const -0x1.ba737b4ca3b13p-639) (f64.const 0x1.8923309857438p-314)) (f64.const -0x1.53bc0d07baa37p-952)) (assert_return (invoke "f64.mul" (f64.const 0x1.7c1932e610219p-276) (f64.const -0x1.2605db646489fp-635)) (f64.const -0x1.b48da2b0d2ae3p-911)) -(assert_return (invoke "f64.mul" (f64.const -0x1.e43cdf3b2108p+329) (f64.const -0x1.99d96abbd61d1p+835)) (f64.const infinity)) +(assert_return (invoke "f64.mul" (f64.const -0x1.e43cdf3b2108p+329) (f64.const -0x1.99d96abbd61d1p+835)) (f64.const inf)) (assert_return (invoke "f64.mul" (f64.const 0x1.4c19466551da3p+947) (f64.const 0x1.0bdcd6c7646e9p-439)) (f64.const 0x1.5b7cd8c3f638ap+508)) (assert_return (invoke "f64.mul" (f64.const 0x1.ff1da1726e3dfp+339) (f64.const -0x1.043c44f52b158p+169)) (f64.const -0x1.03c9364bb585cp+509)) ;; Computations that round differently in round-toward-zero mode. -(assert_return (invoke "f32.mul" (f32.const -0x1.907e8ap+46) (f32.const -0x1.5d3668p+95)) (f32.const infinity)) +(assert_return (invoke "f32.mul" (f32.const -0x1.907e8ap+46) (f32.const -0x1.5d3668p+95)) (f32.const inf)) (assert_return (invoke "f32.mul" (f32.const -0x1.8c9f74p-3) (f32.const 0x1.e2b452p-99)) (f32.const -0x1.75edccp-101)) (assert_return (invoke "f32.mul" (f32.const -0x1.cc605ap-19) (f32.const 0x1.ec321ap+105)) (f32.const -0x1.ba91a4p+87)) (assert_return (invoke "f32.mul" (f32.const -0x1.5fbb7ap+56) (f32.const 0x1.a8965ep-96)) (f32.const -0x1.23ae8ep-39)) @@ -322,7 +322,7 @@ (assert_return (invoke "f64.mul" (f64.const -0x1.5b0266454c26bp-496) (f64.const -0x1.af5787e3e0399p+433)) (f64.const 0x1.2457d81949e0bp-62)) (assert_return (invoke "f64.mul" (f64.const 0x1.0d54a82393d45p+478) (f64.const -0x1.425760807ceaep-764)) (f64.const -0x1.532068c8d0d5dp-286)) (assert_return (invoke "f64.mul" (f64.const -0x1.b532af981786p+172) (f64.const 0x1.ada95085ba36fp+359)) (f64.const -0x1.6ee38c1e01864p+532)) -(assert_return (invoke "f64.mul" (f64.const 0x1.e132f4d49d1cep+768) (f64.const -0x1.a75afe9a7d864p+374)) (f64.const -infinity)) +(assert_return (invoke "f64.mul" (f64.const 0x1.e132f4d49d1cep+768) (f64.const -0x1.a75afe9a7d864p+374)) (f64.const -inf)) (assert_return (invoke "f64.mul" (f64.const 0x1.68bbf1cfff90ap+81) (f64.const 0x1.09cd17d652c5p+70)) (f64.const 0x1.768b8d67d794p+151)) ;; Computations that round differently on x87. @@ -354,9 +354,9 @@ ;; Test the greatest positive value with a finite square. (assert_return (invoke "f32.mul" (f32.const 0x1.fffffep+63) (f32.const 0x1.fffffep+63)) (f32.const 0x1.fffffcp+127)) -(assert_return (invoke "f32.mul" (f32.const 0x1p+64) (f32.const 0x1p+64)) (f32.const infinity)) +(assert_return (invoke "f32.mul" (f32.const 0x1p+64) (f32.const 0x1p+64)) (f32.const inf)) (assert_return (invoke "f64.mul" (f64.const 0x1.fffffffffffffp+511) (f64.const 0x1.fffffffffffffp+511)) (f64.const 0x1.ffffffffffffep+1023)) -(assert_return (invoke "f64.mul" (f64.const 0x1p+512) (f64.const 0x1p+512)) (f64.const infinity)) +(assert_return (invoke "f64.mul" (f64.const 0x1p+512) (f64.const 0x1p+512)) (f64.const inf)) ;; Test the squares of values very close to 1. (assert_return (invoke "f32.mul" (f32.const 0x1.000002p+0) (f32.const 0x1.000002p+0)) (f32.const 0x1.000004p+0)) @@ -408,7 +408,7 @@ (assert_return (invoke "f64.div" (f64.const -0x1.44ca7539cc851p+540) (f64.const 0x1.58501bccc58fep+453)) (f64.const -0x1.e2f8657e0924ep+86)) ;; Computations that round differently in round-downward mode. -(assert_return (invoke "f32.div" (f32.const -0x1.c2c54ap+69) (f32.const -0x1.00d142p-86)) (f32.const infinity)) +(assert_return (invoke "f32.div" (f32.const -0x1.c2c54ap+69) (f32.const -0x1.00d142p-86)) (f32.const inf)) (assert_return (invoke "f32.div" (f32.const 0x1.e35abep-46) (f32.const 0x1.c69dfp+44)) (f32.const 0x1.102eb4p-90)) (assert_return (invoke "f32.div" (f32.const 0x1.45ff2ap+0) (f32.const -0x1.1e8754p+89)) (f32.const -0x1.23434ep-89)) (assert_return (invoke "f32.div" (f32.const 0x1.8db18ap-51) (f32.const 0x1.47c678p-128)) (f32.const 0x1.369b96p+77)) @@ -420,13 +420,13 @@ (assert_return (invoke "f64.div" (f64.const -0x1.91f58d7ed1237p+236) (f64.const -0x1.f190d808383c8p+55)) (f64.const 0x1.9d9eb0836f906p+180)) ;; Computations that round differently in round-toward-zero mode. -(assert_return (invoke "f32.div" (f32.const 0x1.64b2a4p+26) (f32.const 0x1.e95752p-119)) (f32.const infinity)) +(assert_return (invoke "f32.div" (f32.const 0x1.64b2a4p+26) (f32.const 0x1.e95752p-119)) (f32.const inf)) (assert_return (invoke "f32.div" (f32.const -0x1.53c9b6p+77) (f32.const 0x1.d689ap+27)) (f32.const -0x1.71baa4p+49)) (assert_return (invoke "f32.div" (f32.const 0x1.664a8ap+38) (f32.const -0x1.59dba2p+96)) (f32.const -0x1.0933f4p-58)) (assert_return (invoke "f32.div" (f32.const -0x1.99e0fap+111) (f32.const -0x1.c2b5a8p+9)) (f32.const 0x1.d19de6p+101)) (assert_return (invoke "f32.div" (f32.const -0x1.5a815ap+92) (f32.const -0x1.b5820ap+13)) (f32.const 0x1.9580b8p+78)) (assert_return (invoke "f64.div" (f64.const -0x1.81fd1e2af7bebp-655) (f64.const 0x1.edefc4eae536cp-691)) (f64.const -0x1.901abdd91b661p+35)) -(assert_return (invoke "f64.div" (f64.const -0x1.47cf932953c43p+782) (f64.const -0x1.bc40496b1f2a1p-553)) (f64.const infinity)) +(assert_return (invoke "f64.div" (f64.const -0x1.47cf932953c43p+782) (f64.const -0x1.bc40496b1f2a1p-553)) (f64.const inf)) (assert_return (invoke "f64.div" (f64.const -0x1.2bd2e8fbdcad7p-746) (f64.const 0x1.b115674cc476ep-65)) (f64.const -0x1.62752bf19fa81p-682)) (assert_return (invoke "f64.div" (f64.const -0x1.f923e3fea9efep+317) (f64.const -0x1.8044c74d27a39p-588)) (f64.const 0x1.5086518cc7186p+905)) (assert_return (invoke "f64.div" (f64.const 0x1.516ed2051d6bbp+181) (f64.const -0x1.c9f455eb9c2eep+214)) (f64.const -0x1.79414d67f2889p-34)) @@ -478,9 +478,9 @@ (assert_return (invoke "f64.div" (f64.const 0x1p-51) (f64.const 0x1.fffffffffffffp+1023)) (f64.const 0x0.0000000000001p-1022)) ;; Test the least positive value with a finite reciprocal. -(assert_return (invoke "f32.div" (f32.const 1.0) (f32.const 0x1p-128)) (f32.const infinity)) +(assert_return (invoke "f32.div" (f32.const 1.0) (f32.const 0x1p-128)) (f32.const inf)) (assert_return (invoke "f32.div" (f32.const 1.0) (f32.const 0x1.000008p-128)) (f32.const 0x1.fffffp+127)) -(assert_return (invoke "f64.div" (f64.const 1.0) (f64.const 0x0.4p-1022)) (f64.const infinity)) +(assert_return (invoke "f64.div" (f64.const 1.0) (f64.const 0x0.4p-1022)) (f64.const inf)) (assert_return (invoke "f64.div" (f64.const 1.0) (f64.const 0x0.4000000000001p-1022)) (f64.const 0x1.ffffffffffff8p+1023)) ;; Test the least positive value that has a subnormal reciprocal. @@ -620,6 +620,13 @@ (assert_return (invoke "f64.ceil" (f64.const 0x1.fffffffffffffp+51)) (f64.const 0x1p+52)) (assert_return (invoke "f64.ceil" (f64.const -0x1.fffffffffffffp+51)) (f64.const -0x1.ffffffffffffep+51)) +;; Test that implementations don't do the x+0x1p52-0x1p52 trick outside the +;; range where it's safe. +(assert_return (invoke "f32.ceil" (f32.const 0x1.fffffep+23)) (f32.const 0x1.fffffep+23)) +(assert_return (invoke "f32.ceil" (f32.const -0x1.fffffep+23)) (f32.const -0x1.fffffep+23)) +(assert_return (invoke "f64.ceil" (f64.const 0x1.fffffffffffffp+52)) (f64.const 0x1.fffffffffffffp+52)) +(assert_return (invoke "f64.ceil" (f64.const -0x1.fffffffffffffp+52)) (f64.const -0x1.fffffffffffffp+52)) + ;; Test values close to -1.0. (assert_return (invoke "f32.floor" (f32.const -0x1.fffffep-1)) (f32.const -1.0)) (assert_return (invoke "f32.floor" (f32.const -0x1.000002p+0)) (f32.const -2.0)) @@ -632,6 +639,11 @@ (assert_return (invoke "f64.floor" (f64.const -0x1.fffffffffffffp+51)) (f64.const -0x1p+52)) (assert_return (invoke "f64.floor" (f64.const 0x1.fffffffffffffp+51)) (f64.const 0x1.ffffffffffffep+51)) +;; Test that floor isn't implemented as XMVectorFloor. +;; http://dss.stephanierct.com/DevBlog/?p=8#comment-4 +(assert_return (invoke "f32.floor" (f32.const 88607.0)) (f32.const 88607.0)) +(assert_return (invoke "f64.floor" (f64.const 88607.0)) (f64.const 88607.0)) + ;; Test the maximum and minimum value for which trunc is not an identity operator. (assert_return (invoke "f32.trunc" (f32.const -0x1.fffffep+22)) (f32.const -0x1.fffffcp+22)) (assert_return (invoke "f32.trunc" (f32.const 0x1.fffffep+22)) (f32.const 0x1.fffffcp+22)) diff --git a/test/core/forward.wast b/test/core/forward.wast index 43ab4934..7bb3770d 100644 --- a/test/core/forward.wast +++ b/test/core/forward.wast @@ -1,15 +1,15 @@ (module (func $even (export "even") (param $n i32) (result i32) - (if i32 (i32.eq (get_local $n) (i32.const 0)) - (i32.const 1) - (call $odd (i32.sub (get_local $n) (i32.const 1))) + (if (result i32) (i32.eq (local.get $n) (i32.const 0)) + (then (i32.const 1)) + (else (call $odd (i32.sub (local.get $n) (i32.const 1)))) ) ) (func $odd (export "odd") (param $n i32) (result i32) - (if i32 (i32.eq (get_local $n) (i32.const 0)) - (i32.const 0) - (call $even (i32.sub (get_local $n) (i32.const 1))) + (if (result i32) (i32.eq (local.get $n) (i32.const 0)) + (then (i32.const 0)) + (else (call $even (i32.sub (local.get $n) (i32.const 1)))) ) ) ) diff --git a/test/core/func-local-after-body.fail.wast b/test/core/func-local-after-body.fail.wast deleted file mode 100644 index 0c4cf8c3..00000000 --- a/test/core/func-local-after-body.fail.wast +++ /dev/null @@ -1 +0,0 @@ -(module (func (nop) (local i32))) diff --git a/test/core/func-local-before-param.fail.wast b/test/core/func-local-before-param.fail.wast deleted file mode 100644 index 66f35eb6..00000000 --- a/test/core/func-local-before-param.fail.wast +++ /dev/null @@ -1 +0,0 @@ -(module (func (local i32) (param i32))) diff --git a/test/core/func-local-before-result.fail.wast b/test/core/func-local-before-result.fail.wast deleted file mode 100644 index 52026cf7..00000000 --- a/test/core/func-local-before-result.fail.wast +++ /dev/null @@ -1 +0,0 @@ -(module (func (local i32) (result i32) (get_local 0))) diff --git a/test/core/func-param-after-body.fail.wast b/test/core/func-param-after-body.fail.wast deleted file mode 100644 index 399a151b..00000000 --- a/test/core/func-param-after-body.fail.wast +++ /dev/null @@ -1 +0,0 @@ -(module (func (nop) (param i32))) diff --git a/test/core/func-result-after-body.fail.wast b/test/core/func-result-after-body.fail.wast deleted file mode 100644 index 9617a2d0..00000000 --- a/test/core/func-result-after-body.fail.wast +++ /dev/null @@ -1 +0,0 @@ -(module (func (nop) (result i32))) diff --git a/test/core/func-result-before-param.fail.wast b/test/core/func-result-before-param.fail.wast deleted file mode 100644 index 93a930f4..00000000 --- a/test/core/func-result-before-param.fail.wast +++ /dev/null @@ -1 +0,0 @@ -(module (func (result i32) (param i32) (get_local 0))) diff --git a/test/core/func.wast b/test/core/func.wast index a9c71db4..a6b05f53 100644 --- a/test/core/func.wast +++ b/test/core/func.wast @@ -30,11 +30,27 @@ (func (result i32) (unreachable)) + (type $sig-1 (func)) + (type $sig-2 (func (result i32))) + (type $sig-3 (func (param $x i32))) + (type $sig-4 (func (param i32 f64 i32) (result i32))) + + (func (export "type-use-1") (type $sig-1)) + (func (export "type-use-2") (type $sig-2) (i32.const 0)) + (func (export "type-use-3") (type $sig-3)) + (func (export "type-use-4") (type $sig-4) (i32.const 0)) + (func (export "type-use-5") (type $sig-2) (result i32) (i32.const 0)) + (func (export "type-use-6") (type $sig-3) (param i32)) + (func (export "type-use-7") + (type $sig-4) (param i32) (param f64 i32) (result i32) (i32.const 0) + ) + (func (type $sig)) + (func (type $forward)) ;; forward reference (func $complex (param i32 f32) (param $x i64) (param) (param i32) - (result i32) + (result) (result i32) (result) (local f32) (local $y i32) (local i64 i32) (local) (local f64 i32) (unreachable) (unreachable) ) @@ -44,47 +60,48 @@ (unreachable) (unreachable) ) + (type $forward (func)) ;; Typing of locals - (func (export "local-first-i32") (result i32) (local i32 i32) (get_local 0)) - (func (export "local-first-i64") (result i64) (local i64 i64) (get_local 0)) - (func (export "local-first-f32") (result f32) (local f32 f32) (get_local 0)) - (func (export "local-first-f64") (result f64) (local f64 f64) (get_local 0)) - (func (export "local-second-i32") (result i32) (local i32 i32) (get_local 1)) - (func (export "local-second-i64") (result i64) (local i64 i64) (get_local 1)) - (func (export "local-second-f32") (result f32) (local f32 f32) (get_local 1)) - (func (export "local-second-f64") (result f64) (local f64 f64) (get_local 1)) + (func (export "local-first-i32") (result i32) (local i32 i32) (local.get 0)) + (func (export "local-first-i64") (result i64) (local i64 i64) (local.get 0)) + (func (export "local-first-f32") (result f32) (local f32 f32) (local.get 0)) + (func (export "local-first-f64") (result f64) (local f64 f64) (local.get 0)) + (func (export "local-second-i32") (result i32) (local i32 i32) (local.get 1)) + (func (export "local-second-i64") (result i64) (local i64 i64) (local.get 1)) + (func (export "local-second-f32") (result f32) (local f32 f32) (local.get 1)) + (func (export "local-second-f64") (result f64) (local f64 f64) (local.get 1)) (func (export "local-mixed") (result f64) (local f32) (local $x i32) (local i64 i32) (local) (local f64 i32) - (drop (f32.neg (get_local 0))) - (drop (i32.eqz (get_local 1))) - (drop (i64.eqz (get_local 2))) - (drop (i32.eqz (get_local 3))) - (drop (f64.neg (get_local 4))) - (drop (i32.eqz (get_local 5))) - (get_local 4) + (drop (f32.neg (local.get 0))) + (drop (i32.eqz (local.get 1))) + (drop (i64.eqz (local.get 2))) + (drop (i32.eqz (local.get 3))) + (drop (f64.neg (local.get 4))) + (drop (i32.eqz (local.get 5))) + (local.get 4) ) ;; Typing of parameters - (func (export "param-first-i32") (param i32 i32) (result i32) (get_local 0)) - (func (export "param-first-i64") (param i64 i64) (result i64) (get_local 0)) - (func (export "param-first-f32") (param f32 f32) (result f32) (get_local 0)) - (func (export "param-first-f64") (param f64 f64) (result f64) (get_local 0)) - (func (export "param-second-i32") (param i32 i32) (result i32) (get_local 1)) - (func (export "param-second-i64") (param i64 i64) (result i64) (get_local 1)) - (func (export "param-second-f32") (param f32 f32) (result f32) (get_local 1)) - (func (export "param-second-f64") (param f64 f64) (result f64) (get_local 1)) + (func (export "param-first-i32") (param i32 i32) (result i32) (local.get 0)) + (func (export "param-first-i64") (param i64 i64) (result i64) (local.get 0)) + (func (export "param-first-f32") (param f32 f32) (result f32) (local.get 0)) + (func (export "param-first-f64") (param f64 f64) (result f64) (local.get 0)) + (func (export "param-second-i32") (param i32 i32) (result i32) (local.get 1)) + (func (export "param-second-i64") (param i64 i64) (result i64) (local.get 1)) + (func (export "param-second-f32") (param f32 f32) (result f32) (local.get 1)) + (func (export "param-second-f64") (param f64 f64) (result f64) (local.get 1)) (func (export "param-mixed") (param f32 i32) (param) (param $x i64) (param i32 f64 i32) (result f64) - (drop (f32.neg (get_local 0))) - (drop (i32.eqz (get_local 1))) - (drop (i64.eqz (get_local 2))) - (drop (i32.eqz (get_local 3))) - (drop (f64.neg (get_local 4))) - (drop (i32.eqz (get_local 5))) - (get_local 4) + (drop (f32.neg (local.get 0))) + (drop (i32.eqz (local.get 1))) + (drop (i64.eqz (local.get 2))) + (drop (i32.eqz (local.get 3))) + (drop (f64.neg (local.get 4))) + (drop (i32.eqz (local.get 5))) + (local.get 4) ) ;; Typing of result @@ -97,7 +114,7 @@ (func (export "value-f64") (result f64) (f64.const 77.77)) (func (export "value-block-void") (block (call $dummy) (call $dummy))) (func (export "value-block-i32") (result i32) - (block i32 (call $dummy) (i32.const 77)) + (block (result i32) (call $dummy) (i32.const 77)) ) (func (export "return-empty") (return)) @@ -106,7 +123,7 @@ (func (export "return-f32") (result f32) (return (f32.const 78.7))) (func (export "return-f64") (result f64) (return (f64.const 78.78))) (func (export "return-block-i32") (result i32) - (return (block i32 (call $dummy) (i32.const 77))) + (return (block (result i32) (call $dummy) (i32.const 77))) ) (func (export "break-empty") (br 0)) @@ -115,91 +132,54 @@ (func (export "break-f32") (result f32) (br 0 (f32.const 79.9))) (func (export "break-f64") (result f64) (br 0 (f64.const 79.79))) (func (export "break-block-i32") (result i32) - (br 0 (block i32 (call $dummy) (i32.const 77))) + (br 0 (block (result i32) (call $dummy) (i32.const 77))) ) (func (export "break-br_if-empty") (param i32) - (br_if 0 (get_local 0)) + (br_if 0 (local.get 0)) ) (func (export "break-br_if-num") (param i32) (result i32) - (drop (br_if 0 (i32.const 50) (get_local 0))) (i32.const 51) + (drop (br_if 0 (i32.const 50) (local.get 0))) (i32.const 51) ) (func (export "break-br_table-empty") (param i32) - (br_table 0 0 0 (get_local 0)) + (br_table 0 0 0 (local.get 0)) ) (func (export "break-br_table-num") (param i32) (result i32) - (br_table 0 0 (i32.const 50) (get_local 0)) (i32.const 51) + (br_table 0 0 (i32.const 50) (local.get 0)) (i32.const 51) ) (func (export "break-br_table-nested-empty") (param i32) - (block (br_table 0 1 0 (get_local 0))) + (block (br_table 0 1 0 (local.get 0))) ) (func (export "break-br_table-nested-num") (param i32) (result i32) (i32.add - (block i32 (br_table 0 1 0 (i32.const 50) (get_local 0)) (i32.const 51)) + (block (result i32) + (br_table 0 1 0 (i32.const 50) (local.get 0)) (i32.const 51) + ) (i32.const 2) ) ) ;; Default initialization of locals - (func (export "init-local-i32") (result i32) (local i32) (get_local 0)) - (func (export "init-local-i64") (result i64) (local i64) (get_local 0)) - (func (export "init-local-f32") (result f32) (local f32) (get_local 0)) - (func (export "init-local-f64") (result f64) (local f64) (get_local 0)) - - - ;; Desugaring of implicit type signature - (func $empty-sig-1) ;; should be assigned type $sig - (func $complex-sig-1 (param f64 i64 f64 i64 f64 i64 f32 i32)) - (func $empty-sig-2) ;; should be assigned type $sig - (func $complex-sig-2 (param f64 i64 f64 i64 f64 i64 f32 i32)) - (func $complex-sig-3 (param f64 i64 f64 i64 f64 i64 f32 i32)) - - (type $empty-sig-duplicate (func)) - (type $complex-sig-duplicate (func (param f64 i64 f64 i64 f64 i64 f32 i32))) - (table anyfunc - (elem - $complex-sig-3 $empty-sig-2 $complex-sig-1 $complex-sig-3 $empty-sig-1 - ) - ) - - (func (export "signature-explicit-reused") - (call_indirect $sig (i32.const 1)) - (call_indirect $sig (i32.const 4)) - ) - - (func (export "signature-implicit-reused") - ;; The implicit index 16 in this test depends on the function and - ;; type definitions, and may need adapting if they change. - (call_indirect 16 - (f64.const 0) (i64.const 0) (f64.const 0) (i64.const 0) - (f64.const 0) (i64.const 0) (f32.const 0) (i32.const 0) - (i32.const 0) - ) - (call_indirect 16 - (f64.const 0) (i64.const 0) (f64.const 0) (i64.const 0) - (f64.const 0) (i64.const 0) (f32.const 0) (i32.const 0) - (i32.const 2) - ) - (call_indirect 16 - (f64.const 0) (i64.const 0) (f64.const 0) (i64.const 0) - (f64.const 0) (i64.const 0) (f32.const 0) (i32.const 0) - (i32.const 3) - ) - ) - - (func (export "signature-explicit-duplicate") - (call_indirect $empty-sig-duplicate (i32.const 1)) - ) + (func (export "init-local-i32") (result i32) (local i32) (local.get 0)) + (func (export "init-local-i64") (result i64) (local i64) (local.get 0)) + (func (export "init-local-f32") (result f32) (local f32) (local.get 0)) + (func (export "init-local-f64") (result f64) (local f64) (local.get 0)) +) - (func (export "signature-implicit-duplicate") - (call_indirect $complex-sig-duplicate - (f64.const 0) (i64.const 0) (f64.const 0) (i64.const 0) - (f64.const 0) (i64.const 0) (f32.const 0) (i32.const 0) - (i32.const 0) - ) - ) +(assert_return (invoke "type-use-1")) +(assert_return (invoke "type-use-2") (i32.const 0)) +(assert_return (invoke "type-use-3" (i32.const 1))) +(assert_return + (invoke "type-use-4" (i32.const 1) (f64.const 1) (i32.const 1)) + (i32.const 0) +) +(assert_return (invoke "type-use-5") (i32.const 0)) +(assert_return (invoke "type-use-6" (i32.const 1))) +(assert_return + (invoke "type-use-7" (i32.const 1) (f64.const 1) (i32.const 1)) + (i32.const 0) ) (assert_return (invoke "local-first-i32") (i32.const 0)) @@ -303,24 +283,190 @@ (assert_return (invoke "init-local-f32") (f32.const 0)) (assert_return (invoke "init-local-f64") (f64.const 0)) + +;; Expansion of inline function types + +(module + (func $f (result f64) (f64.const 0)) ;; adds implicit type definition + (func $g (param i32)) ;; reuses explicit type definition + (type $t (func (param i32))) + + (func $i32->void (type 0)) ;; (param i32) + (func $void->f64 (type 1) (f64.const 0)) ;; (result f64) + (func $check + (call $i32->void (i32.const 0)) + (drop (call $void->f64)) + ) +) + +(assert_invalid + (module + (func $f (result f64) (f64.const 0)) ;; adds implicit type definition + (func $g (param i32)) ;; reuses explicit type definition + (func $h (result f64) (f64.const 1)) ;; reuses implicit type definition + (type $t (func (param i32))) + + (func (type 2)) ;; does not exist + ) + "unknown type" +) + + +(module + (type $sig (func)) + + (func $empty-sig-1) ;; should be assigned type $sig + (func $complex-sig-1 (param f64 i64 f64 i64 f64 i64 f32 i32)) + (func $empty-sig-2) ;; should be assigned type $sig + (func $complex-sig-2 (param f64 i64 f64 i64 f64 i64 f32 i32)) + (func $complex-sig-3 (param f64 i64 f64 i64 f64 i64 f32 i32)) + (func $complex-sig-4 (param i64 i64 f64 i64 f64 i64 f32 i32)) + (func $complex-sig-5 (param i64 i64 f64 i64 f64 i64 f32 i32)) + + (type $empty-sig-duplicate (func)) + (type $complex-sig-duplicate (func (param i64 i64 f64 i64 f64 i64 f32 i32))) + (table funcref + (elem + $complex-sig-3 $empty-sig-2 $complex-sig-1 $complex-sig-3 $empty-sig-1 + $complex-sig-4 $complex-sig-5 + ) + ) + + (func (export "signature-explicit-reused") + (call_indirect (type $sig) (i32.const 1)) + (call_indirect (type $sig) (i32.const 4)) + ) + + (func (export "signature-implicit-reused") + ;; The implicit index 3 in this test depends on the function and + ;; type definitions, and may need adapting if they change. + (call_indirect (type 3) + (f64.const 0) (i64.const 0) (f64.const 0) (i64.const 0) + (f64.const 0) (i64.const 0) (f32.const 0) (i32.const 0) + (i32.const 0) + ) + (call_indirect (type 3) + (f64.const 0) (i64.const 0) (f64.const 0) (i64.const 0) + (f64.const 0) (i64.const 0) (f32.const 0) (i32.const 0) + (i32.const 2) + ) + (call_indirect (type 3) + (f64.const 0) (i64.const 0) (f64.const 0) (i64.const 0) + (f64.const 0) (i64.const 0) (f32.const 0) (i32.const 0) + (i32.const 3) + ) + ) + + (func (export "signature-explicit-duplicate") + (call_indirect (type $empty-sig-duplicate) (i32.const 1)) + ) + + (func (export "signature-implicit-duplicate") + (call_indirect (type $complex-sig-duplicate) + (i64.const 0) (i64.const 0) (f64.const 0) (i64.const 0) + (f64.const 0) (i64.const 0) (f32.const 0) (i32.const 0) + (i32.const 5) + ) + (call_indirect (type $complex-sig-duplicate) + (i64.const 0) (i64.const 0) (f64.const 0) (i64.const 0) + (f64.const 0) (i64.const 0) (f32.const 0) (i32.const 0) + (i32.const 6) + ) + ) +) + (assert_return (invoke "signature-explicit-reused")) (assert_return (invoke "signature-implicit-reused")) (assert_return (invoke "signature-explicit-duplicate")) (assert_return (invoke "signature-implicit-duplicate")) +;; Malformed type use + +(assert_malformed + (module quote + "(type $sig (func (param i32) (result i32)))" + "(func (type $sig) (result i32) (param i32) (i32.const 0))" + ) + "unexpected token" +) +(assert_malformed + (module quote + "(type $sig (func (param i32) (result i32)))" + "(func (param i32) (type $sig) (result i32) (i32.const 0))" + ) + "unexpected token" +) +(assert_malformed + (module quote + "(type $sig (func (param i32) (result i32)))" + "(func (param i32) (result i32) (type $sig) (i32.const 0))" + ) + "unexpected token" +) +(assert_malformed + (module quote + "(type $sig (func (param i32) (result i32)))" + "(func (result i32) (type $sig) (param i32) (i32.const 0))" + ) + "unexpected token" +) +(assert_malformed + (module quote + "(type $sig (func (param i32) (result i32)))" + "(func (result i32) (param i32) (type $sig) (i32.const 0))" + ) + "unexpected token" +) +(assert_malformed + (module quote + "(func (result i32) (param i32) (i32.const 0))" + ) + "unexpected token" +) + +(assert_malformed + (module quote + "(type $sig (func))" + "(func (type $sig) (result i32) (i32.const 0))" + ) + "inline function type" +) +(assert_malformed + (module quote + "(type $sig (func (param i32) (result i32)))" + "(func (type $sig) (result i32) (i32.const 0))" + ) + "inline function type" +) +(assert_malformed + (module quote + "(type $sig (func (param i32) (result i32)))" + "(func (type $sig) (param i32) (i32.const 0))" + ) + "inline function type" +) +(assert_malformed + (module quote + "(type $sig (func (param i32 i32) (result i32)))" + "(func (type $sig) (param i32) (result i32) (unreachable))" + ) + "inline function type" +) + + ;; Invalid typing of locals (assert_invalid - (module (func $type-local-num-vs-num (result i64) (local i32) (get_local 0))) + (module (func $type-local-num-vs-num (result i64) (local i32) (local.get 0))) "type mismatch" ) (assert_invalid - (module (func $type-local-num-vs-num (local f32) (i32.eqz (get_local 0)))) + (module (func $type-local-num-vs-num (local f32) (i32.eqz (local.get 0)))) "type mismatch" ) (assert_invalid - (module (func $type-local-num-vs-num (local f64 i64) (f64.neg (get_local 1)))) + (module (func $type-local-num-vs-num (local f64 i64) (f64.neg (local.get 1)))) "type mismatch" ) @@ -328,15 +474,15 @@ ;; Invalid typing of parameters (assert_invalid - (module (func $type-param-num-vs-num (param i32) (result i64) (get_local 0))) + (module (func $type-param-num-vs-num (param i32) (result i64) (local.get 0))) "type mismatch" ) (assert_invalid - (module (func $type-param-num-vs-num (param f32) (i32.eqz (get_local 0)))) + (module (func $type-param-num-vs-num (param f32) (i32.eqz (local.get 0)))) "type mismatch" ) (assert_invalid - (module (func $type-param-num-vs-num (param f64 i64) (f64.neg (get_local 1)))) + (module (func $type-param-num-vs-num (param f64 i64) (f64.neg (local.get 1)))) "type mismatch" ) @@ -486,3 +632,30 @@ "type mismatch" ) + +;; Syntax errors + +(assert_malformed + (module quote "(func (nop) (local i32))") + "unexpected token" +) +(assert_malformed + (module quote "(func (nop) (param i32))") + "unexpected token" +) +(assert_malformed + (module quote "(func (nop) (result i32))") + "unexpected token" +) +(assert_malformed + (module quote "(func (local i32) (param i32))") + "unexpected token" +) +(assert_malformed + (module quote "(func (local i32) (result i32) (local.get 0))") + "unexpected token" +) +(assert_malformed + (module quote "(func (result i32) (param i32) (local.get 0))") + "unexpected token" +) diff --git a/test/core/func_ptrs.wast b/test/core/func_ptrs.wast index f7edd9f4..f6f8e2c4 100644 --- a/test/core/func_ptrs.wast +++ b/test/core/func_ptrs.wast @@ -7,22 +7,23 @@ (type $T (func (param i32) (result i32))) ;; 5: i32 -> i32 (type $U (func (param i32))) ;; 6: i32 -> void - (func $print (import "spectest" "print") (type 6)) + (func $print (import "spectest" "print_i32") (type 6)) (func (type 0)) (func (type $S)) (func (export "one") (type 4) (i32.const 13)) - (func (export "two") (type $T) (i32.add (get_local 0) (i32.const 1))) + (func (export "two") (type $T) (i32.add (local.get 0) (i32.const 1))) ;; Both signature and parameters are allowed (and required to match) ;; since this allows the naming of parameters. (func (export "three") (type $T) (param $a i32) (result i32) - (i32.sub (get_local 0) (i32.const 2)) + (i32.sub (local.get 0) (i32.const 2)) ) - (func (export "four") (type $U) (call $print (get_local 0))) + (func (export "four") (type $U) (call $print (local.get 0))) ) + (assert_return (invoke "one") (i32.const 13)) (assert_return (invoke "two" (i32.const 13)) (i32.const 14)) (assert_return (invoke "three" (i32.const 13)) (i32.const 11)) @@ -32,25 +33,25 @@ (assert_invalid (module (elem (i32.const 0) 0) (func)) "unknown table") (assert_invalid - (module (table 1 anyfunc) (elem (i64.const 0))) + (module (table 1 funcref) (elem (i64.const 0))) "type mismatch" ) (assert_invalid - (module (table 1 anyfunc) (elem (i32.ctz (i32.const 0)))) + (module (table 1 funcref) (elem (i32.ctz (i32.const 0)))) "constant expression required" ) (assert_invalid - (module (table 1 anyfunc) (elem (nop))) + (module (table 1 funcref) (elem (nop))) "constant expression required" ) (assert_invalid (module (func (type 42))) "unknown type") -(assert_invalid (module (import "spectest" "print" (func (type 43)))) "unknown type") +(assert_invalid (module (import "spectest" "print_i32" (func (type 43)))) "unknown type") (module (type $T (func (param) (result i32))) (type $U (func (param) (result i32))) - (table anyfunc (elem $t1 $t2 $t3 $u1 $u2 $t1 $t3)) + (table funcref (elem $t1 $t2 $t3 $u1 $u2 $t1 $t3)) (func $t1 (type $T) (i32.const 1)) (func $t2 (type $T) (i32.const 2)) @@ -59,11 +60,11 @@ (func $u2 (type $U) (i32.const 5)) (func (export "callt") (param $i i32) (result i32) - (call_indirect $T (get_local $i)) + (call_indirect (type $T) (local.get $i)) ) (func (export "callu") (param $i i32) (result i32) - (call_indirect $U (get_local $i)) + (call_indirect (type $U) (local.get $i)) ) ) @@ -91,13 +92,13 @@ (module (type $T (func (result i32))) - (table anyfunc (elem 0 1)) + (table funcref (elem 0 1)) (func $t1 (type $T) (i32.const 1)) (func $t2 (type $T) (i32.const 2)) (func (export "callt") (param $i i32) (result i32) - (call_indirect $T (get_local $i)) + (call_indirect (type $T) (local.get $i)) ) ) diff --git a/test/core/get_local.wast b/test/core/get_local.wast deleted file mode 100644 index e1f9625b..00000000 --- a/test/core/get_local.wast +++ /dev/null @@ -1,148 +0,0 @@ -;; Test `get_local` operator - -(module - ;; Typing - - (func (export "type-local-i32") (result i32) (local i32) (get_local 0)) - (func (export "type-local-i64") (result i64) (local i64) (get_local 0)) - (func (export "type-local-f32") (result f32) (local f32) (get_local 0)) - (func (export "type-local-f64") (result f64) (local f64) (get_local 0)) - - (func (export "type-param-i32") (param i32) (result i32) (get_local 0)) - (func (export "type-param-i64") (param i64) (result i64) (get_local 0)) - (func (export "type-param-f32") (param f32) (result f32) (get_local 0)) - (func (export "type-param-f64") (param f64) (result f64) (get_local 0)) - - (func (export "type-mixed") (param i64 f32 f64 i32 i32) - (local f32 i64 i64 f64) - (drop (i64.eqz (get_local 0))) - (drop (f32.neg (get_local 1))) - (drop (f64.neg (get_local 2))) - (drop (i32.eqz (get_local 3))) - (drop (i32.eqz (get_local 4))) - (drop (f32.neg (get_local 5))) - (drop (i64.eqz (get_local 6))) - (drop (i64.eqz (get_local 7))) - (drop (f64.neg (get_local 8))) - ) - - ;; Reading - - (func (export "read") (param i64 f32 f64 i32 i32) (result f64) - (local f32 i64 i64 f64) - (set_local 5 (f32.const 5.5)) - (set_local 6 (i64.const 6)) - (set_local 8 (f64.const 8)) - (f64.add - (f64.convert_u/i64 (get_local 0)) - (f64.add - (f64.promote/f32 (get_local 1)) - (f64.add - (get_local 2) - (f64.add - (f64.convert_u/i32 (get_local 3)) - (f64.add - (f64.convert_s/i32 (get_local 4)) - (f64.add - (f64.promote/f32 (get_local 5)) - (f64.add - (f64.convert_u/i64 (get_local 6)) - (f64.add - (f64.convert_u/i64 (get_local 7)) - (get_local 8) - ) - ) - ) - ) - ) - ) - ) - ) - ) -) - -(assert_return (invoke "type-local-i32") (i32.const 0)) -(assert_return (invoke "type-local-i64") (i64.const 0)) -(assert_return (invoke "type-local-f32") (f32.const 0)) -(assert_return (invoke "type-local-f64") (f64.const 0)) - -(assert_return (invoke "type-param-i32" (i32.const 2)) (i32.const 2)) -(assert_return (invoke "type-param-i64" (i64.const 3)) (i64.const 3)) -(assert_return (invoke "type-param-f32" (f32.const 4.4)) (f32.const 4.4)) -(assert_return (invoke "type-param-f64" (f64.const 5.5)) (f64.const 5.5)) - -(assert_return - (invoke "type-mixed" - (i64.const 1) (f32.const 2.2) (f64.const 3.3) (i32.const 4) (i32.const 5) - ) -) - -(assert_return - (invoke "read" - (i64.const 1) (f32.const 2) (f64.const 3.3) (i32.const 4) (i32.const 5) - ) - (f64.const 34.8) -) - - -;; Invalid typing of access to locals - -(assert_invalid - (module (func $type-local-num-vs-num (result i64) (local i32) (get_local 0))) - "type mismatch" -) -(assert_invalid - (module (func $type-local-num-vs-num (local f32) (i32.eqz (get_local 0)))) - "type mismatch" -) -(assert_invalid - (module (func $type-local-num-vs-num (local f64 i64) (f64.neg (get_local 1)))) - "type mismatch" -) - - -;; Invalid typing of access to parameters - -(assert_invalid - (module (func $type-param-num-vs-num (param i32) (result i64) (get_local 0))) - "type mismatch" -) -(assert_invalid - (module (func $type-param-num-vs-num (param f32) (i32.eqz (get_local 0)))) - "type mismatch" -) -(assert_invalid - (module (func $type-param-num-vs-num (param f64 i64) (f64.neg (get_local 1)))) - "type mismatch" -) - - -;; Invalid local index - -(assert_invalid - (module (func $unbound-local (local i32 i64) (get_local 3))) - "unknown local" -) -(assert_invalid - (module (func $large-local (local i32 i64) (get_local 14324343))) - "unknown local" -) - -(assert_invalid - (module (func $unbound-param (param i32 i64) (get_local 2))) - "unknown local" -) -(assert_invalid - (module (func $large-param (local i32 i64) (get_local 714324343))) - "unknown local" -) - -(assert_invalid - (module (func $unbound-mixed (param i32) (local i32 i64) (get_local 3))) - "unknown local" -) -(assert_invalid - (module (func $large-mixed (param i64) (local i32 i64) (get_local 214324343))) - "unknown local" -) - diff --git a/test/core/globals.wast b/test/core/globals.wast index 9eb59405..63aabb93 100644 --- a/test/core/globals.wast +++ b/test/core/globals.wast @@ -11,23 +11,180 @@ (global (;6;) (mut f64) (f64.const -14)) (global $y (mut i64) (i64.const -15)) - (func (export "get-a") (result i32) (get_global $a)) - (func (export "get-b") (result i64) (get_global $b)) - (func (export "get-x") (result i32) (get_global $x)) - (func (export "get-y") (result i64) (get_global $y)) - (func (export "set-x") (param i32) (set_global $x (get_local 0))) - (func (export "set-y") (param i64) (set_global $y (get_local 0))) + (global $r anyref (ref.null)) + (global funcref (ref.null)) - (func (export "get-1") (result f32) (get_global 1)) - (func (export "get-2") (result f64) (get_global 2)) - (func (export "get-5") (result f32) (get_global 5)) - (func (export "get-6") (result f64) (get_global 6)) - (func (export "set-5") (param f32) (set_global 5 (get_local 0))) - (func (export "set-6") (param f64) (set_global 6 (get_local 0))) + (func (export "get-a") (result i32) (global.get $a)) + (func (export "get-b") (result i64) (global.get $b)) + (func (export "get-r") (result anyref) (global.get $r)) + (func (export "get-x") (result i32) (global.get $x)) + (func (export "get-y") (result i64) (global.get $y)) + (func (export "set-x") (param i32) (global.set $x (local.get 0))) + (func (export "set-y") (param i64) (global.set $y (local.get 0))) + + (func (export "get-1") (result f32) (global.get 1)) + (func (export "get-2") (result f64) (global.get 2)) + (func (export "get-5") (result f32) (global.get 5)) + (func (export "get-6") (result f64) (global.get 6)) + (func (export "set-5") (param f32) (global.set 5 (local.get 0))) + (func (export "set-6") (param f64) (global.set 6 (local.get 0))) + + ;; As the argument of control constructs and instructions + + (memory 1) + + (func $dummy) + + (func (export "as-select-first") (result i32) + (select (global.get $x) (i32.const 2) (i32.const 3)) + ) + (func (export "as-select-mid") (result i32) + (select (i32.const 2) (global.get $x) (i32.const 3)) + ) + (func (export "as-select-last") (result i32) + (select (i32.const 2) (i32.const 3) (global.get $x)) + ) + + (func (export "as-loop-first") (result i32) + (loop (result i32) + (global.get $x) (call $dummy) (call $dummy) + ) + ) + (func (export "as-loop-mid") (result i32) + (loop (result i32) + (call $dummy) (global.get $x) (call $dummy) + ) + ) + (func (export "as-loop-last") (result i32) + (loop (result i32) + (call $dummy) (call $dummy) (global.get $x) + ) + ) + + (func (export "as-if-condition") (result i32) + (if (result i32) (global.get $x) + (then (call $dummy) (i32.const 2)) + (else (call $dummy) (i32.const 3)) + ) + ) + (func (export "as-if-then") (result i32) + (if (result i32) (i32.const 1) + (then (global.get $x)) (else (i32.const 2)) + ) + ) + (func (export "as-if-else") (result i32) + (if (result i32) (i32.const 0) + (then (i32.const 2)) (else (global.get $x)) + ) + ) + + (func (export "as-br_if-first") (result i32) + (block (result i32) + (br_if 0 (global.get $x) (i32.const 2)) + (return (i32.const 3)) + ) + ) + (func (export "as-br_if-last") (result i32) + (block (result i32) + (br_if 0 (i32.const 2) (global.get $x)) + (return (i32.const 3)) + ) + ) + + (func (export "as-br_table-first") (result i32) + (block (result i32) + (global.get $x) (i32.const 2) (br_table 0 0) + ) + ) + (func (export "as-br_table-last") (result i32) + (block (result i32) + (i32.const 2) (global.get $x) (br_table 0 0) + ) + ) + + (func $func (param i32 i32) (result i32) (local.get 0)) + (type $check (func (param i32 i32) (result i32))) + (table funcref (elem $func)) + (func (export "as-call_indirect-first") (result i32) + (block (result i32) + (call_indirect (type $check) + (global.get $x) (i32.const 2) (i32.const 0) + ) + ) + ) + (func (export "as-call_indirect-mid") (result i32) + (block (result i32) + (call_indirect (type $check) + (i32.const 2) (global.get $x) (i32.const 0) + ) + ) + ) + (func (export "as-call_indirect-last") (result i32) + (block (result i32) + (call_indirect (type $check) + (i32.const 2) (i32.const 0) (global.get $x) + ) + ) + ) + + (func (export "as-store-first") + (global.get $x) (i32.const 1) (i32.store) + ) + (func (export "as-store-last") + (i32.const 0) (global.get $x) (i32.store) + ) + (func (export "as-load-operand") (result i32) + (i32.load (global.get $x)) + ) + (func (export "as-memory.grow-value") (result i32) + (memory.grow (global.get $x)) + ) + + (func $f (param i32) (result i32) (local.get 0)) + (func (export "as-call-value") (result i32) + (call $f (global.get $x)) + ) + + (func (export "as-return-value") (result i32) + (global.get $x) (return) + ) + (func (export "as-drop-operand") + (drop (global.get $x)) + ) + (func (export "as-br-value") (result i32) + (block (result i32) (br 0 (global.get $x))) + ) + + (func (export "as-local.set-value") (param i32) (result i32) + (local.set 0 (global.get $x)) + (local.get 0) + ) + (func (export "as-local.tee-value") (param i32) (result i32) + (local.tee 0 (global.get $x)) + ) + (func (export "as-global.set-value") (result i32) + (global.set $x (global.get $x)) + (global.get $x) + ) + + (func (export "as-unary-operand") (result i32) + (i32.eqz (global.get $x)) + ) + (func (export "as-binary-operand") (result i32) + (i32.mul + (global.get $x) (global.get $x) + ) + ) + (func (export "as-compare-operand") (result i32) + (i32.gt_u + (global.get 0) (i32.const 1) + ) + ) ) (assert_return (invoke "get-a") (i32.const -2)) (assert_return (invoke "get-b") (i64.const -5)) +(assert_return (invoke "get-r") (ref.null)) (assert_return (invoke "get-x") (i32.const -12)) (assert_return (invoke "get-y") (i64.const -15)) @@ -46,38 +203,63 @@ (assert_return (invoke "get-5") (f32.const 8)) (assert_return (invoke "get-6") (f64.const 9)) -(assert_invalid - (module (global f32 (f32.const 0)) (func (set_global 0 (i32.const 1)))) - "global is immutable" -) +(assert_return (invoke "as-select-first") (i32.const 6)) +(assert_return (invoke "as-select-mid") (i32.const 2)) +(assert_return (invoke "as-select-last") (i32.const 2)) -(assert_invalid - (module (import "m" "a" (global (mut i32)))) - "mutable globals cannot be imported" -) +(assert_return (invoke "as-loop-first") (i32.const 6)) +(assert_return (invoke "as-loop-mid") (i32.const 6)) +(assert_return (invoke "as-loop-last") (i32.const 6)) -(assert_invalid - (module (global (import "m" "a") (mut i32))) - "mutable globals cannot be imported" -) +(assert_return (invoke "as-if-condition") (i32.const 2)) +(assert_return (invoke "as-if-then") (i32.const 6)) +(assert_return (invoke "as-if-else") (i32.const 6)) -(assert_invalid - (module (global (mut f32) (f32.const 0)) (export "a" (global 0))) - "mutable globals cannot be exported" -) +(assert_return (invoke "as-br_if-first") (i32.const 6)) +(assert_return (invoke "as-br_if-last") (i32.const 2)) + +(assert_return (invoke "as-br_table-first") (i32.const 6)) +(assert_return (invoke "as-br_table-last") (i32.const 2)) + +(assert_return (invoke "as-call_indirect-first") (i32.const 6)) +(assert_return (invoke "as-call_indirect-mid") (i32.const 2)) +(assert_trap (invoke "as-call_indirect-last") "undefined element") + +(assert_return (invoke "as-store-first")) +(assert_return (invoke "as-store-last")) +(assert_return (invoke "as-load-operand") (i32.const 1)) +(assert_return (invoke "as-memory.grow-value") (i32.const 1)) + +(assert_return (invoke "as-call-value") (i32.const 6)) + +(assert_return (invoke "as-return-value") (i32.const 6)) +(assert_return (invoke "as-drop-operand")) +(assert_return (invoke "as-br-value") (i32.const 6)) + +(assert_return (invoke "as-local.set-value" (i32.const 1)) (i32.const 6)) +(assert_return (invoke "as-local.tee-value" (i32.const 1)) (i32.const 6)) +(assert_return (invoke "as-global.set-value") (i32.const 6)) + +(assert_return (invoke "as-unary-operand") (i32.const 0)) +(assert_return (invoke "as-binary-operand") (i32.const 36)) +(assert_return (invoke "as-compare-operand") (i32.const 1)) (assert_invalid - (module (global (export "a") (mut f32) (f32.const 0))) - "mutable globals cannot be exported" + (module (global f32 (f32.const 0)) (func (global.set 0 (f32.const 1)))) + "global is immutable" ) +;; mutable globals can be exported +(module (global (mut f32) (f32.const 0)) (export "a" (global 0))) +(module (global (export "a") (mut f32) (f32.const 0))) + (assert_invalid (module (global f32 (f32.neg (f32.const 0)))) "constant expression required" ) (assert_invalid - (module (global f32 (get_local 0))) + (module (global f32 (local.get 0))) "constant expression required" ) @@ -112,25 +294,30 @@ ) (assert_invalid - (module (global i32 (get_global 0))) + (module (global (import "" "") anyref) (global funcref (global.get 0))) + "type mismatch" +) + +(assert_invalid + (module (global i32 (global.get 0))) "unknown global" ) (assert_invalid - (module (global i32 (get_global 1)) (global i32 (i32.const 0))) + (module (global i32 (global.get 1)) (global i32 (i32.const 0))) "unknown global" ) (module - (import "spectest" "global" (global i32)) + (import "spectest" "global_i32" (global i32)) ) (assert_malformed - (module + (module binary "\00asm" "\01\00\00\00" - "\02\94\80\80\80\00" ;; import section + "\02\98\80\80\80\00" ;; import section "\01" ;; length 1 "\08\73\70\65\63\74\65\73\74" ;; "spectest" - "\06\67\6c\6f\62\61\6c" ;; "global" + "\0a\67\6c\6f\62\61\6c\5f\69\33\32" ;; "global_i32" "\03" ;; GlobalImport "\7f" ;; i32 "\02" ;; invalid mutability @@ -138,12 +325,12 @@ "invalid mutability" ) (assert_malformed - (module + (module binary "\00asm" "\01\00\00\00" - "\02\94\80\80\80\00" ;; import section + "\02\98\80\80\80\00" ;; import section "\01" ;; length 1 "\08\73\70\65\63\74\65\73\74" ;; "spectest" - "\06\67\6c\6f\62\61\6c" ;; "global" + "\0a\67\6c\6f\62\61\6c\5f\69\33\32" ;; "global_i32" "\03" ;; GlobalImport "\7f" ;; i32 "\ff" ;; invalid mutability @@ -155,7 +342,7 @@ (global i32 (i32.const 0)) ) (assert_malformed - (module + (module binary "\00asm" "\01\00\00\00" "\06\86\80\80\80\00" ;; global section "\01" ;; length 1 @@ -167,7 +354,7 @@ "invalid mutability" ) (assert_malformed - (module + (module binary "\00asm" "\01\00\00\00" "\06\86\80\80\80\00" ;; global section "\01" ;; length 1 @@ -178,3 +365,128 @@ ) "invalid mutability" ) + + +(assert_invalid + (module + (global $x (mut i32) (i32.const 0)) + (func $type-global.set-value-empty + (global.set $x) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (global $x (mut i32) (i32.const 0)) + (func $type-global.set-value-empty-in-block + (i32.const 0) + (block (global.set $x)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (global $x (mut i32) (i32.const 0)) + (func $type-global.set-value-empty-in-loop + (i32.const 0) + (loop (global.set $x)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (global $x (mut i32) (i32.const 0)) + (func $type-global.set-value-empty-in-then + (i32.const 0) (i32.const 0) + (if (then (global.set $x))) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (global $x (mut i32) (i32.const 0)) + (func $type-global.set-value-empty-in-else + (i32.const 0) (i32.const 0) + (if (result i32) (then (i32.const 0)) (else (global.set $x))) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (global $x (mut i32) (i32.const 0)) + (func $type-global.set-value-empty-in-br + (i32.const 0) + (block (br 0 (global.set $x))) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (global $x (mut i32) (i32.const 0)) + (func $type-global.set-value-empty-in-br_if + (i32.const 0) + (block (br_if 0 (global.set $x))) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (global $x (mut i32) (i32.const 0)) + (func $type-global.set-value-empty-in-br_table + (i32.const 0) + (block (br_table 0 (global.set $x))) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (global $x (mut i32) (i32.const 0)) + (func $type-global.set-value-empty-in-return + (return (global.set $x)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (global $x (mut i32) (i32.const 0)) + (func $type-global.set-value-empty-in-select + (select (global.set $x) (i32.const 1) (i32.const 2)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (global $x (mut i32) (i32.const 0)) + (func $type-global.set-value-empty-in-call + (call 1 (global.set $x)) + ) + (func (param i32) (result i32) (local.get 0)) + ) + "type mismatch" +) +(assert_invalid + (module + (global $x (mut i32) (i32.const 0)) + (func $f (param i32) (result i32) (local.get 0)) + (type $sig (func (param i32) (result i32))) + (table funcref (elem $f)) + (func $type-global.set-value-empty-in-call_indirect + (block (result i32) + (call_indirect (type $sig) + (global.set $x) (i32.const 0) + ) + ) + ) + ) + "type mismatch" +) diff --git a/test/core/i32.load32_s.fail.wast b/test/core/i32.load32_s.fail.wast deleted file mode 100644 index abf38966..00000000 --- a/test/core/i32.load32_s.fail.wast +++ /dev/null @@ -1 +0,0 @@ -(module (memory 1) (func (param i32) (result i32) (i32.load32_s (get_local 0)))) diff --git a/test/core/i32.load32_u.fail.wast b/test/core/i32.load32_u.fail.wast deleted file mode 100644 index 26df0031..00000000 --- a/test/core/i32.load32_u.fail.wast +++ /dev/null @@ -1 +0,0 @@ -(module (memory 1) (func (param i32) (result i32) (i32.load32_u (get_local 0)))) diff --git a/test/core/i32.load64_s.fail.wast b/test/core/i32.load64_s.fail.wast deleted file mode 100644 index 78fa0127..00000000 --- a/test/core/i32.load64_s.fail.wast +++ /dev/null @@ -1 +0,0 @@ -(module (memory 1) (func (param i32) (result i32) (i32.load64_s (get_local 0)))) diff --git a/test/core/i32.load64_u.fail.wast b/test/core/i32.load64_u.fail.wast deleted file mode 100644 index 01e8273e..00000000 --- a/test/core/i32.load64_u.fail.wast +++ /dev/null @@ -1 +0,0 @@ -(module (memory 1) (func (param i32) (result i32) (i32.load64_u (get_local 0)))) diff --git a/test/core/i32.store32.fail.wast b/test/core/i32.store32.fail.wast deleted file mode 100644 index 8a6c528d..00000000 --- a/test/core/i32.store32.fail.wast +++ /dev/null @@ -1 +0,0 @@ -(module (memory 1) (func (param i32) (param i32) (i32.store32 (get_local 0) (get_local 1)))) diff --git a/test/core/i32.store64.fail.wast b/test/core/i32.store64.fail.wast deleted file mode 100644 index cb176d23..00000000 --- a/test/core/i32.store64.fail.wast +++ /dev/null @@ -1 +0,0 @@ -(module (memory 1) (func (param i32) (param i64) (i32.store64 (get_local 0) (get_local 1)))) diff --git a/test/core/i32.wast b/test/core/i32.wast index bd8722e6..58c853a6 100644 --- a/test/core/i32.wast +++ b/test/core/i32.wast @@ -1,35 +1,35 @@ ;; i32 operations (module - (func (export "add") (param $x i32) (param $y i32) (result i32) (i32.add (get_local $x) (get_local $y))) - (func (export "sub") (param $x i32) (param $y i32) (result i32) (i32.sub (get_local $x) (get_local $y))) - (func (export "mul") (param $x i32) (param $y i32) (result i32) (i32.mul (get_local $x) (get_local $y))) - (func (export "div_s") (param $x i32) (param $y i32) (result i32) (i32.div_s (get_local $x) (get_local $y))) - (func (export "div_u") (param $x i32) (param $y i32) (result i32) (i32.div_u (get_local $x) (get_local $y))) - (func (export "rem_s") (param $x i32) (param $y i32) (result i32) (i32.rem_s (get_local $x) (get_local $y))) - (func (export "rem_u") (param $x i32) (param $y i32) (result i32) (i32.rem_u (get_local $x) (get_local $y))) - (func (export "and") (param $x i32) (param $y i32) (result i32) (i32.and (get_local $x) (get_local $y))) - (func (export "or") (param $x i32) (param $y i32) (result i32) (i32.or (get_local $x) (get_local $y))) - (func (export "xor") (param $x i32) (param $y i32) (result i32) (i32.xor (get_local $x) (get_local $y))) - (func (export "shl") (param $x i32) (param $y i32) (result i32) (i32.shl (get_local $x) (get_local $y))) - (func (export "shr_s") (param $x i32) (param $y i32) (result i32) (i32.shr_s (get_local $x) (get_local $y))) - (func (export "shr_u") (param $x i32) (param $y i32) (result i32) (i32.shr_u (get_local $x) (get_local $y))) - (func (export "rotl") (param $x i32) (param $y i32) (result i32) (i32.rotl (get_local $x) (get_local $y))) - (func (export "rotr") (param $x i32) (param $y i32) (result i32) (i32.rotr (get_local $x) (get_local $y))) - (func (export "clz") (param $x i32) (result i32) (i32.clz (get_local $x))) - (func (export "ctz") (param $x i32) (result i32) (i32.ctz (get_local $x))) - (func (export "popcnt") (param $x i32) (result i32) (i32.popcnt (get_local $x))) - (func (export "eqz") (param $x i32) (result i32) (i32.eqz (get_local $x))) - (func (export "eq") (param $x i32) (param $y i32) (result i32) (i32.eq (get_local $x) (get_local $y))) - (func (export "ne") (param $x i32) (param $y i32) (result i32) (i32.ne (get_local $x) (get_local $y))) - (func (export "lt_s") (param $x i32) (param $y i32) (result i32) (i32.lt_s (get_local $x) (get_local $y))) - (func (export "lt_u") (param $x i32) (param $y i32) (result i32) (i32.lt_u (get_local $x) (get_local $y))) - (func (export "le_s") (param $x i32) (param $y i32) (result i32) (i32.le_s (get_local $x) (get_local $y))) - (func (export "le_u") (param $x i32) (param $y i32) (result i32) (i32.le_u (get_local $x) (get_local $y))) - (func (export "gt_s") (param $x i32) (param $y i32) (result i32) (i32.gt_s (get_local $x) (get_local $y))) - (func (export "gt_u") (param $x i32) (param $y i32) (result i32) (i32.gt_u (get_local $x) (get_local $y))) - (func (export "ge_s") (param $x i32) (param $y i32) (result i32) (i32.ge_s (get_local $x) (get_local $y))) - (func (export "ge_u") (param $x i32) (param $y i32) (result i32) (i32.ge_u (get_local $x) (get_local $y))) + (func (export "add") (param $x i32) (param $y i32) (result i32) (i32.add (local.get $x) (local.get $y))) + (func (export "sub") (param $x i32) (param $y i32) (result i32) (i32.sub (local.get $x) (local.get $y))) + (func (export "mul") (param $x i32) (param $y i32) (result i32) (i32.mul (local.get $x) (local.get $y))) + (func (export "div_s") (param $x i32) (param $y i32) (result i32) (i32.div_s (local.get $x) (local.get $y))) + (func (export "div_u") (param $x i32) (param $y i32) (result i32) (i32.div_u (local.get $x) (local.get $y))) + (func (export "rem_s") (param $x i32) (param $y i32) (result i32) (i32.rem_s (local.get $x) (local.get $y))) + (func (export "rem_u") (param $x i32) (param $y i32) (result i32) (i32.rem_u (local.get $x) (local.get $y))) + (func (export "and") (param $x i32) (param $y i32) (result i32) (i32.and (local.get $x) (local.get $y))) + (func (export "or") (param $x i32) (param $y i32) (result i32) (i32.or (local.get $x) (local.get $y))) + (func (export "xor") (param $x i32) (param $y i32) (result i32) (i32.xor (local.get $x) (local.get $y))) + (func (export "shl") (param $x i32) (param $y i32) (result i32) (i32.shl (local.get $x) (local.get $y))) + (func (export "shr_s") (param $x i32) (param $y i32) (result i32) (i32.shr_s (local.get $x) (local.get $y))) + (func (export "shr_u") (param $x i32) (param $y i32) (result i32) (i32.shr_u (local.get $x) (local.get $y))) + (func (export "rotl") (param $x i32) (param $y i32) (result i32) (i32.rotl (local.get $x) (local.get $y))) + (func (export "rotr") (param $x i32) (param $y i32) (result i32) (i32.rotr (local.get $x) (local.get $y))) + (func (export "clz") (param $x i32) (result i32) (i32.clz (local.get $x))) + (func (export "ctz") (param $x i32) (result i32) (i32.ctz (local.get $x))) + (func (export "popcnt") (param $x i32) (result i32) (i32.popcnt (local.get $x))) + (func (export "eqz") (param $x i32) (result i32) (i32.eqz (local.get $x))) + (func (export "eq") (param $x i32) (param $y i32) (result i32) (i32.eq (local.get $x) (local.get $y))) + (func (export "ne") (param $x i32) (param $y i32) (result i32) (i32.ne (local.get $x) (local.get $y))) + (func (export "lt_s") (param $x i32) (param $y i32) (result i32) (i32.lt_s (local.get $x) (local.get $y))) + (func (export "lt_u") (param $x i32) (param $y i32) (result i32) (i32.lt_u (local.get $x) (local.get $y))) + (func (export "le_s") (param $x i32) (param $y i32) (result i32) (i32.le_s (local.get $x) (local.get $y))) + (func (export "le_u") (param $x i32) (param $y i32) (result i32) (i32.le_u (local.get $x) (local.get $y))) + (func (export "gt_s") (param $x i32) (param $y i32) (result i32) (i32.gt_s (local.get $x) (local.get $y))) + (func (export "gt_u") (param $x i32) (param $y i32) (result i32) (i32.gt_u (local.get $x) (local.get $y))) + (func (export "ge_s") (param $x i32) (param $y i32) (result i32) (i32.ge_s (local.get $x) (local.get $y))) + (func (export "ge_u") (param $x i32) (param $y i32) (result i32) (i32.ge_u (local.get $x) (local.get $y))) ) (assert_return (invoke "add" (i32.const 1) (i32.const 1)) (i32.const 2)) @@ -62,6 +62,7 @@ (assert_trap (invoke "div_s" (i32.const 1) (i32.const 0)) "integer divide by zero") (assert_trap (invoke "div_s" (i32.const 0) (i32.const 0)) "integer divide by zero") (assert_trap (invoke "div_s" (i32.const 0x80000000) (i32.const -1)) "integer overflow") +(assert_trap (invoke "div_s" (i32.const 0x80000000) (i32.const 0)) "integer divide by zero") (assert_return (invoke "div_s" (i32.const 1) (i32.const 1)) (i32.const 1)) (assert_return (invoke "div_s" (i32.const 0) (i32.const 1)) (i32.const 0)) (assert_return (invoke "div_s" (i32.const 0) (i32.const -1)) (i32.const 0)) @@ -419,3 +420,539 @@ (assert_return (invoke "ge_u" (i32.const -1) (i32.const 0x80000000)) (i32.const 1)) (assert_return (invoke "ge_u" (i32.const 0x80000000) (i32.const 0x7fffffff)) (i32.const 1)) (assert_return (invoke "ge_u" (i32.const 0x7fffffff) (i32.const 0x80000000)) (i32.const 0)) + + +(assert_invalid + (module + (func $type-unary-operand-empty + (i32.eqz) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-unary-operand-empty-in-block + (i32.const 0) + (block (i32.eqz) (drop)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-unary-operand-empty-in-loop + (i32.const 0) + (loop (i32.eqz) (drop)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-unary-operand-empty-in-if + (i32.const 0) (i32.const 0) + (if (then (i32.eqz) (drop))) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-unary-operand-empty-in-else + (i32.const 0) (i32.const 0) + (if (result i32) (then (i32.const 0)) (else (i32.eqz))) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-unary-operand-empty-in-br + (i32.const 0) + (block (br 0 (i32.eqz)) (drop)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-unary-operand-empty-in-br_if + (i32.const 0) + (block (br_if 0 (i32.eqz) (i32.const 1)) (drop)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-unary-operand-empty-in-br_table + (i32.const 0) + (block (br_table 0 (i32.eqz)) (drop)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-unary-operand-empty-in-return + (return (i32.eqz)) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-unary-operand-empty-in-select + (select (i32.eqz) (i32.const 1) (i32.const 2)) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-unary-operand-empty-in-call + (call 1 (i32.eqz)) (drop) + ) + (func (param i32) (result i32) (local.get 0)) + ) + "type mismatch" +) +(assert_invalid + (module + (func $f (param i32) (result i32) (local.get 0)) + (type $sig (func (param i32) (result i32))) + (table funcref (elem $f)) + (func $type-unary-operand-empty-in-call_indirect + (block (result i32) + (call_indirect (type $sig) + (i32.eqz) (i32.const 0) + ) + (drop) + ) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-unary-operand-empty-in-local.set + (local i32) + (local.set 0 (i32.eqz)) (local.get 0) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-unary-operand-empty-in-local.tee + (local i32) + (local.tee 0 (i32.eqz)) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (global $x (mut i32) (i32.const 0)) + (func $type-unary-operand-empty-in-global.set + (global.set $x (i32.eqz)) (global.get $x) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 0) + (func $type-unary-operand-empty-in-memory.grow + (memory.grow (i32.eqz)) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 0) + (func $type-unary-operand-empty-in-load + (i32.load (i32.eqz)) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 1) + (func $type-unary-operand-empty-in-store + (i32.store (i32.eqz) (i32.const 1)) + ) + ) + "type mismatch" +) + +(assert_invalid + (module + (func $type-binary-1st-operand-empty + (i32.add) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-binary-2nd-operand-empty + (i32.const 0) (i32.add) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-binary-1st-operand-empty-in-block + (i32.const 0) (i32.const 0) + (block (i32.add) (drop)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-binary-2nd-operand-empty-in-block + (i32.const 0) + (block (i32.const 0) (i32.add) (drop)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-binary-1st-operand-empty-in-loop + (i32.const 0) (i32.const 0) + (loop (i32.add) (drop)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-binary-2nd-operand-empty-in-loop + (i32.const 0) + (loop (i32.const 0) (i32.add) (drop)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-binary-1st-operand-empty-in-if + (i32.const 0) (i32.const 0) (i32.const 0) + (if (i32.add) (then (drop))) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-binary-2nd-operand-empty-in-if + (i32.const 0) (i32.const 0) + (if (i32.const 0) (then (i32.add)) (else (drop))) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-binary-1st-operand-empty-in-else + (i32.const 0) (i32.const 0) (i32.const 0) + (if (result i32) (then (i32.const 0)) (else (i32.add) (i32.const 0))) + (drop) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-binary-2nd-operand-empty-in-else + (i32.const 0) (i32.const 0) + (if (result i32) (then (i32.const 0)) (else (i32.add))) + (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-binary-1st-operand-empty-in-br + (i32.const 0) (i32.const 0) + (block (br 0 (i32.add)) (drop)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-binary-2nd-operand-empty-in-br + (i32.const 0) + (block (br 0 (i32.const 0) (i32.add)) (drop)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-binary-1st-operand-empty-in-br_if + (i32.const 0) (i32.const 0) + (block (br_if 0 (i32.add) (i32.const 1)) (drop)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-binary-2nd-operand-empty-in-br_if + (i32.const 0) + (block (br_if 0 (i32.const 0) (i32.add) (i32.const 1)) (drop)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-binary-1st-operand-empty-in-br_table + (i32.const 0) (i32.const 0) + (block (br_table 0 (i32.add)) (drop)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-binary-2nd-operand-empty-in-br_table + (i32.const 0) + (block (br_table 0 (i32.const 0) (i32.add)) (drop)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-binary-1st-operand-empty-in-return + (return (i32.add)) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-binary-2nd-operand-empty-in-return + (return (i32.const 0) (i32.add)) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-binary-1st-operand-empty-in-select + (select (i32.add) (i32.const 1) (i32.const 2)) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-binary-2nd-operand-empty-in-select + (select (i32.const 0) (i32.add) (i32.const 1) (i32.const 2)) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-binary-1st-operand-empty-in-call + (call 1 (i32.add)) (drop) + ) + (func (param i32 i32) (result i32) (local.get 0)) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-binary-2nd-operand-empty-in-call + (call 1 (i32.const 0) (i32.add)) (drop) + ) + (func (param i32 i32) (result i32) (local.get 0)) + ) + "type mismatch" +) +(assert_invalid + (module + (func $f (param i32) (result i32) (local.get 0)) + (type $sig (func (param i32) (result i32))) + (table funcref (elem $f)) + (func $type-binary-1st-operand-empty-in-call_indirect + (block (result i32) + (call_indirect (type $sig) + (i32.add) (i32.const 0) + ) + (drop) + ) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $f (param i32) (result i32) (local.get 0)) + (type $sig (func (param i32) (result i32))) + (table funcref (elem $f)) + (func $type-binary-2nd-operand-empty-in-call_indirect + (block (result i32) + (call_indirect (type $sig) + (i32.const 0) (i32.add) (i32.const 0) + ) + (drop) + ) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-binary-1st-operand-empty-in-local.set + (local i32) + (local.set 0 (i32.add)) (local.get 0) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-binary-2nd-operand-empty-in-local.set + (local i32) + (local.set 0 (i32.const 0) (i32.add)) (local.get 0) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-binary-1st-operand-empty-in-local.tee + (local i32) + (local.tee 0 (i32.add)) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-binary-2nd-operand-empty-in-local.tee + (local i32) + (local.tee 0 (i32.const 0) (i32.add)) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (global $x (mut i32) (i32.const 0)) + (func $type-binary-1st-operand-empty-in-global.set + (global.set $x (i32.add)) (global.get $x) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (global $x (mut i32) (i32.const 0)) + (func $type-binary-2nd-operand-empty-in-global.set + (global.set $x (i32.const 0) (i32.add)) (global.get $x) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 0) + (func $type-binary-1st-operand-empty-in-memory.grow + (memory.grow (i32.add)) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 0) + (func $type-binary-2nd-operand-empty-in-memory.grow + (memory.grow (i32.const 0) (i32.add)) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 0) + (func $type-binary-1st-operand-empty-in-load + (i32.load (i32.add)) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 0) + (func $type-binary-2nd-operand-empty-in-load + (i32.load (i32.const 0) (i32.add)) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 1) + (func $type-binary-1st-operand-empty-in-store + (i32.store (i32.add) (i32.const 1)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 1) + (func $type-binary-2nd-operand-empty-in-store + (i32.store (i32.const 1) (i32.add) (i32.const 0)) + ) + ) + "type mismatch" +) + + +;; Type check + +(assert_invalid (module (func (result i32) (i32.add (i64.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i32) (i32.and (i64.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i32) (i32.div_s (i64.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i32) (i32.div_u (i64.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i32) (i32.mul (i64.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i32) (i32.or (i64.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i32) (i32.rem_s (i64.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i32) (i32.rem_u (i64.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i32) (i32.rotl (i64.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i32) (i32.rotr (i64.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i32) (i32.shl (i64.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i32) (i32.shr_s (i64.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i32) (i32.shr_u (i64.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i32) (i32.sub (i64.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i32) (i32.xor (i64.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i32) (i32.eqz (i64.const 0)))) "type mismatch") +(assert_invalid (module (func (result i32) (i32.clz (i64.const 0)))) "type mismatch") +(assert_invalid (module (func (result i32) (i32.ctz (i64.const 0)))) "type mismatch") +(assert_invalid (module (func (result i32) (i32.popcnt (i64.const 0)))) "type mismatch") +(assert_invalid (module (func (result i32) (i32.eq (i64.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i32) (i32.ge_s (i64.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i32) (i32.ge_u (i64.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i32) (i32.gt_s (i64.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i32) (i32.gt_u (i64.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i32) (i32.le_s (i64.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i32) (i32.le_u (i64.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i32) (i32.lt_s (i64.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i32) (i32.lt_u (i64.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i32) (i32.ne (i64.const 0) (f32.const 0)))) "type mismatch") diff --git a/test/core/i64.load64_s.fail.wast b/test/core/i64.load64_s.fail.wast deleted file mode 100644 index 335bac35..00000000 --- a/test/core/i64.load64_s.fail.wast +++ /dev/null @@ -1 +0,0 @@ -(module (memory 1) (func (param i32) (result i64) (i64.load64_s (get_local 0)))) diff --git a/test/core/i64.load64_u.fail.wast b/test/core/i64.load64_u.fail.wast deleted file mode 100644 index b9002e2b..00000000 --- a/test/core/i64.load64_u.fail.wast +++ /dev/null @@ -1 +0,0 @@ -(module (memory 1) (func (param i32) (result i64) (i64.load64_u (get_local 0)))) diff --git a/test/core/i64.store64.fail.wast b/test/core/i64.store64.fail.wast deleted file mode 100644 index 918761f6..00000000 --- a/test/core/i64.store64.fail.wast +++ /dev/null @@ -1 +0,0 @@ -(module (memory 1) (func (param i32) (param i64) (i64.store64 (get_local 0) (get_local 1)))) diff --git a/test/core/i64.wast b/test/core/i64.wast index 6bb8a31e..5a8c1d66 100644 --- a/test/core/i64.wast +++ b/test/core/i64.wast @@ -1,35 +1,35 @@ ;; i64 operations (module - (func (export "add") (param $x i64) (param $y i64) (result i64) (i64.add (get_local $x) (get_local $y))) - (func (export "sub") (param $x i64) (param $y i64) (result i64) (i64.sub (get_local $x) (get_local $y))) - (func (export "mul") (param $x i64) (param $y i64) (result i64) (i64.mul (get_local $x) (get_local $y))) - (func (export "div_s") (param $x i64) (param $y i64) (result i64) (i64.div_s (get_local $x) (get_local $y))) - (func (export "div_u") (param $x i64) (param $y i64) (result i64) (i64.div_u (get_local $x) (get_local $y))) - (func (export "rem_s") (param $x i64) (param $y i64) (result i64) (i64.rem_s (get_local $x) (get_local $y))) - (func (export "rem_u") (param $x i64) (param $y i64) (result i64) (i64.rem_u (get_local $x) (get_local $y))) - (func (export "and") (param $x i64) (param $y i64) (result i64) (i64.and (get_local $x) (get_local $y))) - (func (export "or") (param $x i64) (param $y i64) (result i64) (i64.or (get_local $x) (get_local $y))) - (func (export "xor") (param $x i64) (param $y i64) (result i64) (i64.xor (get_local $x) (get_local $y))) - (func (export "shl") (param $x i64) (param $y i64) (result i64) (i64.shl (get_local $x) (get_local $y))) - (func (export "shr_s") (param $x i64) (param $y i64) (result i64) (i64.shr_s (get_local $x) (get_local $y))) - (func (export "shr_u") (param $x i64) (param $y i64) (result i64) (i64.shr_u (get_local $x) (get_local $y))) - (func (export "rotl") (param $x i64) (param $y i64) (result i64) (i64.rotl (get_local $x) (get_local $y))) - (func (export "rotr") (param $x i64) (param $y i64) (result i64) (i64.rotr (get_local $x) (get_local $y))) - (func (export "clz") (param $x i64) (result i64) (i64.clz (get_local $x))) - (func (export "ctz") (param $x i64) (result i64) (i64.ctz (get_local $x))) - (func (export "popcnt") (param $x i64) (result i64) (i64.popcnt (get_local $x))) - (func (export "eqz") (param $x i64) (result i32) (i64.eqz (get_local $x))) - (func (export "eq") (param $x i64) (param $y i64) (result i32) (i64.eq (get_local $x) (get_local $y))) - (func (export "ne") (param $x i64) (param $y i64) (result i32) (i64.ne (get_local $x) (get_local $y))) - (func (export "lt_s") (param $x i64) (param $y i64) (result i32) (i64.lt_s (get_local $x) (get_local $y))) - (func (export "lt_u") (param $x i64) (param $y i64) (result i32) (i64.lt_u (get_local $x) (get_local $y))) - (func (export "le_s") (param $x i64) (param $y i64) (result i32) (i64.le_s (get_local $x) (get_local $y))) - (func (export "le_u") (param $x i64) (param $y i64) (result i32) (i64.le_u (get_local $x) (get_local $y))) - (func (export "gt_s") (param $x i64) (param $y i64) (result i32) (i64.gt_s (get_local $x) (get_local $y))) - (func (export "gt_u") (param $x i64) (param $y i64) (result i32) (i64.gt_u (get_local $x) (get_local $y))) - (func (export "ge_s") (param $x i64) (param $y i64) (result i32) (i64.ge_s (get_local $x) (get_local $y))) - (func (export "ge_u") (param $x i64) (param $y i64) (result i32) (i64.ge_u (get_local $x) (get_local $y))) + (func (export "add") (param $x i64) (param $y i64) (result i64) (i64.add (local.get $x) (local.get $y))) + (func (export "sub") (param $x i64) (param $y i64) (result i64) (i64.sub (local.get $x) (local.get $y))) + (func (export "mul") (param $x i64) (param $y i64) (result i64) (i64.mul (local.get $x) (local.get $y))) + (func (export "div_s") (param $x i64) (param $y i64) (result i64) (i64.div_s (local.get $x) (local.get $y))) + (func (export "div_u") (param $x i64) (param $y i64) (result i64) (i64.div_u (local.get $x) (local.get $y))) + (func (export "rem_s") (param $x i64) (param $y i64) (result i64) (i64.rem_s (local.get $x) (local.get $y))) + (func (export "rem_u") (param $x i64) (param $y i64) (result i64) (i64.rem_u (local.get $x) (local.get $y))) + (func (export "and") (param $x i64) (param $y i64) (result i64) (i64.and (local.get $x) (local.get $y))) + (func (export "or") (param $x i64) (param $y i64) (result i64) (i64.or (local.get $x) (local.get $y))) + (func (export "xor") (param $x i64) (param $y i64) (result i64) (i64.xor (local.get $x) (local.get $y))) + (func (export "shl") (param $x i64) (param $y i64) (result i64) (i64.shl (local.get $x) (local.get $y))) + (func (export "shr_s") (param $x i64) (param $y i64) (result i64) (i64.shr_s (local.get $x) (local.get $y))) + (func (export "shr_u") (param $x i64) (param $y i64) (result i64) (i64.shr_u (local.get $x) (local.get $y))) + (func (export "rotl") (param $x i64) (param $y i64) (result i64) (i64.rotl (local.get $x) (local.get $y))) + (func (export "rotr") (param $x i64) (param $y i64) (result i64) (i64.rotr (local.get $x) (local.get $y))) + (func (export "clz") (param $x i64) (result i64) (i64.clz (local.get $x))) + (func (export "ctz") (param $x i64) (result i64) (i64.ctz (local.get $x))) + (func (export "popcnt") (param $x i64) (result i64) (i64.popcnt (local.get $x))) + (func (export "eqz") (param $x i64) (result i32) (i64.eqz (local.get $x))) + (func (export "eq") (param $x i64) (param $y i64) (result i32) (i64.eq (local.get $x) (local.get $y))) + (func (export "ne") (param $x i64) (param $y i64) (result i32) (i64.ne (local.get $x) (local.get $y))) + (func (export "lt_s") (param $x i64) (param $y i64) (result i32) (i64.lt_s (local.get $x) (local.get $y))) + (func (export "lt_u") (param $x i64) (param $y i64) (result i32) (i64.lt_u (local.get $x) (local.get $y))) + (func (export "le_s") (param $x i64) (param $y i64) (result i32) (i64.le_s (local.get $x) (local.get $y))) + (func (export "le_u") (param $x i64) (param $y i64) (result i32) (i64.le_u (local.get $x) (local.get $y))) + (func (export "gt_s") (param $x i64) (param $y i64) (result i32) (i64.gt_s (local.get $x) (local.get $y))) + (func (export "gt_u") (param $x i64) (param $y i64) (result i32) (i64.gt_u (local.get $x) (local.get $y))) + (func (export "ge_s") (param $x i64) (param $y i64) (result i32) (i64.ge_s (local.get $x) (local.get $y))) + (func (export "ge_u") (param $x i64) (param $y i64) (result i32) (i64.ge_u (local.get $x) (local.get $y))) ) (assert_return (invoke "add" (i64.const 1) (i64.const 1)) (i64.const 2)) @@ -62,6 +62,7 @@ (assert_trap (invoke "div_s" (i64.const 1) (i64.const 0)) "integer divide by zero") (assert_trap (invoke "div_s" (i64.const 0) (i64.const 0)) "integer divide by zero") (assert_trap (invoke "div_s" (i64.const 0x8000000000000000) (i64.const -1)) "integer overflow") +(assert_trap (invoke "div_s" (i64.const 0x8000000000000000) (i64.const 0)) "integer divide by zero") (assert_return (invoke "div_s" (i64.const 1) (i64.const 1)) (i64.const 1)) (assert_return (invoke "div_s" (i64.const 0) (i64.const 1)) (i64.const 0)) (assert_return (invoke "div_s" (i64.const 0) (i64.const -1)) (i64.const 0)) @@ -419,3 +420,36 @@ (assert_return (invoke "ge_u" (i64.const -1) (i64.const 0x8000000000000000)) (i32.const 1)) (assert_return (invoke "ge_u" (i64.const 0x8000000000000000) (i64.const 0x7fffffffffffffff)) (i32.const 1)) (assert_return (invoke "ge_u" (i64.const 0x7fffffffffffffff) (i64.const 0x8000000000000000)) (i32.const 0)) + + +;; Type check + +(assert_invalid (module (func (result i64) (i64.add (i32.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.and (i32.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.div_s (i32.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.div_u (i32.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.mul (i32.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.or (i32.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.rem_s (i32.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.rem_u (i32.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.rotl (i32.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.rotr (i32.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.shl (i32.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.shr_s (i32.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.shr_u (i32.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.sub (i32.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.xor (i32.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.eqz (i32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.clz (i32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.ctz (i32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.popcnt (i32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.eq (i32.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.ge_s (i32.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.ge_u (i32.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.gt_s (i32.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.gt_u (i32.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.le_s (i32.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.le_u (i32.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.lt_s (i32.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.lt_u (i32.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (func (result i64) (i64.ne (i32.const 0) (f32.const 0)))) "type mismatch") diff --git a/test/core/if-else-end-label-mismatch.fail.wast b/test/core/if-else-end-label-mismatch.fail.wast deleted file mode 100644 index 723f898f..00000000 --- a/test/core/if-else-end-label-mismatch.fail.wast +++ /dev/null @@ -1 +0,0 @@ -(module (func if $a else $l end $l)) diff --git a/test/core/if-else-end-label-superfluous.fail.wast b/test/core/if-else-end-label-superfluous.fail.wast deleted file mode 100644 index bcdb6f68..00000000 --- a/test/core/if-else-end-label-superfluous.fail.wast +++ /dev/null @@ -1 +0,0 @@ -(module (func if else $l end $l)) diff --git a/test/core/if-else-label-mismatch.fail.wast b/test/core/if-else-label-mismatch.fail.wast deleted file mode 100644 index 6d9bfdba..00000000 --- a/test/core/if-else-label-mismatch.fail.wast +++ /dev/null @@ -1 +0,0 @@ -(module (func if $a else $l end)) diff --git a/test/core/if-else-label-superfluous.fail.wast b/test/core/if-else-label-superfluous.fail.wast deleted file mode 100644 index e6781468..00000000 --- a/test/core/if-else-label-superfluous.fail.wast +++ /dev/null @@ -1 +0,0 @@ -(module (func if else $l end)) diff --git a/test/core/if-end-label-mismatch.fail.wast b/test/core/if-end-label-mismatch.fail.wast deleted file mode 100644 index 6598d452..00000000 --- a/test/core/if-end-label-mismatch.fail.wast +++ /dev/null @@ -1 +0,0 @@ -(module (func if $a end $l)) diff --git a/test/core/if-end-label-superfluous.fail.wast b/test/core/if-end-label-superfluous.fail.wast deleted file mode 100644 index c111352c..00000000 --- a/test/core/if-end-label-superfluous.fail.wast +++ /dev/null @@ -1 +0,0 @@ -(module (func if end $l)) diff --git a/test/core/if.wast b/test/core/if.wast index 7ec1f2b7..ae7f7b38 100644 --- a/test/core/if.wast +++ b/test/core/if.wast @@ -2,44 +2,46 @@ (module ;; Auxiliary definition + (memory 1) + (func $dummy) (func (export "empty") (param i32) - (if (get_local 0) (then)) - (if (get_local 0) (then) (else)) - (if $l (get_local 0) (then)) - (if $l (get_local 0) (then) (else)) + (if (local.get 0) (then)) + (if (local.get 0) (then) (else)) + (if $l (local.get 0) (then)) + (if $l (local.get 0) (then) (else)) ) (func (export "singular") (param i32) (result i32) - (if (get_local 0) (then (nop))) - (if (get_local 0) (then (nop)) (else (nop))) - (if i32 (get_local 0) (then (i32.const 7)) (else (i32.const 8))) + (if (local.get 0) (then (nop))) + (if (local.get 0) (then (nop)) (else (nop))) + (if (result i32) (local.get 0) (then (i32.const 7)) (else (i32.const 8))) ) (func (export "multi") (param i32) (result i32) - (if (get_local 0) (then (call $dummy) (call $dummy) (call $dummy))) - (if (get_local 0) (then) (else (call $dummy) (call $dummy) (call $dummy))) - (if i32 (get_local 0) + (if (local.get 0) (then (call $dummy) (call $dummy) (call $dummy))) + (if (local.get 0) (then) (else (call $dummy) (call $dummy) (call $dummy))) + (if (result i32) (local.get 0) (then (call $dummy) (call $dummy) (i32.const 8)) (else (call $dummy) (call $dummy) (i32.const 9)) ) ) (func (export "nested") (param i32 i32) (result i32) - (if i32 (get_local 0) + (if (result i32) (local.get 0) (then - (if (get_local 1) (then (call $dummy) (block) (nop))) - (if (get_local 1) (then) (else (call $dummy) (block) (nop))) - (if i32 (get_local 1) + (if (local.get 1) (then (call $dummy) (block) (nop))) + (if (local.get 1) (then) (else (call $dummy) (block) (nop))) + (if (result i32) (local.get 1) (then (call $dummy) (i32.const 9)) (else (call $dummy) (i32.const 10)) ) ) (else - (if (get_local 1) (then (call $dummy) (block) (nop))) - (if (get_local 1) (then) (else (call $dummy) (block) (nop))) - (if i32 (get_local 1) + (if (local.get 1) (then (call $dummy) (block) (nop))) + (if (local.get 1) (then) (else (call $dummy) (block) (nop))) + (if (result i32) (local.get 1) (then (call $dummy) (i32.const 10)) (else (call $dummy) (i32.const 11)) ) @@ -47,9 +49,257 @@ ) ) + (func (export "as-select-first") (param i32) (result i32) + (select + (if (result i32) (local.get 0) + (then (call $dummy) (i32.const 1)) + (else (call $dummy) (i32.const 0)) + ) + (i32.const 2) (i32.const 3) + ) + ) + (func (export "as-select-mid") (param i32) (result i32) + (select + (i32.const 2) + (if (result i32) (local.get 0) + (then (call $dummy) (i32.const 1)) + (else (call $dummy) (i32.const 0)) + ) + (i32.const 3) + ) + ) + (func (export "as-select-last") (param i32) (result i32) + (select + (i32.const 2) (i32.const 3) + (if (result i32) (local.get 0) + (then (call $dummy) (i32.const 1)) + (else (call $dummy) (i32.const 0)) + ) + ) + ) + + (func (export "as-loop-first") (param i32) (result i32) + (loop (result i32) + (if (result i32) (local.get 0) + (then (call $dummy) (i32.const 1)) + (else (call $dummy) (i32.const 0)) + ) + (call $dummy) (call $dummy) + ) + ) + (func (export "as-loop-mid") (param i32) (result i32) + (loop (result i32) + (call $dummy) + (if (result i32) (local.get 0) + (then (call $dummy) (i32.const 1)) + (else (call $dummy) (i32.const 0)) + ) + (call $dummy) + ) + ) + (func (export "as-loop-last") (param i32) (result i32) + (loop (result i32) + (call $dummy) (call $dummy) + (if (result i32) (local.get 0) + (then (call $dummy) (i32.const 1)) + (else (call $dummy) (i32.const 0)) + ) + ) + ) + + (func (export "as-if-condition") (param i32) (result i32) + (if (result i32) + (if (result i32) (local.get 0) + (then (i32.const 1)) (else (i32.const 0)) + ) + (then (call $dummy) (i32.const 2)) + (else (call $dummy) (i32.const 3)) + ) + ) + + (func (export "as-br_if-first") (param i32) (result i32) + (block (result i32) + (br_if 0 + (if (result i32) (local.get 0) + (then (call $dummy) (i32.const 1)) + (else (call $dummy) (i32.const 0)) + ) + (i32.const 2) + ) + (return (i32.const 3)) + ) + ) + (func (export "as-br_if-last") (param i32) (result i32) + (block (result i32) + (br_if 0 + (i32.const 2) + (if (result i32) (local.get 0) + (then (call $dummy) (i32.const 1)) + (else (call $dummy) (i32.const 0)) + ) + ) + (return (i32.const 3)) + ) + ) + + (func (export "as-br_table-first") (param i32) (result i32) + (block (result i32) + (if (result i32) (local.get 0) + (then (call $dummy) (i32.const 1)) + (else (call $dummy) (i32.const 0)) + ) + (i32.const 2) + (br_table 0 0) + ) + ) + (func (export "as-br_table-last") (param i32) (result i32) + (block (result i32) + (i32.const 2) + (if (result i32) (local.get 0) + (then (call $dummy) (i32.const 1)) + (else (call $dummy) (i32.const 0)) + ) + (br_table 0 0) + ) + ) + + (func $func (param i32 i32) (result i32) (local.get 0)) + (type $check (func (param i32 i32) (result i32))) + (table funcref (elem $func)) + (func (export "as-call_indirect-first") (param i32) (result i32) + (block (result i32) + (call_indirect (type $check) + (if (result i32) (local.get 0) + (then (call $dummy) (i32.const 1)) + (else (call $dummy) (i32.const 0)) + ) + (i32.const 2) (i32.const 0) + ) + ) + ) + (func (export "as-call_indirect-mid") (param i32) (result i32) + (block (result i32) + (call_indirect (type $check) + (i32.const 2) + (if (result i32) (local.get 0) + (then (call $dummy) (i32.const 1)) + (else (call $dummy) (i32.const 0)) + ) + (i32.const 0) + ) + ) + ) + (func (export "as-call_indirect-last") (param i32) (result i32) + (block (result i32) + (call_indirect (type $check) + (i32.const 2) (i32.const 0) + (if (result i32) (local.get 0) + (then (call $dummy) (i32.const 1)) + (else (call $dummy) (i32.const 0)) + ) + ) + ) + ) + + (func (export "as-store-first") (param i32) + (if (result i32) (local.get 0) + (then (call $dummy) (i32.const 1)) + (else (call $dummy) (i32.const 0)) + ) + (i32.const 2) + (i32.store) + ) + (func (export "as-store-last") (param i32) + (i32.const 2) + (if (result i32) (local.get 0) + (then (call $dummy) (i32.const 1)) + (else (call $dummy) (i32.const 0)) + ) + (i32.store) + ) + + (func (export "as-memory.grow-value") (param i32) (result i32) + (memory.grow + (if (result i32) (local.get 0) + (then (i32.const 1)) + (else (i32.const 0)) + ) + ) + ) + + (func $f (param i32) (result i32) (local.get 0)) + + (func (export "as-call-value") (param i32) (result i32) + (call $f + (if (result i32) (local.get 0) + (then (i32.const 1)) + (else (i32.const 0)) + ) + ) + ) + (func (export "as-return-value") (param i32) (result i32) + (if (result i32) (local.get 0) + (then (i32.const 1)) + (else (i32.const 0))) + (return) + ) + (func (export "as-drop-operand") (param i32) + (drop + (if (result i32) (local.get 0) + (then (i32.const 1)) + (else (i32.const 0)) + ) + ) + ) + (func (export "as-br-value") (param i32) (result i32) + (block (result i32) + (br 0 + (if (result i32) (local.get 0) + (then (i32.const 1)) + (else (i32.const 0)) + ) + ) + ) + ) + (func (export "as-local.set-value") (param i32) (result i32) + (local i32) + (local.set 0 + (if (result i32) (local.get 0) + (then (i32.const 1)) + (else (i32.const 0)) + ) + ) + (local.get 0) + ) + (func (export "as-local.tee-value") (param i32) (result i32) + (local.tee 0 + (if (result i32) (local.get 0) + (then (i32.const 1)) + (else (i32.const 0)) + ) + ) + ) + (global $a (mut i32) (i32.const 10)) + (func (export "as-global.set-value") (param i32) (result i32) + (global.set $a + (if (result i32) (local.get 0) + (then (i32.const 1)) + (else (i32.const 0)) + ) + ) (global.get $a) + ) + (func (export "as-load-operand") (param i32) (result i32) + (i32.load + (if (result i32) (local.get 0) + (then (i32.const 11)) + (else (i32.const 10)) + ) + ) + ) + (func (export "as-unary-operand") (param i32) (result i32) (i32.ctz - (if i32 (get_local 0) + (if (result i32) (local.get 0) (then (call $dummy) (i32.const 13)) (else (call $dummy) (i32.const -13)) ) @@ -57,11 +307,11 @@ ) (func (export "as-binary-operand") (param i32 i32) (result i32) (i32.mul - (if i32 (get_local 0) + (if (result i32) (local.get 0) (then (call $dummy) (i32.const 3)) (else (call $dummy) (i32.const -3)) ) - (if i32 (get_local 1) + (if (result i32) (local.get 1) (then (call $dummy) (i32.const 4)) (else (call $dummy) (i32.const -5)) ) @@ -69,7 +319,7 @@ ) (func (export "as-test-operand") (param i32) (result i32) (i32.eqz - (if i32 (get_local 0) + (if (result i32) (local.get 0) (then (call $dummy) (i32.const 13)) (else (call $dummy) (i32.const 0)) ) @@ -77,11 +327,11 @@ ) (func (export "as-compare-operand") (param i32 i32) (result i32) (f32.gt - (if f32 (get_local 0) + (if (result f32) (local.get 0) (then (call $dummy) (f32.const 3)) (else (call $dummy) (f32.const -3)) ) - (if f32 (get_local 1) + (if (result f32) (local.get 1) (then (call $dummy) (f32.const 4)) (else (call $dummy) (f32.const -4)) ) @@ -102,7 +352,7 @@ ) (func (export "break-value") (param i32) (result i32) - (if i32 (get_local 0) + (if (result i32) (local.get 0) (then (br 0 (i32.const 18)) (i32.const 19)) (else (br 0 (i32.const 21)) (i32.const 20)) ) @@ -111,23 +361,23 @@ (func (export "effects") (param i32) (result i32) (local i32) (if - (block i32 (set_local 1 (i32.const 1)) (get_local 0)) + (block (result i32) (local.set 1 (i32.const 1)) (local.get 0)) (then - (set_local 1 (i32.mul (get_local 1) (i32.const 3))) - (set_local 1 (i32.sub (get_local 1) (i32.const 5))) - (set_local 1 (i32.mul (get_local 1) (i32.const 7))) + (local.set 1 (i32.mul (local.get 1) (i32.const 3))) + (local.set 1 (i32.sub (local.get 1) (i32.const 5))) + (local.set 1 (i32.mul (local.get 1) (i32.const 7))) (br 0) - (set_local 1 (i32.mul (get_local 1) (i32.const 100))) + (local.set 1 (i32.mul (local.get 1) (i32.const 100))) ) (else - (set_local 1 (i32.mul (get_local 1) (i32.const 5))) - (set_local 1 (i32.sub (get_local 1) (i32.const 7))) - (set_local 1 (i32.mul (get_local 1) (i32.const 3))) + (local.set 1 (i32.mul (local.get 1) (i32.const 5))) + (local.set 1 (i32.sub (local.get 1) (i32.const 7))) + (local.set 1 (i32.mul (local.get 1) (i32.const 3))) (br 0) - (set_local 1 (i32.mul (get_local 1) (i32.const 1000))) + (local.set 1 (i32.mul (local.get 1) (i32.const 1000))) ) ) - (get_local 1) + (local.get 1) ) ) @@ -155,6 +405,72 @@ (assert_return (invoke "nested" (i32.const 0) (i32.const -1)) (i32.const 10)) (assert_return (invoke "nested" (i32.const -111) (i32.const -2)) (i32.const 9)) +(assert_return (invoke "as-select-first" (i32.const 0)) (i32.const 0)) +(assert_return (invoke "as-select-first" (i32.const 1)) (i32.const 1)) +(assert_return (invoke "as-select-mid" (i32.const 0)) (i32.const 2)) +(assert_return (invoke "as-select-mid" (i32.const 1)) (i32.const 2)) +(assert_return (invoke "as-select-last" (i32.const 0)) (i32.const 3)) +(assert_return (invoke "as-select-last" (i32.const 1)) (i32.const 2)) + +(assert_return (invoke "as-loop-first" (i32.const 0)) (i32.const 0)) +(assert_return (invoke "as-loop-first" (i32.const 1)) (i32.const 1)) +(assert_return (invoke "as-loop-mid" (i32.const 0)) (i32.const 0)) +(assert_return (invoke "as-loop-mid" (i32.const 1)) (i32.const 1)) +(assert_return (invoke "as-loop-last" (i32.const 0)) (i32.const 0)) +(assert_return (invoke "as-loop-last" (i32.const 1)) (i32.const 1)) + +(assert_return (invoke "as-if-condition" (i32.const 0)) (i32.const 3)) +(assert_return (invoke "as-if-condition" (i32.const 1)) (i32.const 2)) + +(assert_return (invoke "as-br_if-first" (i32.const 0)) (i32.const 0)) +(assert_return (invoke "as-br_if-first" (i32.const 1)) (i32.const 1)) +(assert_return (invoke "as-br_if-last" (i32.const 0)) (i32.const 3)) +(assert_return (invoke "as-br_if-last" (i32.const 1)) (i32.const 2)) + +(assert_return (invoke "as-br_table-first" (i32.const 0)) (i32.const 0)) +(assert_return (invoke "as-br_table-first" (i32.const 1)) (i32.const 1)) +(assert_return (invoke "as-br_table-last" (i32.const 0)) (i32.const 2)) +(assert_return (invoke "as-br_table-last" (i32.const 1)) (i32.const 2)) + +(assert_return (invoke "as-call_indirect-first" (i32.const 0)) (i32.const 0)) +(assert_return (invoke "as-call_indirect-first" (i32.const 1)) (i32.const 1)) +(assert_return (invoke "as-call_indirect-mid" (i32.const 0)) (i32.const 2)) +(assert_return (invoke "as-call_indirect-mid" (i32.const 1)) (i32.const 2)) +(assert_return (invoke "as-call_indirect-last" (i32.const 0)) (i32.const 2)) +(assert_trap (invoke "as-call_indirect-last" (i32.const 1)) "undefined element") + +(assert_return (invoke "as-store-first" (i32.const 0))) +(assert_return (invoke "as-store-first" (i32.const 1))) +(assert_return (invoke "as-store-last" (i32.const 0))) +(assert_return (invoke "as-store-last" (i32.const 1))) + +(assert_return (invoke "as-memory.grow-value" (i32.const 0)) (i32.const 1)) +(assert_return (invoke "as-memory.grow-value" (i32.const 1)) (i32.const 1)) + +(assert_return (invoke "as-call-value" (i32.const 0)) (i32.const 0)) +(assert_return (invoke "as-call-value" (i32.const 1)) (i32.const 1)) + +(assert_return (invoke "as-return-value" (i32.const 0)) (i32.const 0)) +(assert_return (invoke "as-return-value" (i32.const 1)) (i32.const 1)) + +(assert_return (invoke "as-drop-operand" (i32.const 0))) +(assert_return (invoke "as-drop-operand" (i32.const 1))) + +(assert_return (invoke "as-br-value" (i32.const 0)) (i32.const 0)) +(assert_return (invoke "as-br-value" (i32.const 1)) (i32.const 1)) + +(assert_return (invoke "as-local.set-value" (i32.const 0)) (i32.const 0)) +(assert_return (invoke "as-local.set-value" (i32.const 1)) (i32.const 1)) + +(assert_return (invoke "as-local.tee-value" (i32.const 0)) (i32.const 0)) +(assert_return (invoke "as-local.tee-value" (i32.const 1)) (i32.const 1)) + +(assert_return (invoke "as-global.set-value" (i32.const 0)) (i32.const 0)) +(assert_return (invoke "as-global.set-value" (i32.const 1)) (i32.const 1)) + +(assert_return (invoke "as-load-operand" (i32.const 0)) (i32.const 0)) +(assert_return (invoke "as-load-operand" (i32.const 1)) (i32.const 0)) + (assert_return (invoke "as-unary-operand" (i32.const 0)) (i32.const 0)) (assert_return (invoke "as-unary-operand" (i32.const 1)) (i32.const 0)) (assert_return (invoke "as-unary-operand" (i32.const -1)) (i32.const 0)) @@ -240,76 +556,76 @@ (assert_invalid (module (func $type-then-value-empty-vs-num (result i32) - (if i32 (i32.const 1) (then) (else (i32.const 0))) + (if (result i32) (i32.const 1) (then) (else (i32.const 0))) )) "type mismatch" ) (assert_invalid (module (func $type-then-value-empty-vs-num (result i32) - (if i32 (i32.const 1) (then (i32.const 0)) (else)) + (if (result i32) (i32.const 1) (then (i32.const 0)) (else)) )) "type mismatch" ) (assert_invalid (module (func $type-both-value-empty-vs-num (result i32) - (if i32 (i32.const 1) (then) (else)) + (if (result i32) (i32.const 1) (then) (else)) )) "type mismatch" ) (assert_invalid (module (func $type-no-else-vs-num (result i32) - (if i32 (i32.const 1) (then (i32.const 1))) + (if (result i32) (i32.const 1) (then (i32.const 1))) )) "type mismatch" ) (assert_invalid (module (func $type-then-value-void-vs-num (result i32) - (if i32 (i32.const 1) (then (nop)) (else (i32.const 0))) + (if (result i32) (i32.const 1) (then (nop)) (else (i32.const 0))) )) "type mismatch" ) (assert_invalid (module (func $type-then-value-void-vs-num (result i32) - (if i32 (i32.const 1) (then (i32.const 0)) (else (nop))) + (if (result i32) (i32.const 1) (then (i32.const 0)) (else (nop))) )) "type mismatch" ) (assert_invalid (module (func $type-both-value-void-vs-num (result i32) - (if i32 (i32.const 1) (then (nop)) (else (nop))) + (if (result i32) (i32.const 1) (then (nop)) (else (nop))) )) "type mismatch" ) (assert_invalid (module (func $type-then-value-num-vs-num (result i32) - (if i32 (i32.const 1) (then (i64.const 1)) (else (i32.const 1))) + (if (result i32) (i32.const 1) (then (i64.const 1)) (else (i32.const 1))) )) "type mismatch" ) (assert_invalid (module (func $type-then-value-num-vs-num (result i32) - (if i32 (i32.const 1) (then (i32.const 1)) (else (i64.const 1))) + (if (result i32) (i32.const 1) (then (i32.const 1)) (else (i64.const 1))) )) "type mismatch" ) (assert_invalid (module (func $type-both-value-num-vs-num (result i32) - (if i32 (i32.const 1) (then (i64.const 1)) (else (i64.const 1))) + (if (result i32) (i32.const 1) (then (i64.const 1)) (else (i64.const 1))) )) "type mismatch" ) (assert_invalid (module (func $type-both-different-value-num-vs-num (result i32) - (if i32 (i32.const 1) (then (i64.const 1)) (else (f64.const 1))) + (if (result i32) (i32.const 1) (then (i64.const 1)) (else (f64.const 1))) )) "type mismatch" ) (assert_invalid (module (func $type-then-value-unreached-select (result i32) - (if i64 + (if (result i64) (i32.const 0) (then (select (unreachable) (unreachable) (unreachable))) (else (i64.const 0)) @@ -319,7 +635,7 @@ ) (assert_invalid (module (func $type-else-value-unreached-select (result i32) - (if i64 + (if (result i64) (i32.const 1) (then (i64.const 0)) (else (select (unreachable) (unreachable) (unreachable))) @@ -329,7 +645,7 @@ ) (assert_invalid (module (func $type-else-value-unreached-select (result i32) - (if i64 + (if (result i64) (i32.const 1) (then (select (unreachable) (unreachable) (unreachable))) (else (select (unreachable) (unreachable) (unreachable))) @@ -340,50 +656,278 @@ (assert_invalid (module (func $type-then-break-last-void-vs-num (result i32) - (if i32 (i32.const 1) (then (br 0)) (else (i32.const 1))) + (if (result i32) (i32.const 1) (then (br 0)) (else (i32.const 1))) )) "type mismatch" ) (assert_invalid (module (func $type-else-break-last-void-vs-num (result i32) - (if i32 (i32.const 1) (then (i32.const 1)) (else (br 0))) + (if (result i32) (i32.const 1) (then (i32.const 1)) (else (br 0))) )) "type mismatch" ) (assert_invalid (module (func $type-then-break-empty-vs-num (result i32) - (if i32 (i32.const 1) (then (br 0) (i32.const 1)) (else (i32.const 1))) + (if (result i32) (i32.const 1) + (then (br 0) (i32.const 1)) + (else (i32.const 1)) + ) )) "type mismatch" ) (assert_invalid (module (func $type-else-break-empty-vs-num (result i32) - (if i32 (i32.const 1) (then (i32.const 1)) (else (br 0) (i32.const 1))) + (if (result i32) (i32.const 1) + (then (i32.const 1)) + (else (br 0) (i32.const 1)) + ) )) "type mismatch" ) (assert_invalid (module (func $type-then-break-void-vs-num (result i32) - (if i32 (i32.const 1) (then (br 0 (nop)) (i32.const 1)) (else (i32.const 1))) + (if (result i32) (i32.const 1) + (then (br 0 (nop)) (i32.const 1)) + (else (i32.const 1)) + ) )) "type mismatch" ) (assert_invalid (module (func $type-else-break-void-vs-num (result i32) - (if i32 (i32.const 1) (then (i32.const 1)) (else (br 0 (nop)) (i32.const 1))) + (if (result i32) (i32.const 1) + (then (i32.const 1)) + (else (br 0 (nop)) (i32.const 1)) + ) )) "type mismatch" ) (assert_invalid (module (func $type-then-break-num-vs-num (result i32) - (if i32 (i32.const 1) (then (br 0 (i64.const 1)) (i32.const 1)) (else (i32.const 1))) + (if (result i32) (i32.const 1) + (then (br 0 (i64.const 1)) (i32.const 1)) + (else (i32.const 1)) + ) )) "type mismatch" ) (assert_invalid (module (func $type-else-break-num-vs-num (result i32) - (if i32 (i32.const 1) (then (i32.const 1)) (else (br 0 (i64.const 1)) (i32.const 1))) + (if (result i32) (i32.const 1) + (then (i32.const 1)) + (else (br 0 (i64.const 1)) (i32.const 1)) + ) )) "type mismatch" ) + +(assert_invalid + (module + (func $type-condition-empty + (if (then)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-condition-empty-in-block + (i32.const 0) + (block (if (then))) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-condition-empty-in-loop + (i32.const 0) + (loop (if (then))) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-condition-empty-in-then + (i32.const 0) (i32.const 0) + (if (then (if (then)))) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-condition-empty-in-else + (i32.const 0) (i32.const 0) + (if (result i32) (then (i32.const 0)) (else (if (then)) (i32.const 0))) + (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-condition-empty-in-br + (i32.const 0) + (block (br 0 (if(then))) (drop)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-condition-empty-in-br_if + (i32.const 0) + (block (br_if 0 (if(then)) (i32.const 1)) (drop)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-condition-empty-in-br_table + (i32.const 0) + (block (br_table 0 (if(then))) (drop)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-condition-empty-in-return + (return (if(then))) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-condition-empty-in-select + (select (if(then)) (i32.const 1) (i32.const 2)) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-condition-empty-in-call + (call 1 (if(then))) (drop) + ) + (func (param i32) (result i32) (local.get 0)) + ) + "type mismatch" +) +(assert_invalid + (module + (func $f (param i32) (result i32) (local.get 0)) + (type $sig (func (param i32) (result i32))) + (table funcref (elem $f)) + (func $type-condition-empty-in-call_indirect + (block (result i32) + (call_indirect (type $sig) + (if(then)) (i32.const 0) + ) + (drop) + ) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-condition-empty-in-local.set + (local i32) + (local.set 0 (if(then))) (local.get 0) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-condition-empty-in-local.tee + (local i32) + (local.tee 0 (if(then))) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (global $x (mut i32) (i32.const 0)) + (func $type-condition-empty-in-global.set + (global.set $x (if(then))) (global.get $x) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 0) + (func $type-condition-empty-in-memory.grow + (memory.grow (if(then))) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 0) + (func $type-condition-empty-in-load + (i32.load (if(then))) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 1) + (func $type-condition-empty-in-store + (i32.store (if(then)) (i32.const 1)) + ) + ) + "type mismatch" +) + + +(assert_malformed + (module quote "(func i32.const 0 if end $l)") + "mismatching label" +) +(assert_malformed + (module quote "(func i32.const 0 if $a end $l)") + "mismatching label" +) +(assert_malformed + (module quote "(func i32.const 0 if else $l end)") + "mismatching label" +) +(assert_malformed + (module quote "(func i32.const 0 if $a else $l end)") + "mismatching label" +) +(assert_malformed + (module quote "(func i32.const 0 if else end $l)") + "mismatching label" +) +(assert_malformed + (module quote "(func i32.const 0 if else $l end $l)") + "mismatching label" +) +(assert_malformed + (module quote "(func i32.const 0 if else $l1 end $l2)") + "mismatching label" +) +(assert_malformed + (module quote "(func i32.const 0 if $a else end $l)") + "mismatching label" +) +(assert_malformed + (module quote "(func i32.const 0 if $a else $a end $l)") + "mismatching label" +) +(assert_malformed + (module quote "(func i32.const 0 if $a else $l end $l)") + "mismatching label" +) \ No newline at end of file diff --git a/test/core/import-after-func.fail.wast b/test/core/import-after-func.fail.wast deleted file mode 100644 index ece33a72..00000000 --- a/test/core/import-after-func.fail.wast +++ /dev/null @@ -1 +0,0 @@ -(module (func) (import "" "" (memory 0))) diff --git a/test/core/import-after-global.fail.wast b/test/core/import-after-global.fail.wast deleted file mode 100644 index 348ef270..00000000 --- a/test/core/import-after-global.fail.wast +++ /dev/null @@ -1 +0,0 @@ -(module (global i64 (i64.const 0)) (import "" "" (table 0 anyfunc))) diff --git a/test/core/import-after-memory.fail.wast b/test/core/import-after-memory.fail.wast deleted file mode 100644 index fbe582a9..00000000 --- a/test/core/import-after-memory.fail.wast +++ /dev/null @@ -1 +0,0 @@ -(module (memory 0) (import "" "" (global i32))) diff --git a/test/core/import-after-table.fail.wast b/test/core/import-after-table.fail.wast deleted file mode 100644 index bcd747a9..00000000 --- a/test/core/import-after-table.fail.wast +++ /dev/null @@ -1 +0,0 @@ -(module (table 0 anyfunc) (import "" "" (func))) diff --git a/test/core/imports.wast b/test/core/imports.wast index 81109594..0a396d1b 100644 --- a/test/core/imports.wast +++ b/test/core/imports.wast @@ -6,13 +6,14 @@ (func (export "func-f32") (param f32)) (func (export "func->i32") (result i32) (i32.const 22)) (func (export "func->f32") (result f32) (f32.const 11)) - (func (export "func-i32->i32") (param i32) (result i32) (get_local 0)) - (func (export "func-i64->i64") (param i64) (result i64) (get_local 0)) + (func (export "func-i32->i32") (param i32) (result i32) (local.get 0)) + (func (export "func-i64->i64") (param i64) (result i64) (local.get 0)) (global (export "global-i32") i32 (i32.const 55)) (global (export "global-f32") f32 (f32.const 44)) - (table (export "table-10-inf") 10 anyfunc) - ;; (table (export "table-10-20") 10 20 anyfunc) + (table (export "table-10-inf") 10 funcref) + (table (export "table-10-20") 10 20 funcref) (memory (export "memory-2-inf") 2) + ;; Multiple memories are not yet supported ;; (memory (export "memory-2-4") 2 4) ) @@ -27,56 +28,74 @@ (type $func_f32 (func (param f32))) (type $func_f64 (func (param f64))) - (import "spectest" "print" (func (param i32))) + (import "spectest" "print_i32" (func (param i32))) ;; JavaScript can't handle i64 yet. - ;; (func (import "spectest" "print") (param i64)) - (import "spectest" "print" (func $print_i32 (param i32))) + ;; (func (import "spectest" "print_i64") (param i64)) + (import "spectest" "print_i32" (func $print_i32 (param i32))) ;; JavaScript can't handle i64 yet. - ;; (import "spectest" "print" (func $print_i64 (param i64))) - (import "spectest" "print" (func $print_f32 (param f32))) - (import "spectest" "print" (func $print_f64 (param f64))) - (import "spectest" "print" (func $print_i32_f32 (param i32 f32))) - (import "spectest" "print" (func $print_f64_f64 (param f64 f64))) - (func $print_i32-2 (import "spectest" "print") (param i32)) - (func $print_f64-2 (import "spectest" "print") (param f64)) + ;; (import "spectest" "print_i64" (func $print_i64 (param i64))) + (import "spectest" "print_f32" (func $print_f32 (param f32))) + (import "spectest" "print_f64" (func $print_f64 (param f64))) + (import "spectest" "print_i32_f32" (func $print_i32_f32 (param i32 f32))) + (import "spectest" "print_f64_f64" (func $print_f64_f64 (param f64 f64))) + (func $print_i32-2 (import "spectest" "print_i32") (param i32)) + (func $print_f64-2 (import "spectest" "print_f64") (param f64)) (import "test" "func-i64->i64" (func $i64->i64 (param i64) (result i64))) - (table anyfunc (elem $print_i32 $print_f64)) + (func (export "p1") (import "spectest" "print_i32") (param i32)) + (func $p (export "p2") (import "spectest" "print_i32") (param i32)) + (func (export "p3") (export "p4") (import "spectest" "print_i32") (param i32)) + (func (export "p5") (import "spectest" "print_i32") (type 0)) + (func (export "p6") (import "spectest" "print_i32") (type 0) (param i32) (result)) + + (import "spectest" "print_i32" (func (type $forward))) + (func (import "spectest" "print_i32") (type $forward)) + (type $forward (func (param i32))) + + (table funcref (elem $print_i32 $print_f64)) (func (export "print32") (param $i i32) (local $x f32) - (set_local $x (f32.convert_s/i32 (get_local $i))) - (call 0 (get_local $i)) + (local.set $x (f32.convert_i32_s (local.get $i))) + (call 0 (local.get $i)) (call $print_i32_f32 - (i32.add (get_local $i) (i32.const 1)) + (i32.add (local.get $i) (i32.const 1)) (f32.const 42) ) - (call $print_i32 (get_local $i)) - (call $print_i32-2 (get_local $i)) - (call $print_f32 (get_local $x)) - (call_indirect $func_i32 (get_local $i) (i32.const 0)) + (call $print_i32 (local.get $i)) + (call $print_i32-2 (local.get $i)) + (call $print_f32 (local.get $x)) + (call_indirect (type $func_i32) (local.get $i) (i32.const 0)) ) (func (export "print64") (param $i i64) (local $x f64) - (set_local $x (f64.convert_s/i64 (call $i64->i64 (get_local $i)))) + (local.set $x (f64.convert_i64_s (call $i64->i64 (local.get $i)))) ;; JavaScript can't handle i64 yet. - ;; (call 1 (get_local $i)) + ;; (call 1 (local.get $i)) (call $print_f64_f64 - (f64.add (get_local $x) (f64.const 1)) + (f64.add (local.get $x) (f64.const 1)) (f64.const 53) ) ;; JavaScript can't handle i64 yet. - ;; (call $print_i64 (get_local $i)) - (call $print_f64 (get_local $x)) - (call $print_f64-2 (get_local $x)) - (call_indirect $func_f64 (get_local $x) (i32.const 1)) + ;; (call $print_i64 (local.get $i)) + (call $print_f64 (local.get $x)) + (call $print_f64-2 (local.get $x)) + (call_indirect (type $func_f64) (local.get $x) (i32.const 1)) ) ) (assert_return (invoke "print32" (i32.const 13))) (assert_return (invoke "print64" (i64.const 24))) +(assert_invalid + (module + (type (func (result i32))) + (import "test" "func" (func (type 1))) + ) + "unknown type" +) + (module (import "test" "func" (func))) (module (import "test" "func-i32" (func (param i32)))) (module (import "test" "func-f32" (func (param f32)))) @@ -96,113 +115,113 @@ (assert_unlinkable (module (import "test" "func" (func (param i32)))) - "type mismatch" + "incompatible import type" ) (assert_unlinkable (module (import "test" "func" (func (result i32)))) - "type mismatch" + "incompatible import type" ) (assert_unlinkable (module (import "test" "func" (func (param i32) (result i32)))) - "type mismatch" + "incompatible import type" ) (assert_unlinkable (module (import "test" "func-i32" (func))) - "type mismatch" + "incompatible import type" ) (assert_unlinkable (module (import "test" "func-i32" (func (result i32)))) - "type mismatch" + "incompatible import type" ) (assert_unlinkable (module (import "test" "func-i32" (func (param f32)))) - "type mismatch" + "incompatible import type" ) (assert_unlinkable (module (import "test" "func-i32" (func (param i64)))) - "type mismatch" + "incompatible import type" ) (assert_unlinkable (module (import "test" "func-i32" (func (param i32) (result i32)))) - "type mismatch" + "incompatible import type" ) (assert_unlinkable (module (import "test" "func->i32" (func))) - "type mismatch" + "incompatible import type" ) (assert_unlinkable (module (import "test" "func->i32" (func (param i32)))) - "type mismatch" + "incompatible import type" ) (assert_unlinkable (module (import "test" "func->i32" (func (result f32)))) - "type mismatch" + "incompatible import type" ) (assert_unlinkable (module (import "test" "func->i32" (func (result i64)))) - "type mismatch" + "incompatible import type" ) (assert_unlinkable (module (import "test" "func->i32" (func (param i32) (result i32)))) - "type mismatch" + "incompatible import type" ) (assert_unlinkable (module (import "test" "func-i32->i32" (func))) - "type mismatch" + "incompatible import type" ) (assert_unlinkable (module (import "test" "func-i32->i32" (func (param i32)))) - "type mismatch" + "incompatible import type" ) (assert_unlinkable (module (import "test" "func-i32->i32" (func (result i32)))) - "type mismatch" + "incompatible import type" ) (assert_unlinkable (module (import "test" "global-i32" (func (result i32)))) - "type mismatch" + "incompatible import type" ) (assert_unlinkable (module (import "test" "table-10-inf" (func))) - "type mismatch" + "incompatible import type" ) (assert_unlinkable (module (import "test" "memory-2-inf" (func))) - "type mismatch" + "incompatible import type" ) (assert_unlinkable - (module (import "spectest" "global" (func))) - "type mismatch" + (module (import "spectest" "global_i32" (func))) + "incompatible import type" ) (assert_unlinkable (module (import "spectest" "table" (func))) - "type mismatch" + "incompatible import type" ) (assert_unlinkable (module (import "spectest" "memory" (func))) - "type mismatch" + "incompatible import type" ) ;; Globals (module - (import "spectest" "global" (global i32)) - (global (import "spectest" "global") i32) + (import "spectest" "global_i32" (global i32)) + (global (import "spectest" "global_i32") i32) - (import "spectest" "global" (global $x i32)) - (global $y (import "spectest" "global") i32) + (import "spectest" "global_i32" (global $x i32)) + (global $y (import "spectest" "global_i32") i32) ;; JavaScript can't handle i64 yet. - ;; (import "spectest" "global" (global i64)) - (import "spectest" "global" (global f32)) - (import "spectest" "global" (global f64)) + ;; (import "spectest" "global_i64" (global i64)) + (import "spectest" "global_f32" (global f32)) + (import "spectest" "global_f64" (global f64)) - (func (export "get-0") (result i32) (get_global 0)) - (func (export "get-1") (result i32) (get_global 1)) - (func (export "get-x") (result i32) (get_global $x)) - (func (export "get-y") (result i32) (get_global $y)) + (func (export "get-0") (result i32) (global.get 0)) + (func (export "get-1") (result i32) (global.get 1)) + (func (export "get-x") (result i32) (global.get $x)) + (func (export "get-y") (result i32) (global.get $y)) ) (assert_return (invoke "get-0") (i32.const 666)) @@ -224,27 +243,27 @@ (assert_unlinkable (module (import "test" "func" (global i32))) - "type mismatch" + "incompatible import type" ) (assert_unlinkable (module (import "test" "table-10-inf" (global i32))) - "type mismatch" + "incompatible import type" ) (assert_unlinkable (module (import "test" "memory-2-inf" (global i32))) - "type mismatch" + "incompatible import type" ) (assert_unlinkable - (module (import "spectest" "print" (global i32))) - "type mismatch" + (module (import "spectest" "print_i32" (global i32))) + "incompatible import type" ) (assert_unlinkable (module (import "spectest" "table" (global i32))) - "type mismatch" + "incompatible import type" ) (assert_unlinkable (module (import "spectest" "memory" (global i32))) - "type mismatch" + "incompatible import type" ) @@ -252,10 +271,12 @@ (module (type (func (result i32))) - (import "spectest" "table" (table 10 20 anyfunc)) - (elem 0 (i32.const 1) $f $g) + (import "spectest" "table" (table $tab 10 20 funcref)) + (elem $tab (i32.const 1) $f $g) - (func (export "call") (param i32) (result i32) (call_indirect 0 (get_local 0))) + (func (export "call") (param i32) (result i32) + (call_indirect $tab (type 0) (local.get 0)) + ) (func $f (result i32) (i32.const 11)) (func $g (result i32) (i32.const 22)) ) @@ -269,10 +290,12 @@ (module (type (func (result i32))) - (table (import "spectest" "table") 10 20 anyfunc) - (elem 0 (i32.const 1) $f $g) + (table $tab (import "spectest" "table") 10 20 funcref) + (elem $tab (i32.const 1) $f $g) - (func (export "call") (param i32) (result i32) (call_indirect 0 (get_local 0))) + (func (export "call") (param i32) (result i32) + (call_indirect $tab (type 0) (local.get 0)) + ) (func $f (result i32) (i32.const 11)) (func $g (result i32) (i32.const 22)) ) @@ -284,72 +307,83 @@ (assert_trap (invoke "call" (i32.const 100)) "undefined element") -(assert_invalid - (module (import "" "" (table 10 anyfunc)) (import "" "" (table 10 anyfunc))) - "multiple tables" -) -(assert_invalid - (module (import "" "" (table 10 anyfunc)) (table 10 anyfunc)) - "multiple tables" +(module + (import "spectest" "table" (table 0 funcref)) + (import "spectest" "table" (table 0 funcref)) + (table 10 funcref) + (table 10 funcref) +) + +(module (import "test" "table-10-inf" (table 10 funcref))) +(module (import "test" "table-10-inf" (table 5 funcref))) +(module (import "test" "table-10-inf" (table 0 funcref))) +(module (import "test" "table-10-20" (table 10 funcref))) +(module (import "test" "table-10-20" (table 5 funcref))) +(module (import "test" "table-10-20" (table 0 funcref))) +(module (import "test" "table-10-20" (table 10 20 funcref))) +(module (import "test" "table-10-20" (table 5 20 funcref))) +(module (import "test" "table-10-20" (table 0 20 funcref))) +(module (import "test" "table-10-20" (table 10 25 funcref))) +(module (import "test" "table-10-20" (table 5 25 funcref))) +(module (import "test" "table-10-20" (table 0 25 funcref))) +(module (import "spectest" "table" (table 10 funcref))) +(module (import "spectest" "table" (table 5 funcref))) +(module (import "spectest" "table" (table 0 funcref))) +(module (import "spectest" "table" (table 10 20 funcref))) +(module (import "spectest" "table" (table 5 20 funcref))) +(module (import "spectest" "table" (table 0 20 funcref))) +(module (import "spectest" "table" (table 10 25 funcref))) +(module (import "spectest" "table" (table 5 25 funcref))) + +(assert_unlinkable + (module (import "test" "unknown" (table 10 funcref))) + "unknown import" ) -(assert_invalid - (module (table 10 anyfunc) (table 10 anyfunc)) - "multiple tables" +(assert_unlinkable + (module (import "spectest" "unknown" (table 10 funcref))) + "unknown import" ) -(module (import "test" "table-10-inf" (table 10 anyfunc))) -(module (import "test" "table-10-inf" (table 5 anyfunc))) -(module (import "test" "table-10-inf" (table 0 anyfunc))) -(module (import "spectest" "table" (table 10 anyfunc))) -(module (import "spectest" "table" (table 5 anyfunc))) -(module (import "spectest" "table" (table 0 anyfunc))) -(module (import "spectest" "table" (table 10 20 anyfunc))) -(module (import "spectest" "table" (table 5 20 anyfunc))) -(module (import "spectest" "table" (table 0 20 anyfunc))) -(module (import "spectest" "table" (table 10 25 anyfunc))) -(module (import "spectest" "table" (table 5 25 anyfunc))) - (assert_unlinkable - (module (import "test" "unknown" (table 10 anyfunc))) - "unknown import" + (module (import "test" "table-10-inf" (table 12 funcref))) + "incompatible import type" ) (assert_unlinkable - (module (import "spectest" "unknown" (table 10 anyfunc))) - "unknown import" + (module (import "test" "table-10-inf" (table 10 20 funcref))) + "incompatible import type" ) - (assert_unlinkable - (module (import "test" "table-10-inf" (table 12 anyfunc))) - "actual size smaller than declared" + (module (import "test" "table-10-20" (table 12 20 funcref))) + "incompatible import type" ) (assert_unlinkable - (module (import "test" "table-10-inf" (table 10 20 anyfunc))) - "maximum size larger than declared" + (module (import "test" "table-10-20" (table 10 18 funcref))) + "incompatible import type" ) (assert_unlinkable - (module (import "spectest" "table" (table 12 anyfunc))) - "actual size smaller than declared" + (module (import "spectest" "table" (table 12 funcref))) + "incompatible import type" ) (assert_unlinkable - (module (import "spectest" "table" (table 10 15 anyfunc))) - "maximum size larger than declared" + (module (import "spectest" "table" (table 10 15 funcref))) + "incompatible import type" ) (assert_unlinkable - (module (import "test" "func" (table 10 anyfunc))) - "type mismatch" + (module (import "test" "func" (table 10 funcref))) + "incompatible import type" ) (assert_unlinkable - (module (import "test" "global-i32" (table 10 anyfunc))) - "type mismatch" + (module (import "test" "global-i32" (table 10 funcref))) + "incompatible import type" ) (assert_unlinkable - (module (import "test" "memory-2-inf" (table 10 anyfunc))) - "type mismatch" + (module (import "test" "memory-2-inf" (table 10 funcref))) + "incompatible import type" ) (assert_unlinkable - (module (import "spectest" "print" (table 10 anyfunc))) - "type mismatch" + (module (import "spectest" "print_i32" (table 10 funcref))) + "incompatible import type" ) @@ -360,7 +394,7 @@ (import "spectest" "memory" (memory 1 2)) (data 0 (i32.const 10) "\10") - (func (export "load") (param i32) (result i32) (i32.load (get_local 0))) + (func (export "load") (param i32) (result i32) (i32.load (local.get 0))) ) (assert_return (invoke "load" (i32.const 0)) (i32.const 0)) @@ -372,7 +406,7 @@ (memory (import "spectest" "memory") 1 2) (data 0 (i32.const 10) "\10") - (func (export "load") (param i32) (result i32) (i32.load (get_local 0))) + (func (export "load") (param i32) (result i32) (i32.load (local.get 0))) ) (assert_return (invoke "load" (i32.const 0)) (i32.const 0)) (assert_return (invoke "load" (i32.const 10)) (i32.const 16)) @@ -413,61 +447,159 @@ (assert_unlinkable (module (import "test" "memory-2-inf" (memory 3))) - "actual size smaller than declared" + "incompatible import type" ) (assert_unlinkable (module (import "test" "memory-2-inf" (memory 2 3))) - "maximum size larger than declared" + "incompatible import type" ) (assert_unlinkable (module (import "spectest" "memory" (memory 2))) - "actual size smaller than declared" + "incompatible import type" ) (assert_unlinkable (module (import "spectest" "memory" (memory 1 1))) - "maximum size larger than declared" + "incompatible import type" ) (assert_unlinkable (module (import "test" "func-i32" (memory 1))) - "type mismatch" + "incompatible import type" ) (assert_unlinkable (module (import "test" "global-i32" (memory 1))) - "type mismatch" + "incompatible import type" ) (assert_unlinkable (module (import "test" "table-10-inf" (memory 1))) - "type mismatch" + "incompatible import type" ) (assert_unlinkable - (module (import "spectest" "print" (memory 1))) - "type mismatch" + (module (import "spectest" "print_i32" (memory 1))) + "incompatible import type" ) (assert_unlinkable - (module (import "spectest" "global" (memory 1))) - "type mismatch" + (module (import "spectest" "global_i32" (memory 1))) + "incompatible import type" ) (assert_unlinkable (module (import "spectest" "table" (memory 1))) - "type mismatch" + "incompatible import type" ) (assert_unlinkable (module (import "spectest" "memory" (memory 2))) - "actual size smaller than declared" + "incompatible import type" ) (assert_unlinkable (module (import "spectest" "memory" (memory 1 1))) - "maximum size larger than declared" + "incompatible import type" ) (module (import "spectest" "memory" (memory 0 3)) ;; actual has max size 2 - (func (export "grow") (param i32) (result i32) (grow_memory (get_local 0))) + (func (export "grow") (param i32) (result i32) (memory.grow (local.get 0))) ) (assert_return (invoke "grow" (i32.const 0)) (i32.const 1)) (assert_return (invoke "grow" (i32.const 1)) (i32.const 1)) (assert_return (invoke "grow" (i32.const 0)) (i32.const 2)) (assert_return (invoke "grow" (i32.const 1)) (i32.const -1)) (assert_return (invoke "grow" (i32.const 0)) (i32.const 2)) + + +;; Syntax errors + +(assert_malformed + (module quote "(func) (import \"\" \"\" (func))") + "import after function" +) +(assert_malformed + (module quote "(func) (import \"\" \"\" (global i64))") + "import after function" +) +(assert_malformed + (module quote "(func) (import \"\" \"\" (table 0 funcref))") + "import after function" +) +(assert_malformed + (module quote "(func) (import \"\" \"\" (memory 0))") + "import after function" +) + +(assert_malformed + (module quote "(global i64 (i64.const 0)) (import \"\" \"\" (func))") + "import after global" +) +(assert_malformed + (module quote "(global i64 (i64.const 0)) (import \"\" \"\" (global f32))") + "import after global" +) +(assert_malformed + (module quote "(global i64 (i64.const 0)) (import \"\" \"\" (table 0 funcref))") + "import after global" +) +(assert_malformed + (module quote "(global i64 (i64.const 0)) (import \"\" \"\" (memory 0))") + "import after global" +) + +(assert_malformed + (module quote "(table 0 funcref) (import \"\" \"\" (func))") + "import after table" +) +(assert_malformed + (module quote "(table 0 funcref) (import \"\" \"\" (global i32))") + "import after table" +) +(assert_malformed + (module quote "(table 0 funcref) (import \"\" \"\" (table 0 funcref))") + "import after table" +) +(assert_malformed + (module quote "(table 0 funcref) (import \"\" \"\" (memory 0))") + "import after table" +) + +(assert_malformed + (module quote "(memory 0) (import \"\" \"\" (func))") + "import after memory" +) +(assert_malformed + (module quote "(memory 0) (import \"\" \"\" (global i32))") + "import after memory" +) +(assert_malformed + (module quote "(memory 0) (import \"\" \"\" (table 1 3 funcref))") + "import after memory" +) +(assert_malformed + (module quote "(memory 0) (import \"\" \"\" (memory 1 2))") + "import after memory" +) + +;; This module is required to validate, regardless of whether it can be +;; linked. Overloading is not possible in wasm itself, but it is possible +;; in modules from which wasm can import. +(module) +(register "not wasm") +(assert_unlinkable + (module + (import "not wasm" "overloaded" (func)) + (import "not wasm" "overloaded" (func (param i32))) + (import "not wasm" "overloaded" (func (param i32 i32))) + (import "not wasm" "overloaded" (func (param i64))) + (import "not wasm" "overloaded" (func (param f32))) + (import "not wasm" "overloaded" (func (param f64))) + (import "not wasm" "overloaded" (func (result i32))) + (import "not wasm" "overloaded" (func (result i64))) + (import "not wasm" "overloaded" (func (result f32))) + (import "not wasm" "overloaded" (func (result f64))) + (import "not wasm" "overloaded" (global i32)) + (import "not wasm" "overloaded" (global i64)) + (import "not wasm" "overloaded" (global f32)) + (import "not wasm" "overloaded" (global f64)) + (import "not wasm" "overloaded" (table 0 funcref)) + (import "not wasm" "overloaded" (memory 0)) + ) + "unknown import" +) diff --git a/test/core/inline-module.wast b/test/core/inline-module.wast new file mode 100644 index 00000000..dc7ead77 --- /dev/null +++ b/test/core/inline-module.wast @@ -0,0 +1 @@ +(func) (memory 0) (func (export "f")) diff --git a/test/core/int_exprs.wast b/test/core/int_exprs.wast index 99396a8b..22e1fbcb 100644 --- a/test/core/int_exprs.wast +++ b/test/core/int_exprs.wast @@ -5,14 +5,14 @@ (module (func (export "i32.no_fold_cmp_s_offset") (param $x i32) (param $y i32) (result i32) - (i32.lt_s (i32.add (get_local $x) (i32.const 1)) (i32.add (get_local $y) (i32.const 1)))) + (i32.lt_s (i32.add (local.get $x) (i32.const 1)) (i32.add (local.get $y) (i32.const 1)))) (func (export "i32.no_fold_cmp_u_offset") (param $x i32) (param $y i32) (result i32) - (i32.lt_u (i32.add (get_local $x) (i32.const 1)) (i32.add (get_local $y) (i32.const 1)))) + (i32.lt_u (i32.add (local.get $x) (i32.const 1)) (i32.add (local.get $y) (i32.const 1)))) (func (export "i64.no_fold_cmp_s_offset") (param $x i64) (param $y i64) (result i32) - (i64.lt_s (i64.add (get_local $x) (i64.const 1)) (i64.add (get_local $y) (i64.const 1)))) + (i64.lt_s (i64.add (local.get $x) (i64.const 1)) (i64.add (local.get $y) (i64.const 1)))) (func (export "i64.no_fold_cmp_u_offset") (param $x i64) (param $y i64) (result i32) - (i64.lt_u (i64.add (get_local $x) (i64.const 1)) (i64.add (get_local $y) (i64.const 1)))) + (i64.lt_u (i64.add (local.get $x) (i64.const 1)) (i64.add (local.get $y) (i64.const 1)))) ) (assert_return (invoke "i32.no_fold_cmp_s_offset" (i32.const 0x7fffffff) (i32.const 0)) (i32.const 1)) @@ -24,7 +24,7 @@ (module (func (export "i64.no_fold_wrap_extend_s") (param $x i64) (result i64) - (i64.extend_s/i32 (i32.wrap/i64 (get_local $x)))) + (i64.extend_i32_s (i32.wrap_i64 (local.get $x)))) ) (assert_return (invoke "i64.no_fold_wrap_extend_s" (i64.const 0x0010203040506070)) (i64.const 0x0000000040506070)) @@ -34,7 +34,7 @@ (module (func (export "i64.no_fold_wrap_extend_u") (param $x i64) (result i64) - (i64.extend_u/i32 (i32.wrap/i64 (get_local $x)))) + (i64.extend_i32_u (i32.wrap_i64 (local.get $x)))) ) (assert_return (invoke "i64.no_fold_wrap_extend_u" (i64.const 0x0010203040506070)) (i64.const 0x0000000040506070)) @@ -43,14 +43,14 @@ (module (func (export "i32.no_fold_shl_shr_s") (param $x i32) (result i32) - (i32.shr_s (i32.shl (get_local $x) (i32.const 1)) (i32.const 1))) + (i32.shr_s (i32.shl (local.get $x) (i32.const 1)) (i32.const 1))) (func (export "i32.no_fold_shl_shr_u") (param $x i32) (result i32) - (i32.shr_u (i32.shl (get_local $x) (i32.const 1)) (i32.const 1))) + (i32.shr_u (i32.shl (local.get $x) (i32.const 1)) (i32.const 1))) (func (export "i64.no_fold_shl_shr_s") (param $x i64) (result i64) - (i64.shr_s (i64.shl (get_local $x) (i64.const 1)) (i64.const 1))) + (i64.shr_s (i64.shl (local.get $x) (i64.const 1)) (i64.const 1))) (func (export "i64.no_fold_shl_shr_u") (param $x i64) (result i64) - (i64.shr_u (i64.shl (get_local $x) (i64.const 1)) (i64.const 1))) + (i64.shr_u (i64.shl (local.get $x) (i64.const 1)) (i64.const 1))) ) (assert_return (invoke "i32.no_fold_shl_shr_s" (i32.const 0x80000000)) (i32.const 0)) @@ -62,14 +62,14 @@ (module (func (export "i32.no_fold_shr_s_shl") (param $x i32) (result i32) - (i32.shl (i32.shr_s (get_local $x) (i32.const 1)) (i32.const 1))) + (i32.shl (i32.shr_s (local.get $x) (i32.const 1)) (i32.const 1))) (func (export "i32.no_fold_shr_u_shl") (param $x i32) (result i32) - (i32.shl (i32.shr_u (get_local $x) (i32.const 1)) (i32.const 1))) + (i32.shl (i32.shr_u (local.get $x) (i32.const 1)) (i32.const 1))) (func (export "i64.no_fold_shr_s_shl") (param $x i64) (result i64) - (i64.shl (i64.shr_s (get_local $x) (i64.const 1)) (i64.const 1))) + (i64.shl (i64.shr_s (local.get $x) (i64.const 1)) (i64.const 1))) (func (export "i64.no_fold_shr_u_shl") (param $x i64) (result i64) - (i64.shl (i64.shr_u (get_local $x) (i64.const 1)) (i64.const 1))) + (i64.shl (i64.shr_u (local.get $x) (i64.const 1)) (i64.const 1))) ) (assert_return (invoke "i32.no_fold_shr_s_shl" (i32.const 1)) (i32.const 0)) @@ -81,14 +81,14 @@ (module (func (export "i32.no_fold_div_s_mul") (param $x i32) (result i32) - (i32.mul (i32.div_s (get_local $x) (i32.const 6)) (i32.const 6))) + (i32.mul (i32.div_s (local.get $x) (i32.const 6)) (i32.const 6))) (func (export "i32.no_fold_div_u_mul") (param $x i32) (result i32) - (i32.mul (i32.div_u (get_local $x) (i32.const 6)) (i32.const 6))) + (i32.mul (i32.div_u (local.get $x) (i32.const 6)) (i32.const 6))) (func (export "i64.no_fold_div_s_mul") (param $x i64) (result i64) - (i64.mul (i64.div_s (get_local $x) (i64.const 6)) (i64.const 6))) + (i64.mul (i64.div_s (local.get $x) (i64.const 6)) (i64.const 6))) (func (export "i64.no_fold_div_u_mul") (param $x i64) (result i64) - (i64.mul (i64.div_u (get_local $x) (i64.const 6)) (i64.const 6))) + (i64.mul (i64.div_u (local.get $x) (i64.const 6)) (i64.const 6))) ) (assert_return (invoke "i32.no_fold_div_s_mul" (i32.const 1)) (i32.const 0)) @@ -100,14 +100,14 @@ (module (func (export "i32.no_fold_div_s_self") (param $x i32) (result i32) - (i32.div_s (get_local $x) (get_local $x))) + (i32.div_s (local.get $x) (local.get $x))) (func (export "i32.no_fold_div_u_self") (param $x i32) (result i32) - (i32.div_u (get_local $x) (get_local $x))) + (i32.div_u (local.get $x) (local.get $x))) (func (export "i64.no_fold_div_s_self") (param $x i64) (result i64) - (i64.div_s (get_local $x) (get_local $x))) + (i64.div_s (local.get $x) (local.get $x))) (func (export "i64.no_fold_div_u_self") (param $x i64) (result i64) - (i64.div_u (get_local $x) (get_local $x))) + (i64.div_u (local.get $x) (local.get $x))) ) (assert_trap (invoke "i32.no_fold_div_s_self" (i32.const 0)) "integer divide by zero") @@ -119,14 +119,14 @@ (module (func (export "i32.no_fold_rem_s_self") (param $x i32) (result i32) - (i32.rem_s (get_local $x) (get_local $x))) + (i32.rem_s (local.get $x) (local.get $x))) (func (export "i32.no_fold_rem_u_self") (param $x i32) (result i32) - (i32.rem_u (get_local $x) (get_local $x))) + (i32.rem_u (local.get $x) (local.get $x))) (func (export "i64.no_fold_rem_s_self") (param $x i64) (result i64) - (i64.rem_s (get_local $x) (get_local $x))) + (i64.rem_s (local.get $x) (local.get $x))) (func (export "i64.no_fold_rem_u_self") (param $x i64) (result i64) - (i64.rem_u (get_local $x) (get_local $x))) + (i64.rem_u (local.get $x) (local.get $x))) ) (assert_trap (invoke "i32.no_fold_rem_s_self" (i32.const 0)) "integer divide by zero") @@ -138,14 +138,14 @@ (module (func (export "i32.no_fold_mul_div_s") (param $x i32) (result i32) - (i32.div_s (i32.mul (get_local $x) (i32.const 6)) (i32.const 6))) + (i32.div_s (i32.mul (local.get $x) (i32.const 6)) (i32.const 6))) (func (export "i32.no_fold_mul_div_u") (param $x i32) (result i32) - (i32.div_u (i32.mul (get_local $x) (i32.const 6)) (i32.const 6))) + (i32.div_u (i32.mul (local.get $x) (i32.const 6)) (i32.const 6))) (func (export "i64.no_fold_mul_div_s") (param $x i64) (result i64) - (i64.div_s (i64.mul (get_local $x) (i64.const 6)) (i64.const 6))) + (i64.div_s (i64.mul (local.get $x) (i64.const 6)) (i64.const 6))) (func (export "i64.no_fold_mul_div_u") (param $x i64) (result i64) - (i64.div_u (i64.mul (get_local $x) (i64.const 6)) (i64.const 6))) + (i64.div_u (i64.mul (local.get $x) (i64.const 6)) (i64.const 6))) ) (assert_return (invoke "i32.no_fold_mul_div_s" (i32.const 0x80000000)) (i32.const 0)) @@ -157,10 +157,10 @@ (module (func (export "i32.no_fold_div_s_2") (param $x i32) (result i32) - (i32.div_s (get_local $x) (i32.const 2))) + (i32.div_s (local.get $x) (i32.const 2))) (func (export "i64.no_fold_div_s_2") (param $x i64) (result i64) - (i64.div_s (get_local $x) (i64.const 2))) + (i64.div_s (local.get $x) (i64.const 2))) ) (assert_return (invoke "i32.no_fold_div_s_2" (i32.const -11)) (i32.const -5)) @@ -170,10 +170,10 @@ (module (func (export "i32.no_fold_rem_s_2") (param $x i32) (result i32) - (i32.rem_s (get_local $x) (i32.const 2))) + (i32.rem_s (local.get $x) (i32.const 2))) (func (export "i64.no_fold_rem_s_2") (param $x i64) (result i64) - (i64.rem_s (get_local $x) (i64.const 2))) + (i64.rem_s (local.get $x) (i64.const 2))) ) (assert_return (invoke "i32.no_fold_rem_s_2" (i32.const -11)) (i32.const -1)) @@ -183,14 +183,14 @@ (module (func (export "i32.div_s_0") (param $x i32) (result i32) - (i32.div_s (get_local $x) (i32.const 0))) + (i32.div_s (local.get $x) (i32.const 0))) (func (export "i32.div_u_0") (param $x i32) (result i32) - (i32.div_u (get_local $x) (i32.const 0))) + (i32.div_u (local.get $x) (i32.const 0))) (func (export "i64.div_s_0") (param $x i64) (result i64) - (i64.div_s (get_local $x) (i64.const 0))) + (i64.div_s (local.get $x) (i64.const 0))) (func (export "i64.div_u_0") (param $x i64) (result i64) - (i64.div_u (get_local $x) (i64.const 0))) + (i64.div_u (local.get $x) (i64.const 0))) ) (assert_trap (invoke "i32.div_s_0" (i32.const 71)) "integer divide by zero") @@ -202,14 +202,14 @@ (module (func (export "i32.div_s_3") (param $x i32) (result i32) - (i32.div_s (get_local $x) (i32.const 3))) + (i32.div_s (local.get $x) (i32.const 3))) (func (export "i32.div_u_3") (param $x i32) (result i32) - (i32.div_u (get_local $x) (i32.const 3))) + (i32.div_u (local.get $x) (i32.const 3))) (func (export "i64.div_s_3") (param $x i64) (result i64) - (i64.div_s (get_local $x) (i64.const 3))) + (i64.div_s (local.get $x) (i64.const 3))) (func (export "i64.div_u_3") (param $x i64) (result i64) - (i64.div_u (get_local $x) (i64.const 3))) + (i64.div_u (local.get $x) (i64.const 3))) ) (assert_return (invoke "i32.div_s_3" (i32.const 71)) (i32.const 23)) @@ -225,14 +225,14 @@ (module (func (export "i32.div_s_5") (param $x i32) (result i32) - (i32.div_s (get_local $x) (i32.const 5))) + (i32.div_s (local.get $x) (i32.const 5))) (func (export "i32.div_u_5") (param $x i32) (result i32) - (i32.div_u (get_local $x) (i32.const 5))) + (i32.div_u (local.get $x) (i32.const 5))) (func (export "i64.div_s_5") (param $x i64) (result i64) - (i64.div_s (get_local $x) (i64.const 5))) + (i64.div_s (local.get $x) (i64.const 5))) (func (export "i64.div_u_5") (param $x i64) (result i64) - (i64.div_u (get_local $x) (i64.const 5))) + (i64.div_u (local.get $x) (i64.const 5))) ) (assert_return (invoke "i32.div_s_5" (i32.const 71)) (i32.const 14)) @@ -248,14 +248,14 @@ (module (func (export "i32.div_s_7") (param $x i32) (result i32) - (i32.div_s (get_local $x) (i32.const 7))) + (i32.div_s (local.get $x) (i32.const 7))) (func (export "i32.div_u_7") (param $x i32) (result i32) - (i32.div_u (get_local $x) (i32.const 7))) + (i32.div_u (local.get $x) (i32.const 7))) (func (export "i64.div_s_7") (param $x i64) (result i64) - (i64.div_s (get_local $x) (i64.const 7))) + (i64.div_s (local.get $x) (i64.const 7))) (func (export "i64.div_u_7") (param $x i64) (result i64) - (i64.div_u (get_local $x) (i64.const 7))) + (i64.div_u (local.get $x) (i64.const 7))) ) (assert_return (invoke "i32.div_s_7" (i32.const 71)) (i32.const 10)) @@ -271,14 +271,14 @@ (module (func (export "i32.rem_s_3") (param $x i32) (result i32) - (i32.rem_s (get_local $x) (i32.const 3))) + (i32.rem_s (local.get $x) (i32.const 3))) (func (export "i32.rem_u_3") (param $x i32) (result i32) - (i32.rem_u (get_local $x) (i32.const 3))) + (i32.rem_u (local.get $x) (i32.const 3))) (func (export "i64.rem_s_3") (param $x i64) (result i64) - (i64.rem_s (get_local $x) (i64.const 3))) + (i64.rem_s (local.get $x) (i64.const 3))) (func (export "i64.rem_u_3") (param $x i64) (result i64) - (i64.rem_u (get_local $x) (i64.const 3))) + (i64.rem_u (local.get $x) (i64.const 3))) ) (assert_return (invoke "i32.rem_s_3" (i32.const 71)) (i32.const 2)) @@ -294,14 +294,14 @@ (module (func (export "i32.rem_s_5") (param $x i32) (result i32) - (i32.rem_s (get_local $x) (i32.const 5))) + (i32.rem_s (local.get $x) (i32.const 5))) (func (export "i32.rem_u_5") (param $x i32) (result i32) - (i32.rem_u (get_local $x) (i32.const 5))) + (i32.rem_u (local.get $x) (i32.const 5))) (func (export "i64.rem_s_5") (param $x i64) (result i64) - (i64.rem_s (get_local $x) (i64.const 5))) + (i64.rem_s (local.get $x) (i64.const 5))) (func (export "i64.rem_u_5") (param $x i64) (result i64) - (i64.rem_u (get_local $x) (i64.const 5))) + (i64.rem_u (local.get $x) (i64.const 5))) ) (assert_return (invoke "i32.rem_s_5" (i32.const 71)) (i32.const 1)) @@ -317,14 +317,14 @@ (module (func (export "i32.rem_s_7") (param $x i32) (result i32) - (i32.rem_s (get_local $x) (i32.const 7))) + (i32.rem_s (local.get $x) (i32.const 7))) (func (export "i32.rem_u_7") (param $x i32) (result i32) - (i32.rem_u (get_local $x) (i32.const 7))) + (i32.rem_u (local.get $x) (i32.const 7))) (func (export "i64.rem_s_7") (param $x i64) (result i64) - (i64.rem_s (get_local $x) (i64.const 7))) + (i64.rem_s (local.get $x) (i64.const 7))) (func (export "i64.rem_u_7") (param $x i64) (result i64) - (i64.rem_u (get_local $x) (i64.const 7))) + (i64.rem_u (local.get $x) (i64.const 7))) ) (assert_return (invoke "i32.rem_s_7" (i32.const 71)) (i32.const 1)) @@ -340,10 +340,10 @@ (module (func (export "i32.no_fold_div_neg1") (param $x i32) (result i32) - (i32.div_s (get_local $x) (i32.const -1))) + (i32.div_s (local.get $x) (i32.const -1))) (func (export "i64.no_fold_div_neg1") (param $x i64) (result i64) - (i64.div_s (get_local $x) (i64.const -1))) + (i64.div_s (local.get $x) (i64.const -1))) ) (assert_trap (invoke "i32.no_fold_div_neg1" (i32.const 0x80000000)) "integer overflow") diff --git a/test/core/int_literals.wast b/test/core/int_literals.wast index f0ec0417..73b37cc5 100644 --- a/test/core/int_literals.wast +++ b/test/core/int_literals.wast @@ -22,6 +22,16 @@ (func (export "i64.not_octal") (result i64) (return (i64.const 010))) (func (export "i64.unsigned_decimal") (result i64) (return (i64.const 18446744073709551615))) (func (export "i64.plus_sign") (result i64) (return (i64.const +42))) + + (func (export "i32-dec-sep1") (result i32) (i32.const 1_000_000)) + (func (export "i32-dec-sep2") (result i32) (i32.const 1_0_0_0)) + (func (export "i32-hex-sep1") (result i32) (i32.const 0xa_0f_00_99)) + (func (export "i32-hex-sep2") (result i32) (i32.const 0x1_a_A_0_f)) + + (func (export "i64-dec-sep1") (result i64) (i64.const 1_000_000)) + (func (export "i64-dec-sep2") (result i64) (i64.const 1_0_0_0)) + (func (export "i64-hex-sep1") (result i64) (i64.const 0xa_f00f_0000_9999)) + (func (export "i64-hex-sep2") (result i64) (i64.const 0x1_a_A_0_f)) ) (assert_return (invoke "i32.test") (i32.const 195940365)) @@ -47,3 +57,95 @@ (assert_return (invoke "i64.not_octal") (i64.const 10)) (assert_return (invoke "i64.unsigned_decimal") (i64.const -1)) (assert_return (invoke "i64.plus_sign") (i64.const 42)) + +(assert_return (invoke "i32-dec-sep1") (i32.const 1000000)) +(assert_return (invoke "i32-dec-sep2") (i32.const 1000)) +(assert_return (invoke "i32-hex-sep1") (i32.const 0xa0f0099)) +(assert_return (invoke "i32-hex-sep2") (i32.const 0x1aa0f)) + +(assert_return (invoke "i64-dec-sep1") (i64.const 1000000)) +(assert_return (invoke "i64-dec-sep2") (i64.const 1000)) +(assert_return (invoke "i64-hex-sep1") (i64.const 0xaf00f00009999)) +(assert_return (invoke "i64-hex-sep2") (i64.const 0x1aa0f)) + +(assert_malformed + (module quote "(global i32 (i32.const _100))") + "unknown operator" +) +(assert_malformed + (module quote "(global i32 (i32.const +_100))") + "unknown operator" +) +(assert_malformed + (module quote "(global i32 (i32.const -_100))") + "unknown operator" +) +(assert_malformed + (module quote "(global i32 (i32.const 99_))") + "unknown operator" +) +(assert_malformed + (module quote "(global i32 (i32.const 1__000))") + "unknown operator" +) +(assert_malformed + (module quote "(global i32 (i32.const _0x100))") + "unknown operator" +) +(assert_malformed + (module quote "(global i32 (i32.const 0_x100))") + "unknown operator" +) +(assert_malformed + (module quote "(global i32 (i32.const 0x_100))") + "unknown operator" +) +(assert_malformed + (module quote "(global i32 (i32.const 0x00_))") + "unknown operator" +) +(assert_malformed + (module quote "(global i32 (i32.const 0xff__ffff))") + "unknown operator" +) + +(assert_malformed + (module quote "(global i64 (i64.const _100))") + "unknown operator" +) +(assert_malformed + (module quote "(global i64 (i64.const +_100))") + "unknown operator" +) +(assert_malformed + (module quote "(global i64 (i64.const -_100))") + "unknown operator" +) +(assert_malformed + (module quote "(global i64 (i64.const 99_))") + "unknown operator" +) +(assert_malformed + (module quote "(global i64 (i64.const 1__000))") + "unknown operator" +) +(assert_malformed + (module quote "(global i64 (i64.const _0x100))") + "unknown operator" +) +(assert_malformed + (module quote "(global i64 (i64.const 0_x100))") + "unknown operator" +) +(assert_malformed + (module quote "(global i64 (i64.const 0x_100))") + "unknown operator" +) +(assert_malformed + (module quote "(global i64 (i64.const 0x00_))") + "unknown operator" +) +(assert_malformed + (module quote "(global i64 (i64.const 0xff__ffff))") + "unknown operator" +) diff --git a/test/core/labels.wast b/test/core/labels.wast index 03e5bf72..6fbf6292 100644 --- a/test/core/labels.wast +++ b/test/core/labels.wast @@ -1,6 +1,6 @@ (module (func (export "block") (result i32) - (block $exit i32 + (block $exit (result i32) (br $exit (i32.const 1)) (i32.const 0) ) @@ -8,12 +8,12 @@ (func (export "loop1") (result i32) (local $i i32) - (set_local $i (i32.const 0)) - (block $exit i32 - (loop $cont i32 - (set_local $i (i32.add (get_local $i) (i32.const 1))) - (if (i32.eq (get_local $i) (i32.const 5)) - (br $exit (get_local $i)) + (local.set $i (i32.const 0)) + (block $exit (result i32) + (loop $cont (result i32) + (local.set $i (i32.add (local.get $i) (i32.const 1))) + (if (i32.eq (local.get $i) (i32.const 5)) + (then (br $exit (local.get $i))) ) (br $cont) ) @@ -22,17 +22,17 @@ (func (export "loop2") (result i32) (local $i i32) - (set_local $i (i32.const 0)) - (block $exit i32 - (loop $cont i32 - (set_local $i (i32.add (get_local $i) (i32.const 1))) - (if (i32.eq (get_local $i) (i32.const 5)) - (br $cont) + (local.set $i (i32.const 0)) + (block $exit (result i32) + (loop $cont (result i32) + (local.set $i (i32.add (local.get $i) (i32.const 1))) + (if (i32.eq (local.get $i) (i32.const 5)) + (then (br $cont)) ) - (if (i32.eq (get_local $i) (i32.const 8)) - (br $exit (get_local $i)) + (if (i32.eq (local.get $i) (i32.const 8)) + (then (br $exit (local.get $i))) ) - (set_local $i (i32.add (get_local $i) (i32.const 1))) + (local.set $i (i32.add (local.get $i) (i32.const 1))) (br $cont) ) ) @@ -40,26 +40,26 @@ (func (export "loop3") (result i32) (local $i i32) - (set_local $i (i32.const 0)) - (block $exit i32 - (loop $cont i32 - (set_local $i (i32.add (get_local $i) (i32.const 1))) - (if (i32.eq (get_local $i) (i32.const 5)) - (br $exit (get_local $i)) + (local.set $i (i32.const 0)) + (block $exit (result i32) + (loop $cont (result i32) + (local.set $i (i32.add (local.get $i) (i32.const 1))) + (if (i32.eq (local.get $i) (i32.const 5)) + (then (br $exit (local.get $i))) ) - (get_local $i) + (local.get $i) ) ) ) (func (export "loop4") (param $max i32) (result i32) (local $i i32) - (set_local $i (i32.const 1)) - (block $exit i32 - (loop $cont i32 - (set_local $i (i32.add (get_local $i) (get_local $i))) - (if (i32.gt_u (get_local $i) (get_local $max)) - (br $exit (get_local $i)) + (local.set $i (i32.const 1)) + (block $exit (result i32) + (loop $cont (result i32) + (local.set $i (i32.add (local.get $i) (local.get $i))) + (if (i32.gt_u (local.get $i) (local.get $max)) + (then (br $exit (local.get $i))) ) (br $cont) ) @@ -68,95 +68,102 @@ (func (export "loop5") (result i32) (i32.add - (loop $l i32 (i32.const 1)) + (loop $l (result i32) (i32.const 1)) (i32.const 1) ) ) + (func (export "loop6") (result i32) + (loop (result i32) + (br_if 0 (i32.const 0)) + (i32.const 3) + ) + ) + (func (export "if") (result i32) (local $i i32) - (set_local $i (i32.const 0)) + (local.set $i (i32.const 0)) (block (if $l (i32.const 1) - (then (br $l) (set_local $i (i32.const 666))) + (then (br $l) (local.set $i (i32.const 666))) ) - (set_local $i (i32.add (get_local $i) (i32.const 1))) + (local.set $i (i32.add (local.get $i) (i32.const 1))) (if $l (i32.const 1) - (then (br $l) (set_local $i (i32.const 666))) - (else (set_local $i (i32.const 888))) + (then (br $l) (local.set $i (i32.const 666))) + (else (local.set $i (i32.const 888))) ) - (set_local $i (i32.add (get_local $i) (i32.const 1))) + (local.set $i (i32.add (local.get $i) (i32.const 1))) (if $l (i32.const 1) - (then (br $l) (set_local $i (i32.const 666))) - (else (set_local $i (i32.const 888))) + (then (br $l) (local.set $i (i32.const 666))) + (else (local.set $i (i32.const 888))) ) - (set_local $i (i32.add (get_local $i) (i32.const 1))) + (local.set $i (i32.add (local.get $i) (i32.const 1))) (if $l (i32.const 0) - (then (set_local $i (i32.const 888))) - (else (br $l) (set_local $i (i32.const 666))) + (then (local.set $i (i32.const 888))) + (else (br $l) (local.set $i (i32.const 666))) ) - (set_local $i (i32.add (get_local $i) (i32.const 1))) + (local.set $i (i32.add (local.get $i) (i32.const 1))) (if $l (i32.const 0) - (then (set_local $i (i32.const 888))) - (else (br $l) (set_local $i (i32.const 666))) + (then (local.set $i (i32.const 888))) + (else (br $l) (local.set $i (i32.const 666))) ) - (set_local $i (i32.add (get_local $i) (i32.const 1))) + (local.set $i (i32.add (local.get $i) (i32.const 1))) ) - (get_local $i) + (local.get $i) ) (func (export "if2") (result i32) (local $i i32) - (set_local $i (i32.const 0)) + (local.set $i (i32.const 0)) (block (if (i32.const 1) - (then (br 0) (set_local $i (i32.const 666))) + (then (br 0) (local.set $i (i32.const 666))) ) - (set_local $i (i32.add (get_local $i) (i32.const 1))) + (local.set $i (i32.add (local.get $i) (i32.const 1))) (if (i32.const 1) - (then (br 0) (set_local $i (i32.const 666))) - (else (set_local $i (i32.const 888))) + (then (br 0) (local.set $i (i32.const 666))) + (else (local.set $i (i32.const 888))) ) - (set_local $i (i32.add (get_local $i) (i32.const 1))) + (local.set $i (i32.add (local.get $i) (i32.const 1))) (if (i32.const 1) - (then (br 0) (set_local $i (i32.const 666))) - (else (set_local $i (i32.const 888))) + (then (br 0) (local.set $i (i32.const 666))) + (else (local.set $i (i32.const 888))) ) - (set_local $i (i32.add (get_local $i) (i32.const 1))) + (local.set $i (i32.add (local.get $i) (i32.const 1))) (if (i32.const 0) - (then (set_local $i (i32.const 888))) - (else (br 0) (set_local $i (i32.const 666))) + (then (local.set $i (i32.const 888))) + (else (br 0) (local.set $i (i32.const 666))) ) - (set_local $i (i32.add (get_local $i) (i32.const 1))) + (local.set $i (i32.add (local.get $i) (i32.const 1))) (if (i32.const 0) - (then (set_local $i (i32.const 888))) - (else (br 0) (set_local $i (i32.const 666))) + (then (local.set $i (i32.const 888))) + (else (br 0) (local.set $i (i32.const 666))) ) - (set_local $i (i32.add (get_local $i) (i32.const 1))) + (local.set $i (i32.add (local.get $i) (i32.const 1))) ) - (get_local $i) + (local.get $i) ) (func (export "switch") (param i32) (result i32) - (block $ret i32 + (block $ret (result i32) (i32.mul (i32.const 10) - (block $exit i32 + (block $exit (result i32) (block $0 (block $default (block $3 (block $2 (block $1 - (br_table $0 $1 $2 $3 $default (get_local 0)) + (br_table $0 $1 $2 $3 $default (local.get 0)) ) ;; 1 ) ;; 2 (br $exit (i32.const 2)) @@ -174,7 +181,7 @@ (block $default (block $1 (block $0 - (br_table $0 $1 (get_local 0)) + (br_table $0 $1 (local.get 0)) (br $default) ) ;; 0 (return (i32.const 0)) @@ -185,46 +192,58 @@ (func (export "br_if0") (result i32) (local $i i32) - (set_local $i (i32.const 0)) - (block $outer i32 + (local.set $i (i32.const 0)) + (block $outer (result i32) (block $inner (br_if $inner (i32.const 0)) - (set_local $i (i32.or (get_local $i) (i32.const 0x1))) + (local.set $i (i32.or (local.get $i) (i32.const 0x1))) (br_if $inner (i32.const 1)) - (set_local $i (i32.or (get_local $i) (i32.const 0x2))) + (local.set $i (i32.or (local.get $i) (i32.const 0x2))) ) (drop (br_if $outer - (block i32 - (set_local $i (i32.or (get_local $i) (i32.const 0x4))) - (get_local $i) + (block (result i32) + (local.set $i (i32.or (local.get $i) (i32.const 0x4))) + (local.get $i) ) (i32.const 0) )) - (set_local $i (i32.or (get_local $i) (i32.const 0x8))) + (local.set $i (i32.or (local.get $i) (i32.const 0x8))) (drop (br_if $outer - (block i32 - (set_local $i (i32.or (get_local $i) (i32.const 0x10))) - (get_local $i) + (block (result i32) + (local.set $i (i32.or (local.get $i) (i32.const 0x10))) + (local.get $i) ) (i32.const 1) )) - (set_local $i (i32.or (get_local $i) (i32.const 0x20))) (get_local $i) + (local.set $i (i32.or (local.get $i) (i32.const 0x20))) (local.get $i) ) ) (func (export "br_if1") (result i32) - (block $l0 i32 - (drop (br_if $l0 (block $l1 i32 (br $l1 (i32.const 1))) (i32.const 1))) - (i32.const 1) + (block $l0 (result i32) + (drop + (br_if $l0 + (block $l1 (result i32) (br $l1 (i32.const 1))) + (i32.const 1) + ) + ) + (i32.const 0) ) ) (func (export "br_if2") (result i32) - (block $l0 i32 + (block $l0 (result i32) (if (i32.const 1) - (br $l0 (block $l1 i32 (br $l1 (i32.const 1)))) + (then + (drop + (br_if $l0 + (block $l1 (result i32) (br $l1 (i32.const 1))) + (i32.const 1) + ) + ) + ) ) - (i32.const 1) + (i32.const 0) ) ) @@ -232,38 +251,38 @@ (local $i1 i32) (drop (i32.add - (block $l0 i32 + (block $l0 (result i32) (drop (br_if $l0 - (block i32 (set_local $i1 (i32.const 1)) (get_local $i1)) - (block i32 (set_local $i1 (i32.const 2)) (get_local $i1)) + (block (result i32) (local.set $i1 (i32.const 1)) (local.get $i1)) + (block (result i32) (local.set $i1 (i32.const 2)) (local.get $i1)) )) (i32.const 0) ) (i32.const 0) ) ) - (get_local $i1) + (local.get $i1) ) (func (export "br") (result i32) - (block $l0 i32 + (block $l0 (result i32) (if (i32.const 1) - (br $l0 (block $l1 i32 (br $l1 (i32.const 1)))) - (block (drop (block $l1 i32 (br $l1 (i32.const 1))))) + (then (br $l0 (block $l1 (result i32) (br $l1 (i32.const 1))))) + (else (block (drop (block $l1 (result i32) (br $l1 (i32.const 1)))))) ) (i32.const 1) ) ) (func (export "shadowing") (result i32) - (block $l1 i32 (i32.xor (br $l1 (i32.const 1)) (i32.const 2))) + (block $l1 (result i32) (i32.xor (br $l1 (i32.const 1)) (i32.const 2))) ) (func (export "redefinition") (result i32) - (block $l1 i32 + (block $l1 (result i32) (i32.add - (block $l1 i32 (i32.const 2)) - (block $l1 i32 (br $l1 (i32.const 3))) + (block $l1 (result i32) (i32.const 2)) + (block $l1 (result i32) (br $l1 (i32.const 3))) ) ) ) @@ -275,6 +294,7 @@ (assert_return (invoke "loop3") (i32.const 1)) (assert_return (invoke "loop4" (i32.const 8)) (i32.const 16)) (assert_return (invoke "loop5") (i32.const 2)) +(assert_return (invoke "loop6") (i32.const 3)) (assert_return (invoke "if") (i32.const 5)) (assert_return (invoke "if2") (i32.const 5)) (assert_return (invoke "switch" (i32.const 0)) (i32.const 50)) diff --git a/test/core/left-to-right.wast b/test/core/left-to-right.wast index 7eeda94a..634aa9c8 100644 --- a/test/core/left-to-right.wast +++ b/test/core/left-to-right.wast @@ -5,7 +5,7 @@ (type $i64_T (func (param i64 i64) (result i32))) (type $f32_T (func (param f32 f32) (result i32))) (type $f64_T (func (param f64 f64) (result i32))) - (table anyfunc + (table funcref (elem $i32_t0 $i32_t1 $i64_t0 $i64_t1 $f32_t0 $f32_t1 $f64_t0 $f64_t1) ) @@ -88,7 +88,7 @@ (func (export "i32_store8") (result i32) (call $reset) (i32.store8 (call $i32_left) (call $i32_right)) (call $get)) (func (export "i32_store16") (result i32) (call $reset) (i32.store16 (call $i32_left) (call $i32_right)) (call $get)) (func (export "i32_call") (result i32) (call $reset) (call $i32_dummy (call $i32_left) (call $i32_right)) (call $get)) - (func (export "i32_call_indirect") (result i32) (call $reset) (drop (call_indirect $i32_T (call $i32_left) (call $i32_right) (call $i32_callee))) (call $get)) + (func (export "i32_call_indirect") (result i32) (call $reset) (drop (call_indirect (type $i32_T) (call $i32_left) (call $i32_right) (call $i32_callee))) (call $get)) (func (export "i32_select") (result i32) (call $reset) (drop (select (call $i32_left) (call $i32_right) (call $i32_bool))) (call $get)) (func (export "i64_add") (result i32) (call $reset) (drop (i64.add (call $i64_left) (call $i64_right))) (call $get)) @@ -119,7 +119,7 @@ (func (export "i64_store16") (result i32) (call $reset) (i64.store16 (call $i32_left) (call $i64_right)) (call $get)) (func (export "i64_store32") (result i32) (call $reset) (i64.store32 (call $i32_left) (call $i64_right)) (call $get)) (func (export "i64_call") (result i32) (call $reset) (call $i64_dummy (call $i64_left) (call $i64_right)) (call $get)) - (func (export "i64_call_indirect") (result i32) (call $reset) (drop (call_indirect $i64_T (call $i64_left) (call $i64_right) (call $i64_callee))) (call $get)) + (func (export "i64_call_indirect") (result i32) (call $reset) (drop (call_indirect (type $i64_T) (call $i64_left) (call $i64_right) (call $i64_callee))) (call $get)) (func (export "i64_select") (result i32) (call $reset) (drop (select (call $i64_left) (call $i64_right) (call $i64_bool))) (call $get)) (func (export "f32_add") (result i32) (call $reset) (drop (f32.add (call $f32_left) (call $f32_right))) (call $get)) @@ -137,7 +137,7 @@ (func (export "f32_max") (result i32) (call $reset) (drop (f32.max (call $f32_left) (call $f32_right))) (call $get)) (func (export "f32_store") (result i32) (call $reset) (f32.store (call $i32_left) (call $f32_right)) (call $get)) (func (export "f32_call") (result i32) (call $reset) (call $f32_dummy (call $f32_left) (call $f32_right)) (call $get)) - (func (export "f32_call_indirect") (result i32) (call $reset) (drop (call_indirect $f32_T (call $f32_left) (call $f32_right) (call $f32_callee))) (call $get)) + (func (export "f32_call_indirect") (result i32) (call $reset) (drop (call_indirect (type $f32_T) (call $f32_left) (call $f32_right) (call $f32_callee))) (call $get)) (func (export "f32_select") (result i32) (call $reset) (drop (select (call $f32_left) (call $f32_right) (call $f32_bool))) (call $get)) (func (export "f64_add") (result i32) (call $reset) (drop (f64.add (call $f64_left) (call $f64_right))) (call $get)) @@ -155,21 +155,21 @@ (func (export "f64_max") (result i32) (call $reset) (drop (f64.max (call $f64_left) (call $f64_right))) (call $get)) (func (export "f64_store") (result i32) (call $reset) (f64.store (call $i32_left) (call $f64_right)) (call $get)) (func (export "f64_call") (result i32) (call $reset) (call $f64_dummy (call $f64_left) (call $f64_right)) (call $get)) - (func (export "f64_call_indirect") (result i32) (call $reset) (drop (call_indirect $f64_T (call $f64_left) (call $f64_right) (call $f64_callee))) (call $get)) + (func (export "f64_call_indirect") (result i32) (call $reset) (drop (call_indirect (type $f64_T) (call $f64_left) (call $f64_right) (call $f64_callee))) (call $get)) (func (export "f64_select") (result i32) (call $reset) (drop (select (call $f64_left) (call $f64_right) (call $f64_bool))) (call $get)) (func (export "br_if") (result i32) - (block i32 + (block (result i32) (call $reset) (drop (br_if 0 (call $i32_left) (i32.and (call $i32_right) (i32.const 0)))) (call $get) ) ) (func (export "br_table") (result i32) - (block $a i32 + (block $a (result i32) (call $reset) (drop - (block $b i32 + (block $b (result i32) (br_table $a $b (call $i32_left) (call $i32_right)) ) ) diff --git a/test/core/linking.wast b/test/core/linking.wast index 6a7dc365..e72f928b 100644 --- a/test/core/linking.wast +++ b/test/core/linking.wast @@ -20,17 +20,17 @@ (assert_return (invoke $Nf "call Mf.call") (i32.const 2)) (module - (import "spectest" "print" (func $f (param i32))) + (import "spectest" "print_i32" (func $f (param i32))) (export "print" (func $f)) ) (register "reexport_f") (assert_unlinkable (module (import "reexport_f" "print" (func (param i64)))) - "type mismatch" + "incompatible import type" ) (assert_unlinkable (module (import "reexport_f" "print" (func (param i32) (result i32)))) - "type mismatch" + "incompatible import type" ) @@ -38,17 +38,30 @@ (module $Mg (global $glob (export "glob") i32 (i32.const 42)) - (func (export "get") (result i32) (get_global $glob)) + (func (export "get") (result i32) (global.get $glob)) + + ;; export mutable globals + (global $mut_glob (export "mut_glob") (mut i32) (i32.const 142)) + (func (export "get_mut") (result i32) (global.get $mut_glob)) + (func (export "set_mut") (param i32) (global.set $mut_glob (local.get 0))) ) (register "Mg" $Mg) (module $Ng (global $x (import "Mg" "glob") i32) + (global $mut_glob (import "Mg" "mut_glob") (mut i32)) (func $f (import "Mg" "get") (result i32)) + (func $get_mut (import "Mg" "get_mut") (result i32)) + (func $set_mut (import "Mg" "set_mut") (param i32)) + (export "Mg.glob" (global $x)) (export "Mg.get" (func $f)) (global $glob (export "glob") i32 (i32.const 43)) - (func (export "get") (result i32) (get_global $glob)) + (func (export "get") (result i32) (global.get $glob)) + + (export "Mg.mut_glob" (global $mut_glob)) + (export "Mg.get_mut" (func $get_mut)) + (export "Mg.set_mut" (func $set_mut)) ) (assert_return (get $Mg "glob") (i32.const 42)) @@ -58,6 +71,89 @@ (assert_return (invoke $Ng "Mg.get") (i32.const 42)) (assert_return (invoke $Ng "get") (i32.const 43)) +(assert_return (get $Mg "mut_glob") (i32.const 142)) +(assert_return (get $Ng "Mg.mut_glob") (i32.const 142)) +(assert_return (invoke $Mg "get_mut") (i32.const 142)) +(assert_return (invoke $Ng "Mg.get_mut") (i32.const 142)) + +(assert_return (invoke $Mg "set_mut" (i32.const 241))) +(assert_return (get $Mg "mut_glob") (i32.const 241)) +(assert_return (get $Ng "Mg.mut_glob") (i32.const 241)) +(assert_return (invoke $Mg "get_mut") (i32.const 241)) +(assert_return (invoke $Ng "Mg.get_mut") (i32.const 241)) + + +(assert_unlinkable + (module (import "Mg" "mut_glob" (global i32))) + "incompatible import type" +) +(assert_unlinkable + (module (import "Mg" "glob" (global (mut i32)))) + "incompatible import type" +) + + +(module $Mref_ex + (global (export "g-const-null") nullref (ref.null)) + (global (export "g-var-null") (mut nullref) (ref.null)) + (global (export "g-const-func") funcref (ref.null)) + (global (export "g-var-func") (mut funcref) (ref.null)) + (global (export "g-const-any") anyref (ref.null)) + (global (export "g-var-any") (mut anyref) (ref.null)) +) +(register "Mref_ex" $Mref_ex) + +(module $Mref_im + (global (import "Mref_ex" "g-const-null") nullref) + (global (import "Mref_ex" "g-const-null") funcref) + (global (import "Mref_ex" "g-const-null") anyref) + (global (import "Mref_ex" "g-const-func") funcref) + (global (import "Mref_ex" "g-const-func") anyref) + (global (import "Mref_ex" "g-const-any") anyref) + + (global (import "Mref_ex" "g-var-null") (mut nullref)) + (global (import "Mref_ex" "g-var-func") (mut funcref)) + (global (import "Mref_ex" "g-var-any") (mut anyref)) +) + +(assert_unlinkable + (module (global (import "Mref_ex" "g-const-func") nullref)) + "incompatible import type" +) +(assert_unlinkable + (module (global (import "Mref_ex" "g-const-any") nullref)) + "incompatible import type" +) +(assert_unlinkable + (module (global (import "Mref_ex" "g-const-any") funcref)) + "incompatible import type" +) + +(assert_unlinkable + (module (global (import "Mref_ex" "g-var-null") (mut funcref))) + "incompatible import type" +) +(assert_unlinkable + (module (global (import "Mref_ex" "g-var-null") (mut anyref))) + "incompatible import type" +) +(assert_unlinkable + (module (global (import "Mref_ex" "g-var-func") (mut nullref))) + "incompatible import type" +) +(assert_unlinkable + (module (global (import "Mref_ex" "g-var-func") (mut anyref))) + "incompatible import type" +) +(assert_unlinkable + (module (global (import "Mref_ex" "g-var-any") (mut nullref))) + "incompatible import type" +) +(assert_unlinkable + (module (global (import "Mref_ex" "g-var-any") (mut funcref))) + "incompatible import type" +) + ;; Tables @@ -65,13 +161,13 @@ (type (func (result i32))) (type (func)) - (table (export "tab") 10 anyfunc) + (table (export "tab") 10 funcref) (elem (i32.const 2) $g $g $g $g) (func $g (result i32) (i32.const 4)) (func (export "h") (result i32) (i32.const -4)) (func (export "call") (param i32) (result i32) - (call_indirect 0 (get_local 0)) + (call_indirect (type 0) (local.get 0)) ) ) (register "Mt" $Mt) @@ -83,15 +179,15 @@ (func $f (import "Mt" "call") (param i32) (result i32)) (func $h (import "Mt" "h") (result i32)) - (table anyfunc (elem $g $g $g $h $f)) + (table funcref (elem $g $g $g $h $f)) (func $g (result i32) (i32.const 5)) (export "Mt.call" (func $f)) (func (export "call Mt.call") (param i32) (result i32) - (call $f (get_local 0)) + (call $f (local.get 0)) ) (func (export "call") (param i32) (result i32) - (call_indirect 1 (get_local 0)) + (call_indirect (type 1) (local.get 0)) ) ) @@ -122,12 +218,12 @@ (type (func (result i32))) (func $h (import "Mt" "h") (result i32)) - (table (import "Mt" "tab") 5 anyfunc) + (table (import "Mt" "tab") 5 funcref) (elem (i32.const 1) $i $h) (func $i (result i32) (i32.const 6)) (func (export "call") (param i32) (result i32) - (call_indirect 0 (get_local 0)) + (call_indirect (type 0) (local.get 0)) ) ) @@ -157,14 +253,22 @@ (assert_trap (invoke $Ot "call" (i32.const 20)) "undefined") (module - (table (import "Mt" "tab") 0 anyfunc) + (table (import "Mt" "tab") 0 funcref) (elem (i32.const 9) $f) (func $f) ) +(module $G1 (global (export "g") i32 (i32.const 5))) +(register "G1" $G1) +(module $G2 + (global (import "G1" "g") i32) + (global (export "g") i32 (global.get 0)) +) +(assert_return (get $G2 "g") (i32.const 5)) + (assert_unlinkable (module - (table (import "Mt" "tab") 0 anyfunc) + (table (import "Mt" "tab") 0 funcref) (elem (i32.const 10) $f) (func $f) ) @@ -173,7 +277,7 @@ (assert_unlinkable (module - (table (import "Mt" "tab") 10 anyfunc) + (table (import "Mt" "tab") 10 funcref) (memory (import "Mt" "mem") 1) ;; does not exist (func $f (result i32) (i32.const 0)) (elem (i32.const 7) $f) @@ -185,7 +289,7 @@ (assert_unlinkable (module - (table (import "Mt" "tab") 10 anyfunc) + (table (import "Mt" "tab") 10 funcref) (func $f (result i32) (i32.const 0)) (elem (i32.const 7) $f) (elem (i32.const 12) $f) ;; out of bounds @@ -196,7 +300,7 @@ (assert_unlinkable (module - (table (import "Mt" "tab") 10 anyfunc) + (table (import "Mt" "tab") 10 funcref) (func $f (result i32) (i32.const 0)) (elem (i32.const 7) $f) (memory 1) @@ -207,6 +311,45 @@ (assert_trap (invoke $Mt "call" (i32.const 7)) "uninitialized") +(module $Mtable_ex + (table $t1 (export "t-null") 1 nullref) + (table $t2 (export "t-func") 1 funcref) + (table $t3 (export "t-any") 1 anyref) +) +(register "Mtable_ex" $Mtable_ex) + +(module + (table (import "Mtable_ex" "t-null") 1 nullref) + (table (import "Mtable_ex" "t-func") 1 funcref) + (table (import "Mtable_ex" "t-any") 1 anyref) +) + +(assert_unlinkable + (module (table (import "Mtable_ex" "t-null") 1 funcref)) + "incompatible import type" +) +(assert_unlinkable + (module (table (import "Mtable_ex" "t-null") 1 anyref)) + "incompatible import type" +) +(assert_unlinkable + (module (table (import "Mtable_ex" "t-func") 1 nullref)) + "incompatible import type" +) +(assert_unlinkable + (module (table (import "Mtable_ex" "t-func") 1 anyref)) + "incompatible import type" +) +(assert_unlinkable + (module (table (import "Mtable_ex" "t-any") 1 nullref)) + "incompatible import type" +) +(assert_unlinkable + (module (table (import "Mtable_ex" "t-any") 1 funcref)) + "incompatible import type" +) + + ;; Memories (module $Mm @@ -214,7 +357,7 @@ (data (i32.const 10) "\00\01\02\03\04\05\06\07\08\09") (func (export "load") (param $a i32) (result i32) - (i32.load8_u (get_local 0)) + (i32.load8_u (local.get 0)) ) ) (register "Mm" $Mm) @@ -227,7 +370,7 @@ (export "Mm.load" (func $loadM)) (func (export "load") (param $a i32) (result i32) - (i32.load8_u (get_local 0)) + (i32.load8_u (local.get 0)) ) ) @@ -240,7 +383,7 @@ (data (i32.const 5) "\a0\a1\a2\a3\a4\a5\a6\a7") (func (export "load") (param $a i32) (result i32) - (i32.load8_u (get_local 0)) + (i32.load8_u (local.get 0)) ) ) @@ -266,7 +409,7 @@ (memory (import "Mm" "mem") 1 8) (func (export "grow") (param $a i32) (result i32) - (grow_memory (get_local 0)) + (memory.grow (local.get 0)) ) ) @@ -283,7 +426,7 @@ (module (func $host (import "spectest" "print")) (memory (import "Mm" "mem") 1) - (table (import "Mm" "tab") 0 anyfunc) ;; does not exist + (table (import "Mm" "tab") 0 funcref) ;; does not exist (data (i32.const 0) "abc") ) "unknown import" @@ -304,10 +447,44 @@ (module (memory (import "Mm" "mem") 1) (data (i32.const 0) "abc") - (table 0 anyfunc) + (table 0 funcref) (func) (elem (i32.const 0) 0) ;; out of bounds ) "elements segment does not fit" ) (assert_return (invoke $Mm "load" (i32.const 0)) (i32.const 0)) + +;; Store is modified if the start function traps. +(module $Ms + (type $t (func (result i32))) + (memory (export "memory") 1) + (table (export "table") 1 funcref) + (func (export "get memory[0]") (type $t) + (i32.load8_u (i32.const 0)) + ) + (func (export "get table[0]") (type $t) + (call_indirect (type $t) (i32.const 0)) + ) +) +(register "Ms" $Ms) + +(assert_trap + (module + (import "Ms" "memory" (memory 1)) + (import "Ms" "table" (table 1 funcref)) + (data (i32.const 0) "hello") + (elem (i32.const 0) $f) + (func $f (result i32) + (i32.const 0xdead) + ) + (func $main + (unreachable) + ) + (start $main) + ) + "unreachable" +) + +(assert_return (invoke $Ms "get memory[0]") (i32.const 104)) ;; 'h' +(assert_return (invoke $Ms "get table[0]") (i32.const 0xdead)) diff --git a/test/core/load-align-0.fail.wast b/test/core/load-align-0.fail.wast deleted file mode 100644 index fb8ec030..00000000 --- a/test/core/load-align-0.fail.wast +++ /dev/null @@ -1 +0,0 @@ -(module (memory 0) (func (drop (i64.load align=0 (i32.const 0))))) diff --git a/test/core/load-align-big.fail.wast b/test/core/load-align-big.fail.wast deleted file mode 100644 index ec5eedd2..00000000 --- a/test/core/load-align-big.fail.wast +++ /dev/null @@ -1 +0,0 @@ -(module (memory 0) (func (drop (i64.load align=16 (i32.const 0))))) diff --git a/test/core/load-align-odd.fail.wast b/test/core/load-align-odd.fail.wast deleted file mode 100644 index 2132836c..00000000 --- a/test/core/load-align-odd.fail.wast +++ /dev/null @@ -1 +0,0 @@ -(module (memory 0) (func (drop (i64.load align=5 (i32.const 0))))) diff --git a/test/core/load.wast b/test/core/load.wast new file mode 100644 index 00000000..ef5ec7c4 --- /dev/null +++ b/test/core/load.wast @@ -0,0 +1,567 @@ +;; Load operator as the argument of control constructs and instructions + +(module + (memory 1) + + (func (export "as-br-value") (result i32) + (block (result i32) (br 0 (i32.load (i32.const 0)))) + ) + + (func (export "as-br_if-cond") + (block (br_if 0 (i32.load (i32.const 0)))) + ) + (func (export "as-br_if-value") (result i32) + (block (result i32) + (drop (br_if 0 (i32.load (i32.const 0)) (i32.const 1))) (i32.const 7) + ) + ) + (func (export "as-br_if-value-cond") (result i32) + (block (result i32) + (drop (br_if 0 (i32.const 6) (i32.load (i32.const 0)))) (i32.const 7) + ) + ) + + (func (export "as-br_table-index") + (block (br_table 0 0 0 (i32.load (i32.const 0)))) + ) + (func (export "as-br_table-value") (result i32) + (block (result i32) + (br_table 0 0 0 (i32.load (i32.const 0)) (i32.const 1)) (i32.const 7) + ) + ) + (func (export "as-br_table-value-index") (result i32) + (block (result i32) + (br_table 0 0 (i32.const 6) (i32.load (i32.const 0))) (i32.const 7) + ) + ) + + (func (export "as-return-value") (result i32) + (return (i32.load (i32.const 0))) + ) + + (func (export "as-if-cond") (result i32) + (if (result i32) (i32.load (i32.const 0)) + (then (i32.const 0)) (else (i32.const 1)) + ) + ) + (func (export "as-if-then") (result i32) + (if (result i32) (i32.const 1) + (then (i32.load (i32.const 0))) (else (i32.const 0)) + ) + ) + (func (export "as-if-else") (result i32) + (if (result i32) (i32.const 0) + (then (i32.const 0)) (else (i32.load (i32.const 0))) + ) + ) + + (func (export "as-select-first") (param i32 i32) (result i32) + (select (i32.load (i32.const 0)) (local.get 0) (local.get 1)) + ) + (func (export "as-select-second") (param i32 i32) (result i32) + (select (local.get 0) (i32.load (i32.const 0)) (local.get 1)) + ) + (func (export "as-select-cond") (result i32) + (select (i32.const 0) (i32.const 1) (i32.load (i32.const 0))) + ) + + (func $f (param i32 i32 i32) (result i32) (i32.const -1)) + (func (export "as-call-first") (result i32) + (call $f (i32.load (i32.const 0)) (i32.const 2) (i32.const 3)) + ) + (func (export "as-call-mid") (result i32) + (call $f (i32.const 1) (i32.load (i32.const 0)) (i32.const 3)) + ) + (func (export "as-call-last") (result i32) + (call $f (i32.const 1) (i32.const 2) (i32.load (i32.const 0))) + ) + + (type $sig (func (param i32 i32 i32) (result i32))) + (table funcref (elem $f)) + (func (export "as-call_indirect-first") (result i32) + (call_indirect (type $sig) + (i32.load (i32.const 0)) (i32.const 2) (i32.const 3) (i32.const 0) + ) + ) + (func (export "as-call_indirect-mid") (result i32) + (call_indirect (type $sig) + (i32.const 1) (i32.load (i32.const 0)) (i32.const 3) (i32.const 0) + ) + ) + (func (export "as-call_indirect-last") (result i32) + (call_indirect (type $sig) + (i32.const 1) (i32.const 2) (i32.load (i32.const 0)) (i32.const 0) + ) + ) + (func (export "as-call_indirect-index") (result i32) + (call_indirect (type $sig) + (i32.const 1) (i32.const 2) (i32.const 3) (i32.load (i32.const 0)) + ) + ) + + (func (export "as-local.set-value") (local i32) + (local.set 0 (i32.load (i32.const 0))) + ) + (func (export "as-local.tee-value") (result i32) (local i32) + (local.tee 0 (i32.load (i32.const 0))) + ) + (global $g (mut i32) (i32.const 0)) + (func (export "as-global.set-value") (local i32) + (global.set $g (i32.load (i32.const 0))) + ) + + (func (export "as-load-address") (result i32) + (i32.load (i32.load (i32.const 0))) + ) + (func (export "as-loadN-address") (result i32) + (i32.load8_s (i32.load (i32.const 0))) + ) + + (func (export "as-store-address") + (i32.store (i32.load (i32.const 0)) (i32.const 7)) + ) + (func (export "as-store-value") + (i32.store (i32.const 2) (i32.load (i32.const 0))) + ) + + (func (export "as-storeN-address") + (i32.store8 (i32.load8_s (i32.const 0)) (i32.const 7)) + ) + (func (export "as-storeN-value") + (i32.store16 (i32.const 2) (i32.load (i32.const 0))) + ) + + (func (export "as-unary-operand") (result i32) + (i32.clz (i32.load (i32.const 100))) + ) + + (func (export "as-binary-left") (result i32) + (i32.add (i32.load (i32.const 100)) (i32.const 10)) + ) + (func (export "as-binary-right") (result i32) + (i32.sub (i32.const 10) (i32.load (i32.const 100))) + ) + + (func (export "as-test-operand") (result i32) + (i32.eqz (i32.load (i32.const 100))) + ) + + (func (export "as-compare-left") (result i32) + (i32.le_s (i32.load (i32.const 100)) (i32.const 10)) + ) + (func (export "as-compare-right") (result i32) + (i32.ne (i32.const 10) (i32.load (i32.const 100))) + ) + + (func (export "as-memory.grow-size") (result i32) + (memory.grow (i32.load (i32.const 100))) + ) +) + +(assert_return (invoke "as-br-value") (i32.const 0)) + +(assert_return (invoke "as-br_if-cond")) +(assert_return (invoke "as-br_if-value") (i32.const 0)) +(assert_return (invoke "as-br_if-value-cond") (i32.const 7)) + +(assert_return (invoke "as-br_table-index")) +(assert_return (invoke "as-br_table-value") (i32.const 0)) +(assert_return (invoke "as-br_table-value-index") (i32.const 6)) + +(assert_return (invoke "as-return-value") (i32.const 0)) + +(assert_return (invoke "as-if-cond") (i32.const 1)) +(assert_return (invoke "as-if-then") (i32.const 0)) +(assert_return (invoke "as-if-else") (i32.const 0)) + +(assert_return (invoke "as-select-first" (i32.const 0) (i32.const 1)) (i32.const 0)) +(assert_return (invoke "as-select-second" (i32.const 0) (i32.const 0)) (i32.const 0)) +(assert_return (invoke "as-select-cond") (i32.const 1)) + +(assert_return (invoke "as-call-first") (i32.const -1)) +(assert_return (invoke "as-call-mid") (i32.const -1)) +(assert_return (invoke "as-call-last") (i32.const -1)) + +(assert_return (invoke "as-call_indirect-first") (i32.const -1)) +(assert_return (invoke "as-call_indirect-mid") (i32.const -1)) +(assert_return (invoke "as-call_indirect-last") (i32.const -1)) +(assert_return (invoke "as-call_indirect-index") (i32.const -1)) + +(assert_return (invoke "as-local.set-value")) +(assert_return (invoke "as-local.tee-value") (i32.const 0)) +(assert_return (invoke "as-global.set-value")) + +(assert_return (invoke "as-load-address") (i32.const 0)) +(assert_return (invoke "as-loadN-address") (i32.const 0)) +(assert_return (invoke "as-store-address")) +(assert_return (invoke "as-store-value")) +(assert_return (invoke "as-storeN-address")) +(assert_return (invoke "as-storeN-value")) + +(assert_return (invoke "as-unary-operand") (i32.const 32)) + +(assert_return (invoke "as-binary-left") (i32.const 10)) +(assert_return (invoke "as-binary-right") (i32.const 10)) + +(assert_return (invoke "as-test-operand") (i32.const 1)) + +(assert_return (invoke "as-compare-left") (i32.const 1)) +(assert_return (invoke "as-compare-right") (i32.const 1)) + +(assert_return (invoke "as-memory.grow-size") (i32.const 1)) + +(assert_malformed + (module quote + "(memory 1)" + "(func (param i32) (result i32) (i32.load32 (local.get 0)))" + ) + "unknown operator" +) +(assert_malformed + (module quote + "(memory 1)" + "(func (param i32) (result i32) (i32.load32_u (local.get 0)))" + ) + "unknown operator" +) +(assert_malformed + (module quote + "(memory 1)" + "(func (param i32) (result i32) (i32.load32_s (local.get 0)))" + ) + "unknown operator" +) +(assert_malformed + (module quote + "(memory 1)" + "(func (param i32) (result i32) (i32.load64 (local.get 0)))" + ) + "unknown operator" +) +(assert_malformed + (module quote + "(memory 1)" + "(func (param i32) (result i32) (i32.load64_u (local.get 0)))" + ) + "unknown operator" +) +(assert_malformed + (module quote + "(memory 1)" + "(func (param i32) (result i32) (i32.load64_s (local.get 0)))" + ) + "unknown operator" +) + +(assert_malformed + (module quote + "(memory 1)" + "(func (param i32) (result i64) (i64.load64 (local.get 0)))" + ) + "unknown operator" +) +(assert_malformed + (module quote + "(memory 1)" + "(func (param i32) (result i64) (i64.load64_u (local.get 0)))" + ) + "unknown operator" +) +(assert_malformed + (module quote + "(memory 1)" + "(func (param i32) (result i64) (i64.load64_s (local.get 0)))" + ) + "unknown operator" +) + +(assert_malformed + (module quote + "(memory 1)" + "(func (param i32) (result f32) (f32.load32 (local.get 0)))" + ) + "unknown operator" +) +(assert_malformed + (module quote + "(memory 1)" + "(func (param i32) (result f32) (f32.load64 (local.get 0)))" + ) + "unknown operator" +) + +(assert_malformed + (module quote + "(memory 1)" + "(func (param i32) (result f64) (f64.load32 (local.get 0)))" + ) + "unknown operator" +) +(assert_malformed + (module quote + "(memory 1)" + "(func (param i32) (result f64) (f64.load64 (local.get 0)))" + ) + "unknown operator" +) + + +;; load should have retval + +(assert_invalid + (module (memory 1) (func $load_i32 (i32.load (i32.const 0)))) + "type mismatch" +) +(assert_invalid + (module (memory 1) (func $load8_s_i32 (i32.load8_s (i32.const 0)))) + "type mismatch" +) +(assert_invalid + (module (memory 1) (func $load8_u_i32 (i32.load8_u (i32.const 0)))) + "type mismatch" +) +(assert_invalid + (module (memory 1) (func $load16_s_i32 (i32.load16_s (i32.const 0)))) + "type mismatch" +) +(assert_invalid + (module (memory 1) (func $load16_u_i32 (i32.load16_u (i32.const 0)))) + "type mismatch" +) +(assert_invalid + (module (memory 1) (func $load_i64 (i64.load (i32.const 0)))) + "type mismatch" +) +(assert_invalid + (module (memory 1) (func $load8_s_i64 (i64.load8_s (i32.const 0)))) + "type mismatch" +) +(assert_invalid + (module (memory 1) (func $load8_u_i64 (i64.load8_u (i32.const 0)))) + "type mismatch" +) +(assert_invalid + (module (memory 1) (func $load16_s_i64 (i64.load16_s (i32.const 0)))) + "type mismatch" +) +(assert_invalid + (module (memory 1) (func $load16_u_i64 (i64.load16_u (i32.const 0)))) + "type mismatch" +) +(assert_invalid + (module (memory 1) (func $load32_s_i64 (i64.load32_s (i32.const 0)))) + "type mismatch" +) +(assert_invalid + (module (memory 1) (func $load32_u_i64 (i64.load32_u (i32.const 0)))) + "type mismatch" +) +(assert_invalid + (module (memory 1) (func $load_f32 (f32.load (i32.const 0)))) + "type mismatch" +) +(assert_invalid + (module (memory 1) (func $load_f64 (f64.load (i32.const 0)))) + "type mismatch" +) + + +;; Type check + +(assert_invalid (module (memory 1) (func (result i32) (i32.load (f32.const 0)))) "type mismatch") +(assert_invalid (module (memory 1) (func (result i32) (i32.load8_s (f32.const 0)))) "type mismatch") +(assert_invalid (module (memory 1) (func (result i32) (i32.load8_u (f32.const 0)))) "type mismatch") +(assert_invalid (module (memory 1) (func (result i32) (i32.load16_s (f32.const 0)))) "type mismatch") +(assert_invalid (module (memory 1) (func (result i32) (i32.load16_u (f32.const 0)))) "type mismatch") +(assert_invalid (module (memory 1) (func (result i64) (i64.load (f32.const 0)))) "type mismatch") +(assert_invalid (module (memory 1) (func (result i64) (i64.load8_s (f32.const 0)))) "type mismatch") +(assert_invalid (module (memory 1) (func (result i64) (i64.load8_u (f32.const 0)))) "type mismatch") +(assert_invalid (module (memory 1) (func (result i64) (i64.load16_s (f32.const 0)))) "type mismatch") +(assert_invalid (module (memory 1) (func (result i64) (i64.load16_u (f32.const 0)))) "type mismatch") +(assert_invalid (module (memory 1) (func (result i64) (i64.load32_s (f32.const 0)))) "type mismatch") +(assert_invalid (module (memory 1) (func (result i64) (i64.load32_u (f32.const 0)))) "type mismatch") +(assert_invalid (module (memory 1) (func (result f32) (f32.load (f32.const 0)))) "type mismatch") +(assert_invalid (module (memory 1) (func (result f64) (f64.load (f32.const 0)))) "type mismatch") + + +(assert_invalid + (module + (memory 0) + (func $type-address-empty + (i32.load) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 0) + (func $type-address-empty-in-block + (i32.const 0) + (block (i32.load) (drop)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 0) + (func $type-address-empty-in-loop + (i32.const 0) + (loop (i32.load) (drop)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 0) + (func $type-address-empty-in-then + (i32.const 0) (i32.const 0) + (if (then (i32.load) (drop))) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 0) + (func $type-address-empty-in-else + (i32.const 0) (i32.const 0) + (if (result i32) (then (i32.const 0)) (else (i32.load))) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 0) + (func $type-address-empty-in-br + (i32.const 0) + (block (br 0 (i32.load)) (drop)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 0) + (func $type-address-empty-in-br_if + (i32.const 0) + (block (br_if 0 (i32.load) (i32.const 1)) (drop)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 0) + (func $type-address-empty-in-br_table + (i32.const 0) + (block (br_table 0 (i32.load)) (drop)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 0) + (func $type-address-empty-in-return + (return (i32.load)) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 0) + (func $type-address-empty-in-select + (select (i32.load) (i32.const 1) (i32.const 2)) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 0) + (func $type-address-empty-in-call + (call 1 (i32.load)) (drop) + ) + (func (param i32) (result i32) (local.get 0)) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 0) + (func $f (param i32) (result i32) (local.get 0)) + (type $sig (func (param i32) (result i32))) + (table funcref (elem $f)) + (func $type-address-empty-in-call_indirect + (block (result i32) + (call_indirect (type $sig) + (i32.load) (i32.const 0) + ) + (drop) + ) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 0) + (func $type-address-empty-in-local.set + (local i32) + (local.set 0 (i32.load)) (local.get 0) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 0) + (func $type-address-empty-in-local.tee + (local i32) + (local.tee 0 (i32.load)) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 0) + (global $x (mut i32) (i32.const 0)) + (func $type-address-empty-in-global.set + (global.set $x (i32.load)) (global.get $x) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 0) + (func $type-address-empty-in-memory.grow + (memory.grow (i32.load)) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 0) + (func $type-address-empty-in-load + (i32.load (i32.load)) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 1) + (func $type-address-empty-in-store + (i32.store (i32.load) (i32.const 1)) + ) + ) + "type mismatch" +) diff --git a/test/core/local_get.wast b/test/core/local_get.wast new file mode 100644 index 00000000..ab564cbe --- /dev/null +++ b/test/core/local_get.wast @@ -0,0 +1,226 @@ +;; Test `local.get` operator + +(module + ;; Typing + + (func (export "type-local-i32") (result i32) (local i32) (local.get 0)) + (func (export "type-local-i64") (result i64) (local i64) (local.get 0)) + (func (export "type-local-f32") (result f32) (local f32) (local.get 0)) + (func (export "type-local-f64") (result f64) (local f64) (local.get 0)) + + (func (export "type-param-i32") (param i32) (result i32) (local.get 0)) + (func (export "type-param-i64") (param i64) (result i64) (local.get 0)) + (func (export "type-param-f32") (param f32) (result f32) (local.get 0)) + (func (export "type-param-f64") (param f64) (result f64) (local.get 0)) + + (func (export "type-mixed") (param i64 f32 f64 i32 i32) + (local f32 i64 i64 f64) + (drop (i64.eqz (local.get 0))) + (drop (f32.neg (local.get 1))) + (drop (f64.neg (local.get 2))) + (drop (i32.eqz (local.get 3))) + (drop (i32.eqz (local.get 4))) + (drop (f32.neg (local.get 5))) + (drop (i64.eqz (local.get 6))) + (drop (i64.eqz (local.get 7))) + (drop (f64.neg (local.get 8))) + ) + + ;; Reading + + (func (export "read") (param i64 f32 f64 i32 i32) (result f64) + (local f32 i64 i64 f64) + (local.set 5 (f32.const 5.5)) + (local.set 6 (i64.const 6)) + (local.set 8 (f64.const 8)) + (f64.add + (f64.convert_i64_u (local.get 0)) + (f64.add + (f64.promote_f32 (local.get 1)) + (f64.add + (local.get 2) + (f64.add + (f64.convert_i32_u (local.get 3)) + (f64.add + (f64.convert_i32_s (local.get 4)) + (f64.add + (f64.promote_f32 (local.get 5)) + (f64.add + (f64.convert_i64_u (local.get 6)) + (f64.add + (f64.convert_i64_u (local.get 7)) + (local.get 8) + ) + ) + ) + ) + ) + ) + ) + ) + ) + + ;; As parameter of control constructs and instructions + + (func (export "as-block-value") (param i32) (result i32) + (block (result i32) (local.get 0)) + ) + (func (export "as-loop-value") (param i32) (result i32) + (loop (result i32) (local.get 0)) + ) + (func (export "as-br-value") (param i32) (result i32) + (block (result i32) (br 0 (local.get 0))) + ) + (func (export "as-br_if-value") (param i32) (result i32) + (block $l0 (result i32) (br_if $l0 (local.get 0) (i32.const 1))) + ) + + (func (export "as-br_if-value-cond") (param i32) (result i32) + (block (result i32) + (br_if 0 (local.get 0) (local.get 0)) + ) + ) + (func (export "as-br_table-value") (param i32) (result i32) + (block + (block + (block + (br_table 0 1 2 (local.get 0)) + (return (i32.const 0)) + ) + (return (i32.const 1)) + ) + (return (i32.const 2)) + ) + (i32.const 3) + ) + + (func (export "as-return-value") (param i32) (result i32) + (return (local.get 0)) + ) + + (func (export "as-if-then") (param i32) (result i32) + (if (result i32) (local.get 0) (then (local.get 0)) (else (i32.const 0))) + ) + (func (export "as-if-else") (param i32) (result i32) + (if (result i32) (local.get 0) (then (i32.const 1)) (else (local.get 0))) + ) +) + +(assert_return (invoke "type-local-i32") (i32.const 0)) +(assert_return (invoke "type-local-i64") (i64.const 0)) +(assert_return (invoke "type-local-f32") (f32.const 0)) +(assert_return (invoke "type-local-f64") (f64.const 0)) + +(assert_return (invoke "type-param-i32" (i32.const 2)) (i32.const 2)) +(assert_return (invoke "type-param-i64" (i64.const 3)) (i64.const 3)) +(assert_return (invoke "type-param-f32" (f32.const 4.4)) (f32.const 4.4)) +(assert_return (invoke "type-param-f64" (f64.const 5.5)) (f64.const 5.5)) + +(assert_return (invoke "as-block-value" (i32.const 6)) (i32.const 6)) +(assert_return (invoke "as-loop-value" (i32.const 7)) (i32.const 7)) + +(assert_return (invoke "as-br-value" (i32.const 8)) (i32.const 8)) +(assert_return (invoke "as-br_if-value" (i32.const 9)) (i32.const 9)) +(assert_return (invoke "as-br_if-value-cond" (i32.const 10)) (i32.const 10)) +(assert_return (invoke "as-br_table-value" (i32.const 1)) (i32.const 2)) + +(assert_return (invoke "as-return-value" (i32.const 0)) (i32.const 0)) + +(assert_return (invoke "as-if-then" (i32.const 1)) (i32.const 1)) +(assert_return (invoke "as-if-else" (i32.const 0)) (i32.const 0)) + +(assert_return + (invoke "type-mixed" + (i64.const 1) (f32.const 2.2) (f64.const 3.3) (i32.const 4) (i32.const 5) + ) +) + +(assert_return + (invoke "read" + (i64.const 1) (f32.const 2) (f64.const 3.3) (i32.const 4) (i32.const 5) + ) + (f64.const 34.8) +) + + +;; Invalid typing of access to locals + +(assert_invalid + (module (func $type-local-num-vs-num (result i64) (local i32) (local.get 0))) + "type mismatch" +) +(assert_invalid + (module (func $type-local-num-vs-num (result i32) (local f32) (i32.eqz (local.get 0)))) + "type mismatch" +) +(assert_invalid + (module (func $type-local-num-vs-num (result f64) (local f64 i64) (f64.neg (local.get 1)))) + "type mismatch" +) + + +;; Invalid typing of access to parameters + +(assert_invalid + (module (func $type-param-num-vs-num (param i32) (result i64) (local.get 0))) + "type mismatch" +) +(assert_invalid + (module (func $type-param-num-vs-num (param f32) (result i32) (i32.eqz (local.get 0)))) + "type mismatch" +) +(assert_invalid + (module (func $type-param-num-vs-num (param f64 i64) (result f64) (f64.neg (local.get 1)))) + "type mismatch" +) + + +;; local.set should have retval + +(assert_invalid + (module (func $type-empty-vs-i32 (local i32) (local.get 0))) + "type mismatch" +) +(assert_invalid + (module (func $type-empty-vs-i64 (local i64) (local.get 0))) + "type mismatch" +) +(assert_invalid + (module (func $type-empty-vs-f32 (local f32) (local.get 0))) + "type mismatch" +) +(assert_invalid + (module (func $type-empty-vs-f64 (local f64) (local.get 0))) + "type mismatch" +) + + +;; Invalid local index + +(assert_invalid + (module (func $unbound-local (local i32 i64) (local.get 3))) + "unknown local" +) +(assert_invalid + (module (func $large-local (local i32 i64) (local.get 14324343))) + "unknown local" +) + +(assert_invalid + (module (func $unbound-param (param i32 i64) (local.get 2))) + "unknown local" +) +(assert_invalid + (module (func $large-param (param i32 i64) (local.get 714324343))) + "unknown local" +) + +(assert_invalid + (module (func $unbound-mixed (param i32) (local i32 i64) (local.get 3))) + "unknown local" +) +(assert_invalid + (module (func $large-mixed (param i64) (local i32 i64) (local.get 214324343))) + "unknown local" +) + diff --git a/test/core/local_set.wast b/test/core/local_set.wast new file mode 100644 index 00000000..ce9cf77f --- /dev/null +++ b/test/core/local_set.wast @@ -0,0 +1,362 @@ +;; Test `local.set` operator + +(module + ;; Typing + + (func (export "type-local-i32") (local i32) (local.set 0 (i32.const 0))) + (func (export "type-local-i64") (local i64) (local.set 0 (i64.const 0))) + (func (export "type-local-f32") (local f32) (local.set 0 (f32.const 0))) + (func (export "type-local-f64") (local f64) (local.set 0 (f64.const 0))) + + (func (export "type-param-i32") (param i32) (local.set 0 (i32.const 10))) + (func (export "type-param-i64") (param i64) (local.set 0 (i64.const 11))) + (func (export "type-param-f32") (param f32) (local.set 0 (f32.const 11.1))) + (func (export "type-param-f64") (param f64) (local.set 0 (f64.const 12.2))) + + (func (export "type-mixed") (param i64 f32 f64 i32 i32) (local f32 i64 i64 f64) + (local.set 0 (i64.const 0)) + (local.set 1 (f32.const 0)) + (local.set 2 (f64.const 0)) + (local.set 3 (i32.const 0)) + (local.set 4 (i32.const 0)) + (local.set 5 (f32.const 0)) + (local.set 6 (i64.const 0)) + (local.set 7 (i64.const 0)) + (local.set 8 (f64.const 0)) + ) + + ;; Writing + + (func (export "write") (param i64 f32 f64 i32 i32) (result i64) + (local f32 i64 i64 f64) + (local.set 1 (f32.const -0.3)) + (local.set 3 (i32.const 40)) + (local.set 4 (i32.const -7)) + (local.set 5 (f32.const 5.5)) + (local.set 6 (i64.const 6)) + (local.set 8 (f64.const 8)) + (i64.trunc_f64_s + (f64.add + (f64.convert_i64_u (local.get 0)) + (f64.add + (f64.promote_f32 (local.get 1)) + (f64.add + (local.get 2) + (f64.add + (f64.convert_i32_u (local.get 3)) + (f64.add + (f64.convert_i32_s (local.get 4)) + (f64.add + (f64.promote_f32 (local.get 5)) + (f64.add + (f64.convert_i64_u (local.get 6)) + (f64.add + (f64.convert_i64_u (local.get 7)) + (local.get 8) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + + ;; As parameter of control constructs and instructions + + (func (export "as-block-value") (param i32) + (block (local.set 0 (i32.const 1))) + ) + (func (export "as-loop-value") (param i32) + (loop (local.set 0 (i32.const 3))) + ) + + (func (export "as-br-value") (param i32) + (block (br 0 (local.set 0 (i32.const 9)))) + ) + (func (export "as-br_if-value") (param i32) + (block + (br_if 0 (local.set 0 (i32.const 8)) (i32.const 1)) + ) + ) + (func (export "as-br_if-value-cond") (param i32) + (block + (br_if 0 (i32.const 6) (local.set 0 (i32.const 9))) + ) + ) + (func (export "as-br_table-value") (param i32) + (block + (br_table 0 (local.set 0 (i32.const 10)) (i32.const 1)) + ) + ) + + (func (export "as-return-value") (param i32) + (return (local.set 0 (i32.const 7))) + ) + + (func (export "as-if-then") (param i32) + (if (local.get 0) (then (local.set 0 (i32.const 3)))) + ) + (func (export "as-if-else") (param i32) + (if (local.get 0) (then) (else (local.set 0 (i32.const 1)))) + ) +) + +(assert_return (invoke "type-local-i32")) +(assert_return (invoke "type-local-i64")) +(assert_return (invoke "type-local-f32")) +(assert_return (invoke "type-local-f64")) + +(assert_return (invoke "type-param-i32" (i32.const 2))) +(assert_return (invoke "type-param-i64" (i64.const 3))) +(assert_return (invoke "type-param-f32" (f32.const 4.4))) +(assert_return (invoke "type-param-f64" (f64.const 5.5))) + +(assert_return (invoke "as-block-value" (i32.const 0))) +(assert_return (invoke "as-loop-value" (i32.const 0))) + +(assert_return (invoke "as-br-value" (i32.const 0))) +(assert_return (invoke "as-br_if-value" (i32.const 0))) +(assert_return (invoke "as-br_if-value-cond" (i32.const 0))) +(assert_return (invoke "as-br_table-value" (i32.const 0))) + +(assert_return (invoke "as-return-value" (i32.const 0))) + +(assert_return (invoke "as-if-then" (i32.const 1))) +(assert_return (invoke "as-if-else" (i32.const 0))) + +(assert_return + (invoke "type-mixed" + (i64.const 1) (f32.const 2.2) (f64.const 3.3) (i32.const 4) (i32.const 5) + ) +) + +(assert_return + (invoke "write" + (i64.const 1) (f32.const 2) (f64.const 3.3) (i32.const 4) (i32.const 5) + ) + (i64.const 56) +) + + +;; Invalid typing of access to locals + + +(assert_invalid + (module (func $type-local-arg-void-vs-num (local i32) (local.set 0 (nop)))) + "type mismatch" +) +(assert_invalid + (module (func $type-local-arg-num-vs-num (local i32) (local.set 0 (f32.const 0)))) + "type mismatch" +) +(assert_invalid + (module (func $type-local-arg-num-vs-num (local f32) (local.set 0 (f64.const 0)))) + "type mismatch" +) +(assert_invalid + (module (func $type-local-arg-num-vs-num (local f64 i64) (local.set 1 (f64.const 0)))) + "type mismatch" +) + + +;; Invalid typing of access to parameters + + +(assert_invalid + (module (func $type-param-arg-void-vs-num (param i32) (local.set 0 (nop)))) + "type mismatch" +) +(assert_invalid + (module (func $type-param-arg-num-vs-num (param i32) (local.set 0 (f32.const 0)))) + "type mismatch" +) +(assert_invalid + (module (func $type-param-arg-num-vs-num (param f32) (local.set 0 (f64.const 0)))) + "type mismatch" +) +(assert_invalid + (module (func $type-param-arg-num-vs-num (param f64 i64) (local.set 1 (f64.const 0)))) + "type mismatch" +) + +(assert_invalid + (module + (func $type-param-arg-empty-vs-num (param i32) + (local.set 0) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-param-arg-empty-vs-num-in-block (param i32) + (i32.const 0) + (block (local.set 0)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-param-arg-empty-vs-num-in-loop (param i32) + (i32.const 0) + (loop (local.set 0)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-param-arg-empty-vs-num-in-then (param i32) + (i32.const 0) + (if (i32.const 1) (then (local.set 0))) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-param-arg-empty-vs-num-in-else (param i32) + (i32.const 0) + (if (result i32) (i32.const 0) (then (i32.const 0)) (else (local.set 0))) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-param-arg-empty-vs-num-in-br (param i32) + (i32.const 0) + (block (br 0 (local.set 0))) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-param-arg-empty-vs-num-in-br_if (param i32) + (i32.const 0) + (block (br_if 0 (local.set 0))) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-param-arg-empty-vs-num-in-br_table (param i32) + (i32.const 0) + (block (br_table 0 (local.set 0))) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-param-arg-empty-vs-num-in-return (param i32) + (return (local.set 0)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-param-arg-empty-vs-num-in-select (param i32) + (select (local.set 0) (i32.const 1) (i32.const 2)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-param-arg-empty-vs-num-in-call (param i32) + (call 1 (local.set 0)) + ) + (func (param i32) (result i32) (local.get 0)) + ) + "type mismatch" +) +(assert_invalid + (module + (func $f (param i32) (result i32) (local.get 0)) + (type $sig (func (param i32) (result i32))) + (table funcref (elem $f)) + (func $type-param-arg-empty-vs-num-in-call_indirect (param i32) + (block (result i32) + (call_indirect (type $sig) + (local.set 0) (i32.const 0) + ) + ) + ) + ) + "type mismatch" +) + + +;; Invalid typing of access to mixed args + +(assert_invalid + (module (func $type-mixed-arg-num-vs-num (param f32) (local i32) (local.set 1 (f32.const 0)))) + "type mismatch" +) +(assert_invalid + (module (func $type-mixed-arg-num-vs-num (param i64 i32) (local f32) (local.set 1 (f32.const 0)))) + "type mismatch" +) +(assert_invalid + (module (func $type-mixed-arg-num-vs-num (param i64) (local f64 i64) (local.set 1 (i64.const 0)))) + "type mismatch" +) + + +;; local.set should have no retval + +(assert_invalid + (module (func $type-empty-vs-i32 (param i32) (result i32) (local.set 0 (i32.const 1)))) + "type mismatch" +) +(assert_invalid + (module (func $type-empty-vs-i64 (param i64) (result i64) (local.set 0 (i64.const 1)))) + "type mismatch" +) +(assert_invalid + (module (func $type-empty-vs-f32 (param f32) (result f32) (local.set 0 (f32.const 1)))) + "type mismatch" +) +(assert_invalid + (module (func $type-empty-vs-f64 (param f64) (result f64) (local.set 0 (f64.const 1)))) + "type mismatch" +) + + +;; Invalid local index + +(assert_invalid + (module (func $unbound-local (local i32 i64) (local.set 3 (i32.const 0)))) + "unknown local" +) +(assert_invalid + (module (func $large-local (local i32 i64) (local.set 14324343 (i32.const 0)))) + "unknown local" +) + +(assert_invalid + (module (func $unbound-param (param i32 i64) (local.set 2 (i32.const 0)))) + "unknown local" +) +(assert_invalid + (module (func $large-param (param i32 i64) (local.set 714324343 (i32.const 0)))) + "unknown local" +) + +(assert_invalid + (module (func $unbound-mixed (param i32) (local i32 i64) (local.set 3 (i32.const 0)))) + "unknown local" +) +(assert_invalid + (module (func $large-mixed (param i64) (local i32 i64) (local.set 214324343 (i32.const 0)))) + "unknown local" +) + diff --git a/test/core/local_tee.wast b/test/core/local_tee.wast new file mode 100644 index 00000000..dde7321e --- /dev/null +++ b/test/core/local_tee.wast @@ -0,0 +1,639 @@ +;; Test `local.tee` operator + +(module + ;; Typing + + (func (export "type-local-i32") (result i32) (local i32) (local.tee 0 (i32.const 0))) + (func (export "type-local-i64") (result i64) (local i64) (local.tee 0 (i64.const 0))) + (func (export "type-local-f32") (result f32) (local f32) (local.tee 0 (f32.const 0))) + (func (export "type-local-f64") (result f64) (local f64) (local.tee 0 (f64.const 0))) + + (func (export "type-param-i32") (param i32) (result i32) (local.tee 0 (i32.const 10))) + (func (export "type-param-i64") (param i64) (result i64) (local.tee 0 (i64.const 11))) + (func (export "type-param-f32") (param f32) (result f32) (local.tee 0 (f32.const 11.1))) + (func (export "type-param-f64") (param f64) (result f64) (local.tee 0 (f64.const 12.2))) + + (func (export "type-mixed") (param i64 f32 f64 i32 i32) (local f32 i64 i64 f64) + (drop (i64.eqz (local.tee 0 (i64.const 0)))) + (drop (f32.neg (local.tee 1 (f32.const 0)))) + (drop (f64.neg (local.tee 2 (f64.const 0)))) + (drop (i32.eqz (local.tee 3 (i32.const 0)))) + (drop (i32.eqz (local.tee 4 (i32.const 0)))) + (drop (f32.neg (local.tee 5 (f32.const 0)))) + (drop (i64.eqz (local.tee 6 (i64.const 0)))) + (drop (i64.eqz (local.tee 7 (i64.const 0)))) + (drop (f64.neg (local.tee 8 (f64.const 0)))) + ) + + ;; Writing + + (func (export "write") (param i64 f32 f64 i32 i32) (result i64) (local f32 i64 i64 f64) + (drop (local.tee 1 (f32.const -0.3))) + (drop (local.tee 3 (i32.const 40))) + (drop (local.tee 4 (i32.const -7))) + (drop (local.tee 5 (f32.const 5.5))) + (drop (local.tee 6 (i64.const 6))) + (drop (local.tee 8 (f64.const 8))) + (i64.trunc_f64_s + (f64.add + (f64.convert_i64_u (local.get 0)) + (f64.add + (f64.promote_f32 (local.get 1)) + (f64.add + (local.get 2) + (f64.add + (f64.convert_i32_u (local.get 3)) + (f64.add + (f64.convert_i32_s (local.get 4)) + (f64.add + (f64.promote_f32 (local.get 5)) + (f64.add + (f64.convert_i64_u (local.get 6)) + (f64.add + (f64.convert_i64_u (local.get 7)) + (local.get 8) + ) + ) + ) + ) + ) + ) + ) + ) + ) + ) + + ;; Result + + (func (export "result") (param i64 f32 f64 i32 i32) (result f64) + (local f32 i64 i64 f64) + (f64.add + (f64.convert_i64_u (local.tee 0 (i64.const 1))) + (f64.add + (f64.promote_f32 (local.tee 1 (f32.const 2))) + (f64.add + (local.tee 2 (f64.const 3.3)) + (f64.add + (f64.convert_i32_u (local.tee 3 (i32.const 4))) + (f64.add + (f64.convert_i32_s (local.tee 4 (i32.const 5))) + (f64.add + (f64.promote_f32 (local.tee 5 (f32.const 5.5))) + (f64.add + (f64.convert_i64_u (local.tee 6 (i64.const 6))) + (f64.add + (f64.convert_i64_u (local.tee 7 (i64.const 0))) + (local.tee 8 (f64.const 8)) + ) + ) + ) + ) + ) + ) + ) + ) + ) + + (func $dummy) + + (func (export "as-block-first") (param i32) (result i32) + (block (result i32) (local.tee 0 (i32.const 1)) (call $dummy)) + ) + (func (export "as-block-mid") (param i32) (result i32) + (block (result i32) (call $dummy) (local.tee 0 (i32.const 1)) (call $dummy)) + ) + (func (export "as-block-last") (param i32) (result i32) + (block (result i32) (call $dummy) (call $dummy) (local.tee 0 (i32.const 1))) + ) + + (func (export "as-loop-first") (param i32) (result i32) + (loop (result i32) (local.tee 0 (i32.const 3)) (call $dummy)) + ) + (func (export "as-loop-mid") (param i32) (result i32) + (loop (result i32) (call $dummy) (local.tee 0 (i32.const 4)) (call $dummy)) + ) + (func (export "as-loop-last") (param i32) (result i32) + (loop (result i32) (call $dummy) (call $dummy) (local.tee 0 (i32.const 5))) + ) + + (func (export "as-br-value") (param i32) (result i32) + (block (result i32) (br 0 (local.tee 0 (i32.const 9)))) + ) + + (func (export "as-br_if-cond") (param i32) + (block (br_if 0 (local.tee 0 (i32.const 1)))) + ) + (func (export "as-br_if-value") (param i32) (result i32) + (block (result i32) + (drop (br_if 0 (local.tee 0 (i32.const 8)) (i32.const 1))) (i32.const 7) + ) + ) + (func (export "as-br_if-value-cond") (param i32) (result i32) + (block (result i32) + (drop (br_if 0 (i32.const 6) (local.tee 0 (i32.const 9)))) (i32.const 7) + ) + ) + + (func (export "as-br_table-index") (param i32) + (block (br_table 0 0 0 (local.tee 0 (i32.const 0)))) + ) + (func (export "as-br_table-value") (param i32) (result i32) + (block (result i32) + (br_table 0 0 0 (local.tee 0 (i32.const 10)) (i32.const 1)) (i32.const 7) + ) + ) + (func (export "as-br_table-value-index") (param i32) (result i32) + (block (result i32) + (br_table 0 0 (i32.const 6) (local.tee 0 (i32.const 11))) (i32.const 7) + ) + ) + + (func (export "as-return-value") (param i32) (result i32) + (return (local.tee 0 (i32.const 7))) + ) + + (func (export "as-if-cond") (param i32) (result i32) + (if (result i32) (local.tee 0 (i32.const 2)) + (then (i32.const 0)) (else (i32.const 1)) + ) + ) + (func (export "as-if-then") (param i32) (result i32) + (if (result i32) (local.get 0) + (then (local.tee 0 (i32.const 3))) (else (local.get 0)) + ) + ) + (func (export "as-if-else") (param i32) (result i32) + (if (result i32) (local.get 0) + (then (local.get 0)) (else (local.tee 0 (i32.const 4))) + ) + ) + + (func (export "as-select-first") (param i32 i32) (result i32) + (select (local.tee 0 (i32.const 5)) (local.get 0) (local.get 1)) + ) + (func (export "as-select-second") (param i32 i32) (result i32) + (select (local.get 0) (local.tee 0 (i32.const 6)) (local.get 1)) + ) + (func (export "as-select-cond") (param i32) (result i32) + (select (i32.const 0) (i32.const 1) (local.tee 0 (i32.const 7))) + ) + + (func $f (param i32 i32 i32) (result i32) (i32.const -1)) + (func (export "as-call-first") (param i32) (result i32) + (call $f (local.tee 0 (i32.const 12)) (i32.const 2) (i32.const 3)) + ) + (func (export "as-call-mid") (param i32) (result i32) + (call $f (i32.const 1) (local.tee 0 (i32.const 13)) (i32.const 3)) + ) + (func (export "as-call-last") (param i32) (result i32) + (call $f (i32.const 1) (i32.const 2) (local.tee 0 (i32.const 14))) + ) + + (type $sig (func (param i32 i32 i32) (result i32))) + (table funcref (elem $f)) + (func (export "as-call_indirect-first") (param i32) (result i32) + (call_indirect (type $sig) + (local.tee 0 (i32.const 1)) (i32.const 2) (i32.const 3) (i32.const 0) + ) + ) + (func (export "as-call_indirect-mid") (param i32) (result i32) + (call_indirect (type $sig) + (i32.const 1) (local.tee 0 (i32.const 2)) (i32.const 3) (i32.const 0) + ) + ) + (func (export "as-call_indirect-last") (param i32) (result i32) + (call_indirect (type $sig) + (i32.const 1) (i32.const 2) (local.tee 0 (i32.const 3)) (i32.const 0) + ) + ) + (func (export "as-call_indirect-index") (param i32) (result i32) + (call_indirect (type $sig) + (i32.const 1) (i32.const 2) (i32.const 3) (local.tee 0 (i32.const 0)) + ) + ) + + (func (export "as-local.set-value") (local i32) + (local.set 0 (local.tee 0 (i32.const 1))) + ) + (func (export "as-local.tee-value") (param i32) (result i32) + (local.tee 0 (local.tee 0 (i32.const 1))) + ) + (global $g (mut i32) (i32.const 0)) + (func (export "as-global.set-value") (local i32) + (global.set $g (local.tee 0 (i32.const 1))) + ) + + (memory 1) + (func (export "as-load-address") (param i32) (result i32) + (i32.load (local.tee 0 (i32.const 1))) + ) + (func (export "as-loadN-address") (param i32) (result i32) + (i32.load8_s (local.tee 0 (i32.const 3))) + ) + + (func (export "as-store-address") (param i32) + (i32.store (local.tee 0 (i32.const 30)) (i32.const 7)) + ) + (func (export "as-store-value") (param i32) + (i32.store (i32.const 2) (local.tee 0 (i32.const 1))) + ) + + (func (export "as-storeN-address") (param i32) + (i32.store8 (local.tee 0 (i32.const 1)) (i32.const 7)) + ) + (func (export "as-storeN-value") (param i32) + (i32.store16 (i32.const 2) (local.tee 0 (i32.const 1))) + ) + + (func (export "as-unary-operand") (param f32) (result f32) + (f32.neg (local.tee 0 (f32.const nan:0x0f1e2))) + ) + + (func (export "as-binary-left") (param i32) (result i32) + (i32.add (local.tee 0 (i32.const 3)) (i32.const 10)) + ) + (func (export "as-binary-right") (param i32) (result i32) + (i32.sub (i32.const 10) (local.tee 0 (i32.const 4))) + ) + + (func (export "as-test-operand") (param i32) (result i32) + (i32.eqz (local.tee 0 (i32.const 0))) + ) + + (func (export "as-compare-left") (param i32) (result i32) + (i32.le_s (local.tee 0 (i32.const 43)) (i32.const 10)) + ) + (func (export "as-compare-right") (param i32) (result i32) + (i32.ne (i32.const 10) (local.tee 0 (i32.const 42))) + ) + + (func (export "as-convert-operand") (param i64) (result i32) + (i32.wrap_i64 (local.tee 0 (i64.const 41))) + ) + + (func (export "as-memory.grow-size") (param i32) (result i32) + (memory.grow (local.tee 0 (i32.const 40))) + ) + +) + +(assert_return (invoke "type-local-i32") (i32.const 0)) +(assert_return (invoke "type-local-i64") (i64.const 0)) +(assert_return (invoke "type-local-f32") (f32.const 0)) +(assert_return (invoke "type-local-f64") (f64.const 0)) + +(assert_return (invoke "type-param-i32" (i32.const 2)) (i32.const 10)) +(assert_return (invoke "type-param-i64" (i64.const 3)) (i64.const 11)) +(assert_return (invoke "type-param-f32" (f32.const 4.4)) (f32.const 11.1)) +(assert_return (invoke "type-param-f64" (f64.const 5.5)) (f64.const 12.2)) + +(assert_return (invoke "as-block-first" (i32.const 0)) (i32.const 1)) +(assert_return (invoke "as-block-mid" (i32.const 0)) (i32.const 1)) +(assert_return (invoke "as-block-last" (i32.const 0)) (i32.const 1)) + +(assert_return (invoke "as-loop-first" (i32.const 0)) (i32.const 3)) +(assert_return (invoke "as-loop-mid" (i32.const 0)) (i32.const 4)) +(assert_return (invoke "as-loop-last" (i32.const 0)) (i32.const 5)) + +(assert_return (invoke "as-br-value" (i32.const 0)) (i32.const 9)) + +(assert_return (invoke "as-br_if-cond" (i32.const 0))) +(assert_return (invoke "as-br_if-value" (i32.const 0)) (i32.const 8)) +(assert_return (invoke "as-br_if-value-cond" (i32.const 0)) (i32.const 6)) + +(assert_return (invoke "as-br_table-index" (i32.const 0))) +(assert_return (invoke "as-br_table-value" (i32.const 0)) (i32.const 10)) +(assert_return (invoke "as-br_table-value-index" (i32.const 0)) (i32.const 6)) + +(assert_return (invoke "as-return-value" (i32.const 0)) (i32.const 7)) + +(assert_return (invoke "as-if-cond" (i32.const 0)) (i32.const 0)) +(assert_return (invoke "as-if-then" (i32.const 1)) (i32.const 3)) +(assert_return (invoke "as-if-else" (i32.const 0)) (i32.const 4)) + +(assert_return (invoke "as-select-first" (i32.const 0) (i32.const 1)) (i32.const 5)) +(assert_return (invoke "as-select-second" (i32.const 0) (i32.const 0)) (i32.const 6)) +(assert_return (invoke "as-select-cond" (i32.const 0)) (i32.const 0)) + +(assert_return (invoke "as-call-first" (i32.const 0)) (i32.const -1)) +(assert_return (invoke "as-call-mid" (i32.const 0)) (i32.const -1)) +(assert_return (invoke "as-call-last" (i32.const 0)) (i32.const -1)) + +(assert_return (invoke "as-call_indirect-first" (i32.const 0)) (i32.const -1)) +(assert_return (invoke "as-call_indirect-mid" (i32.const 0)) (i32.const -1)) +(assert_return (invoke "as-call_indirect-last" (i32.const 0)) (i32.const -1)) +(assert_return (invoke "as-call_indirect-index" (i32.const 0)) (i32.const -1)) + +(assert_return (invoke "as-local.set-value")) +(assert_return (invoke "as-local.tee-value" (i32.const 0)) (i32.const 1)) +(assert_return (invoke "as-global.set-value")) + +(assert_return (invoke "as-load-address" (i32.const 0)) (i32.const 0)) +(assert_return (invoke "as-loadN-address" (i32.const 0)) (i32.const 0)) +(assert_return (invoke "as-store-address" (i32.const 0))) +(assert_return (invoke "as-store-value" (i32.const 0))) +(assert_return (invoke "as-storeN-address" (i32.const 0))) +(assert_return (invoke "as-storeN-value" (i32.const 0))) + +(assert_return (invoke "as-unary-operand" (f32.const 0)) (f32.const -nan:0x0f1e2)) +(assert_return (invoke "as-binary-left" (i32.const 0)) (i32.const 13)) +(assert_return (invoke "as-binary-right" (i32.const 0)) (i32.const 6)) +(assert_return (invoke "as-test-operand" (i32.const 0)) (i32.const 1)) +(assert_return (invoke "as-compare-left" (i32.const 0)) (i32.const 0)) +(assert_return (invoke "as-compare-right" (i32.const 0)) (i32.const 1)) +(assert_return (invoke "as-convert-operand" (i64.const 0)) (i32.const 41)) +(assert_return (invoke "as-memory.grow-size" (i32.const 0)) (i32.const 1)) + +(assert_return + (invoke "type-mixed" + (i64.const 1) (f32.const 2.2) (f64.const 3.3) (i32.const 4) (i32.const 5) + ) +) + +(assert_return + (invoke "write" + (i64.const 1) (f32.const 2) (f64.const 3.3) (i32.const 4) (i32.const 5) + ) + (i64.const 56) +) + +(assert_return + (invoke "result" + (i64.const -1) (f32.const -2) (f64.const -3.3) (i32.const -4) (i32.const -5) + ) + (f64.const 34.8) +) + + +;; Invalid typing of access to locals + +(assert_invalid + (module (func $type-local-num-vs-num (result i64) (local i32) (local.tee 0 (i32.const 0)))) + "type mismatch" +) +(assert_invalid + (module (func $type-local-num-vs-num (local f32) (i32.eqz (local.tee 0 (f32.const 0))))) + "type mismatch" +) +(assert_invalid + (module (func $type-local-num-vs-num (local f64 i64) (f64.neg (local.tee 1 (i64.const 0))))) + "type mismatch" +) + +(assert_invalid + (module (func $type-local-arg-void-vs-num (local i32) (local.tee 0 (nop)))) + "type mismatch" +) +(assert_invalid + (module (func $type-local-arg-num-vs-num (local i32) (local.tee 0 (f32.const 0)))) + "type mismatch" +) +(assert_invalid + (module (func $type-local-arg-num-vs-num (local f32) (local.tee 0 (f64.const 0)))) + "type mismatch" +) +(assert_invalid + (module (func $type-local-arg-num-vs-num (local f64 i64) (local.tee 1 (f64.const 0)))) + "type mismatch" +) + + +;; Invalid typing of access to parameters + +(assert_invalid + (module (func $type-param-num-vs-num (param i32) (result i64) (local.get 0))) + "type mismatch" +) +(assert_invalid + (module (func $type-param-num-vs-num (param f32) (i32.eqz (local.get 0)))) + "type mismatch" +) +(assert_invalid + (module (func $type-param-num-vs-num (param f64 i64) (f64.neg (local.get 1)))) + "type mismatch" +) + +(assert_invalid + (module (func $type-param-arg-void-vs-num (param i32) (local.tee 0 (nop)))) + "type mismatch" +) +(assert_invalid + (module (func $type-param-arg-num-vs-num (param i32) (local.tee 0 (f32.const 0)))) + "type mismatch" +) +(assert_invalid + (module (func $type-param-arg-num-vs-num (param f32) (local.tee 0 (f64.const 0)))) + "type mismatch" +) +(assert_invalid + (module (func $type-param-arg-num-vs-num (param f64 i64) (local.tee 1 (f64.const 0)))) + "type mismatch" +) + +(assert_invalid + (module + (func $type-param-arg-empty-vs-num (param i32) + (local.tee 0) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-param-arg-empty-vs-num-in-block (param i32) + (i32.const 0) + (block (local.tee 0) (drop)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-param-arg-empty-vs-num-in-loop (param i32) + (i32.const 0) + (loop (local.tee 0) (drop)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-param-arg-empty-vs-num-in-then (param i32) + (i32.const 0) (i32.const 0) + (if (then (local.tee 0) (drop))) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-param-arg-empty-vs-num-in-else (param i32) + (i32.const 0) (i32.const 0) + (if (result i32) (then (i32.const 0)) (else (local.tee 0))) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-param-arg-empty-vs-num-in-br (param i32) + (i32.const 0) + (block (br 0 (local.tee 0)) (drop)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-param-arg-empty-vs-num-in-br_if (param i32) + (i32.const 0) + (block (br_if 0 (local.tee 0) (i32.const 1)) (drop)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-param-arg-empty-vs-num-in-br_table (param i32) + (i32.const 0) + (block (br_table 0 (local.tee 0)) (drop)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-param-arg-empty-vs-num-in-return (param i32) + (return (local.tee 0)) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-param-arg-empty-vs-num-in-select (param i32) + (select (local.tee 0) (i32.const 1) (i32.const 2)) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-param-arg-empty-vs-num-in-call (param i32) + (call 1 (local.tee 0)) (drop) + ) + (func (param i32) (result i32) (local.get 0)) + ) + "type mismatch" +) +(assert_invalid + (module + (func $f (param i32) (result i32) (local.get 0)) + (type $sig (func (param i32) (result i32))) + (table funcref (elem $f)) + (func $type-param-arg-empty-vs-num-in-call_indirect (param i32) + (block (result i32) + (call_indirect (type $sig) + (local.tee 0) (i32.const 0) + ) + (drop) + ) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-param-arg-empty-vs-num-in-local.set (param i32) + (local.set 0 (local.tee 0)) (local.get 0) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-param-arg-empty-vs-num-in-local.tee (param i32) + (local.tee 0 (local.tee 0)) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (global $x (mut i32) (i32.const 0)) + (func $type-param-arg-empty-vs-num-in-global.set (param i32) + (global.set $x (local.tee 0)) (global.get $x) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 0) + (func $type-param-arg-empty-vs-num-in-memory.grow (param i32) + (memory.grow (local.tee 0)) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 0) + (func $type-param-arg-empty-vs-num-in-load (param i32) + (i32.load (local.tee 0)) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 1) + (func $type-param-arg-empty-vs-num-in-store (param i32) + (i32.store (local.tee 0) (i32.const 1)) + ) + ) + "type mismatch" +) + + +;; Invalid local index + +(assert_invalid + (module (func $unbound-local (local i32 i64) (local.get 3))) + "unknown local" +) +(assert_invalid + (module (func $large-local (local i32 i64) (local.get 14324343))) + "unknown local" +) + +(assert_invalid + (module (func $unbound-param (param i32 i64) (local.get 2))) + "unknown local" +) +(assert_invalid + (module (func $large-param (local i32 i64) (local.get 714324343))) + "unknown local" +) + +(assert_invalid + (module (func $unbound-mixed (param i32) (local i32 i64) (local.get 3))) + "unknown local" +) +(assert_invalid + (module (func $large-mixed (param i64) (local i32 i64) (local.get 214324343))) + "unknown local" +) + +(assert_invalid + (module (func $type-mixed-arg-num-vs-num (param f32) (local i32) (local.tee 1 (f32.const 0)))) + "type mismatch" +) +(assert_invalid + (module (func $type-mixed-arg-num-vs-num (param i64 i32) (local f32) (local.tee 1 (f32.const 0)))) + "type mismatch" +) +(assert_invalid + (module (func $type-mixed-arg-num-vs-num (param i64) (local f64 i64) (local.tee 1 (i64.const 0)))) + "type mismatch" +) diff --git a/test/core/loop-end-label-mismatch.fail.wast b/test/core/loop-end-label-mismatch.fail.wast deleted file mode 100644 index 1ed0104c..00000000 --- a/test/core/loop-end-label-mismatch.fail.wast +++ /dev/null @@ -1 +0,0 @@ -(module (func loop $a end $l)) diff --git a/test/core/loop-end-label-superfluous.fail.wast b/test/core/loop-end-label-superfluous.fail.wast deleted file mode 100644 index 85a2ea6f..00000000 --- a/test/core/loop-end-label-superfluous.fail.wast +++ /dev/null @@ -1 +0,0 @@ -(module (func loop end $l)) diff --git a/test/core/loop.wast b/test/core/loop.wast index 16f849b1..9141d00e 100644 --- a/test/core/loop.wast +++ b/test/core/loop.wast @@ -1,6 +1,8 @@ ;; Test `loop` opcode (module + (memory 1) + (func $dummy) (func (export "empty") @@ -10,55 +12,180 @@ (func (export "singular") (result i32) (loop (nop)) - (loop i32 (i32.const 7)) + (loop (result i32) (i32.const 7)) ) (func (export "multi") (result i32) (loop (call $dummy) (call $dummy) (call $dummy) (call $dummy)) - (loop i32 (call $dummy) (call $dummy) (call $dummy) (i32.const 8)) + (loop (result i32) (call $dummy) (call $dummy) (call $dummy) (i32.const 8)) ) (func (export "nested") (result i32) - (loop i32 + (loop (result i32) (loop (call $dummy) (block) (nop)) - (loop i32 (call $dummy) (i32.const 9)) + (loop (result i32) (call $dummy) (i32.const 9)) ) ) (func (export "deep") (result i32) - (loop i32 (block i32 (loop i32 (block i32 (loop i32 (block i32 - (loop i32 (block i32 (loop i32 (block i32 (loop i32 (block i32 - (loop i32 (block i32 (loop i32 (block i32 (loop i32 (block i32 - (loop i32 (block i32 (loop i32 (block i32 (loop i32 (block i32 - (loop i32 (block i32 (loop i32 (block i32 (loop i32 (block i32 - (loop i32 (block i32 (loop i32 (block i32 (loop i32 (block i32 - (loop i32 (block i32 (loop i32 (block i32 (loop i32 (block i32 - (loop i32 (block i32 (call $dummy) (i32.const 150))) - )))))) - )))))) - )))))) - )))))) - )))))) - )))))) - )))))) + (loop (result i32) (block (result i32) + (loop (result i32) (block (result i32) + (loop (result i32) (block (result i32) + (loop (result i32) (block (result i32) + (loop (result i32) (block (result i32) + (loop (result i32) (block (result i32) + (loop (result i32) (block (result i32) + (loop (result i32) (block (result i32) + (loop (result i32) (block (result i32) + (loop (result i32) (block (result i32) + (loop (result i32) (block (result i32) + (loop (result i32) (block (result i32) + (loop (result i32) (block (result i32) + (loop (result i32) (block (result i32) + (loop (result i32) (block (result i32) + (loop (result i32) (block (result i32) + (loop (result i32) (block (result i32) + (loop (result i32) (block (result i32) + (loop (result i32) (block (result i32) + (loop (result i32) (block (result i32) + (call $dummy) (i32.const 150) + )) + )) + )) + )) + )) + )) + )) + )) + )) + )) + )) + )) + )) + )) + )) + )) + )) + )) + )) + )) + ) + + (func (export "as-select-first") (result i32) + (select (loop (result i32) (i32.const 1)) (i32.const 2) (i32.const 3)) + ) + (func (export "as-select-mid") (result i32) + (select (i32.const 2) (loop (result i32) (i32.const 1)) (i32.const 3)) + ) + (func (export "as-select-last") (result i32) + (select (i32.const 2) (i32.const 3) (loop (result i32) (i32.const 1))) + ) + + (func (export "as-if-condition") + (loop (result i32) (i32.const 1)) (if (then (call $dummy))) + ) + (func (export "as-if-then") (result i32) + (if (result i32) (i32.const 1) (then (loop (result i32) (i32.const 1))) (else (i32.const 2))) + ) + (func (export "as-if-else") (result i32) + (if (result i32) (i32.const 1) (then (i32.const 2)) (else (loop (result i32) (i32.const 1)))) + ) + + (func (export "as-br_if-first") (result i32) + (block (result i32) (br_if 0 (loop (result i32) (i32.const 1)) (i32.const 2))) + ) + (func (export "as-br_if-last") (result i32) + (block (result i32) (br_if 0 (i32.const 2) (loop (result i32) (i32.const 1)))) + ) + + (func (export "as-br_table-first") (result i32) + (block (result i32) (loop (result i32) (i32.const 1)) (i32.const 2) (br_table 0 0)) + ) + (func (export "as-br_table-last") (result i32) + (block (result i32) (i32.const 2) (loop (result i32) (i32.const 1)) (br_table 0 0)) + ) + + (func $func (param i32 i32) (result i32) (local.get 0)) + (type $check (func (param i32 i32) (result i32))) + (table funcref (elem $func)) + (func (export "as-call_indirect-first") (result i32) + (block (result i32) + (call_indirect (type $check) + (loop (result i32) (i32.const 1)) (i32.const 2) (i32.const 0) + ) + ) + ) + (func (export "as-call_indirect-mid") (result i32) + (block (result i32) + (call_indirect (type $check) + (i32.const 2) (loop (result i32) (i32.const 1)) (i32.const 0) + ) + ) + ) + (func (export "as-call_indirect-last") (result i32) + (block (result i32) + (call_indirect (type $check) + (i32.const 1) (i32.const 2) (loop (result i32) (i32.const 0)) + ) + ) + ) + + (func (export "as-store-first") + (loop (result i32) (i32.const 1)) (i32.const 1) (i32.store) + ) + (func (export "as-store-last") + (i32.const 10) (loop (result i32) (i32.const 1)) (i32.store) + ) + + (func (export "as-memory.grow-value") (result i32) + (memory.grow (loop (result i32) (i32.const 1))) + ) + + (func $f (param i32) (result i32) (local.get 0)) + + (func (export "as-call-value") (result i32) + (call $f (loop (result i32) (i32.const 1))) + ) + (func (export "as-return-value") (result i32) + (loop (result i32) (i32.const 1)) (return) + ) + (func (export "as-drop-operand") + (drop (loop (result i32) (i32.const 1))) + ) + (func (export "as-br-value") (result i32) + (block (result i32) (br 0 (loop (result i32) (i32.const 1)))) + ) + (func (export "as-local.set-value") (result i32) + (local i32) (local.set 0 (loop (result i32) (i32.const 1))) (local.get 0) + ) + (func (export "as-local.tee-value") (result i32) + (local i32) (local.tee 0 (loop (result i32) (i32.const 1))) + ) + (global $a (mut i32) (i32.const 0)) + (func (export "as-global.set-value") (result i32) + (global.set $a (loop (result i32) (i32.const 1))) + (global.get $a) + ) + (func (export "as-load-operand") (result i32) + (i32.load (loop (result i32) (i32.const 1))) ) (func (export "as-unary-operand") (result i32) - (i32.ctz (loop i32 (call $dummy) (i32.const 13))) + (i32.ctz (loop (result i32) (call $dummy) (i32.const 13))) ) (func (export "as-binary-operand") (result i32) (i32.mul - (loop i32 (call $dummy) (i32.const 3)) - (loop i32 (call $dummy) (i32.const 4)) + (loop (result i32) (call $dummy) (i32.const 3)) + (loop (result i32) (call $dummy) (i32.const 4)) ) ) (func (export "as-test-operand") (result i32) - (i32.eqz (loop i32 (call $dummy) (i32.const 13))) + (i32.eqz (loop (result i32) (call $dummy) (i32.const 13))) ) (func (export "as-compare-operand") (result i32) (f32.gt - (loop f32 (call $dummy) (f32.const 3)) - (loop f32 (call $dummy) (f32.const 3)) + (loop (result f32) (call $dummy) (f32.const 3)) + (loop (result f32) (call $dummy) (f32.const 3)) ) ) @@ -70,11 +197,13 @@ (i32.const 19) ) (func (export "break-value") (result i32) - (block i32 (loop i32 (br 1 (i32.const 18)) (br 0) (i32.const 19))) + (block (result i32) + (loop (result i32) (br 1 (i32.const 18)) (br 0) (i32.const 19)) + ) ) (func (export "break-repeated") (result i32) - (block i32 - (loop i32 + (block (result i32) + (loop (result i32) (br 1 (i32.const 18)) (br 1 (i32.const 19)) (drop (br_if 1 (i32.const 20) (i32.const 0))) @@ -88,88 +217,88 @@ ) (func (export "break-inner") (result i32) (local i32) - (set_local 0 (i32.const 0)) - (set_local 0 (i32.add (get_local 0) (block i32 (loop i32 (block i32 (br 2 (i32.const 0x1))))))) - (set_local 0 (i32.add (get_local 0) (block i32 (loop i32 (loop i32 (br 2 (i32.const 0x2))))))) - (set_local 0 (i32.add (get_local 0) (block i32 (loop i32 (block i32 (loop i32 (br 1 (i32.const 0x4)))))))) - (set_local 0 (i32.add (get_local 0) (block i32 (loop i32 (i32.ctz (br 1 (i32.const 0x8))))))) - (set_local 0 (i32.add (get_local 0) (block i32 (loop i32 (i32.ctz (loop i32 (br 2 (i32.const 0x10)))))))) - (get_local 0) + (local.set 0 (i32.const 0)) + (local.set 0 (i32.add (local.get 0) (block (result i32) (loop (result i32) (block (result i32) (br 2 (i32.const 0x1))))))) + (local.set 0 (i32.add (local.get 0) (block (result i32) (loop (result i32) (loop (result i32) (br 2 (i32.const 0x2))))))) + (local.set 0 (i32.add (local.get 0) (block (result i32) (loop (result i32) (block (result i32) (loop (result i32) (br 1 (i32.const 0x4)))))))) + (local.set 0 (i32.add (local.get 0) (block (result i32) (loop (result i32) (i32.ctz (br 1 (i32.const 0x8))))))) + (local.set 0 (i32.add (local.get 0) (block (result i32) (loop (result i32) (i32.ctz (loop (result i32) (br 2 (i32.const 0x10)))))))) + (local.get 0) ) (func (export "cont-inner") (result i32) (local i32) - (set_local 0 (i32.const 0)) - (set_local 0 (i32.add (get_local 0) (loop i32 (loop i32 (br 1))))) - (set_local 0 (i32.add (get_local 0) (loop i32 (i32.ctz (br 0))))) - (set_local 0 (i32.add (get_local 0) (loop i32 (i32.ctz (loop i32 (br 1)))))) - (get_local 0) + (local.set 0 (i32.const 0)) + (local.set 0 (i32.add (local.get 0) (loop (result i32) (loop (result i32) (br 1))))) + (local.set 0 (i32.add (local.get 0) (loop (result i32) (i32.ctz (br 0))))) + (local.set 0 (i32.add (local.get 0) (loop (result i32) (i32.ctz (loop (result i32) (br 1)))))) + (local.get 0) ) (func $fx (export "effects") (result i32) (local i32) (block (loop - (set_local 0 (i32.const 1)) - (set_local 0 (i32.mul (get_local 0) (i32.const 3))) - (set_local 0 (i32.sub (get_local 0) (i32.const 5))) - (set_local 0 (i32.mul (get_local 0) (i32.const 7))) + (local.set 0 (i32.const 1)) + (local.set 0 (i32.mul (local.get 0) (i32.const 3))) + (local.set 0 (i32.sub (local.get 0) (i32.const 5))) + (local.set 0 (i32.mul (local.get 0) (i32.const 7))) (br 1) - (set_local 0 (i32.mul (get_local 0) (i32.const 100))) + (local.set 0 (i32.mul (local.get 0) (i32.const 100))) ) ) - (i32.eq (get_local 0) (i32.const -14)) + (i32.eq (local.get 0) (i32.const -14)) ) (func (export "while") (param i64) (result i64) (local i64) - (set_local 1 (i64.const 1)) + (local.set 1 (i64.const 1)) (block (loop - (br_if 1 (i64.eqz (get_local 0))) - (set_local 1 (i64.mul (get_local 0) (get_local 1))) - (set_local 0 (i64.sub (get_local 0) (i64.const 1))) + (br_if 1 (i64.eqz (local.get 0))) + (local.set 1 (i64.mul (local.get 0) (local.get 1))) + (local.set 0 (i64.sub (local.get 0) (i64.const 1))) (br 0) ) ) - (get_local 1) + (local.get 1) ) (func (export "for") (param i64) (result i64) (local i64 i64) - (set_local 1 (i64.const 1)) - (set_local 2 (i64.const 2)) + (local.set 1 (i64.const 1)) + (local.set 2 (i64.const 2)) (block (loop - (br_if 1 (i64.gt_u (get_local 2) (get_local 0))) - (set_local 1 (i64.mul (get_local 1) (get_local 2))) - (set_local 2 (i64.add (get_local 2) (i64.const 1))) + (br_if 1 (i64.gt_u (local.get 2) (local.get 0))) + (local.set 1 (i64.mul (local.get 1) (local.get 2))) + (local.set 2 (i64.add (local.get 2) (i64.const 1))) (br 0) ) ) - (get_local 1) + (local.get 1) ) (func (export "nesting") (param f32 f32) (result f32) (local f32 f32) (block (loop - (br_if 1 (f32.eq (get_local 0) (f32.const 0))) - (set_local 2 (get_local 1)) + (br_if 1 (f32.eq (local.get 0) (f32.const 0))) + (local.set 2 (local.get 1)) (block (loop - (br_if 1 (f32.eq (get_local 2) (f32.const 0))) - (br_if 3 (f32.lt (get_local 2) (f32.const 0))) - (set_local 3 (f32.add (get_local 3) (get_local 2))) - (set_local 2 (f32.sub (get_local 2) (f32.const 2))) + (br_if 1 (f32.eq (local.get 2) (f32.const 0))) + (br_if 3 (f32.lt (local.get 2) (f32.const 0))) + (local.set 3 (f32.add (local.get 3) (local.get 2))) + (local.set 2 (f32.sub (local.get 2) (f32.const 2))) (br 0) ) ) - (set_local 3 (f32.div (get_local 3) (get_local 0))) - (set_local 0 (f32.sub (get_local 0) (f32.const 1))) + (local.set 3 (f32.div (local.get 3) (local.get 0))) + (local.set 0 (f32.sub (local.get 0) (f32.const 1))) (br 0) ) ) - (get_local 3) + (local.get 3) ) ) @@ -179,6 +308,37 @@ (assert_return (invoke "nested") (i32.const 9)) (assert_return (invoke "deep") (i32.const 150)) +(assert_return (invoke "as-select-first") (i32.const 1)) +(assert_return (invoke "as-select-mid") (i32.const 2)) +(assert_return (invoke "as-select-last") (i32.const 2)) + +(assert_return (invoke "as-if-condition")) +(assert_return (invoke "as-if-then") (i32.const 1)) +(assert_return (invoke "as-if-else") (i32.const 2)) + +(assert_return (invoke "as-br_if-first") (i32.const 1)) +(assert_return (invoke "as-br_if-last") (i32.const 2)) + +(assert_return (invoke "as-br_table-first") (i32.const 1)) +(assert_return (invoke "as-br_table-last") (i32.const 2)) + +(assert_return (invoke "as-call_indirect-first") (i32.const 1)) +(assert_return (invoke "as-call_indirect-mid") (i32.const 2)) +(assert_return (invoke "as-call_indirect-last") (i32.const 1)) + +(assert_return (invoke "as-store-first")) +(assert_return (invoke "as-store-last")) + +(assert_return (invoke "as-memory.grow-value") (i32.const 1)) +(assert_return (invoke "as-call-value") (i32.const 1)) +(assert_return (invoke "as-return-value") (i32.const 1)) +(assert_return (invoke "as-drop-operand")) +(assert_return (invoke "as-br-value") (i32.const 1)) +(assert_return (invoke "as-local.set-value") (i32.const 1)) +(assert_return (invoke "as-local.tee-value") (i32.const 1)) +(assert_return (invoke "as-global.set-value") (i32.const 1)) +(assert_return (invoke "as-load-operand") (i32.const 1)) + (assert_return (invoke "as-unary-operand") (i32.const 0)) (assert_return (invoke "as-binary-operand") (i32.const 12)) (assert_return (invoke "as-test-operand") (i32.const 0)) @@ -247,25 +407,63 @@ ) (assert_invalid (module (func $type-value-empty-vs-num (result i32) - (loop i32) + (loop (result i32)) )) "type mismatch" ) (assert_invalid (module (func $type-value-void-vs-num (result i32) - (loop i32 (nop)) + (loop (result i32) (nop)) )) "type mismatch" ) (assert_invalid (module (func $type-value-num-vs-num (result i32) - (loop i32 (f32.const 0)) + (loop (result i32) (f32.const 0)) )) "type mismatch" ) (assert_invalid (module (func $type-value-unreached-select (result i32) - (loop i64 (select (unreachable) (unreachable) (unreachable))) + (loop (result i64) (select (unreachable) (unreachable) (unreachable))) )) "type mismatch" ) + +(assert_invalid + (module + (func $type-value-empty-in-block + (i32.const 0) + (block (loop (result i32)) (drop)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-value-empty-in-loop + (i32.const 0) + (loop (loop (result i32)) (drop)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-value-empty-in-then + (i32.const 0) (i32.const 0) + (if (then (loop (result i32)) (drop))) + ) + ) + "type mismatch" +) + + +(assert_malformed + (module quote "(func loop end $l)") + "mismatching label" +) +(assert_malformed + (module quote "(func loop $a end $l)") + "mismatching label" +) diff --git a/test/core/memory.wast b/test/core/memory.wast index 4539970c..3c426450 100644 --- a/test/core/memory.wast +++ b/test/core/memory.wast @@ -1,29 +1,18 @@ ;; Test memory section structure + (module (memory 0 0)) (module (memory 0 1)) (module (memory 1 256)) (module (memory 0 65536)) -(module (memory 0 0) (data (i32.const 0))) -(module (memory 0 0) (data (i32.const 0) "")) -(module (memory 1 1) (data (i32.const 0) "a")) -(module (memory 1 2) (data (i32.const 0) "a") (data (i32.const 65535) "b")) -(module (memory 1 2) - (data (i32.const 0) "a") (data (i32.const 1) "b") (data (i32.const 2) "c") -) -(module (global (import "spectest" "global") i32) (memory 1) (data (get_global 0) "a")) -(module (global $g (import "spectest" "global") i32) (memory 1) (data (get_global $g) "a")) -;; Use of internal globals in constant expressions is not allowed in MVP. -;; (module (memory 1) (data (get_global 0) "a") (global i32 (i32.const 0))) -;; (module (memory 1) (data (get_global $g) "a") (global $g i32 (i32.const 0))) (assert_invalid (module (memory 0) (memory 0)) "multiple memories") (assert_invalid (module (memory (import "spectest" "memory") 0) (memory 0)) "multiple memories") -(module (memory (data)) (func (export "memsize") (result i32) (current_memory))) +(module (memory (data)) (func (export "memsize") (result i32) (memory.size))) (assert_return (invoke "memsize") (i32.const 0)) -(module (memory (data "")) (func (export "memsize") (result i32) (current_memory))) +(module (memory (data "")) (func (export "memsize") (result i32) (memory.size))) (assert_return (invoke "memsize") (i32.const 0)) -(module (memory (data "x")) (func (export "memsize") (result i32) (current_memory))) +(module (memory (data "x")) (func (export "memsize") (result i32) (memory.size))) (assert_return (invoke "memsize") (i32.const 1)) (assert_invalid (module (data (i32.const 0))) "unknown memory") @@ -35,7 +24,7 @@ "unknown memory" ) (assert_invalid - (module (func (f32.store (f32.const 0) (i32.const 0)))) + (module (func (f32.store (i32.const 0) (f32.const 0)))) "unknown memory" ) (assert_invalid @@ -47,89 +36,18 @@ "unknown memory" ) (assert_invalid - (module (func (drop (current_memory)))) + (module (func (drop (memory.size)))) "unknown memory" ) (assert_invalid - (module (func (drop (grow_memory (i32.const 0))))) + (module (func (drop (memory.grow (i32.const 0))))) "unknown memory" ) -(assert_invalid - (module (memory 1) (data (i64.const 0))) - "type mismatch" -) -(assert_invalid - (module (memory 1) (data (i32.ctz (i32.const 0)))) - "constant expression required" -) -(assert_invalid - (module (memory 1) (data (nop))) - "constant expression required" -) -;; Use of internal globals in constant expressions is not allowed in MVP. -;; (assert_invalid -;; (module (memory 1) (data (get_global $g)) (global $g (mut i32) (i32.const 0))) -;; "constant expression required" -;; ) - -(assert_unlinkable - (module (memory 0 0) (data (i32.const 0) "a")) - "data segment does not fit" -) -(assert_unlinkable - (module (memory 0 1) (data (i32.const 0) "a")) - "data segment does not fit" -) -(assert_unlinkable - (module (memory 1 2) (data (i32.const -1) "a")) - "data segment does not fit" -) -(assert_unlinkable - (module (memory 1 2) (data (i32.const -1000) "a")) - "data segment does not fit" -) -(assert_unlinkable - (module (memory 1 2) (data (i32.const 0) "a") (data (i32.const 98304) "b")) - "data segment does not fit" -) -(assert_unlinkable - (module (memory 0 0) (data (i32.const 1) "")) - "data segment does not fit" -) -(assert_unlinkable - (module (memory 1) (data (i32.const 0x12000) "")) - "data segment does not fit" -) -(assert_unlinkable - (module (memory 1 2) (data (i32.const -1) "")) - "data segment does not fit" -) -;; This seems to cause a time-out on Travis. -(;assert_unlinkable - (module (memory 0x10000) (data (i32.const 0xffffffff) "ab")) - "" ;; either out of memory or segment does not fit -;) -(assert_unlinkable - (module - (global (import "spectest" "global") i32) - (memory 0) (data (get_global 0) "a") - ) - "data segment does not fit" -) - -(module (memory 0 0) (data (i32.const 0) "")) -(module (memory 1 1) (data (i32.const 0x10000) "")) -(module (memory 1 2) (data (i32.const 0) "abc") (data (i32.const 0) "def")) -(module (memory 1 2) (data (i32.const 3) "ab") (data (i32.const 0) "de")) -(module - (memory 1 2) - (data (i32.const 0) "a") (data (i32.const 2) "b") (data (i32.const 1) "c") -) (assert_invalid (module (memory 1 0)) - "memory size minimum must not be greater than maximum" + "size minimum must not be greater than maximum" ) (assert_invalid (module (memory 65537)) @@ -156,49 +74,6 @@ "memory size must be at most 65536 pages (4GiB)" ) -;; Test alignment annotation rules -(module (memory 0) (func (drop (i32.load8_u align=1 (i32.const 0))))) -(module (memory 0) (func (drop (i32.load16_u align=2 (i32.const 0))))) -(module (memory 0) (func (drop (i32.load align=4 (i32.const 0))))) -(module (memory 0) (func (drop (f32.load align=4 (i32.const 0))))) - -(assert_invalid - (module (memory 0) (func (drop (i64.load align=16 (i32.const 0))))) - "alignment must not be larger than natural" -) -(assert_invalid - (module (memory 0) (func (drop (i64.load align=32 (i32.const 0))))) - "alignment must not be larger than natural" -) -(assert_invalid - (module (memory 0) (func (drop (i32.load align=8 (i32.const 0))))) - "alignment must not be larger than natural" -) -(assert_invalid - (module (memory 0) (func (drop (i32.load16_u align=4 (i32.const 0))))) - "alignment must not be larger than natural" -) -(assert_invalid - (module (memory 0) (func (drop (i32.load8_u align=2 (i32.const 0))))) - "alignment must not be larger than natural" -) -(assert_invalid - (module (memory 0) (func (i32.store8 align=2 (i32.const 0) (i32.const 0)))) - "alignment must not be larger than natural" -) -(assert_invalid - (module (memory 0) (func (i32.load16_u align=4 (i32.const 0)))) - "alignment must not be larger than natural" -) -(assert_invalid - (module (memory 0) (func (i32.load8_u align=2 (i32.const 0)))) - "alignment must not be larger than natural" -) -(assert_invalid - (module (memory 0) (func (i32.store8 align=2 (i32.const 0) (i32.const 0)))) - "alignment must not be larger than natural" -) - (module (memory 1) (data (i32.const 0) "ABC\a7D") (data (i32.const 20) "WASM") @@ -229,63 +104,15 @@ ) ) - ;; Aligned read/write - (func (export "aligned") (result i32) - (local i32 i32 i32) - (set_local 0 (i32.const 10)) - (block - (loop - (if - (i32.eq (get_local 0) (i32.const 0)) - (br 2) - ) - (set_local 2 (i32.mul (get_local 0) (i32.const 4))) - (i32.store (get_local 2) (get_local 0)) - (set_local 1 (i32.load (get_local 2))) - (if - (i32.ne (get_local 0) (get_local 1)) - (return (i32.const 0)) - ) - (set_local 0 (i32.sub (get_local 0) (i32.const 1))) - (br 0) - ) - ) - (i32.const 1) - ) - - ;; Unaligned read/write - (func (export "unaligned") (result i32) - (local i32 f64 f64) - (set_local 0 (i32.const 10)) - (block - (loop - (if - (i32.eq (get_local 0) (i32.const 0)) - (br 2) - ) - (set_local 2 (f64.convert_s/i32 (get_local 0))) - (f64.store align=1 (get_local 0) (get_local 2)) - (set_local 1 (f64.load align=1 (get_local 0))) - (if - (f64.ne (get_local 2) (get_local 1)) - (return (i32.const 0)) - ) - (set_local 0 (i32.sub (get_local 0) (i32.const 1))) - (br 0) - ) - ) - (i32.const 1) - ) - ;; Memory cast (func (export "cast") (result f64) (i64.store (i32.const 8) (i64.const -12345)) (if (f64.eq (f64.load (i32.const 8)) - (f64.reinterpret/i64 (i64.const -12345)) + (f64.reinterpret_i64 (i64.const -12345)) ) - (return (f64.const 0)) + (then (return (f64.const 0))) ) (i64.store align=1 (i32.const 9) (i64.const 0)) (i32.store16 align=1 (i32.const 15) (i32.const 16453)) @@ -294,50 +121,48 @@ ;; Sign and zero extending memory loads (func (export "i32_load8_s") (param $i i32) (result i32) - (i32.store8 (i32.const 8) (get_local $i)) + (i32.store8 (i32.const 8) (local.get $i)) (i32.load8_s (i32.const 8)) ) (func (export "i32_load8_u") (param $i i32) (result i32) - (i32.store8 (i32.const 8) (get_local $i)) + (i32.store8 (i32.const 8) (local.get $i)) (i32.load8_u (i32.const 8)) ) (func (export "i32_load16_s") (param $i i32) (result i32) - (i32.store16 (i32.const 8) (get_local $i)) + (i32.store16 (i32.const 8) (local.get $i)) (i32.load16_s (i32.const 8)) ) (func (export "i32_load16_u") (param $i i32) (result i32) - (i32.store16 (i32.const 8) (get_local $i)) + (i32.store16 (i32.const 8) (local.get $i)) (i32.load16_u (i32.const 8)) ) (func (export "i64_load8_s") (param $i i64) (result i64) - (i64.store8 (i32.const 8) (get_local $i)) + (i64.store8 (i32.const 8) (local.get $i)) (i64.load8_s (i32.const 8)) ) (func (export "i64_load8_u") (param $i i64) (result i64) - (i64.store8 (i32.const 8) (get_local $i)) + (i64.store8 (i32.const 8) (local.get $i)) (i64.load8_u (i32.const 8)) ) (func (export "i64_load16_s") (param $i i64) (result i64) - (i64.store16 (i32.const 8) (get_local $i)) + (i64.store16 (i32.const 8) (local.get $i)) (i64.load16_s (i32.const 8)) ) (func (export "i64_load16_u") (param $i i64) (result i64) - (i64.store16 (i32.const 8) (get_local $i)) + (i64.store16 (i32.const 8) (local.get $i)) (i64.load16_u (i32.const 8)) ) (func (export "i64_load32_s") (param $i i64) (result i64) - (i64.store32 (i32.const 8) (get_local $i)) + (i64.store32 (i32.const 8) (local.get $i)) (i64.load32_s (i32.const 8)) ) (func (export "i64_load32_u") (param $i i64) (result i64) - (i64.store32 (i32.const 8) (get_local $i)) + (i64.store32 (i32.const 8) (local.get $i)) (i64.load32_u (i32.const 8)) ) ) (assert_return (invoke "data") (i32.const 1)) -(assert_return (invoke "aligned") (i32.const 1)) -(assert_return (invoke "unaligned") (i32.const 1)) (assert_return (invoke "cast") (f64.const 42.0)) (assert_return (invoke "i32_load8_s" (i32.const -1)) (i32.const -1)) diff --git a/test/core/memory_grow.wast b/test/core/memory_grow.wast new file mode 100644 index 00000000..aa56297d --- /dev/null +++ b/test/core/memory_grow.wast @@ -0,0 +1,379 @@ +(module + (memory 0) + + (func (export "load_at_zero") (result i32) (i32.load (i32.const 0))) + (func (export "store_at_zero") (i32.store (i32.const 0) (i32.const 2))) + + (func (export "load_at_page_size") (result i32) (i32.load (i32.const 0x10000))) + (func (export "store_at_page_size") (i32.store (i32.const 0x10000) (i32.const 3))) + + (func (export "grow") (param $sz i32) (result i32) (memory.grow (local.get $sz))) + (func (export "size") (result i32) (memory.size)) +) + +(assert_return (invoke "size") (i32.const 0)) +(assert_trap (invoke "store_at_zero") "out of bounds memory access") +(assert_trap (invoke "load_at_zero") "out of bounds memory access") +(assert_trap (invoke "store_at_page_size") "out of bounds memory access") +(assert_trap (invoke "load_at_page_size") "out of bounds memory access") +(assert_return (invoke "grow" (i32.const 1)) (i32.const 0)) +(assert_return (invoke "size") (i32.const 1)) +(assert_return (invoke "load_at_zero") (i32.const 0)) +(assert_return (invoke "store_at_zero")) +(assert_return (invoke "load_at_zero") (i32.const 2)) +(assert_trap (invoke "store_at_page_size") "out of bounds memory access") +(assert_trap (invoke "load_at_page_size") "out of bounds memory access") +(assert_return (invoke "grow" (i32.const 4)) (i32.const 1)) +(assert_return (invoke "size") (i32.const 5)) +(assert_return (invoke "load_at_zero") (i32.const 2)) +(assert_return (invoke "store_at_zero")) +(assert_return (invoke "load_at_zero") (i32.const 2)) +(assert_return (invoke "load_at_page_size") (i32.const 0)) +(assert_return (invoke "store_at_page_size")) +(assert_return (invoke "load_at_page_size") (i32.const 3)) + + +(module + (memory 0) + (func (export "grow") (param i32) (result i32) (memory.grow (local.get 0))) +) + +(assert_return (invoke "grow" (i32.const 0)) (i32.const 0)) +(assert_return (invoke "grow" (i32.const 1)) (i32.const 0)) +(assert_return (invoke "grow" (i32.const 0)) (i32.const 1)) +(assert_return (invoke "grow" (i32.const 2)) (i32.const 1)) +(assert_return (invoke "grow" (i32.const 800)) (i32.const 3)) +(assert_return (invoke "grow" (i32.const 0x10000)) (i32.const -1)) +(assert_return (invoke "grow" (i32.const 64736)) (i32.const -1)) +(assert_return (invoke "grow" (i32.const 1)) (i32.const 803)) + +(module + (memory 0 10) + (func (export "grow") (param i32) (result i32) (memory.grow (local.get 0))) +) + +(assert_return (invoke "grow" (i32.const 0)) (i32.const 0)) +(assert_return (invoke "grow" (i32.const 1)) (i32.const 0)) +(assert_return (invoke "grow" (i32.const 1)) (i32.const 1)) +(assert_return (invoke "grow" (i32.const 2)) (i32.const 2)) +(assert_return (invoke "grow" (i32.const 6)) (i32.const 4)) +(assert_return (invoke "grow" (i32.const 0)) (i32.const 10)) +(assert_return (invoke "grow" (i32.const 1)) (i32.const -1)) +(assert_return (invoke "grow" (i32.const 0x10000)) (i32.const -1)) + +;; Test that newly allocated memory (program start and memory.grow) is zeroed + +(module + (memory 1) + (func (export "grow") (param i32) (result i32) + (memory.grow (local.get 0)) + ) + (func (export "check-memory-zero") (param i32 i32) (result i32) + (local i32) + (local.set 2 (i32.const 1)) + (block + (loop + (local.set 2 (i32.load8_u (local.get 0))) + (br_if 1 (i32.ne (local.get 2) (i32.const 0))) + (br_if 1 (i32.ge_u (local.get 0) (local.get 1))) + (local.set 0 (i32.add (local.get 0) (i32.const 1))) + (br_if 0 (i32.le_u (local.get 0) (local.get 1))) + ) + ) + (local.get 2) + ) +) + +(assert_return (invoke "check-memory-zero" (i32.const 0) (i32.const 0xffff)) (i32.const 0)) +(assert_return (invoke "grow" (i32.const 1)) (i32.const 1)) +(assert_return (invoke "check-memory-zero" (i32.const 0x10000) (i32.const 0x1_ffff)) (i32.const 0)) +(assert_return (invoke "grow" (i32.const 1)) (i32.const 2)) +(assert_return (invoke "check-memory-zero" (i32.const 0x20000) (i32.const 0x2_ffff)) (i32.const 0)) +(assert_return (invoke "grow" (i32.const 1)) (i32.const 3)) +(assert_return (invoke "check-memory-zero" (i32.const 0x30000) (i32.const 0x3_ffff)) (i32.const 0)) +(assert_return (invoke "grow" (i32.const 1)) (i32.const 4)) +(assert_return (invoke "check-memory-zero" (i32.const 0x40000) (i32.const 0x4_ffff)) (i32.const 0)) +(assert_return (invoke "grow" (i32.const 1)) (i32.const 5)) +(assert_return (invoke "check-memory-zero" (i32.const 0x50000) (i32.const 0x5_ffff)) (i32.const 0)) + +;; As the argument of control constructs and instructions + +(module + (memory 1) + + (func (export "as-br-value") (result i32) + (block (result i32) (br 0 (memory.grow (i32.const 0)))) + ) + + (func (export "as-br_if-cond") + (block (br_if 0 (memory.grow (i32.const 0)))) + ) + (func (export "as-br_if-value") (result i32) + (block (result i32) + (drop (br_if 0 (memory.grow (i32.const 0)) (i32.const 1))) (i32.const 7) + ) + ) + (func (export "as-br_if-value-cond") (result i32) + (block (result i32) + (drop (br_if 0 (i32.const 6) (memory.grow (i32.const 0)))) (i32.const 7) + ) + ) + + (func (export "as-br_table-index") + (block (br_table 0 0 0 (memory.grow (i32.const 0)))) + ) + (func (export "as-br_table-value") (result i32) + (block (result i32) + (br_table 0 0 0 (memory.grow (i32.const 0)) (i32.const 1)) (i32.const 7) + ) + ) + (func (export "as-br_table-value-index") (result i32) + (block (result i32) + (br_table 0 0 (i32.const 6) (memory.grow (i32.const 0))) (i32.const 7) + ) + ) + + (func (export "as-return-value") (result i32) + (return (memory.grow (i32.const 0))) + ) + + (func (export "as-if-cond") (result i32) + (if (result i32) (memory.grow (i32.const 0)) + (then (i32.const 0)) (else (i32.const 1)) + ) + ) + (func (export "as-if-then") (result i32) + (if (result i32) (i32.const 1) + (then (memory.grow (i32.const 0))) (else (i32.const 0)) + ) + ) + (func (export "as-if-else") (result i32) + (if (result i32) (i32.const 0) + (then (i32.const 0)) (else (memory.grow (i32.const 0))) + ) + ) + + (func (export "as-select-first") (param i32 i32) (result i32) + (select (memory.grow (i32.const 0)) (local.get 0) (local.get 1)) + ) + (func (export "as-select-second") (param i32 i32) (result i32) + (select (local.get 0) (memory.grow (i32.const 0)) (local.get 1)) + ) + (func (export "as-select-cond") (result i32) + (select (i32.const 0) (i32.const 1) (memory.grow (i32.const 0))) + ) + + (func $f (param i32 i32 i32) (result i32) (i32.const -1)) + (func (export "as-call-first") (result i32) + (call $f (memory.grow (i32.const 0)) (i32.const 2) (i32.const 3)) + ) + (func (export "as-call-mid") (result i32) + (call $f (i32.const 1) (memory.grow (i32.const 0)) (i32.const 3)) + ) + (func (export "as-call-last") (result i32) + (call $f (i32.const 1) (i32.const 2) (memory.grow (i32.const 0))) + ) + + (type $sig (func (param i32 i32 i32) (result i32))) + (table funcref (elem $f)) + (func (export "as-call_indirect-first") (result i32) + (call_indirect (type $sig) + (memory.grow (i32.const 0)) (i32.const 2) (i32.const 3) (i32.const 0) + ) + ) + (func (export "as-call_indirect-mid") (result i32) + (call_indirect (type $sig) + (i32.const 1) (memory.grow (i32.const 0)) (i32.const 3) (i32.const 0) + ) + ) + (func (export "as-call_indirect-last") (result i32) + (call_indirect (type $sig) + (i32.const 1) (i32.const 2) (memory.grow (i32.const 0)) (i32.const 0) + ) + ) + (func (export "as-call_indirect-index") (result i32) + (call_indirect (type $sig) + (i32.const 1) (i32.const 2) (i32.const 3) (memory.grow (i32.const 0)) + ) + ) + + (func (export "as-local.set-value") (local i32) + (local.set 0 (memory.grow (i32.const 0))) + ) + (func (export "as-local.tee-value") (result i32) (local i32) + (local.tee 0 (memory.grow (i32.const 0))) + ) + (global $g (mut i32) (i32.const 0)) + (func (export "as-global.set-value") (local i32) + (global.set $g (memory.grow (i32.const 0))) + ) + + (func (export "as-load-address") (result i32) + (i32.load (memory.grow (i32.const 0))) + ) + (func (export "as-loadN-address") (result i32) + (i32.load8_s (memory.grow (i32.const 0))) + ) + + (func (export "as-store-address") + (i32.store (memory.grow (i32.const 0)) (i32.const 7)) + ) + (func (export "as-store-value") + (i32.store (i32.const 2) (memory.grow (i32.const 0))) + ) + + (func (export "as-storeN-address") + (i32.store8 (memory.grow (i32.const 0)) (i32.const 7)) + ) + (func (export "as-storeN-value") + (i32.store16 (i32.const 2) (memory.grow (i32.const 0))) + ) + + (func (export "as-unary-operand") (result i32) + (i32.clz (memory.grow (i32.const 0))) + ) + + (func (export "as-binary-left") (result i32) + (i32.add (memory.grow (i32.const 0)) (i32.const 10)) + ) + (func (export "as-binary-right") (result i32) + (i32.sub (i32.const 10) (memory.grow (i32.const 0))) + ) + + (func (export "as-test-operand") (result i32) + (i32.eqz (memory.grow (i32.const 0))) + ) + + (func (export "as-compare-left") (result i32) + (i32.le_s (memory.grow (i32.const 0)) (i32.const 10)) + ) + (func (export "as-compare-right") (result i32) + (i32.ne (i32.const 10) (memory.grow (i32.const 0))) + ) + + (func (export "as-memory.grow-size") (result i32) + (memory.grow (memory.grow (i32.const 0))) + ) +) + +(assert_return (invoke "as-br-value") (i32.const 1)) + +(assert_return (invoke "as-br_if-cond")) +(assert_return (invoke "as-br_if-value") (i32.const 1)) +(assert_return (invoke "as-br_if-value-cond") (i32.const 6)) + +(assert_return (invoke "as-br_table-index")) +(assert_return (invoke "as-br_table-value") (i32.const 1)) +(assert_return (invoke "as-br_table-value-index") (i32.const 6)) + +(assert_return (invoke "as-return-value") (i32.const 1)) + +(assert_return (invoke "as-if-cond") (i32.const 0)) +(assert_return (invoke "as-if-then") (i32.const 1)) +(assert_return (invoke "as-if-else") (i32.const 1)) + +(assert_return (invoke "as-select-first" (i32.const 0) (i32.const 1)) (i32.const 1)) +(assert_return (invoke "as-select-second" (i32.const 0) (i32.const 0)) (i32.const 1)) +(assert_return (invoke "as-select-cond") (i32.const 0)) + +(assert_return (invoke "as-call-first") (i32.const -1)) +(assert_return (invoke "as-call-mid") (i32.const -1)) +(assert_return (invoke "as-call-last") (i32.const -1)) + +(assert_return (invoke "as-call_indirect-first") (i32.const -1)) +(assert_return (invoke "as-call_indirect-mid") (i32.const -1)) +(assert_return (invoke "as-call_indirect-last") (i32.const -1)) +(assert_trap (invoke "as-call_indirect-index") "undefined element") + +(assert_return (invoke "as-local.set-value")) +(assert_return (invoke "as-local.tee-value") (i32.const 1)) +(assert_return (invoke "as-global.set-value")) + +(assert_return (invoke "as-load-address") (i32.const 0)) +(assert_return (invoke "as-loadN-address") (i32.const 0)) +(assert_return (invoke "as-store-address")) +(assert_return (invoke "as-store-value")) +(assert_return (invoke "as-storeN-address")) +(assert_return (invoke "as-storeN-value")) + +(assert_return (invoke "as-unary-operand") (i32.const 31)) + +(assert_return (invoke "as-binary-left") (i32.const 11)) +(assert_return (invoke "as-binary-right") (i32.const 9)) + +(assert_return (invoke "as-test-operand") (i32.const 0)) + +(assert_return (invoke "as-compare-left") (i32.const 1)) +(assert_return (invoke "as-compare-right") (i32.const 1)) + +(assert_return (invoke "as-memory.grow-size") (i32.const 1)) + + +(assert_invalid + (module + (memory 0) + (func $type-size-empty-vs-i32 (result i32) + (memory.grow) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 0) + (func $type-size-empty-vs-i32-in-block (result i32) + (i32.const 0) + (block (result i32) (memory.grow)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 0) + (func $type-size-empty-vs-i32-in-loop (result i32) + (i32.const 0) + (loop (result i32) (memory.grow)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 0) + (func $type-size-empty-vs-i32-in-then (result i32) + (i32.const 0) (i32.const 0) + (if (result i32) (then (memory.grow))) + ) + ) + "type mismatch" +) + +(assert_invalid + (module + (memory 1) + (func $type-size-f32-vs-i32 (result i32) + (memory.grow (f32.const 0)) + ) + ) + "type mismatch" +) + +(assert_invalid + (module + (memory 1) + (func $type-result-i32-vs-empty + (memory.grow (i32.const 0)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 1) + (func $type-result-i32-vs-f32 (result f32) + (memory.grow (i32.const 0)) + ) + ) + "type mismatch" +) diff --git a/test/core/memory_redundancy.wast b/test/core/memory_redundancy.wast index f16adc41..dd317311 100644 --- a/test/core/memory_redundancy.wast +++ b/test/core/memory_redundancy.wast @@ -21,18 +21,18 @@ (func (export "test_redundant_load") (result i32) (local $t i32) (local $s i32) - (set_local $t (i32.load (i32.const 8))) + (local.set $t (i32.load (i32.const 8))) (i32.store (i32.const 5) (i32.const 0x80000000)) - (set_local $s (i32.load (i32.const 8))) - (i32.add (get_local $t) (get_local $s)) + (local.set $s (i32.load (i32.const 8))) + (i32.add (local.get $t) (local.get $s)) ) (func (export "test_dead_store") (result f32) (local $t f32) (i32.store (i32.const 8) (i32.const 0x23232323)) - (set_local $t (f32.load (i32.const 11))) + (local.set $t (f32.load (i32.const 11))) (i32.store (i32.const 8) (i32.const 0)) - (get_local $t) + (local.get $t) ) ;; A function named "malloc" which implementations nonetheless shouldn't @@ -48,11 +48,11 @@ (result i32) (local $x i32) (local $y i32) - (set_local $x (call $malloc (i32.const 4))) - (set_local $y (call $malloc (i32.const 4))) - (i32.store (get_local $x) (i32.const 42)) - (i32.store (get_local $y) (i32.const 43)) - (i32.load (get_local $x)) + (local.set $x (call $malloc (i32.const 4))) + (local.set $y (call $malloc (i32.const 4))) + (i32.store (local.get $x) (i32.const 42)) + (i32.store (local.get $y) (i32.const 43)) + (i32.load (local.get $x)) ) ) diff --git a/test/core/memory_size.wast b/test/core/memory_size.wast new file mode 100644 index 00000000..239e66d8 --- /dev/null +++ b/test/core/memory_size.wast @@ -0,0 +1,85 @@ +(module + (memory 0) + (func (export "size") (result i32) (memory.size)) + (func (export "grow") (param $sz i32) (drop (memory.grow (local.get $sz)))) +) + +(assert_return (invoke "size") (i32.const 0)) +(assert_return (invoke "grow" (i32.const 1))) +(assert_return (invoke "size") (i32.const 1)) +(assert_return (invoke "grow" (i32.const 4))) +(assert_return (invoke "size") (i32.const 5)) +(assert_return (invoke "grow" (i32.const 0))) +(assert_return (invoke "size") (i32.const 5)) + +(module + (memory 1) + (func (export "size") (result i32) (memory.size)) + (func (export "grow") (param $sz i32) (drop (memory.grow (local.get $sz)))) +) + +(assert_return (invoke "size") (i32.const 1)) +(assert_return (invoke "grow" (i32.const 1))) +(assert_return (invoke "size") (i32.const 2)) +(assert_return (invoke "grow" (i32.const 4))) +(assert_return (invoke "size") (i32.const 6)) +(assert_return (invoke "grow" (i32.const 0))) +(assert_return (invoke "size") (i32.const 6)) + +(module + (memory 0 2) + (func (export "size") (result i32) (memory.size)) + (func (export "grow") (param $sz i32) (drop (memory.grow (local.get $sz)))) +) + +(assert_return (invoke "size") (i32.const 0)) +(assert_return (invoke "grow" (i32.const 3))) +(assert_return (invoke "size") (i32.const 0)) +(assert_return (invoke "grow" (i32.const 1))) +(assert_return (invoke "size") (i32.const 1)) +(assert_return (invoke "grow" (i32.const 0))) +(assert_return (invoke "size") (i32.const 1)) +(assert_return (invoke "grow" (i32.const 4))) +(assert_return (invoke "size") (i32.const 1)) +(assert_return (invoke "grow" (i32.const 1))) +(assert_return (invoke "size") (i32.const 2)) + +(module + (memory 3 8) + (func (export "size") (result i32) (memory.size)) + (func (export "grow") (param $sz i32) (drop (memory.grow (local.get $sz)))) +) + +(assert_return (invoke "size") (i32.const 3)) +(assert_return (invoke "grow" (i32.const 1))) +(assert_return (invoke "size") (i32.const 4)) +(assert_return (invoke "grow" (i32.const 3))) +(assert_return (invoke "size") (i32.const 7)) +(assert_return (invoke "grow" (i32.const 0))) +(assert_return (invoke "size") (i32.const 7)) +(assert_return (invoke "grow" (i32.const 2))) +(assert_return (invoke "size") (i32.const 7)) +(assert_return (invoke "grow" (i32.const 1))) +(assert_return (invoke "size") (i32.const 8)) + + +;; Type errors + +(assert_invalid + (module + (memory 1) + (func $type-result-i32-vs-empty + (memory.size) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 1) + (func $type-result-i32-vs-f32 (result f32) + (memory.size) + ) + ) + "type mismatch" +) diff --git a/test/core/memory_trap.wast b/test/core/memory_trap.wast index 5fd193de..a4156fe2 100644 --- a/test/core/memory_trap.wast +++ b/test/core/memory_trap.wast @@ -2,19 +2,19 @@ (memory 1) (func $addr_limit (result i32) - (i32.mul (current_memory) (i32.const 0x10000)) + (i32.mul (memory.size) (i32.const 0x10000)) ) (func (export "store") (param $i i32) (param $v i32) - (i32.store (i32.add (call $addr_limit) (get_local $i)) (get_local $v)) + (i32.store (i32.add (call $addr_limit) (local.get $i)) (local.get $v)) ) (func (export "load") (param $i i32) (result i32) - (i32.load (i32.add (call $addr_limit) (get_local $i))) + (i32.load (i32.add (call $addr_limit) (local.get $i))) ) - (func (export "grow_memory") (param i32) (result i32) - (grow_memory (get_local 0)) + (func (export "memory.grow") (param i32) (result i32) + (memory.grow (local.get 0)) ) ) @@ -30,7 +30,7 @@ (assert_trap (invoke "load" (i32.const 0)) "out of bounds memory access") (assert_trap (invoke "store" (i32.const 0x80000000) (i32.const 13)) "out of bounds memory access") (assert_trap (invoke "load" (i32.const 0x80000000)) "out of bounds memory access") -(assert_return (invoke "grow_memory" (i32.const 0x10001)) (i32.const -1)) +(assert_return (invoke "memory.grow" (i32.const 0x10001)) (i32.const -1)) (module (memory 1) @@ -38,73 +38,73 @@ (data (i32.const 0xfff8) "abcdefgh") (func (export "i32.load") (param $a i32) (result i32) - (i32.load (get_local $a)) + (i32.load (local.get $a)) ) (func (export "i64.load") (param $a i32) (result i64) - (i64.load (get_local $a)) + (i64.load (local.get $a)) ) (func (export "f32.load") (param $a i32) (result f32) - (f32.load (get_local $a)) + (f32.load (local.get $a)) ) (func (export "f64.load") (param $a i32) (result f64) - (f64.load (get_local $a)) + (f64.load (local.get $a)) ) (func (export "i32.load8_s") (param $a i32) (result i32) - (i32.load8_s (get_local $a)) + (i32.load8_s (local.get $a)) ) (func (export "i32.load8_u") (param $a i32) (result i32) - (i32.load8_u (get_local $a)) + (i32.load8_u (local.get $a)) ) (func (export "i32.load16_s") (param $a i32) (result i32) - (i32.load16_s (get_local $a)) + (i32.load16_s (local.get $a)) ) (func (export "i32.load16_u") (param $a i32) (result i32) - (i32.load16_u (get_local $a)) + (i32.load16_u (local.get $a)) ) (func (export "i64.load8_s") (param $a i32) (result i64) - (i64.load8_s (get_local $a)) + (i64.load8_s (local.get $a)) ) (func (export "i64.load8_u") (param $a i32) (result i64) - (i64.load8_u (get_local $a)) + (i64.load8_u (local.get $a)) ) (func (export "i64.load16_s") (param $a i32) (result i64) - (i64.load16_s (get_local $a)) + (i64.load16_s (local.get $a)) ) (func (export "i64.load16_u") (param $a i32) (result i64) - (i64.load16_u (get_local $a)) + (i64.load16_u (local.get $a)) ) (func (export "i64.load32_s") (param $a i32) (result i64) - (i64.load32_s (get_local $a)) + (i64.load32_s (local.get $a)) ) (func (export "i64.load32_u") (param $a i32) (result i64) - (i64.load32_u (get_local $a)) + (i64.load32_u (local.get $a)) ) (func (export "i32.store") (param $a i32) (param $v i32) - (i32.store (get_local $a) (get_local $v)) + (i32.store (local.get $a) (local.get $v)) ) (func (export "i64.store") (param $a i32) (param $v i64) - (i64.store (get_local $a) (get_local $v)) + (i64.store (local.get $a) (local.get $v)) ) (func (export "f32.store") (param $a i32) (param $v f32) - (f32.store (get_local $a) (get_local $v)) + (f32.store (local.get $a) (local.get $v)) ) (func (export "f64.store") (param $a i32) (param $v f64) - (f64.store (get_local $a) (get_local $v)) + (f64.store (local.get $a) (local.get $v)) ) (func (export "i32.store8") (param $a i32) (param $v i32) - (i32.store8 (get_local $a) (get_local $v)) + (i32.store8 (local.get $a) (local.get $v)) ) (func (export "i32.store16") (param $a i32) (param $v i32) - (i32.store16 (get_local $a) (get_local $v)) + (i32.store16 (local.get $a) (local.get $v)) ) (func (export "i64.store8") (param $a i32) (param $v i64) - (i64.store8 (get_local $a) (get_local $v)) + (i64.store8 (local.get $a) (local.get $v)) ) (func (export "i64.store16") (param $a i32) (param $v i64) - (i64.store16 (get_local $a) (get_local $v)) + (i64.store16 (local.get $a) (local.get $v)) ) (func (export "i64.store32") (param $a i32) (param $v i64) - (i64.store32 (get_local $a) (get_local $v)) + (i64.store32 (local.get $a) (local.get $v)) ) ) diff --git a/test/core/names.wast b/test/core/names.wast index 07b4deb5..9c53234c 100644 --- a/test/core/names.wast +++ b/test/core/names.wast @@ -18,59 +18,1090 @@ (module ;; Test that we can use the empty string as a symbol. - (func (export "") (result f32) (f32.const 0x1.91p+2)) + (func (export "") (result i32) (i32.const 0)) ;; Test that we can use names beginning with a digit. - (func (export "0") (result f32) (f32.const 0x1.97p+2)) + (func (export "0") (result i32) (i32.const 1)) + + ;; Test that we can use names beginning with a dash. + (func (export "-0") (result i32) (i32.const 2)) ;; Test that we can use names beginning with an underscore. - (func (export "_") (result f32) (f32.const 0x1.98p+2)) + (func (export "_") (result i32) (i32.const 3)) ;; Test that we can use names beginning with a dollar sign. - (func (export "$") (result f32) (f32.const 0x1.99p+2)) + (func (export "$") (result i32) (i32.const 4)) ;; Test that we can use names beginning with an at sign. - (func (export "@") (result f32) (f32.const 0x2.00p+2)) + (func (export "@") (result i32) (i32.const 5)) ;; Test that we can use non-alphanumeric names. - (func (export "~!@#$%^&*()_+`-={}|[]\\:\";'<>?,./ ") (result f32) (f32.const 0x1.96p+2)) + (func (export "~!@#$%^&*()_+`-={}|[]\\:\";'<>?,./ ") (result i32) (i32.const 6)) ;; Test that we can use names that have special meaning in JS. - (func (export "NaN") (result f32) (f32.const 0x2.01p+2)) - (func (export "Infinity") (result f32) (f32.const 0x2.02p+2)) - (func (export "if") (result f32) (f32.const 0x2.03p+2)) + (func (export "NaN") (result i32) (i32.const 7)) + (func (export "Infinity") (result i32) (i32.const 8)) + (func (export "if") (result i32) (i32.const 9)) ;; Test that we can use common libc names without conflict. - (func (export "malloc") (result f32) (f32.const 0x1.92p+2)) + (func (export "malloc") (result i32) (i32.const 10)) ;; Test that we can use some libc hidden names without conflict. - (func (export "_malloc") (result f32) (f32.const 0x1.93p+2)) - (func (export "__malloc") (result f32) (f32.const 0x1.94p+2)) + (func (export "_malloc") (result i32) (i32.const 11)) + (func (export "__malloc") (result i32) (i32.const 12)) + + ;; Test that names are case-sensitive. + (func (export "a") (result i32) (i32.const 13)) + (func (export "A") (result i32) (i32.const 14)) + + ;; Test that UTF-8 BOM code points can appear in identifiers. + (func (export "") (result i32) (i32.const 15)) + + ;; Test that Unicode normalization is not applied. These function names + ;; contain different codepoints which normalize to the same thing under + ;; NFC or NFD. + (func (export "Å") (result i32) (i32.const 16)) + (func (export "Å") (result i32) (i32.const 17)) + (func (export "Å") (result i32) (i32.const 18)) + + ;; Test that Unicode compatibility normalization is not applied. These + ;; function names contain different codepoints which normalize to the + ;; same thing under NFKC or NFKD. + (func (export "ffi") (result i32) (i32.const 19)) + (func (export "ffi") (result i32) (i32.const 20)) + (func (export "ffi") (result i32) (i32.const 21)) + + ;; Test the C0 control codes. + (func (export "\00\01\02\03\04\05\06\07\08\09\0a\0b\0c\0d\0e\0f") (result i32) (i32.const 22)) + (func (export "\10\11\12\13\14\15\16\17\18\19\1a\1b\1c\1d\1e\1f") (result i32) (i32.const 23)) + ;; Test miscellaneous control codes. + (func (export " \7f") (result i32) (i32.const 24)) + ;; Test the C1 control codes. + (func (export "\c2\80\c2\81\c2\82\c2\83\c2\84\c2\85\c2\86\c2\87\c2\88\c2\89\c2\8a\c2\8b\c2\8c\c2\8d\c2\8e\c2\8f") (result i32) (i32.const 25)) + (func (export "\c2\90\c2\91\c2\92\c2\93\c2\94\c2\95\c2\96\c2\97\c2\98\c2\99\c2\9a\c2\9b\c2\9c\c2\9d\c2\9e\c2\9f") (result i32) (i32.const 26)) + ;; Test the Unicode Specials. + (func (export "\ef\bf\b0\ef\bf\b1\ef\bf\b2\ef\bf\b3\ef\bf\b4\ef\bf\b5\ef\bf\b6\ef\bf\b7") (result i32) (i32.const 27)) + (func (export "\ef\bf\b8\ef\bf\b9\ef\bf\ba\ef\bf\bb\ef\bf\bc\ef\bf\bd\ef\bf\be\ef\bf\bf") (result i32) (i32.const 28)) + + ;; Test that the control pictures are distinct from the control codes they + ;; depict. These correspond to the C0 and miscellaneous control code tests + ;; above. + (func (export "␀␁␂␃␄␅␆␇␈␉␊␋␌␍␎␏") (result i32) (i32.const 29)) + (func (export "␐␑␒␓␔␕␖␗␘␙␚␛␜␝␞␟") (result i32) (i32.const 30)) + (func (export "␠␡") (result i32) (i32.const 31)) + + ;; Test the Unicode Specials in non-escaped form (excluding U+FFFE and + ;; U+FFFF, so that generic tools don't detect this file as non-UTF-8). + (func (export "￰￱￲￳￴￵￶￷￸�") (result i32) (i32.const 32)) + + ;; Test a bare ZWJ code point. + (func (export "‍") (result i32) (i32.const 33)) + ;; Test a bare ZWNJ code point. + (func (export "‌") (result i32) (i32.const 34)) + + ;; Test various bare joiner code points. + (func (export "͏") (result i32) (i32.const 35)) + (func (export "⁠") (result i32) (i32.const 36)) + (func (export "⵿") (result i32) (i32.const 37)) + (func (export "𑁿") (result i32) (i32.const 38)) + (func (export "᠎") (result i32) (i32.const 39)) + + ;; Test various interesting code points: reverse BOM, zero-width space, + ;; no-break space, soft hyphen, word joiner, ogham space mark, + ;; right-to-left override, left-to-right override. + (func (export "￯​ ­⁠ ‮‭") (result i32) (i32.const 40)) + + ;; Test more interesting code points: left-to-right mark, right-to-left mark, + ;; non-breaking hyphen, line separator, paragraph separator, + ;; left-to-right embedding, right-to-left embedding, + ;; pop directional formatting, narrow no-break space, left-to-right isolate, + ;; right-to-left isolate, first strong isolate, pop directional isolate. + (func (export "‎‏‑

‪‫‬ ⁦⁧⁨⁩") (result i32) (i32.const 41)) + + ;; Test some deprecated code points: inhibit symmetric swapping, + ;; activate symmetric swapping, inhibit arabic form shaping, + ;; activate arabic form shaping, national digit shapes, nominal digit shapes. + (func (export "") (result i32) (i32.const 42)) + + ;; Test "invisible" operator code points. + (func (export "⁡⁢⁣⁤") (result i32) (i32.const 43)) + + ;; Test that code points outside the BMP are supported. + (func (export "𐀀󟿿􏿿") (result i32) (i32.const 44)) + + ;; Test that WebAssembly implementations cope in the presence of Zalgo. + (func (export "Z̴͇̫̥̪͓͈͔͎̗̞̺̯̱̞̙̱̜̖̠̏͆̆͛͌͘͞ḁ̶̰̳̭͙̲̱̹̝͎̼͗ͨ̎̄̆͗̿̀́͟͡l̶̷͉̩̹̫̝͖̙̲̼͇͚͍̮͎̥̞̈́͊͗ͦ̈́ͫ̇́̚ͅͅg̶͕͔͚̩̓̐̅ͮ̔̐̎̂̏̾͊̍͋͊ͧ́̆ͦ͞o̡͋̔͐ͪͩ͏̢̧̫̙̤̮͖͙͓̺̜̩̼̘̠́") (result i32) (i32.const 45)) + + ;; Test Hangul filler code points. + (func (export "ᅟᅠㅤᅠ") (result i32) (i32.const 46)) + + ;; Test variation selectors (which are also ID_Continue code points). + (func (export "︀") (result i32) (i32.const 47)) + (func (export "︄") (result i32) (i32.const 48)) + (func (export "󠄀") (result i32) (i32.const 49)) + (func (export "󠇯") (result i32) (i32.const 50)) + + ;; Test an uncombined combining code point. + (func (export "̈") (result i32) (i32.const 51)) + + ;; Test that numerous different present and historical representations of the + ;; "newline" concept are distinct. Tests largely inspired by: + ;; https://en.wikipedia.org/wiki/Newline#Representations + ;; https://en.wikipedia.org/wiki/Newline#Unicode and + ;; https://en.wikipedia.org/wiki/Newline#Reverse_and_partial_line_feeds + (func (export "\0a") (result i32) (i32.const 52)) + (func (export "␤") (result i32) (i32.const 53)) + (func (export "
") (result i32) (i32.const 54)) + (func (export "\0d") (result i32) (i32.const 55)) + (func (export "\0d\0a") (result i32) (i32.const 56)) + (func (export "\0a\0d") (result i32) (i32.const 57)) + (func (export "\1e") (result i32) (i32.const 58)) + (func (export "\0b") (result i32) (i32.const 59)) + (func (export "\0c") (result i32) (i32.const 60)) + (func (export "\c2\85") (result i32) (i32.const 61)) + (func (export "
") (result i32) (i32.const 62)) + (func (export "…") (result i32) (i32.const 63)) + (func (export "⏎") (result i32) (i32.const 64)) + (func (export "\c2\8b") (result i32) (i32.const 65)) + (func (export "\c2\8c") (result i32) (i32.const 66)) + (func (export "\c2\8d") (result i32) (i32.const 67)) + (func (export "↵") (result i32) (i32.const 68)) + (func (export "↩") (result i32) (i32.const 69)) + (func (export "⌤") (result i32) (i32.const 70)) + (func (export "⤶") (result i32) (i32.const 71)) + (func (export "↲") (result i32) (i32.const 72)) + (func (export "⮨") (result i32) (i32.const 73)) + (func (export "⮰") (result i32) (i32.const 74)) + + ;; Test that non-characters are not replaced by the replacement character. + (func (export "�") (result i32) (i32.const 75)) + (func (export "\ef\b7\90") (result i32) (i32.const 76)) + (func (export "\ef\b7\91") (result i32) (i32.const 77)) + (func (export "\ef\b7\92") (result i32) (i32.const 78)) + (func (export "\ef\b7\93") (result i32) (i32.const 79)) + (func (export "\ef\b7\94") (result i32) (i32.const 80)) + (func (export "\ef\b7\95") (result i32) (i32.const 81)) + (func (export "\ef\b7\96") (result i32) (i32.const 82)) + (func (export "\ef\b7\97") (result i32) (i32.const 83)) + (func (export "\ef\b7\98") (result i32) (i32.const 84)) + (func (export "\ef\b7\99") (result i32) (i32.const 85)) + (func (export "\ef\b7\9a") (result i32) (i32.const 86)) + (func (export "\ef\b7\9b") (result i32) (i32.const 87)) + (func (export "\ef\b7\9c") (result i32) (i32.const 88)) + (func (export "\ef\b7\9d") (result i32) (i32.const 89)) + (func (export "\ef\b7\9e") (result i32) (i32.const 90)) + (func (export "\ef\b7\9f") (result i32) (i32.const 91)) + (func (export "\ef\b7\a0") (result i32) (i32.const 92)) + (func (export "\ef\b7\a1") (result i32) (i32.const 93)) + (func (export "\ef\b7\a2") (result i32) (i32.const 94)) + (func (export "\ef\b7\a3") (result i32) (i32.const 95)) + (func (export "\ef\b7\a4") (result i32) (i32.const 96)) + (func (export "\ef\b7\a5") (result i32) (i32.const 97)) + (func (export "\ef\b7\a6") (result i32) (i32.const 98)) + (func (export "\ef\b7\a7") (result i32) (i32.const 99)) + (func (export "\ef\b7\a8") (result i32) (i32.const 100)) + (func (export "\ef\b7\a9") (result i32) (i32.const 101)) + (func (export "\ef\b7\aa") (result i32) (i32.const 102)) + (func (export "\ef\b7\ab") (result i32) (i32.const 103)) + (func (export "\ef\b7\ac") (result i32) (i32.const 104)) + (func (export "\ef\b7\ad") (result i32) (i32.const 105)) + (func (export "\ef\b7\ae") (result i32) (i32.const 106)) + (func (export "\ef\b7\af") (result i32) (i32.const 107)) + (func (export "\ef\bf\be") (result i32) (i32.const 108)) + (func (export "\ef\bf\bf") (result i32) (i32.const 109)) + (func (export "\f0\9f\bf\be") (result i32) (i32.const 110)) + (func (export "\f0\9f\bf\bf") (result i32) (i32.const 111)) + (func (export "\f0\af\bf\be") (result i32) (i32.const 112)) + (func (export "\f0\af\bf\bf") (result i32) (i32.const 113)) + (func (export "\f0\bf\bf\be") (result i32) (i32.const 114)) + (func (export "\f0\bf\bf\bf") (result i32) (i32.const 115)) + (func (export "\f1\8f\bf\be") (result i32) (i32.const 116)) + (func (export "\f1\8f\bf\bf") (result i32) (i32.const 117)) + (func (export "\f1\9f\bf\be") (result i32) (i32.const 118)) + (func (export "\f1\9f\bf\bf") (result i32) (i32.const 119)) + (func (export "\f1\af\bf\be") (result i32) (i32.const 120)) + (func (export "\f1\af\bf\bf") (result i32) (i32.const 121)) + (func (export "\f1\bf\bf\be") (result i32) (i32.const 122)) + (func (export "\f1\bf\bf\bf") (result i32) (i32.const 123)) + (func (export "\f2\8f\bf\be") (result i32) (i32.const 124)) + (func (export "\f2\8f\bf\bf") (result i32) (i32.const 125)) + (func (export "\f2\9f\bf\be") (result i32) (i32.const 126)) + (func (export "\f2\9f\bf\bf") (result i32) (i32.const 127)) + (func (export "\f2\af\bf\be") (result i32) (i32.const 128)) + (func (export "\f2\af\bf\bf") (result i32) (i32.const 129)) + (func (export "\f2\bf\bf\be") (result i32) (i32.const 130)) + (func (export "\f2\bf\bf\bf") (result i32) (i32.const 131)) + (func (export "\f3\8f\bf\be") (result i32) (i32.const 132)) + (func (export "\f3\8f\bf\bf") (result i32) (i32.const 133)) + (func (export "\f3\9f\bf\be") (result i32) (i32.const 134)) + (func (export "\f3\9f\bf\bf") (result i32) (i32.const 135)) + (func (export "\f3\af\bf\be") (result i32) (i32.const 136)) + (func (export "\f3\af\bf\bf") (result i32) (i32.const 137)) + (func (export "\f3\bf\bf\be") (result i32) (i32.const 138)) + (func (export "\f3\bf\bf\bf") (result i32) (i32.const 139)) + (func (export "\f4\8f\bf\be") (result i32) (i32.const 140)) + (func (export "\f4\8f\bf\bf") (result i32) (i32.const 141)) + + ;; Test an interrobang with combining diacritical marks above. + ;; https://xkcd.com/1209/ + (func (export "̈‽̈̉") (result i32) (i32.const 142)) + + ;; Test that RLM/LRM don't change the logical byte order. + (func (export "abc") (result i32) (i32.const 143)) + (func (export "‭abc") (result i32) (i32.const 144)) + (func (export "‮cba") (result i32) (i32.const 145)) + (func (export "‭abc‮") (result i32) (i32.const 146)) + (func (export "‮cba‭") (result i32) (i32.const 147)) + + ;; Test that Unicode font variations are preserved. + (func (export "𝑨") (result i32) (i32.const 148)) + (func (export "𝐴") (result i32) (i32.const 149)) + (func (export "𝘈") (result i32) (i32.const 150)) + (func (export "𝘼") (result i32) (i32.const 151)) + (func (export "𝐀") (result i32) (i32.const 152)) + (func (export "𝓐") (result i32) (i32.const 153)) + (func (export "𝕬") (result i32) (i32.const 154)) + (func (export "𝗔") (result i32) (i32.const 155)) + (func (export "𝒜") (result i32) (i32.const 156)) + (func (export "𝔄") (result i32) (i32.const 157)) + (func (export "𝔸") (result i32) (i32.const 158)) + (func (export "𝖠") (result i32) (i32.const 159)) + (func (export "𝙰") (result i32) (i32.const 160)) + (func (export "ᴀ") (result i32) (i32.const 161)) + + ;; Test that various additional letter variations are preserved. + ;; (U+0040, U+0061, U+0041, U+00C5, U+0041 U+030A, U+212B, and the font + ;; variations are covered above.) + (func (export "ᴬ") (result i32) (i32.const 162)) + (func (export "Ⓐ") (result i32) (i32.const 163)) + (func (export "A") (result i32) (i32.const 164)) + (func (export "🄐") (result i32) (i32.const 165)) + (func (export "🄰") (result i32) (i32.const 166)) + (func (export "󠁁") (result i32) (i32.const 167)) + (func (export "U+0041") (result i32) (i32.const 168)) + (func (export "A​") (result i32) (i32.const 169)) + (func (export "А") (result i32) (i32.const 170)) + (func (export "Ꙗ") (result i32) (i32.const 171)) + (func (export "ⷼ") (result i32) (i32.const 172)) + (func (export "ⷶ") (result i32) (i32.const 173)) + (func (export "Ɐ") (result i32) (i32.const 174)) + (func (export "🅐") (result i32) (i32.const 175)) + (func (export "🅰") (result i32) (i32.const 176)) + (func (export "Ⱝ") (result i32) (i32.const 177)) + (func (export "𐐂") (result i32) (i32.const 178)) + (func (export "𐐈") (result i32) (i32.const 179)) + (func (export "𐒰") (result i32) (i32.const 180)) + (func (export "À") (result i32) (i32.const 181)) + (func (export "Á") (result i32) (i32.const 182)) + (func (export "Â") (result i32) (i32.const 183)) + (func (export "Ã") (result i32) (i32.const 184)) + (func (export "Ä") (result i32) (i32.const 185)) + (func (export "Ā") (result i32) (i32.const 186)) + (func (export "Ă") (result i32) (i32.const 187)) + (func (export "Ą") (result i32) (i32.const 188)) + (func (export "Ǎ") (result i32) (i32.const 189)) + (func (export "Ǟ") (result i32) (i32.const 190)) + (func (export "Ǡ") (result i32) (i32.const 191)) + (func (export "Ǻ") (result i32) (i32.const 192)) + (func (export "Ȁ") (result i32) (i32.const 193)) + (func (export "Ȃ") (result i32) (i32.const 194)) + (func (export "Ȧ") (result i32) (i32.const 195)) + (func (export "Ⱥ") (result i32) (i32.const 196)) + (func (export "Ӑ") (result i32) (i32.const 197)) + (func (export "Ӓ") (result i32) (i32.const 198)) + (func (export "ߊ") (result i32) (i32.const 199)) + (func (export "ࠡ") (result i32) (i32.const 200)) + (func (export "ࠢ") (result i32) (i32.const 201)) + (func (export "ࠣ") (result i32) (i32.const 202)) + (func (export "ࠤ") (result i32) (i32.const 203)) + (func (export "ࠥ") (result i32) (i32.const 204)) + (func (export "ऄ") (result i32) (i32.const 205)) + (func (export "अ") (result i32) (i32.const 206)) + (func (export "ॲ") (result i32) (i32.const 207)) + (func (export "অ") (result i32) (i32.const 208)) + (func (export "ਅ") (result i32) (i32.const 209)) + (func (export "અ") (result i32) (i32.const 210)) + (func (export "ଅ") (result i32) (i32.const 211)) + (func (export "அ") (result i32) (i32.const 212)) + (func (export "అ") (result i32) (i32.const 213)) + (func (export "ಅ") (result i32) (i32.const 214)) + (func (export "അ") (result i32) (i32.const 215)) + (func (export "ะ") (result i32) (i32.const 216)) + (func (export "ະ") (result i32) (i32.const 217)) + (func (export "༁") (result i32) (i32.const 218)) + (func (export "ཨ") (result i32) (i32.const 219)) + (func (export "ྸ") (result i32) (i32.const 220)) + (func (export "အ") (result i32) (i32.const 221)) + (func (export "ဢ") (result i32) (i32.const 222)) + (func (export "ႜ") (result i32) (i32.const 223)) + (func (export "ᅡ") (result i32) (i32.const 224)) + (func (export "አ") (result i32) (i32.const 225)) + (func (export "ዐ") (result i32) (i32.const 226)) + (func (export "Ꭰ") (result i32) (i32.const 227)) + (func (export "ᐊ") (result i32) (i32.const 228)) + (func (export "ᖳ") (result i32) (i32.const 229)) + (func (export "ᚨ") (result i32) (i32.const 230)) + (func (export "ᚪ") (result i32) (i32.const 231)) + (func (export "ᛆ") (result i32) (i32.const 232)) + (func (export "ᜀ") (result i32) (i32.const 233)) + (func (export "ᜠ") (result i32) (i32.const 234)) + (func (export "ᝀ") (result i32) (i32.const 235)) + (func (export "ᝠ") (result i32) (i32.const 236)) + (func (export "ᠠ") (result i32) (i32.const 237)) + (func (export "ᢇ") (result i32) (i32.const 238)) + (func (export "ᤠ") (result i32) (i32.const 239)) + (func (export "ᥣ") (result i32) (i32.const 240)) + (func (export "ᨕ") (result i32) (i32.const 241)) + (func (export "ᩋ") (result i32) (i32.const 242)) + (func (export "ᩡ") (result i32) (i32.const 243)) + (func (export "ᮃ") (result i32) (i32.const 244)) + (func (export "ᯀ") (result i32) (i32.const 245)) + (func (export "ᯁ") (result i32) (i32.const 246)) + (func (export "ᰣ") (result i32) (i32.const 247)) + (func (export "Ḁ") (result i32) (i32.const 248)) + (func (export "Ạ") (result i32) (i32.const 249)) + (func (export "Ả") (result i32) (i32.const 250)) + (func (export "Ấ") (result i32) (i32.const 251)) + (func (export "Ầ") (result i32) (i32.const 252)) + (func (export "Ẩ") (result i32) (i32.const 253)) + (func (export "Ẫ") (result i32) (i32.const 254)) + (func (export "Ậ") (result i32) (i32.const 255)) + (func (export "Ắ") (result i32) (i32.const 256)) + (func (export "Ằ") (result i32) (i32.const 257)) + (func (export "Ẳ") (result i32) (i32.const 258)) + (func (export "Ẵ") (result i32) (i32.const 259)) + (func (export "Ặ") (result i32) (i32.const 260)) + (func (export "あ") (result i32) (i32.const 261)) + (func (export "ア") (result i32) (i32.const 262)) + (func (export "ㄚ") (result i32) (i32.const 263)) + (func (export "ㅏ") (result i32) (i32.const 264)) + (func (export "㈎") (result i32) (i32.const 265)) + (func (export "㈏") (result i32) (i32.const 266)) + (func (export "㈐") (result i32) (i32.const 267)) + (func (export "㈑") (result i32) (i32.const 268)) + (func (export "㈒") (result i32) (i32.const 269)) + (func (export "㈓") (result i32) (i32.const 270)) + (func (export "㈔") (result i32) (i32.const 271)) + (func (export "㈕") (result i32) (i32.const 272)) + (func (export "㈖") (result i32) (i32.const 273)) + (func (export "㈗") (result i32) (i32.const 274)) + (func (export "㈘") (result i32) (i32.const 275)) + (func (export "㈙") (result i32) (i32.const 276)) + (func (export "㈚") (result i32) (i32.const 277)) + (func (export "㈛") (result i32) (i32.const 278)) + (func (export "㉮") (result i32) (i32.const 279)) + (func (export "㉯") (result i32) (i32.const 280)) + (func (export "㉰") (result i32) (i32.const 281)) + (func (export "㉱") (result i32) (i32.const 282)) + (func (export "㉲") (result i32) (i32.const 283)) + (func (export "㉳") (result i32) (i32.const 284)) + (func (export "㉴") (result i32) (i32.const 285)) + (func (export "㉵") (result i32) (i32.const 286)) + (func (export "㉶") (result i32) (i32.const 287)) + (func (export "㉷") (result i32) (i32.const 288)) + (func (export "㉸") (result i32) (i32.const 289)) + (func (export "㉹") (result i32) (i32.const 290)) + (func (export "㉺") (result i32) (i32.const 291)) + (func (export "㉻") (result i32) (i32.const 292)) + (func (export "㋐") (result i32) (i32.const 293)) + (func (export "ꀊ") (result i32) (i32.const 294)) + (func (export "ꓮ") (result i32) (i32.const 295)) + (func (export "ꕉ") (result i32) (i32.const 296)) + (func (export "ꚠ") (result i32) (i32.const 297)) + (func (export "ꠀ") (result i32) (i32.const 298)) + (func (export "ꠣ") (result i32) (i32.const 299)) + (func (export "ꡝ") (result i32) (i32.const 300)) + (func (export "ꢂ") (result i32) (i32.const 301)) + (func (export "꣪") (result i32) (i32.const 302)) + (func (export "ꤢ") (result i32) (i32.const 303)) + (func (export "ꥆ") (result i32) (i32.const 304)) + (func (export "ꦄ") (result i32) (i32.const 305)) + (func (export "ꨀ") (result i32) (i32.const 306)) + (func (export "ア") (result i32) (i32.const 307)) + (func (export "ᅡ") (result i32) (i32.const 308)) + (func (export "𐀀") (result i32) (i32.const 309)) + (func (export "𐊀") (result i32) (i32.const 310)) + (func (export "𐊠") (result i32) (i32.const 311)) + (func (export "𐌀") (result i32) (i32.const 312)) + (func (export "𐎠") (result i32) (i32.const 313)) + (func (export "𐒖") (result i32) (i32.const 314)) + (func (export "𐔀") (result i32) (i32.const 315)) + (func (export "𐝀") (result i32) (i32.const 316)) + (func (export "𐠀") (result i32) (i32.const 317)) + (func (export "𐤠") (result i32) (i32.const 318)) + (func (export "𐦀") (result i32) (i32.const 319)) + (func (export "𐦠") (result i32) (i32.const 320)) + (func (export "𐨀") (result i32) (i32.const 321)) + (func (export "𐬀") (result i32) (i32.const 322)) + (func (export "𐰀") (result i32) (i32.const 323)) + (func (export "𐰁") (result i32) (i32.const 324)) + (func (export "𐲀") (result i32) (i32.const 325)) + (func (export "𑀅") (result i32) (i32.const 326)) + (func (export "𑂃") (result i32) (i32.const 327)) + (func (export "𑄧") (result i32) (i32.const 328)) + (func (export "𑅐") (result i32) (i32.const 329)) + (func (export "𑆃") (result i32) (i32.const 330)) + (func (export "𑈀") (result i32) (i32.const 331)) + (func (export "𑊀") (result i32) (i32.const 332)) + (func (export "𑊰") (result i32) (i32.const 333)) + (func (export "𑌅") (result i32) (i32.const 334)) + (func (export "𑍰") (result i32) (i32.const 335)) + (func (export "𑐀") (result i32) (i32.const 336)) + (func (export "𑒁") (result i32) (i32.const 337)) + (func (export "𑖀") (result i32) (i32.const 338)) + (func (export "𑘀") (result i32) (i32.const 339)) + (func (export "𑚀") (result i32) (i32.const 340)) + (func (export "𑜒") (result i32) (i32.const 341)) + (func (export "𑜠") (result i32) (i32.const 342)) + (func (export "𑢡") (result i32) (i32.const 343)) + (func (export "𑫕") (result i32) (i32.const 344)) + (func (export "𑰀") (result i32) (i32.const 345)) + (func (export "𑲏") (result i32) (i32.const 346)) + (func (export "𑲯") (result i32) (i32.const 347)) + (func (export "𒀀") (result i32) (i32.const 348)) + (func (export "𖧕") (result i32) (i32.const 349)) + (func (export "𖩆") (result i32) (i32.const 350)) + (func (export "𖫧") (result i32) (i32.const 351)) + (func (export "𖽔") (result i32) (i32.const 352)) + (func (export "𛱁") (result i32) (i32.const 353)) + (func (export "𛱤") (result i32) (i32.const 354)) + (func (export "𞠣") (result i32) (i32.const 355)) + (func (export "🇦") (result i32) (i32.const 356)) + (func (export "Ɑ") (result i32) (i32.const 357)) + (func (export "Λ") (result i32) (i32.const 358)) + (func (export "Ɒ") (result i32) (i32.const 359)) + (func (export "ª") (result i32) (i32.const 360)) + (func (export "∀") (result i32) (i32.const 361)) + (func (export "₳") (result i32) (i32.const 362)) + (func (export "𐤀") (result i32) (i32.const 363)) + (func (export "Ⲁ") (result i32) (i32.const 364)) + (func (export "𐌰") (result i32) (i32.const 365)) + (func (export "Ά") (result i32) (i32.const 366)) + (func (export "Α") (result i32) (i32.const 367)) + (func (export "Ἀ") (result i32) (i32.const 368)) + (func (export "Ἁ") (result i32) (i32.const 369)) + (func (export "Ἂ") (result i32) (i32.const 370)) + (func (export "Ἃ") (result i32) (i32.const 371)) + (func (export "Ἄ") (result i32) (i32.const 372)) + (func (export "Ἅ") (result i32) (i32.const 373)) + (func (export "Ἆ") (result i32) (i32.const 374)) + (func (export "Ἇ") (result i32) (i32.const 375)) + (func (export "ᾈ") (result i32) (i32.const 376)) + (func (export "ᾉ") (result i32) (i32.const 377)) + (func (export "ᾊ") (result i32) (i32.const 378)) + (func (export "ᾋ") (result i32) (i32.const 379)) + (func (export "ᾌ") (result i32) (i32.const 380)) + (func (export "ᾍ") (result i32) (i32.const 381)) + (func (export "ᾎ") (result i32) (i32.const 382)) + (func (export "ᾏ") (result i32) (i32.const 383)) + (func (export "Ᾰ") (result i32) (i32.const 384)) + (func (export "Ᾱ") (result i32) (i32.const 385)) + (func (export "Ὰ") (result i32) (i32.const 386)) + (func (export "Ά") (result i32) (i32.const 387)) + (func (export "ᾼ") (result i32) (i32.const 388)) + (func (export "𝚨") (result i32) (i32.const 389)) + (func (export "𝛢") (result i32) (i32.const 390)) + (func (export "𝜜") (result i32) (i32.const 391)) + (func (export "𝝖") (result i32) (i32.const 392)) + (func (export "𝞐") (result i32) (i32.const 393)) + (func (export "⍶") (result i32) (i32.const 394)) + (func (export "⍺") (result i32) (i32.const 395)) + (func (export "⩜") (result i32) (i32.const 396)) + (func (export "ᗅ") (result i32) (i32.const 397)) + (func (export "Ꭺ") (result i32) (i32.const 398)) + + ;; Test unmatched "closing" and "opening" code points. + (func (export ")˺˼𔗏𝅴𝅶𝅸𝅺⁾₎❩❫⟯﴿︶﹚)⦆󠀩❳❵⟧⟩⟫⟭⦈⦊⦖⸣⸥︘︸︺︼︾﹀﹂﹄﹈﹜﹞]}」󠁝󠁽»’”›❯") (result i32) (i32.const 399)) + (func (export "(˹˻𔗎𝅳𝅵𝅷𝅹⁽₍❨❪⟮﴾︵﹙(⦅󠀨❲❴⟦⟨⟪⟬⦇⦉⦕⸢⸤︗︷︹︻︽︿﹁﹃﹇﹛﹝[{「󠁛󠁻«‘“‹❮") (result i32) (i32.const 400)) + (func (export "𝪋𝪤") (result i32) (i32.const 401)) + (func (export "𝪋") (result i32) (i32.const 402)) + + ;; Test that Unicode fraction normalization is not applied. + (func (export "½") (result i32) (i32.const 403)) + (func (export "1⁄2") (result i32) (i32.const 404)) + (func (export "1/2") (result i32) (i32.const 405)) + (func (export "୳") (result i32) (i32.const 406)) + (func (export "൴") (result i32) (i32.const 407)) + (func (export "⳽") (result i32) (i32.const 408)) + (func (export "꠱") (result i32) (i32.const 409)) + (func (export "𐅁") (result i32) (i32.const 410)) + (func (export "𐅵") (result i32) (i32.const 411)) + (func (export "𐅶") (result i32) (i32.const 412)) + (func (export "𐦽") (result i32) (i32.const 413)) + (func (export "𐹻") (result i32) (i32.const 414)) + + ;; Test a full-width quote. + (func (export """) (result i32) (i32.const 415)) + + ;; Test that different present and historical representations of the "delete" + ;; concept are distinct. + (func (export "\7f") (result i32) (i32.const 416)) + (func (export "\08") (result i32) (i32.const 417)) + (func (export "⌫") (result i32) (i32.const 418)) + (func (export "⌦") (result i32) (i32.const 419)) + (func (export "␈") (result i32) (i32.const 420)) + (func (export "␡") (result i32) (i32.const 421)) + (func (export "᷻") (result i32) (i32.const 422)) + (func (export "\0f") (result i32) (i32.const 423)) + (func (export "←") (result i32) (i32.const 424)) + (func (export "⌧") (result i32) (i32.const 425)) + (func (export "⍒") (result i32) (i32.const 426)) + (func (export "⍔") (result i32) (i32.const 427)) + (func (export "⍢") (result i32) (i32.const 428)) + (func (export "⍫") (result i32) (i32.const 429)) + + ;; Test that different representations of the "substitute" concept are + ;; distinct. (U+FFFD is covered above.) + (func (export "\1a") (result i32) (i32.const 430)) + (func (export "␦") (result i32) (i32.const 431)) + (func (export "␚") (result i32) (i32.const 432)) + (func (export "") (result i32) (i32.const 433)) + (func (export "?") (result i32) (i32.const 434)) + (func (export "¿") (result i32) (i32.const 435)) + (func (export "᥅") (result i32) (i32.const 436)) + (func (export ";") (result i32) (i32.const 437)) + (func (export "՞") (result i32) (i32.const 438)) + (func (export "؟") (result i32) (i32.const 439)) + (func (export "፧") (result i32) (i32.const 440)) + (func (export "⁇") (result i32) (i32.const 441)) + (func (export "⍰") (result i32) (i32.const 442)) + (func (export "❓") (result i32) (i32.const 443)) + (func (export "❔") (result i32) (i32.const 444)) + (func (export "⳺") (result i32) (i32.const 445)) + (func (export "⳻") (result i32) (i32.const 446)) + (func (export "⸮") (result i32) (i32.const 447)) + (func (export "㉄") (result i32) (i32.const 448)) + (func (export "꘏") (result i32) (i32.const 449)) + (func (export "꛷") (result i32) (i32.const 450)) + (func (export "︖") (result i32) (i32.const 451)) + (func (export "﹖") (result i32) (i32.const 452)) + (func (export "?") (result i32) (i32.const 453)) + (func (export "𑅃") (result i32) (i32.const 454)) + (func (export "𞥟") (result i32) (i32.const 455)) + (func (export "󠀿") (result i32) (i32.const 456)) + (func (export "𖡄") (result i32) (i32.const 457)) + (func (export "⯑") (result i32) (i32.const 458)) + + ;; Test that different present and historical representations of the + ;; "paragraph" concept are distinct. (U+2029 is covered above). + (func (export "¶") (result i32) (i32.const 459)) + (func (export "⁋") (result i32) (i32.const 460)) + (func (export "܀") (result i32) (i32.const 461)) + (func (export "჻") (result i32) (i32.const 462)) + (func (export "፨") (result i32) (i32.const 463)) + (func (export "〷") (result i32) (i32.const 464)) + (func (export "❡") (result i32) (i32.const 465)) + (func (export "⸏") (result i32) (i32.const 466)) + (func (export "⸐") (result i32) (i32.const 467)) + (func (export "⸑") (result i32) (i32.const 468)) + (func (export "⸎") (result i32) (i32.const 469)) + (func (export "\14") (result i32) (i32.const 470)) ;; ¶ in CP437 + (func (export "☙") (result i32) (i32.const 471)) + (func (export "⸿") (result i32) (i32.const 472)) + (func (export "〇") (result i32) (i32.const 473)) + (func (export "๛") (result i32) (i32.const 474)) + + ;; Test an unusual character. + (func (export "ꙮ") (result i32) (i32.const 475)) + + ;; Test the three characters whose normalization forms under NFC, NFD, NFKC, + ;; and NFKD are all different. + ;; http://unicode.org/faq/normalization.html#6 + (func (export "ϓ") (result i32) (i32.const 476)) + (func (export "ϔ") (result i32) (i32.const 477)) + (func (export "ẛ") (result i32) (i32.const 478)) ) -(assert_return (invoke "") (f32.const 0x1.91p+2)) -(assert_return (invoke "malloc") (f32.const 0x1.92p+2)) -(assert_return (invoke "_malloc") (f32.const 0x1.93p+2)) -(assert_return (invoke "__malloc") (f32.const 0x1.94p+2)) -(assert_return (invoke "~!@#$%^&*()_+`-={}|[]\\:\";'<>?,./ ") (f32.const 0x1.96p+2)) -(assert_return (invoke "0") (f32.const 0x1.97p+2)) -(assert_return (invoke "_") (f32.const 0x1.98p+2)) -(assert_return (invoke "$") (f32.const 0x1.99p+2)) -(assert_return (invoke "@") (f32.const 0x2.00p+2)) -(assert_return (invoke "NaN") (f32.const 0x2.01p+2)) -(assert_return (invoke "Infinity") (f32.const 0x2.02p+2)) -(assert_return (invoke "if") (f32.const 0x2.03p+2)) +(assert_return (invoke "") (i32.const 0)) +(assert_return (invoke "0") (i32.const 1)) +(assert_return (invoke "-0") (i32.const 2)) +(assert_return (invoke "_") (i32.const 3)) +(assert_return (invoke "$") (i32.const 4)) +(assert_return (invoke "@") (i32.const 5)) +(assert_return (invoke "~!@#$%^&*()_+`-={}|[]\\:\";'<>?,./ ") (i32.const 6)) +(assert_return (invoke "NaN") (i32.const 7)) +(assert_return (invoke "Infinity") (i32.const 8)) +(assert_return (invoke "if") (i32.const 9)) +(assert_return (invoke "malloc") (i32.const 10)) +(assert_return (invoke "_malloc") (i32.const 11)) +(assert_return (invoke "__malloc") (i32.const 12)) +(assert_return (invoke "a") (i32.const 13)) +(assert_return (invoke "A") (i32.const 14)) +(assert_return (invoke "") (i32.const 15)) +(assert_return (invoke "Å") (i32.const 16)) +(assert_return (invoke "Å") (i32.const 17)) +(assert_return (invoke "Å") (i32.const 18)) +(assert_return (invoke "ffi") (i32.const 19)) +(assert_return (invoke "ffi") (i32.const 20)) +(assert_return (invoke "ffi") (i32.const 21)) +(assert_return (invoke "\00\01\02\03\04\05\06\07\08\09\0a\0b\0c\0d\0e\0f") (i32.const 22)) +(assert_return (invoke "\10\11\12\13\14\15\16\17\18\19\1a\1b\1c\1d\1e\1f") (i32.const 23)) +(assert_return (invoke " \7f") (i32.const 24)) +(assert_return (invoke "\c2\80\c2\81\c2\82\c2\83\c2\84\c2\85\c2\86\c2\87\c2\88\c2\89\c2\8a\c2\8b\c2\8c\c2\8d\c2\8e\c2\8f") (i32.const 25)) +(assert_return (invoke "\c2\90\c2\91\c2\92\c2\93\c2\94\c2\95\c2\96\c2\97\c2\98\c2\99\c2\9a\c2\9b\c2\9c\c2\9d\c2\9e\c2\9f") (i32.const 26)) +(assert_return (invoke "\ef\bf\b0\ef\bf\b1\ef\bf\b2\ef\bf\b3\ef\bf\b4\ef\bf\b5\ef\bf\b6\ef\bf\b7") (i32.const 27)) +(assert_return (invoke "\ef\bf\b8\ef\bf\b9\ef\bf\ba\ef\bf\bb\ef\bf\bc\ef\bf\bd\ef\bf\be\ef\bf\bf") (i32.const 28)) +(assert_return (invoke "␀␁␂␃␄␅␆␇␈␉␊␋␌␍␎␏") (i32.const 29)) +(assert_return (invoke "␐␑␒␓␔␕␖␗␘␙␚␛␜␝␞␟") (i32.const 30)) +(assert_return (invoke "␠␡") (i32.const 31)) +(assert_return (invoke "￰￱￲￳￴￵￶￷￸�") (i32.const 32)) +(assert_return (invoke "‍") (i32.const 33)) +(assert_return (invoke "‌") (i32.const 34)) +(assert_return (invoke "͏") (i32.const 35)) +(assert_return (invoke "⁠") (i32.const 36)) +(assert_return (invoke "⵿") (i32.const 37)) +(assert_return (invoke "𑁿") (i32.const 38)) +(assert_return (invoke "᠎") (i32.const 39)) +(assert_return (invoke "￯​ ­⁠ ‮‭") (i32.const 40)) +(assert_return (invoke "‎‏‑

‪‫‬ ⁦⁧⁨⁩") (i32.const 41)) +(assert_return (invoke "") (i32.const 42)) +(assert_return (invoke "⁡⁢⁣⁤") (i32.const 43)) +(assert_return (invoke "𐀀󟿿􏿿") (i32.const 44)) +(assert_return (invoke "Z̴͇̫̥̪͓͈͔͎̗̞̺̯̱̞̙̱̜̖̠̏͆̆͛͌͘͞ḁ̶̰̳̭͙̲̱̹̝͎̼͗ͨ̎̄̆͗̿̀́͟͡l̶̷͉̩̹̫̝͖̙̲̼͇͚͍̮͎̥̞̈́͊͗ͦ̈́ͫ̇́̚ͅͅg̶͕͔͚̩̓̐̅ͮ̔̐̎̂̏̾͊̍͋͊ͧ́̆ͦ͞o̡͋̔͐ͪͩ͏̢̧̫̙̤̮͖͙͓̺̜̩̼̘̠́") (i32.const 45)) +(assert_return (invoke "ᅟᅠㅤᅠ") (i32.const 46)) +(assert_return (invoke "︀") (i32.const 47)) +(assert_return (invoke "︄") (i32.const 48)) +(assert_return (invoke "󠄀") (i32.const 49)) +(assert_return (invoke "󠇯") (i32.const 50)) +(assert_return (invoke "̈") (i32.const 51)) +(assert_return (invoke "\0a") (i32.const 52)) +(assert_return (invoke "␤") (i32.const 53)) +(assert_return (invoke "
") (i32.const 54)) +(assert_return (invoke "\0d") (i32.const 55)) +(assert_return (invoke "\0d\0a") (i32.const 56)) +(assert_return (invoke "\0a\0d") (i32.const 57)) +(assert_return (invoke "\1e") (i32.const 58)) +(assert_return (invoke "\0b") (i32.const 59)) +(assert_return (invoke "\0c") (i32.const 60)) +(assert_return (invoke "\c2\85") (i32.const 61)) +(assert_return (invoke "
") (i32.const 62)) +(assert_return (invoke "…") (i32.const 63)) +(assert_return (invoke "⏎") (i32.const 64)) +(assert_return (invoke "\c2\8b") (i32.const 65)) +(assert_return (invoke "\c2\8c") (i32.const 66)) +(assert_return (invoke "\c2\8d") (i32.const 67)) +(assert_return (invoke "↵") (i32.const 68)) +(assert_return (invoke "↩") (i32.const 69)) +(assert_return (invoke "⌤") (i32.const 70)) +(assert_return (invoke "⤶") (i32.const 71)) +(assert_return (invoke "↲") (i32.const 72)) +(assert_return (invoke "⮨") (i32.const 73)) +(assert_return (invoke "⮰") (i32.const 74)) +(assert_return (invoke "�") (i32.const 75)) +(assert_return (invoke "\ef\b7\90") (i32.const 76)) +(assert_return (invoke "\ef\b7\91") (i32.const 77)) +(assert_return (invoke "\ef\b7\92") (i32.const 78)) +(assert_return (invoke "\ef\b7\93") (i32.const 79)) +(assert_return (invoke "\ef\b7\94") (i32.const 80)) +(assert_return (invoke "\ef\b7\95") (i32.const 81)) +(assert_return (invoke "\ef\b7\96") (i32.const 82)) +(assert_return (invoke "\ef\b7\97") (i32.const 83)) +(assert_return (invoke "\ef\b7\98") (i32.const 84)) +(assert_return (invoke "\ef\b7\99") (i32.const 85)) +(assert_return (invoke "\ef\b7\9a") (i32.const 86)) +(assert_return (invoke "\ef\b7\9b") (i32.const 87)) +(assert_return (invoke "\ef\b7\9c") (i32.const 88)) +(assert_return (invoke "\ef\b7\9d") (i32.const 89)) +(assert_return (invoke "\ef\b7\9e") (i32.const 90)) +(assert_return (invoke "\ef\b7\9f") (i32.const 91)) +(assert_return (invoke "\ef\b7\a0") (i32.const 92)) +(assert_return (invoke "\ef\b7\a1") (i32.const 93)) +(assert_return (invoke "\ef\b7\a2") (i32.const 94)) +(assert_return (invoke "\ef\b7\a3") (i32.const 95)) +(assert_return (invoke "\ef\b7\a4") (i32.const 96)) +(assert_return (invoke "\ef\b7\a5") (i32.const 97)) +(assert_return (invoke "\ef\b7\a6") (i32.const 98)) +(assert_return (invoke "\ef\b7\a7") (i32.const 99)) +(assert_return (invoke "\ef\b7\a8") (i32.const 100)) +(assert_return (invoke "\ef\b7\a9") (i32.const 101)) +(assert_return (invoke "\ef\b7\aa") (i32.const 102)) +(assert_return (invoke "\ef\b7\ab") (i32.const 103)) +(assert_return (invoke "\ef\b7\ac") (i32.const 104)) +(assert_return (invoke "\ef\b7\ad") (i32.const 105)) +(assert_return (invoke "\ef\b7\ae") (i32.const 106)) +(assert_return (invoke "\ef\b7\af") (i32.const 107)) +(assert_return (invoke "\ef\bf\be") (i32.const 108)) +(assert_return (invoke "\ef\bf\bf") (i32.const 109)) +(assert_return (invoke "\f0\9f\bf\be") (i32.const 110)) +(assert_return (invoke "\f0\9f\bf\bf") (i32.const 111)) +(assert_return (invoke "\f0\af\bf\be") (i32.const 112)) +(assert_return (invoke "\f0\af\bf\bf") (i32.const 113)) +(assert_return (invoke "\f0\bf\bf\be") (i32.const 114)) +(assert_return (invoke "\f0\bf\bf\bf") (i32.const 115)) +(assert_return (invoke "\f1\8f\bf\be") (i32.const 116)) +(assert_return (invoke "\f1\8f\bf\bf") (i32.const 117)) +(assert_return (invoke "\f1\9f\bf\be") (i32.const 118)) +(assert_return (invoke "\f1\9f\bf\bf") (i32.const 119)) +(assert_return (invoke "\f1\af\bf\be") (i32.const 120)) +(assert_return (invoke "\f1\af\bf\bf") (i32.const 121)) +(assert_return (invoke "\f1\bf\bf\be") (i32.const 122)) +(assert_return (invoke "\f1\bf\bf\bf") (i32.const 123)) +(assert_return (invoke "\f2\8f\bf\be") (i32.const 124)) +(assert_return (invoke "\f2\8f\bf\bf") (i32.const 125)) +(assert_return (invoke "\f2\9f\bf\be") (i32.const 126)) +(assert_return (invoke "\f2\9f\bf\bf") (i32.const 127)) +(assert_return (invoke "\f2\af\bf\be") (i32.const 128)) +(assert_return (invoke "\f2\af\bf\bf") (i32.const 129)) +(assert_return (invoke "\f2\bf\bf\be") (i32.const 130)) +(assert_return (invoke "\f2\bf\bf\bf") (i32.const 131)) +(assert_return (invoke "\f3\8f\bf\be") (i32.const 132)) +(assert_return (invoke "\f3\8f\bf\bf") (i32.const 133)) +(assert_return (invoke "\f3\9f\bf\be") (i32.const 134)) +(assert_return (invoke "\f3\9f\bf\bf") (i32.const 135)) +(assert_return (invoke "\f3\af\bf\be") (i32.const 136)) +(assert_return (invoke "\f3\af\bf\bf") (i32.const 137)) +(assert_return (invoke "\f3\bf\bf\be") (i32.const 138)) +(assert_return (invoke "\f3\bf\bf\bf") (i32.const 139)) +(assert_return (invoke "\f4\8f\bf\be") (i32.const 140)) +(assert_return (invoke "\f4\8f\bf\bf") (i32.const 141)) +(assert_return (invoke "̈‽̈̉") (i32.const 142)) +(assert_return (invoke "abc") (i32.const 143)) +(assert_return (invoke "‭abc") (i32.const 144)) +(assert_return (invoke "‮cba") (i32.const 145)) +(assert_return (invoke "‭abc‮") (i32.const 146)) +(assert_return (invoke "‮cba‭") (i32.const 147)) +(assert_return (invoke "𝑨") (i32.const 148)) +(assert_return (invoke "𝐴") (i32.const 149)) +(assert_return (invoke "𝘈") (i32.const 150)) +(assert_return (invoke "𝘼") (i32.const 151)) +(assert_return (invoke "𝐀") (i32.const 152)) +(assert_return (invoke "𝓐") (i32.const 153)) +(assert_return (invoke "𝕬") (i32.const 154)) +(assert_return (invoke "𝗔") (i32.const 155)) +(assert_return (invoke "𝒜") (i32.const 156)) +(assert_return (invoke "𝔄") (i32.const 157)) +(assert_return (invoke "𝔸") (i32.const 158)) +(assert_return (invoke "𝖠") (i32.const 159)) +(assert_return (invoke "𝙰") (i32.const 160)) +(assert_return (invoke "ᴀ") (i32.const 161)) +(assert_return (invoke "ᴬ") (i32.const 162)) +(assert_return (invoke "Ⓐ") (i32.const 163)) +(assert_return (invoke "A") (i32.const 164)) +(assert_return (invoke "🄐") (i32.const 165)) +(assert_return (invoke "🄰") (i32.const 166)) +(assert_return (invoke "󠁁") (i32.const 167)) +(assert_return (invoke "U+0041") (i32.const 168)) +(assert_return (invoke "A​") (i32.const 169)) +(assert_return (invoke "А") (i32.const 170)) +(assert_return (invoke "Ꙗ") (i32.const 171)) +(assert_return (invoke "ⷼ") (i32.const 172)) +(assert_return (invoke "ⷶ") (i32.const 173)) +(assert_return (invoke "Ɐ") (i32.const 174)) +(assert_return (invoke "🅐") (i32.const 175)) +(assert_return (invoke "🅰") (i32.const 176)) +(assert_return (invoke "Ⱝ") (i32.const 177)) +(assert_return (invoke "𐐂") (i32.const 178)) +(assert_return (invoke "𐐈") (i32.const 179)) +(assert_return (invoke "𐒰") (i32.const 180)) +(assert_return (invoke "À") (i32.const 181)) +(assert_return (invoke "Á") (i32.const 182)) +(assert_return (invoke "Â") (i32.const 183)) +(assert_return (invoke "Ã") (i32.const 184)) +(assert_return (invoke "Ä") (i32.const 185)) +(assert_return (invoke "Ā") (i32.const 186)) +(assert_return (invoke "Ă") (i32.const 187)) +(assert_return (invoke "Ą") (i32.const 188)) +(assert_return (invoke "Ǎ") (i32.const 189)) +(assert_return (invoke "Ǟ") (i32.const 190)) +(assert_return (invoke "Ǡ") (i32.const 191)) +(assert_return (invoke "Ǻ") (i32.const 192)) +(assert_return (invoke "Ȁ") (i32.const 193)) +(assert_return (invoke "Ȃ") (i32.const 194)) +(assert_return (invoke "Ȧ") (i32.const 195)) +(assert_return (invoke "Ⱥ") (i32.const 196)) +(assert_return (invoke "Ӑ") (i32.const 197)) +(assert_return (invoke "Ӓ") (i32.const 198)) +(assert_return (invoke "ߊ") (i32.const 199)) +(assert_return (invoke "ࠡ") (i32.const 200)) +(assert_return (invoke "ࠢ") (i32.const 201)) +(assert_return (invoke "ࠣ") (i32.const 202)) +(assert_return (invoke "ࠤ") (i32.const 203)) +(assert_return (invoke "ࠥ") (i32.const 204)) +(assert_return (invoke "ऄ") (i32.const 205)) +(assert_return (invoke "अ") (i32.const 206)) +(assert_return (invoke "ॲ") (i32.const 207)) +(assert_return (invoke "অ") (i32.const 208)) +(assert_return (invoke "ਅ") (i32.const 209)) +(assert_return (invoke "અ") (i32.const 210)) +(assert_return (invoke "ଅ") (i32.const 211)) +(assert_return (invoke "அ") (i32.const 212)) +(assert_return (invoke "అ") (i32.const 213)) +(assert_return (invoke "ಅ") (i32.const 214)) +(assert_return (invoke "അ") (i32.const 215)) +(assert_return (invoke "ะ") (i32.const 216)) +(assert_return (invoke "ະ") (i32.const 217)) +(assert_return (invoke "༁") (i32.const 218)) +(assert_return (invoke "ཨ") (i32.const 219)) +(assert_return (invoke "ྸ") (i32.const 220)) +(assert_return (invoke "အ") (i32.const 221)) +(assert_return (invoke "ဢ") (i32.const 222)) +(assert_return (invoke "ႜ") (i32.const 223)) +(assert_return (invoke "ᅡ") (i32.const 224)) +(assert_return (invoke "አ") (i32.const 225)) +(assert_return (invoke "ዐ") (i32.const 226)) +(assert_return (invoke "Ꭰ") (i32.const 227)) +(assert_return (invoke "ᐊ") (i32.const 228)) +(assert_return (invoke "ᖳ") (i32.const 229)) +(assert_return (invoke "ᚨ") (i32.const 230)) +(assert_return (invoke "ᚪ") (i32.const 231)) +(assert_return (invoke "ᛆ") (i32.const 232)) +(assert_return (invoke "ᜀ") (i32.const 233)) +(assert_return (invoke "ᜠ") (i32.const 234)) +(assert_return (invoke "ᝀ") (i32.const 235)) +(assert_return (invoke "ᝠ") (i32.const 236)) +(assert_return (invoke "ᠠ") (i32.const 237)) +(assert_return (invoke "ᢇ") (i32.const 238)) +(assert_return (invoke "ᤠ") (i32.const 239)) +(assert_return (invoke "ᥣ") (i32.const 240)) +(assert_return (invoke "ᨕ") (i32.const 241)) +(assert_return (invoke "ᩋ") (i32.const 242)) +(assert_return (invoke "ᩡ") (i32.const 243)) +(assert_return (invoke "ᮃ") (i32.const 244)) +(assert_return (invoke "ᯀ") (i32.const 245)) +(assert_return (invoke "ᯁ") (i32.const 246)) +(assert_return (invoke "ᰣ") (i32.const 247)) +(assert_return (invoke "Ḁ") (i32.const 248)) +(assert_return (invoke "Ạ") (i32.const 249)) +(assert_return (invoke "Ả") (i32.const 250)) +(assert_return (invoke "Ấ") (i32.const 251)) +(assert_return (invoke "Ầ") (i32.const 252)) +(assert_return (invoke "Ẩ") (i32.const 253)) +(assert_return (invoke "Ẫ") (i32.const 254)) +(assert_return (invoke "Ậ") (i32.const 255)) +(assert_return (invoke "Ắ") (i32.const 256)) +(assert_return (invoke "Ằ") (i32.const 257)) +(assert_return (invoke "Ẳ") (i32.const 258)) +(assert_return (invoke "Ẵ") (i32.const 259)) +(assert_return (invoke "Ặ") (i32.const 260)) +(assert_return (invoke "あ") (i32.const 261)) +(assert_return (invoke "ア") (i32.const 262)) +(assert_return (invoke "ㄚ") (i32.const 263)) +(assert_return (invoke "ㅏ") (i32.const 264)) +(assert_return (invoke "㈎") (i32.const 265)) +(assert_return (invoke "㈏") (i32.const 266)) +(assert_return (invoke "㈐") (i32.const 267)) +(assert_return (invoke "㈑") (i32.const 268)) +(assert_return (invoke "㈒") (i32.const 269)) +(assert_return (invoke "㈓") (i32.const 270)) +(assert_return (invoke "㈔") (i32.const 271)) +(assert_return (invoke "㈕") (i32.const 272)) +(assert_return (invoke "㈖") (i32.const 273)) +(assert_return (invoke "㈗") (i32.const 274)) +(assert_return (invoke "㈘") (i32.const 275)) +(assert_return (invoke "㈙") (i32.const 276)) +(assert_return (invoke "㈚") (i32.const 277)) +(assert_return (invoke "㈛") (i32.const 278)) +(assert_return (invoke "㉮") (i32.const 279)) +(assert_return (invoke "㉯") (i32.const 280)) +(assert_return (invoke "㉰") (i32.const 281)) +(assert_return (invoke "㉱") (i32.const 282)) +(assert_return (invoke "㉲") (i32.const 283)) +(assert_return (invoke "㉳") (i32.const 284)) +(assert_return (invoke "㉴") (i32.const 285)) +(assert_return (invoke "㉵") (i32.const 286)) +(assert_return (invoke "㉶") (i32.const 287)) +(assert_return (invoke "㉷") (i32.const 288)) +(assert_return (invoke "㉸") (i32.const 289)) +(assert_return (invoke "㉹") (i32.const 290)) +(assert_return (invoke "㉺") (i32.const 291)) +(assert_return (invoke "㉻") (i32.const 292)) +(assert_return (invoke "㋐") (i32.const 293)) +(assert_return (invoke "ꀊ") (i32.const 294)) +(assert_return (invoke "ꓮ") (i32.const 295)) +(assert_return (invoke "ꕉ") (i32.const 296)) +(assert_return (invoke "ꚠ") (i32.const 297)) +(assert_return (invoke "ꠀ") (i32.const 298)) +(assert_return (invoke "ꠣ") (i32.const 299)) +(assert_return (invoke "ꡝ") (i32.const 300)) +(assert_return (invoke "ꢂ") (i32.const 301)) +(assert_return (invoke "꣪") (i32.const 302)) +(assert_return (invoke "ꤢ") (i32.const 303)) +(assert_return (invoke "ꥆ") (i32.const 304)) +(assert_return (invoke "ꦄ") (i32.const 305)) +(assert_return (invoke "ꨀ") (i32.const 306)) +(assert_return (invoke "ア") (i32.const 307)) +(assert_return (invoke "ᅡ") (i32.const 308)) +(assert_return (invoke "𐀀") (i32.const 309)) +(assert_return (invoke "𐊀") (i32.const 310)) +(assert_return (invoke "𐊠") (i32.const 311)) +(assert_return (invoke "𐌀") (i32.const 312)) +(assert_return (invoke "𐎠") (i32.const 313)) +(assert_return (invoke "𐒖") (i32.const 314)) +(assert_return (invoke "𐔀") (i32.const 315)) +(assert_return (invoke "𐝀") (i32.const 316)) +(assert_return (invoke "𐠀") (i32.const 317)) +(assert_return (invoke "𐤠") (i32.const 318)) +(assert_return (invoke "𐦀") (i32.const 319)) +(assert_return (invoke "𐦠") (i32.const 320)) +(assert_return (invoke "𐨀") (i32.const 321)) +(assert_return (invoke "𐬀") (i32.const 322)) +(assert_return (invoke "𐰀") (i32.const 323)) +(assert_return (invoke "𐰁") (i32.const 324)) +(assert_return (invoke "𐲀") (i32.const 325)) +(assert_return (invoke "𑀅") (i32.const 326)) +(assert_return (invoke "𑂃") (i32.const 327)) +(assert_return (invoke "𑄧") (i32.const 328)) +(assert_return (invoke "𑅐") (i32.const 329)) +(assert_return (invoke "𑆃") (i32.const 330)) +(assert_return (invoke "𑈀") (i32.const 331)) +(assert_return (invoke "𑊀") (i32.const 332)) +(assert_return (invoke "𑊰") (i32.const 333)) +(assert_return (invoke "𑌅") (i32.const 334)) +(assert_return (invoke "𑍰") (i32.const 335)) +(assert_return (invoke "𑐀") (i32.const 336)) +(assert_return (invoke "𑒁") (i32.const 337)) +(assert_return (invoke "𑖀") (i32.const 338)) +(assert_return (invoke "𑘀") (i32.const 339)) +(assert_return (invoke "𑚀") (i32.const 340)) +(assert_return (invoke "𑜒") (i32.const 341)) +(assert_return (invoke "𑜠") (i32.const 342)) +(assert_return (invoke "𑢡") (i32.const 343)) +(assert_return (invoke "𑫕") (i32.const 344)) +(assert_return (invoke "𑰀") (i32.const 345)) +(assert_return (invoke "𑲏") (i32.const 346)) +(assert_return (invoke "𑲯") (i32.const 347)) +(assert_return (invoke "𒀀") (i32.const 348)) +(assert_return (invoke "𖧕") (i32.const 349)) +(assert_return (invoke "𖩆") (i32.const 350)) +(assert_return (invoke "𖫧") (i32.const 351)) +(assert_return (invoke "𖽔") (i32.const 352)) +(assert_return (invoke "𛱁") (i32.const 353)) +(assert_return (invoke "𛱤") (i32.const 354)) +(assert_return (invoke "𞠣") (i32.const 355)) +(assert_return (invoke "🇦") (i32.const 356)) +(assert_return (invoke "Ɑ") (i32.const 357)) +(assert_return (invoke "Λ") (i32.const 358)) +(assert_return (invoke "Ɒ") (i32.const 359)) +(assert_return (invoke "ª") (i32.const 360)) +(assert_return (invoke "∀") (i32.const 361)) +(assert_return (invoke "₳") (i32.const 362)) +(assert_return (invoke "𐤀") (i32.const 363)) +(assert_return (invoke "Ⲁ") (i32.const 364)) +(assert_return (invoke "𐌰") (i32.const 365)) +(assert_return (invoke "Ά") (i32.const 366)) +(assert_return (invoke "Α") (i32.const 367)) +(assert_return (invoke "Ἀ") (i32.const 368)) +(assert_return (invoke "Ἁ") (i32.const 369)) +(assert_return (invoke "Ἂ") (i32.const 370)) +(assert_return (invoke "Ἃ") (i32.const 371)) +(assert_return (invoke "Ἄ") (i32.const 372)) +(assert_return (invoke "Ἅ") (i32.const 373)) +(assert_return (invoke "Ἆ") (i32.const 374)) +(assert_return (invoke "Ἇ") (i32.const 375)) +(assert_return (invoke "ᾈ") (i32.const 376)) +(assert_return (invoke "ᾉ") (i32.const 377)) +(assert_return (invoke "ᾊ") (i32.const 378)) +(assert_return (invoke "ᾋ") (i32.const 379)) +(assert_return (invoke "ᾌ") (i32.const 380)) +(assert_return (invoke "ᾍ") (i32.const 381)) +(assert_return (invoke "ᾎ") (i32.const 382)) +(assert_return (invoke "ᾏ") (i32.const 383)) +(assert_return (invoke "Ᾰ") (i32.const 384)) +(assert_return (invoke "Ᾱ") (i32.const 385)) +(assert_return (invoke "Ὰ") (i32.const 386)) +(assert_return (invoke "Ά") (i32.const 387)) +(assert_return (invoke "ᾼ") (i32.const 388)) +(assert_return (invoke "𝚨") (i32.const 389)) +(assert_return (invoke "𝛢") (i32.const 390)) +(assert_return (invoke "𝜜") (i32.const 391)) +(assert_return (invoke "𝝖") (i32.const 392)) +(assert_return (invoke "𝞐") (i32.const 393)) +(assert_return (invoke "⍶") (i32.const 394)) +(assert_return (invoke "⍺") (i32.const 395)) +(assert_return (invoke "⩜") (i32.const 396)) +(assert_return (invoke "ᗅ") (i32.const 397)) +(assert_return (invoke "Ꭺ") (i32.const 398)) +(assert_return (invoke ")˺˼𔗏𝅴𝅶𝅸𝅺⁾₎❩❫⟯﴿︶﹚)⦆󠀩❳❵⟧⟩⟫⟭⦈⦊⦖⸣⸥︘︸︺︼︾﹀﹂﹄﹈﹜﹞]}」󠁝󠁽»’”›❯") (i32.const 399)) +(assert_return (invoke "(˹˻𔗎𝅳𝅵𝅷𝅹⁽₍❨❪⟮﴾︵﹙(⦅󠀨❲❴⟦⟨⟪⟬⦇⦉⦕⸢⸤︗︷︹︻︽︿﹁﹃﹇﹛﹝[{「󠁛󠁻«‘“‹❮") (i32.const 400)) +(assert_return (invoke "𝪋𝪤") (i32.const 401)) +(assert_return (invoke "𝪋") (i32.const 402)) +(assert_return (invoke "½") (i32.const 403)) +(assert_return (invoke "1⁄2") (i32.const 404)) +(assert_return (invoke "1/2") (i32.const 405)) +(assert_return (invoke "୳") (i32.const 406)) +(assert_return (invoke "൴") (i32.const 407)) +(assert_return (invoke "⳽") (i32.const 408)) +(assert_return (invoke "꠱") (i32.const 409)) +(assert_return (invoke "𐅁") (i32.const 410)) +(assert_return (invoke "𐅵") (i32.const 411)) +(assert_return (invoke "𐅶") (i32.const 412)) +(assert_return (invoke "𐦽") (i32.const 413)) +(assert_return (invoke "𐹻") (i32.const 414)) +(assert_return (invoke """) (i32.const 415)) +(assert_return (invoke "\7f") (i32.const 416)) +(assert_return (invoke "\08") (i32.const 417)) +(assert_return (invoke "⌫") (i32.const 418)) +(assert_return (invoke "⌦") (i32.const 419)) +(assert_return (invoke "␈") (i32.const 420)) +(assert_return (invoke "␡") (i32.const 421)) +(assert_return (invoke "᷻") (i32.const 422)) +(assert_return (invoke "\0f") (i32.const 423)) +(assert_return (invoke "←") (i32.const 424)) +(assert_return (invoke "⌧") (i32.const 425)) +(assert_return (invoke "⍒") (i32.const 426)) +(assert_return (invoke "⍔") (i32.const 427)) +(assert_return (invoke "⍢") (i32.const 428)) +(assert_return (invoke "⍫") (i32.const 429)) +(assert_return (invoke "\1a") (i32.const 430)) +(assert_return (invoke "␦") (i32.const 431)) +(assert_return (invoke "␚") (i32.const 432)) +(assert_return (invoke "") (i32.const 433)) +(assert_return (invoke "?") (i32.const 434)) +(assert_return (invoke "¿") (i32.const 435)) +(assert_return (invoke "᥅") (i32.const 436)) +(assert_return (invoke ";") (i32.const 437)) +(assert_return (invoke "՞") (i32.const 438)) +(assert_return (invoke "؟") (i32.const 439)) +(assert_return (invoke "፧") (i32.const 440)) +(assert_return (invoke "⁇") (i32.const 441)) +(assert_return (invoke "⍰") (i32.const 442)) +(assert_return (invoke "❓") (i32.const 443)) +(assert_return (invoke "❔") (i32.const 444)) +(assert_return (invoke "⳺") (i32.const 445)) +(assert_return (invoke "⳻") (i32.const 446)) +(assert_return (invoke "⸮") (i32.const 447)) +(assert_return (invoke "㉄") (i32.const 448)) +(assert_return (invoke "꘏") (i32.const 449)) +(assert_return (invoke "꛷") (i32.const 450)) +(assert_return (invoke "︖") (i32.const 451)) +(assert_return (invoke "﹖") (i32.const 452)) +(assert_return (invoke "?") (i32.const 453)) +(assert_return (invoke "𑅃") (i32.const 454)) +(assert_return (invoke "𞥟") (i32.const 455)) +(assert_return (invoke "󠀿") (i32.const 456)) +(assert_return (invoke "𖡄") (i32.const 457)) +(assert_return (invoke "⯑") (i32.const 458)) +(assert_return (invoke "¶") (i32.const 459)) +(assert_return (invoke "⁋") (i32.const 460)) +(assert_return (invoke "܀") (i32.const 461)) +(assert_return (invoke "჻") (i32.const 462)) +(assert_return (invoke "፨") (i32.const 463)) +(assert_return (invoke "〷") (i32.const 464)) +(assert_return (invoke "❡") (i32.const 465)) +(assert_return (invoke "⸏") (i32.const 466)) +(assert_return (invoke "⸐") (i32.const 467)) +(assert_return (invoke "⸑") (i32.const 468)) +(assert_return (invoke "⸎") (i32.const 469)) +(assert_return (invoke "\14") (i32.const 470)) +(assert_return (invoke "☙") (i32.const 471)) +(assert_return (invoke "⸿") (i32.const 472)) +(assert_return (invoke "〇") (i32.const 473)) +(assert_return (invoke "๛") (i32.const 474)) +(assert_return (invoke "ꙮ") (i32.const 475)) +(assert_return (invoke "ϓ") (i32.const 476)) +(assert_return (invoke "ϔ") (i32.const 477)) +(assert_return (invoke "ẛ") (i32.const 478)) (module ;; Test that we can use indices instead of names to reference imports, ;; exports, functions and parameters. - (import "spectest" "print" (func (param i32))) - (func (import "spectest" "print") (param i32)) + (import "spectest" "print_i32" (func (param i32))) + (func (import "spectest" "print_i32") (param i32)) (func (param i32) (param i32) - (call 0 (get_local 0)) - (call 1 (get_local 1)) + (call 0 (local.get 0)) + (call 1 (local.get 1)) ) (export "print32" (func 2)) ) -(invoke "print32" (i32.const 42) (i32.const 123)) +(assert_return (invoke "print32" (i32.const 42) (i32.const 123))) diff --git a/test/core/nop.wast b/test/core/nop.wast index ab83eede..e8fe2de4 100644 --- a/test/core/nop.wast +++ b/test/core/nop.wast @@ -4,7 +4,7 @@ ;; Auxiliary definitions (func $dummy) (func $3-ary (param i32 i32 i32) (result i32) - get_local 0 get_local 1 get_local 2 i32.sub i32.add + local.get 0 local.get 1 local.get 2 i32.sub i32.add ) (memory 1) @@ -21,158 +21,285 @@ (nop) (nop) (call $dummy) (nop) (i32.const 4) (nop) (nop) ) + (func (export "as-drop-first") (param i32) + (nop) (local.get 0) (drop) + ) (func (export "as-drop-last") (param i32) - (get_local 0) (nop) (drop) + (local.get 0) (nop) (drop) ) (func (export "as-drop-everywhere") (param i32) - (nop) (nop) (get_local 0) (nop) (nop) (drop) + (nop) (nop) (local.get 0) (nop) (nop) (drop) ) + (func (export "as-select-first") (param i32) (result i32) + (nop) (local.get 0) (local.get 0) (local.get 0) (select) + ) (func (export "as-select-mid1") (param i32) (result i32) - (get_local 0) (nop) (get_local 0) (get_local 0) (select) + (local.get 0) (nop) (local.get 0) (local.get 0) (select) ) (func (export "as-select-mid2") (param i32) (result i32) - (get_local 0) (get_local 0) (nop) (get_local 0) (select) + (local.get 0) (local.get 0) (nop) (local.get 0) (select) ) (func (export "as-select-last") (param i32) (result i32) - (get_local 0) (get_local 0) (get_local 0) (nop) (select) + (local.get 0) (local.get 0) (local.get 0) (nop) (select) ) (func (export "as-select-everywhere") (param i32) (result i32) - (nop) (get_local 0) (nop) (nop) (get_local 0) - (nop) (nop) (get_local 0) (nop) (nop) (select) + (nop) (local.get 0) (nop) (nop) (local.get 0) + (nop) (nop) (local.get 0) (nop) (nop) (select) ) (func (export "as-block-first") (result i32) - (block i32 (nop) (i32.const 2)) + (block (result i32) (nop) (i32.const 2)) ) (func (export "as-block-mid") (result i32) - (block i32 (call $dummy) (nop) (i32.const 2)) + (block (result i32) (call $dummy) (nop) (i32.const 2)) ) (func (export "as-block-last") (result i32) - (block i32 (nop) (call $dummy) (i32.const 3) (nop)) + (block (result i32) (nop) (call $dummy) (i32.const 3) (nop)) ) (func (export "as-block-everywhere") (result i32) - (block i32 (nop) (nop) (call $dummy) (nop) (i32.const 4) (nop) (nop)) + (block (result i32) + (nop) (nop) (call $dummy) (nop) (i32.const 4) (nop) (nop) + ) ) (func (export "as-loop-first") (result i32) - (loop i32 (nop) (i32.const 2)) + (loop (result i32) (nop) (i32.const 2)) ) (func (export "as-loop-mid") (result i32) - (loop i32 (call $dummy) (nop) (i32.const 2)) + (loop (result i32) (call $dummy) (nop) (i32.const 2)) ) (func (export "as-loop-last") (result i32) - (loop i32 (call $dummy) (i32.const 3) (nop)) + (loop (result i32) (call $dummy) (i32.const 3) (nop)) ) (func (export "as-loop-everywhere") (result i32) - (loop i32 (nop) (nop) (call $dummy) (nop) (i32.const 4) (nop) (nop)) + (loop (result i32) + (nop) (nop) (call $dummy) (nop) (i32.const 4) (nop) (nop) + ) ) (func (export "as-if-condition") (param i32) - (get_local 0) (nop) (if (then (call $dummy))) + (local.get 0) (nop) (if (then (call $dummy))) ) (func (export "as-if-then") (param i32) - (if (get_local 0) (nop) (call $dummy)) + (if (local.get 0) (then (nop)) (else (call $dummy))) ) (func (export "as-if-else") (param i32) - (if (get_local 0) (call $dummy) (nop)) + (if (local.get 0) (then (call $dummy)) (else (nop))) ) + (func (export "as-br-first") (param i32) (result i32) + (block (result i32) (nop) (local.get 0) (br 0)) + ) (func (export "as-br-last") (param i32) (result i32) - (block i32 (get_local 0) (nop) (br 0)) + (block (result i32) (local.get 0) (nop) (br 0)) ) (func (export "as-br-everywhere") (param i32) (result i32) - (block i32 (nop) (nop) (get_local 0) (nop) (nop) (br 0)) + (block (result i32) (nop) (nop) (local.get 0) (nop) (nop) (br 0)) ) + (func (export "as-br_if-first") (param i32) (result i32) + (block (result i32) (nop) (local.get 0) (local.get 0) (br_if 0)) + ) (func (export "as-br_if-mid") (param i32) (result i32) - (block i32 (get_local 0) (nop) (get_local 0) (br_if 0)) + (block (result i32) (local.get 0) (nop) (local.get 0) (br_if 0)) ) (func (export "as-br_if-last") (param i32) (result i32) - (block i32 (get_local 0) (get_local 0) (nop) (br_if 0)) + (block (result i32) (local.get 0) (local.get 0) (nop) (br_if 0)) ) (func (export "as-br_if-everywhere") (param i32) (result i32) - (block i32 - (nop) (nop) (get_local 0) (nop) (nop) (get_local 0) (nop) (nop) + (block (result i32) + (nop) (nop) (local.get 0) (nop) (nop) (local.get 0) (nop) (nop) (br_if 0) ) ) + (func (export "as-br_table-first") (param i32) (result i32) + (block (result i32) (nop) (local.get 0) (local.get 0) (br_table 0 0)) + ) (func (export "as-br_table-mid") (param i32) (result i32) - (block i32 (get_local 0) (nop) (get_local 0) (br_table 0 0)) + (block (result i32) (local.get 0) (nop) (local.get 0) (br_table 0 0)) ) (func (export "as-br_table-last") (param i32) (result i32) - (block i32 (get_local 0) (get_local 0) (nop) (br_table 0 0)) + (block (result i32) (local.get 0) (local.get 0) (nop) (br_table 0 0)) ) (func (export "as-br_table-everywhere") (param i32) (result i32) - (block i32 - (nop) (nop) (get_local 0) (nop) (nop) (get_local 0) (nop) (nop) + (block (result i32) + (nop) (nop) (local.get 0) (nop) (nop) (local.get 0) (nop) (nop) (br_table 0 0) ) ) + (func (export "as-return-first") (param i32) (result i32) + (nop) (local.get 0) (return) + ) (func (export "as-return-last") (param i32) (result i32) - (get_local 0) (nop) (return) + (local.get 0) (nop) (return) ) (func (export "as-return-everywhere") (param i32) (result i32) - (nop) (nop) (get_local 0) (nop) (nop) (return) + (nop) (nop) (local.get 0) (nop) (nop) (return) ) + (func (export "as-call-first") (param i32 i32 i32) (result i32) + (nop) (local.get 0) (local.get 1) (local.get 2) (call $3-ary) + ) (func (export "as-call-mid1") (param i32 i32 i32) (result i32) - (get_local 0) (nop) (get_local 1) (get_local 2) (call $3-ary) + (local.get 0) (nop) (local.get 1) (local.get 2) (call $3-ary) ) (func (export "as-call-mid2") (param i32 i32 i32) (result i32) - (get_local 0) (get_local 1) (nop) (get_local 2) (call $3-ary) + (local.get 0) (local.get 1) (nop) (local.get 2) (call $3-ary) ) (func (export "as-call-last") (param i32 i32 i32) (result i32) - (get_local 0) (get_local 1) (get_local 2) (nop) (call $3-ary) + (local.get 0) (local.get 1) (local.get 2) (nop) (call $3-ary) ) (func (export "as-call-everywhere") (param i32 i32 i32) (result i32) - (nop) (nop) (get_local 0) (nop) (nop) (get_local 1) - (nop) (nop) (get_local 2) (nop) (nop) (call $3-ary) + (nop) (nop) (local.get 0) (nop) (nop) (local.get 1) + (nop) (nop) (local.get 2) (nop) (nop) (call $3-ary) ) - ;; TODO(stack): call_indirect, *_local, load*, store* - + (func (export "as-unary-first") (param i32) (result i32) + (nop) (local.get 0) (i32.ctz) + ) (func (export "as-unary-last") (param i32) (result i32) - (get_local 0) (nop) (i32.ctz) + (local.get 0) (nop) (i32.ctz) ) (func (export "as-unary-everywhere") (param i32) (result i32) - (nop) (nop) (get_local 0) (nop) (nop) (i32.ctz) + (nop) (nop) (local.get 0) (nop) (nop) (i32.ctz) ) + (func (export "as-binary-first") (param i32) (result i32) + (nop) (local.get 0) (local.get 0) (i32.add) + ) (func (export "as-binary-mid") (param i32) (result i32) - (get_local 0) (nop) (get_local 0) (i32.add) + (local.get 0) (nop) (local.get 0) (i32.add) ) (func (export "as-binary-last") (param i32) (result i32) - (get_local 0) (get_local 0) (nop) (i32.add) + (local.get 0) (local.get 0) (nop) (i32.add) ) (func (export "as-binary-everywhere") (param i32) (result i32) - (nop) (get_local 0) (nop) (nop) (get_local 0) (nop) (nop) (i32.add) + (nop) (local.get 0) (nop) (nop) (local.get 0) (nop) (nop) (i32.add) ) + (func (export "as-test-first") (param i32) (result i32) + (nop) (local.get 0) (i32.eqz) + ) (func (export "as-test-last") (param i32) (result i32) - (get_local 0) (nop) (i32.eqz) + (local.get 0) (nop) (i32.eqz) ) (func (export "as-test-everywhere") (param i32) (result i32) - (nop) (nop) (get_local 0) (nop) (nop) i32.eqz + (nop) (nop) (local.get 0) (nop) (nop) i32.eqz ) + (func (export "as-compare-first") (param i32) (result i32) + (nop) (local.get 0) (local.get 0) (i32.ne) + ) (func (export "as-compare-mid") (param i32) (result i32) - (get_local 0) (nop) (get_local 0) (i32.ne) + (local.get 0) (nop) (local.get 0) (i32.ne) ) (func (export "as-compare-last") (param i32) (result i32) - (get_local 0) (get_local 0) (nop) (i32.lt_u) + (local.get 0) (local.get 0) (nop) (i32.lt_u) ) (func (export "as-compare-everywhere") (param i32) (result i32) - (nop) (get_local 0) (nop) (nop) (get_local 0) (nop) (nop) (i32.le_s) + (nop) (local.get 0) (nop) (nop) (local.get 0) (nop) (nop) (i32.le_s) ) - (func (export "as-grow_memory-last") (param i32) (result i32) - (get_local 0) (nop) (grow_memory) + (func (export "as-memory.grow-first") (param i32) (result i32) + (nop) (local.get 0) (memory.grow) ) - (func (export "as-grow_memory-everywhere") (param i32) (result i32) - (nop) (nop) (get_local 0) (nop) (nop) (grow_memory) + (func (export "as-memory.grow-last") (param i32) (result i32) + (local.get 0) (nop) (memory.grow) + ) + (func (export "as-memory.grow-everywhere") (param i32) (result i32) + (nop) (nop) (local.get 0) (nop) (nop) (memory.grow) + ) + + (func $func (param i32 i32) (result i32) (local.get 0)) + (type $check (func (param i32 i32) (result i32))) + (table funcref (elem $func)) + (func (export "as-call_indirect-first") (result i32) + (block (result i32) + (nop) (i32.const 1) (i32.const 2) (i32.const 0) + (call_indirect (type $check)) + ) + ) + (func (export "as-call_indirect-mid1") (result i32) + (block (result i32) + (i32.const 1) (nop) (i32.const 2) (i32.const 0) + (call_indirect (type $check)) + ) + ) + (func (export "as-call_indirect-mid2") (result i32) + (block (result i32) + (i32.const 1) (i32.const 2) (nop) (i32.const 0) + (call_indirect (type $check)) + ) + ) + (func (export "as-call_indirect-last") (result i32) + (block (result i32) + (i32.const 1) (i32.const 2) (i32.const 0) (nop) + (call_indirect (type $check)) + ) + ) + (func (export "as-call_indirect-everywhere") (result i32) + (block (result i32) + (nop) (nop) (i32.const 1) (nop) (nop) (i32.const 2) (nop) (nop) (i32.const 0) (nop) (nop) + (call_indirect (type $check)) + ) + ) + + (func (export "as-local.set-first") (param i32) (result i32) + (nop) (i32.const 2) (local.set 0) (local.get 0) + ) + (func (export "as-local.set-last") (param i32) (result i32) + (i32.const 2) (nop) (local.set 0) (local.get 0) + ) + (func (export "as-local.set-everywhere") (param i32) (result i32) + (nop) (nop) (i32.const 2) (nop) (nop) (local.set 0) (local.get 0) + ) + + (func (export "as-local.tee-first") (param i32) (result i32) + (nop) (i32.const 2) (local.tee 0) + ) + (func (export "as-local.tee-last") (param i32) (result i32) + (i32.const 2) (nop) (local.tee 0) + ) + (func (export "as-local.tee-everywhere") (param i32) (result i32) + (nop) (nop) (i32.const 2) (nop) (nop) (local.tee 0) + ) + + (global $a (mut i32) (i32.const 0)) + (func (export "as-global.set-first") (result i32) + (nop) (i32.const 2) (global.set $a) (global.get $a) + ) + (func (export "as-global.set-last") (result i32) + (i32.const 2) (nop) (global.set $a) (global.get $a) + ) + (func (export "as-global.set-everywhere") (result i32) + (nop) (nop) (i32.const 2) (nop) (nop) (global.set 0) + (global.get $a) + ) + + (func (export "as-load-first") (param i32) (result i32) + (nop) (local.get 0) (i32.load) + ) + (func (export "as-load-last") (param i32) (result i32) + (local.get 0) (nop) (i32.load) + ) + (func (export "as-load-everywhere") (param i32) (result i32) + (nop) (nop) (local.get 0) (nop) (nop) (i32.load) + ) + + (func (export "as-store-first") (param i32 i32) + (nop) (local.get 0) (local.get 1) (i32.store) + ) + (func (export "as-store-mid") (param i32 i32) + (local.get 0) (nop) (local.get 1) (i32.store) + ) + (func (export "as-store-last") (param i32 i32) + (local.get 0) (local.get 1) (nop) (i32.store) + ) + (func (export "as-store-everywhere") (param i32 i32) + (nop) (nop) (local.get 0) (nop) (nop) (local.get 1) (nop) (nop) (i32.store) ) ) @@ -181,9 +308,11 @@ (assert_return (invoke "as-func-last") (i32.const 3)) (assert_return (invoke "as-func-everywhere") (i32.const 4)) +(assert_return (invoke "as-drop-first" (i32.const 0))) (assert_return (invoke "as-drop-last" (i32.const 0))) (assert_return (invoke "as-drop-everywhere" (i32.const 0))) +(assert_return (invoke "as-select-first" (i32.const 3)) (i32.const 3)) (assert_return (invoke "as-select-mid1" (i32.const 3)) (i32.const 3)) (assert_return (invoke "as-select-mid2" (i32.const 3)) (i32.const 3)) (assert_return (invoke "as-select-last" (i32.const 3)) (i32.const 3)) @@ -206,41 +335,78 @@ (assert_return (invoke "as-if-else" (i32.const 0))) (assert_return (invoke "as-if-else" (i32.const 3))) +(assert_return (invoke "as-br-first" (i32.const 5)) (i32.const 5)) (assert_return (invoke "as-br-last" (i32.const 6)) (i32.const 6)) (assert_return (invoke "as-br-everywhere" (i32.const 7)) (i32.const 7)) +(assert_return (invoke "as-br_if-first" (i32.const 4)) (i32.const 4)) (assert_return (invoke "as-br_if-mid" (i32.const 5)) (i32.const 5)) (assert_return (invoke "as-br_if-last" (i32.const 6)) (i32.const 6)) (assert_return (invoke "as-br_if-everywhere" (i32.const 7)) (i32.const 7)) +(assert_return (invoke "as-br_table-first" (i32.const 4)) (i32.const 4)) (assert_return (invoke "as-br_table-mid" (i32.const 5)) (i32.const 5)) (assert_return (invoke "as-br_table-last" (i32.const 6)) (i32.const 6)) (assert_return (invoke "as-br_table-everywhere" (i32.const 7)) (i32.const 7)) +(assert_return (invoke "as-return-first" (i32.const 5)) (i32.const 5)) (assert_return (invoke "as-return-last" (i32.const 6)) (i32.const 6)) (assert_return (invoke "as-return-everywhere" (i32.const 7)) (i32.const 7)) +(assert_return (invoke "as-call-first" (i32.const 3) (i32.const 1) (i32.const 2)) (i32.const 2)) (assert_return (invoke "as-call-mid1" (i32.const 3) (i32.const 1) (i32.const 2)) (i32.const 2)) (assert_return (invoke "as-call-mid2" (i32.const 0) (i32.const 3) (i32.const 1)) (i32.const 2)) (assert_return (invoke "as-call-last" (i32.const 10) (i32.const 9) (i32.const -1)) (i32.const 20)) (assert_return (invoke "as-call-everywhere" (i32.const 2) (i32.const 1) (i32.const 5)) (i32.const -2)) +(assert_return (invoke "as-unary-first" (i32.const 30)) (i32.const 1)) (assert_return (invoke "as-unary-last" (i32.const 30)) (i32.const 1)) (assert_return (invoke "as-unary-everywhere" (i32.const 12)) (i32.const 2)) +(assert_return (invoke "as-binary-first" (i32.const 3)) (i32.const 6)) (assert_return (invoke "as-binary-mid" (i32.const 3)) (i32.const 6)) (assert_return (invoke "as-binary-last" (i32.const 3)) (i32.const 6)) (assert_return (invoke "as-binary-everywhere" (i32.const 3)) (i32.const 6)) +(assert_return (invoke "as-test-first" (i32.const 0)) (i32.const 1)) (assert_return (invoke "as-test-last" (i32.const 0)) (i32.const 1)) (assert_return (invoke "as-test-everywhere" (i32.const 0)) (i32.const 1)) +(assert_return (invoke "as-compare-first" (i32.const 3)) (i32.const 0)) (assert_return (invoke "as-compare-mid" (i32.const 3)) (i32.const 0)) (assert_return (invoke "as-compare-last" (i32.const 3)) (i32.const 0)) (assert_return (invoke "as-compare-everywhere" (i32.const 3)) (i32.const 1)) -(assert_return (invoke "as-grow_memory-last" (i32.const 2)) (i32.const 1)) -(assert_return (invoke "as-grow_memory-everywhere" (i32.const 12)) (i32.const 3)) +(assert_return (invoke "as-memory.grow-first" (i32.const 0)) (i32.const 1)) +(assert_return (invoke "as-memory.grow-last" (i32.const 2)) (i32.const 1)) +(assert_return (invoke "as-memory.grow-everywhere" (i32.const 12)) (i32.const 3)) + +(assert_return (invoke "as-call_indirect-first") (i32.const 1)) +(assert_return (invoke "as-call_indirect-mid1") (i32.const 1)) +(assert_return (invoke "as-call_indirect-mid2") (i32.const 1)) +(assert_return (invoke "as-call_indirect-last") (i32.const 1)) +(assert_return (invoke "as-call_indirect-everywhere") (i32.const 1)) + +(assert_return (invoke "as-local.set-first" (i32.const 1)) (i32.const 2)) +(assert_return (invoke "as-local.set-last" (i32.const 1)) (i32.const 2)) +(assert_return (invoke "as-local.set-everywhere" (i32.const 1)) (i32.const 2)) + +(assert_return (invoke "as-local.tee-first" (i32.const 1)) (i32.const 2)) +(assert_return (invoke "as-local.tee-last" (i32.const 1)) (i32.const 2)) +(assert_return (invoke "as-local.tee-everywhere" (i32.const 1)) (i32.const 2)) + +(assert_return (invoke "as-global.set-first") (i32.const 2)) +(assert_return (invoke "as-global.set-last") (i32.const 2)) +(assert_return (invoke "as-global.set-everywhere") (i32.const 2)) + +(assert_return (invoke "as-load-first" (i32.const 100)) (i32.const 0)) +(assert_return (invoke "as-load-last" (i32.const 100)) (i32.const 0)) +(assert_return (invoke "as-load-everywhere" (i32.const 100)) (i32.const 0)) + +(assert_return (invoke "as-store-first" (i32.const 0) (i32.const 1))) +(assert_return (invoke "as-store-mid" (i32.const 0) (i32.const 2))) +(assert_return (invoke "as-store-last" (i32.const 0) (i32.const 3))) +(assert_return (invoke "as-store-everywhere" (i32.const 0) (i32.const 4))) (assert_invalid (module (func $type-i32 (result i32) (nop))) diff --git a/test/core/of_string-overflow-hex-u32.fail.wast b/test/core/of_string-overflow-hex-u32.fail.wast deleted file mode 100644 index 1323a1f0..00000000 --- a/test/core/of_string-overflow-hex-u32.fail.wast +++ /dev/null @@ -1 +0,0 @@ -(module (func (i32.const 0x100000000))) diff --git a/test/core/of_string-overflow-hex-u64.fail.wast b/test/core/of_string-overflow-hex-u64.fail.wast deleted file mode 100644 index d13d6e4b..00000000 --- a/test/core/of_string-overflow-hex-u64.fail.wast +++ /dev/null @@ -1 +0,0 @@ -(module (func (i64.const 0x10000000000000000))) diff --git a/test/core/of_string-overflow-s32.fail.wast b/test/core/of_string-overflow-s32.fail.wast deleted file mode 100644 index 4dda9602..00000000 --- a/test/core/of_string-overflow-s32.fail.wast +++ /dev/null @@ -1 +0,0 @@ -(module (func (i32.const -2147483649))) diff --git a/test/core/of_string-overflow-s64.fail.wast b/test/core/of_string-overflow-s64.fail.wast deleted file mode 100644 index 1034b0b0..00000000 --- a/test/core/of_string-overflow-s64.fail.wast +++ /dev/null @@ -1 +0,0 @@ -(module (func (i64.const -9223372036854775809))) diff --git a/test/core/of_string-overflow-u32.fail.wast b/test/core/of_string-overflow-u32.fail.wast deleted file mode 100644 index 8f226177..00000000 --- a/test/core/of_string-overflow-u32.fail.wast +++ /dev/null @@ -1 +0,0 @@ -(module (func (i32.const 4294967296))) diff --git a/test/core/of_string-overflow-u64.fail.wast b/test/core/of_string-overflow-u64.fail.wast deleted file mode 100644 index cfa2c46b..00000000 --- a/test/core/of_string-overflow-u64.fail.wast +++ /dev/null @@ -1 +0,0 @@ -(module (func (i64.const 18446744073709551616))) diff --git a/test/core/ref_func.wast b/test/core/ref_func.wast new file mode 100644 index 00000000..393d3f82 --- /dev/null +++ b/test/core/ref_func.wast @@ -0,0 +1,64 @@ +(module + (func (export "f") (param $x i32) (result i32) (local.get $x)) +) +(register "M") + +(module + (func $f (import "M" "f") (param i32) (result i32)) + (func $g (param $x i32) (result i32) (i32.add (local.get $x) (i32.const 1))) + + (global anyref (ref.func $f)) + (global anyref (ref.func $g)) + (global funcref (ref.func $f)) + (global funcref (ref.func $g)) + (global $v (mut funcref) (ref.func $f)) + + (func (export "is_null-f") (result i32) + (ref.is_null (ref.func $f)) + ) + (func (export "is_null-g") (result i32) + (ref.is_null (ref.func $g)) + ) + (func (export "is_null-v") (result i32) + (ref.is_null (global.get $v)) + ) + + (func (export "set-f") (global.set $v (ref.func $f))) + (func (export "set-g") (global.set $v (ref.func $g))) + + (table $t 1 funcref) + + (func (export "call-f") (param $x i32) (result i32) + (table.set $t (i32.const 0) (ref.func $f)) + (call_indirect $t (param i32) (result i32) (local.get $x) (i32.const 0)) + ) + (func (export "call-g") (param $x i32) (result i32) + (table.set $t (i32.const 0) (ref.func $g)) + (call_indirect $t (param i32) (result i32) (local.get $x) (i32.const 0)) + ) + (func (export "call-v") (param $x i32) (result i32) + (table.set $t (i32.const 0) (global.get $v)) + (call_indirect $t (param i32) (result i32) (local.get $x) (i32.const 0)) + ) +) + +(assert_return (invoke "is_null-f") (i32.const 0)) +(assert_return (invoke "is_null-g") (i32.const 0)) +(assert_return (invoke "is_null-v") (i32.const 0)) + +(assert_return (invoke "call-f" (i32.const 4)) (i32.const 4)) +(assert_return (invoke "call-g" (i32.const 4)) (i32.const 5)) +(assert_return (invoke "call-v" (i32.const 4)) (i32.const 4)) +(invoke "set-g") +(assert_return (invoke "call-v" (i32.const 4)) (i32.const 5)) +(invoke "set-f") +(assert_return (invoke "call-v" (i32.const 4)) (i32.const 4)) + +(assert_invalid + (module + (func $f (import "M" "f") (param i32) (result i32)) + (func $g (import "M" "g") (param i32) (result i32)) + (global funcref (ref.func 7)) + ) + "unknown function 7" +) diff --git a/test/core/ref_is_null.wast b/test/core/ref_is_null.wast new file mode 100644 index 00000000..3e9a6783 --- /dev/null +++ b/test/core/ref_is_null.wast @@ -0,0 +1,61 @@ +(module + (func $f1 (export "nullref") (param $x nullref) (result i32) + (ref.is_null (local.get $x)) + ) + (func $f2 (export "anyref") (param $x anyref) (result i32) + (ref.is_null (local.get $x)) + ) + (func $f3 (export "funcref") (param $x funcref) (result i32) + (ref.is_null (local.get $x)) + ) + + (table $t1 2 nullref) + (table $t2 2 anyref) + (table $t3 2 funcref) (elem $t3 (i32.const 1) $dummy) + (func $dummy) + + (func (export "init") (param $r anyref) + (table.set $t2 (i32.const 1) (local.get $r)) + ) + (func (export "deinit") + (table.set $t1 (i32.const 1) (ref.null)) + (table.set $t2 (i32.const 1) (ref.null)) + (table.set $t3 (i32.const 1) (ref.null)) + ) + + (func (export "nullref-elem") (param $x i32) (result i32) + (call $f1 (table.get $t1 (local.get $x))) + ) + (func (export "anyref-elem") (param $x i32) (result i32) + (call $f2 (table.get $t2 (local.get $x))) + ) + (func (export "funcref-elem") (param $x i32) (result i32) + (call $f3 (table.get $t3 (local.get $x))) + ) +) + +(assert_return (invoke "nullref" (ref.null)) (i32.const 1)) +(assert_return (invoke "anyref" (ref.null)) (i32.const 1)) +(assert_return (invoke "funcref" (ref.null)) (i32.const 1)) + +(assert_return (invoke "anyref" (ref.host 1)) (i32.const 0)) + +(invoke "init" (ref.host 0)) + +(assert_return (invoke "nullref-elem" (i32.const 0)) (i32.const 1)) +(assert_return (invoke "anyref-elem" (i32.const 0)) (i32.const 1)) +(assert_return (invoke "funcref-elem" (i32.const 0)) (i32.const 1)) + +(assert_return (invoke "nullref-elem" (i32.const 1)) (i32.const 1)) +(assert_return (invoke "anyref-elem" (i32.const 1)) (i32.const 0)) +(assert_return (invoke "funcref-elem" (i32.const 1)) (i32.const 0)) + +(invoke "deinit") + +(assert_return (invoke "nullref-elem" (i32.const 0)) (i32.const 1)) +(assert_return (invoke "anyref-elem" (i32.const 0)) (i32.const 1)) +(assert_return (invoke "funcref-elem" (i32.const 0)) (i32.const 1)) + +(assert_return (invoke "nullref-elem" (i32.const 0)) (i32.const 1)) +(assert_return (invoke "anyref-elem" (i32.const 1)) (i32.const 1)) +(assert_return (invoke "funcref-elem" (i32.const 1)) (i32.const 1)) diff --git a/test/core/ref_null.wast b/test/core/ref_null.wast new file mode 100644 index 00000000..96cac314 --- /dev/null +++ b/test/core/ref_null.wast @@ -0,0 +1,13 @@ +(module + (func (export "anyref") (result anyref) (ref.null)) + (func (export "funcref") (result funcref) (ref.null)) + (func (export "nullref") (result nullref) (ref.null)) + + (global anyref (ref.null)) + (global funcref (ref.null)) + (global nullref (ref.null)) +) + +(assert_return (invoke "anyref") (ref.null)) +(assert_return (invoke "funcref") (ref.null)) +(assert_return (invoke "nullref") (ref.null)) diff --git a/test/core/resizing.wast b/test/core/resizing.wast deleted file mode 100644 index 80d20b56..00000000 --- a/test/core/resizing.wast +++ /dev/null @@ -1,60 +0,0 @@ -(module - (memory 0) - - (func (export "load_at_zero") (result i32) (i32.load (i32.const 0))) - (func (export "store_at_zero") (i32.store (i32.const 0) (i32.const 2))) - - (func (export "load_at_page_size") (result i32) (i32.load (i32.const 0x10000))) - (func (export "store_at_page_size") (i32.store (i32.const 0x10000) (i32.const 3))) - - (func (export "grow") (param $sz i32) (result i32) (grow_memory (get_local $sz))) - (func (export "size") (result i32) (current_memory)) -) - -(assert_return (invoke "size") (i32.const 0)) -(assert_trap (invoke "store_at_zero") "out of bounds memory access") -(assert_trap (invoke "load_at_zero") "out of bounds memory access") -(assert_trap (invoke "store_at_page_size") "out of bounds memory access") -(assert_trap (invoke "load_at_page_size") "out of bounds memory access") -(assert_return (invoke "grow" (i32.const 1)) (i32.const 0)) -(assert_return (invoke "size") (i32.const 1)) -(assert_return (invoke "load_at_zero") (i32.const 0)) -(assert_return (invoke "store_at_zero")) -(assert_return (invoke "load_at_zero") (i32.const 2)) -(assert_trap (invoke "store_at_page_size") "out of bounds memory access") -(assert_trap (invoke "load_at_page_size") "out of bounds memory access") -(assert_return (invoke "grow" (i32.const 4)) (i32.const 1)) -(assert_return (invoke "size") (i32.const 5)) -(assert_return (invoke "load_at_zero") (i32.const 2)) -(assert_return (invoke "store_at_zero")) -(assert_return (invoke "load_at_zero") (i32.const 2)) -(assert_return (invoke "load_at_page_size") (i32.const 0)) -(assert_return (invoke "store_at_page_size")) -(assert_return (invoke "load_at_page_size") (i32.const 3)) - - -(module - (memory 0) - (func (export "grow") (param i32) (result i32) (grow_memory (get_local 0))) -) - -(assert_return (invoke "grow" (i32.const 0)) (i32.const 0)) -(assert_return (invoke "grow" (i32.const 1)) (i32.const 0)) -(assert_return (invoke "grow" (i32.const 0)) (i32.const 1)) -(assert_return (invoke "grow" (i32.const 2)) (i32.const 1)) -(assert_return (invoke "grow" (i32.const 800)) (i32.const 3)) -(assert_return (invoke "grow" (i32.const 0x10000)) (i32.const -1)) - -(module - (memory 0 10) - (func (export "grow") (param i32) (result i32) (grow_memory (get_local 0))) -) - -(assert_return (invoke "grow" (i32.const 0)) (i32.const 0)) -(assert_return (invoke "grow" (i32.const 1)) (i32.const 0)) -(assert_return (invoke "grow" (i32.const 1)) (i32.const 1)) -(assert_return (invoke "grow" (i32.const 2)) (i32.const 2)) -(assert_return (invoke "grow" (i32.const 6)) (i32.const 4)) -(assert_return (invoke "grow" (i32.const 0)) (i32.const 10)) -(assert_return (invoke "grow" (i32.const 1)) (i32.const -1)) -(assert_return (invoke "grow" (i32.const 0x10000)) (i32.const -1)) diff --git a/test/core/return.wast b/test/core/return.wast index 60db41c1..7077f25b 100644 --- a/test/core/return.wast +++ b/test/core/return.wast @@ -9,6 +9,19 @@ (func (export "type-f32") (drop (f32.neg (return)))) (func (export "type-f64") (drop (f64.neg (return)))) + (func (export "type-i32-value") (result i32) + (block (result i32) (i32.ctz (return (i32.const 1)))) + ) + (func (export "type-i64-value") (result i64) + (block (result i64) (i64.ctz (return (i64.const 2)))) + ) + (func (export "type-f32-value") (result f32) + (block (result f32) (f32.neg (return (f32.const 3)))) + ) + (func (export "type-f64-value") (result f64) + (block (result f64) (f64.neg (return (f64.const 4)))) + ) + (func (export "nullary") (return)) (func (export "unary") (result f64) (return (f64.const 3))) @@ -35,33 +48,33 @@ (block (nop) (call $dummy) (return)) ) (func (export "as-block-value") (result i32) - (block i32 (nop) (call $dummy) (return (i32.const 2))) + (block (result i32) (nop) (call $dummy) (return (i32.const 2))) ) (func (export "as-loop-first") (result i32) - (loop i32 (return (i32.const 3)) (i32.const 2)) + (loop (result i32) (return (i32.const 3)) (i32.const 2)) ) (func (export "as-loop-mid") (result i32) - (loop i32 (call $dummy) (return (i32.const 4)) (i32.const 2)) + (loop (result i32) (call $dummy) (return (i32.const 4)) (i32.const 2)) ) (func (export "as-loop-last") (result i32) - (loop i32 (nop) (call $dummy) (return (i32.const 5))) + (loop (result i32) (nop) (call $dummy) (return (i32.const 5))) ) (func (export "as-br-value") (result i32) - (block i32 (br 0 (return (i32.const 9)))) + (block (result i32) (br 0 (return (i32.const 9)))) ) (func (export "as-br_if-cond") (block (br_if 0 (return))) ) (func (export "as-br_if-value") (result i32) - (block i32 + (block (result i32) (drop (br_if 0 (return (i32.const 8)) (i32.const 1))) (i32.const 7) ) ) (func (export "as-br_if-value-cond") (result i32) - (block i32 + (block (result i32) (drop (br_if 0 (i32.const 6) (return (i32.const 9)))) (i32.const 7) ) ) @@ -70,12 +83,12 @@ (block (br_table 0 0 0 (return (i64.const 9)))) (i64.const -1) ) (func (export "as-br_table-value") (result i32) - (block i32 + (block (result i32) (br_table 0 0 0 (return (i32.const 10)) (i32.const 1)) (i32.const 7) ) ) (func (export "as-br_table-value-index") (result i32) - (block i32 + (block (result i32) (br_table 0 0 (i32.const 6) (return (i32.const 11))) (i32.const 7) ) ) @@ -85,20 +98,26 @@ ) (func (export "as-if-cond") (result i32) - (if i32 (return (i32.const 2)) (i32.const 0) (i32.const 1)) + (if (result i32) + (return (i32.const 2)) (then (i32.const 0)) (else (i32.const 1)) + ) ) (func (export "as-if-then") (param i32 i32) (result i32) - (if i32 (get_local 0) (return (i32.const 3)) (get_local 1)) + (if (result i32) + (local.get 0) (then (return (i32.const 3))) (else (local.get 1)) + ) ) (func (export "as-if-else") (param i32 i32) (result i32) - (if i32 (get_local 0) (get_local 1) (return (i32.const 4))) + (if (result i32) + (local.get 0) (then (local.get 1)) (else (return (i32.const 4))) + ) ) (func (export "as-select-first") (param i32 i32) (result i32) - (select (return (i32.const 5)) (get_local 0) (get_local 1)) + (select (return (i32.const 5)) (local.get 0) (local.get 1)) ) (func (export "as-select-second") (param i32 i32) (result i32) - (select (get_local 0) (return (i32.const 6)) (get_local 1)) + (select (local.get 0) (return (i32.const 6)) (local.get 1)) ) (func (export "as-select-cond") (result i32) (select (i32.const 0) (i32.const 1) (return (i32.const 7))) @@ -116,22 +135,37 @@ ) (type $sig (func (param i32 i32 i32) (result i32))) - (table anyfunc (elem $f)) + (table funcref (elem $f)) (func (export "as-call_indirect-func") (result i32) - (call_indirect $sig (return (i32.const 20)) (i32.const 1) (i32.const 2) (i32.const 3)) + (call_indirect (type $sig) + (return (i32.const 20)) (i32.const 1) (i32.const 2) (i32.const 3) + ) ) (func (export "as-call_indirect-first") (result i32) - (call_indirect $sig (i32.const 0) (return (i32.const 21)) (i32.const 2) (i32.const 3)) + (call_indirect (type $sig) + (i32.const 0) (return (i32.const 21)) (i32.const 2) (i32.const 3) + ) ) (func (export "as-call_indirect-mid") (result i32) - (call_indirect $sig (i32.const 0) (i32.const 1) (return (i32.const 22)) (i32.const 3)) + (call_indirect (type $sig) + (i32.const 0) (i32.const 1) (return (i32.const 22)) (i32.const 3) + ) ) (func (export "as-call_indirect-last") (result i32) - (call_indirect $sig (i32.const 0) (i32.const 1) (i32.const 2) (return (i32.const 23))) + (call_indirect (type $sig) + (i32.const 0) (i32.const 1) (i32.const 2) (return (i32.const 23)) + ) ) - (func (export "as-set_local-value") (result i32) (local f32) - (set_local 0 (return (i32.const 17))) (i32.const -1) + (func (export "as-local.set-value") (result i32) (local f32) + (local.set 0 (return (i32.const 17))) (i32.const -1) + ) + (func (export "as-local.tee-value") (result i32) (local i32) + (local.tee 0 (return (i32.const 1))) + ) + (global $a (mut i32) (i32.const 0)) + (func (export "as-global.set-value") (result i32) + (global.set $a (return (i32.const 1))) ) (memory 1) @@ -179,11 +213,11 @@ ) (func (export "as-convert-operand") (result i32) - (i32.wrap/i64 (return (i32.const 41))) + (i32.wrap_i64 (return (i32.const 41))) ) - (func (export "as-grow_memory-size") (result i32) - (grow_memory (return (i32.const 40))) + (func (export "as-memory.grow-size") (result i32) + (memory.grow (return (i32.const 40))) ) ) @@ -192,6 +226,11 @@ (assert_return (invoke "type-f32")) (assert_return (invoke "type-f64")) +(assert_return (invoke "type-i32-value") (i32.const 1)) +(assert_return (invoke "type-i64-value") (i64.const 2)) +(assert_return (invoke "type-f32-value") (f32.const 3)) +(assert_return (invoke "type-f64-value") (f64.const 4)) + (assert_return (invoke "nullary")) (assert_return (invoke "unary") (f64.const 3)) @@ -242,7 +281,9 @@ (assert_return (invoke "as-call_indirect-mid") (i32.const 22)) (assert_return (invoke "as-call_indirect-last") (i32.const 23)) -(assert_return (invoke "as-set_local-value") (i32.const 17)) +(assert_return (invoke "as-local.set-value") (i32.const 17)) +(assert_return (invoke "as-local.tee-value") (i32.const 1)) +(assert_return (invoke "as-global.set-value") (i32.const 1)) (assert_return (invoke "as-load-address") (f32.const 1.7)) (assert_return (invoke "as-loadN-address") (i64.const 30)) @@ -264,10 +305,167 @@ (assert_return (invoke "as-convert-operand") (i32.const 41)) -(assert_return (invoke "as-grow_memory-size") (i32.const 40)) +(assert_return (invoke "as-memory.grow-size") (i32.const 40)) (assert_invalid - (module (func $type-value-empty-vs-num (result f64) (return))) + (module (func $type-value-empty-vs-num (result i32) (return))) + "type mismatch" +) +(assert_invalid + (module + (func $type-value-empty-vs-num-in-block (result i32) + (i32.const 0) + (block (return)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-value-empty-vs-num-in-loop (result i32) + (i32.const 0) + (loop (return)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-value-empty-vs-num-in-then (result i32) + (i32.const 0) (i32.const 0) + (if (then (return))) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-value-empty-vs-num-in-else (result i32) + (i32.const 0) (i32.const 0) + (if (result i32) (then (i32.const 0)) (else (return))) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-value-empty-vs-num-in-br (result i32) + (i32.const 0) + (block (br 0 (return))) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-value-empty-vs-num-in-br_if (result i32) + (i32.const 0) + (block (br_if 0 (return) (i32.const 1))) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-value-empty-vs-num-in-br_table (result i32) + (i32.const 0) + (block (br_table 0 (return))) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-value-empty-vs-num-in-return (result i32) + (return (return)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-value-empty-vs-num-in-select (result i32) + (select (return) (i32.const 1) (i32.const 2)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-value-empty-vs-num-in-call (result i32) + (call 1 (return)) + ) + (func (param i32) (result i32) (local.get 0)) + ) + "type mismatch" +) +(assert_invalid + (module + (func $f (param i32) (result i32) (local.get 0)) + (type $sig (func (param i32) (result i32))) + (table funcref (elem $f)) + (func $type-value-empty-vs-num-in-call_indirect (result i32) + (block (result i32) + (call_indirect (type $sig) + (return) (i32.const 0) + ) + ) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-value-empty-vs-num-in-local.set (result i32) + (local i32) + (local.set 0 (return)) (local.get 0) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-value-empty-vs-num-in-local.tee (result i32) + (local i32) + (local.tee 0 (return)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (global $x (mut i32) (i32.const 0)) + (func $type-value-empty-vs-num-in-global.set (result i32) + (global.set $x (return)) (global.get $x) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 0) + (func $type-value-empty-vs-num-in-memory.grow (result i32) + (memory.grow (return)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 0) + (func $type-value-empty-vs-num-in-load (result i32) + (i32.load (return)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 1) + (func $type-value-empty-vs-num-in-store (result i32) + (i32.store (return) (i32.const 1)) + ) + ) "type mismatch" ) (assert_invalid diff --git a/test/core/run.py b/test/core/run.py index 39593515..75189554 100755 --- a/test/core/run.py +++ b/test/core/run.py @@ -12,8 +12,7 @@ ownDir = os.path.dirname(os.path.abspath(sys.argv[0])) inputDir = ownDir -expectDir = "expected-output" -outputDir = os.path.join(inputDir, "output") +outputDir = os.path.join(inputDir, "_output") parser = argparse.ArgumentParser() parser.add_argument("--wasm", metavar="", default=os.path.join(os.getcwd(), "wasm")) @@ -28,6 +27,15 @@ outputDir = arguments.out inputFiles = arguments.file if arguments.file else glob.glob(os.path.join(inputDir, "*.wast")) +if not os.path.exists(wasmCommand): + sys.stderr.write("""\ +Error: The executable '%s' does not exist. +Provide the correct path with the '--wasm' flag. + +""" % (wasmCommand)) + parser.print_help() + sys.exit(1) + class RunTests(unittest.TestCase): def _runCommand(self, command, logPath, expectedExitCode = 0): @@ -51,37 +59,38 @@ def _compareFile(self, expectFile, actualFile): def _runTestFile(self, inputPath): dir, inputFile = os.path.split(inputPath) outputPath = os.path.join(outputDir, inputFile) - expectPath = os.path.join(dir, os.path.join(expectDir, inputFile)) # Run original file expectedExitCode = 1 if ".fail." in inputFile else 0 logPath = self._auxFile(outputPath + ".log") self._runCommand(('%s "%s"') % (wasmCommand, inputPath), logPath, expectedExitCode) - self._compareFile(expectPath + ".log", logPath) if expectedExitCode != 0: return - # Convert to binary and validate again + # Convert to binary and run again wasmPath = self._auxFile(outputPath + ".bin.wast") logPath = self._auxFile(wasmPath + ".log") self._runCommand(('%s -d "%s" -o "%s"') % (wasmCommand, inputPath, wasmPath), logPath) - self._runCommand(('%s -d "%s"') % (wasmCommand, wasmPath), logPath) + self._runCommand(('%s "%s"') % (wasmCommand, wasmPath), logPath) - # Convert back to text and validate again + # Convert back to text and run again wastPath = self._auxFile(wasmPath + ".wast") logPath = self._auxFile(wastPath + ".log") self._runCommand(('%s -d "%s" -o "%s"') % (wasmCommand, wasmPath, wastPath), logPath) - self._runCommand(('%s -d "%s" ') % (wasmCommand, wastPath), logPath) + self._runCommand(('%s "%s"') % (wasmCommand, wastPath), logPath) # Convert back to binary once more and compare wasm2Path = self._auxFile(wastPath + ".bin.wast") logPath = self._auxFile(wasm2Path + ".log") self._runCommand(('%s -d "%s" -o "%s"') % (wasmCommand, wastPath, wasm2Path), logPath) - self._runCommand(('%s -d "%s"') % (wasmCommand, wasm2Path), logPath) - # TODO: The binary should stay the same, but OCaml's float-string conversions are inaccurate. - # Once we upgrade to OCaml 4.03, use sprintf "%s" for printing floats. - # self._compareFile(wasmPath, wasm2Path) + self._compareFile(wasmPath, wasm2Path) + + # Convert back to text once more and compare + wast2Path = self._auxFile(wasm2Path + ".wast") + logPath = self._auxFile(wast2Path + ".log") + self._runCommand(('%s -d "%s" -o "%s"') % (wasmCommand, wasm2Path, wast2Path), logPath) + self._compareFile(wastPath, wast2Path) # Convert to JavaScript jsPath = self._auxFile(outputPath.replace(".wast", ".js")) diff --git a/test/core/select.wast b/test/core/select.wast index 4dfa4561..090b052b 100644 --- a/test/core/select.wast +++ b/test/core/select.wast @@ -1,67 +1,529 @@ (module - (func (export "select_i32") (param $lhs i32) (param $rhs i32) (param $cond i32) (result i32) - (select (get_local $lhs) (get_local $rhs) (get_local $cond))) + ;; Auxiliary + (func $dummy) + (table $tab funcref (elem $dummy)) + (memory 1) - (func (export "select_i64") (param $lhs i64) (param $rhs i64) (param $cond i32) (result i64) - (select (get_local $lhs) (get_local $rhs) (get_local $cond))) + (func (export "select-i32") (param i32 i32 i32) (result i32) + (select (local.get 0) (local.get 1) (local.get 2)) + ) + (func (export "select-i64") (param i64 i64 i32) (result i64) + (select (local.get 0) (local.get 1) (local.get 2)) + ) + (func (export "select-f32") (param f32 f32 i32) (result f32) + (select (local.get 0) (local.get 1) (local.get 2)) + ) + (func (export "select-f64") (param f64 f64 i32) (result f64) + (select (local.get 0) (local.get 1) (local.get 2)) + ) - (func (export "select_f32") (param $lhs f32) (param $rhs f32) (param $cond i32) (result f32) - (select (get_local $lhs) (get_local $rhs) (get_local $cond))) + (func (export "select-i32-t") (param i32 i32 i32) (result i32) + (select (result i32) (local.get 0) (local.get 1) (local.get 2)) + ) + (func (export "select-i64-t") (param i64 i64 i32) (result i64) + (select (result i64) (local.get 0) (local.get 1) (local.get 2)) + ) + (func (export "select-f32-t") (param f32 f32 i32) (result f32) + (select (result f32) (local.get 0) (local.get 1) (local.get 2)) + ) + (func (export "select-f64-t") (param f64 f64 i32) (result f64) + (select (result f64) (local.get 0) (local.get 1) (local.get 2)) + ) + (func (export "select-nullref") (param nullref nullref i32) (result nullref) + (select (result nullref) (local.get 0) (local.get 1) (local.get 2)) + ) + (func (export "select-funcref") (param funcref funcref i32) (result funcref) + (select (result funcref) (local.get 0) (local.get 1) (local.get 2)) + ) + (func (export "select-anyref") (param anyref anyref i32) (result anyref) + (select (result anyref) (local.get 0) (local.get 1) (local.get 2)) + ) - (func (export "select_f64") (param $lhs f64) (param $rhs f64) (param $cond i32) (result f64) - (select (get_local $lhs) (get_local $rhs) (get_local $cond))) + (func (export "join-nullref") (param i32) (result anyref) + (select (result anyref) (ref.null) (ref.null) (local.get 0)) + ) + (func (export "join-funcref") (param i32) (result anyref) + (select (result anyref) + (table.get $tab (i32.const 0)) + (ref.null) + (local.get 0) + ) + ) + (func (export "join-anyref") (param i32) (param anyref) (result anyref) + (select (result anyref) + (table.get $tab (i32.const 0)) + (local.get 1) + (local.get 0) + ) + ) ;; Check that both sides of the select are evaluated - (func (export "select_trap_l") (param $cond i32) (result i32) - (select (unreachable) (i32.const 0) (get_local $cond)) + (func (export "select-trap-left") (param $cond i32) (result i32) + (select (unreachable) (i32.const 0) (local.get $cond)) ) - (func (export "select_trap_r") (param $cond i32) (result i32) - (select (i32.const 0) (unreachable) (get_local $cond)) + (func (export "select-trap-right") (param $cond i32) (result i32) + (select (i32.const 0) (unreachable) (local.get $cond)) ) - (func (export "select_unreached") + (func (export "select-unreached") (unreachable) (select) (unreachable) (i32.const 0) (select) (unreachable) (i32.const 0) (i32.const 0) (select) (unreachable) (f32.const 0) (i32.const 0) (select) (unreachable) ) + + + ;; As the argument of control constructs and instructions + + (func (export "as-select-first") (param i32) (result i32) + (select (select (i32.const 0) (i32.const 1) (local.get 0)) (i32.const 2) (i32.const 3)) + ) + (func (export "as-select-mid") (param i32) (result i32) + (select (i32.const 2) (select (i32.const 0) (i32.const 1) (local.get 0)) (i32.const 3)) + ) + (func (export "as-select-last") (param i32) (result i32) + (select (i32.const 2) (i32.const 3) (select (i32.const 0) (i32.const 1) (local.get 0))) + ) + + (func (export "as-loop-first") (param i32) (result i32) + (loop (result i32) (select (i32.const 2) (i32.const 3) (local.get 0)) (call $dummy) (call $dummy)) + ) + (func (export "as-loop-mid") (param i32) (result i32) + (loop (result i32) (call $dummy) (select (i32.const 2) (i32.const 3) (local.get 0)) (call $dummy)) + ) + (func (export "as-loop-last") (param i32) (result i32) + (loop (result i32) (call $dummy) (call $dummy) (select (i32.const 2) (i32.const 3) (local.get 0))) + ) + + (func (export "as-if-condition") (param i32) + (select (i32.const 2) (i32.const 3) (local.get 0)) (if (then (call $dummy))) + ) + (func (export "as-if-then") (param i32) (result i32) + (if (result i32) (i32.const 1) (then (select (i32.const 2) (i32.const 3) (local.get 0))) (else (i32.const 4))) + ) + (func (export "as-if-else") (param i32) (result i32) + (if (result i32) (i32.const 0) (then (i32.const 2)) (else (select (i32.const 2) (i32.const 3) (local.get 0)))) + ) + + (func (export "as-br_if-first") (param i32) (result i32) + (block (result i32) (br_if 0 (select (i32.const 2) (i32.const 3) (local.get 0)) (i32.const 4))) + ) + (func (export "as-br_if-last") (param i32) (result i32) + (block (result i32) (br_if 0 (i32.const 2) (select (i32.const 2) (i32.const 3) (local.get 0)))) + ) + + (func (export "as-br_table-first") (param i32) (result i32) + (block (result i32) (select (i32.const 2) (i32.const 3) (local.get 0)) (i32.const 2) (br_table 0 0)) + ) + (func (export "as-br_table-last") (param i32) (result i32) + (block (result i32) (i32.const 2) (select (i32.const 2) (i32.const 3) (local.get 0)) (br_table 0 0)) + ) + + (func $func (param i32 i32) (result i32) (local.get 0)) + (type $check (func (param i32 i32) (result i32))) + (table $t funcref (elem $func)) + (func (export "as-call_indirect-first") (param i32) (result i32) + (block (result i32) + (call_indirect $t (type $check) + (select (i32.const 2) (i32.const 3) (local.get 0)) (i32.const 1) (i32.const 0) + ) + ) + ) + (func (export "as-call_indirect-mid") (param i32) (result i32) + (block (result i32) + (call_indirect $t (type $check) + (i32.const 1) (select (i32.const 2) (i32.const 3) (local.get 0)) (i32.const 0) + ) + ) + ) + (func (export "as-call_indirect-last") (param i32) (result i32) + (block (result i32) + (call_indirect $t (type $check) + (i32.const 1) (i32.const 4) (select (i32.const 2) (i32.const 3) (local.get 0)) + ) + ) + ) + + (func (export "as-store-first") (param i32) + (select (i32.const 0) (i32.const 4) (local.get 0)) (i32.const 1) (i32.store) + ) + (func (export "as-store-last") (param i32) + (i32.const 8) (select (i32.const 1) (i32.const 2) (local.get 0)) (i32.store) + ) + + (func (export "as-memory.grow-value") (param i32) (result i32) + (memory.grow (select (i32.const 1) (i32.const 2) (local.get 0))) + ) + + (func $f (param i32) (result i32) (local.get 0)) + + (func (export "as-call-value") (param i32) (result i32) + (call $f (select (i32.const 1) (i32.const 2) (local.get 0))) + ) + (func (export "as-return-value") (param i32) (result i32) + (select (i32.const 1) (i32.const 2) (local.get 0)) (return) + ) + (func (export "as-drop-operand") (param i32) + (drop (select (i32.const 1) (i32.const 2) (local.get 0))) + ) + (func (export "as-br-value") (param i32) (result i32) + (block (result i32) (br 0 (select (i32.const 1) (i32.const 2) (local.get 0)))) + ) + (func (export "as-local.set-value") (param i32) (result i32) + (local i32) (local.set 0 (select (i32.const 1) (i32.const 2) (local.get 0))) (local.get 0) + ) + (func (export "as-local.tee-value") (param i32) (result i32) + (local.tee 0 (select (i32.const 1) (i32.const 2) (local.get 0))) + ) + (global $a (mut i32) (i32.const 10)) + (func (export "as-global.set-value") (param i32) (result i32) + (global.set $a (select (i32.const 1) (i32.const 2) (local.get 0))) + (global.get $a) + ) + (func (export "as-load-operand") (param i32) (result i32) + (i32.load (select (i32.const 0) (i32.const 4) (local.get 0))) + ) + + (func (export "as-unary-operand") (param i32) (result i32) + (i32.eqz (select (i32.const 0) (i32.const 1) (local.get 0))) + ) + (func (export "as-binary-operand") (param i32) (result i32) + (i32.mul + (select (i32.const 1) (i32.const 2) (local.get 0)) + (select (i32.const 1) (i32.const 2) (local.get 0)) + ) + ) + (func (export "as-test-operand") (param i32) (result i32) + (block (result i32) + (i32.eqz (select (i32.const 0) (i32.const 1) (local.get 0))) + ) + ) + + (func (export "as-compare-left") (param i32) (result i32) + (block (result i32) + (i32.le_s (select (i32.const 1) (i32.const 2) (local.get 0)) (i32.const 1)) + ) + ) + (func (export "as-compare-right") (param i32) (result i32) + (block (result i32) + (i32.ne (i32.const 1) (select (i32.const 0) (i32.const 1) (local.get 0))) + ) + ) + + (func (export "as-convert-operand") (param i32) (result i32) + (block (result i32) + (i32.wrap_i64 (select (i64.const 1) (i64.const 0) (local.get 0))) + ) + ) ) -(assert_return (invoke "select_i32" (i32.const 1) (i32.const 2) (i32.const 1)) (i32.const 1)) -(assert_return (invoke "select_i64" (i64.const 2) (i64.const 1) (i32.const 1)) (i64.const 2)) -(assert_return (invoke "select_f32" (f32.const 1) (f32.const 2) (i32.const 1)) (f32.const 1)) -(assert_return (invoke "select_f64" (f64.const 1) (f64.const 2) (i32.const 1)) (f64.const 1)) +(assert_return (invoke "select-i32" (i32.const 1) (i32.const 2) (i32.const 1)) (i32.const 1)) +(assert_return (invoke "select-i64" (i64.const 2) (i64.const 1) (i32.const 1)) (i64.const 2)) +(assert_return (invoke "select-f32" (f32.const 1) (f32.const 2) (i32.const 1)) (f32.const 1)) +(assert_return (invoke "select-f64" (f64.const 1) (f64.const 2) (i32.const 1)) (f64.const 1)) + +(assert_return (invoke "select-i32" (i32.const 1) (i32.const 2) (i32.const 0)) (i32.const 2)) +(assert_return (invoke "select-i32" (i32.const 2) (i32.const 1) (i32.const 0)) (i32.const 1)) +(assert_return (invoke "select-i64" (i64.const 2) (i64.const 1) (i32.const -1)) (i64.const 2)) +(assert_return (invoke "select-i64" (i64.const 2) (i64.const 1) (i32.const 0xf0f0f0f0)) (i64.const 2)) + +(assert_return (invoke "select-f32" (f32.const nan) (f32.const 1) (i32.const 1)) (f32.const nan)) +(assert_return (invoke "select-f32" (f32.const nan:0x20304) (f32.const 1) (i32.const 1)) (f32.const nan:0x20304)) +(assert_return (invoke "select-f32" (f32.const nan) (f32.const 1) (i32.const 0)) (f32.const 1)) +(assert_return (invoke "select-f32" (f32.const nan:0x20304) (f32.const 1) (i32.const 0)) (f32.const 1)) +(assert_return (invoke "select-f32" (f32.const 2) (f32.const nan) (i32.const 1)) (f32.const 2)) +(assert_return (invoke "select-f32" (f32.const 2) (f32.const nan:0x20304) (i32.const 1)) (f32.const 2)) +(assert_return (invoke "select-f32" (f32.const 2) (f32.const nan) (i32.const 0)) (f32.const nan)) +(assert_return (invoke "select-f32" (f32.const 2) (f32.const nan:0x20304) (i32.const 0)) (f32.const nan:0x20304)) + +(assert_return (invoke "select-f64" (f64.const nan) (f64.const 1) (i32.const 1)) (f64.const nan)) +(assert_return (invoke "select-f64" (f64.const nan:0x20304) (f64.const 1) (i32.const 1)) (f64.const nan:0x20304)) +(assert_return (invoke "select-f64" (f64.const nan) (f64.const 1) (i32.const 0)) (f64.const 1)) +(assert_return (invoke "select-f64" (f64.const nan:0x20304) (f64.const 1) (i32.const 0)) (f64.const 1)) +(assert_return (invoke "select-f64" (f64.const 2) (f64.const nan) (i32.const 1)) (f64.const 2)) +(assert_return (invoke "select-f64" (f64.const 2) (f64.const nan:0x20304) (i32.const 1)) (f64.const 2)) +(assert_return (invoke "select-f64" (f64.const 2) (f64.const nan) (i32.const 0)) (f64.const nan)) +(assert_return (invoke "select-f64" (f64.const 2) (f64.const nan:0x20304) (i32.const 0)) (f64.const nan:0x20304)) + +(assert_return (invoke "select-i32-t" (i32.const 1) (i32.const 2) (i32.const 1)) (i32.const 1)) +(assert_return (invoke "select-i64-t" (i64.const 2) (i64.const 1) (i32.const 1)) (i64.const 2)) +(assert_return (invoke "select-f32-t" (f32.const 1) (f32.const 2) (i32.const 1)) (f32.const 1)) +(assert_return (invoke "select-f64-t" (f64.const 1) (f64.const 2) (i32.const 1)) (f64.const 1)) +(assert_return (invoke "select-nullref" (ref.null) (ref.null) (i32.const 1)) (ref.null)) +(assert_return (invoke "select-funcref" (ref.null) (ref.null) (i32.const 1)) (ref.null)) +(assert_return (invoke "select-anyref" (ref.host 1) (ref.host 2) (i32.const 1)) (ref.host 1)) + +(assert_return (invoke "select-i32-t" (i32.const 1) (i32.const 2) (i32.const 0)) (i32.const 2)) +(assert_return (invoke "select-i32-t" (i32.const 2) (i32.const 1) (i32.const 0)) (i32.const 1)) +(assert_return (invoke "select-i64-t" (i64.const 2) (i64.const 1) (i32.const -1)) (i64.const 2)) +(assert_return (invoke "select-i64-t" (i64.const 2) (i64.const 1) (i32.const 0xf0f0f0f0)) (i64.const 2)) +(assert_return (invoke "select-anyref" (ref.host 1) (ref.host 2) (i32.const 0)) (ref.host 2)) +(assert_return (invoke "select-anyref" (ref.host 2) (ref.host 1) (i32.const 0)) (ref.host 1)) + +(assert_return (invoke "select-f32-t" (f32.const nan) (f32.const 1) (i32.const 1)) (f32.const nan)) +(assert_return (invoke "select-f32-t" (f32.const nan:0x20304) (f32.const 1) (i32.const 1)) (f32.const nan:0x20304)) +(assert_return (invoke "select-f32-t" (f32.const nan) (f32.const 1) (i32.const 0)) (f32.const 1)) +(assert_return (invoke "select-f32-t" (f32.const nan:0x20304) (f32.const 1) (i32.const 0)) (f32.const 1)) +(assert_return (invoke "select-f32-t" (f32.const 2) (f32.const nan) (i32.const 1)) (f32.const 2)) +(assert_return (invoke "select-f32-t" (f32.const 2) (f32.const nan:0x20304) (i32.const 1)) (f32.const 2)) +(assert_return (invoke "select-f32-t" (f32.const 2) (f32.const nan) (i32.const 0)) (f32.const nan)) +(assert_return (invoke "select-f32-t" (f32.const 2) (f32.const nan:0x20304) (i32.const 0)) (f32.const nan:0x20304)) + +(assert_return (invoke "select-f64-t" (f64.const nan) (f64.const 1) (i32.const 1)) (f64.const nan)) +(assert_return (invoke "select-f64-t" (f64.const nan:0x20304) (f64.const 1) (i32.const 1)) (f64.const nan:0x20304)) +(assert_return (invoke "select-f64-t" (f64.const nan) (f64.const 1) (i32.const 0)) (f64.const 1)) +(assert_return (invoke "select-f64-t" (f64.const nan:0x20304) (f64.const 1) (i32.const 0)) (f64.const 1)) +(assert_return (invoke "select-f64-t" (f64.const 2) (f64.const nan) (i32.const 1)) (f64.const 2)) +(assert_return (invoke "select-f64-t" (f64.const 2) (f64.const nan:0x20304) (i32.const 1)) (f64.const 2)) +(assert_return (invoke "select-f64-t" (f64.const 2) (f64.const nan) (i32.const 0)) (f64.const nan)) +(assert_return (invoke "select-f64-t" (f64.const 2) (f64.const nan:0x20304) (i32.const 0)) (f64.const nan:0x20304)) + +(assert_return (invoke "join-nullref" (i32.const 1)) (ref.null)) +(assert_return (invoke "join-nullref" (i32.const 0)) (ref.null)) + +(assert_return_func (invoke "join-funcref" (i32.const 1))) +(assert_return (invoke "join-funcref" (i32.const 0)) (ref.null)) + +(assert_return_func (invoke "join-anyref" (i32.const 1) (ref.host 1))) +(assert_return (invoke "join-anyref" (i32.const 0) (ref.host 1)) (ref.host 1)) + +(assert_trap (invoke "select-trap-left" (i32.const 1)) "unreachable") +(assert_trap (invoke "select-trap-left" (i32.const 0)) "unreachable") +(assert_trap (invoke "select-trap-right" (i32.const 1)) "unreachable") +(assert_trap (invoke "select-trap-right" (i32.const 0)) "unreachable") + +(assert_return (invoke "as-select-first" (i32.const 0)) (i32.const 1)) +(assert_return (invoke "as-select-first" (i32.const 1)) (i32.const 0)) +(assert_return (invoke "as-select-mid" (i32.const 0)) (i32.const 2)) +(assert_return (invoke "as-select-mid" (i32.const 1)) (i32.const 2)) +(assert_return (invoke "as-select-last" (i32.const 0)) (i32.const 2)) +(assert_return (invoke "as-select-last" (i32.const 1)) (i32.const 3)) + +(assert_return (invoke "as-loop-first" (i32.const 0)) (i32.const 3)) +(assert_return (invoke "as-loop-first" (i32.const 1)) (i32.const 2)) +(assert_return (invoke "as-loop-mid" (i32.const 0)) (i32.const 3)) +(assert_return (invoke "as-loop-mid" (i32.const 1)) (i32.const 2)) +(assert_return (invoke "as-loop-last" (i32.const 0)) (i32.const 3)) +(assert_return (invoke "as-loop-last" (i32.const 1)) (i32.const 2)) + +(assert_return (invoke "as-if-condition" (i32.const 0))) +(assert_return (invoke "as-if-condition" (i32.const 1))) +(assert_return (invoke "as-if-then" (i32.const 0)) (i32.const 3)) +(assert_return (invoke "as-if-then" (i32.const 1)) (i32.const 2)) +(assert_return (invoke "as-if-else" (i32.const 0)) (i32.const 3)) +(assert_return (invoke "as-if-else" (i32.const 1)) (i32.const 2)) -(assert_return (invoke "select_i32" (i32.const 1) (i32.const 2) (i32.const 0)) (i32.const 2)) -(assert_return (invoke "select_i32" (i32.const 2) (i32.const 1) (i32.const 0)) (i32.const 1)) -(assert_return (invoke "select_i64" (i64.const 2) (i64.const 1) (i32.const -1)) (i64.const 2)) -(assert_return (invoke "select_i64" (i64.const 2) (i64.const 1) (i32.const 0xf0f0f0f0)) (i64.const 2)) +(assert_return (invoke "as-br_if-first" (i32.const 0)) (i32.const 3)) +(assert_return (invoke "as-br_if-first" (i32.const 1)) (i32.const 2)) +(assert_return (invoke "as-br_if-last" (i32.const 0)) (i32.const 2)) +(assert_return (invoke "as-br_if-last" (i32.const 1)) (i32.const 2)) -(assert_return (invoke "select_f32" (f32.const nan) (f32.const 1) (i32.const 1)) (f32.const nan)) -(assert_return (invoke "select_f32" (f32.const nan:0x20304) (f32.const 1) (i32.const 1)) (f32.const nan:0x20304)) -(assert_return (invoke "select_f32" (f32.const nan) (f32.const 1) (i32.const 0)) (f32.const 1)) -(assert_return (invoke "select_f32" (f32.const nan:0x20304) (f32.const 1) (i32.const 0)) (f32.const 1)) -(assert_return (invoke "select_f32" (f32.const 2) (f32.const nan) (i32.const 1)) (f32.const 2)) -(assert_return (invoke "select_f32" (f32.const 2) (f32.const nan:0x20304) (i32.const 1)) (f32.const 2)) -(assert_return (invoke "select_f32" (f32.const 2) (f32.const nan) (i32.const 0)) (f32.const nan)) -(assert_return (invoke "select_f32" (f32.const 2) (f32.const nan:0x20304) (i32.const 0)) (f32.const nan:0x20304)) +(assert_return (invoke "as-br_table-first" (i32.const 0)) (i32.const 3)) +(assert_return (invoke "as-br_table-first" (i32.const 1)) (i32.const 2)) +(assert_return (invoke "as-br_table-last" (i32.const 0)) (i32.const 2)) +(assert_return (invoke "as-br_table-last" (i32.const 1)) (i32.const 2)) -(assert_return (invoke "select_f64" (f64.const nan) (f64.const 1) (i32.const 1)) (f64.const nan)) -(assert_return (invoke "select_f64" (f64.const nan:0x20304) (f64.const 1) (i32.const 1)) (f64.const nan:0x20304)) -(assert_return (invoke "select_f64" (f64.const nan) (f64.const 1) (i32.const 0)) (f64.const 1)) -(assert_return (invoke "select_f64" (f64.const nan:0x20304) (f64.const 1) (i32.const 0)) (f64.const 1)) -(assert_return (invoke "select_f64" (f64.const 2) (f64.const nan) (i32.const 1)) (f64.const 2)) -(assert_return (invoke "select_f64" (f64.const 2) (f64.const nan:0x20304) (i32.const 1)) (f64.const 2)) -(assert_return (invoke "select_f64" (f64.const 2) (f64.const nan) (i32.const 0)) (f64.const nan)) -(assert_return (invoke "select_f64" (f64.const 2) (f64.const nan:0x20304) (i32.const 0)) (f64.const nan:0x20304)) +(assert_return (invoke "as-call_indirect-first" (i32.const 0)) (i32.const 3)) +;;(assert_return (invoke "as-call_indirect-first" (i32.const 1)) (i32.const 2)) +(assert_return (invoke "as-call_indirect-mid" (i32.const 0)) (i32.const 1)) +(assert_return (invoke "as-call_indirect-mid" (i32.const 1)) (i32.const 1)) +(assert_trap (invoke "as-call_indirect-last" (i32.const 0)) "undefined element") +(assert_trap (invoke "as-call_indirect-last" (i32.const 1)) "undefined element") -(assert_trap (invoke "select_trap_l" (i32.const 1)) "unreachable executed") -(assert_trap (invoke "select_trap_l" (i32.const 0)) "unreachable executed") -(assert_trap (invoke "select_trap_r" (i32.const 1)) "unreachable executed") -(assert_trap (invoke "select_trap_r" (i32.const 0)) "unreachable executed") +(assert_return (invoke "as-store-first" (i32.const 0))) +(assert_return (invoke "as-store-first" (i32.const 1))) +(assert_return (invoke "as-store-last" (i32.const 0))) +(assert_return (invoke "as-store-last" (i32.const 1))) +(assert_return (invoke "as-memory.grow-value" (i32.const 0)) (i32.const 1)) +(assert_return (invoke "as-memory.grow-value" (i32.const 1)) (i32.const 3)) + +(assert_return (invoke "as-call-value" (i32.const 0)) (i32.const 2)) +(assert_return (invoke "as-call-value" (i32.const 1)) (i32.const 1)) +(assert_return (invoke "as-return-value" (i32.const 0)) (i32.const 2)) +(assert_return (invoke "as-return-value" (i32.const 1)) (i32.const 1)) +(assert_return (invoke "as-drop-operand" (i32.const 0))) +(assert_return (invoke "as-drop-operand" (i32.const 1))) +(assert_return (invoke "as-br-value" (i32.const 0)) (i32.const 2)) +(assert_return (invoke "as-br-value" (i32.const 1)) (i32.const 1)) +(assert_return (invoke "as-local.set-value" (i32.const 0)) (i32.const 2)) +(assert_return (invoke "as-local.set-value" (i32.const 1)) (i32.const 1)) +(assert_return (invoke "as-local.tee-value" (i32.const 0)) (i32.const 2)) +(assert_return (invoke "as-local.tee-value" (i32.const 1)) (i32.const 1)) +(assert_return (invoke "as-global.set-value" (i32.const 0)) (i32.const 2)) +(assert_return (invoke "as-global.set-value" (i32.const 1)) (i32.const 1)) +(assert_return (invoke "as-load-operand" (i32.const 0)) (i32.const 1)) +(assert_return (invoke "as-load-operand" (i32.const 1)) (i32.const 1)) + +(assert_return (invoke "as-unary-operand" (i32.const 0)) (i32.const 0)) +(assert_return (invoke "as-unary-operand" (i32.const 1)) (i32.const 1)) +(assert_return (invoke "as-binary-operand" (i32.const 0)) (i32.const 4)) +(assert_return (invoke "as-binary-operand" (i32.const 1)) (i32.const 1)) +(assert_return (invoke "as-test-operand" (i32.const 0)) (i32.const 0)) +(assert_return (invoke "as-test-operand" (i32.const 1)) (i32.const 1)) +(assert_return (invoke "as-compare-left" (i32.const 0)) (i32.const 0)) +(assert_return (invoke "as-compare-left" (i32.const 1)) (i32.const 1)) +(assert_return (invoke "as-compare-right" (i32.const 0)) (i32.const 0)) +(assert_return (invoke "as-compare-right" (i32.const 1)) (i32.const 1)) +(assert_return (invoke "as-convert-operand" (i32.const 0)) (i32.const 0)) +(assert_return (invoke "as-convert-operand" (i32.const 1)) (i32.const 1)) + +(assert_invalid + (module (func $arity-0-implicit (select (nop) (nop) (i32.const 1)))) + "type mismatch" +) +(assert_invalid + (module (func $arity-0 (select (result) (nop) (nop) (i32.const 1)))) + "invalid result arity" +) +(assert_invalid + (module (func $arity-2 (result i32 i32) + (select (result i32 i32) + (i32.const 0) (i32.const 0) + (i32.const 0) (i32.const 0) + (i32.const 1) + ) + )) + "invalid result arity" +) + + +(assert_invalid + (module (func $type-nullref-implicit + (drop (select (ref.null) (ref.null) (i32.const 1))) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-anyref-implicit (param $r anyref) + (drop (select (local.get $r) (local.get $r) (i32.const 1))) + )) + "type mismatch" +) + +(assert_invalid + (module (func $type-num-vs-num + (drop (select (i32.const 1) (i64.const 1) (i32.const 1))) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-num-vs-num + (drop (select (i32.const 1) (f32.const 1.0) (i32.const 1))) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-num-vs-num + (drop (select (i32.const 1) (f64.const 1.0) (i32.const 1))) + )) + "type mismatch" +) + + +(assert_invalid + (module + (func $type-1st-operand-empty + (select) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-2nd-operand-empty + (i32.const 0) (select) (drop) + ) + ) + "type mismatch" +) (assert_invalid - (module (func $arity-0 (select (nop) (nop) (i32.const 1)))) + (module + (func $type-3rd-operand-empty + (i32.const 0) (i32.const 0) (select) (drop) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-1st-operand-empty-in-block + (i32.const 0) (i32.const 0) (i32.const 0) + (block (select) (drop)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-2nd-operand-empty-in-block + (i32.const 0) (i32.const 0) + (block (i32.const 0) (select) (drop)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-3rd-operand-empty-in-block + (i32.const 0) + (block (i32.const 0) (i32.const 0) (select) (drop)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-1st-operand-empty-in-loop + (i32.const 0) (i32.const 0) (i32.const 0) + (loop (select) (drop)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-2nd-operand-empty-in-loop + (i32.const 0) (i32.const 0) + (loop (i32.const 0) (select) (drop)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-3rd-operand-empty-in-loop + (i32.const 0) + (loop (i32.const 0) (i32.const 0) (select) (drop)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-1st-operand-empty-in-then + (i32.const 0) (i32.const 0) (i32.const 0) + (if (then (select) (drop))) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-2nd-operand-empty-in-then + (i32.const 0) (i32.const 0) + (if (then (i32.const 0) (select) (drop))) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (func $type-3rd-operand-empty-in-then + (i32.const 0) + (if (then (i32.const 0) (i32.const 0) (select) (drop))) + ) + ) "type mismatch" ) diff --git a/test/core/set_local.wast b/test/core/set_local.wast deleted file mode 100644 index 5a006e11..00000000 --- a/test/core/set_local.wast +++ /dev/null @@ -1,205 +0,0 @@ -;; Test `set_local` operator - -(module - ;; Typing - - (func (export "type-local-i32") (local i32) (set_local 0 (i32.const 0))) - (func (export "type-local-i64") (local i64) (set_local 0 (i64.const 0))) - (func (export "type-local-f32") (local f32) (set_local 0 (f32.const 0))) - (func (export "type-local-f64") (local f64) (set_local 0 (f64.const 0))) - - (func (export "type-param-i32") (param i32) (set_local 0 (i32.const 10))) - (func (export "type-param-i64") (param i64) (set_local 0 (i64.const 11))) - (func (export "type-param-f32") (param f32) (set_local 0 (f32.const 11.1))) - (func (export "type-param-f64") (param f64) (set_local 0 (f64.const 12.2))) - - (func (export "type-mixed") (param i64 f32 f64 i32 i32) (local f32 i64 i64 f64) - (set_local 0 (i64.const 0)) - (set_local 1 (f32.const 0)) - (set_local 2 (f64.const 0)) - (set_local 3 (i32.const 0)) - (set_local 4 (i32.const 0)) - (set_local 5 (f32.const 0)) - (set_local 6 (i64.const 0)) - (set_local 7 (i64.const 0)) - (set_local 8 (f64.const 0)) - ) - - ;; Writing - - (func (export "write") (param i64 f32 f64 i32 i32) (result i64) - (local f32 i64 i64 f64) - (set_local 1 (f32.const -0.3)) - (set_local 3 (i32.const 40)) - (set_local 4 (i32.const -7)) - (set_local 5 (f32.const 5.5)) - (set_local 6 (i64.const 6)) - (set_local 8 (f64.const 8)) - (i64.trunc_s/f64 - (f64.add - (f64.convert_u/i64 (get_local 0)) - (f64.add - (f64.promote/f32 (get_local 1)) - (f64.add - (get_local 2) - (f64.add - (f64.convert_u/i32 (get_local 3)) - (f64.add - (f64.convert_s/i32 (get_local 4)) - (f64.add - (f64.promote/f32 (get_local 5)) - (f64.add - (f64.convert_u/i64 (get_local 6)) - (f64.add - (f64.convert_u/i64 (get_local 7)) - (get_local 8) - ) - ) - ) - ) - ) - ) - ) - ) - ) - ) -) - -(assert_return (invoke "type-local-i32")) -(assert_return (invoke "type-local-i64")) -(assert_return (invoke "type-local-f32")) -(assert_return (invoke "type-local-f64")) - -(assert_return (invoke "type-param-i32" (i32.const 2))) -(assert_return (invoke "type-param-i64" (i64.const 3))) -(assert_return (invoke "type-param-f32" (f32.const 4.4))) -(assert_return (invoke "type-param-f64" (f64.const 5.5))) - -(assert_return - (invoke "type-mixed" - (i64.const 1) (f32.const 2.2) (f64.const 3.3) (i32.const 4) (i32.const 5) - ) -) - -(assert_return - (invoke "write" - (i64.const 1) (f32.const 2) (f64.const 3.3) (i32.const 4) (i32.const 5) - ) - (i64.const 56) -) - - -;; Invalid typing of access to locals - -(assert_invalid - (module (func $type-local-num-vs-num (result i64) (local i32) - (set_local 0 (i32.const 0)) - )) - "type mismatch" -) -(assert_invalid - (module (func $type-local-num-vs-num (local f32) - (i32.eqz (set_local 0 (f32.const 0))) - )) - "type mismatch" -) -(assert_invalid - (module (func $type-local-num-vs-num (local f64 i64) - (f64.neg (set_local 1 (i64.const 0))) - )) - "type mismatch" -) - -(assert_invalid - (module (func $type-local-arg-void-vs-num (local i32) (set_local 0 (nop)))) - "type mismatch" -) -(assert_invalid - (module (func $type-local-arg-num-vs-num (local i32) (set_local 0 (f32.const 0)))) - "type mismatch" -) -(assert_invalid - (module (func $type-local-arg-num-vs-num (local f32) (set_local 0 (f64.const 0)))) - "type mismatch" -) -(assert_invalid - (module (func $type-local-arg-num-vs-num (local f64 i64) (set_local 1 (f64.const 0)))) - "type mismatch" -) - - -;; Invalid typing of access to parameters - -(assert_invalid - (module (func $type-param-num-vs-num (param i32) (result i64) (get_local 0))) - "type mismatch" -) -(assert_invalid - (module (func $type-param-num-vs-num (param f32) (i32.eqz (get_local 0)))) - "type mismatch" -) -(assert_invalid - (module (func $type-param-num-vs-num (param f64 i64) (f64.neg (get_local 1)))) - "type mismatch" -) - -(assert_invalid - (module (func $type-param-arg-void-vs-num (param i32) (set_local 0 (nop)))) - "type mismatch" -) -(assert_invalid - (module (func $type-param-arg-num-vs-num (param i32) (set_local 0 (f32.const 0)))) - "type mismatch" -) -(assert_invalid - (module (func $type-param-arg-num-vs-num (param f32) (set_local 0 (f64.const 0)))) - "type mismatch" -) -(assert_invalid - (module (func $type-param-arg-num-vs-num (param f64 i64) (set_local 1 (f64.const 0)))) - "type mismatch" -) - - -;; Invalid local index - -(assert_invalid - (module (func $unbound-local (local i32 i64) (get_local 3))) - "unknown local" -) -(assert_invalid - (module (func $large-local (local i32 i64) (get_local 14324343))) - "unknown local" -) - -(assert_invalid - (module (func $unbound-param (param i32 i64) (get_local 2))) - "unknown local" -) -(assert_invalid - (module (func $large-param (local i32 i64) (get_local 714324343))) - "unknown local" -) - -(assert_invalid - (module (func $unbound-mixed (param i32) (local i32 i64) (get_local 3))) - "unknown local" -) -(assert_invalid - (module (func $large-mixed (param i64) (local i32 i64) (get_local 214324343))) - "unknown local" -) - -(assert_invalid - (module (func $type-mixed-arg-num-vs-num (param f32) (local i32) (set_local 1 (f32.const 0)))) - "type mismatch" -) -(assert_invalid - (module (func $type-mixed-arg-num-vs-num (param i64 i32) (local f32) (set_local 1 (f32.const 0)))) - "type mismatch" -) -(assert_invalid - (module (func $type-mixed-arg-num-vs-num (param i64) (local f64 i64) (set_local 1 (i64.const 0)))) - "type mismatch" -) - diff --git a/test/core/skip-stack-guard-page.wast b/test/core/skip-stack-guard-page.wast index f2449dc8..a472e681 100644 --- a/test/core/skip-stack-guard-page.wast +++ b/test/core/skip-stack-guard-page.wast @@ -5,9 +5,9 @@ (func $test-guard-page-skip (param $depth i32) - (if (i32.eq (get_local $depth) (i32.const 0)) + (if (i32.eq (local.get $depth) (i32.const 0)) (then (call $function-with-many-locals)) - (else (call $test-guard-page-skip (i32.sub (get_local $depth) (i32.const 1)))) + (else (call $test-guard-page-skip (i32.sub (local.get $depth) (i32.const 1)))) ) ) @@ -155,2120 +155,2120 @@ (call $function-with-many-locals) ;; load from memory into the locals - (set_local 0x000 (i64.load offset=0x000 align=1 (i32.const 0))) - (set_local 0x001 (i64.load offset=0x001 align=1 (i32.const 0))) - (set_local 0x002 (i64.load offset=0x002 align=1 (i32.const 0))) - (set_local 0x003 (i64.load offset=0x003 align=1 (i32.const 0))) - (set_local 0x004 (i64.load offset=0x004 align=1 (i32.const 0))) - (set_local 0x005 (i64.load offset=0x005 align=1 (i32.const 0))) - (set_local 0x006 (i64.load offset=0x006 align=1 (i32.const 0))) - (set_local 0x007 (i64.load offset=0x007 align=1 (i32.const 0))) - (set_local 0x008 (i64.load offset=0x008 align=1 (i32.const 0))) - (set_local 0x009 (i64.load offset=0x009 align=1 (i32.const 0))) - (set_local 0x00a (i64.load offset=0x00a align=1 (i32.const 0))) - (set_local 0x00b (i64.load offset=0x00b align=1 (i32.const 0))) - (set_local 0x00c (i64.load offset=0x00c align=1 (i32.const 0))) - (set_local 0x00d (i64.load offset=0x00d align=1 (i32.const 0))) - (set_local 0x00e (i64.load offset=0x00e align=1 (i32.const 0))) - (set_local 0x00f (i64.load offset=0x00f align=1 (i32.const 0))) - (set_local 0x010 (i64.load offset=0x010 align=1 (i32.const 0))) - (set_local 0x011 (i64.load offset=0x011 align=1 (i32.const 0))) - (set_local 0x012 (i64.load offset=0x012 align=1 (i32.const 0))) - (set_local 0x013 (i64.load offset=0x013 align=1 (i32.const 0))) - (set_local 0x014 (i64.load offset=0x014 align=1 (i32.const 0))) - (set_local 0x015 (i64.load offset=0x015 align=1 (i32.const 0))) - (set_local 0x016 (i64.load offset=0x016 align=1 (i32.const 0))) - (set_local 0x017 (i64.load offset=0x017 align=1 (i32.const 0))) - (set_local 0x018 (i64.load offset=0x018 align=1 (i32.const 0))) - (set_local 0x019 (i64.load offset=0x019 align=1 (i32.const 0))) - (set_local 0x01a (i64.load offset=0x01a align=1 (i32.const 0))) - (set_local 0x01b (i64.load offset=0x01b align=1 (i32.const 0))) - (set_local 0x01c (i64.load offset=0x01c align=1 (i32.const 0))) - (set_local 0x01d (i64.load offset=0x01d align=1 (i32.const 0))) - (set_local 0x01e (i64.load offset=0x01e align=1 (i32.const 0))) - (set_local 0x01f (i64.load offset=0x01f align=1 (i32.const 0))) - (set_local 0x020 (i64.load offset=0x020 align=1 (i32.const 0))) - (set_local 0x021 (i64.load offset=0x021 align=1 (i32.const 0))) - (set_local 0x022 (i64.load offset=0x022 align=1 (i32.const 0))) - (set_local 0x023 (i64.load offset=0x023 align=1 (i32.const 0))) - (set_local 0x024 (i64.load offset=0x024 align=1 (i32.const 0))) - (set_local 0x025 (i64.load offset=0x025 align=1 (i32.const 0))) - (set_local 0x026 (i64.load offset=0x026 align=1 (i32.const 0))) - (set_local 0x027 (i64.load offset=0x027 align=1 (i32.const 0))) - (set_local 0x028 (i64.load offset=0x028 align=1 (i32.const 0))) - (set_local 0x029 (i64.load offset=0x029 align=1 (i32.const 0))) - (set_local 0x02a (i64.load offset=0x02a align=1 (i32.const 0))) - (set_local 0x02b (i64.load offset=0x02b align=1 (i32.const 0))) - (set_local 0x02c (i64.load offset=0x02c align=1 (i32.const 0))) - (set_local 0x02d (i64.load offset=0x02d align=1 (i32.const 0))) - (set_local 0x02e (i64.load offset=0x02e align=1 (i32.const 0))) - (set_local 0x02f (i64.load offset=0x02f align=1 (i32.const 0))) - (set_local 0x030 (i64.load offset=0x030 align=1 (i32.const 0))) - (set_local 0x031 (i64.load offset=0x031 align=1 (i32.const 0))) - (set_local 0x032 (i64.load offset=0x032 align=1 (i32.const 0))) - (set_local 0x033 (i64.load offset=0x033 align=1 (i32.const 0))) - (set_local 0x034 (i64.load offset=0x034 align=1 (i32.const 0))) - (set_local 0x035 (i64.load offset=0x035 align=1 (i32.const 0))) - (set_local 0x036 (i64.load offset=0x036 align=1 (i32.const 0))) - (set_local 0x037 (i64.load offset=0x037 align=1 (i32.const 0))) - (set_local 0x038 (i64.load offset=0x038 align=1 (i32.const 0))) - (set_local 0x039 (i64.load offset=0x039 align=1 (i32.const 0))) - (set_local 0x03a (i64.load offset=0x03a align=1 (i32.const 0))) - (set_local 0x03b (i64.load offset=0x03b align=1 (i32.const 0))) - (set_local 0x03c (i64.load offset=0x03c align=1 (i32.const 0))) - (set_local 0x03d (i64.load offset=0x03d align=1 (i32.const 0))) - (set_local 0x03e (i64.load offset=0x03e align=1 (i32.const 0))) - (set_local 0x03f (i64.load offset=0x03f align=1 (i32.const 0))) - (set_local 0x040 (i64.load offset=0x040 align=1 (i32.const 0))) - (set_local 0x041 (i64.load offset=0x041 align=1 (i32.const 0))) - (set_local 0x042 (i64.load offset=0x042 align=1 (i32.const 0))) - (set_local 0x043 (i64.load offset=0x043 align=1 (i32.const 0))) - (set_local 0x044 (i64.load offset=0x044 align=1 (i32.const 0))) - (set_local 0x045 (i64.load offset=0x045 align=1 (i32.const 0))) - (set_local 0x046 (i64.load offset=0x046 align=1 (i32.const 0))) - (set_local 0x047 (i64.load offset=0x047 align=1 (i32.const 0))) - (set_local 0x048 (i64.load offset=0x048 align=1 (i32.const 0))) - (set_local 0x049 (i64.load offset=0x049 align=1 (i32.const 0))) - (set_local 0x04a (i64.load offset=0x04a align=1 (i32.const 0))) - (set_local 0x04b (i64.load offset=0x04b align=1 (i32.const 0))) - (set_local 0x04c (i64.load offset=0x04c align=1 (i32.const 0))) - (set_local 0x04d (i64.load offset=0x04d align=1 (i32.const 0))) - (set_local 0x04e (i64.load offset=0x04e align=1 (i32.const 0))) - (set_local 0x04f (i64.load offset=0x04f align=1 (i32.const 0))) - (set_local 0x050 (i64.load offset=0x050 align=1 (i32.const 0))) - (set_local 0x051 (i64.load offset=0x051 align=1 (i32.const 0))) - (set_local 0x052 (i64.load offset=0x052 align=1 (i32.const 0))) - (set_local 0x053 (i64.load offset=0x053 align=1 (i32.const 0))) - (set_local 0x054 (i64.load offset=0x054 align=1 (i32.const 0))) - (set_local 0x055 (i64.load offset=0x055 align=1 (i32.const 0))) - (set_local 0x056 (i64.load offset=0x056 align=1 (i32.const 0))) - (set_local 0x057 (i64.load offset=0x057 align=1 (i32.const 0))) - (set_local 0x058 (i64.load offset=0x058 align=1 (i32.const 0))) - (set_local 0x059 (i64.load offset=0x059 align=1 (i32.const 0))) - (set_local 0x05a (i64.load offset=0x05a align=1 (i32.const 0))) - (set_local 0x05b (i64.load offset=0x05b align=1 (i32.const 0))) - (set_local 0x05c (i64.load offset=0x05c align=1 (i32.const 0))) - (set_local 0x05d (i64.load offset=0x05d align=1 (i32.const 0))) - (set_local 0x05e (i64.load offset=0x05e align=1 (i32.const 0))) - (set_local 0x05f (i64.load offset=0x05f align=1 (i32.const 0))) - (set_local 0x060 (i64.load offset=0x060 align=1 (i32.const 0))) - (set_local 0x061 (i64.load offset=0x061 align=1 (i32.const 0))) - (set_local 0x062 (i64.load offset=0x062 align=1 (i32.const 0))) - (set_local 0x063 (i64.load offset=0x063 align=1 (i32.const 0))) - (set_local 0x064 (i64.load offset=0x064 align=1 (i32.const 0))) - (set_local 0x065 (i64.load offset=0x065 align=1 (i32.const 0))) - (set_local 0x066 (i64.load offset=0x066 align=1 (i32.const 0))) - (set_local 0x067 (i64.load offset=0x067 align=1 (i32.const 0))) - (set_local 0x068 (i64.load offset=0x068 align=1 (i32.const 0))) - (set_local 0x069 (i64.load offset=0x069 align=1 (i32.const 0))) - (set_local 0x06a (i64.load offset=0x06a align=1 (i32.const 0))) - (set_local 0x06b (i64.load offset=0x06b align=1 (i32.const 0))) - (set_local 0x06c (i64.load offset=0x06c align=1 (i32.const 0))) - (set_local 0x06d (i64.load offset=0x06d align=1 (i32.const 0))) - (set_local 0x06e (i64.load offset=0x06e align=1 (i32.const 0))) - (set_local 0x06f (i64.load offset=0x06f align=1 (i32.const 0))) - (set_local 0x070 (i64.load offset=0x070 align=1 (i32.const 0))) - (set_local 0x071 (i64.load offset=0x071 align=1 (i32.const 0))) - (set_local 0x072 (i64.load offset=0x072 align=1 (i32.const 0))) - (set_local 0x073 (i64.load offset=0x073 align=1 (i32.const 0))) - (set_local 0x074 (i64.load offset=0x074 align=1 (i32.const 0))) - (set_local 0x075 (i64.load offset=0x075 align=1 (i32.const 0))) - (set_local 0x076 (i64.load offset=0x076 align=1 (i32.const 0))) - (set_local 0x077 (i64.load offset=0x077 align=1 (i32.const 0))) - (set_local 0x078 (i64.load offset=0x078 align=1 (i32.const 0))) - (set_local 0x079 (i64.load offset=0x079 align=1 (i32.const 0))) - (set_local 0x07a (i64.load offset=0x07a align=1 (i32.const 0))) - (set_local 0x07b (i64.load offset=0x07b align=1 (i32.const 0))) - (set_local 0x07c (i64.load offset=0x07c align=1 (i32.const 0))) - (set_local 0x07d (i64.load offset=0x07d align=1 (i32.const 0))) - (set_local 0x07e (i64.load offset=0x07e align=1 (i32.const 0))) - (set_local 0x07f (i64.load offset=0x07f align=1 (i32.const 0))) - (set_local 0x080 (i64.load offset=0x080 align=1 (i32.const 0))) - (set_local 0x081 (i64.load offset=0x081 align=1 (i32.const 0))) - (set_local 0x082 (i64.load offset=0x082 align=1 (i32.const 0))) - (set_local 0x083 (i64.load offset=0x083 align=1 (i32.const 0))) - (set_local 0x084 (i64.load offset=0x084 align=1 (i32.const 0))) - (set_local 0x085 (i64.load offset=0x085 align=1 (i32.const 0))) - (set_local 0x086 (i64.load offset=0x086 align=1 (i32.const 0))) - (set_local 0x087 (i64.load offset=0x087 align=1 (i32.const 0))) - (set_local 0x088 (i64.load offset=0x088 align=1 (i32.const 0))) - (set_local 0x089 (i64.load offset=0x089 align=1 (i32.const 0))) - (set_local 0x08a (i64.load offset=0x08a align=1 (i32.const 0))) - (set_local 0x08b (i64.load offset=0x08b align=1 (i32.const 0))) - (set_local 0x08c (i64.load offset=0x08c align=1 (i32.const 0))) - (set_local 0x08d (i64.load offset=0x08d align=1 (i32.const 0))) - (set_local 0x08e (i64.load offset=0x08e align=1 (i32.const 0))) - (set_local 0x08f (i64.load offset=0x08f align=1 (i32.const 0))) - (set_local 0x090 (i64.load offset=0x090 align=1 (i32.const 0))) - (set_local 0x091 (i64.load offset=0x091 align=1 (i32.const 0))) - (set_local 0x092 (i64.load offset=0x092 align=1 (i32.const 0))) - (set_local 0x093 (i64.load offset=0x093 align=1 (i32.const 0))) - (set_local 0x094 (i64.load offset=0x094 align=1 (i32.const 0))) - (set_local 0x095 (i64.load offset=0x095 align=1 (i32.const 0))) - (set_local 0x096 (i64.load offset=0x096 align=1 (i32.const 0))) - (set_local 0x097 (i64.load offset=0x097 align=1 (i32.const 0))) - (set_local 0x098 (i64.load offset=0x098 align=1 (i32.const 0))) - (set_local 0x099 (i64.load offset=0x099 align=1 (i32.const 0))) - (set_local 0x09a (i64.load offset=0x09a align=1 (i32.const 0))) - (set_local 0x09b (i64.load offset=0x09b align=1 (i32.const 0))) - (set_local 0x09c (i64.load offset=0x09c align=1 (i32.const 0))) - (set_local 0x09d (i64.load offset=0x09d align=1 (i32.const 0))) - (set_local 0x09e (i64.load offset=0x09e align=1 (i32.const 0))) - (set_local 0x09f (i64.load offset=0x09f align=1 (i32.const 0))) - (set_local 0x0a0 (i64.load offset=0x0a0 align=1 (i32.const 0))) - (set_local 0x0a1 (i64.load offset=0x0a1 align=1 (i32.const 0))) - (set_local 0x0a2 (i64.load offset=0x0a2 align=1 (i32.const 0))) - (set_local 0x0a3 (i64.load offset=0x0a3 align=1 (i32.const 0))) - (set_local 0x0a4 (i64.load offset=0x0a4 align=1 (i32.const 0))) - (set_local 0x0a5 (i64.load offset=0x0a5 align=1 (i32.const 0))) - (set_local 0x0a6 (i64.load offset=0x0a6 align=1 (i32.const 0))) - (set_local 0x0a7 (i64.load offset=0x0a7 align=1 (i32.const 0))) - (set_local 0x0a8 (i64.load offset=0x0a8 align=1 (i32.const 0))) - (set_local 0x0a9 (i64.load offset=0x0a9 align=1 (i32.const 0))) - (set_local 0x0aa (i64.load offset=0x0aa align=1 (i32.const 0))) - (set_local 0x0ab (i64.load offset=0x0ab align=1 (i32.const 0))) - (set_local 0x0ac (i64.load offset=0x0ac align=1 (i32.const 0))) - (set_local 0x0ad (i64.load offset=0x0ad align=1 (i32.const 0))) - (set_local 0x0ae (i64.load offset=0x0ae align=1 (i32.const 0))) - (set_local 0x0af (i64.load offset=0x0af align=1 (i32.const 0))) - (set_local 0x0b0 (i64.load offset=0x0b0 align=1 (i32.const 0))) - (set_local 0x0b1 (i64.load offset=0x0b1 align=1 (i32.const 0))) - (set_local 0x0b2 (i64.load offset=0x0b2 align=1 (i32.const 0))) - (set_local 0x0b3 (i64.load offset=0x0b3 align=1 (i32.const 0))) - (set_local 0x0b4 (i64.load offset=0x0b4 align=1 (i32.const 0))) - (set_local 0x0b5 (i64.load offset=0x0b5 align=1 (i32.const 0))) - (set_local 0x0b6 (i64.load offset=0x0b6 align=1 (i32.const 0))) - (set_local 0x0b7 (i64.load offset=0x0b7 align=1 (i32.const 0))) - (set_local 0x0b8 (i64.load offset=0x0b8 align=1 (i32.const 0))) - (set_local 0x0b9 (i64.load offset=0x0b9 align=1 (i32.const 0))) - (set_local 0x0ba (i64.load offset=0x0ba align=1 (i32.const 0))) - (set_local 0x0bb (i64.load offset=0x0bb align=1 (i32.const 0))) - (set_local 0x0bc (i64.load offset=0x0bc align=1 (i32.const 0))) - (set_local 0x0bd (i64.load offset=0x0bd align=1 (i32.const 0))) - (set_local 0x0be (i64.load offset=0x0be align=1 (i32.const 0))) - (set_local 0x0bf (i64.load offset=0x0bf align=1 (i32.const 0))) - (set_local 0x0c0 (i64.load offset=0x0c0 align=1 (i32.const 0))) - (set_local 0x0c1 (i64.load offset=0x0c1 align=1 (i32.const 0))) - (set_local 0x0c2 (i64.load offset=0x0c2 align=1 (i32.const 0))) - (set_local 0x0c3 (i64.load offset=0x0c3 align=1 (i32.const 0))) - (set_local 0x0c4 (i64.load offset=0x0c4 align=1 (i32.const 0))) - (set_local 0x0c5 (i64.load offset=0x0c5 align=1 (i32.const 0))) - (set_local 0x0c6 (i64.load offset=0x0c6 align=1 (i32.const 0))) - (set_local 0x0c7 (i64.load offset=0x0c7 align=1 (i32.const 0))) - (set_local 0x0c8 (i64.load offset=0x0c8 align=1 (i32.const 0))) - (set_local 0x0c9 (i64.load offset=0x0c9 align=1 (i32.const 0))) - (set_local 0x0ca (i64.load offset=0x0ca align=1 (i32.const 0))) - (set_local 0x0cb (i64.load offset=0x0cb align=1 (i32.const 0))) - (set_local 0x0cc (i64.load offset=0x0cc align=1 (i32.const 0))) - (set_local 0x0cd (i64.load offset=0x0cd align=1 (i32.const 0))) - (set_local 0x0ce (i64.load offset=0x0ce align=1 (i32.const 0))) - (set_local 0x0cf (i64.load offset=0x0cf align=1 (i32.const 0))) - (set_local 0x0d0 (i64.load offset=0x0d0 align=1 (i32.const 0))) - (set_local 0x0d1 (i64.load offset=0x0d1 align=1 (i32.const 0))) - (set_local 0x0d2 (i64.load offset=0x0d2 align=1 (i32.const 0))) - (set_local 0x0d3 (i64.load offset=0x0d3 align=1 (i32.const 0))) - (set_local 0x0d4 (i64.load offset=0x0d4 align=1 (i32.const 0))) - (set_local 0x0d5 (i64.load offset=0x0d5 align=1 (i32.const 0))) - (set_local 0x0d6 (i64.load offset=0x0d6 align=1 (i32.const 0))) - (set_local 0x0d7 (i64.load offset=0x0d7 align=1 (i32.const 0))) - (set_local 0x0d8 (i64.load offset=0x0d8 align=1 (i32.const 0))) - (set_local 0x0d9 (i64.load offset=0x0d9 align=1 (i32.const 0))) - (set_local 0x0da (i64.load offset=0x0da align=1 (i32.const 0))) - (set_local 0x0db (i64.load offset=0x0db align=1 (i32.const 0))) - (set_local 0x0dc (i64.load offset=0x0dc align=1 (i32.const 0))) - (set_local 0x0dd (i64.load offset=0x0dd align=1 (i32.const 0))) - (set_local 0x0de (i64.load offset=0x0de align=1 (i32.const 0))) - (set_local 0x0df (i64.load offset=0x0df align=1 (i32.const 0))) - (set_local 0x0e0 (i64.load offset=0x0e0 align=1 (i32.const 0))) - (set_local 0x0e1 (i64.load offset=0x0e1 align=1 (i32.const 0))) - (set_local 0x0e2 (i64.load offset=0x0e2 align=1 (i32.const 0))) - (set_local 0x0e3 (i64.load offset=0x0e3 align=1 (i32.const 0))) - (set_local 0x0e4 (i64.load offset=0x0e4 align=1 (i32.const 0))) - (set_local 0x0e5 (i64.load offset=0x0e5 align=1 (i32.const 0))) - (set_local 0x0e6 (i64.load offset=0x0e6 align=1 (i32.const 0))) - (set_local 0x0e7 (i64.load offset=0x0e7 align=1 (i32.const 0))) - (set_local 0x0e8 (i64.load offset=0x0e8 align=1 (i32.const 0))) - (set_local 0x0e9 (i64.load offset=0x0e9 align=1 (i32.const 0))) - (set_local 0x0ea (i64.load offset=0x0ea align=1 (i32.const 0))) - (set_local 0x0eb (i64.load offset=0x0eb align=1 (i32.const 0))) - (set_local 0x0ec (i64.load offset=0x0ec align=1 (i32.const 0))) - (set_local 0x0ed (i64.load offset=0x0ed align=1 (i32.const 0))) - (set_local 0x0ee (i64.load offset=0x0ee align=1 (i32.const 0))) - (set_local 0x0ef (i64.load offset=0x0ef align=1 (i32.const 0))) - (set_local 0x0f0 (i64.load offset=0x0f0 align=1 (i32.const 0))) - (set_local 0x0f1 (i64.load offset=0x0f1 align=1 (i32.const 0))) - (set_local 0x0f2 (i64.load offset=0x0f2 align=1 (i32.const 0))) - (set_local 0x0f3 (i64.load offset=0x0f3 align=1 (i32.const 0))) - (set_local 0x0f4 (i64.load offset=0x0f4 align=1 (i32.const 0))) - (set_local 0x0f5 (i64.load offset=0x0f5 align=1 (i32.const 0))) - (set_local 0x0f6 (i64.load offset=0x0f6 align=1 (i32.const 0))) - (set_local 0x0f7 (i64.load offset=0x0f7 align=1 (i32.const 0))) - (set_local 0x0f8 (i64.load offset=0x0f8 align=1 (i32.const 0))) - (set_local 0x0f9 (i64.load offset=0x0f9 align=1 (i32.const 0))) - (set_local 0x0fa (i64.load offset=0x0fa align=1 (i32.const 0))) - (set_local 0x0fb (i64.load offset=0x0fb align=1 (i32.const 0))) - (set_local 0x0fc (i64.load offset=0x0fc align=1 (i32.const 0))) - (set_local 0x0fd (i64.load offset=0x0fd align=1 (i32.const 0))) - (set_local 0x0fe (i64.load offset=0x0fe align=1 (i32.const 0))) - (set_local 0x0ff (i64.load offset=0x0ff align=1 (i32.const 0))) - (set_local 0x100 (i64.load offset=0x100 align=1 (i32.const 0))) - (set_local 0x101 (i64.load offset=0x101 align=1 (i32.const 0))) - (set_local 0x102 (i64.load offset=0x102 align=1 (i32.const 0))) - (set_local 0x103 (i64.load offset=0x103 align=1 (i32.const 0))) - (set_local 0x104 (i64.load offset=0x104 align=1 (i32.const 0))) - (set_local 0x105 (i64.load offset=0x105 align=1 (i32.const 0))) - (set_local 0x106 (i64.load offset=0x106 align=1 (i32.const 0))) - (set_local 0x107 (i64.load offset=0x107 align=1 (i32.const 0))) - (set_local 0x108 (i64.load offset=0x108 align=1 (i32.const 0))) - (set_local 0x109 (i64.load offset=0x109 align=1 (i32.const 0))) - (set_local 0x10a (i64.load offset=0x10a align=1 (i32.const 0))) - (set_local 0x10b (i64.load offset=0x10b align=1 (i32.const 0))) - (set_local 0x10c (i64.load offset=0x10c align=1 (i32.const 0))) - (set_local 0x10d (i64.load offset=0x10d align=1 (i32.const 0))) - (set_local 0x10e (i64.load offset=0x10e align=1 (i32.const 0))) - (set_local 0x10f (i64.load offset=0x10f align=1 (i32.const 0))) - (set_local 0x110 (i64.load offset=0x110 align=1 (i32.const 0))) - (set_local 0x111 (i64.load offset=0x111 align=1 (i32.const 0))) - (set_local 0x112 (i64.load offset=0x112 align=1 (i32.const 0))) - (set_local 0x113 (i64.load offset=0x113 align=1 (i32.const 0))) - (set_local 0x114 (i64.load offset=0x114 align=1 (i32.const 0))) - (set_local 0x115 (i64.load offset=0x115 align=1 (i32.const 0))) - (set_local 0x116 (i64.load offset=0x116 align=1 (i32.const 0))) - (set_local 0x117 (i64.load offset=0x117 align=1 (i32.const 0))) - (set_local 0x118 (i64.load offset=0x118 align=1 (i32.const 0))) - (set_local 0x119 (i64.load offset=0x119 align=1 (i32.const 0))) - (set_local 0x11a (i64.load offset=0x11a align=1 (i32.const 0))) - (set_local 0x11b (i64.load offset=0x11b align=1 (i32.const 0))) - (set_local 0x11c (i64.load offset=0x11c align=1 (i32.const 0))) - (set_local 0x11d (i64.load offset=0x11d align=1 (i32.const 0))) - (set_local 0x11e (i64.load offset=0x11e align=1 (i32.const 0))) - (set_local 0x11f (i64.load offset=0x11f align=1 (i32.const 0))) - (set_local 0x120 (i64.load offset=0x120 align=1 (i32.const 0))) - (set_local 0x121 (i64.load offset=0x121 align=1 (i32.const 0))) - (set_local 0x122 (i64.load offset=0x122 align=1 (i32.const 0))) - (set_local 0x123 (i64.load offset=0x123 align=1 (i32.const 0))) - (set_local 0x124 (i64.load offset=0x124 align=1 (i32.const 0))) - (set_local 0x125 (i64.load offset=0x125 align=1 (i32.const 0))) - (set_local 0x126 (i64.load offset=0x126 align=1 (i32.const 0))) - (set_local 0x127 (i64.load offset=0x127 align=1 (i32.const 0))) - (set_local 0x128 (i64.load offset=0x128 align=1 (i32.const 0))) - (set_local 0x129 (i64.load offset=0x129 align=1 (i32.const 0))) - (set_local 0x12a (i64.load offset=0x12a align=1 (i32.const 0))) - (set_local 0x12b (i64.load offset=0x12b align=1 (i32.const 0))) - (set_local 0x12c (i64.load offset=0x12c align=1 (i32.const 0))) - (set_local 0x12d (i64.load offset=0x12d align=1 (i32.const 0))) - (set_local 0x12e (i64.load offset=0x12e align=1 (i32.const 0))) - (set_local 0x12f (i64.load offset=0x12f align=1 (i32.const 0))) - (set_local 0x130 (i64.load offset=0x130 align=1 (i32.const 0))) - (set_local 0x131 (i64.load offset=0x131 align=1 (i32.const 0))) - (set_local 0x132 (i64.load offset=0x132 align=1 (i32.const 0))) - (set_local 0x133 (i64.load offset=0x133 align=1 (i32.const 0))) - (set_local 0x134 (i64.load offset=0x134 align=1 (i32.const 0))) - (set_local 0x135 (i64.load offset=0x135 align=1 (i32.const 0))) - (set_local 0x136 (i64.load offset=0x136 align=1 (i32.const 0))) - (set_local 0x137 (i64.load offset=0x137 align=1 (i32.const 0))) - (set_local 0x138 (i64.load offset=0x138 align=1 (i32.const 0))) - (set_local 0x139 (i64.load offset=0x139 align=1 (i32.const 0))) - (set_local 0x13a (i64.load offset=0x13a align=1 (i32.const 0))) - (set_local 0x13b (i64.load offset=0x13b align=1 (i32.const 0))) - (set_local 0x13c (i64.load offset=0x13c align=1 (i32.const 0))) - (set_local 0x13d (i64.load offset=0x13d align=1 (i32.const 0))) - (set_local 0x13e (i64.load offset=0x13e align=1 (i32.const 0))) - (set_local 0x13f (i64.load offset=0x13f align=1 (i32.const 0))) - (set_local 0x140 (i64.load offset=0x140 align=1 (i32.const 0))) - (set_local 0x141 (i64.load offset=0x141 align=1 (i32.const 0))) - (set_local 0x142 (i64.load offset=0x142 align=1 (i32.const 0))) - (set_local 0x143 (i64.load offset=0x143 align=1 (i32.const 0))) - (set_local 0x144 (i64.load offset=0x144 align=1 (i32.const 0))) - (set_local 0x145 (i64.load offset=0x145 align=1 (i32.const 0))) - (set_local 0x146 (i64.load offset=0x146 align=1 (i32.const 0))) - (set_local 0x147 (i64.load offset=0x147 align=1 (i32.const 0))) - (set_local 0x148 (i64.load offset=0x148 align=1 (i32.const 0))) - (set_local 0x149 (i64.load offset=0x149 align=1 (i32.const 0))) - (set_local 0x14a (i64.load offset=0x14a align=1 (i32.const 0))) - (set_local 0x14b (i64.load offset=0x14b align=1 (i32.const 0))) - (set_local 0x14c (i64.load offset=0x14c align=1 (i32.const 0))) - (set_local 0x14d (i64.load offset=0x14d align=1 (i32.const 0))) - (set_local 0x14e (i64.load offset=0x14e align=1 (i32.const 0))) - (set_local 0x14f (i64.load offset=0x14f align=1 (i32.const 0))) - (set_local 0x150 (i64.load offset=0x150 align=1 (i32.const 0))) - (set_local 0x151 (i64.load offset=0x151 align=1 (i32.const 0))) - (set_local 0x152 (i64.load offset=0x152 align=1 (i32.const 0))) - (set_local 0x153 (i64.load offset=0x153 align=1 (i32.const 0))) - (set_local 0x154 (i64.load offset=0x154 align=1 (i32.const 0))) - (set_local 0x155 (i64.load offset=0x155 align=1 (i32.const 0))) - (set_local 0x156 (i64.load offset=0x156 align=1 (i32.const 0))) - (set_local 0x157 (i64.load offset=0x157 align=1 (i32.const 0))) - (set_local 0x158 (i64.load offset=0x158 align=1 (i32.const 0))) - (set_local 0x159 (i64.load offset=0x159 align=1 (i32.const 0))) - (set_local 0x15a (i64.load offset=0x15a align=1 (i32.const 0))) - (set_local 0x15b (i64.load offset=0x15b align=1 (i32.const 0))) - (set_local 0x15c (i64.load offset=0x15c align=1 (i32.const 0))) - (set_local 0x15d (i64.load offset=0x15d align=1 (i32.const 0))) - (set_local 0x15e (i64.load offset=0x15e align=1 (i32.const 0))) - (set_local 0x15f (i64.load offset=0x15f align=1 (i32.const 0))) - (set_local 0x160 (i64.load offset=0x160 align=1 (i32.const 0))) - (set_local 0x161 (i64.load offset=0x161 align=1 (i32.const 0))) - (set_local 0x162 (i64.load offset=0x162 align=1 (i32.const 0))) - (set_local 0x163 (i64.load offset=0x163 align=1 (i32.const 0))) - (set_local 0x164 (i64.load offset=0x164 align=1 (i32.const 0))) - (set_local 0x165 (i64.load offset=0x165 align=1 (i32.const 0))) - (set_local 0x166 (i64.load offset=0x166 align=1 (i32.const 0))) - (set_local 0x167 (i64.load offset=0x167 align=1 (i32.const 0))) - (set_local 0x168 (i64.load offset=0x168 align=1 (i32.const 0))) - (set_local 0x169 (i64.load offset=0x169 align=1 (i32.const 0))) - (set_local 0x16a (i64.load offset=0x16a align=1 (i32.const 0))) - (set_local 0x16b (i64.load offset=0x16b align=1 (i32.const 0))) - (set_local 0x16c (i64.load offset=0x16c align=1 (i32.const 0))) - (set_local 0x16d (i64.load offset=0x16d align=1 (i32.const 0))) - (set_local 0x16e (i64.load offset=0x16e align=1 (i32.const 0))) - (set_local 0x16f (i64.load offset=0x16f align=1 (i32.const 0))) - (set_local 0x170 (i64.load offset=0x170 align=1 (i32.const 0))) - (set_local 0x171 (i64.load offset=0x171 align=1 (i32.const 0))) - (set_local 0x172 (i64.load offset=0x172 align=1 (i32.const 0))) - (set_local 0x173 (i64.load offset=0x173 align=1 (i32.const 0))) - (set_local 0x174 (i64.load offset=0x174 align=1 (i32.const 0))) - (set_local 0x175 (i64.load offset=0x175 align=1 (i32.const 0))) - (set_local 0x176 (i64.load offset=0x176 align=1 (i32.const 0))) - (set_local 0x177 (i64.load offset=0x177 align=1 (i32.const 0))) - (set_local 0x178 (i64.load offset=0x178 align=1 (i32.const 0))) - (set_local 0x179 (i64.load offset=0x179 align=1 (i32.const 0))) - (set_local 0x17a (i64.load offset=0x17a align=1 (i32.const 0))) - (set_local 0x17b (i64.load offset=0x17b align=1 (i32.const 0))) - (set_local 0x17c (i64.load offset=0x17c align=1 (i32.const 0))) - (set_local 0x17d (i64.load offset=0x17d align=1 (i32.const 0))) - (set_local 0x17e (i64.load offset=0x17e align=1 (i32.const 0))) - (set_local 0x17f (i64.load offset=0x17f align=1 (i32.const 0))) - (set_local 0x180 (i64.load offset=0x180 align=1 (i32.const 0))) - (set_local 0x181 (i64.load offset=0x181 align=1 (i32.const 0))) - (set_local 0x182 (i64.load offset=0x182 align=1 (i32.const 0))) - (set_local 0x183 (i64.load offset=0x183 align=1 (i32.const 0))) - (set_local 0x184 (i64.load offset=0x184 align=1 (i32.const 0))) - (set_local 0x185 (i64.load offset=0x185 align=1 (i32.const 0))) - (set_local 0x186 (i64.load offset=0x186 align=1 (i32.const 0))) - (set_local 0x187 (i64.load offset=0x187 align=1 (i32.const 0))) - (set_local 0x188 (i64.load offset=0x188 align=1 (i32.const 0))) - (set_local 0x189 (i64.load offset=0x189 align=1 (i32.const 0))) - (set_local 0x18a (i64.load offset=0x18a align=1 (i32.const 0))) - (set_local 0x18b (i64.load offset=0x18b align=1 (i32.const 0))) - (set_local 0x18c (i64.load offset=0x18c align=1 (i32.const 0))) - (set_local 0x18d (i64.load offset=0x18d align=1 (i32.const 0))) - (set_local 0x18e (i64.load offset=0x18e align=1 (i32.const 0))) - (set_local 0x18f (i64.load offset=0x18f align=1 (i32.const 0))) - (set_local 0x190 (i64.load offset=0x190 align=1 (i32.const 0))) - (set_local 0x191 (i64.load offset=0x191 align=1 (i32.const 0))) - (set_local 0x192 (i64.load offset=0x192 align=1 (i32.const 0))) - (set_local 0x193 (i64.load offset=0x193 align=1 (i32.const 0))) - (set_local 0x194 (i64.load offset=0x194 align=1 (i32.const 0))) - (set_local 0x195 (i64.load offset=0x195 align=1 (i32.const 0))) - (set_local 0x196 (i64.load offset=0x196 align=1 (i32.const 0))) - (set_local 0x197 (i64.load offset=0x197 align=1 (i32.const 0))) - (set_local 0x198 (i64.load offset=0x198 align=1 (i32.const 0))) - (set_local 0x199 (i64.load offset=0x199 align=1 (i32.const 0))) - (set_local 0x19a (i64.load offset=0x19a align=1 (i32.const 0))) - (set_local 0x19b (i64.load offset=0x19b align=1 (i32.const 0))) - (set_local 0x19c (i64.load offset=0x19c align=1 (i32.const 0))) - (set_local 0x19d (i64.load offset=0x19d align=1 (i32.const 0))) - (set_local 0x19e (i64.load offset=0x19e align=1 (i32.const 0))) - (set_local 0x19f (i64.load offset=0x19f align=1 (i32.const 0))) - (set_local 0x1a0 (i64.load offset=0x1a0 align=1 (i32.const 0))) - (set_local 0x1a1 (i64.load offset=0x1a1 align=1 (i32.const 0))) - (set_local 0x1a2 (i64.load offset=0x1a2 align=1 (i32.const 0))) - (set_local 0x1a3 (i64.load offset=0x1a3 align=1 (i32.const 0))) - (set_local 0x1a4 (i64.load offset=0x1a4 align=1 (i32.const 0))) - (set_local 0x1a5 (i64.load offset=0x1a5 align=1 (i32.const 0))) - (set_local 0x1a6 (i64.load offset=0x1a6 align=1 (i32.const 0))) - (set_local 0x1a7 (i64.load offset=0x1a7 align=1 (i32.const 0))) - (set_local 0x1a8 (i64.load offset=0x1a8 align=1 (i32.const 0))) - (set_local 0x1a9 (i64.load offset=0x1a9 align=1 (i32.const 0))) - (set_local 0x1aa (i64.load offset=0x1aa align=1 (i32.const 0))) - (set_local 0x1ab (i64.load offset=0x1ab align=1 (i32.const 0))) - (set_local 0x1ac (i64.load offset=0x1ac align=1 (i32.const 0))) - (set_local 0x1ad (i64.load offset=0x1ad align=1 (i32.const 0))) - (set_local 0x1ae (i64.load offset=0x1ae align=1 (i32.const 0))) - (set_local 0x1af (i64.load offset=0x1af align=1 (i32.const 0))) - (set_local 0x1b0 (i64.load offset=0x1b0 align=1 (i32.const 0))) - (set_local 0x1b1 (i64.load offset=0x1b1 align=1 (i32.const 0))) - (set_local 0x1b2 (i64.load offset=0x1b2 align=1 (i32.const 0))) - (set_local 0x1b3 (i64.load offset=0x1b3 align=1 (i32.const 0))) - (set_local 0x1b4 (i64.load offset=0x1b4 align=1 (i32.const 0))) - (set_local 0x1b5 (i64.load offset=0x1b5 align=1 (i32.const 0))) - (set_local 0x1b6 (i64.load offset=0x1b6 align=1 (i32.const 0))) - (set_local 0x1b7 (i64.load offset=0x1b7 align=1 (i32.const 0))) - (set_local 0x1b8 (i64.load offset=0x1b8 align=1 (i32.const 0))) - (set_local 0x1b9 (i64.load offset=0x1b9 align=1 (i32.const 0))) - (set_local 0x1ba (i64.load offset=0x1ba align=1 (i32.const 0))) - (set_local 0x1bb (i64.load offset=0x1bb align=1 (i32.const 0))) - (set_local 0x1bc (i64.load offset=0x1bc align=1 (i32.const 0))) - (set_local 0x1bd (i64.load offset=0x1bd align=1 (i32.const 0))) - (set_local 0x1be (i64.load offset=0x1be align=1 (i32.const 0))) - (set_local 0x1bf (i64.load offset=0x1bf align=1 (i32.const 0))) - (set_local 0x1c0 (i64.load offset=0x1c0 align=1 (i32.const 0))) - (set_local 0x1c1 (i64.load offset=0x1c1 align=1 (i32.const 0))) - (set_local 0x1c2 (i64.load offset=0x1c2 align=1 (i32.const 0))) - (set_local 0x1c3 (i64.load offset=0x1c3 align=1 (i32.const 0))) - (set_local 0x1c4 (i64.load offset=0x1c4 align=1 (i32.const 0))) - (set_local 0x1c5 (i64.load offset=0x1c5 align=1 (i32.const 0))) - (set_local 0x1c6 (i64.load offset=0x1c6 align=1 (i32.const 0))) - (set_local 0x1c7 (i64.load offset=0x1c7 align=1 (i32.const 0))) - (set_local 0x1c8 (i64.load offset=0x1c8 align=1 (i32.const 0))) - (set_local 0x1c9 (i64.load offset=0x1c9 align=1 (i32.const 0))) - (set_local 0x1ca (i64.load offset=0x1ca align=1 (i32.const 0))) - (set_local 0x1cb (i64.load offset=0x1cb align=1 (i32.const 0))) - (set_local 0x1cc (i64.load offset=0x1cc align=1 (i32.const 0))) - (set_local 0x1cd (i64.load offset=0x1cd align=1 (i32.const 0))) - (set_local 0x1ce (i64.load offset=0x1ce align=1 (i32.const 0))) - (set_local 0x1cf (i64.load offset=0x1cf align=1 (i32.const 0))) - (set_local 0x1d0 (i64.load offset=0x1d0 align=1 (i32.const 0))) - (set_local 0x1d1 (i64.load offset=0x1d1 align=1 (i32.const 0))) - (set_local 0x1d2 (i64.load offset=0x1d2 align=1 (i32.const 0))) - (set_local 0x1d3 (i64.load offset=0x1d3 align=1 (i32.const 0))) - (set_local 0x1d4 (i64.load offset=0x1d4 align=1 (i32.const 0))) - (set_local 0x1d5 (i64.load offset=0x1d5 align=1 (i32.const 0))) - (set_local 0x1d6 (i64.load offset=0x1d6 align=1 (i32.const 0))) - (set_local 0x1d7 (i64.load offset=0x1d7 align=1 (i32.const 0))) - (set_local 0x1d8 (i64.load offset=0x1d8 align=1 (i32.const 0))) - (set_local 0x1d9 (i64.load offset=0x1d9 align=1 (i32.const 0))) - (set_local 0x1da (i64.load offset=0x1da align=1 (i32.const 0))) - (set_local 0x1db (i64.load offset=0x1db align=1 (i32.const 0))) - (set_local 0x1dc (i64.load offset=0x1dc align=1 (i32.const 0))) - (set_local 0x1dd (i64.load offset=0x1dd align=1 (i32.const 0))) - (set_local 0x1de (i64.load offset=0x1de align=1 (i32.const 0))) - (set_local 0x1df (i64.load offset=0x1df align=1 (i32.const 0))) - (set_local 0x1e0 (i64.load offset=0x1e0 align=1 (i32.const 0))) - (set_local 0x1e1 (i64.load offset=0x1e1 align=1 (i32.const 0))) - (set_local 0x1e2 (i64.load offset=0x1e2 align=1 (i32.const 0))) - (set_local 0x1e3 (i64.load offset=0x1e3 align=1 (i32.const 0))) - (set_local 0x1e4 (i64.load offset=0x1e4 align=1 (i32.const 0))) - (set_local 0x1e5 (i64.load offset=0x1e5 align=1 (i32.const 0))) - (set_local 0x1e6 (i64.load offset=0x1e6 align=1 (i32.const 0))) - (set_local 0x1e7 (i64.load offset=0x1e7 align=1 (i32.const 0))) - (set_local 0x1e8 (i64.load offset=0x1e8 align=1 (i32.const 0))) - (set_local 0x1e9 (i64.load offset=0x1e9 align=1 (i32.const 0))) - (set_local 0x1ea (i64.load offset=0x1ea align=1 (i32.const 0))) - (set_local 0x1eb (i64.load offset=0x1eb align=1 (i32.const 0))) - (set_local 0x1ec (i64.load offset=0x1ec align=1 (i32.const 0))) - (set_local 0x1ed (i64.load offset=0x1ed align=1 (i32.const 0))) - (set_local 0x1ee (i64.load offset=0x1ee align=1 (i32.const 0))) - (set_local 0x1ef (i64.load offset=0x1ef align=1 (i32.const 0))) - (set_local 0x1f0 (i64.load offset=0x1f0 align=1 (i32.const 0))) - (set_local 0x1f1 (i64.load offset=0x1f1 align=1 (i32.const 0))) - (set_local 0x1f2 (i64.load offset=0x1f2 align=1 (i32.const 0))) - (set_local 0x1f3 (i64.load offset=0x1f3 align=1 (i32.const 0))) - (set_local 0x1f4 (i64.load offset=0x1f4 align=1 (i32.const 0))) - (set_local 0x1f5 (i64.load offset=0x1f5 align=1 (i32.const 0))) - (set_local 0x1f6 (i64.load offset=0x1f6 align=1 (i32.const 0))) - (set_local 0x1f7 (i64.load offset=0x1f7 align=1 (i32.const 0))) - (set_local 0x1f8 (i64.load offset=0x1f8 align=1 (i32.const 0))) - (set_local 0x1f9 (i64.load offset=0x1f9 align=1 (i32.const 0))) - (set_local 0x1fa (i64.load offset=0x1fa align=1 (i32.const 0))) - (set_local 0x1fb (i64.load offset=0x1fb align=1 (i32.const 0))) - (set_local 0x1fc (i64.load offset=0x1fc align=1 (i32.const 0))) - (set_local 0x1fd (i64.load offset=0x1fd align=1 (i32.const 0))) - (set_local 0x1fe (i64.load offset=0x1fe align=1 (i32.const 0))) - (set_local 0x1ff (i64.load offset=0x1ff align=1 (i32.const 0))) - (set_local 0x200 (i64.load offset=0x200 align=1 (i32.const 0))) - (set_local 0x201 (i64.load offset=0x201 align=1 (i32.const 0))) - (set_local 0x202 (i64.load offset=0x202 align=1 (i32.const 0))) - (set_local 0x203 (i64.load offset=0x203 align=1 (i32.const 0))) - (set_local 0x204 (i64.load offset=0x204 align=1 (i32.const 0))) - (set_local 0x205 (i64.load offset=0x205 align=1 (i32.const 0))) - (set_local 0x206 (i64.load offset=0x206 align=1 (i32.const 0))) - (set_local 0x207 (i64.load offset=0x207 align=1 (i32.const 0))) - (set_local 0x208 (i64.load offset=0x208 align=1 (i32.const 0))) - (set_local 0x209 (i64.load offset=0x209 align=1 (i32.const 0))) - (set_local 0x20a (i64.load offset=0x20a align=1 (i32.const 0))) - (set_local 0x20b (i64.load offset=0x20b align=1 (i32.const 0))) - (set_local 0x20c (i64.load offset=0x20c align=1 (i32.const 0))) - (set_local 0x20d (i64.load offset=0x20d align=1 (i32.const 0))) - (set_local 0x20e (i64.load offset=0x20e align=1 (i32.const 0))) - (set_local 0x20f (i64.load offset=0x20f align=1 (i32.const 0))) - (set_local 0x210 (i64.load offset=0x210 align=1 (i32.const 0))) - (set_local 0x211 (i64.load offset=0x211 align=1 (i32.const 0))) - (set_local 0x212 (i64.load offset=0x212 align=1 (i32.const 0))) - (set_local 0x213 (i64.load offset=0x213 align=1 (i32.const 0))) - (set_local 0x214 (i64.load offset=0x214 align=1 (i32.const 0))) - (set_local 0x215 (i64.load offset=0x215 align=1 (i32.const 0))) - (set_local 0x216 (i64.load offset=0x216 align=1 (i32.const 0))) - (set_local 0x217 (i64.load offset=0x217 align=1 (i32.const 0))) - (set_local 0x218 (i64.load offset=0x218 align=1 (i32.const 0))) - (set_local 0x219 (i64.load offset=0x219 align=1 (i32.const 0))) - (set_local 0x21a (i64.load offset=0x21a align=1 (i32.const 0))) - (set_local 0x21b (i64.load offset=0x21b align=1 (i32.const 0))) - (set_local 0x21c (i64.load offset=0x21c align=1 (i32.const 0))) - (set_local 0x21d (i64.load offset=0x21d align=1 (i32.const 0))) - (set_local 0x21e (i64.load offset=0x21e align=1 (i32.const 0))) - (set_local 0x21f (i64.load offset=0x21f align=1 (i32.const 0))) - (set_local 0x220 (i64.load offset=0x220 align=1 (i32.const 0))) - (set_local 0x221 (i64.load offset=0x221 align=1 (i32.const 0))) - (set_local 0x222 (i64.load offset=0x222 align=1 (i32.const 0))) - (set_local 0x223 (i64.load offset=0x223 align=1 (i32.const 0))) - (set_local 0x224 (i64.load offset=0x224 align=1 (i32.const 0))) - (set_local 0x225 (i64.load offset=0x225 align=1 (i32.const 0))) - (set_local 0x226 (i64.load offset=0x226 align=1 (i32.const 0))) - (set_local 0x227 (i64.load offset=0x227 align=1 (i32.const 0))) - (set_local 0x228 (i64.load offset=0x228 align=1 (i32.const 0))) - (set_local 0x229 (i64.load offset=0x229 align=1 (i32.const 0))) - (set_local 0x22a (i64.load offset=0x22a align=1 (i32.const 0))) - (set_local 0x22b (i64.load offset=0x22b align=1 (i32.const 0))) - (set_local 0x22c (i64.load offset=0x22c align=1 (i32.const 0))) - (set_local 0x22d (i64.load offset=0x22d align=1 (i32.const 0))) - (set_local 0x22e (i64.load offset=0x22e align=1 (i32.const 0))) - (set_local 0x22f (i64.load offset=0x22f align=1 (i32.const 0))) - (set_local 0x230 (i64.load offset=0x230 align=1 (i32.const 0))) - (set_local 0x231 (i64.load offset=0x231 align=1 (i32.const 0))) - (set_local 0x232 (i64.load offset=0x232 align=1 (i32.const 0))) - (set_local 0x233 (i64.load offset=0x233 align=1 (i32.const 0))) - (set_local 0x234 (i64.load offset=0x234 align=1 (i32.const 0))) - (set_local 0x235 (i64.load offset=0x235 align=1 (i32.const 0))) - (set_local 0x236 (i64.load offset=0x236 align=1 (i32.const 0))) - (set_local 0x237 (i64.load offset=0x237 align=1 (i32.const 0))) - (set_local 0x238 (i64.load offset=0x238 align=1 (i32.const 0))) - (set_local 0x239 (i64.load offset=0x239 align=1 (i32.const 0))) - (set_local 0x23a (i64.load offset=0x23a align=1 (i32.const 0))) - (set_local 0x23b (i64.load offset=0x23b align=1 (i32.const 0))) - (set_local 0x23c (i64.load offset=0x23c align=1 (i32.const 0))) - (set_local 0x23d (i64.load offset=0x23d align=1 (i32.const 0))) - (set_local 0x23e (i64.load offset=0x23e align=1 (i32.const 0))) - (set_local 0x23f (i64.load offset=0x23f align=1 (i32.const 0))) - (set_local 0x240 (i64.load offset=0x240 align=1 (i32.const 0))) - (set_local 0x241 (i64.load offset=0x241 align=1 (i32.const 0))) - (set_local 0x242 (i64.load offset=0x242 align=1 (i32.const 0))) - (set_local 0x243 (i64.load offset=0x243 align=1 (i32.const 0))) - (set_local 0x244 (i64.load offset=0x244 align=1 (i32.const 0))) - (set_local 0x245 (i64.load offset=0x245 align=1 (i32.const 0))) - (set_local 0x246 (i64.load offset=0x246 align=1 (i32.const 0))) - (set_local 0x247 (i64.load offset=0x247 align=1 (i32.const 0))) - (set_local 0x248 (i64.load offset=0x248 align=1 (i32.const 0))) - (set_local 0x249 (i64.load offset=0x249 align=1 (i32.const 0))) - (set_local 0x24a (i64.load offset=0x24a align=1 (i32.const 0))) - (set_local 0x24b (i64.load offset=0x24b align=1 (i32.const 0))) - (set_local 0x24c (i64.load offset=0x24c align=1 (i32.const 0))) - (set_local 0x24d (i64.load offset=0x24d align=1 (i32.const 0))) - (set_local 0x24e (i64.load offset=0x24e align=1 (i32.const 0))) - (set_local 0x24f (i64.load offset=0x24f align=1 (i32.const 0))) - (set_local 0x250 (i64.load offset=0x250 align=1 (i32.const 0))) - (set_local 0x251 (i64.load offset=0x251 align=1 (i32.const 0))) - (set_local 0x252 (i64.load offset=0x252 align=1 (i32.const 0))) - (set_local 0x253 (i64.load offset=0x253 align=1 (i32.const 0))) - (set_local 0x254 (i64.load offset=0x254 align=1 (i32.const 0))) - (set_local 0x255 (i64.load offset=0x255 align=1 (i32.const 0))) - (set_local 0x256 (i64.load offset=0x256 align=1 (i32.const 0))) - (set_local 0x257 (i64.load offset=0x257 align=1 (i32.const 0))) - (set_local 0x258 (i64.load offset=0x258 align=1 (i32.const 0))) - (set_local 0x259 (i64.load offset=0x259 align=1 (i32.const 0))) - (set_local 0x25a (i64.load offset=0x25a align=1 (i32.const 0))) - (set_local 0x25b (i64.load offset=0x25b align=1 (i32.const 0))) - (set_local 0x25c (i64.load offset=0x25c align=1 (i32.const 0))) - (set_local 0x25d (i64.load offset=0x25d align=1 (i32.const 0))) - (set_local 0x25e (i64.load offset=0x25e align=1 (i32.const 0))) - (set_local 0x25f (i64.load offset=0x25f align=1 (i32.const 0))) - (set_local 0x260 (i64.load offset=0x260 align=1 (i32.const 0))) - (set_local 0x261 (i64.load offset=0x261 align=1 (i32.const 0))) - (set_local 0x262 (i64.load offset=0x262 align=1 (i32.const 0))) - (set_local 0x263 (i64.load offset=0x263 align=1 (i32.const 0))) - (set_local 0x264 (i64.load offset=0x264 align=1 (i32.const 0))) - (set_local 0x265 (i64.load offset=0x265 align=1 (i32.const 0))) - (set_local 0x266 (i64.load offset=0x266 align=1 (i32.const 0))) - (set_local 0x267 (i64.load offset=0x267 align=1 (i32.const 0))) - (set_local 0x268 (i64.load offset=0x268 align=1 (i32.const 0))) - (set_local 0x269 (i64.load offset=0x269 align=1 (i32.const 0))) - (set_local 0x26a (i64.load offset=0x26a align=1 (i32.const 0))) - (set_local 0x26b (i64.load offset=0x26b align=1 (i32.const 0))) - (set_local 0x26c (i64.load offset=0x26c align=1 (i32.const 0))) - (set_local 0x26d (i64.load offset=0x26d align=1 (i32.const 0))) - (set_local 0x26e (i64.load offset=0x26e align=1 (i32.const 0))) - (set_local 0x26f (i64.load offset=0x26f align=1 (i32.const 0))) - (set_local 0x270 (i64.load offset=0x270 align=1 (i32.const 0))) - (set_local 0x271 (i64.load offset=0x271 align=1 (i32.const 0))) - (set_local 0x272 (i64.load offset=0x272 align=1 (i32.const 0))) - (set_local 0x273 (i64.load offset=0x273 align=1 (i32.const 0))) - (set_local 0x274 (i64.load offset=0x274 align=1 (i32.const 0))) - (set_local 0x275 (i64.load offset=0x275 align=1 (i32.const 0))) - (set_local 0x276 (i64.load offset=0x276 align=1 (i32.const 0))) - (set_local 0x277 (i64.load offset=0x277 align=1 (i32.const 0))) - (set_local 0x278 (i64.load offset=0x278 align=1 (i32.const 0))) - (set_local 0x279 (i64.load offset=0x279 align=1 (i32.const 0))) - (set_local 0x27a (i64.load offset=0x27a align=1 (i32.const 0))) - (set_local 0x27b (i64.load offset=0x27b align=1 (i32.const 0))) - (set_local 0x27c (i64.load offset=0x27c align=1 (i32.const 0))) - (set_local 0x27d (i64.load offset=0x27d align=1 (i32.const 0))) - (set_local 0x27e (i64.load offset=0x27e align=1 (i32.const 0))) - (set_local 0x27f (i64.load offset=0x27f align=1 (i32.const 0))) - (set_local 0x280 (i64.load offset=0x280 align=1 (i32.const 0))) - (set_local 0x281 (i64.load offset=0x281 align=1 (i32.const 0))) - (set_local 0x282 (i64.load offset=0x282 align=1 (i32.const 0))) - (set_local 0x283 (i64.load offset=0x283 align=1 (i32.const 0))) - (set_local 0x284 (i64.load offset=0x284 align=1 (i32.const 0))) - (set_local 0x285 (i64.load offset=0x285 align=1 (i32.const 0))) - (set_local 0x286 (i64.load offset=0x286 align=1 (i32.const 0))) - (set_local 0x287 (i64.load offset=0x287 align=1 (i32.const 0))) - (set_local 0x288 (i64.load offset=0x288 align=1 (i32.const 0))) - (set_local 0x289 (i64.load offset=0x289 align=1 (i32.const 0))) - (set_local 0x28a (i64.load offset=0x28a align=1 (i32.const 0))) - (set_local 0x28b (i64.load offset=0x28b align=1 (i32.const 0))) - (set_local 0x28c (i64.load offset=0x28c align=1 (i32.const 0))) - (set_local 0x28d (i64.load offset=0x28d align=1 (i32.const 0))) - (set_local 0x28e (i64.load offset=0x28e align=1 (i32.const 0))) - (set_local 0x28f (i64.load offset=0x28f align=1 (i32.const 0))) - (set_local 0x290 (i64.load offset=0x290 align=1 (i32.const 0))) - (set_local 0x291 (i64.load offset=0x291 align=1 (i32.const 0))) - (set_local 0x292 (i64.load offset=0x292 align=1 (i32.const 0))) - (set_local 0x293 (i64.load offset=0x293 align=1 (i32.const 0))) - (set_local 0x294 (i64.load offset=0x294 align=1 (i32.const 0))) - (set_local 0x295 (i64.load offset=0x295 align=1 (i32.const 0))) - (set_local 0x296 (i64.load offset=0x296 align=1 (i32.const 0))) - (set_local 0x297 (i64.load offset=0x297 align=1 (i32.const 0))) - (set_local 0x298 (i64.load offset=0x298 align=1 (i32.const 0))) - (set_local 0x299 (i64.load offset=0x299 align=1 (i32.const 0))) - (set_local 0x29a (i64.load offset=0x29a align=1 (i32.const 0))) - (set_local 0x29b (i64.load offset=0x29b align=1 (i32.const 0))) - (set_local 0x29c (i64.load offset=0x29c align=1 (i32.const 0))) - (set_local 0x29d (i64.load offset=0x29d align=1 (i32.const 0))) - (set_local 0x29e (i64.load offset=0x29e align=1 (i32.const 0))) - (set_local 0x29f (i64.load offset=0x29f align=1 (i32.const 0))) - (set_local 0x2a0 (i64.load offset=0x2a0 align=1 (i32.const 0))) - (set_local 0x2a1 (i64.load offset=0x2a1 align=1 (i32.const 0))) - (set_local 0x2a2 (i64.load offset=0x2a2 align=1 (i32.const 0))) - (set_local 0x2a3 (i64.load offset=0x2a3 align=1 (i32.const 0))) - (set_local 0x2a4 (i64.load offset=0x2a4 align=1 (i32.const 0))) - (set_local 0x2a5 (i64.load offset=0x2a5 align=1 (i32.const 0))) - (set_local 0x2a6 (i64.load offset=0x2a6 align=1 (i32.const 0))) - (set_local 0x2a7 (i64.load offset=0x2a7 align=1 (i32.const 0))) - (set_local 0x2a8 (i64.load offset=0x2a8 align=1 (i32.const 0))) - (set_local 0x2a9 (i64.load offset=0x2a9 align=1 (i32.const 0))) - (set_local 0x2aa (i64.load offset=0x2aa align=1 (i32.const 0))) - (set_local 0x2ab (i64.load offset=0x2ab align=1 (i32.const 0))) - (set_local 0x2ac (i64.load offset=0x2ac align=1 (i32.const 0))) - (set_local 0x2ad (i64.load offset=0x2ad align=1 (i32.const 0))) - (set_local 0x2ae (i64.load offset=0x2ae align=1 (i32.const 0))) - (set_local 0x2af (i64.load offset=0x2af align=1 (i32.const 0))) - (set_local 0x2b0 (i64.load offset=0x2b0 align=1 (i32.const 0))) - (set_local 0x2b1 (i64.load offset=0x2b1 align=1 (i32.const 0))) - (set_local 0x2b2 (i64.load offset=0x2b2 align=1 (i32.const 0))) - (set_local 0x2b3 (i64.load offset=0x2b3 align=1 (i32.const 0))) - (set_local 0x2b4 (i64.load offset=0x2b4 align=1 (i32.const 0))) - (set_local 0x2b5 (i64.load offset=0x2b5 align=1 (i32.const 0))) - (set_local 0x2b6 (i64.load offset=0x2b6 align=1 (i32.const 0))) - (set_local 0x2b7 (i64.load offset=0x2b7 align=1 (i32.const 0))) - (set_local 0x2b8 (i64.load offset=0x2b8 align=1 (i32.const 0))) - (set_local 0x2b9 (i64.load offset=0x2b9 align=1 (i32.const 0))) - (set_local 0x2ba (i64.load offset=0x2ba align=1 (i32.const 0))) - (set_local 0x2bb (i64.load offset=0x2bb align=1 (i32.const 0))) - (set_local 0x2bc (i64.load offset=0x2bc align=1 (i32.const 0))) - (set_local 0x2bd (i64.load offset=0x2bd align=1 (i32.const 0))) - (set_local 0x2be (i64.load offset=0x2be align=1 (i32.const 0))) - (set_local 0x2bf (i64.load offset=0x2bf align=1 (i32.const 0))) - (set_local 0x2c0 (i64.load offset=0x2c0 align=1 (i32.const 0))) - (set_local 0x2c1 (i64.load offset=0x2c1 align=1 (i32.const 0))) - (set_local 0x2c2 (i64.load offset=0x2c2 align=1 (i32.const 0))) - (set_local 0x2c3 (i64.load offset=0x2c3 align=1 (i32.const 0))) - (set_local 0x2c4 (i64.load offset=0x2c4 align=1 (i32.const 0))) - (set_local 0x2c5 (i64.load offset=0x2c5 align=1 (i32.const 0))) - (set_local 0x2c6 (i64.load offset=0x2c6 align=1 (i32.const 0))) - (set_local 0x2c7 (i64.load offset=0x2c7 align=1 (i32.const 0))) - (set_local 0x2c8 (i64.load offset=0x2c8 align=1 (i32.const 0))) - (set_local 0x2c9 (i64.load offset=0x2c9 align=1 (i32.const 0))) - (set_local 0x2ca (i64.load offset=0x2ca align=1 (i32.const 0))) - (set_local 0x2cb (i64.load offset=0x2cb align=1 (i32.const 0))) - (set_local 0x2cc (i64.load offset=0x2cc align=1 (i32.const 0))) - (set_local 0x2cd (i64.load offset=0x2cd align=1 (i32.const 0))) - (set_local 0x2ce (i64.load offset=0x2ce align=1 (i32.const 0))) - (set_local 0x2cf (i64.load offset=0x2cf align=1 (i32.const 0))) - (set_local 0x2d0 (i64.load offset=0x2d0 align=1 (i32.const 0))) - (set_local 0x2d1 (i64.load offset=0x2d1 align=1 (i32.const 0))) - (set_local 0x2d2 (i64.load offset=0x2d2 align=1 (i32.const 0))) - (set_local 0x2d3 (i64.load offset=0x2d3 align=1 (i32.const 0))) - (set_local 0x2d4 (i64.load offset=0x2d4 align=1 (i32.const 0))) - (set_local 0x2d5 (i64.load offset=0x2d5 align=1 (i32.const 0))) - (set_local 0x2d6 (i64.load offset=0x2d6 align=1 (i32.const 0))) - (set_local 0x2d7 (i64.load offset=0x2d7 align=1 (i32.const 0))) - (set_local 0x2d8 (i64.load offset=0x2d8 align=1 (i32.const 0))) - (set_local 0x2d9 (i64.load offset=0x2d9 align=1 (i32.const 0))) - (set_local 0x2da (i64.load offset=0x2da align=1 (i32.const 0))) - (set_local 0x2db (i64.load offset=0x2db align=1 (i32.const 0))) - (set_local 0x2dc (i64.load offset=0x2dc align=1 (i32.const 0))) - (set_local 0x2dd (i64.load offset=0x2dd align=1 (i32.const 0))) - (set_local 0x2de (i64.load offset=0x2de align=1 (i32.const 0))) - (set_local 0x2df (i64.load offset=0x2df align=1 (i32.const 0))) - (set_local 0x2e0 (i64.load offset=0x2e0 align=1 (i32.const 0))) - (set_local 0x2e1 (i64.load offset=0x2e1 align=1 (i32.const 0))) - (set_local 0x2e2 (i64.load offset=0x2e2 align=1 (i32.const 0))) - (set_local 0x2e3 (i64.load offset=0x2e3 align=1 (i32.const 0))) - (set_local 0x2e4 (i64.load offset=0x2e4 align=1 (i32.const 0))) - (set_local 0x2e5 (i64.load offset=0x2e5 align=1 (i32.const 0))) - (set_local 0x2e6 (i64.load offset=0x2e6 align=1 (i32.const 0))) - (set_local 0x2e7 (i64.load offset=0x2e7 align=1 (i32.const 0))) - (set_local 0x2e8 (i64.load offset=0x2e8 align=1 (i32.const 0))) - (set_local 0x2e9 (i64.load offset=0x2e9 align=1 (i32.const 0))) - (set_local 0x2ea (i64.load offset=0x2ea align=1 (i32.const 0))) - (set_local 0x2eb (i64.load offset=0x2eb align=1 (i32.const 0))) - (set_local 0x2ec (i64.load offset=0x2ec align=1 (i32.const 0))) - (set_local 0x2ed (i64.load offset=0x2ed align=1 (i32.const 0))) - (set_local 0x2ee (i64.load offset=0x2ee align=1 (i32.const 0))) - (set_local 0x2ef (i64.load offset=0x2ef align=1 (i32.const 0))) - (set_local 0x2f0 (i64.load offset=0x2f0 align=1 (i32.const 0))) - (set_local 0x2f1 (i64.load offset=0x2f1 align=1 (i32.const 0))) - (set_local 0x2f2 (i64.load offset=0x2f2 align=1 (i32.const 0))) - (set_local 0x2f3 (i64.load offset=0x2f3 align=1 (i32.const 0))) - (set_local 0x2f4 (i64.load offset=0x2f4 align=1 (i32.const 0))) - (set_local 0x2f5 (i64.load offset=0x2f5 align=1 (i32.const 0))) - (set_local 0x2f6 (i64.load offset=0x2f6 align=1 (i32.const 0))) - (set_local 0x2f7 (i64.load offset=0x2f7 align=1 (i32.const 0))) - (set_local 0x2f8 (i64.load offset=0x2f8 align=1 (i32.const 0))) - (set_local 0x2f9 (i64.load offset=0x2f9 align=1 (i32.const 0))) - (set_local 0x2fa (i64.load offset=0x2fa align=1 (i32.const 0))) - (set_local 0x2fb (i64.load offset=0x2fb align=1 (i32.const 0))) - (set_local 0x2fc (i64.load offset=0x2fc align=1 (i32.const 0))) - (set_local 0x2fd (i64.load offset=0x2fd align=1 (i32.const 0))) - (set_local 0x2fe (i64.load offset=0x2fe align=1 (i32.const 0))) - (set_local 0x2ff (i64.load offset=0x2ff align=1 (i32.const 0))) - (set_local 0x300 (i64.load offset=0x300 align=1 (i32.const 0))) - (set_local 0x301 (i64.load offset=0x301 align=1 (i32.const 0))) - (set_local 0x302 (i64.load offset=0x302 align=1 (i32.const 0))) - (set_local 0x303 (i64.load offset=0x303 align=1 (i32.const 0))) - (set_local 0x304 (i64.load offset=0x304 align=1 (i32.const 0))) - (set_local 0x305 (i64.load offset=0x305 align=1 (i32.const 0))) - (set_local 0x306 (i64.load offset=0x306 align=1 (i32.const 0))) - (set_local 0x307 (i64.load offset=0x307 align=1 (i32.const 0))) - (set_local 0x308 (i64.load offset=0x308 align=1 (i32.const 0))) - (set_local 0x309 (i64.load offset=0x309 align=1 (i32.const 0))) - (set_local 0x30a (i64.load offset=0x30a align=1 (i32.const 0))) - (set_local 0x30b (i64.load offset=0x30b align=1 (i32.const 0))) - (set_local 0x30c (i64.load offset=0x30c align=1 (i32.const 0))) - (set_local 0x30d (i64.load offset=0x30d align=1 (i32.const 0))) - (set_local 0x30e (i64.load offset=0x30e align=1 (i32.const 0))) - (set_local 0x30f (i64.load offset=0x30f align=1 (i32.const 0))) - (set_local 0x310 (i64.load offset=0x310 align=1 (i32.const 0))) - (set_local 0x311 (i64.load offset=0x311 align=1 (i32.const 0))) - (set_local 0x312 (i64.load offset=0x312 align=1 (i32.const 0))) - (set_local 0x313 (i64.load offset=0x313 align=1 (i32.const 0))) - (set_local 0x314 (i64.load offset=0x314 align=1 (i32.const 0))) - (set_local 0x315 (i64.load offset=0x315 align=1 (i32.const 0))) - (set_local 0x316 (i64.load offset=0x316 align=1 (i32.const 0))) - (set_local 0x317 (i64.load offset=0x317 align=1 (i32.const 0))) - (set_local 0x318 (i64.load offset=0x318 align=1 (i32.const 0))) - (set_local 0x319 (i64.load offset=0x319 align=1 (i32.const 0))) - (set_local 0x31a (i64.load offset=0x31a align=1 (i32.const 0))) - (set_local 0x31b (i64.load offset=0x31b align=1 (i32.const 0))) - (set_local 0x31c (i64.load offset=0x31c align=1 (i32.const 0))) - (set_local 0x31d (i64.load offset=0x31d align=1 (i32.const 0))) - (set_local 0x31e (i64.load offset=0x31e align=1 (i32.const 0))) - (set_local 0x31f (i64.load offset=0x31f align=1 (i32.const 0))) - (set_local 0x320 (i64.load offset=0x320 align=1 (i32.const 0))) - (set_local 0x321 (i64.load offset=0x321 align=1 (i32.const 0))) - (set_local 0x322 (i64.load offset=0x322 align=1 (i32.const 0))) - (set_local 0x323 (i64.load offset=0x323 align=1 (i32.const 0))) - (set_local 0x324 (i64.load offset=0x324 align=1 (i32.const 0))) - (set_local 0x325 (i64.load offset=0x325 align=1 (i32.const 0))) - (set_local 0x326 (i64.load offset=0x326 align=1 (i32.const 0))) - (set_local 0x327 (i64.load offset=0x327 align=1 (i32.const 0))) - (set_local 0x328 (i64.load offset=0x328 align=1 (i32.const 0))) - (set_local 0x329 (i64.load offset=0x329 align=1 (i32.const 0))) - (set_local 0x32a (i64.load offset=0x32a align=1 (i32.const 0))) - (set_local 0x32b (i64.load offset=0x32b align=1 (i32.const 0))) - (set_local 0x32c (i64.load offset=0x32c align=1 (i32.const 0))) - (set_local 0x32d (i64.load offset=0x32d align=1 (i32.const 0))) - (set_local 0x32e (i64.load offset=0x32e align=1 (i32.const 0))) - (set_local 0x32f (i64.load offset=0x32f align=1 (i32.const 0))) - (set_local 0x330 (i64.load offset=0x330 align=1 (i32.const 0))) - (set_local 0x331 (i64.load offset=0x331 align=1 (i32.const 0))) - (set_local 0x332 (i64.load offset=0x332 align=1 (i32.const 0))) - (set_local 0x333 (i64.load offset=0x333 align=1 (i32.const 0))) - (set_local 0x334 (i64.load offset=0x334 align=1 (i32.const 0))) - (set_local 0x335 (i64.load offset=0x335 align=1 (i32.const 0))) - (set_local 0x336 (i64.load offset=0x336 align=1 (i32.const 0))) - (set_local 0x337 (i64.load offset=0x337 align=1 (i32.const 0))) - (set_local 0x338 (i64.load offset=0x338 align=1 (i32.const 0))) - (set_local 0x339 (i64.load offset=0x339 align=1 (i32.const 0))) - (set_local 0x33a (i64.load offset=0x33a align=1 (i32.const 0))) - (set_local 0x33b (i64.load offset=0x33b align=1 (i32.const 0))) - (set_local 0x33c (i64.load offset=0x33c align=1 (i32.const 0))) - (set_local 0x33d (i64.load offset=0x33d align=1 (i32.const 0))) - (set_local 0x33e (i64.load offset=0x33e align=1 (i32.const 0))) - (set_local 0x33f (i64.load offset=0x33f align=1 (i32.const 0))) - (set_local 0x340 (i64.load offset=0x340 align=1 (i32.const 0))) - (set_local 0x341 (i64.load offset=0x341 align=1 (i32.const 0))) - (set_local 0x342 (i64.load offset=0x342 align=1 (i32.const 0))) - (set_local 0x343 (i64.load offset=0x343 align=1 (i32.const 0))) - (set_local 0x344 (i64.load offset=0x344 align=1 (i32.const 0))) - (set_local 0x345 (i64.load offset=0x345 align=1 (i32.const 0))) - (set_local 0x346 (i64.load offset=0x346 align=1 (i32.const 0))) - (set_local 0x347 (i64.load offset=0x347 align=1 (i32.const 0))) - (set_local 0x348 (i64.load offset=0x348 align=1 (i32.const 0))) - (set_local 0x349 (i64.load offset=0x349 align=1 (i32.const 0))) - (set_local 0x34a (i64.load offset=0x34a align=1 (i32.const 0))) - (set_local 0x34b (i64.load offset=0x34b align=1 (i32.const 0))) - (set_local 0x34c (i64.load offset=0x34c align=1 (i32.const 0))) - (set_local 0x34d (i64.load offset=0x34d align=1 (i32.const 0))) - (set_local 0x34e (i64.load offset=0x34e align=1 (i32.const 0))) - (set_local 0x34f (i64.load offset=0x34f align=1 (i32.const 0))) - (set_local 0x350 (i64.load offset=0x350 align=1 (i32.const 0))) - (set_local 0x351 (i64.load offset=0x351 align=1 (i32.const 0))) - (set_local 0x352 (i64.load offset=0x352 align=1 (i32.const 0))) - (set_local 0x353 (i64.load offset=0x353 align=1 (i32.const 0))) - (set_local 0x354 (i64.load offset=0x354 align=1 (i32.const 0))) - (set_local 0x355 (i64.load offset=0x355 align=1 (i32.const 0))) - (set_local 0x356 (i64.load offset=0x356 align=1 (i32.const 0))) - (set_local 0x357 (i64.load offset=0x357 align=1 (i32.const 0))) - (set_local 0x358 (i64.load offset=0x358 align=1 (i32.const 0))) - (set_local 0x359 (i64.load offset=0x359 align=1 (i32.const 0))) - (set_local 0x35a (i64.load offset=0x35a align=1 (i32.const 0))) - (set_local 0x35b (i64.load offset=0x35b align=1 (i32.const 0))) - (set_local 0x35c (i64.load offset=0x35c align=1 (i32.const 0))) - (set_local 0x35d (i64.load offset=0x35d align=1 (i32.const 0))) - (set_local 0x35e (i64.load offset=0x35e align=1 (i32.const 0))) - (set_local 0x35f (i64.load offset=0x35f align=1 (i32.const 0))) - (set_local 0x360 (i64.load offset=0x360 align=1 (i32.const 0))) - (set_local 0x361 (i64.load offset=0x361 align=1 (i32.const 0))) - (set_local 0x362 (i64.load offset=0x362 align=1 (i32.const 0))) - (set_local 0x363 (i64.load offset=0x363 align=1 (i32.const 0))) - (set_local 0x364 (i64.load offset=0x364 align=1 (i32.const 0))) - (set_local 0x365 (i64.load offset=0x365 align=1 (i32.const 0))) - (set_local 0x366 (i64.load offset=0x366 align=1 (i32.const 0))) - (set_local 0x367 (i64.load offset=0x367 align=1 (i32.const 0))) - (set_local 0x368 (i64.load offset=0x368 align=1 (i32.const 0))) - (set_local 0x369 (i64.load offset=0x369 align=1 (i32.const 0))) - (set_local 0x36a (i64.load offset=0x36a align=1 (i32.const 0))) - (set_local 0x36b (i64.load offset=0x36b align=1 (i32.const 0))) - (set_local 0x36c (i64.load offset=0x36c align=1 (i32.const 0))) - (set_local 0x36d (i64.load offset=0x36d align=1 (i32.const 0))) - (set_local 0x36e (i64.load offset=0x36e align=1 (i32.const 0))) - (set_local 0x36f (i64.load offset=0x36f align=1 (i32.const 0))) - (set_local 0x370 (i64.load offset=0x370 align=1 (i32.const 0))) - (set_local 0x371 (i64.load offset=0x371 align=1 (i32.const 0))) - (set_local 0x372 (i64.load offset=0x372 align=1 (i32.const 0))) - (set_local 0x373 (i64.load offset=0x373 align=1 (i32.const 0))) - (set_local 0x374 (i64.load offset=0x374 align=1 (i32.const 0))) - (set_local 0x375 (i64.load offset=0x375 align=1 (i32.const 0))) - (set_local 0x376 (i64.load offset=0x376 align=1 (i32.const 0))) - (set_local 0x377 (i64.load offset=0x377 align=1 (i32.const 0))) - (set_local 0x378 (i64.load offset=0x378 align=1 (i32.const 0))) - (set_local 0x379 (i64.load offset=0x379 align=1 (i32.const 0))) - (set_local 0x37a (i64.load offset=0x37a align=1 (i32.const 0))) - (set_local 0x37b (i64.load offset=0x37b align=1 (i32.const 0))) - (set_local 0x37c (i64.load offset=0x37c align=1 (i32.const 0))) - (set_local 0x37d (i64.load offset=0x37d align=1 (i32.const 0))) - (set_local 0x37e (i64.load offset=0x37e align=1 (i32.const 0))) - (set_local 0x37f (i64.load offset=0x37f align=1 (i32.const 0))) - (set_local 0x380 (i64.load offset=0x380 align=1 (i32.const 0))) - (set_local 0x381 (i64.load offset=0x381 align=1 (i32.const 0))) - (set_local 0x382 (i64.load offset=0x382 align=1 (i32.const 0))) - (set_local 0x383 (i64.load offset=0x383 align=1 (i32.const 0))) - (set_local 0x384 (i64.load offset=0x384 align=1 (i32.const 0))) - (set_local 0x385 (i64.load offset=0x385 align=1 (i32.const 0))) - (set_local 0x386 (i64.load offset=0x386 align=1 (i32.const 0))) - (set_local 0x387 (i64.load offset=0x387 align=1 (i32.const 0))) - (set_local 0x388 (i64.load offset=0x388 align=1 (i32.const 0))) - (set_local 0x389 (i64.load offset=0x389 align=1 (i32.const 0))) - (set_local 0x38a (i64.load offset=0x38a align=1 (i32.const 0))) - (set_local 0x38b (i64.load offset=0x38b align=1 (i32.const 0))) - (set_local 0x38c (i64.load offset=0x38c align=1 (i32.const 0))) - (set_local 0x38d (i64.load offset=0x38d align=1 (i32.const 0))) - (set_local 0x38e (i64.load offset=0x38e align=1 (i32.const 0))) - (set_local 0x38f (i64.load offset=0x38f align=1 (i32.const 0))) - (set_local 0x390 (i64.load offset=0x390 align=1 (i32.const 0))) - (set_local 0x391 (i64.load offset=0x391 align=1 (i32.const 0))) - (set_local 0x392 (i64.load offset=0x392 align=1 (i32.const 0))) - (set_local 0x393 (i64.load offset=0x393 align=1 (i32.const 0))) - (set_local 0x394 (i64.load offset=0x394 align=1 (i32.const 0))) - (set_local 0x395 (i64.load offset=0x395 align=1 (i32.const 0))) - (set_local 0x396 (i64.load offset=0x396 align=1 (i32.const 0))) - (set_local 0x397 (i64.load offset=0x397 align=1 (i32.const 0))) - (set_local 0x398 (i64.load offset=0x398 align=1 (i32.const 0))) - (set_local 0x399 (i64.load offset=0x399 align=1 (i32.const 0))) - (set_local 0x39a (i64.load offset=0x39a align=1 (i32.const 0))) - (set_local 0x39b (i64.load offset=0x39b align=1 (i32.const 0))) - (set_local 0x39c (i64.load offset=0x39c align=1 (i32.const 0))) - (set_local 0x39d (i64.load offset=0x39d align=1 (i32.const 0))) - (set_local 0x39e (i64.load offset=0x39e align=1 (i32.const 0))) - (set_local 0x39f (i64.load offset=0x39f align=1 (i32.const 0))) - (set_local 0x3a0 (i64.load offset=0x3a0 align=1 (i32.const 0))) - (set_local 0x3a1 (i64.load offset=0x3a1 align=1 (i32.const 0))) - (set_local 0x3a2 (i64.load offset=0x3a2 align=1 (i32.const 0))) - (set_local 0x3a3 (i64.load offset=0x3a3 align=1 (i32.const 0))) - (set_local 0x3a4 (i64.load offset=0x3a4 align=1 (i32.const 0))) - (set_local 0x3a5 (i64.load offset=0x3a5 align=1 (i32.const 0))) - (set_local 0x3a6 (i64.load offset=0x3a6 align=1 (i32.const 0))) - (set_local 0x3a7 (i64.load offset=0x3a7 align=1 (i32.const 0))) - (set_local 0x3a8 (i64.load offset=0x3a8 align=1 (i32.const 0))) - (set_local 0x3a9 (i64.load offset=0x3a9 align=1 (i32.const 0))) - (set_local 0x3aa (i64.load offset=0x3aa align=1 (i32.const 0))) - (set_local 0x3ab (i64.load offset=0x3ab align=1 (i32.const 0))) - (set_local 0x3ac (i64.load offset=0x3ac align=1 (i32.const 0))) - (set_local 0x3ad (i64.load offset=0x3ad align=1 (i32.const 0))) - (set_local 0x3ae (i64.load offset=0x3ae align=1 (i32.const 0))) - (set_local 0x3af (i64.load offset=0x3af align=1 (i32.const 0))) - (set_local 0x3b0 (i64.load offset=0x3b0 align=1 (i32.const 0))) - (set_local 0x3b1 (i64.load offset=0x3b1 align=1 (i32.const 0))) - (set_local 0x3b2 (i64.load offset=0x3b2 align=1 (i32.const 0))) - (set_local 0x3b3 (i64.load offset=0x3b3 align=1 (i32.const 0))) - (set_local 0x3b4 (i64.load offset=0x3b4 align=1 (i32.const 0))) - (set_local 0x3b5 (i64.load offset=0x3b5 align=1 (i32.const 0))) - (set_local 0x3b6 (i64.load offset=0x3b6 align=1 (i32.const 0))) - (set_local 0x3b7 (i64.load offset=0x3b7 align=1 (i32.const 0))) - (set_local 0x3b8 (i64.load offset=0x3b8 align=1 (i32.const 0))) - (set_local 0x3b9 (i64.load offset=0x3b9 align=1 (i32.const 0))) - (set_local 0x3ba (i64.load offset=0x3ba align=1 (i32.const 0))) - (set_local 0x3bb (i64.load offset=0x3bb align=1 (i32.const 0))) - (set_local 0x3bc (i64.load offset=0x3bc align=1 (i32.const 0))) - (set_local 0x3bd (i64.load offset=0x3bd align=1 (i32.const 0))) - (set_local 0x3be (i64.load offset=0x3be align=1 (i32.const 0))) - (set_local 0x3bf (i64.load offset=0x3bf align=1 (i32.const 0))) - (set_local 0x3c0 (i64.load offset=0x3c0 align=1 (i32.const 0))) - (set_local 0x3c1 (i64.load offset=0x3c1 align=1 (i32.const 0))) - (set_local 0x3c2 (i64.load offset=0x3c2 align=1 (i32.const 0))) - (set_local 0x3c3 (i64.load offset=0x3c3 align=1 (i32.const 0))) - (set_local 0x3c4 (i64.load offset=0x3c4 align=1 (i32.const 0))) - (set_local 0x3c5 (i64.load offset=0x3c5 align=1 (i32.const 0))) - (set_local 0x3c6 (i64.load offset=0x3c6 align=1 (i32.const 0))) - (set_local 0x3c7 (i64.load offset=0x3c7 align=1 (i32.const 0))) - (set_local 0x3c8 (i64.load offset=0x3c8 align=1 (i32.const 0))) - (set_local 0x3c9 (i64.load offset=0x3c9 align=1 (i32.const 0))) - (set_local 0x3ca (i64.load offset=0x3ca align=1 (i32.const 0))) - (set_local 0x3cb (i64.load offset=0x3cb align=1 (i32.const 0))) - (set_local 0x3cc (i64.load offset=0x3cc align=1 (i32.const 0))) - (set_local 0x3cd (i64.load offset=0x3cd align=1 (i32.const 0))) - (set_local 0x3ce (i64.load offset=0x3ce align=1 (i32.const 0))) - (set_local 0x3cf (i64.load offset=0x3cf align=1 (i32.const 0))) - (set_local 0x3d0 (i64.load offset=0x3d0 align=1 (i32.const 0))) - (set_local 0x3d1 (i64.load offset=0x3d1 align=1 (i32.const 0))) - (set_local 0x3d2 (i64.load offset=0x3d2 align=1 (i32.const 0))) - (set_local 0x3d3 (i64.load offset=0x3d3 align=1 (i32.const 0))) - (set_local 0x3d4 (i64.load offset=0x3d4 align=1 (i32.const 0))) - (set_local 0x3d5 (i64.load offset=0x3d5 align=1 (i32.const 0))) - (set_local 0x3d6 (i64.load offset=0x3d6 align=1 (i32.const 0))) - (set_local 0x3d7 (i64.load offset=0x3d7 align=1 (i32.const 0))) - (set_local 0x3d8 (i64.load offset=0x3d8 align=1 (i32.const 0))) - (set_local 0x3d9 (i64.load offset=0x3d9 align=1 (i32.const 0))) - (set_local 0x3da (i64.load offset=0x3da align=1 (i32.const 0))) - (set_local 0x3db (i64.load offset=0x3db align=1 (i32.const 0))) - (set_local 0x3dc (i64.load offset=0x3dc align=1 (i32.const 0))) - (set_local 0x3dd (i64.load offset=0x3dd align=1 (i32.const 0))) - (set_local 0x3de (i64.load offset=0x3de align=1 (i32.const 0))) - (set_local 0x3df (i64.load offset=0x3df align=1 (i32.const 0))) - (set_local 0x3e0 (i64.load offset=0x3e0 align=1 (i32.const 0))) - (set_local 0x3e1 (i64.load offset=0x3e1 align=1 (i32.const 0))) - (set_local 0x3e2 (i64.load offset=0x3e2 align=1 (i32.const 0))) - (set_local 0x3e3 (i64.load offset=0x3e3 align=1 (i32.const 0))) - (set_local 0x3e4 (i64.load offset=0x3e4 align=1 (i32.const 0))) - (set_local 0x3e5 (i64.load offset=0x3e5 align=1 (i32.const 0))) - (set_local 0x3e6 (i64.load offset=0x3e6 align=1 (i32.const 0))) - (set_local 0x3e7 (i64.load offset=0x3e7 align=1 (i32.const 0))) - (set_local 0x3e8 (i64.load offset=0x3e8 align=1 (i32.const 0))) - (set_local 0x3e9 (i64.load offset=0x3e9 align=1 (i32.const 0))) - (set_local 0x3ea (i64.load offset=0x3ea align=1 (i32.const 0))) - (set_local 0x3eb (i64.load offset=0x3eb align=1 (i32.const 0))) - (set_local 0x3ec (i64.load offset=0x3ec align=1 (i32.const 0))) - (set_local 0x3ed (i64.load offset=0x3ed align=1 (i32.const 0))) - (set_local 0x3ee (i64.load offset=0x3ee align=1 (i32.const 0))) - (set_local 0x3ef (i64.load offset=0x3ef align=1 (i32.const 0))) - (set_local 0x3f0 (i64.load offset=0x3f0 align=1 (i32.const 0))) - (set_local 0x3f1 (i64.load offset=0x3f1 align=1 (i32.const 0))) - (set_local 0x3f2 (i64.load offset=0x3f2 align=1 (i32.const 0))) - (set_local 0x3f3 (i64.load offset=0x3f3 align=1 (i32.const 0))) - (set_local 0x3f4 (i64.load offset=0x3f4 align=1 (i32.const 0))) - (set_local 0x3f5 (i64.load offset=0x3f5 align=1 (i32.const 0))) - (set_local 0x3f6 (i64.load offset=0x3f6 align=1 (i32.const 0))) - (set_local 0x3f7 (i64.load offset=0x3f7 align=1 (i32.const 0))) - (set_local 0x3f8 (i64.load offset=0x3f8 align=1 (i32.const 0))) - (set_local 0x3f9 (i64.load offset=0x3f9 align=1 (i32.const 0))) - (set_local 0x3fa (i64.load offset=0x3fa align=1 (i32.const 0))) - (set_local 0x3fb (i64.load offset=0x3fb align=1 (i32.const 0))) - (set_local 0x3fc (i64.load offset=0x3fc align=1 (i32.const 0))) - (set_local 0x3fd (i64.load offset=0x3fd align=1 (i32.const 0))) - (set_local 0x3fe (i64.load offset=0x3fe align=1 (i32.const 0))) - (set_local 0x3ff (i64.load offset=0x3ff align=1 (i32.const 0))) - (set_local 0x400 (i64.load offset=0x400 align=1 (i32.const 0))) - (set_local 0x401 (i64.load offset=0x401 align=1 (i32.const 0))) - (set_local 0x402 (i64.load offset=0x402 align=1 (i32.const 0))) - (set_local 0x403 (i64.load offset=0x403 align=1 (i32.const 0))) - (set_local 0x404 (i64.load offset=0x404 align=1 (i32.const 0))) - (set_local 0x405 (i64.load offset=0x405 align=1 (i32.const 0))) - (set_local 0x406 (i64.load offset=0x406 align=1 (i32.const 0))) - (set_local 0x407 (i64.load offset=0x407 align=1 (i32.const 0))) - (set_local 0x408 (i64.load offset=0x408 align=1 (i32.const 0))) - (set_local 0x409 (i64.load offset=0x409 align=1 (i32.const 0))) - (set_local 0x40a (i64.load offset=0x40a align=1 (i32.const 0))) - (set_local 0x40b (i64.load offset=0x40b align=1 (i32.const 0))) - (set_local 0x40c (i64.load offset=0x40c align=1 (i32.const 0))) - (set_local 0x40d (i64.load offset=0x40d align=1 (i32.const 0))) - (set_local 0x40e (i64.load offset=0x40e align=1 (i32.const 0))) - (set_local 0x40f (i64.load offset=0x40f align=1 (i32.const 0))) - (set_local 0x410 (i64.load offset=0x410 align=1 (i32.const 0))) - (set_local 0x411 (i64.load offset=0x411 align=1 (i32.const 0))) - (set_local 0x412 (i64.load offset=0x412 align=1 (i32.const 0))) - (set_local 0x413 (i64.load offset=0x413 align=1 (i32.const 0))) - (set_local 0x414 (i64.load offset=0x414 align=1 (i32.const 0))) - (set_local 0x415 (i64.load offset=0x415 align=1 (i32.const 0))) - (set_local 0x416 (i64.load offset=0x416 align=1 (i32.const 0))) - (set_local 0x417 (i64.load offset=0x417 align=1 (i32.const 0))) - (set_local 0x418 (i64.load offset=0x418 align=1 (i32.const 0))) - (set_local 0x419 (i64.load offset=0x419 align=1 (i32.const 0))) - (set_local 0x41a (i64.load offset=0x41a align=1 (i32.const 0))) - (set_local 0x41b (i64.load offset=0x41b align=1 (i32.const 0))) - (set_local 0x41c (i64.load offset=0x41c align=1 (i32.const 0))) - (set_local 0x41d (i64.load offset=0x41d align=1 (i32.const 0))) - (set_local 0x41e (i64.load offset=0x41e align=1 (i32.const 0))) - (set_local 0x41f (i64.load offset=0x41f align=1 (i32.const 0))) + (local.set 0x000 (i64.load offset=0x000 align=1 (i32.const 0))) + (local.set 0x001 (i64.load offset=0x001 align=1 (i32.const 0))) + (local.set 0x002 (i64.load offset=0x002 align=1 (i32.const 0))) + (local.set 0x003 (i64.load offset=0x003 align=1 (i32.const 0))) + (local.set 0x004 (i64.load offset=0x004 align=1 (i32.const 0))) + (local.set 0x005 (i64.load offset=0x005 align=1 (i32.const 0))) + (local.set 0x006 (i64.load offset=0x006 align=1 (i32.const 0))) + (local.set 0x007 (i64.load offset=0x007 align=1 (i32.const 0))) + (local.set 0x008 (i64.load offset=0x008 align=1 (i32.const 0))) + (local.set 0x009 (i64.load offset=0x009 align=1 (i32.const 0))) + (local.set 0x00a (i64.load offset=0x00a align=1 (i32.const 0))) + (local.set 0x00b (i64.load offset=0x00b align=1 (i32.const 0))) + (local.set 0x00c (i64.load offset=0x00c align=1 (i32.const 0))) + (local.set 0x00d (i64.load offset=0x00d align=1 (i32.const 0))) + (local.set 0x00e (i64.load offset=0x00e align=1 (i32.const 0))) + (local.set 0x00f (i64.load offset=0x00f align=1 (i32.const 0))) + (local.set 0x010 (i64.load offset=0x010 align=1 (i32.const 0))) + (local.set 0x011 (i64.load offset=0x011 align=1 (i32.const 0))) + (local.set 0x012 (i64.load offset=0x012 align=1 (i32.const 0))) + (local.set 0x013 (i64.load offset=0x013 align=1 (i32.const 0))) + (local.set 0x014 (i64.load offset=0x014 align=1 (i32.const 0))) + (local.set 0x015 (i64.load offset=0x015 align=1 (i32.const 0))) + (local.set 0x016 (i64.load offset=0x016 align=1 (i32.const 0))) + (local.set 0x017 (i64.load offset=0x017 align=1 (i32.const 0))) + (local.set 0x018 (i64.load offset=0x018 align=1 (i32.const 0))) + (local.set 0x019 (i64.load offset=0x019 align=1 (i32.const 0))) + (local.set 0x01a (i64.load offset=0x01a align=1 (i32.const 0))) + (local.set 0x01b (i64.load offset=0x01b align=1 (i32.const 0))) + (local.set 0x01c (i64.load offset=0x01c align=1 (i32.const 0))) + (local.set 0x01d (i64.load offset=0x01d align=1 (i32.const 0))) + (local.set 0x01e (i64.load offset=0x01e align=1 (i32.const 0))) + (local.set 0x01f (i64.load offset=0x01f align=1 (i32.const 0))) + (local.set 0x020 (i64.load offset=0x020 align=1 (i32.const 0))) + (local.set 0x021 (i64.load offset=0x021 align=1 (i32.const 0))) + (local.set 0x022 (i64.load offset=0x022 align=1 (i32.const 0))) + (local.set 0x023 (i64.load offset=0x023 align=1 (i32.const 0))) + (local.set 0x024 (i64.load offset=0x024 align=1 (i32.const 0))) + (local.set 0x025 (i64.load offset=0x025 align=1 (i32.const 0))) + (local.set 0x026 (i64.load offset=0x026 align=1 (i32.const 0))) + (local.set 0x027 (i64.load offset=0x027 align=1 (i32.const 0))) + (local.set 0x028 (i64.load offset=0x028 align=1 (i32.const 0))) + (local.set 0x029 (i64.load offset=0x029 align=1 (i32.const 0))) + (local.set 0x02a (i64.load offset=0x02a align=1 (i32.const 0))) + (local.set 0x02b (i64.load offset=0x02b align=1 (i32.const 0))) + (local.set 0x02c (i64.load offset=0x02c align=1 (i32.const 0))) + (local.set 0x02d (i64.load offset=0x02d align=1 (i32.const 0))) + (local.set 0x02e (i64.load offset=0x02e align=1 (i32.const 0))) + (local.set 0x02f (i64.load offset=0x02f align=1 (i32.const 0))) + (local.set 0x030 (i64.load offset=0x030 align=1 (i32.const 0))) + (local.set 0x031 (i64.load offset=0x031 align=1 (i32.const 0))) + (local.set 0x032 (i64.load offset=0x032 align=1 (i32.const 0))) + (local.set 0x033 (i64.load offset=0x033 align=1 (i32.const 0))) + (local.set 0x034 (i64.load offset=0x034 align=1 (i32.const 0))) + (local.set 0x035 (i64.load offset=0x035 align=1 (i32.const 0))) + (local.set 0x036 (i64.load offset=0x036 align=1 (i32.const 0))) + (local.set 0x037 (i64.load offset=0x037 align=1 (i32.const 0))) + (local.set 0x038 (i64.load offset=0x038 align=1 (i32.const 0))) + (local.set 0x039 (i64.load offset=0x039 align=1 (i32.const 0))) + (local.set 0x03a (i64.load offset=0x03a align=1 (i32.const 0))) + (local.set 0x03b (i64.load offset=0x03b align=1 (i32.const 0))) + (local.set 0x03c (i64.load offset=0x03c align=1 (i32.const 0))) + (local.set 0x03d (i64.load offset=0x03d align=1 (i32.const 0))) + (local.set 0x03e (i64.load offset=0x03e align=1 (i32.const 0))) + (local.set 0x03f (i64.load offset=0x03f align=1 (i32.const 0))) + (local.set 0x040 (i64.load offset=0x040 align=1 (i32.const 0))) + (local.set 0x041 (i64.load offset=0x041 align=1 (i32.const 0))) + (local.set 0x042 (i64.load offset=0x042 align=1 (i32.const 0))) + (local.set 0x043 (i64.load offset=0x043 align=1 (i32.const 0))) + (local.set 0x044 (i64.load offset=0x044 align=1 (i32.const 0))) + (local.set 0x045 (i64.load offset=0x045 align=1 (i32.const 0))) + (local.set 0x046 (i64.load offset=0x046 align=1 (i32.const 0))) + (local.set 0x047 (i64.load offset=0x047 align=1 (i32.const 0))) + (local.set 0x048 (i64.load offset=0x048 align=1 (i32.const 0))) + (local.set 0x049 (i64.load offset=0x049 align=1 (i32.const 0))) + (local.set 0x04a (i64.load offset=0x04a align=1 (i32.const 0))) + (local.set 0x04b (i64.load offset=0x04b align=1 (i32.const 0))) + (local.set 0x04c (i64.load offset=0x04c align=1 (i32.const 0))) + (local.set 0x04d (i64.load offset=0x04d align=1 (i32.const 0))) + (local.set 0x04e (i64.load offset=0x04e align=1 (i32.const 0))) + (local.set 0x04f (i64.load offset=0x04f align=1 (i32.const 0))) + (local.set 0x050 (i64.load offset=0x050 align=1 (i32.const 0))) + (local.set 0x051 (i64.load offset=0x051 align=1 (i32.const 0))) + (local.set 0x052 (i64.load offset=0x052 align=1 (i32.const 0))) + (local.set 0x053 (i64.load offset=0x053 align=1 (i32.const 0))) + (local.set 0x054 (i64.load offset=0x054 align=1 (i32.const 0))) + (local.set 0x055 (i64.load offset=0x055 align=1 (i32.const 0))) + (local.set 0x056 (i64.load offset=0x056 align=1 (i32.const 0))) + (local.set 0x057 (i64.load offset=0x057 align=1 (i32.const 0))) + (local.set 0x058 (i64.load offset=0x058 align=1 (i32.const 0))) + (local.set 0x059 (i64.load offset=0x059 align=1 (i32.const 0))) + (local.set 0x05a (i64.load offset=0x05a align=1 (i32.const 0))) + (local.set 0x05b (i64.load offset=0x05b align=1 (i32.const 0))) + (local.set 0x05c (i64.load offset=0x05c align=1 (i32.const 0))) + (local.set 0x05d (i64.load offset=0x05d align=1 (i32.const 0))) + (local.set 0x05e (i64.load offset=0x05e align=1 (i32.const 0))) + (local.set 0x05f (i64.load offset=0x05f align=1 (i32.const 0))) + (local.set 0x060 (i64.load offset=0x060 align=1 (i32.const 0))) + (local.set 0x061 (i64.load offset=0x061 align=1 (i32.const 0))) + (local.set 0x062 (i64.load offset=0x062 align=1 (i32.const 0))) + (local.set 0x063 (i64.load offset=0x063 align=1 (i32.const 0))) + (local.set 0x064 (i64.load offset=0x064 align=1 (i32.const 0))) + (local.set 0x065 (i64.load offset=0x065 align=1 (i32.const 0))) + (local.set 0x066 (i64.load offset=0x066 align=1 (i32.const 0))) + (local.set 0x067 (i64.load offset=0x067 align=1 (i32.const 0))) + (local.set 0x068 (i64.load offset=0x068 align=1 (i32.const 0))) + (local.set 0x069 (i64.load offset=0x069 align=1 (i32.const 0))) + (local.set 0x06a (i64.load offset=0x06a align=1 (i32.const 0))) + (local.set 0x06b (i64.load offset=0x06b align=1 (i32.const 0))) + (local.set 0x06c (i64.load offset=0x06c align=1 (i32.const 0))) + (local.set 0x06d (i64.load offset=0x06d align=1 (i32.const 0))) + (local.set 0x06e (i64.load offset=0x06e align=1 (i32.const 0))) + (local.set 0x06f (i64.load offset=0x06f align=1 (i32.const 0))) + (local.set 0x070 (i64.load offset=0x070 align=1 (i32.const 0))) + (local.set 0x071 (i64.load offset=0x071 align=1 (i32.const 0))) + (local.set 0x072 (i64.load offset=0x072 align=1 (i32.const 0))) + (local.set 0x073 (i64.load offset=0x073 align=1 (i32.const 0))) + (local.set 0x074 (i64.load offset=0x074 align=1 (i32.const 0))) + (local.set 0x075 (i64.load offset=0x075 align=1 (i32.const 0))) + (local.set 0x076 (i64.load offset=0x076 align=1 (i32.const 0))) + (local.set 0x077 (i64.load offset=0x077 align=1 (i32.const 0))) + (local.set 0x078 (i64.load offset=0x078 align=1 (i32.const 0))) + (local.set 0x079 (i64.load offset=0x079 align=1 (i32.const 0))) + (local.set 0x07a (i64.load offset=0x07a align=1 (i32.const 0))) + (local.set 0x07b (i64.load offset=0x07b align=1 (i32.const 0))) + (local.set 0x07c (i64.load offset=0x07c align=1 (i32.const 0))) + (local.set 0x07d (i64.load offset=0x07d align=1 (i32.const 0))) + (local.set 0x07e (i64.load offset=0x07e align=1 (i32.const 0))) + (local.set 0x07f (i64.load offset=0x07f align=1 (i32.const 0))) + (local.set 0x080 (i64.load offset=0x080 align=1 (i32.const 0))) + (local.set 0x081 (i64.load offset=0x081 align=1 (i32.const 0))) + (local.set 0x082 (i64.load offset=0x082 align=1 (i32.const 0))) + (local.set 0x083 (i64.load offset=0x083 align=1 (i32.const 0))) + (local.set 0x084 (i64.load offset=0x084 align=1 (i32.const 0))) + (local.set 0x085 (i64.load offset=0x085 align=1 (i32.const 0))) + (local.set 0x086 (i64.load offset=0x086 align=1 (i32.const 0))) + (local.set 0x087 (i64.load offset=0x087 align=1 (i32.const 0))) + (local.set 0x088 (i64.load offset=0x088 align=1 (i32.const 0))) + (local.set 0x089 (i64.load offset=0x089 align=1 (i32.const 0))) + (local.set 0x08a (i64.load offset=0x08a align=1 (i32.const 0))) + (local.set 0x08b (i64.load offset=0x08b align=1 (i32.const 0))) + (local.set 0x08c (i64.load offset=0x08c align=1 (i32.const 0))) + (local.set 0x08d (i64.load offset=0x08d align=1 (i32.const 0))) + (local.set 0x08e (i64.load offset=0x08e align=1 (i32.const 0))) + (local.set 0x08f (i64.load offset=0x08f align=1 (i32.const 0))) + (local.set 0x090 (i64.load offset=0x090 align=1 (i32.const 0))) + (local.set 0x091 (i64.load offset=0x091 align=1 (i32.const 0))) + (local.set 0x092 (i64.load offset=0x092 align=1 (i32.const 0))) + (local.set 0x093 (i64.load offset=0x093 align=1 (i32.const 0))) + (local.set 0x094 (i64.load offset=0x094 align=1 (i32.const 0))) + (local.set 0x095 (i64.load offset=0x095 align=1 (i32.const 0))) + (local.set 0x096 (i64.load offset=0x096 align=1 (i32.const 0))) + (local.set 0x097 (i64.load offset=0x097 align=1 (i32.const 0))) + (local.set 0x098 (i64.load offset=0x098 align=1 (i32.const 0))) + (local.set 0x099 (i64.load offset=0x099 align=1 (i32.const 0))) + (local.set 0x09a (i64.load offset=0x09a align=1 (i32.const 0))) + (local.set 0x09b (i64.load offset=0x09b align=1 (i32.const 0))) + (local.set 0x09c (i64.load offset=0x09c align=1 (i32.const 0))) + (local.set 0x09d (i64.load offset=0x09d align=1 (i32.const 0))) + (local.set 0x09e (i64.load offset=0x09e align=1 (i32.const 0))) + (local.set 0x09f (i64.load offset=0x09f align=1 (i32.const 0))) + (local.set 0x0a0 (i64.load offset=0x0a0 align=1 (i32.const 0))) + (local.set 0x0a1 (i64.load offset=0x0a1 align=1 (i32.const 0))) + (local.set 0x0a2 (i64.load offset=0x0a2 align=1 (i32.const 0))) + (local.set 0x0a3 (i64.load offset=0x0a3 align=1 (i32.const 0))) + (local.set 0x0a4 (i64.load offset=0x0a4 align=1 (i32.const 0))) + (local.set 0x0a5 (i64.load offset=0x0a5 align=1 (i32.const 0))) + (local.set 0x0a6 (i64.load offset=0x0a6 align=1 (i32.const 0))) + (local.set 0x0a7 (i64.load offset=0x0a7 align=1 (i32.const 0))) + (local.set 0x0a8 (i64.load offset=0x0a8 align=1 (i32.const 0))) + (local.set 0x0a9 (i64.load offset=0x0a9 align=1 (i32.const 0))) + (local.set 0x0aa (i64.load offset=0x0aa align=1 (i32.const 0))) + (local.set 0x0ab (i64.load offset=0x0ab align=1 (i32.const 0))) + (local.set 0x0ac (i64.load offset=0x0ac align=1 (i32.const 0))) + (local.set 0x0ad (i64.load offset=0x0ad align=1 (i32.const 0))) + (local.set 0x0ae (i64.load offset=0x0ae align=1 (i32.const 0))) + (local.set 0x0af (i64.load offset=0x0af align=1 (i32.const 0))) + (local.set 0x0b0 (i64.load offset=0x0b0 align=1 (i32.const 0))) + (local.set 0x0b1 (i64.load offset=0x0b1 align=1 (i32.const 0))) + (local.set 0x0b2 (i64.load offset=0x0b2 align=1 (i32.const 0))) + (local.set 0x0b3 (i64.load offset=0x0b3 align=1 (i32.const 0))) + (local.set 0x0b4 (i64.load offset=0x0b4 align=1 (i32.const 0))) + (local.set 0x0b5 (i64.load offset=0x0b5 align=1 (i32.const 0))) + (local.set 0x0b6 (i64.load offset=0x0b6 align=1 (i32.const 0))) + (local.set 0x0b7 (i64.load offset=0x0b7 align=1 (i32.const 0))) + (local.set 0x0b8 (i64.load offset=0x0b8 align=1 (i32.const 0))) + (local.set 0x0b9 (i64.load offset=0x0b9 align=1 (i32.const 0))) + (local.set 0x0ba (i64.load offset=0x0ba align=1 (i32.const 0))) + (local.set 0x0bb (i64.load offset=0x0bb align=1 (i32.const 0))) + (local.set 0x0bc (i64.load offset=0x0bc align=1 (i32.const 0))) + (local.set 0x0bd (i64.load offset=0x0bd align=1 (i32.const 0))) + (local.set 0x0be (i64.load offset=0x0be align=1 (i32.const 0))) + (local.set 0x0bf (i64.load offset=0x0bf align=1 (i32.const 0))) + (local.set 0x0c0 (i64.load offset=0x0c0 align=1 (i32.const 0))) + (local.set 0x0c1 (i64.load offset=0x0c1 align=1 (i32.const 0))) + (local.set 0x0c2 (i64.load offset=0x0c2 align=1 (i32.const 0))) + (local.set 0x0c3 (i64.load offset=0x0c3 align=1 (i32.const 0))) + (local.set 0x0c4 (i64.load offset=0x0c4 align=1 (i32.const 0))) + (local.set 0x0c5 (i64.load offset=0x0c5 align=1 (i32.const 0))) + (local.set 0x0c6 (i64.load offset=0x0c6 align=1 (i32.const 0))) + (local.set 0x0c7 (i64.load offset=0x0c7 align=1 (i32.const 0))) + (local.set 0x0c8 (i64.load offset=0x0c8 align=1 (i32.const 0))) + (local.set 0x0c9 (i64.load offset=0x0c9 align=1 (i32.const 0))) + (local.set 0x0ca (i64.load offset=0x0ca align=1 (i32.const 0))) + (local.set 0x0cb (i64.load offset=0x0cb align=1 (i32.const 0))) + (local.set 0x0cc (i64.load offset=0x0cc align=1 (i32.const 0))) + (local.set 0x0cd (i64.load offset=0x0cd align=1 (i32.const 0))) + (local.set 0x0ce (i64.load offset=0x0ce align=1 (i32.const 0))) + (local.set 0x0cf (i64.load offset=0x0cf align=1 (i32.const 0))) + (local.set 0x0d0 (i64.load offset=0x0d0 align=1 (i32.const 0))) + (local.set 0x0d1 (i64.load offset=0x0d1 align=1 (i32.const 0))) + (local.set 0x0d2 (i64.load offset=0x0d2 align=1 (i32.const 0))) + (local.set 0x0d3 (i64.load offset=0x0d3 align=1 (i32.const 0))) + (local.set 0x0d4 (i64.load offset=0x0d4 align=1 (i32.const 0))) + (local.set 0x0d5 (i64.load offset=0x0d5 align=1 (i32.const 0))) + (local.set 0x0d6 (i64.load offset=0x0d6 align=1 (i32.const 0))) + (local.set 0x0d7 (i64.load offset=0x0d7 align=1 (i32.const 0))) + (local.set 0x0d8 (i64.load offset=0x0d8 align=1 (i32.const 0))) + (local.set 0x0d9 (i64.load offset=0x0d9 align=1 (i32.const 0))) + (local.set 0x0da (i64.load offset=0x0da align=1 (i32.const 0))) + (local.set 0x0db (i64.load offset=0x0db align=1 (i32.const 0))) + (local.set 0x0dc (i64.load offset=0x0dc align=1 (i32.const 0))) + (local.set 0x0dd (i64.load offset=0x0dd align=1 (i32.const 0))) + (local.set 0x0de (i64.load offset=0x0de align=1 (i32.const 0))) + (local.set 0x0df (i64.load offset=0x0df align=1 (i32.const 0))) + (local.set 0x0e0 (i64.load offset=0x0e0 align=1 (i32.const 0))) + (local.set 0x0e1 (i64.load offset=0x0e1 align=1 (i32.const 0))) + (local.set 0x0e2 (i64.load offset=0x0e2 align=1 (i32.const 0))) + (local.set 0x0e3 (i64.load offset=0x0e3 align=1 (i32.const 0))) + (local.set 0x0e4 (i64.load offset=0x0e4 align=1 (i32.const 0))) + (local.set 0x0e5 (i64.load offset=0x0e5 align=1 (i32.const 0))) + (local.set 0x0e6 (i64.load offset=0x0e6 align=1 (i32.const 0))) + (local.set 0x0e7 (i64.load offset=0x0e7 align=1 (i32.const 0))) + (local.set 0x0e8 (i64.load offset=0x0e8 align=1 (i32.const 0))) + (local.set 0x0e9 (i64.load offset=0x0e9 align=1 (i32.const 0))) + (local.set 0x0ea (i64.load offset=0x0ea align=1 (i32.const 0))) + (local.set 0x0eb (i64.load offset=0x0eb align=1 (i32.const 0))) + (local.set 0x0ec (i64.load offset=0x0ec align=1 (i32.const 0))) + (local.set 0x0ed (i64.load offset=0x0ed align=1 (i32.const 0))) + (local.set 0x0ee (i64.load offset=0x0ee align=1 (i32.const 0))) + (local.set 0x0ef (i64.load offset=0x0ef align=1 (i32.const 0))) + (local.set 0x0f0 (i64.load offset=0x0f0 align=1 (i32.const 0))) + (local.set 0x0f1 (i64.load offset=0x0f1 align=1 (i32.const 0))) + (local.set 0x0f2 (i64.load offset=0x0f2 align=1 (i32.const 0))) + (local.set 0x0f3 (i64.load offset=0x0f3 align=1 (i32.const 0))) + (local.set 0x0f4 (i64.load offset=0x0f4 align=1 (i32.const 0))) + (local.set 0x0f5 (i64.load offset=0x0f5 align=1 (i32.const 0))) + (local.set 0x0f6 (i64.load offset=0x0f6 align=1 (i32.const 0))) + (local.set 0x0f7 (i64.load offset=0x0f7 align=1 (i32.const 0))) + (local.set 0x0f8 (i64.load offset=0x0f8 align=1 (i32.const 0))) + (local.set 0x0f9 (i64.load offset=0x0f9 align=1 (i32.const 0))) + (local.set 0x0fa (i64.load offset=0x0fa align=1 (i32.const 0))) + (local.set 0x0fb (i64.load offset=0x0fb align=1 (i32.const 0))) + (local.set 0x0fc (i64.load offset=0x0fc align=1 (i32.const 0))) + (local.set 0x0fd (i64.load offset=0x0fd align=1 (i32.const 0))) + (local.set 0x0fe (i64.load offset=0x0fe align=1 (i32.const 0))) + (local.set 0x0ff (i64.load offset=0x0ff align=1 (i32.const 0))) + (local.set 0x100 (i64.load offset=0x100 align=1 (i32.const 0))) + (local.set 0x101 (i64.load offset=0x101 align=1 (i32.const 0))) + (local.set 0x102 (i64.load offset=0x102 align=1 (i32.const 0))) + (local.set 0x103 (i64.load offset=0x103 align=1 (i32.const 0))) + (local.set 0x104 (i64.load offset=0x104 align=1 (i32.const 0))) + (local.set 0x105 (i64.load offset=0x105 align=1 (i32.const 0))) + (local.set 0x106 (i64.load offset=0x106 align=1 (i32.const 0))) + (local.set 0x107 (i64.load offset=0x107 align=1 (i32.const 0))) + (local.set 0x108 (i64.load offset=0x108 align=1 (i32.const 0))) + (local.set 0x109 (i64.load offset=0x109 align=1 (i32.const 0))) + (local.set 0x10a (i64.load offset=0x10a align=1 (i32.const 0))) + (local.set 0x10b (i64.load offset=0x10b align=1 (i32.const 0))) + (local.set 0x10c (i64.load offset=0x10c align=1 (i32.const 0))) + (local.set 0x10d (i64.load offset=0x10d align=1 (i32.const 0))) + (local.set 0x10e (i64.load offset=0x10e align=1 (i32.const 0))) + (local.set 0x10f (i64.load offset=0x10f align=1 (i32.const 0))) + (local.set 0x110 (i64.load offset=0x110 align=1 (i32.const 0))) + (local.set 0x111 (i64.load offset=0x111 align=1 (i32.const 0))) + (local.set 0x112 (i64.load offset=0x112 align=1 (i32.const 0))) + (local.set 0x113 (i64.load offset=0x113 align=1 (i32.const 0))) + (local.set 0x114 (i64.load offset=0x114 align=1 (i32.const 0))) + (local.set 0x115 (i64.load offset=0x115 align=1 (i32.const 0))) + (local.set 0x116 (i64.load offset=0x116 align=1 (i32.const 0))) + (local.set 0x117 (i64.load offset=0x117 align=1 (i32.const 0))) + (local.set 0x118 (i64.load offset=0x118 align=1 (i32.const 0))) + (local.set 0x119 (i64.load offset=0x119 align=1 (i32.const 0))) + (local.set 0x11a (i64.load offset=0x11a align=1 (i32.const 0))) + (local.set 0x11b (i64.load offset=0x11b align=1 (i32.const 0))) + (local.set 0x11c (i64.load offset=0x11c align=1 (i32.const 0))) + (local.set 0x11d (i64.load offset=0x11d align=1 (i32.const 0))) + (local.set 0x11e (i64.load offset=0x11e align=1 (i32.const 0))) + (local.set 0x11f (i64.load offset=0x11f align=1 (i32.const 0))) + (local.set 0x120 (i64.load offset=0x120 align=1 (i32.const 0))) + (local.set 0x121 (i64.load offset=0x121 align=1 (i32.const 0))) + (local.set 0x122 (i64.load offset=0x122 align=1 (i32.const 0))) + (local.set 0x123 (i64.load offset=0x123 align=1 (i32.const 0))) + (local.set 0x124 (i64.load offset=0x124 align=1 (i32.const 0))) + (local.set 0x125 (i64.load offset=0x125 align=1 (i32.const 0))) + (local.set 0x126 (i64.load offset=0x126 align=1 (i32.const 0))) + (local.set 0x127 (i64.load offset=0x127 align=1 (i32.const 0))) + (local.set 0x128 (i64.load offset=0x128 align=1 (i32.const 0))) + (local.set 0x129 (i64.load offset=0x129 align=1 (i32.const 0))) + (local.set 0x12a (i64.load offset=0x12a align=1 (i32.const 0))) + (local.set 0x12b (i64.load offset=0x12b align=1 (i32.const 0))) + (local.set 0x12c (i64.load offset=0x12c align=1 (i32.const 0))) + (local.set 0x12d (i64.load offset=0x12d align=1 (i32.const 0))) + (local.set 0x12e (i64.load offset=0x12e align=1 (i32.const 0))) + (local.set 0x12f (i64.load offset=0x12f align=1 (i32.const 0))) + (local.set 0x130 (i64.load offset=0x130 align=1 (i32.const 0))) + (local.set 0x131 (i64.load offset=0x131 align=1 (i32.const 0))) + (local.set 0x132 (i64.load offset=0x132 align=1 (i32.const 0))) + (local.set 0x133 (i64.load offset=0x133 align=1 (i32.const 0))) + (local.set 0x134 (i64.load offset=0x134 align=1 (i32.const 0))) + (local.set 0x135 (i64.load offset=0x135 align=1 (i32.const 0))) + (local.set 0x136 (i64.load offset=0x136 align=1 (i32.const 0))) + (local.set 0x137 (i64.load offset=0x137 align=1 (i32.const 0))) + (local.set 0x138 (i64.load offset=0x138 align=1 (i32.const 0))) + (local.set 0x139 (i64.load offset=0x139 align=1 (i32.const 0))) + (local.set 0x13a (i64.load offset=0x13a align=1 (i32.const 0))) + (local.set 0x13b (i64.load offset=0x13b align=1 (i32.const 0))) + (local.set 0x13c (i64.load offset=0x13c align=1 (i32.const 0))) + (local.set 0x13d (i64.load offset=0x13d align=1 (i32.const 0))) + (local.set 0x13e (i64.load offset=0x13e align=1 (i32.const 0))) + (local.set 0x13f (i64.load offset=0x13f align=1 (i32.const 0))) + (local.set 0x140 (i64.load offset=0x140 align=1 (i32.const 0))) + (local.set 0x141 (i64.load offset=0x141 align=1 (i32.const 0))) + (local.set 0x142 (i64.load offset=0x142 align=1 (i32.const 0))) + (local.set 0x143 (i64.load offset=0x143 align=1 (i32.const 0))) + (local.set 0x144 (i64.load offset=0x144 align=1 (i32.const 0))) + (local.set 0x145 (i64.load offset=0x145 align=1 (i32.const 0))) + (local.set 0x146 (i64.load offset=0x146 align=1 (i32.const 0))) + (local.set 0x147 (i64.load offset=0x147 align=1 (i32.const 0))) + (local.set 0x148 (i64.load offset=0x148 align=1 (i32.const 0))) + (local.set 0x149 (i64.load offset=0x149 align=1 (i32.const 0))) + (local.set 0x14a (i64.load offset=0x14a align=1 (i32.const 0))) + (local.set 0x14b (i64.load offset=0x14b align=1 (i32.const 0))) + (local.set 0x14c (i64.load offset=0x14c align=1 (i32.const 0))) + (local.set 0x14d (i64.load offset=0x14d align=1 (i32.const 0))) + (local.set 0x14e (i64.load offset=0x14e align=1 (i32.const 0))) + (local.set 0x14f (i64.load offset=0x14f align=1 (i32.const 0))) + (local.set 0x150 (i64.load offset=0x150 align=1 (i32.const 0))) + (local.set 0x151 (i64.load offset=0x151 align=1 (i32.const 0))) + (local.set 0x152 (i64.load offset=0x152 align=1 (i32.const 0))) + (local.set 0x153 (i64.load offset=0x153 align=1 (i32.const 0))) + (local.set 0x154 (i64.load offset=0x154 align=1 (i32.const 0))) + (local.set 0x155 (i64.load offset=0x155 align=1 (i32.const 0))) + (local.set 0x156 (i64.load offset=0x156 align=1 (i32.const 0))) + (local.set 0x157 (i64.load offset=0x157 align=1 (i32.const 0))) + (local.set 0x158 (i64.load offset=0x158 align=1 (i32.const 0))) + (local.set 0x159 (i64.load offset=0x159 align=1 (i32.const 0))) + (local.set 0x15a (i64.load offset=0x15a align=1 (i32.const 0))) + (local.set 0x15b (i64.load offset=0x15b align=1 (i32.const 0))) + (local.set 0x15c (i64.load offset=0x15c align=1 (i32.const 0))) + (local.set 0x15d (i64.load offset=0x15d align=1 (i32.const 0))) + (local.set 0x15e (i64.load offset=0x15e align=1 (i32.const 0))) + (local.set 0x15f (i64.load offset=0x15f align=1 (i32.const 0))) + (local.set 0x160 (i64.load offset=0x160 align=1 (i32.const 0))) + (local.set 0x161 (i64.load offset=0x161 align=1 (i32.const 0))) + (local.set 0x162 (i64.load offset=0x162 align=1 (i32.const 0))) + (local.set 0x163 (i64.load offset=0x163 align=1 (i32.const 0))) + (local.set 0x164 (i64.load offset=0x164 align=1 (i32.const 0))) + (local.set 0x165 (i64.load offset=0x165 align=1 (i32.const 0))) + (local.set 0x166 (i64.load offset=0x166 align=1 (i32.const 0))) + (local.set 0x167 (i64.load offset=0x167 align=1 (i32.const 0))) + (local.set 0x168 (i64.load offset=0x168 align=1 (i32.const 0))) + (local.set 0x169 (i64.load offset=0x169 align=1 (i32.const 0))) + (local.set 0x16a (i64.load offset=0x16a align=1 (i32.const 0))) + (local.set 0x16b (i64.load offset=0x16b align=1 (i32.const 0))) + (local.set 0x16c (i64.load offset=0x16c align=1 (i32.const 0))) + (local.set 0x16d (i64.load offset=0x16d align=1 (i32.const 0))) + (local.set 0x16e (i64.load offset=0x16e align=1 (i32.const 0))) + (local.set 0x16f (i64.load offset=0x16f align=1 (i32.const 0))) + (local.set 0x170 (i64.load offset=0x170 align=1 (i32.const 0))) + (local.set 0x171 (i64.load offset=0x171 align=1 (i32.const 0))) + (local.set 0x172 (i64.load offset=0x172 align=1 (i32.const 0))) + (local.set 0x173 (i64.load offset=0x173 align=1 (i32.const 0))) + (local.set 0x174 (i64.load offset=0x174 align=1 (i32.const 0))) + (local.set 0x175 (i64.load offset=0x175 align=1 (i32.const 0))) + (local.set 0x176 (i64.load offset=0x176 align=1 (i32.const 0))) + (local.set 0x177 (i64.load offset=0x177 align=1 (i32.const 0))) + (local.set 0x178 (i64.load offset=0x178 align=1 (i32.const 0))) + (local.set 0x179 (i64.load offset=0x179 align=1 (i32.const 0))) + (local.set 0x17a (i64.load offset=0x17a align=1 (i32.const 0))) + (local.set 0x17b (i64.load offset=0x17b align=1 (i32.const 0))) + (local.set 0x17c (i64.load offset=0x17c align=1 (i32.const 0))) + (local.set 0x17d (i64.load offset=0x17d align=1 (i32.const 0))) + (local.set 0x17e (i64.load offset=0x17e align=1 (i32.const 0))) + (local.set 0x17f (i64.load offset=0x17f align=1 (i32.const 0))) + (local.set 0x180 (i64.load offset=0x180 align=1 (i32.const 0))) + (local.set 0x181 (i64.load offset=0x181 align=1 (i32.const 0))) + (local.set 0x182 (i64.load offset=0x182 align=1 (i32.const 0))) + (local.set 0x183 (i64.load offset=0x183 align=1 (i32.const 0))) + (local.set 0x184 (i64.load offset=0x184 align=1 (i32.const 0))) + (local.set 0x185 (i64.load offset=0x185 align=1 (i32.const 0))) + (local.set 0x186 (i64.load offset=0x186 align=1 (i32.const 0))) + (local.set 0x187 (i64.load offset=0x187 align=1 (i32.const 0))) + (local.set 0x188 (i64.load offset=0x188 align=1 (i32.const 0))) + (local.set 0x189 (i64.load offset=0x189 align=1 (i32.const 0))) + (local.set 0x18a (i64.load offset=0x18a align=1 (i32.const 0))) + (local.set 0x18b (i64.load offset=0x18b align=1 (i32.const 0))) + (local.set 0x18c (i64.load offset=0x18c align=1 (i32.const 0))) + (local.set 0x18d (i64.load offset=0x18d align=1 (i32.const 0))) + (local.set 0x18e (i64.load offset=0x18e align=1 (i32.const 0))) + (local.set 0x18f (i64.load offset=0x18f align=1 (i32.const 0))) + (local.set 0x190 (i64.load offset=0x190 align=1 (i32.const 0))) + (local.set 0x191 (i64.load offset=0x191 align=1 (i32.const 0))) + (local.set 0x192 (i64.load offset=0x192 align=1 (i32.const 0))) + (local.set 0x193 (i64.load offset=0x193 align=1 (i32.const 0))) + (local.set 0x194 (i64.load offset=0x194 align=1 (i32.const 0))) + (local.set 0x195 (i64.load offset=0x195 align=1 (i32.const 0))) + (local.set 0x196 (i64.load offset=0x196 align=1 (i32.const 0))) + (local.set 0x197 (i64.load offset=0x197 align=1 (i32.const 0))) + (local.set 0x198 (i64.load offset=0x198 align=1 (i32.const 0))) + (local.set 0x199 (i64.load offset=0x199 align=1 (i32.const 0))) + (local.set 0x19a (i64.load offset=0x19a align=1 (i32.const 0))) + (local.set 0x19b (i64.load offset=0x19b align=1 (i32.const 0))) + (local.set 0x19c (i64.load offset=0x19c align=1 (i32.const 0))) + (local.set 0x19d (i64.load offset=0x19d align=1 (i32.const 0))) + (local.set 0x19e (i64.load offset=0x19e align=1 (i32.const 0))) + (local.set 0x19f (i64.load offset=0x19f align=1 (i32.const 0))) + (local.set 0x1a0 (i64.load offset=0x1a0 align=1 (i32.const 0))) + (local.set 0x1a1 (i64.load offset=0x1a1 align=1 (i32.const 0))) + (local.set 0x1a2 (i64.load offset=0x1a2 align=1 (i32.const 0))) + (local.set 0x1a3 (i64.load offset=0x1a3 align=1 (i32.const 0))) + (local.set 0x1a4 (i64.load offset=0x1a4 align=1 (i32.const 0))) + (local.set 0x1a5 (i64.load offset=0x1a5 align=1 (i32.const 0))) + (local.set 0x1a6 (i64.load offset=0x1a6 align=1 (i32.const 0))) + (local.set 0x1a7 (i64.load offset=0x1a7 align=1 (i32.const 0))) + (local.set 0x1a8 (i64.load offset=0x1a8 align=1 (i32.const 0))) + (local.set 0x1a9 (i64.load offset=0x1a9 align=1 (i32.const 0))) + (local.set 0x1aa (i64.load offset=0x1aa align=1 (i32.const 0))) + (local.set 0x1ab (i64.load offset=0x1ab align=1 (i32.const 0))) + (local.set 0x1ac (i64.load offset=0x1ac align=1 (i32.const 0))) + (local.set 0x1ad (i64.load offset=0x1ad align=1 (i32.const 0))) + (local.set 0x1ae (i64.load offset=0x1ae align=1 (i32.const 0))) + (local.set 0x1af (i64.load offset=0x1af align=1 (i32.const 0))) + (local.set 0x1b0 (i64.load offset=0x1b0 align=1 (i32.const 0))) + (local.set 0x1b1 (i64.load offset=0x1b1 align=1 (i32.const 0))) + (local.set 0x1b2 (i64.load offset=0x1b2 align=1 (i32.const 0))) + (local.set 0x1b3 (i64.load offset=0x1b3 align=1 (i32.const 0))) + (local.set 0x1b4 (i64.load offset=0x1b4 align=1 (i32.const 0))) + (local.set 0x1b5 (i64.load offset=0x1b5 align=1 (i32.const 0))) + (local.set 0x1b6 (i64.load offset=0x1b6 align=1 (i32.const 0))) + (local.set 0x1b7 (i64.load offset=0x1b7 align=1 (i32.const 0))) + (local.set 0x1b8 (i64.load offset=0x1b8 align=1 (i32.const 0))) + (local.set 0x1b9 (i64.load offset=0x1b9 align=1 (i32.const 0))) + (local.set 0x1ba (i64.load offset=0x1ba align=1 (i32.const 0))) + (local.set 0x1bb (i64.load offset=0x1bb align=1 (i32.const 0))) + (local.set 0x1bc (i64.load offset=0x1bc align=1 (i32.const 0))) + (local.set 0x1bd (i64.load offset=0x1bd align=1 (i32.const 0))) + (local.set 0x1be (i64.load offset=0x1be align=1 (i32.const 0))) + (local.set 0x1bf (i64.load offset=0x1bf align=1 (i32.const 0))) + (local.set 0x1c0 (i64.load offset=0x1c0 align=1 (i32.const 0))) + (local.set 0x1c1 (i64.load offset=0x1c1 align=1 (i32.const 0))) + (local.set 0x1c2 (i64.load offset=0x1c2 align=1 (i32.const 0))) + (local.set 0x1c3 (i64.load offset=0x1c3 align=1 (i32.const 0))) + (local.set 0x1c4 (i64.load offset=0x1c4 align=1 (i32.const 0))) + (local.set 0x1c5 (i64.load offset=0x1c5 align=1 (i32.const 0))) + (local.set 0x1c6 (i64.load offset=0x1c6 align=1 (i32.const 0))) + (local.set 0x1c7 (i64.load offset=0x1c7 align=1 (i32.const 0))) + (local.set 0x1c8 (i64.load offset=0x1c8 align=1 (i32.const 0))) + (local.set 0x1c9 (i64.load offset=0x1c9 align=1 (i32.const 0))) + (local.set 0x1ca (i64.load offset=0x1ca align=1 (i32.const 0))) + (local.set 0x1cb (i64.load offset=0x1cb align=1 (i32.const 0))) + (local.set 0x1cc (i64.load offset=0x1cc align=1 (i32.const 0))) + (local.set 0x1cd (i64.load offset=0x1cd align=1 (i32.const 0))) + (local.set 0x1ce (i64.load offset=0x1ce align=1 (i32.const 0))) + (local.set 0x1cf (i64.load offset=0x1cf align=1 (i32.const 0))) + (local.set 0x1d0 (i64.load offset=0x1d0 align=1 (i32.const 0))) + (local.set 0x1d1 (i64.load offset=0x1d1 align=1 (i32.const 0))) + (local.set 0x1d2 (i64.load offset=0x1d2 align=1 (i32.const 0))) + (local.set 0x1d3 (i64.load offset=0x1d3 align=1 (i32.const 0))) + (local.set 0x1d4 (i64.load offset=0x1d4 align=1 (i32.const 0))) + (local.set 0x1d5 (i64.load offset=0x1d5 align=1 (i32.const 0))) + (local.set 0x1d6 (i64.load offset=0x1d6 align=1 (i32.const 0))) + (local.set 0x1d7 (i64.load offset=0x1d7 align=1 (i32.const 0))) + (local.set 0x1d8 (i64.load offset=0x1d8 align=1 (i32.const 0))) + (local.set 0x1d9 (i64.load offset=0x1d9 align=1 (i32.const 0))) + (local.set 0x1da (i64.load offset=0x1da align=1 (i32.const 0))) + (local.set 0x1db (i64.load offset=0x1db align=1 (i32.const 0))) + (local.set 0x1dc (i64.load offset=0x1dc align=1 (i32.const 0))) + (local.set 0x1dd (i64.load offset=0x1dd align=1 (i32.const 0))) + (local.set 0x1de (i64.load offset=0x1de align=1 (i32.const 0))) + (local.set 0x1df (i64.load offset=0x1df align=1 (i32.const 0))) + (local.set 0x1e0 (i64.load offset=0x1e0 align=1 (i32.const 0))) + (local.set 0x1e1 (i64.load offset=0x1e1 align=1 (i32.const 0))) + (local.set 0x1e2 (i64.load offset=0x1e2 align=1 (i32.const 0))) + (local.set 0x1e3 (i64.load offset=0x1e3 align=1 (i32.const 0))) + (local.set 0x1e4 (i64.load offset=0x1e4 align=1 (i32.const 0))) + (local.set 0x1e5 (i64.load offset=0x1e5 align=1 (i32.const 0))) + (local.set 0x1e6 (i64.load offset=0x1e6 align=1 (i32.const 0))) + (local.set 0x1e7 (i64.load offset=0x1e7 align=1 (i32.const 0))) + (local.set 0x1e8 (i64.load offset=0x1e8 align=1 (i32.const 0))) + (local.set 0x1e9 (i64.load offset=0x1e9 align=1 (i32.const 0))) + (local.set 0x1ea (i64.load offset=0x1ea align=1 (i32.const 0))) + (local.set 0x1eb (i64.load offset=0x1eb align=1 (i32.const 0))) + (local.set 0x1ec (i64.load offset=0x1ec align=1 (i32.const 0))) + (local.set 0x1ed (i64.load offset=0x1ed align=1 (i32.const 0))) + (local.set 0x1ee (i64.load offset=0x1ee align=1 (i32.const 0))) + (local.set 0x1ef (i64.load offset=0x1ef align=1 (i32.const 0))) + (local.set 0x1f0 (i64.load offset=0x1f0 align=1 (i32.const 0))) + (local.set 0x1f1 (i64.load offset=0x1f1 align=1 (i32.const 0))) + (local.set 0x1f2 (i64.load offset=0x1f2 align=1 (i32.const 0))) + (local.set 0x1f3 (i64.load offset=0x1f3 align=1 (i32.const 0))) + (local.set 0x1f4 (i64.load offset=0x1f4 align=1 (i32.const 0))) + (local.set 0x1f5 (i64.load offset=0x1f5 align=1 (i32.const 0))) + (local.set 0x1f6 (i64.load offset=0x1f6 align=1 (i32.const 0))) + (local.set 0x1f7 (i64.load offset=0x1f7 align=1 (i32.const 0))) + (local.set 0x1f8 (i64.load offset=0x1f8 align=1 (i32.const 0))) + (local.set 0x1f9 (i64.load offset=0x1f9 align=1 (i32.const 0))) + (local.set 0x1fa (i64.load offset=0x1fa align=1 (i32.const 0))) + (local.set 0x1fb (i64.load offset=0x1fb align=1 (i32.const 0))) + (local.set 0x1fc (i64.load offset=0x1fc align=1 (i32.const 0))) + (local.set 0x1fd (i64.load offset=0x1fd align=1 (i32.const 0))) + (local.set 0x1fe (i64.load offset=0x1fe align=1 (i32.const 0))) + (local.set 0x1ff (i64.load offset=0x1ff align=1 (i32.const 0))) + (local.set 0x200 (i64.load offset=0x200 align=1 (i32.const 0))) + (local.set 0x201 (i64.load offset=0x201 align=1 (i32.const 0))) + (local.set 0x202 (i64.load offset=0x202 align=1 (i32.const 0))) + (local.set 0x203 (i64.load offset=0x203 align=1 (i32.const 0))) + (local.set 0x204 (i64.load offset=0x204 align=1 (i32.const 0))) + (local.set 0x205 (i64.load offset=0x205 align=1 (i32.const 0))) + (local.set 0x206 (i64.load offset=0x206 align=1 (i32.const 0))) + (local.set 0x207 (i64.load offset=0x207 align=1 (i32.const 0))) + (local.set 0x208 (i64.load offset=0x208 align=1 (i32.const 0))) + (local.set 0x209 (i64.load offset=0x209 align=1 (i32.const 0))) + (local.set 0x20a (i64.load offset=0x20a align=1 (i32.const 0))) + (local.set 0x20b (i64.load offset=0x20b align=1 (i32.const 0))) + (local.set 0x20c (i64.load offset=0x20c align=1 (i32.const 0))) + (local.set 0x20d (i64.load offset=0x20d align=1 (i32.const 0))) + (local.set 0x20e (i64.load offset=0x20e align=1 (i32.const 0))) + (local.set 0x20f (i64.load offset=0x20f align=1 (i32.const 0))) + (local.set 0x210 (i64.load offset=0x210 align=1 (i32.const 0))) + (local.set 0x211 (i64.load offset=0x211 align=1 (i32.const 0))) + (local.set 0x212 (i64.load offset=0x212 align=1 (i32.const 0))) + (local.set 0x213 (i64.load offset=0x213 align=1 (i32.const 0))) + (local.set 0x214 (i64.load offset=0x214 align=1 (i32.const 0))) + (local.set 0x215 (i64.load offset=0x215 align=1 (i32.const 0))) + (local.set 0x216 (i64.load offset=0x216 align=1 (i32.const 0))) + (local.set 0x217 (i64.load offset=0x217 align=1 (i32.const 0))) + (local.set 0x218 (i64.load offset=0x218 align=1 (i32.const 0))) + (local.set 0x219 (i64.load offset=0x219 align=1 (i32.const 0))) + (local.set 0x21a (i64.load offset=0x21a align=1 (i32.const 0))) + (local.set 0x21b (i64.load offset=0x21b align=1 (i32.const 0))) + (local.set 0x21c (i64.load offset=0x21c align=1 (i32.const 0))) + (local.set 0x21d (i64.load offset=0x21d align=1 (i32.const 0))) + (local.set 0x21e (i64.load offset=0x21e align=1 (i32.const 0))) + (local.set 0x21f (i64.load offset=0x21f align=1 (i32.const 0))) + (local.set 0x220 (i64.load offset=0x220 align=1 (i32.const 0))) + (local.set 0x221 (i64.load offset=0x221 align=1 (i32.const 0))) + (local.set 0x222 (i64.load offset=0x222 align=1 (i32.const 0))) + (local.set 0x223 (i64.load offset=0x223 align=1 (i32.const 0))) + (local.set 0x224 (i64.load offset=0x224 align=1 (i32.const 0))) + (local.set 0x225 (i64.load offset=0x225 align=1 (i32.const 0))) + (local.set 0x226 (i64.load offset=0x226 align=1 (i32.const 0))) + (local.set 0x227 (i64.load offset=0x227 align=1 (i32.const 0))) + (local.set 0x228 (i64.load offset=0x228 align=1 (i32.const 0))) + (local.set 0x229 (i64.load offset=0x229 align=1 (i32.const 0))) + (local.set 0x22a (i64.load offset=0x22a align=1 (i32.const 0))) + (local.set 0x22b (i64.load offset=0x22b align=1 (i32.const 0))) + (local.set 0x22c (i64.load offset=0x22c align=1 (i32.const 0))) + (local.set 0x22d (i64.load offset=0x22d align=1 (i32.const 0))) + (local.set 0x22e (i64.load offset=0x22e align=1 (i32.const 0))) + (local.set 0x22f (i64.load offset=0x22f align=1 (i32.const 0))) + (local.set 0x230 (i64.load offset=0x230 align=1 (i32.const 0))) + (local.set 0x231 (i64.load offset=0x231 align=1 (i32.const 0))) + (local.set 0x232 (i64.load offset=0x232 align=1 (i32.const 0))) + (local.set 0x233 (i64.load offset=0x233 align=1 (i32.const 0))) + (local.set 0x234 (i64.load offset=0x234 align=1 (i32.const 0))) + (local.set 0x235 (i64.load offset=0x235 align=1 (i32.const 0))) + (local.set 0x236 (i64.load offset=0x236 align=1 (i32.const 0))) + (local.set 0x237 (i64.load offset=0x237 align=1 (i32.const 0))) + (local.set 0x238 (i64.load offset=0x238 align=1 (i32.const 0))) + (local.set 0x239 (i64.load offset=0x239 align=1 (i32.const 0))) + (local.set 0x23a (i64.load offset=0x23a align=1 (i32.const 0))) + (local.set 0x23b (i64.load offset=0x23b align=1 (i32.const 0))) + (local.set 0x23c (i64.load offset=0x23c align=1 (i32.const 0))) + (local.set 0x23d (i64.load offset=0x23d align=1 (i32.const 0))) + (local.set 0x23e (i64.load offset=0x23e align=1 (i32.const 0))) + (local.set 0x23f (i64.load offset=0x23f align=1 (i32.const 0))) + (local.set 0x240 (i64.load offset=0x240 align=1 (i32.const 0))) + (local.set 0x241 (i64.load offset=0x241 align=1 (i32.const 0))) + (local.set 0x242 (i64.load offset=0x242 align=1 (i32.const 0))) + (local.set 0x243 (i64.load offset=0x243 align=1 (i32.const 0))) + (local.set 0x244 (i64.load offset=0x244 align=1 (i32.const 0))) + (local.set 0x245 (i64.load offset=0x245 align=1 (i32.const 0))) + (local.set 0x246 (i64.load offset=0x246 align=1 (i32.const 0))) + (local.set 0x247 (i64.load offset=0x247 align=1 (i32.const 0))) + (local.set 0x248 (i64.load offset=0x248 align=1 (i32.const 0))) + (local.set 0x249 (i64.load offset=0x249 align=1 (i32.const 0))) + (local.set 0x24a (i64.load offset=0x24a align=1 (i32.const 0))) + (local.set 0x24b (i64.load offset=0x24b align=1 (i32.const 0))) + (local.set 0x24c (i64.load offset=0x24c align=1 (i32.const 0))) + (local.set 0x24d (i64.load offset=0x24d align=1 (i32.const 0))) + (local.set 0x24e (i64.load offset=0x24e align=1 (i32.const 0))) + (local.set 0x24f (i64.load offset=0x24f align=1 (i32.const 0))) + (local.set 0x250 (i64.load offset=0x250 align=1 (i32.const 0))) + (local.set 0x251 (i64.load offset=0x251 align=1 (i32.const 0))) + (local.set 0x252 (i64.load offset=0x252 align=1 (i32.const 0))) + (local.set 0x253 (i64.load offset=0x253 align=1 (i32.const 0))) + (local.set 0x254 (i64.load offset=0x254 align=1 (i32.const 0))) + (local.set 0x255 (i64.load offset=0x255 align=1 (i32.const 0))) + (local.set 0x256 (i64.load offset=0x256 align=1 (i32.const 0))) + (local.set 0x257 (i64.load offset=0x257 align=1 (i32.const 0))) + (local.set 0x258 (i64.load offset=0x258 align=1 (i32.const 0))) + (local.set 0x259 (i64.load offset=0x259 align=1 (i32.const 0))) + (local.set 0x25a (i64.load offset=0x25a align=1 (i32.const 0))) + (local.set 0x25b (i64.load offset=0x25b align=1 (i32.const 0))) + (local.set 0x25c (i64.load offset=0x25c align=1 (i32.const 0))) + (local.set 0x25d (i64.load offset=0x25d align=1 (i32.const 0))) + (local.set 0x25e (i64.load offset=0x25e align=1 (i32.const 0))) + (local.set 0x25f (i64.load offset=0x25f align=1 (i32.const 0))) + (local.set 0x260 (i64.load offset=0x260 align=1 (i32.const 0))) + (local.set 0x261 (i64.load offset=0x261 align=1 (i32.const 0))) + (local.set 0x262 (i64.load offset=0x262 align=1 (i32.const 0))) + (local.set 0x263 (i64.load offset=0x263 align=1 (i32.const 0))) + (local.set 0x264 (i64.load offset=0x264 align=1 (i32.const 0))) + (local.set 0x265 (i64.load offset=0x265 align=1 (i32.const 0))) + (local.set 0x266 (i64.load offset=0x266 align=1 (i32.const 0))) + (local.set 0x267 (i64.load offset=0x267 align=1 (i32.const 0))) + (local.set 0x268 (i64.load offset=0x268 align=1 (i32.const 0))) + (local.set 0x269 (i64.load offset=0x269 align=1 (i32.const 0))) + (local.set 0x26a (i64.load offset=0x26a align=1 (i32.const 0))) + (local.set 0x26b (i64.load offset=0x26b align=1 (i32.const 0))) + (local.set 0x26c (i64.load offset=0x26c align=1 (i32.const 0))) + (local.set 0x26d (i64.load offset=0x26d align=1 (i32.const 0))) + (local.set 0x26e (i64.load offset=0x26e align=1 (i32.const 0))) + (local.set 0x26f (i64.load offset=0x26f align=1 (i32.const 0))) + (local.set 0x270 (i64.load offset=0x270 align=1 (i32.const 0))) + (local.set 0x271 (i64.load offset=0x271 align=1 (i32.const 0))) + (local.set 0x272 (i64.load offset=0x272 align=1 (i32.const 0))) + (local.set 0x273 (i64.load offset=0x273 align=1 (i32.const 0))) + (local.set 0x274 (i64.load offset=0x274 align=1 (i32.const 0))) + (local.set 0x275 (i64.load offset=0x275 align=1 (i32.const 0))) + (local.set 0x276 (i64.load offset=0x276 align=1 (i32.const 0))) + (local.set 0x277 (i64.load offset=0x277 align=1 (i32.const 0))) + (local.set 0x278 (i64.load offset=0x278 align=1 (i32.const 0))) + (local.set 0x279 (i64.load offset=0x279 align=1 (i32.const 0))) + (local.set 0x27a (i64.load offset=0x27a align=1 (i32.const 0))) + (local.set 0x27b (i64.load offset=0x27b align=1 (i32.const 0))) + (local.set 0x27c (i64.load offset=0x27c align=1 (i32.const 0))) + (local.set 0x27d (i64.load offset=0x27d align=1 (i32.const 0))) + (local.set 0x27e (i64.load offset=0x27e align=1 (i32.const 0))) + (local.set 0x27f (i64.load offset=0x27f align=1 (i32.const 0))) + (local.set 0x280 (i64.load offset=0x280 align=1 (i32.const 0))) + (local.set 0x281 (i64.load offset=0x281 align=1 (i32.const 0))) + (local.set 0x282 (i64.load offset=0x282 align=1 (i32.const 0))) + (local.set 0x283 (i64.load offset=0x283 align=1 (i32.const 0))) + (local.set 0x284 (i64.load offset=0x284 align=1 (i32.const 0))) + (local.set 0x285 (i64.load offset=0x285 align=1 (i32.const 0))) + (local.set 0x286 (i64.load offset=0x286 align=1 (i32.const 0))) + (local.set 0x287 (i64.load offset=0x287 align=1 (i32.const 0))) + (local.set 0x288 (i64.load offset=0x288 align=1 (i32.const 0))) + (local.set 0x289 (i64.load offset=0x289 align=1 (i32.const 0))) + (local.set 0x28a (i64.load offset=0x28a align=1 (i32.const 0))) + (local.set 0x28b (i64.load offset=0x28b align=1 (i32.const 0))) + (local.set 0x28c (i64.load offset=0x28c align=1 (i32.const 0))) + (local.set 0x28d (i64.load offset=0x28d align=1 (i32.const 0))) + (local.set 0x28e (i64.load offset=0x28e align=1 (i32.const 0))) + (local.set 0x28f (i64.load offset=0x28f align=1 (i32.const 0))) + (local.set 0x290 (i64.load offset=0x290 align=1 (i32.const 0))) + (local.set 0x291 (i64.load offset=0x291 align=1 (i32.const 0))) + (local.set 0x292 (i64.load offset=0x292 align=1 (i32.const 0))) + (local.set 0x293 (i64.load offset=0x293 align=1 (i32.const 0))) + (local.set 0x294 (i64.load offset=0x294 align=1 (i32.const 0))) + (local.set 0x295 (i64.load offset=0x295 align=1 (i32.const 0))) + (local.set 0x296 (i64.load offset=0x296 align=1 (i32.const 0))) + (local.set 0x297 (i64.load offset=0x297 align=1 (i32.const 0))) + (local.set 0x298 (i64.load offset=0x298 align=1 (i32.const 0))) + (local.set 0x299 (i64.load offset=0x299 align=1 (i32.const 0))) + (local.set 0x29a (i64.load offset=0x29a align=1 (i32.const 0))) + (local.set 0x29b (i64.load offset=0x29b align=1 (i32.const 0))) + (local.set 0x29c (i64.load offset=0x29c align=1 (i32.const 0))) + (local.set 0x29d (i64.load offset=0x29d align=1 (i32.const 0))) + (local.set 0x29e (i64.load offset=0x29e align=1 (i32.const 0))) + (local.set 0x29f (i64.load offset=0x29f align=1 (i32.const 0))) + (local.set 0x2a0 (i64.load offset=0x2a0 align=1 (i32.const 0))) + (local.set 0x2a1 (i64.load offset=0x2a1 align=1 (i32.const 0))) + (local.set 0x2a2 (i64.load offset=0x2a2 align=1 (i32.const 0))) + (local.set 0x2a3 (i64.load offset=0x2a3 align=1 (i32.const 0))) + (local.set 0x2a4 (i64.load offset=0x2a4 align=1 (i32.const 0))) + (local.set 0x2a5 (i64.load offset=0x2a5 align=1 (i32.const 0))) + (local.set 0x2a6 (i64.load offset=0x2a6 align=1 (i32.const 0))) + (local.set 0x2a7 (i64.load offset=0x2a7 align=1 (i32.const 0))) + (local.set 0x2a8 (i64.load offset=0x2a8 align=1 (i32.const 0))) + (local.set 0x2a9 (i64.load offset=0x2a9 align=1 (i32.const 0))) + (local.set 0x2aa (i64.load offset=0x2aa align=1 (i32.const 0))) + (local.set 0x2ab (i64.load offset=0x2ab align=1 (i32.const 0))) + (local.set 0x2ac (i64.load offset=0x2ac align=1 (i32.const 0))) + (local.set 0x2ad (i64.load offset=0x2ad align=1 (i32.const 0))) + (local.set 0x2ae (i64.load offset=0x2ae align=1 (i32.const 0))) + (local.set 0x2af (i64.load offset=0x2af align=1 (i32.const 0))) + (local.set 0x2b0 (i64.load offset=0x2b0 align=1 (i32.const 0))) + (local.set 0x2b1 (i64.load offset=0x2b1 align=1 (i32.const 0))) + (local.set 0x2b2 (i64.load offset=0x2b2 align=1 (i32.const 0))) + (local.set 0x2b3 (i64.load offset=0x2b3 align=1 (i32.const 0))) + (local.set 0x2b4 (i64.load offset=0x2b4 align=1 (i32.const 0))) + (local.set 0x2b5 (i64.load offset=0x2b5 align=1 (i32.const 0))) + (local.set 0x2b6 (i64.load offset=0x2b6 align=1 (i32.const 0))) + (local.set 0x2b7 (i64.load offset=0x2b7 align=1 (i32.const 0))) + (local.set 0x2b8 (i64.load offset=0x2b8 align=1 (i32.const 0))) + (local.set 0x2b9 (i64.load offset=0x2b9 align=1 (i32.const 0))) + (local.set 0x2ba (i64.load offset=0x2ba align=1 (i32.const 0))) + (local.set 0x2bb (i64.load offset=0x2bb align=1 (i32.const 0))) + (local.set 0x2bc (i64.load offset=0x2bc align=1 (i32.const 0))) + (local.set 0x2bd (i64.load offset=0x2bd align=1 (i32.const 0))) + (local.set 0x2be (i64.load offset=0x2be align=1 (i32.const 0))) + (local.set 0x2bf (i64.load offset=0x2bf align=1 (i32.const 0))) + (local.set 0x2c0 (i64.load offset=0x2c0 align=1 (i32.const 0))) + (local.set 0x2c1 (i64.load offset=0x2c1 align=1 (i32.const 0))) + (local.set 0x2c2 (i64.load offset=0x2c2 align=1 (i32.const 0))) + (local.set 0x2c3 (i64.load offset=0x2c3 align=1 (i32.const 0))) + (local.set 0x2c4 (i64.load offset=0x2c4 align=1 (i32.const 0))) + (local.set 0x2c5 (i64.load offset=0x2c5 align=1 (i32.const 0))) + (local.set 0x2c6 (i64.load offset=0x2c6 align=1 (i32.const 0))) + (local.set 0x2c7 (i64.load offset=0x2c7 align=1 (i32.const 0))) + (local.set 0x2c8 (i64.load offset=0x2c8 align=1 (i32.const 0))) + (local.set 0x2c9 (i64.load offset=0x2c9 align=1 (i32.const 0))) + (local.set 0x2ca (i64.load offset=0x2ca align=1 (i32.const 0))) + (local.set 0x2cb (i64.load offset=0x2cb align=1 (i32.const 0))) + (local.set 0x2cc (i64.load offset=0x2cc align=1 (i32.const 0))) + (local.set 0x2cd (i64.load offset=0x2cd align=1 (i32.const 0))) + (local.set 0x2ce (i64.load offset=0x2ce align=1 (i32.const 0))) + (local.set 0x2cf (i64.load offset=0x2cf align=1 (i32.const 0))) + (local.set 0x2d0 (i64.load offset=0x2d0 align=1 (i32.const 0))) + (local.set 0x2d1 (i64.load offset=0x2d1 align=1 (i32.const 0))) + (local.set 0x2d2 (i64.load offset=0x2d2 align=1 (i32.const 0))) + (local.set 0x2d3 (i64.load offset=0x2d3 align=1 (i32.const 0))) + (local.set 0x2d4 (i64.load offset=0x2d4 align=1 (i32.const 0))) + (local.set 0x2d5 (i64.load offset=0x2d5 align=1 (i32.const 0))) + (local.set 0x2d6 (i64.load offset=0x2d6 align=1 (i32.const 0))) + (local.set 0x2d7 (i64.load offset=0x2d7 align=1 (i32.const 0))) + (local.set 0x2d8 (i64.load offset=0x2d8 align=1 (i32.const 0))) + (local.set 0x2d9 (i64.load offset=0x2d9 align=1 (i32.const 0))) + (local.set 0x2da (i64.load offset=0x2da align=1 (i32.const 0))) + (local.set 0x2db (i64.load offset=0x2db align=1 (i32.const 0))) + (local.set 0x2dc (i64.load offset=0x2dc align=1 (i32.const 0))) + (local.set 0x2dd (i64.load offset=0x2dd align=1 (i32.const 0))) + (local.set 0x2de (i64.load offset=0x2de align=1 (i32.const 0))) + (local.set 0x2df (i64.load offset=0x2df align=1 (i32.const 0))) + (local.set 0x2e0 (i64.load offset=0x2e0 align=1 (i32.const 0))) + (local.set 0x2e1 (i64.load offset=0x2e1 align=1 (i32.const 0))) + (local.set 0x2e2 (i64.load offset=0x2e2 align=1 (i32.const 0))) + (local.set 0x2e3 (i64.load offset=0x2e3 align=1 (i32.const 0))) + (local.set 0x2e4 (i64.load offset=0x2e4 align=1 (i32.const 0))) + (local.set 0x2e5 (i64.load offset=0x2e5 align=1 (i32.const 0))) + (local.set 0x2e6 (i64.load offset=0x2e6 align=1 (i32.const 0))) + (local.set 0x2e7 (i64.load offset=0x2e7 align=1 (i32.const 0))) + (local.set 0x2e8 (i64.load offset=0x2e8 align=1 (i32.const 0))) + (local.set 0x2e9 (i64.load offset=0x2e9 align=1 (i32.const 0))) + (local.set 0x2ea (i64.load offset=0x2ea align=1 (i32.const 0))) + (local.set 0x2eb (i64.load offset=0x2eb align=1 (i32.const 0))) + (local.set 0x2ec (i64.load offset=0x2ec align=1 (i32.const 0))) + (local.set 0x2ed (i64.load offset=0x2ed align=1 (i32.const 0))) + (local.set 0x2ee (i64.load offset=0x2ee align=1 (i32.const 0))) + (local.set 0x2ef (i64.load offset=0x2ef align=1 (i32.const 0))) + (local.set 0x2f0 (i64.load offset=0x2f0 align=1 (i32.const 0))) + (local.set 0x2f1 (i64.load offset=0x2f1 align=1 (i32.const 0))) + (local.set 0x2f2 (i64.load offset=0x2f2 align=1 (i32.const 0))) + (local.set 0x2f3 (i64.load offset=0x2f3 align=1 (i32.const 0))) + (local.set 0x2f4 (i64.load offset=0x2f4 align=1 (i32.const 0))) + (local.set 0x2f5 (i64.load offset=0x2f5 align=1 (i32.const 0))) + (local.set 0x2f6 (i64.load offset=0x2f6 align=1 (i32.const 0))) + (local.set 0x2f7 (i64.load offset=0x2f7 align=1 (i32.const 0))) + (local.set 0x2f8 (i64.load offset=0x2f8 align=1 (i32.const 0))) + (local.set 0x2f9 (i64.load offset=0x2f9 align=1 (i32.const 0))) + (local.set 0x2fa (i64.load offset=0x2fa align=1 (i32.const 0))) + (local.set 0x2fb (i64.load offset=0x2fb align=1 (i32.const 0))) + (local.set 0x2fc (i64.load offset=0x2fc align=1 (i32.const 0))) + (local.set 0x2fd (i64.load offset=0x2fd align=1 (i32.const 0))) + (local.set 0x2fe (i64.load offset=0x2fe align=1 (i32.const 0))) + (local.set 0x2ff (i64.load offset=0x2ff align=1 (i32.const 0))) + (local.set 0x300 (i64.load offset=0x300 align=1 (i32.const 0))) + (local.set 0x301 (i64.load offset=0x301 align=1 (i32.const 0))) + (local.set 0x302 (i64.load offset=0x302 align=1 (i32.const 0))) + (local.set 0x303 (i64.load offset=0x303 align=1 (i32.const 0))) + (local.set 0x304 (i64.load offset=0x304 align=1 (i32.const 0))) + (local.set 0x305 (i64.load offset=0x305 align=1 (i32.const 0))) + (local.set 0x306 (i64.load offset=0x306 align=1 (i32.const 0))) + (local.set 0x307 (i64.load offset=0x307 align=1 (i32.const 0))) + (local.set 0x308 (i64.load offset=0x308 align=1 (i32.const 0))) + (local.set 0x309 (i64.load offset=0x309 align=1 (i32.const 0))) + (local.set 0x30a (i64.load offset=0x30a align=1 (i32.const 0))) + (local.set 0x30b (i64.load offset=0x30b align=1 (i32.const 0))) + (local.set 0x30c (i64.load offset=0x30c align=1 (i32.const 0))) + (local.set 0x30d (i64.load offset=0x30d align=1 (i32.const 0))) + (local.set 0x30e (i64.load offset=0x30e align=1 (i32.const 0))) + (local.set 0x30f (i64.load offset=0x30f align=1 (i32.const 0))) + (local.set 0x310 (i64.load offset=0x310 align=1 (i32.const 0))) + (local.set 0x311 (i64.load offset=0x311 align=1 (i32.const 0))) + (local.set 0x312 (i64.load offset=0x312 align=1 (i32.const 0))) + (local.set 0x313 (i64.load offset=0x313 align=1 (i32.const 0))) + (local.set 0x314 (i64.load offset=0x314 align=1 (i32.const 0))) + (local.set 0x315 (i64.load offset=0x315 align=1 (i32.const 0))) + (local.set 0x316 (i64.load offset=0x316 align=1 (i32.const 0))) + (local.set 0x317 (i64.load offset=0x317 align=1 (i32.const 0))) + (local.set 0x318 (i64.load offset=0x318 align=1 (i32.const 0))) + (local.set 0x319 (i64.load offset=0x319 align=1 (i32.const 0))) + (local.set 0x31a (i64.load offset=0x31a align=1 (i32.const 0))) + (local.set 0x31b (i64.load offset=0x31b align=1 (i32.const 0))) + (local.set 0x31c (i64.load offset=0x31c align=1 (i32.const 0))) + (local.set 0x31d (i64.load offset=0x31d align=1 (i32.const 0))) + (local.set 0x31e (i64.load offset=0x31e align=1 (i32.const 0))) + (local.set 0x31f (i64.load offset=0x31f align=1 (i32.const 0))) + (local.set 0x320 (i64.load offset=0x320 align=1 (i32.const 0))) + (local.set 0x321 (i64.load offset=0x321 align=1 (i32.const 0))) + (local.set 0x322 (i64.load offset=0x322 align=1 (i32.const 0))) + (local.set 0x323 (i64.load offset=0x323 align=1 (i32.const 0))) + (local.set 0x324 (i64.load offset=0x324 align=1 (i32.const 0))) + (local.set 0x325 (i64.load offset=0x325 align=1 (i32.const 0))) + (local.set 0x326 (i64.load offset=0x326 align=1 (i32.const 0))) + (local.set 0x327 (i64.load offset=0x327 align=1 (i32.const 0))) + (local.set 0x328 (i64.load offset=0x328 align=1 (i32.const 0))) + (local.set 0x329 (i64.load offset=0x329 align=1 (i32.const 0))) + (local.set 0x32a (i64.load offset=0x32a align=1 (i32.const 0))) + (local.set 0x32b (i64.load offset=0x32b align=1 (i32.const 0))) + (local.set 0x32c (i64.load offset=0x32c align=1 (i32.const 0))) + (local.set 0x32d (i64.load offset=0x32d align=1 (i32.const 0))) + (local.set 0x32e (i64.load offset=0x32e align=1 (i32.const 0))) + (local.set 0x32f (i64.load offset=0x32f align=1 (i32.const 0))) + (local.set 0x330 (i64.load offset=0x330 align=1 (i32.const 0))) + (local.set 0x331 (i64.load offset=0x331 align=1 (i32.const 0))) + (local.set 0x332 (i64.load offset=0x332 align=1 (i32.const 0))) + (local.set 0x333 (i64.load offset=0x333 align=1 (i32.const 0))) + (local.set 0x334 (i64.load offset=0x334 align=1 (i32.const 0))) + (local.set 0x335 (i64.load offset=0x335 align=1 (i32.const 0))) + (local.set 0x336 (i64.load offset=0x336 align=1 (i32.const 0))) + (local.set 0x337 (i64.load offset=0x337 align=1 (i32.const 0))) + (local.set 0x338 (i64.load offset=0x338 align=1 (i32.const 0))) + (local.set 0x339 (i64.load offset=0x339 align=1 (i32.const 0))) + (local.set 0x33a (i64.load offset=0x33a align=1 (i32.const 0))) + (local.set 0x33b (i64.load offset=0x33b align=1 (i32.const 0))) + (local.set 0x33c (i64.load offset=0x33c align=1 (i32.const 0))) + (local.set 0x33d (i64.load offset=0x33d align=1 (i32.const 0))) + (local.set 0x33e (i64.load offset=0x33e align=1 (i32.const 0))) + (local.set 0x33f (i64.load offset=0x33f align=1 (i32.const 0))) + (local.set 0x340 (i64.load offset=0x340 align=1 (i32.const 0))) + (local.set 0x341 (i64.load offset=0x341 align=1 (i32.const 0))) + (local.set 0x342 (i64.load offset=0x342 align=1 (i32.const 0))) + (local.set 0x343 (i64.load offset=0x343 align=1 (i32.const 0))) + (local.set 0x344 (i64.load offset=0x344 align=1 (i32.const 0))) + (local.set 0x345 (i64.load offset=0x345 align=1 (i32.const 0))) + (local.set 0x346 (i64.load offset=0x346 align=1 (i32.const 0))) + (local.set 0x347 (i64.load offset=0x347 align=1 (i32.const 0))) + (local.set 0x348 (i64.load offset=0x348 align=1 (i32.const 0))) + (local.set 0x349 (i64.load offset=0x349 align=1 (i32.const 0))) + (local.set 0x34a (i64.load offset=0x34a align=1 (i32.const 0))) + (local.set 0x34b (i64.load offset=0x34b align=1 (i32.const 0))) + (local.set 0x34c (i64.load offset=0x34c align=1 (i32.const 0))) + (local.set 0x34d (i64.load offset=0x34d align=1 (i32.const 0))) + (local.set 0x34e (i64.load offset=0x34e align=1 (i32.const 0))) + (local.set 0x34f (i64.load offset=0x34f align=1 (i32.const 0))) + (local.set 0x350 (i64.load offset=0x350 align=1 (i32.const 0))) + (local.set 0x351 (i64.load offset=0x351 align=1 (i32.const 0))) + (local.set 0x352 (i64.load offset=0x352 align=1 (i32.const 0))) + (local.set 0x353 (i64.load offset=0x353 align=1 (i32.const 0))) + (local.set 0x354 (i64.load offset=0x354 align=1 (i32.const 0))) + (local.set 0x355 (i64.load offset=0x355 align=1 (i32.const 0))) + (local.set 0x356 (i64.load offset=0x356 align=1 (i32.const 0))) + (local.set 0x357 (i64.load offset=0x357 align=1 (i32.const 0))) + (local.set 0x358 (i64.load offset=0x358 align=1 (i32.const 0))) + (local.set 0x359 (i64.load offset=0x359 align=1 (i32.const 0))) + (local.set 0x35a (i64.load offset=0x35a align=1 (i32.const 0))) + (local.set 0x35b (i64.load offset=0x35b align=1 (i32.const 0))) + (local.set 0x35c (i64.load offset=0x35c align=1 (i32.const 0))) + (local.set 0x35d (i64.load offset=0x35d align=1 (i32.const 0))) + (local.set 0x35e (i64.load offset=0x35e align=1 (i32.const 0))) + (local.set 0x35f (i64.load offset=0x35f align=1 (i32.const 0))) + (local.set 0x360 (i64.load offset=0x360 align=1 (i32.const 0))) + (local.set 0x361 (i64.load offset=0x361 align=1 (i32.const 0))) + (local.set 0x362 (i64.load offset=0x362 align=1 (i32.const 0))) + (local.set 0x363 (i64.load offset=0x363 align=1 (i32.const 0))) + (local.set 0x364 (i64.load offset=0x364 align=1 (i32.const 0))) + (local.set 0x365 (i64.load offset=0x365 align=1 (i32.const 0))) + (local.set 0x366 (i64.load offset=0x366 align=1 (i32.const 0))) + (local.set 0x367 (i64.load offset=0x367 align=1 (i32.const 0))) + (local.set 0x368 (i64.load offset=0x368 align=1 (i32.const 0))) + (local.set 0x369 (i64.load offset=0x369 align=1 (i32.const 0))) + (local.set 0x36a (i64.load offset=0x36a align=1 (i32.const 0))) + (local.set 0x36b (i64.load offset=0x36b align=1 (i32.const 0))) + (local.set 0x36c (i64.load offset=0x36c align=1 (i32.const 0))) + (local.set 0x36d (i64.load offset=0x36d align=1 (i32.const 0))) + (local.set 0x36e (i64.load offset=0x36e align=1 (i32.const 0))) + (local.set 0x36f (i64.load offset=0x36f align=1 (i32.const 0))) + (local.set 0x370 (i64.load offset=0x370 align=1 (i32.const 0))) + (local.set 0x371 (i64.load offset=0x371 align=1 (i32.const 0))) + (local.set 0x372 (i64.load offset=0x372 align=1 (i32.const 0))) + (local.set 0x373 (i64.load offset=0x373 align=1 (i32.const 0))) + (local.set 0x374 (i64.load offset=0x374 align=1 (i32.const 0))) + (local.set 0x375 (i64.load offset=0x375 align=1 (i32.const 0))) + (local.set 0x376 (i64.load offset=0x376 align=1 (i32.const 0))) + (local.set 0x377 (i64.load offset=0x377 align=1 (i32.const 0))) + (local.set 0x378 (i64.load offset=0x378 align=1 (i32.const 0))) + (local.set 0x379 (i64.load offset=0x379 align=1 (i32.const 0))) + (local.set 0x37a (i64.load offset=0x37a align=1 (i32.const 0))) + (local.set 0x37b (i64.load offset=0x37b align=1 (i32.const 0))) + (local.set 0x37c (i64.load offset=0x37c align=1 (i32.const 0))) + (local.set 0x37d (i64.load offset=0x37d align=1 (i32.const 0))) + (local.set 0x37e (i64.load offset=0x37e align=1 (i32.const 0))) + (local.set 0x37f (i64.load offset=0x37f align=1 (i32.const 0))) + (local.set 0x380 (i64.load offset=0x380 align=1 (i32.const 0))) + (local.set 0x381 (i64.load offset=0x381 align=1 (i32.const 0))) + (local.set 0x382 (i64.load offset=0x382 align=1 (i32.const 0))) + (local.set 0x383 (i64.load offset=0x383 align=1 (i32.const 0))) + (local.set 0x384 (i64.load offset=0x384 align=1 (i32.const 0))) + (local.set 0x385 (i64.load offset=0x385 align=1 (i32.const 0))) + (local.set 0x386 (i64.load offset=0x386 align=1 (i32.const 0))) + (local.set 0x387 (i64.load offset=0x387 align=1 (i32.const 0))) + (local.set 0x388 (i64.load offset=0x388 align=1 (i32.const 0))) + (local.set 0x389 (i64.load offset=0x389 align=1 (i32.const 0))) + (local.set 0x38a (i64.load offset=0x38a align=1 (i32.const 0))) + (local.set 0x38b (i64.load offset=0x38b align=1 (i32.const 0))) + (local.set 0x38c (i64.load offset=0x38c align=1 (i32.const 0))) + (local.set 0x38d (i64.load offset=0x38d align=1 (i32.const 0))) + (local.set 0x38e (i64.load offset=0x38e align=1 (i32.const 0))) + (local.set 0x38f (i64.load offset=0x38f align=1 (i32.const 0))) + (local.set 0x390 (i64.load offset=0x390 align=1 (i32.const 0))) + (local.set 0x391 (i64.load offset=0x391 align=1 (i32.const 0))) + (local.set 0x392 (i64.load offset=0x392 align=1 (i32.const 0))) + (local.set 0x393 (i64.load offset=0x393 align=1 (i32.const 0))) + (local.set 0x394 (i64.load offset=0x394 align=1 (i32.const 0))) + (local.set 0x395 (i64.load offset=0x395 align=1 (i32.const 0))) + (local.set 0x396 (i64.load offset=0x396 align=1 (i32.const 0))) + (local.set 0x397 (i64.load offset=0x397 align=1 (i32.const 0))) + (local.set 0x398 (i64.load offset=0x398 align=1 (i32.const 0))) + (local.set 0x399 (i64.load offset=0x399 align=1 (i32.const 0))) + (local.set 0x39a (i64.load offset=0x39a align=1 (i32.const 0))) + (local.set 0x39b (i64.load offset=0x39b align=1 (i32.const 0))) + (local.set 0x39c (i64.load offset=0x39c align=1 (i32.const 0))) + (local.set 0x39d (i64.load offset=0x39d align=1 (i32.const 0))) + (local.set 0x39e (i64.load offset=0x39e align=1 (i32.const 0))) + (local.set 0x39f (i64.load offset=0x39f align=1 (i32.const 0))) + (local.set 0x3a0 (i64.load offset=0x3a0 align=1 (i32.const 0))) + (local.set 0x3a1 (i64.load offset=0x3a1 align=1 (i32.const 0))) + (local.set 0x3a2 (i64.load offset=0x3a2 align=1 (i32.const 0))) + (local.set 0x3a3 (i64.load offset=0x3a3 align=1 (i32.const 0))) + (local.set 0x3a4 (i64.load offset=0x3a4 align=1 (i32.const 0))) + (local.set 0x3a5 (i64.load offset=0x3a5 align=1 (i32.const 0))) + (local.set 0x3a6 (i64.load offset=0x3a6 align=1 (i32.const 0))) + (local.set 0x3a7 (i64.load offset=0x3a7 align=1 (i32.const 0))) + (local.set 0x3a8 (i64.load offset=0x3a8 align=1 (i32.const 0))) + (local.set 0x3a9 (i64.load offset=0x3a9 align=1 (i32.const 0))) + (local.set 0x3aa (i64.load offset=0x3aa align=1 (i32.const 0))) + (local.set 0x3ab (i64.load offset=0x3ab align=1 (i32.const 0))) + (local.set 0x3ac (i64.load offset=0x3ac align=1 (i32.const 0))) + (local.set 0x3ad (i64.load offset=0x3ad align=1 (i32.const 0))) + (local.set 0x3ae (i64.load offset=0x3ae align=1 (i32.const 0))) + (local.set 0x3af (i64.load offset=0x3af align=1 (i32.const 0))) + (local.set 0x3b0 (i64.load offset=0x3b0 align=1 (i32.const 0))) + (local.set 0x3b1 (i64.load offset=0x3b1 align=1 (i32.const 0))) + (local.set 0x3b2 (i64.load offset=0x3b2 align=1 (i32.const 0))) + (local.set 0x3b3 (i64.load offset=0x3b3 align=1 (i32.const 0))) + (local.set 0x3b4 (i64.load offset=0x3b4 align=1 (i32.const 0))) + (local.set 0x3b5 (i64.load offset=0x3b5 align=1 (i32.const 0))) + (local.set 0x3b6 (i64.load offset=0x3b6 align=1 (i32.const 0))) + (local.set 0x3b7 (i64.load offset=0x3b7 align=1 (i32.const 0))) + (local.set 0x3b8 (i64.load offset=0x3b8 align=1 (i32.const 0))) + (local.set 0x3b9 (i64.load offset=0x3b9 align=1 (i32.const 0))) + (local.set 0x3ba (i64.load offset=0x3ba align=1 (i32.const 0))) + (local.set 0x3bb (i64.load offset=0x3bb align=1 (i32.const 0))) + (local.set 0x3bc (i64.load offset=0x3bc align=1 (i32.const 0))) + (local.set 0x3bd (i64.load offset=0x3bd align=1 (i32.const 0))) + (local.set 0x3be (i64.load offset=0x3be align=1 (i32.const 0))) + (local.set 0x3bf (i64.load offset=0x3bf align=1 (i32.const 0))) + (local.set 0x3c0 (i64.load offset=0x3c0 align=1 (i32.const 0))) + (local.set 0x3c1 (i64.load offset=0x3c1 align=1 (i32.const 0))) + (local.set 0x3c2 (i64.load offset=0x3c2 align=1 (i32.const 0))) + (local.set 0x3c3 (i64.load offset=0x3c3 align=1 (i32.const 0))) + (local.set 0x3c4 (i64.load offset=0x3c4 align=1 (i32.const 0))) + (local.set 0x3c5 (i64.load offset=0x3c5 align=1 (i32.const 0))) + (local.set 0x3c6 (i64.load offset=0x3c6 align=1 (i32.const 0))) + (local.set 0x3c7 (i64.load offset=0x3c7 align=1 (i32.const 0))) + (local.set 0x3c8 (i64.load offset=0x3c8 align=1 (i32.const 0))) + (local.set 0x3c9 (i64.load offset=0x3c9 align=1 (i32.const 0))) + (local.set 0x3ca (i64.load offset=0x3ca align=1 (i32.const 0))) + (local.set 0x3cb (i64.load offset=0x3cb align=1 (i32.const 0))) + (local.set 0x3cc (i64.load offset=0x3cc align=1 (i32.const 0))) + (local.set 0x3cd (i64.load offset=0x3cd align=1 (i32.const 0))) + (local.set 0x3ce (i64.load offset=0x3ce align=1 (i32.const 0))) + (local.set 0x3cf (i64.load offset=0x3cf align=1 (i32.const 0))) + (local.set 0x3d0 (i64.load offset=0x3d0 align=1 (i32.const 0))) + (local.set 0x3d1 (i64.load offset=0x3d1 align=1 (i32.const 0))) + (local.set 0x3d2 (i64.load offset=0x3d2 align=1 (i32.const 0))) + (local.set 0x3d3 (i64.load offset=0x3d3 align=1 (i32.const 0))) + (local.set 0x3d4 (i64.load offset=0x3d4 align=1 (i32.const 0))) + (local.set 0x3d5 (i64.load offset=0x3d5 align=1 (i32.const 0))) + (local.set 0x3d6 (i64.load offset=0x3d6 align=1 (i32.const 0))) + (local.set 0x3d7 (i64.load offset=0x3d7 align=1 (i32.const 0))) + (local.set 0x3d8 (i64.load offset=0x3d8 align=1 (i32.const 0))) + (local.set 0x3d9 (i64.load offset=0x3d9 align=1 (i32.const 0))) + (local.set 0x3da (i64.load offset=0x3da align=1 (i32.const 0))) + (local.set 0x3db (i64.load offset=0x3db align=1 (i32.const 0))) + (local.set 0x3dc (i64.load offset=0x3dc align=1 (i32.const 0))) + (local.set 0x3dd (i64.load offset=0x3dd align=1 (i32.const 0))) + (local.set 0x3de (i64.load offset=0x3de align=1 (i32.const 0))) + (local.set 0x3df (i64.load offset=0x3df align=1 (i32.const 0))) + (local.set 0x3e0 (i64.load offset=0x3e0 align=1 (i32.const 0))) + (local.set 0x3e1 (i64.load offset=0x3e1 align=1 (i32.const 0))) + (local.set 0x3e2 (i64.load offset=0x3e2 align=1 (i32.const 0))) + (local.set 0x3e3 (i64.load offset=0x3e3 align=1 (i32.const 0))) + (local.set 0x3e4 (i64.load offset=0x3e4 align=1 (i32.const 0))) + (local.set 0x3e5 (i64.load offset=0x3e5 align=1 (i32.const 0))) + (local.set 0x3e6 (i64.load offset=0x3e6 align=1 (i32.const 0))) + (local.set 0x3e7 (i64.load offset=0x3e7 align=1 (i32.const 0))) + (local.set 0x3e8 (i64.load offset=0x3e8 align=1 (i32.const 0))) + (local.set 0x3e9 (i64.load offset=0x3e9 align=1 (i32.const 0))) + (local.set 0x3ea (i64.load offset=0x3ea align=1 (i32.const 0))) + (local.set 0x3eb (i64.load offset=0x3eb align=1 (i32.const 0))) + (local.set 0x3ec (i64.load offset=0x3ec align=1 (i32.const 0))) + (local.set 0x3ed (i64.load offset=0x3ed align=1 (i32.const 0))) + (local.set 0x3ee (i64.load offset=0x3ee align=1 (i32.const 0))) + (local.set 0x3ef (i64.load offset=0x3ef align=1 (i32.const 0))) + (local.set 0x3f0 (i64.load offset=0x3f0 align=1 (i32.const 0))) + (local.set 0x3f1 (i64.load offset=0x3f1 align=1 (i32.const 0))) + (local.set 0x3f2 (i64.load offset=0x3f2 align=1 (i32.const 0))) + (local.set 0x3f3 (i64.load offset=0x3f3 align=1 (i32.const 0))) + (local.set 0x3f4 (i64.load offset=0x3f4 align=1 (i32.const 0))) + (local.set 0x3f5 (i64.load offset=0x3f5 align=1 (i32.const 0))) + (local.set 0x3f6 (i64.load offset=0x3f6 align=1 (i32.const 0))) + (local.set 0x3f7 (i64.load offset=0x3f7 align=1 (i32.const 0))) + (local.set 0x3f8 (i64.load offset=0x3f8 align=1 (i32.const 0))) + (local.set 0x3f9 (i64.load offset=0x3f9 align=1 (i32.const 0))) + (local.set 0x3fa (i64.load offset=0x3fa align=1 (i32.const 0))) + (local.set 0x3fb (i64.load offset=0x3fb align=1 (i32.const 0))) + (local.set 0x3fc (i64.load offset=0x3fc align=1 (i32.const 0))) + (local.set 0x3fd (i64.load offset=0x3fd align=1 (i32.const 0))) + (local.set 0x3fe (i64.load offset=0x3fe align=1 (i32.const 0))) + (local.set 0x3ff (i64.load offset=0x3ff align=1 (i32.const 0))) + (local.set 0x400 (i64.load offset=0x400 align=1 (i32.const 0))) + (local.set 0x401 (i64.load offset=0x401 align=1 (i32.const 0))) + (local.set 0x402 (i64.load offset=0x402 align=1 (i32.const 0))) + (local.set 0x403 (i64.load offset=0x403 align=1 (i32.const 0))) + (local.set 0x404 (i64.load offset=0x404 align=1 (i32.const 0))) + (local.set 0x405 (i64.load offset=0x405 align=1 (i32.const 0))) + (local.set 0x406 (i64.load offset=0x406 align=1 (i32.const 0))) + (local.set 0x407 (i64.load offset=0x407 align=1 (i32.const 0))) + (local.set 0x408 (i64.load offset=0x408 align=1 (i32.const 0))) + (local.set 0x409 (i64.load offset=0x409 align=1 (i32.const 0))) + (local.set 0x40a (i64.load offset=0x40a align=1 (i32.const 0))) + (local.set 0x40b (i64.load offset=0x40b align=1 (i32.const 0))) + (local.set 0x40c (i64.load offset=0x40c align=1 (i32.const 0))) + (local.set 0x40d (i64.load offset=0x40d align=1 (i32.const 0))) + (local.set 0x40e (i64.load offset=0x40e align=1 (i32.const 0))) + (local.set 0x40f (i64.load offset=0x40f align=1 (i32.const 0))) + (local.set 0x410 (i64.load offset=0x410 align=1 (i32.const 0))) + (local.set 0x411 (i64.load offset=0x411 align=1 (i32.const 0))) + (local.set 0x412 (i64.load offset=0x412 align=1 (i32.const 0))) + (local.set 0x413 (i64.load offset=0x413 align=1 (i32.const 0))) + (local.set 0x414 (i64.load offset=0x414 align=1 (i32.const 0))) + (local.set 0x415 (i64.load offset=0x415 align=1 (i32.const 0))) + (local.set 0x416 (i64.load offset=0x416 align=1 (i32.const 0))) + (local.set 0x417 (i64.load offset=0x417 align=1 (i32.const 0))) + (local.set 0x418 (i64.load offset=0x418 align=1 (i32.const 0))) + (local.set 0x419 (i64.load offset=0x419 align=1 (i32.const 0))) + (local.set 0x41a (i64.load offset=0x41a align=1 (i32.const 0))) + (local.set 0x41b (i64.load offset=0x41b align=1 (i32.const 0))) + (local.set 0x41c (i64.load offset=0x41c align=1 (i32.const 0))) + (local.set 0x41d (i64.load offset=0x41d align=1 (i32.const 0))) + (local.set 0x41e (i64.load offset=0x41e align=1 (i32.const 0))) + (local.set 0x41f (i64.load offset=0x41f align=1 (i32.const 0))) ;; store the locals back to memory - (i64.store offset=0x000 align=1 (i32.const 0) (get_local 0x000)) - (i64.store offset=0x001 align=1 (i32.const 0) (get_local 0x001)) - (i64.store offset=0x002 align=1 (i32.const 0) (get_local 0x002)) - (i64.store offset=0x003 align=1 (i32.const 0) (get_local 0x003)) - (i64.store offset=0x004 align=1 (i32.const 0) (get_local 0x004)) - (i64.store offset=0x005 align=1 (i32.const 0) (get_local 0x005)) - (i64.store offset=0x006 align=1 (i32.const 0) (get_local 0x006)) - (i64.store offset=0x007 align=1 (i32.const 0) (get_local 0x007)) - (i64.store offset=0x008 align=1 (i32.const 0) (get_local 0x008)) - (i64.store offset=0x009 align=1 (i32.const 0) (get_local 0x009)) - (i64.store offset=0x00a align=1 (i32.const 0) (get_local 0x00a)) - (i64.store offset=0x00b align=1 (i32.const 0) (get_local 0x00b)) - (i64.store offset=0x00c align=1 (i32.const 0) (get_local 0x00c)) - (i64.store offset=0x00d align=1 (i32.const 0) (get_local 0x00d)) - (i64.store offset=0x00e align=1 (i32.const 0) (get_local 0x00e)) - (i64.store offset=0x00f align=1 (i32.const 0) (get_local 0x00f)) - (i64.store offset=0x010 align=1 (i32.const 0) (get_local 0x010)) - (i64.store offset=0x011 align=1 (i32.const 0) (get_local 0x011)) - (i64.store offset=0x012 align=1 (i32.const 0) (get_local 0x012)) - (i64.store offset=0x013 align=1 (i32.const 0) (get_local 0x013)) - (i64.store offset=0x014 align=1 (i32.const 0) (get_local 0x014)) - (i64.store offset=0x015 align=1 (i32.const 0) (get_local 0x015)) - (i64.store offset=0x016 align=1 (i32.const 0) (get_local 0x016)) - (i64.store offset=0x017 align=1 (i32.const 0) (get_local 0x017)) - (i64.store offset=0x018 align=1 (i32.const 0) (get_local 0x018)) - (i64.store offset=0x019 align=1 (i32.const 0) (get_local 0x019)) - (i64.store offset=0x01a align=1 (i32.const 0) (get_local 0x01a)) - (i64.store offset=0x01b align=1 (i32.const 0) (get_local 0x01b)) - (i64.store offset=0x01c align=1 (i32.const 0) (get_local 0x01c)) - (i64.store offset=0x01d align=1 (i32.const 0) (get_local 0x01d)) - (i64.store offset=0x01e align=1 (i32.const 0) (get_local 0x01e)) - (i64.store offset=0x01f align=1 (i32.const 0) (get_local 0x01f)) - (i64.store offset=0x020 align=1 (i32.const 0) (get_local 0x020)) - (i64.store offset=0x021 align=1 (i32.const 0) (get_local 0x021)) - (i64.store offset=0x022 align=1 (i32.const 0) (get_local 0x022)) - (i64.store offset=0x023 align=1 (i32.const 0) (get_local 0x023)) - (i64.store offset=0x024 align=1 (i32.const 0) (get_local 0x024)) - (i64.store offset=0x025 align=1 (i32.const 0) (get_local 0x025)) - (i64.store offset=0x026 align=1 (i32.const 0) (get_local 0x026)) - (i64.store offset=0x027 align=1 (i32.const 0) (get_local 0x027)) - (i64.store offset=0x028 align=1 (i32.const 0) (get_local 0x028)) - (i64.store offset=0x029 align=1 (i32.const 0) (get_local 0x029)) - (i64.store offset=0x02a align=1 (i32.const 0) (get_local 0x02a)) - (i64.store offset=0x02b align=1 (i32.const 0) (get_local 0x02b)) - (i64.store offset=0x02c align=1 (i32.const 0) (get_local 0x02c)) - (i64.store offset=0x02d align=1 (i32.const 0) (get_local 0x02d)) - (i64.store offset=0x02e align=1 (i32.const 0) (get_local 0x02e)) - (i64.store offset=0x02f align=1 (i32.const 0) (get_local 0x02f)) - (i64.store offset=0x030 align=1 (i32.const 0) (get_local 0x030)) - (i64.store offset=0x031 align=1 (i32.const 0) (get_local 0x031)) - (i64.store offset=0x032 align=1 (i32.const 0) (get_local 0x032)) - (i64.store offset=0x033 align=1 (i32.const 0) (get_local 0x033)) - (i64.store offset=0x034 align=1 (i32.const 0) (get_local 0x034)) - (i64.store offset=0x035 align=1 (i32.const 0) (get_local 0x035)) - (i64.store offset=0x036 align=1 (i32.const 0) (get_local 0x036)) - (i64.store offset=0x037 align=1 (i32.const 0) (get_local 0x037)) - (i64.store offset=0x038 align=1 (i32.const 0) (get_local 0x038)) - (i64.store offset=0x039 align=1 (i32.const 0) (get_local 0x039)) - (i64.store offset=0x03a align=1 (i32.const 0) (get_local 0x03a)) - (i64.store offset=0x03b align=1 (i32.const 0) (get_local 0x03b)) - (i64.store offset=0x03c align=1 (i32.const 0) (get_local 0x03c)) - (i64.store offset=0x03d align=1 (i32.const 0) (get_local 0x03d)) - (i64.store offset=0x03e align=1 (i32.const 0) (get_local 0x03e)) - (i64.store offset=0x03f align=1 (i32.const 0) (get_local 0x03f)) - (i64.store offset=0x040 align=1 (i32.const 0) (get_local 0x040)) - (i64.store offset=0x041 align=1 (i32.const 0) (get_local 0x041)) - (i64.store offset=0x042 align=1 (i32.const 0) (get_local 0x042)) - (i64.store offset=0x043 align=1 (i32.const 0) (get_local 0x043)) - (i64.store offset=0x044 align=1 (i32.const 0) (get_local 0x044)) - (i64.store offset=0x045 align=1 (i32.const 0) (get_local 0x045)) - (i64.store offset=0x046 align=1 (i32.const 0) (get_local 0x046)) - (i64.store offset=0x047 align=1 (i32.const 0) (get_local 0x047)) - (i64.store offset=0x048 align=1 (i32.const 0) (get_local 0x048)) - (i64.store offset=0x049 align=1 (i32.const 0) (get_local 0x049)) - (i64.store offset=0x04a align=1 (i32.const 0) (get_local 0x04a)) - (i64.store offset=0x04b align=1 (i32.const 0) (get_local 0x04b)) - (i64.store offset=0x04c align=1 (i32.const 0) (get_local 0x04c)) - (i64.store offset=0x04d align=1 (i32.const 0) (get_local 0x04d)) - (i64.store offset=0x04e align=1 (i32.const 0) (get_local 0x04e)) - (i64.store offset=0x04f align=1 (i32.const 0) (get_local 0x04f)) - (i64.store offset=0x050 align=1 (i32.const 0) (get_local 0x050)) - (i64.store offset=0x051 align=1 (i32.const 0) (get_local 0x051)) - (i64.store offset=0x052 align=1 (i32.const 0) (get_local 0x052)) - (i64.store offset=0x053 align=1 (i32.const 0) (get_local 0x053)) - (i64.store offset=0x054 align=1 (i32.const 0) (get_local 0x054)) - (i64.store offset=0x055 align=1 (i32.const 0) (get_local 0x055)) - (i64.store offset=0x056 align=1 (i32.const 0) (get_local 0x056)) - (i64.store offset=0x057 align=1 (i32.const 0) (get_local 0x057)) - (i64.store offset=0x058 align=1 (i32.const 0) (get_local 0x058)) - (i64.store offset=0x059 align=1 (i32.const 0) (get_local 0x059)) - (i64.store offset=0x05a align=1 (i32.const 0) (get_local 0x05a)) - (i64.store offset=0x05b align=1 (i32.const 0) (get_local 0x05b)) - (i64.store offset=0x05c align=1 (i32.const 0) (get_local 0x05c)) - (i64.store offset=0x05d align=1 (i32.const 0) (get_local 0x05d)) - (i64.store offset=0x05e align=1 (i32.const 0) (get_local 0x05e)) - (i64.store offset=0x05f align=1 (i32.const 0) (get_local 0x05f)) - (i64.store offset=0x060 align=1 (i32.const 0) (get_local 0x060)) - (i64.store offset=0x061 align=1 (i32.const 0) (get_local 0x061)) - (i64.store offset=0x062 align=1 (i32.const 0) (get_local 0x062)) - (i64.store offset=0x063 align=1 (i32.const 0) (get_local 0x063)) - (i64.store offset=0x064 align=1 (i32.const 0) (get_local 0x064)) - (i64.store offset=0x065 align=1 (i32.const 0) (get_local 0x065)) - (i64.store offset=0x066 align=1 (i32.const 0) (get_local 0x066)) - (i64.store offset=0x067 align=1 (i32.const 0) (get_local 0x067)) - (i64.store offset=0x068 align=1 (i32.const 0) (get_local 0x068)) - (i64.store offset=0x069 align=1 (i32.const 0) (get_local 0x069)) - (i64.store offset=0x06a align=1 (i32.const 0) (get_local 0x06a)) - (i64.store offset=0x06b align=1 (i32.const 0) (get_local 0x06b)) - (i64.store offset=0x06c align=1 (i32.const 0) (get_local 0x06c)) - (i64.store offset=0x06d align=1 (i32.const 0) (get_local 0x06d)) - (i64.store offset=0x06e align=1 (i32.const 0) (get_local 0x06e)) - (i64.store offset=0x06f align=1 (i32.const 0) (get_local 0x06f)) - (i64.store offset=0x070 align=1 (i32.const 0) (get_local 0x070)) - (i64.store offset=0x071 align=1 (i32.const 0) (get_local 0x071)) - (i64.store offset=0x072 align=1 (i32.const 0) (get_local 0x072)) - (i64.store offset=0x073 align=1 (i32.const 0) (get_local 0x073)) - (i64.store offset=0x074 align=1 (i32.const 0) (get_local 0x074)) - (i64.store offset=0x075 align=1 (i32.const 0) (get_local 0x075)) - (i64.store offset=0x076 align=1 (i32.const 0) (get_local 0x076)) - (i64.store offset=0x077 align=1 (i32.const 0) (get_local 0x077)) - (i64.store offset=0x078 align=1 (i32.const 0) (get_local 0x078)) - (i64.store offset=0x079 align=1 (i32.const 0) (get_local 0x079)) - (i64.store offset=0x07a align=1 (i32.const 0) (get_local 0x07a)) - (i64.store offset=0x07b align=1 (i32.const 0) (get_local 0x07b)) - (i64.store offset=0x07c align=1 (i32.const 0) (get_local 0x07c)) - (i64.store offset=0x07d align=1 (i32.const 0) (get_local 0x07d)) - (i64.store offset=0x07e align=1 (i32.const 0) (get_local 0x07e)) - (i64.store offset=0x07f align=1 (i32.const 0) (get_local 0x07f)) - (i64.store offset=0x080 align=1 (i32.const 0) (get_local 0x080)) - (i64.store offset=0x081 align=1 (i32.const 0) (get_local 0x081)) - (i64.store offset=0x082 align=1 (i32.const 0) (get_local 0x082)) - (i64.store offset=0x083 align=1 (i32.const 0) (get_local 0x083)) - (i64.store offset=0x084 align=1 (i32.const 0) (get_local 0x084)) - (i64.store offset=0x085 align=1 (i32.const 0) (get_local 0x085)) - (i64.store offset=0x086 align=1 (i32.const 0) (get_local 0x086)) - (i64.store offset=0x087 align=1 (i32.const 0) (get_local 0x087)) - (i64.store offset=0x088 align=1 (i32.const 0) (get_local 0x088)) - (i64.store offset=0x089 align=1 (i32.const 0) (get_local 0x089)) - (i64.store offset=0x08a align=1 (i32.const 0) (get_local 0x08a)) - (i64.store offset=0x08b align=1 (i32.const 0) (get_local 0x08b)) - (i64.store offset=0x08c align=1 (i32.const 0) (get_local 0x08c)) - (i64.store offset=0x08d align=1 (i32.const 0) (get_local 0x08d)) - (i64.store offset=0x08e align=1 (i32.const 0) (get_local 0x08e)) - (i64.store offset=0x08f align=1 (i32.const 0) (get_local 0x08f)) - (i64.store offset=0x090 align=1 (i32.const 0) (get_local 0x090)) - (i64.store offset=0x091 align=1 (i32.const 0) (get_local 0x091)) - (i64.store offset=0x092 align=1 (i32.const 0) (get_local 0x092)) - (i64.store offset=0x093 align=1 (i32.const 0) (get_local 0x093)) - (i64.store offset=0x094 align=1 (i32.const 0) (get_local 0x094)) - (i64.store offset=0x095 align=1 (i32.const 0) (get_local 0x095)) - (i64.store offset=0x096 align=1 (i32.const 0) (get_local 0x096)) - (i64.store offset=0x097 align=1 (i32.const 0) (get_local 0x097)) - (i64.store offset=0x098 align=1 (i32.const 0) (get_local 0x098)) - (i64.store offset=0x099 align=1 (i32.const 0) (get_local 0x099)) - (i64.store offset=0x09a align=1 (i32.const 0) (get_local 0x09a)) - (i64.store offset=0x09b align=1 (i32.const 0) (get_local 0x09b)) - (i64.store offset=0x09c align=1 (i32.const 0) (get_local 0x09c)) - (i64.store offset=0x09d align=1 (i32.const 0) (get_local 0x09d)) - (i64.store offset=0x09e align=1 (i32.const 0) (get_local 0x09e)) - (i64.store offset=0x09f align=1 (i32.const 0) (get_local 0x09f)) - (i64.store offset=0x0a0 align=1 (i32.const 0) (get_local 0x0a0)) - (i64.store offset=0x0a1 align=1 (i32.const 0) (get_local 0x0a1)) - (i64.store offset=0x0a2 align=1 (i32.const 0) (get_local 0x0a2)) - (i64.store offset=0x0a3 align=1 (i32.const 0) (get_local 0x0a3)) - (i64.store offset=0x0a4 align=1 (i32.const 0) (get_local 0x0a4)) - (i64.store offset=0x0a5 align=1 (i32.const 0) (get_local 0x0a5)) - (i64.store offset=0x0a6 align=1 (i32.const 0) (get_local 0x0a6)) - (i64.store offset=0x0a7 align=1 (i32.const 0) (get_local 0x0a7)) - (i64.store offset=0x0a8 align=1 (i32.const 0) (get_local 0x0a8)) - (i64.store offset=0x0a9 align=1 (i32.const 0) (get_local 0x0a9)) - (i64.store offset=0x0aa align=1 (i32.const 0) (get_local 0x0aa)) - (i64.store offset=0x0ab align=1 (i32.const 0) (get_local 0x0ab)) - (i64.store offset=0x0ac align=1 (i32.const 0) (get_local 0x0ac)) - (i64.store offset=0x0ad align=1 (i32.const 0) (get_local 0x0ad)) - (i64.store offset=0x0ae align=1 (i32.const 0) (get_local 0x0ae)) - (i64.store offset=0x0af align=1 (i32.const 0) (get_local 0x0af)) - (i64.store offset=0x0b0 align=1 (i32.const 0) (get_local 0x0b0)) - (i64.store offset=0x0b1 align=1 (i32.const 0) (get_local 0x0b1)) - (i64.store offset=0x0b2 align=1 (i32.const 0) (get_local 0x0b2)) - (i64.store offset=0x0b3 align=1 (i32.const 0) (get_local 0x0b3)) - (i64.store offset=0x0b4 align=1 (i32.const 0) (get_local 0x0b4)) - (i64.store offset=0x0b5 align=1 (i32.const 0) (get_local 0x0b5)) - (i64.store offset=0x0b6 align=1 (i32.const 0) (get_local 0x0b6)) - (i64.store offset=0x0b7 align=1 (i32.const 0) (get_local 0x0b7)) - (i64.store offset=0x0b8 align=1 (i32.const 0) (get_local 0x0b8)) - (i64.store offset=0x0b9 align=1 (i32.const 0) (get_local 0x0b9)) - (i64.store offset=0x0ba align=1 (i32.const 0) (get_local 0x0ba)) - (i64.store offset=0x0bb align=1 (i32.const 0) (get_local 0x0bb)) - (i64.store offset=0x0bc align=1 (i32.const 0) (get_local 0x0bc)) - (i64.store offset=0x0bd align=1 (i32.const 0) (get_local 0x0bd)) - (i64.store offset=0x0be align=1 (i32.const 0) (get_local 0x0be)) - (i64.store offset=0x0bf align=1 (i32.const 0) (get_local 0x0bf)) - (i64.store offset=0x0c0 align=1 (i32.const 0) (get_local 0x0c0)) - (i64.store offset=0x0c1 align=1 (i32.const 0) (get_local 0x0c1)) - (i64.store offset=0x0c2 align=1 (i32.const 0) (get_local 0x0c2)) - (i64.store offset=0x0c3 align=1 (i32.const 0) (get_local 0x0c3)) - (i64.store offset=0x0c4 align=1 (i32.const 0) (get_local 0x0c4)) - (i64.store offset=0x0c5 align=1 (i32.const 0) (get_local 0x0c5)) - (i64.store offset=0x0c6 align=1 (i32.const 0) (get_local 0x0c6)) - (i64.store offset=0x0c7 align=1 (i32.const 0) (get_local 0x0c7)) - (i64.store offset=0x0c8 align=1 (i32.const 0) (get_local 0x0c8)) - (i64.store offset=0x0c9 align=1 (i32.const 0) (get_local 0x0c9)) - (i64.store offset=0x0ca align=1 (i32.const 0) (get_local 0x0ca)) - (i64.store offset=0x0cb align=1 (i32.const 0) (get_local 0x0cb)) - (i64.store offset=0x0cc align=1 (i32.const 0) (get_local 0x0cc)) - (i64.store offset=0x0cd align=1 (i32.const 0) (get_local 0x0cd)) - (i64.store offset=0x0ce align=1 (i32.const 0) (get_local 0x0ce)) - (i64.store offset=0x0cf align=1 (i32.const 0) (get_local 0x0cf)) - (i64.store offset=0x0d0 align=1 (i32.const 0) (get_local 0x0d0)) - (i64.store offset=0x0d1 align=1 (i32.const 0) (get_local 0x0d1)) - (i64.store offset=0x0d2 align=1 (i32.const 0) (get_local 0x0d2)) - (i64.store offset=0x0d3 align=1 (i32.const 0) (get_local 0x0d3)) - (i64.store offset=0x0d4 align=1 (i32.const 0) (get_local 0x0d4)) - (i64.store offset=0x0d5 align=1 (i32.const 0) (get_local 0x0d5)) - (i64.store offset=0x0d6 align=1 (i32.const 0) (get_local 0x0d6)) - (i64.store offset=0x0d7 align=1 (i32.const 0) (get_local 0x0d7)) - (i64.store offset=0x0d8 align=1 (i32.const 0) (get_local 0x0d8)) - (i64.store offset=0x0d9 align=1 (i32.const 0) (get_local 0x0d9)) - (i64.store offset=0x0da align=1 (i32.const 0) (get_local 0x0da)) - (i64.store offset=0x0db align=1 (i32.const 0) (get_local 0x0db)) - (i64.store offset=0x0dc align=1 (i32.const 0) (get_local 0x0dc)) - (i64.store offset=0x0dd align=1 (i32.const 0) (get_local 0x0dd)) - (i64.store offset=0x0de align=1 (i32.const 0) (get_local 0x0de)) - (i64.store offset=0x0df align=1 (i32.const 0) (get_local 0x0df)) - (i64.store offset=0x0e0 align=1 (i32.const 0) (get_local 0x0e0)) - (i64.store offset=0x0e1 align=1 (i32.const 0) (get_local 0x0e1)) - (i64.store offset=0x0e2 align=1 (i32.const 0) (get_local 0x0e2)) - (i64.store offset=0x0e3 align=1 (i32.const 0) (get_local 0x0e3)) - (i64.store offset=0x0e4 align=1 (i32.const 0) (get_local 0x0e4)) - (i64.store offset=0x0e5 align=1 (i32.const 0) (get_local 0x0e5)) - (i64.store offset=0x0e6 align=1 (i32.const 0) (get_local 0x0e6)) - (i64.store offset=0x0e7 align=1 (i32.const 0) (get_local 0x0e7)) - (i64.store offset=0x0e8 align=1 (i32.const 0) (get_local 0x0e8)) - (i64.store offset=0x0e9 align=1 (i32.const 0) (get_local 0x0e9)) - (i64.store offset=0x0ea align=1 (i32.const 0) (get_local 0x0ea)) - (i64.store offset=0x0eb align=1 (i32.const 0) (get_local 0x0eb)) - (i64.store offset=0x0ec align=1 (i32.const 0) (get_local 0x0ec)) - (i64.store offset=0x0ed align=1 (i32.const 0) (get_local 0x0ed)) - (i64.store offset=0x0ee align=1 (i32.const 0) (get_local 0x0ee)) - (i64.store offset=0x0ef align=1 (i32.const 0) (get_local 0x0ef)) - (i64.store offset=0x0f0 align=1 (i32.const 0) (get_local 0x0f0)) - (i64.store offset=0x0f1 align=1 (i32.const 0) (get_local 0x0f1)) - (i64.store offset=0x0f2 align=1 (i32.const 0) (get_local 0x0f2)) - (i64.store offset=0x0f3 align=1 (i32.const 0) (get_local 0x0f3)) - (i64.store offset=0x0f4 align=1 (i32.const 0) (get_local 0x0f4)) - (i64.store offset=0x0f5 align=1 (i32.const 0) (get_local 0x0f5)) - (i64.store offset=0x0f6 align=1 (i32.const 0) (get_local 0x0f6)) - (i64.store offset=0x0f7 align=1 (i32.const 0) (get_local 0x0f7)) - (i64.store offset=0x0f8 align=1 (i32.const 0) (get_local 0x0f8)) - (i64.store offset=0x0f9 align=1 (i32.const 0) (get_local 0x0f9)) - (i64.store offset=0x0fa align=1 (i32.const 0) (get_local 0x0fa)) - (i64.store offset=0x0fb align=1 (i32.const 0) (get_local 0x0fb)) - (i64.store offset=0x0fc align=1 (i32.const 0) (get_local 0x0fc)) - (i64.store offset=0x0fd align=1 (i32.const 0) (get_local 0x0fd)) - (i64.store offset=0x0fe align=1 (i32.const 0) (get_local 0x0fe)) - (i64.store offset=0x0ff align=1 (i32.const 0) (get_local 0x0ff)) - (i64.store offset=0x100 align=1 (i32.const 0) (get_local 0x100)) - (i64.store offset=0x101 align=1 (i32.const 0) (get_local 0x101)) - (i64.store offset=0x102 align=1 (i32.const 0) (get_local 0x102)) - (i64.store offset=0x103 align=1 (i32.const 0) (get_local 0x103)) - (i64.store offset=0x104 align=1 (i32.const 0) (get_local 0x104)) - (i64.store offset=0x105 align=1 (i32.const 0) (get_local 0x105)) - (i64.store offset=0x106 align=1 (i32.const 0) (get_local 0x106)) - (i64.store offset=0x107 align=1 (i32.const 0) (get_local 0x107)) - (i64.store offset=0x108 align=1 (i32.const 0) (get_local 0x108)) - (i64.store offset=0x109 align=1 (i32.const 0) (get_local 0x109)) - (i64.store offset=0x10a align=1 (i32.const 0) (get_local 0x10a)) - (i64.store offset=0x10b align=1 (i32.const 0) (get_local 0x10b)) - (i64.store offset=0x10c align=1 (i32.const 0) (get_local 0x10c)) - (i64.store offset=0x10d align=1 (i32.const 0) (get_local 0x10d)) - (i64.store offset=0x10e align=1 (i32.const 0) (get_local 0x10e)) - (i64.store offset=0x10f align=1 (i32.const 0) (get_local 0x10f)) - (i64.store offset=0x110 align=1 (i32.const 0) (get_local 0x110)) - (i64.store offset=0x111 align=1 (i32.const 0) (get_local 0x111)) - (i64.store offset=0x112 align=1 (i32.const 0) (get_local 0x112)) - (i64.store offset=0x113 align=1 (i32.const 0) (get_local 0x113)) - (i64.store offset=0x114 align=1 (i32.const 0) (get_local 0x114)) - (i64.store offset=0x115 align=1 (i32.const 0) (get_local 0x115)) - (i64.store offset=0x116 align=1 (i32.const 0) (get_local 0x116)) - (i64.store offset=0x117 align=1 (i32.const 0) (get_local 0x117)) - (i64.store offset=0x118 align=1 (i32.const 0) (get_local 0x118)) - (i64.store offset=0x119 align=1 (i32.const 0) (get_local 0x119)) - (i64.store offset=0x11a align=1 (i32.const 0) (get_local 0x11a)) - (i64.store offset=0x11b align=1 (i32.const 0) (get_local 0x11b)) - (i64.store offset=0x11c align=1 (i32.const 0) (get_local 0x11c)) - (i64.store offset=0x11d align=1 (i32.const 0) (get_local 0x11d)) - (i64.store offset=0x11e align=1 (i32.const 0) (get_local 0x11e)) - (i64.store offset=0x11f align=1 (i32.const 0) (get_local 0x11f)) - (i64.store offset=0x120 align=1 (i32.const 0) (get_local 0x120)) - (i64.store offset=0x121 align=1 (i32.const 0) (get_local 0x121)) - (i64.store offset=0x122 align=1 (i32.const 0) (get_local 0x122)) - (i64.store offset=0x123 align=1 (i32.const 0) (get_local 0x123)) - (i64.store offset=0x124 align=1 (i32.const 0) (get_local 0x124)) - (i64.store offset=0x125 align=1 (i32.const 0) (get_local 0x125)) - (i64.store offset=0x126 align=1 (i32.const 0) (get_local 0x126)) - (i64.store offset=0x127 align=1 (i32.const 0) (get_local 0x127)) - (i64.store offset=0x128 align=1 (i32.const 0) (get_local 0x128)) - (i64.store offset=0x129 align=1 (i32.const 0) (get_local 0x129)) - (i64.store offset=0x12a align=1 (i32.const 0) (get_local 0x12a)) - (i64.store offset=0x12b align=1 (i32.const 0) (get_local 0x12b)) - (i64.store offset=0x12c align=1 (i32.const 0) (get_local 0x12c)) - (i64.store offset=0x12d align=1 (i32.const 0) (get_local 0x12d)) - (i64.store offset=0x12e align=1 (i32.const 0) (get_local 0x12e)) - (i64.store offset=0x12f align=1 (i32.const 0) (get_local 0x12f)) - (i64.store offset=0x130 align=1 (i32.const 0) (get_local 0x130)) - (i64.store offset=0x131 align=1 (i32.const 0) (get_local 0x131)) - (i64.store offset=0x132 align=1 (i32.const 0) (get_local 0x132)) - (i64.store offset=0x133 align=1 (i32.const 0) (get_local 0x133)) - (i64.store offset=0x134 align=1 (i32.const 0) (get_local 0x134)) - (i64.store offset=0x135 align=1 (i32.const 0) (get_local 0x135)) - (i64.store offset=0x136 align=1 (i32.const 0) (get_local 0x136)) - (i64.store offset=0x137 align=1 (i32.const 0) (get_local 0x137)) - (i64.store offset=0x138 align=1 (i32.const 0) (get_local 0x138)) - (i64.store offset=0x139 align=1 (i32.const 0) (get_local 0x139)) - (i64.store offset=0x13a align=1 (i32.const 0) (get_local 0x13a)) - (i64.store offset=0x13b align=1 (i32.const 0) (get_local 0x13b)) - (i64.store offset=0x13c align=1 (i32.const 0) (get_local 0x13c)) - (i64.store offset=0x13d align=1 (i32.const 0) (get_local 0x13d)) - (i64.store offset=0x13e align=1 (i32.const 0) (get_local 0x13e)) - (i64.store offset=0x13f align=1 (i32.const 0) (get_local 0x13f)) - (i64.store offset=0x140 align=1 (i32.const 0) (get_local 0x140)) - (i64.store offset=0x141 align=1 (i32.const 0) (get_local 0x141)) - (i64.store offset=0x142 align=1 (i32.const 0) (get_local 0x142)) - (i64.store offset=0x143 align=1 (i32.const 0) (get_local 0x143)) - (i64.store offset=0x144 align=1 (i32.const 0) (get_local 0x144)) - (i64.store offset=0x145 align=1 (i32.const 0) (get_local 0x145)) - (i64.store offset=0x146 align=1 (i32.const 0) (get_local 0x146)) - (i64.store offset=0x147 align=1 (i32.const 0) (get_local 0x147)) - (i64.store offset=0x148 align=1 (i32.const 0) (get_local 0x148)) - (i64.store offset=0x149 align=1 (i32.const 0) (get_local 0x149)) - (i64.store offset=0x14a align=1 (i32.const 0) (get_local 0x14a)) - (i64.store offset=0x14b align=1 (i32.const 0) (get_local 0x14b)) - (i64.store offset=0x14c align=1 (i32.const 0) (get_local 0x14c)) - (i64.store offset=0x14d align=1 (i32.const 0) (get_local 0x14d)) - (i64.store offset=0x14e align=1 (i32.const 0) (get_local 0x14e)) - (i64.store offset=0x14f align=1 (i32.const 0) (get_local 0x14f)) - (i64.store offset=0x150 align=1 (i32.const 0) (get_local 0x150)) - (i64.store offset=0x151 align=1 (i32.const 0) (get_local 0x151)) - (i64.store offset=0x152 align=1 (i32.const 0) (get_local 0x152)) - (i64.store offset=0x153 align=1 (i32.const 0) (get_local 0x153)) - (i64.store offset=0x154 align=1 (i32.const 0) (get_local 0x154)) - (i64.store offset=0x155 align=1 (i32.const 0) (get_local 0x155)) - (i64.store offset=0x156 align=1 (i32.const 0) (get_local 0x156)) - (i64.store offset=0x157 align=1 (i32.const 0) (get_local 0x157)) - (i64.store offset=0x158 align=1 (i32.const 0) (get_local 0x158)) - (i64.store offset=0x159 align=1 (i32.const 0) (get_local 0x159)) - (i64.store offset=0x15a align=1 (i32.const 0) (get_local 0x15a)) - (i64.store offset=0x15b align=1 (i32.const 0) (get_local 0x15b)) - (i64.store offset=0x15c align=1 (i32.const 0) (get_local 0x15c)) - (i64.store offset=0x15d align=1 (i32.const 0) (get_local 0x15d)) - (i64.store offset=0x15e align=1 (i32.const 0) (get_local 0x15e)) - (i64.store offset=0x15f align=1 (i32.const 0) (get_local 0x15f)) - (i64.store offset=0x160 align=1 (i32.const 0) (get_local 0x160)) - (i64.store offset=0x161 align=1 (i32.const 0) (get_local 0x161)) - (i64.store offset=0x162 align=1 (i32.const 0) (get_local 0x162)) - (i64.store offset=0x163 align=1 (i32.const 0) (get_local 0x163)) - (i64.store offset=0x164 align=1 (i32.const 0) (get_local 0x164)) - (i64.store offset=0x165 align=1 (i32.const 0) (get_local 0x165)) - (i64.store offset=0x166 align=1 (i32.const 0) (get_local 0x166)) - (i64.store offset=0x167 align=1 (i32.const 0) (get_local 0x167)) - (i64.store offset=0x168 align=1 (i32.const 0) (get_local 0x168)) - (i64.store offset=0x169 align=1 (i32.const 0) (get_local 0x169)) - (i64.store offset=0x16a align=1 (i32.const 0) (get_local 0x16a)) - (i64.store offset=0x16b align=1 (i32.const 0) (get_local 0x16b)) - (i64.store offset=0x16c align=1 (i32.const 0) (get_local 0x16c)) - (i64.store offset=0x16d align=1 (i32.const 0) (get_local 0x16d)) - (i64.store offset=0x16e align=1 (i32.const 0) (get_local 0x16e)) - (i64.store offset=0x16f align=1 (i32.const 0) (get_local 0x16f)) - (i64.store offset=0x170 align=1 (i32.const 0) (get_local 0x170)) - (i64.store offset=0x171 align=1 (i32.const 0) (get_local 0x171)) - (i64.store offset=0x172 align=1 (i32.const 0) (get_local 0x172)) - (i64.store offset=0x173 align=1 (i32.const 0) (get_local 0x173)) - (i64.store offset=0x174 align=1 (i32.const 0) (get_local 0x174)) - (i64.store offset=0x175 align=1 (i32.const 0) (get_local 0x175)) - (i64.store offset=0x176 align=1 (i32.const 0) (get_local 0x176)) - (i64.store offset=0x177 align=1 (i32.const 0) (get_local 0x177)) - (i64.store offset=0x178 align=1 (i32.const 0) (get_local 0x178)) - (i64.store offset=0x179 align=1 (i32.const 0) (get_local 0x179)) - (i64.store offset=0x17a align=1 (i32.const 0) (get_local 0x17a)) - (i64.store offset=0x17b align=1 (i32.const 0) (get_local 0x17b)) - (i64.store offset=0x17c align=1 (i32.const 0) (get_local 0x17c)) - (i64.store offset=0x17d align=1 (i32.const 0) (get_local 0x17d)) - (i64.store offset=0x17e align=1 (i32.const 0) (get_local 0x17e)) - (i64.store offset=0x17f align=1 (i32.const 0) (get_local 0x17f)) - (i64.store offset=0x180 align=1 (i32.const 0) (get_local 0x180)) - (i64.store offset=0x181 align=1 (i32.const 0) (get_local 0x181)) - (i64.store offset=0x182 align=1 (i32.const 0) (get_local 0x182)) - (i64.store offset=0x183 align=1 (i32.const 0) (get_local 0x183)) - (i64.store offset=0x184 align=1 (i32.const 0) (get_local 0x184)) - (i64.store offset=0x185 align=1 (i32.const 0) (get_local 0x185)) - (i64.store offset=0x186 align=1 (i32.const 0) (get_local 0x186)) - (i64.store offset=0x187 align=1 (i32.const 0) (get_local 0x187)) - (i64.store offset=0x188 align=1 (i32.const 0) (get_local 0x188)) - (i64.store offset=0x189 align=1 (i32.const 0) (get_local 0x189)) - (i64.store offset=0x18a align=1 (i32.const 0) (get_local 0x18a)) - (i64.store offset=0x18b align=1 (i32.const 0) (get_local 0x18b)) - (i64.store offset=0x18c align=1 (i32.const 0) (get_local 0x18c)) - (i64.store offset=0x18d align=1 (i32.const 0) (get_local 0x18d)) - (i64.store offset=0x18e align=1 (i32.const 0) (get_local 0x18e)) - (i64.store offset=0x18f align=1 (i32.const 0) (get_local 0x18f)) - (i64.store offset=0x190 align=1 (i32.const 0) (get_local 0x190)) - (i64.store offset=0x191 align=1 (i32.const 0) (get_local 0x191)) - (i64.store offset=0x192 align=1 (i32.const 0) (get_local 0x192)) - (i64.store offset=0x193 align=1 (i32.const 0) (get_local 0x193)) - (i64.store offset=0x194 align=1 (i32.const 0) (get_local 0x194)) - (i64.store offset=0x195 align=1 (i32.const 0) (get_local 0x195)) - (i64.store offset=0x196 align=1 (i32.const 0) (get_local 0x196)) - (i64.store offset=0x197 align=1 (i32.const 0) (get_local 0x197)) - (i64.store offset=0x198 align=1 (i32.const 0) (get_local 0x198)) - (i64.store offset=0x199 align=1 (i32.const 0) (get_local 0x199)) - (i64.store offset=0x19a align=1 (i32.const 0) (get_local 0x19a)) - (i64.store offset=0x19b align=1 (i32.const 0) (get_local 0x19b)) - (i64.store offset=0x19c align=1 (i32.const 0) (get_local 0x19c)) - (i64.store offset=0x19d align=1 (i32.const 0) (get_local 0x19d)) - (i64.store offset=0x19e align=1 (i32.const 0) (get_local 0x19e)) - (i64.store offset=0x19f align=1 (i32.const 0) (get_local 0x19f)) - (i64.store offset=0x1a0 align=1 (i32.const 0) (get_local 0x1a0)) - (i64.store offset=0x1a1 align=1 (i32.const 0) (get_local 0x1a1)) - (i64.store offset=0x1a2 align=1 (i32.const 0) (get_local 0x1a2)) - (i64.store offset=0x1a3 align=1 (i32.const 0) (get_local 0x1a3)) - (i64.store offset=0x1a4 align=1 (i32.const 0) (get_local 0x1a4)) - (i64.store offset=0x1a5 align=1 (i32.const 0) (get_local 0x1a5)) - (i64.store offset=0x1a6 align=1 (i32.const 0) (get_local 0x1a6)) - (i64.store offset=0x1a7 align=1 (i32.const 0) (get_local 0x1a7)) - (i64.store offset=0x1a8 align=1 (i32.const 0) (get_local 0x1a8)) - (i64.store offset=0x1a9 align=1 (i32.const 0) (get_local 0x1a9)) - (i64.store offset=0x1aa align=1 (i32.const 0) (get_local 0x1aa)) - (i64.store offset=0x1ab align=1 (i32.const 0) (get_local 0x1ab)) - (i64.store offset=0x1ac align=1 (i32.const 0) (get_local 0x1ac)) - (i64.store offset=0x1ad align=1 (i32.const 0) (get_local 0x1ad)) - (i64.store offset=0x1ae align=1 (i32.const 0) (get_local 0x1ae)) - (i64.store offset=0x1af align=1 (i32.const 0) (get_local 0x1af)) - (i64.store offset=0x1b0 align=1 (i32.const 0) (get_local 0x1b0)) - (i64.store offset=0x1b1 align=1 (i32.const 0) (get_local 0x1b1)) - (i64.store offset=0x1b2 align=1 (i32.const 0) (get_local 0x1b2)) - (i64.store offset=0x1b3 align=1 (i32.const 0) (get_local 0x1b3)) - (i64.store offset=0x1b4 align=1 (i32.const 0) (get_local 0x1b4)) - (i64.store offset=0x1b5 align=1 (i32.const 0) (get_local 0x1b5)) - (i64.store offset=0x1b6 align=1 (i32.const 0) (get_local 0x1b6)) - (i64.store offset=0x1b7 align=1 (i32.const 0) (get_local 0x1b7)) - (i64.store offset=0x1b8 align=1 (i32.const 0) (get_local 0x1b8)) - (i64.store offset=0x1b9 align=1 (i32.const 0) (get_local 0x1b9)) - (i64.store offset=0x1ba align=1 (i32.const 0) (get_local 0x1ba)) - (i64.store offset=0x1bb align=1 (i32.const 0) (get_local 0x1bb)) - (i64.store offset=0x1bc align=1 (i32.const 0) (get_local 0x1bc)) - (i64.store offset=0x1bd align=1 (i32.const 0) (get_local 0x1bd)) - (i64.store offset=0x1be align=1 (i32.const 0) (get_local 0x1be)) - (i64.store offset=0x1bf align=1 (i32.const 0) (get_local 0x1bf)) - (i64.store offset=0x1c0 align=1 (i32.const 0) (get_local 0x1c0)) - (i64.store offset=0x1c1 align=1 (i32.const 0) (get_local 0x1c1)) - (i64.store offset=0x1c2 align=1 (i32.const 0) (get_local 0x1c2)) - (i64.store offset=0x1c3 align=1 (i32.const 0) (get_local 0x1c3)) - (i64.store offset=0x1c4 align=1 (i32.const 0) (get_local 0x1c4)) - (i64.store offset=0x1c5 align=1 (i32.const 0) (get_local 0x1c5)) - (i64.store offset=0x1c6 align=1 (i32.const 0) (get_local 0x1c6)) - (i64.store offset=0x1c7 align=1 (i32.const 0) (get_local 0x1c7)) - (i64.store offset=0x1c8 align=1 (i32.const 0) (get_local 0x1c8)) - (i64.store offset=0x1c9 align=1 (i32.const 0) (get_local 0x1c9)) - (i64.store offset=0x1ca align=1 (i32.const 0) (get_local 0x1ca)) - (i64.store offset=0x1cb align=1 (i32.const 0) (get_local 0x1cb)) - (i64.store offset=0x1cc align=1 (i32.const 0) (get_local 0x1cc)) - (i64.store offset=0x1cd align=1 (i32.const 0) (get_local 0x1cd)) - (i64.store offset=0x1ce align=1 (i32.const 0) (get_local 0x1ce)) - (i64.store offset=0x1cf align=1 (i32.const 0) (get_local 0x1cf)) - (i64.store offset=0x1d0 align=1 (i32.const 0) (get_local 0x1d0)) - (i64.store offset=0x1d1 align=1 (i32.const 0) (get_local 0x1d1)) - (i64.store offset=0x1d2 align=1 (i32.const 0) (get_local 0x1d2)) - (i64.store offset=0x1d3 align=1 (i32.const 0) (get_local 0x1d3)) - (i64.store offset=0x1d4 align=1 (i32.const 0) (get_local 0x1d4)) - (i64.store offset=0x1d5 align=1 (i32.const 0) (get_local 0x1d5)) - (i64.store offset=0x1d6 align=1 (i32.const 0) (get_local 0x1d6)) - (i64.store offset=0x1d7 align=1 (i32.const 0) (get_local 0x1d7)) - (i64.store offset=0x1d8 align=1 (i32.const 0) (get_local 0x1d8)) - (i64.store offset=0x1d9 align=1 (i32.const 0) (get_local 0x1d9)) - (i64.store offset=0x1da align=1 (i32.const 0) (get_local 0x1da)) - (i64.store offset=0x1db align=1 (i32.const 0) (get_local 0x1db)) - (i64.store offset=0x1dc align=1 (i32.const 0) (get_local 0x1dc)) - (i64.store offset=0x1dd align=1 (i32.const 0) (get_local 0x1dd)) - (i64.store offset=0x1de align=1 (i32.const 0) (get_local 0x1de)) - (i64.store offset=0x1df align=1 (i32.const 0) (get_local 0x1df)) - (i64.store offset=0x1e0 align=1 (i32.const 0) (get_local 0x1e0)) - (i64.store offset=0x1e1 align=1 (i32.const 0) (get_local 0x1e1)) - (i64.store offset=0x1e2 align=1 (i32.const 0) (get_local 0x1e2)) - (i64.store offset=0x1e3 align=1 (i32.const 0) (get_local 0x1e3)) - (i64.store offset=0x1e4 align=1 (i32.const 0) (get_local 0x1e4)) - (i64.store offset=0x1e5 align=1 (i32.const 0) (get_local 0x1e5)) - (i64.store offset=0x1e6 align=1 (i32.const 0) (get_local 0x1e6)) - (i64.store offset=0x1e7 align=1 (i32.const 0) (get_local 0x1e7)) - (i64.store offset=0x1e8 align=1 (i32.const 0) (get_local 0x1e8)) - (i64.store offset=0x1e9 align=1 (i32.const 0) (get_local 0x1e9)) - (i64.store offset=0x1ea align=1 (i32.const 0) (get_local 0x1ea)) - (i64.store offset=0x1eb align=1 (i32.const 0) (get_local 0x1eb)) - (i64.store offset=0x1ec align=1 (i32.const 0) (get_local 0x1ec)) - (i64.store offset=0x1ed align=1 (i32.const 0) (get_local 0x1ed)) - (i64.store offset=0x1ee align=1 (i32.const 0) (get_local 0x1ee)) - (i64.store offset=0x1ef align=1 (i32.const 0) (get_local 0x1ef)) - (i64.store offset=0x1f0 align=1 (i32.const 0) (get_local 0x1f0)) - (i64.store offset=0x1f1 align=1 (i32.const 0) (get_local 0x1f1)) - (i64.store offset=0x1f2 align=1 (i32.const 0) (get_local 0x1f2)) - (i64.store offset=0x1f3 align=1 (i32.const 0) (get_local 0x1f3)) - (i64.store offset=0x1f4 align=1 (i32.const 0) (get_local 0x1f4)) - (i64.store offset=0x1f5 align=1 (i32.const 0) (get_local 0x1f5)) - (i64.store offset=0x1f6 align=1 (i32.const 0) (get_local 0x1f6)) - (i64.store offset=0x1f7 align=1 (i32.const 0) (get_local 0x1f7)) - (i64.store offset=0x1f8 align=1 (i32.const 0) (get_local 0x1f8)) - (i64.store offset=0x1f9 align=1 (i32.const 0) (get_local 0x1f9)) - (i64.store offset=0x1fa align=1 (i32.const 0) (get_local 0x1fa)) - (i64.store offset=0x1fb align=1 (i32.const 0) (get_local 0x1fb)) - (i64.store offset=0x1fc align=1 (i32.const 0) (get_local 0x1fc)) - (i64.store offset=0x1fd align=1 (i32.const 0) (get_local 0x1fd)) - (i64.store offset=0x1fe align=1 (i32.const 0) (get_local 0x1fe)) - (i64.store offset=0x1ff align=1 (i32.const 0) (get_local 0x1ff)) - (i64.store offset=0x200 align=1 (i32.const 0) (get_local 0x200)) - (i64.store offset=0x201 align=1 (i32.const 0) (get_local 0x201)) - (i64.store offset=0x202 align=1 (i32.const 0) (get_local 0x202)) - (i64.store offset=0x203 align=1 (i32.const 0) (get_local 0x203)) - (i64.store offset=0x204 align=1 (i32.const 0) (get_local 0x204)) - (i64.store offset=0x205 align=1 (i32.const 0) (get_local 0x205)) - (i64.store offset=0x206 align=1 (i32.const 0) (get_local 0x206)) - (i64.store offset=0x207 align=1 (i32.const 0) (get_local 0x207)) - (i64.store offset=0x208 align=1 (i32.const 0) (get_local 0x208)) - (i64.store offset=0x209 align=1 (i32.const 0) (get_local 0x209)) - (i64.store offset=0x20a align=1 (i32.const 0) (get_local 0x20a)) - (i64.store offset=0x20b align=1 (i32.const 0) (get_local 0x20b)) - (i64.store offset=0x20c align=1 (i32.const 0) (get_local 0x20c)) - (i64.store offset=0x20d align=1 (i32.const 0) (get_local 0x20d)) - (i64.store offset=0x20e align=1 (i32.const 0) (get_local 0x20e)) - (i64.store offset=0x20f align=1 (i32.const 0) (get_local 0x20f)) - (i64.store offset=0x210 align=1 (i32.const 0) (get_local 0x210)) - (i64.store offset=0x211 align=1 (i32.const 0) (get_local 0x211)) - (i64.store offset=0x212 align=1 (i32.const 0) (get_local 0x212)) - (i64.store offset=0x213 align=1 (i32.const 0) (get_local 0x213)) - (i64.store offset=0x214 align=1 (i32.const 0) (get_local 0x214)) - (i64.store offset=0x215 align=1 (i32.const 0) (get_local 0x215)) - (i64.store offset=0x216 align=1 (i32.const 0) (get_local 0x216)) - (i64.store offset=0x217 align=1 (i32.const 0) (get_local 0x217)) - (i64.store offset=0x218 align=1 (i32.const 0) (get_local 0x218)) - (i64.store offset=0x219 align=1 (i32.const 0) (get_local 0x219)) - (i64.store offset=0x21a align=1 (i32.const 0) (get_local 0x21a)) - (i64.store offset=0x21b align=1 (i32.const 0) (get_local 0x21b)) - (i64.store offset=0x21c align=1 (i32.const 0) (get_local 0x21c)) - (i64.store offset=0x21d align=1 (i32.const 0) (get_local 0x21d)) - (i64.store offset=0x21e align=1 (i32.const 0) (get_local 0x21e)) - (i64.store offset=0x21f align=1 (i32.const 0) (get_local 0x21f)) - (i64.store offset=0x220 align=1 (i32.const 0) (get_local 0x220)) - (i64.store offset=0x221 align=1 (i32.const 0) (get_local 0x221)) - (i64.store offset=0x222 align=1 (i32.const 0) (get_local 0x222)) - (i64.store offset=0x223 align=1 (i32.const 0) (get_local 0x223)) - (i64.store offset=0x224 align=1 (i32.const 0) (get_local 0x224)) - (i64.store offset=0x225 align=1 (i32.const 0) (get_local 0x225)) - (i64.store offset=0x226 align=1 (i32.const 0) (get_local 0x226)) - (i64.store offset=0x227 align=1 (i32.const 0) (get_local 0x227)) - (i64.store offset=0x228 align=1 (i32.const 0) (get_local 0x228)) - (i64.store offset=0x229 align=1 (i32.const 0) (get_local 0x229)) - (i64.store offset=0x22a align=1 (i32.const 0) (get_local 0x22a)) - (i64.store offset=0x22b align=1 (i32.const 0) (get_local 0x22b)) - (i64.store offset=0x22c align=1 (i32.const 0) (get_local 0x22c)) - (i64.store offset=0x22d align=1 (i32.const 0) (get_local 0x22d)) - (i64.store offset=0x22e align=1 (i32.const 0) (get_local 0x22e)) - (i64.store offset=0x22f align=1 (i32.const 0) (get_local 0x22f)) - (i64.store offset=0x230 align=1 (i32.const 0) (get_local 0x230)) - (i64.store offset=0x231 align=1 (i32.const 0) (get_local 0x231)) - (i64.store offset=0x232 align=1 (i32.const 0) (get_local 0x232)) - (i64.store offset=0x233 align=1 (i32.const 0) (get_local 0x233)) - (i64.store offset=0x234 align=1 (i32.const 0) (get_local 0x234)) - (i64.store offset=0x235 align=1 (i32.const 0) (get_local 0x235)) - (i64.store offset=0x236 align=1 (i32.const 0) (get_local 0x236)) - (i64.store offset=0x237 align=1 (i32.const 0) (get_local 0x237)) - (i64.store offset=0x238 align=1 (i32.const 0) (get_local 0x238)) - (i64.store offset=0x239 align=1 (i32.const 0) (get_local 0x239)) - (i64.store offset=0x23a align=1 (i32.const 0) (get_local 0x23a)) - (i64.store offset=0x23b align=1 (i32.const 0) (get_local 0x23b)) - (i64.store offset=0x23c align=1 (i32.const 0) (get_local 0x23c)) - (i64.store offset=0x23d align=1 (i32.const 0) (get_local 0x23d)) - (i64.store offset=0x23e align=1 (i32.const 0) (get_local 0x23e)) - (i64.store offset=0x23f align=1 (i32.const 0) (get_local 0x23f)) - (i64.store offset=0x240 align=1 (i32.const 0) (get_local 0x240)) - (i64.store offset=0x241 align=1 (i32.const 0) (get_local 0x241)) - (i64.store offset=0x242 align=1 (i32.const 0) (get_local 0x242)) - (i64.store offset=0x243 align=1 (i32.const 0) (get_local 0x243)) - (i64.store offset=0x244 align=1 (i32.const 0) (get_local 0x244)) - (i64.store offset=0x245 align=1 (i32.const 0) (get_local 0x245)) - (i64.store offset=0x246 align=1 (i32.const 0) (get_local 0x246)) - (i64.store offset=0x247 align=1 (i32.const 0) (get_local 0x247)) - (i64.store offset=0x248 align=1 (i32.const 0) (get_local 0x248)) - (i64.store offset=0x249 align=1 (i32.const 0) (get_local 0x249)) - (i64.store offset=0x24a align=1 (i32.const 0) (get_local 0x24a)) - (i64.store offset=0x24b align=1 (i32.const 0) (get_local 0x24b)) - (i64.store offset=0x24c align=1 (i32.const 0) (get_local 0x24c)) - (i64.store offset=0x24d align=1 (i32.const 0) (get_local 0x24d)) - (i64.store offset=0x24e align=1 (i32.const 0) (get_local 0x24e)) - (i64.store offset=0x24f align=1 (i32.const 0) (get_local 0x24f)) - (i64.store offset=0x250 align=1 (i32.const 0) (get_local 0x250)) - (i64.store offset=0x251 align=1 (i32.const 0) (get_local 0x251)) - (i64.store offset=0x252 align=1 (i32.const 0) (get_local 0x252)) - (i64.store offset=0x253 align=1 (i32.const 0) (get_local 0x253)) - (i64.store offset=0x254 align=1 (i32.const 0) (get_local 0x254)) - (i64.store offset=0x255 align=1 (i32.const 0) (get_local 0x255)) - (i64.store offset=0x256 align=1 (i32.const 0) (get_local 0x256)) - (i64.store offset=0x257 align=1 (i32.const 0) (get_local 0x257)) - (i64.store offset=0x258 align=1 (i32.const 0) (get_local 0x258)) - (i64.store offset=0x259 align=1 (i32.const 0) (get_local 0x259)) - (i64.store offset=0x25a align=1 (i32.const 0) (get_local 0x25a)) - (i64.store offset=0x25b align=1 (i32.const 0) (get_local 0x25b)) - (i64.store offset=0x25c align=1 (i32.const 0) (get_local 0x25c)) - (i64.store offset=0x25d align=1 (i32.const 0) (get_local 0x25d)) - (i64.store offset=0x25e align=1 (i32.const 0) (get_local 0x25e)) - (i64.store offset=0x25f align=1 (i32.const 0) (get_local 0x25f)) - (i64.store offset=0x260 align=1 (i32.const 0) (get_local 0x260)) - (i64.store offset=0x261 align=1 (i32.const 0) (get_local 0x261)) - (i64.store offset=0x262 align=1 (i32.const 0) (get_local 0x262)) - (i64.store offset=0x263 align=1 (i32.const 0) (get_local 0x263)) - (i64.store offset=0x264 align=1 (i32.const 0) (get_local 0x264)) - (i64.store offset=0x265 align=1 (i32.const 0) (get_local 0x265)) - (i64.store offset=0x266 align=1 (i32.const 0) (get_local 0x266)) - (i64.store offset=0x267 align=1 (i32.const 0) (get_local 0x267)) - (i64.store offset=0x268 align=1 (i32.const 0) (get_local 0x268)) - (i64.store offset=0x269 align=1 (i32.const 0) (get_local 0x269)) - (i64.store offset=0x26a align=1 (i32.const 0) (get_local 0x26a)) - (i64.store offset=0x26b align=1 (i32.const 0) (get_local 0x26b)) - (i64.store offset=0x26c align=1 (i32.const 0) (get_local 0x26c)) - (i64.store offset=0x26d align=1 (i32.const 0) (get_local 0x26d)) - (i64.store offset=0x26e align=1 (i32.const 0) (get_local 0x26e)) - (i64.store offset=0x26f align=1 (i32.const 0) (get_local 0x26f)) - (i64.store offset=0x270 align=1 (i32.const 0) (get_local 0x270)) - (i64.store offset=0x271 align=1 (i32.const 0) (get_local 0x271)) - (i64.store offset=0x272 align=1 (i32.const 0) (get_local 0x272)) - (i64.store offset=0x273 align=1 (i32.const 0) (get_local 0x273)) - (i64.store offset=0x274 align=1 (i32.const 0) (get_local 0x274)) - (i64.store offset=0x275 align=1 (i32.const 0) (get_local 0x275)) - (i64.store offset=0x276 align=1 (i32.const 0) (get_local 0x276)) - (i64.store offset=0x277 align=1 (i32.const 0) (get_local 0x277)) - (i64.store offset=0x278 align=1 (i32.const 0) (get_local 0x278)) - (i64.store offset=0x279 align=1 (i32.const 0) (get_local 0x279)) - (i64.store offset=0x27a align=1 (i32.const 0) (get_local 0x27a)) - (i64.store offset=0x27b align=1 (i32.const 0) (get_local 0x27b)) - (i64.store offset=0x27c align=1 (i32.const 0) (get_local 0x27c)) - (i64.store offset=0x27d align=1 (i32.const 0) (get_local 0x27d)) - (i64.store offset=0x27e align=1 (i32.const 0) (get_local 0x27e)) - (i64.store offset=0x27f align=1 (i32.const 0) (get_local 0x27f)) - (i64.store offset=0x280 align=1 (i32.const 0) (get_local 0x280)) - (i64.store offset=0x281 align=1 (i32.const 0) (get_local 0x281)) - (i64.store offset=0x282 align=1 (i32.const 0) (get_local 0x282)) - (i64.store offset=0x283 align=1 (i32.const 0) (get_local 0x283)) - (i64.store offset=0x284 align=1 (i32.const 0) (get_local 0x284)) - (i64.store offset=0x285 align=1 (i32.const 0) (get_local 0x285)) - (i64.store offset=0x286 align=1 (i32.const 0) (get_local 0x286)) - (i64.store offset=0x287 align=1 (i32.const 0) (get_local 0x287)) - (i64.store offset=0x288 align=1 (i32.const 0) (get_local 0x288)) - (i64.store offset=0x289 align=1 (i32.const 0) (get_local 0x289)) - (i64.store offset=0x28a align=1 (i32.const 0) (get_local 0x28a)) - (i64.store offset=0x28b align=1 (i32.const 0) (get_local 0x28b)) - (i64.store offset=0x28c align=1 (i32.const 0) (get_local 0x28c)) - (i64.store offset=0x28d align=1 (i32.const 0) (get_local 0x28d)) - (i64.store offset=0x28e align=1 (i32.const 0) (get_local 0x28e)) - (i64.store offset=0x28f align=1 (i32.const 0) (get_local 0x28f)) - (i64.store offset=0x290 align=1 (i32.const 0) (get_local 0x290)) - (i64.store offset=0x291 align=1 (i32.const 0) (get_local 0x291)) - (i64.store offset=0x292 align=1 (i32.const 0) (get_local 0x292)) - (i64.store offset=0x293 align=1 (i32.const 0) (get_local 0x293)) - (i64.store offset=0x294 align=1 (i32.const 0) (get_local 0x294)) - (i64.store offset=0x295 align=1 (i32.const 0) (get_local 0x295)) - (i64.store offset=0x296 align=1 (i32.const 0) (get_local 0x296)) - (i64.store offset=0x297 align=1 (i32.const 0) (get_local 0x297)) - (i64.store offset=0x298 align=1 (i32.const 0) (get_local 0x298)) - (i64.store offset=0x299 align=1 (i32.const 0) (get_local 0x299)) - (i64.store offset=0x29a align=1 (i32.const 0) (get_local 0x29a)) - (i64.store offset=0x29b align=1 (i32.const 0) (get_local 0x29b)) - (i64.store offset=0x29c align=1 (i32.const 0) (get_local 0x29c)) - (i64.store offset=0x29d align=1 (i32.const 0) (get_local 0x29d)) - (i64.store offset=0x29e align=1 (i32.const 0) (get_local 0x29e)) - (i64.store offset=0x29f align=1 (i32.const 0) (get_local 0x29f)) - (i64.store offset=0x2a0 align=1 (i32.const 0) (get_local 0x2a0)) - (i64.store offset=0x2a1 align=1 (i32.const 0) (get_local 0x2a1)) - (i64.store offset=0x2a2 align=1 (i32.const 0) (get_local 0x2a2)) - (i64.store offset=0x2a3 align=1 (i32.const 0) (get_local 0x2a3)) - (i64.store offset=0x2a4 align=1 (i32.const 0) (get_local 0x2a4)) - (i64.store offset=0x2a5 align=1 (i32.const 0) (get_local 0x2a5)) - (i64.store offset=0x2a6 align=1 (i32.const 0) (get_local 0x2a6)) - (i64.store offset=0x2a7 align=1 (i32.const 0) (get_local 0x2a7)) - (i64.store offset=0x2a8 align=1 (i32.const 0) (get_local 0x2a8)) - (i64.store offset=0x2a9 align=1 (i32.const 0) (get_local 0x2a9)) - (i64.store offset=0x2aa align=1 (i32.const 0) (get_local 0x2aa)) - (i64.store offset=0x2ab align=1 (i32.const 0) (get_local 0x2ab)) - (i64.store offset=0x2ac align=1 (i32.const 0) (get_local 0x2ac)) - (i64.store offset=0x2ad align=1 (i32.const 0) (get_local 0x2ad)) - (i64.store offset=0x2ae align=1 (i32.const 0) (get_local 0x2ae)) - (i64.store offset=0x2af align=1 (i32.const 0) (get_local 0x2af)) - (i64.store offset=0x2b0 align=1 (i32.const 0) (get_local 0x2b0)) - (i64.store offset=0x2b1 align=1 (i32.const 0) (get_local 0x2b1)) - (i64.store offset=0x2b2 align=1 (i32.const 0) (get_local 0x2b2)) - (i64.store offset=0x2b3 align=1 (i32.const 0) (get_local 0x2b3)) - (i64.store offset=0x2b4 align=1 (i32.const 0) (get_local 0x2b4)) - (i64.store offset=0x2b5 align=1 (i32.const 0) (get_local 0x2b5)) - (i64.store offset=0x2b6 align=1 (i32.const 0) (get_local 0x2b6)) - (i64.store offset=0x2b7 align=1 (i32.const 0) (get_local 0x2b7)) - (i64.store offset=0x2b8 align=1 (i32.const 0) (get_local 0x2b8)) - (i64.store offset=0x2b9 align=1 (i32.const 0) (get_local 0x2b9)) - (i64.store offset=0x2ba align=1 (i32.const 0) (get_local 0x2ba)) - (i64.store offset=0x2bb align=1 (i32.const 0) (get_local 0x2bb)) - (i64.store offset=0x2bc align=1 (i32.const 0) (get_local 0x2bc)) - (i64.store offset=0x2bd align=1 (i32.const 0) (get_local 0x2bd)) - (i64.store offset=0x2be align=1 (i32.const 0) (get_local 0x2be)) - (i64.store offset=0x2bf align=1 (i32.const 0) (get_local 0x2bf)) - (i64.store offset=0x2c0 align=1 (i32.const 0) (get_local 0x2c0)) - (i64.store offset=0x2c1 align=1 (i32.const 0) (get_local 0x2c1)) - (i64.store offset=0x2c2 align=1 (i32.const 0) (get_local 0x2c2)) - (i64.store offset=0x2c3 align=1 (i32.const 0) (get_local 0x2c3)) - (i64.store offset=0x2c4 align=1 (i32.const 0) (get_local 0x2c4)) - (i64.store offset=0x2c5 align=1 (i32.const 0) (get_local 0x2c5)) - (i64.store offset=0x2c6 align=1 (i32.const 0) (get_local 0x2c6)) - (i64.store offset=0x2c7 align=1 (i32.const 0) (get_local 0x2c7)) - (i64.store offset=0x2c8 align=1 (i32.const 0) (get_local 0x2c8)) - (i64.store offset=0x2c9 align=1 (i32.const 0) (get_local 0x2c9)) - (i64.store offset=0x2ca align=1 (i32.const 0) (get_local 0x2ca)) - (i64.store offset=0x2cb align=1 (i32.const 0) (get_local 0x2cb)) - (i64.store offset=0x2cc align=1 (i32.const 0) (get_local 0x2cc)) - (i64.store offset=0x2cd align=1 (i32.const 0) (get_local 0x2cd)) - (i64.store offset=0x2ce align=1 (i32.const 0) (get_local 0x2ce)) - (i64.store offset=0x2cf align=1 (i32.const 0) (get_local 0x2cf)) - (i64.store offset=0x2d0 align=1 (i32.const 0) (get_local 0x2d0)) - (i64.store offset=0x2d1 align=1 (i32.const 0) (get_local 0x2d1)) - (i64.store offset=0x2d2 align=1 (i32.const 0) (get_local 0x2d2)) - (i64.store offset=0x2d3 align=1 (i32.const 0) (get_local 0x2d3)) - (i64.store offset=0x2d4 align=1 (i32.const 0) (get_local 0x2d4)) - (i64.store offset=0x2d5 align=1 (i32.const 0) (get_local 0x2d5)) - (i64.store offset=0x2d6 align=1 (i32.const 0) (get_local 0x2d6)) - (i64.store offset=0x2d7 align=1 (i32.const 0) (get_local 0x2d7)) - (i64.store offset=0x2d8 align=1 (i32.const 0) (get_local 0x2d8)) - (i64.store offset=0x2d9 align=1 (i32.const 0) (get_local 0x2d9)) - (i64.store offset=0x2da align=1 (i32.const 0) (get_local 0x2da)) - (i64.store offset=0x2db align=1 (i32.const 0) (get_local 0x2db)) - (i64.store offset=0x2dc align=1 (i32.const 0) (get_local 0x2dc)) - (i64.store offset=0x2dd align=1 (i32.const 0) (get_local 0x2dd)) - (i64.store offset=0x2de align=1 (i32.const 0) (get_local 0x2de)) - (i64.store offset=0x2df align=1 (i32.const 0) (get_local 0x2df)) - (i64.store offset=0x2e0 align=1 (i32.const 0) (get_local 0x2e0)) - (i64.store offset=0x2e1 align=1 (i32.const 0) (get_local 0x2e1)) - (i64.store offset=0x2e2 align=1 (i32.const 0) (get_local 0x2e2)) - (i64.store offset=0x2e3 align=1 (i32.const 0) (get_local 0x2e3)) - (i64.store offset=0x2e4 align=1 (i32.const 0) (get_local 0x2e4)) - (i64.store offset=0x2e5 align=1 (i32.const 0) (get_local 0x2e5)) - (i64.store offset=0x2e6 align=1 (i32.const 0) (get_local 0x2e6)) - (i64.store offset=0x2e7 align=1 (i32.const 0) (get_local 0x2e7)) - (i64.store offset=0x2e8 align=1 (i32.const 0) (get_local 0x2e8)) - (i64.store offset=0x2e9 align=1 (i32.const 0) (get_local 0x2e9)) - (i64.store offset=0x2ea align=1 (i32.const 0) (get_local 0x2ea)) - (i64.store offset=0x2eb align=1 (i32.const 0) (get_local 0x2eb)) - (i64.store offset=0x2ec align=1 (i32.const 0) (get_local 0x2ec)) - (i64.store offset=0x2ed align=1 (i32.const 0) (get_local 0x2ed)) - (i64.store offset=0x2ee align=1 (i32.const 0) (get_local 0x2ee)) - (i64.store offset=0x2ef align=1 (i32.const 0) (get_local 0x2ef)) - (i64.store offset=0x2f0 align=1 (i32.const 0) (get_local 0x2f0)) - (i64.store offset=0x2f1 align=1 (i32.const 0) (get_local 0x2f1)) - (i64.store offset=0x2f2 align=1 (i32.const 0) (get_local 0x2f2)) - (i64.store offset=0x2f3 align=1 (i32.const 0) (get_local 0x2f3)) - (i64.store offset=0x2f4 align=1 (i32.const 0) (get_local 0x2f4)) - (i64.store offset=0x2f5 align=1 (i32.const 0) (get_local 0x2f5)) - (i64.store offset=0x2f6 align=1 (i32.const 0) (get_local 0x2f6)) - (i64.store offset=0x2f7 align=1 (i32.const 0) (get_local 0x2f7)) - (i64.store offset=0x2f8 align=1 (i32.const 0) (get_local 0x2f8)) - (i64.store offset=0x2f9 align=1 (i32.const 0) (get_local 0x2f9)) - (i64.store offset=0x2fa align=1 (i32.const 0) (get_local 0x2fa)) - (i64.store offset=0x2fb align=1 (i32.const 0) (get_local 0x2fb)) - (i64.store offset=0x2fc align=1 (i32.const 0) (get_local 0x2fc)) - (i64.store offset=0x2fd align=1 (i32.const 0) (get_local 0x2fd)) - (i64.store offset=0x2fe align=1 (i32.const 0) (get_local 0x2fe)) - (i64.store offset=0x2ff align=1 (i32.const 0) (get_local 0x2ff)) - (i64.store offset=0x300 align=1 (i32.const 0) (get_local 0x300)) - (i64.store offset=0x301 align=1 (i32.const 0) (get_local 0x301)) - (i64.store offset=0x302 align=1 (i32.const 0) (get_local 0x302)) - (i64.store offset=0x303 align=1 (i32.const 0) (get_local 0x303)) - (i64.store offset=0x304 align=1 (i32.const 0) (get_local 0x304)) - (i64.store offset=0x305 align=1 (i32.const 0) (get_local 0x305)) - (i64.store offset=0x306 align=1 (i32.const 0) (get_local 0x306)) - (i64.store offset=0x307 align=1 (i32.const 0) (get_local 0x307)) - (i64.store offset=0x308 align=1 (i32.const 0) (get_local 0x308)) - (i64.store offset=0x309 align=1 (i32.const 0) (get_local 0x309)) - (i64.store offset=0x30a align=1 (i32.const 0) (get_local 0x30a)) - (i64.store offset=0x30b align=1 (i32.const 0) (get_local 0x30b)) - (i64.store offset=0x30c align=1 (i32.const 0) (get_local 0x30c)) - (i64.store offset=0x30d align=1 (i32.const 0) (get_local 0x30d)) - (i64.store offset=0x30e align=1 (i32.const 0) (get_local 0x30e)) - (i64.store offset=0x30f align=1 (i32.const 0) (get_local 0x30f)) - (i64.store offset=0x310 align=1 (i32.const 0) (get_local 0x310)) - (i64.store offset=0x311 align=1 (i32.const 0) (get_local 0x311)) - (i64.store offset=0x312 align=1 (i32.const 0) (get_local 0x312)) - (i64.store offset=0x313 align=1 (i32.const 0) (get_local 0x313)) - (i64.store offset=0x314 align=1 (i32.const 0) (get_local 0x314)) - (i64.store offset=0x315 align=1 (i32.const 0) (get_local 0x315)) - (i64.store offset=0x316 align=1 (i32.const 0) (get_local 0x316)) - (i64.store offset=0x317 align=1 (i32.const 0) (get_local 0x317)) - (i64.store offset=0x318 align=1 (i32.const 0) (get_local 0x318)) - (i64.store offset=0x319 align=1 (i32.const 0) (get_local 0x319)) - (i64.store offset=0x31a align=1 (i32.const 0) (get_local 0x31a)) - (i64.store offset=0x31b align=1 (i32.const 0) (get_local 0x31b)) - (i64.store offset=0x31c align=1 (i32.const 0) (get_local 0x31c)) - (i64.store offset=0x31d align=1 (i32.const 0) (get_local 0x31d)) - (i64.store offset=0x31e align=1 (i32.const 0) (get_local 0x31e)) - (i64.store offset=0x31f align=1 (i32.const 0) (get_local 0x31f)) - (i64.store offset=0x320 align=1 (i32.const 0) (get_local 0x320)) - (i64.store offset=0x321 align=1 (i32.const 0) (get_local 0x321)) - (i64.store offset=0x322 align=1 (i32.const 0) (get_local 0x322)) - (i64.store offset=0x323 align=1 (i32.const 0) (get_local 0x323)) - (i64.store offset=0x324 align=1 (i32.const 0) (get_local 0x324)) - (i64.store offset=0x325 align=1 (i32.const 0) (get_local 0x325)) - (i64.store offset=0x326 align=1 (i32.const 0) (get_local 0x326)) - (i64.store offset=0x327 align=1 (i32.const 0) (get_local 0x327)) - (i64.store offset=0x328 align=1 (i32.const 0) (get_local 0x328)) - (i64.store offset=0x329 align=1 (i32.const 0) (get_local 0x329)) - (i64.store offset=0x32a align=1 (i32.const 0) (get_local 0x32a)) - (i64.store offset=0x32b align=1 (i32.const 0) (get_local 0x32b)) - (i64.store offset=0x32c align=1 (i32.const 0) (get_local 0x32c)) - (i64.store offset=0x32d align=1 (i32.const 0) (get_local 0x32d)) - (i64.store offset=0x32e align=1 (i32.const 0) (get_local 0x32e)) - (i64.store offset=0x32f align=1 (i32.const 0) (get_local 0x32f)) - (i64.store offset=0x330 align=1 (i32.const 0) (get_local 0x330)) - (i64.store offset=0x331 align=1 (i32.const 0) (get_local 0x331)) - (i64.store offset=0x332 align=1 (i32.const 0) (get_local 0x332)) - (i64.store offset=0x333 align=1 (i32.const 0) (get_local 0x333)) - (i64.store offset=0x334 align=1 (i32.const 0) (get_local 0x334)) - (i64.store offset=0x335 align=1 (i32.const 0) (get_local 0x335)) - (i64.store offset=0x336 align=1 (i32.const 0) (get_local 0x336)) - (i64.store offset=0x337 align=1 (i32.const 0) (get_local 0x337)) - (i64.store offset=0x338 align=1 (i32.const 0) (get_local 0x338)) - (i64.store offset=0x339 align=1 (i32.const 0) (get_local 0x339)) - (i64.store offset=0x33a align=1 (i32.const 0) (get_local 0x33a)) - (i64.store offset=0x33b align=1 (i32.const 0) (get_local 0x33b)) - (i64.store offset=0x33c align=1 (i32.const 0) (get_local 0x33c)) - (i64.store offset=0x33d align=1 (i32.const 0) (get_local 0x33d)) - (i64.store offset=0x33e align=1 (i32.const 0) (get_local 0x33e)) - (i64.store offset=0x33f align=1 (i32.const 0) (get_local 0x33f)) - (i64.store offset=0x340 align=1 (i32.const 0) (get_local 0x340)) - (i64.store offset=0x341 align=1 (i32.const 0) (get_local 0x341)) - (i64.store offset=0x342 align=1 (i32.const 0) (get_local 0x342)) - (i64.store offset=0x343 align=1 (i32.const 0) (get_local 0x343)) - (i64.store offset=0x344 align=1 (i32.const 0) (get_local 0x344)) - (i64.store offset=0x345 align=1 (i32.const 0) (get_local 0x345)) - (i64.store offset=0x346 align=1 (i32.const 0) (get_local 0x346)) - (i64.store offset=0x347 align=1 (i32.const 0) (get_local 0x347)) - (i64.store offset=0x348 align=1 (i32.const 0) (get_local 0x348)) - (i64.store offset=0x349 align=1 (i32.const 0) (get_local 0x349)) - (i64.store offset=0x34a align=1 (i32.const 0) (get_local 0x34a)) - (i64.store offset=0x34b align=1 (i32.const 0) (get_local 0x34b)) - (i64.store offset=0x34c align=1 (i32.const 0) (get_local 0x34c)) - (i64.store offset=0x34d align=1 (i32.const 0) (get_local 0x34d)) - (i64.store offset=0x34e align=1 (i32.const 0) (get_local 0x34e)) - (i64.store offset=0x34f align=1 (i32.const 0) (get_local 0x34f)) - (i64.store offset=0x350 align=1 (i32.const 0) (get_local 0x350)) - (i64.store offset=0x351 align=1 (i32.const 0) (get_local 0x351)) - (i64.store offset=0x352 align=1 (i32.const 0) (get_local 0x352)) - (i64.store offset=0x353 align=1 (i32.const 0) (get_local 0x353)) - (i64.store offset=0x354 align=1 (i32.const 0) (get_local 0x354)) - (i64.store offset=0x355 align=1 (i32.const 0) (get_local 0x355)) - (i64.store offset=0x356 align=1 (i32.const 0) (get_local 0x356)) - (i64.store offset=0x357 align=1 (i32.const 0) (get_local 0x357)) - (i64.store offset=0x358 align=1 (i32.const 0) (get_local 0x358)) - (i64.store offset=0x359 align=1 (i32.const 0) (get_local 0x359)) - (i64.store offset=0x35a align=1 (i32.const 0) (get_local 0x35a)) - (i64.store offset=0x35b align=1 (i32.const 0) (get_local 0x35b)) - (i64.store offset=0x35c align=1 (i32.const 0) (get_local 0x35c)) - (i64.store offset=0x35d align=1 (i32.const 0) (get_local 0x35d)) - (i64.store offset=0x35e align=1 (i32.const 0) (get_local 0x35e)) - (i64.store offset=0x35f align=1 (i32.const 0) (get_local 0x35f)) - (i64.store offset=0x360 align=1 (i32.const 0) (get_local 0x360)) - (i64.store offset=0x361 align=1 (i32.const 0) (get_local 0x361)) - (i64.store offset=0x362 align=1 (i32.const 0) (get_local 0x362)) - (i64.store offset=0x363 align=1 (i32.const 0) (get_local 0x363)) - (i64.store offset=0x364 align=1 (i32.const 0) (get_local 0x364)) - (i64.store offset=0x365 align=1 (i32.const 0) (get_local 0x365)) - (i64.store offset=0x366 align=1 (i32.const 0) (get_local 0x366)) - (i64.store offset=0x367 align=1 (i32.const 0) (get_local 0x367)) - (i64.store offset=0x368 align=1 (i32.const 0) (get_local 0x368)) - (i64.store offset=0x369 align=1 (i32.const 0) (get_local 0x369)) - (i64.store offset=0x36a align=1 (i32.const 0) (get_local 0x36a)) - (i64.store offset=0x36b align=1 (i32.const 0) (get_local 0x36b)) - (i64.store offset=0x36c align=1 (i32.const 0) (get_local 0x36c)) - (i64.store offset=0x36d align=1 (i32.const 0) (get_local 0x36d)) - (i64.store offset=0x36e align=1 (i32.const 0) (get_local 0x36e)) - (i64.store offset=0x36f align=1 (i32.const 0) (get_local 0x36f)) - (i64.store offset=0x370 align=1 (i32.const 0) (get_local 0x370)) - (i64.store offset=0x371 align=1 (i32.const 0) (get_local 0x371)) - (i64.store offset=0x372 align=1 (i32.const 0) (get_local 0x372)) - (i64.store offset=0x373 align=1 (i32.const 0) (get_local 0x373)) - (i64.store offset=0x374 align=1 (i32.const 0) (get_local 0x374)) - (i64.store offset=0x375 align=1 (i32.const 0) (get_local 0x375)) - (i64.store offset=0x376 align=1 (i32.const 0) (get_local 0x376)) - (i64.store offset=0x377 align=1 (i32.const 0) (get_local 0x377)) - (i64.store offset=0x378 align=1 (i32.const 0) (get_local 0x378)) - (i64.store offset=0x379 align=1 (i32.const 0) (get_local 0x379)) - (i64.store offset=0x37a align=1 (i32.const 0) (get_local 0x37a)) - (i64.store offset=0x37b align=1 (i32.const 0) (get_local 0x37b)) - (i64.store offset=0x37c align=1 (i32.const 0) (get_local 0x37c)) - (i64.store offset=0x37d align=1 (i32.const 0) (get_local 0x37d)) - (i64.store offset=0x37e align=1 (i32.const 0) (get_local 0x37e)) - (i64.store offset=0x37f align=1 (i32.const 0) (get_local 0x37f)) - (i64.store offset=0x380 align=1 (i32.const 0) (get_local 0x380)) - (i64.store offset=0x381 align=1 (i32.const 0) (get_local 0x381)) - (i64.store offset=0x382 align=1 (i32.const 0) (get_local 0x382)) - (i64.store offset=0x383 align=1 (i32.const 0) (get_local 0x383)) - (i64.store offset=0x384 align=1 (i32.const 0) (get_local 0x384)) - (i64.store offset=0x385 align=1 (i32.const 0) (get_local 0x385)) - (i64.store offset=0x386 align=1 (i32.const 0) (get_local 0x386)) - (i64.store offset=0x387 align=1 (i32.const 0) (get_local 0x387)) - (i64.store offset=0x388 align=1 (i32.const 0) (get_local 0x388)) - (i64.store offset=0x389 align=1 (i32.const 0) (get_local 0x389)) - (i64.store offset=0x38a align=1 (i32.const 0) (get_local 0x38a)) - (i64.store offset=0x38b align=1 (i32.const 0) (get_local 0x38b)) - (i64.store offset=0x38c align=1 (i32.const 0) (get_local 0x38c)) - (i64.store offset=0x38d align=1 (i32.const 0) (get_local 0x38d)) - (i64.store offset=0x38e align=1 (i32.const 0) (get_local 0x38e)) - (i64.store offset=0x38f align=1 (i32.const 0) (get_local 0x38f)) - (i64.store offset=0x390 align=1 (i32.const 0) (get_local 0x390)) - (i64.store offset=0x391 align=1 (i32.const 0) (get_local 0x391)) - (i64.store offset=0x392 align=1 (i32.const 0) (get_local 0x392)) - (i64.store offset=0x393 align=1 (i32.const 0) (get_local 0x393)) - (i64.store offset=0x394 align=1 (i32.const 0) (get_local 0x394)) - (i64.store offset=0x395 align=1 (i32.const 0) (get_local 0x395)) - (i64.store offset=0x396 align=1 (i32.const 0) (get_local 0x396)) - (i64.store offset=0x397 align=1 (i32.const 0) (get_local 0x397)) - (i64.store offset=0x398 align=1 (i32.const 0) (get_local 0x398)) - (i64.store offset=0x399 align=1 (i32.const 0) (get_local 0x399)) - (i64.store offset=0x39a align=1 (i32.const 0) (get_local 0x39a)) - (i64.store offset=0x39b align=1 (i32.const 0) (get_local 0x39b)) - (i64.store offset=0x39c align=1 (i32.const 0) (get_local 0x39c)) - (i64.store offset=0x39d align=1 (i32.const 0) (get_local 0x39d)) - (i64.store offset=0x39e align=1 (i32.const 0) (get_local 0x39e)) - (i64.store offset=0x39f align=1 (i32.const 0) (get_local 0x39f)) - (i64.store offset=0x3a0 align=1 (i32.const 0) (get_local 0x3a0)) - (i64.store offset=0x3a1 align=1 (i32.const 0) (get_local 0x3a1)) - (i64.store offset=0x3a2 align=1 (i32.const 0) (get_local 0x3a2)) - (i64.store offset=0x3a3 align=1 (i32.const 0) (get_local 0x3a3)) - (i64.store offset=0x3a4 align=1 (i32.const 0) (get_local 0x3a4)) - (i64.store offset=0x3a5 align=1 (i32.const 0) (get_local 0x3a5)) - (i64.store offset=0x3a6 align=1 (i32.const 0) (get_local 0x3a6)) - (i64.store offset=0x3a7 align=1 (i32.const 0) (get_local 0x3a7)) - (i64.store offset=0x3a8 align=1 (i32.const 0) (get_local 0x3a8)) - (i64.store offset=0x3a9 align=1 (i32.const 0) (get_local 0x3a9)) - (i64.store offset=0x3aa align=1 (i32.const 0) (get_local 0x3aa)) - (i64.store offset=0x3ab align=1 (i32.const 0) (get_local 0x3ab)) - (i64.store offset=0x3ac align=1 (i32.const 0) (get_local 0x3ac)) - (i64.store offset=0x3ad align=1 (i32.const 0) (get_local 0x3ad)) - (i64.store offset=0x3ae align=1 (i32.const 0) (get_local 0x3ae)) - (i64.store offset=0x3af align=1 (i32.const 0) (get_local 0x3af)) - (i64.store offset=0x3b0 align=1 (i32.const 0) (get_local 0x3b0)) - (i64.store offset=0x3b1 align=1 (i32.const 0) (get_local 0x3b1)) - (i64.store offset=0x3b2 align=1 (i32.const 0) (get_local 0x3b2)) - (i64.store offset=0x3b3 align=1 (i32.const 0) (get_local 0x3b3)) - (i64.store offset=0x3b4 align=1 (i32.const 0) (get_local 0x3b4)) - (i64.store offset=0x3b5 align=1 (i32.const 0) (get_local 0x3b5)) - (i64.store offset=0x3b6 align=1 (i32.const 0) (get_local 0x3b6)) - (i64.store offset=0x3b7 align=1 (i32.const 0) (get_local 0x3b7)) - (i64.store offset=0x3b8 align=1 (i32.const 0) (get_local 0x3b8)) - (i64.store offset=0x3b9 align=1 (i32.const 0) (get_local 0x3b9)) - (i64.store offset=0x3ba align=1 (i32.const 0) (get_local 0x3ba)) - (i64.store offset=0x3bb align=1 (i32.const 0) (get_local 0x3bb)) - (i64.store offset=0x3bc align=1 (i32.const 0) (get_local 0x3bc)) - (i64.store offset=0x3bd align=1 (i32.const 0) (get_local 0x3bd)) - (i64.store offset=0x3be align=1 (i32.const 0) (get_local 0x3be)) - (i64.store offset=0x3bf align=1 (i32.const 0) (get_local 0x3bf)) - (i64.store offset=0x3c0 align=1 (i32.const 0) (get_local 0x3c0)) - (i64.store offset=0x3c1 align=1 (i32.const 0) (get_local 0x3c1)) - (i64.store offset=0x3c2 align=1 (i32.const 0) (get_local 0x3c2)) - (i64.store offset=0x3c3 align=1 (i32.const 0) (get_local 0x3c3)) - (i64.store offset=0x3c4 align=1 (i32.const 0) (get_local 0x3c4)) - (i64.store offset=0x3c5 align=1 (i32.const 0) (get_local 0x3c5)) - (i64.store offset=0x3c6 align=1 (i32.const 0) (get_local 0x3c6)) - (i64.store offset=0x3c7 align=1 (i32.const 0) (get_local 0x3c7)) - (i64.store offset=0x3c8 align=1 (i32.const 0) (get_local 0x3c8)) - (i64.store offset=0x3c9 align=1 (i32.const 0) (get_local 0x3c9)) - (i64.store offset=0x3ca align=1 (i32.const 0) (get_local 0x3ca)) - (i64.store offset=0x3cb align=1 (i32.const 0) (get_local 0x3cb)) - (i64.store offset=0x3cc align=1 (i32.const 0) (get_local 0x3cc)) - (i64.store offset=0x3cd align=1 (i32.const 0) (get_local 0x3cd)) - (i64.store offset=0x3ce align=1 (i32.const 0) (get_local 0x3ce)) - (i64.store offset=0x3cf align=1 (i32.const 0) (get_local 0x3cf)) - (i64.store offset=0x3d0 align=1 (i32.const 0) (get_local 0x3d0)) - (i64.store offset=0x3d1 align=1 (i32.const 0) (get_local 0x3d1)) - (i64.store offset=0x3d2 align=1 (i32.const 0) (get_local 0x3d2)) - (i64.store offset=0x3d3 align=1 (i32.const 0) (get_local 0x3d3)) - (i64.store offset=0x3d4 align=1 (i32.const 0) (get_local 0x3d4)) - (i64.store offset=0x3d5 align=1 (i32.const 0) (get_local 0x3d5)) - (i64.store offset=0x3d6 align=1 (i32.const 0) (get_local 0x3d6)) - (i64.store offset=0x3d7 align=1 (i32.const 0) (get_local 0x3d7)) - (i64.store offset=0x3d8 align=1 (i32.const 0) (get_local 0x3d8)) - (i64.store offset=0x3d9 align=1 (i32.const 0) (get_local 0x3d9)) - (i64.store offset=0x3da align=1 (i32.const 0) (get_local 0x3da)) - (i64.store offset=0x3db align=1 (i32.const 0) (get_local 0x3db)) - (i64.store offset=0x3dc align=1 (i32.const 0) (get_local 0x3dc)) - (i64.store offset=0x3dd align=1 (i32.const 0) (get_local 0x3dd)) - (i64.store offset=0x3de align=1 (i32.const 0) (get_local 0x3de)) - (i64.store offset=0x3df align=1 (i32.const 0) (get_local 0x3df)) - (i64.store offset=0x3e0 align=1 (i32.const 0) (get_local 0x3e0)) - (i64.store offset=0x3e1 align=1 (i32.const 0) (get_local 0x3e1)) - (i64.store offset=0x3e2 align=1 (i32.const 0) (get_local 0x3e2)) - (i64.store offset=0x3e3 align=1 (i32.const 0) (get_local 0x3e3)) - (i64.store offset=0x3e4 align=1 (i32.const 0) (get_local 0x3e4)) - (i64.store offset=0x3e5 align=1 (i32.const 0) (get_local 0x3e5)) - (i64.store offset=0x3e6 align=1 (i32.const 0) (get_local 0x3e6)) - (i64.store offset=0x3e7 align=1 (i32.const 0) (get_local 0x3e7)) - (i64.store offset=0x3e8 align=1 (i32.const 0) (get_local 0x3e8)) - (i64.store offset=0x3e9 align=1 (i32.const 0) (get_local 0x3e9)) - (i64.store offset=0x3ea align=1 (i32.const 0) (get_local 0x3ea)) - (i64.store offset=0x3eb align=1 (i32.const 0) (get_local 0x3eb)) - (i64.store offset=0x3ec align=1 (i32.const 0) (get_local 0x3ec)) - (i64.store offset=0x3ed align=1 (i32.const 0) (get_local 0x3ed)) - (i64.store offset=0x3ee align=1 (i32.const 0) (get_local 0x3ee)) - (i64.store offset=0x3ef align=1 (i32.const 0) (get_local 0x3ef)) - (i64.store offset=0x3f0 align=1 (i32.const 0) (get_local 0x3f0)) - (i64.store offset=0x3f1 align=1 (i32.const 0) (get_local 0x3f1)) - (i64.store offset=0x3f2 align=1 (i32.const 0) (get_local 0x3f2)) - (i64.store offset=0x3f3 align=1 (i32.const 0) (get_local 0x3f3)) - (i64.store offset=0x3f4 align=1 (i32.const 0) (get_local 0x3f4)) - (i64.store offset=0x3f5 align=1 (i32.const 0) (get_local 0x3f5)) - (i64.store offset=0x3f6 align=1 (i32.const 0) (get_local 0x3f6)) - (i64.store offset=0x3f7 align=1 (i32.const 0) (get_local 0x3f7)) - (i64.store offset=0x3f8 align=1 (i32.const 0) (get_local 0x3f8)) - (i64.store offset=0x3f9 align=1 (i32.const 0) (get_local 0x3f9)) - (i64.store offset=0x3fa align=1 (i32.const 0) (get_local 0x3fa)) - (i64.store offset=0x3fb align=1 (i32.const 0) (get_local 0x3fb)) - (i64.store offset=0x3fc align=1 (i32.const 0) (get_local 0x3fc)) - (i64.store offset=0x3fd align=1 (i32.const 0) (get_local 0x3fd)) - (i64.store offset=0x3fe align=1 (i32.const 0) (get_local 0x3fe)) - (i64.store offset=0x3ff align=1 (i32.const 0) (get_local 0x3ff)) - (i64.store offset=0x400 align=1 (i32.const 0) (get_local 0x400)) - (i64.store offset=0x401 align=1 (i32.const 0) (get_local 0x401)) - (i64.store offset=0x402 align=1 (i32.const 0) (get_local 0x402)) - (i64.store offset=0x403 align=1 (i32.const 0) (get_local 0x403)) - (i64.store offset=0x404 align=1 (i32.const 0) (get_local 0x404)) - (i64.store offset=0x405 align=1 (i32.const 0) (get_local 0x405)) - (i64.store offset=0x406 align=1 (i32.const 0) (get_local 0x406)) - (i64.store offset=0x407 align=1 (i32.const 0) (get_local 0x407)) - (i64.store offset=0x408 align=1 (i32.const 0) (get_local 0x408)) - (i64.store offset=0x409 align=1 (i32.const 0) (get_local 0x409)) - (i64.store offset=0x40a align=1 (i32.const 0) (get_local 0x40a)) - (i64.store offset=0x40b align=1 (i32.const 0) (get_local 0x40b)) - (i64.store offset=0x40c align=1 (i32.const 0) (get_local 0x40c)) - (i64.store offset=0x40d align=1 (i32.const 0) (get_local 0x40d)) - (i64.store offset=0x40e align=1 (i32.const 0) (get_local 0x40e)) - (i64.store offset=0x40f align=1 (i32.const 0) (get_local 0x40f)) - (i64.store offset=0x410 align=1 (i32.const 0) (get_local 0x410)) - (i64.store offset=0x411 align=1 (i32.const 0) (get_local 0x411)) - (i64.store offset=0x412 align=1 (i32.const 0) (get_local 0x412)) - (i64.store offset=0x413 align=1 (i32.const 0) (get_local 0x413)) - (i64.store offset=0x414 align=1 (i32.const 0) (get_local 0x414)) - (i64.store offset=0x415 align=1 (i32.const 0) (get_local 0x415)) - (i64.store offset=0x416 align=1 (i32.const 0) (get_local 0x416)) - (i64.store offset=0x417 align=1 (i32.const 0) (get_local 0x417)) - (i64.store offset=0x418 align=1 (i32.const 0) (get_local 0x418)) - (i64.store offset=0x419 align=1 (i32.const 0) (get_local 0x419)) - (i64.store offset=0x41a align=1 (i32.const 0) (get_local 0x41a)) - (i64.store offset=0x41b align=1 (i32.const 0) (get_local 0x41b)) - (i64.store offset=0x41c align=1 (i32.const 0) (get_local 0x41c)) - (i64.store offset=0x41d align=1 (i32.const 0) (get_local 0x41d)) - (i64.store offset=0x41e align=1 (i32.const 0) (get_local 0x41e)) - (i64.store offset=0x41f align=1 (i32.const 0) (get_local 0x41f)) + (i64.store offset=0x000 align=1 (i32.const 0) (local.get 0x000)) + (i64.store offset=0x001 align=1 (i32.const 0) (local.get 0x001)) + (i64.store offset=0x002 align=1 (i32.const 0) (local.get 0x002)) + (i64.store offset=0x003 align=1 (i32.const 0) (local.get 0x003)) + (i64.store offset=0x004 align=1 (i32.const 0) (local.get 0x004)) + (i64.store offset=0x005 align=1 (i32.const 0) (local.get 0x005)) + (i64.store offset=0x006 align=1 (i32.const 0) (local.get 0x006)) + (i64.store offset=0x007 align=1 (i32.const 0) (local.get 0x007)) + (i64.store offset=0x008 align=1 (i32.const 0) (local.get 0x008)) + (i64.store offset=0x009 align=1 (i32.const 0) (local.get 0x009)) + (i64.store offset=0x00a align=1 (i32.const 0) (local.get 0x00a)) + (i64.store offset=0x00b align=1 (i32.const 0) (local.get 0x00b)) + (i64.store offset=0x00c align=1 (i32.const 0) (local.get 0x00c)) + (i64.store offset=0x00d align=1 (i32.const 0) (local.get 0x00d)) + (i64.store offset=0x00e align=1 (i32.const 0) (local.get 0x00e)) + (i64.store offset=0x00f align=1 (i32.const 0) (local.get 0x00f)) + (i64.store offset=0x010 align=1 (i32.const 0) (local.get 0x010)) + (i64.store offset=0x011 align=1 (i32.const 0) (local.get 0x011)) + (i64.store offset=0x012 align=1 (i32.const 0) (local.get 0x012)) + (i64.store offset=0x013 align=1 (i32.const 0) (local.get 0x013)) + (i64.store offset=0x014 align=1 (i32.const 0) (local.get 0x014)) + (i64.store offset=0x015 align=1 (i32.const 0) (local.get 0x015)) + (i64.store offset=0x016 align=1 (i32.const 0) (local.get 0x016)) + (i64.store offset=0x017 align=1 (i32.const 0) (local.get 0x017)) + (i64.store offset=0x018 align=1 (i32.const 0) (local.get 0x018)) + (i64.store offset=0x019 align=1 (i32.const 0) (local.get 0x019)) + (i64.store offset=0x01a align=1 (i32.const 0) (local.get 0x01a)) + (i64.store offset=0x01b align=1 (i32.const 0) (local.get 0x01b)) + (i64.store offset=0x01c align=1 (i32.const 0) (local.get 0x01c)) + (i64.store offset=0x01d align=1 (i32.const 0) (local.get 0x01d)) + (i64.store offset=0x01e align=1 (i32.const 0) (local.get 0x01e)) + (i64.store offset=0x01f align=1 (i32.const 0) (local.get 0x01f)) + (i64.store offset=0x020 align=1 (i32.const 0) (local.get 0x020)) + (i64.store offset=0x021 align=1 (i32.const 0) (local.get 0x021)) + (i64.store offset=0x022 align=1 (i32.const 0) (local.get 0x022)) + (i64.store offset=0x023 align=1 (i32.const 0) (local.get 0x023)) + (i64.store offset=0x024 align=1 (i32.const 0) (local.get 0x024)) + (i64.store offset=0x025 align=1 (i32.const 0) (local.get 0x025)) + (i64.store offset=0x026 align=1 (i32.const 0) (local.get 0x026)) + (i64.store offset=0x027 align=1 (i32.const 0) (local.get 0x027)) + (i64.store offset=0x028 align=1 (i32.const 0) (local.get 0x028)) + (i64.store offset=0x029 align=1 (i32.const 0) (local.get 0x029)) + (i64.store offset=0x02a align=1 (i32.const 0) (local.get 0x02a)) + (i64.store offset=0x02b align=1 (i32.const 0) (local.get 0x02b)) + (i64.store offset=0x02c align=1 (i32.const 0) (local.get 0x02c)) + (i64.store offset=0x02d align=1 (i32.const 0) (local.get 0x02d)) + (i64.store offset=0x02e align=1 (i32.const 0) (local.get 0x02e)) + (i64.store offset=0x02f align=1 (i32.const 0) (local.get 0x02f)) + (i64.store offset=0x030 align=1 (i32.const 0) (local.get 0x030)) + (i64.store offset=0x031 align=1 (i32.const 0) (local.get 0x031)) + (i64.store offset=0x032 align=1 (i32.const 0) (local.get 0x032)) + (i64.store offset=0x033 align=1 (i32.const 0) (local.get 0x033)) + (i64.store offset=0x034 align=1 (i32.const 0) (local.get 0x034)) + (i64.store offset=0x035 align=1 (i32.const 0) (local.get 0x035)) + (i64.store offset=0x036 align=1 (i32.const 0) (local.get 0x036)) + (i64.store offset=0x037 align=1 (i32.const 0) (local.get 0x037)) + (i64.store offset=0x038 align=1 (i32.const 0) (local.get 0x038)) + (i64.store offset=0x039 align=1 (i32.const 0) (local.get 0x039)) + (i64.store offset=0x03a align=1 (i32.const 0) (local.get 0x03a)) + (i64.store offset=0x03b align=1 (i32.const 0) (local.get 0x03b)) + (i64.store offset=0x03c align=1 (i32.const 0) (local.get 0x03c)) + (i64.store offset=0x03d align=1 (i32.const 0) (local.get 0x03d)) + (i64.store offset=0x03e align=1 (i32.const 0) (local.get 0x03e)) + (i64.store offset=0x03f align=1 (i32.const 0) (local.get 0x03f)) + (i64.store offset=0x040 align=1 (i32.const 0) (local.get 0x040)) + (i64.store offset=0x041 align=1 (i32.const 0) (local.get 0x041)) + (i64.store offset=0x042 align=1 (i32.const 0) (local.get 0x042)) + (i64.store offset=0x043 align=1 (i32.const 0) (local.get 0x043)) + (i64.store offset=0x044 align=1 (i32.const 0) (local.get 0x044)) + (i64.store offset=0x045 align=1 (i32.const 0) (local.get 0x045)) + (i64.store offset=0x046 align=1 (i32.const 0) (local.get 0x046)) + (i64.store offset=0x047 align=1 (i32.const 0) (local.get 0x047)) + (i64.store offset=0x048 align=1 (i32.const 0) (local.get 0x048)) + (i64.store offset=0x049 align=1 (i32.const 0) (local.get 0x049)) + (i64.store offset=0x04a align=1 (i32.const 0) (local.get 0x04a)) + (i64.store offset=0x04b align=1 (i32.const 0) (local.get 0x04b)) + (i64.store offset=0x04c align=1 (i32.const 0) (local.get 0x04c)) + (i64.store offset=0x04d align=1 (i32.const 0) (local.get 0x04d)) + (i64.store offset=0x04e align=1 (i32.const 0) (local.get 0x04e)) + (i64.store offset=0x04f align=1 (i32.const 0) (local.get 0x04f)) + (i64.store offset=0x050 align=1 (i32.const 0) (local.get 0x050)) + (i64.store offset=0x051 align=1 (i32.const 0) (local.get 0x051)) + (i64.store offset=0x052 align=1 (i32.const 0) (local.get 0x052)) + (i64.store offset=0x053 align=1 (i32.const 0) (local.get 0x053)) + (i64.store offset=0x054 align=1 (i32.const 0) (local.get 0x054)) + (i64.store offset=0x055 align=1 (i32.const 0) (local.get 0x055)) + (i64.store offset=0x056 align=1 (i32.const 0) (local.get 0x056)) + (i64.store offset=0x057 align=1 (i32.const 0) (local.get 0x057)) + (i64.store offset=0x058 align=1 (i32.const 0) (local.get 0x058)) + (i64.store offset=0x059 align=1 (i32.const 0) (local.get 0x059)) + (i64.store offset=0x05a align=1 (i32.const 0) (local.get 0x05a)) + (i64.store offset=0x05b align=1 (i32.const 0) (local.get 0x05b)) + (i64.store offset=0x05c align=1 (i32.const 0) (local.get 0x05c)) + (i64.store offset=0x05d align=1 (i32.const 0) (local.get 0x05d)) + (i64.store offset=0x05e align=1 (i32.const 0) (local.get 0x05e)) + (i64.store offset=0x05f align=1 (i32.const 0) (local.get 0x05f)) + (i64.store offset=0x060 align=1 (i32.const 0) (local.get 0x060)) + (i64.store offset=0x061 align=1 (i32.const 0) (local.get 0x061)) + (i64.store offset=0x062 align=1 (i32.const 0) (local.get 0x062)) + (i64.store offset=0x063 align=1 (i32.const 0) (local.get 0x063)) + (i64.store offset=0x064 align=1 (i32.const 0) (local.get 0x064)) + (i64.store offset=0x065 align=1 (i32.const 0) (local.get 0x065)) + (i64.store offset=0x066 align=1 (i32.const 0) (local.get 0x066)) + (i64.store offset=0x067 align=1 (i32.const 0) (local.get 0x067)) + (i64.store offset=0x068 align=1 (i32.const 0) (local.get 0x068)) + (i64.store offset=0x069 align=1 (i32.const 0) (local.get 0x069)) + (i64.store offset=0x06a align=1 (i32.const 0) (local.get 0x06a)) + (i64.store offset=0x06b align=1 (i32.const 0) (local.get 0x06b)) + (i64.store offset=0x06c align=1 (i32.const 0) (local.get 0x06c)) + (i64.store offset=0x06d align=1 (i32.const 0) (local.get 0x06d)) + (i64.store offset=0x06e align=1 (i32.const 0) (local.get 0x06e)) + (i64.store offset=0x06f align=1 (i32.const 0) (local.get 0x06f)) + (i64.store offset=0x070 align=1 (i32.const 0) (local.get 0x070)) + (i64.store offset=0x071 align=1 (i32.const 0) (local.get 0x071)) + (i64.store offset=0x072 align=1 (i32.const 0) (local.get 0x072)) + (i64.store offset=0x073 align=1 (i32.const 0) (local.get 0x073)) + (i64.store offset=0x074 align=1 (i32.const 0) (local.get 0x074)) + (i64.store offset=0x075 align=1 (i32.const 0) (local.get 0x075)) + (i64.store offset=0x076 align=1 (i32.const 0) (local.get 0x076)) + (i64.store offset=0x077 align=1 (i32.const 0) (local.get 0x077)) + (i64.store offset=0x078 align=1 (i32.const 0) (local.get 0x078)) + (i64.store offset=0x079 align=1 (i32.const 0) (local.get 0x079)) + (i64.store offset=0x07a align=1 (i32.const 0) (local.get 0x07a)) + (i64.store offset=0x07b align=1 (i32.const 0) (local.get 0x07b)) + (i64.store offset=0x07c align=1 (i32.const 0) (local.get 0x07c)) + (i64.store offset=0x07d align=1 (i32.const 0) (local.get 0x07d)) + (i64.store offset=0x07e align=1 (i32.const 0) (local.get 0x07e)) + (i64.store offset=0x07f align=1 (i32.const 0) (local.get 0x07f)) + (i64.store offset=0x080 align=1 (i32.const 0) (local.get 0x080)) + (i64.store offset=0x081 align=1 (i32.const 0) (local.get 0x081)) + (i64.store offset=0x082 align=1 (i32.const 0) (local.get 0x082)) + (i64.store offset=0x083 align=1 (i32.const 0) (local.get 0x083)) + (i64.store offset=0x084 align=1 (i32.const 0) (local.get 0x084)) + (i64.store offset=0x085 align=1 (i32.const 0) (local.get 0x085)) + (i64.store offset=0x086 align=1 (i32.const 0) (local.get 0x086)) + (i64.store offset=0x087 align=1 (i32.const 0) (local.get 0x087)) + (i64.store offset=0x088 align=1 (i32.const 0) (local.get 0x088)) + (i64.store offset=0x089 align=1 (i32.const 0) (local.get 0x089)) + (i64.store offset=0x08a align=1 (i32.const 0) (local.get 0x08a)) + (i64.store offset=0x08b align=1 (i32.const 0) (local.get 0x08b)) + (i64.store offset=0x08c align=1 (i32.const 0) (local.get 0x08c)) + (i64.store offset=0x08d align=1 (i32.const 0) (local.get 0x08d)) + (i64.store offset=0x08e align=1 (i32.const 0) (local.get 0x08e)) + (i64.store offset=0x08f align=1 (i32.const 0) (local.get 0x08f)) + (i64.store offset=0x090 align=1 (i32.const 0) (local.get 0x090)) + (i64.store offset=0x091 align=1 (i32.const 0) (local.get 0x091)) + (i64.store offset=0x092 align=1 (i32.const 0) (local.get 0x092)) + (i64.store offset=0x093 align=1 (i32.const 0) (local.get 0x093)) + (i64.store offset=0x094 align=1 (i32.const 0) (local.get 0x094)) + (i64.store offset=0x095 align=1 (i32.const 0) (local.get 0x095)) + (i64.store offset=0x096 align=1 (i32.const 0) (local.get 0x096)) + (i64.store offset=0x097 align=1 (i32.const 0) (local.get 0x097)) + (i64.store offset=0x098 align=1 (i32.const 0) (local.get 0x098)) + (i64.store offset=0x099 align=1 (i32.const 0) (local.get 0x099)) + (i64.store offset=0x09a align=1 (i32.const 0) (local.get 0x09a)) + (i64.store offset=0x09b align=1 (i32.const 0) (local.get 0x09b)) + (i64.store offset=0x09c align=1 (i32.const 0) (local.get 0x09c)) + (i64.store offset=0x09d align=1 (i32.const 0) (local.get 0x09d)) + (i64.store offset=0x09e align=1 (i32.const 0) (local.get 0x09e)) + (i64.store offset=0x09f align=1 (i32.const 0) (local.get 0x09f)) + (i64.store offset=0x0a0 align=1 (i32.const 0) (local.get 0x0a0)) + (i64.store offset=0x0a1 align=1 (i32.const 0) (local.get 0x0a1)) + (i64.store offset=0x0a2 align=1 (i32.const 0) (local.get 0x0a2)) + (i64.store offset=0x0a3 align=1 (i32.const 0) (local.get 0x0a3)) + (i64.store offset=0x0a4 align=1 (i32.const 0) (local.get 0x0a4)) + (i64.store offset=0x0a5 align=1 (i32.const 0) (local.get 0x0a5)) + (i64.store offset=0x0a6 align=1 (i32.const 0) (local.get 0x0a6)) + (i64.store offset=0x0a7 align=1 (i32.const 0) (local.get 0x0a7)) + (i64.store offset=0x0a8 align=1 (i32.const 0) (local.get 0x0a8)) + (i64.store offset=0x0a9 align=1 (i32.const 0) (local.get 0x0a9)) + (i64.store offset=0x0aa align=1 (i32.const 0) (local.get 0x0aa)) + (i64.store offset=0x0ab align=1 (i32.const 0) (local.get 0x0ab)) + (i64.store offset=0x0ac align=1 (i32.const 0) (local.get 0x0ac)) + (i64.store offset=0x0ad align=1 (i32.const 0) (local.get 0x0ad)) + (i64.store offset=0x0ae align=1 (i32.const 0) (local.get 0x0ae)) + (i64.store offset=0x0af align=1 (i32.const 0) (local.get 0x0af)) + (i64.store offset=0x0b0 align=1 (i32.const 0) (local.get 0x0b0)) + (i64.store offset=0x0b1 align=1 (i32.const 0) (local.get 0x0b1)) + (i64.store offset=0x0b2 align=1 (i32.const 0) (local.get 0x0b2)) + (i64.store offset=0x0b3 align=1 (i32.const 0) (local.get 0x0b3)) + (i64.store offset=0x0b4 align=1 (i32.const 0) (local.get 0x0b4)) + (i64.store offset=0x0b5 align=1 (i32.const 0) (local.get 0x0b5)) + (i64.store offset=0x0b6 align=1 (i32.const 0) (local.get 0x0b6)) + (i64.store offset=0x0b7 align=1 (i32.const 0) (local.get 0x0b7)) + (i64.store offset=0x0b8 align=1 (i32.const 0) (local.get 0x0b8)) + (i64.store offset=0x0b9 align=1 (i32.const 0) (local.get 0x0b9)) + (i64.store offset=0x0ba align=1 (i32.const 0) (local.get 0x0ba)) + (i64.store offset=0x0bb align=1 (i32.const 0) (local.get 0x0bb)) + (i64.store offset=0x0bc align=1 (i32.const 0) (local.get 0x0bc)) + (i64.store offset=0x0bd align=1 (i32.const 0) (local.get 0x0bd)) + (i64.store offset=0x0be align=1 (i32.const 0) (local.get 0x0be)) + (i64.store offset=0x0bf align=1 (i32.const 0) (local.get 0x0bf)) + (i64.store offset=0x0c0 align=1 (i32.const 0) (local.get 0x0c0)) + (i64.store offset=0x0c1 align=1 (i32.const 0) (local.get 0x0c1)) + (i64.store offset=0x0c2 align=1 (i32.const 0) (local.get 0x0c2)) + (i64.store offset=0x0c3 align=1 (i32.const 0) (local.get 0x0c3)) + (i64.store offset=0x0c4 align=1 (i32.const 0) (local.get 0x0c4)) + (i64.store offset=0x0c5 align=1 (i32.const 0) (local.get 0x0c5)) + (i64.store offset=0x0c6 align=1 (i32.const 0) (local.get 0x0c6)) + (i64.store offset=0x0c7 align=1 (i32.const 0) (local.get 0x0c7)) + (i64.store offset=0x0c8 align=1 (i32.const 0) (local.get 0x0c8)) + (i64.store offset=0x0c9 align=1 (i32.const 0) (local.get 0x0c9)) + (i64.store offset=0x0ca align=1 (i32.const 0) (local.get 0x0ca)) + (i64.store offset=0x0cb align=1 (i32.const 0) (local.get 0x0cb)) + (i64.store offset=0x0cc align=1 (i32.const 0) (local.get 0x0cc)) + (i64.store offset=0x0cd align=1 (i32.const 0) (local.get 0x0cd)) + (i64.store offset=0x0ce align=1 (i32.const 0) (local.get 0x0ce)) + (i64.store offset=0x0cf align=1 (i32.const 0) (local.get 0x0cf)) + (i64.store offset=0x0d0 align=1 (i32.const 0) (local.get 0x0d0)) + (i64.store offset=0x0d1 align=1 (i32.const 0) (local.get 0x0d1)) + (i64.store offset=0x0d2 align=1 (i32.const 0) (local.get 0x0d2)) + (i64.store offset=0x0d3 align=1 (i32.const 0) (local.get 0x0d3)) + (i64.store offset=0x0d4 align=1 (i32.const 0) (local.get 0x0d4)) + (i64.store offset=0x0d5 align=1 (i32.const 0) (local.get 0x0d5)) + (i64.store offset=0x0d6 align=1 (i32.const 0) (local.get 0x0d6)) + (i64.store offset=0x0d7 align=1 (i32.const 0) (local.get 0x0d7)) + (i64.store offset=0x0d8 align=1 (i32.const 0) (local.get 0x0d8)) + (i64.store offset=0x0d9 align=1 (i32.const 0) (local.get 0x0d9)) + (i64.store offset=0x0da align=1 (i32.const 0) (local.get 0x0da)) + (i64.store offset=0x0db align=1 (i32.const 0) (local.get 0x0db)) + (i64.store offset=0x0dc align=1 (i32.const 0) (local.get 0x0dc)) + (i64.store offset=0x0dd align=1 (i32.const 0) (local.get 0x0dd)) + (i64.store offset=0x0de align=1 (i32.const 0) (local.get 0x0de)) + (i64.store offset=0x0df align=1 (i32.const 0) (local.get 0x0df)) + (i64.store offset=0x0e0 align=1 (i32.const 0) (local.get 0x0e0)) + (i64.store offset=0x0e1 align=1 (i32.const 0) (local.get 0x0e1)) + (i64.store offset=0x0e2 align=1 (i32.const 0) (local.get 0x0e2)) + (i64.store offset=0x0e3 align=1 (i32.const 0) (local.get 0x0e3)) + (i64.store offset=0x0e4 align=1 (i32.const 0) (local.get 0x0e4)) + (i64.store offset=0x0e5 align=1 (i32.const 0) (local.get 0x0e5)) + (i64.store offset=0x0e6 align=1 (i32.const 0) (local.get 0x0e6)) + (i64.store offset=0x0e7 align=1 (i32.const 0) (local.get 0x0e7)) + (i64.store offset=0x0e8 align=1 (i32.const 0) (local.get 0x0e8)) + (i64.store offset=0x0e9 align=1 (i32.const 0) (local.get 0x0e9)) + (i64.store offset=0x0ea align=1 (i32.const 0) (local.get 0x0ea)) + (i64.store offset=0x0eb align=1 (i32.const 0) (local.get 0x0eb)) + (i64.store offset=0x0ec align=1 (i32.const 0) (local.get 0x0ec)) + (i64.store offset=0x0ed align=1 (i32.const 0) (local.get 0x0ed)) + (i64.store offset=0x0ee align=1 (i32.const 0) (local.get 0x0ee)) + (i64.store offset=0x0ef align=1 (i32.const 0) (local.get 0x0ef)) + (i64.store offset=0x0f0 align=1 (i32.const 0) (local.get 0x0f0)) + (i64.store offset=0x0f1 align=1 (i32.const 0) (local.get 0x0f1)) + (i64.store offset=0x0f2 align=1 (i32.const 0) (local.get 0x0f2)) + (i64.store offset=0x0f3 align=1 (i32.const 0) (local.get 0x0f3)) + (i64.store offset=0x0f4 align=1 (i32.const 0) (local.get 0x0f4)) + (i64.store offset=0x0f5 align=1 (i32.const 0) (local.get 0x0f5)) + (i64.store offset=0x0f6 align=1 (i32.const 0) (local.get 0x0f6)) + (i64.store offset=0x0f7 align=1 (i32.const 0) (local.get 0x0f7)) + (i64.store offset=0x0f8 align=1 (i32.const 0) (local.get 0x0f8)) + (i64.store offset=0x0f9 align=1 (i32.const 0) (local.get 0x0f9)) + (i64.store offset=0x0fa align=1 (i32.const 0) (local.get 0x0fa)) + (i64.store offset=0x0fb align=1 (i32.const 0) (local.get 0x0fb)) + (i64.store offset=0x0fc align=1 (i32.const 0) (local.get 0x0fc)) + (i64.store offset=0x0fd align=1 (i32.const 0) (local.get 0x0fd)) + (i64.store offset=0x0fe align=1 (i32.const 0) (local.get 0x0fe)) + (i64.store offset=0x0ff align=1 (i32.const 0) (local.get 0x0ff)) + (i64.store offset=0x100 align=1 (i32.const 0) (local.get 0x100)) + (i64.store offset=0x101 align=1 (i32.const 0) (local.get 0x101)) + (i64.store offset=0x102 align=1 (i32.const 0) (local.get 0x102)) + (i64.store offset=0x103 align=1 (i32.const 0) (local.get 0x103)) + (i64.store offset=0x104 align=1 (i32.const 0) (local.get 0x104)) + (i64.store offset=0x105 align=1 (i32.const 0) (local.get 0x105)) + (i64.store offset=0x106 align=1 (i32.const 0) (local.get 0x106)) + (i64.store offset=0x107 align=1 (i32.const 0) (local.get 0x107)) + (i64.store offset=0x108 align=1 (i32.const 0) (local.get 0x108)) + (i64.store offset=0x109 align=1 (i32.const 0) (local.get 0x109)) + (i64.store offset=0x10a align=1 (i32.const 0) (local.get 0x10a)) + (i64.store offset=0x10b align=1 (i32.const 0) (local.get 0x10b)) + (i64.store offset=0x10c align=1 (i32.const 0) (local.get 0x10c)) + (i64.store offset=0x10d align=1 (i32.const 0) (local.get 0x10d)) + (i64.store offset=0x10e align=1 (i32.const 0) (local.get 0x10e)) + (i64.store offset=0x10f align=1 (i32.const 0) (local.get 0x10f)) + (i64.store offset=0x110 align=1 (i32.const 0) (local.get 0x110)) + (i64.store offset=0x111 align=1 (i32.const 0) (local.get 0x111)) + (i64.store offset=0x112 align=1 (i32.const 0) (local.get 0x112)) + (i64.store offset=0x113 align=1 (i32.const 0) (local.get 0x113)) + (i64.store offset=0x114 align=1 (i32.const 0) (local.get 0x114)) + (i64.store offset=0x115 align=1 (i32.const 0) (local.get 0x115)) + (i64.store offset=0x116 align=1 (i32.const 0) (local.get 0x116)) + (i64.store offset=0x117 align=1 (i32.const 0) (local.get 0x117)) + (i64.store offset=0x118 align=1 (i32.const 0) (local.get 0x118)) + (i64.store offset=0x119 align=1 (i32.const 0) (local.get 0x119)) + (i64.store offset=0x11a align=1 (i32.const 0) (local.get 0x11a)) + (i64.store offset=0x11b align=1 (i32.const 0) (local.get 0x11b)) + (i64.store offset=0x11c align=1 (i32.const 0) (local.get 0x11c)) + (i64.store offset=0x11d align=1 (i32.const 0) (local.get 0x11d)) + (i64.store offset=0x11e align=1 (i32.const 0) (local.get 0x11e)) + (i64.store offset=0x11f align=1 (i32.const 0) (local.get 0x11f)) + (i64.store offset=0x120 align=1 (i32.const 0) (local.get 0x120)) + (i64.store offset=0x121 align=1 (i32.const 0) (local.get 0x121)) + (i64.store offset=0x122 align=1 (i32.const 0) (local.get 0x122)) + (i64.store offset=0x123 align=1 (i32.const 0) (local.get 0x123)) + (i64.store offset=0x124 align=1 (i32.const 0) (local.get 0x124)) + (i64.store offset=0x125 align=1 (i32.const 0) (local.get 0x125)) + (i64.store offset=0x126 align=1 (i32.const 0) (local.get 0x126)) + (i64.store offset=0x127 align=1 (i32.const 0) (local.get 0x127)) + (i64.store offset=0x128 align=1 (i32.const 0) (local.get 0x128)) + (i64.store offset=0x129 align=1 (i32.const 0) (local.get 0x129)) + (i64.store offset=0x12a align=1 (i32.const 0) (local.get 0x12a)) + (i64.store offset=0x12b align=1 (i32.const 0) (local.get 0x12b)) + (i64.store offset=0x12c align=1 (i32.const 0) (local.get 0x12c)) + (i64.store offset=0x12d align=1 (i32.const 0) (local.get 0x12d)) + (i64.store offset=0x12e align=1 (i32.const 0) (local.get 0x12e)) + (i64.store offset=0x12f align=1 (i32.const 0) (local.get 0x12f)) + (i64.store offset=0x130 align=1 (i32.const 0) (local.get 0x130)) + (i64.store offset=0x131 align=1 (i32.const 0) (local.get 0x131)) + (i64.store offset=0x132 align=1 (i32.const 0) (local.get 0x132)) + (i64.store offset=0x133 align=1 (i32.const 0) (local.get 0x133)) + (i64.store offset=0x134 align=1 (i32.const 0) (local.get 0x134)) + (i64.store offset=0x135 align=1 (i32.const 0) (local.get 0x135)) + (i64.store offset=0x136 align=1 (i32.const 0) (local.get 0x136)) + (i64.store offset=0x137 align=1 (i32.const 0) (local.get 0x137)) + (i64.store offset=0x138 align=1 (i32.const 0) (local.get 0x138)) + (i64.store offset=0x139 align=1 (i32.const 0) (local.get 0x139)) + (i64.store offset=0x13a align=1 (i32.const 0) (local.get 0x13a)) + (i64.store offset=0x13b align=1 (i32.const 0) (local.get 0x13b)) + (i64.store offset=0x13c align=1 (i32.const 0) (local.get 0x13c)) + (i64.store offset=0x13d align=1 (i32.const 0) (local.get 0x13d)) + (i64.store offset=0x13e align=1 (i32.const 0) (local.get 0x13e)) + (i64.store offset=0x13f align=1 (i32.const 0) (local.get 0x13f)) + (i64.store offset=0x140 align=1 (i32.const 0) (local.get 0x140)) + (i64.store offset=0x141 align=1 (i32.const 0) (local.get 0x141)) + (i64.store offset=0x142 align=1 (i32.const 0) (local.get 0x142)) + (i64.store offset=0x143 align=1 (i32.const 0) (local.get 0x143)) + (i64.store offset=0x144 align=1 (i32.const 0) (local.get 0x144)) + (i64.store offset=0x145 align=1 (i32.const 0) (local.get 0x145)) + (i64.store offset=0x146 align=1 (i32.const 0) (local.get 0x146)) + (i64.store offset=0x147 align=1 (i32.const 0) (local.get 0x147)) + (i64.store offset=0x148 align=1 (i32.const 0) (local.get 0x148)) + (i64.store offset=0x149 align=1 (i32.const 0) (local.get 0x149)) + (i64.store offset=0x14a align=1 (i32.const 0) (local.get 0x14a)) + (i64.store offset=0x14b align=1 (i32.const 0) (local.get 0x14b)) + (i64.store offset=0x14c align=1 (i32.const 0) (local.get 0x14c)) + (i64.store offset=0x14d align=1 (i32.const 0) (local.get 0x14d)) + (i64.store offset=0x14e align=1 (i32.const 0) (local.get 0x14e)) + (i64.store offset=0x14f align=1 (i32.const 0) (local.get 0x14f)) + (i64.store offset=0x150 align=1 (i32.const 0) (local.get 0x150)) + (i64.store offset=0x151 align=1 (i32.const 0) (local.get 0x151)) + (i64.store offset=0x152 align=1 (i32.const 0) (local.get 0x152)) + (i64.store offset=0x153 align=1 (i32.const 0) (local.get 0x153)) + (i64.store offset=0x154 align=1 (i32.const 0) (local.get 0x154)) + (i64.store offset=0x155 align=1 (i32.const 0) (local.get 0x155)) + (i64.store offset=0x156 align=1 (i32.const 0) (local.get 0x156)) + (i64.store offset=0x157 align=1 (i32.const 0) (local.get 0x157)) + (i64.store offset=0x158 align=1 (i32.const 0) (local.get 0x158)) + (i64.store offset=0x159 align=1 (i32.const 0) (local.get 0x159)) + (i64.store offset=0x15a align=1 (i32.const 0) (local.get 0x15a)) + (i64.store offset=0x15b align=1 (i32.const 0) (local.get 0x15b)) + (i64.store offset=0x15c align=1 (i32.const 0) (local.get 0x15c)) + (i64.store offset=0x15d align=1 (i32.const 0) (local.get 0x15d)) + (i64.store offset=0x15e align=1 (i32.const 0) (local.get 0x15e)) + (i64.store offset=0x15f align=1 (i32.const 0) (local.get 0x15f)) + (i64.store offset=0x160 align=1 (i32.const 0) (local.get 0x160)) + (i64.store offset=0x161 align=1 (i32.const 0) (local.get 0x161)) + (i64.store offset=0x162 align=1 (i32.const 0) (local.get 0x162)) + (i64.store offset=0x163 align=1 (i32.const 0) (local.get 0x163)) + (i64.store offset=0x164 align=1 (i32.const 0) (local.get 0x164)) + (i64.store offset=0x165 align=1 (i32.const 0) (local.get 0x165)) + (i64.store offset=0x166 align=1 (i32.const 0) (local.get 0x166)) + (i64.store offset=0x167 align=1 (i32.const 0) (local.get 0x167)) + (i64.store offset=0x168 align=1 (i32.const 0) (local.get 0x168)) + (i64.store offset=0x169 align=1 (i32.const 0) (local.get 0x169)) + (i64.store offset=0x16a align=1 (i32.const 0) (local.get 0x16a)) + (i64.store offset=0x16b align=1 (i32.const 0) (local.get 0x16b)) + (i64.store offset=0x16c align=1 (i32.const 0) (local.get 0x16c)) + (i64.store offset=0x16d align=1 (i32.const 0) (local.get 0x16d)) + (i64.store offset=0x16e align=1 (i32.const 0) (local.get 0x16e)) + (i64.store offset=0x16f align=1 (i32.const 0) (local.get 0x16f)) + (i64.store offset=0x170 align=1 (i32.const 0) (local.get 0x170)) + (i64.store offset=0x171 align=1 (i32.const 0) (local.get 0x171)) + (i64.store offset=0x172 align=1 (i32.const 0) (local.get 0x172)) + (i64.store offset=0x173 align=1 (i32.const 0) (local.get 0x173)) + (i64.store offset=0x174 align=1 (i32.const 0) (local.get 0x174)) + (i64.store offset=0x175 align=1 (i32.const 0) (local.get 0x175)) + (i64.store offset=0x176 align=1 (i32.const 0) (local.get 0x176)) + (i64.store offset=0x177 align=1 (i32.const 0) (local.get 0x177)) + (i64.store offset=0x178 align=1 (i32.const 0) (local.get 0x178)) + (i64.store offset=0x179 align=1 (i32.const 0) (local.get 0x179)) + (i64.store offset=0x17a align=1 (i32.const 0) (local.get 0x17a)) + (i64.store offset=0x17b align=1 (i32.const 0) (local.get 0x17b)) + (i64.store offset=0x17c align=1 (i32.const 0) (local.get 0x17c)) + (i64.store offset=0x17d align=1 (i32.const 0) (local.get 0x17d)) + (i64.store offset=0x17e align=1 (i32.const 0) (local.get 0x17e)) + (i64.store offset=0x17f align=1 (i32.const 0) (local.get 0x17f)) + (i64.store offset=0x180 align=1 (i32.const 0) (local.get 0x180)) + (i64.store offset=0x181 align=1 (i32.const 0) (local.get 0x181)) + (i64.store offset=0x182 align=1 (i32.const 0) (local.get 0x182)) + (i64.store offset=0x183 align=1 (i32.const 0) (local.get 0x183)) + (i64.store offset=0x184 align=1 (i32.const 0) (local.get 0x184)) + (i64.store offset=0x185 align=1 (i32.const 0) (local.get 0x185)) + (i64.store offset=0x186 align=1 (i32.const 0) (local.get 0x186)) + (i64.store offset=0x187 align=1 (i32.const 0) (local.get 0x187)) + (i64.store offset=0x188 align=1 (i32.const 0) (local.get 0x188)) + (i64.store offset=0x189 align=1 (i32.const 0) (local.get 0x189)) + (i64.store offset=0x18a align=1 (i32.const 0) (local.get 0x18a)) + (i64.store offset=0x18b align=1 (i32.const 0) (local.get 0x18b)) + (i64.store offset=0x18c align=1 (i32.const 0) (local.get 0x18c)) + (i64.store offset=0x18d align=1 (i32.const 0) (local.get 0x18d)) + (i64.store offset=0x18e align=1 (i32.const 0) (local.get 0x18e)) + (i64.store offset=0x18f align=1 (i32.const 0) (local.get 0x18f)) + (i64.store offset=0x190 align=1 (i32.const 0) (local.get 0x190)) + (i64.store offset=0x191 align=1 (i32.const 0) (local.get 0x191)) + (i64.store offset=0x192 align=1 (i32.const 0) (local.get 0x192)) + (i64.store offset=0x193 align=1 (i32.const 0) (local.get 0x193)) + (i64.store offset=0x194 align=1 (i32.const 0) (local.get 0x194)) + (i64.store offset=0x195 align=1 (i32.const 0) (local.get 0x195)) + (i64.store offset=0x196 align=1 (i32.const 0) (local.get 0x196)) + (i64.store offset=0x197 align=1 (i32.const 0) (local.get 0x197)) + (i64.store offset=0x198 align=1 (i32.const 0) (local.get 0x198)) + (i64.store offset=0x199 align=1 (i32.const 0) (local.get 0x199)) + (i64.store offset=0x19a align=1 (i32.const 0) (local.get 0x19a)) + (i64.store offset=0x19b align=1 (i32.const 0) (local.get 0x19b)) + (i64.store offset=0x19c align=1 (i32.const 0) (local.get 0x19c)) + (i64.store offset=0x19d align=1 (i32.const 0) (local.get 0x19d)) + (i64.store offset=0x19e align=1 (i32.const 0) (local.get 0x19e)) + (i64.store offset=0x19f align=1 (i32.const 0) (local.get 0x19f)) + (i64.store offset=0x1a0 align=1 (i32.const 0) (local.get 0x1a0)) + (i64.store offset=0x1a1 align=1 (i32.const 0) (local.get 0x1a1)) + (i64.store offset=0x1a2 align=1 (i32.const 0) (local.get 0x1a2)) + (i64.store offset=0x1a3 align=1 (i32.const 0) (local.get 0x1a3)) + (i64.store offset=0x1a4 align=1 (i32.const 0) (local.get 0x1a4)) + (i64.store offset=0x1a5 align=1 (i32.const 0) (local.get 0x1a5)) + (i64.store offset=0x1a6 align=1 (i32.const 0) (local.get 0x1a6)) + (i64.store offset=0x1a7 align=1 (i32.const 0) (local.get 0x1a7)) + (i64.store offset=0x1a8 align=1 (i32.const 0) (local.get 0x1a8)) + (i64.store offset=0x1a9 align=1 (i32.const 0) (local.get 0x1a9)) + (i64.store offset=0x1aa align=1 (i32.const 0) (local.get 0x1aa)) + (i64.store offset=0x1ab align=1 (i32.const 0) (local.get 0x1ab)) + (i64.store offset=0x1ac align=1 (i32.const 0) (local.get 0x1ac)) + (i64.store offset=0x1ad align=1 (i32.const 0) (local.get 0x1ad)) + (i64.store offset=0x1ae align=1 (i32.const 0) (local.get 0x1ae)) + (i64.store offset=0x1af align=1 (i32.const 0) (local.get 0x1af)) + (i64.store offset=0x1b0 align=1 (i32.const 0) (local.get 0x1b0)) + (i64.store offset=0x1b1 align=1 (i32.const 0) (local.get 0x1b1)) + (i64.store offset=0x1b2 align=1 (i32.const 0) (local.get 0x1b2)) + (i64.store offset=0x1b3 align=1 (i32.const 0) (local.get 0x1b3)) + (i64.store offset=0x1b4 align=1 (i32.const 0) (local.get 0x1b4)) + (i64.store offset=0x1b5 align=1 (i32.const 0) (local.get 0x1b5)) + (i64.store offset=0x1b6 align=1 (i32.const 0) (local.get 0x1b6)) + (i64.store offset=0x1b7 align=1 (i32.const 0) (local.get 0x1b7)) + (i64.store offset=0x1b8 align=1 (i32.const 0) (local.get 0x1b8)) + (i64.store offset=0x1b9 align=1 (i32.const 0) (local.get 0x1b9)) + (i64.store offset=0x1ba align=1 (i32.const 0) (local.get 0x1ba)) + (i64.store offset=0x1bb align=1 (i32.const 0) (local.get 0x1bb)) + (i64.store offset=0x1bc align=1 (i32.const 0) (local.get 0x1bc)) + (i64.store offset=0x1bd align=1 (i32.const 0) (local.get 0x1bd)) + (i64.store offset=0x1be align=1 (i32.const 0) (local.get 0x1be)) + (i64.store offset=0x1bf align=1 (i32.const 0) (local.get 0x1bf)) + (i64.store offset=0x1c0 align=1 (i32.const 0) (local.get 0x1c0)) + (i64.store offset=0x1c1 align=1 (i32.const 0) (local.get 0x1c1)) + (i64.store offset=0x1c2 align=1 (i32.const 0) (local.get 0x1c2)) + (i64.store offset=0x1c3 align=1 (i32.const 0) (local.get 0x1c3)) + (i64.store offset=0x1c4 align=1 (i32.const 0) (local.get 0x1c4)) + (i64.store offset=0x1c5 align=1 (i32.const 0) (local.get 0x1c5)) + (i64.store offset=0x1c6 align=1 (i32.const 0) (local.get 0x1c6)) + (i64.store offset=0x1c7 align=1 (i32.const 0) (local.get 0x1c7)) + (i64.store offset=0x1c8 align=1 (i32.const 0) (local.get 0x1c8)) + (i64.store offset=0x1c9 align=1 (i32.const 0) (local.get 0x1c9)) + (i64.store offset=0x1ca align=1 (i32.const 0) (local.get 0x1ca)) + (i64.store offset=0x1cb align=1 (i32.const 0) (local.get 0x1cb)) + (i64.store offset=0x1cc align=1 (i32.const 0) (local.get 0x1cc)) + (i64.store offset=0x1cd align=1 (i32.const 0) (local.get 0x1cd)) + (i64.store offset=0x1ce align=1 (i32.const 0) (local.get 0x1ce)) + (i64.store offset=0x1cf align=1 (i32.const 0) (local.get 0x1cf)) + (i64.store offset=0x1d0 align=1 (i32.const 0) (local.get 0x1d0)) + (i64.store offset=0x1d1 align=1 (i32.const 0) (local.get 0x1d1)) + (i64.store offset=0x1d2 align=1 (i32.const 0) (local.get 0x1d2)) + (i64.store offset=0x1d3 align=1 (i32.const 0) (local.get 0x1d3)) + (i64.store offset=0x1d4 align=1 (i32.const 0) (local.get 0x1d4)) + (i64.store offset=0x1d5 align=1 (i32.const 0) (local.get 0x1d5)) + (i64.store offset=0x1d6 align=1 (i32.const 0) (local.get 0x1d6)) + (i64.store offset=0x1d7 align=1 (i32.const 0) (local.get 0x1d7)) + (i64.store offset=0x1d8 align=1 (i32.const 0) (local.get 0x1d8)) + (i64.store offset=0x1d9 align=1 (i32.const 0) (local.get 0x1d9)) + (i64.store offset=0x1da align=1 (i32.const 0) (local.get 0x1da)) + (i64.store offset=0x1db align=1 (i32.const 0) (local.get 0x1db)) + (i64.store offset=0x1dc align=1 (i32.const 0) (local.get 0x1dc)) + (i64.store offset=0x1dd align=1 (i32.const 0) (local.get 0x1dd)) + (i64.store offset=0x1de align=1 (i32.const 0) (local.get 0x1de)) + (i64.store offset=0x1df align=1 (i32.const 0) (local.get 0x1df)) + (i64.store offset=0x1e0 align=1 (i32.const 0) (local.get 0x1e0)) + (i64.store offset=0x1e1 align=1 (i32.const 0) (local.get 0x1e1)) + (i64.store offset=0x1e2 align=1 (i32.const 0) (local.get 0x1e2)) + (i64.store offset=0x1e3 align=1 (i32.const 0) (local.get 0x1e3)) + (i64.store offset=0x1e4 align=1 (i32.const 0) (local.get 0x1e4)) + (i64.store offset=0x1e5 align=1 (i32.const 0) (local.get 0x1e5)) + (i64.store offset=0x1e6 align=1 (i32.const 0) (local.get 0x1e6)) + (i64.store offset=0x1e7 align=1 (i32.const 0) (local.get 0x1e7)) + (i64.store offset=0x1e8 align=1 (i32.const 0) (local.get 0x1e8)) + (i64.store offset=0x1e9 align=1 (i32.const 0) (local.get 0x1e9)) + (i64.store offset=0x1ea align=1 (i32.const 0) (local.get 0x1ea)) + (i64.store offset=0x1eb align=1 (i32.const 0) (local.get 0x1eb)) + (i64.store offset=0x1ec align=1 (i32.const 0) (local.get 0x1ec)) + (i64.store offset=0x1ed align=1 (i32.const 0) (local.get 0x1ed)) + (i64.store offset=0x1ee align=1 (i32.const 0) (local.get 0x1ee)) + (i64.store offset=0x1ef align=1 (i32.const 0) (local.get 0x1ef)) + (i64.store offset=0x1f0 align=1 (i32.const 0) (local.get 0x1f0)) + (i64.store offset=0x1f1 align=1 (i32.const 0) (local.get 0x1f1)) + (i64.store offset=0x1f2 align=1 (i32.const 0) (local.get 0x1f2)) + (i64.store offset=0x1f3 align=1 (i32.const 0) (local.get 0x1f3)) + (i64.store offset=0x1f4 align=1 (i32.const 0) (local.get 0x1f4)) + (i64.store offset=0x1f5 align=1 (i32.const 0) (local.get 0x1f5)) + (i64.store offset=0x1f6 align=1 (i32.const 0) (local.get 0x1f6)) + (i64.store offset=0x1f7 align=1 (i32.const 0) (local.get 0x1f7)) + (i64.store offset=0x1f8 align=1 (i32.const 0) (local.get 0x1f8)) + (i64.store offset=0x1f9 align=1 (i32.const 0) (local.get 0x1f9)) + (i64.store offset=0x1fa align=1 (i32.const 0) (local.get 0x1fa)) + (i64.store offset=0x1fb align=1 (i32.const 0) (local.get 0x1fb)) + (i64.store offset=0x1fc align=1 (i32.const 0) (local.get 0x1fc)) + (i64.store offset=0x1fd align=1 (i32.const 0) (local.get 0x1fd)) + (i64.store offset=0x1fe align=1 (i32.const 0) (local.get 0x1fe)) + (i64.store offset=0x1ff align=1 (i32.const 0) (local.get 0x1ff)) + (i64.store offset=0x200 align=1 (i32.const 0) (local.get 0x200)) + (i64.store offset=0x201 align=1 (i32.const 0) (local.get 0x201)) + (i64.store offset=0x202 align=1 (i32.const 0) (local.get 0x202)) + (i64.store offset=0x203 align=1 (i32.const 0) (local.get 0x203)) + (i64.store offset=0x204 align=1 (i32.const 0) (local.get 0x204)) + (i64.store offset=0x205 align=1 (i32.const 0) (local.get 0x205)) + (i64.store offset=0x206 align=1 (i32.const 0) (local.get 0x206)) + (i64.store offset=0x207 align=1 (i32.const 0) (local.get 0x207)) + (i64.store offset=0x208 align=1 (i32.const 0) (local.get 0x208)) + (i64.store offset=0x209 align=1 (i32.const 0) (local.get 0x209)) + (i64.store offset=0x20a align=1 (i32.const 0) (local.get 0x20a)) + (i64.store offset=0x20b align=1 (i32.const 0) (local.get 0x20b)) + (i64.store offset=0x20c align=1 (i32.const 0) (local.get 0x20c)) + (i64.store offset=0x20d align=1 (i32.const 0) (local.get 0x20d)) + (i64.store offset=0x20e align=1 (i32.const 0) (local.get 0x20e)) + (i64.store offset=0x20f align=1 (i32.const 0) (local.get 0x20f)) + (i64.store offset=0x210 align=1 (i32.const 0) (local.get 0x210)) + (i64.store offset=0x211 align=1 (i32.const 0) (local.get 0x211)) + (i64.store offset=0x212 align=1 (i32.const 0) (local.get 0x212)) + (i64.store offset=0x213 align=1 (i32.const 0) (local.get 0x213)) + (i64.store offset=0x214 align=1 (i32.const 0) (local.get 0x214)) + (i64.store offset=0x215 align=1 (i32.const 0) (local.get 0x215)) + (i64.store offset=0x216 align=1 (i32.const 0) (local.get 0x216)) + (i64.store offset=0x217 align=1 (i32.const 0) (local.get 0x217)) + (i64.store offset=0x218 align=1 (i32.const 0) (local.get 0x218)) + (i64.store offset=0x219 align=1 (i32.const 0) (local.get 0x219)) + (i64.store offset=0x21a align=1 (i32.const 0) (local.get 0x21a)) + (i64.store offset=0x21b align=1 (i32.const 0) (local.get 0x21b)) + (i64.store offset=0x21c align=1 (i32.const 0) (local.get 0x21c)) + (i64.store offset=0x21d align=1 (i32.const 0) (local.get 0x21d)) + (i64.store offset=0x21e align=1 (i32.const 0) (local.get 0x21e)) + (i64.store offset=0x21f align=1 (i32.const 0) (local.get 0x21f)) + (i64.store offset=0x220 align=1 (i32.const 0) (local.get 0x220)) + (i64.store offset=0x221 align=1 (i32.const 0) (local.get 0x221)) + (i64.store offset=0x222 align=1 (i32.const 0) (local.get 0x222)) + (i64.store offset=0x223 align=1 (i32.const 0) (local.get 0x223)) + (i64.store offset=0x224 align=1 (i32.const 0) (local.get 0x224)) + (i64.store offset=0x225 align=1 (i32.const 0) (local.get 0x225)) + (i64.store offset=0x226 align=1 (i32.const 0) (local.get 0x226)) + (i64.store offset=0x227 align=1 (i32.const 0) (local.get 0x227)) + (i64.store offset=0x228 align=1 (i32.const 0) (local.get 0x228)) + (i64.store offset=0x229 align=1 (i32.const 0) (local.get 0x229)) + (i64.store offset=0x22a align=1 (i32.const 0) (local.get 0x22a)) + (i64.store offset=0x22b align=1 (i32.const 0) (local.get 0x22b)) + (i64.store offset=0x22c align=1 (i32.const 0) (local.get 0x22c)) + (i64.store offset=0x22d align=1 (i32.const 0) (local.get 0x22d)) + (i64.store offset=0x22e align=1 (i32.const 0) (local.get 0x22e)) + (i64.store offset=0x22f align=1 (i32.const 0) (local.get 0x22f)) + (i64.store offset=0x230 align=1 (i32.const 0) (local.get 0x230)) + (i64.store offset=0x231 align=1 (i32.const 0) (local.get 0x231)) + (i64.store offset=0x232 align=1 (i32.const 0) (local.get 0x232)) + (i64.store offset=0x233 align=1 (i32.const 0) (local.get 0x233)) + (i64.store offset=0x234 align=1 (i32.const 0) (local.get 0x234)) + (i64.store offset=0x235 align=1 (i32.const 0) (local.get 0x235)) + (i64.store offset=0x236 align=1 (i32.const 0) (local.get 0x236)) + (i64.store offset=0x237 align=1 (i32.const 0) (local.get 0x237)) + (i64.store offset=0x238 align=1 (i32.const 0) (local.get 0x238)) + (i64.store offset=0x239 align=1 (i32.const 0) (local.get 0x239)) + (i64.store offset=0x23a align=1 (i32.const 0) (local.get 0x23a)) + (i64.store offset=0x23b align=1 (i32.const 0) (local.get 0x23b)) + (i64.store offset=0x23c align=1 (i32.const 0) (local.get 0x23c)) + (i64.store offset=0x23d align=1 (i32.const 0) (local.get 0x23d)) + (i64.store offset=0x23e align=1 (i32.const 0) (local.get 0x23e)) + (i64.store offset=0x23f align=1 (i32.const 0) (local.get 0x23f)) + (i64.store offset=0x240 align=1 (i32.const 0) (local.get 0x240)) + (i64.store offset=0x241 align=1 (i32.const 0) (local.get 0x241)) + (i64.store offset=0x242 align=1 (i32.const 0) (local.get 0x242)) + (i64.store offset=0x243 align=1 (i32.const 0) (local.get 0x243)) + (i64.store offset=0x244 align=1 (i32.const 0) (local.get 0x244)) + (i64.store offset=0x245 align=1 (i32.const 0) (local.get 0x245)) + (i64.store offset=0x246 align=1 (i32.const 0) (local.get 0x246)) + (i64.store offset=0x247 align=1 (i32.const 0) (local.get 0x247)) + (i64.store offset=0x248 align=1 (i32.const 0) (local.get 0x248)) + (i64.store offset=0x249 align=1 (i32.const 0) (local.get 0x249)) + (i64.store offset=0x24a align=1 (i32.const 0) (local.get 0x24a)) + (i64.store offset=0x24b align=1 (i32.const 0) (local.get 0x24b)) + (i64.store offset=0x24c align=1 (i32.const 0) (local.get 0x24c)) + (i64.store offset=0x24d align=1 (i32.const 0) (local.get 0x24d)) + (i64.store offset=0x24e align=1 (i32.const 0) (local.get 0x24e)) + (i64.store offset=0x24f align=1 (i32.const 0) (local.get 0x24f)) + (i64.store offset=0x250 align=1 (i32.const 0) (local.get 0x250)) + (i64.store offset=0x251 align=1 (i32.const 0) (local.get 0x251)) + (i64.store offset=0x252 align=1 (i32.const 0) (local.get 0x252)) + (i64.store offset=0x253 align=1 (i32.const 0) (local.get 0x253)) + (i64.store offset=0x254 align=1 (i32.const 0) (local.get 0x254)) + (i64.store offset=0x255 align=1 (i32.const 0) (local.get 0x255)) + (i64.store offset=0x256 align=1 (i32.const 0) (local.get 0x256)) + (i64.store offset=0x257 align=1 (i32.const 0) (local.get 0x257)) + (i64.store offset=0x258 align=1 (i32.const 0) (local.get 0x258)) + (i64.store offset=0x259 align=1 (i32.const 0) (local.get 0x259)) + (i64.store offset=0x25a align=1 (i32.const 0) (local.get 0x25a)) + (i64.store offset=0x25b align=1 (i32.const 0) (local.get 0x25b)) + (i64.store offset=0x25c align=1 (i32.const 0) (local.get 0x25c)) + (i64.store offset=0x25d align=1 (i32.const 0) (local.get 0x25d)) + (i64.store offset=0x25e align=1 (i32.const 0) (local.get 0x25e)) + (i64.store offset=0x25f align=1 (i32.const 0) (local.get 0x25f)) + (i64.store offset=0x260 align=1 (i32.const 0) (local.get 0x260)) + (i64.store offset=0x261 align=1 (i32.const 0) (local.get 0x261)) + (i64.store offset=0x262 align=1 (i32.const 0) (local.get 0x262)) + (i64.store offset=0x263 align=1 (i32.const 0) (local.get 0x263)) + (i64.store offset=0x264 align=1 (i32.const 0) (local.get 0x264)) + (i64.store offset=0x265 align=1 (i32.const 0) (local.get 0x265)) + (i64.store offset=0x266 align=1 (i32.const 0) (local.get 0x266)) + (i64.store offset=0x267 align=1 (i32.const 0) (local.get 0x267)) + (i64.store offset=0x268 align=1 (i32.const 0) (local.get 0x268)) + (i64.store offset=0x269 align=1 (i32.const 0) (local.get 0x269)) + (i64.store offset=0x26a align=1 (i32.const 0) (local.get 0x26a)) + (i64.store offset=0x26b align=1 (i32.const 0) (local.get 0x26b)) + (i64.store offset=0x26c align=1 (i32.const 0) (local.get 0x26c)) + (i64.store offset=0x26d align=1 (i32.const 0) (local.get 0x26d)) + (i64.store offset=0x26e align=1 (i32.const 0) (local.get 0x26e)) + (i64.store offset=0x26f align=1 (i32.const 0) (local.get 0x26f)) + (i64.store offset=0x270 align=1 (i32.const 0) (local.get 0x270)) + (i64.store offset=0x271 align=1 (i32.const 0) (local.get 0x271)) + (i64.store offset=0x272 align=1 (i32.const 0) (local.get 0x272)) + (i64.store offset=0x273 align=1 (i32.const 0) (local.get 0x273)) + (i64.store offset=0x274 align=1 (i32.const 0) (local.get 0x274)) + (i64.store offset=0x275 align=1 (i32.const 0) (local.get 0x275)) + (i64.store offset=0x276 align=1 (i32.const 0) (local.get 0x276)) + (i64.store offset=0x277 align=1 (i32.const 0) (local.get 0x277)) + (i64.store offset=0x278 align=1 (i32.const 0) (local.get 0x278)) + (i64.store offset=0x279 align=1 (i32.const 0) (local.get 0x279)) + (i64.store offset=0x27a align=1 (i32.const 0) (local.get 0x27a)) + (i64.store offset=0x27b align=1 (i32.const 0) (local.get 0x27b)) + (i64.store offset=0x27c align=1 (i32.const 0) (local.get 0x27c)) + (i64.store offset=0x27d align=1 (i32.const 0) (local.get 0x27d)) + (i64.store offset=0x27e align=1 (i32.const 0) (local.get 0x27e)) + (i64.store offset=0x27f align=1 (i32.const 0) (local.get 0x27f)) + (i64.store offset=0x280 align=1 (i32.const 0) (local.get 0x280)) + (i64.store offset=0x281 align=1 (i32.const 0) (local.get 0x281)) + (i64.store offset=0x282 align=1 (i32.const 0) (local.get 0x282)) + (i64.store offset=0x283 align=1 (i32.const 0) (local.get 0x283)) + (i64.store offset=0x284 align=1 (i32.const 0) (local.get 0x284)) + (i64.store offset=0x285 align=1 (i32.const 0) (local.get 0x285)) + (i64.store offset=0x286 align=1 (i32.const 0) (local.get 0x286)) + (i64.store offset=0x287 align=1 (i32.const 0) (local.get 0x287)) + (i64.store offset=0x288 align=1 (i32.const 0) (local.get 0x288)) + (i64.store offset=0x289 align=1 (i32.const 0) (local.get 0x289)) + (i64.store offset=0x28a align=1 (i32.const 0) (local.get 0x28a)) + (i64.store offset=0x28b align=1 (i32.const 0) (local.get 0x28b)) + (i64.store offset=0x28c align=1 (i32.const 0) (local.get 0x28c)) + (i64.store offset=0x28d align=1 (i32.const 0) (local.get 0x28d)) + (i64.store offset=0x28e align=1 (i32.const 0) (local.get 0x28e)) + (i64.store offset=0x28f align=1 (i32.const 0) (local.get 0x28f)) + (i64.store offset=0x290 align=1 (i32.const 0) (local.get 0x290)) + (i64.store offset=0x291 align=1 (i32.const 0) (local.get 0x291)) + (i64.store offset=0x292 align=1 (i32.const 0) (local.get 0x292)) + (i64.store offset=0x293 align=1 (i32.const 0) (local.get 0x293)) + (i64.store offset=0x294 align=1 (i32.const 0) (local.get 0x294)) + (i64.store offset=0x295 align=1 (i32.const 0) (local.get 0x295)) + (i64.store offset=0x296 align=1 (i32.const 0) (local.get 0x296)) + (i64.store offset=0x297 align=1 (i32.const 0) (local.get 0x297)) + (i64.store offset=0x298 align=1 (i32.const 0) (local.get 0x298)) + (i64.store offset=0x299 align=1 (i32.const 0) (local.get 0x299)) + (i64.store offset=0x29a align=1 (i32.const 0) (local.get 0x29a)) + (i64.store offset=0x29b align=1 (i32.const 0) (local.get 0x29b)) + (i64.store offset=0x29c align=1 (i32.const 0) (local.get 0x29c)) + (i64.store offset=0x29d align=1 (i32.const 0) (local.get 0x29d)) + (i64.store offset=0x29e align=1 (i32.const 0) (local.get 0x29e)) + (i64.store offset=0x29f align=1 (i32.const 0) (local.get 0x29f)) + (i64.store offset=0x2a0 align=1 (i32.const 0) (local.get 0x2a0)) + (i64.store offset=0x2a1 align=1 (i32.const 0) (local.get 0x2a1)) + (i64.store offset=0x2a2 align=1 (i32.const 0) (local.get 0x2a2)) + (i64.store offset=0x2a3 align=1 (i32.const 0) (local.get 0x2a3)) + (i64.store offset=0x2a4 align=1 (i32.const 0) (local.get 0x2a4)) + (i64.store offset=0x2a5 align=1 (i32.const 0) (local.get 0x2a5)) + (i64.store offset=0x2a6 align=1 (i32.const 0) (local.get 0x2a6)) + (i64.store offset=0x2a7 align=1 (i32.const 0) (local.get 0x2a7)) + (i64.store offset=0x2a8 align=1 (i32.const 0) (local.get 0x2a8)) + (i64.store offset=0x2a9 align=1 (i32.const 0) (local.get 0x2a9)) + (i64.store offset=0x2aa align=1 (i32.const 0) (local.get 0x2aa)) + (i64.store offset=0x2ab align=1 (i32.const 0) (local.get 0x2ab)) + (i64.store offset=0x2ac align=1 (i32.const 0) (local.get 0x2ac)) + (i64.store offset=0x2ad align=1 (i32.const 0) (local.get 0x2ad)) + (i64.store offset=0x2ae align=1 (i32.const 0) (local.get 0x2ae)) + (i64.store offset=0x2af align=1 (i32.const 0) (local.get 0x2af)) + (i64.store offset=0x2b0 align=1 (i32.const 0) (local.get 0x2b0)) + (i64.store offset=0x2b1 align=1 (i32.const 0) (local.get 0x2b1)) + (i64.store offset=0x2b2 align=1 (i32.const 0) (local.get 0x2b2)) + (i64.store offset=0x2b3 align=1 (i32.const 0) (local.get 0x2b3)) + (i64.store offset=0x2b4 align=1 (i32.const 0) (local.get 0x2b4)) + (i64.store offset=0x2b5 align=1 (i32.const 0) (local.get 0x2b5)) + (i64.store offset=0x2b6 align=1 (i32.const 0) (local.get 0x2b6)) + (i64.store offset=0x2b7 align=1 (i32.const 0) (local.get 0x2b7)) + (i64.store offset=0x2b8 align=1 (i32.const 0) (local.get 0x2b8)) + (i64.store offset=0x2b9 align=1 (i32.const 0) (local.get 0x2b9)) + (i64.store offset=0x2ba align=1 (i32.const 0) (local.get 0x2ba)) + (i64.store offset=0x2bb align=1 (i32.const 0) (local.get 0x2bb)) + (i64.store offset=0x2bc align=1 (i32.const 0) (local.get 0x2bc)) + (i64.store offset=0x2bd align=1 (i32.const 0) (local.get 0x2bd)) + (i64.store offset=0x2be align=1 (i32.const 0) (local.get 0x2be)) + (i64.store offset=0x2bf align=1 (i32.const 0) (local.get 0x2bf)) + (i64.store offset=0x2c0 align=1 (i32.const 0) (local.get 0x2c0)) + (i64.store offset=0x2c1 align=1 (i32.const 0) (local.get 0x2c1)) + (i64.store offset=0x2c2 align=1 (i32.const 0) (local.get 0x2c2)) + (i64.store offset=0x2c3 align=1 (i32.const 0) (local.get 0x2c3)) + (i64.store offset=0x2c4 align=1 (i32.const 0) (local.get 0x2c4)) + (i64.store offset=0x2c5 align=1 (i32.const 0) (local.get 0x2c5)) + (i64.store offset=0x2c6 align=1 (i32.const 0) (local.get 0x2c6)) + (i64.store offset=0x2c7 align=1 (i32.const 0) (local.get 0x2c7)) + (i64.store offset=0x2c8 align=1 (i32.const 0) (local.get 0x2c8)) + (i64.store offset=0x2c9 align=1 (i32.const 0) (local.get 0x2c9)) + (i64.store offset=0x2ca align=1 (i32.const 0) (local.get 0x2ca)) + (i64.store offset=0x2cb align=1 (i32.const 0) (local.get 0x2cb)) + (i64.store offset=0x2cc align=1 (i32.const 0) (local.get 0x2cc)) + (i64.store offset=0x2cd align=1 (i32.const 0) (local.get 0x2cd)) + (i64.store offset=0x2ce align=1 (i32.const 0) (local.get 0x2ce)) + (i64.store offset=0x2cf align=1 (i32.const 0) (local.get 0x2cf)) + (i64.store offset=0x2d0 align=1 (i32.const 0) (local.get 0x2d0)) + (i64.store offset=0x2d1 align=1 (i32.const 0) (local.get 0x2d1)) + (i64.store offset=0x2d2 align=1 (i32.const 0) (local.get 0x2d2)) + (i64.store offset=0x2d3 align=1 (i32.const 0) (local.get 0x2d3)) + (i64.store offset=0x2d4 align=1 (i32.const 0) (local.get 0x2d4)) + (i64.store offset=0x2d5 align=1 (i32.const 0) (local.get 0x2d5)) + (i64.store offset=0x2d6 align=1 (i32.const 0) (local.get 0x2d6)) + (i64.store offset=0x2d7 align=1 (i32.const 0) (local.get 0x2d7)) + (i64.store offset=0x2d8 align=1 (i32.const 0) (local.get 0x2d8)) + (i64.store offset=0x2d9 align=1 (i32.const 0) (local.get 0x2d9)) + (i64.store offset=0x2da align=1 (i32.const 0) (local.get 0x2da)) + (i64.store offset=0x2db align=1 (i32.const 0) (local.get 0x2db)) + (i64.store offset=0x2dc align=1 (i32.const 0) (local.get 0x2dc)) + (i64.store offset=0x2dd align=1 (i32.const 0) (local.get 0x2dd)) + (i64.store offset=0x2de align=1 (i32.const 0) (local.get 0x2de)) + (i64.store offset=0x2df align=1 (i32.const 0) (local.get 0x2df)) + (i64.store offset=0x2e0 align=1 (i32.const 0) (local.get 0x2e0)) + (i64.store offset=0x2e1 align=1 (i32.const 0) (local.get 0x2e1)) + (i64.store offset=0x2e2 align=1 (i32.const 0) (local.get 0x2e2)) + (i64.store offset=0x2e3 align=1 (i32.const 0) (local.get 0x2e3)) + (i64.store offset=0x2e4 align=1 (i32.const 0) (local.get 0x2e4)) + (i64.store offset=0x2e5 align=1 (i32.const 0) (local.get 0x2e5)) + (i64.store offset=0x2e6 align=1 (i32.const 0) (local.get 0x2e6)) + (i64.store offset=0x2e7 align=1 (i32.const 0) (local.get 0x2e7)) + (i64.store offset=0x2e8 align=1 (i32.const 0) (local.get 0x2e8)) + (i64.store offset=0x2e9 align=1 (i32.const 0) (local.get 0x2e9)) + (i64.store offset=0x2ea align=1 (i32.const 0) (local.get 0x2ea)) + (i64.store offset=0x2eb align=1 (i32.const 0) (local.get 0x2eb)) + (i64.store offset=0x2ec align=1 (i32.const 0) (local.get 0x2ec)) + (i64.store offset=0x2ed align=1 (i32.const 0) (local.get 0x2ed)) + (i64.store offset=0x2ee align=1 (i32.const 0) (local.get 0x2ee)) + (i64.store offset=0x2ef align=1 (i32.const 0) (local.get 0x2ef)) + (i64.store offset=0x2f0 align=1 (i32.const 0) (local.get 0x2f0)) + (i64.store offset=0x2f1 align=1 (i32.const 0) (local.get 0x2f1)) + (i64.store offset=0x2f2 align=1 (i32.const 0) (local.get 0x2f2)) + (i64.store offset=0x2f3 align=1 (i32.const 0) (local.get 0x2f3)) + (i64.store offset=0x2f4 align=1 (i32.const 0) (local.get 0x2f4)) + (i64.store offset=0x2f5 align=1 (i32.const 0) (local.get 0x2f5)) + (i64.store offset=0x2f6 align=1 (i32.const 0) (local.get 0x2f6)) + (i64.store offset=0x2f7 align=1 (i32.const 0) (local.get 0x2f7)) + (i64.store offset=0x2f8 align=1 (i32.const 0) (local.get 0x2f8)) + (i64.store offset=0x2f9 align=1 (i32.const 0) (local.get 0x2f9)) + (i64.store offset=0x2fa align=1 (i32.const 0) (local.get 0x2fa)) + (i64.store offset=0x2fb align=1 (i32.const 0) (local.get 0x2fb)) + (i64.store offset=0x2fc align=1 (i32.const 0) (local.get 0x2fc)) + (i64.store offset=0x2fd align=1 (i32.const 0) (local.get 0x2fd)) + (i64.store offset=0x2fe align=1 (i32.const 0) (local.get 0x2fe)) + (i64.store offset=0x2ff align=1 (i32.const 0) (local.get 0x2ff)) + (i64.store offset=0x300 align=1 (i32.const 0) (local.get 0x300)) + (i64.store offset=0x301 align=1 (i32.const 0) (local.get 0x301)) + (i64.store offset=0x302 align=1 (i32.const 0) (local.get 0x302)) + (i64.store offset=0x303 align=1 (i32.const 0) (local.get 0x303)) + (i64.store offset=0x304 align=1 (i32.const 0) (local.get 0x304)) + (i64.store offset=0x305 align=1 (i32.const 0) (local.get 0x305)) + (i64.store offset=0x306 align=1 (i32.const 0) (local.get 0x306)) + (i64.store offset=0x307 align=1 (i32.const 0) (local.get 0x307)) + (i64.store offset=0x308 align=1 (i32.const 0) (local.get 0x308)) + (i64.store offset=0x309 align=1 (i32.const 0) (local.get 0x309)) + (i64.store offset=0x30a align=1 (i32.const 0) (local.get 0x30a)) + (i64.store offset=0x30b align=1 (i32.const 0) (local.get 0x30b)) + (i64.store offset=0x30c align=1 (i32.const 0) (local.get 0x30c)) + (i64.store offset=0x30d align=1 (i32.const 0) (local.get 0x30d)) + (i64.store offset=0x30e align=1 (i32.const 0) (local.get 0x30e)) + (i64.store offset=0x30f align=1 (i32.const 0) (local.get 0x30f)) + (i64.store offset=0x310 align=1 (i32.const 0) (local.get 0x310)) + (i64.store offset=0x311 align=1 (i32.const 0) (local.get 0x311)) + (i64.store offset=0x312 align=1 (i32.const 0) (local.get 0x312)) + (i64.store offset=0x313 align=1 (i32.const 0) (local.get 0x313)) + (i64.store offset=0x314 align=1 (i32.const 0) (local.get 0x314)) + (i64.store offset=0x315 align=1 (i32.const 0) (local.get 0x315)) + (i64.store offset=0x316 align=1 (i32.const 0) (local.get 0x316)) + (i64.store offset=0x317 align=1 (i32.const 0) (local.get 0x317)) + (i64.store offset=0x318 align=1 (i32.const 0) (local.get 0x318)) + (i64.store offset=0x319 align=1 (i32.const 0) (local.get 0x319)) + (i64.store offset=0x31a align=1 (i32.const 0) (local.get 0x31a)) + (i64.store offset=0x31b align=1 (i32.const 0) (local.get 0x31b)) + (i64.store offset=0x31c align=1 (i32.const 0) (local.get 0x31c)) + (i64.store offset=0x31d align=1 (i32.const 0) (local.get 0x31d)) + (i64.store offset=0x31e align=1 (i32.const 0) (local.get 0x31e)) + (i64.store offset=0x31f align=1 (i32.const 0) (local.get 0x31f)) + (i64.store offset=0x320 align=1 (i32.const 0) (local.get 0x320)) + (i64.store offset=0x321 align=1 (i32.const 0) (local.get 0x321)) + (i64.store offset=0x322 align=1 (i32.const 0) (local.get 0x322)) + (i64.store offset=0x323 align=1 (i32.const 0) (local.get 0x323)) + (i64.store offset=0x324 align=1 (i32.const 0) (local.get 0x324)) + (i64.store offset=0x325 align=1 (i32.const 0) (local.get 0x325)) + (i64.store offset=0x326 align=1 (i32.const 0) (local.get 0x326)) + (i64.store offset=0x327 align=1 (i32.const 0) (local.get 0x327)) + (i64.store offset=0x328 align=1 (i32.const 0) (local.get 0x328)) + (i64.store offset=0x329 align=1 (i32.const 0) (local.get 0x329)) + (i64.store offset=0x32a align=1 (i32.const 0) (local.get 0x32a)) + (i64.store offset=0x32b align=1 (i32.const 0) (local.get 0x32b)) + (i64.store offset=0x32c align=1 (i32.const 0) (local.get 0x32c)) + (i64.store offset=0x32d align=1 (i32.const 0) (local.get 0x32d)) + (i64.store offset=0x32e align=1 (i32.const 0) (local.get 0x32e)) + (i64.store offset=0x32f align=1 (i32.const 0) (local.get 0x32f)) + (i64.store offset=0x330 align=1 (i32.const 0) (local.get 0x330)) + (i64.store offset=0x331 align=1 (i32.const 0) (local.get 0x331)) + (i64.store offset=0x332 align=1 (i32.const 0) (local.get 0x332)) + (i64.store offset=0x333 align=1 (i32.const 0) (local.get 0x333)) + (i64.store offset=0x334 align=1 (i32.const 0) (local.get 0x334)) + (i64.store offset=0x335 align=1 (i32.const 0) (local.get 0x335)) + (i64.store offset=0x336 align=1 (i32.const 0) (local.get 0x336)) + (i64.store offset=0x337 align=1 (i32.const 0) (local.get 0x337)) + (i64.store offset=0x338 align=1 (i32.const 0) (local.get 0x338)) + (i64.store offset=0x339 align=1 (i32.const 0) (local.get 0x339)) + (i64.store offset=0x33a align=1 (i32.const 0) (local.get 0x33a)) + (i64.store offset=0x33b align=1 (i32.const 0) (local.get 0x33b)) + (i64.store offset=0x33c align=1 (i32.const 0) (local.get 0x33c)) + (i64.store offset=0x33d align=1 (i32.const 0) (local.get 0x33d)) + (i64.store offset=0x33e align=1 (i32.const 0) (local.get 0x33e)) + (i64.store offset=0x33f align=1 (i32.const 0) (local.get 0x33f)) + (i64.store offset=0x340 align=1 (i32.const 0) (local.get 0x340)) + (i64.store offset=0x341 align=1 (i32.const 0) (local.get 0x341)) + (i64.store offset=0x342 align=1 (i32.const 0) (local.get 0x342)) + (i64.store offset=0x343 align=1 (i32.const 0) (local.get 0x343)) + (i64.store offset=0x344 align=1 (i32.const 0) (local.get 0x344)) + (i64.store offset=0x345 align=1 (i32.const 0) (local.get 0x345)) + (i64.store offset=0x346 align=1 (i32.const 0) (local.get 0x346)) + (i64.store offset=0x347 align=1 (i32.const 0) (local.get 0x347)) + (i64.store offset=0x348 align=1 (i32.const 0) (local.get 0x348)) + (i64.store offset=0x349 align=1 (i32.const 0) (local.get 0x349)) + (i64.store offset=0x34a align=1 (i32.const 0) (local.get 0x34a)) + (i64.store offset=0x34b align=1 (i32.const 0) (local.get 0x34b)) + (i64.store offset=0x34c align=1 (i32.const 0) (local.get 0x34c)) + (i64.store offset=0x34d align=1 (i32.const 0) (local.get 0x34d)) + (i64.store offset=0x34e align=1 (i32.const 0) (local.get 0x34e)) + (i64.store offset=0x34f align=1 (i32.const 0) (local.get 0x34f)) + (i64.store offset=0x350 align=1 (i32.const 0) (local.get 0x350)) + (i64.store offset=0x351 align=1 (i32.const 0) (local.get 0x351)) + (i64.store offset=0x352 align=1 (i32.const 0) (local.get 0x352)) + (i64.store offset=0x353 align=1 (i32.const 0) (local.get 0x353)) + (i64.store offset=0x354 align=1 (i32.const 0) (local.get 0x354)) + (i64.store offset=0x355 align=1 (i32.const 0) (local.get 0x355)) + (i64.store offset=0x356 align=1 (i32.const 0) (local.get 0x356)) + (i64.store offset=0x357 align=1 (i32.const 0) (local.get 0x357)) + (i64.store offset=0x358 align=1 (i32.const 0) (local.get 0x358)) + (i64.store offset=0x359 align=1 (i32.const 0) (local.get 0x359)) + (i64.store offset=0x35a align=1 (i32.const 0) (local.get 0x35a)) + (i64.store offset=0x35b align=1 (i32.const 0) (local.get 0x35b)) + (i64.store offset=0x35c align=1 (i32.const 0) (local.get 0x35c)) + (i64.store offset=0x35d align=1 (i32.const 0) (local.get 0x35d)) + (i64.store offset=0x35e align=1 (i32.const 0) (local.get 0x35e)) + (i64.store offset=0x35f align=1 (i32.const 0) (local.get 0x35f)) + (i64.store offset=0x360 align=1 (i32.const 0) (local.get 0x360)) + (i64.store offset=0x361 align=1 (i32.const 0) (local.get 0x361)) + (i64.store offset=0x362 align=1 (i32.const 0) (local.get 0x362)) + (i64.store offset=0x363 align=1 (i32.const 0) (local.get 0x363)) + (i64.store offset=0x364 align=1 (i32.const 0) (local.get 0x364)) + (i64.store offset=0x365 align=1 (i32.const 0) (local.get 0x365)) + (i64.store offset=0x366 align=1 (i32.const 0) (local.get 0x366)) + (i64.store offset=0x367 align=1 (i32.const 0) (local.get 0x367)) + (i64.store offset=0x368 align=1 (i32.const 0) (local.get 0x368)) + (i64.store offset=0x369 align=1 (i32.const 0) (local.get 0x369)) + (i64.store offset=0x36a align=1 (i32.const 0) (local.get 0x36a)) + (i64.store offset=0x36b align=1 (i32.const 0) (local.get 0x36b)) + (i64.store offset=0x36c align=1 (i32.const 0) (local.get 0x36c)) + (i64.store offset=0x36d align=1 (i32.const 0) (local.get 0x36d)) + (i64.store offset=0x36e align=1 (i32.const 0) (local.get 0x36e)) + (i64.store offset=0x36f align=1 (i32.const 0) (local.get 0x36f)) + (i64.store offset=0x370 align=1 (i32.const 0) (local.get 0x370)) + (i64.store offset=0x371 align=1 (i32.const 0) (local.get 0x371)) + (i64.store offset=0x372 align=1 (i32.const 0) (local.get 0x372)) + (i64.store offset=0x373 align=1 (i32.const 0) (local.get 0x373)) + (i64.store offset=0x374 align=1 (i32.const 0) (local.get 0x374)) + (i64.store offset=0x375 align=1 (i32.const 0) (local.get 0x375)) + (i64.store offset=0x376 align=1 (i32.const 0) (local.get 0x376)) + (i64.store offset=0x377 align=1 (i32.const 0) (local.get 0x377)) + (i64.store offset=0x378 align=1 (i32.const 0) (local.get 0x378)) + (i64.store offset=0x379 align=1 (i32.const 0) (local.get 0x379)) + (i64.store offset=0x37a align=1 (i32.const 0) (local.get 0x37a)) + (i64.store offset=0x37b align=1 (i32.const 0) (local.get 0x37b)) + (i64.store offset=0x37c align=1 (i32.const 0) (local.get 0x37c)) + (i64.store offset=0x37d align=1 (i32.const 0) (local.get 0x37d)) + (i64.store offset=0x37e align=1 (i32.const 0) (local.get 0x37e)) + (i64.store offset=0x37f align=1 (i32.const 0) (local.get 0x37f)) + (i64.store offset=0x380 align=1 (i32.const 0) (local.get 0x380)) + (i64.store offset=0x381 align=1 (i32.const 0) (local.get 0x381)) + (i64.store offset=0x382 align=1 (i32.const 0) (local.get 0x382)) + (i64.store offset=0x383 align=1 (i32.const 0) (local.get 0x383)) + (i64.store offset=0x384 align=1 (i32.const 0) (local.get 0x384)) + (i64.store offset=0x385 align=1 (i32.const 0) (local.get 0x385)) + (i64.store offset=0x386 align=1 (i32.const 0) (local.get 0x386)) + (i64.store offset=0x387 align=1 (i32.const 0) (local.get 0x387)) + (i64.store offset=0x388 align=1 (i32.const 0) (local.get 0x388)) + (i64.store offset=0x389 align=1 (i32.const 0) (local.get 0x389)) + (i64.store offset=0x38a align=1 (i32.const 0) (local.get 0x38a)) + (i64.store offset=0x38b align=1 (i32.const 0) (local.get 0x38b)) + (i64.store offset=0x38c align=1 (i32.const 0) (local.get 0x38c)) + (i64.store offset=0x38d align=1 (i32.const 0) (local.get 0x38d)) + (i64.store offset=0x38e align=1 (i32.const 0) (local.get 0x38e)) + (i64.store offset=0x38f align=1 (i32.const 0) (local.get 0x38f)) + (i64.store offset=0x390 align=1 (i32.const 0) (local.get 0x390)) + (i64.store offset=0x391 align=1 (i32.const 0) (local.get 0x391)) + (i64.store offset=0x392 align=1 (i32.const 0) (local.get 0x392)) + (i64.store offset=0x393 align=1 (i32.const 0) (local.get 0x393)) + (i64.store offset=0x394 align=1 (i32.const 0) (local.get 0x394)) + (i64.store offset=0x395 align=1 (i32.const 0) (local.get 0x395)) + (i64.store offset=0x396 align=1 (i32.const 0) (local.get 0x396)) + (i64.store offset=0x397 align=1 (i32.const 0) (local.get 0x397)) + (i64.store offset=0x398 align=1 (i32.const 0) (local.get 0x398)) + (i64.store offset=0x399 align=1 (i32.const 0) (local.get 0x399)) + (i64.store offset=0x39a align=1 (i32.const 0) (local.get 0x39a)) + (i64.store offset=0x39b align=1 (i32.const 0) (local.get 0x39b)) + (i64.store offset=0x39c align=1 (i32.const 0) (local.get 0x39c)) + (i64.store offset=0x39d align=1 (i32.const 0) (local.get 0x39d)) + (i64.store offset=0x39e align=1 (i32.const 0) (local.get 0x39e)) + (i64.store offset=0x39f align=1 (i32.const 0) (local.get 0x39f)) + (i64.store offset=0x3a0 align=1 (i32.const 0) (local.get 0x3a0)) + (i64.store offset=0x3a1 align=1 (i32.const 0) (local.get 0x3a1)) + (i64.store offset=0x3a2 align=1 (i32.const 0) (local.get 0x3a2)) + (i64.store offset=0x3a3 align=1 (i32.const 0) (local.get 0x3a3)) + (i64.store offset=0x3a4 align=1 (i32.const 0) (local.get 0x3a4)) + (i64.store offset=0x3a5 align=1 (i32.const 0) (local.get 0x3a5)) + (i64.store offset=0x3a6 align=1 (i32.const 0) (local.get 0x3a6)) + (i64.store offset=0x3a7 align=1 (i32.const 0) (local.get 0x3a7)) + (i64.store offset=0x3a8 align=1 (i32.const 0) (local.get 0x3a8)) + (i64.store offset=0x3a9 align=1 (i32.const 0) (local.get 0x3a9)) + (i64.store offset=0x3aa align=1 (i32.const 0) (local.get 0x3aa)) + (i64.store offset=0x3ab align=1 (i32.const 0) (local.get 0x3ab)) + (i64.store offset=0x3ac align=1 (i32.const 0) (local.get 0x3ac)) + (i64.store offset=0x3ad align=1 (i32.const 0) (local.get 0x3ad)) + (i64.store offset=0x3ae align=1 (i32.const 0) (local.get 0x3ae)) + (i64.store offset=0x3af align=1 (i32.const 0) (local.get 0x3af)) + (i64.store offset=0x3b0 align=1 (i32.const 0) (local.get 0x3b0)) + (i64.store offset=0x3b1 align=1 (i32.const 0) (local.get 0x3b1)) + (i64.store offset=0x3b2 align=1 (i32.const 0) (local.get 0x3b2)) + (i64.store offset=0x3b3 align=1 (i32.const 0) (local.get 0x3b3)) + (i64.store offset=0x3b4 align=1 (i32.const 0) (local.get 0x3b4)) + (i64.store offset=0x3b5 align=1 (i32.const 0) (local.get 0x3b5)) + (i64.store offset=0x3b6 align=1 (i32.const 0) (local.get 0x3b6)) + (i64.store offset=0x3b7 align=1 (i32.const 0) (local.get 0x3b7)) + (i64.store offset=0x3b8 align=1 (i32.const 0) (local.get 0x3b8)) + (i64.store offset=0x3b9 align=1 (i32.const 0) (local.get 0x3b9)) + (i64.store offset=0x3ba align=1 (i32.const 0) (local.get 0x3ba)) + (i64.store offset=0x3bb align=1 (i32.const 0) (local.get 0x3bb)) + (i64.store offset=0x3bc align=1 (i32.const 0) (local.get 0x3bc)) + (i64.store offset=0x3bd align=1 (i32.const 0) (local.get 0x3bd)) + (i64.store offset=0x3be align=1 (i32.const 0) (local.get 0x3be)) + (i64.store offset=0x3bf align=1 (i32.const 0) (local.get 0x3bf)) + (i64.store offset=0x3c0 align=1 (i32.const 0) (local.get 0x3c0)) + (i64.store offset=0x3c1 align=1 (i32.const 0) (local.get 0x3c1)) + (i64.store offset=0x3c2 align=1 (i32.const 0) (local.get 0x3c2)) + (i64.store offset=0x3c3 align=1 (i32.const 0) (local.get 0x3c3)) + (i64.store offset=0x3c4 align=1 (i32.const 0) (local.get 0x3c4)) + (i64.store offset=0x3c5 align=1 (i32.const 0) (local.get 0x3c5)) + (i64.store offset=0x3c6 align=1 (i32.const 0) (local.get 0x3c6)) + (i64.store offset=0x3c7 align=1 (i32.const 0) (local.get 0x3c7)) + (i64.store offset=0x3c8 align=1 (i32.const 0) (local.get 0x3c8)) + (i64.store offset=0x3c9 align=1 (i32.const 0) (local.get 0x3c9)) + (i64.store offset=0x3ca align=1 (i32.const 0) (local.get 0x3ca)) + (i64.store offset=0x3cb align=1 (i32.const 0) (local.get 0x3cb)) + (i64.store offset=0x3cc align=1 (i32.const 0) (local.get 0x3cc)) + (i64.store offset=0x3cd align=1 (i32.const 0) (local.get 0x3cd)) + (i64.store offset=0x3ce align=1 (i32.const 0) (local.get 0x3ce)) + (i64.store offset=0x3cf align=1 (i32.const 0) (local.get 0x3cf)) + (i64.store offset=0x3d0 align=1 (i32.const 0) (local.get 0x3d0)) + (i64.store offset=0x3d1 align=1 (i32.const 0) (local.get 0x3d1)) + (i64.store offset=0x3d2 align=1 (i32.const 0) (local.get 0x3d2)) + (i64.store offset=0x3d3 align=1 (i32.const 0) (local.get 0x3d3)) + (i64.store offset=0x3d4 align=1 (i32.const 0) (local.get 0x3d4)) + (i64.store offset=0x3d5 align=1 (i32.const 0) (local.get 0x3d5)) + (i64.store offset=0x3d6 align=1 (i32.const 0) (local.get 0x3d6)) + (i64.store offset=0x3d7 align=1 (i32.const 0) (local.get 0x3d7)) + (i64.store offset=0x3d8 align=1 (i32.const 0) (local.get 0x3d8)) + (i64.store offset=0x3d9 align=1 (i32.const 0) (local.get 0x3d9)) + (i64.store offset=0x3da align=1 (i32.const 0) (local.get 0x3da)) + (i64.store offset=0x3db align=1 (i32.const 0) (local.get 0x3db)) + (i64.store offset=0x3dc align=1 (i32.const 0) (local.get 0x3dc)) + (i64.store offset=0x3dd align=1 (i32.const 0) (local.get 0x3dd)) + (i64.store offset=0x3de align=1 (i32.const 0) (local.get 0x3de)) + (i64.store offset=0x3df align=1 (i32.const 0) (local.get 0x3df)) + (i64.store offset=0x3e0 align=1 (i32.const 0) (local.get 0x3e0)) + (i64.store offset=0x3e1 align=1 (i32.const 0) (local.get 0x3e1)) + (i64.store offset=0x3e2 align=1 (i32.const 0) (local.get 0x3e2)) + (i64.store offset=0x3e3 align=1 (i32.const 0) (local.get 0x3e3)) + (i64.store offset=0x3e4 align=1 (i32.const 0) (local.get 0x3e4)) + (i64.store offset=0x3e5 align=1 (i32.const 0) (local.get 0x3e5)) + (i64.store offset=0x3e6 align=1 (i32.const 0) (local.get 0x3e6)) + (i64.store offset=0x3e7 align=1 (i32.const 0) (local.get 0x3e7)) + (i64.store offset=0x3e8 align=1 (i32.const 0) (local.get 0x3e8)) + (i64.store offset=0x3e9 align=1 (i32.const 0) (local.get 0x3e9)) + (i64.store offset=0x3ea align=1 (i32.const 0) (local.get 0x3ea)) + (i64.store offset=0x3eb align=1 (i32.const 0) (local.get 0x3eb)) + (i64.store offset=0x3ec align=1 (i32.const 0) (local.get 0x3ec)) + (i64.store offset=0x3ed align=1 (i32.const 0) (local.get 0x3ed)) + (i64.store offset=0x3ee align=1 (i32.const 0) (local.get 0x3ee)) + (i64.store offset=0x3ef align=1 (i32.const 0) (local.get 0x3ef)) + (i64.store offset=0x3f0 align=1 (i32.const 0) (local.get 0x3f0)) + (i64.store offset=0x3f1 align=1 (i32.const 0) (local.get 0x3f1)) + (i64.store offset=0x3f2 align=1 (i32.const 0) (local.get 0x3f2)) + (i64.store offset=0x3f3 align=1 (i32.const 0) (local.get 0x3f3)) + (i64.store offset=0x3f4 align=1 (i32.const 0) (local.get 0x3f4)) + (i64.store offset=0x3f5 align=1 (i32.const 0) (local.get 0x3f5)) + (i64.store offset=0x3f6 align=1 (i32.const 0) (local.get 0x3f6)) + (i64.store offset=0x3f7 align=1 (i32.const 0) (local.get 0x3f7)) + (i64.store offset=0x3f8 align=1 (i32.const 0) (local.get 0x3f8)) + (i64.store offset=0x3f9 align=1 (i32.const 0) (local.get 0x3f9)) + (i64.store offset=0x3fa align=1 (i32.const 0) (local.get 0x3fa)) + (i64.store offset=0x3fb align=1 (i32.const 0) (local.get 0x3fb)) + (i64.store offset=0x3fc align=1 (i32.const 0) (local.get 0x3fc)) + (i64.store offset=0x3fd align=1 (i32.const 0) (local.get 0x3fd)) + (i64.store offset=0x3fe align=1 (i32.const 0) (local.get 0x3fe)) + (i64.store offset=0x3ff align=1 (i32.const 0) (local.get 0x3ff)) + (i64.store offset=0x400 align=1 (i32.const 0) (local.get 0x400)) + (i64.store offset=0x401 align=1 (i32.const 0) (local.get 0x401)) + (i64.store offset=0x402 align=1 (i32.const 0) (local.get 0x402)) + (i64.store offset=0x403 align=1 (i32.const 0) (local.get 0x403)) + (i64.store offset=0x404 align=1 (i32.const 0) (local.get 0x404)) + (i64.store offset=0x405 align=1 (i32.const 0) (local.get 0x405)) + (i64.store offset=0x406 align=1 (i32.const 0) (local.get 0x406)) + (i64.store offset=0x407 align=1 (i32.const 0) (local.get 0x407)) + (i64.store offset=0x408 align=1 (i32.const 0) (local.get 0x408)) + (i64.store offset=0x409 align=1 (i32.const 0) (local.get 0x409)) + (i64.store offset=0x40a align=1 (i32.const 0) (local.get 0x40a)) + (i64.store offset=0x40b align=1 (i32.const 0) (local.get 0x40b)) + (i64.store offset=0x40c align=1 (i32.const 0) (local.get 0x40c)) + (i64.store offset=0x40d align=1 (i32.const 0) (local.get 0x40d)) + (i64.store offset=0x40e align=1 (i32.const 0) (local.get 0x40e)) + (i64.store offset=0x40f align=1 (i32.const 0) (local.get 0x40f)) + (i64.store offset=0x410 align=1 (i32.const 0) (local.get 0x410)) + (i64.store offset=0x411 align=1 (i32.const 0) (local.get 0x411)) + (i64.store offset=0x412 align=1 (i32.const 0) (local.get 0x412)) + (i64.store offset=0x413 align=1 (i32.const 0) (local.get 0x413)) + (i64.store offset=0x414 align=1 (i32.const 0) (local.get 0x414)) + (i64.store offset=0x415 align=1 (i32.const 0) (local.get 0x415)) + (i64.store offset=0x416 align=1 (i32.const 0) (local.get 0x416)) + (i64.store offset=0x417 align=1 (i32.const 0) (local.get 0x417)) + (i64.store offset=0x418 align=1 (i32.const 0) (local.get 0x418)) + (i64.store offset=0x419 align=1 (i32.const 0) (local.get 0x419)) + (i64.store offset=0x41a align=1 (i32.const 0) (local.get 0x41a)) + (i64.store offset=0x41b align=1 (i32.const 0) (local.get 0x41b)) + (i64.store offset=0x41c align=1 (i32.const 0) (local.get 0x41c)) + (i64.store offset=0x41d align=1 (i32.const 0) (local.get 0x41d)) + (i64.store offset=0x41e align=1 (i32.const 0) (local.get 0x41e)) + (i64.store offset=0x41f align=1 (i32.const 0) (local.get 0x41f)) ) ) @@ -2281,4 +2281,4 @@ (assert_exhaustion (invoke "test-guard-page-skip" (i32.const 600)) "call stack exhausted") (assert_exhaustion (invoke "test-guard-page-skip" (i32.const 700)) "call stack exhausted") (assert_exhaustion (invoke "test-guard-page-skip" (i32.const 800)) "call stack exhausted") -(assert_exhaustion (invoke "test-guard-page-skip" (i32.const 900)) "call stack exhausted") \ No newline at end of file +(assert_exhaustion (invoke "test-guard-page-skip" (i32.const 900)) "call stack exhausted") diff --git a/test/core/stack.wast b/test/core/stack.wast index f685b17f..d0c46955 100644 --- a/test/core/stack.wast +++ b/test/core/stack.wast @@ -2,131 +2,219 @@ (func (export "fac-expr") (param $n i64) (result i64) (local $i i64) (local $res i64) - (set_local $i (get_local $n)) - (set_local $res (i64.const 1)) + (local.set $i (local.get $n)) + (local.set $res (i64.const 1)) (block $done (loop $loop (if - (i64.eq (get_local $i) (i64.const 0)) - (br $done) - (block - (set_local $res (i64.mul (get_local $i) (get_local $res))) - (set_local $i (i64.sub (get_local $i) (i64.const 1))) + (i64.eq (local.get $i) (i64.const 0)) + (then (br $done)) + (else + (local.set $res (i64.mul (local.get $i) (local.get $res))) + (local.set $i (i64.sub (local.get $i) (i64.const 1))) ) ) (br $loop) ) ) - (get_local $res) + (local.get $res) ) (func (export "fac-stack") (param $n i64) (result i64) (local $i i64) (local $res i64) - (get_local $n) - (set_local $i) + (local.get $n) + (local.set $i) (i64.const 1) - (set_local $res) + (local.set $res) (block $done (loop $loop - (get_local $i) + (local.get $i) (i64.const 0) (i64.eq) (if (then (br $done)) (else - (get_local $i) - (get_local $res) + (local.get $i) + (local.get $res) (i64.mul) - (set_local $res) - (get_local $i) + (local.set $res) + (local.get $i) (i64.const 1) (i64.sub) - (set_local $i) + (local.set $i) ) ) (br $loop) ) ) - (get_local $res) + (local.get $res) ) (func (export "fac-stack-raw") (param $n i64) (result i64) (local $i i64) (local $res i64) - get_local $n - set_local $i + local.get $n + local.set $i i64.const 1 - set_local $res + local.set $res block $done loop $loop - get_local $i + local.get $i i64.const 0 i64.eq if $body br $done else $body - get_local $i - get_local $res + local.get $i + local.get $res i64.mul - set_local $res - get_local $i + local.set $res + local.get $i i64.const 1 i64.sub - set_local $i + local.set $i end $body br $loop end $loop end $done - get_local $res + local.get $res ) (func (export "fac-mixed") (param $n i64) (result i64) (local $i i64) (local $res i64) - (set_local $i (get_local $n)) - (set_local $res (i64.const 1)) + (local.set $i (local.get $n)) + (local.set $res (i64.const 1)) (block $done (loop $loop - (i64.eq (get_local $i) (i64.const 0)) + (i64.eq (local.get $i) (i64.const 0)) (if (then (br $done)) (else - (i64.mul (get_local $i) (get_local $res)) - (set_local $res) - (i64.sub (get_local $i) (i64.const 1)) - (set_local $i) + (i64.mul (local.get $i) (local.get $res)) + (local.set $res) + (i64.sub (local.get $i) (i64.const 1)) + (local.set $i) ) ) (br $loop) ) ) - (get_local $res) + (local.get $res) ) (func (export "fac-mixed-raw") (param $n i64) (result i64) (local $i i64) (local $res i64) - (set_local $i (get_local $n)) - (set_local $res (i64.const 1)) + (local.set $i (local.get $n)) + (local.set $res (i64.const 1)) block $done loop $loop - (i64.eq (get_local $i) (i64.const 0)) + (i64.eq (local.get $i) (i64.const 0)) if br $done else - (i64.mul (get_local $i) (get_local $res)) - set_local $res - (i64.sub (get_local $i) (i64.const 1)) - set_local $i + (i64.mul (local.get $i) (local.get $res)) + local.set $res + (i64.sub (local.get $i) (i64.const 1)) + local.set $i end br $loop end end - get_local $res + local.get $res ) ) (assert_return (invoke "fac-expr" (i64.const 25)) (i64.const 7034535277573963776)) (assert_return (invoke "fac-stack" (i64.const 25)) (i64.const 7034535277573963776)) (assert_return (invoke "fac-mixed" (i64.const 25)) (i64.const 7034535277573963776)) + + +;; Syntax of flat call_indirect + +(module + (type $proc (func)) + (table 1 funcref) + + (func + (block i32.const 0 call_indirect) + (loop i32.const 0 call_indirect) + (if (i32.const 0) (then i32.const 0 call_indirect)) + (if (i32.const 0) + (then i32.const 0 call_indirect) + (else i32.const 0 call_indirect) + ) + (block i32.const 0 call_indirect (type $proc)) + (loop i32.const 0 call_indirect (type $proc)) + (if (i32.const 0) (then i32.const 0 call_indirect (type $proc))) + (if (i32.const 0) + (then i32.const 0 call_indirect (type $proc)) + (else i32.const 0 call_indirect (type $proc)) + ) + (block i32.const 0 i32.const 0 call_indirect (param i32)) + (loop i32.const 0 i32.const 0 call_indirect (param i32)) + (if (i32.const 0) (then i32.const 0 i32.const 0 call_indirect (param i32))) + (if (i32.const 0) + (then i32.const 0 i32.const 0 call_indirect (param i32)) + (else i32.const 0 i32.const 0 call_indirect (param i32)) + ) + (block (result i32) i32.const 0 call_indirect (result i32)) (drop) + (loop (result i32) i32.const 0 call_indirect (result i32)) (drop) + (if (result i32) (i32.const 0) + (then i32.const 0 call_indirect (result i32)) + (else i32.const 0 call_indirect (result i32)) + ) (drop) + (block i32.const 0 call_indirect (type $proc) (param) (result)) + (loop i32.const 0 call_indirect (type $proc) (param) (result)) + (if (i32.const 0) + (then i32.const 0 call_indirect (type $proc) (param) (result)) + ) + (if (i32.const 0) + (then i32.const 0 call_indirect (type $proc) (param) (param) (result)) + (else i32.const 0 call_indirect (type $proc) (param) (result) (result)) + ) + + block i32.const 0 call_indirect end + loop i32.const 0 call_indirect end + i32.const 0 if i32.const 0 call_indirect end + i32.const 0 if i32.const 0 call_indirect else i32.const 0 call_indirect end + block i32.const 0 call_indirect (type $proc) end + loop i32.const 0 call_indirect (type $proc) end + i32.const 0 if i32.const 0 call_indirect (type $proc) end + i32.const 0 + if + i32.const 0 call_indirect (type $proc) + else + i32.const 0 call_indirect (type $proc) + end + block i32.const 0 i32.const 0 call_indirect (param i32) end + loop i32.const 0 i32.const 0 call_indirect (param i32) end + i32.const 0 if i32.const 0 i32.const 0 call_indirect (param i32) end + i32.const 0 + if + i32.const 0 i32.const 0 call_indirect (param i32) + else + i32.const 0 i32.const 0 call_indirect (param i32) + end + block (result i32) i32.const 0 call_indirect (result i32) end drop + loop (result i32) i32.const 0 call_indirect (result i32) end drop + i32.const 0 + if (result i32) + i32.const 0 call_indirect (result i32) + else + i32.const 0 call_indirect (result i32) + end drop + block i32.const 0 call_indirect (type $proc) (param) (result) end + loop i32.const 0 call_indirect (type $proc) (param) (result) end + i32.const 0 if i32.const 0 call_indirect (type $proc) (param) (result) end + i32.const 0 + if + i32.const 0 call_indirect (type $proc) (param) (result) + else + i32.const 0 call_indirect (type $proc) (param) (param) (result) (result) + end + i32.const 0 call_indirect + ) +) diff --git a/test/core/start.wast b/test/core/start.wast index a94dfa16..bf88a6a4 100644 --- a/test/core/start.wast +++ b/test/core/start.wast @@ -78,13 +78,13 @@ (assert_return (invoke "get") (i32.const 70)) (module - (func $print_i32 (import "spectest" "print") (param i32)) + (func $print_i32 (import "spectest" "print_i32") (param i32)) (func $main (call $print_i32 (i32.const 1))) (start 1) ) (module - (func $print_i32 (import "spectest" "print") (param i32)) + (func $print_i32 (import "spectest" "print_i32") (param i32)) (func $main (call $print_i32 (i32.const 2))) (start $main) ) @@ -98,3 +98,8 @@ (module (func $main (unreachable)) (start $main)) "unreachable" ) + +(assert_malformed + (module quote "(module (func $a (unreachable)) (func $b (unreachable)) (start $a) (start $b))") + "multiple start sections" +) diff --git a/test/core/store-align-0.fail.wast b/test/core/store-align-0.fail.wast deleted file mode 100644 index 02d837a8..00000000 --- a/test/core/store-align-0.fail.wast +++ /dev/null @@ -1 +0,0 @@ -(module (memory 0) (func (i64.store align=0 (i32.const 0) (i64.const 0)))) diff --git a/test/core/store-align-big.fail.wast b/test/core/store-align-big.fail.wast deleted file mode 100644 index 812cd9ca..00000000 --- a/test/core/store-align-big.fail.wast +++ /dev/null @@ -1 +0,0 @@ -(module (memory 0) (func (i64.store align=16 (i32.const 0) (i64.const 0)))) diff --git a/test/core/store-align-odd.fail.wast b/test/core/store-align-odd.fail.wast deleted file mode 100644 index 19201b40..00000000 --- a/test/core/store-align-odd.fail.wast +++ /dev/null @@ -1 +0,0 @@ -(module (memory 0) (func (i64.store align=6 (i32.const 0) (i64.const 0)))) diff --git a/test/core/store.wast b/test/core/store.wast new file mode 100644 index 00000000..01c3a2dd --- /dev/null +++ b/test/core/store.wast @@ -0,0 +1,417 @@ +;; Store operator as the argument of control constructs and instructions + +(module + (memory 1) + + (func (export "as-block-value") + (block (i32.store (i32.const 0) (i32.const 1))) + ) + (func (export "as-loop-value") + (loop (i32.store (i32.const 0) (i32.const 1))) + ) + + (func (export "as-br-value") + (block (br 0 (i32.store (i32.const 0) (i32.const 1)))) + ) + (func (export "as-br_if-value") + (block + (br_if 0 (i32.store (i32.const 0) (i32.const 1)) (i32.const 1)) + ) + ) + (func (export "as-br_if-value-cond") + (block + (br_if 0 (i32.const 6) (i32.store (i32.const 0) (i32.const 1))) + ) + ) + (func (export "as-br_table-value") + (block + (br_table 0 (i32.store (i32.const 0) (i32.const 1)) (i32.const 1)) + ) + ) + + (func (export "as-return-value") + (return (i32.store (i32.const 0) (i32.const 1))) + ) + + (func (export "as-if-then") + (if (i32.const 1) (then (i32.store (i32.const 0) (i32.const 1)))) + ) + (func (export "as-if-else") + (if (i32.const 0) (then) (else (i32.store (i32.const 0) (i32.const 1)))) + ) +) + +(assert_return (invoke "as-block-value")) +(assert_return (invoke "as-loop-value")) + +(assert_return (invoke "as-br-value")) +(assert_return (invoke "as-br_if-value")) +(assert_return (invoke "as-br_if-value-cond")) +(assert_return (invoke "as-br_table-value")) + +(assert_return (invoke "as-return-value")) + +(assert_return (invoke "as-if-then")) +(assert_return (invoke "as-if-else")) + +(assert_malformed + (module quote + "(memory 1)" + "(func (param i32) (i32.store32 (local.get 0) (i32.const 0)))" + ) + "unknown operator" +) +(assert_malformed + (module quote + "(memory 1)" + "(func (param i32) (i32.store64 (local.get 0) (i64.const 0)))" + ) + "unknown operator" +) + +(assert_malformed + (module quote + "(memory 1)" + "(func (param i32) (i64.store64 (local.get 0) (i64.const 0)))" + ) + "unknown operator" +) + +(assert_malformed + (module quote + "(memory 1)" + "(func (param i32) (f32.store32 (local.get 0) (f32.const 0)))" + ) + "unknown operator" +) +(assert_malformed + (module quote + "(memory 1)" + "(func (param i32) (f32.store64 (local.get 0) (f64.const 0)))" + ) + "unknown operator" +) + +(assert_malformed + (module quote + "(memory 1)" + "(func (param i32) (f64.store32 (local.get 0) (f32.const 0)))" + ) + "unknown operator" +) +(assert_malformed + (module quote + "(memory 1)" + "(func (param i32) (f64.store64 (local.get 0) (f64.const 0)))" + ) + "unknown operator" +) +;; store should have no retval + +(assert_invalid + (module (memory 1) (func (param i32) (result i32) (i32.store (i32.const 0) (i32.const 1)))) + "type mismatch" +) +(assert_invalid + (module (memory 1) (func (param i64) (result i64) (i64.store (i32.const 0) (i64.const 1)))) + "type mismatch" +) +(assert_invalid + (module (memory 1) (func (param f32) (result f32) (f32.store (i32.const 0) (f32.const 1)))) + "type mismatch" +) +(assert_invalid + (module (memory 1) (func (param f64) (result f64) (f64.store (i32.const 0) (f64.const 1)))) + "type mismatch" +) +(assert_invalid + (module (memory 1) (func (param i32) (result i32) (i32.store8 (i32.const 0) (i32.const 1)))) + "type mismatch" +) +(assert_invalid + (module (memory 1) (func (param i32) (result i32) (i32.store16 (i32.const 0) (i32.const 1)))) + "type mismatch" +) +(assert_invalid + (module (memory 1) (func (param i64) (result i64) (i64.store8 (i32.const 0) (i64.const 1)))) + "type mismatch" +) +(assert_invalid + (module (memory 1) (func (param i64) (result i64) (i64.store16 (i32.const 0) (i64.const 1)))) + "type mismatch" +) +(assert_invalid + (module (memory 1) (func (param i64) (result i64) (i64.store32 (i32.const 0) (i64.const 1)))) + "type mismatch" +) + + +(assert_invalid + (module + (memory 1) + (func $type-address-empty + (i32.store) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 1) + (func $type-value-empty + (i32.const 0) (i32.store) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 1) + (func $type-address-empty-in-block + (i32.const 0) (i32.const 0) + (block (i32.store)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 1) + (func $type-value-empty-in-block + (i32.const 0) + (block (i32.const 0) (i32.store)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 1) + (func $type-address-empty-in-loop + (i32.const 0) (i32.const 0) + (loop (i32.store)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 1) + (func $type-value-empty-in-loop + (i32.const 0) + (loop (i32.const 0) (i32.store)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 1) + (func $type-address-empty-in-then + (i32.const 0) (i32.const 0) + (if (then (i32.store))) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 1) + (func $type-value-empty-in-then + (i32.const 0) + (if (then (i32.const 0) (i32.store))) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 1) + (func $type-address-empty-in-else + (i32.const 0) (i32.const 0) + (if (result i32) (then (i32.const 0)) (else (i32.store))) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 1) + (func $type-value-empty-in-else + (i32.const 0) + (if (result i32) (then (i32.const 0)) (else (i32.const 0) (i32.store))) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 1) + (func $type-address-empty-in-br + (i32.const 0) (i32.const 0) + (block (br 0 (i32.store))) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 1) + (func $type-value-empty-in-br + (i32.const 0) + (block (br 0 (i32.const 0) (i32.store))) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 1) + (func $type-address-empty-in-br_if + (i32.const 0) (i32.const 0) + (block (br_if 0 (i32.store) (i32.const 1)) ) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 1) + (func $type-value-empty-in-br_if + (i32.const 0) + (block (br_if 0 (i32.const 0) (i32.store) (i32.const 1)) ) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 1) + (func $type-address-empty-in-br_table + (i32.const 0) (i32.const 0) + (block (br_table 0 (i32.store))) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 1) + (func $type-value-empty-in-br_table + (i32.const 0) + (block (br_table 0 (i32.const 0) (i32.store))) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 1) + (func $type-address-empty-in-return + (return (i32.store)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 1) + (func $type-value-empty-in-return + (return (i32.const 0) (i32.store)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 1) + (func $type-address-empty-in-select + (select (i32.store) (i32.const 1) (i32.const 2)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 1) + (func $type-value-empty-in-select + (select (i32.const 0) (i32.store) (i32.const 1) (i32.const 2)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 1) + (func $type-address-empty-in-call + (call 1 (i32.store)) + ) + (func (param i32) (result i32) (local.get 0)) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 1) + (func $type-value-empty-in-call + (call 1 (i32.const 0) (i32.store)) + ) + (func (param i32) (result i32) (local.get 0)) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 1) + (func $f (param i32) (result i32) (local.get 0)) + (type $sig (func (param i32) (result i32))) + (table funcref (elem $f)) + (func $type-address-empty-in-call_indirect + (block (result i32) + (call_indirect (type $sig) + (i32.store) (i32.const 0) + ) + ) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (memory 1) + (func $f (param i32) (result i32) (local.get 0)) + (type $sig (func (param i32) (result i32))) + (table funcref (elem $f)) + (func $type-value-empty-in-call_indirect + (block (result i32) + (call_indirect (type $sig) + (i32.const 0) (i32.store) (i32.const 0) + ) + ) + ) + ) + "type mismatch" +) + + +;; Type check + +(assert_invalid (module (memory 1) (func (i32.store (f32.const 0) (i32.const 0)))) "type mismatch") +(assert_invalid (module (memory 1) (func (i32.store8 (f32.const 0) (i32.const 0)))) "type mismatch") +(assert_invalid (module (memory 1) (func (i32.store16 (f32.const 0) (i32.const 0)))) "type mismatch") +(assert_invalid (module (memory 1) (func (i64.store (f32.const 0) (i32.const 0)))) "type mismatch") +(assert_invalid (module (memory 1) (func (i64.store8 (f32.const 0) (i64.const 0)))) "type mismatch") +(assert_invalid (module (memory 1) (func (i64.store16 (f32.const 0) (i64.const 0)))) "type mismatch") +(assert_invalid (module (memory 1) (func (i64.store32 (f32.const 0) (i64.const 0)))) "type mismatch") +(assert_invalid (module (memory 1) (func (f32.store (f32.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (memory 1) (func (f64.store (f32.const 0) (f64.const 0)))) "type mismatch") + +(assert_invalid (module (memory 1) (func (i32.store (i32.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (memory 1) (func (i32.store8 (i32.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (memory 1) (func (i32.store16 (i32.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (memory 1) (func (i64.store (i32.const 0) (f32.const 0)))) "type mismatch") +(assert_invalid (module (memory 1) (func (i64.store8 (i32.const 0) (f64.const 0)))) "type mismatch") +(assert_invalid (module (memory 1) (func (i64.store16 (i32.const 0) (f64.const 0)))) "type mismatch") +(assert_invalid (module (memory 1) (func (i64.store32 (i32.const 0) (f64.const 0)))) "type mismatch") +(assert_invalid (module (memory 1) (func (f32.store (i32.const 0) (i32.const 0)))) "type mismatch") +(assert_invalid (module (memory 1) (func (f64.store (i32.const 0) (i64.const 0)))) "type mismatch") diff --git a/test/core/store_retval.wast b/test/core/store_retval.wast deleted file mode 100644 index a4d03582..00000000 --- a/test/core/store_retval.wast +++ /dev/null @@ -1,55 +0,0 @@ -(assert_invalid - (module (func (param i32) (result i32) (set_local 0 (i32.const 1)))) - "type mismatch" -) -(assert_invalid - (module (func (param i64) (result i64) (set_local 0 (i64.const 1)))) - "type mismatch" -) -(assert_invalid - (module (func (param f32) (result f32) (set_local 0 (f32.const 1)))) - "type mismatch" -) -(assert_invalid - (module (func (param f64) (result f64) (set_local 0 (f64.const 1)))) - "type mismatch" -) - -(assert_invalid - (module (memory 1) (func (param i32) (result i32) (i32.store (i32.const 0) (i32.const 1)))) - "type mismatch" -) -(assert_invalid - (module (memory 1) (func (param i64) (result i64) (i64.store (i32.const 0) (i64.const 1)))) - "type mismatch" -) -(assert_invalid - (module (memory 1) (func (param f32) (result f32) (f32.store (i32.const 0) (f32.const 1)))) - "type mismatch" -) -(assert_invalid - (module (memory 1) (func (param f64) (result f64) (f64.store (i32.const 0) (f64.const 1)))) - "type mismatch" -) - -(assert_invalid - (module (memory 1) (func (param i32) (result i32) (i32.store8 (i32.const 0) (i32.const 1)))) - "type mismatch" -) -(assert_invalid - (module (memory 1) (func (param i32) (result i32) (i32.store16 (i32.const 0) (i32.const 1)))) - "type mismatch" -) -(assert_invalid - (module (memory 1) (func (param i64) (result i64) (i64.store8 (i32.const 0) (i64.const 1)))) - "type mismatch" -) -(assert_invalid - (module (memory 1) (func (param i64) (result i64) (i64.store16 (i32.const 0) (i64.const 1)))) - "type mismatch" -) -(assert_invalid - (module (memory 1) (func (param i64) (result i64) (i64.store32 (i32.const 0) (i64.const 1)))) - "type mismatch" -) - diff --git a/test/core/switch.wast b/test/core/switch.wast index 2d4565a5..e9ae24dc 100644 --- a/test/core/switch.wast +++ b/test/core/switch.wast @@ -2,7 +2,7 @@ ;; Statement switch (func (export "stmt") (param $i i32) (result i32) (local $j i32) - (set_local $j (i32.const 100)) + (local.set $j (i32.const 100)) (block $switch (block $7 (block $default @@ -14,40 +14,40 @@ (block $1 (block $0 (br_table $0 $1 $2 $3 $4 $5 $6 $7 $default - (get_local $i) + (local.get $i) ) ) ;; 0 - (return (get_local $i)) + (return (local.get $i)) ) ;; 1 (nop) ;; fallthrough ) ;; 2 ;; fallthrough ) ;; 3 - (set_local $j (i32.sub (i32.const 0) (get_local $i))) + (local.set $j (i32.sub (i32.const 0) (local.get $i))) (br $switch) ) ;; 4 (br $switch) ) ;; 5 - (set_local $j (i32.const 101)) + (local.set $j (i32.const 101)) (br $switch) ) ;; 6 - (set_local $j (i32.const 101)) + (local.set $j (i32.const 101)) ;; fallthrough ) ;; default - (set_local $j (i32.const 102)) + (local.set $j (i32.const 102)) ) ;; 7 ;; fallthrough ) - (return (get_local $j)) + (return (local.get $j)) ) ;; Expression switch (func (export "expr") (param $i i64) (result i64) (local $j i64) - (set_local $j (i64.const 100)) + (local.set $j (i64.const 100)) (return - (block $switch i64 + (block $switch (result i64) (block $7 (block $default (block $4 @@ -58,26 +58,26 @@ (block $1 (block $0 (br_table $0 $1 $2 $3 $4 $5 $6 $7 $default - (i32.wrap/i64 (get_local $i)) + (i32.wrap_i64 (local.get $i)) ) ) ;; 0 - (return (get_local $i)) + (return (local.get $i)) ) ;; 1 (nop) ;; fallthrough ) ;; 2 ;; fallthrough ) ;; 3 - (br $switch (i64.sub (i64.const 0) (get_local $i))) + (br $switch (i64.sub (i64.const 0) (local.get $i))) ) ;; 6 - (set_local $j (i64.const 101)) + (local.set $j (i64.const 101)) ;; fallthrough ) ;; 4 ;; fallthrough ) ;; 5 ;; fallthrough ) ;; default - (br $switch (get_local $j)) + (br $switch (local.get $j)) ) ;; 7 (i64.const -5) ) @@ -87,16 +87,16 @@ ;; Argument switch (func (export "arg") (param $i i32) (result i32) (return - (block $2 i32 + (block $2 (result i32) (i32.add (i32.const 10) - (block $1 i32 + (block $1 (result i32) (i32.add (i32.const 100) - (block $0 i32 + (block $0 (result i32) (i32.add (i32.const 1000) - (block $default i32 + (block $default (result i32) (br_table $0 $1 $2 $default - (i32.mul (i32.const 2) (get_local $i)) - (i32.and (i32.const 3) (get_local $i)) + (i32.mul (i32.const 2) (local.get $i)) + (i32.and (i32.const 3) (local.get $i)) ) ) ) diff --git a/test/core/table_fill.wast b/test/core/table_fill.wast new file mode 100644 index 00000000..8ec66b69 --- /dev/null +++ b/test/core/table_fill.wast @@ -0,0 +1,153 @@ +(module + (table $t 10 anyref) + + (func (export "fill") (param $i i32) (param $r anyref) (param $n i32) + (table.fill $t (local.get $i) (local.get $r) (local.get $n)) + ) + + (func (export "get") (param $i i32) (result anyref) + (table.get $t (local.get $i)) + ) +) + +(assert_return (invoke "get" (i32.const 1)) (ref.null)) +(assert_return (invoke "get" (i32.const 2)) (ref.null)) +(assert_return (invoke "get" (i32.const 3)) (ref.null)) +(assert_return (invoke "get" (i32.const 4)) (ref.null)) +(assert_return (invoke "get" (i32.const 5)) (ref.null)) + +(assert_return (invoke "fill" (i32.const 2) (ref.host 1) (i32.const 3))) +(assert_return (invoke "get" (i32.const 1)) (ref.null)) +(assert_return (invoke "get" (i32.const 2)) (ref.host 1)) +(assert_return (invoke "get" (i32.const 3)) (ref.host 1)) +(assert_return (invoke "get" (i32.const 4)) (ref.host 1)) +(assert_return (invoke "get" (i32.const 5)) (ref.null)) + +(assert_return (invoke "fill" (i32.const 4) (ref.host 2) (i32.const 2))) +(assert_return (invoke "get" (i32.const 3)) (ref.host 1)) +(assert_return (invoke "get" (i32.const 4)) (ref.host 2)) +(assert_return (invoke "get" (i32.const 5)) (ref.host 2)) +(assert_return (invoke "get" (i32.const 6)) (ref.null)) + +(assert_return (invoke "fill" (i32.const 4) (ref.host 3) (i32.const 0))) +(assert_return (invoke "get" (i32.const 3)) (ref.host 1)) +(assert_return (invoke "get" (i32.const 4)) (ref.host 2)) +(assert_return (invoke "get" (i32.const 5)) (ref.host 2)) + +(assert_return (invoke "fill" (i32.const 8) (ref.host 4) (i32.const 2))) +(assert_return (invoke "get" (i32.const 7)) (ref.null)) +(assert_return (invoke "get" (i32.const 8)) (ref.host 4)) +(assert_return (invoke "get" (i32.const 9)) (ref.host 4)) + +(assert_return (invoke "fill" (i32.const 9) (ref.null) (i32.const 1))) +(assert_return (invoke "get" (i32.const 8)) (ref.host 4)) +(assert_return (invoke "get" (i32.const 9)) (ref.null)) + +(assert_return (invoke "fill" (i32.const 10) (ref.host 5) (i32.const 0))) +(assert_return (invoke "get" (i32.const 9)) (ref.null)) + +(assert_trap + (invoke "fill" (i32.const 8) (ref.host 6) (i32.const 3)) + "out of bounds" +) +(assert_return (invoke "get" (i32.const 7)) (ref.null)) +(assert_return (invoke "get" (i32.const 8)) (ref.host 6)) +(assert_return (invoke "get" (i32.const 9)) (ref.host 6)) + +(assert_trap + (invoke "fill" (i32.const 11) (ref.null) (i32.const 0)) + "out of bounds" +) + +(assert_trap + (invoke "fill" (i32.const 11) (ref.null) (i32.const 10)) + "out of bounds" +) + + +;; Type errors + +(assert_invalid + (module + (table $t 10 anyref) + (func $type-index-value-length-empty-vs-i32-i32 + (table.fill $t) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (table $t 10 anyref) + (func $type-index-empty-vs-i32 + (table.fill $t (ref.null) (i32.const 1)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (table $t 10 anyref) + (func $type-value-empty-vs + (table.fill $t (i32.const 1) (i32.const 1)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (table $t 10 anyref) + (func $type-length-empty-vs-i32 + (table.fill $t (i32.const 1) (ref.null)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (table $t 0 anyref) + (func $type-index-f32-vs-i32 + (table.fill $t (f32.const 1) (ref.null) (i32.const 1)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (table $t 0 funcref) + (func $type-value-vs-funcref (param $r anyref) + (table.fill $t (i32.const 1) (local.get $r) (i32.const 1)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (table $t 0 anyref) + (func $type-length-f32-vs-i32 + (table.fill $t (i32.const 1) (ref.null) (f32.const 1)) + ) + ) + "type mismatch" +) + +(assert_invalid + (module + (table $t1 1 anyref) + (table $t2 1 funcref) + (func $type-value-anyref-vs-funcref-multi (param $r anyref) + (table.fill $t2 (i32.const 0) (local.get $r) (i32.const 1)) + ) + ) + "type mismatch" +) + +(assert_invalid + (module + (table $t 1 anyref) + (func $type-result-empty-vs-num (result i32) + (table.fill $t (i32.const 0) (ref.null) (i32.const 1)) + ) + ) + "type mismatch" +) diff --git a/test/core/table_get.wast b/test/core/table_get.wast new file mode 100644 index 00000000..02855a83 --- /dev/null +++ b/test/core/table_get.wast @@ -0,0 +1,87 @@ +(module + (table $t2 2 anyref) + (table $t3 3 funcref) (elem $t3 (i32.const 1) $dummy) + (func $dummy) + + (func (export "init") (param $r anyref) + (table.set $t2 (i32.const 1) (local.get $r)) + (table.set $t3 (i32.const 2) (table.get $t3 (i32.const 1))) + ) + + (func (export "get-anyref") (param $i i32) (result anyref) + (table.get $t2 (local.get $i)) + ) + (func $f3 (export "get-funcref") (param $i i32) (result funcref) + (table.get $t3 (local.get $i)) + ) + + (func (export "is_null-funcref") (param $i i32) (result i32) + (ref.is_null (call $f3 (local.get $i))) + ) +) + +(invoke "init" (ref.host 1)) + +(assert_return (invoke "get-anyref" (i32.const 0)) (ref.null)) +(assert_return (invoke "get-anyref" (i32.const 1)) (ref.host 1)) + +(assert_return (invoke "get-funcref" (i32.const 0)) (ref.null)) +(assert_return (invoke "is_null-funcref" (i32.const 1)) (i32.const 0)) +(assert_return (invoke "is_null-funcref" (i32.const 2)) (i32.const 0)) + +(assert_trap (invoke "get-anyref" (i32.const 2)) "out of bounds") +(assert_trap (invoke "get-funcref" (i32.const 3)) "out of bounds") +(assert_trap (invoke "get-anyref" (i32.const -1)) "out of bounds") +(assert_trap (invoke "get-funcref" (i32.const -1)) "out of bounds") + + +;; Type errors + +(assert_invalid + (module + (table $t 10 anyref) + (func $type-index-empty-vs-i32 (result anyref) + (table.get $t) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (table $t 10 anyref) + (func $type-index-f32-vs-i32 (result anyref) + (table.get $t (f32.const 1)) + ) + ) + "type mismatch" +) + +(assert_invalid + (module + (table $t 10 anyref) + (func $type-result-anyref-vs-empty + (table.get $t (i32.const 0)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (table $t 10 anyref) + (func $type-result-anyref-vs-funcref (result funcref) + (table.get $t (i32.const 1)) + ) + ) + "type mismatch" +) + +(assert_invalid + (module + (table $t1 1 funcref) + (table $t2 1 anyref) + (func $type-result-anyref-vs-funcref-multi (result funcref) + (table.get $t2 (i32.const 0)) + ) + ) + "type mismatch" +) diff --git a/test/core/table_grow.wast b/test/core/table_grow.wast new file mode 100644 index 00000000..158df3ca --- /dev/null +++ b/test/core/table_grow.wast @@ -0,0 +1,171 @@ +(module + (table $t 0 anyref) + + (func (export "get") (param $i i32) (result anyref) (table.get $t (local.get $i))) + (func (export "set") (param $i i32) (param $r anyref) (table.set $t (local.get $i) (local.get $r))) + + (func (export "grow") (param $sz i32) (param $init anyref) (result i32) + (table.grow $t (local.get $init) (local.get $sz)) + ) + (func (export "size") (result i32) (table.size $t)) +) + +(assert_return (invoke "size") (i32.const 0)) +(assert_trap (invoke "set" (i32.const 0) (ref.host 2)) "out of bounds table access") +(assert_trap (invoke "get" (i32.const 0)) "out of bounds table access") + +(assert_return (invoke "grow" (i32.const 1) (ref.null)) (i32.const 0)) +(assert_return (invoke "size") (i32.const 1)) +(assert_return (invoke "get" (i32.const 0)) (ref.null)) +(assert_return (invoke "set" (i32.const 0) (ref.host 2))) +(assert_return (invoke "get" (i32.const 0)) (ref.host 2)) +(assert_trap (invoke "set" (i32.const 1) (ref.host 2)) "out of bounds table access") +(assert_trap (invoke "get" (i32.const 1)) "out of bounds table access") + +(assert_return (invoke "grow" (i32.const 4) (ref.host 3)) (i32.const 1)) +(assert_return (invoke "size") (i32.const 5)) +(assert_return (invoke "get" (i32.const 0)) (ref.host 2)) +(assert_return (invoke "set" (i32.const 0) (ref.host 2))) +(assert_return (invoke "get" (i32.const 0)) (ref.host 2)) +(assert_return (invoke "get" (i32.const 1)) (ref.host 3)) +(assert_return (invoke "get" (i32.const 4)) (ref.host 3)) +(assert_return (invoke "set" (i32.const 4) (ref.host 4))) +(assert_return (invoke "get" (i32.const 4)) (ref.host 4)) +(assert_trap (invoke "set" (i32.const 5) (ref.host 2)) "out of bounds table access") +(assert_trap (invoke "get" (i32.const 5)) "out of bounds table access") + + +;; Reject growing to size outside i32 value range +(module + (table $t 0x10 anyref) + (func $f (export "grow") (result i32) + (table.grow $t (ref.func $f) (i32.const 0xffff_fff0)) + ) +) + +(assert_return (invoke "grow") (i32.const -1)) + + +(module + (table $t 0 anyref) + (func (export "grow") (param i32) (result i32) + (table.grow $t (ref.null) (local.get 0)) + ) +) + +(assert_return (invoke "grow" (i32.const 0)) (i32.const 0)) +(assert_return (invoke "grow" (i32.const 1)) (i32.const 0)) +(assert_return (invoke "grow" (i32.const 0)) (i32.const 1)) +(assert_return (invoke "grow" (i32.const 2)) (i32.const 1)) +(assert_return (invoke "grow" (i32.const 800)) (i32.const 3)) + + +(module + (table $t 0 10 anyref) + (func (export "grow") (param i32) (result i32) + (table.grow $t (ref.null) (local.get 0)) + ) +) + +(assert_return (invoke "grow" (i32.const 0)) (i32.const 0)) +(assert_return (invoke "grow" (i32.const 1)) (i32.const 0)) +(assert_return (invoke "grow" (i32.const 1)) (i32.const 1)) +(assert_return (invoke "grow" (i32.const 2)) (i32.const 2)) +(assert_return (invoke "grow" (i32.const 6)) (i32.const 4)) +(assert_return (invoke "grow" (i32.const 0)) (i32.const 10)) +(assert_return (invoke "grow" (i32.const 1)) (i32.const -1)) +(assert_return (invoke "grow" (i32.const 0x10000)) (i32.const -1)) + + +(module + (table $t 10 anyref) + (func (export "grow") (param i32) (result i32) + (table.grow $t (ref.null) (local.get 0)) + ) + (func (export "check-table-null") (param i32 i32) (result anyref) + (local anyref) + (local.set 2 (ref.func 1)) + (block + (loop + (local.set 2 (table.get $t (local.get 0))) + (br_if 1 (i32.eqz (ref.is_null (local.get 2)))) + (br_if 1 (i32.ge_u (local.get 0) (local.get 1))) + (local.set 0 (i32.add (local.get 0) (i32.const 1))) + (br_if 0 (i32.le_u (local.get 0) (local.get 1))) + ) + ) + (local.get 2) + ) +) + +(assert_return (invoke "check-table-null" (i32.const 0) (i32.const 9)) (ref.null)) +(assert_return (invoke "grow" (i32.const 10)) (i32.const 10)) +(assert_return (invoke "check-table-null" (i32.const 0) (i32.const 19)) (ref.null)) + + +;; Type errors + +(assert_invalid + (module + (table $t 0 anyref) + (func $type-init-size-empty-vs-i32-anyref (result i32) + (table.grow $t) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (table $t 0 anyref) + (func $type-size-empty-vs-i32 (result i32) + (table.grow $t (ref.null)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (table $t 0 anyref) + (func $type-init-empty-vs-anyref (result i32) + (table.grow $t (i32.const 1)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (table $t 0 anyref) + (func $type-size-f32-vs-i32 (result i32) + (table.grow $t (ref.null) (f32.const 1)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (table $t 0 funcref) + (func $type-init-anyref-vs-funcref (param $r anyref) (result i32) + (table.grow $t (local.get $r) (i32.const 1)) + ) + ) + "type mismatch" +) + +(assert_invalid + (module + (table $t 1 anyref) + (func $type-result-i32-vs-empty + (table.grow $t (ref.null) (i32.const 0)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (table $t 1 anyref) + (func $type-result-i32-vs-f32 (result f32) + (table.grow $t (ref.null) (i32.const 0)) + ) + ) + "type mismatch" +) diff --git a/test/core/table_set.wast b/test/core/table_set.wast new file mode 100644 index 00000000..5d2a6a26 --- /dev/null +++ b/test/core/table_set.wast @@ -0,0 +1,118 @@ +(module + (table $t2 1 anyref) + (table $t3 2 funcref) (elem $t3 (i32.const 1) $dummy) + (func $dummy) + + (func (export "get-anyref") (param $i i32) (result anyref) + (table.get $t2 (local.get $i)) + ) + (func $f3 (export "get-funcref") (param $i i32) (result funcref) + (table.get $t3 (local.get $i)) + ) + + (func (export "set-anyref") (param $i i32) (param $r anyref) + (table.set $t2 (local.get $i) (local.get $r)) + ) + (func (export "set-funcref") (param $i i32) (param $r funcref) + (table.set $t3 (local.get $i) (local.get $r)) + ) + (func (export "set-funcref-from") (param $i i32) (param $j i32) + (table.set $t3 (local.get $i) (table.get $t3 (local.get $j))) + ) + + (func (export "is_null-funcref") (param $i i32) (result i32) + (ref.is_null (call $f3 (local.get $i))) + ) +) + +(assert_return (invoke "get-anyref" (i32.const 0)) (ref.null)) +(assert_return (invoke "set-anyref" (i32.const 0) (ref.host 1))) +(assert_return (invoke "get-anyref" (i32.const 0)) (ref.host 1)) +(assert_return (invoke "set-anyref" (i32.const 0) (ref.null))) +(assert_return (invoke "get-anyref" (i32.const 0)) (ref.null)) + +(assert_return (invoke "get-funcref" (i32.const 0)) (ref.null)) +(assert_return (invoke "set-funcref-from" (i32.const 0) (i32.const 1))) +(assert_return (invoke "is_null-funcref" (i32.const 0)) (i32.const 0)) +(assert_return (invoke "set-funcref" (i32.const 0) (ref.null))) +(assert_return (invoke "get-funcref" (i32.const 0)) (ref.null)) + +(assert_trap (invoke "set-anyref" (i32.const 2) (ref.null)) "out of bounds") +(assert_trap (invoke "set-funcref" (i32.const 3) (ref.null)) "out of bounds") +(assert_trap (invoke "set-anyref" (i32.const -1) (ref.null)) "out of bounds") +(assert_trap (invoke "set-funcref" (i32.const -1) (ref.null)) "out of bounds") + +(assert_trap (invoke "set-anyref" (i32.const 2) (ref.host 0)) "out of bounds") +(assert_trap (invoke "set-funcref-from" (i32.const 3) (i32.const 1)) "out of bounds") +(assert_trap (invoke "set-anyref" (i32.const -1) (ref.host 0)) "out of bounds") +(assert_trap (invoke "set-funcref-from" (i32.const -1) (i32.const 1)) "out of bounds") + + +;; Type errors + +(assert_invalid + (module + (table $t 10 anyref) + (func $type-index-value-empty-vs-i32-anyref + (table.set $t) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (table $t 10 anyref) + (func $type-index-empty-vs-i32 + (table.set $t (ref.null)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (table $t 10 anyref) + (func $type-value-empty-vs-anyref + (table.set $t (i32.const 1)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (table $t 10 anyref) + (func $type-size-f32-vs-i32 + (table.set $t (f32.const 1) (ref.null)) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (table $t 10 funcref) + (func $type-value-anyref-vs-funcref (param $r anyref) + (table.set $t (i32.const 1) (local.get $r)) + ) + ) + "type mismatch" +) + +(assert_invalid + (module + (table $t1 1 anyref) + (table $t2 1 funcref) + (func $type-value-anyref-vs-funcref-multi (param $r anyref) + (table.set $t2 (i32.const 0) (local.get $r)) + ) + ) + "type mismatch" +) + +(assert_invalid + (module + (table $t 10 anyref) + (func $type-result-empty-vs-num (result i32) + (table.set $t (i32.const 0) (ref.null)) + ) + ) + "type mismatch" +) diff --git a/test/core/table_size.wast b/test/core/table_size.wast new file mode 100644 index 00000000..5817104a --- /dev/null +++ b/test/core/table_size.wast @@ -0,0 +1,86 @@ +(module + (table $t0 0 anyref) + (table $t1 1 anyref) + (table $t2 0 2 anyref) + (table $t3 3 8 anyref) + + (func (export "size-t0") (result i32) (table.size $t0)) + (func (export "size-t1") (result i32) (table.size $t1)) + (func (export "size-t2") (result i32) (table.size $t2)) + (func (export "size-t3") (result i32) (table.size $t3)) + + (func (export "grow-t0") (param $sz i32) + (drop (table.grow $t0 (ref.null) (local.get $sz))) + ) + (func (export "grow-t1") (param $sz i32) + (drop (table.grow $t1 (ref.null) (local.get $sz))) + ) + (func (export "grow-t2") (param $sz i32) + (drop (table.grow $t2 (ref.null) (local.get $sz))) + ) + (func (export "grow-t3") (param $sz i32) + (drop (table.grow $t3 (ref.null) (local.get $sz))) + ) +) + +(assert_return (invoke "size-t0") (i32.const 0)) +(assert_return (invoke "grow-t0" (i32.const 1))) +(assert_return (invoke "size-t0") (i32.const 1)) +(assert_return (invoke "grow-t0" (i32.const 4))) +(assert_return (invoke "size-t0") (i32.const 5)) +(assert_return (invoke "grow-t0" (i32.const 0))) +(assert_return (invoke "size-t0") (i32.const 5)) + +(assert_return (invoke "size-t1") (i32.const 1)) +(assert_return (invoke "grow-t1" (i32.const 1))) +(assert_return (invoke "size-t1") (i32.const 2)) +(assert_return (invoke "grow-t1" (i32.const 4))) +(assert_return (invoke "size-t1") (i32.const 6)) +(assert_return (invoke "grow-t1" (i32.const 0))) +(assert_return (invoke "size-t1") (i32.const 6)) + +(assert_return (invoke "size-t2") (i32.const 0)) +(assert_return (invoke "grow-t2" (i32.const 3))) +(assert_return (invoke "size-t2") (i32.const 0)) +(assert_return (invoke "grow-t2" (i32.const 1))) +(assert_return (invoke "size-t2") (i32.const 1)) +(assert_return (invoke "grow-t2" (i32.const 0))) +(assert_return (invoke "size-t2") (i32.const 1)) +(assert_return (invoke "grow-t2" (i32.const 4))) +(assert_return (invoke "size-t2") (i32.const 1)) +(assert_return (invoke "grow-t2" (i32.const 1))) +(assert_return (invoke "size-t2") (i32.const 2)) + +(assert_return (invoke "size-t3") (i32.const 3)) +(assert_return (invoke "grow-t3" (i32.const 1))) +(assert_return (invoke "size-t3") (i32.const 4)) +(assert_return (invoke "grow-t3" (i32.const 3))) +(assert_return (invoke "size-t3") (i32.const 7)) +(assert_return (invoke "grow-t3" (i32.const 0))) +(assert_return (invoke "size-t3") (i32.const 7)) +(assert_return (invoke "grow-t3" (i32.const 2))) +(assert_return (invoke "size-t3") (i32.const 7)) +(assert_return (invoke "grow-t3" (i32.const 1))) +(assert_return (invoke "size-t3") (i32.const 8)) + + +;; Type errors + +(assert_invalid + (module + (table $t 1 anyref) + (func $type-result-i32-vs-empty + (table.size $t) + ) + ) + "type mismatch" +) +(assert_invalid + (module + (table $t 1 anyref) + (func $type-result-i32-vs-f32 (result f32) + (table.size $t) + ) + ) + "type mismatch" +) diff --git a/test/core/tee_local.wast b/test/core/tee_local.wast deleted file mode 100644 index 452793e3..00000000 --- a/test/core/tee_local.wast +++ /dev/null @@ -1,236 +0,0 @@ -;; Test `tee_local` operator - -(module - ;; Typing - - (func (export "type-local-i32") (result i32) (local i32) (tee_local 0 (i32.const 0))) - (func (export "type-local-i64") (result i64) (local i64) (tee_local 0 (i64.const 0))) - (func (export "type-local-f32") (result f32) (local f32) (tee_local 0 (f32.const 0))) - (func (export "type-local-f64") (result f64) (local f64) (tee_local 0 (f64.const 0))) - - (func (export "type-param-i32") (param i32) (result i32) (tee_local 0 (i32.const 10))) - (func (export "type-param-i64") (param i64) (result i64) (tee_local 0 (i64.const 11))) - (func (export "type-param-f32") (param f32) (result f32) (tee_local 0 (f32.const 11.1))) - (func (export "type-param-f64") (param f64) (result f64) (tee_local 0 (f64.const 12.2))) - - (func (export "type-mixed") (param i64 f32 f64 i32 i32) (local f32 i64 i64 f64) - (drop (i64.eqz (tee_local 0 (i64.const 0)))) - (drop (f32.neg (tee_local 1 (f32.const 0)))) - (drop (f64.neg (tee_local 2 (f64.const 0)))) - (drop (i32.eqz (tee_local 3 (i32.const 0)))) - (drop (i32.eqz (tee_local 4 (i32.const 0)))) - (drop (f32.neg (tee_local 5 (f32.const 0)))) - (drop (i64.eqz (tee_local 6 (i64.const 0)))) - (drop (i64.eqz (tee_local 7 (i64.const 0)))) - (drop (f64.neg (tee_local 8 (f64.const 0)))) - ) - - ;; Writing - - (func (export "write") (param i64 f32 f64 i32 i32) (result i64) (local f32 i64 i64 f64) - (drop (tee_local 1 (f32.const -0.3))) - (drop (tee_local 3 (i32.const 40))) - (drop (tee_local 4 (i32.const -7))) - (drop (tee_local 5 (f32.const 5.5))) - (drop (tee_local 6 (i64.const 6))) - (drop (tee_local 8 (f64.const 8))) - (i64.trunc_s/f64 - (f64.add - (f64.convert_u/i64 (get_local 0)) - (f64.add - (f64.promote/f32 (get_local 1)) - (f64.add - (get_local 2) - (f64.add - (f64.convert_u/i32 (get_local 3)) - (f64.add - (f64.convert_s/i32 (get_local 4)) - (f64.add - (f64.promote/f32 (get_local 5)) - (f64.add - (f64.convert_u/i64 (get_local 6)) - (f64.add - (f64.convert_u/i64 (get_local 7)) - (get_local 8) - ) - ) - ) - ) - ) - ) - ) - ) - ) - ) - - ;; Result - - (func (export "result") (param i64 f32 f64 i32 i32) (result f64) - (local f32 i64 i64 f64) - (f64.add - (f64.convert_u/i64 (tee_local 0 (i64.const 1))) - (f64.add - (f64.promote/f32 (tee_local 1 (f32.const 2))) - (f64.add - (tee_local 2 (f64.const 3.3)) - (f64.add - (f64.convert_u/i32 (tee_local 3 (i32.const 4))) - (f64.add - (f64.convert_s/i32 (tee_local 4 (i32.const 5))) - (f64.add - (f64.promote/f32 (tee_local 5 (f32.const 5.5))) - (f64.add - (f64.convert_u/i64 (tee_local 6 (i64.const 6))) - (f64.add - (f64.convert_u/i64 (tee_local 7 (i64.const 0))) - (tee_local 8 (f64.const 8)) - ) - ) - ) - ) - ) - ) - ) - ) - ) -) - -(assert_return (invoke "type-local-i32") (i32.const 0)) -(assert_return (invoke "type-local-i64") (i64.const 0)) -(assert_return (invoke "type-local-f32") (f32.const 0)) -(assert_return (invoke "type-local-f64") (f64.const 0)) - -(assert_return (invoke "type-param-i32" (i32.const 2)) (i32.const 10)) -(assert_return (invoke "type-param-i64" (i64.const 3)) (i64.const 11)) -(assert_return (invoke "type-param-f32" (f32.const 4.4)) (f32.const 11.1)) -(assert_return (invoke "type-param-f64" (f64.const 5.5)) (f64.const 12.2)) - -(assert_return - (invoke "type-mixed" - (i64.const 1) (f32.const 2.2) (f64.const 3.3) (i32.const 4) (i32.const 5) - ) -) - -(assert_return - (invoke "write" - (i64.const 1) (f32.const 2) (f64.const 3.3) (i32.const 4) (i32.const 5) - ) - (i64.const 56) -) - -(assert_return - (invoke "result" - (i64.const -1) (f32.const -2) (f64.const -3.3) (i32.const -4) (i32.const -5) - ) - (f64.const 34.8) -) - - -;; Invalid typing of access to locals - -(assert_invalid - (module (func $type-local-num-vs-num (result i64) (local i32) (tee_local 0 (i32.const 0)))) - "type mismatch" -) -(assert_invalid - (module (func $type-local-num-vs-num (local f32) (i32.eqz (tee_local 0 (f32.const 0))))) - "type mismatch" -) -(assert_invalid - (module (func $type-local-num-vs-num (local f64 i64) (f64.neg (tee_local 1 (i64.const 0))))) - "type mismatch" -) - -(assert_invalid - (module (func $type-local-arg-void-vs-num (local i32) (tee_local 0 (nop)))) - "type mismatch" -) -(assert_invalid - (module (func $type-local-arg-num-vs-num (local i32) (tee_local 0 (f32.const 0)))) - "type mismatch" -) -(assert_invalid - (module (func $type-local-arg-num-vs-num (local f32) (tee_local 0 (f64.const 0)))) - "type mismatch" -) -(assert_invalid - (module (func $type-local-arg-num-vs-num (local f64 i64) (tee_local 1 (f64.const 0)))) - "type mismatch" -) - - -;; Invalid typing of access to parameters - -(assert_invalid - (module (func $type-param-num-vs-num (param i32) (result i64) (get_local 0))) - "type mismatch" -) -(assert_invalid - (module (func $type-param-num-vs-num (param f32) (i32.eqz (get_local 0)))) - "type mismatch" -) -(assert_invalid - (module (func $type-param-num-vs-num (param f64 i64) (f64.neg (get_local 1)))) - "type mismatch" -) - -(assert_invalid - (module (func $type-param-arg-void-vs-num (param i32) (tee_local 0 (nop)))) - "type mismatch" -) -(assert_invalid - (module (func $type-param-arg-num-vs-num (param i32) (tee_local 0 (f32.const 0)))) - "type mismatch" -) -(assert_invalid - (module (func $type-param-arg-num-vs-num (param f32) (tee_local 0 (f64.const 0)))) - "type mismatch" -) -(assert_invalid - (module (func $type-param-arg-num-vs-num (param f64 i64) (tee_local 1 (f64.const 0)))) - "type mismatch" -) - - -;; Invalid local index - -(assert_invalid - (module (func $unbound-local (local i32 i64) (get_local 3))) - "unknown local" -) -(assert_invalid - (module (func $large-local (local i32 i64) (get_local 14324343))) - "unknown local" -) - -(assert_invalid - (module (func $unbound-param (param i32 i64) (get_local 2))) - "unknown local" -) -(assert_invalid - (module (func $large-param (local i32 i64) (get_local 714324343))) - "unknown local" -) - -(assert_invalid - (module (func $unbound-mixed (param i32) (local i32 i64) (get_local 3))) - "unknown local" -) -(assert_invalid - (module (func $large-mixed (param i64) (local i32 i64) (get_local 214324343))) - "unknown local" -) - -(assert_invalid - (module (func $type-mixed-arg-num-vs-num (param f32) (local i32) (tee_local 1 (f32.const 0)))) - "type mismatch" -) -(assert_invalid - (module (func $type-mixed-arg-num-vs-num (param i64 i32) (local f32) (tee_local 1 (f32.const 0)))) - "type mismatch" -) -(assert_invalid - (module (func $type-mixed-arg-num-vs-num (param i64) (local f64 i64) (tee_local 1 (i64.const 0)))) - "type mismatch" -) - diff --git a/test/core/token.wast b/test/core/token.wast new file mode 100644 index 00000000..1dcd32e7 --- /dev/null +++ b/test/core/token.wast @@ -0,0 +1,10 @@ +;; Test tokenization + +(assert_malformed + (module quote "(func (drop (i32.const0)))") + "unknown operator" +) +(assert_malformed + (module quote "(func br 0drop)") + "unknown operator" +) diff --git a/test/core/traps.wast b/test/core/traps.wast index 32072b98..142fa22b 100644 --- a/test/core/traps.wast +++ b/test/core/traps.wast @@ -4,29 +4,31 @@ (module (func (export "no_dce.i32.div_s") (param $x i32) (param $y i32) - (drop (i32.div_s (get_local $x) (get_local $y)))) + (drop (i32.div_s (local.get $x) (local.get $y)))) (func (export "no_dce.i32.div_u") (param $x i32) (param $y i32) - (drop (i32.div_u (get_local $x) (get_local $y)))) + (drop (i32.div_u (local.get $x) (local.get $y)))) (func (export "no_dce.i64.div_s") (param $x i64) (param $y i64) - (drop (i64.div_s (get_local $x) (get_local $y)))) + (drop (i64.div_s (local.get $x) (local.get $y)))) (func (export "no_dce.i64.div_u") (param $x i64) (param $y i64) - (drop (i64.div_u (get_local $x) (get_local $y)))) + (drop (i64.div_u (local.get $x) (local.get $y)))) ) (assert_trap (invoke "no_dce.i32.div_s" (i32.const 1) (i32.const 0)) "integer divide by zero") (assert_trap (invoke "no_dce.i32.div_u" (i32.const 1) (i32.const 0)) "integer divide by zero") (assert_trap (invoke "no_dce.i64.div_s" (i64.const 1) (i64.const 0)) "integer divide by zero") (assert_trap (invoke "no_dce.i64.div_u" (i64.const 1) (i64.const 0)) "integer divide by zero") +(assert_trap (invoke "no_dce.i32.div_s" (i32.const 0x80000000) (i32.const -1)) "integer overflow") +(assert_trap (invoke "no_dce.i64.div_s" (i64.const 0x8000000000000000) (i64.const -1)) "integer overflow") (module (func (export "no_dce.i32.rem_s") (param $x i32) (param $y i32) - (drop (i32.rem_s (get_local $x) (get_local $y)))) + (drop (i32.rem_s (local.get $x) (local.get $y)))) (func (export "no_dce.i32.rem_u") (param $x i32) (param $y i32) - (drop (i32.rem_u (get_local $x) (get_local $y)))) + (drop (i32.rem_u (local.get $x) (local.get $y)))) (func (export "no_dce.i64.rem_s") (param $x i64) (param $y i64) - (drop (i64.rem_s (get_local $x) (get_local $y)))) + (drop (i64.rem_s (local.get $x) (local.get $y)))) (func (export "no_dce.i64.rem_u") (param $x i64) (param $y i64) - (drop (i64.rem_u (get_local $x) (get_local $y)))) + (drop (i64.rem_u (local.get $x) (local.get $y)))) ) (assert_trap (invoke "no_dce.i32.rem_s" (i32.const 1) (i32.const 0)) "integer divide by zero") @@ -35,42 +37,42 @@ (assert_trap (invoke "no_dce.i64.rem_u" (i64.const 1) (i64.const 0)) "integer divide by zero") (module - (func (export "no_dce.i32.trunc_s_f32") (param $x f32) (drop (i32.trunc_s/f32 (get_local $x)))) - (func (export "no_dce.i32.trunc_u_f32") (param $x f32) (drop (i32.trunc_u/f32 (get_local $x)))) - (func (export "no_dce.i32.trunc_s_f64") (param $x f64) (drop (i32.trunc_s/f64 (get_local $x)))) - (func (export "no_dce.i32.trunc_u_f64") (param $x f64) (drop (i32.trunc_u/f64 (get_local $x)))) - (func (export "no_dce.i64.trunc_s_f32") (param $x f32) (drop (i64.trunc_s/f32 (get_local $x)))) - (func (export "no_dce.i64.trunc_u_f32") (param $x f32) (drop (i64.trunc_u/f32 (get_local $x)))) - (func (export "no_dce.i64.trunc_s_f64") (param $x f64) (drop (i64.trunc_s/f64 (get_local $x)))) - (func (export "no_dce.i64.trunc_u_f64") (param $x f64) (drop (i64.trunc_u/f64 (get_local $x)))) + (func (export "no_dce.i32.trunc_f32_s") (param $x f32) (drop (i32.trunc_f32_s (local.get $x)))) + (func (export "no_dce.i32.trunc_f32_u") (param $x f32) (drop (i32.trunc_f32_u (local.get $x)))) + (func (export "no_dce.i32.trunc_f64_s") (param $x f64) (drop (i32.trunc_f64_s (local.get $x)))) + (func (export "no_dce.i32.trunc_f64_u") (param $x f64) (drop (i32.trunc_f64_u (local.get $x)))) + (func (export "no_dce.i64.trunc_f32_s") (param $x f32) (drop (i64.trunc_f32_s (local.get $x)))) + (func (export "no_dce.i64.trunc_f32_u") (param $x f32) (drop (i64.trunc_f32_u (local.get $x)))) + (func (export "no_dce.i64.trunc_f64_s") (param $x f64) (drop (i64.trunc_f64_s (local.get $x)))) + (func (export "no_dce.i64.trunc_f64_u") (param $x f64) (drop (i64.trunc_f64_u (local.get $x)))) ) -(assert_trap (invoke "no_dce.i32.trunc_s_f32" (f32.const nan)) "invalid conversion to integer") -(assert_trap (invoke "no_dce.i32.trunc_u_f32" (f32.const nan)) "invalid conversion to integer") -(assert_trap (invoke "no_dce.i32.trunc_s_f64" (f64.const nan)) "invalid conversion to integer") -(assert_trap (invoke "no_dce.i32.trunc_u_f64" (f64.const nan)) "invalid conversion to integer") -(assert_trap (invoke "no_dce.i64.trunc_s_f32" (f32.const nan)) "invalid conversion to integer") -(assert_trap (invoke "no_dce.i64.trunc_u_f32" (f32.const nan)) "invalid conversion to integer") -(assert_trap (invoke "no_dce.i64.trunc_s_f64" (f64.const nan)) "invalid conversion to integer") -(assert_trap (invoke "no_dce.i64.trunc_u_f64" (f64.const nan)) "invalid conversion to integer") +(assert_trap (invoke "no_dce.i32.trunc_f32_s" (f32.const nan)) "invalid conversion to integer") +(assert_trap (invoke "no_dce.i32.trunc_f32_u" (f32.const nan)) "invalid conversion to integer") +(assert_trap (invoke "no_dce.i32.trunc_f64_s" (f64.const nan)) "invalid conversion to integer") +(assert_trap (invoke "no_dce.i32.trunc_f64_u" (f64.const nan)) "invalid conversion to integer") +(assert_trap (invoke "no_dce.i64.trunc_f32_s" (f32.const nan)) "invalid conversion to integer") +(assert_trap (invoke "no_dce.i64.trunc_f32_u" (f32.const nan)) "invalid conversion to integer") +(assert_trap (invoke "no_dce.i64.trunc_f64_s" (f64.const nan)) "invalid conversion to integer") +(assert_trap (invoke "no_dce.i64.trunc_f64_u" (f64.const nan)) "invalid conversion to integer") (module (memory 1) - (func (export "no_dce.i32.load") (param $i i32) (drop (i32.load (get_local $i)))) - (func (export "no_dce.i32.load16_s") (param $i i32) (drop (i32.load16_s (get_local $i)))) - (func (export "no_dce.i32.load16_u") (param $i i32) (drop (i32.load16_u (get_local $i)))) - (func (export "no_dce.i32.load8_s") (param $i i32) (drop (i32.load8_s (get_local $i)))) - (func (export "no_dce.i32.load8_u") (param $i i32) (drop (i32.load8_u (get_local $i)))) - (func (export "no_dce.i64.load") (param $i i32) (drop (i64.load (get_local $i)))) - (func (export "no_dce.i64.load32_s") (param $i i32) (drop (i64.load32_s (get_local $i)))) - (func (export "no_dce.i64.load32_u") (param $i i32) (drop (i64.load32_u (get_local $i)))) - (func (export "no_dce.i64.load16_s") (param $i i32) (drop (i64.load16_s (get_local $i)))) - (func (export "no_dce.i64.load16_u") (param $i i32) (drop (i64.load16_u (get_local $i)))) - (func (export "no_dce.i64.load8_s") (param $i i32) (drop (i64.load8_s (get_local $i)))) - (func (export "no_dce.i64.load8_u") (param $i i32) (drop (i64.load8_u (get_local $i)))) - (func (export "no_dce.f32.load") (param $i i32) (drop (f32.load (get_local $i)))) - (func (export "no_dce.f64.load") (param $i i32) (drop (f64.load (get_local $i)))) + (func (export "no_dce.i32.load") (param $i i32) (drop (i32.load (local.get $i)))) + (func (export "no_dce.i32.load16_s") (param $i i32) (drop (i32.load16_s (local.get $i)))) + (func (export "no_dce.i32.load16_u") (param $i i32) (drop (i32.load16_u (local.get $i)))) + (func (export "no_dce.i32.load8_s") (param $i i32) (drop (i32.load8_s (local.get $i)))) + (func (export "no_dce.i32.load8_u") (param $i i32) (drop (i32.load8_u (local.get $i)))) + (func (export "no_dce.i64.load") (param $i i32) (drop (i64.load (local.get $i)))) + (func (export "no_dce.i64.load32_s") (param $i i32) (drop (i64.load32_s (local.get $i)))) + (func (export "no_dce.i64.load32_u") (param $i i32) (drop (i64.load32_u (local.get $i)))) + (func (export "no_dce.i64.load16_s") (param $i i32) (drop (i64.load16_s (local.get $i)))) + (func (export "no_dce.i64.load16_u") (param $i i32) (drop (i64.load16_u (local.get $i)))) + (func (export "no_dce.i64.load8_s") (param $i i32) (drop (i64.load8_s (local.get $i)))) + (func (export "no_dce.i64.load8_u") (param $i i32) (drop (i64.load8_u (local.get $i)))) + (func (export "no_dce.f32.load") (param $i i32) (drop (f32.load (local.get $i)))) + (func (export "no_dce.f64.load") (param $i i32) (drop (f64.load (local.get $i)))) ) (assert_trap (invoke "no_dce.i32.load" (i32.const 65536)) "out of bounds memory access") diff --git a/test/core/type.wast b/test/core/type.wast new file mode 100644 index 00000000..5ceeeb26 --- /dev/null +++ b/test/core/type.wast @@ -0,0 +1,59 @@ +;; Test type definitions + +(module + (type (func)) + (type $t (func)) + + (type (func (param i32))) + (type (func (param $x i32))) + (type (func (result i32))) + (type (func (param i32) (result i32))) + (type (func (param $x i32) (result i32))) + + (type (func (param f32 f64))) + ;; (type (func (result i64 f32))) + ;; (type (func (param i32 i64) (result f32 f64))) + + (type (func (param f32) (param f64))) + (type (func (param $x f32) (param f64))) + (type (func (param f32) (param $y f64))) + (type (func (param $x f32) (param $y f64))) + ;; (type (func (result i64) (result f32))) + ;; (type (func (param i32) (param i64) (result f32) (result f64))) + ;; (type (func (param $x i32) (param $y i64) (result f32) (result f64))) + + (type (func (param f32 f64) (param $x i32) (param f64 i32 i32))) + ;; (type (func (result i64 i64 f32) (result f32 i32))) + ;; (type + ;; (func (param i32 i32) (param i64 i32) (result f32 f64) (result f64 i32)) + ;; ) + + (type (func (param) (param $x f32) (param) (param) (param f64 i32) (param))) + ;; (type + ;; (func (result) (result) (result i64 i64) (result) (result f32) (result)) + ;; ) + ;; (type + ;; (func + ;; (param i32 i32) (param i64 i32) (param) (param $x i32) (param) + ;; (result) (result f32 f64) (result f64 i32) (result) + ;; ) + ;; ) +) + +(assert_malformed + (module quote "(type (func (result i32) (param i32)))") + "result before parameter" +) +(assert_malformed + (module quote "(type (func (result $x i32)))") + "unexpected token" +) + +(assert_invalid + (module (type (func (result i32 i32)))) + "invalid result arity" +) +(assert_invalid + (module (type (func (result i32) (result i32)))) + "invalid result arity" +) diff --git a/test/core/typecheck.wast b/test/core/typecheck.wast deleted file mode 100644 index 1d15cc56..00000000 --- a/test/core/typecheck.wast +++ /dev/null @@ -1,425 +0,0 @@ -;; TODO: move all tests in this file to appropriate operator-specific files. - -(assert_invalid - (module (func $type-unary-operand-missing - (i32.eqz) (drop) - )) - "type mismatch" -) -(assert_invalid - (module (func $type-unary-operand-missing-in-block - (i32.const 0) - (block (i32.eqz) (drop)) - )) - "type mismatch" -) -(assert_invalid - (module (func $type-unary-operand-missing-in-loop - (i32.const 0) - (loop (i32.eqz) (drop)) - )) - "type mismatch" -) -(assert_invalid - (module (func $type-unary-operand-missing-in-if - (i32.const 0) (i32.const 0) - (if (then (i32.eqz) (drop))) - )) - "type mismatch" -) -(assert_invalid - (module (func $type-unary-operand-missing-in-else - (i32.const 0) (i32.const 0) - (if i32 (then (i32.const 0)) (else (i32.eqz))) (drop) - )) - "type mismatch" -) - -(assert_invalid - (module (func $type-binary-1st-operand-missing - (i32.add) (drop) - )) - "type mismatch" -) -(assert_invalid - (module (func $type-binary-2nd-operand-missing - (i32.const 0) (i32.add) (drop) - )) - "type mismatch" -) -(assert_invalid - (module (func $type-binary-1st-operand-missing-in-block - (i32.const 0) (i32.const 0) - (block (i32.add) (drop)) - )) - "type mismatch" -) -(assert_invalid - (module (func $type-binary-2nd-operand-missing-in-block - (i32.const 0) - (block (i32.const 0) (i32.add) (drop)) - )) - "type mismatch" -) -(assert_invalid - (module (func $type-binary-1st-operand-missing-in-loop - (i32.const 0) (i32.const 0) - (loop (i32.add) (drop)) - )) - "type mismatch" -) -(assert_invalid - (module (func $type-binary-2nd-operand-missing-in-loop - (i32.const 0) - (loop (i32.const 0) (i32.add) (drop)) - )) - "type mismatch" -) -(assert_invalid - (module (func $type-binary-1st-operand-missing-in-if - (i32.const 0) (i32.const 0) (i32.const 0) - (if (i32.add) (drop)) - )) - "type mismatch" -) -(assert_invalid - (module (func $type-binary-2nd-operand-missing-in-if - (i32.const 0) (i32.const 0) - (if (i32.const 0) (i32.add) (drop)) - )) - "type mismatch" -) -(assert_invalid - (module (func $type-binary-1st-operand-missing-in-else - (i32.const 0) (i32.const 0) (i32.const 0) - (if i32 (then (i32.const 0)) (else (i32.add) (i32.const 0))) - (drop) (drop) - )) - "type mismatch" -) -(assert_invalid - (module (func $type-binary-2nd-operand-missing-in-else - (i32.const 0) (i32.const 0) - (if i32 (then (i32.const 0)) (else (i32.add))) - (drop) - )) - "type mismatch" -) - -(assert_invalid - (module (func $type-if-operand-missing - (if (then)) - )) - "type mismatch" -) -(assert_invalid - (module (func $type-if-operand-missing-in-block - (i32.const 0) - (block (if (then))) - )) - "type mismatch" -) -(assert_invalid - (module (func $type-if-operand-missing-in-loop - (i32.const 0) - (loop (if (then))) - )) - "type mismatch" -) -(assert_invalid - (module (func $type-if-operand-missing-in-if - (i32.const 0) (i32.const 0) - (if (then (if (then)))) - )) - "type mismatch" -) -(assert_invalid - (module (func $type-if-operand-missing-in-else - (i32.const 0) (i32.const 0) - (if i32 (then (i32.const 0)) (else (if (then)) (i32.const 0))) - (drop) - )) - "type mismatch" -) - -(assert_invalid - (module (func $type-br-operand-missing - (block i32 (br 0)) - (i32.eqz) (drop) - )) - "type mismatch" -) -(assert_invalid - (module (func $type-br-operand-missing-in-block - (i32.const 0) - (block i32 (br 0)) - (i32.eqz) (drop) - )) - "type mismatch" -) -(assert_invalid - (module (func $type-br-operand-missing-in-if - (block - (i32.const 0) (i32.const 0) - (if i32 (then (br 0))) - ) - (i32.eqz) (drop) - )) - "type mismatch" -) -(assert_invalid - (module (func $type-br-operand-missing-in-else - (block - (i32.const 0) (i32.const 0) - (if i32 (then (i32.const 0)) (else (br 0))) - ) - (i32.eqz) (drop) - )) - "type mismatch" -) - -(assert_invalid - (module (func $type-return-operand-missing (result i32) - (return) - )) - "type mismatch" -) -(assert_invalid - (module (func $type-return-operand-missing-in-block (result i32) - (i32.const 0) - (block (return)) - )) - "type mismatch" -) -(assert_invalid - (module (func $type-return-operand-missing-in-loop (result i32) - (i32.const 0) - (loop (return)) - )) - "type mismatch" -) -(assert_invalid - (module (func $type-return-operand-missing-in-if (result i32) - (i32.const 0) (i32.const 0) - (if (then (return))) - )) - "type mismatch" -) -(assert_invalid - (module (func $type-return-operand-missing-in-else (result i32) - (i32.const 0) (i32.const 0) - (if i32 (then (i32.const 0)) (else (return))) (drop) - )) - "type mismatch" -) - -;; TODO(stack): more of the above - -;; if condition -(assert_invalid (module (func (if (f32.const 0) (nop) (nop)))) "type mismatch") - -;; br_if condition -(assert_invalid (module (func (block (br_if 0 (f32.const 0))))) "type mismatch") - -;; br_table key -(assert_invalid - (module (func (block (br_table 0 (f32.const 0))))) - "type mismatch") - -;; call params -(assert_invalid (module (func (param i32)) (func (call 0 (f32.const 0)))) "type mismatch") -(assert_invalid - (module - (type (func (param i32))) - (func (type 0)) - (table 0 anyfunc) - (func - (call_indirect 0 (i32.const 0) (f32.const 0)))) - "type mismatch") - -;; call_indirect index -(assert_invalid - (module - (type (func)) - (func (type 0)) - (table 0 anyfunc) - (func (call_indirect 0 (f32.const 0)))) - "type mismatch") - -;; return -(assert_invalid (module (func (result i32) (return (f32.const 0)))) "type mismatch") - -;; set_local -(assert_invalid (module (func (local i32) (set_local 0 (f32.const 0)))) "type mismatch") - -;; load index -(assert_invalid (module (memory 1) (func (i32.load (f32.const 0)))) "type mismatch") -(assert_invalid (module (memory 1) (func (i32.load8_s (f32.const 0)))) "type mismatch") -(assert_invalid (module (memory 1) (func (i32.load8_u (f32.const 0)))) "type mismatch") -(assert_invalid (module (memory 1) (func (i32.load16_s (f32.const 0)))) "type mismatch") -(assert_invalid (module (memory 1) (func (i32.load16_u (f32.const 0)))) "type mismatch") -(assert_invalid (module (memory 1) (func (i64.load (f32.const 0)))) "type mismatch") -(assert_invalid (module (memory 1) (func (i64.load8_s (f32.const 0)))) "type mismatch") -(assert_invalid (module (memory 1) (func (i64.load8_u (f32.const 0)))) "type mismatch") -(assert_invalid (module (memory 1) (func (i64.load16_s (f32.const 0)))) "type mismatch") -(assert_invalid (module (memory 1) (func (i64.load16_u (f32.const 0)))) "type mismatch") -(assert_invalid (module (memory 1) (func (i64.load32_s (f32.const 0)))) "type mismatch") -(assert_invalid (module (memory 1) (func (i64.load32_u (f32.const 0)))) "type mismatch") -(assert_invalid (module (memory 1) (func (f32.load (f32.const 0)))) "type mismatch") -(assert_invalid (module (memory 1) (func (f64.load (f32.const 0)))) "type mismatch") - -;; store index -(assert_invalid (module (memory 1) (func (i32.store (f32.const 0) (i32.const 0)))) "type mismatch") -(assert_invalid (module (memory 1) (func (i32.store8 (f32.const 0) (i32.const 0)))) "type mismatch") -(assert_invalid (module (memory 1) (func (i32.store16 (f32.const 0) (i32.const 0)))) "type mismatch") -(assert_invalid (module (memory 1) (func (i64.store (f32.const 0) (i32.const 0)))) "type mismatch") -(assert_invalid (module (memory 1) (func (i64.store8 (f32.const 0) (i64.const 0)))) "type mismatch") -(assert_invalid (module (memory 1) (func (i64.store16 (f32.const 0) (i64.const 0)))) "type mismatch") -(assert_invalid (module (memory 1) (func (i64.store32 (f32.const 0) (i64.const 0)))) "type mismatch") -(assert_invalid (module (memory 1) (func (f32.store (f32.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (memory 1) (func (f64.store (f32.const 0) (f64.const 0)))) "type mismatch") - -;; store value -(assert_invalid (module (memory 1) (func (i32.store (i32.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (memory 1) (func (i32.store8 (i32.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (memory 1) (func (i32.store16 (i32.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (memory 1) (func (i64.store (i32.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (memory 1) (func (i64.store8 (i32.const 0) (f64.const 0)))) "type mismatch") -(assert_invalid (module (memory 1) (func (i64.store16 (i32.const 0) (f64.const 0)))) "type mismatch") -(assert_invalid (module (memory 1) (func (i64.store32 (i32.const 0) (f64.const 0)))) "type mismatch") -(assert_invalid (module (memory 1) (func (f32.store (i32.const 0) (i32.const 0)))) "type mismatch") -(assert_invalid (module (memory 1) (func (f64.store (i32.const 0) (i64.const 0)))) "type mismatch") - -;; binary -(assert_invalid (module (func (i32.add (i64.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (i32.and (i64.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (i32.div_s (i64.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (i32.div_u (i64.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (i32.mul (i64.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (i32.or (i64.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (i32.rem_s (i64.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (i32.rem_u (i64.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (i32.rotl (i64.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (i32.rotr (i64.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (i32.shl (i64.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (i32.shr_s (i64.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (i32.shr_u (i64.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (i32.sub (i64.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (i32.xor (i64.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (i64.add (i32.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (i64.and (i32.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (i64.div_s (i32.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (i64.div_u (i32.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (i64.mul (i32.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (i64.or (i32.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (i64.rem_s (i32.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (i64.rem_u (i32.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (i64.rotl (i32.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (i64.rotr (i32.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (i64.shl (i32.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (i64.shr_s (i32.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (i64.shr_u (i32.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (i64.sub (i32.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (i64.xor (i32.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (f32.add (i64.const 0) (f64.const 0)))) "type mismatch") -(assert_invalid (module (func (f32.copysign (i64.const 0) (f64.const 0)))) "type mismatch") -(assert_invalid (module (func (f32.div (i64.const 0) (f64.const 0)))) "type mismatch") -(assert_invalid (module (func (f32.max (i64.const 0) (f64.const 0)))) "type mismatch") -(assert_invalid (module (func (f32.min (i64.const 0) (f64.const 0)))) "type mismatch") -(assert_invalid (module (func (f32.mul (i64.const 0) (f64.const 0)))) "type mismatch") -(assert_invalid (module (func (f32.sub (i64.const 0) (f64.const 0)))) "type mismatch") -(assert_invalid (module (func (f64.add (i64.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (f64.copysign (i64.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (f64.div (i64.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (f64.max (i64.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (f64.min (i64.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (f64.mul (i64.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (f64.sub (i64.const 0) (f32.const 0)))) "type mismatch") - -;; unary -(assert_invalid (module (func (i32.eqz (i64.const 0)))) "type mismatch") -(assert_invalid (module (func (i32.clz (i64.const 0)))) "type mismatch") -(assert_invalid (module (func (i32.ctz (i64.const 0)))) "type mismatch") -(assert_invalid (module (func (i32.popcnt (i64.const 0)))) "type mismatch") -(assert_invalid (module (func (i64.eqz (i32.const 0)))) "type mismatch") -(assert_invalid (module (func (i64.clz (i32.const 0)))) "type mismatch") -(assert_invalid (module (func (i64.ctz (i32.const 0)))) "type mismatch") -(assert_invalid (module (func (i64.popcnt (i32.const 0)))) "type mismatch") -(assert_invalid (module (func (f32.abs (i64.const 0)))) "type mismatch") -(assert_invalid (module (func (f32.ceil (i64.const 0)))) "type mismatch") -(assert_invalid (module (func (f32.floor (i64.const 0)))) "type mismatch") -(assert_invalid (module (func (f32.nearest (i64.const 0)))) "type mismatch") -(assert_invalid (module (func (f32.neg (i64.const 0)))) "type mismatch") -(assert_invalid (module (func (f32.sqrt (i64.const 0)))) "type mismatch") -(assert_invalid (module (func (f32.trunc (i64.const 0)))) "type mismatch") -(assert_invalid (module (func (f64.abs (i64.const 0)))) "type mismatch") -(assert_invalid (module (func (f64.ceil (i64.const 0)))) "type mismatch") -(assert_invalid (module (func (f64.floor (i64.const 0)))) "type mismatch") -(assert_invalid (module (func (f64.nearest (i64.const 0)))) "type mismatch") -(assert_invalid (module (func (f64.neg (i64.const 0)))) "type mismatch") -(assert_invalid (module (func (f64.sqrt (i64.const 0)))) "type mismatch") -(assert_invalid (module (func (f64.trunc (i64.const 0)))) "type mismatch") - -;; compare -(assert_invalid (module (func (i32.eq (i64.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (i32.ge_s (i64.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (i32.ge_u (i64.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (i32.gt_s (i64.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (i32.gt_u (i64.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (i32.le_s (i64.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (i32.le_u (i64.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (i32.lt_s (i64.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (i32.lt_u (i64.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (i32.ne (i64.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (i64.eq (i32.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (i64.ge_s (i32.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (i64.ge_u (i32.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (i64.gt_s (i32.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (i64.gt_u (i32.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (i64.le_s (i32.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (i64.le_u (i32.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (i64.lt_s (i32.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (i64.lt_u (i32.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (i64.ne (i32.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (f32.eq (i64.const 0) (f64.const 0)))) "type mismatch") -(assert_invalid (module (func (f32.ge (i64.const 0) (f64.const 0)))) "type mismatch") -(assert_invalid (module (func (f32.gt (i64.const 0) (f64.const 0)))) "type mismatch") -(assert_invalid (module (func (f32.le (i64.const 0) (f64.const 0)))) "type mismatch") -(assert_invalid (module (func (f32.lt (i64.const 0) (f64.const 0)))) "type mismatch") -(assert_invalid (module (func (f32.ne (i64.const 0) (f64.const 0)))) "type mismatch") -(assert_invalid (module (func (f64.eq (i64.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (f64.ge (i64.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (f64.gt (i64.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (f64.le (i64.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (f64.lt (i64.const 0) (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (f64.ne (i64.const 0) (f32.const 0)))) "type mismatch") - -;; convert -(assert_invalid (module (func (i32.wrap/i64 (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (i32.trunc_s/f32 (i64.const 0)))) "type mismatch") -(assert_invalid (module (func (i32.trunc_u/f32 (i64.const 0)))) "type mismatch") -(assert_invalid (module (func (i32.trunc_s/f64 (i64.const 0)))) "type mismatch") -(assert_invalid (module (func (i32.trunc_u/f64 (i64.const 0)))) "type mismatch") -(assert_invalid (module (func (i32.reinterpret/f32 (i64.const 0)))) "type mismatch") -(assert_invalid (module (func (i64.extend_s/i32 (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (i64.extend_u/i32 (f32.const 0)))) "type mismatch") -(assert_invalid (module (func (i64.trunc_s/f32 (i32.const 0)))) "type mismatch") -(assert_invalid (module (func (i64.trunc_u/f32 (i32.const 0)))) "type mismatch") -(assert_invalid (module (func (i64.trunc_s/f64 (i32.const 0)))) "type mismatch") -(assert_invalid (module (func (i64.trunc_u/f64 (i32.const 0)))) "type mismatch") -(assert_invalid (module (func (i64.reinterpret/f64 (i32.const 0)))) "type mismatch") -(assert_invalid (module (func (f32.convert_s/i32 (i64.const 0)))) "type mismatch") -(assert_invalid (module (func (f32.convert_u/i32 (i64.const 0)))) "type mismatch") -(assert_invalid (module (func (f32.convert_s/i64 (i32.const 0)))) "type mismatch") -(assert_invalid (module (func (f32.convert_u/i64 (i32.const 0)))) "type mismatch") -(assert_invalid (module (func (f32.demote/f64 (i32.const 0)))) "type mismatch") -(assert_invalid (module (func (f32.reinterpret/i32 (i64.const 0)))) "type mismatch") -(assert_invalid (module (func (f64.convert_s/i32 (i64.const 0)))) "type mismatch") -(assert_invalid (module (func (f64.convert_u/i32 (i64.const 0)))) "type mismatch") -(assert_invalid (module (func (f64.convert_s/i64 (i32.const 0)))) "type mismatch") -(assert_invalid (module (func (f64.convert_u/i64 (i32.const 0)))) "type mismatch") -(assert_invalid (module (func (f64.promote/f32 (i32.const 0)))) "type mismatch") -(assert_invalid (module (func (f64.reinterpret/i64 (i32.const 0)))) "type mismatch") - -;; grow_memory -(assert_invalid (module (memory 1) (func (grow_memory (f32.const 0)))) "type mismatch") diff --git a/test/core/unreachable.wast b/test/core/unreachable.wast index f0d2c739..3074847a 100644 --- a/test/core/unreachable.wast +++ b/test/core/unreachable.wast @@ -24,62 +24,74 @@ ) (func (export "as-block-first") (result i32) - (block i32 (unreachable) (i32.const 2)) + (block (result i32) (unreachable) (i32.const 2)) ) (func (export "as-block-mid") (result i32) - (block i32 (call $dummy) (unreachable) (i32.const 2)) + (block (result i32) (call $dummy) (unreachable) (i32.const 2)) ) (func (export "as-block-last") (block (nop) (call $dummy) (unreachable)) ) (func (export "as-block-value") (result i32) - (block i32 (nop) (call $dummy) (unreachable)) + (block (result i32) (nop) (call $dummy) (unreachable)) ) (func (export "as-block-broke") (result i32) - (block i32 (call $dummy) (br 0 (i32.const 1)) (unreachable)) + (block (result i32) (call $dummy) (br 0 (i32.const 1)) (unreachable)) ) (func (export "as-loop-first") (result i32) - (loop i32 (unreachable) (i32.const 2)) + (loop (result i32) (unreachable) (i32.const 2)) ) (func (export "as-loop-mid") (result i32) - (loop i32 (call $dummy) (unreachable) (i32.const 2)) + (loop (result i32) (call $dummy) (unreachable) (i32.const 2)) ) (func (export "as-loop-last") (loop (nop) (call $dummy) (unreachable)) ) (func (export "as-loop-broke") (result i32) - (block i32 (loop i32 (call $dummy) (br 1 (i32.const 1)) (unreachable))) + (block (result i32) + (loop (result i32) (call $dummy) (br 1 (i32.const 1)) (unreachable)) + ) ) (func (export "as-br-value") (result i32) - (block i32 (br 0 (unreachable))) + (block (result i32) (br 0 (unreachable))) ) (func (export "as-br_if-cond") (block (br_if 0 (unreachable))) ) (func (export "as-br_if-value") (result i32) - (block i32 (drop (br_if 0 (unreachable) (i32.const 1))) (i32.const 7)) + (block (result i32) + (drop (br_if 0 (unreachable) (i32.const 1))) (i32.const 7) + ) ) (func (export "as-br_if-value-cond") (result i32) - (block i32 (drop (br_if 0 (i32.const 6) (unreachable))) (i32.const 7)) + (block (result i32) + (drop (br_if 0 (i32.const 6) (unreachable))) (i32.const 7) + ) ) (func (export "as-br_table-index") (block (br_table 0 0 0 (unreachable))) ) (func (export "as-br_table-value") (result i32) - (block i32 (br_table 0 0 0 (unreachable) (i32.const 1)) (i32.const 7)) + (block (result i32) + (br_table 0 0 0 (unreachable) (i32.const 1)) (i32.const 7) + ) ) (func (export "as-br_table-value-2") (result i32) - (block i32 (block i32 (br_table 0 1 (unreachable) (i32.const 1)))) + (block (result i32) + (block (result i32) (br_table 0 1 (unreachable) (i32.const 1))) + ) ) (func (export "as-br_table-value-index") (result i32) - (block i32 (br_table 0 0 (i32.const 6) (unreachable)) (i32.const 7)) + (block (result i32) + (br_table 0 0 (i32.const 6) (unreachable)) (i32.const 7) + ) ) (func (export "as-br_table-value-and-index") (result i32) - (block i32 (br_table 0 0 (unreachable)) (i32.const 8)) + (block (result i32) (br_table 0 0 (unreachable)) (i32.const 8)) ) (func (export "as-return-value") (result i64) @@ -87,20 +99,23 @@ ) (func (export "as-if-cond") (result i32) - (if i32 (unreachable) (i32.const 0) (i32.const 1)) + (if (result i32) (unreachable) (then (i32.const 0)) (else (i32.const 1))) ) (func (export "as-if-then") (param i32 i32) (result i32) - (if i32 (get_local 0) (unreachable) (get_local 1)) + (if (result i32) (local.get 0) (then (unreachable)) (else (local.get 1))) ) (func (export "as-if-else") (param i32 i32) (result i32) - (if i32 (get_local 0) (get_local 1) (unreachable)) + (if (result i32) (local.get 0) (then (local.get 1)) (else (unreachable))) + ) + (func (export "as-if-then-no-else") (param i32 i32) (result i32) + (if (local.get 0) (then (unreachable))) (local.get 1) ) (func (export "as-select-first") (param i32 i32) (result i32) - (select (unreachable) (get_local 0) (get_local 1)) + (select (unreachable) (local.get 0) (local.get 1)) ) (func (export "as-select-second") (param i32 i32) (result i32) - (select (get_local 0) (unreachable) (get_local 1)) + (select (local.get 0) (unreachable) (local.get 1)) ) (func (export "as-select-cond") (result i32) (select (i32.const 0) (i32.const 1) (unreachable)) @@ -117,22 +132,37 @@ ) (type $sig (func (param i32 i32 i32))) - (table anyfunc (elem $dummy3)) + (table funcref (elem $dummy3)) (func (export "as-call_indirect-func") - (call_indirect $sig (unreachable) (i32.const 1) (i32.const 2) (i32.const 3)) + (call_indirect (type $sig) + (unreachable) (i32.const 1) (i32.const 2) (i32.const 3) + ) ) (func (export "as-call_indirect-first") - (call_indirect $sig (i32.const 0) (unreachable) (i32.const 2) (i32.const 3)) + (call_indirect (type $sig) + (i32.const 0) (unreachable) (i32.const 2) (i32.const 3) + ) ) (func (export "as-call_indirect-mid") - (call_indirect $sig (i32.const 0) (i32.const 1) (unreachable) (i32.const 3)) + (call_indirect (type $sig) + (i32.const 0) (i32.const 1) (unreachable) (i32.const 3) + ) ) (func (export "as-call_indirect-last") - (call_indirect $sig (i32.const 0) (i32.const 1) (i32.const 2) (unreachable)) + (call_indirect (type $sig) + (i32.const 0) (i32.const 1) (i32.const 2) (unreachable) + ) ) - (func (export "as-set_local-value") (local f32) - (set_local 0 (unreachable)) + (func (export "as-local.set-value") (local f32) + (local.set 0 (unreachable)) + ) + (func (export "as-local.tee-value") (result f32) (local f32) + (local.tee 0 (unreachable)) + ) + (global $a (mut f32) (f32.const 0)) + (func (export "as-global.set-value") (result f32) + (global.set $a (unreachable)) ) (memory 1) @@ -180,11 +210,11 @@ ) (func (export "as-convert-operand") (result i32) - (i32.wrap/i64 (unreachable)) + (i32.wrap_i64 (unreachable)) ) - (func (export "as-grow_memory-size") (result i32) - (grow_memory (unreachable)) + (func (export "as-memory.grow-size") (result i32) + (memory.grow (unreachable)) ) ) @@ -228,6 +258,8 @@ (assert_return (invoke "as-if-then" (i32.const 0) (i32.const 6)) (i32.const 6)) (assert_trap (invoke "as-if-else" (i32.const 0) (i32.const 6)) "unreachable") (assert_return (invoke "as-if-else" (i32.const 1) (i32.const 6)) (i32.const 6)) +(assert_trap (invoke "as-if-then-no-else" (i32.const 1) (i32.const 6)) "unreachable") +(assert_return (invoke "as-if-then-no-else" (i32.const 0) (i32.const 6)) (i32.const 6)) (assert_trap (invoke "as-select-first" (i32.const 0) (i32.const 6)) "unreachable") (assert_trap (invoke "as-select-first" (i32.const 1) (i32.const 6)) "unreachable") @@ -244,7 +276,9 @@ (assert_trap (invoke "as-call_indirect-mid") "unreachable") (assert_trap (invoke "as-call_indirect-last") "unreachable") -(assert_trap (invoke "as-set_local-value") "unreachable") +(assert_trap (invoke "as-local.set-value") "unreachable") +(assert_trap (invoke "as-local.tee-value") "unreachable") +(assert_trap (invoke "as-global.set-value") "unreachable") (assert_trap (invoke "as-load-address") "unreachable") (assert_trap (invoke "as-loadN-address") "unreachable") @@ -266,5 +300,5 @@ (assert_trap (invoke "as-convert-operand") "unreachable") -(assert_trap (invoke "as-grow_memory-size") "unreachable") +(assert_trap (invoke "as-memory.grow-size") "unreachable") diff --git a/test/core/unreached-invalid.wast b/test/core/unreached-invalid.wast index f0ad5ca7..3ddd7738 100644 --- a/test/core/unreached-invalid.wast +++ b/test/core/unreached-invalid.wast @@ -1,11 +1,11 @@ ;; Failures in unreachable code. (assert_invalid - (module (func $local-index (unreachable) (drop (get_local 0)))) + (module (func $local-index (unreachable) (drop (local.get 0)))) "unknown local" ) (assert_invalid - (module (func $global-index (unreachable) (drop (get_global 0)))) + (module (func $global-index (unreachable) (drop (global.get 0)))) "unknown global" ) (assert_invalid @@ -99,7 +99,7 @@ ) (assert_invalid (module (func $type-block-value-num-vs-num-after-break (result i32) - (block i32 (i32.const 1) (br 0) (f32.const 0)) + (block (result i32) (i32.const 1) (br 0) (f32.const 0)) )) "type mismatch" ) @@ -111,7 +111,7 @@ ) (assert_invalid (module (func $type-loop-value-num-vs-num-after-break (result i32) - (loop i32 (br 1 (i32.const 1)) (f32.const 0)) + (loop (result i32) (br 1 (i32.const 1)) (f32.const 0)) )) "type mismatch" ) @@ -160,7 +160,7 @@ ) (assert_invalid (module (func $type-block-value-num-vs-num-after-return (result i32) - (block i32 (i32.const 1) (return (i32.const 0)) (f32.const 0)) + (block (result i32) (i32.const 1) (return (i32.const 0)) (f32.const 0)) )) "type mismatch" ) @@ -172,7 +172,7 @@ ) (assert_invalid (module (func $type-loop-value-num-vs-num-after-return (result i32) - (loop i32 (return (i32.const 1)) (f32.const 0)) + (loop (result i32) (return (i32.const 1)) (f32.const 0)) )) "type mismatch" ) @@ -195,6 +195,18 @@ )) "type mismatch" ) +(assert_invalid + (module (func $type-unary-num-vs-void-in-loop-after-unreachable + (unreachable) (loop (drop (i32.eqz (nop)))) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-unary-num-vs-void-in-i32-loop-after-unreachable + (unreachable) (loop (result i32) (i32.eqz (nop))) + )) + "type mismatch" +) (assert_invalid (module (func $type-unary-num-vs-num-after-unreachable (unreachable) (drop (i32.eqz (f32.const 1))) @@ -221,7 +233,7 @@ ) (assert_invalid (module (func $type-block-value-num-vs-num-after-unreachable (result i32) - (block i32 (i32.const 1) (unreachable) (f32.const 0)) + (block (result i32) (i32.const 1) (unreachable) (f32.const 0)) )) "type mismatch" ) @@ -233,7 +245,7 @@ ) (assert_invalid (module (func $type-loop-value-num-vs-num-after-unreachable (result i32) - (loop i32 (unreachable) (f32.const 0)) + (loop (result i32) (unreachable) (f32.const 0)) )) "type mismatch" ) @@ -249,6 +261,24 @@ )) "type mismatch" ) +(assert_invalid + (module (func $type-unary-num-vs-void-in-if-after-unreachable + (unreachable) (if (i32.const 0) (then (drop (i32.eqz (nop))))) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-unary-num-vs-void-in-else-after-unreachable + (unreachable) (if (i32.const 0) (then (nop)) (else (drop (i32.eqz (nop))))) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-unary-num-vs-void-in-else-after-unreachable-if + (if (i32.const 0) (then (unreachable)) (else (drop (i32.eqz (nop))))) + )) + "type mismatch" +) (assert_invalid (module (func $type-unary-num-vs-void-after-nested-unreachable @@ -283,7 +313,7 @@ (assert_invalid (module (func $type-block-value-num-vs-num-after-nested-unreachable (result i32) - (block i32 (i32.const 1) (block (unreachable)) (f32.const 0)) + (block (result i32) (i32.const 1) (block (unreachable)) (f32.const 0)) )) "type mismatch" ) @@ -296,7 +326,7 @@ (assert_invalid (module (func $type-loop-value-num-vs-num-after-nested-unreachable (result i32) - (loop i32 (block (unreachable)) (f32.const 0)) + (loop (result i32) (block (unreachable)) (f32.const 0)) )) "type mismatch" ) @@ -346,7 +376,7 @@ ) (assert_invalid (module (func $type-block-value-num-vs-num-after-infinite-loop (result i32) - (block i32 (i32.const 1) (loop (br 0)) (f32.const 0)) + (block (result i32) (i32.const 1) (loop (br 0)) (f32.const 0)) )) "type mismatch" ) @@ -358,7 +388,7 @@ ) (assert_invalid (module (func $type-loop-value-num-vs-num-after-infinite-loop (result i32) - (loop i32 (loop (br 0)) (f32.const 0)) + (loop (result i32) (loop (br 0)) (f32.const 0)) )) "type mismatch" ) @@ -407,7 +437,7 @@ ) (assert_invalid (module (func $type-if-value-num-vs-num-in-dead-body (result i32) - (if i32 (i32.const 0) (then (f32.const 0))) + (if (result i32) (i32.const 0) (then (f32.const 0))) )) "type mismatch" ) @@ -419,7 +449,7 @@ ) (assert_invalid (module (func $type-block-value-num-vs-num-in-dead-body (result i32) - (if i32 (i32.const 0) (then (block i32 (f32.const 0)))) + (if (result i32) (i32.const 0) (then (block (result i32) (f32.const 0)))) )) "type mismatch" ) @@ -431,7 +461,7 @@ ) (assert_invalid (module (func $type-block-value-num-vs-num-in-dead-body (result i32) - (if i32 (i32.const 0) (then (loop i32 (f32.const 0)))) + (if (result i32) (i32.const 0) (then (loop (result i32) (f32.const 0)))) )) "type mismatch" ) @@ -445,7 +475,7 @@ (assert_invalid (module (func $type-br-second-num-vs-num (result i32) - (block i32 (br 0 (i32.const 1)) (br 0 (f64.const 1))) + (block (result i32) (br 0 (i32.const 1)) (br 0 (f64.const 1))) )) "type mismatch" ) @@ -456,6 +486,31 @@ )) "type mismatch" ) +(assert_invalid + (module (func $type-br_if-num-vs-void-after-unreachable (result i32) + (block (result i32) + (block (unreachable) (br_if 1 (i32.const 0) (i32.const 0))) + ) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-br_if-num-vs-num-after-unreachable (result i32) + (block (result i32) + (block (result f32) (unreachable) (br_if 1 (i32.const 0) (i32.const 0))) + (drop) (i32.const 0) + ) + )) + "type mismatch" +) +(assert_invalid + (module (func $type-br_if-num2-vs-num-after-unreachable (result i32) + (block (result i32) + (unreachable) (br_if 0 (i32.const 0) (i32.const 0)) (i32.const 0) + ) + )) + "type mismatch" +) (assert_invalid (module (func $type-br_table-num-vs-num-after-unreachable (block (br_table 0 (unreachable) (f32.const 1))) @@ -464,14 +519,14 @@ ) (assert_invalid (module (func $type-br_table-label-num-vs-num-after-unreachable (result i32) - (block i32 (unreachable) (br_table 0 (f32.const 0) (i32.const 1))) + (block (result i32) (unreachable) (br_table 0 (f32.const 0) (i32.const 1))) )) "type mismatch" ) (assert_invalid (module (func $type-br_table-label-num-vs-label-void-after-unreachable (block - (block f32 + (block (result f32) (unreachable) (br_table 0 1 0 (i32.const 1)) ) @@ -480,20 +535,6 @@ )) "type mismatch" ) -(assert_invalid - (module (func $type-br_table-label-num-vs-label-num-after-unreachable - (block f64 - (block f32 - (unreachable) - (br_table 0 1 1 (i32.const 1)) - ) - (drop) - (f64.const 0) - ) - (drop) - )) - "type mismatch" -) (assert_invalid (module (func $type-block-value-nested-unreachable-num-vs-void @@ -509,7 +550,7 @@ ) (assert_invalid (module (func $type-block-value-nested-unreachable-num-vs-num (result i32) - (block i64 (i64.const 0) (block (unreachable))) + (block (result i64) (i64.const 0) (block (unreachable))) )) "type mismatch" ) @@ -528,13 +569,13 @@ ) (assert_invalid (module (func $type-block-value-nested-br-void-vs-num (result i32) - (block i32 (block (br 1 (i32.const 0)))) + (block (result i32) (block (br 1 (i32.const 0)))) )) "type mismatch" ) (assert_invalid (module (func $type-block-value-nested-br-num-vs-num (result i32) - (block i32 (i64.const 0) (block (br 1 (i32.const 0)))) + (block (result i32) (i64.const 0) (block (br 1 (i32.const 0)))) )) "type mismatch" ) @@ -547,13 +588,15 @@ ) (assert_invalid (module (func $type-block-value-nested2-br-void-vs-num (result i32) - (block i32 (block (block (br 2 (i32.const 0))))) + (block (result i32) (block (block (br 2 (i32.const 0))))) )) "type mismatch" ) (assert_invalid (module (func $type-block-value-nested2-br-num-vs-num (result i32) - (block i32 (block i64 (i64.const 0) (block (br 2 (i32.const 0))))) + (block (result i32) + (block (result i64) (i64.const 0) (block (br 2 (i32.const 0)))) + ) )) "type mismatch" ) @@ -578,7 +621,7 @@ ) (assert_invalid (module (func $type-block-value-nested-return-num-vs-num (result i32) - (block i64 (i64.const 0) (block (return (i32.const 0)))) + (block (result i64) (i64.const 0) (block (return (i32.const 0)))) )) "type mismatch" ) @@ -604,7 +647,7 @@ ) (assert_invalid (module (func $type-loop-value-nested-unreachable-num-vs-num (result i32) - (loop i64 (i64.const 0) (block (unreachable))) + (loop (result i64) (i64.const 0) (block (unreachable))) )) "type mismatch" ) @@ -621,3 +664,32 @@ )) "type mismatch" ) + +(assert_invalid + (module (func $tee-local-unreachable-value + (local i32) + (local.tee 0 (unreachable)) + )) + "type mismatch" +) +(assert_invalid + (module (func $br_if-unreachable (result i32) + (block (result i32) + (block + (br_if 1 (unreachable) (i32.const 0)) + ) + (i32.const 0) + ) + )) + "type mismatch" +) +(assert_invalid + (module + (func $type-br_if-after-unreachable (result i64) + unreachable + br_if 0 + i64.extend_i32_u + ) + ) + "type mismatch" +) diff --git a/test/core/unwind.wast b/test/core/unwind.wast index b993f2a8..85db60b5 100644 --- a/test/core/unwind.wast +++ b/test/core/unwind.wast @@ -10,6 +10,12 @@ (func (export "func-unwind-by-br-value") (result i32) (i32.const 3) (i64.const 1) (br 0 (i32.const 9)) ) + (func (export "func-unwind-by-br_if") + (i32.const 3) (i64.const 1) (drop (drop (br_if 0 (i32.const 1)))) + ) + (func (export "func-unwind-by-br_if-value") (result i32) + (i32.const 3) (i64.const 1) (drop (drop (br_if 0 (i32.const 9) (i32.const 1)))) + ) (func (export "func-unwind-by-br_table") (i32.const 3) (i64.const 1) (br_table 0 (i32.const 0)) ) @@ -27,28 +33,46 @@ (block (i32.const 3) (i64.const 1) (br 0)) (i32.const 9) ) (func (export "block-unwind-by-br-value") (result i32) - (block i32 (i32.const 3) (i64.const 1) (br 0 (i32.const 9))) + (block (result i32) (i32.const 3) (i64.const 1) (br 0 (i32.const 9))) + ) + (func (export "block-unwind-by-br_if") (result i32) + (block (i32.const 3) (i64.const 1) (drop (drop (br_if 0 (i32.const 1))))) (i32.const 9) + ) + (func (export "block-unwind-by-br_if-value") (result i32) + (block (result i32) + (i32.const 3) (i64.const 1) (drop (drop (br_if 0 (i32.const 9) (i32.const 1)))) + ) ) (func (export "block-unwind-by-br_table") (result i32) (block (i32.const 3) (i64.const 1) (br_table 0 (i32.const 0))) (i32.const 9) ) (func (export "block-unwind-by-br_table-value") (result i32) - (block i32 + (block (result i32) (i32.const 3) (i64.const 1) (br_table 0 (i32.const 9) (i32.const 0)) ) ) (func (export "block-unwind-by-return") (result i32) - (block i32 (i32.const 3) (i64.const 1) (return (i32.const 9))) + (block (result i32) (i32.const 3) (i64.const 1) (return (i32.const 9))) ) (func (export "block-nested-unwind-by-unreachable") (result i32) - (block i32 (i32.const 3) (block (i64.const 1) (unreachable))) + (block (result i32) (i32.const 3) (block (i64.const 1) (unreachable))) ) (func (export "block-nested-unwind-by-br") (result i32) (block (i32.const 3) (block (i64.const 1) (br 1)) (drop)) (i32.const 9) ) (func (export "block-nested-unwind-by-br-value") (result i32) - (block i32 (i32.const 3) (block (i64.const 1) (br 1 (i32.const 9)))) + (block (result i32) + (i32.const 3) (block (i64.const 1) (br 1 (i32.const 9))) + ) + ) + (func (export "block-nested-unwind-by-br_if") (result i32) + (block (i32.const 3) (block (i64.const 1) (drop (br_if 1 (i32.const 1)))) (drop)) (i32.const 9) + ) + (func (export "block-nested-unwind-by-br_if-value") (result i32) + (block (result i32) + (i32.const 3) (block (i64.const 1) (drop (drop (br_if 1 (i32.const 9) (i32.const 1))))) + ) ) (func (export "block-nested-unwind-by-br_table") (result i32) (block @@ -58,23 +82,30 @@ (i32.const 9) ) (func (export "block-nested-unwind-by-br_table-value") (result i32) - (block i32 + (block (result i32) (i32.const 3) (block (i64.const 1) (br_table 1 (i32.const 9) (i32.const 1))) ) ) (func (export "block-nested-unwind-by-return") (result i32) - (block i32 (i32.const 3) (block (i64.const 1) (return (i32.const 9)))) + (block (result i32) + (i32.const 3) (block (i64.const 1) (return (i32.const 9))) + ) ) (func (export "unary-after-unreachable") (result i32) (f32.const 0) (unreachable) (i64.eqz) ) (func (export "unary-after-br") (result i32) - (block i32 (f32.const 0) (br 0 (i32.const 9)) (i64.eqz)) + (block (result i32) (f32.const 0) (br 0 (i32.const 9)) (i64.eqz)) + ) + (func (export "unary-after-br_if") (result i32) + (block (result i32) + (i64.const 0) (drop (br_if 0 (i32.const 9) (i32.const 1))) (i64.eqz) + ) ) (func (export "unary-after-br_table") (result i32) - (block i32 + (block (result i32) (f32.const 0) (br_table 0 0 (i32.const 9) (i32.const 0)) (i64.eqz) ) ) @@ -86,10 +117,18 @@ (f32.const 0) (f64.const 1) (unreachable) (i64.eq) ) (func (export "binary-after-br") (result i32) - (block i32 (f32.const 0) (f64.const 1) (br 0 (i32.const 9)) (i64.eq)) + (block (result i32) + (f32.const 0) (f64.const 1) (br 0 (i32.const 9)) (i64.eq) + ) + ) + (func (export "binary-after-br_if") (result i32) + (block (result i32) + (i64.const 0) (i64.const 1) (drop (br_if 0 (i32.const 9) (i32.const 1))) + (i64.eq) + ) ) (func (export "binary-after-br_table") (result i32) - (block i32 + (block (result i32) (f32.const 0) (f64.const 1) (br_table 0 (i32.const 9) (i32.const 0)) (i64.eq) ) @@ -102,12 +141,19 @@ (f32.const 0) (f64.const 1) (i64.const 0) (unreachable) (select) ) (func (export "select-after-br") (result i32) - (block i32 + (block (result i32) (f32.const 0) (f64.const 1) (i64.const 0) (br 0 (i32.const 9)) (select) ) ) + (func (export "select-after-br_if") (result i32) + (block (result i32) + (i32.const 0) (i32.const 1) (i32.const 0) + (drop (br_if 0 (i32.const 9) (i32.const 1))) + (select) + ) + ) (func (export "select-after-br_table") (result i32) - (block i32 + (block (result i32) (f32.const 0) (f64.const 1) (i64.const 0) (br_table 0 (i32.const 9) (i32.const 0)) (select) @@ -118,37 +164,56 @@ ) (func (export "block-value-after-unreachable") (result i32) - (block i32 (f32.const 0) (unreachable)) + (block (result i32) (f32.const 0) (unreachable)) ) (func (export "block-value-after-br") (result i32) - (block i32 (f32.const 0) (br 0 (i32.const 9))) + (block (result i32) (f32.const 0) (br 0 (i32.const 9))) + ) + (func (export "block-value-after-br_if") (result i32) + (block (result i32) + (i32.const 0) (drop (br_if 0 (i32.const 9) (i32.const 1))) + ) ) (func (export "block-value-after-br_table") (result i32) - (block i32 (f32.const 0) (br_table 0 0 (i32.const 9) (i32.const 0))) + (block (result i32) + (f32.const 0) (br_table 0 0 (i32.const 9) (i32.const 0)) + ) ) (func (export "block-value-after-return") (result i32) - (block i32 (f32.const 0) (return (i32.const 9))) + (block (result i32) (f32.const 0) (return (i32.const 9))) ) (func (export "loop-value-after-unreachable") (result i32) - (loop i32 (f32.const 0) (unreachable)) + (loop (result i32) (f32.const 0) (unreachable)) ) (func (export "loop-value-after-br") (result i32) - (block i32 (loop i32 (f32.const 0) (br 1 (i32.const 9)))) + (block (result i32) (loop (result i32) (f32.const 0) (br 1 (i32.const 9)))) ) + (func (export "loop-value-after-br_if") (result i32) + (block (result i32) + (loop (result i32) + (i32.const 0) (drop (br_if 1 (i32.const 9) (i32.const 1))) + ) + ) + ) + (func (export "loop-value-after-br_table") (result i32) - (block i32 - (loop i32 (f32.const 0) (br_table 1 1 (i32.const 9) (i32.const 0))) + (block (result i32) + (loop (result i32) + (f32.const 0) (br_table 1 1 (i32.const 9) (i32.const 0)) + ) ) ) (func (export "loop-value-after-return") (result i32) - (loop i32 (f32.const 0) (return (i32.const 9))) + (loop (result i32) (f32.const 0) (return (i32.const 9))) ) ) (assert_trap (invoke "func-unwind-by-unreachable") "unreachable") (assert_return (invoke "func-unwind-by-br")) (assert_return (invoke "func-unwind-by-br-value") (i32.const 9)) +(assert_return (invoke "func-unwind-by-br_if")) +(assert_return (invoke "func-unwind-by-br_if-value") (i32.const 9)) (assert_return (invoke "func-unwind-by-br_table")) (assert_return (invoke "func-unwind-by-br_table-value") (i32.const 9)) (assert_return (invoke "func-unwind-by-return") (i32.const 9)) @@ -156,6 +221,8 @@ (assert_trap (invoke "block-unwind-by-unreachable") "unreachable") (assert_return (invoke "block-unwind-by-br") (i32.const 9)) (assert_return (invoke "block-unwind-by-br-value") (i32.const 9)) +(assert_return (invoke "block-unwind-by-br_if") (i32.const 9)) +(assert_return (invoke "block-unwind-by-br_if-value") (i32.const 9)) (assert_return (invoke "block-unwind-by-br_table") (i32.const 9)) (assert_return (invoke "block-unwind-by-br_table-value") (i32.const 9)) (assert_return (invoke "block-unwind-by-return") (i32.const 9)) @@ -163,31 +230,38 @@ (assert_trap (invoke "block-nested-unwind-by-unreachable") "unreachable") (assert_return (invoke "block-nested-unwind-by-br") (i32.const 9)) (assert_return (invoke "block-nested-unwind-by-br-value") (i32.const 9)) +(assert_return (invoke "block-nested-unwind-by-br_if") (i32.const 9)) +(assert_return (invoke "block-nested-unwind-by-br_if-value") (i32.const 9)) (assert_return (invoke "block-nested-unwind-by-br_table") (i32.const 9)) (assert_return (invoke "block-nested-unwind-by-br_table-value") (i32.const 9)) (assert_return (invoke "block-nested-unwind-by-return") (i32.const 9)) (assert_trap (invoke "unary-after-unreachable") "unreachable") (assert_return (invoke "unary-after-br") (i32.const 9)) +(assert_return (invoke "unary-after-br_if") (i32.const 9)) (assert_return (invoke "unary-after-br_table") (i32.const 9)) (assert_return (invoke "unary-after-return") (i32.const 9)) (assert_trap (invoke "binary-after-unreachable") "unreachable") (assert_return (invoke "binary-after-br") (i32.const 9)) +(assert_return (invoke "binary-after-br_if") (i32.const 9)) (assert_return (invoke "binary-after-br_table") (i32.const 9)) (assert_return (invoke "binary-after-return") (i32.const 9)) (assert_trap (invoke "select-after-unreachable") "unreachable") (assert_return (invoke "select-after-br") (i32.const 9)) +(assert_return (invoke "select-after-br_if") (i32.const 9)) (assert_return (invoke "select-after-br_table") (i32.const 9)) (assert_return (invoke "select-after-return") (i32.const 9)) (assert_trap (invoke "block-value-after-unreachable") "unreachable") (assert_return (invoke "block-value-after-br") (i32.const 9)) +(assert_return (invoke "block-value-after-br_if") (i32.const 9)) (assert_return (invoke "block-value-after-br_table") (i32.const 9)) (assert_return (invoke "block-value-after-return") (i32.const 9)) (assert_trap (invoke "loop-value-after-unreachable") "unreachable") (assert_return (invoke "loop-value-after-br") (i32.const 9)) +(assert_return (invoke "loop-value-after-br_if") (i32.const 9)) (assert_return (invoke "loop-value-after-br_table") (i32.const 9)) (assert_return (invoke "loop-value-after-return") (i32.const 9)) diff --git a/test/core/utf8-custom-section-id.wast b/test/core/utf8-custom-section-id.wast new file mode 100644 index 00000000..129d2b91 --- /dev/null +++ b/test/core/utf8-custom-section-id.wast @@ -0,0 +1,1792 @@ +;;;;;; Invalid UTF-8 custom section names + +;;;; Continuation bytes not preceded by prefixes + +;; encoding starts with (first) continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\02" ;; custom section + "\01\80" ;; "\80" + ) + "invalid UTF-8 encoding" +) + +;; encoding starts with (0x8f) continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\02" ;; custom section + "\01\8f" ;; "\8f" + ) + "invalid UTF-8 encoding" +) + +;; encoding starts with (0x90) continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\02" ;; custom section + "\01\90" ;; "\90" + ) + "invalid UTF-8 encoding" +) + +;; encoding starts with (0x9f) continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\02" ;; custom section + "\01\9f" ;; "\9f" + ) + "invalid UTF-8 encoding" +) + +;; encoding starts with (0xa0) continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\02" ;; custom section + "\01\a0" ;; "\a0" + ) + "invalid UTF-8 encoding" +) + +;; encoding starts with (last) continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\02" ;; custom section + "\01\bf" ;; "\bf" + ) + "invalid UTF-8 encoding" +) + +;;;; 2-byte sequences + +;; 2-byte sequence contains 3 bytes +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\c2\80\80" ;; "\c2\80\80" + ) + "invalid UTF-8 encoding" +) + +;; 2-byte sequence contains 1 byte at end of string +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\02" ;; custom section + "\01\c2" ;; "\c2" + ) + "invalid UTF-8 encoding" +) + +;; 2-byte sequence contains 1 byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\03" ;; custom section + "\02\c2\2e" ;; "\c2." + ) + "invalid UTF-8 encoding" +) + +;;;; 2-byte sequence contents + +;; overlong encoding after 0xc0 prefix +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\03" ;; custom section + "\02\c0\80" ;; "\c0\80" + ) + "invalid UTF-8 encoding" +) + +;; overlong encoding after 0xc0 prefix +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\03" ;; custom section + "\02\c0\bf" ;; "\c0\bf" + ) + "invalid UTF-8 encoding" +) + +;; overlong encoding after 0xc1 prefix +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\03" ;; custom section + "\02\c1\80" ;; "\c1\80" + ) + "invalid UTF-8 encoding" +) + +;; overlong encoding after 0xc1 prefix +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\03" ;; custom section + "\02\c1\bf" ;; "\c1\bf" + ) + "invalid UTF-8 encoding" +) + +;; byte after (first) 2-byte prefix not a contination byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\03" ;; custom section + "\02\c2\00" ;; "\c2\00" + ) + "invalid UTF-8 encoding" +) + +;; byte after (first) 2-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\03" ;; custom section + "\02\c2\7f" ;; "\c2\7f" + ) + "invalid UTF-8 encoding" +) + +;; byte after (first) 2-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\03" ;; custom section + "\02\c2\c0" ;; "\c2\c0" + ) + "invalid UTF-8 encoding" +) + +;; byte after (first) 2-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\03" ;; custom section + "\02\c2\fd" ;; "\c2\fd" + ) + "invalid UTF-8 encoding" +) + +;; byte after (last) 2-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\03" ;; custom section + "\02\df\00" ;; "\df\00" + ) + "invalid UTF-8 encoding" +) + +;; byte after (last) 2-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\03" ;; custom section + "\02\df\7f" ;; "\df\7f" + ) + "invalid UTF-8 encoding" +) + +;; byte after (last) 2-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\03" ;; custom section + "\02\df\c0" ;; "\df\c0" + ) + "invalid UTF-8 encoding" +) + +;; byte after (last) 2-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\03" ;; custom section + "\02\df\fd" ;; "\df\fd" + ) + "invalid UTF-8 encoding" +) + +;;;; 3-byte sequences + +;; 3-byte sequence contains 4 bytes +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\e1\80\80\80" ;; "\e1\80\80\80" + ) + "invalid UTF-8 encoding" +) + +;; 3-byte sequence contains 2 bytes at end of string +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\03" ;; custom section + "\02\e1\80" ;; "\e1\80" + ) + "invalid UTF-8 encoding" +) + +;; 3-byte sequence contains 2 bytes +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\e1\80\2e" ;; "\e1\80." + ) + "invalid UTF-8 encoding" +) + +;; 3-byte sequence contains 1 byte at end of string +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\02" ;; custom section + "\01\e1" ;; "\e1" + ) + "invalid UTF-8 encoding" +) + +;; 3-byte sequence contains 1 byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\03" ;; custom section + "\02\e1\2e" ;; "\e1." + ) + "invalid UTF-8 encoding" +) + +;;;; 3-byte sequence contents + +;; first byte after (0xe0) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\e0\00\a0" ;; "\e0\00\a0" + ) + "invalid UTF-8 encoding" +) + +;; first byte after (0xe0) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\e0\7f\a0" ;; "\e0\7f\a0" + ) + "invalid UTF-8 encoding" +) + +;; overlong encoding after 0xe0 prefix +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\e0\80\80" ;; "\e0\80\80" + ) + "invalid UTF-8 encoding" +) + +;; overlong encoding after 0xe0 prefix +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\e0\80\a0" ;; "\e0\80\a0" + ) + "invalid UTF-8 encoding" +) + +;; overlong encoding after 0xe0 prefix +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\e0\9f\a0" ;; "\e0\9f\a0" + ) + "invalid UTF-8 encoding" +) + +;; overlong encoding after 0xe0 prefix +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\e0\9f\bf" ;; "\e0\9f\bf" + ) + "invalid UTF-8 encoding" +) + +;; first byte after (0xe0) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\e0\c0\a0" ;; "\e0\c0\a0" + ) + "invalid UTF-8 encoding" +) + +;; first byte after (0xe0) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\e0\fd\a0" ;; "\e0\fd\a0" + ) + "invalid UTF-8 encoding" +) + +;; first byte after (first normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\e1\00\80" ;; "\e1\00\80" + ) + "invalid UTF-8 encoding" +) + +;; first byte after (first normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\e1\7f\80" ;; "\e1\7f\80" + ) + "invalid UTF-8 encoding" +) + +;; first byte after (first normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\e1\c0\80" ;; "\e1\c0\80" + ) + "invalid UTF-8 encoding" +) + +;; first byte after (first normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\e1\fd\80" ;; "\e1\fd\80" + ) + "invalid UTF-8 encoding" +) + +;; first byte after (normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\ec\00\80" ;; "\ec\00\80" + ) + "invalid UTF-8 encoding" +) + +;; first byte after (normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\ec\7f\80" ;; "\ec\7f\80" + ) + "invalid UTF-8 encoding" +) + +;; first byte after (normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\ec\c0\80" ;; "\ec\c0\80" + ) + "invalid UTF-8 encoding" +) + +;; first byte after (normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\ec\fd\80" ;; "\ec\fd\80" + ) + "invalid UTF-8 encoding" +) + +;; first byte after (0xed) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\ed\00\80" ;; "\ed\00\80" + ) + "invalid UTF-8 encoding" +) + +;; first byte after (0xed) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\ed\7f\80" ;; "\ed\7f\80" + ) + "invalid UTF-8 encoding" +) + +;; byte sequence reserved for UTF-16 surrogate half +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\ed\a0\80" ;; "\ed\a0\80" + ) + "invalid UTF-8 encoding" +) + +;; byte sequence reserved for UTF-16 surrogate half +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\ed\a0\bf" ;; "\ed\a0\bf" + ) + "invalid UTF-8 encoding" +) + +;; byte sequence reserved for UTF-16 surrogate half +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\ed\bf\80" ;; "\ed\bf\80" + ) + "invalid UTF-8 encoding" +) + +;; byte sequence reserved for UTF-16 surrogate half +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\ed\bf\bf" ;; "\ed\bf\bf" + ) + "invalid UTF-8 encoding" +) + +;; first byte after (0xed) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\ed\c0\80" ;; "\ed\c0\80" + ) + "invalid UTF-8 encoding" +) + +;; first byte after (0xed) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\ed\fd\80" ;; "\ed\fd\80" + ) + "invalid UTF-8 encoding" +) + +;; first byte after (normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\ee\00\80" ;; "\ee\00\80" + ) + "invalid UTF-8 encoding" +) + +;; first byte after (normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\ee\7f\80" ;; "\ee\7f\80" + ) + "invalid UTF-8 encoding" +) + +;; first byte after (normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\ee\c0\80" ;; "\ee\c0\80" + ) + "invalid UTF-8 encoding" +) + +;; first byte after (normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\ee\fd\80" ;; "\ee\fd\80" + ) + "invalid UTF-8 encoding" +) + +;; first byte after (last normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\ef\00\80" ;; "\ef\00\80" + ) + "invalid UTF-8 encoding" +) + +;; first byte after (last normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\ef\7f\80" ;; "\ef\7f\80" + ) + "invalid UTF-8 encoding" +) + +;; first byte after (last normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\ef\c0\80" ;; "\ef\c0\80" + ) + "invalid UTF-8 encoding" +) + +;; first byte after (last normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\ef\fd\80" ;; "\ef\fd\80" + ) + "invalid UTF-8 encoding" +) + +;;;; 3-byte sequence contents (third byte) + +;; second byte after (0xe0) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\e0\a0\00" ;; "\e0\a0\00" + ) + "invalid UTF-8 encoding" +) + +;; second byte after (0xe0) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\e0\a0\7f" ;; "\e0\a0\7f" + ) + "invalid UTF-8 encoding" +) + +;; second byte after (0xe0) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\e0\a0\c0" ;; "\e0\a0\c0" + ) + "invalid UTF-8 encoding" +) + +;; second byte after (0xe0) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\e0\a0\fd" ;; "\e0\a0\fd" + ) + "invalid UTF-8 encoding" +) + +;; second byte after (first normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\e1\80\00" ;; "\e1\80\00" + ) + "invalid UTF-8 encoding" +) + +;; second byte after (first normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\e1\80\7f" ;; "\e1\80\7f" + ) + "invalid UTF-8 encoding" +) + +;; second byte after (first normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\e1\80\c0" ;; "\e1\80\c0" + ) + "invalid UTF-8 encoding" +) + +;; second byte after (first normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\e1\80\fd" ;; "\e1\80\fd" + ) + "invalid UTF-8 encoding" +) + +;; second byte after (normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\ec\80\00" ;; "\ec\80\00" + ) + "invalid UTF-8 encoding" +) + +;; second byte after (normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\ec\80\7f" ;; "\ec\80\7f" + ) + "invalid UTF-8 encoding" +) + +;; second byte after (normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\ec\80\c0" ;; "\ec\80\c0" + ) + "invalid UTF-8 encoding" +) + +;; second byte after (normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\ec\80\fd" ;; "\ec\80\fd" + ) + "invalid UTF-8 encoding" +) + +;; second byte after (0xed) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\ed\80\00" ;; "\ed\80\00" + ) + "invalid UTF-8 encoding" +) + +;; second byte after (0xed) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\ed\80\7f" ;; "\ed\80\7f" + ) + "invalid UTF-8 encoding" +) + +;; second byte after (0xed) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\ed\80\c0" ;; "\ed\80\c0" + ) + "invalid UTF-8 encoding" +) + +;; second byte after (0xed) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\ed\80\fd" ;; "\ed\80\fd" + ) + "invalid UTF-8 encoding" +) + +;; second byte after (normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\ee\80\00" ;; "\ee\80\00" + ) + "invalid UTF-8 encoding" +) + +;; second byte after (normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\ee\80\7f" ;; "\ee\80\7f" + ) + "invalid UTF-8 encoding" +) + +;; second byte after (normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\ee\80\c0" ;; "\ee\80\c0" + ) + "invalid UTF-8 encoding" +) + +;; second byte after (normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\ee\80\fd" ;; "\ee\80\fd" + ) + "invalid UTF-8 encoding" +) + +;; second byte after (last normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\ef\80\00" ;; "\ef\80\00" + ) + "invalid UTF-8 encoding" +) + +;; second byte after (last normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\ef\80\7f" ;; "\ef\80\7f" + ) + "invalid UTF-8 encoding" +) + +;; second byte after (last normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\ef\80\c0" ;; "\ef\80\c0" + ) + "invalid UTF-8 encoding" +) + +;; second byte after (last normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\ef\80\fd" ;; "\ef\80\fd" + ) + "invalid UTF-8 encoding" +) + +;;;; 4-byte sequences + +;; 4-byte sequence contains 5 bytes +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\06" ;; custom section + "\05\f1\80\80\80\80" ;; "\f1\80\80\80\80" + ) + "invalid UTF-8 encoding" +) + +;; 4-byte sequence contains 3 bytes at end of string +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\f1\80\80" ;; "\f1\80\80" + ) + "invalid UTF-8 encoding" +) + +;; 4-byte sequence contains 3 bytes +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\f1\80\80\23" ;; "\f1\80\80#" + ) + "invalid UTF-8 encoding" +) + +;; 4-byte sequence contains 2 bytes at end of string +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\03" ;; custom section + "\02\f1\80" ;; "\f1\80" + ) + "invalid UTF-8 encoding" +) + +;; 4-byte sequence contains 2 bytes +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\f1\80\23" ;; "\f1\80#" + ) + "invalid UTF-8 encoding" +) + +;; 4-byte sequence contains 1 byte at end of string +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\02" ;; custom section + "\01\f1" ;; "\f1" + ) + "invalid UTF-8 encoding" +) + +;; 4-byte sequence contains 1 byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\03" ;; custom section + "\02\f1\23" ;; "\f1#" + ) + "invalid UTF-8 encoding" +) + +;;;; 4-byte sequence contents + +;; first byte after (0xf0) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\f0\00\90\90" ;; "\f0\00\90\90" + ) + "invalid UTF-8 encoding" +) + +;; first byte after (0xf0) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\f0\7f\90\90" ;; "\f0\7f\90\90" + ) + "invalid UTF-8 encoding" +) + +;; overlong encoding after 0xf0 prefix +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\f0\80\80\80" ;; "\f0\80\80\80" + ) + "invalid UTF-8 encoding" +) + +;; overlong encoding after 0xf0 prefix +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\f0\80\90\90" ;; "\f0\80\90\90" + ) + "invalid UTF-8 encoding" +) + +;; overlong encoding after 0xf0 prefix +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\f0\8f\90\90" ;; "\f0\8f\90\90" + ) + "invalid UTF-8 encoding" +) + +;; overlong encoding after 0xf0 prefix +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\f0\8f\bf\bf" ;; "\f0\8f\bf\bf" + ) + "invalid UTF-8 encoding" +) + +;; first byte after (0xf0) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\f0\c0\90\90" ;; "\f0\c0\90\90" + ) + "invalid UTF-8 encoding" +) + +;; first byte after (0xf0) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\f0\fd\90\90" ;; "\f0\fd\90\90" + ) + "invalid UTF-8 encoding" +) + +;; first byte after (first normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\f1\00\80\80" ;; "\f1\00\80\80" + ) + "invalid UTF-8 encoding" +) + +;; first byte after (first normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\f1\7f\80\80" ;; "\f1\7f\80\80" + ) + "invalid UTF-8 encoding" +) + +;; first byte after (first normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\f1\c0\80\80" ;; "\f1\c0\80\80" + ) + "invalid UTF-8 encoding" +) + +;; first byte after (first normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\f1\fd\80\80" ;; "\f1\fd\80\80" + ) + "invalid UTF-8 encoding" +) + +;; first byte after (last normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\f3\00\80\80" ;; "\f3\00\80\80" + ) + "invalid UTF-8 encoding" +) + +;; first byte after (last normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\f3\7f\80\80" ;; "\f3\7f\80\80" + ) + "invalid UTF-8 encoding" +) + +;; first byte after (last normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\f3\c0\80\80" ;; "\f3\c0\80\80" + ) + "invalid UTF-8 encoding" +) + +;; first byte after (last normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\f3\fd\80\80" ;; "\f3\fd\80\80" + ) + "invalid UTF-8 encoding" +) + +;; first byte after (0xf4) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\f4\00\80\80" ;; "\f4\00\80\80" + ) + "invalid UTF-8 encoding" +) + +;; first byte after (0xf4) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\f4\7f\80\80" ;; "\f4\7f\80\80" + ) + "invalid UTF-8 encoding" +) + +;; (first) invalid code point +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\f4\90\80\80" ;; "\f4\90\80\80" + ) + "invalid UTF-8 encoding" +) + +;; invalid code point +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\f4\bf\80\80" ;; "\f4\bf\80\80" + ) + "invalid UTF-8 encoding" +) + +;; first byte after (0xf4) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\f4\c0\80\80" ;; "\f4\c0\80\80" + ) + "invalid UTF-8 encoding" +) + +;; first byte after (0xf4) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\f4\fd\80\80" ;; "\f4\fd\80\80" + ) + "invalid UTF-8 encoding" +) + +;; (first) invalid 4-byte prefix +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\f5\80\80\80" ;; "\f5\80\80\80" + ) + "invalid UTF-8 encoding" +) + +;; (last) invalid 4-byte prefix +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\f7\80\80\80" ;; "\f7\80\80\80" + ) + "invalid UTF-8 encoding" +) + +;; (last) invalid 4-byte prefix +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\f7\bf\bf\bf" ;; "\f7\bf\bf\bf" + ) + "invalid UTF-8 encoding" +) + +;;;; 4-byte sequence contents (third byte) + +;; second byte after (0xf0) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\f0\90\00\90" ;; "\f0\90\00\90" + ) + "invalid UTF-8 encoding" +) + +;; second byte after (0xf0) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\f0\90\7f\90" ;; "\f0\90\7f\90" + ) + "invalid UTF-8 encoding" +) + +;; second byte after (0xf0) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\f0\90\c0\90" ;; "\f0\90\c0\90" + ) + "invalid UTF-8 encoding" +) + +;; second byte after (0xf0) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\f0\90\fd\90" ;; "\f0\90\fd\90" + ) + "invalid UTF-8 encoding" +) + +;; second byte after (first normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\f1\80\00\80" ;; "\f1\80\00\80" + ) + "invalid UTF-8 encoding" +) + +;; second byte after (first normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\f1\80\7f\80" ;; "\f1\80\7f\80" + ) + "invalid UTF-8 encoding" +) + +;; second byte after (first normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\f1\80\c0\80" ;; "\f1\80\c0\80" + ) + "invalid UTF-8 encoding" +) + +;; second byte after (first normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\f1\80\fd\80" ;; "\f1\80\fd\80" + ) + "invalid UTF-8 encoding" +) + +;; second byte after (last normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\f3\80\00\80" ;; "\f3\80\00\80" + ) + "invalid UTF-8 encoding" +) + +;; second byte after (last normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\f3\80\7f\80" ;; "\f3\80\7f\80" + ) + "invalid UTF-8 encoding" +) + +;; second byte after (last normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\f3\80\c0\80" ;; "\f3\80\c0\80" + ) + "invalid UTF-8 encoding" +) + +;; second byte after (last normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\f3\80\fd\80" ;; "\f3\80\fd\80" + ) + "invalid UTF-8 encoding" +) + +;; second byte after (0xf4) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\f4\80\00\80" ;; "\f4\80\00\80" + ) + "invalid UTF-8 encoding" +) + +;; second byte after (0xf4) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\f4\80\7f\80" ;; "\f4\80\7f\80" + ) + "invalid UTF-8 encoding" +) + +;; second byte after (0xf4) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\f4\80\c0\80" ;; "\f4\80\c0\80" + ) + "invalid UTF-8 encoding" +) + +;; second byte after (0xf4) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\f4\80\fd\80" ;; "\f4\80\fd\80" + ) + "invalid UTF-8 encoding" +) + +;;;; 4-byte sequence contents (fourth byte) + +;; third byte after (0xf0) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\f0\90\90\00" ;; "\f0\90\90\00" + ) + "invalid UTF-8 encoding" +) + +;; third byte after (0xf0) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\f0\90\90\7f" ;; "\f0\90\90\7f" + ) + "invalid UTF-8 encoding" +) + +;; third byte after (0xf0) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\f0\90\90\c0" ;; "\f0\90\90\c0" + ) + "invalid UTF-8 encoding" +) + +;; third byte after (0xf0) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\f0\90\90\fd" ;; "\f0\90\90\fd" + ) + "invalid UTF-8 encoding" +) + +;; third byte after (first normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\f1\80\80\00" ;; "\f1\80\80\00" + ) + "invalid UTF-8 encoding" +) + +;; third byte after (first normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\f1\80\80\7f" ;; "\f1\80\80\7f" + ) + "invalid UTF-8 encoding" +) + +;; third byte after (first normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\f1\80\80\c0" ;; "\f1\80\80\c0" + ) + "invalid UTF-8 encoding" +) + +;; third byte after (first normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\f1\80\80\fd" ;; "\f1\80\80\fd" + ) + "invalid UTF-8 encoding" +) + +;; third byte after (last normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\f3\80\80\00" ;; "\f3\80\80\00" + ) + "invalid UTF-8 encoding" +) + +;; third byte after (last normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\f3\80\80\7f" ;; "\f3\80\80\7f" + ) + "invalid UTF-8 encoding" +) + +;; third byte after (last normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\f3\80\80\c0" ;; "\f3\80\80\c0" + ) + "invalid UTF-8 encoding" +) + +;; third byte after (last normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\f3\80\80\fd" ;; "\f3\80\80\fd" + ) + "invalid UTF-8 encoding" +) + +;; third byte after (0xf4) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\f4\80\80\00" ;; "\f4\80\80\00" + ) + "invalid UTF-8 encoding" +) + +;; third byte after (0xf4) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\f4\80\80\7f" ;; "\f4\80\80\7f" + ) + "invalid UTF-8 encoding" +) + +;; third byte after (0xf4) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\f4\80\80\c0" ;; "\f4\80\80\c0" + ) + "invalid UTF-8 encoding" +) + +;; third byte after (0xf4) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\f4\80\80\fd" ;; "\f4\80\80\fd" + ) + "invalid UTF-8 encoding" +) + +;;;; 5-byte sequences + +;; 5-byte sequence contains 6 bytes +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\07" ;; custom section + "\06\f8\80\80\80\80\80" ;; "\f8\80\80\80\80\80" + ) + "invalid UTF-8 encoding" +) + +;; 5-byte sequence contains 4 bytes at end of string +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\f8\80\80\80" ;; "\f8\80\80\80" + ) + "invalid UTF-8 encoding" +) + +;; 5-byte sequence contains 4 bytes +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\06" ;; custom section + "\05\f8\80\80\80\23" ;; "\f8\80\80\80#" + ) + "invalid UTF-8 encoding" +) + +;; 5-byte sequence contains 3 bytes at end of string +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\f8\80\80" ;; "\f8\80\80" + ) + "invalid UTF-8 encoding" +) + +;; 5-byte sequence contains 3 bytes +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\f8\80\80\23" ;; "\f8\80\80#" + ) + "invalid UTF-8 encoding" +) + +;; 5-byte sequence contains 2 bytes at end of string +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\03" ;; custom section + "\02\f8\80" ;; "\f8\80" + ) + "invalid UTF-8 encoding" +) + +;; 5-byte sequence contains 2 bytes +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\f8\80\23" ;; "\f8\80#" + ) + "invalid UTF-8 encoding" +) + +;; 5-byte sequence contains 1 byte at end of string +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\02" ;; custom section + "\01\f8" ;; "\f8" + ) + "invalid UTF-8 encoding" +) + +;; 5-byte sequence contains 1 byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\03" ;; custom section + "\02\f8\23" ;; "\f8#" + ) + "invalid UTF-8 encoding" +) + +;;;; 5-byte sequence contents + +;; (first) invalid 5-byte prefix +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\06" ;; custom section + "\05\f8\80\80\80\80" ;; "\f8\80\80\80\80" + ) + "invalid UTF-8 encoding" +) + +;; (last) invalid 5-byte prefix +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\06" ;; custom section + "\05\fb\bf\bf\bf\bf" ;; "\fb\bf\bf\bf\bf" + ) + "invalid UTF-8 encoding" +) + +;;;; 6-byte sequences + +;; 6-byte sequence contains 7 bytes +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\08" ;; custom section + "\07\fc\80\80\80\80\80\80" ;; "\fc\80\80\80\80\80\80" + ) + "invalid UTF-8 encoding" +) + +;; 6-byte sequence contains 5 bytes at end of string +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\06" ;; custom section + "\05\fc\80\80\80\80" ;; "\fc\80\80\80\80" + ) + "invalid UTF-8 encoding" +) + +;; 6-byte sequence contains 5 bytes +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\07" ;; custom section + "\06\fc\80\80\80\80\23" ;; "\fc\80\80\80\80#" + ) + "invalid UTF-8 encoding" +) + +;; 6-byte sequence contains 4 bytes at end of string +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\fc\80\80\80" ;; "\fc\80\80\80" + ) + "invalid UTF-8 encoding" +) + +;; 6-byte sequence contains 4 bytes +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\06" ;; custom section + "\05\fc\80\80\80\23" ;; "\fc\80\80\80#" + ) + "invalid UTF-8 encoding" +) + +;; 6-byte sequence contains 3 bytes at end of string +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\fc\80\80" ;; "\fc\80\80" + ) + "invalid UTF-8 encoding" +) + +;; 6-byte sequence contains 3 bytes +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\fc\80\80\23" ;; "\fc\80\80#" + ) + "invalid UTF-8 encoding" +) + +;; 6-byte sequence contains 2 bytes at end of string +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\03" ;; custom section + "\02\fc\80" ;; "\fc\80" + ) + "invalid UTF-8 encoding" +) + +;; 6-byte sequence contains 2 bytes +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\04" ;; custom section + "\03\fc\80\23" ;; "\fc\80#" + ) + "invalid UTF-8 encoding" +) + +;; 6-byte sequence contains 1 byte at end of string +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\02" ;; custom section + "\01\fc" ;; "\fc" + ) + "invalid UTF-8 encoding" +) + +;; 6-byte sequence contains 1 byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\03" ;; custom section + "\02\fc\23" ;; "\fc#" + ) + "invalid UTF-8 encoding" +) + +;;;; 6-byte sequence contents + +;; (first) invalid 6-byte prefix +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\07" ;; custom section + "\06\fc\80\80\80\80\80" ;; "\fc\80\80\80\80\80" + ) + "invalid UTF-8 encoding" +) + +;; (last) invalid 6-byte prefix +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\07" ;; custom section + "\06\fd\bf\bf\bf\bf\bf" ;; "\fd\bf\bf\bf\bf\bf" + ) + "invalid UTF-8 encoding" +) + +;;;; Miscellaneous invalid bytes + +;; invalid byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\02" ;; custom section + "\01\fe" ;; "\fe" + ) + "invalid UTF-8 encoding" +) + +;; invalid byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\02" ;; custom section + "\01\ff" ;; "\ff" + ) + "invalid UTF-8 encoding" +) + +;; UTF-16BE BOM +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\03" ;; custom section + "\02\fe\ff" ;; "\fe\ff" + ) + "invalid UTF-8 encoding" +) + +;; UTF-32BE BOM +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\00\00\fe\ff" ;; "\00\00\fe\ff" + ) + "invalid UTF-8 encoding" +) + +;; UTF-16LE BOM +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\03" ;; custom section + "\02\ff\fe" ;; "\ff\fe" + ) + "invalid UTF-8 encoding" +) + +;; UTF-32LE BOM +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\00\05" ;; custom section + "\04\ff\fe\00\00" ;; "\ff\fe\00\00" + ) + "invalid UTF-8 encoding" +) + diff --git a/test/core/utf8-import-field.wast b/test/core/utf8-import-field.wast new file mode 100644 index 00000000..1ff2aa03 --- /dev/null +++ b/test/core/utf8-import-field.wast @@ -0,0 +1,2672 @@ +;;;;;; Invalid UTF-8 import field names + +;;;; Continuation bytes not preceded by prefixes + +;; encoding starts with (first) continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0b" ;; import section + "\01" ;; length 1 + "\01\80" ;; "\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; encoding starts with (0x8f) continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0b" ;; import section + "\01" ;; length 1 + "\01\8f" ;; "\8f" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; encoding starts with (0x90) continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0b" ;; import section + "\01" ;; length 1 + "\01\90" ;; "\90" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; encoding starts with (0x9f) continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0b" ;; import section + "\01" ;; length 1 + "\01\9f" ;; "\9f" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; encoding starts with (0xa0) continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0b" ;; import section + "\01" ;; length 1 + "\01\a0" ;; "\a0" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; encoding starts with (last) continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0b" ;; import section + "\01" ;; length 1 + "\01\bf" ;; "\bf" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;;;; 2-byte sequences + +;; 2-byte sequence contains 3 bytes +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\c2\80\80" ;; "\c2\80\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; 2-byte sequence contains 1 byte at end of string +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0b" ;; import section + "\01" ;; length 1 + "\01\c2" ;; "\c2" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; 2-byte sequence contains 1 byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0c" ;; import section + "\01" ;; length 1 + "\02\c2\2e" ;; "\c2." + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;;;; 2-byte sequence contents + +;; overlong encoding after 0xc0 prefix +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0c" ;; import section + "\01" ;; length 1 + "\02\c0\80" ;; "\c0\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; overlong encoding after 0xc0 prefix +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0c" ;; import section + "\01" ;; length 1 + "\02\c0\bf" ;; "\c0\bf" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; overlong encoding after 0xc1 prefix +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0c" ;; import section + "\01" ;; length 1 + "\02\c1\80" ;; "\c1\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; overlong encoding after 0xc1 prefix +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0c" ;; import section + "\01" ;; length 1 + "\02\c1\bf" ;; "\c1\bf" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; byte after (first) 2-byte prefix not a contination byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0c" ;; import section + "\01" ;; length 1 + "\02\c2\00" ;; "\c2\00" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; byte after (first) 2-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0c" ;; import section + "\01" ;; length 1 + "\02\c2\7f" ;; "\c2\7f" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; byte after (first) 2-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0c" ;; import section + "\01" ;; length 1 + "\02\c2\c0" ;; "\c2\c0" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; byte after (first) 2-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0c" ;; import section + "\01" ;; length 1 + "\02\c2\fd" ;; "\c2\fd" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; byte after (last) 2-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0c" ;; import section + "\01" ;; length 1 + "\02\df\00" ;; "\df\00" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; byte after (last) 2-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0c" ;; import section + "\01" ;; length 1 + "\02\df\7f" ;; "\df\7f" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; byte after (last) 2-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0c" ;; import section + "\01" ;; length 1 + "\02\df\c0" ;; "\df\c0" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; byte after (last) 2-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0c" ;; import section + "\01" ;; length 1 + "\02\df\fd" ;; "\df\fd" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;;;; 3-byte sequences + +;; 3-byte sequence contains 4 bytes +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\e1\80\80\80" ;; "\e1\80\80\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; 3-byte sequence contains 2 bytes at end of string +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0c" ;; import section + "\01" ;; length 1 + "\02\e1\80" ;; "\e1\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; 3-byte sequence contains 2 bytes +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\e1\80\2e" ;; "\e1\80." + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; 3-byte sequence contains 1 byte at end of string +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0b" ;; import section + "\01" ;; length 1 + "\01\e1" ;; "\e1" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; 3-byte sequence contains 1 byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0c" ;; import section + "\01" ;; length 1 + "\02\e1\2e" ;; "\e1." + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;;;; 3-byte sequence contents + +;; first byte after (0xe0) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\e0\00\a0" ;; "\e0\00\a0" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (0xe0) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\e0\7f\a0" ;; "\e0\7f\a0" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; overlong encoding after 0xe0 prefix +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\e0\80\80" ;; "\e0\80\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; overlong encoding after 0xe0 prefix +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\e0\80\a0" ;; "\e0\80\a0" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; overlong encoding after 0xe0 prefix +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\e0\9f\a0" ;; "\e0\9f\a0" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; overlong encoding after 0xe0 prefix +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\e0\9f\bf" ;; "\e0\9f\bf" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (0xe0) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\e0\c0\a0" ;; "\e0\c0\a0" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (0xe0) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\e0\fd\a0" ;; "\e0\fd\a0" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (first normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\e1\00\80" ;; "\e1\00\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (first normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\e1\7f\80" ;; "\e1\7f\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (first normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\e1\c0\80" ;; "\e1\c0\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (first normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\e1\fd\80" ;; "\e1\fd\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\ec\00\80" ;; "\ec\00\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\ec\7f\80" ;; "\ec\7f\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\ec\c0\80" ;; "\ec\c0\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\ec\fd\80" ;; "\ec\fd\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (0xed) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\ed\00\80" ;; "\ed\00\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (0xed) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\ed\7f\80" ;; "\ed\7f\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; byte sequence reserved for UTF-16 surrogate half +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\ed\a0\80" ;; "\ed\a0\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; byte sequence reserved for UTF-16 surrogate half +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\ed\a0\bf" ;; "\ed\a0\bf" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; byte sequence reserved for UTF-16 surrogate half +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\ed\bf\80" ;; "\ed\bf\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; byte sequence reserved for UTF-16 surrogate half +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\ed\bf\bf" ;; "\ed\bf\bf" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (0xed) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\ed\c0\80" ;; "\ed\c0\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (0xed) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\ed\fd\80" ;; "\ed\fd\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\ee\00\80" ;; "\ee\00\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\ee\7f\80" ;; "\ee\7f\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\ee\c0\80" ;; "\ee\c0\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\ee\fd\80" ;; "\ee\fd\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (last normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\ef\00\80" ;; "\ef\00\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (last normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\ef\7f\80" ;; "\ef\7f\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (last normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\ef\c0\80" ;; "\ef\c0\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (last normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\ef\fd\80" ;; "\ef\fd\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;;;; 3-byte sequence contents (third byte) + +;; second byte after (0xe0) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\e0\a0\00" ;; "\e0\a0\00" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (0xe0) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\e0\a0\7f" ;; "\e0\a0\7f" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (0xe0) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\e0\a0\c0" ;; "\e0\a0\c0" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (0xe0) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\e0\a0\fd" ;; "\e0\a0\fd" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (first normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\e1\80\00" ;; "\e1\80\00" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (first normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\e1\80\7f" ;; "\e1\80\7f" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (first normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\e1\80\c0" ;; "\e1\80\c0" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (first normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\e1\80\fd" ;; "\e1\80\fd" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\ec\80\00" ;; "\ec\80\00" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\ec\80\7f" ;; "\ec\80\7f" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\ec\80\c0" ;; "\ec\80\c0" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\ec\80\fd" ;; "\ec\80\fd" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (0xed) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\ed\80\00" ;; "\ed\80\00" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (0xed) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\ed\80\7f" ;; "\ed\80\7f" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (0xed) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\ed\80\c0" ;; "\ed\80\c0" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (0xed) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\ed\80\fd" ;; "\ed\80\fd" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\ee\80\00" ;; "\ee\80\00" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\ee\80\7f" ;; "\ee\80\7f" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\ee\80\c0" ;; "\ee\80\c0" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\ee\80\fd" ;; "\ee\80\fd" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (last normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\ef\80\00" ;; "\ef\80\00" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (last normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\ef\80\7f" ;; "\ef\80\7f" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (last normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\ef\80\c0" ;; "\ef\80\c0" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (last normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\ef\80\fd" ;; "\ef\80\fd" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;;;; 4-byte sequences + +;; 4-byte sequence contains 5 bytes +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0f" ;; import section + "\01" ;; length 1 + "\05\f1\80\80\80\80" ;; "\f1\80\80\80\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; 4-byte sequence contains 3 bytes at end of string +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\f1\80\80" ;; "\f1\80\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; 4-byte sequence contains 3 bytes +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\f1\80\80\23" ;; "\f1\80\80#" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; 4-byte sequence contains 2 bytes at end of string +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0c" ;; import section + "\01" ;; length 1 + "\02\f1\80" ;; "\f1\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; 4-byte sequence contains 2 bytes +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\f1\80\23" ;; "\f1\80#" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; 4-byte sequence contains 1 byte at end of string +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0b" ;; import section + "\01" ;; length 1 + "\01\f1" ;; "\f1" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; 4-byte sequence contains 1 byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0c" ;; import section + "\01" ;; length 1 + "\02\f1\23" ;; "\f1#" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;;;; 4-byte sequence contents + +;; first byte after (0xf0) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\f0\00\90\90" ;; "\f0\00\90\90" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (0xf0) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\f0\7f\90\90" ;; "\f0\7f\90\90" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; overlong encoding after 0xf0 prefix +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\f0\80\80\80" ;; "\f0\80\80\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; overlong encoding after 0xf0 prefix +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\f0\80\90\90" ;; "\f0\80\90\90" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; overlong encoding after 0xf0 prefix +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\f0\8f\90\90" ;; "\f0\8f\90\90" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; overlong encoding after 0xf0 prefix +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\f0\8f\bf\bf" ;; "\f0\8f\bf\bf" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (0xf0) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\f0\c0\90\90" ;; "\f0\c0\90\90" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (0xf0) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\f0\fd\90\90" ;; "\f0\fd\90\90" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (first normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\f1\00\80\80" ;; "\f1\00\80\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (first normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\f1\7f\80\80" ;; "\f1\7f\80\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (first normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\f1\c0\80\80" ;; "\f1\c0\80\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (first normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\f1\fd\80\80" ;; "\f1\fd\80\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (last normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\f3\00\80\80" ;; "\f3\00\80\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (last normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\f3\7f\80\80" ;; "\f3\7f\80\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (last normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\f3\c0\80\80" ;; "\f3\c0\80\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (last normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\f3\fd\80\80" ;; "\f3\fd\80\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (0xf4) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\f4\00\80\80" ;; "\f4\00\80\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (0xf4) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\f4\7f\80\80" ;; "\f4\7f\80\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; (first) invalid code point +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\f4\90\80\80" ;; "\f4\90\80\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; invalid code point +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\f4\bf\80\80" ;; "\f4\bf\80\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (0xf4) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\f4\c0\80\80" ;; "\f4\c0\80\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (0xf4) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\f4\fd\80\80" ;; "\f4\fd\80\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; (first) invalid 4-byte prefix +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\f5\80\80\80" ;; "\f5\80\80\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; (last) invalid 4-byte prefix +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\f7\80\80\80" ;; "\f7\80\80\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; (last) invalid 4-byte prefix +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\f7\bf\bf\bf" ;; "\f7\bf\bf\bf" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;;;; 4-byte sequence contents (third byte) + +;; second byte after (0xf0) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\f0\90\00\90" ;; "\f0\90\00\90" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (0xf0) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\f0\90\7f\90" ;; "\f0\90\7f\90" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (0xf0) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\f0\90\c0\90" ;; "\f0\90\c0\90" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (0xf0) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\f0\90\fd\90" ;; "\f0\90\fd\90" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (first normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\f1\80\00\80" ;; "\f1\80\00\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (first normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\f1\80\7f\80" ;; "\f1\80\7f\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (first normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\f1\80\c0\80" ;; "\f1\80\c0\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (first normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\f1\80\fd\80" ;; "\f1\80\fd\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (last normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\f3\80\00\80" ;; "\f3\80\00\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (last normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\f3\80\7f\80" ;; "\f3\80\7f\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (last normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\f3\80\c0\80" ;; "\f3\80\c0\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (last normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\f3\80\fd\80" ;; "\f3\80\fd\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (0xf4) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\f4\80\00\80" ;; "\f4\80\00\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (0xf4) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\f4\80\7f\80" ;; "\f4\80\7f\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (0xf4) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\f4\80\c0\80" ;; "\f4\80\c0\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (0xf4) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\f4\80\fd\80" ;; "\f4\80\fd\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;;;; 4-byte sequence contents (fourth byte) + +;; third byte after (0xf0) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\f0\90\90\00" ;; "\f0\90\90\00" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; third byte after (0xf0) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\f0\90\90\7f" ;; "\f0\90\90\7f" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; third byte after (0xf0) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\f0\90\90\c0" ;; "\f0\90\90\c0" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; third byte after (0xf0) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\f0\90\90\fd" ;; "\f0\90\90\fd" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; third byte after (first normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\f1\80\80\00" ;; "\f1\80\80\00" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; third byte after (first normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\f1\80\80\7f" ;; "\f1\80\80\7f" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; third byte after (first normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\f1\80\80\c0" ;; "\f1\80\80\c0" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; third byte after (first normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\f1\80\80\fd" ;; "\f1\80\80\fd" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; third byte after (last normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\f3\80\80\00" ;; "\f3\80\80\00" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; third byte after (last normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\f3\80\80\7f" ;; "\f3\80\80\7f" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; third byte after (last normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\f3\80\80\c0" ;; "\f3\80\80\c0" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; third byte after (last normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\f3\80\80\fd" ;; "\f3\80\80\fd" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; third byte after (0xf4) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\f4\80\80\00" ;; "\f4\80\80\00" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; third byte after (0xf4) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\f4\80\80\7f" ;; "\f4\80\80\7f" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; third byte after (0xf4) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\f4\80\80\c0" ;; "\f4\80\80\c0" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; third byte after (0xf4) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\f4\80\80\fd" ;; "\f4\80\80\fd" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;;;; 5-byte sequences + +;; 5-byte sequence contains 6 bytes +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\10" ;; import section + "\01" ;; length 1 + "\06\f8\80\80\80\80\80" ;; "\f8\80\80\80\80\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; 5-byte sequence contains 4 bytes at end of string +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\f8\80\80\80" ;; "\f8\80\80\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; 5-byte sequence contains 4 bytes +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0f" ;; import section + "\01" ;; length 1 + "\05\f8\80\80\80\23" ;; "\f8\80\80\80#" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; 5-byte sequence contains 3 bytes at end of string +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\f8\80\80" ;; "\f8\80\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; 5-byte sequence contains 3 bytes +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\f8\80\80\23" ;; "\f8\80\80#" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; 5-byte sequence contains 2 bytes at end of string +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0c" ;; import section + "\01" ;; length 1 + "\02\f8\80" ;; "\f8\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; 5-byte sequence contains 2 bytes +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\f8\80\23" ;; "\f8\80#" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; 5-byte sequence contains 1 byte at end of string +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0b" ;; import section + "\01" ;; length 1 + "\01\f8" ;; "\f8" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; 5-byte sequence contains 1 byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0c" ;; import section + "\01" ;; length 1 + "\02\f8\23" ;; "\f8#" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;;;; 5-byte sequence contents + +;; (first) invalid 5-byte prefix +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0f" ;; import section + "\01" ;; length 1 + "\05\f8\80\80\80\80" ;; "\f8\80\80\80\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; (last) invalid 5-byte prefix +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0f" ;; import section + "\01" ;; length 1 + "\05\fb\bf\bf\bf\bf" ;; "\fb\bf\bf\bf\bf" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;;;; 6-byte sequences + +;; 6-byte sequence contains 7 bytes +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\11" ;; import section + "\01" ;; length 1 + "\07\fc\80\80\80\80\80\80" ;; "\fc\80\80\80\80\80\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; 6-byte sequence contains 5 bytes at end of string +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0f" ;; import section + "\01" ;; length 1 + "\05\fc\80\80\80\80" ;; "\fc\80\80\80\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; 6-byte sequence contains 5 bytes +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\10" ;; import section + "\01" ;; length 1 + "\06\fc\80\80\80\80\23" ;; "\fc\80\80\80\80#" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; 6-byte sequence contains 4 bytes at end of string +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\fc\80\80\80" ;; "\fc\80\80\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; 6-byte sequence contains 4 bytes +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0f" ;; import section + "\01" ;; length 1 + "\05\fc\80\80\80\23" ;; "\fc\80\80\80#" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; 6-byte sequence contains 3 bytes at end of string +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\fc\80\80" ;; "\fc\80\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; 6-byte sequence contains 3 bytes +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\fc\80\80\23" ;; "\fc\80\80#" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; 6-byte sequence contains 2 bytes at end of string +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0c" ;; import section + "\01" ;; length 1 + "\02\fc\80" ;; "\fc\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; 6-byte sequence contains 2 bytes +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\03\fc\80\23" ;; "\fc\80#" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; 6-byte sequence contains 1 byte at end of string +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0b" ;; import section + "\01" ;; length 1 + "\01\fc" ;; "\fc" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; 6-byte sequence contains 1 byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0c" ;; import section + "\01" ;; length 1 + "\02\fc\23" ;; "\fc#" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;;;; 6-byte sequence contents + +;; (first) invalid 6-byte prefix +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\10" ;; import section + "\01" ;; length 1 + "\06\fc\80\80\80\80\80" ;; "\fc\80\80\80\80\80" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; (last) invalid 6-byte prefix +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\10" ;; import section + "\01" ;; length 1 + "\06\fd\bf\bf\bf\bf\bf" ;; "\fd\bf\bf\bf\bf\bf" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;;;; Miscellaneous invalid bytes + +;; invalid byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0b" ;; import section + "\01" ;; length 1 + "\01\fe" ;; "\fe" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; invalid byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0b" ;; import section + "\01" ;; length 1 + "\01\ff" ;; "\ff" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; UTF-16BE BOM +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0c" ;; import section + "\01" ;; length 1 + "\02\fe\ff" ;; "\fe\ff" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; UTF-32BE BOM +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\00\00\fe\ff" ;; "\00\00\fe\ff" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; UTF-16LE BOM +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0c" ;; import section + "\01" ;; length 1 + "\02\ff\fe" ;; "\ff\fe" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; UTF-32LE BOM +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\ff\fe\00\00" ;; "\ff\fe\00\00" + "\04\74\65\73\74" ;; "test" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + diff --git a/test/core/utf8-import-module.wast b/test/core/utf8-import-module.wast new file mode 100644 index 00000000..ceabbeb7 --- /dev/null +++ b/test/core/utf8-import-module.wast @@ -0,0 +1,2672 @@ +;;;;;; Invalid UTF-8 import module names + +;;;; Continuation bytes not preceded by prefixes + +;; encoding starts with (first) continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0b" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\01\80" ;; "\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; encoding starts with (0x8f) continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0b" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\01\8f" ;; "\8f" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; encoding starts with (0x90) continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0b" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\01\90" ;; "\90" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; encoding starts with (0x9f) continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0b" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\01\9f" ;; "\9f" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; encoding starts with (0xa0) continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0b" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\01\a0" ;; "\a0" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; encoding starts with (last) continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0b" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\01\bf" ;; "\bf" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;;;; 2-byte sequences + +;; 2-byte sequence contains 3 bytes +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\c2\80\80" ;; "\c2\80\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; 2-byte sequence contains 1 byte at end of string +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0b" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\01\c2" ;; "\c2" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; 2-byte sequence contains 1 byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0c" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\02\c2\2e" ;; "\c2." + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;;;; 2-byte sequence contents + +;; overlong encoding after 0xc0 prefix +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0c" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\02\c0\80" ;; "\c0\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; overlong encoding after 0xc0 prefix +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0c" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\02\c0\bf" ;; "\c0\bf" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; overlong encoding after 0xc1 prefix +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0c" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\02\c1\80" ;; "\c1\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; overlong encoding after 0xc1 prefix +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0c" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\02\c1\bf" ;; "\c1\bf" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; byte after (first) 2-byte prefix not a contination byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0c" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\02\c2\00" ;; "\c2\00" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; byte after (first) 2-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0c" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\02\c2\7f" ;; "\c2\7f" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; byte after (first) 2-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0c" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\02\c2\c0" ;; "\c2\c0" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; byte after (first) 2-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0c" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\02\c2\fd" ;; "\c2\fd" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; byte after (last) 2-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0c" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\02\df\00" ;; "\df\00" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; byte after (last) 2-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0c" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\02\df\7f" ;; "\df\7f" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; byte after (last) 2-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0c" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\02\df\c0" ;; "\df\c0" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; byte after (last) 2-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0c" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\02\df\fd" ;; "\df\fd" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;;;; 3-byte sequences + +;; 3-byte sequence contains 4 bytes +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\e1\80\80\80" ;; "\e1\80\80\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; 3-byte sequence contains 2 bytes at end of string +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0c" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\02\e1\80" ;; "\e1\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; 3-byte sequence contains 2 bytes +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\e1\80\2e" ;; "\e1\80." + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; 3-byte sequence contains 1 byte at end of string +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0b" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\01\e1" ;; "\e1" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; 3-byte sequence contains 1 byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0c" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\02\e1\2e" ;; "\e1." + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;;;; 3-byte sequence contents + +;; first byte after (0xe0) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\e0\00\a0" ;; "\e0\00\a0" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (0xe0) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\e0\7f\a0" ;; "\e0\7f\a0" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; overlong encoding after 0xe0 prefix +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\e0\80\80" ;; "\e0\80\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; overlong encoding after 0xe0 prefix +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\e0\80\a0" ;; "\e0\80\a0" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; overlong encoding after 0xe0 prefix +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\e0\9f\a0" ;; "\e0\9f\a0" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; overlong encoding after 0xe0 prefix +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\e0\9f\bf" ;; "\e0\9f\bf" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (0xe0) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\e0\c0\a0" ;; "\e0\c0\a0" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (0xe0) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\e0\fd\a0" ;; "\e0\fd\a0" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (first normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\e1\00\80" ;; "\e1\00\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (first normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\e1\7f\80" ;; "\e1\7f\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (first normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\e1\c0\80" ;; "\e1\c0\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (first normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\e1\fd\80" ;; "\e1\fd\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\ec\00\80" ;; "\ec\00\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\ec\7f\80" ;; "\ec\7f\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\ec\c0\80" ;; "\ec\c0\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\ec\fd\80" ;; "\ec\fd\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (0xed) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\ed\00\80" ;; "\ed\00\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (0xed) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\ed\7f\80" ;; "\ed\7f\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; byte sequence reserved for UTF-16 surrogate half +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\ed\a0\80" ;; "\ed\a0\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; byte sequence reserved for UTF-16 surrogate half +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\ed\a0\bf" ;; "\ed\a0\bf" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; byte sequence reserved for UTF-16 surrogate half +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\ed\bf\80" ;; "\ed\bf\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; byte sequence reserved for UTF-16 surrogate half +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\ed\bf\bf" ;; "\ed\bf\bf" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (0xed) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\ed\c0\80" ;; "\ed\c0\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (0xed) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\ed\fd\80" ;; "\ed\fd\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\ee\00\80" ;; "\ee\00\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\ee\7f\80" ;; "\ee\7f\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\ee\c0\80" ;; "\ee\c0\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\ee\fd\80" ;; "\ee\fd\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (last normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\ef\00\80" ;; "\ef\00\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (last normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\ef\7f\80" ;; "\ef\7f\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (last normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\ef\c0\80" ;; "\ef\c0\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (last normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\ef\fd\80" ;; "\ef\fd\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;;;; 3-byte sequence contents (third byte) + +;; second byte after (0xe0) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\e0\a0\00" ;; "\e0\a0\00" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (0xe0) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\e0\a0\7f" ;; "\e0\a0\7f" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (0xe0) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\e0\a0\c0" ;; "\e0\a0\c0" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (0xe0) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\e0\a0\fd" ;; "\e0\a0\fd" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (first normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\e1\80\00" ;; "\e1\80\00" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (first normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\e1\80\7f" ;; "\e1\80\7f" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (first normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\e1\80\c0" ;; "\e1\80\c0" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (first normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\e1\80\fd" ;; "\e1\80\fd" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\ec\80\00" ;; "\ec\80\00" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\ec\80\7f" ;; "\ec\80\7f" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\ec\80\c0" ;; "\ec\80\c0" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\ec\80\fd" ;; "\ec\80\fd" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (0xed) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\ed\80\00" ;; "\ed\80\00" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (0xed) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\ed\80\7f" ;; "\ed\80\7f" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (0xed) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\ed\80\c0" ;; "\ed\80\c0" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (0xed) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\ed\80\fd" ;; "\ed\80\fd" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\ee\80\00" ;; "\ee\80\00" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\ee\80\7f" ;; "\ee\80\7f" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\ee\80\c0" ;; "\ee\80\c0" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\ee\80\fd" ;; "\ee\80\fd" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (last normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\ef\80\00" ;; "\ef\80\00" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (last normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\ef\80\7f" ;; "\ef\80\7f" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (last normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\ef\80\c0" ;; "\ef\80\c0" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (last normal) 3-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\ef\80\fd" ;; "\ef\80\fd" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;;;; 4-byte sequences + +;; 4-byte sequence contains 5 bytes +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0f" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\05\f1\80\80\80\80" ;; "\f1\80\80\80\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; 4-byte sequence contains 3 bytes at end of string +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\f1\80\80" ;; "\f1\80\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; 4-byte sequence contains 3 bytes +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\f1\80\80\23" ;; "\f1\80\80#" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; 4-byte sequence contains 2 bytes at end of string +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0c" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\02\f1\80" ;; "\f1\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; 4-byte sequence contains 2 bytes +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\f1\80\23" ;; "\f1\80#" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; 4-byte sequence contains 1 byte at end of string +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0b" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\01\f1" ;; "\f1" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; 4-byte sequence contains 1 byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0c" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\02\f1\23" ;; "\f1#" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;;;; 4-byte sequence contents + +;; first byte after (0xf0) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\f0\00\90\90" ;; "\f0\00\90\90" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (0xf0) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\f0\7f\90\90" ;; "\f0\7f\90\90" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; overlong encoding after 0xf0 prefix +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\f0\80\80\80" ;; "\f0\80\80\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; overlong encoding after 0xf0 prefix +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\f0\80\90\90" ;; "\f0\80\90\90" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; overlong encoding after 0xf0 prefix +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\f0\8f\90\90" ;; "\f0\8f\90\90" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; overlong encoding after 0xf0 prefix +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\f0\8f\bf\bf" ;; "\f0\8f\bf\bf" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (0xf0) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\f0\c0\90\90" ;; "\f0\c0\90\90" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (0xf0) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\f0\fd\90\90" ;; "\f0\fd\90\90" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (first normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\f1\00\80\80" ;; "\f1\00\80\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (first normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\f1\7f\80\80" ;; "\f1\7f\80\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (first normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\f1\c0\80\80" ;; "\f1\c0\80\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (first normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\f1\fd\80\80" ;; "\f1\fd\80\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (last normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\f3\00\80\80" ;; "\f3\00\80\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (last normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\f3\7f\80\80" ;; "\f3\7f\80\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (last normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\f3\c0\80\80" ;; "\f3\c0\80\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (last normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\f3\fd\80\80" ;; "\f3\fd\80\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (0xf4) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\f4\00\80\80" ;; "\f4\00\80\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (0xf4) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\f4\7f\80\80" ;; "\f4\7f\80\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; (first) invalid code point +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\f4\90\80\80" ;; "\f4\90\80\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; invalid code point +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\f4\bf\80\80" ;; "\f4\bf\80\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (0xf4) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\f4\c0\80\80" ;; "\f4\c0\80\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; first byte after (0xf4) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\f4\fd\80\80" ;; "\f4\fd\80\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; (first) invalid 4-byte prefix +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\f5\80\80\80" ;; "\f5\80\80\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; (last) invalid 4-byte prefix +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\f7\80\80\80" ;; "\f7\80\80\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; (last) invalid 4-byte prefix +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\f7\bf\bf\bf" ;; "\f7\bf\bf\bf" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;;;; 4-byte sequence contents (third byte) + +;; second byte after (0xf0) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\f0\90\00\90" ;; "\f0\90\00\90" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (0xf0) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\f0\90\7f\90" ;; "\f0\90\7f\90" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (0xf0) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\f0\90\c0\90" ;; "\f0\90\c0\90" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (0xf0) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\f0\90\fd\90" ;; "\f0\90\fd\90" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (first normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\f1\80\00\80" ;; "\f1\80\00\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (first normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\f1\80\7f\80" ;; "\f1\80\7f\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (first normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\f1\80\c0\80" ;; "\f1\80\c0\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (first normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\f1\80\fd\80" ;; "\f1\80\fd\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (last normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\f3\80\00\80" ;; "\f3\80\00\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (last normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\f3\80\7f\80" ;; "\f3\80\7f\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (last normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\f3\80\c0\80" ;; "\f3\80\c0\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (last normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\f3\80\fd\80" ;; "\f3\80\fd\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (0xf4) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\f4\80\00\80" ;; "\f4\80\00\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (0xf4) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\f4\80\7f\80" ;; "\f4\80\7f\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (0xf4) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\f4\80\c0\80" ;; "\f4\80\c0\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; second byte after (0xf4) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\f4\80\fd\80" ;; "\f4\80\fd\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;;;; 4-byte sequence contents (fourth byte) + +;; third byte after (0xf0) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\f0\90\90\00" ;; "\f0\90\90\00" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; third byte after (0xf0) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\f0\90\90\7f" ;; "\f0\90\90\7f" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; third byte after (0xf0) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\f0\90\90\c0" ;; "\f0\90\90\c0" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; third byte after (0xf0) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\f0\90\90\fd" ;; "\f0\90\90\fd" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; third byte after (first normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\f1\80\80\00" ;; "\f1\80\80\00" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; third byte after (first normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\f1\80\80\7f" ;; "\f1\80\80\7f" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; third byte after (first normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\f1\80\80\c0" ;; "\f1\80\80\c0" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; third byte after (first normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\f1\80\80\fd" ;; "\f1\80\80\fd" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; third byte after (last normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\f3\80\80\00" ;; "\f3\80\80\00" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; third byte after (last normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\f3\80\80\7f" ;; "\f3\80\80\7f" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; third byte after (last normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\f3\80\80\c0" ;; "\f3\80\80\c0" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; third byte after (last normal) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\f3\80\80\fd" ;; "\f3\80\80\fd" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; third byte after (0xf4) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\f4\80\80\00" ;; "\f4\80\80\00" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; third byte after (0xf4) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\f4\80\80\7f" ;; "\f4\80\80\7f" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; third byte after (0xf4) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\f4\80\80\c0" ;; "\f4\80\80\c0" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; third byte after (0xf4) 4-byte prefix not a continuation byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\f4\80\80\fd" ;; "\f4\80\80\fd" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;;;; 5-byte sequences + +;; 5-byte sequence contains 6 bytes +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\10" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\06\f8\80\80\80\80\80" ;; "\f8\80\80\80\80\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; 5-byte sequence contains 4 bytes at end of string +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\f8\80\80\80" ;; "\f8\80\80\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; 5-byte sequence contains 4 bytes +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0f" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\05\f8\80\80\80\23" ;; "\f8\80\80\80#" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; 5-byte sequence contains 3 bytes at end of string +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\f8\80\80" ;; "\f8\80\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; 5-byte sequence contains 3 bytes +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\f8\80\80\23" ;; "\f8\80\80#" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; 5-byte sequence contains 2 bytes at end of string +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0c" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\02\f8\80" ;; "\f8\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; 5-byte sequence contains 2 bytes +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\f8\80\23" ;; "\f8\80#" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; 5-byte sequence contains 1 byte at end of string +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0b" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\01\f8" ;; "\f8" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; 5-byte sequence contains 1 byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0c" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\02\f8\23" ;; "\f8#" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;;;; 5-byte sequence contents + +;; (first) invalid 5-byte prefix +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0f" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\05\f8\80\80\80\80" ;; "\f8\80\80\80\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; (last) invalid 5-byte prefix +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0f" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\05\fb\bf\bf\bf\bf" ;; "\fb\bf\bf\bf\bf" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;;;; 6-byte sequences + +;; 6-byte sequence contains 7 bytes +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\11" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\07\fc\80\80\80\80\80\80" ;; "\fc\80\80\80\80\80\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; 6-byte sequence contains 5 bytes at end of string +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0f" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\05\fc\80\80\80\80" ;; "\fc\80\80\80\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; 6-byte sequence contains 5 bytes +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\10" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\06\fc\80\80\80\80\23" ;; "\fc\80\80\80\80#" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; 6-byte sequence contains 4 bytes at end of string +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\fc\80\80\80" ;; "\fc\80\80\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; 6-byte sequence contains 4 bytes +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0f" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\05\fc\80\80\80\23" ;; "\fc\80\80\80#" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; 6-byte sequence contains 3 bytes at end of string +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\fc\80\80" ;; "\fc\80\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; 6-byte sequence contains 3 bytes +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\fc\80\80\23" ;; "\fc\80\80#" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; 6-byte sequence contains 2 bytes at end of string +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0c" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\02\fc\80" ;; "\fc\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; 6-byte sequence contains 2 bytes +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0d" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\03\fc\80\23" ;; "\fc\80#" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; 6-byte sequence contains 1 byte at end of string +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0b" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\01\fc" ;; "\fc" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; 6-byte sequence contains 1 byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0c" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\02\fc\23" ;; "\fc#" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;;;; 6-byte sequence contents + +;; (first) invalid 6-byte prefix +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\10" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\06\fc\80\80\80\80\80" ;; "\fc\80\80\80\80\80" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; (last) invalid 6-byte prefix +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\10" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\06\fd\bf\bf\bf\bf\bf" ;; "\fd\bf\bf\bf\bf\bf" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;;;; Miscellaneous invalid bytes + +;; invalid byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0b" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\01\fe" ;; "\fe" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; invalid byte +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0b" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\01\ff" ;; "\ff" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; UTF-16BE BOM +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0c" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\02\fe\ff" ;; "\fe\ff" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; UTF-32BE BOM +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\00\00\fe\ff" ;; "\00\00\fe\ff" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; UTF-16LE BOM +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0c" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\02\ff\fe" ;; "\ff\fe" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + +;; UTF-32LE BOM +(assert_malformed + (module binary + "\00asm" "\01\00\00\00" + "\02\0e" ;; import section + "\01" ;; length 1 + "\04\74\65\73\74" ;; "test" + "\04\ff\fe\00\00" ;; "\ff\fe\00\00" + "\03" ;; GlobalImport + "\7f" ;; i32 + "\00" ;; immutable + ) + "invalid UTF-8 encoding" +) + diff --git a/test/core/utf8-invalid-encoding.wast b/test/core/utf8-invalid-encoding.wast new file mode 100644 index 00000000..3b357309 --- /dev/null +++ b/test/core/utf8-invalid-encoding.wast @@ -0,0 +1,176 @@ +(assert_malformed (module quote "(func (export \"\\00\\00\\fe\\ff\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\8f\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\90\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\9f\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\a0\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\bf\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\c0\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\c0\\bf\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\c1\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\c1\\bf\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\c2\\00\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\c2\\2e\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\c2\\7f\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\c2\\80\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\c2\\c0\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\c2\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\c2\\fd\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\df\\00\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\df\\7f\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\df\\c0\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\df\\fd\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\e0\\00\\a0\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\e0\\7f\\a0\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\e0\\80\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\e0\\80\\a0\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\e0\\9f\\a0\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\e0\\9f\\bf\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\e0\\a0\\00\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\e0\\a0\\7f\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\e0\\a0\\c0\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\e0\\a0\\fd\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\e0\\c0\\a0\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\e0\\fd\\a0\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\e1\\00\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\e1\\2e\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\e1\\7f\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\e1\\80\\00\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\e1\\80\\2e\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\e1\\80\\7f\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\e1\\80\\80\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\e1\\80\\c0\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\e1\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\e1\\80\\fd\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\e1\\c0\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\e1\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\e1\\fd\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\ec\\00\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\ec\\7f\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\ec\\80\\00\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\ec\\80\\7f\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\ec\\80\\c0\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\ec\\80\\fd\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\ec\\c0\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\ec\\fd\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\ed\\00\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\ed\\7f\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\ed\\80\\00\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\ed\\80\\7f\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\ed\\80\\c0\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\ed\\80\\fd\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\ed\\a0\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\ed\\a0\\bf\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\ed\\bf\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\ed\\bf\\bf\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\ed\\c0\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\ed\\fd\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\ee\\00\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\ee\\7f\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\ee\\80\\00\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\ee\\80\\7f\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\ee\\80\\c0\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\ee\\80\\fd\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\ee\\c0\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\ee\\fd\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\ef\\00\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\ef\\7f\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\ef\\80\\00\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\ef\\80\\7f\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\ef\\80\\c0\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\ef\\80\\fd\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\ef\\c0\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\ef\\fd\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f0\\00\\90\\90\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f0\\7f\\90\\90\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f0\\80\\80\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f0\\80\\90\\90\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f0\\8f\\90\\90\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f0\\8f\\bf\\bf\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f0\\90\\00\\90\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f0\\90\\7f\\90\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f0\\90\\90\\00\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f0\\90\\90\\7f\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f0\\90\\90\\c0\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f0\\90\\90\\fd\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f0\\90\\c0\\90\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f0\\90\\fd\\90\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f0\\c0\\90\\90\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f0\\fd\\90\\90\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f1\\00\\80\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f1\\23\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f1\\7f\\80\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f1\\80\\00\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f1\\80\\23\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f1\\80\\7f\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f1\\80\\80\\00\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f1\\80\\80\\23\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f1\\80\\80\\7f\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f1\\80\\80\\80\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f1\\80\\80\\c0\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f1\\80\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f1\\80\\80\\fd\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f1\\80\\c0\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f1\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f1\\80\\fd\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f1\\c0\\80\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f1\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f1\\fd\\80\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f3\\00\\80\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f3\\7f\\80\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f3\\80\\00\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f3\\80\\7f\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f3\\80\\80\\00\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f3\\80\\80\\7f\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f3\\80\\80\\c0\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f3\\80\\80\\fd\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f3\\80\\c0\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f3\\80\\fd\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f3\\c0\\80\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f3\\fd\\80\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f4\\00\\80\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f4\\7f\\80\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f4\\80\\00\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f4\\80\\7f\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f4\\80\\80\\00\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f4\\80\\80\\7f\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f4\\80\\80\\c0\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f4\\80\\80\\fd\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f4\\80\\c0\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f4\\80\\fd\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f4\\90\\80\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f4\\bf\\80\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f4\\c0\\80\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f4\\fd\\80\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f5\\80\\80\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f7\\80\\80\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f7\\bf\\bf\\bf\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f8\\23\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f8\\80\\23\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f8\\80\\80\\23\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f8\\80\\80\\80\\23\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f8\\80\\80\\80\\80\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f8\\80\\80\\80\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f8\\80\\80\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f8\\80\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f8\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\f8\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\fb\\bf\\bf\\bf\\bf\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\fc\\23\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\fc\\80\\23\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\fc\\80\\80\\23\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\fc\\80\\80\\80\\23\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\fc\\80\\80\\80\\80\\23\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\fc\\80\\80\\80\\80\\80\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\fc\\80\\80\\80\\80\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\fc\\80\\80\\80\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\fc\\80\\80\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\fc\\80\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\fc\\80\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\fc\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\fd\\bf\\bf\\bf\\bf\\bf\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\fe\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\fe\\ff\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\ff\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\ff\\fe\\00\\00\"))") "invalid UTF-8 encoding") +(assert_malformed (module quote "(func (export \"\\ff\\fe\"))") "invalid UTF-8 encoding") diff --git a/test/harness/async_index.js b/test/harness/async_index.js new file mode 100644 index 00000000..cc252f50 --- /dev/null +++ b/test/harness/async_index.js @@ -0,0 +1,375 @@ +/* + * Copyright 2018 WebAssembly Community Group participants + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +"use strict"; + +let testNum = (function() { + let count = 1; + return function() { + return `#${count++} `; + }; +})(); + +function uniqueTest(func, desc) { + test(func, testNum() + desc); +} + +// WPT's assert_throw uses a list of predefined, hardcoded known errors. Since +// it is not aware of the WebAssembly error types (yet), implement our own +// version. +function assertThrows(func, err) { + let caught = false; + try { + func(); + } catch (e) { + assert_true( + e instanceof err, + `expected ${err.name}, observed ${e.constructor.name}` + ); + caught = true; + } + assert_true(caught, testNum() + "assertThrows must catch any error."); +} + +/****************************************************************************** + ***************************** WAST HARNESS ************************************ + ******************************************************************************/ + +const EXPECT_INVALID = false; + +/* DATA **********************************************************************/ + +// Default imports. +var registry = {}; + +// All tests run asynchronously and return their results as promises. To ensure +// that all tests execute in the correct order, we chain the promises together +// so that a test is only executed when all previous tests have finished their +// execution. +let chain = Promise.resolve(); + +// Resets the registry between two different WPT tests. +function reinitializeRegistry() { + if (typeof WebAssembly === "undefined") return; + + chain = chain.then(_ => { + let spectest = { + print: console.log.bind(console), + print_i32: console.log.bind(console), + print_i32_f32: console.log.bind(console), + print_f64_f64: console.log.bind(console), + print_f32: console.log.bind(console), + print_f64: console.log.bind(console), + global_i32: 666, + global_f32: 666, + global_f64: 666, + table: new WebAssembly.Table({ + initial: 10, + maximum: 20, + element: "anyfunc" + }), + memory: new WebAssembly.Memory({ initial: 1, maximum: 2 }) + }; + let handler = { + get(target, prop) { + return prop in target ? target[prop] : {}; + } + }; + registry = new Proxy({ spectest }, handler); + }); + + // This function is called at the end of every generated js test file. By + // adding the chain as a promise_test here we make sure that the WPT harness + // waits for all tests in the chain to finish. + promise_test(_ => chain, testNum() + "Reinitialize the default imports"); +} + +reinitializeRegistry(); + +/* WAST POLYFILL *************************************************************/ + +function binary(bytes) { + let buffer = new ArrayBuffer(bytes.length); + let view = new Uint8Array(buffer); + for (let i = 0; i < bytes.length; ++i) { + view[i] = bytes.charCodeAt(i); + } + return buffer; +} + +/** + * Returns a compiled module, or throws if there was an error at compilation. + */ +function module(bytes, valid = true) { + const test = valid + ? "Test that WebAssembly compilation succeeds" + : "Test that WebAssembly compilation fails"; + const loc = new Error().stack.toString().replace("Error", ""); + let buffer = binary(bytes); + let validated = WebAssembly.validate(buffer); + + uniqueTest(_ => { + assert_equals(valid, validated); + }, test); + + chain = chain.then(_ => WebAssembly.compile(buffer)).then( + module => { + uniqueTest(_ => { + assert_true(valid, loc); + }, test); + return module; + }, + error => { + uniqueTest(_ => { + assert_true( + !valid, + `WebAssembly.compile failed unexpectedly with ${error} at {loc}` + ); + }, test); + } + ); + return chain; +} + +function assert_invalid(bytes) { + module(bytes, EXPECT_INVALID); +} + +const assert_malformed = assert_invalid; + +function instance(bytes, imports, valid = true) { + const test = valid + ? "Test that WebAssembly instantiation succeeds" + : "Test that WebAssembly instantiation fails"; + const loc = new Error().stack.toString().replace("Error", ""); + chain = Promise.all([imports, chain]) + .then(values => { + let imports = values[0] ? values[0] : registry; + return WebAssembly.instantiate(binary(bytes), imports); + }) + .then( + pair => { + uniqueTest(_ => { + assert_true(valid, loc); + }, test); + return pair.instance; + }, + error => { + uniqueTest(_ => { + assert_true( + !valid, + `unexpected instantiation error, observed ${error} ${loc}` + ); + }, test); + return error; + } + ); + return chain; +} + +function exports(name, instance) { + return instance.then(inst => { + return { [name]: inst.exports }; + }); +} + +function call(instance, name, args) { + return Promise.all([instance, chain]).then(values => { + return values[0].exports[name](...args); + }); +} + +function run(action) { + const test = "Run a WebAssembly test without special assertions"; + const loc = new Error().stack.toString().replace("Error", ""); + chain = Promise.all([chain, action()]) + .then( + _ => { + uniqueTest(_ => {}, test); + }, + error => { + uniqueTest(_ => { + assert_true( + false, + `unexpected runtime error, observed ${error} ${loc}` + ); + }, "run"); + } + ) + // Clear all exceptions, so that subsequent tests get executed. + .catch(_ => {}); +} + +function assert_trap(action) { + const test = "Test that a WebAssembly code traps"; + const loc = new Error().stack.toString().replace("Error", ""); + chain = Promise.all([chain, action()]) + .then( + result => { + uniqueTest(_ => { + assert_true(false, loc); + }, test); + }, + error => { + uniqueTest(_ => { + assert_true( + error instanceof WebAssembly.RuntimeError, + `expected runtime error, observed ${error} ${loc}` + ); + }, test); + } + ) + // Clear all exceptions, so that subsequent tests get executed. + .catch(_ => {}); +} + +function assert_return(action, expected) { + const test = "Test that a WebAssembly code returns a specific result"; + const loc = new Error().stack.toString().replace("Error", ""); + chain = Promise.all([action(), chain]) + .then( + values => { + uniqueTest(_ => { + assert_equals(values[0], expected, loc); + }, test); + }, + error => { + uniqueTest(_ => { + assert_true( + false, + `unexpected runtime error, observed ${error} ${loc}` + ); + }, test); + } + ) + // Clear all exceptions, so that subsequent tests get executed. + .catch(_ => {}); +} + +let StackOverflow; +try { + (function f() { + 1 + f(); + })(); +} catch (e) { + StackOverflow = e.constructor; +} + +function assert_exhaustion(action) { + const test = "Test that a WebAssembly code exhauts the stack space"; + const loc = new Error().stack.toString().replace("Error", ""); + chain = Promise.all([action(), chain]) + .then( + _ => { + uniqueTest(_ => { + assert_true(false, loc); + }, test); + }, + error => { + uniqueTest(_ => { + assert_true( + error instanceof StackOverflow, + `expected runtime error, observed ${error} ${loc}` + ); + }, test); + } + ) + // Clear all exceptions, so that subsequent tests get executed. + .catch(_ => {}); +} + +function assert_unlinkable(bytes) { + const test = "Test that a WebAssembly module is unlinkable"; + const loc = new Error().stack.toString().replace("Error", ""); + instance(bytes, registry, EXPECT_INVALID) + .then( + result => { + uniqueTest(_ => { + assert_true( + result instanceof WebAssembly.LinkError, + `expected link error, observed ${result} ${loc}` + ); + }, test); + }, + _ => { + uniqueTest(_ => { + assert_true(false, loc); + }, test); + } + ) + // Clear all exceptions, so that subsequent tests get executed. + .catch(_ => {}); +} + +function assert_uninstantiable(bytes) { + const test = "Test that a WebAssembly module is uninstantiable"; + const loc = new Error().stack.toString().replace("Error", ""); + instance(bytes, registry, EXPECT_INVALID) + .then( + result => { + uniqueTest(_ => { + assert_true( + result instanceof WebAssembly.RuntimeError, + `expected link error, observed ${result} ${loc}` + ); + }, test); + }, + _ => { + uniqueTest(_ => { + assert_true(false, loc); + }, test); + } + ) + // Clear all exceptions, so that subsequent tests get executed. + .catch(_ => {}); +} + +function register(name, instance) { + const test = + "Test that the exports of a WebAssembly module can be registered"; + const loc = new Error().stack.toString().replace("Error", ""); + let stack = new Error(); + chain = Promise.all([instance, chain]) + .then( + values => { + registry[name] = values[0].exports; + }, + _ => { + uniqueTest(_ => { + assert_true(false, loc); + }, test); + } + ) + // Clear all exceptions, so that subsequent tests get executed. + .catch(_ => {}); +} + +function get(instance, name) { + const test = "Test that an export of a WebAssembly instance can be acquired"; + const loc = new Error().stack.toString().replace("Error", ""); + chain = Promise.all([instance, chain]).then( + values => { + return values[0].exports[name]; + }, + _ => { + uniqueTest(_ => { + assert_true(false, loc); + }, test); + } + ); + return chain; +} + diff --git a/test/harness/index.js b/test/harness/sync_index.js similarity index 87% rename from test/harness/index.js rename to test/harness/sync_index.js index c5b45057..bd57cc48 100644 --- a/test/harness/index.js +++ b/test/harness/sync_index.js @@ -66,8 +66,6 @@ const EXPECT_INVALID = false; /* DATA **********************************************************************/ -let soft_validate = true; - let $$; // Default imports. @@ -78,14 +76,25 @@ function reinitializeRegistry() { if (typeof WebAssembly === 'undefined') return; - registry = { - spectest: { - print: console.log.bind(console), - global: 666, - table: new WebAssembly.Table({initial: 10, maximum: 20, element: 'anyfunc'}), - memory: new WebAssembly.Memory({initial: 1, maximum: 2}) - } + let spectest = { + print: console.log.bind(console), + print_i32: console.log.bind(console), + print_i32_f32: console.log.bind(console), + print_f64_f64: console.log.bind(console), + print_f32: console.log.bind(console), + print_f64: console.log.bind(console), + global_i32: 666, + global_f32: 666, + global_f64: 666, + table: new WebAssembly.Table({initial: 10, maximum: 20, element: 'anyfunc'}), + memory: new WebAssembly.Memory({initial: 1, maximum: 2}) + }; + let handler = { + get(target, prop) { + return (prop in target) ? target[prop] : {}; + } }; + registry = new Proxy({spectest}, handler); } reinitializeRegistry(); @@ -111,14 +120,20 @@ function module(bytes, valid = true) { try { validated = WebAssembly.validate(buffer); } catch (e) { - throw new Error(`WebAssembly.validate throws: ${e}${e.stack}`); + throw new Error(`WebAssembly.validate throws ${typeof e}: ${e}${e.stack}`); } if (validated !== valid) { // Try to get a more precise error message from the WebAssembly.CompileError. - let err = ''; - try { new WebAssembly.Module(buffer) } catch(e) { err = e.toString() } - throw new Error(`WebAssembly.validate error: ${err}\n`); + try { + new WebAssembly.Module(buffer); + } catch (e) { + if (e instanceof WebAssembly.CompileError) + throw new WebAssembly.CompileError(`WebAssembly.validate error: ${e.toString()}${e.stack}\n`); + else + throw new Error(`WebAssembly.validate throws ${typeof e}: ${e}${e.stack}`); + } + throw new Error(`WebAssembly.validate was expected to fail, but didn't`); } let module; @@ -126,7 +141,7 @@ function module(bytes, valid = true) { module = new WebAssembly.Module(buffer); } catch(e) { if (valid) - throw new Error('WebAssembly.Module ctor unexpectedly throws'); + throw new Error('WebAssembly.Module ctor unexpectedly throws ${typeof e}: ${e}${e.stack}'); throw e; } @@ -150,19 +165,6 @@ function assert_invalid(bytes) { const assert_malformed = assert_invalid; -function assert_soft_invalid(bytes) { - uniqueTest(() => { - try { - module(bytes, /* valid */ soft_validate); - if (soft_validate) - throw new Error('did not fail'); - } catch(e) { - if (soft_validate) - assert_true(e instanceof WebAssembly.CompileError, "expected soft invalid failure:"); - } - }, "A wast module that *could* be invalid under certain engines."); -} - function instance(bytes, imports = registry, valid = true) { if (imports instanceof Result) { if (imports.isError()) diff --git a/test/harness/testharness.js b/test/harness/testharness.js index 49e38675..fdd87e8f 100644 --- a/test/harness/testharness.js +++ b/test/harness/testharness.js @@ -591,7 +591,7 @@ policies and contribution forms [3]. /** * Returns a Promise that will resolve after the specified event or - * series of events has occured. + * series of events has occurred. */ this.wait_for = function(types) { if (waitingFor) { @@ -971,7 +971,7 @@ policies and contribution forms [3]. function assert_approx_equals(actual, expected, epsilon, description) { /* - * Test if two primitive numbers are equal withing +/- epsilon + * Test if two primitive numbers are equal within +/- epsilon */ assert(typeof actual === "number", "assert_approx_equals", description, diff --git a/test/harness/wasm-constants.js b/test/harness/wasm-constants.js deleted file mode 100644 index f056f9cb..00000000 --- a/test/harness/wasm-constants.js +++ /dev/null @@ -1,374 +0,0 @@ -// Copyright 2015 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --expose-wasm - -function bytes() { - var buffer = new ArrayBuffer(arguments.length); - var view = new Uint8Array(buffer); - for (var i = 0; i < arguments.length; i++) { - var val = arguments[i]; - if ((typeof val) == "string") val = val.charCodeAt(0); - view[i] = val | 0; - } - return buffer; -} - -// Header declaration constants -var kWasmH0 = 0; -var kWasmH1 = 0x61; -var kWasmH2 = 0x73; -var kWasmH3 = 0x6d; - -var kWasmV0 = 1; -var kWasmV1 = 0; -var kWasmV2 = 0; -var kWasmV3 = 0; - -var kHeaderSize = 8; -var kPageSize = 65536; - -function bytesWithHeader() { - var buffer = new ArrayBuffer(kHeaderSize + arguments.length); - var view = new Uint8Array(buffer); - view[0] = kWasmH0; - view[1] = kWasmH1; - view[2] = kWasmH2; - view[3] = kWasmH3; - view[4] = kWasmV0; - view[5] = kWasmV1; - view[6] = kWasmV2; - view[7] = kWasmV3; - for (var i = 0; i < arguments.length; i++) { - var val = arguments[i]; - if ((typeof val) == "string") val = val.charCodeAt(0); - view[kHeaderSize + i] = val | 0; - } - return buffer; -} - -let kDeclNoLocals = 0; - -// Section declaration constants -let kUnknownSectionCode = 0; -let kTypeSectionCode = 1; // Function signature declarations -let kImportSectionCode = 2; // Import declarations -let kFunctionSectionCode = 3; // Function declarations -let kTableSectionCode = 4; // Indirect function table and other tables -let kMemorySectionCode = 5; // Memory attributes -let kGlobalSectionCode = 6; // Global declarations -let kExportSectionCode = 7; // Exports -let kStartSectionCode = 8; // Start function declaration -let kElementSectionCode = 9; // Elements section -let kCodeSectionCode = 10; // Function code -let kDataSectionCode = 11; // Data segments -let kNameSectionCode = 12; // Name section (encoded as string) - -let kWasmFunctionTypeForm = 0x60; -let kWasmAnyFunctionTypeForm = 0x70; - -let kResizableMaximumFlag = 1; - -// Function declaration flags -let kDeclFunctionName = 0x01; -let kDeclFunctionImport = 0x02; -let kDeclFunctionLocals = 0x04; -let kDeclFunctionExport = 0x08; - -// Local types -let kWasmStmt = 0x40; -let kWasmI32 = 0x7f; -let kWasmI64 = 0x7e; -let kWasmF32 = 0x7d; -let kWasmF64 = 0x7c; -let kWasmS128 = 0x7b; - -let kExternalFunction = 0; -let kExternalTable = 1; -let kExternalMemory = 2; -let kExternalGlobal = 3; - -let kTableZero = 0; -let kMemoryZero = 0; - -// Useful signatures -let kSig_i_i = makeSig([kWasmI32], [kWasmI32]); -let kSig_l_l = makeSig([kWasmI64], [kWasmI64]); -let kSig_i_l = makeSig([kWasmI64], [kWasmI32]); -let kSig_i_ii = makeSig([kWasmI32, kWasmI32], [kWasmI32]); -let kSig_i_iii = makeSig([kWasmI32, kWasmI32, kWasmI32], [kWasmI32]); -let kSig_d_dd = makeSig([kWasmF64, kWasmF64], [kWasmF64]); -let kSig_l_ll = makeSig([kWasmI64, kWasmI64], [kWasmI64]); -let kSig_i_dd = makeSig([kWasmF64, kWasmF64], [kWasmI32]); -let kSig_v_v = makeSig([], []); -let kSig_i_v = makeSig([], [kWasmI32]); -let kSig_l_v = makeSig([], [kWasmI64]); -let kSig_f_v = makeSig([], [kWasmF64]); -let kSig_d_v = makeSig([], [kWasmF64]); -let kSig_v_i = makeSig([kWasmI32], []); -let kSig_v_ii = makeSig([kWasmI32, kWasmI32], []); -let kSig_v_iii = makeSig([kWasmI32, kWasmI32, kWasmI32], []); -let kSig_v_l = makeSig([kWasmI64], []); -let kSig_v_d = makeSig([kWasmF64], []); -let kSig_v_dd = makeSig([kWasmF64, kWasmF64], []); -let kSig_v_ddi = makeSig([kWasmF64, kWasmF64, kWasmI32], []); -let kSig_s_v = makeSig([], [kWasmS128]); - -function makeSig(params, results) { - return {params: params, results: results}; -} - -function makeSig_v_x(x) { - return makeSig([x], []); -} - -function makeSig_v_xx(x) { - return makeSig([x, x], []); -} - -function makeSig_r_v(r) { - return makeSig([], [r]); -} - -function makeSig_r_x(r, x) { - return makeSig([x], [r]); -} - -function makeSig_r_xx(r, x) { - return makeSig([x, x], [r]); -} - -// Opcodes -let kExprUnreachable = 0x00; -let kExprNop = 0x01; -let kExprBlock = 0x02; -let kExprLoop = 0x03; -let kExprIf = 0x04; -let kExprElse = 0x05; -let kExprTry = 0x06; -let kExprCatch = 0x07; -let kExprThrow = 0x08; -let kExprEnd = 0x0b; -let kExprBr = 0x0c; -let kExprBrIf = 0x0d; -let kExprBrTable = 0x0e; -let kExprReturn = 0x0f; -let kExprCallFunction = 0x10; -let kExprCallIndirect = 0x11; -let kExprDrop = 0x1a; -let kExprSelect = 0x1b; -let kExprGetLocal = 0x20; -let kExprSetLocal = 0x21; -let kExprTeeLocal = 0x22; -let kExprGetGlobal = 0x23; -let kExprSetGlobal = 0x24; -let kExprI32Const = 0x41; -let kExprI64Const = 0x42; -let kExprF32Const = 0x43; -let kExprF64Const = 0x44; -let kExprI32LoadMem = 0x28; -let kExprI64LoadMem = 0x29; -let kExprF32LoadMem = 0x2a; -let kExprF64LoadMem = 0x2b; -let kExprI32LoadMem8S = 0x2c; -let kExprI32LoadMem8U = 0x2d; -let kExprI32LoadMem16S = 0x2e; -let kExprI32LoadMem16U = 0x2f; -let kExprI64LoadMem8S = 0x30; -let kExprI64LoadMem8U = 0x31; -let kExprI64LoadMem16S = 0x32; -let kExprI64LoadMem16U = 0x33; -let kExprI64LoadMem32S = 0x34; -let kExprI64LoadMem32U = 0x35; -let kExprI32StoreMem = 0x36; -let kExprI64StoreMem = 0x37; -let kExprF32StoreMem = 0x38; -let kExprF64StoreMem = 0x39; -let kExprI32StoreMem8 = 0x3a; -let kExprI32StoreMem16 = 0x3b; -let kExprI64StoreMem8 = 0x3c; -let kExprI64StoreMem16 = 0x3d; -let kExprI64StoreMem32 = 0x3e; -let kExprMemorySize = 0x3f; -let kExprGrowMemory = 0x40; -let kExprI32Eqz = 0x45; -let kExprI32Eq = 0x46; -let kExprI32Ne = 0x47; -let kExprI32LtS = 0x48; -let kExprI32LtU = 0x49; -let kExprI32GtS = 0x4a; -let kExprI32GtU = 0x4b; -let kExprI32LeS = 0x4c; -let kExprI32LeU = 0x4d; -let kExprI32GeS = 0x4e; -let kExprI32GeU = 0x4f; -let kExprI64Eqz = 0x50; -let kExprI64Eq = 0x51; -let kExprI64Ne = 0x52; -let kExprI64LtS = 0x53; -let kExprI64LtU = 0x54; -let kExprI64GtS = 0x55; -let kExprI64GtU = 0x56; -let kExprI64LeS = 0x57; -let kExprI64LeU = 0x58; -let kExprI64GeS = 0x59; -let kExprI64GeU = 0x5a; -let kExprF32Eq = 0x5b; -let kExprF32Ne = 0x5c; -let kExprF32Lt = 0x5d; -let kExprF32Gt = 0x5e; -let kExprF32Le = 0x5f; -let kExprF32Ge = 0x60; -let kExprF64Eq = 0x61; -let kExprF64Ne = 0x62; -let kExprF64Lt = 0x63; -let kExprF64Gt = 0x64; -let kExprF64Le = 0x65; -let kExprF64Ge = 0x66; -let kExprI32Clz = 0x67; -let kExprI32Ctz = 0x68; -let kExprI32Popcnt = 0x69; -let kExprI32Add = 0x6a; -let kExprI32Sub = 0x6b; -let kExprI32Mul = 0x6c; -let kExprI32DivS = 0x6d; -let kExprI32DivU = 0x6e; -let kExprI32RemS = 0x6f; -let kExprI32RemU = 0x70; -let kExprI32And = 0x71; -let kExprI32Ior = 0x72; -let kExprI32Xor = 0x73; -let kExprI32Shl = 0x74; -let kExprI32ShrS = 0x75; -let kExprI32ShrU = 0x76; -let kExprI32Rol = 0x77; -let kExprI32Ror = 0x78; -let kExprI64Clz = 0x79; -let kExprI64Ctz = 0x7a; -let kExprI64Popcnt = 0x7b; -let kExprI64Add = 0x7c; -let kExprI64Sub = 0x7d; -let kExprI64Mul = 0x7e; -let kExprI64DivS = 0x7f; -let kExprI64DivU = 0x80; -let kExprI64RemS = 0x81; -let kExprI64RemU = 0x82; -let kExprI64And = 0x83; -let kExprI64Ior = 0x84; -let kExprI64Xor = 0x85; -let kExprI64Shl = 0x86; -let kExprI64ShrS = 0x87; -let kExprI64ShrU = 0x88; -let kExprI64Rol = 0x89; -let kExprI64Ror = 0x8a; -let kExprF32Abs = 0x8b; -let kExprF32Neg = 0x8c; -let kExprF32Ceil = 0x8d; -let kExprF32Floor = 0x8e; -let kExprF32Trunc = 0x8f; -let kExprF32NearestInt = 0x90; -let kExprF32Sqrt = 0x91; -let kExprF32Add = 0x92; -let kExprF32Sub = 0x93; -let kExprF32Mul = 0x94; -let kExprF32Div = 0x95; -let kExprF32Min = 0x96; -let kExprF32Max = 0x97; -let kExprF32CopySign = 0x98; -let kExprF64Abs = 0x99; -let kExprF64Neg = 0x9a; -let kExprF64Ceil = 0x9b; -let kExprF64Floor = 0x9c; -let kExprF64Trunc = 0x9d; -let kExprF64NearestInt = 0x9e; -let kExprF64Sqrt = 0x9f; -let kExprF64Add = 0xa0; -let kExprF64Sub = 0xa1; -let kExprF64Mul = 0xa2; -let kExprF64Div = 0xa3; -let kExprF64Min = 0xa4; -let kExprF64Max = 0xa5; -let kExprF64CopySign = 0xa6; -let kExprI32ConvertI64 = 0xa7; -let kExprI32SConvertF32 = 0xa8; -let kExprI32UConvertF32 = 0xa9; -let kExprI32SConvertF64 = 0xaa; -let kExprI32UConvertF64 = 0xab; -let kExprI64SConvertI32 = 0xac; -let kExprI64UConvertI32 = 0xad; -let kExprI64SConvertF32 = 0xae; -let kExprI64UConvertF32 = 0xaf; -let kExprI64SConvertF64 = 0xb0; -let kExprI64UConvertF64 = 0xb1; -let kExprF32SConvertI32 = 0xb2; -let kExprF32UConvertI32 = 0xb3; -let kExprF32SConvertI64 = 0xb4; -let kExprF32UConvertI64 = 0xb5; -let kExprF32ConvertF64 = 0xb6; -let kExprF64SConvertI32 = 0xb7; -let kExprF64UConvertI32 = 0xb8; -let kExprF64SConvertI64 = 0xb9; -let kExprF64UConvertI64 = 0xba; -let kExprF64ConvertF32 = 0xbb; -let kExprI32ReinterpretF32 = 0xbc; -let kExprI64ReinterpretF64 = 0xbd; -let kExprF32ReinterpretI32 = 0xbe; -let kExprF64ReinterpretI64 = 0xbf; - -let kTrapUnreachable = 0; -let kTrapMemOutOfBounds = 1; -let kTrapDivByZero = 2; -let kTrapDivUnrepresentable = 3; -let kTrapRemByZero = 4; -let kTrapFloatUnrepresentable = 5; -let kTrapFuncInvalid = 6; -let kTrapFuncSigMismatch = 7; -let kTrapInvalidIndex = 8; - -let kTrapMsgs = [ - "unreachable", - "memory access out of bounds", - "divide by zero", - "divide result unrepresentable", - "remainder by zero", - "integer result unrepresentable", - "invalid function", - "function signature mismatch", - "invalid index into function table" -]; - -function assertTraps(trap, code) { - var threwException = true; - try { - if (typeof code === 'function') { - code(); - } else { - eval(code); - } - threwException = false; - } catch (e) { - assertEquals("object", typeof e); - assertEquals(kTrapMsgs[trap], e.message); - // Success. - return; - } - throw new MjsUnitAssertionError("Did not trap, expected: " + kTrapMsgs[trap]); -} - -function assertWasmThrows(value, code) { - assertEquals("number", typeof(value)); - try { - if (typeof code === 'function') { - code(); - } else { - eval(code); - } - } catch (e) { - assertEquals("number", typeof e); - assertEquals(value, e); - // Success. - return; - } - throw new MjsUnitAssertionError("Did not throw at all, expected: " + value); -} diff --git a/test/harness/wasm-module-builder.js b/test/harness/wasm-module-builder.js deleted file mode 100644 index 6e9284e7..00000000 --- a/test/harness/wasm-module-builder.js +++ /dev/null @@ -1,555 +0,0 @@ -// Copyright 2016 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Used for encoding f32 and double constants to bits. -let __buffer = new ArrayBuffer(8); -let byte_view = new Int8Array(__buffer); -let f32_view = new Float32Array(__buffer); -let f64_view = new Float64Array(__buffer); - -class Binary extends Array { - emit_u8(val) { - this.push(val); - } - - emit_u16(val) { - this.push(val & 0xff); - this.push((val >> 8) & 0xff); - } - - emit_u32(val) { - this.push(val & 0xff); - this.push((val >> 8) & 0xff); - this.push((val >> 16) & 0xff); - this.push((val >> 24) & 0xff); - } - - emit_u32v(val) { - while (true) { - let v = val & 0xff; - val = val >>> 7; - if (val == 0) { - this.push(v); - break; - } - this.push(v | 0x80); - } - } - - emit_bytes(data) { - for (let i = 0; i < data.length; i++) { - this.push(data[i] & 0xff); - } - } - - emit_string(string) { - // When testing illegal names, we pass a byte array directly. - if (string instanceof Array) { - this.emit_u32v(string.length); - this.emit_bytes(string); - return; - } - - // This is the hacky way to convert a JavaScript string to a UTF8 encoded - // string only containing single-byte characters. - let string_utf8 = unescape(encodeURIComponent(string)); - this.emit_u32v(string_utf8.length); - for (let i = 0; i < string_utf8.length; i++) { - this.emit_u8(string_utf8.charCodeAt(i)); - } - } - - emit_header() { - this.push(kWasmH0, kWasmH1, kWasmH2, kWasmH3, - kWasmV0, kWasmV1, kWasmV2, kWasmV3); - } - - emit_section(section_code, content_generator) { - // Emit section name. - this.emit_u8(section_code); - // Emit the section to a temporary buffer: its full length isn't know yet. - let section = new Binary; - content_generator(section); - // Emit section length. - this.emit_u32v(section.length); - // Copy the temporary buffer. - this.push(...section); - } -} - -class WasmFunctionBuilder { - constructor(module, name, type_index) { - this.module = module; - this.name = name; - this.type_index = type_index; - this.body = []; - } - - exportAs(name) { - this.module.addExport(name, this.index); - return this; - } - - exportFunc() { - this.exportAs(this.name); - return this; - } - - addBody(body) { - this.body = body; - return this; - } - - addLocals(locals) { - this.locals = locals; - return this; - } - - end() { - return this.module; - } -} - -class WasmGlobalBuilder { - constructor(module, type, mutable) { - this.module = module; - this.type = type; - this.mutable = mutable; - this.init = 0; - } - - exportAs(name) { - this.module.exports.push({name: name, kind: kExternalGlobal, - index: this.index}); - return this; - } -} - -class WasmModuleBuilder { - constructor() { - this.types = []; - this.imports = []; - this.exports = []; - this.globals = []; - this.functions = []; - this.function_table = []; - this.function_table_length = 0; - this.function_table_inits = []; - this.segments = []; - this.explicit = []; - this.num_imported_funcs = 0; - this.num_imported_globals = 0; - return this; - } - - addStart(start_index) { - this.start_index = start_index; - return this; - } - - addMemory(min, max, exp) { - this.memory = {min: min, max: max, exp: exp}; - return this; - } - - addExplicitSection(bytes) { - this.explicit.push(bytes); - return this; - } - - addType(type) { - // TODO: canonicalize types? - this.types.push(type); - return this.types.length - 1; - } - - addGlobal(local_type, mutable) { - let glob = new WasmGlobalBuilder(this, local_type, mutable); - glob.index = this.globals.length + this.num_imported_globals; - this.globals.push(glob); - return glob; - } - - addFunction(name, type) { - let type_index = (typeof type) == "number" ? type : this.addType(type); - let func = new WasmFunctionBuilder(this, name, type_index); - func.index = this.functions.length + this.num_imported_funcs; - this.functions.push(func); - return func; - } - - addImport(module = "", name, type) { - let type_index = (typeof type) == "number" ? type : this.addType(type); - this.imports.push({module: module, name: name, kind: kExternalFunction, - type: type_index}); - return this.num_imported_funcs++; - } - - addImportedGlobal(module = "", name, type) { - let o = {module: module, name: name, kind: kExternalGlobal, type: type, - mutable: false} - this.imports.push(o); - return this.num_imported_globals++; - } - - addImportedMemory(module = "", name, initial = 0, maximum) { - let o = {module: module, name: name, kind: kExternalMemory, - initial: initial, maximum: maximum}; - this.imports.push(o); - return this; - } - - addImportedTable(module = "", name, initial, maximum) { - let o = {module: module, name: name, kind: kExternalTable, initial: initial, - maximum: maximum}; - this.imports.push(o); - } - - addExport(name, index) { - this.exports.push({name: name, kind: kExternalFunction, index: index}); - return this; - } - - addExportOfKind(name, kind, index) { - this.exports.push({name: name, kind: kind, index: index}); - return this; - } - - addDataSegment(addr, data, is_global = false) { - this.segments.push({addr: addr, data: data, is_global: is_global}); - return this.segments.length - 1; - } - - exportMemoryAs(name) { - this.exports.push({name: name, kind: kExternalMemory, index: 0}); - } - - addFunctionTableInit(base, is_global, array) { - this.function_table_inits.push({base: base, is_global: is_global, - array: array}); - if (!is_global) { - var length = base + array.length; - if (length > this.function_table_length) { - this.function_table_length = length; - } - } - return this; - } - - appendToTable(array) { - return this.addFunctionTableInit(this.function_table.length, false, array); - } - - setFunctionTableLength(length) { - this.function_table_length = length; - return this; - } - - toArray(debug = false) { - let binary = new Binary; - let wasm = this; - - // Add header - binary.emit_header(); - - // Add type section - if (wasm.types.length > 0) { - if (debug) print("emitting types @ " + binary.length); - binary.emit_section(kTypeSectionCode, section => { - section.emit_u32v(wasm.types.length); - for (let type of wasm.types) { - section.emit_u8(kWasmFunctionTypeForm); - section.emit_u32v(type.params.length); - for (let param of type.params) { - section.emit_u8(param); - } - section.emit_u32v(type.results.length); - for (let result of type.results) { - section.emit_u8(result); - } - } - }); - } - - // Add imports section - if (wasm.imports.length > 0) { - if (debug) print("emitting imports @ " + binary.length); - binary.emit_section(kImportSectionCode, section => { - section.emit_u32v(wasm.imports.length); - for (let imp of wasm.imports) { - section.emit_string(imp.module); - section.emit_string(imp.name || ''); - section.emit_u8(imp.kind); - if (imp.kind == kExternalFunction) { - section.emit_u32v(imp.type); - } else if (imp.kind == kExternalGlobal) { - section.emit_u32v(imp.type); - section.emit_u8(imp.mutable); - } else if (imp.kind == kExternalMemory) { - var has_max = (typeof imp.maximum) != "undefined"; - section.emit_u8(has_max ? 1 : 0); // flags - section.emit_u32v(imp.initial); // initial - if (has_max) section.emit_u32v(imp.maximum); // maximum - } else if (imp.kind == kExternalTable) { - section.emit_u8(kWasmAnyFunctionTypeForm); - var has_max = (typeof imp.maximum) != "undefined"; - section.emit_u8(has_max ? 1 : 0); // flags - section.emit_u32v(imp.initial); // initial - if (has_max) section.emit_u32v(imp.maximum); // maximum - } else { - throw new Error("unknown/unsupported import kind " + imp.kind); - } - } - }); - } - - // Add functions declarations - let has_names = false; - let names = false; - if (wasm.functions.length > 0) { - if (debug) print("emitting function decls @ " + binary.length); - binary.emit_section(kFunctionSectionCode, section => { - section.emit_u32v(wasm.functions.length); - for (let func of wasm.functions) { - has_names = has_names || (func.name != undefined && - func.name.length > 0); - section.emit_u32v(func.type_index); - } - }); - } - - // Add function_table. - if (wasm.function_table_length > 0) { - if (debug) print("emitting table @ " + binary.length); - binary.emit_section(kTableSectionCode, section => { - section.emit_u8(1); // one table entry - section.emit_u8(kWasmAnyFunctionTypeForm); - section.emit_u8(1); - section.emit_u32v(wasm.function_table_length); - section.emit_u32v(wasm.function_table_length); - }); - } - - // Add memory section - if (wasm.memory != undefined) { - if (debug) print("emitting memory @ " + binary.length); - binary.emit_section(kMemorySectionCode, section => { - section.emit_u8(1); // one memory entry - section.emit_u32v(kResizableMaximumFlag); - section.emit_u32v(wasm.memory.min); - section.emit_u32v(wasm.memory.max); - }); - } - - // Add global section. - if (wasm.globals.length > 0) { - if (debug) print ("emitting globals @ " + binary.length); - binary.emit_section(kGlobalSectionCode, section => { - section.emit_u32v(wasm.globals.length); - for (let global of wasm.globals) { - section.emit_u8(global.type); - section.emit_u8(global.mutable); - if ((typeof global.init_index) == "undefined") { - // Emit a constant initializer. - switch (global.type) { - case kWasmI32: - section.emit_u8(kExprI32Const); - section.emit_u32v(global.init); - break; - case kWasmI64: - section.emit_u8(kExprI64Const); - section.emit_u8(global.init); - break; - case kWasmF32: - section.emit_u8(kExprF32Const); - f32_view[0] = global.init; - section.emit_u8(byte_view[0]); - section.emit_u8(byte_view[1]); - section.emit_u8(byte_view[2]); - section.emit_u8(byte_view[3]); - break; - case kWasmF64: - section.emit_u8(kExprF64Const); - f64_view[0] = global.init; - section.emit_u8(byte_view[0]); - section.emit_u8(byte_view[1]); - section.emit_u8(byte_view[2]); - section.emit_u8(byte_view[3]); - section.emit_u8(byte_view[4]); - section.emit_u8(byte_view[5]); - section.emit_u8(byte_view[6]); - section.emit_u8(byte_view[7]); - break; - } - } else { - // Emit a global-index initializer. - section.emit_u8(kExprGetGlobal); - section.emit_u32v(global.init_index); - } - section.emit_u8(kExprEnd); // end of init expression - } - }); - } - - // Add export table. - var mem_export = (wasm.memory != undefined && wasm.memory.exp); - var exports_count = wasm.exports.length + (mem_export ? 1 : 0); - if (exports_count > 0) { - if (debug) print("emitting exports @ " + binary.length); - binary.emit_section(kExportSectionCode, section => { - section.emit_u32v(exports_count); - for (let exp of wasm.exports) { - section.emit_string(exp.name); - section.emit_u8(exp.kind); - section.emit_u32v(exp.index); - } - if (mem_export) { - section.emit_string("memory"); - section.emit_u8(kExternalMemory); - section.emit_u8(0); - } - }); - } - - // Add start function section. - if (wasm.start_index != undefined) { - if (debug) print("emitting start function @ " + binary.length); - binary.emit_section(kStartSectionCode, section => { - section.emit_u32v(wasm.start_index); - }); - } - - // Add table elements. - if (wasm.function_table_inits.length > 0) { - if (debug) print("emitting table @ " + binary.length); - binary.emit_section(kElementSectionCode, section => { - var inits = wasm.function_table_inits; - section.emit_u32v(inits.length); - section.emit_u8(0); // table index - - for (let init of inits) { - if (init.is_global) { - section.emit_u8(kExprGetGlobal); - } else { - section.emit_u8(kExprI32Const); - } - section.emit_u32v(init.base); - section.emit_u8(kExprEnd); - section.emit_u32v(init.array.length); - for (let index of init.array) { - section.emit_u32v(index); - } - } - }); - } - - // Add function bodies. - if (wasm.functions.length > 0) { - // emit function bodies - if (debug) print("emitting code @ " + binary.length); - binary.emit_section(kCodeSectionCode, section => { - section.emit_u32v(wasm.functions.length); - for (let func of wasm.functions) { - // Function body length will be patched later. - let local_decls = []; - let l = func.locals; - if (l != undefined) { - let local_decls_count = 0; - if (l.i32_count > 0) { - local_decls.push({count: l.i32_count, type: kWasmI32}); - } - if (l.i64_count > 0) { - local_decls.push({count: l.i64_count, type: kWasmI64}); - } - if (l.f32_count > 0) { - local_decls.push({count: l.f32_count, type: kWasmF32}); - } - if (l.f64_count > 0) { - local_decls.push({count: l.f64_count, type: kWasmF64}); - } - } - - let header = new Binary; - header.emit_u32v(local_decls.length); - for (let decl of local_decls) { - header.emit_u32v(decl.count); - header.emit_u8(decl.type); - } - - section.emit_u32v(header.length + func.body.length); - section.emit_bytes(header); - section.emit_bytes(func.body); - } - }); - } - - // Add data segments. - if (wasm.segments.length > 0) { - if (debug) print("emitting data segments @ " + binary.length); - binary.emit_section(kDataSectionCode, section => { - section.emit_u32v(wasm.segments.length); - for (let seg of wasm.segments) { - section.emit_u8(0); // linear memory index 0 - if (seg.is_global) { - // initializer is a global variable - section.emit_u8(kExprGetGlobal); - section.emit_u32v(seg.addr); - } else { - // initializer is a constant - section.emit_u8(kExprI32Const); - section.emit_u32v(seg.addr); - } - section.emit_u8(kExprEnd); - section.emit_u32v(seg.data.length); - section.emit_bytes(seg.data); - } - }); - } - - // Add any explicitly added sections - for (let exp of wasm.explicit) { - if (debug) print("emitting explicit @ " + binary.length); - binary.emit_bytes(exp); - } - - // Add function names. - if (has_names) { - if (debug) print("emitting names @ " + binary.length); - binary.emit_section(kUnknownSectionCode, section => { - section.emit_string("name"); - var count = wasm.functions.length + wasm.num_imported_funcs; - section.emit_u32v(count); - for (var i = 0; i < wasm.num_imported_funcs; i++) { - section.emit_u8(0); // empty string - section.emit_u8(0); // local names count == 0 - } - for (let func of wasm.functions) { - var name = func.name == undefined ? "" : func.name; - section.emit_string(name); - section.emit_u8(0); // local names count == 0 - } - }); - } - - return binary; - } - - toBuffer(debug = false) { - let bytes = this.toArray(debug); - let buffer = new ArrayBuffer(bytes.length); - let view = new Uint8Array(buffer); - for (let i = 0; i < bytes.length; i++) { - let val = bytes[i]; - if ((typeof val) == "string") val = val.charCodeAt(0); - view[i] = val | 0; - } - return new Uint8Array(buffer); - } - - instantiate(...args) { - let module = new WebAssembly.Module(this.toBuffer()); - let instance = new WebAssembly.Instance(module, ...args); - return instance; - } -} diff --git a/test/harness/wast.js b/test/harness/wast.js deleted file mode 100644 index 5d329c10..00000000 --- a/test/harness/wast.js +++ /dev/null @@ -1,29777 +0,0 @@ -// DO NOT EDIT. Generated from WebAssembly spec interpreter - -let WebAssemblyText = (function() { -  let _registry = {__proto__: null}; - function normalize(file) { - return file.split('/').reverse()[0].split('.')[0]; - } -  function require(file) { -    let name = normalize(file); - if (!(name in _registry)) { - throw new Error('missing module: ' + name) -    } else if (typeof _registry[name] === 'function') { - - -      let f = _registry[name]; -      _registry[name] = function() { throw new Error('cyclic module: ' + name) }; -      _registry[name] = f(); -    } -    return _registry[name]; -  } - - - _registry['arrange'] = function() { -    let exports = {}; -//////// start of arrange.js //////// -// Generated by BUCKLESCRIPT VERSION 1.4.3 , PLEASE EDIT WITH CARE -'use strict'; - -var F32 = require("./f32"); -var F64 = require("./f64"); -var I32 = require("./i32"); -var I64 = require("./i64"); -var Lib = require("./lib"); -var List = require("bs-platform/lib/js/list"); -var Block = require("bs-platform/lib/js/block"); -var Curry = require("bs-platform/lib/js/curry"); -var Types = require("./types"); -var Buffer = require("bs-platform/lib/js/buffer"); -var Decode = require("./decode"); -var Encode = require("./encode"); -var Printf = require("bs-platform/lib/js/printf"); -var Source = require("./source"); -var $$String = require("bs-platform/lib/js/string"); -var Values = require("./values"); -var Caml_int32 = require("bs-platform/lib/js/caml_int32"); -var Pervasives = require("bs-platform/lib/js/pervasives"); -var Caml_builtin_exceptions = require("bs-platform/lib/js/caml_builtin_exceptions"); - -function add_hex_char(buf, c) { - return Curry._1(Printf.bprintf(buf, /* Format */[ - /* Char_literal */Block.__(12, [ - /* "\\" */92, - /* Int */Block.__(4, [ - /* Int_x */6, - /* Lit_padding */Block.__(0, [ - /* Zeros */2, - 2 - ]), - /* No_precision */0, - /* End_of_format */0 - ]) - ]), - "\\%02x" - ]), c); -} - -function add_char(buf, c) { - if (c < /* " " */32 || c >= /* "\127" */127) { - return add_hex_char(buf, c); - } - else { - if (c === /* "\"" */34 || c === /* "\\" */92) { - Buffer.add_char(buf, /* "\\" */92); - } - return Buffer.add_char(buf, c); - } -} - -function string_with(add_char, s) { - var buf = Buffer.create(Caml_int32.imul(3, s.length) + 2 | 0); - Buffer.add_char(buf, /* "\"" */34); - $$String.iter(Curry._1(add_char, buf), s); - Buffer.add_char(buf, /* "\"" */34); - return Buffer.contents(buf); -} - -function list_of_opt(param) { - if (param) { - return /* :: */[ - param[0], - /* [] */0 - ]; - } - else { - return /* [] */0; - } -} - -function break_bytes(s) { - var ss = Curry._2(Lib.$$String[/* breakup */0], s, 16); - var f = function (param) { - return /* Atom */Block.__(0, [string_with(add_hex_char, param)]); - }; - return List.map(f, ss); -} - -function decls(kind, ts) { - var head = kind; - var f = function (param) { - return /* Atom */Block.__(0, [Types.string_of_value_type(param)]); - }; - var xs = ts; - if (xs) { - return /* :: */[ - /* Node */Block.__(1, [ - head, - List.map(f, xs) - ]), - /* [] */0 - ]; - } - else { - return /* [] */0; - } -} - -function func_type(param) { - return /* Node */Block.__(1, [ - "func", - Pervasives.$at(decls("param", param[0]), decls("result", param[1])) - ]); -} - -function limits(nat, param) { - var xs = list_of_opt(param[/* max */1]); - return $$String.concat(" ", /* :: */[ - Curry._1(nat, param[/* min */0]), - List.map(nat, xs) - ]); -} - -function global_type(param) { - var t = param[0]; - if (param[1] !== 0) { - return /* Node */Block.__(1, [ - "mut", - /* :: */[ - /* Atom */Block.__(0, [Types.string_of_value_type(t)]), - /* [] */0 - ] - ]); - } - else { - return /* Atom */Block.__(0, [Types.string_of_value_type(t)]); - } -} - -function testop(_, _$1) { - return "eqz"; -} - -function relop(_, param) { - switch (param) { - case 0 : - return "eq"; - case 1 : - return "ne"; - case 2 : - return "lt_s"; - case 3 : - return "lt_u"; - case 4 : - return "gt_s"; - case 5 : - return "gt_u"; - case 6 : - return "le_s"; - case 7 : - return "le_u"; - case 8 : - return "ge_s"; - case 9 : - return "ge_u"; - - } -} - -function unop(_, param) { - switch (param) { - case 0 : - return "clz"; - case 1 : - return "ctz"; - case 2 : - return "popcnt"; - - } -} - -function binop(_, param) { - switch (param) { - case 0 : - return "add"; - case 1 : - return "sub"; - case 2 : - return "mul"; - case 3 : - return "div_s"; - case 4 : - return "div_u"; - case 5 : - return "rem_s"; - case 6 : - return "rem_u"; - case 7 : - return "and"; - case 8 : - return "or"; - case 9 : - return "xor"; - case 10 : - return "shl"; - case 11 : - return "shr_s"; - case 12 : - return "shr_u"; - case 13 : - return "rotl"; - case 14 : - return "rotr"; - - } -} - -function cvtop(xx, param) { - switch (param) { - case 0 : - return "extend_s/i32"; - case 1 : - return "extend_u/i32"; - case 2 : - return "wrap/i64"; - case 3 : - return "trunc_s/f32"; - case 4 : - return "trunc_u/f32"; - case 5 : - return "trunc_s/f64"; - case 6 : - return "trunc_u/f64"; - case 7 : - return "reinterpret/f" + xx; - - } -} - -function testop$1(_, _$1) { - throw [ - Caml_builtin_exceptions.assert_failure, - [ - "/usr/local/google/home/rossberg/wasm/spec/interpreter/_build/jslib/src/arrange.ml", - 128, - 27 - ] - ]; -} - -function relop$1(_, param) { - switch (param) { - case 0 : - return "eq"; - case 1 : - return "ne"; - case 2 : - return "lt"; - case 3 : - return "gt"; - case 4 : - return "le"; - case 5 : - return "ge"; - - } -} - -function unop$1(_, param) { - switch (param) { - case 0 : - return "neg"; - case 1 : - return "abs"; - case 2 : - return "ceil"; - case 3 : - return "floor"; - case 4 : - return "trunc"; - case 5 : - return "nearest"; - case 6 : - return "sqrt"; - - } -} - -function binop$1(_, param) { - switch (param) { - case 0 : - return "add"; - case 1 : - return "sub"; - case 2 : - return "mul"; - case 3 : - return "div"; - case 4 : - return "min"; - case 5 : - return "max"; - case 6 : - return "copysign"; - - } -} - -function cvtop$1(xx, param) { - switch (param) { - case 0 : - return "convert_s/i32"; - case 1 : - return "convert_u/i32"; - case 2 : - return "convert_s/i64"; - case 3 : - return "convert_u/i64"; - case 4 : - return "promote/f32"; - case 5 : - return "demote/f64"; - case 6 : - return "reinterpret/i" + xx; - - } -} - -function oper(param, op) { - var floatop = param[1]; - var intop = param[0]; - var $js; - switch (op.tag | 0) { - case 0 : - $js = Curry._2(intop, "32", op[0]); - break; - case 1 : - $js = Curry._2(intop, "64", op[0]); - break; - case 2 : - $js = Curry._2(floatop, "32", op[0]); - break; - case 3 : - $js = Curry._2(floatop, "64", op[0]); - break; - - } - return Types.string_of_value_type(Values.type_of(op)) + ("." + $js); -} - -var partial_arg = /* tuple */[ - unop, - unop$1 -]; - -function unop$2(param) { - return oper(partial_arg, param); -} - -var partial_arg$1 = /* tuple */[ - binop, - binop$1 -]; - -function binop$2(param) { - return oper(partial_arg$1, param); -} - -var partial_arg$2 = /* tuple */[ - testop, - testop$1 -]; - -function testop$2(param) { - return oper(partial_arg$2, param); -} - -var partial_arg$3 = /* tuple */[ - relop, - relop$1 -]; - -function relop$2(param) { - return oper(partial_arg$3, param); -} - -var partial_arg$4 = /* tuple */[ - cvtop, - cvtop$1 -]; - -function cvtop$2(param) { - return oper(partial_arg$4, param); -} - -function mem_size(param) { - switch (param) { - case 0 : - return "8"; - case 1 : - return "16"; - case 2 : - return "32"; - - } -} - -function extension(param) { - if (param !== 0) { - return "_u"; - } - else { - return "_s"; - } -} - -function memop(name, param) { - var offset = param[/* offset */2]; - var align = param[/* align */1]; - var ty = param[/* ty */0]; - return Types.string_of_value_type(ty) + ("." + (name + (( - offset ? " offset=" + Curry._1(I32.to_string_u, offset) : "" - ) + ( - (1 << align) === Types.size(ty) ? "" : " align=" + Curry._1(I32.to_string_u, Curry._1(I32.of_int_u, (1 << align))) - )))); -} - -function loadop(op) { - var match = op[/* sz */3]; - if (match) { - var match$1 = match[0]; - return memop("load" + (mem_size(match$1[0]) + extension(match$1[1])), op); - } - else { - return memop("load", op); - } -} - -function storeop(op) { - var match = op[/* sz */3]; - if (match) { - return memop("store" + mem_size(match[0]), op); - } - else { - return memop("store", op); - } -} - -function $$var(x) { - return Curry._1(I32.to_string_u, x[/* it */1]); -} - -function constop(v) { - return Types.string_of_value_type(Values.type_of(v[/* it */1])) + ".const"; -} - -function instr(e) { - var match = e[/* it */1]; - var match$1; - if (typeof match === "number") { - switch (match) { - case 0 : - match$1 = /* tuple */[ - "unreachable", - /* [] */0 - ]; - break; - case 1 : - match$1 = /* tuple */[ - "nop", - /* [] */0 - ]; - break; - case 2 : - match$1 = /* tuple */[ - "return", - /* [] */0 - ]; - break; - case 3 : - match$1 = /* tuple */[ - "drop", - /* [] */0 - ]; - break; - case 4 : - match$1 = /* tuple */[ - "select", - /* [] */0 - ]; - break; - case 5 : - match$1 = /* tuple */[ - "current_memory", - /* [] */0 - ]; - break; - case 6 : - match$1 = /* tuple */[ - "grow_memory", - /* [] */0 - ]; - break; - - } - } - else { - switch (match.tag | 0) { - case 0 : - var f = function (param) { - return /* Atom */Block.__(0, [Types.string_of_value_type(param)]); - }; - match$1 = /* tuple */[ - "block", - Pervasives.$at(List.map(f, match[0]), List.map(instr, match[1])) - ]; - break; - case 1 : - var f$1 = function (param) { - return /* Atom */Block.__(0, [Types.string_of_value_type(param)]); - }; - match$1 = /* tuple */[ - "loop", - Pervasives.$at(List.map(f$1, match[0]), List.map(instr, match[1])) - ]; - break; - case 2 : - var f$2 = function (param) { - return /* Atom */Block.__(0, [Types.string_of_value_type(param)]); - }; - match$1 = /* tuple */[ - "if", - Pervasives.$at(List.map(f$2, match[0]), /* :: */[ - /* Node */Block.__(1, [ - "then", - List.map(instr, match[1]) - ]), - /* :: */[ - /* Node */Block.__(1, [ - "else", - List.map(instr, match[2]) - ]), - /* [] */0 - ] - ]) - ]; - break; - case 3 : - match$1 = /* tuple */[ - "br " + Curry._1(I32.to_string_u, match[0][/* it */1]), - /* [] */0 - ]; - break; - case 4 : - match$1 = /* tuple */[ - "br_if " + Curry._1(I32.to_string_u, match[0][/* it */1]), - /* [] */0 - ]; - break; - case 5 : - var xs = Pervasives.$at(match[0], /* :: */[ - match[1], - /* [] */0 - ]); - match$1 = /* tuple */[ - "br_table " + $$String.concat(" ", List.map($$var, xs)), - /* [] */0 - ]; - break; - case 6 : - match$1 = /* tuple */[ - "call " + Curry._1(I32.to_string_u, match[0][/* it */1]), - /* [] */0 - ]; - break; - case 7 : - match$1 = /* tuple */[ - "call_indirect " + Curry._1(I32.to_string_u, match[0][/* it */1]), - /* [] */0 - ]; - break; - case 8 : - match$1 = /* tuple */[ - "get_local " + Curry._1(I32.to_string_u, match[0][/* it */1]), - /* [] */0 - ]; - break; - case 9 : - match$1 = /* tuple */[ - "set_local " + Curry._1(I32.to_string_u, match[0][/* it */1]), - /* [] */0 - ]; - break; - case 10 : - match$1 = /* tuple */[ - "tee_local " + Curry._1(I32.to_string_u, match[0][/* it */1]), - /* [] */0 - ]; - break; - case 11 : - match$1 = /* tuple */[ - "get_global " + Curry._1(I32.to_string_u, match[0][/* it */1]), - /* [] */0 - ]; - break; - case 12 : - match$1 = /* tuple */[ - "set_global " + Curry._1(I32.to_string_u, match[0][/* it */1]), - /* [] */0 - ]; - break; - case 13 : - match$1 = /* tuple */[ - loadop(match[0]), - /* [] */0 - ]; - break; - case 14 : - match$1 = /* tuple */[ - storeop(match[0]), - /* [] */0 - ]; - break; - case 15 : - var lit = match[0]; - match$1 = /* tuple */[ - constop(lit) + (" " + Values.string_of_value(lit[/* it */1])), - /* [] */0 - ]; - break; - case 16 : - match$1 = /* tuple */[ - Curry._1(testop$2, match[0]), - /* [] */0 - ]; - break; - case 17 : - match$1 = /* tuple */[ - Curry._1(relop$2, match[0]), - /* [] */0 - ]; - break; - case 18 : - match$1 = /* tuple */[ - Curry._1(unop$2, match[0]), - /* [] */0 - ]; - break; - case 19 : - match$1 = /* tuple */[ - Curry._1(binop$2, match[0]), - /* [] */0 - ]; - break; - case 20 : - match$1 = /* tuple */[ - Curry._1(cvtop$2, match[0]), - /* [] */0 - ]; - break; - - } - } - return /* Node */Block.__(1, [ - match$1[0], - match$1[1] - ]); -} - -function func_with_name(name, f) { - var match = f[/* it */1]; - return /* Node */Block.__(1, [ - "func" + name, - Pervasives.$at(/* :: */[ - /* Node */Block.__(1, [ - "type " + Curry._1(I32.to_string_u, match[/* ftype */0][/* it */1]), - /* [] */0 - ]), - /* [] */0 - ], Pervasives.$at(decls("local", match[/* locals */1]), List.map(instr, match[/* body */2]))) - ]); -} - -function func(f) { - return func_with_name("", f); -} - -function start(x) { - return /* Node */Block.__(1, [ - "start " + Curry._1(I32.to_string_u, x[/* it */1]), - /* [] */0 - ]); -} - -function table(off, i, tab) { - var match = tab[/* it */1]; - var match$1 = match[/* ttype */0]; - return /* Node */Block.__(1, [ - "table $" + (Curry._1(I32.to_string_u, Curry._1(I32.of_int_u, off + i | 0)) + (" " + limits(I32.to_string_u, match$1[0]))), - /* :: */[ - /* Atom */Block.__(0, [Types.string_of_elem_type(match$1[1])]), - /* [] */0 - ] - ]); -} - -function memory(off, i, mem) { - var match = mem[/* it */1]; - return /* Node */Block.__(1, [ - "memory $" + (Curry._1(I32.to_string_u, Curry._1(I32.of_int_u, off + i | 0)) + (" " + limits(I32.to_string_u, match[/* mtype */0][0]))), - /* [] */0 - ]); -} - -function segment(head, dat, seg) { - var match = seg[/* it */1]; - return /* Node */Block.__(1, [ - head, - /* :: */[ - /* Atom */Block.__(0, [Curry._1(I32.to_string_u, match[/* index */0][/* it */1])]), - /* :: */[ - /* Node */Block.__(1, [ - "offset", - List.map(instr, match[/* offset */1][/* it */1]) - ]), - Curry._1(dat, match[/* init */2]) - ] - ] - ]); -} - -function elems(seg) { - return segment("elem", function (param) { - return List.map(function (param) { - return /* Atom */Block.__(0, [Curry._1(I32.to_string_u, param[/* it */1])]); - }, param); - }, seg); -} - -function data(seg) { - return segment("data", break_bytes, seg); -} - -function typedef(i, t) { - return /* Node */Block.__(1, [ - "type $" + Curry._1(I32.to_string_u, Curry._1(I32.of_int_u, i)), - /* :: */[ - func_type(t), - /* [] */0 - ] - ]); -} - -function import_kind(i, k) { - var match = k[/* it */1]; - switch (match.tag | 0) { - case 0 : - return /* Node */Block.__(1, [ - "func $" + Curry._1(I32.to_string_u, Curry._1(I32.of_int_u, i)), - /* :: */[ - /* Node */Block.__(1, [ - "type", - /* :: */[ - /* Atom */Block.__(0, [Curry._1(I32.to_string_u, match[0][/* it */1])]), - /* [] */0 - ] - ]), - /* [] */0 - ] - ]); - case 1 : - return table(0, i, Source.$at$at(/* record */[/* ttype */match[0]], k[/* at */0])); - case 2 : - return memory(0, i, Source.$at$at(/* record */[/* mtype */match[0]], k[/* at */0])); - case 3 : - return /* Node */Block.__(1, [ - "global $" + Curry._1(I32.to_string_u, Curry._1(I32.of_int_u, i)), - /* :: */[ - global_type(match[0]), - /* [] */0 - ] - ]); - - } -} - -function $$import(i, im) { - var match = im[/* it */1]; - return /* Node */Block.__(1, [ - "import", - /* :: */[ - /* Atom */Block.__(0, [string_with(add_char, match[/* module_name */0])]), - /* :: */[ - /* Atom */Block.__(0, [string_with(add_char, match[/* item_name */1])]), - /* :: */[ - import_kind(i, match[/* ikind */2]), - /* [] */0 - ] - ] - ] - ]); -} - -function export_kind(k) { - var match = k[/* it */1]; - switch (match) { - case 0 : - return "func"; - case 1 : - return "table"; - case 2 : - return "memory"; - case 3 : - return "global"; - - } -} - -function $$export(ex) { - var match = ex[/* it */1]; - return /* Node */Block.__(1, [ - "export", - /* :: */[ - /* Atom */Block.__(0, [string_with(add_char, match[/* name */0])]), - /* :: */[ - /* Node */Block.__(1, [ - export_kind(match[/* ekind */1]), - /* :: */[ - /* Atom */Block.__(0, [Curry._1(I32.to_string_u, match[/* item */2][/* it */1])]), - /* [] */0 - ] - ]), - /* [] */0 - ] - ] - ]); -} - -function var_opt(param) { - if (param) { - return " " + param[0][/* it */1]; - } - else { - return ""; - } -} - -function is_func_import(im) { - var match = im[/* it */1][/* ikind */2][/* it */1]; - if (match.tag) { - return /* false */0; - } - else { - return /* true */1; - } -} - -function is_table_import(im) { - var match = im[/* it */1][/* ikind */2][/* it */1]; - if (match.tag === 1) { - return /* true */1; - } - else { - return /* false */0; - } -} - -function is_memory_import(im) { - var match = im[/* it */1][/* ikind */2][/* it */1]; - if (match.tag === 2) { - return /* true */1; - } - else { - return /* false */0; - } -} - -function is_global_import(im) { - var match = im[/* it */1][/* ikind */2][/* it */1]; - if (match.tag === 3) { - return /* true */1; - } - else { - return /* false */0; - } -} - -function module_with_var_opt(x_opt, m) { - var func_imports = List.filter(is_func_import)(m[/* it */1][/* imports */8]); - var table_imports = List.filter(is_table_import)(m[/* it */1][/* imports */8]); - var memory_imports = List.filter(is_memory_import)(m[/* it */1][/* imports */8]); - var global_imports = List.filter(is_global_import)(m[/* it */1][/* imports */8]); - var partial_arg = List.length(table_imports); - var f = function (param, param$1) { - return table(partial_arg, param, param$1); - }; - var partial_arg$1 = List.length(memory_imports); - var f$1 = function (param, param$1) { - return memory(partial_arg$1, param, param$1); - }; - var partial_arg$2 = List.length(global_imports); - var f$2 = function (param, param$1) { - var off = partial_arg$2; - var i = param; - var g = param$1; - var match = g[/* it */1]; - return /* Node */Block.__(1, [ - "global $" + Curry._1(I32.to_string_u, Curry._1(I32.of_int_u, off + i | 0)), - /* :: */[ - global_type(match[/* gtype */0]), - List.map(instr, match[/* value */1][/* it */1]) - ] - ]); - }; - var partial_arg$3 = List.length(func_imports); - var f$3 = function (param, param$1) { - var off = partial_arg$3; - var i = param; - var f$4 = param$1; - return func_with_name(" $" + Curry._1(I32.to_string_u, Curry._1(I32.of_int_u, off + i | 0)), f$4); - }; - var xs = list_of_opt(m[/* it */1][/* start */5]); - return /* Node */Block.__(1, [ - "module" + var_opt(x_opt), - Pervasives.$at(List.mapi(typedef, m[/* it */1][/* types */0]), Pervasives.$at(List.mapi($$import, table_imports), Pervasives.$at(List.mapi($$import, memory_imports), Pervasives.$at(List.mapi($$import, global_imports), Pervasives.$at(List.mapi($$import, func_imports), Pervasives.$at(List.mapi(f, m[/* it */1][/* tables */2]), Pervasives.$at(List.mapi(f$1, m[/* it */1][/* memories */3]), Pervasives.$at(List.mapi(f$2, m[/* it */1][/* globals */1]), Pervasives.$at(List.mapi(f$3, m[/* it */1][/* funcs */4]), Pervasives.$at(List.map($$export, m[/* it */1][/* exports */9]), Pervasives.$at(List.map(start, xs), Pervasives.$at(List.map(elems, m[/* it */1][/* elems */6]), List.map(data, m[/* it */1][/* data */7]))))))))))))) - ]); -} - -function module_(param) { - return module_with_var_opt(/* None */0, param); -} - -function literal(lit) { - var match = lit[/* it */1]; - switch (match.tag | 0) { - case 0 : - return /* Node */Block.__(1, [ - "i32.const " + Curry._1(I32.to_string_s, match[0]), - /* [] */0 - ]); - case 1 : - return /* Node */Block.__(1, [ - "i64.const " + Curry._1(I64.to_string_s, match[0]), - /* [] */0 - ]); - case 2 : - return /* Node */Block.__(1, [ - "f32.const " + Curry._1(F32.to_string, match[0]), - /* [] */0 - ]); - case 3 : - return /* Node */Block.__(1, [ - "f64.const " + Curry._1(F64.to_string, match[0]), - /* [] */0 - ]); - - } -} - -function definition(mode, x_opt, def) { - var match = def[/* it */1]; - var exit = 0; - exit = mode !== 564146209 && !(mode >= 983167089 && match.tag) ? 1 : 2; - switch (exit) { - case 1 : - var match$1 = def[/* it */1]; - var m; - m = match$1.tag ? Decode.decode("", match$1[1]) : match$1[0]; - return module_with_var_opt(x_opt, m); - case 2 : - var match$2 = def[/* it */1]; - var bs; - bs = match$2.tag ? match$2[1] : Encode.encode(match$2[0]); - var x_opt$1 = x_opt; - var bs$1 = bs; - return /* Node */Block.__(1, [ - "module" + var_opt(x_opt$1), - break_bytes(bs$1) - ]); - - } -} - -function access(x_opt, name) { - return $$String.concat(" ", /* :: */[ - var_opt(x_opt), - /* :: */[ - string_with(add_char, name), - /* [] */0 - ] - ]); -} - -function action(act) { - var match = act[/* it */1]; - if (match.tag) { - return /* Node */Block.__(1, [ - "get" + access(match[0], match[1]), - /* [] */0 - ]); - } - else { - return /* Node */Block.__(1, [ - "invoke" + access(match[0], match[1]), - List.map(literal, match[2]) - ]); - } -} - -function script(mode, scr) { - return List.map(function (param) { - var mode$1 = mode; - var cmd = param; - var match = cmd[/* it */1]; - switch (match.tag | 0) { - case 0 : - return definition(mode$1, match[0], match[1]); - case 1 : - return /* Node */Block.__(1, [ - "register " + (string_with(add_char, match[0]) + var_opt(match[1])), - /* [] */0 - ]); - case 2 : - return action(match[0]); - case 3 : - var mode$2 = mode$1; - var ass = match[0]; - var match$1 = ass[/* it */1]; - switch (match$1.tag | 0) { - case 0 : - return /* Node */Block.__(1, [ - "assert_malformed", - /* :: */[ - definition(/* Original */983167089, /* None */0, match$1[0]), - /* :: */[ - /* Atom */Block.__(0, [string_with(add_char, match$1[1])]), - /* [] */0 - ] - ] - ]); - case 1 : - return /* Node */Block.__(1, [ - "assert_invalid", - /* :: */[ - definition(mode$2, /* None */0, match$1[0]), - /* :: */[ - /* Atom */Block.__(0, [string_with(add_char, match$1[1])]), - /* [] */0 - ] - ] - ]); - case 2 : - return /* Node */Block.__(1, [ - "assert_soft_invalid", - /* :: */[ - definition(mode$2, /* None */0, match$1[0]), - /* :: */[ - /* Atom */Block.__(0, [string_with(add_char, match$1[1])]), - /* [] */0 - ] - ] - ]); - case 3 : - return /* Node */Block.__(1, [ - "assert_unlinkable", - /* :: */[ - definition(mode$2, /* None */0, match$1[0]), - /* :: */[ - /* Atom */Block.__(0, [string_with(add_char, match$1[1])]), - /* [] */0 - ] - ] - ]); - case 4 : - return /* Node */Block.__(1, [ - "assert_trap", - /* :: */[ - definition(mode$2, /* None */0, match$1[0]), - /* :: */[ - /* Atom */Block.__(0, [string_with(add_char, match$1[1])]), - /* [] */0 - ] - ] - ]); - case 5 : - return /* Node */Block.__(1, [ - "assert_return", - /* :: */[ - action(match$1[0]), - List.map(literal, match$1[1]) - ] - ]); - case 6 : - return /* Node */Block.__(1, [ - "assert_return_nan", - /* :: */[ - action(match$1[0]), - /* [] */0 - ] - ]); - case 7 : - return /* Node */Block.__(1, [ - "assert_trap", - /* :: */[ - action(match$1[0]), - /* :: */[ - /* Atom */Block.__(0, [string_with(add_char, match$1[1])]), - /* [] */0 - ] - ] - ]); - case 8 : - return /* Node */Block.__(1, [ - "assert_exhaustion", - /* :: */[ - action(match$1[0]), - /* :: */[ - /* Atom */Block.__(0, [string_with(add_char, match$1[1])]), - /* [] */0 - ] - ] - ]); - - } - case 4 : - throw [ - Caml_builtin_exceptions.assert_failure, - [ - "/usr/local/google/home/rossberg/wasm/spec/interpreter/_build/jslib/src/arrange.ml", - 435, - 14 - ] - ]; - - } - }, scr); -} - -exports.instr = instr; -exports.func = func; -exports.module_ = module_; -exports.script = script; -/* F32 Not a pure module */ -//////// end of arrange.js //////// -    return exports; -  }; - - - _registry['array'] = function() { -    let exports = {}; -//////// start of array.js //////// -'use strict'; - -var Curry = require("./curry"); -var Caml_array = require("./caml_array"); -var Caml_exceptions = require("./caml_exceptions"); -var Caml_builtin_exceptions = require("./caml_builtin_exceptions"); - -function init(l, f) { - if (l) { - if (l < 0) { - throw [ - Caml_builtin_exceptions.invalid_argument, - "Array.init" - ]; - } - else { - var res = Caml_array.caml_make_vect(l, Curry._1(f, 0)); - for(var i = 1 ,i_finish = l - 1 | 0; i <= i_finish; ++i){ - res[i] = Curry._1(f, i); - } - return res; - } - } - else { - return /* array */[]; - } -} - -function make_matrix(sx, sy, init) { - var res = Caml_array.caml_make_vect(sx, /* array */[]); - for(var x = 0 ,x_finish = sx - 1 | 0; x <= x_finish; ++x){ - res[x] = Caml_array.caml_make_vect(sy, init); - } - return res; -} - -function copy(a) { - var l = a.length; - if (l) { - return Caml_array.caml_array_sub(a, 0, l); - } - else { - return /* array */[]; - } -} - -function append(a1, a2) { - var l1 = a1.length; - if (l1) { - if (a2.length) { - return a1.concat(a2); - } - else { - return Caml_array.caml_array_sub(a1, 0, l1); - } - } - else { - return copy(a2); - } -} - -function sub(a, ofs, len) { - if (len < 0 || ofs > (a.length - len | 0)) { - throw [ - Caml_builtin_exceptions.invalid_argument, - "Array.sub" - ]; - } - else { - return Caml_array.caml_array_sub(a, ofs, len); - } -} - -function fill(a, ofs, len, v) { - if (ofs < 0 || len < 0 || ofs > (a.length - len | 0)) { - throw [ - Caml_builtin_exceptions.invalid_argument, - "Array.fill" - ]; - } - else { - for(var i = ofs ,i_finish = (ofs + len | 0) - 1 | 0; i <= i_finish; ++i){ - a[i] = v; - } - return /* () */0; - } -} - -function blit(a1, ofs1, a2, ofs2, len) { - if (len < 0 || ofs1 < 0 || ofs1 > (a1.length - len | 0) || ofs2 < 0 || ofs2 > (a2.length - len | 0)) { - throw [ - Caml_builtin_exceptions.invalid_argument, - "Array.blit" - ]; - } - else { - return Caml_array.caml_array_blit(a1, ofs1, a2, ofs2, len); - } -} - -function iter(f, a) { - for(var i = 0 ,i_finish = a.length - 1 | 0; i <= i_finish; ++i){ - Curry._1(f, a[i]); - } - return /* () */0; -} - -function map(f, a) { - var l = a.length; - if (l) { - var r = Caml_array.caml_make_vect(l, Curry._1(f, a[0])); - for(var i = 1 ,i_finish = l - 1 | 0; i <= i_finish; ++i){ - r[i] = Curry._1(f, a[i]); - } - return r; - } - else { - return /* array */[]; - } -} - -function iteri(f, a) { - for(var i = 0 ,i_finish = a.length - 1 | 0; i <= i_finish; ++i){ - Curry._2(f, i, a[i]); - } - return /* () */0; -} - -function mapi(f, a) { - var l = a.length; - if (l) { - var r = Caml_array.caml_make_vect(l, Curry._2(f, 0, a[0])); - for(var i = 1 ,i_finish = l - 1 | 0; i <= i_finish; ++i){ - r[i] = Curry._2(f, i, a[i]); - } - return r; - } - else { - return /* array */[]; - } -} - -function to_list(a) { - var _i = a.length - 1 | 0; - var _res = /* [] */0; - while(true) { - var res = _res; - var i = _i; - if (i < 0) { - return res; - } - else { - _res = /* :: */[ - a[i], - res - ]; - _i = i - 1 | 0; - continue ; - - } - }; -} - -function list_length(_accu, _param) { - while(true) { - var param = _param; - var accu = _accu; - if (param) { - _param = param[1]; - _accu = accu + 1 | 0; - continue ; - - } - else { - return accu; - } - }; -} - -function of_list(l) { - if (l) { - var a = Caml_array.caml_make_vect(list_length(0, l), l[0]); - var _i = 1; - var _param = l[1]; - while(true) { - var param = _param; - var i = _i; - if (param) { - a[i] = param[0]; - _param = param[1]; - _i = i + 1 | 0; - continue ; - - } - else { - return a; - } - }; - } - else { - return /* array */[]; - } -} - -function fold_left(f, x, a) { - var r = x; - for(var i = 0 ,i_finish = a.length - 1 | 0; i <= i_finish; ++i){ - r = Curry._2(f, r, a[i]); - } - return r; -} - -function fold_right(f, a, x) { - var r = x; - for(var i = a.length - 1 | 0; i >= 0; --i){ - r = Curry._2(f, a[i], r); - } - return r; -} - -var Bottom = Caml_exceptions.create("Array.Bottom"); - -function sort(cmp, a) { - var maxson = function (l, i) { - var i31 = ((i + i | 0) + i | 0) + 1 | 0; - var x = i31; - if ((i31 + 2 | 0) < l) { - if (Curry._2(cmp, a[i31], a[i31 + 1 | 0]) < 0) { - x = i31 + 1 | 0; - } - if (Curry._2(cmp, a[x], a[i31 + 2 | 0]) < 0) { - x = i31 + 2 | 0; - } - return x; - } - else if ((i31 + 1 | 0) < l && Curry._2(cmp, a[i31], a[i31 + 1 | 0]) < 0) { - return i31 + 1 | 0; - } - else if (i31 < l) { - return i31; - } - else { - throw [ - Bottom, - i - ]; - } - }; - var trickle = function (l, i, e) { - try { - var l$1 = l; - var _i = i; - var e$1 = e; - while(true) { - var i$1 = _i; - var j = maxson(l$1, i$1); - if (Curry._2(cmp, a[j], e$1) > 0) { - a[i$1] = a[j]; - _i = j; - continue ; - - } - else { - a[i$1] = e$1; - return /* () */0; - } - }; - } - catch (exn){ - if (exn[0] === Bottom) { - a[exn[1]] = e; - return /* () */0; - } - else { - throw exn; - } - } - }; - var bubble = function (l, i) { - try { - var l$1 = l; - var _i = i; - while(true) { - var i$1 = _i; - var j = maxson(l$1, i$1); - a[i$1] = a[j]; - _i = j; - continue ; - - }; - } - catch (exn){ - if (exn[0] === Bottom) { - return exn[1]; - } - else { - throw exn; - } - } - }; - var trickleup = function (_i, e) { - while(true) { - var i = _i; - var father = (i - 1 | 0) / 3 | 0; - if (i === father) { - throw [ - Caml_builtin_exceptions.assert_failure, - [ - "array.ml", - 168, - 4 - ] - ]; - } - if (Curry._2(cmp, a[father], e) < 0) { - a[i] = a[father]; - if (father > 0) { - _i = father; - continue ; - - } - else { - a[0] = e; - return /* () */0; - } - } - else { - a[i] = e; - return /* () */0; - } - }; - }; - var l = a.length; - for(var i = ((l + 1 | 0) / 3 | 0) - 1 | 0; i >= 0; --i){ - trickle(l, i, a[i]); - } - for(var i$1 = l - 1 | 0; i$1 >= 2; --i$1){ - var e = a[i$1]; - a[i$1] = a[0]; - trickleup(bubble(i$1, 0), e); - } - if (l > 1) { - var e$1 = a[1]; - a[1] = a[0]; - a[0] = e$1; - return /* () */0; - } - else { - return 0; - } -} - -function stable_sort(cmp, a) { - var merge = function (src1ofs, src1len, src2, src2ofs, src2len, dst, dstofs) { - var src1r = src1ofs + src1len | 0; - var src2r = src2ofs + src2len | 0; - var _i1 = src1ofs; - var _s1 = a[src1ofs]; - var _i2 = src2ofs; - var _s2 = src2[src2ofs]; - var _d = dstofs; - while(true) { - var d = _d; - var s2 = _s2; - var i2 = _i2; - var s1 = _s1; - var i1 = _i1; - if (Curry._2(cmp, s1, s2) <= 0) { - dst[d] = s1; - var i1$1 = i1 + 1 | 0; - if (i1$1 < src1r) { - _d = d + 1 | 0; - _s1 = a[i1$1]; - _i1 = i1$1; - continue ; - - } - else { - return blit(src2, i2, dst, d + 1 | 0, src2r - i2 | 0); - } - } - else { - dst[d] = s2; - var i2$1 = i2 + 1 | 0; - if (i2$1 < src2r) { - _d = d + 1 | 0; - _s2 = src2[i2$1]; - _i2 = i2$1; - continue ; - - } - else { - return blit(a, i1, dst, d + 1 | 0, src1r - i1 | 0); - } - } - }; - }; - var isortto = function (srcofs, dst, dstofs, len) { - for(var i = 0 ,i_finish = len - 1 | 0; i <= i_finish; ++i){ - var e = a[srcofs + i | 0]; - var j = (dstofs + i | 0) - 1 | 0; - while(j >= dstofs && Curry._2(cmp, dst[j], e) > 0) { - dst[j + 1 | 0] = dst[j]; - j = j - 1 | 0; - }; - dst[j + 1 | 0] = e; - } - return /* () */0; - }; - var sortto = function (srcofs, dst, dstofs, len) { - if (len <= 5) { - return isortto(srcofs, dst, dstofs, len); - } - else { - var l1 = len / 2 | 0; - var l2 = len - l1 | 0; - sortto(srcofs + l1 | 0, dst, dstofs + l1 | 0, l2); - sortto(srcofs, a, srcofs + l2 | 0, l1); - return merge(srcofs + l2 | 0, l1, dst, dstofs + l1 | 0, l2, dst, dstofs); - } - }; - var l = a.length; - if (l <= 5) { - return isortto(0, a, 0, l); - } - else { - var l1 = l / 2 | 0; - var l2 = l - l1 | 0; - var t = Caml_array.caml_make_vect(l2, a[0]); - sortto(l1, t, 0, l2); - sortto(0, a, l2, l1); - return merge(l2, l1, t, 0, l2, a, 0); - } -} - -var create_matrix = make_matrix; - -var concat = Caml_array.caml_array_concat; - -var fast_sort = stable_sort; - -exports.init = init; -exports.make_matrix = make_matrix; -exports.create_matrix = create_matrix; -exports.append = append; -exports.concat = concat; -exports.sub = sub; -exports.copy = copy; -exports.fill = fill; -exports.blit = blit; -exports.to_list = to_list; -exports.of_list = of_list; -exports.iter = iter; -exports.map = map; -exports.iteri = iteri; -exports.mapi = mapi; -exports.fold_left = fold_left; -exports.fold_right = fold_right; -exports.sort = sort; -exports.stable_sort = stable_sort; -exports.fast_sort = fast_sort; -/* No side effect */ -//////// end of array.js //////// -    return exports; -  }; - - - _registry['ast'] = function() { -    let exports = {}; -//////// start of ast.js //////// -// Generated by BUCKLESCRIPT VERSION 1.4.3 , PLEASE EDIT WITH CARE -'use strict'; - -var Lib = require("./lib"); -var Block = require("bs-platform/lib/js/block"); -var Curry = require("bs-platform/lib/js/curry"); -var Caml_obj = require("bs-platform/lib/js/caml_obj"); - -var IntOp = /* module */[]; - -var FloatOp = /* module */[]; - -function export_kind_of_import_kind(param) { - switch (param.tag | 0) { - case 0 : - return /* FuncExport */0; - case 1 : - return /* TableExport */1; - case 2 : - return /* MemoryExport */2; - case 3 : - return /* GlobalExport */3; - - } -} - -function import_type(m, im) { - var match = im[/* it */1]; - var match$1 = match[/* ikind */2][/* it */1]; - switch (match$1.tag | 0) { - case 0 : - return /* ExternalFuncType */Block.__(0, [Curry._2(Lib.List32[/* nth */1], m[/* it */1][/* types */0], match$1[0][/* it */1])]); - case 1 : - return /* ExternalTableType */Block.__(1, [match$1[0]]); - case 2 : - return /* ExternalMemoryType */Block.__(2, [match$1[0]]); - case 3 : - return /* ExternalGlobalType */Block.__(3, [match$1[0]]); - - } -} - -function export_type(m, ex) { - var match = ex[/* it */1]; - var ekind = match[/* ekind */1]; - var _i = match[/* item */2][/* it */1]; - var _param = m[/* it */1][/* imports */8]; - while(true) { - var param = _param; - var i = _i; - if (param) { - var ims = param[1]; - var im = param[0]; - if (Caml_obj.caml_equal(export_kind_of_import_kind(im[/* it */1][/* ikind */2][/* it */1]), ekind[/* it */1])) { - if (i) { - _param = ims; - _i = i - 1 | 0; - continue ; - - } - else { - return import_type(m, im); - } - } - else { - _param = ims; - continue ; - - } - } - else { - var match$1 = ekind[/* it */1]; - switch (match$1) { - case 0 : - return /* ExternalFuncType */Block.__(0, [Curry._2(Lib.List32[/* nth */1], m[/* it */1][/* types */0], Curry._2(Lib.List32[/* nth */1], m[/* it */1][/* funcs */4], i)[/* it */1][/* ftype */0][/* it */1])]); - case 1 : - return /* ExternalTableType */Block.__(1, [Curry._2(Lib.List32[/* nth */1], m[/* it */1][/* tables */2], i)[/* it */1][/* ttype */0]]); - case 2 : - return /* ExternalMemoryType */Block.__(2, [Curry._2(Lib.List32[/* nth */1], m[/* it */1][/* memories */3], i)[/* it */1][/* mtype */0]]); - case 3 : - return /* ExternalGlobalType */Block.__(3, [Curry._2(Lib.List32[/* nth */1], m[/* it */1][/* globals */1], i)[/* it */1][/* gtype */0]]); - - } - } - }; -} - -var I32Op = 0; - -var I64Op = 0; - -var F32Op = 0; - -var F64Op = 0; - -var empty_module = /* record */[ - /* types : [] */0, - /* globals : [] */0, - /* tables : [] */0, - /* memories : [] */0, - /* funcs : [] */0, - /* start : None */0, - /* elems : [] */0, - /* data : [] */0, - /* imports : [] */0, - /* exports : [] */0 -]; - -exports.IntOp = IntOp; -exports.FloatOp = FloatOp; -exports.I32Op = I32Op; -exports.I64Op = I64Op; -exports.F32Op = F32Op; -exports.F64Op = F64Op; -exports.empty_module = empty_module; -exports.export_kind_of_import_kind = export_kind_of_import_kind; -exports.import_type = import_type; -exports.export_type = export_type; -/* Lib Not a pure module */ -//////// end of ast.js //////// -    return exports; -  }; - - - _registry['bigarray'] = function() { -    let exports = {}; -//////// start of bigarray.js //////// -'use strict'; - -var Caml_array = require("./caml_array"); -var Caml_builtin_exceptions = require("./caml_builtin_exceptions"); - -function dims() { - var n = function () { - throw "caml_ba_num_dims not implemented by bucklescript yet\n"; - }(); - var d = Caml_array.caml_make_vect(n, 0); - for(var i = 0 ,i_finish = n - 1 | 0; i <= i_finish; ++i){ - d[i] = function () { - throw "caml_ba_dim not implemented by bucklescript yet\n"; - }(); - } - return d; -} - -function map_file(_, $staropt$star, _$1, _$2, _$3, _$4) { - $staropt$star ? $staropt$star[0] : /* int64 */[ - /* hi */0, - /* lo */0 - ]; - return function () { - throw "caml_ba_map_file_bytecode not implemented by bucklescript yet\n"; - }(); -} - -var Genarray = /* module */[ - /* dims */dims, - /* map_file */map_file -]; - -function create(_, _$1, _$2) { - return function () { - throw "caml_ba_create not implemented by bucklescript yet\n"; - }(); -} - -function of_array(kind, layout, data) { - var ba = create(kind, layout, data.length); - layout !== 0 ? 1 : 0; - for(var i = 0 ,i_finish = data.length - 1 | 0; i <= i_finish; ++i){ - (function () { - throw "caml_ba_set_1 not implemented by bucklescript yet\n"; - }()); - } - return ba; -} - -function map_file$1(fd, pos, kind, layout, shared, dim) { - return map_file(fd, pos, kind, layout, shared, /* int array */[dim]); -} - -var Array1 = /* module */[ - /* create */create, - /* of_array */of_array, - /* map_file */map_file$1 -]; - -function create$1(_, _$1, _$2, _$3) { - return function () { - throw "caml_ba_create not implemented by bucklescript yet\n"; - }(); -} - -function slice_left(_, _$1) { - return function () { - throw "caml_ba_slice not implemented by bucklescript yet\n"; - }(); -} - -function slice_right(_, _$1) { - return function () { - throw "caml_ba_slice not implemented by bucklescript yet\n"; - }(); -} - -function of_array$1(kind, layout, data) { - var dim1 = data.length; - var dim2 = dim1 ? data[0].length : 0; - var ba = create$1(kind, layout, dim1, dim2); - layout !== 0 ? 1 : 0; - for(var i = 0 ,i_finish = dim1 - 1 | 0; i <= i_finish; ++i){ - var row = data[i]; - if (row.length !== dim2) { - throw [ - Caml_builtin_exceptions.invalid_argument, - "Bigarray.Array2.of_array: non-rectangular data" - ]; - } - for(var j = 0 ,j_finish = dim2 - 1 | 0; j <= j_finish; ++j){ - (function () { - throw "caml_ba_set_2 not implemented by bucklescript yet\n"; - }()); - } - } - return ba; -} - -function map_file$2(fd, pos, kind, layout, shared, dim1, dim2) { - return map_file(fd, pos, kind, layout, shared, /* int array */[ - dim1, - dim2 - ]); -} - -var Array2 = /* module */[ - /* create */create$1, - /* slice_left */slice_left, - /* slice_right */slice_right, - /* of_array */of_array$1, - /* map_file */map_file$2 -]; - -function create$2(_, _$1, _$2, _$3, _$4) { - return function () { - throw "caml_ba_create not implemented by bucklescript yet\n"; - }(); -} - -function slice_left_1(_, _$1, _$2) { - return function () { - throw "caml_ba_slice not implemented by bucklescript yet\n"; - }(); -} - -function slice_right_1(_, _$1, _$2) { - return function () { - throw "caml_ba_slice not implemented by bucklescript yet\n"; - }(); -} - -function slice_left_2(_, _$1) { - return function () { - throw "caml_ba_slice not implemented by bucklescript yet\n"; - }(); -} - -function slice_right_2(_, _$1) { - return function () { - throw "caml_ba_slice not implemented by bucklescript yet\n"; - }(); -} - -function of_array$2(kind, layout, data) { - var dim1 = data.length; - var dim2 = dim1 ? data[0].length : 0; - var dim3 = dim2 ? data[0][0].length : 0; - var ba = create$2(kind, layout, dim1, dim2, dim3); - layout !== 0 ? 1 : 0; - for(var i = 0 ,i_finish = dim1 - 1 | 0; i <= i_finish; ++i){ - var row = data[i]; - if (row.length !== dim2) { - throw [ - Caml_builtin_exceptions.invalid_argument, - "Bigarray.Array3.of_array: non-cubic data" - ]; - } - for(var j = 0 ,j_finish = dim2 - 1 | 0; j <= j_finish; ++j){ - var col = row[j]; - if (col.length !== dim3) { - throw [ - Caml_builtin_exceptions.invalid_argument, - "Bigarray.Array3.of_array: non-cubic data" - ]; - } - for(var k = 0 ,k_finish = dim3 - 1 | 0; k <= k_finish; ++k){ - (function () { - throw "caml_ba_set_3 not implemented by bucklescript yet\n"; - }()); - } - } - } - return ba; -} - -function map_file$3(fd, pos, kind, layout, shared, dim1, dim2, dim3) { - return map_file(fd, pos, kind, layout, shared, /* int array */[ - dim1, - dim2, - dim3 - ]); -} - -var Array3 = /* module */[ - /* create */create$2, - /* slice_left_1 */slice_left_1, - /* slice_right_1 */slice_right_1, - /* slice_left_2 */slice_left_2, - /* slice_right_2 */slice_right_2, - /* of_array */of_array$2, - /* map_file */map_file$3 -]; - -function array1_of_genarray(a) { - if (function () { - throw "caml_ba_num_dims not implemented by bucklescript yet\n"; - }() === 1) { - return a; - } - else { - throw [ - Caml_builtin_exceptions.invalid_argument, - "Bigarray.array1_of_genarray" - ]; - } -} - -function array2_of_genarray(a) { - if (function () { - throw "caml_ba_num_dims not implemented by bucklescript yet\n"; - }() === 2) { - return a; - } - else { - throw [ - Caml_builtin_exceptions.invalid_argument, - "Bigarray.array2_of_genarray" - ]; - } -} - -function array3_of_genarray(a) { - if (function () { - throw "caml_ba_num_dims not implemented by bucklescript yet\n"; - }() === 3) { - return a; - } - else { - throw [ - Caml_builtin_exceptions.invalid_argument, - "Bigarray.array3_of_genarray" - ]; - } -} - -function reshape_1(_, _$1) { - return function () { - throw "caml_ba_reshape not implemented by bucklescript yet\n"; - }(); -} - -function reshape_2(_, _$1, _$2) { - return function () { - throw "caml_ba_reshape not implemented by bucklescript yet\n"; - }(); -} - -function reshape_3(_, _$1, _$2, _$3) { - return function () { - throw "caml_ba_reshape not implemented by bucklescript yet\n"; - }(); -} - -var float32 = /* Float32 */0; - -var float64 = /* Float64 */1; - -var complex32 = /* Complex32 */10; - -var complex64 = /* Complex64 */11; - -var int8_signed = /* Int8_signed */2; - -var int8_unsigned = /* Int8_unsigned */3; - -var int16_signed = /* Int16_signed */4; - -var int16_unsigned = /* Int16_unsigned */5; - -var $$int = /* Int */8; - -var int32 = /* Int32 */6; - -var int64 = /* Int64 */7; - -var nativeint = /* Nativeint */9; - -var $$char = /* Char */12; - -var c_layout = /* C_layout */0; - -var fortran_layout = /* Fortran_layout */1; - -function reshape(_, _$1) { - return function () { - throw "caml_ba_reshape not implemented by bucklescript yet\n"; - }(); -} - -exports.float32 = float32; -exports.float64 = float64; -exports.complex32 = complex32; -exports.complex64 = complex64; -exports.int8_signed = int8_signed; -exports.int8_unsigned = int8_unsigned; -exports.int16_signed = int16_signed; -exports.int16_unsigned = int16_unsigned; -exports.$$int = $$int; -exports.int32 = int32; -exports.int64 = int64; -exports.nativeint = nativeint; -exports.$$char = $$char; -exports.c_layout = c_layout; -exports.fortran_layout = fortran_layout; -exports.Genarray = Genarray; -exports.Array1 = Array1; -exports.Array2 = Array2; -exports.Array3 = Array3; -exports.array1_of_genarray = array1_of_genarray; -exports.array2_of_genarray = array2_of_genarray; -exports.array3_of_genarray = array3_of_genarray; -exports.reshape = reshape; -exports.reshape_1 = reshape_1; -exports.reshape_2 = reshape_2; -exports.reshape_3 = reshape_3; -/* Not a pure module */ -//////// end of bigarray.js //////// -    return exports; -  }; - - - _registry['block'] = function() { -    let exports = {}; -//////// start of block.js //////// -'use strict'; - - -function __(tag, block) { - block.tag = tag; - return block; -} - -exports.__ = __; -/* No side effect */ -//////// end of block.js //////// -    return exports; -  }; - - - _registry['buffer'] = function() { -    let exports = {}; -//////// start of buffer.js //////// -'use strict'; - -var Sys = require("./sys"); -var Bytes = require("./bytes"); -var Curry = require("./curry"); -var $$String = require("./string"); -var Pervasives = require("./pervasives"); -var Caml_string = require("./caml_string"); -var Caml_builtin_exceptions = require("./caml_builtin_exceptions"); - -function create(n) { - var n$1 = n < 1 ? 1 : n; - var n$2 = n$1 > Sys.max_string_length ? Sys.max_string_length : n$1; - var s = Caml_string.caml_create_string(n$2); - return /* record */[ - /* buffer */s, - /* position */0, - /* length */n$2, - /* initial_buffer */s - ]; -} - -function contents(b) { - return Bytes.sub_string(b[/* buffer */0], 0, b[/* position */1]); -} - -function to_bytes(b) { - return Bytes.sub(b[/* buffer */0], 0, b[/* position */1]); -} - -function sub(b, ofs, len) { - if (ofs < 0 || len < 0 || ofs > (b[/* position */1] - len | 0)) { - throw [ - Caml_builtin_exceptions.invalid_argument, - "Buffer.sub" - ]; - } - else { - return Bytes.sub_string(b[/* buffer */0], ofs, len); - } -} - -function blit(src, srcoff, dst, dstoff, len) { - if (len < 0 || srcoff < 0 || srcoff > (src[/* position */1] - len | 0) || dstoff < 0 || dstoff > (dst.length - len | 0)) { - throw [ - Caml_builtin_exceptions.invalid_argument, - "Buffer.blit" - ]; - } - else { - return Bytes.blit(src[/* buffer */0], srcoff, dst, dstoff, len); - } -} - -function nth(b, ofs) { - if (ofs < 0 || ofs >= b[/* position */1]) { - throw [ - Caml_builtin_exceptions.invalid_argument, - "Buffer.nth" - ]; - } - else { - return b[/* buffer */0][ofs]; - } -} - -function length(b) { - return b[/* position */1]; -} - -function clear(b) { - b[/* position */1] = 0; - return /* () */0; -} - -function reset(b) { - b[/* position */1] = 0; - b[/* buffer */0] = b[/* initial_buffer */3]; - b[/* length */2] = b[/* buffer */0].length; - return /* () */0; -} - -function resize(b, more) { - var len = b[/* length */2]; - var new_len = len; - while((b[/* position */1] + more | 0) > new_len) { - new_len = (new_len << 1); - }; - if (new_len > Sys.max_string_length) { - if ((b[/* position */1] + more | 0) <= Sys.max_string_length) { - new_len = Sys.max_string_length; - } - else { - throw [ - Caml_builtin_exceptions.failure, - "Buffer.add: cannot grow buffer" - ]; - } - } - var new_buffer = Caml_string.caml_create_string(new_len); - Bytes.blit(b[/* buffer */0], 0, new_buffer, 0, b[/* position */1]); - b[/* buffer */0] = new_buffer; - b[/* length */2] = new_len; - return /* () */0; -} - -function add_char(b, c) { - var pos = b[/* position */1]; - if (pos >= b[/* length */2]) { - resize(b, 1); - } - b[/* buffer */0][pos] = c; - b[/* position */1] = pos + 1 | 0; - return /* () */0; -} - -function add_substring(b, s, offset, len) { - if (offset < 0 || len < 0 || (offset + len | 0) > s.length) { - throw [ - Caml_builtin_exceptions.invalid_argument, - "Buffer.add_substring/add_subbytes" - ]; - } - var new_position = b[/* position */1] + len | 0; - if (new_position > b[/* length */2]) { - resize(b, len); - } - Bytes.blit_string(s, offset, b[/* buffer */0], b[/* position */1], len); - b[/* position */1] = new_position; - return /* () */0; -} - -function add_subbytes(b, s, offset, len) { - return add_substring(b, Caml_string.bytes_to_string(s), offset, len); -} - -function add_string(b, s) { - var len = s.length; - var new_position = b[/* position */1] + len | 0; - if (new_position > b[/* length */2]) { - resize(b, len); - } - Bytes.blit_string(s, 0, b[/* buffer */0], b[/* position */1], len); - b[/* position */1] = new_position; - return /* () */0; -} - -function add_bytes(b, s) { - return add_string(b, Caml_string.bytes_to_string(s)); -} - -function add_buffer(b, bs) { - return add_subbytes(b, bs[/* buffer */0], 0, bs[/* position */1]); -} - -function add_channel(b, ic, len) { - if (len < 0 || len > Sys.max_string_length) { - throw [ - Caml_builtin_exceptions.invalid_argument, - "Buffer.add_channel" - ]; - } - if ((b[/* position */1] + len | 0) > b[/* length */2]) { - resize(b, len); - } - Pervasives.really_input(ic, b[/* buffer */0], b[/* position */1], len); - b[/* position */1] = b[/* position */1] + len | 0; - return /* () */0; -} - -function output_buffer(oc, b) { - return Pervasives.output(oc, b[/* buffer */0], 0, b[/* position */1]); -} - -function closing(param) { - if (param !== 40) { - if (param !== 123) { - throw [ - Caml_builtin_exceptions.assert_failure, - [ - "buffer.ml", - 115, - 9 - ] - ]; - } - else { - return /* "}" */125; - } - } - else { - return /* ")" */41; - } -} - -function advance_to_closing(opening, closing, k, s, start) { - var _k = k; - var _i = start; - var lim = s.length; - while(true) { - var i = _i; - var k$1 = _k; - if (i >= lim) { - throw Caml_builtin_exceptions.not_found; - } - else if (Caml_string.get(s, i) === opening) { - _i = i + 1 | 0; - _k = k$1 + 1 | 0; - continue ; - - } - else if (Caml_string.get(s, i) === closing) { - if (k$1) { - _i = i + 1 | 0; - _k = k$1 - 1 | 0; - continue ; - - } - else { - return i; - } - } - else { - _i = i + 1 | 0; - continue ; - - } - }; -} - -function advance_to_non_alpha(s, start) { - var _i = start; - var lim = s.length; - while(true) { - var i = _i; - if (i >= lim) { - return lim; - } - else { - var match = Caml_string.get(s, i); - var exit = 0; - if (match >= 91) { - if (match >= 97) { - if (match >= 123) { - return i; - } - else { - exit = 1; - } - } - else if (match !== 95) { - return i; - } - else { - exit = 1; - } - } - else if (match >= 58) { - if (match >= 65) { - exit = 1; - } - else { - return i; - } - } - else if (match >= 48) { - exit = 1; - } - else { - return i; - } - if (exit === 1) { - _i = i + 1 | 0; - continue ; - - } - - } - }; -} - -function find_ident(s, start, lim) { - if (start >= lim) { - throw Caml_builtin_exceptions.not_found; - } - else { - var c = Caml_string.get(s, start); - var exit = 0; - if (c !== 40) { - if (c !== 123) { - var stop = advance_to_non_alpha(s, start + 1 | 0); - return /* tuple */[ - $$String.sub(s, start, stop - start | 0), - stop - ]; - } - else { - exit = 1; - } - } - else { - exit = 1; - } - if (exit === 1) { - var new_start = start + 1 | 0; - var stop$1 = advance_to_closing(c, closing(c), 0, s, new_start); - return /* tuple */[ - $$String.sub(s, new_start, (stop$1 - start | 0) - 1 | 0), - stop$1 + 1 | 0 - ]; - } - - } -} - -function add_substitute(b, f, s) { - var lim = s.length; - var _previous = /* " " */32; - var _i = 0; - while(true) { - var i = _i; - var previous = _previous; - if (i < lim) { - var current = Caml_string.get(s, i); - if (current !== 36) { - if (previous === /* "\\" */92) { - add_char(b, /* "\\" */92); - add_char(b, current); - _i = i + 1 | 0; - _previous = /* " " */32; - continue ; - - } - else if (current !== 92) { - add_char(b, current); - _i = i + 1 | 0; - _previous = current; - continue ; - - } - else { - _i = i + 1 | 0; - _previous = current; - continue ; - - } - } - else if (previous === /* "\\" */92) { - add_char(b, current); - _i = i + 1 | 0; - _previous = /* " " */32; - continue ; - - } - else { - var j = i + 1 | 0; - var match = find_ident(s, j, lim); - add_string(b, Curry._1(f, match[0])); - _i = match[1]; - _previous = /* " " */32; - continue ; - - } - } - else if (previous === /* "\\" */92) { - return add_char(b, previous); - } - else { - return 0; - } - }; -} - -exports.create = create; -exports.contents = contents; -exports.to_bytes = to_bytes; -exports.sub = sub; -exports.blit = blit; -exports.nth = nth; -exports.length = length; -exports.clear = clear; -exports.reset = reset; -exports.add_char = add_char; -exports.add_string = add_string; -exports.add_bytes = add_bytes; -exports.add_substring = add_substring; -exports.add_subbytes = add_subbytes; -exports.add_substitute = add_substitute; -exports.add_buffer = add_buffer; -exports.add_channel = add_channel; -exports.output_buffer = output_buffer; -/* No side effect */ -//////// end of buffer.js //////// -    return exports; -  }; - - - _registry['bytes'] = function() { -    let exports = {}; -//////// start of bytes.js //////// -'use strict'; - -var Char = require("./char"); -var List = require("./list"); -var Curry = require("./curry"); -var Caml_obj = require("./caml_obj"); -var Caml_int32 = require("./caml_int32"); -var Pervasives = require("./pervasives"); -var Caml_string = require("./caml_string"); -var Caml_builtin_exceptions = require("./caml_builtin_exceptions"); - -function make(n, c) { - var s = Caml_string.caml_create_string(n); - Caml_string.caml_fill_string(s, 0, n, c); - return s; -} - -function init(n, f) { - var s = Caml_string.caml_create_string(n); - for(var i = 0 ,i_finish = n - 1 | 0; i <= i_finish; ++i){ - s[i] = Curry._1(f, i); - } - return s; -} - -var empty = []; - -function copy(s) { - var len = s.length; - var r = Caml_string.caml_create_string(len); - Caml_string.caml_blit_bytes(s, 0, r, 0, len); - return r; -} - -function to_string(b) { - return Caml_string.bytes_to_string(copy(b)); -} - -function of_string(s) { - return copy(Caml_string.bytes_of_string(s)); -} - -function sub(s, ofs, len) { - if (ofs < 0 || len < 0 || ofs > (s.length - len | 0)) { - throw [ - Caml_builtin_exceptions.invalid_argument, - "String.sub / Bytes.sub" - ]; - } - else { - var r = Caml_string.caml_create_string(len); - Caml_string.caml_blit_bytes(s, ofs, r, 0, len); - return r; - } -} - -function sub_string(b, ofs, len) { - return Caml_string.bytes_to_string(sub(b, ofs, len)); -} - -function extend(s, left, right) { - var len = (s.length + left | 0) + right | 0; - var r = Caml_string.caml_create_string(len); - var match = left < 0 ? /* tuple */[ - -left | 0, - 0 - ] : /* tuple */[ - 0, - left - ]; - var dstoff = match[1]; - var srcoff = match[0]; - var cpylen = Pervasives.min(s.length - srcoff | 0, len - dstoff | 0); - if (cpylen > 0) { - Caml_string.caml_blit_bytes(s, srcoff, r, dstoff, cpylen); - } - return r; -} - -function fill(s, ofs, len, c) { - if (ofs < 0 || len < 0 || ofs > (s.length - len | 0)) { - throw [ - Caml_builtin_exceptions.invalid_argument, - "String.fill / Bytes.fill" - ]; - } - else { - return Caml_string.caml_fill_string(s, ofs, len, c); - } -} - -function blit(s1, ofs1, s2, ofs2, len) { - if (len < 0 || ofs1 < 0 || ofs1 > (s1.length - len | 0) || ofs2 < 0 || ofs2 > (s2.length - len | 0)) { - throw [ - Caml_builtin_exceptions.invalid_argument, - "Bytes.blit" - ]; - } - else { - return Caml_string.caml_blit_bytes(s1, ofs1, s2, ofs2, len); - } -} - -function blit_string(s1, ofs1, s2, ofs2, len) { - if (len < 0 || ofs1 < 0 || ofs1 > (s1.length - len | 0) || ofs2 < 0 || ofs2 > (s2.length - len | 0)) { - throw [ - Caml_builtin_exceptions.invalid_argument, - "String.blit / Bytes.blit_string" - ]; - } - else { - return Caml_string.caml_blit_string(s1, ofs1, s2, ofs2, len); - } -} - -function iter(f, a) { - for(var i = 0 ,i_finish = a.length - 1 | 0; i <= i_finish; ++i){ - Curry._1(f, a[i]); - } - return /* () */0; -} - -function iteri(f, a) { - for(var i = 0 ,i_finish = a.length - 1 | 0; i <= i_finish; ++i){ - Curry._2(f, i, a[i]); - } - return /* () */0; -} - -function concat(sep, l) { - if (l) { - var hd = l[0]; - var num = [0]; - var len = [0]; - List.iter(function (s) { - num[0] = num[0] + 1 | 0; - len[0] = len[0] + s.length | 0; - return /* () */0; - }, l); - var r = Caml_string.caml_create_string(len[0] + Caml_int32.imul(sep.length, num[0] - 1 | 0) | 0); - Caml_string.caml_blit_bytes(hd, 0, r, 0, hd.length); - var pos = [hd.length]; - List.iter(function (s) { - Caml_string.caml_blit_bytes(sep, 0, r, pos[0], sep.length); - pos[0] = pos[0] + sep.length | 0; - Caml_string.caml_blit_bytes(s, 0, r, pos[0], s.length); - pos[0] = pos[0] + s.length | 0; - return /* () */0; - }, l[1]); - return r; - } - else { - return empty; - } -} - -function cat(a, b) { - return a.concat(b); -} - -function is_space(param) { - var switcher = param - 9 | 0; - if (switcher > 4 || switcher < 0) { - if (switcher !== 23) { - return /* false */0; - } - else { - return /* true */1; - } - } - else if (switcher !== 2) { - return /* true */1; - } - else { - return /* false */0; - } -} - -function trim(s) { - var len = s.length; - var i = 0; - while(i < len && is_space(s[i])) { - i = i + 1 | 0; - }; - var j = len - 1 | 0; - while(j >= i && is_space(s[j])) { - j = j - 1 | 0; - }; - if (j >= i) { - return sub(s, i, (j - i | 0) + 1 | 0); - } - else { - return empty; - } -} - -function escaped(s) { - var n = 0; - for(var i = 0 ,i_finish = s.length - 1 | 0; i <= i_finish; ++i){ - var match = s[i]; - var $js; - if (match >= 32) { - var switcher = match - 34 | 0; - $js = switcher > 58 || switcher < 0 ? ( - switcher >= 93 ? 4 : 1 - ) : ( - switcher > 57 || switcher < 1 ? 2 : 1 - ); - } - else { - $js = match >= 11 ? ( - match !== 13 ? 4 : 2 - ) : ( - match >= 8 ? 2 : 4 - ); - } - n = n + $js | 0; - } - if (n === s.length) { - return copy(s); - } - else { - var s$prime = Caml_string.caml_create_string(n); - n = 0; - for(var i$1 = 0 ,i_finish$1 = s.length - 1 | 0; i$1 <= i_finish$1; ++i$1){ - var c = s[i$1]; - var exit = 0; - if (c >= 35) { - if (c !== 92) { - if (c >= 127) { - exit = 1; - } - else { - s$prime[n] = c; - } - } - else { - exit = 2; - } - } - else if (c >= 32) { - if (c >= 34) { - exit = 2; - } - else { - s$prime[n] = c; - } - } - else if (c >= 14) { - exit = 1; - } - else { - switch (c) { - case 8 : - s$prime[n] = /* "\\" */92; - n = n + 1 | 0; - s$prime[n] = /* "b" */98; - break; - case 9 : - s$prime[n] = /* "\\" */92; - n = n + 1 | 0; - s$prime[n] = /* "t" */116; - break; - case 10 : - s$prime[n] = /* "\\" */92; - n = n + 1 | 0; - s$prime[n] = /* "n" */110; - break; - case 0 : - case 1 : - case 2 : - case 3 : - case 4 : - case 5 : - case 6 : - case 7 : - case 11 : - case 12 : - exit = 1; - break; - case 13 : - s$prime[n] = /* "\\" */92; - n = n + 1 | 0; - s$prime[n] = /* "r" */114; - break; - - } - } - switch (exit) { - case 1 : - s$prime[n] = /* "\\" */92; - n = n + 1 | 0; - s$prime[n] = 48 + (c / 100 | 0) | 0; - n = n + 1 | 0; - s$prime[n] = 48 + (c / 10 | 0) % 10 | 0; - n = n + 1 | 0; - s$prime[n] = 48 + c % 10 | 0; - break; - case 2 : - s$prime[n] = /* "\\" */92; - n = n + 1 | 0; - s$prime[n] = c; - break; - - } - n = n + 1 | 0; - } - return s$prime; - } -} - -function map(f, s) { - var l = s.length; - if (l) { - var r = Caml_string.caml_create_string(l); - for(var i = 0 ,i_finish = l - 1 | 0; i <= i_finish; ++i){ - r[i] = Curry._1(f, s[i]); - } - return r; - } - else { - return s; - } -} - -function mapi(f, s) { - var l = s.length; - if (l) { - var r = Caml_string.caml_create_string(l); - for(var i = 0 ,i_finish = l - 1 | 0; i <= i_finish; ++i){ - r[i] = Curry._2(f, i, s[i]); - } - return r; - } - else { - return s; - } -} - -function uppercase(s) { - return map(Char.uppercase, s); -} - -function lowercase(s) { - return map(Char.lowercase, s); -} - -function apply1(f, s) { - if (s.length) { - var r = copy(s); - r[0] = Curry._1(f, s[0]); - return r; - } - else { - return s; - } -} - -function capitalize(s) { - return apply1(Char.uppercase, s); -} - -function uncapitalize(s) { - return apply1(Char.lowercase, s); -} - -function index_rec(s, lim, _i, c) { - while(true) { - var i = _i; - if (i >= lim) { - throw Caml_builtin_exceptions.not_found; - } - else if (s[i] === c) { - return i; - } - else { - _i = i + 1 | 0; - continue ; - - } - }; -} - -function index(s, c) { - return index_rec(s, s.length, 0, c); -} - -function index_from(s, i, c) { - var l = s.length; - if (i < 0 || i > l) { - throw [ - Caml_builtin_exceptions.invalid_argument, - "String.index_from / Bytes.index_from" - ]; - } - else { - return index_rec(s, l, i, c); - } -} - -function rindex_rec(s, _i, c) { - while(true) { - var i = _i; - if (i < 0) { - throw Caml_builtin_exceptions.not_found; - } - else if (s[i] === c) { - return i; - } - else { - _i = i - 1 | 0; - continue ; - - } - }; -} - -function rindex(s, c) { - return rindex_rec(s, s.length - 1 | 0, c); -} - -function rindex_from(s, i, c) { - if (i < -1 || i >= s.length) { - throw [ - Caml_builtin_exceptions.invalid_argument, - "String.rindex_from / Bytes.rindex_from" - ]; - } - else { - return rindex_rec(s, i, c); - } -} - -function contains_from(s, i, c) { - var l = s.length; - if (i < 0 || i > l) { - throw [ - Caml_builtin_exceptions.invalid_argument, - "String.contains_from / Bytes.contains_from" - ]; - } - else { - try { - index_rec(s, l, i, c); - return /* true */1; - } - catch (exn){ - if (exn === Caml_builtin_exceptions.not_found) { - return /* false */0; - } - else { - throw exn; - } - } - } -} - -function contains(s, c) { - return contains_from(s, 0, c); -} - -function rcontains_from(s, i, c) { - if (i < 0 || i >= s.length) { - throw [ - Caml_builtin_exceptions.invalid_argument, - "String.rcontains_from / Bytes.rcontains_from" - ]; - } - else { - try { - rindex_rec(s, i, c); - return /* true */1; - } - catch (exn){ - if (exn === Caml_builtin_exceptions.not_found) { - return /* false */0; - } - else { - throw exn; - } - } - } -} - -var compare = Caml_obj.caml_compare; - -var unsafe_to_string = Caml_string.bytes_to_string; - -var unsafe_of_string = Caml_string.bytes_of_string; - -exports.make = make; -exports.init = init; -exports.empty = empty; -exports.copy = copy; -exports.of_string = of_string; -exports.to_string = to_string; -exports.sub = sub; -exports.sub_string = sub_string; -exports.extend = extend; -exports.fill = fill; -exports.blit = blit; -exports.blit_string = blit_string; -exports.concat = concat; -exports.cat = cat; -exports.iter = iter; -exports.iteri = iteri; -exports.map = map; -exports.mapi = mapi; -exports.trim = trim; -exports.escaped = escaped; -exports.index = index; -exports.rindex = rindex; -exports.index_from = index_from; -exports.rindex_from = rindex_from; -exports.contains = contains; -exports.contains_from = contains_from; -exports.rcontains_from = rcontains_from; -exports.uppercase = uppercase; -exports.lowercase = lowercase; -exports.capitalize = capitalize; -exports.uncapitalize = uncapitalize; -exports.compare = compare; -exports.unsafe_to_string = unsafe_to_string; -exports.unsafe_of_string = unsafe_of_string; -/* No side effect */ -//////// end of bytes.js //////// -    return exports; -  }; - - - _registry['caml_array'] = function() { -    let exports = {}; -//////// start of caml_array.js //////// -'use strict'; - - -function caml_array_sub(x, offset, len) { - var result = new Array(len); - var j = 0; - var i = offset; - while(j < len) { - result[j] = x[i]; - j = j + 1 | 0; - i = i + 1 | 0; - }; - return result; -} - -function len(_acc, _l) { - while(true) { - var l = _l; - var acc = _acc; - if (l) { - _l = l[1]; - _acc = l[0].length + acc | 0; - continue ; - - } - else { - return acc; - } - }; -} - -function fill(arr, _i, _l) { - while(true) { - var l = _l; - var i = _i; - if (l) { - var x = l[0]; - var l$1 = x.length; - var k = i; - var j = 0; - while(j < l$1) { - arr[k] = x[j]; - k = k + 1 | 0; - j = j + 1 | 0; - }; - _l = l[1]; - _i = k; - continue ; - - } - else { - return /* () */0; - } - }; -} - -function caml_array_concat(l) { - var v = len(0, l); - var result = new Array(v); - fill(result, 0, l); - return result; -} - -function caml_make_vect(len, init) { - var b = new Array(len); - for(var i = 0 ,i_finish = len - 1 | 0; i <= i_finish; ++i){ - b[i] = init; - } - return b; -} - -function caml_array_blit(a1, i1, a2, i2, len) { - if (i2 <= i1) { - for(var j = 0 ,j_finish = len - 1 | 0; j <= j_finish; ++j){ - a2[j + i2 | 0] = a1[j + i1 | 0]; - } - return /* () */0; - } - else { - for(var j$1 = len - 1 | 0; j$1 >= 0; --j$1){ - a2[j$1 + i2 | 0] = a1[j$1 + i1 | 0]; - } - return /* () */0; - } -} - -exports.caml_array_sub = caml_array_sub; -exports.caml_array_concat = caml_array_concat; -exports.caml_make_vect = caml_make_vect; -exports.caml_array_blit = caml_array_blit; -/* No side effect */ -//////// end of caml_array.js //////// -    return exports; -  }; - - - _registry['caml_builtin_exceptions'] = function() { -    let exports = {}; -//////// start of caml_builtin_exceptions.js //////// -'use strict'; - - -var out_of_memory = /* tuple */[ - "Out_of_memory", - 0 -]; - -var sys_error = /* tuple */[ - "Sys_error", - -1 -]; - -var failure = /* tuple */[ - "Failure", - -2 -]; - -var invalid_argument = /* tuple */[ - "Invalid_argument", - -3 -]; - -var end_of_file = /* tuple */[ - "End_of_file", - -4 -]; - -var division_by_zero = /* tuple */[ - "Division_by_zero", - -5 -]; - -var not_found = /* tuple */[ - "Not_found", - -6 -]; - -var match_failure = /* tuple */[ - "Match_failure", - -7 -]; - -var stack_overflow = /* tuple */[ - "Stack_overflow", - -8 -]; - -var sys_blocked_io = /* tuple */[ - "Sys_blocked_io", - -9 -]; - -var assert_failure = /* tuple */[ - "Assert_failure", - -10 -]; - -var undefined_recursive_module = /* tuple */[ - "Undefined_recursive_module", - -11 -]; - -exports.out_of_memory = out_of_memory; -exports.sys_error = sys_error; -exports.failure = failure; -exports.invalid_argument = invalid_argument; -exports.end_of_file = end_of_file; -exports.division_by_zero = division_by_zero; -exports.not_found = not_found; -exports.match_failure = match_failure; -exports.stack_overflow = stack_overflow; -exports.sys_blocked_io = sys_blocked_io; -exports.assert_failure = assert_failure; -exports.undefined_recursive_module = undefined_recursive_module; -/* No side effect */ -//////// end of caml_builtin_exceptions.js //////// -    return exports; -  }; - - - _registry['caml_bytes'] = function() { -    let exports = {}; -//////// start of caml_bytes.js //////// -'use strict'; - -var Caml_builtin_exceptions = require("./caml_builtin_exceptions"); - -function get(s, i) { - if (i < 0 || i >= s.length) { - throw [ - Caml_builtin_exceptions.invalid_argument, - "index out of bounds" - ]; - } - else { - return s[i]; - } -} - -exports.get = get; -/* No side effect */ -//////// end of caml_bytes.js //////// -    return exports; -  }; - - - _registry['caml_exceptions'] = function() { -    let exports = {}; -//////// start of caml_exceptions.js //////// -'use strict'; - - -var id = [0]; - -function caml_set_oo_id(b) { - b[1] = id[0]; - id[0] += 1; - return b; -} - -function get_id() { - id[0] += 1; - return id[0]; -} - -function create(str) { - var v_001 = get_id(/* () */0); - var v = /* tuple */[ - str, - v_001 - ]; - v.tag = 248; - return v; -} - -exports.caml_set_oo_id = caml_set_oo_id; -exports.get_id = get_id; -exports.create = create; -/* No side effect */ -//////// end of caml_exceptions.js //////// -    return exports; -  }; - - - _registry['caml_float'] = function() { -    let exports = {}; -//////// start of caml_float.js //////// -'use strict'; - - -function caml_int32_float_of_bits(x) { - var int32 = new Int32Array(/* array */[x]); - var float32 = new Float32Array(int32.buffer); - return float32[0]; -} - -function caml_int32_bits_of_float(x) { - var float32 = new Float32Array(/* float array */[x]); - return new Int32Array(float32.buffer)[0]; -} - -function caml_classify_float(x) { - if (isFinite(x)) { - if (Math.abs(x) >= 2.2250738585072014e-308) { - return /* FP_normal */0; - } - else if (x !== 0) { - return /* FP_subnormal */1; - } - else { - return /* FP_zero */2; - } - } - else if (isNaN(x)) { - return /* FP_nan */4; - } - else { - return /* FP_infinite */3; - } -} - -function caml_modf_float(x) { - if (isFinite(x)) { - var neg = +(1 / x < 0); - var x$1 = Math.abs(x); - var i = Math.floor(x$1); - var f = x$1 - i; - if (neg) { - return /* tuple */[ - -f, - -i - ]; - } - else { - return /* tuple */[ - f, - i - ]; - } - } - else if (isNaN(x)) { - return /* tuple */[ - NaN, - NaN - ]; - } - else { - return /* tuple */[ - 1 / x, - x - ]; - } -} - -var caml_ldexp_float = ( function (x,exp) { - exp |= 0; - if (exp > 1023) { - exp -= 1023; - x *= Math.pow(2, 1023); - if (exp > 1023) { // in case x is subnormal - exp -= 1023; - x *= Math.pow(2, 1023); - } - } - if (exp < -1023) { - exp += 1023; - x *= Math.pow(2, -1023); - } - x *= Math.pow(2, exp); - return x; -} -); - -var caml_frexp_float = (function (x) { - if ((x == 0) || !isFinite(x)) return [ x, 0]; - var neg = x < 0; - if (neg) x = - x; - var exp = Math.floor(Math.LOG2E*Math.log(x)) + 1; - x *= Math.pow(2,-exp); - if (x < 0.5) { x *= 2; exp -= 1; } - if (neg) x = - x; - return [x, exp]; -} -); - -function caml_float_compare(x, y) { - if (x === y) { - return 0; - } - else if (x < y) { - return -1; - } - else if (x > y || x === x) { - return 1; - } - else if (y === y) { - return -1; - } - else { - return 0; - } -} - -function caml_copysign_float(x, y) { - var x$1 = Math.abs(x); - var y$1 = y === 0 ? 1 / y : y; - if (y$1 < 0) { - return -x$1; - } - else { - return x$1; - } -} - -function caml_expm1_float(x) { - var y = Math.exp(x); - var z = y - 1; - if (Math.abs(x) > 1) { - return z; - } - else if (z === 0) { - return x; - } - else { - return x * z / Math.log(y); - } -} - -var caml_hypot_float = ( function (x, y) { - var x0 = Math.abs(x), y0 = Math.abs(y); - var a = Math.max(x0, y0), b = Math.min(x0,y0) / (a?a:1); - return a * Math.sqrt(1 + b*b); -} -); - -var caml_log10_float = ( function (x) { - return Math.LOG10E * Math.log(x); } -); - -exports.caml_int32_float_of_bits = caml_int32_float_of_bits; -exports.caml_int32_bits_of_float = caml_int32_bits_of_float; -exports.caml_classify_float = caml_classify_float; -exports.caml_modf_float = caml_modf_float; -exports.caml_ldexp_float = caml_ldexp_float; -exports.caml_frexp_float = caml_frexp_float; -exports.caml_float_compare = caml_float_compare; -exports.caml_copysign_float = caml_copysign_float; -exports.caml_expm1_float = caml_expm1_float; -exports.caml_hypot_float = caml_hypot_float; -exports.caml_log10_float = caml_log10_float; -/* caml_ldexp_float Not a pure module */ -//////// end of caml_float.js //////// -    return exports; -  }; - - - _registry['caml_format'] = function() { -    let exports = {}; -//////// start of caml_format.js //////// -'use strict'; - -var Curry = require("./curry"); -var Caml_int32 = require("./caml_int32"); -var Caml_int64 = require("./caml_int64"); -var Caml_utils = require("./caml_utils"); -var Caml_string = require("./caml_string"); -var Caml_builtin_exceptions = require("./caml_builtin_exceptions"); - -function caml_failwith(s) { - throw [ - Caml_builtin_exceptions.failure, - s - ]; -} - -function parse_digit(c) { - if (c >= 65) { - if (c >= 97) { - if (c >= 123) { - return -1; - } - else { - return c - 87 | 0; - } - } - else if (c >= 91) { - return -1; - } - else { - return c - 55 | 0; - } - } - else if (c > 57 || c < 48) { - return -1; - } - else { - return c - /* "0" */48 | 0; - } -} - -function int_of_string_base(param) { - switch (param) { - case 0 : - return 8; - case 1 : - return 16; - case 2 : - return 10; - case 3 : - return 2; - - } -} - -function parse_sign_and_base(s) { - var sign = 1; - var base = /* Dec */2; - var i = 0; - if (s[i] === "-") { - sign = -1; - i = i + 1 | 0; - } - var match = s.charCodeAt(i); - var match$1 = s.charCodeAt(i + 1 | 0); - if (match === 48) { - if (match$1 >= 89) { - if (match$1 !== 98) { - if (match$1 !== 111) { - if (match$1 === 120) { - base = /* Hex */1; - i = i + 2 | 0; - } - - } - else { - base = /* Oct */0; - i = i + 2 | 0; - } - } - else { - base = /* Bin */3; - i = i + 2 | 0; - } - } - else if (match$1 !== 66) { - if (match$1 !== 79) { - if (match$1 >= 88) { - base = /* Hex */1; - i = i + 2 | 0; - } - - } - else { - base = /* Oct */0; - i = i + 2 | 0; - } - } - else { - base = /* Bin */3; - i = i + 2 | 0; - } - } - return /* tuple */[ - i, - sign, - base - ]; -} - -function caml_int_of_string(s) { - var match = parse_sign_and_base(s); - var i = match[0]; - var base = int_of_string_base(match[2]); - var threshold = 4294967295; - var len = s.length; - var c = i < len ? s.charCodeAt(i) : /* "\000" */0; - var d = parse_digit(c); - if (d < 0 || d >= base) { - throw [ - Caml_builtin_exceptions.failure, - "int_of_string" - ]; - } - var aux = function (_acc, _k) { - while(true) { - var k = _k; - var acc = _acc; - if (k === len) { - return acc; - } - else { - var a = s.charCodeAt(k); - if (a === /* "_" */95) { - _k = k + 1 | 0; - continue ; - - } - else { - var v = parse_digit(a); - if (v < 0 || v >= base) { - throw [ - Caml_builtin_exceptions.failure, - "int_of_string" - ]; - } - else { - var acc$1 = base * acc + v; - if (acc$1 > threshold) { - throw [ - Caml_builtin_exceptions.failure, - "int_of_string" - ]; - } - else { - _k = k + 1 | 0; - _acc = acc$1; - continue ; - - } - } - } - } - }; - }; - var res = match[1] * aux(d, i + 1 | 0); - var or_res = res | 0; - if (base === 10 && res !== or_res) { - throw [ - Caml_builtin_exceptions.failure, - "int_of_string" - ]; - } - return or_res; -} - -function caml_int64_of_string(s) { - var match = parse_sign_and_base(s); - var hbase = match[2]; - var i = match[0]; - var base = Caml_int64.of_int32(int_of_string_base(hbase)); - var sign = Caml_int64.of_int32(match[1]); - var threshold; - switch (hbase) { - case 0 : - threshold = /* int64 */[ - /* hi */536870911, - /* lo */4294967295 - ]; - break; - case 1 : - threshold = /* int64 */[ - /* hi */268435455, - /* lo */4294967295 - ]; - break; - case 2 : - threshold = /* int64 */[ - /* hi */429496729, - /* lo */2576980377 - ]; - break; - case 3 : - threshold = /* int64 */[ - /* hi */2147483647, - /* lo */4294967295 - ]; - break; - - } - var len = s.length; - var c = i < len ? s.charCodeAt(i) : /* "\000" */0; - var d = Caml_int64.of_int32(parse_digit(c)); - if (Caml_int64.lt(d, /* int64 */[ - /* hi */0, - /* lo */0 - ]) || Caml_int64.ge(d, base)) { - throw [ - Caml_builtin_exceptions.failure, - "int64_of_string" - ]; - } - var aux = function (_acc, _k) { - while(true) { - var k = _k; - var acc = _acc; - if (k === len) { - return acc; - } - else { - var a = s.charCodeAt(k); - if (a === /* "_" */95) { - _k = k + 1 | 0; - continue ; - - } - else { - var v = Caml_int64.of_int32(parse_digit(a)); - if (Caml_int64.lt(v, /* int64 */[ - /* hi */0, - /* lo */0 - ]) || Caml_int64.ge(v, base)) { - throw [ - Caml_builtin_exceptions.failure, - "int64_of_string" - ]; - } - else { - var acc$1 = Caml_int64.add(Caml_int64.mul(base, acc), v); - if (Caml_int64.gt(acc$1, threshold)) { - throw [ - Caml_builtin_exceptions.failure, - "int64_of_string" - ]; - } - else { - _k = k + 1 | 0; - _acc = acc$1; - continue ; - - } - } - } - } - }; - }; - var res = Caml_int64.mul(sign, aux(d, i + 1 | 0)); - var or_res_000 = /* hi */res[0] | /* hi */0; - var or_res_001 = /* lo */(res[1] >>> 0); - var or_res = /* int64 */[ - or_res_000, - or_res_001 - ]; - if (Caml_int64.eq(base, /* int64 */[ - /* hi */0, - /* lo */10 - ]) && Caml_int64.neq(res, or_res)) { - throw [ - Caml_builtin_exceptions.failure, - "int64_of_string" - ]; - } - return or_res; -} - -function int_of_base(param) { - switch (param) { - case 0 : - return 8; - case 1 : - return 16; - case 2 : - return 10; - - } -} - -function lowercase(c) { - if (c >= /* "A" */65 && c <= /* "Z" */90 || c >= /* "\192" */192 && c <= /* "\214" */214 || c >= /* "\216" */216 && c <= /* "\222" */222) { - return c + 32 | 0; - } - else { - return c; - } -} - -function parse_format(fmt) { - var len = fmt.length; - if (len > 31) { - throw [ - Caml_builtin_exceptions.invalid_argument, - "format_int: format too long" - ]; - } - var f = /* record */[ - /* justify */"+", - /* signstyle */"-", - /* filter */" ", - /* alternate : false */0, - /* base : Dec */2, - /* signedconv : false */0, - /* width */0, - /* uppercase : false */0, - /* sign */1, - /* prec */-1, - /* conv */"f" - ]; - var _i = 0; - while(true) { - var i = _i; - if (i >= len) { - return f; - } - else { - var c = fmt.charCodeAt(i); - var exit = 0; - if (c >= 69) { - if (c >= 88) { - if (c >= 121) { - exit = 1; - } - else { - switch (c - 88 | 0) { - case 0 : - f[/* base */4] = /* Hex */1; - f[/* uppercase */7] = /* true */1; - _i = i + 1 | 0; - continue ; - case 13 : - case 14 : - case 15 : - exit = 5; - break; - case 12 : - case 17 : - exit = 4; - break; - case 23 : - f[/* base */4] = /* Oct */0; - _i = i + 1 | 0; - continue ; - case 29 : - f[/* base */4] = /* Dec */2; - _i = i + 1 | 0; - continue ; - case 1 : - case 2 : - case 3 : - case 4 : - case 5 : - case 6 : - case 7 : - case 8 : - case 9 : - case 10 : - case 11 : - case 16 : - case 18 : - case 19 : - case 20 : - case 21 : - case 22 : - case 24 : - case 25 : - case 26 : - case 27 : - case 28 : - case 30 : - case 31 : - exit = 1; - break; - case 32 : - f[/* base */4] = /* Hex */1; - _i = i + 1 | 0; - continue ; - - } - } - } - else if (c >= 72) { - exit = 1; - } - else { - f[/* signedconv */5] = /* true */1; - f[/* uppercase */7] = /* true */1; - f[/* conv */10] = String.fromCharCode(lowercase(c)); - _i = i + 1 | 0; - continue ; - - } - } - else { - var switcher = c - 32 | 0; - if (switcher > 25 || switcher < 0) { - exit = 1; - } - else { - switch (switcher) { - case 3 : - f[/* alternate */3] = /* true */1; - _i = i + 1 | 0; - continue ; - case 0 : - case 11 : - exit = 2; - break; - case 13 : - f[/* justify */0] = "-"; - _i = i + 1 | 0; - continue ; - case 14 : - f[/* prec */9] = 0; - var j = i + 1 | 0; - while((function(j){ - return function () { - var w = fmt.charCodeAt(j) - /* "0" */48 | 0; - return +(w >= 0 && w <= 9); - } - }(j))()) { - f[/* prec */9] = (Caml_int32.imul(f[/* prec */9], 10) + fmt.charCodeAt(j) | 0) - /* "0" */48 | 0; - j = j + 1 | 0; - }; - _i = j; - continue ; - case 1 : - case 2 : - case 4 : - case 5 : - case 6 : - case 7 : - case 8 : - case 9 : - case 10 : - case 12 : - case 15 : - exit = 1; - break; - case 16 : - f[/* filter */2] = "0"; - _i = i + 1 | 0; - continue ; - case 17 : - case 18 : - case 19 : - case 20 : - case 21 : - case 22 : - case 23 : - case 24 : - case 25 : - exit = 3; - break; - - } - } - } - switch (exit) { - case 1 : - _i = i + 1 | 0; - continue ; - case 2 : - f[/* signstyle */1] = String.fromCharCode(c); - _i = i + 1 | 0; - continue ; - case 3 : - f[/* width */6] = 0; - var j$1 = i; - while((function(j$1){ - return function () { - var w = fmt.charCodeAt(j$1) - /* "0" */48 | 0; - return +(w >= 0 && w <= 9); - } - }(j$1))()) { - f[/* width */6] = (Caml_int32.imul(f[/* width */6], 10) + fmt.charCodeAt(j$1) | 0) - /* "0" */48 | 0; - j$1 = j$1 + 1 | 0; - }; - _i = j$1; - continue ; - case 4 : - f[/* signedconv */5] = /* true */1; - f[/* base */4] = /* Dec */2; - _i = i + 1 | 0; - continue ; - case 5 : - f[/* signedconv */5] = /* true */1; - f[/* conv */10] = String.fromCharCode(c); - _i = i + 1 | 0; - continue ; - - } - } - }; -} - -function finish_formatting(param, rawbuffer) { - var justify = param[/* justify */0]; - var signstyle = param[/* signstyle */1]; - var filter = param[/* filter */2]; - var alternate = param[/* alternate */3]; - var base = param[/* base */4]; - var signedconv = param[/* signedconv */5]; - var width = param[/* width */6]; - var uppercase = param[/* uppercase */7]; - var sign = param[/* sign */8]; - var len = rawbuffer.length; - if (signedconv && (sign < 0 || signstyle !== "-")) { - len = len + 1 | 0; - } - if (alternate) { - if (base) { - if (base === /* Hex */1) { - len = len + 2 | 0; - } - - } - else { - len = len + 1 | 0; - } - } - var buffer = ""; - if (justify === "+" && filter === " ") { - for(var i = len ,i_finish = width - 1 | 0; i <= i_finish; ++i){ - buffer = buffer + filter; - } - } - if (signedconv) { - if (sign < 0) { - buffer = buffer + "-"; - } - else if (signstyle !== "-") { - buffer = buffer + signstyle; - } - - } - if (alternate && base === /* Oct */0) { - buffer = buffer + "0"; - } - if (alternate && base === /* Hex */1) { - buffer = buffer + "0x"; - } - if (justify === "+" && filter === "0") { - for(var i$1 = len ,i_finish$1 = width - 1 | 0; i$1 <= i_finish$1; ++i$1){ - buffer = buffer + filter; - } - } - buffer = uppercase ? buffer + rawbuffer.toUpperCase() : buffer + rawbuffer; - if (justify === "-") { - for(var i$2 = len ,i_finish$2 = width - 1 | 0; i$2 <= i_finish$2; ++i$2){ - buffer = buffer + " "; - } - } - return buffer; -} - -function caml_format_int(fmt, i) { - if (fmt === "%d") { - return "" + i; - } - else { - var f = parse_format(fmt); - var f$1 = f; - var i$1 = i; - var i$2 = i$1 < 0 ? ( - f$1[/* signedconv */5] ? (f$1[/* sign */8] = -1, -i$1) : (i$1 >>> 0) - ) : i$1; - var s = i$2.toString(int_of_base(f$1[/* base */4])); - if (f$1[/* prec */9] >= 0) { - f$1[/* filter */2] = " "; - var n = f$1[/* prec */9] - s.length | 0; - if (n > 0) { - s = Caml_utils.repeat(n, "0") + s; - } - - } - return finish_formatting(f$1, s); - } -} - -function caml_int64_format(fmt, x) { - var f = parse_format(fmt); - var x$1 = f[/* signedconv */5] && Caml_int64.lt(x, /* int64 */[ - /* hi */0, - /* lo */0 - ]) ? (f[/* sign */8] = -1, Caml_int64.neg(x)) : x; - var s = ""; - var match = f[/* base */4]; - switch (match) { - case 0 : - var wbase = /* int64 */[ - /* hi */0, - /* lo */8 - ]; - var cvtbl = "01234567"; - if (Caml_int64.lt(x$1, /* int64 */[ - /* hi */0, - /* lo */0 - ])) { - var y = Caml_int64.discard_sign(x$1); - var match$1 = Caml_int64.div_mod(y, wbase); - var quotient = Caml_int64.add(/* int64 */[ - /* hi */268435456, - /* lo */0 - ], match$1[0]); - var modulus = match$1[1]; - s = Caml_string.js_string_of_char(cvtbl.charCodeAt(modulus[1] | 0)) + s; - while(Caml_int64.neq(quotient, /* int64 */[ - /* hi */0, - /* lo */0 - ])) { - var match$2 = Caml_int64.div_mod(quotient, wbase); - quotient = match$2[0]; - modulus = match$2[1]; - s = Caml_string.js_string_of_char(cvtbl.charCodeAt(modulus[1] | 0)) + s; - }; - } - else { - var match$3 = Caml_int64.div_mod(x$1, wbase); - var quotient$1 = match$3[0]; - var modulus$1 = match$3[1]; - s = Caml_string.js_string_of_char(cvtbl.charCodeAt(modulus$1[1] | 0)) + s; - while(Caml_int64.neq(quotient$1, /* int64 */[ - /* hi */0, - /* lo */0 - ])) { - var match$4 = Caml_int64.div_mod(quotient$1, wbase); - quotient$1 = match$4[0]; - modulus$1 = match$4[1]; - s = Caml_string.js_string_of_char(cvtbl.charCodeAt(modulus$1[1] | 0)) + s; - }; - } - break; - case 1 : - s = Caml_int64.to_hex(x$1) + s; - break; - case 2 : - var wbase$1 = /* int64 */[ - /* hi */0, - /* lo */10 - ]; - var cvtbl$1 = "0123456789"; - if (Caml_int64.lt(x$1, /* int64 */[ - /* hi */0, - /* lo */0 - ])) { - var y$1 = Caml_int64.discard_sign(x$1); - var match$5 = Caml_int64.div_mod(y$1, wbase$1); - var match$6 = Caml_int64.div_mod(Caml_int64.add(/* int64 */[ - /* hi */0, - /* lo */8 - ], match$5[1]), wbase$1); - var quotient$2 = Caml_int64.add(Caml_int64.add(/* int64 */[ - /* hi */214748364, - /* lo */3435973836 - ], match$5[0]), match$6[0]); - var modulus$2 = match$6[1]; - s = Caml_string.js_string_of_char(cvtbl$1.charCodeAt(modulus$2[1] | 0)) + s; - while(Caml_int64.neq(quotient$2, /* int64 */[ - /* hi */0, - /* lo */0 - ])) { - var match$7 = Caml_int64.div_mod(quotient$2, wbase$1); - quotient$2 = match$7[0]; - modulus$2 = match$7[1]; - s = Caml_string.js_string_of_char(cvtbl$1.charCodeAt(modulus$2[1] | 0)) + s; - }; - } - else { - var match$8 = Caml_int64.div_mod(x$1, wbase$1); - var quotient$3 = match$8[0]; - var modulus$3 = match$8[1]; - s = Caml_string.js_string_of_char(cvtbl$1.charCodeAt(modulus$3[1] | 0)) + s; - while(Caml_int64.neq(quotient$3, /* int64 */[ - /* hi */0, - /* lo */0 - ])) { - var match$9 = Caml_int64.div_mod(quotient$3, wbase$1); - quotient$3 = match$9[0]; - modulus$3 = match$9[1]; - s = Caml_string.js_string_of_char(cvtbl$1.charCodeAt(modulus$3[1] | 0)) + s; - }; - } - break; - - } - if (f[/* prec */9] >= 0) { - f[/* filter */2] = " "; - var n = f[/* prec */9] - s.length | 0; - if (n > 0) { - s = Caml_utils.repeat(n, "0") + s; - } - - } - return finish_formatting(f, s); -} - -function caml_format_float(fmt, x) { - var f = parse_format(fmt); - var prec = f[/* prec */9] < 0 ? 6 : f[/* prec */9]; - var x$1 = x < 0 ? (f[/* sign */8] = -1, -x) : x; - var s = ""; - if (isNaN(x$1)) { - s = "nan"; - f[/* filter */2] = " "; - } - else if (isFinite(x$1)) { - var match = f[/* conv */10]; - switch (match) { - case "e" : - s = x$1.toExponential(prec); - var i = s.length; - if (s[i - 3 | 0] === "e") { - s = s.slice(0, i - 1 | 0) + ("0" + s.slice(i - 1 | 0)); - } - break; - case "f" : - s = x$1.toFixed(prec); - break; - case "g" : - var prec$1 = prec !== 0 ? prec : 1; - s = x$1.toExponential(prec$1 - 1 | 0); - var j = s.indexOf("e"); - var exp = +s.slice(j + 1 | 0); - if (exp < -4 || x$1 >= 1e21 || x$1.toFixed(0).length > prec$1) { - var i$1 = j - 1 | 0; - while(s[i$1] === "0") { - i$1 = i$1 - 1 | 0; - }; - if (s[i$1] === ".") { - i$1 = i$1 - 1 | 0; - } - s = s.slice(0, i$1 + 1 | 0) + s.slice(j); - var i$2 = s.length; - if (s[i$2 - 3 | 0] === "e") { - s = s.slice(0, i$2 - 1 | 0) + ("0" + s.slice(i$2 - 1 | 0)); - } - - } - else { - var p = prec$1; - if (exp < 0) { - p = p - (exp + 1 | 0) | 0; - s = x$1.toFixed(p); - } - else { - while(function () { - s = x$1.toFixed(p); - return +(s.length > (prec$1 + 1 | 0)); - }()) { - p = p - 1 | 0; - }; - } - if (p !== 0) { - var k = s.length - 1 | 0; - while(s[k] === "0") { - k = k - 1 | 0; - }; - if (s[k] === ".") { - k = k - 1 | 0; - } - s = s.slice(0, k + 1 | 0); - } - - } - break; - default: - - } - } - else { - s = "inf"; - f[/* filter */2] = " "; - } - return finish_formatting(f, s); -} - -var float_of_string = ( - function (s, caml_failwith) { - var res = +s; - if ((s.length > 0) && (res === res)) - return res; - s = s.replace(/_/g, ""); - res = +s; - if (((s.length > 0) && (res === res)) || /^[+-]?nan$/i.test(s)) { - return res; - } - ; - if (/^ *0x[0-9a-f_]+p[+-]?[0-9_]+/i.test(s)) { - var pidx = s.indexOf('p'); - pidx = (pidx == -1) ? s.indexOf('P') : pidx; - var exp = +s.substring(pidx + 1); - res = +s.substring(0, pidx); - return res * Math.pow(2, exp); - } - if (/^\+?inf(inity)?$/i.test(s)) - return Infinity; - if (/^-inf(inity)?$/i.test(s)) - return -Infinity; - caml_failwith("float_of_string"); -} - -); - -function caml_float_of_string(s) { - return Curry._2(float_of_string, s, caml_failwith); -} - -var caml_nativeint_format = caml_format_int; - -var caml_int32_format = caml_format_int; - -var caml_int32_of_string = caml_int_of_string; - -var caml_nativeint_of_string = caml_int_of_string; - -exports.caml_format_float = caml_format_float; -exports.caml_format_int = caml_format_int; -exports.caml_nativeint_format = caml_nativeint_format; -exports.caml_int32_format = caml_int32_format; -exports.caml_float_of_string = caml_float_of_string; -exports.caml_int64_format = caml_int64_format; -exports.caml_int_of_string = caml_int_of_string; -exports.caml_int32_of_string = caml_int32_of_string; -exports.caml_int64_of_string = caml_int64_of_string; -exports.caml_nativeint_of_string = caml_nativeint_of_string; -/* float_of_string Not a pure module */ -//////// end of caml_format.js //////// -    return exports; -  }; - - - _registry['caml_int32'] = function() { -    let exports = {}; -//////// start of caml_int32.js //////// -'use strict'; - -var Caml_builtin_exceptions = require("./caml_builtin_exceptions"); - -function div(x, y) { - if (y === 0) { - throw Caml_builtin_exceptions.division_by_zero; - } - else { - return x / y | 0; - } -} - -function mod_(x, y) { - if (y === 0) { - throw Caml_builtin_exceptions.division_by_zero; - } - else { - return x % y; - } -} - -function caml_bswap16(x) { - return ((x & 255) << 8) | ((x & 65280) >>> 8); -} - -function caml_int32_bswap(x) { - return ((x & 255) << 24) | ((x & 65280) << 8) | ((x & 16711680) >>> 8) | ((x & 4278190080) >>> 24); -} - -var imul = ( Math.imul || function (x,y) { - y |= 0; return ((((x >> 16) * y) << 16) + (x & 0xffff) * y)|0; -} -); - -var caml_nativeint_bswap = caml_int32_bswap; - -exports.div = div; -exports.mod_ = mod_; -exports.caml_bswap16 = caml_bswap16; -exports.caml_int32_bswap = caml_int32_bswap; -exports.caml_nativeint_bswap = caml_nativeint_bswap; -exports.imul = imul; -/* imul Not a pure module */ -//////// end of caml_int32.js //////// -    return exports; -  }; - - - _registry['caml_int64'] = function() { -    let exports = {}; -//////// start of caml_int64.js //////// -'use strict'; - -var Caml_obj = require("./caml_obj"); -var Caml_int32 = require("./caml_int32"); -var Caml_utils = require("./caml_utils"); -var Caml_builtin_exceptions = require("./caml_builtin_exceptions"); - -var min_int = /* record */[ - /* hi */-2147483648, - /* lo */0 -]; - -var max_int = /* record */[ - /* hi */134217727, - /* lo */1 -]; - -var one = /* record */[ - /* hi */0, - /* lo */1 -]; - -var zero = /* record */[ - /* hi */0, - /* lo */0 -]; - -var neg_one = /* record */[ - /* hi */-1, - /* lo */4294967295 -]; - -function neg_signed(x) { - return +((x & 2147483648) !== 0); -} - -function add(param, param$1) { - var other_low_ = param$1[/* lo */1]; - var this_low_ = param[/* lo */1]; - var lo = this_low_ + other_low_ & 4294967295; - var overflow = neg_signed(this_low_) && (neg_signed(other_low_) || !neg_signed(lo)) || neg_signed(other_low_) && !neg_signed(lo) ? 1 : 0; - var hi = param[/* hi */0] + param$1[/* hi */0] + overflow & 4294967295; - return /* record */[ - /* hi */hi, - /* lo */(lo >>> 0) - ]; -} - -function not(param) { - var hi = param[/* hi */0] ^ -1; - var lo = param[/* lo */1] ^ -1; - return /* record */[ - /* hi */hi, - /* lo */(lo >>> 0) - ]; -} - -function eq(x, y) { - if (x[/* hi */0] === y[/* hi */0]) { - return +(x[/* lo */1] === y[/* lo */1]); - } - else { - return /* false */0; - } -} - -function neg(x) { - if (eq(x, min_int)) { - return min_int; - } - else { - return add(not(x), one); - } -} - -function sub(x, y) { - return add(x, neg(y)); -} - -function lsl_(x, numBits) { - var lo = x[/* lo */1]; - if (numBits) { - if (numBits >= 32) { - return /* record */[ - /* hi */(lo << (numBits - 32 | 0)), - /* lo */0 - ]; - } - else { - var hi = (lo >>> (32 - numBits | 0)) | (x[/* hi */0] << numBits); - return /* record */[ - /* hi */hi, - /* lo */((lo << numBits) >>> 0) - ]; - } - } - else { - return x; - } -} - -function lsr_(x, numBits) { - var hi = x[/* hi */0]; - if (numBits) { - var offset = numBits - 32 | 0; - if (offset) { - if (offset > 0) { - var lo = (hi >>> offset); - return /* record */[ - /* hi */0, - /* lo */(lo >>> 0) - ]; - } - else { - var hi$1 = (hi >>> numBits); - var lo$1 = (hi << (-offset | 0)) | (x[/* lo */1] >>> numBits); - return /* record */[ - /* hi */hi$1, - /* lo */(lo$1 >>> 0) - ]; - } - } - else { - return /* record */[ - /* hi */0, - /* lo */(hi >>> 0) - ]; - } - } - else { - return x; - } -} - -function asr_(x, numBits) { - var hi = x[/* hi */0]; - if (numBits) { - if (numBits < 32) { - var hi$1 = (hi >> numBits); - var lo = (hi << (32 - numBits | 0)) | (x[/* lo */1] >>> numBits); - return /* record */[ - /* hi */hi$1, - /* lo */(lo >>> 0) - ]; - } - else { - var lo$1 = (hi >> (numBits - 32 | 0)); - return /* record */[ - /* hi */hi >= 0 ? 0 : -1, - /* lo */(lo$1 >>> 0) - ]; - } - } - else { - return x; - } -} - -function is_zero(param) { - if (param[/* hi */0] !== 0 || param[/* lo */1] !== 0) { - return /* false */0; - } - else { - return /* true */1; - } -} - -function mul(_this, _other) { - while(true) { - var other = _other; - var $$this = _this; - var exit = 0; - var lo; - var this_hi = $$this[/* hi */0]; - var exit$1 = 0; - var exit$2 = 0; - var exit$3 = 0; - if (this_hi !== 0) { - exit$3 = 4; - } - else if ($$this[/* lo */1] !== 0) { - exit$3 = 4; - } - else { - return zero; - } - if (exit$3 === 4) { - if (other[/* hi */0] !== 0) { - exit$2 = 3; - } - else if (other[/* lo */1] !== 0) { - exit$2 = 3; - } - else { - return zero; - } - } - if (exit$2 === 3) { - if (this_hi !== -2147483648) { - exit$1 = 2; - } - else if ($$this[/* lo */1] !== 0) { - exit$1 = 2; - } - else { - lo = other[/* lo */1]; - exit = 1; - } - } - if (exit$1 === 2) { - var other_hi = other[/* hi */0]; - var lo$1 = $$this[/* lo */1]; - var exit$4 = 0; - if (other_hi !== -2147483648) { - exit$4 = 3; - } - else if (other[/* lo */1] !== 0) { - exit$4 = 3; - } - else { - lo = lo$1; - exit = 1; - } - if (exit$4 === 3) { - var other_lo = other[/* lo */1]; - if (this_hi < 0) { - if (other_hi < 0) { - _other = neg(other); - _this = neg($$this); - continue ; - - } - else { - return neg(mul(neg($$this), other)); - } - } - else if (other_hi < 0) { - return neg(mul($$this, neg(other))); - } - else { - var a48 = (this_hi >>> 16); - var a32 = this_hi & 65535; - var a16 = (lo$1 >>> 16); - var a00 = lo$1 & 65535; - var b48 = (other_hi >>> 16); - var b32 = other_hi & 65535; - var b16 = (other_lo >>> 16); - var b00 = other_lo & 65535; - var c48 = 0; - var c32 = 0; - var c16 = 0; - var c00 = a00 * b00; - c16 = (c00 >>> 16) + a16 * b00; - c32 = (c16 >>> 16); - c16 = (c16 & 65535) + a00 * b16; - c32 = c32 + (c16 >>> 16) + a32 * b00; - c48 = (c32 >>> 16); - c32 = (c32 & 65535) + a16 * b16; - c48 += (c32 >>> 16); - c32 = (c32 & 65535) + a00 * b32; - c48 += (c32 >>> 16); - c32 = c32 & 65535; - c48 = c48 + (a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48) & 65535; - var hi = c32 | (c48 << 16); - var lo$2 = c00 & 65535 | ((c16 & 65535) << 16); - return /* record */[ - /* hi */hi, - /* lo */(lo$2 >>> 0) - ]; - } - } - - } - if (exit === 1) { - if ((lo & 1) === 0) { - return zero; - } - else { - return min_int; - } - } - - }; -} - -function swap(param) { - var hi = Caml_int32.caml_int32_bswap(param[/* lo */1]); - var lo = Caml_int32.caml_int32_bswap(param[/* hi */0]); - return /* record */[ - /* hi */hi, - /* lo */(lo >>> 0) - ]; -} - -function xor(param, param$1) { - return /* record */[ - /* hi */param[/* hi */0] ^ param$1[/* hi */0], - /* lo */((param[/* lo */1] ^ param$1[/* lo */1]) >>> 0) - ]; -} - -function or_(param, param$1) { - return /* record */[ - /* hi */param[/* hi */0] | param$1[/* hi */0], - /* lo */((param[/* lo */1] | param$1[/* lo */1]) >>> 0) - ]; -} - -function and_(param, param$1) { - return /* record */[ - /* hi */param[/* hi */0] & param$1[/* hi */0], - /* lo */((param[/* lo */1] & param$1[/* lo */1]) >>> 0) - ]; -} - -function ge(param, param$1) { - var other_hi = param$1[/* hi */0]; - var hi = param[/* hi */0]; - if (hi > other_hi) { - return /* true */1; - } - else if (hi < other_hi) { - return /* false */0; - } - else { - return +(param[/* lo */1] >= param$1[/* lo */1]); - } -} - -function neq(x, y) { - return 1 - eq(x, y); -} - -function lt(x, y) { - return 1 - ge(x, y); -} - -function gt(x, y) { - if (x[/* hi */0] > y[/* hi */0]) { - return /* true */1; - } - else if (x[/* hi */0] < y[/* hi */0]) { - return /* false */0; - } - else { - return +(x[/* lo */1] > y[/* lo */1]); - } -} - -function le(x, y) { - return 1 - gt(x, y); -} - -function to_float(param) { - return param[/* hi */0] * 4294967296 + param[/* lo */1]; -} - -var two_ptr_32_dbl = Math.pow(2, 32); - -var two_ptr_63_dbl = Math.pow(2, 63); - -var neg_two_ptr_63 = -Math.pow(2, 63); - -function of_float(x) { - if (isNaN(x) || !isFinite(x)) { - return zero; - } - else if (x <= neg_two_ptr_63) { - return min_int; - } - else if (x + 1 >= two_ptr_63_dbl) { - return max_int; - } - else if (x < 0) { - return neg(of_float(-x)); - } - else { - var hi = x / two_ptr_32_dbl | 0; - var lo = x % two_ptr_32_dbl | 0; - return /* record */[ - /* hi */hi, - /* lo */(lo >>> 0) - ]; - } -} - -function div(_self, _other) { - while(true) { - var other = _other; - var self = _self; - var self_hi = self[/* hi */0]; - var exit = 0; - var exit$1 = 0; - if (other[/* hi */0] !== 0) { - exit$1 = 2; - } - else if (other[/* lo */1] !== 0) { - exit$1 = 2; - } - else { - throw Caml_builtin_exceptions.division_by_zero; - } - if (exit$1 === 2) { - if (self_hi !== -2147483648) { - if (self_hi !== 0) { - exit = 1; - } - else if (self[/* lo */1] !== 0) { - exit = 1; - } - else { - return zero; - } - } - else if (self[/* lo */1] !== 0) { - exit = 1; - } - else if (eq(other, one) || eq(other, neg_one)) { - return self; - } - else if (eq(other, min_int)) { - return one; - } - else { - var other_hi = other[/* hi */0]; - var half_this = asr_(self, 1); - var approx = lsl_(div(half_this, other), 1); - var exit$2 = 0; - if (approx[/* hi */0] !== 0) { - exit$2 = 3; - } - else if (approx[/* lo */1] !== 0) { - exit$2 = 3; - } - else if (other_hi < 0) { - return one; - } - else { - return neg(one); - } - if (exit$2 === 3) { - var y = mul(other, approx); - var rem = add(self, neg(y)); - return add(approx, div(rem, other)); - } - - } - } - if (exit === 1) { - var other_hi$1 = other[/* hi */0]; - var exit$3 = 0; - if (other_hi$1 !== -2147483648) { - exit$3 = 2; - } - else if (other[/* lo */1] !== 0) { - exit$3 = 2; - } - else { - return zero; - } - if (exit$3 === 2) { - if (self_hi < 0) { - if (other_hi$1 < 0) { - _other = neg(other); - _self = neg(self); - continue ; - - } - else { - return neg(div(neg(self), other)); - } - } - else if (other_hi$1 < 0) { - return neg(div(self, neg(other))); - } - else { - var res = zero; - var rem$1 = self; - while(ge(rem$1, other)) { - var approx$1 = Math.max(1, Math.floor(to_float(rem$1) / to_float(other))); - var log2 = Math.ceil(Math.log(approx$1) / Math.LN2); - var delta = log2 <= 48 ? 1 : Math.pow(2, log2 - 48); - var approxRes = of_float(approx$1); - var approxRem = mul(approxRes, other); - while(approxRem[/* hi */0] < 0 || gt(approxRem, rem$1)) { - approx$1 -= delta; - approxRes = of_float(approx$1); - approxRem = mul(approxRes, other); - }; - if (is_zero(approxRes)) { - approxRes = one; - } - res = add(res, approxRes); - rem$1 = add(rem$1, neg(approxRem)); - }; - return res; - } - } - - } - - }; -} - -function mod_(self, other) { - var y = mul(div(self, other), other); - return add(self, neg(y)); -} - -function div_mod(self, other) { - var quotient = div(self, other); - var y = mul(quotient, other); - return /* tuple */[ - quotient, - add(self, neg(y)) - ]; -} - -function compare(self, other) { - var v = Caml_obj.caml_nativeint_compare(self[/* hi */0], other[/* hi */0]); - if (v) { - return v; - } - else { - return Caml_obj.caml_nativeint_compare(self[/* lo */1], other[/* lo */1]); - } -} - -function of_int32(lo) { - return /* record */[ - /* hi */lo < 0 ? -1 : 0, - /* lo */(lo >>> 0) - ]; -} - -function to_int32(x) { - return x[/* lo */1] | 0; -} - -function to_hex(x) { - var aux = function (v) { - return (v >>> 0).toString(16); - }; - var match = x[/* hi */0]; - var match$1 = x[/* lo */1]; - var exit = 0; - if (match !== 0) { - exit = 1; - } - else if (match$1 !== 0) { - exit = 1; - } - else { - return "0"; - } - if (exit === 1) { - if (match$1 !== 0) { - if (match !== 0) { - var lo = aux(x[/* lo */1]); - var pad = 8 - lo.length | 0; - if (pad <= 0) { - return aux(x[/* hi */0]) + lo; - } - else { - return aux(x[/* hi */0]) + (Caml_utils.repeat(pad, "0") + lo); - } - } - else { - return aux(x[/* lo */1]); - } - } - else { - return aux(x[/* hi */0]) + "00000000"; - } - } - -} - -function discard_sign(x) { - return /* record */[ - /* hi */2147483647 & x[/* hi */0], - /* lo */x[/* lo */1] - ]; -} - -function float_of_bits(x) { - var int32 = new Int32Array(/* array */[ - x[/* lo */1], - x[/* hi */0] - ]); - return new Float64Array(int32.buffer)[0]; -} - -function bits_of_float(x) { - var to_nat = function (x) { - return x; - }; - var u = new Float64Array(/* float array */[x]); - var int32 = new Int32Array(u.buffer); - var hi = to_nat(int32[1]); - var lo = to_nat(int32[0]); - return /* record */[ - /* hi */hi, - /* lo */(lo >>> 0) - ]; -} - -function get64(s, i) { - var hi = (s.charCodeAt(i + 4 | 0) << 32) | (s.charCodeAt(i + 5 | 0) << 40) | (s.charCodeAt(i + 6 | 0) << 48) | (s.charCodeAt(i + 7 | 0) << 56); - var lo = s.charCodeAt(i) | (s.charCodeAt(i + 1 | 0) << 8) | (s.charCodeAt(i + 2 | 0) << 16) | (s.charCodeAt(i + 3 | 0) << 24); - return /* record */[ - /* hi */hi, - /* lo */(lo >>> 0) - ]; -} - -exports.min_int = min_int; -exports.max_int = max_int; -exports.one = one; -exports.zero = zero; -exports.not = not; -exports.of_int32 = of_int32; -exports.to_int32 = to_int32; -exports.add = add; -exports.neg = neg; -exports.sub = sub; -exports.lsl_ = lsl_; -exports.lsr_ = lsr_; -exports.asr_ = asr_; -exports.is_zero = is_zero; -exports.mul = mul; -exports.xor = xor; -exports.or_ = or_; -exports.and_ = and_; -exports.swap = swap; -exports.ge = ge; -exports.eq = eq; -exports.neq = neq; -exports.lt = lt; -exports.gt = gt; -exports.le = le; -exports.to_float = to_float; -exports.of_float = of_float; -exports.div = div; -exports.mod_ = mod_; -exports.div_mod = div_mod; -exports.compare = compare; -exports.to_hex = to_hex; -exports.discard_sign = discard_sign; -exports.float_of_bits = float_of_bits; -exports.bits_of_float = bits_of_float; -exports.get64 = get64; -/* two_ptr_32_dbl Not a pure module */ -//////// end of caml_int64.js //////// -    return exports; -  }; - - - _registry['camlinternalFormatBasics'] = function() { -    let exports = {}; -//////// start of camlinternalFormatBasics.js //////// -'use strict'; - -var Block = require("./block"); - -function erase_rel(param) { - if (typeof param === "number") { - return /* End_of_fmtty */0; - } - else { - switch (param.tag | 0) { - case 0 : - return /* Char_ty */Block.__(0, [erase_rel(param[0])]); - case 1 : - return /* String_ty */Block.__(1, [erase_rel(param[0])]); - case 2 : - return /* Int_ty */Block.__(2, [erase_rel(param[0])]); - case 3 : - return /* Int32_ty */Block.__(3, [erase_rel(param[0])]); - case 4 : - return /* Nativeint_ty */Block.__(4, [erase_rel(param[0])]); - case 5 : - return /* Int64_ty */Block.__(5, [erase_rel(param[0])]); - case 6 : - return /* Float_ty */Block.__(6, [erase_rel(param[0])]); - case 7 : - return /* Bool_ty */Block.__(7, [erase_rel(param[0])]); - case 8 : - return /* Format_arg_ty */Block.__(8, [ - param[0], - erase_rel(param[1]) - ]); - case 9 : - var ty1 = param[0]; - return /* Format_subst_ty */Block.__(9, [ - ty1, - ty1, - erase_rel(param[2]) - ]); - case 10 : - return /* Alpha_ty */Block.__(10, [erase_rel(param[0])]); - case 11 : - return /* Theta_ty */Block.__(11, [erase_rel(param[0])]); - case 12 : - return /* Any_ty */Block.__(12, [erase_rel(param[0])]); - case 13 : - return /* Reader_ty */Block.__(13, [erase_rel(param[0])]); - case 14 : - return /* Ignored_reader_ty */Block.__(14, [erase_rel(param[0])]); - - } - } -} - -function concat_fmtty(fmtty1, fmtty2) { - if (typeof fmtty1 === "number") { - return fmtty2; - } - else { - switch (fmtty1.tag | 0) { - case 0 : - return /* Char_ty */Block.__(0, [concat_fmtty(fmtty1[0], fmtty2)]); - case 1 : - return /* String_ty */Block.__(1, [concat_fmtty(fmtty1[0], fmtty2)]); - case 2 : - return /* Int_ty */Block.__(2, [concat_fmtty(fmtty1[0], fmtty2)]); - case 3 : - return /* Int32_ty */Block.__(3, [concat_fmtty(fmtty1[0], fmtty2)]); - case 4 : - return /* Nativeint_ty */Block.__(4, [concat_fmtty(fmtty1[0], fmtty2)]); - case 5 : - return /* Int64_ty */Block.__(5, [concat_fmtty(fmtty1[0], fmtty2)]); - case 6 : - return /* Float_ty */Block.__(6, [concat_fmtty(fmtty1[0], fmtty2)]); - case 7 : - return /* Bool_ty */Block.__(7, [concat_fmtty(fmtty1[0], fmtty2)]); - case 8 : - return /* Format_arg_ty */Block.__(8, [ - fmtty1[0], - concat_fmtty(fmtty1[1], fmtty2) - ]); - case 9 : - return /* Format_subst_ty */Block.__(9, [ - fmtty1[0], - fmtty1[1], - concat_fmtty(fmtty1[2], fmtty2) - ]); - case 10 : - return /* Alpha_ty */Block.__(10, [concat_fmtty(fmtty1[0], fmtty2)]); - case 11 : - return /* Theta_ty */Block.__(11, [concat_fmtty(fmtty1[0], fmtty2)]); - case 12 : - return /* Any_ty */Block.__(12, [concat_fmtty(fmtty1[0], fmtty2)]); - case 13 : - return /* Reader_ty */Block.__(13, [concat_fmtty(fmtty1[0], fmtty2)]); - case 14 : - return /* Ignored_reader_ty */Block.__(14, [concat_fmtty(fmtty1[0], fmtty2)]); - - } - } -} - -function concat_fmt(fmt1, fmt2) { - if (typeof fmt1 === "number") { - return fmt2; - } - else { - switch (fmt1.tag | 0) { - case 0 : - return /* Char */Block.__(0, [concat_fmt(fmt1[0], fmt2)]); - case 1 : - return /* Caml_char */Block.__(1, [concat_fmt(fmt1[0], fmt2)]); - case 2 : - return /* String */Block.__(2, [ - fmt1[0], - concat_fmt(fmt1[1], fmt2) - ]); - case 3 : - return /* Caml_string */Block.__(3, [ - fmt1[0], - concat_fmt(fmt1[1], fmt2) - ]); - case 4 : - return /* Int */Block.__(4, [ - fmt1[0], - fmt1[1], - fmt1[2], - concat_fmt(fmt1[3], fmt2) - ]); - case 5 : - return /* Int32 */Block.__(5, [ - fmt1[0], - fmt1[1], - fmt1[2], - concat_fmt(fmt1[3], fmt2) - ]); - case 6 : - return /* Nativeint */Block.__(6, [ - fmt1[0], - fmt1[1], - fmt1[2], - concat_fmt(fmt1[3], fmt2) - ]); - case 7 : - return /* Int64 */Block.__(7, [ - fmt1[0], - fmt1[1], - fmt1[2], - concat_fmt(fmt1[3], fmt2) - ]); - case 8 : - return /* Float */Block.__(8, [ - fmt1[0], - fmt1[1], - fmt1[2], - concat_fmt(fmt1[3], fmt2) - ]); - case 9 : - return /* Bool */Block.__(9, [concat_fmt(fmt1[0], fmt2)]); - case 10 : - return /* Flush */Block.__(10, [concat_fmt(fmt1[0], fmt2)]); - case 11 : - return /* String_literal */Block.__(11, [ - fmt1[0], - concat_fmt(fmt1[1], fmt2) - ]); - case 12 : - return /* Char_literal */Block.__(12, [ - fmt1[0], - concat_fmt(fmt1[1], fmt2) - ]); - case 13 : - return /* Format_arg */Block.__(13, [ - fmt1[0], - fmt1[1], - concat_fmt(fmt1[2], fmt2) - ]); - case 14 : - return /* Format_subst */Block.__(14, [ - fmt1[0], - fmt1[1], - concat_fmt(fmt1[2], fmt2) - ]); - case 15 : - return /* Alpha */Block.__(15, [concat_fmt(fmt1[0], fmt2)]); - case 16 : - return /* Theta */Block.__(16, [concat_fmt(fmt1[0], fmt2)]); - case 17 : - return /* Formatting_lit */Block.__(17, [ - fmt1[0], - concat_fmt(fmt1[1], fmt2) - ]); - case 18 : - return /* Formatting_gen */Block.__(18, [ - fmt1[0], - concat_fmt(fmt1[1], fmt2) - ]); - case 19 : - return /* Reader */Block.__(19, [concat_fmt(fmt1[0], fmt2)]); - case 20 : - return /* Scan_char_set */Block.__(20, [ - fmt1[0], - fmt1[1], - concat_fmt(fmt1[2], fmt2) - ]); - case 21 : - return /* Scan_get_counter */Block.__(21, [ - fmt1[0], - concat_fmt(fmt1[1], fmt2) - ]); - case 22 : - return /* Scan_next_char */Block.__(22, [concat_fmt(fmt1[0], fmt2)]); - case 23 : - return /* Ignored_param */Block.__(23, [ - fmt1[0], - concat_fmt(fmt1[1], fmt2) - ]); - case 24 : - return /* Custom */Block.__(24, [ - fmt1[0], - fmt1[1], - concat_fmt(fmt1[2], fmt2) - ]); - - } - } -} - -exports.concat_fmtty = concat_fmtty; -exports.erase_rel = erase_rel; -exports.concat_fmt = concat_fmt; -/* No side effect */ -//////// end of camlinternalFormatBasics.js //////// -    return exports; -  }; - - - _registry['camlinternalFormat'] = function() { -    let exports = {}; -//////// start of camlinternalFormat.js //////// -'use strict'; - -var Sys = require("./sys"); -var Char = require("./char"); -var Block = require("./block"); -var Bytes = require("./bytes"); -var Curry = require("./curry"); -var Buffer = require("./buffer"); -var $$String = require("./string"); -var Caml_io = require("./caml_io"); -var Caml_obj = require("./caml_obj"); -var Caml_bytes = require("./caml_bytes"); -var Caml_float = require("./caml_float"); -var Caml_int32 = require("./caml_int32"); -var Pervasives = require("./pervasives"); -var Caml_format = require("./caml_format"); -var Caml_string = require("./caml_string"); -var Caml_exceptions = require("./caml_exceptions"); -var Caml_builtin_exceptions = require("./caml_builtin_exceptions"); -var CamlinternalFormatBasics = require("./camlinternalFormatBasics"); - -function create_char_set() { - return Bytes.make(32, /* "\000" */0); -} - -function add_in_char_set(char_set, c) { - var str_ind = (c >>> 3); - var mask = (1 << (c & 7)); - char_set[str_ind] = Pervasives.char_of_int(Caml_bytes.get(char_set, str_ind) | mask); - return /* () */0; -} - -var freeze_char_set = Bytes.to_string; - -function rev_char_set(char_set) { - var char_set$prime = Bytes.make(32, /* "\000" */0); - for(var i = 0; i <= 31; ++i){ - char_set$prime[i] = Pervasives.char_of_int(Caml_string.get(char_set, i) ^ 255); - } - return Caml_string.bytes_to_string(char_set$prime); -} - -function is_in_char_set(char_set, c) { - var str_ind = (c >>> 3); - var mask = (1 << (c & 7)); - return +((Caml_string.get(char_set, str_ind) & mask) !== 0); -} - -function pad_of_pad_opt(pad_opt) { - if (pad_opt) { - return /* Lit_padding */Block.__(0, [ - /* Right */1, - pad_opt[0] - ]); - } - else { - return /* No_padding */0; - } -} - -function prec_of_prec_opt(prec_opt) { - if (prec_opt) { - return /* Lit_precision */[prec_opt[0]]; - } - else { - return /* No_precision */0; - } -} - -function param_format_of_ignored_format(ign, fmt) { - if (typeof ign === "number") { - switch (ign) { - case 0 : - return /* Param_format_EBB */[/* Char */Block.__(0, [fmt])]; - case 1 : - return /* Param_format_EBB */[/* Caml_char */Block.__(1, [fmt])]; - case 2 : - return /* Param_format_EBB */[/* Bool */Block.__(9, [fmt])]; - case 3 : - return /* Param_format_EBB */[/* Reader */Block.__(19, [fmt])]; - case 4 : - return /* Param_format_EBB */[/* Scan_next_char */Block.__(22, [fmt])]; - - } - } - else { - switch (ign.tag | 0) { - case 0 : - return /* Param_format_EBB */[/* String */Block.__(2, [ - pad_of_pad_opt(ign[0]), - fmt - ])]; - case 1 : - return /* Param_format_EBB */[/* Caml_string */Block.__(3, [ - pad_of_pad_opt(ign[0]), - fmt - ])]; - case 2 : - return /* Param_format_EBB */[/* Int */Block.__(4, [ - ign[0], - pad_of_pad_opt(ign[1]), - /* No_precision */0, - fmt - ])]; - case 3 : - return /* Param_format_EBB */[/* Int32 */Block.__(5, [ - ign[0], - pad_of_pad_opt(ign[1]), - /* No_precision */0, - fmt - ])]; - case 4 : - return /* Param_format_EBB */[/* Nativeint */Block.__(6, [ - ign[0], - pad_of_pad_opt(ign[1]), - /* No_precision */0, - fmt - ])]; - case 5 : - return /* Param_format_EBB */[/* Int64 */Block.__(7, [ - ign[0], - pad_of_pad_opt(ign[1]), - /* No_precision */0, - fmt - ])]; - case 6 : - return /* Param_format_EBB */[/* Float */Block.__(8, [ - /* Float_f */0, - pad_of_pad_opt(ign[0]), - prec_of_prec_opt(ign[1]), - fmt - ])]; - case 7 : - return /* Param_format_EBB */[/* Format_arg */Block.__(13, [ - ign[0], - ign[1], - fmt - ])]; - case 8 : - return /* Param_format_EBB */[/* Format_subst */Block.__(14, [ - ign[0], - ign[1], - fmt - ])]; - case 9 : - return /* Param_format_EBB */[/* Scan_char_set */Block.__(20, [ - ign[0], - ign[1], - fmt - ])]; - case 10 : - return /* Param_format_EBB */[/* Scan_get_counter */Block.__(21, [ - ign[0], - fmt - ])]; - - } - } -} - -function buffer_check_size(buf, overhead) { - var len = buf[/* bytes */1].length; - var min_len = buf[/* ind */0] + overhead | 0; - if (min_len > len) { - var new_len = Pervasives.max((len << 1), min_len); - var new_str = Caml_string.caml_create_string(new_len); - Bytes.blit(buf[/* bytes */1], 0, new_str, 0, len); - buf[/* bytes */1] = new_str; - return /* () */0; - } - else { - return 0; - } -} - -function buffer_add_char(buf, c) { - buffer_check_size(buf, 1); - buf[/* bytes */1][buf[/* ind */0]] = c; - buf[/* ind */0] = buf[/* ind */0] + 1 | 0; - return /* () */0; -} - -function buffer_add_string(buf, s) { - var str_len = s.length; - buffer_check_size(buf, str_len); - $$String.blit(s, 0, buf[/* bytes */1], buf[/* ind */0], str_len); - buf[/* ind */0] = buf[/* ind */0] + str_len | 0; - return /* () */0; -} - -function buffer_contents(buf) { - return Bytes.sub_string(buf[/* bytes */1], 0, buf[/* ind */0]); -} - -function char_of_iconv(iconv) { - switch (iconv) { - case 0 : - case 1 : - case 2 : - return /* "d" */100; - case 3 : - case 4 : - case 5 : - return /* "i" */105; - case 6 : - case 7 : - return /* "x" */120; - case 8 : - case 9 : - return /* "X" */88; - case 10 : - case 11 : - return /* "o" */111; - case 12 : - return /* "u" */117; - - } -} - -function char_of_fconv(fconv) { - switch (fconv) { - case 0 : - case 1 : - case 2 : - return /* "f" */102; - case 3 : - case 4 : - case 5 : - return /* "e" */101; - case 6 : - case 7 : - case 8 : - return /* "E" */69; - case 9 : - case 10 : - case 11 : - return /* "g" */103; - case 12 : - case 13 : - case 14 : - return /* "G" */71; - case 15 : - return /* "F" */70; - - } -} - -function char_of_counter(counter) { - switch (counter) { - case 0 : - return /* "l" */108; - case 1 : - return /* "n" */110; - case 2 : - return /* "N" */78; - - } -} - -function bprint_char_set(buf, char_set) { - var print_char = function (buf, i) { - var c = Pervasives.char_of_int(i); - if (c !== 37) { - if (c !== 64) { - return buffer_add_char(buf, c); - } - else { - buffer_add_char(buf, /* "%" */37); - return buffer_add_char(buf, /* "@" */64); - } - } - else { - buffer_add_char(buf, /* "%" */37); - return buffer_add_char(buf, /* "%" */37); - } - }; - var print_out = function (set, _i) { - while(true) { - var i = _i; - if (i < 256) { - if (is_in_char_set(set, Pervasives.char_of_int(i))) { - var set$1 = set; - var i$1 = i; - var match = Pervasives.char_of_int(i$1); - var switcher = match - 45 | 0; - if (switcher > 48 || switcher < 0) { - if (switcher >= 210) { - return print_char(buf, 255); - } - else { - return print_second(set$1, i$1 + 1 | 0); - } - } - else if (switcher > 47 || switcher < 1) { - return print_out(set$1, i$1 + 1 | 0); - } - else { - return print_second(set$1, i$1 + 1 | 0); - } - } - else { - _i = i + 1 | 0; - continue ; - - } - } - else { - return 0; - } - }; - }; - var print_second = function (set, i) { - if (is_in_char_set(set, Pervasives.char_of_int(i))) { - var match = Pervasives.char_of_int(i); - var exit = 0; - var switcher = match - 45 | 0; - if (switcher > 48 || switcher < 0) { - if (switcher >= 210) { - print_char(buf, 254); - return print_char(buf, 255); - } - else { - exit = 1; - } - } - else if (switcher > 47 || switcher < 1) { - if (is_in_char_set(set, Pervasives.char_of_int(i + 1 | 0))) { - exit = 1; - } - else { - print_char(buf, i - 1 | 0); - return print_out(set, i + 1 | 0); - } - } - else { - exit = 1; - } - if (exit === 1) { - if (is_in_char_set(set, Pervasives.char_of_int(i + 1 | 0))) { - var set$1 = set; - var i$1 = i - 1 | 0; - var _j = i + 2 | 0; - while(true) { - var j = _j; - if (j === 256 || !is_in_char_set(set$1, Pervasives.char_of_int(j))) { - print_char(buf, i$1); - print_char(buf, /* "-" */45); - print_char(buf, j - 1 | 0); - if (j < 256) { - return print_out(set$1, j + 1 | 0); - } - else { - return 0; - } - } - else { - _j = j + 1 | 0; - continue ; - - } - }; - } - else { - print_char(buf, i - 1 | 0); - print_char(buf, i); - return print_out(set, i + 2 | 0); - } - } - - } - else { - print_char(buf, i - 1 | 0); - return print_out(set, i + 1 | 0); - } - }; - var print_start = function (set) { - var is_alone = function (c) { - var match_000 = Char.chr(c - 1 | 0); - var match_001 = Char.chr(c + 1 | 0); - if (is_in_char_set(set, c)) { - return 1 - (is_in_char_set(set, match_000) && is_in_char_set(set, match_001)); - } - else { - return /* false */0; - } - }; - if (is_alone(/* "]" */93)) { - buffer_add_char(buf, /* "]" */93); - } - print_out(set, 1); - if (is_alone(/* "-" */45)) { - return buffer_add_char(buf, /* "-" */45); - } - else { - return 0; - } - }; - buffer_add_char(buf, /* "[" */91); - print_start(is_in_char_set(char_set, /* "\000" */0) ? (buffer_add_char(buf, /* "^" */94), rev_char_set(char_set)) : char_set); - return buffer_add_char(buf, /* "]" */93); -} - -function bprint_padty(buf, padty) { - switch (padty) { - case 0 : - return buffer_add_char(buf, /* "-" */45); - case 1 : - return /* () */0; - case 2 : - return buffer_add_char(buf, /* "0" */48); - - } -} - -function bprint_ignored_flag(buf, ign_flag) { - if (ign_flag) { - return buffer_add_char(buf, /* "_" */95); - } - else { - return 0; - } -} - -function bprint_pad_opt(buf, pad_opt) { - if (pad_opt) { - return buffer_add_string(buf, "" + pad_opt[0]); - } - else { - return /* () */0; - } -} - -function bprint_padding(buf, pad) { - if (typeof pad === "number") { - return /* () */0; - } - else { - bprint_padty(buf, pad[0]); - if (pad.tag) { - return buffer_add_char(buf, /* "*" */42); - } - else { - return buffer_add_string(buf, "" + pad[1]); - } - } -} - -function bprint_precision(buf, prec) { - if (typeof prec === "number") { - if (prec !== 0) { - return buffer_add_string(buf, ".*"); - } - else { - return /* () */0; - } - } - else { - buffer_add_char(buf, /* "." */46); - return buffer_add_string(buf, "" + prec[0]); - } -} - -function bprint_iconv_flag(buf, iconv) { - switch (iconv) { - case 1 : - case 4 : - return buffer_add_char(buf, /* "+" */43); - case 2 : - case 5 : - return buffer_add_char(buf, /* " " */32); - case 7 : - case 9 : - case 11 : - return buffer_add_char(buf, /* "#" */35); - case 0 : - case 3 : - case 6 : - case 8 : - case 10 : - case 12 : - return /* () */0; - - } -} - -function bprint_int_fmt(buf, ign_flag, iconv, pad, prec) { - buffer_add_char(buf, /* "%" */37); - bprint_ignored_flag(buf, ign_flag); - bprint_iconv_flag(buf, iconv); - bprint_padding(buf, pad); - bprint_precision(buf, prec); - return buffer_add_char(buf, char_of_iconv(iconv)); -} - -function bprint_altint_fmt(buf, ign_flag, iconv, pad, prec, c) { - buffer_add_char(buf, /* "%" */37); - bprint_ignored_flag(buf, ign_flag); - bprint_iconv_flag(buf, iconv); - bprint_padding(buf, pad); - bprint_precision(buf, prec); - buffer_add_char(buf, c); - return buffer_add_char(buf, char_of_iconv(iconv)); -} - -function bprint_fconv_flag(buf, fconv) { - switch (fconv) { - case 1 : - case 4 : - case 7 : - case 10 : - case 13 : - return buffer_add_char(buf, /* "+" */43); - case 2 : - case 5 : - case 8 : - case 11 : - case 14 : - return buffer_add_char(buf, /* " " */32); - case 0 : - case 3 : - case 6 : - case 9 : - case 12 : - case 15 : - return /* () */0; - - } -} - -function bprint_float_fmt(buf, ign_flag, fconv, pad, prec) { - buffer_add_char(buf, /* "%" */37); - bprint_ignored_flag(buf, ign_flag); - bprint_fconv_flag(buf, fconv); - bprint_padding(buf, pad); - bprint_precision(buf, prec); - return buffer_add_char(buf, char_of_fconv(fconv)); -} - -function string_of_formatting_lit(formatting_lit) { - if (typeof formatting_lit === "number") { - switch (formatting_lit) { - case 0 : - return "@]"; - case 1 : - return "@}"; - case 2 : - return "@?"; - case 3 : - return "@\n"; - case 4 : - return "@."; - case 5 : - return "@@"; - case 6 : - return "@%"; - - } - } - else { - switch (formatting_lit.tag | 0) { - case 0 : - case 1 : - return formatting_lit[0]; - case 2 : - return "@" + Caml_string.bytes_to_string(Bytes.make(1, formatting_lit[0])); - - } - } -} - -function string_of_formatting_gen(formatting_gen) { - return formatting_gen[0][1]; -} - -function bprint_char_literal(buf, chr) { - if (chr !== 37) { - return buffer_add_char(buf, chr); - } - else { - return buffer_add_string(buf, "%%"); - } -} - -function bprint_string_literal(buf, str) { - for(var i = 0 ,i_finish = str.length - 1 | 0; i <= i_finish; ++i){ - bprint_char_literal(buf, Caml_string.get(str, i)); - } - return /* () */0; -} - -function bprint_fmtty(buf, _fmtty) { - while(true) { - var fmtty = _fmtty; - if (typeof fmtty === "number") { - return /* () */0; - } - else { - switch (fmtty.tag | 0) { - case 0 : - buffer_add_string(buf, "%c"); - _fmtty = fmtty[0]; - continue ; - case 1 : - buffer_add_string(buf, "%s"); - _fmtty = fmtty[0]; - continue ; - case 2 : - buffer_add_string(buf, "%i"); - _fmtty = fmtty[0]; - continue ; - case 3 : - buffer_add_string(buf, "%li"); - _fmtty = fmtty[0]; - continue ; - case 4 : - buffer_add_string(buf, "%ni"); - _fmtty = fmtty[0]; - continue ; - case 5 : - buffer_add_string(buf, "%Li"); - _fmtty = fmtty[0]; - continue ; - case 6 : - buffer_add_string(buf, "%f"); - _fmtty = fmtty[0]; - continue ; - case 7 : - buffer_add_string(buf, "%B"); - _fmtty = fmtty[0]; - continue ; - case 8 : - buffer_add_string(buf, "%{"); - bprint_fmtty(buf, fmtty[0]); - buffer_add_string(buf, "%}"); - _fmtty = fmtty[1]; - continue ; - case 9 : - buffer_add_string(buf, "%("); - bprint_fmtty(buf, fmtty[0]); - buffer_add_string(buf, "%)"); - _fmtty = fmtty[2]; - continue ; - case 10 : - buffer_add_string(buf, "%a"); - _fmtty = fmtty[0]; - continue ; - case 11 : - buffer_add_string(buf, "%t"); - _fmtty = fmtty[0]; - continue ; - case 12 : - buffer_add_string(buf, "%?"); - _fmtty = fmtty[0]; - continue ; - case 13 : - buffer_add_string(buf, "%r"); - _fmtty = fmtty[0]; - continue ; - case 14 : - buffer_add_string(buf, "%_r"); - _fmtty = fmtty[0]; - continue ; - - } - } - }; -} - -function int_of_custom_arity(param) { - if (param) { - return 1 + int_of_custom_arity(param[0]) | 0; - } - else { - return 0; - } -} - -function bprint_fmt(buf, fmt) { - var _fmt = fmt; - var _ign_flag = /* false */0; - while(true) { - var ign_flag = _ign_flag; - var fmt$1 = _fmt; - if (typeof fmt$1 === "number") { - return /* () */0; - } - else { - switch (fmt$1.tag | 0) { - case 0 : - buffer_add_char(buf, /* "%" */37); - bprint_ignored_flag(buf, ign_flag); - buffer_add_char(buf, /* "c" */99); - _ign_flag = /* false */0; - _fmt = fmt$1[0]; - continue ; - case 1 : - buffer_add_char(buf, /* "%" */37); - bprint_ignored_flag(buf, ign_flag); - buffer_add_char(buf, /* "C" */67); - _ign_flag = /* false */0; - _fmt = fmt$1[0]; - continue ; - case 2 : - buffer_add_char(buf, /* "%" */37); - bprint_ignored_flag(buf, ign_flag); - bprint_padding(buf, fmt$1[0]); - buffer_add_char(buf, /* "s" */115); - _ign_flag = /* false */0; - _fmt = fmt$1[1]; - continue ; - case 3 : - buffer_add_char(buf, /* "%" */37); - bprint_ignored_flag(buf, ign_flag); - bprint_padding(buf, fmt$1[0]); - buffer_add_char(buf, /* "S" */83); - _ign_flag = /* false */0; - _fmt = fmt$1[1]; - continue ; - case 4 : - bprint_int_fmt(buf, ign_flag, fmt$1[0], fmt$1[1], fmt$1[2]); - _ign_flag = /* false */0; - _fmt = fmt$1[3]; - continue ; - case 5 : - bprint_altint_fmt(buf, ign_flag, fmt$1[0], fmt$1[1], fmt$1[2], /* "l" */108); - _ign_flag = /* false */0; - _fmt = fmt$1[3]; - continue ; - case 6 : - bprint_altint_fmt(buf, ign_flag, fmt$1[0], fmt$1[1], fmt$1[2], /* "n" */110); - _ign_flag = /* false */0; - _fmt = fmt$1[3]; - continue ; - case 7 : - bprint_altint_fmt(buf, ign_flag, fmt$1[0], fmt$1[1], fmt$1[2], /* "L" */76); - _ign_flag = /* false */0; - _fmt = fmt$1[3]; - continue ; - case 8 : - bprint_float_fmt(buf, ign_flag, fmt$1[0], fmt$1[1], fmt$1[2]); - _ign_flag = /* false */0; - _fmt = fmt$1[3]; - continue ; - case 9 : - buffer_add_char(buf, /* "%" */37); - bprint_ignored_flag(buf, ign_flag); - buffer_add_char(buf, /* "B" */66); - _ign_flag = /* false */0; - _fmt = fmt$1[0]; - continue ; - case 10 : - buffer_add_string(buf, "%!"); - _fmt = fmt$1[0]; - continue ; - case 11 : - bprint_string_literal(buf, fmt$1[0]); - _fmt = fmt$1[1]; - continue ; - case 12 : - bprint_char_literal(buf, fmt$1[0]); - _fmt = fmt$1[1]; - continue ; - case 13 : - buffer_add_char(buf, /* "%" */37); - bprint_ignored_flag(buf, ign_flag); - bprint_pad_opt(buf, fmt$1[0]); - buffer_add_char(buf, /* "{" */123); - bprint_fmtty(buf, fmt$1[1]); - buffer_add_char(buf, /* "%" */37); - buffer_add_char(buf, /* "}" */125); - _ign_flag = /* false */0; - _fmt = fmt$1[2]; - continue ; - case 14 : - buffer_add_char(buf, /* "%" */37); - bprint_ignored_flag(buf, ign_flag); - bprint_pad_opt(buf, fmt$1[0]); - buffer_add_char(buf, /* "(" */40); - bprint_fmtty(buf, fmt$1[1]); - buffer_add_char(buf, /* "%" */37); - buffer_add_char(buf, /* ")" */41); - _ign_flag = /* false */0; - _fmt = fmt$1[2]; - continue ; - case 15 : - buffer_add_char(buf, /* "%" */37); - bprint_ignored_flag(buf, ign_flag); - buffer_add_char(buf, /* "a" */97); - _ign_flag = /* false */0; - _fmt = fmt$1[0]; - continue ; - case 16 : - buffer_add_char(buf, /* "%" */37); - bprint_ignored_flag(buf, ign_flag); - buffer_add_char(buf, /* "t" */116); - _ign_flag = /* false */0; - _fmt = fmt$1[0]; - continue ; - case 17 : - bprint_string_literal(buf, string_of_formatting_lit(fmt$1[0])); - _fmt = fmt$1[1]; - continue ; - case 18 : - bprint_string_literal(buf, "@{"); - bprint_string_literal(buf, string_of_formatting_gen(fmt$1[0])); - _fmt = fmt$1[1]; - continue ; - case 19 : - buffer_add_char(buf, /* "%" */37); - bprint_ignored_flag(buf, ign_flag); - buffer_add_char(buf, /* "r" */114); - _ign_flag = /* false */0; - _fmt = fmt$1[0]; - continue ; - case 20 : - buffer_add_char(buf, /* "%" */37); - bprint_ignored_flag(buf, ign_flag); - bprint_pad_opt(buf, fmt$1[0]); - bprint_char_set(buf, fmt$1[1]); - _ign_flag = /* false */0; - _fmt = fmt$1[2]; - continue ; - case 21 : - buffer_add_char(buf, /* "%" */37); - bprint_ignored_flag(buf, ign_flag); - buffer_add_char(buf, char_of_counter(fmt$1[0])); - _ign_flag = /* false */0; - _fmt = fmt$1[1]; - continue ; - case 22 : - buffer_add_char(buf, /* "%" */37); - bprint_ignored_flag(buf, ign_flag); - bprint_string_literal(buf, "0c"); - _ign_flag = /* false */0; - _fmt = fmt$1[0]; - continue ; - case 23 : - var match = param_format_of_ignored_format(fmt$1[0], fmt$1[1]); - _ign_flag = /* true */1; - _fmt = match[0]; - continue ; - case 24 : - for(var _i = 1 ,_i_finish = int_of_custom_arity(fmt$1[0]); _i <= _i_finish; ++_i){ - buffer_add_char(buf, /* "%" */37); - bprint_ignored_flag(buf, ign_flag); - buffer_add_char(buf, /* "?" */63); - } - _ign_flag = /* false */0; - _fmt = fmt$1[2]; - continue ; - - } - } - }; -} - -function string_of_fmt(fmt) { - var buf = /* record */[ - /* ind */0, - /* bytes */new Array(16) - ]; - bprint_fmt(buf, fmt); - return buffer_contents(buf); -} - -function symm(param) { - if (typeof param === "number") { - return /* End_of_fmtty */0; - } - else { - switch (param.tag | 0) { - case 0 : - return /* Char_ty */Block.__(0, [symm(param[0])]); - case 1 : - return /* String_ty */Block.__(1, [symm(param[0])]); - case 2 : - return /* Int_ty */Block.__(2, [symm(param[0])]); - case 3 : - return /* Int32_ty */Block.__(3, [symm(param[0])]); - case 4 : - return /* Nativeint_ty */Block.__(4, [symm(param[0])]); - case 5 : - return /* Int64_ty */Block.__(5, [symm(param[0])]); - case 6 : - return /* Float_ty */Block.__(6, [symm(param[0])]); - case 7 : - return /* Bool_ty */Block.__(7, [symm(param[0])]); - case 8 : - return /* Format_arg_ty */Block.__(8, [ - param[0], - symm(param[1]) - ]); - case 9 : - return /* Format_subst_ty */Block.__(9, [ - param[1], - param[0], - symm(param[2]) - ]); - case 10 : - return /* Alpha_ty */Block.__(10, [symm(param[0])]); - case 11 : - return /* Theta_ty */Block.__(11, [symm(param[0])]); - case 12 : - return /* Any_ty */Block.__(12, [symm(param[0])]); - case 13 : - return /* Reader_ty */Block.__(13, [symm(param[0])]); - case 14 : - return /* Ignored_reader_ty */Block.__(14, [symm(param[0])]); - - } - } -} - -function fmtty_rel_det(param) { - if (typeof param === "number") { - return /* tuple */[ - function () { - return /* Refl */0; - }, - function () { - return /* Refl */0; - }, - function () { - return /* Refl */0; - }, - function () { - return /* Refl */0; - } - ]; - } - else { - switch (param.tag | 0) { - case 0 : - var match = fmtty_rel_det(param[0]); - var af = match[1]; - var fa = match[0]; - return /* tuple */[ - function () { - Curry._1(fa, /* Refl */0); - return /* Refl */0; - }, - function () { - Curry._1(af, /* Refl */0); - return /* Refl */0; - }, - match[2], - match[3] - ]; - case 1 : - var match$1 = fmtty_rel_det(param[0]); - var af$1 = match$1[1]; - var fa$1 = match$1[0]; - return /* tuple */[ - function () { - Curry._1(fa$1, /* Refl */0); - return /* Refl */0; - }, - function () { - Curry._1(af$1, /* Refl */0); - return /* Refl */0; - }, - match$1[2], - match$1[3] - ]; - case 2 : - var match$2 = fmtty_rel_det(param[0]); - var af$2 = match$2[1]; - var fa$2 = match$2[0]; - return /* tuple */[ - function () { - Curry._1(fa$2, /* Refl */0); - return /* Refl */0; - }, - function () { - Curry._1(af$2, /* Refl */0); - return /* Refl */0; - }, - match$2[2], - match$2[3] - ]; - case 3 : - var match$3 = fmtty_rel_det(param[0]); - var af$3 = match$3[1]; - var fa$3 = match$3[0]; - return /* tuple */[ - function () { - Curry._1(fa$3, /* Refl */0); - return /* Refl */0; - }, - function () { - Curry._1(af$3, /* Refl */0); - return /* Refl */0; - }, - match$3[2], - match$3[3] - ]; - case 4 : - var match$4 = fmtty_rel_det(param[0]); - var af$4 = match$4[1]; - var fa$4 = match$4[0]; - return /* tuple */[ - function () { - Curry._1(fa$4, /* Refl */0); - return /* Refl */0; - }, - function () { - Curry._1(af$4, /* Refl */0); - return /* Refl */0; - }, - match$4[2], - match$4[3] - ]; - case 5 : - var match$5 = fmtty_rel_det(param[0]); - var af$5 = match$5[1]; - var fa$5 = match$5[0]; - return /* tuple */[ - function () { - Curry._1(fa$5, /* Refl */0); - return /* Refl */0; - }, - function () { - Curry._1(af$5, /* Refl */0); - return /* Refl */0; - }, - match$5[2], - match$5[3] - ]; - case 6 : - var match$6 = fmtty_rel_det(param[0]); - var af$6 = match$6[1]; - var fa$6 = match$6[0]; - return /* tuple */[ - function () { - Curry._1(fa$6, /* Refl */0); - return /* Refl */0; - }, - function () { - Curry._1(af$6, /* Refl */0); - return /* Refl */0; - }, - match$6[2], - match$6[3] - ]; - case 7 : - var match$7 = fmtty_rel_det(param[0]); - var af$7 = match$7[1]; - var fa$7 = match$7[0]; - return /* tuple */[ - function () { - Curry._1(fa$7, /* Refl */0); - return /* Refl */0; - }, - function () { - Curry._1(af$7, /* Refl */0); - return /* Refl */0; - }, - match$7[2], - match$7[3] - ]; - case 8 : - var match$8 = fmtty_rel_det(param[1]); - var af$8 = match$8[1]; - var fa$8 = match$8[0]; - return /* tuple */[ - function () { - Curry._1(fa$8, /* Refl */0); - return /* Refl */0; - }, - function () { - Curry._1(af$8, /* Refl */0); - return /* Refl */0; - }, - match$8[2], - match$8[3] - ]; - case 9 : - var match$9 = fmtty_rel_det(param[2]); - var de = match$9[3]; - var ed = match$9[2]; - var af$9 = match$9[1]; - var fa$9 = match$9[0]; - var ty = trans(symm(param[0]), param[1]); - var match$10 = fmtty_rel_det(ty); - var jd = match$10[3]; - var dj = match$10[2]; - var ga = match$10[1]; - var ag = match$10[0]; - return /* tuple */[ - function () { - Curry._1(fa$9, /* Refl */0); - Curry._1(ag, /* Refl */0); - return /* Refl */0; - }, - function () { - Curry._1(ga, /* Refl */0); - Curry._1(af$9, /* Refl */0); - return /* Refl */0; - }, - function () { - Curry._1(ed, /* Refl */0); - Curry._1(dj, /* Refl */0); - return /* Refl */0; - }, - function () { - Curry._1(jd, /* Refl */0); - Curry._1(de, /* Refl */0); - return /* Refl */0; - } - ]; - case 10 : - var match$11 = fmtty_rel_det(param[0]); - var af$10 = match$11[1]; - var fa$10 = match$11[0]; - return /* tuple */[ - function () { - Curry._1(fa$10, /* Refl */0); - return /* Refl */0; - }, - function () { - Curry._1(af$10, /* Refl */0); - return /* Refl */0; - }, - match$11[2], - match$11[3] - ]; - case 11 : - var match$12 = fmtty_rel_det(param[0]); - var af$11 = match$12[1]; - var fa$11 = match$12[0]; - return /* tuple */[ - function () { - Curry._1(fa$11, /* Refl */0); - return /* Refl */0; - }, - function () { - Curry._1(af$11, /* Refl */0); - return /* Refl */0; - }, - match$12[2], - match$12[3] - ]; - case 12 : - var match$13 = fmtty_rel_det(param[0]); - var af$12 = match$13[1]; - var fa$12 = match$13[0]; - return /* tuple */[ - function () { - Curry._1(fa$12, /* Refl */0); - return /* Refl */0; - }, - function () { - Curry._1(af$12, /* Refl */0); - return /* Refl */0; - }, - match$13[2], - match$13[3] - ]; - case 13 : - var match$14 = fmtty_rel_det(param[0]); - var de$1 = match$14[3]; - var ed$1 = match$14[2]; - var af$13 = match$14[1]; - var fa$13 = match$14[0]; - return /* tuple */[ - function () { - Curry._1(fa$13, /* Refl */0); - return /* Refl */0; - }, - function () { - Curry._1(af$13, /* Refl */0); - return /* Refl */0; - }, - function () { - Curry._1(ed$1, /* Refl */0); - return /* Refl */0; - }, - function () { - Curry._1(de$1, /* Refl */0); - return /* Refl */0; - } - ]; - case 14 : - var match$15 = fmtty_rel_det(param[0]); - var de$2 = match$15[3]; - var ed$2 = match$15[2]; - var af$14 = match$15[1]; - var fa$14 = match$15[0]; - return /* tuple */[ - function () { - Curry._1(fa$14, /* Refl */0); - return /* Refl */0; - }, - function () { - Curry._1(af$14, /* Refl */0); - return /* Refl */0; - }, - function () { - Curry._1(ed$2, /* Refl */0); - return /* Refl */0; - }, - function () { - Curry._1(de$2, /* Refl */0); - return /* Refl */0; - } - ]; - - } - } -} - -function trans(ty1, ty2) { - var exit = 0; - if (typeof ty1 === "number") { - if (typeof ty2 === "number") { - if (ty2) { - throw [ - Caml_builtin_exceptions.assert_failure, - [ - "camlinternalFormat.ml", - 816, - 23 - ] - ]; - } - else { - return /* End_of_fmtty */0; - } - } - else { - switch (ty2.tag | 0) { - case 8 : - exit = 6; - break; - case 9 : - exit = 7; - break; - case 10 : - exit = 1; - break; - case 11 : - exit = 2; - break; - case 12 : - exit = 3; - break; - case 13 : - exit = 4; - break; - case 14 : - exit = 5; - break; - default: - throw [ - Caml_builtin_exceptions.assert_failure, - [ - "camlinternalFormat.ml", - 816, - 23 - ] - ]; - } - } - } - else { - switch (ty1.tag | 0) { - case 0 : - if (typeof ty2 === "number") { - exit = 8; - } - else { - switch (ty2.tag | 0) { - case 0 : - return /* Char_ty */Block.__(0, [trans(ty1[0], ty2[0])]); - case 8 : - exit = 6; - break; - case 9 : - exit = 7; - break; - case 10 : - exit = 1; - break; - case 11 : - exit = 2; - break; - case 12 : - exit = 3; - break; - case 13 : - exit = 4; - break; - case 14 : - exit = 5; - break; - - } - } - break; - case 1 : - if (typeof ty2 === "number") { - exit = 8; - } - else { - switch (ty2.tag | 0) { - case 1 : - return /* String_ty */Block.__(1, [trans(ty1[0], ty2[0])]); - case 8 : - exit = 6; - break; - case 9 : - exit = 7; - break; - case 10 : - exit = 1; - break; - case 11 : - exit = 2; - break; - case 12 : - exit = 3; - break; - case 13 : - exit = 4; - break; - case 14 : - exit = 5; - break; - - } - } - break; - case 2 : - if (typeof ty2 === "number") { - exit = 8; - } - else { - switch (ty2.tag | 0) { - case 2 : - return /* Int_ty */Block.__(2, [trans(ty1[0], ty2[0])]); - case 8 : - exit = 6; - break; - case 9 : - exit = 7; - break; - case 10 : - exit = 1; - break; - case 11 : - exit = 2; - break; - case 12 : - exit = 3; - break; - case 13 : - exit = 4; - break; - case 14 : - exit = 5; - break; - - } - } - break; - case 3 : - if (typeof ty2 === "number") { - exit = 8; - } - else { - switch (ty2.tag | 0) { - case 3 : - return /* Int32_ty */Block.__(3, [trans(ty1[0], ty2[0])]); - case 8 : - exit = 6; - break; - case 9 : - exit = 7; - break; - case 10 : - exit = 1; - break; - case 11 : - exit = 2; - break; - case 12 : - exit = 3; - break; - case 13 : - exit = 4; - break; - case 14 : - exit = 5; - break; - - } - } - break; - case 4 : - if (typeof ty2 === "number") { - exit = 8; - } - else { - switch (ty2.tag | 0) { - case 4 : - return /* Nativeint_ty */Block.__(4, [trans(ty1[0], ty2[0])]); - case 8 : - exit = 6; - break; - case 9 : - exit = 7; - break; - case 10 : - exit = 1; - break; - case 11 : - exit = 2; - break; - case 12 : - exit = 3; - break; - case 13 : - exit = 4; - break; - case 14 : - exit = 5; - break; - - } - } - break; - case 5 : - if (typeof ty2 === "number") { - exit = 8; - } - else { - switch (ty2.tag | 0) { - case 5 : - return /* Int64_ty */Block.__(5, [trans(ty1[0], ty2[0])]); - case 8 : - exit = 6; - break; - case 9 : - exit = 7; - break; - case 10 : - exit = 1; - break; - case 11 : - exit = 2; - break; - case 12 : - exit = 3; - break; - case 13 : - exit = 4; - break; - case 14 : - exit = 5; - break; - - } - } - break; - case 6 : - if (typeof ty2 === "number") { - exit = 8; - } - else { - switch (ty2.tag | 0) { - case 6 : - return /* Float_ty */Block.__(6, [trans(ty1[0], ty2[0])]); - case 8 : - exit = 6; - break; - case 9 : - exit = 7; - break; - case 10 : - exit = 1; - break; - case 11 : - exit = 2; - break; - case 12 : - exit = 3; - break; - case 13 : - exit = 4; - break; - case 14 : - exit = 5; - break; - - } - } - break; - case 7 : - if (typeof ty2 === "number") { - exit = 8; - } - else { - switch (ty2.tag | 0) { - case 7 : - return /* Bool_ty */Block.__(7, [trans(ty1[0], ty2[0])]); - case 8 : - exit = 6; - break; - case 9 : - exit = 7; - break; - case 10 : - exit = 1; - break; - case 11 : - exit = 2; - break; - case 12 : - exit = 3; - break; - case 13 : - exit = 4; - break; - case 14 : - exit = 5; - break; - - } - } - break; - case 8 : - if (typeof ty2 === "number") { - throw [ - Caml_builtin_exceptions.assert_failure, - [ - "camlinternalFormat.ml", - 802, - 26 - ] - ]; - } - else { - switch (ty2.tag | 0) { - case 8 : - return /* Format_arg_ty */Block.__(8, [ - trans(ty1[0], ty2[0]), - trans(ty1[1], ty2[1]) - ]); - case 10 : - exit = 1; - break; - case 11 : - exit = 2; - break; - case 12 : - exit = 3; - break; - case 13 : - exit = 4; - break; - case 14 : - exit = 5; - break; - default: - throw [ - Caml_builtin_exceptions.assert_failure, - [ - "camlinternalFormat.ml", - 802, - 26 - ] - ]; - } - } - break; - case 9 : - if (typeof ty2 === "number") { - throw [ - Caml_builtin_exceptions.assert_failure, - [ - "camlinternalFormat.ml", - 812, - 28 - ] - ]; - } - else { - switch (ty2.tag | 0) { - case 8 : - exit = 6; - break; - case 9 : - var ty = trans(symm(ty1[1]), ty2[0]); - var match = fmtty_rel_det(ty); - Curry._1(match[1], /* Refl */0); - Curry._1(match[3], /* Refl */0); - return /* Format_subst_ty */Block.__(9, [ - ty1[0], - ty2[1], - trans(ty1[2], ty2[2]) - ]); - case 10 : - exit = 1; - break; - case 11 : - exit = 2; - break; - case 12 : - exit = 3; - break; - case 13 : - exit = 4; - break; - case 14 : - exit = 5; - break; - default: - throw [ - Caml_builtin_exceptions.assert_failure, - [ - "camlinternalFormat.ml", - 812, - 28 - ] - ]; - } - } - break; - case 10 : - if (typeof ty2 === "number") { - throw [ - Caml_builtin_exceptions.assert_failure, - [ - "camlinternalFormat.ml", - 780, - 21 - ] - ]; - } - else if (ty2.tag === 10) { - return /* Alpha_ty */Block.__(10, [trans(ty1[0], ty2[0])]); - } - else { - throw [ - Caml_builtin_exceptions.assert_failure, - [ - "camlinternalFormat.ml", - 780, - 21 - ] - ]; - } - break; - case 11 : - if (typeof ty2 === "number") { - throw [ - Caml_builtin_exceptions.assert_failure, - [ - "camlinternalFormat.ml", - 784, - 21 - ] - ]; - } - else { - switch (ty2.tag | 0) { - case 10 : - exit = 1; - break; - case 11 : - return /* Theta_ty */Block.__(11, [trans(ty1[0], ty2[0])]); - default: - throw [ - Caml_builtin_exceptions.assert_failure, - [ - "camlinternalFormat.ml", - 784, - 21 - ] - ]; - } - } - break; - case 12 : - if (typeof ty2 === "number") { - throw [ - Caml_builtin_exceptions.assert_failure, - [ - "camlinternalFormat.ml", - 788, - 19 - ] - ]; - } - else { - switch (ty2.tag | 0) { - case 10 : - exit = 1; - break; - case 11 : - exit = 2; - break; - case 12 : - return /* Any_ty */Block.__(12, [trans(ty1[0], ty2[0])]); - default: - throw [ - Caml_builtin_exceptions.assert_failure, - [ - "camlinternalFormat.ml", - 788, - 19 - ] - ]; - } - } - break; - case 13 : - if (typeof ty2 === "number") { - throw [ - Caml_builtin_exceptions.assert_failure, - [ - "camlinternalFormat.ml", - 792, - 22 - ] - ]; - } - else { - switch (ty2.tag | 0) { - case 10 : - exit = 1; - break; - case 11 : - exit = 2; - break; - case 12 : - exit = 3; - break; - case 13 : - return /* Reader_ty */Block.__(13, [trans(ty1[0], ty2[0])]); - default: - throw [ - Caml_builtin_exceptions.assert_failure, - [ - "camlinternalFormat.ml", - 792, - 22 - ] - ]; - } - } - break; - case 14 : - if (typeof ty2 === "number") { - throw [ - Caml_builtin_exceptions.assert_failure, - [ - "camlinternalFormat.ml", - 797, - 30 - ] - ]; - } - else { - switch (ty2.tag | 0) { - case 10 : - exit = 1; - break; - case 11 : - exit = 2; - break; - case 12 : - exit = 3; - break; - case 13 : - exit = 4; - break; - case 14 : - return /* Ignored_reader_ty */Block.__(14, [trans(ty1[0], ty2[0])]); - default: - throw [ - Caml_builtin_exceptions.assert_failure, - [ - "camlinternalFormat.ml", - 797, - 30 - ] - ]; - } - } - break; - - } - } - switch (exit) { - case 1 : - throw [ - Caml_builtin_exceptions.assert_failure, - [ - "camlinternalFormat.ml", - 781, - 21 - ] - ]; - case 2 : - throw [ - Caml_builtin_exceptions.assert_failure, - [ - "camlinternalFormat.ml", - 785, - 21 - ] - ]; - case 3 : - throw [ - Caml_builtin_exceptions.assert_failure, - [ - "camlinternalFormat.ml", - 789, - 19 - ] - ]; - case 4 : - throw [ - Caml_builtin_exceptions.assert_failure, - [ - "camlinternalFormat.ml", - 793, - 22 - ] - ]; - case 5 : - throw [ - Caml_builtin_exceptions.assert_failure, - [ - "camlinternalFormat.ml", - 798, - 30 - ] - ]; - case 6 : - throw [ - Caml_builtin_exceptions.assert_failure, - [ - "camlinternalFormat.ml", - 803, - 26 - ] - ]; - case 7 : - throw [ - Caml_builtin_exceptions.assert_failure, - [ - "camlinternalFormat.ml", - 813, - 28 - ] - ]; - case 8 : - throw [ - Caml_builtin_exceptions.assert_failure, - [ - "camlinternalFormat.ml", - 817, - 23 - ] - ]; - - } -} - -function fmtty_of_formatting_gen(formatting_gen) { - return fmtty_of_fmt(formatting_gen[0][0]); -} - -function fmtty_of_fmt(_fmtty) { - while(true) { - var fmtty = _fmtty; - if (typeof fmtty === "number") { - return /* End_of_fmtty */0; - } - else { - switch (fmtty.tag | 0) { - case 2 : - case 3 : - return fmtty_of_padding_fmtty(fmtty[0], /* String_ty */Block.__(1, [fmtty_of_fmt(fmtty[1])])); - case 4 : - var ty_rest = fmtty_of_fmt(fmtty[3]); - var prec_ty = fmtty_of_precision_fmtty(fmtty[2], /* Int_ty */Block.__(2, [ty_rest])); - return fmtty_of_padding_fmtty(fmtty[1], prec_ty); - case 5 : - var ty_rest$1 = fmtty_of_fmt(fmtty[3]); - var prec_ty$1 = fmtty_of_precision_fmtty(fmtty[2], /* Int32_ty */Block.__(3, [ty_rest$1])); - return fmtty_of_padding_fmtty(fmtty[1], prec_ty$1); - case 6 : - var ty_rest$2 = fmtty_of_fmt(fmtty[3]); - var prec_ty$2 = fmtty_of_precision_fmtty(fmtty[2], /* Nativeint_ty */Block.__(4, [ty_rest$2])); - return fmtty_of_padding_fmtty(fmtty[1], prec_ty$2); - case 7 : - var ty_rest$3 = fmtty_of_fmt(fmtty[3]); - var prec_ty$3 = fmtty_of_precision_fmtty(fmtty[2], /* Int64_ty */Block.__(5, [ty_rest$3])); - return fmtty_of_padding_fmtty(fmtty[1], prec_ty$3); - case 8 : - var ty_rest$4 = fmtty_of_fmt(fmtty[3]); - var prec_ty$4 = fmtty_of_precision_fmtty(fmtty[2], /* Float_ty */Block.__(6, [ty_rest$4])); - return fmtty_of_padding_fmtty(fmtty[1], prec_ty$4); - case 9 : - return /* Bool_ty */Block.__(7, [fmtty_of_fmt(fmtty[0])]); - case 10 : - _fmtty = fmtty[0]; - continue ; - case 13 : - return /* Format_arg_ty */Block.__(8, [ - fmtty[1], - fmtty_of_fmt(fmtty[2]) - ]); - case 14 : - var ty = fmtty[1]; - return /* Format_subst_ty */Block.__(9, [ - ty, - ty, - fmtty_of_fmt(fmtty[2]) - ]); - case 15 : - return /* Alpha_ty */Block.__(10, [fmtty_of_fmt(fmtty[0])]); - case 16 : - return /* Theta_ty */Block.__(11, [fmtty_of_fmt(fmtty[0])]); - case 11 : - case 12 : - case 17 : - _fmtty = fmtty[1]; - continue ; - case 18 : - return CamlinternalFormatBasics.concat_fmtty(fmtty_of_formatting_gen(fmtty[0]), fmtty_of_fmt(fmtty[1])); - case 19 : - return /* Reader_ty */Block.__(13, [fmtty_of_fmt(fmtty[0])]); - case 20 : - return /* String_ty */Block.__(1, [fmtty_of_fmt(fmtty[2])]); - case 21 : - return /* Int_ty */Block.__(2, [fmtty_of_fmt(fmtty[1])]); - case 0 : - case 1 : - case 22 : - return /* Char_ty */Block.__(0, [fmtty_of_fmt(fmtty[0])]); - case 23 : - var ign = fmtty[0]; - var fmt = fmtty[1]; - if (typeof ign === "number") { - switch (ign) { - case 3 : - return /* Ignored_reader_ty */Block.__(14, [fmtty_of_fmt(fmt)]); - case 0 : - case 1 : - case 2 : - case 4 : - return fmtty_of_fmt(fmt); - - } - } - else { - switch (ign.tag | 0) { - case 8 : - return CamlinternalFormatBasics.concat_fmtty(ign[1], fmtty_of_fmt(fmt)); - case 0 : - case 1 : - case 2 : - case 3 : - case 4 : - case 5 : - case 6 : - case 7 : - case 9 : - case 10 : - return fmtty_of_fmt(fmt); - - } - } - case 24 : - return fmtty_of_custom(fmtty[0], fmtty_of_fmt(fmtty[2])); - - } - } - }; -} - -function fmtty_of_custom(arity, fmtty) { - if (arity) { - return /* Any_ty */Block.__(12, [fmtty_of_custom(arity[0], fmtty)]); - } - else { - return fmtty; - } -} - -function fmtty_of_padding_fmtty(pad, fmtty) { - if (typeof pad === "number" || !pad.tag) { - return fmtty; - } - else { - return /* Int_ty */Block.__(2, [fmtty]); - } -} - -function fmtty_of_precision_fmtty(prec, fmtty) { - if (typeof prec === "number" && prec !== 0) { - return /* Int_ty */Block.__(2, [fmtty]); - } - else { - return fmtty; - } -} - -var Type_mismatch = Caml_exceptions.create("CamlinternalFormat.Type_mismatch"); - -function type_padding(pad, fmtty) { - if (typeof pad === "number") { - return /* Padding_fmtty_EBB */[ - /* No_padding */0, - fmtty - ]; - } - else if (pad.tag) { - if (typeof fmtty === "number") { - throw Type_mismatch; - } - else if (fmtty.tag === 2) { - return /* Padding_fmtty_EBB */[ - /* Arg_padding */Block.__(1, [pad[0]]), - fmtty[0] - ]; - } - else { - throw Type_mismatch; - } - } - else { - return /* Padding_fmtty_EBB */[ - /* Lit_padding */Block.__(0, [ - pad[0], - pad[1] - ]), - fmtty - ]; - } -} - -function type_padprec(pad, prec, fmtty) { - var match = type_padding(pad, fmtty); - if (typeof prec === "number") { - if (prec !== 0) { - var match$1 = match[1]; - if (typeof match$1 === "number") { - throw Type_mismatch; - } - else if (match$1.tag === 2) { - return /* Padprec_fmtty_EBB */[ - match[0], - /* Arg_precision */1, - match$1[0] - ]; - } - else { - throw Type_mismatch; - } - } - else { - return /* Padprec_fmtty_EBB */[ - match[0], - /* No_precision */0, - match[1] - ]; - } - } - else { - return /* Padprec_fmtty_EBB */[ - match[0], - /* Lit_precision */[prec[0]], - match[1] - ]; - } -} - -function type_ignored_param_one(ign, fmt, fmtty) { - var match = type_format_gen(fmt, fmtty); - return /* Fmt_fmtty_EBB */[ - /* Ignored_param */Block.__(23, [ - ign, - match[0] - ]), - match[1] - ]; -} - -function type_format_gen(fmt, fmtty) { - if (typeof fmt === "number") { - return /* Fmt_fmtty_EBB */[ - /* End_of_format */0, - fmtty - ]; - } - else { - switch (fmt.tag | 0) { - case 0 : - if (typeof fmtty === "number") { - throw Type_mismatch; - } - else if (fmtty.tag) { - throw Type_mismatch; - } - else { - var match = type_format_gen(fmt[0], fmtty[0]); - return /* Fmt_fmtty_EBB */[ - /* Char */Block.__(0, [match[0]]), - match[1] - ]; - } - break; - case 1 : - if (typeof fmtty === "number") { - throw Type_mismatch; - } - else if (fmtty.tag) { - throw Type_mismatch; - } - else { - var match$1 = type_format_gen(fmt[0], fmtty[0]); - return /* Fmt_fmtty_EBB */[ - /* Caml_char */Block.__(1, [match$1[0]]), - match$1[1] - ]; - } - break; - case 2 : - var match$2 = type_padding(fmt[0], fmtty); - var match$3 = match$2[1]; - if (typeof match$3 === "number") { - throw Type_mismatch; - } - else if (match$3.tag === 1) { - var match$4 = type_format_gen(fmt[1], match$3[0]); - return /* Fmt_fmtty_EBB */[ - /* String */Block.__(2, [ - match$2[0], - match$4[0] - ]), - match$4[1] - ]; - } - else { - throw Type_mismatch; - } - break; - case 3 : - var match$5 = type_padding(fmt[0], fmtty); - var match$6 = match$5[1]; - if (typeof match$6 === "number") { - throw Type_mismatch; - } - else if (match$6.tag === 1) { - var match$7 = type_format_gen(fmt[1], match$6[0]); - return /* Fmt_fmtty_EBB */[ - /* Caml_string */Block.__(3, [ - match$5[0], - match$7[0] - ]), - match$7[1] - ]; - } - else { - throw Type_mismatch; - } - break; - case 4 : - var match$8 = type_padprec(fmt[1], fmt[2], fmtty); - var match$9 = match$8[2]; - if (typeof match$9 === "number") { - throw Type_mismatch; - } - else if (match$9.tag === 2) { - var match$10 = type_format_gen(fmt[3], match$9[0]); - return /* Fmt_fmtty_EBB */[ - /* Int */Block.__(4, [ - fmt[0], - match$8[0], - match$8[1], - match$10[0] - ]), - match$10[1] - ]; - } - else { - throw Type_mismatch; - } - break; - case 5 : - var match$11 = type_padprec(fmt[1], fmt[2], fmtty); - var match$12 = match$11[2]; - if (typeof match$12 === "number") { - throw Type_mismatch; - } - else if (match$12.tag === 3) { - var match$13 = type_format_gen(fmt[3], match$12[0]); - return /* Fmt_fmtty_EBB */[ - /* Int32 */Block.__(5, [ - fmt[0], - match$11[0], - match$11[1], - match$13[0] - ]), - match$13[1] - ]; - } - else { - throw Type_mismatch; - } - break; - case 6 : - var match$14 = type_padprec(fmt[1], fmt[2], fmtty); - var match$15 = match$14[2]; - if (typeof match$15 === "number") { - throw Type_mismatch; - } - else if (match$15.tag === 4) { - var match$16 = type_format_gen(fmt[3], match$15[0]); - return /* Fmt_fmtty_EBB */[ - /* Nativeint */Block.__(6, [ - fmt[0], - match$14[0], - match$14[1], - match$16[0] - ]), - match$16[1] - ]; - } - else { - throw Type_mismatch; - } - break; - case 7 : - var match$17 = type_padprec(fmt[1], fmt[2], fmtty); - var match$18 = match$17[2]; - if (typeof match$18 === "number") { - throw Type_mismatch; - } - else if (match$18.tag === 5) { - var match$19 = type_format_gen(fmt[3], match$18[0]); - return /* Fmt_fmtty_EBB */[ - /* Int64 */Block.__(7, [ - fmt[0], - match$17[0], - match$17[1], - match$19[0] - ]), - match$19[1] - ]; - } - else { - throw Type_mismatch; - } - break; - case 8 : - var match$20 = type_padprec(fmt[1], fmt[2], fmtty); - var match$21 = match$20[2]; - if (typeof match$21 === "number") { - throw Type_mismatch; - } - else if (match$21.tag === 6) { - var match$22 = type_format_gen(fmt[3], match$21[0]); - return /* Fmt_fmtty_EBB */[ - /* Float */Block.__(8, [ - fmt[0], - match$20[0], - match$20[1], - match$22[0] - ]), - match$22[1] - ]; - } - else { - throw Type_mismatch; - } - break; - case 9 : - if (typeof fmtty === "number") { - throw Type_mismatch; - } - else if (fmtty.tag === 7) { - var match$23 = type_format_gen(fmt[0], fmtty[0]); - return /* Fmt_fmtty_EBB */[ - /* Bool */Block.__(9, [match$23[0]]), - match$23[1] - ]; - } - else { - throw Type_mismatch; - } - break; - case 10 : - var match$24 = type_format_gen(fmt[0], fmtty); - return /* Fmt_fmtty_EBB */[ - /* Flush */Block.__(10, [match$24[0]]), - match$24[1] - ]; - case 11 : - var match$25 = type_format_gen(fmt[1], fmtty); - return /* Fmt_fmtty_EBB */[ - /* String_literal */Block.__(11, [ - fmt[0], - match$25[0] - ]), - match$25[1] - ]; - case 12 : - var match$26 = type_format_gen(fmt[1], fmtty); - return /* Fmt_fmtty_EBB */[ - /* Char_literal */Block.__(12, [ - fmt[0], - match$26[0] - ]), - match$26[1] - ]; - case 13 : - if (typeof fmtty === "number") { - throw Type_mismatch; - } - else if (fmtty.tag === 8) { - var sub_fmtty$prime = fmtty[0]; - if (Caml_obj.caml_notequal(/* Fmtty_EBB */[fmt[1]], /* Fmtty_EBB */[sub_fmtty$prime])) { - throw Type_mismatch; - } - var match$27 = type_format_gen(fmt[2], fmtty[1]); - return /* Fmt_fmtty_EBB */[ - /* Format_arg */Block.__(13, [ - fmt[0], - sub_fmtty$prime, - match$27[0] - ]), - match$27[1] - ]; - } - else { - throw Type_mismatch; - } - break; - case 14 : - if (typeof fmtty === "number") { - throw Type_mismatch; - } - else if (fmtty.tag === 9) { - var sub_fmtty1 = fmtty[0]; - if (Caml_obj.caml_notequal(/* Fmtty_EBB */[CamlinternalFormatBasics.erase_rel(fmt[1])], /* Fmtty_EBB */[CamlinternalFormatBasics.erase_rel(sub_fmtty1)])) { - throw Type_mismatch; - } - var match$28 = type_format_gen(fmt[2], CamlinternalFormatBasics.erase_rel(fmtty[2])); - return /* Fmt_fmtty_EBB */[ - /* Format_subst */Block.__(14, [ - fmt[0], - sub_fmtty1, - match$28[0] - ]), - match$28[1] - ]; - } - else { - throw Type_mismatch; - } - break; - case 15 : - if (typeof fmtty === "number") { - throw Type_mismatch; - } - else if (fmtty.tag === 10) { - var match$29 = type_format_gen(fmt[0], fmtty[0]); - return /* Fmt_fmtty_EBB */[ - /* Alpha */Block.__(15, [match$29[0]]), - match$29[1] - ]; - } - else { - throw Type_mismatch; - } - break; - case 16 : - if (typeof fmtty === "number") { - throw Type_mismatch; - } - else if (fmtty.tag === 11) { - var match$30 = type_format_gen(fmt[0], fmtty[0]); - return /* Fmt_fmtty_EBB */[ - /* Theta */Block.__(16, [match$30[0]]), - match$30[1] - ]; - } - else { - throw Type_mismatch; - } - break; - case 17 : - var match$31 = type_format_gen(fmt[1], fmtty); - return /* Fmt_fmtty_EBB */[ - /* Formatting_lit */Block.__(17, [ - fmt[0], - match$31[0] - ]), - match$31[1] - ]; - case 18 : - var formatting_gen = fmt[0]; - var fmt0 = fmt[1]; - var fmtty0 = fmtty; - if (formatting_gen.tag) { - var match$32 = formatting_gen[0]; - var match$33 = type_format_gen(match$32[0], fmtty0); - var match$34 = type_format_gen(fmt0, match$33[1]); - return /* Fmt_fmtty_EBB */[ - /* Formatting_gen */Block.__(18, [ - /* Open_box */Block.__(1, [/* Format */[ - match$33[0], - match$32[1] - ]]), - match$34[0] - ]), - match$34[1] - ]; - } - else { - var match$35 = formatting_gen[0]; - var match$36 = type_format_gen(match$35[0], fmtty0); - var match$37 = type_format_gen(fmt0, match$36[1]); - return /* Fmt_fmtty_EBB */[ - /* Formatting_gen */Block.__(18, [ - /* Open_tag */Block.__(0, [/* Format */[ - match$36[0], - match$35[1] - ]]), - match$37[0] - ]), - match$37[1] - ]; - } - case 19 : - if (typeof fmtty === "number") { - throw Type_mismatch; - } - else if (fmtty.tag === 13) { - var match$38 = type_format_gen(fmt[0], fmtty[0]); - return /* Fmt_fmtty_EBB */[ - /* Reader */Block.__(19, [match$38[0]]), - match$38[1] - ]; - } - else { - throw Type_mismatch; - } - break; - case 20 : - if (typeof fmtty === "number") { - throw Type_mismatch; - } - else if (fmtty.tag === 1) { - var match$39 = type_format_gen(fmt[2], fmtty[0]); - return /* Fmt_fmtty_EBB */[ - /* Scan_char_set */Block.__(20, [ - fmt[0], - fmt[1], - match$39[0] - ]), - match$39[1] - ]; - } - else { - throw Type_mismatch; - } - break; - case 21 : - if (typeof fmtty === "number") { - throw Type_mismatch; - } - else if (fmtty.tag === 2) { - var match$40 = type_format_gen(fmt[1], fmtty[0]); - return /* Fmt_fmtty_EBB */[ - /* Scan_get_counter */Block.__(21, [ - fmt[0], - match$40[0] - ]), - match$40[1] - ]; - } - else { - throw Type_mismatch; - } - break; - case 23 : - var ign = fmt[0]; - var fmt$1 = fmt[1]; - var fmtty$1 = fmtty; - if (typeof ign === "number") { - switch (ign) { - case 3 : - if (typeof fmtty$1 === "number") { - throw Type_mismatch; - } - else if (fmtty$1.tag === 14) { - var match$41 = type_format_gen(fmt$1, fmtty$1[0]); - return /* Fmt_fmtty_EBB */[ - /* Ignored_param */Block.__(23, [ - /* Ignored_reader */3, - match$41[0] - ]), - match$41[1] - ]; - } - else { - throw Type_mismatch; - } - break; - case 0 : - case 1 : - case 2 : - case 4 : - return type_ignored_param_one(ign, fmt$1, fmtty$1); - - } - } - else { - switch (ign.tag | 0) { - case 7 : - return type_ignored_param_one(/* Ignored_format_arg */Block.__(7, [ - ign[0], - ign[1] - ]), fmt$1, fmtty$1); - case 8 : - var match$42 = type_ignored_format_substitution(ign[1], fmt$1, fmtty$1); - var match$43 = match$42[1]; - return /* Fmt_fmtty_EBB */[ - /* Ignored_param */Block.__(23, [ - /* Ignored_format_subst */Block.__(8, [ - ign[0], - match$42[0] - ]), - match$43[0] - ]), - match$43[1] - ]; - case 0 : - case 1 : - case 2 : - case 3 : - case 4 : - case 5 : - case 6 : - case 9 : - case 10 : - return type_ignored_param_one(ign, fmt$1, fmtty$1); - - } - } - case 22 : - case 24 : - throw Type_mismatch; - - } - } -} - -function type_ignored_format_substitution(sub_fmtty, fmt, fmtty) { - if (typeof sub_fmtty === "number") { - return /* Fmtty_fmt_EBB */[ - /* End_of_fmtty */0, - type_format_gen(fmt, fmtty) - ]; - } - else { - switch (sub_fmtty.tag | 0) { - case 0 : - if (typeof fmtty === "number") { - throw Type_mismatch; - } - else if (fmtty.tag) { - throw Type_mismatch; - } - else { - var match = type_ignored_format_substitution(sub_fmtty[0], fmt, fmtty[0]); - return /* Fmtty_fmt_EBB */[ - /* Char_ty */Block.__(0, [match[0]]), - match[1] - ]; - } - break; - case 1 : - if (typeof fmtty === "number") { - throw Type_mismatch; - } - else if (fmtty.tag === 1) { - var match$1 = type_ignored_format_substitution(sub_fmtty[0], fmt, fmtty[0]); - return /* Fmtty_fmt_EBB */[ - /* String_ty */Block.__(1, [match$1[0]]), - match$1[1] - ]; - } - else { - throw Type_mismatch; - } - break; - case 2 : - if (typeof fmtty === "number") { - throw Type_mismatch; - } - else if (fmtty.tag === 2) { - var match$2 = type_ignored_format_substitution(sub_fmtty[0], fmt, fmtty[0]); - return /* Fmtty_fmt_EBB */[ - /* Int_ty */Block.__(2, [match$2[0]]), - match$2[1] - ]; - } - else { - throw Type_mismatch; - } - break; - case 3 : - if (typeof fmtty === "number") { - throw Type_mismatch; - } - else if (fmtty.tag === 3) { - var match$3 = type_ignored_format_substitution(sub_fmtty[0], fmt, fmtty[0]); - return /* Fmtty_fmt_EBB */[ - /* Int32_ty */Block.__(3, [match$3[0]]), - match$3[1] - ]; - } - else { - throw Type_mismatch; - } - break; - case 4 : - if (typeof fmtty === "number") { - throw Type_mismatch; - } - else if (fmtty.tag === 4) { - var match$4 = type_ignored_format_substitution(sub_fmtty[0], fmt, fmtty[0]); - return /* Fmtty_fmt_EBB */[ - /* Nativeint_ty */Block.__(4, [match$4[0]]), - match$4[1] - ]; - } - else { - throw Type_mismatch; - } - break; - case 5 : - if (typeof fmtty === "number") { - throw Type_mismatch; - } - else if (fmtty.tag === 5) { - var match$5 = type_ignored_format_substitution(sub_fmtty[0], fmt, fmtty[0]); - return /* Fmtty_fmt_EBB */[ - /* Int64_ty */Block.__(5, [match$5[0]]), - match$5[1] - ]; - } - else { - throw Type_mismatch; - } - break; - case 6 : - if (typeof fmtty === "number") { - throw Type_mismatch; - } - else if (fmtty.tag === 6) { - var match$6 = type_ignored_format_substitution(sub_fmtty[0], fmt, fmtty[0]); - return /* Fmtty_fmt_EBB */[ - /* Float_ty */Block.__(6, [match$6[0]]), - match$6[1] - ]; - } - else { - throw Type_mismatch; - } - break; - case 7 : - if (typeof fmtty === "number") { - throw Type_mismatch; - } - else if (fmtty.tag === 7) { - var match$7 = type_ignored_format_substitution(sub_fmtty[0], fmt, fmtty[0]); - return /* Fmtty_fmt_EBB */[ - /* Bool_ty */Block.__(7, [match$7[0]]), - match$7[1] - ]; - } - else { - throw Type_mismatch; - } - break; - case 8 : - if (typeof fmtty === "number") { - throw Type_mismatch; - } - else if (fmtty.tag === 8) { - var sub2_fmtty$prime = fmtty[0]; - if (Caml_obj.caml_notequal(/* Fmtty_EBB */[sub_fmtty[0]], /* Fmtty_EBB */[sub2_fmtty$prime])) { - throw Type_mismatch; - } - var match$8 = type_ignored_format_substitution(sub_fmtty[1], fmt, fmtty[1]); - return /* Fmtty_fmt_EBB */[ - /* Format_arg_ty */Block.__(8, [ - sub2_fmtty$prime, - match$8[0] - ]), - match$8[1] - ]; - } - else { - throw Type_mismatch; - } - break; - case 9 : - if (typeof fmtty === "number") { - throw Type_mismatch; - } - else if (fmtty.tag === 9) { - var sub2_fmtty$prime$1 = fmtty[1]; - var sub1_fmtty$prime = fmtty[0]; - if (Caml_obj.caml_notequal(/* Fmtty_EBB */[CamlinternalFormatBasics.erase_rel(sub_fmtty[0])], /* Fmtty_EBB */[CamlinternalFormatBasics.erase_rel(sub1_fmtty$prime)])) { - throw Type_mismatch; - } - if (Caml_obj.caml_notequal(/* Fmtty_EBB */[CamlinternalFormatBasics.erase_rel(sub_fmtty[1])], /* Fmtty_EBB */[CamlinternalFormatBasics.erase_rel(sub2_fmtty$prime$1)])) { - throw Type_mismatch; - } - var sub_fmtty$prime = trans(symm(sub1_fmtty$prime), sub2_fmtty$prime$1); - var match$9 = fmtty_rel_det(sub_fmtty$prime); - Curry._1(match$9[1], /* Refl */0); - Curry._1(match$9[3], /* Refl */0); - var match$10 = type_ignored_format_substitution(CamlinternalFormatBasics.erase_rel(sub_fmtty[2]), fmt, fmtty[2]); - return /* Fmtty_fmt_EBB */[ - /* Format_subst_ty */Block.__(9, [ - sub1_fmtty$prime, - sub2_fmtty$prime$1, - symm(match$10[0]) - ]), - match$10[1] - ]; - } - else { - throw Type_mismatch; - } - break; - case 10 : - if (typeof fmtty === "number") { - throw Type_mismatch; - } - else if (fmtty.tag === 10) { - var match$11 = type_ignored_format_substitution(sub_fmtty[0], fmt, fmtty[0]); - return /* Fmtty_fmt_EBB */[ - /* Alpha_ty */Block.__(10, [match$11[0]]), - match$11[1] - ]; - } - else { - throw Type_mismatch; - } - break; - case 11 : - if (typeof fmtty === "number") { - throw Type_mismatch; - } - else if (fmtty.tag === 11) { - var match$12 = type_ignored_format_substitution(sub_fmtty[0], fmt, fmtty[0]); - return /* Fmtty_fmt_EBB */[ - /* Theta_ty */Block.__(11, [match$12[0]]), - match$12[1] - ]; - } - else { - throw Type_mismatch; - } - break; - case 12 : - throw Type_mismatch; - case 13 : - if (typeof fmtty === "number") { - throw Type_mismatch; - } - else if (fmtty.tag === 13) { - var match$13 = type_ignored_format_substitution(sub_fmtty[0], fmt, fmtty[0]); - return /* Fmtty_fmt_EBB */[ - /* Reader_ty */Block.__(13, [match$13[0]]), - match$13[1] - ]; - } - else { - throw Type_mismatch; - } - break; - case 14 : - if (typeof fmtty === "number") { - throw Type_mismatch; - } - else if (fmtty.tag === 14) { - var match$14 = type_ignored_format_substitution(sub_fmtty[0], fmt, fmtty[0]); - return /* Fmtty_fmt_EBB */[ - /* Ignored_reader_ty */Block.__(14, [match$14[0]]), - match$14[1] - ]; - } - else { - throw Type_mismatch; - } - break; - - } - } -} - -function type_format(fmt, fmtty) { - var match = type_format_gen(fmt, fmtty); - if (typeof match[1] === "number") { - return match[0]; - } - else { - throw Type_mismatch; - } -} - -function recast(fmt, fmtty) { - return type_format(fmt, CamlinternalFormatBasics.erase_rel(symm(fmtty))); -} - -function fix_padding(padty, width, str) { - var len = str.length; - var match_000 = Pervasives.abs(width); - var match_001 = width < 0 ? /* Left */0 : padty; - var padty$1 = match_001; - var width$1 = match_000; - if (width$1 <= len) { - return str; - } - else { - var res = Bytes.make(width$1, padty$1 === /* Zeros */2 ? /* "0" */48 : /* " " */32); - switch (padty$1) { - case 0 : - $$String.blit(str, 0, res, 0, len); - break; - case 1 : - $$String.blit(str, 0, res, width$1 - len | 0, len); - break; - case 2 : - if (len > 0 && (Caml_string.get(str, 0) === /* "+" */43 || Caml_string.get(str, 0) === /* "-" */45 || Caml_string.get(str, 0) === /* " " */32)) { - res[0] = Caml_string.get(str, 0); - $$String.blit(str, 1, res, (width$1 - len | 0) + 1 | 0, len - 1 | 0); - } - else if (len > 1 && Caml_string.get(str, 0) === /* "0" */48 && (Caml_string.get(str, 1) === /* "x" */120 || Caml_string.get(str, 1) === /* "X" */88)) { - res[1] = Caml_string.get(str, 1); - $$String.blit(str, 2, res, (width$1 - len | 0) + 2 | 0, len - 2 | 0); - } - else { - $$String.blit(str, 0, res, width$1 - len | 0, len); - } - break; - - } - return Caml_string.bytes_to_string(res); - } -} - -function fix_int_precision(prec, str) { - var prec$1 = Pervasives.abs(prec); - var len = str.length; - var c = Caml_string.get(str, 0); - var exit = 0; - if (c >= 58) { - if (c >= 71) { - if (c > 102 || c < 97) { - return str; - } - else { - exit = 2; - } - } - else if (c >= 65) { - exit = 2; - } - else { - return str; - } - } - else if (c !== 32) { - if (c >= 43) { - switch (c - 43 | 0) { - case 0 : - case 2 : - exit = 1; - break; - case 1 : - case 3 : - case 4 : - return str; - case 5 : - if ((prec$1 + 2 | 0) > len && len > 1 && (Caml_string.get(str, 1) === /* "x" */120 || Caml_string.get(str, 1) === /* "X" */88)) { - var res = Bytes.make(prec$1 + 2 | 0, /* "0" */48); - res[1] = Caml_string.get(str, 1); - $$String.blit(str, 2, res, (prec$1 - len | 0) + 4 | 0, len - 2 | 0); - return Caml_string.bytes_to_string(res); - } - else { - exit = 2; - } - break; - case 6 : - case 7 : - case 8 : - case 9 : - case 10 : - case 11 : - case 12 : - case 13 : - case 14 : - exit = 2; - break; - - } - } - else { - return str; - } - } - else { - exit = 1; - } - switch (exit) { - case 1 : - if ((prec$1 + 1 | 0) > len) { - var res$1 = Bytes.make(prec$1 + 1 | 0, /* "0" */48); - res$1[0] = c; - $$String.blit(str, 1, res$1, (prec$1 - len | 0) + 2 | 0, len - 1 | 0); - return Caml_string.bytes_to_string(res$1); - } - else { - return str; - } - break; - case 2 : - if (prec$1 > len) { - var res$2 = Bytes.make(prec$1, /* "0" */48); - $$String.blit(str, 0, res$2, prec$1 - len | 0, len); - return Caml_string.bytes_to_string(res$2); - } - else { - return str; - } - break; - - } -} - -function string_to_caml_string(str) { - return $$String.concat($$String.escaped(str), /* :: */[ - '"', - /* :: */[ - '"', - /* [] */0 - ] - ]); -} - -function format_of_iconv(iconv) { - switch (iconv) { - case 0 : - return "%d"; - case 1 : - return "%+d"; - case 2 : - return "% d"; - case 3 : - return "%i"; - case 4 : - return "%+i"; - case 5 : - return "% i"; - case 6 : - return "%x"; - case 7 : - return "%#x"; - case 8 : - return "%X"; - case 9 : - return "%#X"; - case 10 : - return "%o"; - case 11 : - return "%#o"; - case 12 : - return "%u"; - - } -} - -function format_of_aconv(iconv, c) { - var seps; - switch (iconv) { - case 0 : - seps = /* :: */[ - "%", - /* :: */[ - "d", - /* [] */0 - ] - ]; - break; - case 1 : - seps = /* :: */[ - "%+", - /* :: */[ - "d", - /* [] */0 - ] - ]; - break; - case 2 : - seps = /* :: */[ - "% ", - /* :: */[ - "d", - /* [] */0 - ] - ]; - break; - case 3 : - seps = /* :: */[ - "%", - /* :: */[ - "i", - /* [] */0 - ] - ]; - break; - case 4 : - seps = /* :: */[ - "%+", - /* :: */[ - "i", - /* [] */0 - ] - ]; - break; - case 5 : - seps = /* :: */[ - "% ", - /* :: */[ - "i", - /* [] */0 - ] - ]; - break; - case 6 : - seps = /* :: */[ - "%", - /* :: */[ - "x", - /* [] */0 - ] - ]; - break; - case 7 : - seps = /* :: */[ - "%#", - /* :: */[ - "x", - /* [] */0 - ] - ]; - break; - case 8 : - seps = /* :: */[ - "%", - /* :: */[ - "X", - /* [] */0 - ] - ]; - break; - case 9 : - seps = /* :: */[ - "%#", - /* :: */[ - "X", - /* [] */0 - ] - ]; - break; - case 10 : - seps = /* :: */[ - "%", - /* :: */[ - "o", - /* [] */0 - ] - ]; - break; - case 11 : - seps = /* :: */[ - "%#", - /* :: */[ - "o", - /* [] */0 - ] - ]; - break; - case 12 : - seps = /* :: */[ - "%", - /* :: */[ - "u", - /* [] */0 - ] - ]; - break; - - } - return $$String.concat(Caml_string.bytes_to_string(Bytes.make(1, c)), seps); -} - -function format_of_fconv(fconv, prec) { - if (fconv === /* Float_F */15) { - return "%.12g"; - } - else { - var prec$1 = Pervasives.abs(prec); - var symb = char_of_fconv(fconv); - var buf = /* record */[ - /* ind */0, - /* bytes */new Array(16) - ]; - buffer_add_char(buf, /* "%" */37); - bprint_fconv_flag(buf, fconv); - buffer_add_char(buf, /* "." */46); - buffer_add_string(buf, "" + prec$1); - buffer_add_char(buf, symb); - return buffer_contents(buf); - } -} - -function convert_int(iconv, n) { - return Caml_format.caml_format_int(format_of_iconv(iconv), n); -} - -function convert_int32(iconv, n) { - return Caml_format.caml_int32_format(format_of_aconv(iconv, /* "l" */108), n); -} - -function convert_nativeint(iconv, n) { - return Caml_format.caml_nativeint_format(format_of_aconv(iconv, /* "n" */110), n); -} - -function convert_int64(iconv, n) { - return Caml_format.caml_int64_format(format_of_aconv(iconv, /* "L" */76), n); -} - -function convert_float(fconv, prec, x) { - var prec$1 = Pervasives.abs(prec); - var str = Caml_format.caml_format_float(format_of_fconv(fconv, prec$1), x); - if (fconv !== /* Float_F */15) { - return str; - } - else { - var len = str.length; - var is_valid = function (_i) { - while(true) { - var i = _i; - if (i === len) { - return /* false */0; - } - else { - var match = Caml_string.get(str, i); - var switcher = match - 46 | 0; - if (switcher > 23 || switcher < 0) { - if (switcher !== 55) { - _i = i + 1 | 0; - continue ; - - } - else { - return /* true */1; - } - } - else if (switcher > 22 || switcher < 1) { - return /* true */1; - } - else { - _i = i + 1 | 0; - continue ; - - } - } - }; - }; - var match = Caml_float.caml_classify_float(x); - if (match !== 3) { - if (match >= 4) { - return "nan"; - } - else if (is_valid(0)) { - return str; - } - else { - return str + "."; - } - } - else if (x < 0.0) { - return "neg_infinity"; - } - else { - return "infinity"; - } - } -} - -function format_caml_char(c) { - return $$String.concat(Char.escaped(c), /* :: */[ - "'", - /* :: */[ - "'", - /* [] */0 - ] - ]); -} - -function string_of_fmtty(fmtty) { - var buf = /* record */[ - /* ind */0, - /* bytes */new Array(16) - ]; - bprint_fmtty(buf, fmtty); - return buffer_contents(buf); -} - -function make_printf(_k, o, _acc, _fmt) { - while(true) { - var fmt = _fmt; - var acc = _acc; - var k = _k; - if (typeof fmt === "number") { - return Curry._2(k, o, acc); - } - else { - switch (fmt.tag | 0) { - case 0 : - var rest = fmt[0]; - return (function(k,acc,rest){ - return function (c) { - var new_acc = /* Acc_data_char */Block.__(5, [ - acc, - c - ]); - return make_printf(k, o, new_acc, rest); - } - }(k,acc,rest)); - case 1 : - var rest$1 = fmt[0]; - return (function(k,acc,rest$1){ - return function (c) { - var new_acc_001 = format_caml_char(c); - var new_acc = /* Acc_data_string */Block.__(4, [ - acc, - new_acc_001 - ]); - return make_printf(k, o, new_acc, rest$1); - } - }(k,acc,rest$1)); - case 2 : - return make_string_padding(k, o, acc, fmt[1], fmt[0], function (str) { - return str; - }); - case 3 : - return make_string_padding(k, o, acc, fmt[1], fmt[0], string_to_caml_string); - case 4 : - return make_int_padding_precision(k, o, acc, fmt[3], fmt[1], fmt[2], convert_int, fmt[0]); - case 5 : - return make_int_padding_precision(k, o, acc, fmt[3], fmt[1], fmt[2], convert_int32, fmt[0]); - case 6 : - return make_int_padding_precision(k, o, acc, fmt[3], fmt[1], fmt[2], convert_nativeint, fmt[0]); - case 7 : - return make_int_padding_precision(k, o, acc, fmt[3], fmt[1], fmt[2], convert_int64, fmt[0]); - case 8 : - var k$1 = k; - var o$1 = o; - var acc$1 = acc; - var fmt$1 = fmt[3]; - var pad = fmt[1]; - var prec = fmt[2]; - var fconv = fmt[0]; - if (typeof pad === "number") { - if (typeof prec === "number") { - if (prec !== 0) { - return (function(k$1,o$1,acc$1,fmt$1,fconv){ - return function (p, x) { - var str = convert_float(fconv, p, x); - return make_printf(k$1, o$1, /* Acc_data_string */Block.__(4, [ - acc$1, - str - ]), fmt$1); - } - }(k$1,o$1,acc$1,fmt$1,fconv)); - } - else { - return (function(k$1,o$1,acc$1,fmt$1,fconv){ - return function (x) { - var str = convert_float(fconv, 6, x); - return make_printf(k$1, o$1, /* Acc_data_string */Block.__(4, [ - acc$1, - str - ]), fmt$1); - } - }(k$1,o$1,acc$1,fmt$1,fconv)); - } - } - else { - var p = prec[0]; - return (function(k$1,o$1,acc$1,fmt$1,fconv,p){ - return function (x) { - var str = convert_float(fconv, p, x); - return make_printf(k$1, o$1, /* Acc_data_string */Block.__(4, [ - acc$1, - str - ]), fmt$1); - } - }(k$1,o$1,acc$1,fmt$1,fconv,p)); - } - } - else if (pad.tag) { - var padty = pad[0]; - if (typeof prec === "number") { - if (prec !== 0) { - return (function(k$1,o$1,acc$1,fmt$1,fconv,padty){ - return function (w, p, x) { - var str = fix_padding(padty, w, convert_float(fconv, p, x)); - return make_printf(k$1, o$1, /* Acc_data_string */Block.__(4, [ - acc$1, - str - ]), fmt$1); - } - }(k$1,o$1,acc$1,fmt$1,fconv,padty)); - } - else { - return (function(k$1,o$1,acc$1,fmt$1,fconv,padty){ - return function (w, x) { - var str = convert_float(fconv, 6, x); - var str$prime = fix_padding(padty, w, str); - return make_printf(k$1, o$1, /* Acc_data_string */Block.__(4, [ - acc$1, - str$prime - ]), fmt$1); - } - }(k$1,o$1,acc$1,fmt$1,fconv,padty)); - } - } - else { - var p$1 = prec[0]; - return (function(k$1,o$1,acc$1,fmt$1,fconv,padty,p$1){ - return function (w, x) { - var str = fix_padding(padty, w, convert_float(fconv, p$1, x)); - return make_printf(k$1, o$1, /* Acc_data_string */Block.__(4, [ - acc$1, - str - ]), fmt$1); - } - }(k$1,o$1,acc$1,fmt$1,fconv,padty,p$1)); - } - } - else { - var w = pad[1]; - var padty$1 = pad[0]; - if (typeof prec === "number") { - if (prec !== 0) { - return (function(k$1,o$1,acc$1,fmt$1,fconv,padty$1,w){ - return function (p, x) { - var str = fix_padding(padty$1, w, convert_float(fconv, p, x)); - return make_printf(k$1, o$1, /* Acc_data_string */Block.__(4, [ - acc$1, - str - ]), fmt$1); - } - }(k$1,o$1,acc$1,fmt$1,fconv,padty$1,w)); - } - else { - return (function(k$1,o$1,acc$1,fmt$1,fconv,padty$1,w){ - return function (x) { - var str = convert_float(fconv, 6, x); - var str$prime = fix_padding(padty$1, w, str); - return make_printf(k$1, o$1, /* Acc_data_string */Block.__(4, [ - acc$1, - str$prime - ]), fmt$1); - } - }(k$1,o$1,acc$1,fmt$1,fconv,padty$1,w)); - } - } - else { - var p$2 = prec[0]; - return (function(k$1,o$1,acc$1,fmt$1,fconv,padty$1,w,p$2){ - return function (x) { - var str = fix_padding(padty$1, w, convert_float(fconv, p$2, x)); - return make_printf(k$1, o$1, /* Acc_data_string */Block.__(4, [ - acc$1, - str - ]), fmt$1); - } - }(k$1,o$1,acc$1,fmt$1,fconv,padty$1,w,p$2)); - } - } - case 9 : - var rest$2 = fmt[0]; - return (function(k,acc,rest$2){ - return function (b) { - return make_printf(k, o, /* Acc_data_string */Block.__(4, [ - acc, - b ? "true" : "false" - ]), rest$2); - } - }(k,acc,rest$2)); - case 10 : - _fmt = fmt[0]; - _acc = /* Acc_flush */Block.__(7, [acc]); - continue ; - case 11 : - _fmt = fmt[1]; - _acc = /* Acc_string_literal */Block.__(2, [ - acc, - fmt[0] - ]); - continue ; - case 12 : - _fmt = fmt[1]; - _acc = /* Acc_char_literal */Block.__(3, [ - acc, - fmt[0] - ]); - continue ; - case 13 : - var rest$3 = fmt[2]; - var ty = string_of_fmtty(fmt[1]); - return (function(k,acc,rest$3,ty){ - return function () { - return make_printf(k, o, /* Acc_data_string */Block.__(4, [ - acc, - ty - ]), rest$3); - } - }(k,acc,rest$3,ty)); - case 14 : - var rest$4 = fmt[2]; - var fmtty = fmt[1]; - return (function(k,acc,fmtty,rest$4){ - return function (param) { - return make_printf(k, o, acc, CamlinternalFormatBasics.concat_fmt(recast(param[0], fmtty), rest$4)); - } - }(k,acc,fmtty,rest$4)); - case 15 : - var rest$5 = fmt[0]; - return (function(k,acc,rest$5){ - return function (f, x) { - return make_printf(k, o, /* Acc_delay */Block.__(6, [ - acc, - function (o) { - return Curry._2(f, o, x); - } - ]), rest$5); - } - }(k,acc,rest$5)); - case 16 : - var rest$6 = fmt[0]; - return (function(k,acc,rest$6){ - return function (f) { - return make_printf(k, o, /* Acc_delay */Block.__(6, [ - acc, - f - ]), rest$6); - } - }(k,acc,rest$6)); - case 17 : - _fmt = fmt[1]; - _acc = /* Acc_formatting_lit */Block.__(0, [ - acc, - fmt[0] - ]); - continue ; - case 18 : - var match = fmt[0]; - if (match.tag) { - var rest$7 = fmt[1]; - var k$prime = (function(k,acc,rest$7){ - return function k$prime(koc, kacc) { - return make_printf(k, koc, /* Acc_formatting_gen */Block.__(1, [ - acc, - /* Acc_open_box */Block.__(1, [kacc]) - ]), rest$7); - } - }(k,acc,rest$7)); - _fmt = match[0][0]; - _acc = /* End_of_acc */0; - _k = k$prime; - continue ; - - } - else { - var rest$8 = fmt[1]; - var k$prime$1 = (function(k,acc,rest$8){ - return function k$prime$1(koc, kacc) { - return make_printf(k, koc, /* Acc_formatting_gen */Block.__(1, [ - acc, - /* Acc_open_tag */Block.__(0, [kacc]) - ]), rest$8); - } - }(k,acc,rest$8)); - _fmt = match[0][0]; - _acc = /* End_of_acc */0; - _k = k$prime$1; - continue ; - - } - break; - case 19 : - throw [ - Caml_builtin_exceptions.assert_failure, - [ - "camlinternalFormat.ml", - 1449, - 4 - ] - ]; - case 20 : - var rest$9 = fmt[2]; - var new_acc = /* Acc_invalid_arg */Block.__(8, [ - acc, - "Printf: bad conversion %[" - ]); - return (function(k,rest$9,new_acc){ - return function () { - return make_printf(k, o, new_acc, rest$9); - } - }(k,rest$9,new_acc)); - case 21 : - var rest$10 = fmt[1]; - return (function(k,acc,rest$10){ - return function (n) { - var new_acc_001 = Caml_format.caml_format_int("%u", n); - var new_acc = /* Acc_data_string */Block.__(4, [ - acc, - new_acc_001 - ]); - return make_printf(k, o, new_acc, rest$10); - } - }(k,acc,rest$10)); - case 22 : - var rest$11 = fmt[0]; - return (function(k,acc,rest$11){ - return function (c) { - var new_acc = /* Acc_data_char */Block.__(5, [ - acc, - c - ]); - return make_printf(k, o, new_acc, rest$11); - } - }(k,acc,rest$11)); - case 23 : - var k$2 = k; - var o$2 = o; - var acc$2 = acc; - var ign = fmt[0]; - var fmt$2 = fmt[1]; - if (typeof ign === "number") { - switch (ign) { - case 3 : - throw [ - Caml_builtin_exceptions.assert_failure, - [ - "camlinternalFormat.ml", - 1517, - 39 - ] - ]; - case 0 : - case 1 : - case 2 : - case 4 : - return make_invalid_arg(k$2, o$2, acc$2, fmt$2); - - } - } - else { - switch (ign.tag | 0) { - case 8 : - return make_from_fmtty(k$2, o$2, acc$2, ign[1], fmt$2); - case 0 : - case 1 : - case 2 : - case 3 : - case 4 : - case 5 : - case 6 : - case 7 : - case 9 : - case 10 : - return make_invalid_arg(k$2, o$2, acc$2, fmt$2); - - } - } - case 24 : - return make_custom(k, o, acc, fmt[2], fmt[0], Curry._1(fmt[1], /* () */0)); - - } - } - }; -} - -function make_from_fmtty(k, o, acc, fmtty, fmt) { - if (typeof fmtty === "number") { - return make_invalid_arg(k, o, acc, fmt); - } - else { - switch (fmtty.tag | 0) { - case 0 : - var rest = fmtty[0]; - return function () { - return make_from_fmtty(k, o, acc, rest, fmt); - }; - case 1 : - var rest$1 = fmtty[0]; - return function () { - return make_from_fmtty(k, o, acc, rest$1, fmt); - }; - case 2 : - var rest$2 = fmtty[0]; - return function () { - return make_from_fmtty(k, o, acc, rest$2, fmt); - }; - case 3 : - var rest$3 = fmtty[0]; - return function () { - return make_from_fmtty(k, o, acc, rest$3, fmt); - }; - case 4 : - var rest$4 = fmtty[0]; - return function () { - return make_from_fmtty(k, o, acc, rest$4, fmt); - }; - case 5 : - var rest$5 = fmtty[0]; - return function () { - return make_from_fmtty(k, o, acc, rest$5, fmt); - }; - case 6 : - var rest$6 = fmtty[0]; - return function () { - return make_from_fmtty(k, o, acc, rest$6, fmt); - }; - case 7 : - var rest$7 = fmtty[0]; - return function () { - return make_from_fmtty(k, o, acc, rest$7, fmt); - }; - case 8 : - var rest$8 = fmtty[1]; - return function () { - return make_from_fmtty(k, o, acc, rest$8, fmt); - }; - case 9 : - var rest$9 = fmtty[2]; - var ty = trans(symm(fmtty[0]), fmtty[1]); - return function () { - return make_from_fmtty(k, o, acc, CamlinternalFormatBasics.concat_fmtty(ty, rest$9), fmt); - }; - case 10 : - var rest$10 = fmtty[0]; - return function (_, _$1) { - return make_from_fmtty(k, o, acc, rest$10, fmt); - }; - case 11 : - var rest$11 = fmtty[0]; - return function () { - return make_from_fmtty(k, o, acc, rest$11, fmt); - }; - case 12 : - var rest$12 = fmtty[0]; - return function () { - return make_from_fmtty(k, o, acc, rest$12, fmt); - }; - case 13 : - throw [ - Caml_builtin_exceptions.assert_failure, - [ - "camlinternalFormat.ml", - 1540, - 31 - ] - ]; - case 14 : - throw [ - Caml_builtin_exceptions.assert_failure, - [ - "camlinternalFormat.ml", - 1541, - 31 - ] - ]; - - } - } -} - -function make_invalid_arg(k, o, acc, fmt) { - return make_printf(k, o, /* Acc_invalid_arg */Block.__(8, [ - acc, - "Printf: bad conversion %_" - ]), fmt); -} - -function make_string_padding(k, o, acc, fmt, pad, trans) { - if (typeof pad === "number") { - return function (x) { - var new_acc_001 = Curry._1(trans, x); - var new_acc = /* Acc_data_string */Block.__(4, [ - acc, - new_acc_001 - ]); - return make_printf(k, o, new_acc, fmt); - }; - } - else if (pad.tag) { - var padty = pad[0]; - return function (w, x) { - var new_acc_001 = fix_padding(padty, w, Curry._1(trans, x)); - var new_acc = /* Acc_data_string */Block.__(4, [ - acc, - new_acc_001 - ]); - return make_printf(k, o, new_acc, fmt); - }; - } - else { - var width = pad[1]; - var padty$1 = pad[0]; - return function (x) { - var new_acc_001 = fix_padding(padty$1, width, Curry._1(trans, x)); - var new_acc = /* Acc_data_string */Block.__(4, [ - acc, - new_acc_001 - ]); - return make_printf(k, o, new_acc, fmt); - }; - } -} - -function make_int_padding_precision(k, o, acc, fmt, pad, prec, trans, iconv) { - if (typeof pad === "number") { - if (typeof prec === "number") { - if (prec !== 0) { - return function (p, x) { - var str = fix_int_precision(p, Curry._2(trans, iconv, x)); - return make_printf(k, o, /* Acc_data_string */Block.__(4, [ - acc, - str - ]), fmt); - }; - } - else { - return function (x) { - var str = Curry._2(trans, iconv, x); - return make_printf(k, o, /* Acc_data_string */Block.__(4, [ - acc, - str - ]), fmt); - }; - } - } - else { - var p = prec[0]; - return function (x) { - var str = fix_int_precision(p, Curry._2(trans, iconv, x)); - return make_printf(k, o, /* Acc_data_string */Block.__(4, [ - acc, - str - ]), fmt); - }; - } - } - else if (pad.tag) { - var padty = pad[0]; - if (typeof prec === "number") { - if (prec !== 0) { - return function (w, p, x) { - var str = fix_padding(padty, w, fix_int_precision(p, Curry._2(trans, iconv, x))); - return make_printf(k, o, /* Acc_data_string */Block.__(4, [ - acc, - str - ]), fmt); - }; - } - else { - return function (w, x) { - var str = fix_padding(padty, w, Curry._2(trans, iconv, x)); - return make_printf(k, o, /* Acc_data_string */Block.__(4, [ - acc, - str - ]), fmt); - }; - } - } - else { - var p$1 = prec[0]; - return function (w, x) { - var str = fix_padding(padty, w, fix_int_precision(p$1, Curry._2(trans, iconv, x))); - return make_printf(k, o, /* Acc_data_string */Block.__(4, [ - acc, - str - ]), fmt); - }; - } - } - else { - var w = pad[1]; - var padty$1 = pad[0]; - if (typeof prec === "number") { - if (prec !== 0) { - return function (p, x) { - var str = fix_padding(padty$1, w, fix_int_precision(p, Curry._2(trans, iconv, x))); - return make_printf(k, o, /* Acc_data_string */Block.__(4, [ - acc, - str - ]), fmt); - }; - } - else { - return function (x) { - var str = fix_padding(padty$1, w, Curry._2(trans, iconv, x)); - return make_printf(k, o, /* Acc_data_string */Block.__(4, [ - acc, - str - ]), fmt); - }; - } - } - else { - var p$2 = prec[0]; - return function (x) { - var str = fix_padding(padty$1, w, fix_int_precision(p$2, Curry._2(trans, iconv, x))); - return make_printf(k, o, /* Acc_data_string */Block.__(4, [ - acc, - str - ]), fmt); - }; - } - } -} - -function make_custom(k, o, acc, rest, arity, f) { - if (arity) { - var arity$1 = arity[0]; - return function (x) { - return make_custom(k, o, acc, rest, arity$1, Curry._1(f, x)); - }; - } - else { - return make_printf(k, o, /* Acc_data_string */Block.__(4, [ - acc, - f - ]), rest); - } -} - -function output_acc(o, _acc) { - while(true) { - var acc = _acc; - var exit = 0; - if (typeof acc === "number") { - return /* () */0; - } - else { - switch (acc.tag | 0) { - case 0 : - var s = string_of_formatting_lit(acc[1]); - output_acc(o, acc[0]); - return Pervasives.output_string(o, s); - case 1 : - var match = acc[1]; - var p = acc[0]; - output_acc(o, p); - if (match.tag) { - Pervasives.output_string(o, "@["); - _acc = match[0]; - continue ; - - } - else { - Pervasives.output_string(o, "@{"); - _acc = match[0]; - continue ; - - } - break; - case 2 : - case 4 : - exit = 1; - break; - case 3 : - case 5 : - exit = 2; - break; - case 6 : - output_acc(o, acc[0]); - return Curry._1(acc[1], o); - case 7 : - output_acc(o, acc[0]); - return Caml_io.caml_ml_flush(o); - case 8 : - output_acc(o, acc[0]); - throw [ - Caml_builtin_exceptions.invalid_argument, - acc[1] - ]; - - } - } - switch (exit) { - case 1 : - output_acc(o, acc[0]); - return Pervasives.output_string(o, acc[1]); - case 2 : - output_acc(o, acc[0]); - return Caml_io.caml_ml_output_char(o, acc[1]); - - } - }; -} - -function bufput_acc(b, _acc) { - while(true) { - var acc = _acc; - var exit = 0; - if (typeof acc === "number") { - return /* () */0; - } - else { - switch (acc.tag | 0) { - case 0 : - var s = string_of_formatting_lit(acc[1]); - bufput_acc(b, acc[0]); - return Buffer.add_string(b, s); - case 1 : - var match = acc[1]; - var p = acc[0]; - bufput_acc(b, p); - if (match.tag) { - Buffer.add_string(b, "@["); - _acc = match[0]; - continue ; - - } - else { - Buffer.add_string(b, "@{"); - _acc = match[0]; - continue ; - - } - break; - case 2 : - case 4 : - exit = 1; - break; - case 3 : - case 5 : - exit = 2; - break; - case 6 : - bufput_acc(b, acc[0]); - return Curry._1(acc[1], b); - case 7 : - _acc = acc[0]; - continue ; - case 8 : - bufput_acc(b, acc[0]); - throw [ - Caml_builtin_exceptions.invalid_argument, - acc[1] - ]; - - } - } - switch (exit) { - case 1 : - bufput_acc(b, acc[0]); - return Buffer.add_string(b, acc[1]); - case 2 : - bufput_acc(b, acc[0]); - return Buffer.add_char(b, acc[1]); - - } - }; -} - -function strput_acc(b, _acc) { - while(true) { - var acc = _acc; - var exit = 0; - if (typeof acc === "number") { - return /* () */0; - } - else { - switch (acc.tag | 0) { - case 0 : - var s = string_of_formatting_lit(acc[1]); - strput_acc(b, acc[0]); - return Buffer.add_string(b, s); - case 1 : - var match = acc[1]; - var p = acc[0]; - strput_acc(b, p); - if (match.tag) { - Buffer.add_string(b, "@["); - _acc = match[0]; - continue ; - - } - else { - Buffer.add_string(b, "@{"); - _acc = match[0]; - continue ; - - } - break; - case 2 : - case 4 : - exit = 1; - break; - case 3 : - case 5 : - exit = 2; - break; - case 6 : - strput_acc(b, acc[0]); - return Buffer.add_string(b, Curry._1(acc[1], /* () */0)); - case 7 : - _acc = acc[0]; - continue ; - case 8 : - strput_acc(b, acc[0]); - throw [ - Caml_builtin_exceptions.invalid_argument, - acc[1] - ]; - - } - } - switch (exit) { - case 1 : - strput_acc(b, acc[0]); - return Buffer.add_string(b, acc[1]); - case 2 : - strput_acc(b, acc[0]); - return Buffer.add_char(b, acc[1]); - - } - }; -} - -function failwith_message(param) { - var buf = Buffer.create(256); - var k = function (_, acc) { - strput_acc(buf, acc); - var s = Buffer.contents(buf); - throw [ - Caml_builtin_exceptions.failure, - s - ]; - }; - return make_printf(k, /* () */0, /* End_of_acc */0, param[0]); -} - -function open_box_of_string(str) { - if (str === "") { - return /* tuple */[ - 0, - /* Pp_box */4 - ]; - } - else { - var len = str.length; - var invalid_box = function () { - return Curry._1(failwith_message(/* Format */[ - /* String_literal */Block.__(11, [ - "invalid box description ", - /* Caml_string */Block.__(3, [ - /* No_padding */0, - /* End_of_format */0 - ]) - ]), - "invalid box description %S" - ]), str); - }; - var parse_spaces = function (_i) { - while(true) { - var i = _i; - if (i === len) { - return i; - } - else { - var match = Caml_string.get(str, i); - if (match !== 9) { - if (match !== 32) { - return i; - } - else { - _i = i + 1 | 0; - continue ; - - } - } - else { - _i = i + 1 | 0; - continue ; - - } - } - }; - }; - var parse_lword = function (_, _j) { - while(true) { - var j = _j; - if (j === len) { - return j; - } - else { - var match = Caml_string.get(str, j); - if (match > 122 || match < 97) { - return j; - } - else { - _j = j + 1 | 0; - continue ; - - } - } - }; - }; - var parse_int = function (_, _j) { - while(true) { - var j = _j; - if (j === len) { - return j; - } - else { - var match = Caml_string.get(str, j); - if (match >= 48) { - if (match >= 58) { - return j; - } - else { - _j = j + 1 | 0; - continue ; - - } - } - else if (match !== 45) { - return j; - } - else { - _j = j + 1 | 0; - continue ; - - } - } - }; - }; - var wstart = parse_spaces(0); - var wend = parse_lword(wstart, wstart); - var box_name = $$String.sub(str, wstart, wend - wstart | 0); - var nstart = parse_spaces(wend); - var nend = parse_int(nstart, nstart); - var indent; - if (nstart === nend) { - indent = 0; - } - else { - try { - indent = Caml_format.caml_int_of_string($$String.sub(str, nstart, nend - nstart | 0)); - } - catch (exn){ - if (exn[0] === Caml_builtin_exceptions.failure) { - indent = invalid_box(/* () */0); - } - else { - throw exn; - } - } - } - var exp_end = parse_spaces(nend); - if (exp_end !== len) { - invalid_box(/* () */0); - } - var box_type; - switch (box_name) { - case "" : - case "b" : - box_type = /* Pp_box */4; - break; - case "h" : - box_type = /* Pp_hbox */0; - break; - case "hov" : - box_type = /* Pp_hovbox */3; - break; - case "hv" : - box_type = /* Pp_hvbox */2; - break; - case "v" : - box_type = /* Pp_vbox */1; - break; - default: - box_type = invalid_box(/* () */0); - } - return /* tuple */[ - indent, - box_type - ]; - } -} - -function make_padding_fmt_ebb(pad, fmt) { - if (typeof pad === "number") { - return /* Padding_fmt_EBB */[ - /* No_padding */0, - fmt - ]; - } - else if (pad.tag) { - return /* Padding_fmt_EBB */[ - /* Arg_padding */Block.__(1, [pad[0]]), - fmt - ]; - } - else { - return /* Padding_fmt_EBB */[ - /* Lit_padding */Block.__(0, [ - pad[0], - pad[1] - ]), - fmt - ]; - } -} - -function make_precision_fmt_ebb(prec, fmt) { - if (typeof prec === "number") { - if (prec !== 0) { - return /* Precision_fmt_EBB */[ - /* Arg_precision */1, - fmt - ]; - } - else { - return /* Precision_fmt_EBB */[ - /* No_precision */0, - fmt - ]; - } - } - else { - return /* Precision_fmt_EBB */[ - /* Lit_precision */[prec[0]], - fmt - ]; - } -} - -function make_padprec_fmt_ebb(pad, prec, fmt) { - var match = make_precision_fmt_ebb(prec, fmt); - var fmt$prime = match[1]; - var prec$1 = match[0]; - if (typeof pad === "number") { - return /* Padprec_fmt_EBB */[ - /* No_padding */0, - prec$1, - fmt$prime - ]; - } - else if (pad.tag) { - return /* Padprec_fmt_EBB */[ - /* Arg_padding */Block.__(1, [pad[0]]), - prec$1, - fmt$prime - ]; - } - else { - return /* Padprec_fmt_EBB */[ - /* Lit_padding */Block.__(0, [ - pad[0], - pad[1] - ]), - prec$1, - fmt$prime - ]; - } -} - -function fmt_ebb_of_string(legacy_behavior, str) { - var legacy_behavior$1 = legacy_behavior ? legacy_behavior[0] : /* true */1; - var invalid_format_message = function (str_ind, msg) { - return Curry._3(failwith_message(/* Format */[ - /* String_literal */Block.__(11, [ - "invalid format ", - /* Caml_string */Block.__(3, [ - /* No_padding */0, - /* String_literal */Block.__(11, [ - ": at character number ", - /* Int */Block.__(4, [ - /* Int_d */0, - /* No_padding */0, - /* No_precision */0, - /* String_literal */Block.__(11, [ - ", ", - /* String */Block.__(2, [ - /* No_padding */0, - /* End_of_format */0 - ]) - ]) - ]) - ]) - ]) - ]), - "invalid format %S: at character number %d, %s" - ]), str, str_ind, msg); - }; - var invalid_format_without = function (str_ind, c, s) { - return Curry._4(failwith_message(/* Format */[ - /* String_literal */Block.__(11, [ - "invalid format ", - /* Caml_string */Block.__(3, [ - /* No_padding */0, - /* String_literal */Block.__(11, [ - ": at character number ", - /* Int */Block.__(4, [ - /* Int_d */0, - /* No_padding */0, - /* No_precision */0, - /* String_literal */Block.__(11, [ - ", '", - /* Char */Block.__(0, [/* String_literal */Block.__(11, [ - "' without ", - /* String */Block.__(2, [ - /* No_padding */0, - /* End_of_format */0 - ]) - ])]) - ]) - ]) - ]) - ]) - ]), - "invalid format %S: at character number %d, '%c' without %s" - ]), str, str_ind, c, s); - }; - var expected_character = function (str_ind, expected, read) { - return Curry._4(failwith_message(/* Format */[ - /* String_literal */Block.__(11, [ - "invalid format ", - /* Caml_string */Block.__(3, [ - /* No_padding */0, - /* String_literal */Block.__(11, [ - ": at character number ", - /* Int */Block.__(4, [ - /* Int_d */0, - /* No_padding */0, - /* No_precision */0, - /* String_literal */Block.__(11, [ - ", ", - /* String */Block.__(2, [ - /* No_padding */0, - /* String_literal */Block.__(11, [ - " expected, read ", - /* Caml_char */Block.__(1, [/* End_of_format */0]) - ]) - ]) - ]) - ]) - ]) - ]) - ]), - "invalid format %S: at character number %d, %s expected, read %C" - ]), str, str_ind, expected, read); - }; - var compute_int_conv = function (pct_ind, str_ind, _plus, _sharp, _space, symb) { - while(true) { - var space = _space; - var sharp = _sharp; - var plus = _plus; - var exit = 0; - var exit$1 = 0; - if (plus !== 0) { - if (sharp !== 0) { - exit$1 = 2; - } - else if (space !== 0) { - exit = 1; - } - else if (symb !== 100) { - if (symb !== 105) { - exit = 1; - } - else { - return /* Int_pi */4; - } - } - else { - return /* Int_pd */1; - } - } - else if (sharp !== 0) { - if (space !== 0) { - exit$1 = 2; - } - else if (symb !== 88) { - if (symb !== 111) { - if (symb !== 120) { - exit$1 = 2; - } - else { - return /* Int_Cx */7; - } - } - else { - return /* Int_Co */11; - } - } - else { - return /* Int_CX */9; - } - } - else if (space !== 0) { - if (symb !== 100) { - if (symb !== 105) { - exit = 1; - } - else { - return /* Int_si */5; - } - } - else { - return /* Int_sd */2; - } - } - else { - var switcher = symb - 88 | 0; - if (switcher > 32 || switcher < 0) { - exit = 1; - } - else { - switch (switcher) { - case 0 : - return /* Int_X */8; - case 12 : - return /* Int_d */0; - case 17 : - return /* Int_i */3; - case 23 : - return /* Int_o */10; - case 29 : - return /* Int_u */12; - case 1 : - case 2 : - case 3 : - case 4 : - case 5 : - case 6 : - case 7 : - case 8 : - case 9 : - case 10 : - case 11 : - case 13 : - case 14 : - case 15 : - case 16 : - case 18 : - case 19 : - case 20 : - case 21 : - case 22 : - case 24 : - case 25 : - case 26 : - case 27 : - case 28 : - case 30 : - case 31 : - exit = 1; - break; - case 32 : - return /* Int_x */6; - - } - } - } - if (exit$1 === 2) { - var exit$2 = 0; - var switcher$1 = symb - 88 | 0; - if (switcher$1 > 32 || switcher$1 < 0) { - exit = 1; - } - else { - switch (switcher$1) { - case 0 : - if (legacy_behavior$1) { - return /* Int_CX */9; - } - else { - exit = 1; - } - break; - case 23 : - if (legacy_behavior$1) { - return /* Int_Co */11; - } - else { - exit = 1; - } - break; - case 12 : - case 17 : - case 29 : - exit$2 = 3; - break; - case 1 : - case 2 : - case 3 : - case 4 : - case 5 : - case 6 : - case 7 : - case 8 : - case 9 : - case 10 : - case 11 : - case 13 : - case 14 : - case 15 : - case 16 : - case 18 : - case 19 : - case 20 : - case 21 : - case 22 : - case 24 : - case 25 : - case 26 : - case 27 : - case 28 : - case 30 : - case 31 : - exit = 1; - break; - case 32 : - if (legacy_behavior$1) { - return /* Int_Cx */7; - } - else { - exit = 1; - } - break; - - } - } - if (exit$2 === 3) { - if (legacy_behavior$1) { - _sharp = /* false */0; - continue ; - - } - else { - return incompatible_flag(pct_ind, str_ind, symb, "'#'"); - } - } - - } - if (exit === 1) { - if (plus !== 0) { - if (space !== 0) { - if (legacy_behavior$1) { - _space = /* false */0; - continue ; - - } - else { - return incompatible_flag(pct_ind, str_ind, /* " " */32, "'+'"); - } - } - else if (legacy_behavior$1) { - _plus = /* false */0; - continue ; - - } - else { - return incompatible_flag(pct_ind, str_ind, symb, "'+'"); - } - } - else if (space !== 0) { - if (legacy_behavior$1) { - _space = /* false */0; - continue ; - - } - else { - return incompatible_flag(pct_ind, str_ind, symb, "' '"); - } - } - else { - throw [ - Caml_builtin_exceptions.assert_failure, - [ - "camlinternalFormat.ml", - 2716, - 28 - ] - ]; - } - } - - }; - }; - var incompatible_flag = function (pct_ind, str_ind, symb, option) { - var subfmt = $$String.sub(str, pct_ind, str_ind - pct_ind | 0); - return Curry._5(failwith_message(/* Format */[ - /* String_literal */Block.__(11, [ - "invalid format ", - /* Caml_string */Block.__(3, [ - /* No_padding */0, - /* String_literal */Block.__(11, [ - ": at character number ", - /* Int */Block.__(4, [ - /* Int_d */0, - /* No_padding */0, - /* No_precision */0, - /* String_literal */Block.__(11, [ - ", ", - /* String */Block.__(2, [ - /* No_padding */0, - /* String_literal */Block.__(11, [ - " is incompatible with '", - /* Char */Block.__(0, [/* String_literal */Block.__(11, [ - "' in sub-format ", - /* Caml_string */Block.__(3, [ - /* No_padding */0, - /* End_of_format */0 - ]) - ])]) - ]) - ]) - ]) - ]) - ]) - ]) - ]), - "invalid format %S: at character number %d, %s is incompatible with '%c' in sub-format %S" - ]), str, pct_ind, option, symb, subfmt); - }; - var parse_positive = function (_str_ind, end_ind, _acc) { - while(true) { - var acc = _acc; - var str_ind = _str_ind; - if (str_ind === end_ind) { - invalid_format_message(end_ind, "unexpected end of format"); - } - var c = Caml_string.get(str, str_ind); - if (c > 57 || c < 48) { - return /* tuple */[ - str_ind, - acc - ]; - } - else { - var new_acc = Caml_int32.imul(acc, 10) + (c - /* "0" */48 | 0) | 0; - if (new_acc > Sys.max_string_length) { - return Curry._3(failwith_message(/* Format */[ - /* String_literal */Block.__(11, [ - "invalid format ", - /* Caml_string */Block.__(3, [ - /* No_padding */0, - /* String_literal */Block.__(11, [ - ": integer ", - /* Int */Block.__(4, [ - /* Int_d */0, - /* No_padding */0, - /* No_precision */0, - /* String_literal */Block.__(11, [ - " is greater than the limit ", - /* Int */Block.__(4, [ - /* Int_d */0, - /* No_padding */0, - /* No_precision */0, - /* End_of_format */0 - ]) - ]) - ]) - ]) - ]) - ]), - "invalid format %S: integer %d is greater than the limit %d" - ]), str, new_acc, Sys.max_string_length); - } - else { - _acc = new_acc; - _str_ind = str_ind + 1 | 0; - continue ; - - } - } - }; - }; - var parse_after_precision = function (pct_ind, str_ind, end_ind, minus, plus, sharp, space, ign, pad, prec) { - if (str_ind === end_ind) { - invalid_format_message(end_ind, "unexpected end of format"); - } - var parse_conv = function (padprec) { - return parse_conversion(pct_ind, str_ind + 1 | 0, end_ind, plus, sharp, space, ign, pad, prec, padprec, Caml_string.get(str, str_ind)); - }; - if (typeof pad === "number") { - var exit = 0; - if (typeof prec === "number") { - if (prec !== 0) { - exit = 1; - } - else { - return parse_conv(/* No_padding */0); - } - } - else { - exit = 1; - } - if (exit === 1) { - if (minus !== 0) { - if (typeof prec === "number") { - return parse_conv(/* Arg_padding */Block.__(1, [/* Left */0])); - } - else { - return parse_conv(/* Lit_padding */Block.__(0, [ - /* Left */0, - prec[0] - ])); - } - } - else if (typeof prec === "number") { - return parse_conv(/* Arg_padding */Block.__(1, [/* Right */1])); - } - else { - return parse_conv(/* Lit_padding */Block.__(0, [ - /* Right */1, - prec[0] - ])); - } - } - - } - else { - return parse_conv(pad); - } - }; - var parse_after_padding = function (pct_ind, str_ind, end_ind, minus, plus, sharp, space, ign, pad) { - if (str_ind === end_ind) { - invalid_format_message(end_ind, "unexpected end of format"); - } - var symb = Caml_string.get(str, str_ind); - if (symb !== 46) { - return parse_conversion(pct_ind, str_ind + 1 | 0, end_ind, plus, sharp, space, ign, pad, /* No_precision */0, pad, symb); - } - else { - var pct_ind$1 = pct_ind; - var str_ind$1 = str_ind + 1 | 0; - var end_ind$1 = end_ind; - var minus$1 = minus; - var plus$1 = plus; - var sharp$1 = sharp; - var space$1 = space; - var ign$1 = ign; - var pad$1 = pad; - if (str_ind$1 === end_ind$1) { - invalid_format_message(end_ind$1, "unexpected end of format"); - } - var parse_literal = function (minus, str_ind) { - var match = parse_positive(str_ind, end_ind$1, 0); - return parse_after_precision(pct_ind$1, match[0], end_ind$1, minus, plus$1, sharp$1, space$1, ign$1, pad$1, /* Lit_precision */[match[1]]); - }; - var symb$1 = Caml_string.get(str, str_ind$1); - var exit = 0; - var exit$1 = 0; - if (symb$1 >= 48) { - if (symb$1 >= 58) { - exit = 1; - } - else { - return parse_literal(minus$1, str_ind$1); - } - } - else if (symb$1 >= 42) { - switch (symb$1 - 42 | 0) { - case 0 : - return parse_after_precision(pct_ind$1, str_ind$1 + 1 | 0, end_ind$1, minus$1, plus$1, sharp$1, space$1, ign$1, pad$1, /* Arg_precision */1); - case 1 : - case 3 : - exit$1 = 2; - break; - case 2 : - case 4 : - case 5 : - exit = 1; - break; - - } - } - else { - exit = 1; - } - if (exit$1 === 2) { - if (legacy_behavior$1) { - return parse_literal(minus$1 || +(symb$1 === /* "-" */45), str_ind$1 + 1 | 0); - } - else { - exit = 1; - } - } - if (exit === 1) { - if (legacy_behavior$1) { - return parse_after_precision(pct_ind$1, str_ind$1, end_ind$1, minus$1, plus$1, sharp$1, space$1, ign$1, pad$1, /* Lit_precision */[0]); - } - else { - return invalid_format_without(str_ind$1 - 1 | 0, /* "." */46, "precision"); - } - } - - } - }; - var parse_literal = function (lit_start, _str_ind, end_ind) { - while(true) { - var str_ind = _str_ind; - if (str_ind === end_ind) { - return add_literal(lit_start, str_ind, /* End_of_format */0); - } - else { - var match = Caml_string.get(str, str_ind); - if (match !== 37) { - if (match !== 64) { - _str_ind = str_ind + 1 | 0; - continue ; - - } - else { - var match$1 = parse_after_at(str_ind + 1 | 0, end_ind); - return add_literal(lit_start, str_ind, match$1[0]); - } - } - else { - var match$2 = parse_format(str_ind, end_ind); - return add_literal(lit_start, str_ind, match$2[0]); - } - } - }; - }; - var parse_format = function (pct_ind, end_ind) { - var pct_ind$1 = pct_ind; - var str_ind = pct_ind + 1 | 0; - var end_ind$1 = end_ind; - if (str_ind === end_ind$1) { - invalid_format_message(end_ind$1, "unexpected end of format"); - } - var match = Caml_string.get(str, str_ind); - if (match !== 95) { - return parse_flags(pct_ind$1, str_ind, end_ind$1, /* false */0); - } - else { - return parse_flags(pct_ind$1, str_ind + 1 | 0, end_ind$1, /* true */1); - } - }; - var parse_after_at = function (str_ind, end_ind) { - if (str_ind === end_ind) { - return /* Fmt_EBB */[/* Char_literal */Block.__(12, [ - /* "@" */64, - /* End_of_format */0 - ])]; - } - else { - var c = Caml_string.get(str, str_ind); - var exit = 0; - if (c >= 65) { - if (c >= 94) { - var switcher = c - 123 | 0; - if (switcher > 2 || switcher < 0) { - exit = 1; - } - else { - switch (switcher) { - case 0 : - return parse_tag(/* true */1, str_ind + 1 | 0, end_ind); - case 1 : - exit = 1; - break; - case 2 : - var beg_ind = str_ind + 1 | 0; - var match = parse_literal(beg_ind, beg_ind, end_ind); - return /* Fmt_EBB */[/* Formatting_lit */Block.__(17, [ - /* Close_tag */1, - match[0] - ])]; - - } - } - } - else if (c >= 91) { - switch (c - 91 | 0) { - case 0 : - return parse_tag(/* false */0, str_ind + 1 | 0, end_ind); - case 1 : - exit = 1; - break; - case 2 : - var beg_ind$1 = str_ind + 1 | 0; - var match$1 = parse_literal(beg_ind$1, beg_ind$1, end_ind); - return /* Fmt_EBB */[/* Formatting_lit */Block.__(17, [ - /* Close_box */0, - match$1[0] - ])]; - - } - } - else { - exit = 1; - } - } - else if (c !== 10) { - if (c >= 32) { - switch (c - 32 | 0) { - case 0 : - var beg_ind$2 = str_ind + 1 | 0; - var match$2 = parse_literal(beg_ind$2, beg_ind$2, end_ind); - return /* Fmt_EBB */[/* Formatting_lit */Block.__(17, [ - /* Break */Block.__(0, [ - "@ ", - 1, - 0 - ]), - match$2[0] - ])]; - case 5 : - if ((str_ind + 1 | 0) < end_ind && Caml_string.get(str, str_ind + 1 | 0) === /* "%" */37) { - var beg_ind$3 = str_ind + 2 | 0; - var match$3 = parse_literal(beg_ind$3, beg_ind$3, end_ind); - return /* Fmt_EBB */[/* Formatting_lit */Block.__(17, [ - /* Escaped_percent */6, - match$3[0] - ])]; - } - else { - var match$4 = parse_literal(str_ind, str_ind, end_ind); - return /* Fmt_EBB */[/* Char_literal */Block.__(12, [ - /* "@" */64, - match$4[0] - ])]; - } - break; - case 12 : - var beg_ind$4 = str_ind + 1 | 0; - var match$5 = parse_literal(beg_ind$4, beg_ind$4, end_ind); - return /* Fmt_EBB */[/* Formatting_lit */Block.__(17, [ - /* Break */Block.__(0, [ - "@,", - 0, - 0 - ]), - match$5[0] - ])]; - case 14 : - var beg_ind$5 = str_ind + 1 | 0; - var match$6 = parse_literal(beg_ind$5, beg_ind$5, end_ind); - return /* Fmt_EBB */[/* Formatting_lit */Block.__(17, [ - /* Flush_newline */4, - match$6[0] - ])]; - case 27 : - var str_ind$1 = str_ind + 1 | 0; - var end_ind$1 = end_ind; - var match$7; - try { - if (str_ind$1 === end_ind$1 || Caml_string.get(str, str_ind$1) !== /* "<" */60) { - throw Caml_builtin_exceptions.not_found; - } - var str_ind_1 = parse_spaces(str_ind$1 + 1 | 0, end_ind$1); - var match$8 = Caml_string.get(str, str_ind_1); - var exit$1 = 0; - if (match$8 >= 48) { - if (match$8 >= 58) { - throw Caml_builtin_exceptions.not_found; - } - else { - exit$1 = 1; - } - } - else if (match$8 !== 45) { - throw Caml_builtin_exceptions.not_found; - } - else { - exit$1 = 1; - } - if (exit$1 === 1) { - var match$9 = parse_integer(str_ind_1, end_ind$1); - var width = match$9[1]; - var str_ind_3 = parse_spaces(match$9[0], end_ind$1); - var match$10 = Caml_string.get(str, str_ind_3); - var switcher$1 = match$10 - 45 | 0; - if (switcher$1 > 12 || switcher$1 < 0) { - if (switcher$1 !== 17) { - throw Caml_builtin_exceptions.not_found; - } - else { - var s = $$String.sub(str, str_ind$1 - 2 | 0, (str_ind_3 - str_ind$1 | 0) + 3 | 0); - match$7 = /* tuple */[ - str_ind_3 + 1 | 0, - /* Break */Block.__(0, [ - s, - width, - 0 - ]) - ]; - } - } - else if (switcher$1 === 2 || switcher$1 === 1) { - throw Caml_builtin_exceptions.not_found; - } - else { - var match$11 = parse_integer(str_ind_3, end_ind$1); - var str_ind_5 = parse_spaces(match$11[0], end_ind$1); - if (Caml_string.get(str, str_ind_5) !== /* ">" */62) { - throw Caml_builtin_exceptions.not_found; - } - var s$1 = $$String.sub(str, str_ind$1 - 2 | 0, (str_ind_5 - str_ind$1 | 0) + 3 | 0); - match$7 = /* tuple */[ - str_ind_5 + 1 | 0, - /* Break */Block.__(0, [ - s$1, - width, - match$11[1] - ]) - ]; - } - } - - } - catch (exn){ - if (exn === Caml_builtin_exceptions.not_found) { - match$7 = /* tuple */[ - str_ind$1, - /* Break */Block.__(0, [ - "@;", - 1, - 0 - ]) - ]; - } - else if (exn[0] === Caml_builtin_exceptions.failure) { - match$7 = /* tuple */[ - str_ind$1, - /* Break */Block.__(0, [ - "@;", - 1, - 0 - ]) - ]; - } - else { - throw exn; - } - } - var next_ind = match$7[0]; - var match$12 = parse_literal(next_ind, next_ind, end_ind$1); - return /* Fmt_EBB */[/* Formatting_lit */Block.__(17, [ - match$7[1], - match$12[0] - ])]; - case 28 : - var str_ind$2 = str_ind + 1 | 0; - var end_ind$2 = end_ind; - var match$13; - try { - var str_ind_1$1 = parse_spaces(str_ind$2, end_ind$2); - var match$14 = Caml_string.get(str, str_ind_1$1); - var exit$2 = 0; - if (match$14 >= 48) { - if (match$14 >= 58) { - match$13 = /* None */0; - } - else { - exit$2 = 1; - } - } - else if (match$14 !== 45) { - match$13 = /* None */0; - } - else { - exit$2 = 1; - } - if (exit$2 === 1) { - var match$15 = parse_integer(str_ind_1$1, end_ind$2); - var str_ind_3$1 = parse_spaces(match$15[0], end_ind$2); - if (Caml_string.get(str, str_ind_3$1) !== /* ">" */62) { - throw Caml_builtin_exceptions.not_found; - } - var s$2 = $$String.sub(str, str_ind$2 - 2 | 0, (str_ind_3$1 - str_ind$2 | 0) + 3 | 0); - match$13 = /* Some */[/* tuple */[ - str_ind_3$1 + 1 | 0, - /* Magic_size */Block.__(1, [ - s$2, - match$15[1] - ]) - ]]; - } - - } - catch (exn$1){ - if (exn$1 === Caml_builtin_exceptions.not_found) { - match$13 = /* None */0; - } - else if (exn$1[0] === Caml_builtin_exceptions.failure) { - match$13 = /* None */0; - } - else { - throw exn$1; - } - } - if (match$13) { - var match$16 = match$13[0]; - var next_ind$1 = match$16[0]; - var match$17 = parse_literal(next_ind$1, next_ind$1, end_ind$2); - return /* Fmt_EBB */[/* Formatting_lit */Block.__(17, [ - match$16[1], - match$17[0] - ])]; - } - else { - var match$18 = parse_literal(str_ind$2, str_ind$2, end_ind$2); - return /* Fmt_EBB */[/* Formatting_lit */Block.__(17, [ - /* Scan_indic */Block.__(2, [/* "<" */60]), - match$18[0] - ])]; - } - case 1 : - case 2 : - case 3 : - case 4 : - case 6 : - case 7 : - case 8 : - case 9 : - case 10 : - case 11 : - case 13 : - case 15 : - case 16 : - case 17 : - case 18 : - case 19 : - case 20 : - case 21 : - case 22 : - case 23 : - case 24 : - case 25 : - case 26 : - case 29 : - case 30 : - exit = 1; - break; - case 31 : - var beg_ind$6 = str_ind + 1 | 0; - var match$19 = parse_literal(beg_ind$6, beg_ind$6, end_ind); - return /* Fmt_EBB */[/* Formatting_lit */Block.__(17, [ - /* FFlush */2, - match$19[0] - ])]; - case 32 : - var beg_ind$7 = str_ind + 1 | 0; - var match$20 = parse_literal(beg_ind$7, beg_ind$7, end_ind); - return /* Fmt_EBB */[/* Formatting_lit */Block.__(17, [ - /* Escaped_at */5, - match$20[0] - ])]; - - } - } - else { - exit = 1; - } - } - else { - var beg_ind$8 = str_ind + 1 | 0; - var match$21 = parse_literal(beg_ind$8, beg_ind$8, end_ind); - return /* Fmt_EBB */[/* Formatting_lit */Block.__(17, [ - /* Force_newline */3, - match$21[0] - ])]; - } - if (exit === 1) { - var beg_ind$9 = str_ind + 1 | 0; - var match$22 = parse_literal(beg_ind$9, beg_ind$9, end_ind); - return /* Fmt_EBB */[/* Formatting_lit */Block.__(17, [ - /* Scan_indic */Block.__(2, [c]), - match$22[0] - ])]; - } - - } - }; - var add_literal = function (lit_start, str_ind, fmt) { - var size = str_ind - lit_start | 0; - if (size !== 0) { - if (size !== 1) { - return /* Fmt_EBB */[/* String_literal */Block.__(11, [ - $$String.sub(str, lit_start, size), - fmt - ])]; - } - else { - return /* Fmt_EBB */[/* Char_literal */Block.__(12, [ - Caml_string.get(str, lit_start), - fmt - ])]; - } - } - else { - return /* Fmt_EBB */[fmt]; - } - }; - var parse_spaces = function (_str_ind, end_ind) { - while(true) { - var str_ind = _str_ind; - if (str_ind === end_ind) { - invalid_format_message(end_ind, "unexpected end of format"); - } - if (Caml_string.get(str, str_ind) === /* " " */32) { - _str_ind = str_ind + 1 | 0; - continue ; - - } - else { - return str_ind; - } - }; - }; - var parse_integer = function (str_ind, end_ind) { - if (str_ind === end_ind) { - invalid_format_message(end_ind, "unexpected end of format"); - } - var match = Caml_string.get(str, str_ind); - if (match >= 48) { - if (match >= 58) { - throw [ - Caml_builtin_exceptions.assert_failure, - [ - "camlinternalFormat.ml", - 2621, - 11 - ] - ]; - } - else { - return parse_positive(str_ind, end_ind, 0); - } - } - else if (match !== 45) { - throw [ - Caml_builtin_exceptions.assert_failure, - [ - "camlinternalFormat.ml", - 2621, - 11 - ] - ]; - } - else { - if ((str_ind + 1 | 0) === end_ind) { - invalid_format_message(end_ind, "unexpected end of format"); - } - var c = Caml_string.get(str, str_ind + 1 | 0); - if (c > 57 || c < 48) { - return expected_character(str_ind + 1 | 0, "digit", c); - } - else { - var match$1 = parse_positive(str_ind + 1 | 0, end_ind, 0); - return /* tuple */[ - match$1[0], - -match$1[1] | 0 - ]; - } - } - }; - var compute_float_conv = function (pct_ind, str_ind, _plus, _space, symb) { - while(true) { - var space = _space; - var plus = _plus; - if (plus !== 0) { - if (space !== 0) { - if (legacy_behavior$1) { - _space = /* false */0; - continue ; - - } - else { - return incompatible_flag(pct_ind, str_ind, /* " " */32, "'+'"); - } - } - else { - var exit = 0; - if (symb >= 72) { - var switcher = symb - 101 | 0; - if (switcher > 2 || switcher < 0) { - exit = 1; - } - else { - switch (switcher) { - case 0 : - return /* Float_pe */4; - case 1 : - return /* Float_pf */1; - case 2 : - return /* Float_pg */10; - - } - } - } - else if (symb >= 69) { - switch (symb - 69 | 0) { - case 0 : - return /* Float_pE */7; - case 1 : - exit = 1; - break; - case 2 : - return /* Float_pG */13; - - } - } - else { - exit = 1; - } - if (exit === 1) { - if (legacy_behavior$1) { - _plus = /* false */0; - continue ; - - } - else { - return incompatible_flag(pct_ind, str_ind, symb, "'+'"); - } - } - - } - } - else if (space !== 0) { - var exit$1 = 0; - if (symb >= 72) { - var switcher$1 = symb - 101 | 0; - if (switcher$1 > 2 || switcher$1 < 0) { - exit$1 = 1; - } - else { - switch (switcher$1) { - case 0 : - return /* Float_se */5; - case 1 : - return /* Float_sf */2; - case 2 : - return /* Float_sg */11; - - } - } - } - else if (symb >= 69) { - switch (symb - 69 | 0) { - case 0 : - return /* Float_sE */8; - case 1 : - exit$1 = 1; - break; - case 2 : - return /* Float_sG */14; - - } - } - else { - exit$1 = 1; - } - if (exit$1 === 1) { - if (legacy_behavior$1) { - _space = /* false */0; - continue ; - - } - else { - return incompatible_flag(pct_ind, str_ind, symb, "' '"); - } - } - - } - else if (symb >= 72) { - var switcher$2 = symb - 101 | 0; - if (switcher$2 > 2 || switcher$2 < 0) { - throw [ - Caml_builtin_exceptions.assert_failure, - [ - "camlinternalFormat.ml", - 2744, - 25 - ] - ]; - } - else { - switch (switcher$2) { - case 0 : - return /* Float_e */3; - case 1 : - return /* Float_f */0; - case 2 : - return /* Float_g */9; - - } - } - } - else if (symb >= 69) { - switch (symb - 69 | 0) { - case 0 : - return /* Float_E */6; - case 1 : - return /* Float_F */15; - case 2 : - return /* Float_G */12; - - } - } - else { - throw [ - Caml_builtin_exceptions.assert_failure, - [ - "camlinternalFormat.ml", - 2744, - 25 - ] - ]; - } - }; - }; - var search_subformat_end = function (_str_ind, end_ind, c) { - while(true) { - var str_ind = _str_ind; - if (str_ind === end_ind) { - Curry._3(failwith_message(/* Format */[ - /* String_literal */Block.__(11, [ - "invalid format ", - /* Caml_string */Block.__(3, [ - /* No_padding */0, - /* String_literal */Block.__(11, [ - ': unclosed sub-format, expected "', - /* Char_literal */Block.__(12, [ - /* "%" */37, - /* Char */Block.__(0, [/* String_literal */Block.__(11, [ - '" at character number ', - /* Int */Block.__(4, [ - /* Int_d */0, - /* No_padding */0, - /* No_precision */0, - /* End_of_format */0 - ]) - ])]) - ]) - ]) - ]) - ]), - 'invalid format %S: unclosed sub-format, expected "%%%c" at character number %d' - ]), str, c, end_ind); - } - var match = Caml_string.get(str, str_ind); - if (match !== 37) { - _str_ind = str_ind + 1 | 0; - continue ; - - } - else { - if ((str_ind + 1 | 0) === end_ind) { - invalid_format_message(end_ind, "unexpected end of format"); - } - if (Caml_string.get(str, str_ind + 1 | 0) === c) { - return str_ind; - } - else { - var match$1 = Caml_string.get(str, str_ind + 1 | 0); - var exit = 0; - if (match$1 >= 95) { - if (match$1 >= 123) { - if (match$1 >= 126) { - exit = 1; - } - else { - switch (match$1 - 123 | 0) { - case 0 : - var sub_end = search_subformat_end(str_ind + 2 | 0, end_ind, /* "}" */125); - _str_ind = sub_end + 2 | 0; - continue ; - case 1 : - exit = 1; - break; - case 2 : - return expected_character(str_ind + 1 | 0, "character ')'", /* "}" */125); - - } - } - } - else if (match$1 >= 96) { - exit = 1; - } - else { - if ((str_ind + 2 | 0) === end_ind) { - invalid_format_message(end_ind, "unexpected end of format"); - } - var match$2 = Caml_string.get(str, str_ind + 2 | 0); - if (match$2 !== 40) { - if (match$2 !== 123) { - _str_ind = str_ind + 3 | 0; - continue ; - - } - else { - var sub_end$1 = search_subformat_end(str_ind + 3 | 0, end_ind, /* "}" */125); - _str_ind = sub_end$1 + 2 | 0; - continue ; - - } - } - else { - var sub_end$2 = search_subformat_end(str_ind + 3 | 0, end_ind, /* ")" */41); - _str_ind = sub_end$2 + 2 | 0; - continue ; - - } - } - } - else if (match$1 !== 40) { - if (match$1 !== 41) { - exit = 1; - } - else { - return expected_character(str_ind + 1 | 0, "character '}'", /* ")" */41); - } - } - else { - var sub_end$3 = search_subformat_end(str_ind + 2 | 0, end_ind, /* ")" */41); - _str_ind = sub_end$3 + 2 | 0; - continue ; - - } - if (exit === 1) { - _str_ind = str_ind + 2 | 0; - continue ; - - } - - } - } - }; - }; - var parse_conversion = function (pct_ind, str_ind, end_ind, plus, sharp, space, ign, pad, prec, padprec, symb) { - var plus_used = /* false */0; - var sharp_used = /* false */0; - var space_used = /* false */0; - var ign_used = [/* false */0]; - var pad_used = /* false */0; - var prec_used = [/* false */0]; - var check_no_0 = function (symb, pad) { - if (typeof pad === "number") { - return pad; - } - else if (pad.tag) { - if (pad[0] >= 2) { - if (legacy_behavior$1) { - return /* Arg_padding */Block.__(1, [/* Right */1]); - } - else { - return incompatible_flag(pct_ind, str_ind, symb, "0"); - } - } - else { - return pad; - } - } - else if (pad[0] >= 2) { - if (legacy_behavior$1) { - return /* Lit_padding */Block.__(0, [ - /* Right */1, - pad[1] - ]); - } - else { - return incompatible_flag(pct_ind, str_ind, symb, "0"); - } - } - else { - return pad; - } - }; - var opt_of_pad = function (c, pad) { - if (typeof pad === "number") { - return /* None */0; - } - else if (pad.tag) { - return incompatible_flag(pct_ind, str_ind, c, "'*'"); - } - else { - switch (pad[0]) { - case 0 : - if (legacy_behavior$1) { - return /* Some */[pad[1]]; - } - else { - return incompatible_flag(pct_ind, str_ind, c, "'-'"); - } - case 1 : - return /* Some */[pad[1]]; - case 2 : - if (legacy_behavior$1) { - return /* Some */[pad[1]]; - } - else { - return incompatible_flag(pct_ind, str_ind, c, "'0'"); - } - - } - } - }; - var get_prec_opt = function () { - prec_used[0] = /* true */1; - if (typeof prec === "number") { - if (prec !== 0) { - return incompatible_flag(pct_ind, str_ind, /* "_" */95, "'*'"); - } - else { - return /* None */0; - } - } - else { - return /* Some */[prec[0]]; - } - }; - var fmt_result; - var exit = 0; - var exit$1 = 0; - var exit$2 = 0; - if (symb >= 124) { - exit$1 = 6; - } - else { - switch (symb) { - case 33 : - var match = parse_literal(str_ind, str_ind, end_ind); - fmt_result = /* Fmt_EBB */[/* Flush */Block.__(10, [match[0]])]; - break; - case 40 : - var sub_end = search_subformat_end(str_ind, end_ind, /* ")" */41); - var beg_ind = sub_end + 2 | 0; - var match$1 = parse_literal(beg_ind, beg_ind, end_ind); - var fmt_rest = match$1[0]; - var match$2 = parse_literal(str_ind, str_ind, sub_end); - var sub_fmtty = fmtty_of_fmt(match$2[0]); - if (ign_used[0] = /* true */1, ign) { - pad_used = /* true */1; - var ignored_000 = opt_of_pad(/* "_" */95, pad); - var ignored = /* Ignored_format_subst */Block.__(8, [ - ignored_000, - sub_fmtty - ]); - fmt_result = /* Fmt_EBB */[/* Ignored_param */Block.__(23, [ - ignored, - fmt_rest - ])]; - } - else { - pad_used = /* true */1; - fmt_result = /* Fmt_EBB */[/* Format_subst */Block.__(14, [ - opt_of_pad(/* "(" */40, pad), - sub_fmtty, - fmt_rest - ])]; - } - break; - case 44 : - fmt_result = parse_literal(str_ind, str_ind, end_ind); - break; - case 37 : - case 64 : - exit$1 = 4; - break; - case 67 : - var match$3 = parse_literal(str_ind, str_ind, end_ind); - var fmt_rest$1 = match$3[0]; - fmt_result = (ign_used[0] = /* true */1, ign) ? /* Fmt_EBB */[/* Ignored_param */Block.__(23, [ - /* Ignored_caml_char */1, - fmt_rest$1 - ])] : /* Fmt_EBB */[/* Caml_char */Block.__(1, [fmt_rest$1])]; - break; - case 78 : - var match$4 = parse_literal(str_ind, str_ind, end_ind); - var fmt_rest$2 = match$4[0]; - if (ign_used[0] = /* true */1, ign) { - var ignored$1 = /* Ignored_scan_get_counter */Block.__(10, [/* Token_counter */2]); - fmt_result = /* Fmt_EBB */[/* Ignored_param */Block.__(23, [ - ignored$1, - fmt_rest$2 - ])]; - } - else { - fmt_result = /* Fmt_EBB */[/* Scan_get_counter */Block.__(21, [ - /* Token_counter */2, - fmt_rest$2 - ])]; - } - break; - case 83 : - pad_used = /* true */1; - var pad$1 = check_no_0(symb, padprec); - var match$5 = parse_literal(str_ind, str_ind, end_ind); - var fmt_rest$3 = match$5[0]; - if (ign_used[0] = /* true */1, ign) { - pad_used = /* true */1; - var ignored$2 = /* Ignored_caml_string */Block.__(1, [opt_of_pad(/* "_" */95, padprec)]); - fmt_result = /* Fmt_EBB */[/* Ignored_param */Block.__(23, [ - ignored$2, - fmt_rest$3 - ])]; - } - else { - var match$6 = make_padding_fmt_ebb(pad$1, fmt_rest$3); - fmt_result = /* Fmt_EBB */[/* Caml_string */Block.__(3, [ - match$6[0], - match$6[1] - ])]; - } - break; - case 91 : - var match$7 = parse_char_set(str_ind, end_ind); - var char_set = match$7[1]; - var next_ind = match$7[0]; - var match$8 = parse_literal(next_ind, next_ind, end_ind); - var fmt_rest$4 = match$8[0]; - if (ign_used[0] = /* true */1, ign) { - pad_used = /* true */1; - var ignored_000$1 = opt_of_pad(/* "_" */95, pad); - var ignored$3 = /* Ignored_scan_char_set */Block.__(9, [ - ignored_000$1, - char_set - ]); - fmt_result = /* Fmt_EBB */[/* Ignored_param */Block.__(23, [ - ignored$3, - fmt_rest$4 - ])]; - } - else { - pad_used = /* true */1; - fmt_result = /* Fmt_EBB */[/* Scan_char_set */Block.__(20, [ - opt_of_pad(/* "[" */91, pad), - char_set, - fmt_rest$4 - ])]; - } - break; - case 32 : - case 35 : - case 43 : - case 45 : - case 95 : - exit$1 = 5; - break; - case 97 : - var match$9 = parse_literal(str_ind, str_ind, end_ind); - fmt_result = /* Fmt_EBB */[/* Alpha */Block.__(15, [match$9[0]])]; - break; - case 66 : - case 98 : - exit$1 = 3; - break; - case 99 : - var char_format = function (fmt_rest) { - if (ign_used[0] = /* true */1, ign) { - return /* Fmt_EBB */[/* Ignored_param */Block.__(23, [ - /* Ignored_char */0, - fmt_rest - ])]; - } - else { - return /* Fmt_EBB */[/* Char */Block.__(0, [fmt_rest])]; - } - }; - var scan_format = function (fmt_rest) { - if (ign_used[0] = /* true */1, ign) { - return /* Fmt_EBB */[/* Ignored_param */Block.__(23, [ - /* Ignored_scan_next_char */4, - fmt_rest - ])]; - } - else { - return /* Fmt_EBB */[/* Scan_next_char */Block.__(22, [fmt_rest])]; - } - }; - var match$10 = parse_literal(str_ind, str_ind, end_ind); - var fmt_rest$5 = match$10[0]; - pad_used = /* true */1; - var match$11 = opt_of_pad(/* "c" */99, pad); - fmt_result = match$11 ? ( - match$11[0] !== 0 ? ( - legacy_behavior$1 ? char_format(fmt_rest$5) : invalid_format_message(str_ind, "non-zero widths are unsupported for %c conversions") - ) : scan_format(fmt_rest$5) - ) : char_format(fmt_rest$5); - break; - case 69 : - case 70 : - case 71 : - case 101 : - case 102 : - case 103 : - exit$1 = 2; - break; - case 76 : - case 108 : - case 110 : - exit$2 = 8; - break; - case 114 : - var match$12 = parse_literal(str_ind, str_ind, end_ind); - var fmt_rest$6 = match$12[0]; - fmt_result = (ign_used[0] = /* true */1, ign) ? /* Fmt_EBB */[/* Ignored_param */Block.__(23, [ - /* Ignored_reader */3, - fmt_rest$6 - ])] : /* Fmt_EBB */[/* Reader */Block.__(19, [fmt_rest$6])]; - break; - case 115 : - pad_used = /* true */1; - var pad$2 = check_no_0(symb, padprec); - var match$13 = parse_literal(str_ind, str_ind, end_ind); - var fmt_rest$7 = match$13[0]; - if (ign_used[0] = /* true */1, ign) { - pad_used = /* true */1; - var ignored$4 = /* Ignored_string */Block.__(0, [opt_of_pad(/* "_" */95, padprec)]); - fmt_result = /* Fmt_EBB */[/* Ignored_param */Block.__(23, [ - ignored$4, - fmt_rest$7 - ])]; - } - else { - var match$14 = make_padding_fmt_ebb(pad$2, fmt_rest$7); - fmt_result = /* Fmt_EBB */[/* String */Block.__(2, [ - match$14[0], - match$14[1] - ])]; - } - break; - case 116 : - var match$15 = parse_literal(str_ind, str_ind, end_ind); - fmt_result = /* Fmt_EBB */[/* Theta */Block.__(16, [match$15[0]])]; - break; - case 88 : - case 100 : - case 105 : - case 111 : - case 117 : - case 120 : - exit$2 = 7; - break; - case 0 : - case 1 : - case 2 : - case 3 : - case 4 : - case 5 : - case 6 : - case 7 : - case 8 : - case 9 : - case 10 : - case 11 : - case 12 : - case 13 : - case 14 : - case 15 : - case 16 : - case 17 : - case 18 : - case 19 : - case 20 : - case 21 : - case 22 : - case 23 : - case 24 : - case 25 : - case 26 : - case 27 : - case 28 : - case 29 : - case 30 : - case 31 : - case 34 : - case 36 : - case 38 : - case 39 : - case 41 : - case 42 : - case 46 : - case 47 : - case 48 : - case 49 : - case 50 : - case 51 : - case 52 : - case 53 : - case 54 : - case 55 : - case 56 : - case 57 : - case 58 : - case 59 : - case 60 : - case 61 : - case 62 : - case 63 : - case 65 : - case 68 : - case 72 : - case 73 : - case 74 : - case 75 : - case 77 : - case 79 : - case 80 : - case 81 : - case 82 : - case 84 : - case 85 : - case 86 : - case 87 : - case 89 : - case 90 : - case 92 : - case 93 : - case 94 : - case 96 : - case 104 : - case 106 : - case 107 : - case 109 : - case 112 : - case 113 : - case 118 : - case 119 : - case 121 : - case 122 : - exit$1 = 6; - break; - case 123 : - var sub_end$1 = search_subformat_end(str_ind, end_ind, /* "}" */125); - var match$16 = parse_literal(str_ind, str_ind, sub_end$1); - var beg_ind$1 = sub_end$1 + 2 | 0; - var match$17 = parse_literal(beg_ind$1, beg_ind$1, end_ind); - var fmt_rest$8 = match$17[0]; - var sub_fmtty$1 = fmtty_of_fmt(match$16[0]); - if (ign_used[0] = /* true */1, ign) { - pad_used = /* true */1; - var ignored_000$2 = opt_of_pad(/* "_" */95, pad); - var ignored$5 = /* Ignored_format_arg */Block.__(7, [ - ignored_000$2, - sub_fmtty$1 - ]); - fmt_result = /* Fmt_EBB */[/* Ignored_param */Block.__(23, [ - ignored$5, - fmt_rest$8 - ])]; - } - else { - pad_used = /* true */1; - fmt_result = /* Fmt_EBB */[/* Format_arg */Block.__(13, [ - opt_of_pad(/* "{" */123, pad), - sub_fmtty$1, - fmt_rest$8 - ])]; - } - break; - - } - } - switch (exit$2) { - case 7 : - plus_used = /* true */1; - sharp_used = /* true */1; - space_used = /* true */1; - var iconv = compute_int_conv(pct_ind, str_ind, plus, sharp, space, symb); - var match$18 = parse_literal(str_ind, str_ind, end_ind); - var fmt_rest$9 = match$18[0]; - if (ign_used[0] = /* true */1, ign) { - pad_used = /* true */1; - var ignored_001 = opt_of_pad(/* "_" */95, pad); - var ignored$6 = /* Ignored_int */Block.__(2, [ - iconv, - ignored_001 - ]); - fmt_result = /* Fmt_EBB */[/* Ignored_param */Block.__(23, [ - ignored$6, - fmt_rest$9 - ])]; - } - else { - pad_used = /* true */1; - prec_used[0] = /* true */1; - var pad$3; - var exit$3 = 0; - if (typeof prec === "number" && prec === 0) { - pad$3 = pad; - } - else { - exit$3 = 9; - } - if (exit$3 === 9) { - pad$3 = typeof pad === "number" ? /* No_padding */0 : ( - pad.tag ? ( - pad[0] >= 2 ? ( - legacy_behavior$1 ? /* Arg_padding */Block.__(1, [/* Right */1]) : incompatible_flag(pct_ind, str_ind, /* "0" */48, "precision") - ) : pad - ) : ( - pad[0] >= 2 ? ( - legacy_behavior$1 ? /* Lit_padding */Block.__(0, [ - /* Right */1, - pad[1] - ]) : incompatible_flag(pct_ind, str_ind, /* "0" */48, "precision") - ) : pad - ) - ); - } - var match$19 = make_padprec_fmt_ebb(pad$3, (prec_used[0] = /* true */1, prec), fmt_rest$9); - fmt_result = /* Fmt_EBB */[/* Int */Block.__(4, [ - iconv, - match$19[0], - match$19[1], - match$19[2] - ])]; - } - break; - case 8 : - if (str_ind === end_ind || !is_int_base(Caml_string.get(str, str_ind))) { - var match$20 = parse_literal(str_ind, str_ind, end_ind); - var fmt_rest$10 = match$20[0]; - var counter = counter_of_char(symb); - if (ign_used[0] = /* true */1, ign) { - var ignored$7 = /* Ignored_scan_get_counter */Block.__(10, [counter]); - fmt_result = /* Fmt_EBB */[/* Ignored_param */Block.__(23, [ - ignored$7, - fmt_rest$10 - ])]; - } - else { - fmt_result = /* Fmt_EBB */[/* Scan_get_counter */Block.__(21, [ - counter, - fmt_rest$10 - ])]; - } - } - else { - exit$1 = 6; - } - break; - - } - switch (exit$1) { - case 2 : - plus_used = /* true */1; - space_used = /* true */1; - var fconv = compute_float_conv(pct_ind, str_ind, plus, space, symb); - var match$21 = parse_literal(str_ind, str_ind, end_ind); - var fmt_rest$11 = match$21[0]; - if (ign_used[0] = /* true */1, ign) { - pad_used = /* true */1; - var ignored_000$3 = opt_of_pad(/* "_" */95, pad); - var ignored_001$1 = get_prec_opt(/* () */0); - var ignored$8 = /* Ignored_float */Block.__(6, [ - ignored_000$3, - ignored_001$1 - ]); - fmt_result = /* Fmt_EBB */[/* Ignored_param */Block.__(23, [ - ignored$8, - fmt_rest$11 - ])]; - } - else { - pad_used = /* true */1; - var match$22 = make_padprec_fmt_ebb(pad, (prec_used[0] = /* true */1, prec), fmt_rest$11); - fmt_result = /* Fmt_EBB */[/* Float */Block.__(8, [ - fconv, - match$22[0], - match$22[1], - match$22[2] - ])]; - } - break; - case 3 : - var match$23 = parse_literal(str_ind, str_ind, end_ind); - var fmt_rest$12 = match$23[0]; - fmt_result = (ign_used[0] = /* true */1, ign) ? /* Fmt_EBB */[/* Ignored_param */Block.__(23, [ - /* Ignored_bool */2, - fmt_rest$12 - ])] : /* Fmt_EBB */[/* Bool */Block.__(9, [fmt_rest$12])]; - break; - case 4 : - var match$24 = parse_literal(str_ind, str_ind, end_ind); - fmt_result = /* Fmt_EBB */[/* Char_literal */Block.__(12, [ - symb, - match$24[0] - ])]; - break; - case 5 : - fmt_result = Curry._3(failwith_message(/* Format */[ - /* String_literal */Block.__(11, [ - "invalid format ", - /* Caml_string */Block.__(3, [ - /* No_padding */0, - /* String_literal */Block.__(11, [ - ": at character number ", - /* Int */Block.__(4, [ - /* Int_d */0, - /* No_padding */0, - /* No_precision */0, - /* String_literal */Block.__(11, [ - ", flag ", - /* Caml_char */Block.__(1, [/* String_literal */Block.__(11, [ - " is only allowed after the '", - /* Char_literal */Block.__(12, [ - /* "%" */37, - /* String_literal */Block.__(11, [ - "', before padding and precision", - /* End_of_format */0 - ]) - ]) - ])]) - ]) - ]) - ]) - ]) - ]), - "invalid format %S: at character number %d, flag %C is only allowed after the '%%', before padding and precision" - ]), str, pct_ind, symb); - break; - case 6 : - if (symb >= 108) { - if (symb >= 111) { - exit = 1; - } - else { - switch (symb - 108 | 0) { - case 0 : - plus_used = /* true */1; - sharp_used = /* true */1; - space_used = /* true */1; - var iconv$1 = compute_int_conv(pct_ind, str_ind + 1 | 0, plus, sharp, space, Caml_string.get(str, str_ind)); - var beg_ind$2 = str_ind + 1 | 0; - var match$25 = parse_literal(beg_ind$2, beg_ind$2, end_ind); - var fmt_rest$13 = match$25[0]; - if (ign_used[0] = /* true */1, ign) { - pad_used = /* true */1; - var ignored_001$2 = opt_of_pad(/* "_" */95, pad); - var ignored$9 = /* Ignored_int32 */Block.__(3, [ - iconv$1, - ignored_001$2 - ]); - fmt_result = /* Fmt_EBB */[/* Ignored_param */Block.__(23, [ - ignored$9, - fmt_rest$13 - ])]; - } - else { - pad_used = /* true */1; - var match$26 = make_padprec_fmt_ebb(pad, (prec_used[0] = /* true */1, prec), fmt_rest$13); - fmt_result = /* Fmt_EBB */[/* Int32 */Block.__(5, [ - iconv$1, - match$26[0], - match$26[1], - match$26[2] - ])]; - } - break; - case 1 : - exit = 1; - break; - case 2 : - plus_used = /* true */1; - sharp_used = /* true */1; - space_used = /* true */1; - var iconv$2 = compute_int_conv(pct_ind, str_ind + 1 | 0, plus, sharp, space, Caml_string.get(str, str_ind)); - var beg_ind$3 = str_ind + 1 | 0; - var match$27 = parse_literal(beg_ind$3, beg_ind$3, end_ind); - var fmt_rest$14 = match$27[0]; - if (ign_used[0] = /* true */1, ign) { - pad_used = /* true */1; - var ignored_001$3 = opt_of_pad(/* "_" */95, pad); - var ignored$10 = /* Ignored_nativeint */Block.__(4, [ - iconv$2, - ignored_001$3 - ]); - fmt_result = /* Fmt_EBB */[/* Ignored_param */Block.__(23, [ - ignored$10, - fmt_rest$14 - ])]; - } - else { - pad_used = /* true */1; - var match$28 = make_padprec_fmt_ebb(pad, (prec_used[0] = /* true */1, prec), fmt_rest$14); - fmt_result = /* Fmt_EBB */[/* Nativeint */Block.__(6, [ - iconv$2, - match$28[0], - match$28[1], - match$28[2] - ])]; - } - break; - - } - } - } - else if (symb !== 76) { - exit = 1; - } - else { - plus_used = /* true */1; - sharp_used = /* true */1; - space_used = /* true */1; - var iconv$3 = compute_int_conv(pct_ind, str_ind + 1 | 0, plus, sharp, space, Caml_string.get(str, str_ind)); - var beg_ind$4 = str_ind + 1 | 0; - var match$29 = parse_literal(beg_ind$4, beg_ind$4, end_ind); - var fmt_rest$15 = match$29[0]; - if (ign_used[0] = /* true */1, ign) { - pad_used = /* true */1; - var ignored_001$4 = opt_of_pad(/* "_" */95, pad); - var ignored$11 = /* Ignored_int64 */Block.__(5, [ - iconv$3, - ignored_001$4 - ]); - fmt_result = /* Fmt_EBB */[/* Ignored_param */Block.__(23, [ - ignored$11, - fmt_rest$15 - ])]; - } - else { - pad_used = /* true */1; - var match$30 = make_padprec_fmt_ebb(pad, (prec_used[0] = /* true */1, prec), fmt_rest$15); - fmt_result = /* Fmt_EBB */[/* Int64 */Block.__(7, [ - iconv$3, - match$30[0], - match$30[1], - match$30[2] - ])]; - } - } - break; - - } - if (exit === 1) { - fmt_result = Curry._3(failwith_message(/* Format */[ - /* String_literal */Block.__(11, [ - "invalid format ", - /* Caml_string */Block.__(3, [ - /* No_padding */0, - /* String_literal */Block.__(11, [ - ": at character number ", - /* Int */Block.__(4, [ - /* Int_d */0, - /* No_padding */0, - /* No_precision */0, - /* String_literal */Block.__(11, [ - ', invalid conversion "', - /* Char_literal */Block.__(12, [ - /* "%" */37, - /* Char */Block.__(0, [/* Char_literal */Block.__(12, [ - /* "\"" */34, - /* End_of_format */0 - ])]) - ]) - ]) - ]) - ]) - ]) - ]), - 'invalid format %S: at character number %d, invalid conversion "%%%c"' - ]), str, str_ind - 1 | 0, symb); - } - if (!legacy_behavior$1) { - if (!plus_used && plus) { - incompatible_flag(pct_ind, str_ind, symb, "'+'"); - } - if (!sharp_used && sharp) { - incompatible_flag(pct_ind, str_ind, symb, "'#'"); - } - if (!space_used && space) { - incompatible_flag(pct_ind, str_ind, symb, "' '"); - } - if (!pad_used && Caml_obj.caml_notequal(/* Padding_EBB */[pad], /* Padding_EBB */[/* No_padding */0])) { - incompatible_flag(pct_ind, str_ind, symb, "`padding'"); - } - if (!prec_used[0] && Caml_obj.caml_notequal(/* Precision_EBB */[prec], /* Precision_EBB */[/* No_precision */0])) { - incompatible_flag(pct_ind, str_ind, ign ? /* "_" */95 : symb, "`precision'"); - } - if (ign && plus) { - incompatible_flag(pct_ind, str_ind, /* "_" */95, "'+'"); - } - - } - if (!ign_used[0] && ign) { - var exit$4 = 0; - if (symb >= 38) { - if (symb !== 44) { - if (symb !== 64) { - exit$4 = 1; - } - else if (!legacy_behavior$1) { - exit$4 = 1; - } - - } - else if (!legacy_behavior$1) { - exit$4 = 1; - } - - } - else if (symb !== 33) { - if (symb >= 37) { - if (!legacy_behavior$1) { - exit$4 = 1; - } - - } - else { - exit$4 = 1; - } - } - else if (!legacy_behavior$1) { - exit$4 = 1; - } - if (exit$4 === 1) { - incompatible_flag(pct_ind, str_ind, symb, "'_'"); - } - - } - return fmt_result; - }; - var parse_flags = function (pct_ind, str_ind, end_ind, ign) { - var zero = [/* false */0]; - var minus = [/* false */0]; - var plus = [/* false */0]; - var space = [/* false */0]; - var sharp = [/* false */0]; - var set_flag = function (str_ind, flag) { - if (flag[0] && !legacy_behavior$1) { - Curry._3(failwith_message(/* Format */[ - /* String_literal */Block.__(11, [ - "invalid format ", - /* Caml_string */Block.__(3, [ - /* No_padding */0, - /* String_literal */Block.__(11, [ - ": at character number ", - /* Int */Block.__(4, [ - /* Int_d */0, - /* No_padding */0, - /* No_precision */0, - /* String_literal */Block.__(11, [ - ", duplicate flag ", - /* Caml_char */Block.__(1, [/* End_of_format */0]) - ]) - ]) - ]) - ]) - ]), - "invalid format %S: at character number %d, duplicate flag %C" - ]), str, str_ind, Caml_string.get(str, str_ind)); - } - flag[0] = /* true */1; - return /* () */0; - }; - var _str_ind = str_ind; - while(true) { - var str_ind$1 = _str_ind; - if (str_ind$1 === end_ind) { - invalid_format_message(end_ind, "unexpected end of format"); - } - var match = Caml_string.get(str, str_ind$1); - var exit = 0; - var switcher = match - 32 | 0; - if (switcher > 16 || switcher < 0) { - exit = 1; - } - else { - switch (switcher) { - case 0 : - set_flag(str_ind$1, space); - _str_ind = str_ind$1 + 1 | 0; - continue ; - case 3 : - set_flag(str_ind$1, sharp); - _str_ind = str_ind$1 + 1 | 0; - continue ; - case 11 : - set_flag(str_ind$1, plus); - _str_ind = str_ind$1 + 1 | 0; - continue ; - case 13 : - set_flag(str_ind$1, minus); - _str_ind = str_ind$1 + 1 | 0; - continue ; - case 1 : - case 2 : - case 4 : - case 5 : - case 6 : - case 7 : - case 8 : - case 9 : - case 10 : - case 12 : - case 14 : - case 15 : - exit = 1; - break; - case 16 : - set_flag(str_ind$1, zero); - _str_ind = str_ind$1 + 1 | 0; - continue ; - - } - } - if (exit === 1) { - var pct_ind$1 = pct_ind; - var str_ind$2 = str_ind$1; - var end_ind$1 = end_ind; - var zero$1 = zero[0]; - var minus$1 = minus[0]; - var plus$1 = plus[0]; - var sharp$1 = sharp[0]; - var space$1 = space[0]; - var ign$1 = ign; - if (str_ind$2 === end_ind$1) { - invalid_format_message(end_ind$1, "unexpected end of format"); - } - var padty = zero$1 !== 0 ? ( - minus$1 !== 0 ? ( - legacy_behavior$1 ? /* Left */0 : incompatible_flag(pct_ind$1, str_ind$2, /* "-" */45, "0") - ) : /* Zeros */2 - ) : ( - minus$1 !== 0 ? /* Left */0 : /* Right */1 - ); - var match$1 = Caml_string.get(str, str_ind$2); - var exit$1 = 0; - if (match$1 >= 48) { - if (match$1 >= 58) { - exit$1 = 1; - } - else { - var match$2 = parse_positive(str_ind$2, end_ind$1, 0); - return parse_after_padding(pct_ind$1, match$2[0], end_ind$1, minus$1, plus$1, sharp$1, space$1, ign$1, /* Lit_padding */Block.__(0, [ - padty, - match$2[1] - ])); - } - } - else if (match$1 !== 42) { - exit$1 = 1; - } - else { - return parse_after_padding(pct_ind$1, str_ind$2 + 1 | 0, end_ind$1, minus$1, plus$1, sharp$1, space$1, ign$1, /* Arg_padding */Block.__(1, [padty])); - } - if (exit$1 === 1) { - switch (padty) { - case 0 : - if (!legacy_behavior$1) { - invalid_format_without(str_ind$2 - 1 | 0, /* "-" */45, "padding"); - } - return parse_after_padding(pct_ind$1, str_ind$2, end_ind$1, minus$1, plus$1, sharp$1, space$1, ign$1, /* No_padding */0); - case 1 : - return parse_after_padding(pct_ind$1, str_ind$2, end_ind$1, minus$1, plus$1, sharp$1, space$1, ign$1, /* No_padding */0); - case 2 : - return parse_after_padding(pct_ind$1, str_ind$2, end_ind$1, minus$1, plus$1, sharp$1, space$1, ign$1, /* Lit_padding */Block.__(0, [ - /* Right */1, - 0 - ])); - - } - } - - } - - }; - }; - var is_int_base = function (symb) { - var switcher = symb - 88 | 0; - if (switcher > 32 || switcher < 0) { - return /* false */0; - } - else { - switch (switcher) { - case 1 : - case 2 : - case 3 : - case 4 : - case 5 : - case 6 : - case 7 : - case 8 : - case 9 : - case 10 : - case 11 : - case 13 : - case 14 : - case 15 : - case 16 : - case 18 : - case 19 : - case 20 : - case 21 : - case 22 : - case 24 : - case 25 : - case 26 : - case 27 : - case 28 : - case 30 : - case 31 : - return /* false */0; - case 0 : - case 12 : - case 17 : - case 23 : - case 29 : - case 32 : - return /* true */1; - - } - } - }; - var counter_of_char = function (symb) { - var exit = 0; - if (symb >= 108) { - if (symb >= 111) { - exit = 1; - } - else { - switch (symb - 108 | 0) { - case 0 : - return /* Line_counter */0; - case 1 : - exit = 1; - break; - case 2 : - return /* Char_counter */1; - - } - } - } - else if (symb !== 76) { - exit = 1; - } - else { - return /* Token_counter */2; - } - if (exit === 1) { - throw [ - Caml_builtin_exceptions.assert_failure, - [ - "camlinternalFormat.ml", - 2683, - 34 - ] - ]; - } - - }; - var parse_char_set = function (str_ind, end_ind) { - if (str_ind === end_ind) { - invalid_format_message(end_ind, "unexpected end of format"); - } - var char_set = Bytes.make(32, /* "\000" */0); - var add_range = function (c, c$prime) { - for(var i = c; i <= c$prime; ++i){ - add_in_char_set(char_set, Pervasives.char_of_int(i)); - } - return /* () */0; - }; - var fail_single_percent = function (str_ind) { - return Curry._2(failwith_message(/* Format */[ - /* String_literal */Block.__(11, [ - "invalid format ", - /* Caml_string */Block.__(3, [ - /* No_padding */0, - /* String_literal */Block.__(11, [ - ": '", - /* Char_literal */Block.__(12, [ - /* "%" */37, - /* String_literal */Block.__(11, [ - "' alone is not accepted in character sets, use ", - /* Char_literal */Block.__(12, [ - /* "%" */37, - /* Char_literal */Block.__(12, [ - /* "%" */37, - /* String_literal */Block.__(11, [ - " instead at position ", - /* Int */Block.__(4, [ - /* Int_d */0, - /* No_padding */0, - /* No_precision */0, - /* Char_literal */Block.__(12, [ - /* "." */46, - /* End_of_format */0 - ]) - ]) - ]) - ]) - ]) - ]) - ]) - ]) - ]) - ]), - "invalid format %S: '%%' alone is not accepted in character sets, use %%%% instead at position %d." - ]), str, str_ind); - }; - var parse_char_set_after_char = function (_str_ind, end_ind, _c) { - while(true) { - var c = _c; - var str_ind = _str_ind; - if (str_ind === end_ind) { - invalid_format_message(end_ind, "unexpected end of format"); - } - var c$prime = Caml_string.get(str, str_ind); - var exit = 0; - var exit$1 = 0; - if (c$prime >= 46) { - if (c$prime !== 64) { - if (c$prime !== 93) { - exit = 1; - } - else { - add_in_char_set(char_set, c); - return str_ind + 1 | 0; - } - } - else { - exit$1 = 2; - } - } - else if (c$prime !== 37) { - if (c$prime >= 45) { - var str_ind$1 = str_ind + 1 | 0; - var end_ind$1 = end_ind; - var c$1 = c; - if (str_ind$1 === end_ind$1) { - invalid_format_message(end_ind$1, "unexpected end of format"); - } - var c$prime$1 = Caml_string.get(str, str_ind$1); - if (c$prime$1 !== 37) { - if (c$prime$1 !== 93) { - add_range(c$1, c$prime$1); - return parse_char_set_content(str_ind$1 + 1 | 0, end_ind$1); - } - else { - add_in_char_set(char_set, c$1); - add_in_char_set(char_set, /* "-" */45); - return str_ind$1 + 1 | 0; - } - } - else { - if ((str_ind$1 + 1 | 0) === end_ind$1) { - invalid_format_message(end_ind$1, "unexpected end of format"); - } - var c$prime$2 = Caml_string.get(str, str_ind$1 + 1 | 0); - var exit$2 = 0; - if (c$prime$2 !== 37) { - if (c$prime$2 !== 64) { - return fail_single_percent(str_ind$1); - } - else { - exit$2 = 1; - } - } - else { - exit$2 = 1; - } - if (exit$2 === 1) { - add_range(c$1, c$prime$2); - return parse_char_set_content(str_ind$1 + 2 | 0, end_ind$1); - } - - } - } - else { - exit = 1; - } - } - else { - exit$1 = 2; - } - if (exit$1 === 2) { - if (c === /* "%" */37) { - add_in_char_set(char_set, c$prime); - return parse_char_set_content(str_ind + 1 | 0, end_ind); - } - else { - exit = 1; - } - } - if (exit === 1) { - if (c === /* "%" */37) { - fail_single_percent(str_ind); - } - add_in_char_set(char_set, c); - _c = c$prime; - _str_ind = str_ind + 1 | 0; - continue ; - - } - - }; - }; - var parse_char_set_content = function (_str_ind, end_ind) { - while(true) { - var str_ind = _str_ind; - if (str_ind === end_ind) { - invalid_format_message(end_ind, "unexpected end of format"); - } - var c = Caml_string.get(str, str_ind); - if (c !== 45) { - if (c !== 93) { - return parse_char_set_after_char(str_ind + 1 | 0, end_ind, c); - } - else { - return str_ind + 1 | 0; - } - } - else { - add_in_char_set(char_set, /* "-" */45); - _str_ind = str_ind + 1 | 0; - continue ; - - } - }; - }; - var parse_char_set_start = function (str_ind, end_ind) { - if (str_ind === end_ind) { - invalid_format_message(end_ind, "unexpected end of format"); - } - var c = Caml_string.get(str, str_ind); - return parse_char_set_after_char(str_ind + 1 | 0, end_ind, c); - }; - if (str_ind === end_ind) { - invalid_format_message(end_ind, "unexpected end of format"); - } - var match = Caml_string.get(str, str_ind); - var match$1 = match !== 94 ? /* tuple */[ - str_ind, - /* false */0 - ] : /* tuple */[ - str_ind + 1 | 0, - /* true */1 - ]; - var next_ind = parse_char_set_start(match$1[0], end_ind); - var char_set$1 = Bytes.to_string(char_set); - return /* tuple */[ - next_ind, - match$1[1] ? rev_char_set(char_set$1) : char_set$1 - ]; - }; - var check_open_box = function (fmt) { - if (typeof fmt === "number") { - return /* () */0; - } - else if (fmt.tag === 11) { - if (typeof fmt[1] === "number") { - try { - open_box_of_string(fmt[0]); - return /* () */0; - } - catch (exn){ - if (exn[0] === Caml_builtin_exceptions.failure) { - return /* () */0; - } - else { - throw exn; - } - } - } - else { - return /* () */0; - } - } - else { - return /* () */0; - } - }; - var parse_tag = function (is_open_tag, str_ind, end_ind) { - try { - if (str_ind === end_ind) { - throw Caml_builtin_exceptions.not_found; - } - var match = Caml_string.get(str, str_ind); - if (match !== 60) { - throw Caml_builtin_exceptions.not_found; - } - else { - var ind = $$String.index_from(str, str_ind + 1 | 0, /* ">" */62); - if (ind >= end_ind) { - throw Caml_builtin_exceptions.not_found; - } - var sub_str = $$String.sub(str, str_ind, (ind - str_ind | 0) + 1 | 0); - var beg_ind = ind + 1 | 0; - var match$1 = parse_literal(beg_ind, beg_ind, end_ind); - var match$2 = parse_literal(str_ind, str_ind, ind + 1 | 0); - var sub_fmt = match$2[0]; - var sub_format = /* Format */[ - sub_fmt, - sub_str - ]; - var formatting = is_open_tag ? /* Open_tag */Block.__(0, [sub_format]) : (check_open_box(sub_fmt), /* Open_box */Block.__(1, [sub_format])); - return /* Fmt_EBB */[/* Formatting_gen */Block.__(18, [ - formatting, - match$1[0] - ])]; - } - } - catch (exn){ - if (exn === Caml_builtin_exceptions.not_found) { - var match$3 = parse_literal(str_ind, str_ind, end_ind); - var sub_format$1 = /* Format */[ - /* End_of_format */0, - "" - ]; - var formatting$1 = is_open_tag ? /* Open_tag */Block.__(0, [sub_format$1]) : /* Open_box */Block.__(1, [sub_format$1]); - return /* Fmt_EBB */[/* Formatting_gen */Block.__(18, [ - formatting$1, - match$3[0] - ])]; - } - else { - throw exn; - } - } - }; - return parse_literal(0, 0, str.length); -} - -function format_of_string_fmtty(str, fmtty) { - var match = fmt_ebb_of_string(/* None */0, str); - try { - return /* Format */[ - type_format(match[0], fmtty), - str - ]; - } - catch (exn){ - if (exn === Type_mismatch) { - return Curry._2(failwith_message(/* Format */[ - /* String_literal */Block.__(11, [ - "bad input: format type mismatch between ", - /* Caml_string */Block.__(3, [ - /* No_padding */0, - /* String_literal */Block.__(11, [ - " and ", - /* Caml_string */Block.__(3, [ - /* No_padding */0, - /* End_of_format */0 - ]) - ]) - ]) - ]), - "bad input: format type mismatch between %S and %S" - ]), str, string_of_fmtty(fmtty)); - } - else { - throw exn; - } - } -} - -function format_of_string_format(str, param) { - var match = fmt_ebb_of_string(/* None */0, str); - try { - return /* Format */[ - type_format(match[0], fmtty_of_fmt(param[0])), - str - ]; - } - catch (exn){ - if (exn === Type_mismatch) { - return Curry._2(failwith_message(/* Format */[ - /* String_literal */Block.__(11, [ - "bad input: format type mismatch between ", - /* Caml_string */Block.__(3, [ - /* No_padding */0, - /* String_literal */Block.__(11, [ - " and ", - /* Caml_string */Block.__(3, [ - /* No_padding */0, - /* End_of_format */0 - ]) - ]) - ]) - ]), - "bad input: format type mismatch between %S and %S" - ]), str, param[1]); - } - else { - throw exn; - } - } -} - -exports.is_in_char_set = is_in_char_set; -exports.rev_char_set = rev_char_set; -exports.create_char_set = create_char_set; -exports.add_in_char_set = add_in_char_set; -exports.freeze_char_set = freeze_char_set; -exports.param_format_of_ignored_format = param_format_of_ignored_format; -exports.make_printf = make_printf; -exports.output_acc = output_acc; -exports.bufput_acc = bufput_acc; -exports.strput_acc = strput_acc; -exports.type_format = type_format; -exports.fmt_ebb_of_string = fmt_ebb_of_string; -exports.format_of_string_fmtty = format_of_string_fmtty; -exports.format_of_string_format = format_of_string_format; -exports.char_of_iconv = char_of_iconv; -exports.string_of_formatting_lit = string_of_formatting_lit; -exports.string_of_formatting_gen = string_of_formatting_gen; -exports.string_of_fmtty = string_of_fmtty; -exports.string_of_fmt = string_of_fmt; -exports.open_box_of_string = open_box_of_string; -exports.symm = symm; -exports.trans = trans; -exports.recast = recast; -/* No side effect */ -//////// end of camlinternalFormat.js //////// -    return exports; -  }; - - - _registry['caml_io'] = function() { -    let exports = {}; -//////// start of caml_io.js //////// -'use strict'; - -var Curry = require("./curry"); -var Caml_builtin_exceptions = require("./caml_builtin_exceptions"); - -function $caret(prim, prim$1) { - return prim + prim$1; -} - -var stdin = undefined; - -var stdout = /* record */[ - /* buffer */"", - /* output */function (_, s) { - var v = s.length - 1 | 0; - if (( (typeof process !== "undefined") && process.stdout && process.stdout.write)) { - return ( process.stdout.write )(s); - } - else if (s[v] === "\n") { - console.log(s.slice(0, v)); - return /* () */0; - } - else { - console.log(s); - return /* () */0; - } - } -]; - -var stderr = /* record */[ - /* buffer */"", - /* output */function (_, s) { - var v = s.length - 1 | 0; - if (s[v] === "\n") { - console.log(s.slice(0, v)); - return /* () */0; - } - else { - console.log(s); - return /* () */0; - } - } -]; - -function caml_ml_open_descriptor_in() { - throw [ - Caml_builtin_exceptions.failure, - "caml_ml_open_descriptor_in not implemented" - ]; -} - -function caml_ml_open_descriptor_out() { - throw [ - Caml_builtin_exceptions.failure, - "caml_ml_open_descriptor_out not implemented" - ]; -} - -function caml_ml_flush(oc) { - if (oc[/* buffer */0] !== "") { - Curry._2(oc[/* output */1], oc, oc[/* buffer */0]); - oc[/* buffer */0] = ""; - return /* () */0; - } - else { - return 0; - } -} - -var node_std_output = (function (s){ - return (typeof process !== "undefined") && process.stdout && (process.stdout.write(s), true); - } -); - -function caml_ml_output(oc, str, offset, len) { - var str$1 = offset === 0 && len === str.length ? str : str.slice(offset, len); - if (( (typeof process !== "undefined") && process.stdout && process.stdout.write ) && oc === stdout) { - return ( process.stdout.write )(str$1); - } - else { - var id = str$1.lastIndexOf("\n"); - if (id < 0) { - oc[/* buffer */0] = oc[/* buffer */0] + str$1; - return /* () */0; - } - else { - oc[/* buffer */0] = oc[/* buffer */0] + str$1.slice(0, id + 1 | 0); - caml_ml_flush(oc); - oc[/* buffer */0] = oc[/* buffer */0] + str$1.slice(id + 1 | 0); - return /* () */0; - } - } -} - -function caml_ml_output_char(oc, $$char) { - return caml_ml_output(oc, String.fromCharCode($$char), 0, 1); -} - -function caml_ml_input(_, _$1, _$2, _$3) { - throw [ - Caml_builtin_exceptions.failure, - "caml_ml_input ic not implemented" - ]; -} - -function caml_ml_input_char() { - throw [ - Caml_builtin_exceptions.failure, - "caml_ml_input_char not implemnted" - ]; -} - -function caml_ml_out_channels_list() { - return /* :: */[ - stdout, - /* :: */[ - stderr, - /* [] */0 - ] - ]; -} - -exports.$caret = $caret; -exports.stdin = stdin; -exports.stdout = stdout; -exports.stderr = stderr; -exports.caml_ml_open_descriptor_in = caml_ml_open_descriptor_in; -exports.caml_ml_open_descriptor_out = caml_ml_open_descriptor_out; -exports.caml_ml_flush = caml_ml_flush; -exports.node_std_output = node_std_output; -exports.caml_ml_output = caml_ml_output; -exports.caml_ml_output_char = caml_ml_output_char; -exports.caml_ml_input = caml_ml_input; -exports.caml_ml_input_char = caml_ml_input_char; -exports.caml_ml_out_channels_list = caml_ml_out_channels_list; -/* stdin Not a pure module */ -//////// end of caml_io.js //////// -    return exports; -  }; - - - _registry['caml_lexer'] = function() { -    let exports = {}; -//////// start of caml_lexer.js //////// -'use strict'; - -var Caml_builtin_exceptions = require("./caml_builtin_exceptions"); - -function fail() { - throw [ - Caml_builtin_exceptions.failure, - "lexing: empty token" - ]; -} - - - -/***********************************************************************/ -/* */ -/* Objective Caml */ -/* */ -/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */ -/* */ -/* Copyright 1996 Institut National de Recherche en Informatique et */ -/* en Automatique. All rights reserved. This file is distributed */ -/* under the terms of the GNU Library General Public License, with */ -/* the special exception on linking described in file ../LICENSE. */ -/* */ -/***********************************************************************/ - -/* $Id: lexing.c 6045 2004-01-01 16:42:43Z doligez $ */ - -/* The table-driven automaton for lexers generated by camllex. */ - -function caml_lex_array(s) { - var l = s.length / 2; - var a = new Array(l); - // when s.charCodeAt(2 * i + 1 ) > 128 (0x80) - // a[i] < 0 - // for(var i = 0 ; i <= 0xffff; ++i) { if (i << 16 >> 16 !==i){console.log(i<<16>>16, 'vs',i)}} - // - for (var i = 0; i < l; i++) - a[i] = (s.charCodeAt(2 * i) | (s.charCodeAt(2 * i + 1) << 8)) << 16 >> 16; - return a; -} -/** - * external c_engine : lex_tables -> int -> lexbuf -> int - * lexing.ml - * type lex_tables = { - * lex_base : string; - * lex_backtrk : string; - * lex_default : string; - * lex_trans : string; - * lex_check : string; - * lex_base_code : string; - * lex_backtrk_code : string; - * lex_default_code : string; - * lex_trans_code : string; - * lex_check_code : string; - * lex_code : string; - * } - * - * type lexbuf = { - * refill_buff : lexbuf -> unit ; - * mutable lex_buffer : bytes; - * mutable lex_buffer_len : int; - * mutable lex_abs_pos : int; - * mutable lex_start_pos : int; - * mutable lex_curr_pos : int; - * mutable lex_last_pos : int; - * mutable lex_last_action : int; - * mutable lex_eof_reached : bool; - * mutable lex_mem : int array; - * mutable lex_start_p : position; - * mutable lex_curr_p; - * } - * @param tbl - * @param start_state - * @param lexbuf - * @returns {any} - */ -function $$caml_lex_engine(tbl, start_state, lexbuf) { - // Lexing.lexbuf - var lex_buffer = 1; - var lex_buffer_len = 2; - var lex_start_pos = 4; - var lex_curr_pos = 5; - var lex_last_pos = 6; - var lex_last_action = 7; - var lex_eof_reached = 8; - // Lexing.lex_tables - var lex_base = 0; - var lex_backtrk = 1; - var lex_default = 2; - var lex_trans = 3; - var lex_check = 4; - if (!tbl.lex_default) { - tbl.lex_base = caml_lex_array(tbl[lex_base]); - tbl.lex_backtrk = caml_lex_array(tbl[lex_backtrk]); - tbl.lex_check = caml_lex_array(tbl[lex_check]); - tbl.lex_trans = caml_lex_array(tbl[lex_trans]); - tbl.lex_default = caml_lex_array(tbl[lex_default]); - } - var c; - var state = start_state; - //var buffer = bytes_of_string(lexbuf[lex_buffer]); - var buffer = lexbuf[lex_buffer]; - if (state >= 0) { - /* First entry */ - lexbuf[lex_last_pos] = lexbuf[lex_start_pos] = lexbuf[lex_curr_pos]; - lexbuf[lex_last_action] = -1; - } - else { - /* Reentry after refill */ - state = -state - 1; - } - for (;;) { - /* Lookup base address or action number for current state */ - var base = tbl.lex_base[state]; - if (base < 0) - return -base - 1; - /* See if it's a backtrack point */ - var backtrk = tbl.lex_backtrk[state]; - if (backtrk >= 0) { - lexbuf[lex_last_pos] = lexbuf[lex_curr_pos]; - lexbuf[lex_last_action] = backtrk; - } - /* See if we need a refill */ - if (lexbuf[lex_curr_pos] >= lexbuf[lex_buffer_len]) { - if (lexbuf[lex_eof_reached] === 0) - return -state - 1; - else - c = 256; - } - else { - /* Read next input char */ - c = buffer[lexbuf[lex_curr_pos]]; - lexbuf[lex_curr_pos]++; - } - /* Determine next state */ - if (tbl.lex_check[base + c] === state) { - state = tbl.lex_trans[base + c]; - } - else { - state = tbl.lex_default[state]; - } - /* If no transition on this char, return to last backtrack point */ - if (state < 0) { - lexbuf[lex_curr_pos] = lexbuf[lex_last_pos]; - if (lexbuf[lex_last_action] == -1) - fail(); - else - return lexbuf[lex_last_action]; - } - else { - /* Erase the EOF condition only if the EOF pseudo-character was - consumed by the automaton (i.e. there was no backtrack above) - */ - if (c == 256) - lexbuf[lex_eof_reached] = 0; - } - } -} - -/***********************************************/ -/* New lexer engine, with memory of positions */ -/***********************************************/ - -/** - * s -> Lexing.lex_tables.lex_code - * mem -> Lexing.lexbuf.lex_mem (* int array *) - */ - -function caml_lex_run_mem(s, i, mem, curr_pos) { - for (;;) { - var dst = s.charCodeAt(i); - i++; - if (dst == 0xff) - return; - var src = s.charCodeAt(i); - i++; - if (src == 0xff) - mem[dst] = curr_pos; - else - mem[dst] = mem[src]; - } -} - - -/** - * s -> Lexing.lex_tables.lex_code - * mem -> Lexing.lexbuf.lex_mem (* int array *) - */ - -function caml_lex_run_tag(s, i, mem) { - for (;;) { - var dst = s.charCodeAt(i); - i++; - if (dst == 0xff) - return; - var src = s.charCodeAt(i); - i++; - if (src == 0xff) - mem[dst] = -1; - else - mem[dst] = mem[src]; - } -} -/** - * external c_new_engine : lex_tables -> int -> lexbuf -> int = "caml_new_lex_engine" - * @param tbl - * @param start_state - * @param lexbuf - * @returns {any} - */ -function $$caml_new_lex_engine(tbl, start_state, lexbuf) { - // Lexing.lexbuf - var lex_buffer = 1; - var lex_buffer_len = 2; - var lex_start_pos = 4; - var lex_curr_pos = 5; - var lex_last_pos = 6; - var lex_last_action = 7; - var lex_eof_reached = 8; - var lex_mem = 9; - // Lexing.lex_tables - var lex_base = 0; - var lex_backtrk = 1; - var lex_default = 2; - var lex_trans = 3; - var lex_check = 4; - var lex_base_code = 5; - var lex_backtrk_code = 6; - var lex_default_code = 7; - var lex_trans_code = 8; - var lex_check_code = 9; - var lex_code = 10; - if (!tbl.lex_default) { - tbl.lex_base = caml_lex_array(tbl[lex_base]); - tbl.lex_backtrk = caml_lex_array(tbl[lex_backtrk]); - tbl.lex_check = caml_lex_array(tbl[lex_check]); - tbl.lex_trans = caml_lex_array(tbl[lex_trans]); - tbl.lex_default = caml_lex_array(tbl[lex_default]); - } - if (!tbl.lex_default_code) { - tbl.lex_base_code = caml_lex_array(tbl[lex_base_code]); - tbl.lex_backtrk_code = caml_lex_array(tbl[lex_backtrk_code]); - tbl.lex_check_code = caml_lex_array(tbl[lex_check_code]); - tbl.lex_trans_code = caml_lex_array(tbl[lex_trans_code]); - tbl.lex_default_code = caml_lex_array(tbl[lex_default_code]); - } - if (tbl.lex_code == null) { - //tbl.lex_code = caml_bytes_of_string(tbl[lex_code]); - tbl.lex_code = (tbl[lex_code]); - } - var c, state = start_state; - //var buffer = caml_bytes_of_string(lexbuf[lex_buffer]); - var buffer = lexbuf[lex_buffer]; - if (state >= 0) { - /* First entry */ - lexbuf[lex_last_pos] = lexbuf[lex_start_pos] = lexbuf[lex_curr_pos]; - lexbuf[lex_last_action] = -1; - } - else { - /* Reentry after refill */ - state = -state - 1; - } - for (;;) { - /* Lookup base address or action number for current state */ - var base = tbl.lex_base[state]; - if (base < 0) { - var pc_off = tbl.lex_base_code[state]; - caml_lex_run_tag(tbl.lex_code, pc_off, lexbuf[lex_mem]); - return -base - 1; - } - /* See if it's a backtrack point */ - var backtrk = tbl.lex_backtrk[state]; - if (backtrk >= 0) { - var pc_off = tbl.lex_backtrk_code[state]; - caml_lex_run_tag(tbl.lex_code, pc_off, lexbuf[lex_mem]); - lexbuf[lex_last_pos] = lexbuf[lex_curr_pos]; - lexbuf[lex_last_action] = backtrk; - } - /* See if we need a refill */ - if (lexbuf[lex_curr_pos] >= lexbuf[lex_buffer_len]) { - if (lexbuf[lex_eof_reached] == 0) - return -state - 1; - else - c = 256; - } - else { - /* Read next input char */ - c = buffer[lexbuf[lex_curr_pos]]; - lexbuf[lex_curr_pos]++; - } - /* Determine next state */ - var pstate = state; - if (tbl.lex_check[base + c] == state) - state = tbl.lex_trans[base + c]; - else - state = tbl.lex_default[state]; - /* If no transition on this char, return to last backtrack point */ - if (state < 0) { - lexbuf[lex_curr_pos] = lexbuf[lex_last_pos]; - if (lexbuf[lex_last_action] == -1) - fail(); - else - return lexbuf[lex_last_action]; - } - else { - /* If some transition, get and perform memory moves */ - var base_code = tbl.lex_base_code[pstate], pc_off; - if (tbl.lex_check_code[base_code + c] == pstate) - pc_off = tbl.lex_trans_code[base_code + c]; - else - pc_off = tbl.lex_default_code[pstate]; - if (pc_off > 0) - caml_lex_run_mem(tbl.lex_code, pc_off, lexbuf[lex_mem], lexbuf[lex_curr_pos]); - /* Erase the EOF condition only if the EOF pseudo-character was - consumed by the automaton (i.e. there was no backtrack above) - */ - if (c == 256) - lexbuf[lex_eof_reached] = 0; - } - } -} - -; - -function caml_lex_engine(prim, prim$1, prim$2) { - return $$caml_lex_engine(prim, prim$1, prim$2); -} - -function caml_new_lex_engine(prim, prim$1, prim$2) { - return $$caml_new_lex_engine(prim, prim$1, prim$2); -} - -exports.fail = fail; -exports.caml_lex_engine = caml_lex_engine; -exports.caml_new_lex_engine = caml_new_lex_engine; -/* Not a pure module */ -//////// end of caml_lexer.js //////// -    return exports; -  }; - - - _registry['caml_obj'] = function() { -    let exports = {}; -//////// start of caml_obj.js //////// -'use strict'; - -var Block = require("./block"); -var Caml_builtin_exceptions = require("./caml_builtin_exceptions"); - -function caml_obj_dup(x) { - var len = x.length; - var v = new Array(len); - for(var i = 0 ,i_finish = len - 1 | 0; i <= i_finish; ++i){ - v[i] = x[i]; - } - v.tag = x.tag | 0; - return v; -} - -function caml_obj_truncate(x, new_size) { - var len = x.length; - if (new_size <= 0 || new_size > len) { - throw [ - Caml_builtin_exceptions.invalid_argument, - "Obj.truncate" - ]; - } - else if (len !== new_size) { - for(var i = new_size ,i_finish = len - 1 | 0; i <= i_finish; ++i){ - x[i] = 0; - } - x.length = new_size; - return /* () */0; - } - else { - return 0; - } -} - -function caml_lazy_make_forward(x) { - return Block.__(250, [x]); -} - -function caml_update_dummy(x, y) { - var len = y.length; - for(var i = 0 ,i_finish = len - 1 | 0; i <= i_finish; ++i){ - x[i] = y[i]; - } - var y_tag = y.tag | 0; - if (y_tag !== 0) { - x.tag = y_tag; - return /* () */0; - } - else { - return 0; - } -} - -function caml_int_compare(x, y) { - if (x < y) { - return -1; - } - else if (x === y) { - return 0; - } - else { - return 1; - } -} - -function caml_compare(_a, _b) { - while(true) { - var b = _b; - var a = _a; - if (typeof a === "string") { - var x = a; - var y = b; - if (x < y) { - return -1; - } - else if (x === y) { - return 0; - } - else { - return 1; - } - } - else if (typeof a === "number") { - return caml_int_compare(a, b); - } - else if (typeof a === "boolean" || typeof a === "null" || typeof a === "undefined") { - var x$1 = a; - var y$1 = b; - if (x$1 === y$1) { - return 0; - } - else if (x$1 < y$1) { - return -1; - } - else { - return 1; - } - } - else { - var tag_a = a.tag | 0; - var tag_b = b.tag | 0; - if (tag_a === 250) { - _a = a[0]; - continue ; - - } - else if (tag_b === 250) { - _b = b[0]; - continue ; - - } - else if (tag_a === 248) { - return caml_int_compare(a[1], b[1]); - } - else if (tag_a === 251) { - throw [ - Caml_builtin_exceptions.invalid_argument, - "equal: abstract value" - ]; - } - else if (tag_a !== tag_b) { - if (tag_a < tag_b) { - return -1; - } - else { - return 1; - } - } - else { - var len_a = a.length; - var len_b = b.length; - if (len_a === len_b) { - var a$1 = a; - var b$1 = b; - var _i = 0; - var same_length = len_a; - while(true) { - var i = _i; - if (i === same_length) { - return 0; - } - else { - var res = caml_compare(a$1[i], b$1[i]); - if (res !== 0) { - return res; - } - else { - _i = i + 1 | 0; - continue ; - - } - } - }; - } - else if (len_a < len_b) { - var a$2 = a; - var b$2 = b; - var _i$1 = 0; - var short_length = len_a; - while(true) { - var i$1 = _i$1; - if (i$1 === short_length) { - return -1; - } - else { - var res$1 = caml_compare(a$2[i$1], b$2[i$1]); - if (res$1 !== 0) { - return res$1; - } - else { - _i$1 = i$1 + 1 | 0; - continue ; - - } - } - }; - } - else { - var a$3 = a; - var b$3 = b; - var _i$2 = 0; - var short_length$1 = len_b; - while(true) { - var i$2 = _i$2; - if (i$2 === short_length$1) { - return 1; - } - else { - var res$2 = caml_compare(a$3[i$2], b$3[i$2]); - if (res$2 !== 0) { - return res$2; - } - else { - _i$2 = i$2 + 1 | 0; - continue ; - - } - } - }; - } - } - } - }; -} - -function caml_equal(_a, _b) { - while(true) { - var b = _b; - var a = _a; - if (a === b) { - return /* true */1; - } - else if (typeof a === "string" || typeof a === "number" || typeof a === "boolean" || typeof a === "undefined" || typeof a === "null") { - return /* false */0; - } - else { - var tag_a = a.tag | 0; - var tag_b = b.tag | 0; - if (tag_a === 250) { - _a = a[0]; - continue ; - - } - else if (tag_b === 250) { - _b = b[0]; - continue ; - - } - else if (tag_a === 248) { - return +(a[1] === b[1]); - } - else if (tag_a === 251) { - throw [ - Caml_builtin_exceptions.invalid_argument, - "equal: abstract value" - ]; - } - else if (tag_a !== tag_b) { - return /* false */0; - } - else { - var len_a = a.length; - var len_b = b.length; - if (len_a === len_b) { - var a$1 = a; - var b$1 = b; - var _i = 0; - var same_length = len_a; - while(true) { - var i = _i; - if (i === same_length) { - return /* true */1; - } - else if (caml_equal(a$1[i], b$1[i])) { - _i = i + 1 | 0; - continue ; - - } - else { - return /* false */0; - } - }; - } - else { - return /* false */0; - } - } - } - }; -} - -function caml_notequal(a, b) { - return 1 - caml_equal(a, b); -} - -function caml_greaterequal(a, b) { - return +(caml_compare(a, b) >= 0); -} - -function caml_greaterthan(a, b) { - return +(caml_compare(a, b) > 0); -} - -function caml_lessequal(a, b) { - return +(caml_compare(a, b) <= 0); -} - -function caml_lessthan(a, b) { - return +(caml_compare(a, b) < 0); -} - -var caml_int32_compare = caml_int_compare; - -var caml_nativeint_compare = caml_int_compare; - -exports.caml_obj_dup = caml_obj_dup; -exports.caml_obj_truncate = caml_obj_truncate; -exports.caml_lazy_make_forward = caml_lazy_make_forward; -exports.caml_update_dummy = caml_update_dummy; -exports.caml_int_compare = caml_int_compare; -exports.caml_int32_compare = caml_int32_compare; -exports.caml_nativeint_compare = caml_nativeint_compare; -exports.caml_compare = caml_compare; -exports.caml_equal = caml_equal; -exports.caml_notequal = caml_notequal; -exports.caml_greaterequal = caml_greaterequal; -exports.caml_greaterthan = caml_greaterthan; -exports.caml_lessthan = caml_lessthan; -exports.caml_lessequal = caml_lessequal; -/* No side effect */ -//////// end of caml_obj.js //////// -    return exports; -  }; - - - _registry['caml_oo'] = function() { -    let exports = {}; -//////// start of caml_oo.js //////// -'use strict'; - -var Caml_array = require("./caml_array"); -var Caml_builtin_exceptions = require("./caml_builtin_exceptions"); - -var caml_methods_cache = Caml_array.caml_make_vect(1000, 0); - -function caml_get_public_method(obj, tag, cacheid) { - var meths = obj[0]; - var offs = caml_methods_cache[cacheid]; - if (meths[offs] === tag) { - return meths[offs - 1 | 0]; - } - else { - var aux = function (_i) { - while(true) { - var i = _i; - if (i < 3) { - throw [ - Caml_builtin_exceptions.assert_failure, - [ - "caml_oo.ml", - 54, - 20 - ] - ]; - } - else if (meths[i] === tag) { - caml_methods_cache[cacheid] = i; - return i; - } - else { - _i = i - 2 | 0; - continue ; - - } - }; - }; - return meths[aux((meths[0] << 1) + 1 | 0) - 1 | 0]; - } -} - -exports.caml_get_public_method = caml_get_public_method; -/* No side effect */ -//////// end of caml_oo.js //////// -    return exports; -  }; - - - _registry['caml_parser'] = function() { -    let exports = {}; -//////// start of caml_parser.js //////// -'use strict'; - - - - -/***********************************************************************/ -/* */ -/* Objective Caml */ -/* */ -/* Xavier Leroy, projet Cristal, INRIA Rocquencourt */ -/* */ -/* Copyright 1996 Institut National de Recherche en Informatique et */ -/* en Automatique. All rights reserved. This file is distributed */ -/* under the terms of the GNU Library General Public License, with */ -/* the special exception on linking described in file ../LICENSE. */ -/* */ -/***********************************************************************/ - -/* $Id: parsing.c 8983 2008-08-06 09:38:25Z xleroy $ */ - -/* The PDA automaton for parsers generated by camlyacc */ - -/* The pushdown automata */ - -/** - * caml_lex_array("abcd") - * [25185, 25699] - * @param s - * @returns {any[]} - * TODO: duplicated with module {!Caml_lex} - */ -function caml_lex_array(s) { - var l = s.length / 2; - var a = new Array(l); - for (var i = 0; i < l; i++) - a[i] = (s.charCodeAt(2 * i) | (s.charCodeAt(2 * i + 1) << 8)) << 16 >> 16; - return a; -} -/** - * Note that TS enum is not friendly to Closure compiler - * @enum{number} - */ -var Automata = { - START: 0, - LOOP: 6, - TOKEN_READ: 1, - TEST_SHIFT: 7, - ERROR_DETECTED: 5, - SHIFT: 8, - SHIFT_RECOVER: 9, - STACK_GROWN_1: 2, - REDUCE: 10, - STACK_GROWN_2: 3, - SEMANTIC_ACTION_COMPUTED: 4 -}; -/** - * @enum{number} - */ -var Result = { - READ_TOKEN: 0, - RAISE_PARSE_ERROR: 1, - GROW_STACKS_1: 2, - GROW_STACKS_2: 3, - COMPUTE_SEMANTIC_ACTION: 4, - CALL_ERROR_FUNCTION: 5 -}; -var PARSER_TRACE = false; -/** - * external parse_engine : parse_tables -> parser_env -> parser_input -> Obj.t -> parser_output - * parsing.ml - * - * type parse_tables = { - * actions : (parser_env -> Obj.t) array - * transl_const : int array; - * transl_block : int array; - * lhs : string; - * len : string; - * defred : string; - * dgoto : string; - * sindex : string; - * rindex : string; - * gindex : string; - * tablesize : int; - * table : string; - * check : string; - * error_function : string -> unit; - * names_const : string; - * names_block : string - * } - * - * type parser_env = - * { mutable s_stack : int array; (* States *) - * mutable v_stack : Obj.t array; (* Semantic attributes *) - * mutable symb_start_stack : position array; (* Start positions *) - * mutable symb_end_stack : position array; (* End positions *) - * mutable stacksize : int; (* Size of the stacks *) - * mutable stackbase : int; (* Base sp for current parse *) - * mutable curr_char : int; (* Last token read *) - * mutable lval : Obj.t; (* Its semantic attribute *) - * mutable symb_start : position; (* Start pos. of the current symbol*) - * mutable symb_end : position; (* End pos. of the current symbol *) - * mutable asp : int; (* The stack pointer for attributes *) - * mutable rule_len : int; (* Number of rhs items in the rule *) - * mutable rule_number : int; (* Rule number to reduce by *) - * mutable sp : int; (* Saved sp for parse_engine *) - * mutable state : int; (* Saved state for parse_engine *) - * mutable errflag : int } (* Saved error flag for parse_engine *) - * - * type parser_input = - * | Start - * | Token_read - * | Stacks_grown_1 - * | Stacks_grown_2 - * | Semantic_action_computed - * | Error_detected - - * @param tables - * @param env - * @param cmd - * @param arg - * @returns {number} - */ -function $$caml_parse_engine(tables /* parser_table */, env /* parser_env */, cmd /* parser_input*/, arg /* Obj.t*/) { - var ERRCODE = 256; - //var START = 0; - //var TOKEN_READ = 1; - //var STACKS_GROWN_1 = 2; - //var STACKS_GROWN_2 = 3; - //var SEMANTIC_ACTION_COMPUTED = 4; - //var ERROR_DETECTED = 5; - //var loop = 6; - //var testshift = 7; - //var shift = 8; - //var shift_recover = 9; - //var reduce = 10; - // Parsing.parser_env - var env_s_stack = 0; // array - var env_v_stack = 1; // array - var env_symb_start_stack = 2; // array - var env_symb_end_stack = 3; // array - var env_stacksize = 4; - var env_stackbase = 5; - var env_curr_char = 6; - var env_lval = 7; // Obj.t - var env_symb_start = 8; // position - var env_symb_end = 9; // position - var env_asp = 10; - var env_rule_len = 11; - var env_rule_number = 12; - var env_sp = 13; - var env_state = 14; - var env_errflag = 15; - // Parsing.parse_tables - // var _tbl_actions = 1; - var tbl_transl_const = 1; // array - var tbl_transl_block = 2; // array - var tbl_lhs = 3; - var tbl_len = 4; - var tbl_defred = 5; - var tbl_dgoto = 6; - var tbl_sindex = 7; - var tbl_rindex = 8; - var tbl_gindex = 9; - var tbl_tablesize = 10; - var tbl_table = 11; - var tbl_check = 12; - // var _tbl_error_function = 14; - // var _tbl_names_const = 15; - // var _tbl_names_block = 16; - if (!tables.dgoto) { - tables.defred = caml_lex_array(tables[tbl_defred]); - tables.sindex = caml_lex_array(tables[tbl_sindex]); - tables.check = caml_lex_array(tables[tbl_check]); - tables.rindex = caml_lex_array(tables[tbl_rindex]); - tables.table = caml_lex_array(tables[tbl_table]); - tables.len = caml_lex_array(tables[tbl_len]); - tables.lhs = caml_lex_array(tables[tbl_lhs]); - tables.gindex = caml_lex_array(tables[tbl_gindex]); - tables.dgoto = caml_lex_array(tables[tbl_dgoto]); - } - var res; - var n, n1, n2, state1; - // RESTORE - var sp = env[env_sp]; - var state = env[env_state]; - var errflag = env[env_errflag]; - exit: for (;;) { - //console.error("State", Automata[cmd]); - switch (cmd) { - case Automata.START: - state = 0; - errflag = 0; - // Fall through - case Automata.LOOP: - n = tables.defred[state]; - if (n != 0) { - cmd = Automata.REDUCE; - break; - } - if (env[env_curr_char] >= 0) { - cmd = Automata.TEST_SHIFT; - break; - } - res = Result.READ_TOKEN; - break exit; - /* The ML code calls the lexer and updates */ - /* symb_start and symb_end */ - case Automata.TOKEN_READ: - if (typeof arg !== 'number') { - env[env_curr_char] = tables[tbl_transl_block][arg.tag | 0 /* + 1 */]; - env[env_lval] = arg[0]; - } - else { - env[env_curr_char] = tables[tbl_transl_const][arg /* + 1 */]; - env[env_lval] = 0; - } - if (PARSER_TRACE) { - console.error("State %d, read token", state, arg); - } - // Fall through - case Automata.TEST_SHIFT: - n1 = tables.sindex[state]; - n2 = n1 + env[env_curr_char]; - if (n1 != 0 && n2 >= 0 && n2 <= tables[tbl_tablesize] && - tables.check[n2] == env[env_curr_char]) { - cmd = Automata.SHIFT; - break; - } - n1 = tables.rindex[state]; - n2 = n1 + env[env_curr_char]; - if (n1 != 0 && n2 >= 0 && n2 <= tables[tbl_tablesize] && - tables.check[n2] == env[env_curr_char]) { - n = tables.table[n2]; - cmd = Automata.REDUCE; - break; - } - if (errflag <= 0) { - res = Result.CALL_ERROR_FUNCTION; - break exit; - } - // Fall through - /* The ML code calls the error function */ - case Automata.ERROR_DETECTED: - if (errflag < 3) { - errflag = 3; - for (;;) { - state1 = env[env_s_stack][sp /* + 1*/]; - n1 = tables.sindex[state1]; - n2 = n1 + ERRCODE; - if (n1 != 0 && n2 >= 0 && n2 <= tables[tbl_tablesize] && - tables.check[n2] == ERRCODE) { - cmd = Automata.SHIFT_RECOVER; - break; - } - else { - if (sp <= env[env_stackbase]) - return Result.RAISE_PARSE_ERROR; - /* The ML code raises Parse_error */ - sp--; - } - } - } - else { - if (env[env_curr_char] == 0) - return Result.RAISE_PARSE_ERROR; - /* The ML code raises Parse_error */ - env[env_curr_char] = -1; - cmd = Automata.LOOP; - break; - } - // Fall through - case Automata.SHIFT: - env[env_curr_char] = -1; - if (errflag > 0) - errflag--; - // Fall through - case Automata.SHIFT_RECOVER: - if (PARSER_TRACE) { - console.error("State %d: shift to state %d", state, tables.table[n2]); - } - state = tables.table[n2]; - sp++; - if (sp >= env[env_stacksize]) { - res = Result.GROW_STACKS_1; - break exit; - } - // Fall through - /* The ML code resizes the stacks */ - case Automata.STACK_GROWN_1: - env[env_s_stack][sp /* + 1 */] = state; - env[env_v_stack][sp /* + 1 */] = env[env_lval]; - env[env_symb_start_stack][sp /* + 1 */] = env[env_symb_start]; - env[env_symb_end_stack][sp /* + 1 */] = env[env_symb_end]; - cmd = Automata.LOOP; - break; - case Automata.REDUCE: - if (PARSER_TRACE) { - console.error("State %d : reduce by rule %d", state, n); - } - var m = tables.len[n]; - env[env_asp] = sp; - env[env_rule_number] = n; - env[env_rule_len] = m; - sp = sp - m + 1; - m = tables.lhs[n]; - state1 = env[env_s_stack][sp - 1]; // - n1 = tables.gindex[m]; - n2 = n1 + state1; - if (n1 != 0 && n2 >= 0 && n2 <= tables[tbl_tablesize] && - tables.check[n2] == state1) - state = tables.table[n2]; - else - state = tables.dgoto[m]; - if (sp >= env[env_stacksize]) { - res = Result.GROW_STACKS_2; - break exit; - } - // Fall through - /* The ML code resizes the stacks */ - case Automata.STACK_GROWN_2: - res = Result.COMPUTE_SEMANTIC_ACTION; - break exit; - /* The ML code calls the semantic action */ - case Automata.SEMANTIC_ACTION_COMPUTED: - env[env_s_stack][sp /* + 1 */] = state; - env[env_v_stack][sp /* + 1*/] = arg; - var asp = env[env_asp]; - env[env_symb_end_stack][sp /* + 1*/] = env[env_symb_end_stack][asp /* + 1*/]; - if (sp > asp) { - /* This is an epsilon production. Take symb_start equal to symb_end. */ - env[env_symb_start_stack][sp /* + 1*/] = env[env_symb_end_stack][asp /*+ 1*/]; - } - cmd = Automata.LOOP; - break; - /* Should not happen */ - default: - return Result.RAISE_PARSE_ERROR; - } - } - // SAVE - env[env_sp] = sp; - env[env_state] = state; - env[env_errflag] = errflag; - return res; -} - -/** - * external set_trace: bool -> bool = "caml_set_parser_trace" - * parsing.ml - * @param {boolean} - * @returns {boolean} - */ -function $$caml_set_parser_trace(v) { - var old = PARSER_TRACE; - PARSER_TRACE = v; - return old; -} - - -; - -function caml_parse_engine(prim, prim$1, prim$2, prim$3) { - return $$caml_parse_engine(prim, prim$1, prim$2, prim$3); -} - -function caml_set_parser_trace(prim) { - return $$caml_set_parser_trace(prim); -} - -exports.caml_parse_engine = caml_parse_engine; -exports.caml_set_parser_trace = caml_set_parser_trace; -/* Not a pure module */ -//////// end of caml_parser.js //////// -    return exports; -  }; - - - _registry['caml_string'] = function() { -    let exports = {}; -//////// start of caml_string.js //////// -'use strict'; - -var Caml_builtin_exceptions = require("./caml_builtin_exceptions"); - -function js_string_of_char(prim) { - return String.fromCharCode(prim); -} - -function caml_string_get(s, i) { - if (i >= s.length || i < 0) { - throw [ - Caml_builtin_exceptions.invalid_argument, - "index out of bounds" - ]; - } - else { - return s.charCodeAt(i); - } -} - -function caml_create_string(len) { - if (len < 0) { - throw [ - Caml_builtin_exceptions.invalid_argument, - "String.create" - ]; - } - else { - return new Array(len); - } -} - -function caml_string_compare(s1, s2) { - if (s1 === s2) { - return 0; - } - else if (s1 < s2) { - return -1; - } - else { - return 1; - } -} - -function caml_fill_string(s, i, l, c) { - if (l > 0) { - for(var k = i ,k_finish = (l + i | 0) - 1 | 0; k <= k_finish; ++k){ - s[k] = c; - } - return /* () */0; - } - else { - return 0; - } -} - -function caml_blit_string(s1, i1, s2, i2, len) { - if (len > 0) { - var off1 = s1.length - i1 | 0; - if (len <= off1) { - for(var i = 0 ,i_finish = len - 1 | 0; i <= i_finish; ++i){ - s2[i2 + i | 0] = s1.charCodeAt(i1 + i | 0); - } - return /* () */0; - } - else { - for(var i$1 = 0 ,i_finish$1 = off1 - 1 | 0; i$1 <= i_finish$1; ++i$1){ - s2[i2 + i$1 | 0] = s1.charCodeAt(i1 + i$1 | 0); - } - for(var i$2 = off1 ,i_finish$2 = len - 1 | 0; i$2 <= i_finish$2; ++i$2){ - s2[i2 + i$2 | 0] = /* "\000" */0; - } - return /* () */0; - } - } - else { - return 0; - } -} - -function caml_blit_bytes(s1, i1, s2, i2, len) { - if (len > 0) { - if (s1 === s2) { - var s1$1 = s1; - var i1$1 = i1; - var i2$1 = i2; - var len$1 = len; - if (i1$1 < i2$1) { - var range_a = (s1$1.length - i2$1 | 0) - 1 | 0; - var range_b = len$1 - 1 | 0; - var range = range_a > range_b ? range_b : range_a; - for(var j = range; j >= 0; --j){ - s1$1[i2$1 + j | 0] = s1$1[i1$1 + j | 0]; - } - return /* () */0; - } - else if (i1$1 > i2$1) { - var range_a$1 = (s1$1.length - i1$1 | 0) - 1 | 0; - var range_b$1 = len$1 - 1 | 0; - var range$1 = range_a$1 > range_b$1 ? range_b$1 : range_a$1; - for(var k = 0; k <= range$1; ++k){ - s1$1[i2$1 + k | 0] = s1$1[i1$1 + k | 0]; - } - return /* () */0; - } - else { - return 0; - } - } - else { - var off1 = s1.length - i1 | 0; - if (len <= off1) { - for(var i = 0 ,i_finish = len - 1 | 0; i <= i_finish; ++i){ - s2[i2 + i | 0] = s1[i1 + i | 0]; - } - return /* () */0; - } - else { - for(var i$1 = 0 ,i_finish$1 = off1 - 1 | 0; i$1 <= i_finish$1; ++i$1){ - s2[i2 + i$1 | 0] = s1[i1 + i$1 | 0]; - } - for(var i$2 = off1 ,i_finish$2 = len - 1 | 0; i$2 <= i_finish$2; ++i$2){ - s2[i2 + i$2 | 0] = /* "\000" */0; - } - return /* () */0; - } - } - } - else { - return 0; - } -} - -function bytes_of_string(s) { - var len = s.length; - var res = new Array(len); - for(var i = 0 ,i_finish = len - 1 | 0; i <= i_finish; ++i){ - res[i] = s.charCodeAt(i); - } - return res; -} - -function bytes_to_string(a) { - var bytes = a; - var i = 0; - var len = a.length; - var s = ""; - var s_len = len; - if (i === 0 && len <= 4096 && len === bytes.length) { - return String.fromCharCode.apply(null,bytes); - } - else { - var offset = 0; - while(s_len > 0) { - var next = s_len < 1024 ? s_len : 1024; - var tmp_bytes = new Array(next); - caml_blit_bytes(bytes, offset, tmp_bytes, 0, next); - s = s + String.fromCharCode.apply(null,tmp_bytes); - s_len = s_len - next | 0; - offset = offset + next | 0; - }; - return s; - } -} - -function caml_string_of_char_array(chars) { - var len = chars.length; - var bytes = new Array(len); - for(var i = 0 ,i_finish = len - 1 | 0; i <= i_finish; ++i){ - bytes[i] = chars[i]; - } - return bytes_to_string(bytes); -} - -function caml_is_printable(c) { - if (c > 31) { - return +(c < 127); - } - else { - return /* false */0; - } -} - -function caml_string_get16(s, i) { - return s.charCodeAt(i) + (s.charCodeAt(i + 1 | 0) << 8) | 0; -} - -function caml_string_get32(s, i) { - return ((s.charCodeAt(i) + (s.charCodeAt(i + 1 | 0) << 8) | 0) + (s.charCodeAt(i + 2 | 0) << 16) | 0) + (s.charCodeAt(i + 3 | 0) << 24) | 0; -} - -function get(s, i) { - if (i < 0 || i >= s.length) { - throw [ - Caml_builtin_exceptions.invalid_argument, - "index out of bounds" - ]; - } - else { - return s.charCodeAt(i); - } -} - -exports.bytes_of_string = bytes_of_string; -exports.bytes_to_string = bytes_to_string; -exports.caml_is_printable = caml_is_printable; -exports.caml_string_of_char_array = caml_string_of_char_array; -exports.caml_string_get = caml_string_get; -exports.caml_string_compare = caml_string_compare; -exports.caml_create_string = caml_create_string; -exports.caml_fill_string = caml_fill_string; -exports.caml_blit_string = caml_blit_string; -exports.caml_blit_bytes = caml_blit_bytes; -exports.caml_string_get16 = caml_string_get16; -exports.caml_string_get32 = caml_string_get32; -exports.js_string_of_char = js_string_of_char; -exports.get = get; -/* No side effect */ -//////// end of caml_string.js //////// -    return exports; -  }; - - - _registry['caml_utils'] = function() { -    let exports = {}; -//////// start of caml_utils.js //////// -'use strict'; - - -var repeat = ( (String.prototype.repeat && function (count,self){return self.repeat(count)}) || - function(count , self) { - if (self.length == 0 || count == 0) { - return ''; - } - // Ensuring count is a 31-bit integer allows us to heavily optimize the - // main part. But anyway, most current (August 2014) browsers can't handle - // strings 1 << 28 chars or longer, so: - if (self.length * count >= 1 << 28) { - throw new RangeError('repeat count must not overflow maximum string size'); - } - var rpt = ''; - for (;;) { - if ((count & 1) == 1) { - rpt += self; - } - count >>>= 1; - if (count == 0) { - break; - } - self += self; - } - return rpt; - } -); - -exports.repeat = repeat; -/* repeat Not a pure module */ -//////// end of caml_utils.js //////// -    return exports; -  }; - - - _registry['char'] = function() { -    let exports = {}; -//////// start of char.js //////// -'use strict'; - -var Caml_string = require("./caml_string"); -var Caml_builtin_exceptions = require("./caml_builtin_exceptions"); - -function chr(n) { - if (n < 0 || n > 255) { - throw [ - Caml_builtin_exceptions.invalid_argument, - "Char.chr" - ]; - } - else { - return n; - } -} - -function escaped(c) { - var exit = 0; - if (c >= 40) { - if (c !== 92) { - exit = c >= 127 ? 1 : 2; - } - else { - return "\\\\"; - } - } - else if (c >= 32) { - if (c >= 39) { - return "\\'"; - } - else { - exit = 2; - } - } - else if (c >= 14) { - exit = 1; - } - else { - switch (c) { - case 8 : - return "\\b"; - case 9 : - return "\\t"; - case 10 : - return "\\n"; - case 0 : - case 1 : - case 2 : - case 3 : - case 4 : - case 5 : - case 6 : - case 7 : - case 11 : - case 12 : - exit = 1; - break; - case 13 : - return "\\r"; - - } - } - switch (exit) { - case 1 : - var s = new Array(4); - s[0] = /* "\\" */92; - s[1] = 48 + (c / 100 | 0) | 0; - s[2] = 48 + (c / 10 | 0) % 10 | 0; - s[3] = 48 + c % 10 | 0; - return Caml_string.bytes_to_string(s); - case 2 : - var s$1 = new Array(1); - s$1[0] = c; - return Caml_string.bytes_to_string(s$1); - - } -} - -function lowercase(c) { - if (c >= /* "A" */65 && c <= /* "Z" */90 || c >= /* "\192" */192 && c <= /* "\214" */214 || c >= /* "\216" */216 && c <= /* "\222" */222) { - return c + 32 | 0; - } - else { - return c; - } -} - -function uppercase(c) { - if (c >= /* "a" */97 && c <= /* "z" */122 || c >= /* "\224" */224 && c <= /* "\246" */246 || c >= /* "\248" */248 && c <= /* "\254" */254) { - return c - 32 | 0; - } - else { - return c; - } -} - -function compare(c1, c2) { - return c1 - c2 | 0; -} - -exports.chr = chr; -exports.escaped = escaped; -exports.lowercase = lowercase; -exports.uppercase = uppercase; -exports.compare = compare; -/* No side effect */ -//////// end of char.js //////// -    return exports; -  }; - - - _registry['curry'] = function() { -    let exports = {}; -//////// start of curry.js //////// -'use strict'; - -var Caml_oo = require("./caml_oo"); -var Caml_array = require("./caml_array"); - -function app(_f, _args) { - while(true) { - var args = _args; - var f = _f; - var arity = f.length; - var arity$1 = arity ? arity : 1; - var len = args.length; - var d = arity$1 - len | 0; - if (d) { - if (d < 0) { - _args = Caml_array.caml_array_sub(args, arity$1, -d | 0); - _f = f.apply(null, Caml_array.caml_array_sub(args, 0, arity$1)); - continue ; - - } - else { - return (function(f,args){ - return function (x) { - return app(f, args.concat(/* array */[x])); - } - }(f,args)); - } - } - else { - return f.apply(null, args); - } - }; -} - -function js(label, cacheid, obj, args) { - var meth = Caml_oo.caml_get_public_method(obj, label, cacheid); - return app(meth, args); -} - -function curry_1(o, a0, arity) { - if (arity > 7 || arity < 0) { - return app(o, /* array */[a0]); - } - else { - switch (arity) { - case 0 : - case 1 : - return o(a0); - case 2 : - return function (param) { - return o(a0, param); - }; - case 3 : - return function (param, param$1) { - return o(a0, param, param$1); - }; - case 4 : - return function (param, param$1, param$2) { - return o(a0, param, param$1, param$2); - }; - case 5 : - return function (param, param$1, param$2, param$3) { - return o(a0, param, param$1, param$2, param$3); - }; - case 6 : - return function (param, param$1, param$2, param$3, param$4) { - return o(a0, param, param$1, param$2, param$3, param$4); - }; - case 7 : - return function (param, param$1, param$2, param$3, param$4, param$5) { - return o(a0, param, param$1, param$2, param$3, param$4, param$5); - }; - - } - } -} - -function _1(o, a0) { - var arity = o.length; - if (arity === 1) { - return o(a0); - } - else { - return curry_1(o, a0, arity); - } -} - -function js1(label, cacheid, a0) { - return _1(Caml_oo.caml_get_public_method(a0, label, cacheid), a0); -} - -function __1(o) { - var arity = o.length; - if (arity === 1) { - return o; - } - else { - return function (a0) { - return _1(o, a0); - }; - } -} - -function curry_2(o, a0, a1, arity) { - if (arity > 7 || arity < 0) { - return app(o, /* array */[ - a0, - a1 - ]); - } - else { - switch (arity) { - case 0 : - case 1 : - return app(o(a0), /* array */[a1]); - case 2 : - return o(a0, a1); - case 3 : - return function (param) { - return o(a0, a1, param); - }; - case 4 : - return function (param, param$1) { - return o(a0, a1, param, param$1); - }; - case 5 : - return function (param, param$1, param$2) { - return o(a0, a1, param, param$1, param$2); - }; - case 6 : - return function (param, param$1, param$2, param$3) { - return o(a0, a1, param, param$1, param$2, param$3); - }; - case 7 : - return function (param, param$1, param$2, param$3, param$4) { - return o(a0, a1, param, param$1, param$2, param$3, param$4); - }; - - } - } -} - -function _2(o, a0, a1) { - var arity = o.length; - if (arity === 2) { - return o(a0, a1); - } - else { - return curry_2(o, a0, a1, arity); - } -} - -function js2(label, cacheid, a0, a1) { - return _2(Caml_oo.caml_get_public_method(a0, label, cacheid), a0, a1); -} - -function __2(o) { - var arity = o.length; - if (arity === 2) { - return o; - } - else { - return function (a0, a1) { - return _2(o, a0, a1); - }; - } -} - -function curry_3(o, a0, a1, a2, arity) { - if (arity > 7 || arity < 0) { - return app(o, /* array */[ - a0, - a1, - a2 - ]); - } - else { - switch (arity) { - case 0 : - case 1 : - return app(o(a0), /* array */[ - a1, - a2 - ]); - case 2 : - return app(o(a0, a1), /* array */[a2]); - case 3 : - return o(a0, a1, a2); - case 4 : - return function (param) { - return o(a0, a1, a2, param); - }; - case 5 : - return function (param, param$1) { - return o(a0, a1, a2, param, param$1); - }; - case 6 : - return function (param, param$1, param$2) { - return o(a0, a1, a2, param, param$1, param$2); - }; - case 7 : - return function (param, param$1, param$2, param$3) { - return o(a0, a1, a2, param, param$1, param$2, param$3); - }; - - } - } -} - -function _3(o, a0, a1, a2) { - var arity = o.length; - if (arity === 3) { - return o(a0, a1, a2); - } - else { - return curry_3(o, a0, a1, a2, arity); - } -} - -function js3(label, cacheid, a0, a1, a2) { - return _3(Caml_oo.caml_get_public_method(a0, label, cacheid), a0, a1, a2); -} - -function __3(o) { - var arity = o.length; - if (arity === 3) { - return o; - } - else { - return function (a0, a1, a2) { - return _3(o, a0, a1, a2); - }; - } -} - -function curry_4(o, a0, a1, a2, a3, arity) { - if (arity > 7 || arity < 0) { - return app(o, /* array */[ - a0, - a1, - a2, - a3 - ]); - } - else { - switch (arity) { - case 0 : - case 1 : - return app(o(a0), /* array */[ - a1, - a2, - a3 - ]); - case 2 : - return app(o(a0, a1), /* array */[ - a2, - a3 - ]); - case 3 : - return app(o(a0, a1, a2), /* array */[a3]); - case 4 : - return o(a0, a1, a2, a3); - case 5 : - return function (param) { - return o(a0, a1, a2, a3, param); - }; - case 6 : - return function (param, param$1) { - return o(a0, a1, a2, a3, param, param$1); - }; - case 7 : - return function (param, param$1, param$2) { - return o(a0, a1, a2, a3, param, param$1, param$2); - }; - - } - } -} - -function _4(o, a0, a1, a2, a3) { - var arity = o.length; - if (arity === 4) { - return o(a0, a1, a2, a3); - } - else { - return curry_4(o, a0, a1, a2, a3, arity); - } -} - -function js4(label, cacheid, a0, a1, a2, a3) { - return _4(Caml_oo.caml_get_public_method(a0, label, cacheid), a0, a1, a2, a3); -} - -function __4(o) { - var arity = o.length; - if (arity === 4) { - return o; - } - else { - return function (a0, a1, a2, a3) { - return _4(o, a0, a1, a2, a3); - }; - } -} - -function curry_5(o, a0, a1, a2, a3, a4, arity) { - if (arity > 7 || arity < 0) { - return app(o, /* array */[ - a0, - a1, - a2, - a3, - a4 - ]); - } - else { - switch (arity) { - case 0 : - case 1 : - return app(o(a0), /* array */[ - a1, - a2, - a3, - a4 - ]); - case 2 : - return app(o(a0, a1), /* array */[ - a2, - a3, - a4 - ]); - case 3 : - return app(o(a0, a1, a2), /* array */[ - a3, - a4 - ]); - case 4 : - return app(o(a0, a1, a2, a3), /* array */[a4]); - case 5 : - return o(a0, a1, a2, a3, a4); - case 6 : - return function (param) { - return o(a0, a1, a2, a3, a4, param); - }; - case 7 : - return function (param, param$1) { - return o(a0, a1, a2, a3, a4, param, param$1); - }; - - } - } -} - -function _5(o, a0, a1, a2, a3, a4) { - var arity = o.length; - if (arity === 5) { - return o(a0, a1, a2, a3, a4); - } - else { - return curry_5(o, a0, a1, a2, a3, a4, arity); - } -} - -function js5(label, cacheid, a0, a1, a2, a3, a4) { - return _5(Caml_oo.caml_get_public_method(a0, label, cacheid), a0, a1, a2, a3, a4); -} - -function __5(o) { - var arity = o.length; - if (arity === 5) { - return o; - } - else { - return function (a0, a1, a2, a3, a4) { - return _5(o, a0, a1, a2, a3, a4); - }; - } -} - -function curry_6(o, a0, a1, a2, a3, a4, a5, arity) { - if (arity > 7 || arity < 0) { - return app(o, /* array */[ - a0, - a1, - a2, - a3, - a4, - a5 - ]); - } - else { - switch (arity) { - case 0 : - case 1 : - return app(o(a0), /* array */[ - a1, - a2, - a3, - a4, - a5 - ]); - case 2 : - return app(o(a0, a1), /* array */[ - a2, - a3, - a4, - a5 - ]); - case 3 : - return app(o(a0, a1, a2), /* array */[ - a3, - a4, - a5 - ]); - case 4 : - return app(o(a0, a1, a2, a3), /* array */[ - a4, - a5 - ]); - case 5 : - return app(o(a0, a1, a2, a3, a4), /* array */[a5]); - case 6 : - return o(a0, a1, a2, a3, a4, a5); - case 7 : - return function (param) { - return o(a0, a1, a2, a3, a4, a5, param); - }; - - } - } -} - -function _6(o, a0, a1, a2, a3, a4, a5) { - var arity = o.length; - if (arity === 6) { - return o(a0, a1, a2, a3, a4, a5); - } - else { - return curry_6(o, a0, a1, a2, a3, a4, a5, arity); - } -} - -function js6(label, cacheid, a0, a1, a2, a3, a4, a5) { - return _6(Caml_oo.caml_get_public_method(a0, label, cacheid), a0, a1, a2, a3, a4, a5); -} - -function __6(o) { - var arity = o.length; - if (arity === 6) { - return o; - } - else { - return function (a0, a1, a2, a3, a4, a5) { - return _6(o, a0, a1, a2, a3, a4, a5); - }; - } -} - -function curry_7(o, a0, a1, a2, a3, a4, a5, a6, arity) { - if (arity > 7 || arity < 0) { - return app(o, /* array */[ - a0, - a1, - a2, - a3, - a4, - a5, - a6 - ]); - } - else { - switch (arity) { - case 0 : - case 1 : - return app(o(a0), /* array */[ - a1, - a2, - a3, - a4, - a5, - a6 - ]); - case 2 : - return app(o(a0, a1), /* array */[ - a2, - a3, - a4, - a5, - a6 - ]); - case 3 : - return app(o(a0, a1, a2), /* array */[ - a3, - a4, - a5, - a6 - ]); - case 4 : - return app(o(a0, a1, a2, a3), /* array */[ - a4, - a5, - a6 - ]); - case 5 : - return app(o(a0, a1, a2, a3, a4), /* array */[ - a5, - a6 - ]); - case 6 : - return app(o(a0, a1, a2, a3, a4, a5), /* array */[a6]); - case 7 : - return o(a0, a1, a2, a3, a4, a5, a6); - - } - } -} - -function _7(o, a0, a1, a2, a3, a4, a5, a6) { - var arity = o.length; - if (arity === 7) { - return o(a0, a1, a2, a3, a4, a5, a6); - } - else { - return curry_7(o, a0, a1, a2, a3, a4, a5, a6, arity); - } -} - -function js7(label, cacheid, a0, a1, a2, a3, a4, a5, a6) { - return _7(Caml_oo.caml_get_public_method(a0, label, cacheid), a0, a1, a2, a3, a4, a5, a6); -} - -function __7(o) { - var arity = o.length; - if (arity === 7) { - return o; - } - else { - return function (a0, a1, a2, a3, a4, a5, a6) { - return _7(o, a0, a1, a2, a3, a4, a5, a6); - }; - } -} - -function curry_8(o, a0, a1, a2, a3, a4, a5, a6, a7, arity) { - if (arity > 7 || arity < 0) { - return app(o, /* array */[ - a0, - a1, - a2, - a3, - a4, - a5, - a6, - a7 - ]); - } - else { - switch (arity) { - case 0 : - case 1 : - return app(o(a0), /* array */[ - a1, - a2, - a3, - a4, - a5, - a6, - a7 - ]); - case 2 : - return app(o(a0, a1), /* array */[ - a2, - a3, - a4, - a5, - a6, - a7 - ]); - case 3 : - return app(o(a0, a1, a2), /* array */[ - a3, - a4, - a5, - a6, - a7 - ]); - case 4 : - return app(o(a0, a1, a2, a3), /* array */[ - a4, - a5, - a6, - a7 - ]); - case 5 : - return app(o(a0, a1, a2, a3, a4), /* array */[ - a5, - a6, - a7 - ]); - case 6 : - return app(o(a0, a1, a2, a3, a4, a5), /* array */[ - a6, - a7 - ]); - case 7 : - return app(o(a0, a1, a2, a3, a4, a5, a6), /* array */[a7]); - - } - } -} - -function _8(o, a0, a1, a2, a3, a4, a5, a6, a7) { - var arity = o.length; - if (arity === 8) { - return o(a0, a1, a2, a3, a4, a5, a6, a7); - } - else { - return curry_8(o, a0, a1, a2, a3, a4, a5, a6, a7, arity); - } -} - -function js8(label, cacheid, a0, a1, a2, a3, a4, a5, a6, a7) { - return _8(Caml_oo.caml_get_public_method(a0, label, cacheid), a0, a1, a2, a3, a4, a5, a6, a7); -} - -function __8(o) { - var arity = o.length; - if (arity === 8) { - return o; - } - else { - return function (a0, a1, a2, a3, a4, a5, a6, a7) { - return _8(o, a0, a1, a2, a3, a4, a5, a6, a7); - }; - } -} - -exports.app = app; -exports.js = js; -exports.curry_1 = curry_1; -exports._1 = _1; -exports.js1 = js1; -exports.__1 = __1; -exports.curry_2 = curry_2; -exports._2 = _2; -exports.js2 = js2; -exports.__2 = __2; -exports.curry_3 = curry_3; -exports._3 = _3; -exports.js3 = js3; -exports.__3 = __3; -exports.curry_4 = curry_4; -exports._4 = _4; -exports.js4 = js4; -exports.__4 = __4; -exports.curry_5 = curry_5; -exports._5 = _5; -exports.js5 = js5; -exports.__5 = __5; -exports.curry_6 = curry_6; -exports._6 = _6; -exports.js6 = js6; -exports.__6 = __6; -exports.curry_7 = curry_7; -exports._7 = _7; -exports.js7 = js7; -exports.__7 = __7; -exports.curry_8 = curry_8; -exports._8 = _8; -exports.js8 = js8; -exports.__8 = __8; -/* No side effect */ -//////// end of curry.js //////// -    return exports; -  }; - - - _registry['decode'] = function() { -    let exports = {}; -//////// start of decode.js //////// -// Generated by BUCKLESCRIPT VERSION 1.4.3 , PLEASE EDIT WITH CARE -'use strict'; - -var F32 = require("./f32"); -var F64 = require("./f64"); -var I32 = require("./i32"); -var Lib = require("./lib"); -var List = require("bs-platform/lib/js/list"); -var Block = require("bs-platform/lib/js/block"); -var Curry = require("bs-platform/lib/js/curry"); -var $$Error = require("./error"); -var Encode = require("./encode"); -var Printf = require("bs-platform/lib/js/printf"); -var Source = require("./source"); -var $$String = require("bs-platform/lib/js/string"); -var Caml_obj = require("bs-platform/lib/js/caml_obj"); -var Operators = require("./operators"); -var Caml_int64 = require("bs-platform/lib/js/caml_int64"); -var Caml_string = require("bs-platform/lib/js/caml_string"); -var Caml_exceptions = require("bs-platform/lib/js/caml_exceptions"); - -var EOS = Caml_exceptions.create("Decode.EOS"); - -function stream(name, bs) { - return /* record */[ - /* name */name, - /* bytes */bs, - /* pos */[0] - ]; -} - -function eos(s) { - return +(s[/* pos */2][0] === s[/* bytes */1].length); -} - -function check(n, s) { - if ((s[/* pos */2][0] + n | 0) > s[/* bytes */1].length) { - throw EOS; - } - else { - return 0; - } -} - -function skip(n, s) { - check(n, s); - s[/* pos */2][0] = s[/* pos */2][0] + n | 0; - return /* () */0; -} - -function read(s) { - return Caml_string.get(s[/* bytes */1], s[/* pos */2][0]); -} - -function peek(s) { - if (eos(s)) { - return /* None */0; - } - else { - return /* Some */[read(s)]; - } -} - -function get(s) { - check(1, s); - var b = read(s); - skip(1, s); - return b; -} - -var Code = $$Error.Make(/* module */[]); - -var Code$1 = Code[/* Error */0]; - -function string_of_byte(b) { - return Curry._1(Printf.sprintf(/* Format */[ - /* Int */Block.__(4, [ - /* Int_x */6, - /* Lit_padding */Block.__(0, [ - /* Zeros */2, - 2 - ]), - /* No_precision */0, - /* End_of_format */0 - ]), - "%02x" - ]), b); -} - -function position(s, pos) { - return /* record */[ - /* file */s[/* name */0], - /* line */-1, - /* column */pos - ]; -} - -function region(s, left, right) { - return /* record */[ - /* left */position(s, left), - /* right */position(s, right) - ]; -} - -function error(s, pos, msg) { - throw [ - Code$1, - region(s, pos, pos), - msg - ]; -} - -function $$require(b, s, pos, msg) { - if (b) { - return 0; - } - else { - return error(s, pos, msg); - } -} - -function guard(f, s) { - try { - return Curry._1(f, s); - } - catch (exn){ - if (exn === EOS) { - return error(s, s[/* bytes */1].length, "unexpected end of binary or function"); - } - else { - throw exn; - } - } -} - -function get$1(param) { - return guard(get, param); -} - -function expect(b, s, msg) { - return $$require(+(guard(get$1, s) === b), s, s[/* pos */2][0] - 1 | 0, msg); -} - -function illegal(s, pos, b) { - return error(s, pos, "illegal opcode " + string_of_byte(b)); -} - -function at(f, s) { - var left = s[/* pos */2][0]; - var x = Curry._1(f, s); - var right = s[/* pos */2][0]; - return Source.$at$at(x, region(s, left, right)); -} - -function u16(s) { - var lo = guard(get, s); - var hi = guard(get, s); - return (hi << 8) + lo | 0; -} - -function u32(s) { - var lo = u16(s); - var hi = u16(s); - return lo + (hi << 16) | 0; -} - -function u64(s) { - var lo = Caml_int64.of_int32(u32(s)); - var hi = Caml_int64.of_int32(u32(s)); - return Caml_int64.add(lo, Caml_int64.lsl_(hi, 32)); -} - -function vuN(n, s) { - $$require(+(n > 0), s, s[/* pos */2][0], "integer representation too long"); - var b = guard(get, s); - $$require(+(n >= 7 || (b & 127) < (1 << n)), s, s[/* pos */2][0] - 1 | 0, "integer too large"); - var x = Caml_int64.of_int32(b & 127); - if (b & 128) { - return Caml_int64.or_(x, Caml_int64.lsl_(vuN(n - 7 | 0, s), 7)); - } - else { - return x; - } -} - -function vsN(n, s) { - $$require(+(n > 0), s, s[/* pos */2][0], "integer representation too long"); - var b = guard(get, s); - var mask = (-1 << n) & 127; - $$require(+(n >= 7 || (b & mask) === 0 || (b & mask) === mask), s, s[/* pos */2][0] - 1 | 0, "integer too large"); - var x = Caml_int64.of_int32(b & 127); - if (b & 128) { - return Caml_int64.or_(x, Caml_int64.lsl_(vsN(n - 7 | 0, s), 7)); - } - else if (b & 64) { - return /* int64 */[ - /* hi */x[0] | /* hi */-1, - /* lo */((x[1] | /* lo */4294967168) >>> 0) - ]; - } - else { - return x; - } -} - -function vu32(s) { - return vuN(32, s)[1] | 0; -} - -function vs32(s) { - return vsN(32, s)[1] | 0; -} - -function vs64(s) { - return vsN(64, s); -} - -function f32(s) { - return Curry._1(F32.of_bits, u32(s)); -} - -function f64(s) { - return Curry._1(F64.of_bits, u64(s)); -} - -function len32(s) { - var pos = s[/* pos */2][0]; - var n = vuN(32, s)[1] | 0; - if (n <= s[/* bytes */1].length) { - return n; - } - else { - return error(s, pos, "length out of bounds"); - } -} - -function string(s) { - var n = len32(s); - return guard(function (param) { - var n$1 = n; - var s = param; - var i = s[/* pos */2][0]; - skip(n$1, s); - return $$String.sub(s[/* bytes */1], i, n$1); - }, s); -} - -function list(f, n, s) { - if (n) { - var x = Curry._1(f, s); - return /* :: */[ - x, - list(f, n - 1 | 0, s) - ]; - } - else { - return /* [] */0; - } -} - -function opt(f, b, s) { - if (b) { - return /* Some */[Curry._1(f, s)]; - } - else { - return /* None */0; - } -} - -function vec(f, s) { - var n = len32(s); - return list(f, n, s); -} - -function sized(f, s) { - var size = len32(s); - var start = s[/* pos */2][0]; - var x = Curry._2(f, size, s); - $$require(+(s[/* pos */2][0] === (start + size | 0)), s, start, "section size mismatch"); - return x; -} - -function value_type(s) { - var match = vsN(7, s)[1] | 0; - var switcher = match + 4 | 0; - if (switcher > 3 || switcher < 0) { - return error(s, s[/* pos */2][0] - 1 | 0, "invalid value type"); - } - else { - switch (switcher) { - case 0 : - return /* F64Type */3; - case 1 : - return /* F32Type */2; - case 2 : - return /* I64Type */1; - case 3 : - return /* I32Type */0; - - } - } -} - -function elem_type(s) { - var match = vsN(7, s)[1] | 0; - if (match !== -16) { - return error(s, s[/* pos */2][0] - 1 | 0, "invalid element type"); - } - else { - return /* AnyFuncType */0; - } -} - -function stack_type(s) { - var match = peek(s); - if (match) { - if (match[0] !== 64) { - return /* :: */[ - value_type(s), - /* [] */0 - ]; - } - else { - guard(function (param) { - return skip(1, param); - }, s); - return /* [] */0; - } - } - else { - return /* :: */[ - value_type(s), - /* [] */0 - ]; - } -} - -function func_type(s) { - var match = vsN(7, s)[1] | 0; - if (match !== -32) { - return error(s, s[/* pos */2][0] - 1 | 0, "invalid function type"); - } - else { - var ins = vec(value_type, s); - var out = vec(value_type, s); - return /* FuncType */[ - ins, - out - ]; - } -} - -function limits(vu, s) { - var has_max = +((vuN(1, s)[1] | 0) === 1); - var min = Curry._1(vu, s); - var max = opt(vu, has_max, s); - return /* record */[ - /* min */min, - /* max */max - ]; -} - -function table_type(s) { - var t = elem_type(s); - var lim = limits(vu32, s); - return /* TableType */[ - lim, - t - ]; -} - -function memory_type(s) { - var lim = limits(vu32, s); - return /* MemoryType */[lim]; -} - -function mutability(s) { - var match = guard(get, s); - if (match !== 0) { - if (match !== 1) { - return error(s, s[/* pos */2][0] - 1 | 0, "invalid mutability"); - } - else { - return /* Mutable */1; - } - } - else { - return /* Immutable */0; - } -} - -function global_type(s) { - var t = value_type(s); - var mut = mutability(s); - return /* GlobalType */[ - t, - mut - ]; -} - -function $$var(s) { - return vuN(32, s)[1] | 0; -} - -function memop(s) { - var align = vuN(32, s)[1] | 0; - $$require(Curry._2(I32.le_u, align, 32), s, s[/* pos */2][0] - 1 | 0, "invalid memop flags"); - var offset = vuN(32, s)[1] | 0; - return /* tuple */[ - align, - offset - ]; -} - -function instr(s) { - var pos = s[/* pos */2][0]; - var b = guard(get, s); - if (b > 191 || b < 0) { - return illegal(s, pos, b); - } - else { - switch (b) { - case 0 : - return Operators.unreachable; - case 1 : - return Operators.nop; - case 2 : - var ts = stack_type(s); - var es$prime = List.rev(instr_block$prime(s, /* [] */0)); - expect(11, s, "END opcode expected"); - return Operators.block(ts, es$prime); - case 3 : - var ts$1 = stack_type(s); - var es$prime$1 = List.rev(instr_block$prime(s, /* [] */0)); - expect(11, s, "END opcode expected"); - return Operators.loop(ts$1, es$prime$1); - case 4 : - var ts$2 = stack_type(s); - var es1 = List.rev(instr_block$prime(s, /* [] */0)); - if (Caml_obj.caml_equal(peek(s), /* Some */[5])) { - expect(5, s, "ELSE or END opcode expected"); - var es2 = List.rev(instr_block$prime(s, /* [] */0)); - expect(11, s, "END opcode expected"); - return Operators.if_(ts$2, es1, es2); - } - else { - expect(11, s, "END opcode expected"); - return Operators.if_(ts$2, es1, /* [] */0); - } - break; - case 5 : - return error(s, pos, "misplaced ELSE opcode"); - case 11 : - return error(s, pos, "misplaced END opcode"); - case 12 : - return Operators.br(at($$var, s)); - case 13 : - return Operators.br_if(at($$var, s)); - case 14 : - var xs = vec(function (param) { - return at($$var, param); - }, s); - var x = at($$var, s); - return Operators.br_table(xs, x); - case 15 : - return Operators.$$return; - case 16 : - return Operators.call(at($$var, s)); - case 17 : - var x$1 = at($$var, s); - expect(0, s, "zero flag expected"); - return Operators.call_indirect(x$1); - case 26 : - return Operators.drop; - case 27 : - return Operators.select; - case 32 : - return Operators.get_local(at($$var, s)); - case 33 : - return Operators.set_local(at($$var, s)); - case 34 : - return Operators.tee_local(at($$var, s)); - case 35 : - return Operators.get_global(at($$var, s)); - case 36 : - return Operators.set_global(at($$var, s)); - case 6 : - case 7 : - case 8 : - case 9 : - case 10 : - case 18 : - case 19 : - case 20 : - case 21 : - case 22 : - case 23 : - case 24 : - case 25 : - case 28 : - case 29 : - case 30 : - case 31 : - case 37 : - case 38 : - case 39 : - return illegal(s, pos, b); - case 40 : - var match = memop(s); - return Operators.i32_load(match[0], match[1]); - case 41 : - var match$1 = memop(s); - return Operators.i64_load(match$1[0], match$1[1]); - case 42 : - var match$2 = memop(s); - return Operators.f32_load(match$2[0], match$2[1]); - case 43 : - var match$3 = memop(s); - return Operators.f64_load(match$3[0], match$3[1]); - case 44 : - var match$4 = memop(s); - return Operators.i32_load8_s(match$4[0], match$4[1]); - case 45 : - var match$5 = memop(s); - return Operators.i32_load8_u(match$5[0], match$5[1]); - case 46 : - var match$6 = memop(s); - return Operators.i32_load16_s(match$6[0], match$6[1]); - case 47 : - var match$7 = memop(s); - return Operators.i32_load16_u(match$7[0], match$7[1]); - case 48 : - var match$8 = memop(s); - return Operators.i64_load8_s(match$8[0], match$8[1]); - case 49 : - var match$9 = memop(s); - return Operators.i64_load8_u(match$9[0], match$9[1]); - case 50 : - var match$10 = memop(s); - return Operators.i64_load16_s(match$10[0], match$10[1]); - case 51 : - var match$11 = memop(s); - return Operators.i64_load16_u(match$11[0], match$11[1]); - case 52 : - var match$12 = memop(s); - return Operators.i64_load32_s(match$12[0], match$12[1]); - case 53 : - var match$13 = memop(s); - return Operators.i64_load32_u(match$13[0], match$13[1]); - case 54 : - var match$14 = memop(s); - return Operators.i32_store(match$14[0], match$14[1]); - case 55 : - var match$15 = memop(s); - return Operators.i64_store(match$15[0], match$15[1]); - case 56 : - var match$16 = memop(s); - return Operators.f32_store(match$16[0], match$16[1]); - case 57 : - var match$17 = memop(s); - return Operators.f64_store(match$17[0], match$17[1]); - case 58 : - var match$18 = memop(s); - return Operators.i32_store8(match$18[0], match$18[1]); - case 59 : - var match$19 = memop(s); - return Operators.i32_store16(match$19[0], match$19[1]); - case 60 : - var match$20 = memop(s); - return Operators.i64_store8(match$20[0], match$20[1]); - case 61 : - var match$21 = memop(s); - return Operators.i64_store16(match$21[0], match$21[1]); - case 62 : - var match$22 = memop(s); - return Operators.i64_store32(match$22[0], match$22[1]); - case 63 : - expect(0, s, "zero flag expected"); - return Operators.current_memory; - case 64 : - expect(0, s, "zero flag expected"); - return Operators.grow_memory; - case 65 : - return Operators.i32_const(at(vs32, s)); - case 66 : - return Operators.i64_const(at(vs64, s)); - case 67 : - return Operators.f32_const(at(f32, s)); - case 68 : - return Operators.f64_const(at(f64, s)); - case 69 : - return Operators.i32_eqz; - case 70 : - return Operators.i32_eq; - case 71 : - return Operators.i32_ne; - case 72 : - return Operators.i32_lt_s; - case 73 : - return Operators.i32_lt_u; - case 74 : - return Operators.i32_gt_s; - case 75 : - return Operators.i32_gt_u; - case 76 : - return Operators.i32_le_s; - case 77 : - return Operators.i32_le_u; - case 78 : - return Operators.i32_ge_s; - case 79 : - return Operators.i32_ge_u; - case 80 : - return Operators.i64_eqz; - case 81 : - return Operators.i64_eq; - case 82 : - return Operators.i64_ne; - case 83 : - return Operators.i64_lt_s; - case 84 : - return Operators.i64_lt_u; - case 85 : - return Operators.i64_gt_s; - case 86 : - return Operators.i64_gt_u; - case 87 : - return Operators.i64_le_s; - case 88 : - return Operators.i64_le_u; - case 89 : - return Operators.i64_ge_s; - case 90 : - return Operators.i64_ge_u; - case 91 : - return Operators.f32_eq; - case 92 : - return Operators.f32_ne; - case 93 : - return Operators.f32_lt; - case 94 : - return Operators.f32_gt; - case 95 : - return Operators.f32_le; - case 96 : - return Operators.f32_ge; - case 97 : - return Operators.f64_eq; - case 98 : - return Operators.f64_ne; - case 99 : - return Operators.f64_lt; - case 100 : - return Operators.f64_gt; - case 101 : - return Operators.f64_le; - case 102 : - return Operators.f64_ge; - case 103 : - return Operators.i32_clz; - case 104 : - return Operators.i32_ctz; - case 105 : - return Operators.i32_popcnt; - case 106 : - return Operators.i32_add; - case 107 : - return Operators.i32_sub; - case 108 : - return Operators.i32_mul; - case 109 : - return Operators.i32_div_s; - case 110 : - return Operators.i32_div_u; - case 111 : - return Operators.i32_rem_s; - case 112 : - return Operators.i32_rem_u; - case 113 : - return Operators.i32_and; - case 114 : - return Operators.i32_or; - case 115 : - return Operators.i32_xor; - case 116 : - return Operators.i32_shl; - case 117 : - return Operators.i32_shr_s; - case 118 : - return Operators.i32_shr_u; - case 119 : - return Operators.i32_rotl; - case 120 : - return Operators.i32_rotr; - case 121 : - return Operators.i64_clz; - case 122 : - return Operators.i64_ctz; - case 123 : - return Operators.i64_popcnt; - case 124 : - return Operators.i64_add; - case 125 : - return Operators.i64_sub; - case 126 : - return Operators.i64_mul; - case 127 : - return Operators.i64_div_s; - case 128 : - return Operators.i64_div_u; - case 129 : - return Operators.i64_rem_s; - case 130 : - return Operators.i64_rem_u; - case 131 : - return Operators.i64_and; - case 132 : - return Operators.i64_or; - case 133 : - return Operators.i64_xor; - case 134 : - return Operators.i64_shl; - case 135 : - return Operators.i64_shr_s; - case 136 : - return Operators.i64_shr_u; - case 137 : - return Operators.i64_rotl; - case 138 : - return Operators.i64_rotr; - case 139 : - return Operators.f32_abs; - case 140 : - return Operators.f32_neg; - case 141 : - return Operators.f32_ceil; - case 142 : - return Operators.f32_floor; - case 143 : - return Operators.f32_trunc; - case 144 : - return Operators.f32_nearest; - case 145 : - return Operators.f32_sqrt; - case 146 : - return Operators.f32_add; - case 147 : - return Operators.f32_sub; - case 148 : - return Operators.f32_mul; - case 149 : - return Operators.f32_div; - case 150 : - return Operators.f32_min; - case 151 : - return Operators.f32_max; - case 152 : - return Operators.f32_copysign; - case 153 : - return Operators.f64_abs; - case 154 : - return Operators.f64_neg; - case 155 : - return Operators.f64_ceil; - case 156 : - return Operators.f64_floor; - case 157 : - return Operators.f64_trunc; - case 158 : - return Operators.f64_nearest; - case 159 : - return Operators.f64_sqrt; - case 160 : - return Operators.f64_add; - case 161 : - return Operators.f64_sub; - case 162 : - return Operators.f64_mul; - case 163 : - return Operators.f64_div; - case 164 : - return Operators.f64_min; - case 165 : - return Operators.f64_max; - case 166 : - return Operators.f64_copysign; - case 167 : - return Operators.i32_wrap_i64; - case 168 : - return Operators.i32_trunc_s_f32; - case 169 : - return Operators.i32_trunc_u_f32; - case 170 : - return Operators.i32_trunc_s_f64; - case 171 : - return Operators.i32_trunc_u_f64; - case 172 : - return Operators.i64_extend_s_i32; - case 173 : - return Operators.i64_extend_u_i32; - case 174 : - return Operators.i64_trunc_s_f32; - case 175 : - return Operators.i64_trunc_u_f32; - case 176 : - return Operators.i64_trunc_s_f64; - case 177 : - return Operators.i64_trunc_u_f64; - case 178 : - return Operators.f32_convert_s_i32; - case 179 : - return Operators.f32_convert_u_i32; - case 180 : - return Operators.f32_convert_s_i64; - case 181 : - return Operators.f32_convert_u_i64; - case 182 : - return Operators.f32_demote_f64; - case 183 : - return Operators.f64_convert_s_i32; - case 184 : - return Operators.f64_convert_u_i32; - case 185 : - return Operators.f64_convert_s_i64; - case 186 : - return Operators.f64_convert_u_i64; - case 187 : - return Operators.f64_promote_f32; - case 188 : - return Operators.i32_reinterpret_f32; - case 189 : - return Operators.i64_reinterpret_f64; - case 190 : - return Operators.f32_reinterpret_i32; - case 191 : - return Operators.f64_reinterpret_i64; - - } - } -} - -function instr_block$prime(s, _es) { - while(true) { - var es = _es; - var match = peek(s); - if (match) { - var match$1 = match[0]; - if (match$1 !== 5) { - if (match$1 !== 11) { - var pos = s[/* pos */2][0]; - var e$prime = instr(s); - _es = /* :: */[ - Source.$at$at(e$prime, region(s, pos, pos)), - es - ]; - continue ; - - } - else { - return es; - } - } - else { - return es; - } - } - else { - return es; - } - }; -} - -function instr_block(s) { - return List.rev(instr_block$prime(s, /* [] */0)); -} - -function $$const(s) { - var c = at(instr_block, s); - expect(11, s, "END opcode expected"); - return c; -} - -function id(s) { - var bo = peek(s); - return Curry._2(Lib.Option[/* map */1], function (param) { - if (param > 11 || param < 0) { - return error(s, s[/* pos */2][0], "invalid section id"); - } - else { - switch (param) { - case 0 : - return /* CustomSection */-808010220; - case 1 : - return /* TypeSection */836501035; - case 2 : - return /* ImportSection */696517344; - case 3 : - return /* FuncSection */205556449; - case 4 : - return /* TableSection */1031864215; - case 5 : - return /* MemorySection */-840203068; - case 6 : - return /* GlobalSection */-872313182; - case 7 : - return /* ExportSection */-440679759; - case 8 : - return /* StartSection */395720131; - case 9 : - return /* ElemSection */440380662; - case 10 : - return /* CodeSection */1021133848; - case 11 : - return /* DataSection */66447547; - - } - } - }, bo); -} - -function section_with_size(tag, f, $$default, s) { - var match = id(s); - if (match && Caml_obj.caml_equal(match[0], tag)) { - guard(get, s); - return sized(f, s); - } - else { - return $$default; - } -} - -function section(tag, f, $$default, s) { - return section_with_size(tag, function () { - return f; - }, $$default, s); -} - -function type_section(s) { - return section(/* TypeSection */836501035, function (param) { - return vec(func_type, param); - }, /* [] */0, s); -} - -function import_kind(s) { - var match = guard(get, s); - if (match > 3 || match < 0) { - return error(s, s[/* pos */2][0] - 1 | 0, "invalid import kind"); - } - else { - switch (match) { - case 0 : - return /* FuncImport */Block.__(0, [at($$var, s)]); - case 1 : - return /* TableImport */Block.__(1, [table_type(s)]); - case 2 : - return /* MemoryImport */Block.__(2, [memory_type(s)]); - case 3 : - return /* GlobalImport */Block.__(3, [global_type(s)]); - - } - } -} - -function $$import(s) { - var module_name = string(s); - var item_name = string(s); - var ikind = at(import_kind, s); - return /* record */[ - /* module_name */module_name, - /* item_name */item_name, - /* ikind */ikind - ]; -} - -function import_section(s) { - return section(/* ImportSection */696517344, function (param) { - return vec(function (param) { - return at($$import, param); - }, param); - }, /* [] */0, s); -} - -function func_section(s) { - return section(/* FuncSection */205556449, function (param) { - return vec(function (param) { - return at($$var, param); - }, param); - }, /* [] */0, s); -} - -function table(s) { - var ttype = table_type(s); - return /* record */[/* ttype */ttype]; -} - -function table_section(s) { - return section(/* TableSection */1031864215, function (param) { - return vec(function (param) { - return at(table, param); - }, param); - }, /* [] */0, s); -} - -function memory(s) { - var mtype = memory_type(s); - return /* record */[/* mtype */mtype]; -} - -function memory_section(s) { - return section(/* MemorySection */-840203068, function (param) { - return vec(function (param) { - return at(memory, param); - }, param); - }, /* [] */0, s); -} - -function global(s) { - var gtype = global_type(s); - var value = $$const(s); - return /* record */[ - /* gtype */gtype, - /* value */value - ]; -} - -function global_section(s) { - return section(/* GlobalSection */-872313182, function (param) { - return vec(function (param) { - return at(global, param); - }, param); - }, /* [] */0, s); -} - -function export_kind(s) { - var match = guard(get, s); - if (match > 3 || match < 0) { - return error(s, s[/* pos */2][0] - 1 | 0, "invalid export kind"); - } - else { - switch (match) { - case 0 : - return /* FuncExport */0; - case 1 : - return /* TableExport */1; - case 2 : - return /* MemoryExport */2; - case 3 : - return /* GlobalExport */3; - - } - } -} - -function $$export(s) { - var name = string(s); - var ekind = at(export_kind, s); - var item = at($$var, s); - return /* record */[ - /* name */name, - /* ekind */ekind, - /* item */item - ]; -} - -function export_section(s) { - return section(/* ExportSection */-440679759, function (param) { - return vec(function (param) { - return at($$export, param); - }, param); - }, /* [] */0, s); -} - -function start_section(s) { - return section(/* StartSection */395720131, function (param) { - return /* Some */[at($$var, param)]; - }, /* None */0, s); -} - -function local(s) { - var n = len32(s); - var t = value_type(s); - return Curry._2(Lib.List[/* make */0], n, t); -} - -function code(_, s) { - var locals = List.flatten(vec(local, s)); - var body = List.rev(instr_block$prime(s, /* [] */0)); - expect(11, s, "END opcode expected"); - return /* record */[ - /* ftype */Source.$at$at(-1, Source.no_region), - /* locals */locals, - /* body */body - ]; -} - -function code_section(s) { - return section(/* CodeSection */1021133848, function (param) { - return vec(function (param) { - return at(function (param) { - return sized(code, param); - }, param); - }, param); - }, /* [] */0, s); -} - -function segment(dat, s) { - var index = at($$var, s); - var offset = $$const(s); - var init = Curry._1(dat, s); - return /* record */[ - /* index */index, - /* offset */offset, - /* init */init - ]; -} - -function table_segment(s) { - return segment(function (param) { - return vec(function (param) { - return at($$var, param); - }, param); - }, s); -} - -function elem_section(s) { - return section(/* ElemSection */440380662, function (param) { - return vec(function (param) { - return at(table_segment, param); - }, param); - }, /* [] */0, s); -} - -function memory_segment(s) { - return segment(string, s); -} - -function data_section(s) { - return section(/* DataSection */66447547, function (param) { - return vec(function (param) { - return at(memory_segment, param); - }, param); - }, /* [] */0, s); -} - -function custom(size, s) { - var start = s[/* pos */2][0]; - string(s); - var partial_arg = size - (s[/* pos */2][0] - start | 0) | 0; - var partial_arg$1 = function (param) { - return skip(partial_arg, param); - }; - (function (param) { - return guard(partial_arg$1, param); - }(s)); - return /* true */1; -} - -function custom_section(s) { - return section_with_size(/* CustomSection */-808010220, custom, /* false */0, s); -} - -function iterate(f, s) { - while(true) { - if (Curry._1(f, s)) { - continue ; - - } - else { - return 0; - } - }; -} - -function module_(s) { - var magic = u32(s); - $$require(+(magic === 1836278016), s, 0, "magic header not detected"); - var version = u32(s); - $$require(+(version === Encode.version), s, 4, "unknown binary version"); - iterate(custom_section, s); - var types = type_section(s); - iterate(custom_section, s); - var imports = import_section(s); - iterate(custom_section, s); - var func_types = func_section(s); - iterate(custom_section, s); - var tables = table_section(s); - iterate(custom_section, s); - var memories = memory_section(s); - iterate(custom_section, s); - var globals = global_section(s); - iterate(custom_section, s); - var $$exports = export_section(s); - iterate(custom_section, s); - var start = start_section(s); - iterate(custom_section, s); - var elems = elem_section(s); - iterate(custom_section, s); - var func_bodies = code_section(s); - iterate(custom_section, s); - var data = data_section(s); - iterate(custom_section, s); - $$require(+(s[/* pos */2][0] === s[/* bytes */1].length), s, s[/* bytes */1].length, "junk after last section"); - $$require(+(List.length(func_types) === List.length(func_bodies)), s, s[/* bytes */1].length, "function and code section have inconsistent lengths"); - var funcs = List.map2(function (t, f) { - var init = f[/* it */1]; - return Source.$at$at(/* record */[ - /* ftype */t, - /* locals */init[/* locals */1], - /* body */init[/* body */2] - ], f[/* at */0]); - }, func_types, func_bodies); - return /* record */[ - /* types */types, - /* globals */globals, - /* tables */tables, - /* memories */memories, - /* funcs */funcs, - /* start */start, - /* elems */elems, - /* data */data, - /* imports */imports, - /* exports */$$exports - ]; -} - -function decode(name, bs) { - return at(module_, stream(name, bs)); -} - -exports.Code = Code$1; -exports.decode = decode; -/* Code Not a pure module */ -//////// end of decode.js //////// -    return exports; -  }; - - - _registry['encode'] = function() { -    let exports = {}; -//////// start of encode.js //////// -// Generated by BUCKLESCRIPT VERSION 1.4.3 , PLEASE EDIT WITH CARE -'use strict'; - -var F32 = require("./f32"); -var F64 = require("./f64"); -var Lib = require("./lib"); -var Char = require("bs-platform/lib/js/char"); -var List = require("bs-platform/lib/js/list"); -var Bytes = require("bs-platform/lib/js/bytes"); -var Curry = require("bs-platform/lib/js/curry"); -var $$Error = require("./error"); -var Buffer = require("bs-platform/lib/js/buffer"); -var Source = require("./source"); -var Caml_obj = require("bs-platform/lib/js/caml_obj"); -var Caml_int64 = require("bs-platform/lib/js/caml_int64"); -var Caml_builtin_exceptions = require("bs-platform/lib/js/caml_builtin_exceptions"); - -var Code = $$Error.Make(/* module */[]); - -var Code$1 = Code[/* Error */0]; - -function stream() { - return /* record */[ - /* buf */Buffer.create(8192), - /* patches */[/* [] */0] - ]; -} - -function patch(s, pos, b) { - s[/* patches */1][0] = /* :: */[ - /* tuple */[ - pos, - b - ], - s[/* patches */1][0] - ]; - return /* () */0; -} - -function encode(m) { - var s = stream(/* () */0); - var u8 = function (i) { - var b = Char.chr(i & 255); - return Buffer.add_char(s[/* buf */0], b); - }; - var u16 = function (i) { - u8(i & 255); - return u8((i >>> 8)); - }; - var u32 = function (i) { - u16(i & 65535); - return u16((i >> 16)); - }; - var vu64 = function (_i) { - while(true) { - var i = _i; - var b = i[1] & /* lo */127 | 0; - if (Caml_int64.le(/* int64 */[ - /* hi */0, - /* lo */0 - ], i) && Caml_int64.lt(i, /* int64 */[ - /* hi */0, - /* lo */128 - ])) { - return u8(b); - } - else { - u8(b | 128); - _i = Caml_int64.lsr_(i, 7); - continue ; - - } - }; - }; - var vs64 = function (_i) { - while(true) { - var i = _i; - var b = i[1] & /* lo */127 | 0; - if (Caml_int64.le(/* int64 */[ - /* hi */-1, - /* lo */4294967232 - ], i) && Caml_int64.lt(i, /* int64 */[ - /* hi */0, - /* lo */64 - ])) { - return u8(b); - } - else { - u8(b | 128); - _i = Caml_int64.asr_(i, 7); - continue ; - - } - }; - }; - var vu32 = function (i) { - return vu64(Caml_int64.and_(Caml_int64.of_int32(i), /* int64 */[ - /* hi */0, - /* lo */4294967295 - ])); - }; - var len = function (i) { - if (i !== i) { - Curry._2(Code[/* error */2], Source.no_region, "cannot encode length with more than 32 bit"); - } - return vu32(i); - }; - var bool = function (b) { - var i = b ? 1 : 0; - return vu64(Caml_int64.and_(Caml_int64.of_int32(i), /* int64 */[ - /* hi */0, - /* lo */1 - ])); - }; - var string = function (bs) { - len(bs.length); - return Buffer.add_string(s[/* buf */0], bs); - }; - var vec = function (f, xs) { - len(List.length(xs)); - return List.iter(f, xs); - }; - var gap32 = function () { - var p = Buffer.length(s[/* buf */0]); - u32(0); - u8(0); - return p; - }; - var patch_gap32 = function (p, n) { - if (n > 268435455) { - throw [ - Caml_builtin_exceptions.assert_failure, - [ - "/usr/local/google/home/rossberg/wasm/spec/interpreter/_build/jslib/src/encode.ml", - 80, - 6 - ] - ]; - } - patch(s, p, Char.chr((n | 128) & 255)); - patch(s, p + 1 | 0, Char.chr(((n >>> 7) | 128) & 255)); - patch(s, p + 2 | 0, Char.chr(((n >>> 14) | 128) & 255)); - patch(s, p + 3 | 0, Char.chr(((n >>> 21) | 128) & 255)); - return patch(s, p + 4 | 0, Char.chr((n >>> 28) & 255)); - }; - var value_type = function (param) { - switch (param) { - case 0 : - return vs64(/* int64 */[ - /* hi */-1, - /* lo */4294967295 - ]); - case 1 : - return vs64(/* int64 */[ - /* hi */-1, - /* lo */4294967294 - ]); - case 2 : - return vs64(/* int64 */[ - /* hi */-1, - /* lo */4294967293 - ]); - case 3 : - return vs64(/* int64 */[ - /* hi */-1, - /* lo */4294967292 - ]); - - } - }; - var stack_type = function (param) { - if (param) { - if (param[1]) { - return Curry._2(Code[/* error */2], Source.no_region, "cannot encode stack type with arity > 1 (yet)"); - } - else { - return value_type(param[0]); - } - } - else { - return vs64(/* int64 */[ - /* hi */-1, - /* lo */4294967232 - ]); - } - }; - var func_type = function (param) { - vs64(/* int64 */[ - /* hi */-1, - /* lo */4294967264 - ]); - vec(value_type, param[0]); - return vec(value_type, param[1]); - }; - var limits = function (vu, param) { - var max = param[/* max */1]; - bool(+(max !== /* None */0)); - Curry._1(vu, param[/* min */0]); - return Curry._2(Lib.Option[/* app */2], vu, max); - }; - var table_type = function (param) { - vs64(/* int64 */[ - /* hi */-1, - /* lo */4294967280 - ]); - return limits(vu32, param[0]); - }; - var memory_type = function (param) { - return limits(vu32, param[0]); - }; - var global_type = function (param) { - value_type(param[0]); - var param$1 = param[1]; - if (param$1 !== 0) { - return u8(1); - } - else { - return u8(0); - } - }; - var memop = function (param) { - vu32(param[/* align */1]); - return vu32(param[/* offset */2]); - }; - var $$var = function (x) { - return vu32(x[/* it */1]); - }; - var instr = function (e) { - var match = e[/* it */1]; - if (typeof match === "number") { - switch (match) { - case 0 : - return u8(0); - case 1 : - return u8(1); - case 2 : - return u8(15); - case 3 : - return u8(26); - case 4 : - return u8(27); - case 5 : - u8(63); - return u8(0); - case 6 : - u8(64); - return u8(0); - - } - } - else { - switch (match.tag | 0) { - case 0 : - u8(2); - stack_type(match[0]); - List.iter(instr, match[1]); - return u8(11); - case 1 : - u8(3); - stack_type(match[0]); - List.iter(instr, match[1]); - return u8(11); - case 2 : - var es2 = match[2]; - u8(4); - stack_type(match[0]); - List.iter(instr, match[1]); - if (es2 !== /* [] */0) { - u8(5); - } - List.iter(instr, es2); - return u8(11); - case 3 : - u8(12); - return vu32(match[0][/* it */1]); - case 4 : - u8(13); - return vu32(match[0][/* it */1]); - case 5 : - u8(14); - vec($$var, match[0]); - return vu32(match[1][/* it */1]); - case 6 : - u8(16); - return vu32(match[0][/* it */1]); - case 7 : - u8(17); - vu32(match[0][/* it */1]); - return u8(0); - case 8 : - u8(32); - return vu32(match[0][/* it */1]); - case 9 : - u8(33); - return vu32(match[0][/* it */1]); - case 10 : - u8(34); - return vu32(match[0][/* it */1]); - case 11 : - u8(35); - return vu32(match[0][/* it */1]); - case 12 : - u8(36); - return vu32(match[0][/* it */1]); - case 13 : - var mo = match[0]; - switch (mo[/* ty */0]) { - case 0 : - var match$1 = mo[/* sz */3]; - if (match$1) { - var match$2 = match$1[0]; - switch (match$2[0]) { - case 0 : - if (match$2[1] !== 0) { - u8(45); - return memop(mo); - } - else { - u8(44); - return memop(mo); - } - case 1 : - if (match$2[1] !== 0) { - u8(47); - return memop(mo); - } - else { - u8(46); - return memop(mo); - } - case 2 : - throw [ - Caml_builtin_exceptions.assert_failure, - [ - "/usr/local/google/home/rossberg/wasm/spec/interpreter/_build/jslib/src/encode.ml", - 182, - 8 - ] - ]; - - } - } - else { - u8(40); - return memop(mo); - } - break; - case 1 : - var match$3 = mo[/* sz */3]; - if (match$3) { - var match$4 = match$3[0]; - switch (match$4[0]) { - case 0 : - if (match$4[1] !== 0) { - u8(49); - return memop(mo); - } - else { - u8(48); - return memop(mo); - } - case 1 : - if (match$4[1] !== 0) { - u8(51); - return memop(mo); - } - else { - u8(50); - return memop(mo); - } - case 2 : - if (match$4[1] !== 0) { - u8(53); - return memop(mo); - } - else { - u8(52); - return memop(mo); - } - - } - } - else { - u8(41); - return memop(mo); - } - break; - case 2 : - if (mo[/* sz */3]) { - throw [ - Caml_builtin_exceptions.assert_failure, - [ - "/usr/local/google/home/rossberg/wasm/spec/interpreter/_build/jslib/src/encode.ml", - 196, - 8 - ] - ]; - } - else { - u8(42); - return memop(mo); - } - break; - case 3 : - if (mo[/* sz */3]) { - throw [ - Caml_builtin_exceptions.assert_failure, - [ - "/usr/local/google/home/rossberg/wasm/spec/interpreter/_build/jslib/src/encode.ml", - 196, - 8 - ] - ]; - } - else { - u8(43); - return memop(mo); - } - break; - - } - break; - case 14 : - var mo$1 = match[0]; - switch (mo$1[/* ty */0]) { - case 0 : - var match$5 = mo$1[/* sz */3]; - if (match$5) { - switch (match$5[0]) { - case 0 : - u8(58); - return memop(mo$1); - case 1 : - u8(59); - return memop(mo$1); - case 2 : - throw [ - Caml_builtin_exceptions.assert_failure, - [ - "/usr/local/google/home/rossberg/wasm/spec/interpreter/_build/jslib/src/encode.ml", - 204, - 52 - ] - ]; - - } - } - else { - u8(54); - return memop(mo$1); - } - break; - case 1 : - var match$6 = mo$1[/* sz */3]; - if (match$6) { - switch (match$6[0]) { - case 0 : - u8(60); - return memop(mo$1); - case 1 : - u8(61); - return memop(mo$1); - case 2 : - u8(62); - return memop(mo$1); - - } - } - else { - u8(55); - return memop(mo$1); - } - break; - case 2 : - if (mo$1[/* sz */3]) { - throw [ - Caml_builtin_exceptions.assert_failure, - [ - "/usr/local/google/home/rossberg/wasm/spec/interpreter/_build/jslib/src/encode.ml", - 208, - 58 - ] - ]; - } - else { - u8(56); - return memop(mo$1); - } - break; - case 3 : - if (mo$1[/* sz */3]) { - throw [ - Caml_builtin_exceptions.assert_failure, - [ - "/usr/local/google/home/rossberg/wasm/spec/interpreter/_build/jslib/src/encode.ml", - 208, - 58 - ] - ]; - } - else { - u8(57); - return memop(mo$1); - } - break; - - } - break; - case 15 : - var match$7 = match[0][/* it */1]; - switch (match$7.tag | 0) { - case 0 : - u8(65); - return vs64(Caml_int64.of_int32(match$7[0])); - case 1 : - u8(66); - return vs64(match$7[0]); - case 2 : - u8(67); - return u32(Curry._1(F32.to_bits, match$7[0])); - case 3 : - u8(68); - var i = Curry._1(F64.to_bits, match$7[0]); - u32(i[1] & /* lo */4294967295 | 0); - return u32(Caml_int64.asr_(i, 32)[1] | 0); - - } - break; - case 16 : - switch (match[0].tag | 0) { - case 0 : - return u8(69); - case 1 : - return u8(80); - case 2 : - throw [ - Caml_builtin_exceptions.assert_failure, - [ - "/usr/local/google/home/rossberg/wasm/spec/interpreter/_build/jslib/src/encode.ml", - 220, - 24 - ] - ]; - case 3 : - throw [ - Caml_builtin_exceptions.assert_failure, - [ - "/usr/local/google/home/rossberg/wasm/spec/interpreter/_build/jslib/src/encode.ml", - 221, - 24 - ] - ]; - - } - break; - case 17 : - var match$8 = match[0]; - switch (match$8.tag | 0) { - case 0 : - switch (match$8[0]) { - case 0 : - return u8(70); - case 1 : - return u8(71); - case 2 : - return u8(72); - case 3 : - return u8(73); - case 4 : - return u8(74); - case 5 : - return u8(75); - case 6 : - return u8(76); - case 7 : - return u8(77); - case 8 : - return u8(78); - case 9 : - return u8(79); - - } - break; - case 1 : - switch (match$8[0]) { - case 0 : - return u8(81); - case 1 : - return u8(82); - case 2 : - return u8(83); - case 3 : - return u8(84); - case 4 : - return u8(85); - case 5 : - return u8(86); - case 6 : - return u8(87); - case 7 : - return u8(88); - case 8 : - return u8(89); - case 9 : - return u8(90); - - } - break; - case 2 : - switch (match$8[0]) { - case 0 : - return u8(91); - case 1 : - return u8(92); - case 2 : - return u8(93); - case 3 : - return u8(94); - case 4 : - return u8(95); - case 5 : - return u8(96); - - } - break; - case 3 : - switch (match$8[0]) { - case 0 : - return u8(97); - case 1 : - return u8(98); - case 2 : - return u8(99); - case 3 : - return u8(100); - case 4 : - return u8(101); - case 5 : - return u8(102); - - } - break; - - } - break; - case 18 : - var match$9 = match[0]; - switch (match$9.tag | 0) { - case 0 : - switch (match$9[0]) { - case 0 : - return u8(103); - case 1 : - return u8(104); - case 2 : - return u8(105); - - } - break; - case 1 : - switch (match$9[0]) { - case 0 : - return u8(121); - case 1 : - return u8(122); - case 2 : - return u8(123); - - } - break; - case 2 : - switch (match$9[0]) { - case 0 : - return u8(140); - case 1 : - return u8(139); - case 2 : - return u8(141); - case 3 : - return u8(142); - case 4 : - return u8(143); - case 5 : - return u8(144); - case 6 : - return u8(145); - - } - break; - case 3 : - switch (match$9[0]) { - case 0 : - return u8(154); - case 1 : - return u8(153); - case 2 : - return u8(155); - case 3 : - return u8(156); - case 4 : - return u8(157); - case 5 : - return u8(158); - case 6 : - return u8(159); - - } - break; - - } - break; - case 19 : - var match$10 = match[0]; - switch (match$10.tag | 0) { - case 0 : - switch (match$10[0]) { - case 0 : - return u8(106); - case 1 : - return u8(107); - case 2 : - return u8(108); - case 3 : - return u8(109); - case 4 : - return u8(110); - case 5 : - return u8(111); - case 6 : - return u8(112); - case 7 : - return u8(113); - case 8 : - return u8(114); - case 9 : - return u8(115); - case 10 : - return u8(116); - case 11 : - return u8(117); - case 12 : - return u8(118); - case 13 : - return u8(119); - case 14 : - return u8(120); - - } - break; - case 1 : - switch (match$10[0]) { - case 0 : - return u8(124); - case 1 : - return u8(125); - case 2 : - return u8(126); - case 3 : - return u8(127); - case 4 : - return u8(128); - case 5 : - return u8(129); - case 6 : - return u8(130); - case 7 : - return u8(131); - case 8 : - return u8(132); - case 9 : - return u8(133); - case 10 : - return u8(134); - case 11 : - return u8(135); - case 12 : - return u8(136); - case 13 : - return u8(137); - case 14 : - return u8(138); - - } - break; - case 2 : - switch (match$10[0]) { - case 0 : - return u8(146); - case 1 : - return u8(147); - case 2 : - return u8(148); - case 3 : - return u8(149); - case 4 : - return u8(150); - case 5 : - return u8(151); - case 6 : - return u8(152); - - } - break; - case 3 : - switch (match$10[0]) { - case 0 : - return u8(160); - case 1 : - return u8(161); - case 2 : - return u8(162); - case 3 : - return u8(163); - case 4 : - return u8(164); - case 5 : - return u8(165); - case 6 : - return u8(166); - - } - break; - - } - break; - case 20 : - var match$11 = match[0]; - switch (match$11.tag | 0) { - case 0 : - switch (match$11[0]) { - case 0 : - throw [ - Caml_builtin_exceptions.assert_failure, - [ - "/usr/local/google/home/rossberg/wasm/spec/interpreter/_build/jslib/src/encode.ml", - 331, - 42 - ] - ]; - case 1 : - throw [ - Caml_builtin_exceptions.assert_failure, - [ - "/usr/local/google/home/rossberg/wasm/spec/interpreter/_build/jslib/src/encode.ml", - 332, - 42 - ] - ]; - case 2 : - return u8(167); - case 3 : - return u8(168); - case 4 : - return u8(169); - case 5 : - return u8(170); - case 6 : - return u8(171); - case 7 : - return u8(188); - - } - break; - case 1 : - switch (match$11[0]) { - case 0 : - return u8(172); - case 1 : - return u8(173); - case 2 : - throw [ - Caml_builtin_exceptions.assert_failure, - [ - "/usr/local/google/home/rossberg/wasm/spec/interpreter/_build/jslib/src/encode.ml", - 342, - 39 - ] - ]; - case 3 : - return u8(174); - case 4 : - return u8(175); - case 5 : - return u8(176); - case 6 : - return u8(177); - case 7 : - return u8(189); - - } - break; - case 2 : - switch (match$11[0]) { - case 0 : - return u8(178); - case 1 : - return u8(179); - case 2 : - return u8(180); - case 3 : - return u8(181); - case 4 : - throw [ - Caml_builtin_exceptions.assert_failure, - [ - "/usr/local/google/home/rossberg/wasm/spec/interpreter/_build/jslib/src/encode.ml", - 353, - 42 - ] - ]; - case 5 : - return u8(182); - case 6 : - return u8(190); - - } - break; - case 3 : - switch (match$11[0]) { - case 0 : - return u8(183); - case 1 : - return u8(184); - case 2 : - return u8(185); - case 3 : - return u8(186); - case 4 : - return u8(187); - case 5 : - throw [ - Caml_builtin_exceptions.assert_failure, - [ - "/usr/local/google/home/rossberg/wasm/spec/interpreter/_build/jslib/src/encode.ml", - 362, - 41 - ] - ]; - case 6 : - return u8(191); - - } - break; - - } - break; - - } - } - }; - var $$const = function (c) { - List.iter(instr, c[/* it */1]); - return u8(11); - }; - var section = function (id, f, x, needed) { - if (needed) { - u8(id); - var g = gap32(/* () */0); - var p = Buffer.length(s[/* buf */0]); - Curry._1(f, x); - return patch_gap32(g, Buffer.length(s[/* buf */0]) - p | 0); - } - else { - return 0; - } - }; - var type_section = function (ts) { - return section(1, function (param) { - return vec(func_type, param); - }, ts, +(ts !== /* [] */0)); - }; - var $$import = function (im) { - var match = im[/* it */1]; - string(match[/* module_name */0]); - string(match[/* item_name */1]); - var k = match[/* ikind */2]; - var match$1 = k[/* it */1]; - switch (match$1.tag | 0) { - case 0 : - u8(0); - return vu32(match$1[0][/* it */1]); - case 1 : - u8(1); - return table_type(match$1[0]); - case 2 : - u8(2); - return memory_type(match$1[0]); - case 3 : - u8(3); - return global_type(match$1[0]); - - } - }; - var import_section = function (ims) { - return section(2, function (param) { - return vec($$import, param); - }, ims, +(ims !== /* [] */0)); - }; - var func = function (f) { - return vu32(f[/* it */1][/* ftype */0][/* it */1]); - }; - var func_section = function (fs) { - return section(3, function (param) { - return vec(func, param); - }, fs, +(fs !== /* [] */0)); - }; - var table = function (tab) { - var match = tab[/* it */1]; - return table_type(match[/* ttype */0]); - }; - var table_section = function (tabs) { - return section(4, function (param) { - return vec(table, param); - }, tabs, +(tabs !== /* [] */0)); - }; - var memory = function (mem) { - var match = mem[/* it */1]; - return memory_type(match[/* mtype */0]); - }; - var memory_section = function (mems) { - return section(5, function (param) { - return vec(memory, param); - }, mems, +(mems !== /* [] */0)); - }; - var global = function (g) { - var match = g[/* it */1]; - global_type(match[/* gtype */0]); - return $$const(match[/* value */1]); - }; - var global_section = function (gs) { - return section(6, function (param) { - return vec(global, param); - }, gs, +(gs !== /* [] */0)); - }; - var export_kind = function (k) { - var match = k[/* it */1]; - switch (match) { - case 0 : - return u8(0); - case 1 : - return u8(1); - case 2 : - return u8(2); - case 3 : - return u8(3); - - } - }; - var $$export = function (ex) { - var match = ex[/* it */1]; - string(match[/* name */0]); - export_kind(match[/* ekind */1]); - return vu32(match[/* item */2][/* it */1]); - }; - var export_section = function (exs) { - return section(7, function (param) { - return vec($$export, param); - }, exs, +(exs !== /* [] */0)); - }; - var start_section = function (xo) { - return section(8, function (param) { - return Curry._2(Lib.Option[/* app */2], $$var, param); - }, xo, +(xo !== /* None */0)); - }; - var compress = function (ts) { - var combine = function (t, ts) { - if (ts) { - var match = ts[0]; - if (Caml_obj.caml_equal(t, match[0])) { - return /* :: */[ - /* tuple */[ - t, - match[1] + 1 | 0 - ], - ts[1] - ]; - } - else { - return /* :: */[ - /* tuple */[ - t, - 1 - ], - ts - ]; - } - } - else { - return /* :: */[ - /* tuple */[ - t, - 1 - ], - ts - ]; - } - }; - return List.fold_right(combine, ts, /* [] */0); - }; - var local = function (param) { - len(param[1]); - return value_type(param[0]); - }; - var code = function (f) { - var match = f[/* it */1]; - var g = gap32(/* () */0); - var p = Buffer.length(s[/* buf */0]); - vec(local, compress(match[/* locals */1])); - List.iter(instr, match[/* body */2]); - u8(11); - return patch_gap32(g, Buffer.length(s[/* buf */0]) - p | 0); - }; - var code_section = function (fs) { - return section(10, function (param) { - return vec(code, param); - }, fs, +(fs !== /* [] */0)); - }; - var segment = function (dat, seg) { - var match = seg[/* it */1]; - vu32(match[/* index */0][/* it */1]); - $$const(match[/* offset */1]); - return Curry._1(dat, match[/* init */2]); - }; - var table_segment = function (seg) { - return segment(function (param) { - return vec($$var, param); - }, seg); - }; - var elem_section = function (elems) { - return section(9, function (param) { - return vec(table_segment, param); - }, elems, +(elems !== /* [] */0)); - }; - var memory_segment = function (seg) { - return segment(string, seg); - }; - var module_ = function (m) { - u32(1836278016); - u32(13); - type_section(m[/* it */1][/* types */0]); - import_section(m[/* it */1][/* imports */8]); - func_section(m[/* it */1][/* funcs */4]); - table_section(m[/* it */1][/* tables */2]); - memory_section(m[/* it */1][/* memories */3]); - global_section(m[/* it */1][/* globals */1]); - export_section(m[/* it */1][/* exports */9]); - start_section(m[/* it */1][/* start */5]); - elem_section(m[/* it */1][/* elems */6]); - code_section(m[/* it */1][/* funcs */4]); - var data = m[/* it */1][/* data */7]; - return section(11, function (param) { - return vec(memory_segment, param); - }, data, +(data !== /* [] */0)); - }; - module_(m); - var s$1 = s; - var bs = Buffer.to_bytes(s$1[/* buf */0]); - List.iter(function (param) { - bs[param[0]] = param[1]; - return /* () */0; - }, s$1[/* patches */1][0]); - return Bytes.to_string(bs); -} - -var version = 13; - -exports.Code = Code$1; -exports.version = version; -exports.encode = encode; -/* Code Not a pure module */ -//////// end of encode.js //////// -    return exports; -  }; - - - _registry['error'] = function() { -    let exports = {}; -//////// start of error.js //////// -// Generated by BUCKLESCRIPT VERSION 1.4.3 , PLEASE EDIT WITH CARE -'use strict'; - -var Source = require("./source"); -var Caml_exceptions = require("bs-platform/lib/js/caml_exceptions"); - -function Make() { - var $$Error = Caml_exceptions.create("Error.Make(*).Error"); - var warn = function (at, m) { - console.error(Source.string_of_region(at) + (": warning: " + m)); - return /* () */0; - }; - var error = function (at, m) { - throw [ - $$Error, - at, - m - ]; - }; - return /* module */[ - /* Error */$$Error, - /* warn */warn, - /* error */error - ]; -} - -exports.Make = Make; -/* No side effect */ -//////// end of error.js //////// -    return exports; -  }; - - - _registry['f32'] = function() { -    let exports = {}; -//////// start of f32.js //////// -// Generated by BUCKLESCRIPT VERSION 1.4.3 , PLEASE EDIT WITH CARE -'use strict'; - -var Block = require("bs-platform/lib/js/block"); -var Curry = require("bs-platform/lib/js/curry"); -var Float = require("./float"); -var Int32 = require("bs-platform/lib/js/int32"); -var Printf = require("bs-platform/lib/js/printf"); -var Caml_float = require("bs-platform/lib/js/caml_float"); -var Caml_format = require("bs-platform/lib/js/caml_format"); - -function print_nan_significand_digits(a) { - return Curry._1(Printf.sprintf(/* Format */[ - /* Int32 */Block.__(5, [ - /* Int_x */6, - /* No_padding */0, - /* No_precision */0, - /* End_of_format */0 - ]), - "%lx" - ]), Int32.abs(2139095040 ^ a)); -} - -var include = Float.Make(/* module */[ - /* pos_nan */2143289344, - /* neg_nan */-4194304, - /* caml_int32_bits_of_float */Caml_float.caml_int32_bits_of_float, - /* caml_int32_float_of_bits */Caml_float.caml_int32_float_of_bits, - /* caml_int32_of_string */Caml_format.caml_int32_of_string, - /* to_string */Int32.to_string, - /* %int32_and */function (prim, prim$1) { - return prim & prim$1; - }, - /* %int32_or */function (prim, prim$1) { - return prim | prim$1; - }, - /* %int32_xor */function (prim, prim$1) { - return prim ^ prim$1; - }, - /* min_int */Int32.min_int, - /* max_int */Int32.max_int, - /* zero */Int32.zero, - /* bare_nan */2139095040, - /* print_nan_significand_digits */print_nan_significand_digits - ]); - -var pos_nan = include[0]; - -var neg_nan = include[1]; - -var of_float = include[2]; - -var to_float = include[3]; - -var of_string = include[4]; - -var to_string = include[5]; - -var of_bits = include[6]; - -var to_bits = include[7]; - -var add = include[8]; - -var sub = include[9]; - -var mul = include[10]; - -var div = include[11]; - -var sqrt = include[12]; - -var min = include[13]; - -var max = include[14]; - -var ceil = include[15]; - -var floor = include[16]; - -var trunc = include[17]; - -var nearest = include[18]; - -var abs = include[19]; - -var neg = include[20]; - -var copysign = include[21]; - -var eq = include[22]; - -var ne = include[23]; - -var lt = include[24]; - -var le = include[25]; - -var gt = include[26]; - -var ge = include[27]; - -var zero = include[28]; - -exports.pos_nan = pos_nan; -exports.neg_nan = neg_nan; -exports.of_float = of_float; -exports.to_float = to_float; -exports.of_string = of_string; -exports.to_string = to_string; -exports.of_bits = of_bits; -exports.to_bits = to_bits; -exports.add = add; -exports.sub = sub; -exports.mul = mul; -exports.div = div; -exports.sqrt = sqrt; -exports.min = min; -exports.max = max; -exports.ceil = ceil; -exports.floor = floor; -exports.trunc = trunc; -exports.nearest = nearest; -exports.abs = abs; -exports.neg = neg; -exports.copysign = copysign; -exports.eq = eq; -exports.ne = ne; -exports.lt = lt; -exports.le = le; -exports.gt = gt; -exports.ge = ge; -exports.zero = zero; -/* include Not a pure module */ -//////// end of f32.js //////// -    return exports; -  }; - - - _registry['f64'] = function() { -    let exports = {}; -//////// start of f64.js //////// -// Generated by BUCKLESCRIPT VERSION 1.4.3 , PLEASE EDIT WITH CARE -'use strict'; - -var Block = require("bs-platform/lib/js/block"); -var Curry = require("bs-platform/lib/js/curry"); -var Float = require("./float"); -var Int64 = require("bs-platform/lib/js/int64"); -var Printf = require("bs-platform/lib/js/printf"); -var Caml_int64 = require("bs-platform/lib/js/caml_int64"); -var Caml_format = require("bs-platform/lib/js/caml_format"); - -var bare_nan = /* int64 */[ - /* hi */2146435072, - /* lo */0 -]; - -function print_nan_significand_digits(a) { - return Curry._1(Printf.sprintf(/* Format */[ - /* Int64 */Block.__(7, [ - /* Int_x */6, - /* No_padding */0, - /* No_precision */0, - /* End_of_format */0 - ]), - "%Lx" - ]), Int64.abs(/* int64 */[ - /* hi *//* hi */2146435072 ^ a[0], - /* lo */((/* lo */0 ^ a[1]) >>> 0) - ])); -} - -var include = Float.Make(/* module */[ - /* pos_nan : int64 */[ - /* hi */2146959360, - /* lo */0 - ], - /* neg_nan : int64 */[ - /* hi */-524288, - /* lo */0 - ], - /* caml_int64_bits_of_float */Caml_int64.bits_of_float, - /* caml_int64_float_of_bits */Caml_int64.float_of_bits, - /* caml_int64_of_string */Caml_format.caml_int64_of_string, - /* to_string */Int64.to_string, - /* %int64_and */function (prim, prim$1) { - return /* int64 */[ - /* hi */prim[0] & prim$1[0], - /* lo */((prim[1] & prim$1[1]) >>> 0) - ]; - }, - /* %int64_or */function (prim, prim$1) { - return /* int64 */[ - /* hi */prim[0] | prim$1[0], - /* lo */((prim[1] | prim$1[1]) >>> 0) - ]; - }, - /* %int64_xor */function (prim, prim$1) { - return /* int64 */[ - /* hi */prim[0] ^ prim$1[0], - /* lo */((prim[1] ^ prim$1[1]) >>> 0) - ]; - }, - /* min_int */Int64.min_int, - /* max_int */Int64.max_int, - /* zero */Int64.zero, - /* bare_nan */bare_nan, - /* print_nan_significand_digits */print_nan_significand_digits - ]); - -var pos_nan = include[0]; - -var neg_nan = include[1]; - -var of_float = include[2]; - -var to_float = include[3]; - -var of_string = include[4]; - -var to_string = include[5]; - -var of_bits = include[6]; - -var to_bits = include[7]; - -var add = include[8]; - -var sub = include[9]; - -var mul = include[10]; - -var div = include[11]; - -var sqrt = include[12]; - -var min = include[13]; - -var max = include[14]; - -var ceil = include[15]; - -var floor = include[16]; - -var trunc = include[17]; - -var nearest = include[18]; - -var abs = include[19]; - -var neg = include[20]; - -var copysign = include[21]; - -var eq = include[22]; - -var ne = include[23]; - -var lt = include[24]; - -var le = include[25]; - -var gt = include[26]; - -var ge = include[27]; - -var zero = include[28]; - -exports.pos_nan = pos_nan; -exports.neg_nan = neg_nan; -exports.of_float = of_float; -exports.to_float = to_float; -exports.of_string = of_string; -exports.to_string = to_string; -exports.of_bits = of_bits; -exports.to_bits = to_bits; -exports.add = add; -exports.sub = sub; -exports.mul = mul; -exports.div = div; -exports.sqrt = sqrt; -exports.min = min; -exports.max = max; -exports.ceil = ceil; -exports.floor = floor; -exports.trunc = trunc; -exports.nearest = nearest; -exports.abs = abs; -exports.neg = neg; -exports.copysign = copysign; -exports.eq = eq; -exports.ne = ne; -exports.lt = lt; -exports.le = le; -exports.gt = gt; -exports.ge = ge; -exports.zero = zero; -/* include Not a pure module */ -//////// end of f64.js //////// -    return exports; -  }; - - - _registry['float'] = function() { -    let exports = {}; -//////// start of float.js //////// -// Generated by BUCKLESCRIPT VERSION 1.4.3 , PLEASE EDIT WITH CARE -'use strict'; - -var Curry = require("bs-platform/lib/js/curry"); -var $$String = require("bs-platform/lib/js/string"); -var Caml_obj = require("bs-platform/lib/js/caml_obj"); -var Pervasives = require("bs-platform/lib/js/pervasives"); -var Caml_format = require("bs-platform/lib/js/caml_format"); -var Caml_string = require("bs-platform/lib/js/caml_string"); -var Caml_builtin_exceptions = require("bs-platform/lib/js/caml_builtin_exceptions"); - -function Make(Rep) { - var pos_nan = Rep[/* pos_nan */0]; - var neg_nan = Rep[/* neg_nan */1]; - var bare_nan = Rep[/* bare_nan */12]; - var of_float = Rep[/* bits_of_float */2]; - var to_float = Rep[/* float_of_bits */3]; - var of_bits = function (x) { - return x; - }; - var to_bits = function (x) { - return x; - }; - var is_nan = function (x) { - var xf = Curry._1(Rep[/* float_of_bits */3], x); - return +(xf !== xf); - }; - var canonicalize_nan = function (x) { - return Curry._2(Rep[/* logor */7], x, Rep[/* pos_nan */0]); - }; - var determine_binary_nan = function (x, y) { - return canonicalize_nan(is_nan(x) ? x : ( - is_nan(y) ? y : Rep[/* pos_nan */0] - )); - }; - var determine_unary_nan = function (x) { - return canonicalize_nan(is_nan(x) ? x : Rep[/* pos_nan */0]); - }; - var binary = function (x, op, y) { - var xf = Curry._1(to_float, x); - var yf = Curry._1(to_float, y); - var t = Curry._2(op, xf, yf); - if (t === t) { - return Curry._1(of_float, t); - } - else { - return determine_binary_nan(x, y); - } - }; - var unary = function (op, x) { - var t = Curry._1(op, Curry._1(to_float, x)); - if (t === t) { - return Curry._1(of_float, t); - } - else { - return determine_unary_nan(x); - } - }; - var zero = Curry._1(of_float, 0.0); - var add = function (x, y) { - return binary(x, function (prim, prim$1) { - return prim + prim$1; - }, y); - }; - var sub = function (x, y) { - return binary(x, function (prim, prim$1) { - return prim - prim$1; - }, y); - }; - var mul = function (x, y) { - return binary(x, function (prim, prim$1) { - return prim * prim$1; - }, y); - }; - var div = function (x, y) { - return binary(x, function (prim, prim$1) { - return prim / prim$1; - }, y); - }; - var sqrt = function (x) { - return unary(function (prim) { - return Math.sqrt(prim); - }, x); - }; - var ceil = function (x) { - return unary(function (prim) { - return Math.ceil(prim); - }, x); - }; - var floor = function (x) { - return unary(function (prim) { - return Math.floor(prim); - }, x); - }; - var trunc = function (x) { - var xf = Curry._1(to_float, x); - if (xf === 0.0) { - return x; - } - else { - var f = xf < 0.0 ? Math.ceil(xf) : Math.floor(xf); - var result = Curry._1(of_float, f); - if (is_nan(result)) { - return determine_unary_nan(result); - } - else { - return result; - } - } - }; - var nearest = function (x) { - var xf = Curry._1(to_float, x); - if (xf === 0.0) { - return x; - } - else { - var u = Math.ceil(xf); - var d = Math.floor(xf); - var um = Math.abs(xf - u); - var dm = Math.abs(xf - d); - var h = u / 2; - var u_or_d = +(um < dm || um === dm && Math.floor(h) === h); - var f = u_or_d ? u : d; - var result = Curry._1(of_float, f); - if (is_nan(result)) { - return determine_unary_nan(result); - } - else { - return result; - } - } - }; - var min = function (x, y) { - var xf = Curry._1(to_float, x); - var yf = Curry._1(to_float, y); - if (xf === yf) { - return Curry._2(Rep[/* logor */7], x, y); - } - else if (xf < yf) { - return x; - } - else if (xf > yf) { - return y; - } - else { - return determine_binary_nan(x, y); - } - }; - var max = function (x, y) { - var xf = Curry._1(to_float, x); - var yf = Curry._1(to_float, y); - if (xf === yf) { - return Curry._2(Rep[/* logand */6], x, y); - } - else if (xf > yf) { - return x; - } - else if (xf < yf) { - return y; - } - else { - return determine_binary_nan(x, y); - } - }; - var abs = function (x) { - return Curry._2(Rep[/* logand */6], x, Rep[/* max_int */10]); - }; - var neg = function (x) { - return Curry._2(Rep[/* logxor */8], x, Rep[/* min_int */9]); - }; - var copysign = function (x, y) { - return Curry._2(Rep[/* logor */7], abs(x), Curry._2(Rep[/* logand */6], y, Rep[/* min_int */9])); - }; - var eq = function (x, y) { - return +(Curry._1(to_float, x) === Curry._1(to_float, y)); - }; - var ne = function (x, y) { - return +(Curry._1(to_float, x) !== Curry._1(to_float, y)); - }; - var lt = function (x, y) { - return +(Curry._1(to_float, x) < Curry._1(to_float, y)); - }; - var gt = function (x, y) { - return +(Curry._1(to_float, x) > Curry._1(to_float, y)); - }; - var le = function (x, y) { - return +(Curry._1(to_float, x) <= Curry._1(to_float, y)); - }; - var ge = function (x, y) { - return +(Curry._1(to_float, x) >= Curry._1(to_float, y)); - }; - var of_signless_string = function (x, len) { - if (x !== "nan" && len > 6 && $$String.sub(x, 0, 6) === "nan:0x") { - var s = Curry._1(Rep[/* of_string */4], $$String.sub(x, 4, len - 4 | 0)); - if (Caml_obj.caml_equal(s, Rep[/* zero */11])) { - throw [ - Caml_builtin_exceptions.failure, - "nan payload must not be zero" - ]; - } - else if (Caml_obj.caml_notequal(Curry._2(Rep[/* logand */6], s, bare_nan), Rep[/* zero */11])) { - throw [ - Caml_builtin_exceptions.failure, - "nan payload must not overlap with exponent bits" - ]; - } - else if (Caml_obj.caml_lessthan(s, Rep[/* zero */11])) { - throw [ - Caml_builtin_exceptions.failure, - "nan payload must not overlap with sign bit" - ]; - } - else { - return Curry._2(Rep[/* logor */7], s, bare_nan); - } - } - else { - return Curry._1(of_float, Caml_format.caml_float_of_string(x)); - } - }; - var of_string = function (x) { - var len = x.length; - if (len > 0 && Caml_string.get(x, 0) === /* "-" */45) { - return neg(of_signless_string($$String.sub(x, 1, len - 1 | 0), len - 1 | 0)); - } - else if (len > 0 && Caml_string.get(x, 0) === /* "+" */43) { - return of_signless_string($$String.sub(x, 1, len - 1 | 0), len - 1 | 0); - } - else { - return of_signless_string(x, len); - } - }; - var to_string = function (x) { - var a = abs(x); - return ( - Caml_obj.caml_lessthan(x, Rep[/* zero */11]) ? "-" : "" - ) + ( - is_nan(a) ? "nan:0x" + Curry._1(Rep[/* print_nan_significand_digits */13], a) : Pervasives.string_of_float(Curry._1(to_float, a)) - ); - }; - return /* module */[ - /* pos_nan */pos_nan, - /* neg_nan */neg_nan, - /* of_float */of_float, - /* to_float */to_float, - /* of_string */of_string, - /* to_string */to_string, - /* of_bits */of_bits, - /* to_bits */to_bits, - /* add */add, - /* sub */sub, - /* mul */mul, - /* div */div, - /* sqrt */sqrt, - /* min */min, - /* max */max, - /* ceil */ceil, - /* floor */floor, - /* trunc */trunc, - /* nearest */nearest, - /* abs */abs, - /* neg */neg, - /* copysign */copysign, - /* eq */eq, - /* ne */ne, - /* lt */lt, - /* le */le, - /* gt */gt, - /* ge */ge, - /* zero */zero - ]; -} - -exports.Make = Make; -/* No side effect */ -//////// end of float.js //////// -    return exports; -  }; - - - _registry['format'] = function() { -    let exports = {}; -//////// start of format.js //////// -'use strict'; - -var Block = require("./block"); -var Bytes = require("./bytes"); -var Curry = require("./curry"); -var Buffer = require("./buffer"); -var $$String = require("./string"); -var Caml_io = require("./caml_io"); -var Caml_obj = require("./caml_obj"); -var Pervasives = require("./pervasives"); -var Caml_string = require("./caml_string"); -var Caml_exceptions = require("./caml_exceptions"); -var CamlinternalFormat = require("./camlinternalFormat"); -var Caml_builtin_exceptions = require("./caml_builtin_exceptions"); - -function add_queue(x, q) { - var c = /* Cons */[/* record */[ - /* head */x, - /* tail : Nil */0 - ]]; - var match = q[/* insert */0]; - if (match) { - q[/* insert */0] = c; - match[0][/* tail */1] = c; - return /* () */0; - } - else { - q[/* insert */0] = c; - q[/* body */1] = c; - return /* () */0; - } -} - -var Empty_queue = Caml_exceptions.create("Format.Empty_queue"); - -function peek_queue(param) { - var match = param[/* body */1]; - if (match) { - return match[0][/* head */0]; - } - else { - throw Empty_queue; - } -} - -function take_queue(q) { - var match = q[/* body */1]; - if (match) { - var match$1 = match[0]; - var x = match$1[/* head */0]; - var tl = match$1[/* tail */1]; - q[/* body */1] = tl; - if (!tl) { - q[/* insert */0] = /* Nil */0; - } - return x; - } - else { - throw Empty_queue; - } -} - -function pp_enqueue(state, token) { - state[/* pp_right_total */12] = state[/* pp_right_total */12] + token[/* length */2] | 0; - return add_queue(token, state[/* pp_queue */26]); -} - -function pp_clear_queue(state) { - state[/* pp_left_total */11] = 1; - state[/* pp_right_total */12] = 1; - var q = state[/* pp_queue */26]; - q[/* insert */0] = /* Nil */0; - q[/* body */1] = /* Nil */0; - return /* () */0; -} - -function pp_output_string(state, s) { - return Curry._3(state[/* pp_out_string */16], s, 0, s.length); -} - -function break_new_line(state, offset, width) { - Curry._1(state[/* pp_out_newline */18], /* () */0); - state[/* pp_is_new_line */10] = /* true */1; - var indent = (state[/* pp_margin */5] - width | 0) + offset | 0; - var real_indent = Pervasives.min(state[/* pp_max_indent */7], indent); - state[/* pp_current_indent */9] = real_indent; - state[/* pp_space_left */8] = state[/* pp_margin */5] - state[/* pp_current_indent */9] | 0; - return Curry._1(state[/* pp_out_spaces */19], state[/* pp_current_indent */9]); -} - -function break_same_line(state, width) { - state[/* pp_space_left */8] = state[/* pp_space_left */8] - width | 0; - return Curry._1(state[/* pp_out_spaces */19], width); -} - -function pp_force_break_line(state) { - var match = state[/* pp_format_stack */1]; - if (match) { - var match$1 = match[0]; - var width = match$1[1]; - var bl_ty = match$1[0]; - if (width > state[/* pp_space_left */8] && bl_ty !== 0 && bl_ty < 5) { - return break_new_line(state, 0, width); - } - else { - return 0; - } - } - else { - return Curry._1(state[/* pp_out_newline */18], /* () */0); - } -} - -function format_pp_token(state, size, param) { - if (typeof param === "number") { - switch (param) { - case 0 : - var match = state[/* pp_tbox_stack */2]; - if (match) { - var tabs = match[0][0]; - var add_tab = function (n, ls) { - if (ls) { - var x = ls[0]; - if (Caml_obj.caml_lessthan(n, x)) { - return /* :: */[ - n, - ls - ]; - } - else { - return /* :: */[ - x, - add_tab(n, ls[1]) - ]; - } - } - else { - return /* :: */[ - n, - /* [] */0 - ]; - } - }; - tabs[0] = add_tab(state[/* pp_margin */5] - state[/* pp_space_left */8] | 0, tabs[0]); - return /* () */0; - } - else { - return /* () */0; - } - break; - case 1 : - var match$1 = state[/* pp_format_stack */1]; - if (match$1) { - state[/* pp_format_stack */1] = match$1[1]; - return /* () */0; - } - else { - return /* () */0; - } - case 2 : - var match$2 = state[/* pp_tbox_stack */2]; - if (match$2) { - state[/* pp_tbox_stack */2] = match$2[1]; - return /* () */0; - } - else { - return /* () */0; - } - case 3 : - var match$3 = state[/* pp_format_stack */1]; - if (match$3) { - return break_new_line(state, 0, match$3[0][1]); - } - else { - return Curry._1(state[/* pp_out_newline */18], /* () */0); - } - case 4 : - if (state[/* pp_current_indent */9] !== (state[/* pp_margin */5] - state[/* pp_space_left */8] | 0)) { - var state$1 = state; - var match$4 = take_queue(state$1[/* pp_queue */26]); - var size$1 = match$4[/* elem_size */0]; - state$1[/* pp_left_total */11] = state$1[/* pp_left_total */11] - match$4[/* length */2] | 0; - state$1[/* pp_space_left */8] = state$1[/* pp_space_left */8] + size$1 | 0; - return /* () */0; - } - else { - return 0; - } - case 5 : - var match$5 = state[/* pp_mark_stack */4]; - if (match$5) { - var marker = Curry._1(state[/* pp_mark_close_tag */23], match$5[0]); - pp_output_string(state, marker); - state[/* pp_mark_stack */4] = match$5[1]; - return /* () */0; - } - else { - return /* () */0; - } - break; - - } - } - else { - switch (param.tag | 0) { - case 0 : - state[/* pp_space_left */8] = state[/* pp_space_left */8] - size | 0; - pp_output_string(state, param[0]); - state[/* pp_is_new_line */10] = /* false */0; - return /* () */0; - case 1 : - var off = param[1]; - var n = param[0]; - var match$6 = state[/* pp_format_stack */1]; - if (match$6) { - var match$7 = match$6[0]; - var width = match$7[1]; - switch (match$7[0]) { - case 1 : - case 2 : - return break_new_line(state, off, width); - case 3 : - if (size > state[/* pp_space_left */8]) { - return break_new_line(state, off, width); - } - else { - return break_same_line(state, n); - } - case 4 : - if (state[/* pp_is_new_line */10] || !(size > state[/* pp_space_left */8] || state[/* pp_current_indent */9] > ((state[/* pp_margin */5] - width | 0) + off | 0))) { - return break_same_line(state, n); - } - else { - return break_new_line(state, off, width); - } - case 0 : - case 5 : - return break_same_line(state, n); - - } - } - else { - return /* () */0; - } - break; - case 2 : - var insertion_point = state[/* pp_margin */5] - state[/* pp_space_left */8] | 0; - var match$8 = state[/* pp_tbox_stack */2]; - if (match$8) { - var tabs$1 = match$8[0][0]; - var find = function (n, _param) { - while(true) { - var param = _param; - if (param) { - var x = param[0]; - if (Caml_obj.caml_greaterequal(x, n)) { - return x; - } - else { - _param = param[1]; - continue ; - - } - } - else { - throw Caml_builtin_exceptions.not_found; - } - }; - }; - var match$9 = tabs$1[0]; - var tab; - if (match$9) { - try { - tab = find(insertion_point, tabs$1[0]); - } - catch (exn){ - if (exn === Caml_builtin_exceptions.not_found) { - tab = match$9[0]; - } - else { - throw exn; - } - } - } - else { - tab = insertion_point; - } - var offset = tab - insertion_point | 0; - if (offset >= 0) { - return break_same_line(state, offset + param[0] | 0); - } - else { - return break_new_line(state, tab + param[1] | 0, state[/* pp_margin */5]); - } - } - else { - return /* () */0; - } - break; - case 3 : - var ty = param[1]; - var insertion_point$1 = state[/* pp_margin */5] - state[/* pp_space_left */8] | 0; - if (insertion_point$1 > state[/* pp_max_indent */7]) { - pp_force_break_line(state); - } - var offset$1 = state[/* pp_space_left */8] - param[0] | 0; - var bl_type = ty !== 1 ? ( - size > state[/* pp_space_left */8] ? ty : /* Pp_fits */5 - ) : /* Pp_vbox */1; - state[/* pp_format_stack */1] = /* :: */[ - /* Format_elem */[ - bl_type, - offset$1 - ], - state[/* pp_format_stack */1] - ]; - return /* () */0; - case 4 : - state[/* pp_tbox_stack */2] = /* :: */[ - param[0], - state[/* pp_tbox_stack */2] - ]; - return /* () */0; - case 5 : - var tag_name = param[0]; - var marker$1 = Curry._1(state[/* pp_mark_open_tag */22], tag_name); - pp_output_string(state, marker$1); - state[/* pp_mark_stack */4] = /* :: */[ - tag_name, - state[/* pp_mark_stack */4] - ]; - return /* () */0; - - } - } -} - -function advance_left(state) { - try { - var state$1 = state; - while(true) { - var match = peek_queue(state$1[/* pp_queue */26]); - var size = match[/* elem_size */0]; - if (size < 0 && (state$1[/* pp_right_total */12] - state$1[/* pp_left_total */11] | 0) < state$1[/* pp_space_left */8]) { - return 0; - } - else { - take_queue(state$1[/* pp_queue */26]); - format_pp_token(state$1, size < 0 ? 1000000010 : size, match[/* token */1]); - state$1[/* pp_left_total */11] = match[/* length */2] + state$1[/* pp_left_total */11] | 0; - continue ; - - } - }; - } - catch (exn){ - if (exn === Empty_queue) { - return /* () */0; - } - else { - throw exn; - } - } -} - -function enqueue_advance(state, tok) { - pp_enqueue(state, tok); - return advance_left(state); -} - -function enqueue_string_as(state, size, s) { - return enqueue_advance(state, /* record */[ - /* elem_size */size, - /* token : Pp_text */Block.__(0, [s]), - /* length */size - ]); -} - -var q_elem = /* record */[ - /* elem_size */-1, - /* token : Pp_text */Block.__(0, [""]), - /* length */0 -]; - -var scan_stack_bottom_000 = /* Scan_elem */[ - -1, - q_elem -]; - -var scan_stack_bottom = /* :: */[ - scan_stack_bottom_000, - /* [] */0 -]; - -function set_size(state, ty) { - var match = state[/* pp_scan_stack */0]; - if (match) { - var match$1 = match[0]; - var queue_elem = match$1[1]; - var size = queue_elem[/* elem_size */0]; - var t = match[1]; - if (match$1[0] < state[/* pp_left_total */11]) { - state[/* pp_scan_stack */0] = scan_stack_bottom; - return /* () */0; - } - else { - var exit = 0; - var $js = queue_elem[/* token */1]; - if (typeof $js === "number") { - return /* () */0; - } - else { - switch ($js.tag | 0) { - case 1 : - case 2 : - exit = 1; - break; - case 3 : - if (ty) { - return 0; - } - else { - queue_elem[/* elem_size */0] = state[/* pp_right_total */12] + size | 0; - state[/* pp_scan_stack */0] = t; - return /* () */0; - } - default: - return /* () */0; - } - } - if (exit === 1) { - if (ty) { - queue_elem[/* elem_size */0] = state[/* pp_right_total */12] + size | 0; - state[/* pp_scan_stack */0] = t; - return /* () */0; - } - else { - return 0; - } - } - - } - } - else { - return /* () */0; - } -} - -function scan_push(state, b, tok) { - pp_enqueue(state, tok); - if (b) { - set_size(state, /* true */1); - } - state[/* pp_scan_stack */0] = /* :: */[ - /* Scan_elem */[ - state[/* pp_right_total */12], - tok - ], - state[/* pp_scan_stack */0] - ]; - return /* () */0; -} - -function pp_open_box_gen(state, indent, br_ty) { - state[/* pp_curr_depth */13] = state[/* pp_curr_depth */13] + 1 | 0; - if (state[/* pp_curr_depth */13] < state[/* pp_max_boxes */14]) { - var elem = /* record */[ - /* elem_size */-state[/* pp_right_total */12] | 0, - /* token : Pp_begin */Block.__(3, [ - indent, - br_ty - ]), - /* length */0 - ]; - return scan_push(state, /* false */0, elem); - } - else if (state[/* pp_curr_depth */13] === state[/* pp_max_boxes */14]) { - var state$1 = state; - var s = state[/* pp_ellipsis */15]; - var len = s.length; - return enqueue_string_as(state$1, len, s); - } - else { - return 0; - } -} - -function pp_close_box(state, _) { - if (state[/* pp_curr_depth */13] > 1) { - if (state[/* pp_curr_depth */13] < state[/* pp_max_boxes */14]) { - pp_enqueue(state, /* record */[ - /* elem_size */0, - /* token : Pp_end */1, - /* length */0 - ]); - set_size(state, /* true */1); - set_size(state, /* false */0); - } - state[/* pp_curr_depth */13] = state[/* pp_curr_depth */13] - 1 | 0; - return /* () */0; - } - else { - return 0; - } -} - -function pp_open_tag(state, tag_name) { - if (state[/* pp_print_tags */20]) { - state[/* pp_tag_stack */3] = /* :: */[ - tag_name, - state[/* pp_tag_stack */3] - ]; - Curry._1(state[/* pp_print_open_tag */24], tag_name); - } - if (state[/* pp_mark_tags */21]) { - return pp_enqueue(state, /* record */[ - /* elem_size */0, - /* token : Pp_open_tag */Block.__(5, [tag_name]), - /* length */0 - ]); - } - else { - return 0; - } -} - -function pp_close_tag(state, _) { - if (state[/* pp_mark_tags */21]) { - pp_enqueue(state, /* record */[ - /* elem_size */0, - /* token : Pp_close_tag */5, - /* length */0 - ]); - } - if (state[/* pp_print_tags */20]) { - var match = state[/* pp_tag_stack */3]; - if (match) { - Curry._1(state[/* pp_print_close_tag */25], match[0]); - state[/* pp_tag_stack */3] = match[1]; - return /* () */0; - } - else { - return /* () */0; - } - } - else { - return 0; - } -} - -function pp_set_print_tags(state, b) { - state[/* pp_print_tags */20] = b; - return /* () */0; -} - -function pp_set_mark_tags(state, b) { - state[/* pp_mark_tags */21] = b; - return /* () */0; -} - -function pp_get_print_tags(state, _) { - return state[/* pp_print_tags */20]; -} - -function pp_get_mark_tags(state, _) { - return state[/* pp_mark_tags */21]; -} - -function pp_set_tags(state, b) { - state[/* pp_print_tags */20] = b; - state[/* pp_mark_tags */21] = b; - return /* () */0; -} - -function pp_get_formatter_tag_functions(state, _) { - return /* record */[ - /* mark_open_tag */state[/* pp_mark_open_tag */22], - /* mark_close_tag */state[/* pp_mark_close_tag */23], - /* print_open_tag */state[/* pp_print_open_tag */24], - /* print_close_tag */state[/* pp_print_close_tag */25] - ]; -} - -function pp_set_formatter_tag_functions(state, param) { - state[/* pp_mark_open_tag */22] = param[/* mark_open_tag */0]; - state[/* pp_mark_close_tag */23] = param[/* mark_close_tag */1]; - state[/* pp_print_open_tag */24] = param[/* print_open_tag */2]; - state[/* pp_print_close_tag */25] = param[/* print_close_tag */3]; - return /* () */0; -} - -function pp_rinit(state) { - pp_clear_queue(state); - state[/* pp_scan_stack */0] = scan_stack_bottom; - state[/* pp_format_stack */1] = /* [] */0; - state[/* pp_tbox_stack */2] = /* [] */0; - state[/* pp_tag_stack */3] = /* [] */0; - state[/* pp_mark_stack */4] = /* [] */0; - state[/* pp_current_indent */9] = 0; - state[/* pp_curr_depth */13] = 0; - state[/* pp_space_left */8] = state[/* pp_margin */5]; - return pp_open_box_gen(state, 0, /* Pp_hovbox */3); -} - -function pp_flush_queue(state, b) { - while(state[/* pp_curr_depth */13] > 1) { - pp_close_box(state, /* () */0); - }; - state[/* pp_right_total */12] = 1000000010; - advance_left(state); - if (b) { - Curry._1(state[/* pp_out_newline */18], /* () */0); - } - return pp_rinit(state); -} - -function pp_print_as_size(state, size, s) { - if (state[/* pp_curr_depth */13] < state[/* pp_max_boxes */14]) { - return enqueue_string_as(state, size, s); - } - else { - return 0; - } -} - -var pp_print_as = pp_print_as_size; - -function pp_print_string(state, s) { - return pp_print_as(state, s.length, s); -} - -function pp_print_int(state, i) { - return pp_print_string(state, "" + i); -} - -function pp_print_float(state, f) { - return pp_print_string(state, Pervasives.string_of_float(f)); -} - -function pp_print_bool(state, b) { - return pp_print_string(state, b ? "true" : "false"); -} - -function pp_print_char(state, c) { - return pp_print_as(state, 1, Caml_string.bytes_to_string(Bytes.make(1, c))); -} - -function pp_open_hbox(state, _) { - return pp_open_box_gen(state, 0, /* Pp_hbox */0); -} - -function pp_open_vbox(state, indent) { - return pp_open_box_gen(state, indent, /* Pp_vbox */1); -} - -function pp_open_hvbox(state, indent) { - return pp_open_box_gen(state, indent, /* Pp_hvbox */2); -} - -function pp_open_hovbox(state, indent) { - return pp_open_box_gen(state, indent, /* Pp_hovbox */3); -} - -function pp_open_box(state, indent) { - return pp_open_box_gen(state, indent, /* Pp_box */4); -} - -function pp_print_newline(state, _) { - pp_flush_queue(state, /* true */1); - return Curry._1(state[/* pp_out_flush */17], /* () */0); -} - -function pp_print_flush(state, _) { - pp_flush_queue(state, /* false */0); - return Curry._1(state[/* pp_out_flush */17], /* () */0); -} - -function pp_force_newline(state, _) { - if (state[/* pp_curr_depth */13] < state[/* pp_max_boxes */14]) { - return enqueue_advance(state, /* record */[ - /* elem_size */0, - /* token : Pp_newline */3, - /* length */0 - ]); - } - else { - return 0; - } -} - -function pp_print_if_newline(state, _) { - if (state[/* pp_curr_depth */13] < state[/* pp_max_boxes */14]) { - return enqueue_advance(state, /* record */[ - /* elem_size */0, - /* token : Pp_if_newline */4, - /* length */0 - ]); - } - else { - return 0; - } -} - -function pp_print_break(state, width, offset) { - if (state[/* pp_curr_depth */13] < state[/* pp_max_boxes */14]) { - var elem = /* record */[ - /* elem_size */-state[/* pp_right_total */12] | 0, - /* token : Pp_break */Block.__(1, [ - width, - offset - ]), - /* length */width - ]; - return scan_push(state, /* true */1, elem); - } - else { - return 0; - } -} - -function pp_print_space(state, _) { - return pp_print_break(state, 1, 0); -} - -function pp_print_cut(state, _) { - return pp_print_break(state, 0, 0); -} - -function pp_open_tbox(state, _) { - state[/* pp_curr_depth */13] = state[/* pp_curr_depth */13] + 1 | 0; - if (state[/* pp_curr_depth */13] < state[/* pp_max_boxes */14]) { - var elem = /* record */[ - /* elem_size */0, - /* token : Pp_tbegin */Block.__(4, [/* Pp_tbox */[[/* [] */0]]]), - /* length */0 - ]; - return enqueue_advance(state, elem); - } - else { - return 0; - } -} - -function pp_close_tbox(state, _) { - if (state[/* pp_curr_depth */13] > 1) { - if (state[/* pp_curr_depth */13] < state[/* pp_max_boxes */14]) { - var elem = /* record */[ - /* elem_size */0, - /* token : Pp_tend */2, - /* length */0 - ]; - enqueue_advance(state, elem); - state[/* pp_curr_depth */13] = state[/* pp_curr_depth */13] - 1 | 0; - return /* () */0; - } - else { - return 0; - } - } - else { - return 0; - } -} - -function pp_print_tbreak(state, width, offset) { - if (state[/* pp_curr_depth */13] < state[/* pp_max_boxes */14]) { - var elem = /* record */[ - /* elem_size */-state[/* pp_right_total */12] | 0, - /* token : Pp_tbreak */Block.__(2, [ - width, - offset - ]), - /* length */width - ]; - return scan_push(state, /* true */1, elem); - } - else { - return 0; - } -} - -function pp_print_tab(state, _) { - return pp_print_tbreak(state, 0, 0); -} - -function pp_set_tab(state, _) { - if (state[/* pp_curr_depth */13] < state[/* pp_max_boxes */14]) { - var elem = /* record */[ - /* elem_size */0, - /* token : Pp_stab */0, - /* length */0 - ]; - return enqueue_advance(state, elem); - } - else { - return 0; - } -} - -function pp_print_list(_$staropt$star, pp_v, ppf, _param) { - while(true) { - var param = _param; - var $staropt$star = _$staropt$star; - var pp_sep = $staropt$star ? $staropt$star[0] : pp_print_cut; - if (param) { - var vs = param[1]; - var v = param[0]; - if (vs) { - Curry._2(pp_v, ppf, v); - Curry._2(pp_sep, ppf, /* () */0); - _param = vs; - _$staropt$star = /* Some */[pp_sep]; - continue ; - - } - else { - return Curry._2(pp_v, ppf, v); - } - } - else { - return /* () */0; - } - }; -} - -function pp_print_text(ppf, s) { - var len = s.length; - var left = [0]; - var right = [0]; - var flush = function () { - pp_print_string(ppf, $$String.sub(s, left[0], right[0] - left[0] | 0)); - right[0] = right[0] + 1 | 0; - left[0] = right[0]; - return /* () */0; - }; - while(right[0] !== len) { - var match = Caml_string.get(s, right[0]); - if (match !== 10) { - if (match !== 32) { - right[0] = right[0] + 1 | 0; - } - else { - flush(/* () */0); - pp_print_break(ppf, 1, 0); - } - } - else { - flush(/* () */0); - pp_force_newline(ppf, /* () */0); - } - }; - if (left[0] !== len) { - return flush(/* () */0); - } - else { - return 0; - } -} - -function pp_set_max_boxes(state, n) { - if (n > 1) { - state[/* pp_max_boxes */14] = n; - return /* () */0; - } - else { - return 0; - } -} - -function pp_get_max_boxes(state, _) { - return state[/* pp_max_boxes */14]; -} - -function pp_over_max_boxes(state, _) { - return +(state[/* pp_curr_depth */13] === state[/* pp_max_boxes */14]); -} - -function pp_set_ellipsis_text(state, s) { - state[/* pp_ellipsis */15] = s; - return /* () */0; -} - -function pp_get_ellipsis_text(state, _) { - return state[/* pp_ellipsis */15]; -} - -function pp_limit(n) { - if (n < 1000000010) { - return n; - } - else { - return 1000000009; - } -} - -function pp_set_max_indent(state, n) { - var state$1 = state; - var n$1 = state[/* pp_margin */5] - n | 0; - if (n$1 >= 1) { - var n$2 = pp_limit(n$1); - state$1[/* pp_min_space_left */6] = n$2; - state$1[/* pp_max_indent */7] = state$1[/* pp_margin */5] - state$1[/* pp_min_space_left */6] | 0; - return pp_rinit(state$1); - } - else { - return 0; - } -} - -function pp_get_max_indent(state, _) { - return state[/* pp_max_indent */7]; -} - -function pp_set_margin(state, n) { - if (n >= 1) { - var n$1 = pp_limit(n); - state[/* pp_margin */5] = n$1; - var new_max_indent = state[/* pp_max_indent */7] <= state[/* pp_margin */5] ? state[/* pp_max_indent */7] : Pervasives.max(Pervasives.max(state[/* pp_margin */5] - state[/* pp_min_space_left */6] | 0, state[/* pp_margin */5] / 2 | 0), 1); - return pp_set_max_indent(state, new_max_indent); - } - else { - return 0; - } -} - -function pp_get_margin(state, _) { - return state[/* pp_margin */5]; -} - -function pp_set_formatter_out_functions(state, param) { - state[/* pp_out_string */16] = param[/* out_string */0]; - state[/* pp_out_flush */17] = param[/* out_flush */1]; - state[/* pp_out_newline */18] = param[/* out_newline */2]; - state[/* pp_out_spaces */19] = param[/* out_spaces */3]; - return /* () */0; -} - -function pp_get_formatter_out_functions(state, _) { - return /* record */[ - /* out_string */state[/* pp_out_string */16], - /* out_flush */state[/* pp_out_flush */17], - /* out_newline */state[/* pp_out_newline */18], - /* out_spaces */state[/* pp_out_spaces */19] - ]; -} - -function pp_set_formatter_output_functions(state, f, g) { - state[/* pp_out_string */16] = f; - state[/* pp_out_flush */17] = g; - return /* () */0; -} - -function pp_get_formatter_output_functions(state, _) { - return /* tuple */[ - state[/* pp_out_string */16], - state[/* pp_out_flush */17] - ]; -} - -function pp_set_all_formatter_output_functions(state, f, g, h, i) { - pp_set_formatter_output_functions(state, f, g); - state[/* pp_out_newline */18] = h; - state[/* pp_out_spaces */19] = i; - return /* () */0; -} - -function pp_get_all_formatter_output_functions(state, _) { - return /* tuple */[ - state[/* pp_out_string */16], - state[/* pp_out_flush */17], - state[/* pp_out_newline */18], - state[/* pp_out_spaces */19] - ]; -} - -function display_newline(state, _) { - return Curry._3(state[/* pp_out_string */16], "\n", 0, 1); -} - -var blank_line = Caml_string.bytes_to_string(Bytes.make(80, /* " " */32)); - -function display_blanks(state, _n) { - while(true) { - var n = _n; - if (n > 0) { - if (n <= 80) { - return Curry._3(state[/* pp_out_string */16], blank_line, 0, n); - } - else { - Curry._3(state[/* pp_out_string */16], blank_line, 0, 80); - _n = n - 80 | 0; - continue ; - - } - } - else { - return 0; - } - }; -} - -function pp_set_formatter_out_channel(state, os) { - state[/* pp_out_string */16] = function (param, param$1, param$2) { - return Pervasives.output_substring(os, param, param$1, param$2); - }; - state[/* pp_out_flush */17] = function () { - return Caml_io.caml_ml_flush(os); - }; - state[/* pp_out_newline */18] = function (param) { - return display_newline(state, param); - }; - state[/* pp_out_spaces */19] = function (param) { - return display_blanks(state, param); - }; - return /* () */0; -} - -function default_pp_mark_open_tag(s) { - return "<" + (s + ">"); -} - -function default_pp_mark_close_tag(s) { - return ""); -} - -function default_pp_print_open_tag() { - return /* () */0; -} - -function default_pp_print_close_tag() { - return /* () */0; -} - -function pp_make_formatter(f, g, h, i) { - var pp_q = /* record */[ - /* insert : Nil */0, - /* body : Nil */0 - ]; - var sys_tok = /* record */[ - /* elem_size */-1, - /* token : Pp_begin */Block.__(3, [ - 0, - /* Pp_hovbox */3 - ]), - /* length */0 - ]; - add_queue(sys_tok, pp_q); - var sys_scan_stack_000 = /* Scan_elem */[ - 1, - sys_tok - ]; - var sys_scan_stack = /* :: */[ - sys_scan_stack_000, - scan_stack_bottom - ]; - return /* record */[ - /* pp_scan_stack */sys_scan_stack, - /* pp_format_stack : [] */0, - /* pp_tbox_stack : [] */0, - /* pp_tag_stack : [] */0, - /* pp_mark_stack : [] */0, - /* pp_margin */78, - /* pp_min_space_left */10, - /* pp_max_indent */68, - /* pp_space_left */78, - /* pp_current_indent */0, - /* pp_is_new_line : true */1, - /* pp_left_total */1, - /* pp_right_total */1, - /* pp_curr_depth */1, - /* pp_max_boxes */Pervasives.max_int, - /* pp_ellipsis */".", - /* pp_out_string */f, - /* pp_out_flush */g, - /* pp_out_newline */h, - /* pp_out_spaces */i, - /* pp_print_tags : false */0, - /* pp_mark_tags : false */0, - /* pp_mark_open_tag */default_pp_mark_open_tag, - /* pp_mark_close_tag */default_pp_mark_close_tag, - /* pp_print_open_tag */default_pp_print_open_tag, - /* pp_print_close_tag */default_pp_print_close_tag, - /* pp_queue */pp_q - ]; -} - -function make_formatter(output, flush) { - var ppf = pp_make_formatter(output, flush, function () { - return /* () */0; - }, function () { - return /* () */0; - }); - ppf[/* pp_out_newline */18] = function (param) { - return display_newline(ppf, param); - }; - ppf[/* pp_out_spaces */19] = function (param) { - return display_blanks(ppf, param); - }; - return ppf; -} - -function formatter_of_out_channel(oc) { - return make_formatter(function (param, param$1, param$2) { - return Pervasives.output_substring(oc, param, param$1, param$2); - }, function () { - return Caml_io.caml_ml_flush(oc); - }); -} - -function formatter_of_buffer(b) { - return make_formatter(function (param, param$1, param$2) { - return Buffer.add_substring(b, param, param$1, param$2); - }, function () { - return /* () */0; - }); -} - -var stdbuf = Buffer.create(512); - -var std_formatter = formatter_of_out_channel(Pervasives.stdout); - -var err_formatter = formatter_of_out_channel(Pervasives.stderr); - -var str_formatter = formatter_of_buffer(stdbuf); - -function flush_str_formatter() { - pp_flush_queue(str_formatter, /* false */0); - var s = Buffer.contents(stdbuf); - Buffer.reset(stdbuf); - return s; -} - -function flush_buf_formatter(buf, ppf) { - pp_flush_queue(ppf, /* false */0); - var s = Buffer.contents(buf); - Buffer.reset(buf); - return s; -} - -function open_hbox(param) { - return pp_open_hbox(std_formatter, param); -} - -function open_vbox(param) { - return pp_open_vbox(std_formatter, param); -} - -function open_hvbox(param) { - return pp_open_hvbox(std_formatter, param); -} - -function open_hovbox(param) { - return pp_open_hovbox(std_formatter, param); -} - -function open_box(param) { - return pp_open_box(std_formatter, param); -} - -function close_box(param) { - return pp_close_box(std_formatter, param); -} - -function open_tag(param) { - return pp_open_tag(std_formatter, param); -} - -function close_tag(param) { - return pp_close_tag(std_formatter, param); -} - -function print_as(param, param$1) { - return pp_print_as(std_formatter, param, param$1); -} - -function print_string(param) { - return pp_print_string(std_formatter, param); -} - -function print_int(param) { - return pp_print_string(std_formatter, "" + param); -} - -function print_float(param) { - return pp_print_string(std_formatter, Pervasives.string_of_float(param)); -} - -function print_char(param) { - return pp_print_char(std_formatter, param); -} - -function print_bool(param) { - return pp_print_string(std_formatter, param ? "true" : "false"); -} - -function print_break(param, param$1) { - return pp_print_break(std_formatter, param, param$1); -} - -function print_cut() { - return pp_print_break(std_formatter, 0, 0); -} - -function print_space() { - return pp_print_break(std_formatter, 1, 0); -} - -function force_newline(param) { - return pp_force_newline(std_formatter, param); -} - -function print_flush(param) { - return pp_print_flush(std_formatter, param); -} - -function print_newline(param) { - return pp_print_newline(std_formatter, param); -} - -function print_if_newline(param) { - return pp_print_if_newline(std_formatter, param); -} - -function open_tbox(param) { - return pp_open_tbox(std_formatter, param); -} - -function close_tbox(param) { - return pp_close_tbox(std_formatter, param); -} - -function print_tbreak(param, param$1) { - return pp_print_tbreak(std_formatter, param, param$1); -} - -function set_tab(param) { - return pp_set_tab(std_formatter, param); -} - -function print_tab() { - return pp_print_tbreak(std_formatter, 0, 0); -} - -function set_margin(param) { - return pp_set_margin(std_formatter, param); -} - -function get_margin() { - return std_formatter[/* pp_margin */5]; -} - -function set_max_indent(param) { - return pp_set_max_indent(std_formatter, param); -} - -function get_max_indent() { - return std_formatter[/* pp_max_indent */7]; -} - -function set_max_boxes(param) { - return pp_set_max_boxes(std_formatter, param); -} - -function get_max_boxes() { - return std_formatter[/* pp_max_boxes */14]; -} - -function over_max_boxes(param) { - return pp_over_max_boxes(std_formatter, param); -} - -function set_ellipsis_text(param) { - std_formatter[/* pp_ellipsis */15] = param; - return /* () */0; -} - -function get_ellipsis_text() { - return std_formatter[/* pp_ellipsis */15]; -} - -function set_formatter_out_channel(param) { - return pp_set_formatter_out_channel(std_formatter, param); -} - -function set_formatter_out_functions(param) { - return pp_set_formatter_out_functions(std_formatter, param); -} - -function get_formatter_out_functions(param) { - return pp_get_formatter_out_functions(std_formatter, param); -} - -function set_formatter_output_functions(param, param$1) { - return pp_set_formatter_output_functions(std_formatter, param, param$1); -} - -function get_formatter_output_functions(param) { - return pp_get_formatter_output_functions(std_formatter, param); -} - -function set_all_formatter_output_functions(param, param$1, param$2, param$3) { - return pp_set_all_formatter_output_functions(std_formatter, param, param$1, param$2, param$3); -} - -function get_all_formatter_output_functions(param) { - return pp_get_all_formatter_output_functions(std_formatter, param); -} - -function set_formatter_tag_functions(param) { - return pp_set_formatter_tag_functions(std_formatter, param); -} - -function get_formatter_tag_functions(param) { - return pp_get_formatter_tag_functions(std_formatter, param); -} - -function set_print_tags(param) { - std_formatter[/* pp_print_tags */20] = param; - return /* () */0; -} - -function get_print_tags() { - return std_formatter[/* pp_print_tags */20]; -} - -function set_mark_tags(param) { - std_formatter[/* pp_mark_tags */21] = param; - return /* () */0; -} - -function get_mark_tags() { - return std_formatter[/* pp_mark_tags */21]; -} - -function set_tags(param) { - return pp_set_tags(std_formatter, param); -} - -function compute_tag(output, tag_acc) { - var buf = Buffer.create(16); - var ppf = formatter_of_buffer(buf); - Curry._2(output, ppf, tag_acc); - pp_print_flush(ppf, /* () */0); - var len = buf[/* position */1]; - if (len < 2) { - return Buffer.contents(buf); - } - else { - return Buffer.sub(buf, 1, len - 2 | 0); - } -} - -function output_formatting_lit(ppf, fmting_lit) { - if (typeof fmting_lit === "number") { - switch (fmting_lit) { - case 0 : - return pp_close_box(ppf, /* () */0); - case 1 : - return pp_close_tag(ppf, /* () */0); - case 2 : - return pp_print_flush(ppf, /* () */0); - case 3 : - return pp_force_newline(ppf, /* () */0); - case 4 : - return pp_print_newline(ppf, /* () */0); - case 5 : - return pp_print_char(ppf, /* "@" */64); - case 6 : - return pp_print_char(ppf, /* "%" */37); - - } - } - else { - switch (fmting_lit.tag | 0) { - case 0 : - return pp_print_break(ppf, fmting_lit[1], fmting_lit[2]); - case 1 : - return /* () */0; - case 2 : - pp_print_char(ppf, /* "@" */64); - return pp_print_char(ppf, fmting_lit[0]); - - } - } -} - -function output_acc(ppf, acc) { - var exit = 0; - var p; - var size; - var s; - var p$1; - var size$1; - var c; - if (typeof acc === "number") { - return /* () */0; - } - else { - switch (acc.tag | 0) { - case 0 : - output_acc(ppf, acc[0]); - return output_formatting_lit(ppf, acc[1]); - case 1 : - var match = acc[1]; - var p$2 = acc[0]; - output_acc(ppf, p$2); - if (match.tag) { - var match$1 = CamlinternalFormat.open_box_of_string(compute_tag(output_acc, match[0])); - return pp_open_box_gen(ppf, match$1[0], match$1[1]); - } - else { - return pp_open_tag(ppf, compute_tag(output_acc, match[0])); - } - break; - case 2 : - var p$3 = acc[0]; - var exit$1 = 0; - if (typeof p$3 === "number") { - exit$1 = 3; - } - else if (p$3.tag) { - exit$1 = 3; - } - else { - var match$2 = p$3[1]; - if (typeof match$2 === "number") { - exit$1 = 3; - } - else if (match$2.tag === 1) { - p = p$3[0]; - size = match$2[1]; - s = acc[1]; - exit = 1; - } - else { - exit$1 = 3; - } - } - if (exit$1 === 3) { - output_acc(ppf, p$3); - return pp_print_string(ppf, acc[1]); - } - break; - case 3 : - var p$4 = acc[0]; - var exit$2 = 0; - if (typeof p$4 === "number") { - exit$2 = 3; - } - else if (p$4.tag) { - exit$2 = 3; - } - else { - var match$3 = p$4[1]; - if (typeof match$3 === "number") { - exit$2 = 3; - } - else if (match$3.tag === 1) { - p$1 = p$4[0]; - size$1 = match$3[1]; - c = acc[1]; - exit = 2; - } - else { - exit$2 = 3; - } - } - if (exit$2 === 3) { - output_acc(ppf, p$4); - return pp_print_char(ppf, acc[1]); - } - break; - case 4 : - var p$5 = acc[0]; - var exit$3 = 0; - if (typeof p$5 === "number") { - exit$3 = 3; - } - else if (p$5.tag) { - exit$3 = 3; - } - else { - var match$4 = p$5[1]; - if (typeof match$4 === "number") { - exit$3 = 3; - } - else if (match$4.tag === 1) { - p = p$5[0]; - size = match$4[1]; - s = acc[1]; - exit = 1; - } - else { - exit$3 = 3; - } - } - if (exit$3 === 3) { - output_acc(ppf, p$5); - return pp_print_string(ppf, acc[1]); - } - break; - case 5 : - var p$6 = acc[0]; - var exit$4 = 0; - if (typeof p$6 === "number") { - exit$4 = 3; - } - else if (p$6.tag) { - exit$4 = 3; - } - else { - var match$5 = p$6[1]; - if (typeof match$5 === "number") { - exit$4 = 3; - } - else if (match$5.tag === 1) { - p$1 = p$6[0]; - size$1 = match$5[1]; - c = acc[1]; - exit = 2; - } - else { - exit$4 = 3; - } - } - if (exit$4 === 3) { - output_acc(ppf, p$6); - return pp_print_char(ppf, acc[1]); - } - break; - case 6 : - output_acc(ppf, acc[0]); - return Curry._1(acc[1], ppf); - case 7 : - output_acc(ppf, acc[0]); - return pp_print_flush(ppf, /* () */0); - case 8 : - output_acc(ppf, acc[0]); - throw [ - Caml_builtin_exceptions.invalid_argument, - acc[1] - ]; - - } - } - switch (exit) { - case 1 : - output_acc(ppf, p); - return pp_print_as_size(ppf, size, s); - case 2 : - output_acc(ppf, p$1); - return pp_print_as_size(ppf, size$1, Caml_string.bytes_to_string(Bytes.make(1, c))); - - } -} - -function strput_acc(ppf, acc) { - var exit = 0; - var p; - var size; - var s; - var p$1; - var size$1; - var c; - if (typeof acc === "number") { - return /* () */0; - } - else { - switch (acc.tag | 0) { - case 0 : - strput_acc(ppf, acc[0]); - return output_formatting_lit(ppf, acc[1]); - case 1 : - var match = acc[1]; - var p$2 = acc[0]; - strput_acc(ppf, p$2); - if (match.tag) { - var match$1 = CamlinternalFormat.open_box_of_string(compute_tag(strput_acc, match[0])); - return pp_open_box_gen(ppf, match$1[0], match$1[1]); - } - else { - return pp_open_tag(ppf, compute_tag(strput_acc, match[0])); - } - break; - case 2 : - var p$3 = acc[0]; - var exit$1 = 0; - if (typeof p$3 === "number") { - exit$1 = 3; - } - else if (p$3.tag) { - exit$1 = 3; - } - else { - var match$2 = p$3[1]; - if (typeof match$2 === "number") { - exit$1 = 3; - } - else if (match$2.tag === 1) { - p = p$3[0]; - size = match$2[1]; - s = acc[1]; - exit = 1; - } - else { - exit$1 = 3; - } - } - if (exit$1 === 3) { - strput_acc(ppf, p$3); - return pp_print_string(ppf, acc[1]); - } - break; - case 3 : - var p$4 = acc[0]; - var exit$2 = 0; - if (typeof p$4 === "number") { - exit$2 = 3; - } - else if (p$4.tag) { - exit$2 = 3; - } - else { - var match$3 = p$4[1]; - if (typeof match$3 === "number") { - exit$2 = 3; - } - else if (match$3.tag === 1) { - p$1 = p$4[0]; - size$1 = match$3[1]; - c = acc[1]; - exit = 2; - } - else { - exit$2 = 3; - } - } - if (exit$2 === 3) { - strput_acc(ppf, p$4); - return pp_print_char(ppf, acc[1]); - } - break; - case 4 : - var p$5 = acc[0]; - var exit$3 = 0; - if (typeof p$5 === "number") { - exit$3 = 3; - } - else if (p$5.tag) { - exit$3 = 3; - } - else { - var match$4 = p$5[1]; - if (typeof match$4 === "number") { - exit$3 = 3; - } - else if (match$4.tag === 1) { - p = p$5[0]; - size = match$4[1]; - s = acc[1]; - exit = 1; - } - else { - exit$3 = 3; - } - } - if (exit$3 === 3) { - strput_acc(ppf, p$5); - return pp_print_string(ppf, acc[1]); - } - break; - case 5 : - var p$6 = acc[0]; - var exit$4 = 0; - if (typeof p$6 === "number") { - exit$4 = 3; - } - else if (p$6.tag) { - exit$4 = 3; - } - else { - var match$5 = p$6[1]; - if (typeof match$5 === "number") { - exit$4 = 3; - } - else if (match$5.tag === 1) { - p$1 = p$6[0]; - size$1 = match$5[1]; - c = acc[1]; - exit = 2; - } - else { - exit$4 = 3; - } - } - if (exit$4 === 3) { - strput_acc(ppf, p$6); - return pp_print_char(ppf, acc[1]); - } - break; - case 6 : - var p$7 = acc[0]; - var exit$5 = 0; - if (typeof p$7 === "number") { - exit$5 = 3; - } - else if (p$7.tag) { - exit$5 = 3; - } - else { - var match$6 = p$7[1]; - if (typeof match$6 === "number") { - exit$5 = 3; - } - else if (match$6.tag === 1) { - strput_acc(ppf, p$7[0]); - return pp_print_as_size(ppf, match$6[1], Curry._1(acc[1], /* () */0)); - } - else { - exit$5 = 3; - } - } - if (exit$5 === 3) { - strput_acc(ppf, p$7); - return pp_print_string(ppf, Curry._1(acc[1], /* () */0)); - } - break; - case 7 : - strput_acc(ppf, acc[0]); - return pp_print_flush(ppf, /* () */0); - case 8 : - strput_acc(ppf, acc[0]); - throw [ - Caml_builtin_exceptions.invalid_argument, - acc[1] - ]; - - } - } - switch (exit) { - case 1 : - strput_acc(ppf, p); - return pp_print_as_size(ppf, size, s); - case 2 : - strput_acc(ppf, p$1); - return pp_print_as_size(ppf, size$1, Caml_string.bytes_to_string(Bytes.make(1, c))); - - } -} - -function kfprintf(k, o, param) { - return CamlinternalFormat.make_printf(function (o, acc) { - output_acc(o, acc); - return Curry._1(k, o); - }, o, /* End_of_acc */0, param[0]); -} - -function ikfprintf(k, x, param) { - return CamlinternalFormat.make_printf(function (_, _$1) { - return Curry._1(k, x); - }, x, /* End_of_acc */0, param[0]); -} - -function fprintf(ppf, fmt) { - return kfprintf(function () { - return /* () */0; - }, ppf, fmt); -} - -function ifprintf(ppf, fmt) { - return ikfprintf(function () { - return /* () */0; - }, ppf, fmt); -} - -function printf(fmt) { - return fprintf(std_formatter, fmt); -} - -function eprintf(fmt) { - return fprintf(err_formatter, fmt); -} - -function ksprintf(k, param) { - var b = Buffer.create(512); - var ppf = formatter_of_buffer(b); - var k$prime = function (_, acc) { - strput_acc(ppf, acc); - return Curry._1(k, flush_buf_formatter(b, ppf)); - }; - return CamlinternalFormat.make_printf(k$prime, /* () */0, /* End_of_acc */0, param[0]); -} - -function sprintf(fmt) { - return ksprintf(function (s) { - return s; - }, fmt); -} - -function asprintf(param) { - var b = Buffer.create(512); - var ppf = formatter_of_buffer(b); - var k$prime = function (ppf, acc) { - output_acc(ppf, acc); - pp_flush_queue(ppf, /* false */0); - return flush_buf_formatter(b, ppf); - }; - return CamlinternalFormat.make_printf(k$prime, ppf, /* End_of_acc */0, param[0]); -} - -function bprintf(b, param) { - var k = function (ppf, acc) { - output_acc(ppf, acc); - return pp_flush_queue(ppf, /* false */0); - }; - return CamlinternalFormat.make_printf(k, formatter_of_buffer(b), /* End_of_acc */0, param[0]); -} - -Pervasives.at_exit(print_flush); - -var kprintf = ksprintf; - -exports.open_box = open_box; -exports.close_box = close_box; -exports.print_string = print_string; -exports.print_as = print_as; -exports.print_int = print_int; -exports.print_float = print_float; -exports.print_char = print_char; -exports.print_bool = print_bool; -exports.print_space = print_space; -exports.print_cut = print_cut; -exports.print_break = print_break; -exports.print_flush = print_flush; -exports.print_newline = print_newline; -exports.force_newline = force_newline; -exports.print_if_newline = print_if_newline; -exports.set_margin = set_margin; -exports.get_margin = get_margin; -exports.set_max_indent = set_max_indent; -exports.get_max_indent = get_max_indent; -exports.set_max_boxes = set_max_boxes; -exports.get_max_boxes = get_max_boxes; -exports.over_max_boxes = over_max_boxes; -exports.open_hbox = open_hbox; -exports.open_vbox = open_vbox; -exports.open_hvbox = open_hvbox; -exports.open_hovbox = open_hovbox; -exports.open_tbox = open_tbox; -exports.close_tbox = close_tbox; -exports.print_tbreak = print_tbreak; -exports.set_tab = set_tab; -exports.print_tab = print_tab; -exports.set_ellipsis_text = set_ellipsis_text; -exports.get_ellipsis_text = get_ellipsis_text; -exports.open_tag = open_tag; -exports.close_tag = close_tag; -exports.set_tags = set_tags; -exports.set_print_tags = set_print_tags; -exports.set_mark_tags = set_mark_tags; -exports.get_print_tags = get_print_tags; -exports.get_mark_tags = get_mark_tags; -exports.set_formatter_out_channel = set_formatter_out_channel; -exports.set_formatter_output_functions = set_formatter_output_functions; -exports.get_formatter_output_functions = get_formatter_output_functions; -exports.set_formatter_out_functions = set_formatter_out_functions; -exports.get_formatter_out_functions = get_formatter_out_functions; -exports.set_formatter_tag_functions = set_formatter_tag_functions; -exports.get_formatter_tag_functions = get_formatter_tag_functions; -exports.formatter_of_out_channel = formatter_of_out_channel; -exports.std_formatter = std_formatter; -exports.err_formatter = err_formatter; -exports.formatter_of_buffer = formatter_of_buffer; -exports.stdbuf = stdbuf; -exports.str_formatter = str_formatter; -exports.flush_str_formatter = flush_str_formatter; -exports.make_formatter = make_formatter; -exports.pp_open_hbox = pp_open_hbox; -exports.pp_open_vbox = pp_open_vbox; -exports.pp_open_hvbox = pp_open_hvbox; -exports.pp_open_hovbox = pp_open_hovbox; -exports.pp_open_box = pp_open_box; -exports.pp_close_box = pp_close_box; -exports.pp_open_tag = pp_open_tag; -exports.pp_close_tag = pp_close_tag; -exports.pp_print_string = pp_print_string; -exports.pp_print_as = pp_print_as; -exports.pp_print_int = pp_print_int; -exports.pp_print_float = pp_print_float; -exports.pp_print_char = pp_print_char; -exports.pp_print_bool = pp_print_bool; -exports.pp_print_break = pp_print_break; -exports.pp_print_cut = pp_print_cut; -exports.pp_print_space = pp_print_space; -exports.pp_force_newline = pp_force_newline; -exports.pp_print_flush = pp_print_flush; -exports.pp_print_newline = pp_print_newline; -exports.pp_print_if_newline = pp_print_if_newline; -exports.pp_open_tbox = pp_open_tbox; -exports.pp_close_tbox = pp_close_tbox; -exports.pp_print_tbreak = pp_print_tbreak; -exports.pp_set_tab = pp_set_tab; -exports.pp_print_tab = pp_print_tab; -exports.pp_set_tags = pp_set_tags; -exports.pp_set_print_tags = pp_set_print_tags; -exports.pp_set_mark_tags = pp_set_mark_tags; -exports.pp_get_print_tags = pp_get_print_tags; -exports.pp_get_mark_tags = pp_get_mark_tags; -exports.pp_set_margin = pp_set_margin; -exports.pp_get_margin = pp_get_margin; -exports.pp_set_max_indent = pp_set_max_indent; -exports.pp_get_max_indent = pp_get_max_indent; -exports.pp_set_max_boxes = pp_set_max_boxes; -exports.pp_get_max_boxes = pp_get_max_boxes; -exports.pp_over_max_boxes = pp_over_max_boxes; -exports.pp_set_ellipsis_text = pp_set_ellipsis_text; -exports.pp_get_ellipsis_text = pp_get_ellipsis_text; -exports.pp_set_formatter_out_channel = pp_set_formatter_out_channel; -exports.pp_set_formatter_output_functions = pp_set_formatter_output_functions; -exports.pp_get_formatter_output_functions = pp_get_formatter_output_functions; -exports.pp_set_formatter_tag_functions = pp_set_formatter_tag_functions; -exports.pp_get_formatter_tag_functions = pp_get_formatter_tag_functions; -exports.pp_set_formatter_out_functions = pp_set_formatter_out_functions; -exports.pp_get_formatter_out_functions = pp_get_formatter_out_functions; -exports.pp_print_list = pp_print_list; -exports.pp_print_text = pp_print_text; -exports.fprintf = fprintf; -exports.printf = printf; -exports.eprintf = eprintf; -exports.sprintf = sprintf; -exports.asprintf = asprintf; -exports.ifprintf = ifprintf; -exports.kfprintf = kfprintf; -exports.ikfprintf = ikfprintf; -exports.ksprintf = ksprintf; -exports.bprintf = bprintf; -exports.kprintf = kprintf; -exports.set_all_formatter_output_functions = set_all_formatter_output_functions; -exports.get_all_formatter_output_functions = get_all_formatter_output_functions; -exports.pp_set_all_formatter_output_functions = pp_set_all_formatter_output_functions; -exports.pp_get_all_formatter_output_functions = pp_get_all_formatter_output_functions; -/* blank_line Not a pure module */ -//////// end of format.js //////// -    return exports; -  }; - - - _registry['i32'] = function() { -    let exports = {}; -//////// start of i32.js //////// -// Generated by BUCKLESCRIPT VERSION 1.4.3 , PLEASE EDIT WITH CARE -'use strict'; - -var Int = require("./int"); -var Int32 = require("bs-platform/lib/js/int32"); -var Caml_int32 = require("bs-platform/lib/js/caml_int32"); - -var include = Int.Make(/* module */[ - /* zero */Int32.zero, - /* one */Int32.one, - /* minus_one */Int32.minus_one, - /* max_int */Int32.max_int, - /* min_int */Int32.min_int, - /* %int32_neg */function (prim) { - return -prim | 0; - }, - /* %int32_add */function (prim, prim$1) { - return prim + prim$1 | 0; - }, - /* %int32_sub */function (prim, prim$1) { - return prim - prim$1 | 0; - }, - /* %int32_mul */Caml_int32.imul, - /* %int32_div */Caml_int32.div, - /* %int32_mod */Caml_int32.mod_, - /* %int32_and */function (prim, prim$1) { - return prim & prim$1; - }, - /* lognot */Int32.lognot, - /* %int32_or */function (prim, prim$1) { - return prim | prim$1; - }, - /* %int32_xor */function (prim, prim$1) { - return prim ^ prim$1; - }, - /* %int32_lsl */function (prim, prim$1) { - return (prim << prim$1); - }, - /* %int32_asr */function (prim, prim$1) { - return (prim >> prim$1); - }, - /* %int32_lsr */function (prim, prim$1) { - return (prim >>> prim$1) | 0; - }, - /* %int32_of_int */function (prim) { - return prim; - }, - /* %int32_to_int */function (prim) { - return prim; - }, - /* to_string */Int32.to_string, - /* bitwidth */32 - ]); - -var of_bits = include[0]; - -var to_bits = include[1]; - -var zero = include[2]; - -var add = include[3]; - -var sub = include[4]; - -var mul = include[5]; - -var div_s = include[6]; - -var div_u = include[7]; - -var rem_s = include[8]; - -var rem_u = include[9]; - -var and_ = include[10]; - -var or_ = include[11]; - -var xor = include[12]; - -var shl = include[13]; - -var shr_s = include[14]; - -var shr_u = include[15]; - -var rotl = include[16]; - -var rotr = include[17]; - -var clz = include[18]; - -var ctz = include[19]; - -var popcnt = include[20]; - -var eqz = include[21]; - -var eq = include[22]; - -var ne = include[23]; - -var lt_s = include[24]; - -var lt_u = include[25]; - -var le_s = include[26]; - -var le_u = include[27]; - -var gt_s = include[28]; - -var gt_u = include[29]; - -var ge_s = include[30]; - -var ge_u = include[31]; - -var of_int_s = include[32]; - -var of_int_u = include[33]; - -var of_string_s = include[34]; - -var of_string_u = include[35]; - -var of_string = include[36]; - -var to_string_s = include[37]; - -var to_string_u = include[38]; - -exports.of_bits = of_bits; -exports.to_bits = to_bits; -exports.zero = zero; -exports.add = add; -exports.sub = sub; -exports.mul = mul; -exports.div_s = div_s; -exports.div_u = div_u; -exports.rem_s = rem_s; -exports.rem_u = rem_u; -exports.and_ = and_; -exports.or_ = or_; -exports.xor = xor; -exports.shl = shl; -exports.shr_s = shr_s; -exports.shr_u = shr_u; -exports.rotl = rotl; -exports.rotr = rotr; -exports.clz = clz; -exports.ctz = ctz; -exports.popcnt = popcnt; -exports.eqz = eqz; -exports.eq = eq; -exports.ne = ne; -exports.lt_s = lt_s; -exports.lt_u = lt_u; -exports.le_s = le_s; -exports.le_u = le_u; -exports.gt_s = gt_s; -exports.gt_u = gt_u; -exports.ge_s = ge_s; -exports.ge_u = ge_u; -exports.of_int_s = of_int_s; -exports.of_int_u = of_int_u; -exports.of_string_s = of_string_s; -exports.of_string_u = of_string_u; -exports.of_string = of_string; -exports.to_string_s = to_string_s; -exports.to_string_u = to_string_u; -/* include Not a pure module */ -//////// end of i32.js //////// -    return exports; -  }; - - - _registry['i64'] = function() { -    let exports = {}; -//////// start of i64.js //////// -// Generated by BUCKLESCRIPT VERSION 1.4.3 , PLEASE EDIT WITH CARE -'use strict'; - -var Int = require("./int"); -var Int64 = require("bs-platform/lib/js/int64"); -var Caml_int64 = require("bs-platform/lib/js/caml_int64"); - -var include = Int.Make(/* module */[ - /* zero */Int64.zero, - /* one */Int64.one, - /* minus_one */Int64.minus_one, - /* max_int */Int64.max_int, - /* min_int */Int64.min_int, - /* %int64_neg */Caml_int64.neg, - /* %int64_add */Caml_int64.add, - /* %int64_sub */Caml_int64.sub, - /* %int64_mul */Caml_int64.mul, - /* %int64_div */Caml_int64.div, - /* %int64_mod */Caml_int64.mod_, - /* %int64_and */function (prim, prim$1) { - return /* int64 */[ - /* hi */prim[0] & prim$1[0], - /* lo */((prim[1] & prim$1[1]) >>> 0) - ]; - }, - /* lognot */Int64.lognot, - /* %int64_or */function (prim, prim$1) { - return /* int64 */[ - /* hi */prim[0] | prim$1[0], - /* lo */((prim[1] | prim$1[1]) >>> 0) - ]; - }, - /* %int64_xor */function (prim, prim$1) { - return /* int64 */[ - /* hi */prim[0] ^ prim$1[0], - /* lo */((prim[1] ^ prim$1[1]) >>> 0) - ]; - }, - /* %int64_lsl */Caml_int64.lsl_, - /* %int64_asr */Caml_int64.asr_, - /* %int64_lsr */Caml_int64.lsr_, - /* %int64_of_int */Caml_int64.of_int32, - /* %int64_to_int */function (prim) { - return prim[1] | 0; - }, - /* to_string */Int64.to_string, - /* bitwidth */64 - ]); - -var of_bits = include[0]; - -var to_bits = include[1]; - -var zero = include[2]; - -var add = include[3]; - -var sub = include[4]; - -var mul = include[5]; - -var div_s = include[6]; - -var div_u = include[7]; - -var rem_s = include[8]; - -var rem_u = include[9]; - -var and_ = include[10]; - -var or_ = include[11]; - -var xor = include[12]; - -var shl = include[13]; - -var shr_s = include[14]; - -var shr_u = include[15]; - -var rotl = include[16]; - -var rotr = include[17]; - -var clz = include[18]; - -var ctz = include[19]; - -var popcnt = include[20]; - -var eqz = include[21]; - -var eq = include[22]; - -var ne = include[23]; - -var lt_s = include[24]; - -var lt_u = include[25]; - -var le_s = include[26]; - -var le_u = include[27]; - -var gt_s = include[28]; - -var gt_u = include[29]; - -var ge_s = include[30]; - -var ge_u = include[31]; - -var of_int_s = include[32]; - -var of_int_u = include[33]; - -var of_string_s = include[34]; - -var of_string_u = include[35]; - -var of_string = include[36]; - -var to_string_s = include[37]; - -var to_string_u = include[38]; - -exports.of_bits = of_bits; -exports.to_bits = to_bits; -exports.zero = zero; -exports.add = add; -exports.sub = sub; -exports.mul = mul; -exports.div_s = div_s; -exports.div_u = div_u; -exports.rem_s = rem_s; -exports.rem_u = rem_u; -exports.and_ = and_; -exports.or_ = or_; -exports.xor = xor; -exports.shl = shl; -exports.shr_s = shr_s; -exports.shr_u = shr_u; -exports.rotl = rotl; -exports.rotr = rotr; -exports.clz = clz; -exports.ctz = ctz; -exports.popcnt = popcnt; -exports.eqz = eqz; -exports.eq = eq; -exports.ne = ne; -exports.lt_s = lt_s; -exports.lt_u = lt_u; -exports.le_s = le_s; -exports.le_u = le_u; -exports.gt_s = gt_s; -exports.gt_u = gt_u; -exports.ge_s = ge_s; -exports.ge_u = ge_u; -exports.of_int_s = of_int_s; -exports.of_int_u = of_int_u; -exports.of_string_s = of_string_s; -exports.of_string_u = of_string_u; -exports.of_string = of_string; -exports.to_string_s = to_string_s; -exports.to_string_u = to_string_u; -/* include Not a pure module */ -//////// end of i64.js //////// -    return exports; -  }; - - - _registry['int32'] = function() { -    let exports = {}; -//////// start of int32.js //////// -'use strict'; - -var Caml_obj = require("./caml_obj"); -var Caml_format = require("./caml_format"); - -function succ(n) { - return n + 1 | 0; -} - -function pred(n) { - return n - 1 | 0; -} - -function abs(n) { - if (n >= 0) { - return n; - } - else { - return -n | 0; - } -} - -function lognot(n) { - return n ^ -1; -} - -function to_string(n) { - return Caml_format.caml_int32_format("%d", n); -} - -var compare = Caml_obj.caml_int32_compare; - -var zero = 0; - -var one = 1; - -var minus_one = -1; - -var max_int = 2147483647; - -var min_int = -2147483648; - -exports.zero = zero; -exports.one = one; -exports.minus_one = minus_one; -exports.succ = succ; -exports.pred = pred; -exports.abs = abs; -exports.max_int = max_int; -exports.min_int = min_int; -exports.lognot = lognot; -exports.to_string = to_string; -exports.compare = compare; -/* No side effect */ -//////// end of int32.js //////// -    return exports; -  }; - - - _registry['int64'] = function() { -    let exports = {}; -//////// start of int64.js //////// -'use strict'; - -var Caml_int64 = require("./caml_int64"); -var Caml_format = require("./caml_format"); - -function succ(n) { - return Caml_int64.add(n, /* int64 */[ - /* hi */0, - /* lo */1 - ]); -} - -function pred(n) { - return Caml_int64.sub(n, /* int64 */[ - /* hi */0, - /* lo */1 - ]); -} - -function abs(n) { - if (Caml_int64.ge(n, /* int64 */[ - /* hi */0, - /* lo */0 - ])) { - return n; - } - else { - return Caml_int64.neg(n); - } -} - -function lognot(n) { - return /* int64 */[ - /* hi */n[0] ^ /* hi */-1, - /* lo */((n[1] ^ /* lo */4294967295) >>> 0) - ]; -} - -function to_string(n) { - return Caml_format.caml_int64_format("%d", n); -} - -var compare = Caml_int64.compare; - -var zero = /* int64 */[ - /* hi */0, - /* lo */0 -]; - -var one = /* int64 */[ - /* hi */0, - /* lo */1 -]; - -var minus_one = /* int64 */[ - /* hi */-1, - /* lo */4294967295 -]; - -var max_int = /* int64 */[ - /* hi */2147483647, - /* lo */4294967295 -]; - -var min_int = /* int64 */[ - /* hi */-2147483648, - /* lo */0 -]; - -exports.zero = zero; -exports.one = one; -exports.minus_one = minus_one; -exports.succ = succ; -exports.pred = pred; -exports.abs = abs; -exports.max_int = max_int; -exports.min_int = min_int; -exports.lognot = lognot; -exports.to_string = to_string; -exports.compare = compare; -/* No side effect */ -//////// end of int64.js //////// -    return exports; -  }; - - - _registry['int'] = function() { -    let exports = {}; -//////// start of int.js //////// -// Generated by BUCKLESCRIPT VERSION 1.4.3 , PLEASE EDIT WITH CARE -'use strict'; - -var Curry = require("bs-platform/lib/js/curry"); -var Caml_obj = require("bs-platform/lib/js/caml_obj"); -var Pervasives = require("bs-platform/lib/js/pervasives"); -var Caml_string = require("bs-platform/lib/js/caml_string"); -var Numeric_error = require("./numeric_error"); - -function Make(Rep) { - var cmp_u = function (x, op, y) { - return Curry._2(op, Curry._2(Rep[/* add */6], x, Rep[/* min_int */4]), Curry._2(Rep[/* add */6], y, Rep[/* min_int */4])); - }; - var divrem_u = function (n, d) { - if (Caml_obj.caml_equal(d, Rep[/* zero */0])) { - throw Numeric_error.IntegerDivideByZero; - } - else { - var t = Curry._2(Rep[/* shift_right */16], d, Rep[/* bitwidth */21] - 1 | 0); - var n$prime = Curry._2(Rep[/* logand */11], n, Curry._1(Rep[/* lognot */12], t)); - var q = Curry._2(Rep[/* shift_left */15], Curry._2(Rep[/* div */9], Curry._2(Rep[/* shift_right_logical */17], n$prime, 1), d), 1); - var r = Curry._2(Rep[/* sub */7], n, Curry._2(Rep[/* mul */8], q, d)); - if (cmp_u(r, Caml_obj.caml_lessthan, d)) { - return /* tuple */[ - q, - r - ]; - } - else { - return /* tuple */[ - Curry._2(Rep[/* add */6], q, Rep[/* one */1]), - Curry._2(Rep[/* sub */7], r, d) - ]; - } - } - }; - var of_bits = function (x) { - return x; - }; - var to_bits = function (x) { - return x; - }; - var zero = Rep[/* zero */0]; - var one = Rep[/* one */1]; - var ten = Curry._1(Rep[/* of_int */18], 10); - var add = Rep[/* add */6]; - var sub = Rep[/* sub */7]; - var mul = Rep[/* mul */8]; - var div_s = function (x, y) { - if (Caml_obj.caml_equal(y, Rep[/* zero */0])) { - throw Numeric_error.IntegerDivideByZero; - } - else if (Caml_obj.caml_equal(x, Rep[/* min_int */4]) && Caml_obj.caml_equal(y, Rep[/* minus_one */2])) { - throw Numeric_error.IntegerOverflow; - } - else { - return Curry._2(Rep[/* div */9], x, y); - } - }; - var div_u = function (x, y) { - return divrem_u(x, y)[0]; - }; - var rem_s = function (x, y) { - if (Caml_obj.caml_equal(y, Rep[/* zero */0])) { - throw Numeric_error.IntegerDivideByZero; - } - else { - return Curry._2(Rep[/* rem */10], x, y); - } - }; - var rem_u = function (x, y) { - return divrem_u(x, y)[1]; - }; - var and_ = Rep[/* logand */11]; - var or_ = Rep[/* logor */13]; - var xor = Rep[/* logxor */14]; - var shift = function (f, x, y) { - return Curry._2(f, x, Curry._1(Rep[/* to_int */19], Curry._2(Rep[/* logand */11], y, Curry._1(Rep[/* of_int */18], Rep[/* bitwidth */21] - 1 | 0)))); - }; - var shl = function (x, y) { - return shift(Rep[/* shift_left */15], x, y); - }; - var shr_s = function (x, y) { - return shift(Rep[/* shift_right */16], x, y); - }; - var shr_u = function (x, y) { - return shift(Rep[/* shift_right_logical */17], x, y); - }; - var clamp_rotate_count = function (n) { - return Curry._1(Rep[/* to_int */19], Curry._2(Rep[/* logand */11], n, Curry._1(Rep[/* of_int */18], Rep[/* bitwidth */21] - 1 | 0))); - }; - var rotl = function (x, y) { - var n = clamp_rotate_count(y); - return Curry._2(or_, Curry._2(Rep[/* shift_left */15], x, n), Curry._2(Rep[/* shift_right_logical */17], x, Rep[/* bitwidth */21] - n | 0)); - }; - var rotr = function (x, y) { - var n = clamp_rotate_count(y); - return Curry._2(or_, Curry._2(Rep[/* shift_right_logical */17], x, n), Curry._2(Rep[/* shift_left */15], x, Rep[/* bitwidth */21] - n | 0)); - }; - var clz = function (x) { - var loop = function (_acc, _n) { - while(true) { - var n = _n; - var acc = _acc; - if (Caml_obj.caml_equal(n, Rep[/* zero */0])) { - return Rep[/* bitwidth */21]; - } - else if (Caml_obj.caml_equal(Curry._2(and_, n, Curry._2(Rep[/* shift_left */15], Rep[/* one */1], Rep[/* bitwidth */21] - 1 | 0)), Rep[/* zero */0])) { - _n = Curry._2(Rep[/* shift_left */15], n, 1); - _acc = 1 + acc | 0; - continue ; - - } - else { - return acc; - } - }; - }; - return Curry._1(Rep[/* of_int */18], loop(0, x)); - }; - var ctz = function (x) { - var loop = function (_acc, _n) { - while(true) { - var n = _n; - var acc = _acc; - if (Caml_obj.caml_equal(n, Rep[/* zero */0])) { - return Rep[/* bitwidth */21]; - } - else if (Caml_obj.caml_equal(Curry._2(and_, n, Rep[/* one */1]), Rep[/* one */1])) { - return acc; - } - else { - _n = Curry._2(Rep[/* shift_right_logical */17], n, 1); - _acc = 1 + acc | 0; - continue ; - - } - }; - }; - return Curry._1(Rep[/* of_int */18], loop(0, x)); - }; - var popcnt = function (x) { - var loop = function (_acc, _i, _n) { - while(true) { - var n = _n; - var i = _i; - var acc = _acc; - if (Caml_obj.caml_equal(n, Rep[/* zero */0])) { - return acc; - } - else { - var acc$prime = Caml_obj.caml_equal(Curry._2(and_, n, Rep[/* one */1]), Rep[/* one */1]) ? acc + 1 | 0 : acc; - _n = Curry._2(Rep[/* shift_right_logical */17], n, 1); - _i = i - 1 | 0; - _acc = acc$prime; - continue ; - - } - }; - }; - return Curry._1(Rep[/* of_int */18], loop(0, Rep[/* bitwidth */21], x)); - }; - var eqz = function (x) { - return Caml_obj.caml_equal(x, Rep[/* zero */0]); - }; - var eq = Caml_obj.caml_equal; - var ne = Caml_obj.caml_notequal; - var lt_s = Caml_obj.caml_lessthan; - var lt_u = function (x, y) { - return cmp_u(x, Caml_obj.caml_lessthan, y); - }; - var le_s = Caml_obj.caml_lessequal; - var le_u = function (x, y) { - return cmp_u(x, Caml_obj.caml_lessequal, y); - }; - var gt_s = Caml_obj.caml_greaterthan; - var gt_u = function (x, y) { - return cmp_u(x, Caml_obj.caml_greaterthan, y); - }; - var ge_s = Caml_obj.caml_greaterequal; - var ge_u = function (x, y) { - return cmp_u(x, Caml_obj.caml_greaterequal, y); - }; - var of_int_s = Rep[/* of_int */18]; - var of_int_u = function (i) { - return Curry._2(and_, Curry._1(Rep[/* of_int */18], i), Curry._2(or_, shl(Curry._1(Rep[/* of_int */18], Pervasives.max_int), one), one)); - }; - var to_string_s = Rep[/* to_string */20]; - var to_string_u = function (i) { - if (Caml_obj.caml_greaterequal(i, Rep[/* zero */0])) { - return Curry._1(to_string_s, i); - } - else { - return Curry._1(to_string_s, div_u(i, ten)) + Curry._1(to_string_s, rem_u(i, ten)); - } - }; - var $$require = function (b) { - if (b) { - return 0; - } - else { - return Pervasives.failwith("of_string"); - } - }; - var dec_digit = function (c) { - if (c > 57 || c < 48) { - return Pervasives.failwith("of_string"); - } - else { - return c - /* "0" */48 | 0; - } - }; - var hex_digit = function (c) { - if (c >= 65) { - if (c >= 97) { - if (c >= 103) { - return Pervasives.failwith("of_string"); - } - else { - return (10 + c | 0) - /* "a" */97 | 0; - } - } - else if (c >= 71) { - return Pervasives.failwith("of_string"); - } - else { - return (10 + c | 0) - /* "A" */65 | 0; - } - } - else if (c > 57 || c < 48) { - return Pervasives.failwith("of_string"); - } - else { - return c - /* "0" */48 | 0; - } - }; - var match = divrem_u(Rep[/* minus_one */2], ten); - var max_lower = match[1]; - var max_upper = match[0]; - var of_string = function (s) { - var len = s.length; - var parse_int = function (i) { - $$require(+((len - i | 0) > 0)); - if ((i + 2 | 0) <= len && Caml_string.get(s, i) === /* "0" */48 && Caml_string.get(s, i + 1 | 0) === /* "x" */120) { - var _i = i + 2 | 0; - var _num = Rep[/* zero */0]; - while(true) { - var num = _num; - var i$1 = _i; - if (i$1 === len) { - return num; - } - else { - var digit = Curry._1(Rep[/* of_int */18], hex_digit(Caml_string.get(s, i$1))); - $$require(le_u(num, shr_u(Rep[/* minus_one */2], Curry._1(Rep[/* of_int */18], 4)))); - _num = Curry._2(Rep[/* logor */13], Curry._2(Rep[/* shift_left */15], num, 4), digit); - _i = i$1 + 1 | 0; - continue ; - - } - }; - } - else { - var _i$1 = i; - var _num$1 = Rep[/* zero */0]; - while(true) { - var num$1 = _num$1; - var i$2 = _i$1; - if (i$2 === len) { - return num$1; - } - else { - var digit$1 = Curry._1(Rep[/* of_int */18], dec_digit(Caml_string.get(s, i$2))); - $$require(lt_u(num$1, max_upper) || Caml_obj.caml_equal(num$1, max_upper) && le_u(digit$1, max_lower)); - _num$1 = Curry._2(Rep[/* add */6], Curry._2(Rep[/* mul */8], num$1, ten), digit$1); - _i$1 = i$2 + 1 | 0; - continue ; - - } - }; - } - }; - $$require(+(len > 0)); - var match = Caml_string.get(s, 0); - var switcher = match - 43 | 0; - if (switcher > 2 || switcher < 0) { - return parse_int(0); - } - else { - switch (switcher) { - case 0 : - return parse_int(1); - case 1 : - return parse_int(0); - case 2 : - var n = parse_int(1); - $$require(Caml_obj.caml_greaterequal(Curry._2(Rep[/* sub */7], n, Rep[/* one */1]), Rep[/* minus_one */2])); - return Curry._1(Rep[/* neg */5], n); - - } - } - }; - var of_string_s = function (s) { - var n = of_string(s); - $$require(+(Caml_string.get(s, 0) === /* "-" */45) || Caml_obj.caml_greaterequal(n, Rep[/* zero */0])); - return n; - }; - var of_string_u = function (s) { - var n = of_string(s); - $$require(+(Caml_string.get(s, 0) !== /* "+" */43 && Caml_string.get(s, 0) !== /* "-" */45)); - return n; - }; - return /* module */[ - /* of_bits */of_bits, - /* to_bits */to_bits, - /* zero */zero, - /* add */add, - /* sub */sub, - /* mul */mul, - /* div_s */div_s, - /* div_u */div_u, - /* rem_s */rem_s, - /* rem_u */rem_u, - /* and_ */and_, - /* or_ */or_, - /* xor */xor, - /* shl */shl, - /* shr_s */shr_s, - /* shr_u */shr_u, - /* rotl */rotl, - /* rotr */rotr, - /* clz */clz, - /* ctz */ctz, - /* popcnt */popcnt, - /* eqz */eqz, - /* eq */eq, - /* ne */ne, - /* lt_s */lt_s, - /* lt_u */lt_u, - /* le_s */le_s, - /* le_u */le_u, - /* gt_s */gt_s, - /* gt_u */gt_u, - /* ge_s */ge_s, - /* ge_u */ge_u, - /* of_int_s */of_int_s, - /* of_int_u */of_int_u, - /* of_string_s */of_string_s, - /* of_string_u */of_string_u, - /* of_string */of_string, - /* to_string_s */to_string_s, - /* to_string_u */to_string_u - ]; -} - -exports.Make = Make; -/* No side effect */ -//////// end of int.js //////// -    return exports; -  }; - - - _registry['lexer'] = function() { -    let exports = {}; -//////// start of lexer.js //////// -// Generated by BUCKLESCRIPT VERSION 1.4.3 , PLEASE EDIT WITH CARE -'use strict'; - -var F32 = require("./f32"); -var F64 = require("./f64"); -var I32 = require("./i32"); -var I64 = require("./i64"); -var Lib = require("./lib"); -var Char = require("bs-platform/lib/js/char"); -var Block = require("bs-platform/lib/js/block"); -var Curry = require("bs-platform/lib/js/curry"); -var Buffer = require("bs-platform/lib/js/buffer"); -var Lexing = require("bs-platform/lib/js/lexing"); -var Script = require("./script"); -var Source = require("./source"); -var $$String = require("bs-platform/lib/js/string"); -var Operators = require("./operators"); -var Caml_format = require("bs-platform/lib/js/caml_format"); -var Caml_string = require("bs-platform/lib/js/caml_string"); -var Caml_builtin_exceptions = require("bs-platform/lib/js/caml_builtin_exceptions"); - -function convert_pos(pos) { - return /* record */[ - /* file */pos[/* pos_fname */0], - /* line */pos[/* pos_lnum */1], - /* column */pos[/* pos_cnum */3] - pos[/* pos_bol */2] | 0 - ]; -} - -function region(lexbuf) { - var left = convert_pos(Lexing.lexeme_start_p(lexbuf)); - var right = convert_pos(Lexing.lexeme_end_p(lexbuf)); - return /* record */[ - /* left */left, - /* right */right - ]; -} - -function error(lexbuf, msg) { - throw [ - Script.Syntax, - region(lexbuf), - msg - ]; -} - -function error_nest(start, lexbuf, msg) { - lexbuf[/* lex_start_p */10] = start; - return error(lexbuf, msg); -} - -function text(s) { - var b = Buffer.create(s.length); - var i = 1; - while(i < (s.length - 1 | 0)) { - var c; - if (Caml_string.get(s, i) !== /* "\\" */92) { - c = Caml_string.get(s, i); - } - else { - i = i + 1 | 0; - var d = Caml_string.get(s, i); - var exit = 0; - if (d >= 92) { - if (d !== 110) { - if (d !== 116) { - if (d >= 93) { - exit = 1; - } - else { - c = /* "\\" */92; - } - } - else { - c = /* "\t" */9; - } - } - else { - c = /* "\n" */10; - } - } - else if (d !== 34) { - if (d !== 39) { - exit = 1; - } - else { - c = /* "'" */39; - } - } - else { - c = /* "\"" */34; - } - if (exit === 1) { - i = i + 1 | 0; - c = Char.chr(Caml_format.caml_int_of_string("0x" + ($$String.make(1, d) + $$String.make(1, Caml_string.get(s, i))))); - } - - } - Buffer.add_char(b, c); - i = i + 1 | 0; - }; - return Buffer.contents(b); -} - -function value_type(param) { - switch (param) { - case "f32" : - return /* F32Type */2; - case "f64" : - return /* F64Type */3; - case "i32" : - return /* I32Type */0; - case "i64" : - return /* I64Type */1; - default: - throw [ - Caml_builtin_exceptions.assert_failure, - [ - "text/lexer.mll", - 45, - 9 - ] - ]; - } -} - -function intop(t, i32, i64) { - switch (t) { - case "i32" : - return i32; - case "i64" : - return i64; - default: - throw [ - Caml_builtin_exceptions.assert_failure, - [ - "text/lexer.mll", - 51, - 9 - ] - ]; - } -} - -function floatop(t, f32, f64) { - switch (t) { - case "f32" : - return f32; - case "f64" : - return f64; - default: - throw [ - Caml_builtin_exceptions.assert_failure, - [ - "text/lexer.mll", - 57, - 9 - ] - ]; - } -} - -function numop(t, i32, i64, f32, f64) { - switch (t) { - case "f32" : - return f32; - case "f64" : - return f64; - case "i32" : - return i32; - case "i64" : - return i64; - default: - throw [ - Caml_builtin_exceptions.assert_failure, - [ - "text/lexer.mll", - 65, - 9 - ] - ]; - } -} - -function memsz(sz, m8, m16, m32) { - switch (sz) { - case "16" : - return m16; - case "32" : - return m32; - case "8" : - return m8; - default: - throw [ - Caml_builtin_exceptions.assert_failure, - [ - "text/lexer.mll", - 72, - 9 - ] - ]; - } -} - -function ext(e, s, u) { - var switcher = e - 115 | 0; - if (switcher > 2 || switcher < 0) { - throw [ - Caml_builtin_exceptions.assert_failure, - [ - "text/lexer.mll", - 78, - 9 - ] - ]; - } - else { - switch (switcher) { - case 0 : - return s; - case 1 : - throw [ - Caml_builtin_exceptions.assert_failure, - [ - "text/lexer.mll", - 78, - 9 - ] - ]; - case 2 : - return u; - - } - } -} - -var opt = Lib.Option[/* get */0]; - -var __ocaml_lex_tables = /* record */[ - /* lex_base */"\0\0o\xffp\xffq\xffr\xff\x01\0U\0\x07\0\x1b\0\x05\0o\0o\0t\0\x06\0j\0\x0e\0k\0y\0\x10\0y\0s\0\xb4\0\x01\x01z\0\xbe\0\xc5\0\x04\x01\x1a\x01\xfe\xff\x02\0s\xff\x13\0<\x01R\x01x\x01\"\0\x8f\x01\xd5\x01\x0e\x01\xee\x01/\x02>\x02U\x02\x96\x02\xa0\x02O\0D\0\xac\x02\xc2\x02\xe7\x02\0\x03&\x03L\x03z\0|\0~\0\x86\0|\0y\0\xfb\xff\x85\0\0\0\x0f\0\x87\0r\x03\x98\x03\xb1\0\xe8\xff\r\0\x10\0\xee\0\xad\0\xb6\0\xbb\0\xc2\0\x82\xff\xb4\0x\xff\0\0\x9c\x02\xb8\0\xbb\0\xf1\0\xca\0\xbf\0\xc2\0\xe3\0\xf2\0\xef\0\xe4\0\xf8\0\xeb\0\xf3\0*\x01\n\x01\xe6\0\xe8\0\xf5\0\xf7\0\xf7\0\xf5\xff\xd7\xff\xd6\xff\0\0\x01\0\x16\x01\x14\x01j\x01\x1c\0\x1a\0\x1b\x01\b\x01\xdb\xff\x19\x01\xb3\xff\xb4\xff'\x01\xb1\xff\xb2\xff3\x01\x1a\x01\x1e\x01\x1e\x01,\x01\xae\x01\x1f\0&\0\xda\xff\xcc\xffA\x01\xc3\xffV\x01\xc1\xff\xc2\xff3\x01A\x019\x01>\x01\xd5\xfff\x01h\x01\xcd\xff\xc6\xffa\x01\xcb\xffX\x01p\x01c\x01\xc9\xff\xca\xffc\x01w\x01t\x01\x84\x01r\x01\xc7\xff\xc8\xffu\x01\x85\x01y\x01|\x01{\x01\x89\x01{\x01\0\0\x90\x01*\0,\0\x97\xff\x8b\x01\xbf\xff\xc0\xff\xc5\xff\x86\x01\xc4\xff\x7f\x01\xb7\xff\xb5\xff\x9b\x01\x9c\x01\x89\x01\xaf\xff\xb0\xff\x9c\x01\xad\xff\xae\xff\xa3\x01\xa0\x01\xe3\x01\xaa\x01\xde\x01\xe1\x01\xa6\xff\xa8\x01\xba\x01\xc6\x01\xcb\x01\xb8\x01\xfd\x01\xff\x01\xcf\x01\t\x02\t\x02\f\x02\xa1\xff\x9f\xff\xda\x01\x0e\x02\x0e\x02\x11\x02\xa0\xff\x9e\xff\x18\x02~\x03\xd6\x01\xe6\x01\xdf\x01\xdb\x01\xd6\x01\xe8\x01\xe4\x01\xe7\x01\xe6\x01\xf4\x01\xe6\x01,\x02\xf6\x01'\x026\x02\x96\xff\xf8\x01\b\x02\n\x02\x15\x02\x1b\x02\b\x02M\x02O\x02&\x02]\x02_\x02\xa5\xff)\x02`\x02b\x02\xa4\xff&\x02*\x02)\x02\x86\xff.\x02\xf2\xff\xf8\xff\xf9\xff\xfa\xff\xd1\x03F\x04\xf7\xff9\x04\xa4\x047\x02r\x02u\x02z\x02\xb7\x03D\x02H\x029\x02F\x02K\x02>\x02E\x02Q\x02M\x02M\x02\xbd\x03\x97\x02T\x02x\x02F\x02t\x02^\x02R\x02g\x02\x8a\x02x\x02\xbd\x02\xbf\x02\x86\x02\xcf\x02\xca\x02\xd2\x02\x9d\xff\x9b\xff\xa4\x02\xdf\x02\xe2\x02\xef\x02\x9c\xff\x9a\xff\xaf\x02\xba\x02\xbd\x02\xb7\x02\xb8\xff\xba\x02\xd1\xff\xa9\xff\xaa\xff\xce\x02\xd7\x02\xdd\xff\xda\x02\xcb\x02\xcf\x02\xcd\x02\xdb\x02\xdc\xff\xd3\x02\xd2\xff\xbd\xff\xee\x02\xdc\x02\xd4\xff\xeb\x02\xdf\x02\xec\x02\xce\xff\t\x03\xfb\x02\xd3\xff\xbe\xff\0\x03\x02\x03\0\x03\xd0\xff\xfe\x02\x06\x03\x12\x03\xcf\xff\xfe\x02\t\x03\f\x03\xbc\xff\xba\xff\xb9\xff\f\x03\x05\x03\xbb\xff\x17\x03\x1f\x03/\x03f\x031\x03b\x03e\x03\xa3\xff\xac\xff\xa7\xff\xa8\xff1\x03-\x03(\x038\x03,\x03/\x03.\x03<\x038\x03\x8a\x03Q\x03\x88\x03\x8b\x03\x99\xff\x90\x03\x1f\x04Z\x03N\x03X\x03S\x03V\x03U\x03Q\x03a\x03\x98\x03l\x03\xad\x03\xb2\x03\xa2\xff}\x03y\x03t\x03\x84\x03}\x03\x84\x03\x83\x03\x92\x03\x8b\x03\xd1\x03\xa2\x03\xd6\x03\xd9\x03\x98\xff\xab\x03\x92\xff\x9c\x03\xa7\x03\x98\x03\xb3\x03\xaa\x03\xb2\x03\xbe\x03\xf4\xff\xbf\x03\xb9\x03\xeb\x03\x97\x04\xa2\x04\xac\x04\xb6\x04\xdc\x04\xc9\x03\xbd\x03\xbc\x03\xd9\x03\xc0\x04\xc1\x03\xc8\x03\xd6\x03\xce\x03\xce\x03\xd0\x03\xdf\x03\xd5\x03\xdc\x03\xd4\x03\xd2\x03\xf9\x03\x02\x04\x0f\x04\x80\xff\xfe\x03\x14\x04\n\x04\x0e\x04\x14\x04\x7f\xff\x13\x04\r\x04(\x04\x1f\x04\x1b\x04\x14\x04-\x04$\x04+\x041\x04~\xff*\x04.\x04*\x04.\x04?\x04?\x047\x04_\x04}\xff|\x04|\x04\x80\x04\x85\x04\x95\x04\x87\x04\x95\x04\x8f\x04{\xff\x9d\x04\x8f\x04z\xff\x99\x04\xa1\x04\x8e\x04\x91\x04\x91\x04\x9d\x04\x98\x04\x9a\x04y\xff\x9c\x04\xa6\x04\x97\x04\xf3\xff\xa1\x04\xba\x04\xc2\x04\x8c\xff\xb9\x04\xb8\x04\xb2\x04\x8a\xff\xba\x04\xc9\x04\xce\x04\xcd\x04\xc9\x04\xd5\x04\xd5\x04\xcc\x04\xd4\x04\xf1\xff\xc6\x04\xcc\x04\xcc\x04\xf0\xff\xe2\x04\x88\xff\xe5\x04\xd6\x04\xe4\x04\xdd\x04\xef\xff\xe0\x04\xe9\x04\xe5\x04\xeb\xff\xea\x04\xe1\x04\xe9\x04\xea\xff\xec\x04\xef\x04\xe1\x04\xee\xff\xe6\x04\x8e\xff\xe3\x04\xf0\x04\xf2\x04\xed\xff\xea\x04\xf3\x04\xe6\xff\x89\xff\xea\x04\xe8\x04\xe8\x04\x85\xff\xf6\x04\xf5\x04\xea\x04\xeb\x04\xef\x04\xf4\x04\xe9\xff\xf8\x04\xf1\x04\x8f\xff\xf3\x04\xf3\x04\x03\x05\xf9\x04\x83\xff\n\x05\xfd\x04\t\x05\n\x05\x02\x05\xe7\xff\x12\x05\x06\x05\x04\x05\x11\x05\x14\x05\n\x05\xe0\xff\x12\x05\x93\xff\f\x05\x14\x05\x8b\xff\b\x05\x1a\x05\x10\x05\x1e\x05\x19\x05\x1c\x05\f\x05\xe5\xff\x1a\x05\x16\x05\x14\x05\"\x05&\x05\x1c\x05\xe1\xff\x1a\x05(\x05*\x05 \x05\xde\xff\x1b\x05\x1a\x05\x91\xff&\x05 \x05\x1d\x05\x84\xff \x05'\x05(\x056\x05-\x05)\x054\x050\x05(\x056\x059\x05)\x05\xe3\xff,\x05:\x052\x05-\x05C\x056\x05@\x059\x058\x056\x050\x05\x95\xff;\x05<\x058\x05N\x05G\x05C\x05A\x05N\x05Q\x05H\x05\xe2\xffF\x05T\x05V\x05L\x05\xdf\xffB\x05[\x05N\x05W\x05P\x05O\x05M\x05G\x05\x94\xff_\x05a\x05W\x05\x8d\xffP\x05_\x05S\x05b\x05T\x05\x8c\x05\x9a\x05\xa4\x05\xae\x05\xb8\x05\xcf\x05\x82\x05~\x05\x80\x05w\xff\x83\x05\x95\x05\x8a\x05\x90\xff\x15\x06\xee\x05t\xffu\xff\x02\x06\xfb\xff\xfc\xff\xfd\xff\xce\x05\x01\0\xff\xff\xfe\xff", - /* lex_backtrk */"\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x90\0\x90\0\x90\0\x90\0\x90\0\x90\0\x90\0\x90\0\x90\0\x90\0\x90\0\x90\0\x90\0\x90\0\x90\0\x90\0\x90\0\x90\0\x90\0\x90\0\x90\0\x02\0\x02\0\xff\xff\0\0\xff\xff\xff\xff\x04\0\xff\xff\x02\0\xff\xff\xff\xff\x02\0\xff\xff\x02\0\x04\0\xff\xff\x04\0\x04\0\xff\xff\xff\xff\xff\xff\x03\0\x03\0\xff\xff\x03\0\x03\0\x03\0\xff\xff\x04\0\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x04\0\xff\xff\xff\xff\xff\xff\x04\0\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\t\0\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\"\0\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff#\0\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xffI\0\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\t\0\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\b\0\b\0\xff\xff\xff\xff\xff\xff\t\0\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xffT\0\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\t\0\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff'\0'\0\xff\xff'\0\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x83\0\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x13\0\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x1b\0\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff~\0\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xffx\0\xff\xff&\0&\0\xff\xff&\0\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x89\0\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x04\0\x04\0\xff\xff\xff\xff", - /* lex_default */"\x01\0\0\0\0\0\0\0\0\0\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\0\x01\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\0\0\xff\xff\0\0\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\0\0\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\0\0\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\0\0\xff\xff\0\0\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\0\0\0\0\0\0\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\0\0\xff\xff\0\0\0\0\xff\xff\0\0\0\0\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\0\0\0\0\xff\xff\0\0\xff\xff\0\0\0\0\xff\xff\xff\xff\xff\xff\xff\xff\0\0\xff\xff\xff\xff\0\0\0\0\xff\xff\0\0\xff\xff\xff\xff\xff\xff\0\0\0\0\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\0\0\0\0\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\0\0\xff\xff\0\0\0\0\0\0\xff\xff\0\0\xff\xff\0\0\0\0\xff\xff\xff\xff\xff\xff\0\0\0\0\xff\xff\0\0\0\0\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\0\0\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\0\0\0\0\xff\xff\xff\xff\xff\xff\xff\xff\0\0\0\0\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\0\0\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\0\0\xff\xff\xff\xff\xff\xff\0\0\xff\xff\xff\xff\xff\xff\0\0\xff\xff\0\0\0\0\0\0\0\0\x01\x01\0\x01\0\0\xff\xff\0\x01\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\0\0\0\0\xff\xff\xff\xff\xff\xff\xff\xff\0\0\0\0\xff\xff\xff\xff\xff\xff\xff\xff\0\0\xff\xff\0\0\0\0\0\0\xff\xff\xff\xff\0\0\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\0\0\xff\xff\0\0\0\0\xff\xff\xff\xff\0\0\xff\xff\xff\xff\xff\xff\0\0\xff\xff\xff\xff\0\0\0\0\xff\xff\xff\xff\xff\xff\0\0\xff\xff\xff\xff\xff\xff\0\0\xff\xff\xff\xff\xff\xff\0\0\0\0\0\0\xff\xff\xff\xff\0\0\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\0\0\0\0\0\0\0\0\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\0\0\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\0\0\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\0\0\xff\xff\0\0\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\0\0\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\0\0\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\0\0\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\0\0\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\0\0\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\0\0\xff\xff\xff\xff\0\0\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\0\0\xff\xff\xff\xff\xff\xff\0\0\xff\xff\xff\xff\xff\xff\0\0\xff\xff\xff\xff\xff\xff\0\0\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\0\0\xff\xff\xff\xff\xff\xff\0\0\xff\xff\0\0\xff\xff\xff\xff\xff\xff\xff\xff\0\0\xff\xff\xff\xff\xff\xff\0\0\xff\xff\xff\xff\xff\xff\0\0\xff\xff\xff\xff\xff\xff\0\0\xff\xff\0\0\xff\xff\xff\xff\xff\xff\0\0\xff\xff\xff\xff\0\0\0\0\xff\xff\xff\xff\xff\xff\0\0\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\0\0\xff\xff\xff\xff\0\0\xff\xff\xff\xff\xff\xff\xff\xff\0\0\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\0\0\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\0\0\xff\xff\0\0\xff\xff\xff\xff\0\0\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\0\0\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\0\0\xff\xff\xff\xff\xff\xff\xff\xff\0\0\xff\xff\xff\xff\0\0\xff\xff\xff\xff\xff\xff\0\0\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\0\0\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\0\0\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\0\0\xff\xff\xff\xff\xff\xff\xff\xff\0\0\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\0\0\xff\xff\xff\xff\xff\xff\0\0\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\0\0\xff\xff\xff\xff\xff\xff\0\0\xff\xff\xa9\x02\0\0\0\0\xad\x02\0\0\0\0\0\0\xff\xff\xff\xff\0\0\0\0", - /* lex_trans */'\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x04\0\x03\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x04\0\0\0\x16\0\0\0\x06\0\0\0\0\0\0\0\x1d\0\x1c\0\xb2\x02\x19\0\0\0\x19\0O\0\xa5\0\x1b\0\x1a\0\x1a\0\x1a\0\x1a\0\x1a\0\x1a\0\x1a\0\x1a\0\x1a\0>\0\x05\0\xa9\x02\x1e\0,\0?\0,\0\xd4\0N\0+\0+\0+\0+\0+\0+\0+\0+\0+\0+\0&\0n\0&\0n\0\x7f\0(\0(\0(\0(\0(\0(\0(\0(\0(\0(\0\x7f\0\xa7\0\xa8\0t\0q\0\x14\0\x10\0\n\0\x11\0\x0e\0\x15\0\t\0\xa4\x02\x18\0z\x02#\x02\x0f\0\x13\0\x17\0\b\0\x07\0x\x02\r\0\x0b\0\f\0\x12\0\xa8\x02y\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\x11\x02\xf4\x01\xa8\x02\xa8\x02\x96\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\x95\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02<\0\xa8\x025\0\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02`\x02\xa8\x02D\x02\xa8\x02F\x022\x02\x18\x02\x05\x02\x19\x024\x02\xfe\x01<\x005\x02\x04\x02\xe8\x01\x96\x016\0\x97\x01\x17\x02E\x02_\x027\0\x95\x01\x06\x01\xe9\x01\xfa\0\x05\x01\xff\x018\x003\x02\xea\x019\0:\0E\0;\0=\0D\x000\0/\0/\0/\0/\0/\0/\0/\0/\0/\0@\0\x02\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfd\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xf6\0L\0\xfe\0C\0I\0J\0K\0M\0\x04\x01\xc1\0B\0F\0\xba\0.\0\xb1\0\xaf\0\xad\0 \0-\0\x1a\0\x1a\0\x1a\0\x1a\0\x1a\0\x1a\0\x1a\0\x1a\0\x1a\0\x1a\0(\0(\0(\0(\0(\0(\0(\0(\0(\0(\0 \0\x1f\0\x1a\0\x1a\0\x1a\0\x1a\0\x1a\0\x1a\0\x1a\0\x1a\0\x1a\0\x1a\x006\0\xac\0\xb2\0\x97\0\x91\0\x8f\0\x86\0w\0\x8c\0\xff\0G\0\x1f\0f\0\x96\0e\0b\0H\0\xb3\0\x8b\0y\0x\0\x1f\0c\0d\0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0`\0j\0k\0a\0o\0p\0\x80\0p\0_\0\x1f\0\xfc\0\x1f\0"\0"\0"\0"\0"\0"\0"\0"\0"\0"\0s\0z\0r\0g\0{\0|\0!\0"\0"\0"\0"\0"\0"\0i\0v\0m\0u\0l\0h\0\x82\0\x83\0\x1f\0n\0\x87\0\x88\0\x81\0$\0\x89\0"\0"\0"\0"\0"\0"\0"\0"\0"\0"\0\x8a\0"\0"\0"\0"\0"\0"\0"\0"\0"\0"\0%\0"\0$\0$\0$\0$\0$\0$\0$\0$\0$\0$\0\x85\0\x8e\0\x84\0\x8d\0\x90\0\x92\0\x93\0$\0$\0$\0$\0)\0$\0\x95\0\xa9\0\x94\0"\0"\0"\0"\0%\0"\0~\0\x98\0}\0\x9d\0\x9a\0\x99\0\x9c\0\x7f\0\x9b\0#\0\x9e\0\x9f\0\xa0\0\xa1\0\xa2\0\xa3\0\xa4\0$\0$\0$\0$\0)\0$\0\xa6\0\xab\0\xae\0\xb0\0\xb7\0\xb4\0\xb6\0\xaa\0\xb5\0#\0&\0\xfd\0&\0$\0\xbb\0\'\0\'\0\'\0\'\0\'\0\'\0\'\0\'\0\'\0\'\0\xb9\0\xbc\0\xb8\0\xbd\0\xbe\0\xbf\0\xc0\0"\0"\0"\0"\0%\0"\0$\0\xc2\0\'\0\'\0\'\0\'\0\'\0\'\0\'\0\'\0\'\0\'\0\xc3\0\xc4\0\xc5\0\xc7\0\xce\0\xc6\0\xc8\0"\0"\0"\0"\0%\0"\0\xc9\0"\0"\0"\0"\0%\0"\0\xcb\0\xcd\0\xcc\0\xca\0\xcf\0\xd1\0\xd3\0\xd2\0\xd0\0#\0\xd5\0\xaf\0\xd9\0\xda\0\xdb\0\xd8\0\x99\0\xdc\0\xe6\0"\0"\0"\0"\0%\0"\0\x96\0\xdd\0\xde\0\xdf\0\xe0\0\xe1\0\xe2\0\xe3\0\xe4\0#\0(\0(\0(\0(\0(\0(\0(\0(\0(\0(\0&\0\xe5\0&\0\xe7\0\xe8\0*\0*\0*\0*\0*\0*\0*\0*\0*\0*\0\xe9\0\xea\0\xeb\0\xed\0\xf2\0\xec\0\xee\0$\0$\0$\0$\0)\0$\0*\0*\0*\0*\0*\0*\0*\0*\0*\0*\0\xef\0\xf0\0\xf1\0\xf3\0\xf4\0\xf5\0\xf7\0$\0$\0$\0$\0)\0$\0\xf8\0\xf9\0\xfb\0$\0$\0$\0$\0)\0$\0\x93\x01v\x01\x07\x01\b\x01h\x01e\x01Z\x01T\x01f\x01#\0[\x01P\x01L\x01A\x01I\x01U\x01H\x01$\0$\0$\0$\0)\0$\0g\x011\x019\x01,\x01V\x01:\x018\x01\x1a\x01\x1b\x01#\0+\0+\0+\0+\0+\0+\0+\0+\0+\0+\0+\0+\0+\0+\0+\0+\0+\0+\0+\0+\0 \0\x1c\x01/\0/\0/\0/\0/\0/\0/\0/\0/\0/\0\x18\x01c\0\x17\x01\x1d\x01\x19\x01\x1f\x01&\x01\x1e\x01 \x01!\x01 \0\x1f\0/\0/\0/\0/\0/\0/\0/\0/\0/\0/\0\x15\x01Z\0%\x01^\0X\0T\0#\x01R\0$\x01"\x01\x16\x01\x1f\0]\0Y\0S\0V\0[\0\'\x01W\0\\\0P\0\x1f\0)\x01Q\0U\0(\x01+\x012\x002\x002\x002\x002\x002\x002\x002\x002\x002\0*\x01-\x01.\x01/\x010\x012\x01\x1f\x002\x002\x002\x002\x002\x002\0$\x006\x012\x002\x002\x002\x002\x002\x002\x002\x002\x002\x001\x007\x01@\x01>\x01;\x01<\x01=\x012\x002\x002\x002\x003\x002\0?\x012\x002\x002\x002\x002\x002\0D\x01B\x01E\x01&\0F\x01&\0$\0C\x014\x004\x004\x004\x004\x004\x004\x004\x004\x004\0G\x012\x002\x002\x002\x003\x002\x002\x002\x002\x002\x003\x002\0K\x01J\x01M\x01#\0N\x01O\x01Q\x01R\x01S\x01Y\x01X\x01W\x01]\x01$\0\\\x014\x004\x004\x004\x004\x004\x004\x004\x004\x004\0^\x012\x002\x002\x002\x003\x002\x002\x002\x002\x002\x003\x002\0_\x01`\x01a\x01#\0b\x01c\x01d\x01i\x01j\x01k\x01l\x01m\x01n\x01o\x01p\x01A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0q\x012\x002\x002\x002\x003\x002\0A\0A\0A\0A\0A\0A\0r\x01s\x01t\x01#\0u\x01w\x01\x85\x01{\x01[\x01|\x01}\x01~\x01\x7f\x01\x80\x01\x81\x01A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0\x82\x01A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0Z\0\x83\x01^\0X\0\xd6\0\x84\x01R\0\x86\x01\x87\x01\x88\x01\x89\x01]\0Y\0S\0V\0[\0\x8a\x01\xd7\0\\\0P\0\x03\x01\x8b\x01\x8c\x01U\0\x8d\x01\x03\x01A\0A\0A\0A\0A\0A\0\x8e\x01\x8f\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x90\x01\x91\x01\x92\x01\x94\x01\xa5\x01\x9d\x01\x98\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x10\x01\x99\x01\x14\x01\f\x01\x0b\x01\x0f\x01\n\x01\x9a\x01\x9b\x01\x9c\x013\x01\x13\x01\r\x01\x11\x01\x9e\x01\x9f\x01\xa0\x01\t\x01\x12\x01\x0e\x015\x01\x03\x01\xa6\x01\xa7\x01\xa8\x014\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\xa9\x01\xdf\x01\xdc\x01\xd3\x01\xca\x01\xbf\x01\xb9\x01\x03\x01\xb1\x01\xb2\x01\xb3\x01\xb4\x01\xb5\x01\x03\x01\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfd\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xb6\x01\xb7\x01\xfe\0\0\x01\0\x01\0\x01\0\x01\0\x01\0\x01\0\x01\0\x01\0\x01\0\x01\xb8\x01\xba\x01\xbb\x01\xbc\x01\xbd\x01\xbe\x01\xc0\x01\0\x01\0\x01\0\x01\0\x01\0\x01\0\x01\x10\x01\xc1\x01\x14\x01z\x01\x0b\x01\x0f\x01\n\x01\xc2\x01\xc3\x01\xc4\x01\xc5\x01\x13\x01\r\x01\x11\x01\xc6\x01y\x01\xc7\x01x\x01\x12\x01\x0e\x01\xc8\x01\xc9\x01\xcb\x01\xcc\x01\xcd\x01\xce\x01\0\x01\0\x01\0\x01\0\x01\0\x01\0\x01\xcf\x01\xd0\x01\xff\0\xd1\x01\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfd\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xfc\0\xd2\x01\xfc\0\xfe\0\xa2\x01\xa1\x01\xa1\x01\xa1\x01\xa1\x01\xa1\x01\xa1\x01\xa1\x01\xa1\x01\xa1\x01\xff\xff\xa1\x01\xa1\x01\xa1\x01\xa1\x01\xa1\x01\xa1\x01\xa1\x01\xa1\x01\xa1\x01\xa1\x01\xa1\x01\xa1\x01\xa1\x01\xa1\x01\xa1\x01\xa1\x01\xa1\x01\xa1\x01\xa1\x01\xa1\x01\xa4\x01\xa4\x01\xa4\x01\xa4\x01\xa4\x01\xa4\x01\xa4\x01\xa4\x01\xa4\x01\xa4\x01\xd4\x01\xd5\x01\xd6\x01\xd7\x01\xd8\x01\xd9\x01\xda\x01\xa4\x01\xa4\x01\xa4\x01\xa4\x01\xa4\x01\xa4\x01\xdb\x01\xdd\x01\xde\x01\xff\0\xe0\x01\xe1\x01\xe2\x01\xe3\x01\xe4\x01\xe5\x01\xe6\x01\xe7\x01\xf0\x01\xec\x01\xeb\x01\xa4\x01\xa4\x01\xa4\x01\xa4\x01\xa4\x01\xa4\x01\xa4\x01\xa4\x01\xa4\x01\xa4\x01\xed\x01\xa4\x01\xa4\x01\xa4\x01\xa4\x01\xa4\x01\xa4\x01\xa4\x01\xa4\x01\xa4\x01\xa4\x01\xa4\x01\xa4\x01\xfc\0\xa3\x01\xaa\x01\xee\x01\xef\x01\xf1\x01\xaf\x01\xf2\x01\xf3\x01\xf5\x01\xb0\x01\xf6\x01\xf7\x01\xf8\x01\xf9\x01\xac\x01\xae\x01\xab\x01\xad\x01\xfa\x01\xfb\x01\xfc\x01\xfd\x01\x02\x02\0\x02\x01\x02\xa4\x01\xa4\x01\xa4\x01\xa4\x01\xa4\x01\xa4\x01\x03\x02\t\x02\x06\x02\xfd\0\x07\x02\b\x02\x0b\x02\r\x02\f\x02\x0e\x02\x0f\x02\x10\x02\x12\x02\x15\x02\x14\x02\x16\x02\x1f\x02\n\x02\x1b\x02\x1a\x02\x1e\x02\x1d\x02 \x02!\x02\x13\x02"\x02$\x02-\x02*\x02\'\x02(\x02)\x02\x1c\x02+\x02,\x02.\x02/\x020\x02%\x02&\x021\x02A\x02?\x028\x026\x027\x029\x02:\x02;\x02<\x02=\x02>\x02@\x02B\x02C\x02[\x02X\x02H\x02L\x02I\x02J\x02K\x02M\x02S\x02O\x02G\x02P\x02N\x02Q\x02R\x02T\x02U\x02V\x02W\x02Y\x02Z\x02\\\x02]\x02^\x02l\x02a\x02b\x02c\x02d\x02e\x02f\x02g\x02h\x02i\x02j\x02k\x02m\x02n\x02o\x02p\x02q\x02r\x02\xfd\0s\x02t\x02u\x02v\x02w\x02\x91\x02\x88\x02{\x02|\x02}\x02\x83\x02\x7f\x02\x80\x02\x81\x02~\x02\x82\x02\x84\x02\x85\x02\x86\x02\x87\x02\x89\x02\x8a\x02\x8b\x02\x8c\x02\x8d\x02\x8e\x02\x8f\x02\x90\x02\x92\x02\x93\x02\x94\x02\xa0\x02\x97\x02\x98\x02\x99\x02\x9a\x02\x9b\x02\x9d\x02\x9c\x02\x9c\x02\x9c\x02\x9c\x02\x9c\x02\x9c\x02\x9c\x02\x9c\x02\x9c\x02\x9c\x02\x9c\x02\x9c\x02\x9c\x02\x9c\x02\x9c\x02\x9c\x02\x9c\x02\x9c\x02\x9c\x02\x9c\x02\x9c\x02\x9c\x02\x9c\x02\x9c\x02\x9c\x02\x9c\x02\x9c\x02\x9c\x02\x9c\x02\x9f\x02\x9f\x02\x9f\x02\x9f\x02\x9f\x02\x9f\x02\x9f\x02\x9f\x02\x9f\x02\x9f\x02\xa1\x02\xa2\x02\xa3\x02\xa5\x02\xa6\x02\xa7\x02\xaa\x02\x9f\x02\x9f\x02\x9f\x02\x9f\x02\x9f\x02\x9f\x02\x9f\x02\x9f\x02\x9f\x02\x9f\x02\x9f\x02\x9f\x02\x9f\x02\x9f\x02\x9f\x02\x9f\x02\xb3\x02\0\0\0\0\xaf\x02\0\0\0\0\0\0\x9f\x02\x9f\x02\x9f\x02\x9f\x02\x9f\x02\x9f\x02\0\0\0\0\0\0\x9f\x02\x9f\x02\x9f\x02\x9f\x02\x9f\x02\x9f\x02\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x9e\x02\0\0\0\0\0\0\xb0\x02\0\0\0\0\0\0\0\0\0\0\x9f\x02\x9f\x02\x9f\x02\x9f\x02\x9f\x02\x9f\x02\xa8\x02\0\0\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xb1\x02\0\0\xa8\x02\xa8\x02\0\0\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\0\0\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\0\0\xa8\x02\0\0\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\0\0\xa8\x02\0\0\xa8\x02\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\xab\x02\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\xae\x02\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0', - /* lex_check */"\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\0\0\0\0\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\0\0\xff\xff\0\0\xff\xff\0\0\xff\xff\xff\xff\xff\xff\0\0\0\0\xb1\x02\0\0\xff\xff\0\0N\0\xa4\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0=\0\0\0\x05\0\x1d\0\x1f\0>\0\x1f\0D\0E\0\x1f\0\x1f\0\x1f\0\x1f\0\x1f\0\x1f\0\x1f\0\x1f\0\x1f\0\x1f\0#\0l\0#\0m\0}\0#\0#\0#\0#\0#\0#\0#\0#\0#\0#\0~\0\xa6\0\xa7\0g\0h\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x07\0\0\0\t\0\r\0\0\0\0\0\0\0\0\0\0\0\t\0\0\0\0\0\0\0\0\0\x06\0\t\0\x06\0\x06\0\x06\0\x06\0\x06\0\x0f\0\x12\0\x06\0\x06\0\b\0\x06\0\x06\0\x06\0\x06\0\x06\0\x06\0\x06\0\x06\0\x06\0\x06\0\x06\0\x06\0\x06\0\x06\0\b\0\x06\0\x06\0\x06\0\x06\0\x06\0\x06\0\x06\0\x06\0\x06\0\x06\0\x06\0\x06\0\x06\0\x06\0\x06\0\x06\0\x06\0\x06\0\x06\0\x06\0\x06\0\x06\0\x06\0\x06\0\x06\0\x06\0\x06\0\x06\0\x06\0\x06\0\x06\0-\0\x06\0.\0\x06\0\x06\0\x06\0\x06\0\x06\0\x06\0\x06\0\x06\0\x06\0\x06\0\x06\0\x06\0\x06\0\x06\0\x06\0\x06\0\x06\0\x06\0\x06\0\x06\0\x06\0\x06\0\x06\0\x06\0\x06\0\x06\0\x06\0\x06\0\x06\0\n\0\x06\0\x0b\0\x06\0\x0b\0\f\0\x0e\0\x10\0\x0e\0\f\0\x11\0\x17\0\f\0\x10\0\x13\0\x14\x005\0\x14\0\x0e\0\x0b\0\n\x006\0\x14\0\x15\0\x13\0\x17\0\x15\0\x11\x007\0\f\0\x13\x008\x009\0\x18\0:\0<\0\x18\0\x19\0\x19\0\x19\0\x19\0\x19\0\x19\0\x19\0\x19\0\x19\0\x19\0?\0\0\0\x16\0\x16\0\x16\0\x16\0\x16\0\x16\0\x16\0\x16\0\x16\0\x16\0\x16\0\x16\0\x16\0\x16\0\x16\0\x16\0\x16\0\x16\0\x16\0\x16\0\x16\0\x16\0\x16\0\x16\0\x16\0\x16\0\x16\0\x16\0\x16\0\x16\0\x16\0\x16\0B\0G\0\x16\0\x18\0H\0I\0J\0L\0\x15\0P\0\x18\0\x18\0Q\0\x19\0S\0T\0U\0\x1a\0\x19\0\x1a\0\x1a\0\x1a\0\x1a\0\x1a\0\x1a\0\x1a\0\x1a\0\x1a\0\x1a\0&\0&\0&\0&\0&\0&\0&\0&\0&\0&\0\x1b\0\x1a\0\x1b\0\x1b\0\x1b\0\x1b\0\x1b\0\x1b\0\x1b\0\x1b\0\x1b\0\x1b\0F\0V\0R\0W\0X\0Y\0[\0\\\0Z\0\x16\0F\0\x1b\0_\0W\0`\0a\0F\0R\0Z\0\\\0\\\0\x1a\0b\0c\0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0^\0i\0j\0^\0n\0o\0x\0o\0^\0\x1b\0\x16\0 \0!\0!\0!\0!\0!\0!\0!\0!\0!\0!\0q\0y\0q\0]\0z\0{\0\x1b\0!\0!\0!\0!\0!\0!\0]\0t\0k\0t\0k\0]\0w\0\x81\0 \0k\0\x86\0\x87\0w\0\"\0\x88\0\"\0\"\0\"\0\"\0\"\0\"\0\"\0\"\0\"\0\"\0\x89\0!\0!\0!\0!\0!\0!\0\"\0\"\0\"\0\"\0\"\0\"\0$\0$\0$\0$\0$\0$\0$\0$\0$\0$\0\x83\0\x8b\0\x83\0\x8c\0\x8f\0\x91\0\x92\0$\0$\0$\0$\0$\0$\0\x93\0\x96\0\x93\0\"\0\"\0\"\0\"\0\"\0\"\0|\0\x97\0|\0\x98\0\x99\0\x97\0\x9a\0|\0\x9a\0\"\0\x9d\0\x9e\0\x9f\0\xa0\0\xa1\0\xa2\0\xa3\0$\0$\0$\0$\0$\0$\0\xa5\0\xa9\0\xad\0\xaf\0\xb2\0\xb3\0\xb4\0\xa9\0\xb4\0$\0%\0\x16\0%\0%\0\xba\0%\0%\0%\0%\0%\0%\0%\0%\0%\0%\0\xb7\0\xbb\0\xb7\0\xbc\0\xbd\0\xbe\0\xbf\0%\0%\0%\0%\0%\0%\0'\0\xc1\0'\0'\0'\0'\0'\0'\0'\0'\0'\0'\0\xc2\0\xc3\0\xc4\0\xc5\0\xc6\0\xc5\0\xc7\0'\0'\0'\0'\0'\0'\0\xc8\0%\0%\0%\0%\0%\0%\0\xc9\0\xca\0\xcb\0\xc9\0\xce\0\xcf\0\xd0\0\xd1\0\xcf\0%\0\xd4\0\xd6\0\xd8\0\xd9\0\xda\0\xd7\0\xd8\0\xdb\0\xd6\0'\0'\0'\0'\0'\0'\0\xd7\0\xdc\0\xdd\0\xde\0\xdf\0\xe0\0\xe1\0\xe2\0\xe3\0'\0(\0(\0(\0(\0(\0(\0(\0(\0(\0(\0)\0\xe4\0)\0\xe6\0\xe7\0)\0)\0)\0)\0)\0)\0)\0)\0)\0)\0\xe8\0\xe9\0\xea\0\xeb\0\xec\0\xeb\0\xed\0)\0)\0)\0)\0)\0)\0*\0*\0*\0*\0*\0*\0*\0*\0*\0*\0\xee\0\xef\0\xf0\0\xf2\0\xf3\0\xf4\0\xf6\0*\0*\0*\0*\0*\0*\0\xf7\0\xf8\0\xfa\0)\0)\0)\0)\0)\0)\0\x04\x01\x05\x01\x06\x01\x07\x01\t\x01\x0b\x01\f\x01\r\x01\n\x01)\0\f\x01\x0e\x01\x0f\x01\x11\x01\x10\x01\r\x01\x10\x01*\0*\0*\0*\0*\0*\0\n\x01\x15\x01\x12\x01\x17\x01\r\x01\x12\x01\x12\x01\x19\x01\x1a\x01*\0+\0+\0+\0+\0+\0+\0+\0+\0+\0+\0,\0,\0,\0,\0,\0,\0,\0,\0,\0,\0/\0\x1b\x01/\0/\0/\0/\0/\0/\0/\0/\0/\0/\0\x16\x01\x18\x01\x16\x01\x1c\x01\x18\x01\x1d\x01\x1e\x01\x1d\x01\x1f\x01 \x010\0/\x000\x000\x000\x000\x000\x000\x000\x000\x000\x000\0\x14\x01O\0\"\x01O\0O\0O\0!\x01O\0#\x01!\x01\x14\x010\0O\0O\0O\0O\0O\0&\x01O\0O\0O\0/\0'\x01O\0O\0'\x01(\x011\x001\x001\x001\x001\x001\x001\x001\x001\x001\0)\x01,\x01-\x01.\x01/\x011\x010\x001\x001\x001\x001\x001\x001\x002\x005\x012\x002\x002\x002\x002\x002\x002\x002\x002\x002\x000\x006\x018\x019\x01:\x01;\x01<\x012\x002\x002\x002\x002\x002\0>\x011\x001\x001\x001\x001\x001\0B\x01A\x01D\x013\0E\x013\x003\0A\x013\x003\x003\x003\x003\x003\x003\x003\x003\x003\0F\x012\x002\x002\x002\x002\x002\x003\x003\x003\x003\x003\x003\0H\x01I\x01L\x012\0M\x01N\x01P\x01Q\x01R\x01T\x01U\x01V\x01Z\x014\0[\x014\x004\x004\x004\x004\x004\x004\x004\x004\x004\0]\x013\x003\x003\x003\x003\x003\x004\x004\x004\x004\x004\x004\0^\x01_\x01`\x013\0a\x01b\x01c\x01h\x01i\x01j\x01k\x01l\x01m\x01n\x01o\x01@\0@\0@\0@\0@\0@\0@\0@\0@\0@\0p\x014\x004\x004\x004\x004\x004\0@\0@\0@\0@\0@\0@\0q\x01r\x01s\x014\0t\x01v\x01x\x01y\x01z\x01{\x01|\x01}\x01~\x01\x7f\x01\x80\x01A\0A\0A\0A\0A\0A\0A\0A\0A\0A\0\x81\x01@\0@\0@\0@\0@\0@\0A\0A\0A\0A\0A\0A\0\xd5\0\x82\x01\xd5\0\xd5\0\xd5\0\x83\x01\xd5\0\x85\x01\x86\x01\x87\x01\x88\x01\xd5\0\xd5\0\xd5\0\xd5\0\xd5\0\x89\x01\xd5\0\xd5\0\xd5\0\xff\0\x8a\x01\x8b\x01\xd5\0\x8c\x01\xff\0A\0A\0A\0A\0A\0A\0\x8d\x01\x8e\x01\xff\0\xff\0\xff\0\xff\0\xff\0\xff\0\xff\0\xff\0\xff\0\xff\0\x8f\x01\x90\x01\x91\x01\x93\x01\x95\x01\x96\x01\x97\x01\xff\0\xff\0\xff\0\xff\0\xff\0\xff\0\b\x01\x98\x01\b\x01\b\x01\b\x01\b\x01\b\x01\x99\x01\x9a\x01\x9b\x01\x13\x01\b\x01\b\x01\b\x01\x9d\x01\x9e\x01\x9f\x01\b\x01\b\x01\b\x01\x13\x01\xff\0\xa5\x01\xa6\x01\xa7\x01\x13\x01\xff\0\xff\0\xff\0\xff\0\xff\0\xff\0\xa8\x01\xaa\x01\xab\x01\xac\x01\xad\x01\xae\x01\xaf\x01\xff\0\xb0\x01\xb1\x01\xb2\x01\xb3\x01\xb4\x01\xff\0\0\x01\0\x01\0\x01\0\x01\0\x01\0\x01\0\x01\0\x01\0\x01\0\x01\0\x01\0\x01\0\x01\0\x01\0\x01\0\x01\0\x01\0\x01\0\x01\0\x01\0\x01\0\x01\0\x01\0\x01\0\x01\0\x01\0\x01\0\x01\0\x01\0\x01\0\x01\0\x01\xb5\x01\xb6\x01\0\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\xb7\x01\xb9\x01\xba\x01\xbb\x01\xbc\x01\xbd\x01\xbf\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01w\x01\xc0\x01w\x01w\x01w\x01w\x01w\x01\xc1\x01\xc2\x01\xc3\x01\xc4\x01w\x01w\x01w\x01\xc5\x01w\x01\xc6\x01w\x01w\x01w\x01\xc7\x01\xc8\x01\xca\x01\xcb\x01\xcc\x01\xcd\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\x02\x01\xce\x01\xcf\x01\0\x01\xd0\x01\x03\x01\x03\x01\x03\x01\x03\x01\x03\x01\x03\x01\x03\x01\x03\x01\x03\x01\x03\x01\x03\x01\x03\x01\x03\x01\x03\x01\x03\x01\x03\x01\x03\x01\x03\x01\x03\x01\x03\x01\x03\x01\x03\x01\x03\x01\x03\x01\x03\x01\x03\x01\x03\x01\x03\x01\x03\x01\x03\x01\x03\x01\x03\x01\xd1\x01\0\x01\x03\x01\xa0\x01\xa0\x01\xa0\x01\xa0\x01\xa0\x01\xa0\x01\xa0\x01\xa0\x01\xa0\x01\xa0\x01\xff\0\xa1\x01\xa1\x01\xa1\x01\xa1\x01\xa1\x01\xa1\x01\xa1\x01\xa1\x01\xa1\x01\xa1\x01\xa2\x01\xa2\x01\xa2\x01\xa2\x01\xa2\x01\xa2\x01\xa2\x01\xa2\x01\xa2\x01\xa2\x01\xa3\x01\xa3\x01\xa3\x01\xa3\x01\xa3\x01\xa3\x01\xa3\x01\xa3\x01\xa3\x01\xa3\x01\xd3\x01\xd4\x01\xd5\x01\xd6\x01\xd7\x01\xd8\x01\xd9\x01\xa3\x01\xa3\x01\xa3\x01\xa3\x01\xa3\x01\xa3\x01\xda\x01\xdc\x01\xdd\x01\x03\x01\xdf\x01\xe0\x01\xe1\x01\xe2\x01\xe3\x01\xe4\x01\xe5\x01\xe6\x01\xe8\x01\xe9\x01\xea\x01\xa4\x01\xa4\x01\xa4\x01\xa4\x01\xa4\x01\xa4\x01\xa4\x01\xa4\x01\xa4\x01\xa4\x01\xec\x01\xa3\x01\xa3\x01\xa3\x01\xa3\x01\xa3\x01\xa3\x01\xa4\x01\xa4\x01\xa4\x01\xa4\x01\xa4\x01\xa4\x01\x03\x01\xa2\x01\xa9\x01\xed\x01\xee\x01\xf0\x01\xa9\x01\xf1\x01\xf2\x01\xf4\x01\xa9\x01\xf5\x01\xf6\x01\xf7\x01\xf8\x01\xa9\x01\xa9\x01\xa9\x01\xa9\x01\xf9\x01\xfa\x01\xfb\x01\xfc\x01\xfe\x01\xff\x01\0\x02\xa4\x01\xa4\x01\xa4\x01\xa4\x01\xa4\x01\xa4\x01\x02\x02\x04\x02\x05\x02\0\x01\x06\x02\x07\x02\t\x02\n\x02\x0b\x02\r\x02\x0e\x02\x0f\x02\x11\x02\x12\x02\x13\x02\x15\x02\x17\x02\t\x02\x18\x02\x19\x02\x1b\x02\x1c\x02\x1f\x02 \x02\x11\x02!\x02#\x02$\x02%\x02&\x02'\x02(\x02\x18\x02*\x02+\x02-\x02.\x02/\x02#\x02#\x020\x022\x023\x024\x025\x026\x028\x029\x02:\x02;\x02<\x02=\x02?\x02A\x02B\x02D\x02E\x02F\x02G\x02H\x02I\x02J\x02L\x02M\x02N\x02F\x02O\x02L\x02P\x02Q\x02S\x02T\x02U\x02V\x02X\x02Y\x02[\x02\\\x02]\x02_\x02`\x02a\x02b\x02c\x02d\x02e\x02f\x02g\x02h\x02i\x02j\x02l\x02m\x02n\x02o\x02p\x02q\x02\x03\x01r\x02s\x02t\x02u\x02v\x02x\x02y\x02z\x02{\x02|\x02}\x02~\x02\x7f\x02\x80\x02|\x02\x81\x02\x83\x02\x84\x02\x85\x02\x86\x02\x88\x02\x89\x02\x8a\x02\x8b\x02\x8c\x02\x8d\x02\x8e\x02\x8f\x02\x91\x02\x92\x02\x93\x02\x95\x02\x96\x02\x97\x02\x98\x02\x99\x02\x9a\x02\x9b\x02\x9b\x02\x9b\x02\x9b\x02\x9b\x02\x9b\x02\x9b\x02\x9b\x02\x9b\x02\x9b\x02\x9c\x02\x9c\x02\x9c\x02\x9c\x02\x9c\x02\x9c\x02\x9c\x02\x9c\x02\x9c\x02\x9c\x02\x9d\x02\x9d\x02\x9d\x02\x9d\x02\x9d\x02\x9d\x02\x9d\x02\x9d\x02\x9d\x02\x9d\x02\x9e\x02\x9e\x02\x9e\x02\x9e\x02\x9e\x02\x9e\x02\x9e\x02\x9e\x02\x9e\x02\x9e\x02\xa0\x02\xa1\x02\xa2\x02\xa4\x02\xa5\x02\xa6\x02\xa9\x02\x9e\x02\x9e\x02\x9e\x02\x9e\x02\x9e\x02\x9e\x02\x9f\x02\x9f\x02\x9f\x02\x9f\x02\x9f\x02\x9f\x02\x9f\x02\x9f\x02\x9f\x02\x9f\x02\xb0\x02\xff\xff\xff\xff\xac\x02\xff\xff\xff\xff\xff\xff\x9f\x02\x9f\x02\x9f\x02\x9f\x02\x9f\x02\x9f\x02\xff\xff\xff\xff\xff\xff\x9e\x02\x9e\x02\x9e\x02\x9e\x02\x9e\x02\x9e\x02\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x9d\x02\xff\xff\xff\xff\xff\xff\xac\x02\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x9f\x02\x9f\x02\x9f\x02\x9f\x02\x9f\x02\x9f\x02\xa8\x02\xff\xff\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xac\x02\xff\xff\xa8\x02\xa8\x02\xff\xff\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xff\xff\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xff\xff\xa8\x02\xff\xff\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xa8\x02\xff\xff\xa8\x02\xff\xff\xa8\x02\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xa9\x02\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xac\x02\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff", - /* lex_base_code */"", - /* lex_backtrk_code */"", - /* lex_default_code */"", - /* lex_trans_code */"", - /* lex_check_code */"", - /* lex_code */"" -]; - -function token(lexbuf) { - var lexbuf$1 = lexbuf; - var ___ocaml_lex_state = 0; - while(true) { - var __ocaml_lex_state = ___ocaml_lex_state; - var __ocaml_lex_state$1 = Lexing.engine(__ocaml_lex_tables, __ocaml_lex_state, lexbuf$1); - if (__ocaml_lex_state$1 > 144 || __ocaml_lex_state$1 < 0) { - Curry._1(lexbuf$1[/* refill_buff */0], lexbuf$1); - ___ocaml_lex_state = __ocaml_lex_state$1; - continue ; - - } - else { - switch (__ocaml_lex_state$1) { - case 0 : - return /* LPAR */2; - case 1 : - return /* RPAR */3; - case 2 : - var s = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_curr_pos */5]); - return /* NAT */Block.__(0, [s]); - case 3 : - var s$1 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_curr_pos */5]); - return /* INT */Block.__(1, [s$1]); - case 4 : - var s$2 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_curr_pos */5]); - return /* FLOAT */Block.__(2, [s$2]); - case 5 : - var s$3 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_curr_pos */5]); - return /* TEXT */Block.__(3, [text(s$3)]); - case 6 : - return error(lexbuf$1, "unclosed text literal"); - case 7 : - return error(lexbuf$1, "illegal control character in text literal"); - case 8 : - return error_nest(Lexing.lexeme_end_p(lexbuf$1), lexbuf$1, "illegal escape"); - case 9 : - var t = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - return /* VALUE_TYPE */Block.__(5, [value_type(t)]); - case 10 : - var t$1 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - return /* CONST */Block.__(10, [numop(t$1, function (s) { - var n = Curry._1(I32.of_string, s[/* it */1]); - return /* tuple */[ - Operators.i32_const(Source.$at$at(n, s[/* at */0])), - /* I32 */Block.__(0, [n]) - ]; - }, function (s) { - var n = Curry._1(I64.of_string, s[/* it */1]); - return /* tuple */[ - Operators.i64_const(Source.$at$at(n, s[/* at */0])), - /* I64 */Block.__(1, [n]) - ]; - }, function (s) { - var n = Curry._1(F32.of_string, s[/* it */1]); - return /* tuple */[ - Operators.f32_const(Source.$at$at(n, s[/* at */0])), - /* F32 */Block.__(2, [n]) - ]; - }, function (s) { - var n = Curry._1(F64.of_string, s[/* it */1]); - return /* tuple */[ - Operators.f64_const(Source.$at$at(n, s[/* at */0])), - /* F64 */Block.__(3, [n]) - ]; - })]); - case 11 : - return /* ANYFUNC */0; - case 12 : - return /* MUT */1; - case 13 : - return /* NOP */4; - case 14 : - return /* UNREACHABLE */24; - case 15 : - return /* DROP */5; - case 16 : - return /* BLOCK */6; - case 17 : - return /* LOOP */12; - case 18 : - return /* END */7; - case 19 : - return /* BR */13; - case 20 : - return /* BR_IF */14; - case 21 : - return /* BR_TABLE */15; - case 22 : - return /* RETURN */18; - case 23 : - return /* IF */8; - case 24 : - return /* THEN */9; - case 25 : - return /* ELSE */10; - case 26 : - return /* SELECT */11; - case 27 : - return /* CALL */16; - case 28 : - return /* CALL_INDIRECT */17; - case 29 : - return /* GET_LOCAL */19; - case 30 : - return /* SET_LOCAL */20; - case 31 : - return /* TEE_LOCAL */21; - case 32 : - return /* GET_GLOBAL */22; - case 33 : - return /* SET_GLOBAL */23; - case 34 : - var t$2 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - return /* LOAD */Block.__(6, [(function(t$2){ - return function (a, o) { - var partial_arg = Curry._2(opt, a, 2); - var partial_arg$1 = Curry._2(opt, a, 3); - var partial_arg$2 = Curry._2(opt, a, 2); - var partial_arg$3 = Curry._2(opt, a, 3); - return Curry._1(numop(t$2, function (param) { - return Operators.i32_load(partial_arg, param); - }, function (param) { - return Operators.i64_load(partial_arg$1, param); - }, function (param) { - return Operators.f32_load(partial_arg$2, param); - }, function (param) { - return Operators.f64_load(partial_arg$3, param); - }), o); - } - }(t$2))]); - case 35 : - var t$3 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - return /* STORE */Block.__(7, [(function(t$3){ - return function (a, o) { - var partial_arg = Curry._2(opt, a, 2); - var partial_arg$1 = Curry._2(opt, a, 3); - var partial_arg$2 = Curry._2(opt, a, 2); - var partial_arg$3 = Curry._2(opt, a, 3); - return Curry._1(numop(t$3, function (param) { - return Operators.i32_store(partial_arg, param); - }, function (param) { - return Operators.i64_store(partial_arg$1, param); - }, function (param) { - return Operators.f32_store(partial_arg$2, param); - }, function (param) { - return Operators.f64_store(partial_arg$3, param); - }), o); - } - }(t$3))]); - case 36 : - var t$4 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - var sz = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4] + 8 | 0, lexbuf$1[/* lex_curr_pos */5] - 2 | 0); - var s$4 = Lexing.sub_lexeme_char(lexbuf$1, lexbuf$1[/* lex_curr_pos */5] - 1 | 0); - if (t$4 === "i32" && sz === "32") { - error(lexbuf$1, "unknown operator"); - } - return /* LOAD */Block.__(6, [(function(t$4,sz,s$4){ - return function (a, o) { - return intop(t$4, Curry._1(memsz(sz, Curry._1(ext(s$4, Operators.i32_load8_s, Operators.i32_load8_u), Curry._2(opt, a, 0)), Curry._1(ext(s$4, Operators.i32_load16_s, Operators.i32_load16_u), Curry._2(opt, a, 1)), function () { - return Operators.unreachable; - }), o), Curry._1(memsz(sz, Curry._1(ext(s$4, Operators.i64_load8_s, Operators.i64_load8_u), Curry._2(opt, a, 0)), Curry._1(ext(s$4, Operators.i64_load16_s, Operators.i64_load16_u), Curry._2(opt, a, 1)), Curry._1(ext(s$4, Operators.i64_load32_s, Operators.i64_load32_u), Curry._2(opt, a, 2))), o)); - } - }(t$4,sz,s$4))]); - case 37 : - var t$5 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - var sz$1 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4] + 9 | 0, lexbuf$1[/* lex_curr_pos */5]); - if (t$5 === "i32" && sz$1 === "32") { - error(lexbuf$1, "unknown operator"); - } - return /* STORE */Block.__(7, [(function(t$5,sz$1){ - return function (a, o) { - var partial_arg = Curry._2(opt, a, 0); - var partial_arg$1 = Curry._2(opt, a, 1); - var partial_arg$2 = Curry._2(opt, a, 0); - var partial_arg$3 = Curry._2(opt, a, 1); - var partial_arg$4 = Curry._2(opt, a, 2); - return intop(t$5, Curry._1(memsz(sz$1, function (param) { - return Operators.i32_store8(partial_arg, param); - }, function (param) { - return Operators.i32_store16(partial_arg$1, param); - }, function () { - return Operators.unreachable; - }), o), Curry._1(memsz(sz$1, function (param) { - return Operators.i64_store8(partial_arg$2, param); - }, function (param) { - return Operators.i64_store16(partial_arg$3, param); - }, function (param) { - return Operators.i64_store32(partial_arg$4, param); - }), o)); - } - }(t$5,sz$1))]); - case 38 : - var s$5 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4] + 7 | 0, lexbuf$1[/* lex_curr_pos */5]); - return /* OFFSET_EQ_NAT */Block.__(8, [s$5]); - case 39 : - var s$6 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4] + 6 | 0, lexbuf$1[/* lex_curr_pos */5]); - return /* ALIGN_EQ_NAT */Block.__(9, [s$6]); - case 40 : - var t$6 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - return /* UNARY */Block.__(11, [intop(t$6, Operators.i32_clz, Operators.i64_clz)]); - case 41 : - var t$7 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - return /* UNARY */Block.__(11, [intop(t$7, Operators.i32_ctz, Operators.i64_ctz)]); - case 42 : - var t$8 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - return /* UNARY */Block.__(11, [intop(t$8, Operators.i32_popcnt, Operators.i64_popcnt)]); - case 43 : - var t$9 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - return /* UNARY */Block.__(11, [floatop(t$9, Operators.f32_neg, Operators.f64_neg)]); - case 44 : - var t$10 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - return /* UNARY */Block.__(11, [floatop(t$10, Operators.f32_abs, Operators.f64_abs)]); - case 45 : - var t$11 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - return /* UNARY */Block.__(11, [floatop(t$11, Operators.f32_sqrt, Operators.f64_sqrt)]); - case 46 : - var t$12 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - return /* UNARY */Block.__(11, [floatop(t$12, Operators.f32_ceil, Operators.f64_ceil)]); - case 47 : - var t$13 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - return /* UNARY */Block.__(11, [floatop(t$13, Operators.f32_floor, Operators.f64_floor)]); - case 48 : - var t$14 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - return /* UNARY */Block.__(11, [floatop(t$14, Operators.f32_trunc, Operators.f64_trunc)]); - case 49 : - var t$15 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - return /* UNARY */Block.__(11, [floatop(t$15, Operators.f32_nearest, Operators.f64_nearest)]); - case 50 : - var t$16 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - return /* BINARY */Block.__(12, [intop(t$16, Operators.i32_add, Operators.i64_add)]); - case 51 : - var t$17 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - return /* BINARY */Block.__(12, [intop(t$17, Operators.i32_sub, Operators.i64_sub)]); - case 52 : - var t$18 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - return /* BINARY */Block.__(12, [intop(t$18, Operators.i32_mul, Operators.i64_mul)]); - case 53 : - var t$19 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - return /* BINARY */Block.__(12, [intop(t$19, Operators.i32_div_s, Operators.i64_div_s)]); - case 54 : - var t$20 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - return /* BINARY */Block.__(12, [intop(t$20, Operators.i32_div_u, Operators.i64_div_u)]); - case 55 : - var t$21 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - return /* BINARY */Block.__(12, [intop(t$21, Operators.i32_rem_s, Operators.i64_rem_s)]); - case 56 : - var t$22 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - return /* BINARY */Block.__(12, [intop(t$22, Operators.i32_rem_u, Operators.i64_rem_u)]); - case 57 : - var t$23 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - return /* BINARY */Block.__(12, [intop(t$23, Operators.i32_and, Operators.i64_and)]); - case 58 : - var t$24 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - return /* BINARY */Block.__(12, [intop(t$24, Operators.i32_or, Operators.i64_or)]); - case 59 : - var t$25 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - return /* BINARY */Block.__(12, [intop(t$25, Operators.i32_xor, Operators.i64_xor)]); - case 60 : - var t$26 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - return /* BINARY */Block.__(12, [intop(t$26, Operators.i32_shl, Operators.i64_shl)]); - case 61 : - var t$27 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - return /* BINARY */Block.__(12, [intop(t$27, Operators.i32_shr_s, Operators.i64_shr_s)]); - case 62 : - var t$28 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - return /* BINARY */Block.__(12, [intop(t$28, Operators.i32_shr_u, Operators.i64_shr_u)]); - case 63 : - var t$29 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - return /* BINARY */Block.__(12, [intop(t$29, Operators.i32_rotl, Operators.i64_rotl)]); - case 64 : - var t$30 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - return /* BINARY */Block.__(12, [intop(t$30, Operators.i32_rotr, Operators.i64_rotr)]); - case 65 : - var t$31 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - return /* BINARY */Block.__(12, [floatop(t$31, Operators.f32_add, Operators.f64_add)]); - case 66 : - var t$32 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - return /* BINARY */Block.__(12, [floatop(t$32, Operators.f32_sub, Operators.f64_sub)]); - case 67 : - var t$33 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - return /* BINARY */Block.__(12, [floatop(t$33, Operators.f32_mul, Operators.f64_mul)]); - case 68 : - var t$34 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - return /* BINARY */Block.__(12, [floatop(t$34, Operators.f32_div, Operators.f64_div)]); - case 69 : - var t$35 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - return /* BINARY */Block.__(12, [floatop(t$35, Operators.f32_min, Operators.f64_min)]); - case 70 : - var t$36 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - return /* BINARY */Block.__(12, [floatop(t$36, Operators.f32_max, Operators.f64_max)]); - case 71 : - var t$37 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - return /* BINARY */Block.__(12, [floatop(t$37, Operators.f32_copysign, Operators.f64_copysign)]); - case 72 : - var t$38 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - return /* TEST */Block.__(15, [intop(t$38, Operators.i32_eqz, Operators.i64_eqz)]); - case 73 : - var t$39 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - return /* COMPARE */Block.__(13, [intop(t$39, Operators.i32_eq, Operators.i64_eq)]); - case 74 : - var t$40 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - return /* COMPARE */Block.__(13, [intop(t$40, Operators.i32_ne, Operators.i64_ne)]); - case 75 : - var t$41 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - return /* COMPARE */Block.__(13, [intop(t$41, Operators.i32_lt_s, Operators.i64_lt_s)]); - case 76 : - var t$42 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - return /* COMPARE */Block.__(13, [intop(t$42, Operators.i32_lt_u, Operators.i64_lt_u)]); - case 77 : - var t$43 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - return /* COMPARE */Block.__(13, [intop(t$43, Operators.i32_le_s, Operators.i64_le_s)]); - case 78 : - var t$44 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - return /* COMPARE */Block.__(13, [intop(t$44, Operators.i32_le_u, Operators.i64_le_u)]); - case 79 : - var t$45 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - return /* COMPARE */Block.__(13, [intop(t$45, Operators.i32_gt_s, Operators.i64_gt_s)]); - case 80 : - var t$46 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - return /* COMPARE */Block.__(13, [intop(t$46, Operators.i32_gt_u, Operators.i64_gt_u)]); - case 81 : - var t$47 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - return /* COMPARE */Block.__(13, [intop(t$47, Operators.i32_ge_s, Operators.i64_ge_s)]); - case 82 : - var t$48 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - return /* COMPARE */Block.__(13, [intop(t$48, Operators.i32_ge_u, Operators.i64_ge_u)]); - case 83 : - var t$49 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - return /* COMPARE */Block.__(13, [floatop(t$49, Operators.f32_eq, Operators.f64_eq)]); - case 84 : - var t$50 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - return /* COMPARE */Block.__(13, [floatop(t$50, Operators.f32_ne, Operators.f64_ne)]); - case 85 : - var t$51 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - return /* COMPARE */Block.__(13, [floatop(t$51, Operators.f32_lt, Operators.f64_lt)]); - case 86 : - var t$52 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - return /* COMPARE */Block.__(13, [floatop(t$52, Operators.f32_le, Operators.f64_le)]); - case 87 : - var t$53 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - return /* COMPARE */Block.__(13, [floatop(t$53, Operators.f32_gt, Operators.f64_gt)]); - case 88 : - var t$54 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - return /* COMPARE */Block.__(13, [floatop(t$54, Operators.f32_ge, Operators.f64_ge)]); - case 89 : - return /* CONVERT */Block.__(14, [Operators.i32_wrap_i64]); - case 90 : - return /* CONVERT */Block.__(14, [Operators.i64_extend_s_i32]); - case 91 : - return /* CONVERT */Block.__(14, [Operators.i64_extend_u_i32]); - case 92 : - return /* CONVERT */Block.__(14, [Operators.f32_demote_f64]); - case 93 : - return /* CONVERT */Block.__(14, [Operators.f64_promote_f32]); - case 94 : - var t$55 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - return /* CONVERT */Block.__(14, [intop(t$55, Operators.i32_trunc_s_f32, Operators.i64_trunc_s_f32)]); - case 95 : - var t$56 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - return /* CONVERT */Block.__(14, [intop(t$56, Operators.i32_trunc_u_f32, Operators.i64_trunc_u_f32)]); - case 96 : - var t$57 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - return /* CONVERT */Block.__(14, [intop(t$57, Operators.i32_trunc_s_f64, Operators.i64_trunc_s_f64)]); - case 97 : - var t$58 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - return /* CONVERT */Block.__(14, [intop(t$58, Operators.i32_trunc_u_f64, Operators.i64_trunc_u_f64)]); - case 98 : - var t$59 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - return /* CONVERT */Block.__(14, [floatop(t$59, Operators.f32_convert_s_i32, Operators.f64_convert_s_i32)]); - case 99 : - var t$60 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - return /* CONVERT */Block.__(14, [floatop(t$60, Operators.f32_convert_u_i32, Operators.f64_convert_u_i32)]); - case 100 : - var t$61 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - return /* CONVERT */Block.__(14, [floatop(t$61, Operators.f32_convert_s_i64, Operators.f64_convert_s_i64)]); - case 101 : - var t$62 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_start_pos */4] + 3 | 0); - return /* CONVERT */Block.__(14, [floatop(t$62, Operators.f32_convert_u_i64, Operators.f64_convert_u_i64)]); - case 102 : - return /* CONVERT */Block.__(14, [Operators.f32_reinterpret_i32]); - case 103 : - return /* CONVERT */Block.__(14, [Operators.f64_reinterpret_i64]); - case 104 : - return /* CONVERT */Block.__(14, [Operators.i32_reinterpret_f32]); - case 105 : - return /* CONVERT */Block.__(14, [Operators.i64_reinterpret_f64]); - case 106 : - return /* CURRENT_MEMORY */25; - case 107 : - return /* GROW_MEMORY */26; - case 108 : - return /* TYPE */29; - case 109 : - return /* FUNC */27; - case 110 : - return /* START */28; - case 111 : - return /* PARAM */30; - case 112 : - return /* RESULT */31; - case 113 : - return /* LOCAL */32; - case 114 : - return /* GLOBAL */33; - case 115 : - return /* MODULE */34; - case 116 : - return /* TABLE */35; - case 117 : - return /* MEMORY */37; - case 118 : - return /* ELEM */36; - case 119 : - return /* DATA */38; - case 120 : - return /* OFFSET */39; - case 121 : - return /* IMPORT */40; - case 122 : - return /* EXPORT */41; - case 123 : - return /* SCRIPT */42; - case 124 : - return /* REGISTER */43; - case 125 : - return /* INVOKE */44; - case 126 : - return /* GET */45; - case 127 : - return /* ASSERT_MALFORMED */46; - case 128 : - return /* ASSERT_INVALID */47; - case 129 : - return /* ASSERT_SOFT_INVALID */48; - case 130 : - return /* ASSERT_UNLINKABLE */49; - case 131 : - return /* ASSERT_RETURN */50; - case 132 : - return /* ASSERT_RETURN_NAN */51; - case 133 : - return /* ASSERT_TRAP */52; - case 134 : - return /* ASSERT_EXHAUSTION */53; - case 135 : - return /* INPUT */54; - case 136 : - return /* OUTPUT */55; - case 137 : - var s$7 = Lexing.sub_lexeme(lexbuf$1, lexbuf$1[/* lex_start_pos */4], lexbuf$1[/* lex_curr_pos */5]); - return /* VAR */Block.__(4, [s$7]); - case 140 : - __ocaml_lex_comment_rec(Lexing.lexeme_start_p(lexbuf$1), lexbuf$1, 684); - return token(lexbuf$1); - case 141 : - return token(lexbuf$1); - case 139 : - case 142 : - Lexing.new_line(lexbuf$1); - return token(lexbuf$1); - case 138 : - case 143 : - return /* EOF */56; - case 144 : - return error(lexbuf$1, "unknown operator"); - - } - } - }; -} - -function __ocaml_lex_comment_rec(start, lexbuf, ___ocaml_lex_state) { - while(true) { - var __ocaml_lex_state = ___ocaml_lex_state; - var __ocaml_lex_state$1 = Lexing.engine(__ocaml_lex_tables, __ocaml_lex_state, lexbuf); - if (__ocaml_lex_state$1 > 4 || __ocaml_lex_state$1 < 0) { - Curry._1(lexbuf[/* refill_buff */0], lexbuf); - ___ocaml_lex_state = __ocaml_lex_state$1; - continue ; - - } - else { - switch (__ocaml_lex_state$1) { - case 0 : - return /* () */0; - case 1 : - __ocaml_lex_comment_rec(Lexing.lexeme_start_p(lexbuf), lexbuf, 684); - ___ocaml_lex_state = 684; - continue ; - case 2 : - Lexing.new_line(lexbuf); - ___ocaml_lex_state = 684; - continue ; - case 3 : - return error_nest(start, lexbuf, "unclosed comment"); - case 4 : - ___ocaml_lex_state = 684; - continue ; - - } - } - }; -} - -exports.convert_pos = convert_pos; -exports.token = token; -/* F32 Not a pure module */ -//////// end of lexer.js //////// -    return exports; -  }; - - - _registry['lexing'] = function() { -    let exports = {}; -//////// start of lexing.js //////// -'use strict'; - -var Sys = require("./sys"); -var Bytes = require("./bytes"); -var Curry = require("./curry"); -var Caml_bytes = require("./caml_bytes"); -var Caml_lexer = require("./caml_lexer"); -var Pervasives = require("./pervasives"); -var Caml_string = require("./caml_string"); -var Caml_builtin_exceptions = require("./caml_builtin_exceptions"); - -function engine(tbl, state, buf) { - var result = Caml_lexer.caml_lex_engine(tbl, state, buf); - if (result >= 0) { - buf[/* lex_start_p */10] = buf[/* lex_curr_p */11]; - var init = buf[/* lex_curr_p */11]; - buf[/* lex_curr_p */11] = /* record */[ - /* pos_fname */init[/* pos_fname */0], - /* pos_lnum */init[/* pos_lnum */1], - /* pos_bol */init[/* pos_bol */2], - /* pos_cnum */buf[/* lex_abs_pos */3] + buf[/* lex_curr_pos */5] | 0 - ]; - } - return result; -} - -function new_engine(tbl, state, buf) { - var result = Caml_lexer.caml_new_lex_engine(tbl, state, buf); - if (result >= 0) { - buf[/* lex_start_p */10] = buf[/* lex_curr_p */11]; - var init = buf[/* lex_curr_p */11]; - buf[/* lex_curr_p */11] = /* record */[ - /* pos_fname */init[/* pos_fname */0], - /* pos_lnum */init[/* pos_lnum */1], - /* pos_bol */init[/* pos_bol */2], - /* pos_cnum */buf[/* lex_abs_pos */3] + buf[/* lex_curr_pos */5] | 0 - ]; - } - return result; -} - -var zero_pos = /* record */[ - /* pos_fname */"", - /* pos_lnum */1, - /* pos_bol */0, - /* pos_cnum */0 -]; - -function from_function(f) { - var partial_arg = new Array(512); - return /* record */[ - /* refill_buff */function (param) { - var read_fun = f; - var aux_buffer = partial_arg; - var lexbuf = param; - var read = Curry._2(read_fun, aux_buffer, aux_buffer.length); - var n = read > 0 ? read : (lexbuf[/* lex_eof_reached */8] = /* true */1, 0); - if ((lexbuf[/* lex_buffer_len */2] + n | 0) > lexbuf[/* lex_buffer */1].length) { - if (((lexbuf[/* lex_buffer_len */2] - lexbuf[/* lex_start_pos */4] | 0) + n | 0) <= lexbuf[/* lex_buffer */1].length) { - Bytes.blit(lexbuf[/* lex_buffer */1], lexbuf[/* lex_start_pos */4], lexbuf[/* lex_buffer */1], 0, lexbuf[/* lex_buffer_len */2] - lexbuf[/* lex_start_pos */4] | 0); - } - else { - var newlen = Pervasives.min((lexbuf[/* lex_buffer */1].length << 1), Sys.max_string_length); - if (((lexbuf[/* lex_buffer_len */2] - lexbuf[/* lex_start_pos */4] | 0) + n | 0) > newlen) { - throw [ - Caml_builtin_exceptions.failure, - "Lexing.lex_refill: cannot grow buffer" - ]; - } - var newbuf = Caml_string.caml_create_string(newlen); - Bytes.blit(lexbuf[/* lex_buffer */1], lexbuf[/* lex_start_pos */4], newbuf, 0, lexbuf[/* lex_buffer_len */2] - lexbuf[/* lex_start_pos */4] | 0); - lexbuf[/* lex_buffer */1] = newbuf; - } - var s = lexbuf[/* lex_start_pos */4]; - lexbuf[/* lex_abs_pos */3] = lexbuf[/* lex_abs_pos */3] + s | 0; - lexbuf[/* lex_curr_pos */5] = lexbuf[/* lex_curr_pos */5] - s | 0; - lexbuf[/* lex_start_pos */4] = 0; - lexbuf[/* lex_last_pos */6] = lexbuf[/* lex_last_pos */6] - s | 0; - lexbuf[/* lex_buffer_len */2] = lexbuf[/* lex_buffer_len */2] - s | 0; - var t = lexbuf[/* lex_mem */9]; - for(var i = 0 ,i_finish = t.length - 1 | 0; i <= i_finish; ++i){ - var v = t[i]; - if (v >= 0) { - t[i] = v - s | 0; - } - - } - } - Bytes.blit(aux_buffer, 0, lexbuf[/* lex_buffer */1], lexbuf[/* lex_buffer_len */2], n); - lexbuf[/* lex_buffer_len */2] = lexbuf[/* lex_buffer_len */2] + n | 0; - return /* () */0; - }, - /* lex_buffer */new Array(1024), - /* lex_buffer_len */0, - /* lex_abs_pos */0, - /* lex_start_pos */0, - /* lex_curr_pos */0, - /* lex_last_pos */0, - /* lex_last_action */0, - /* lex_eof_reached : false */0, - /* lex_mem : int array */[], - /* lex_start_p */zero_pos, - /* lex_curr_p */zero_pos - ]; -} - -function from_channel(ic) { - return from_function(function (buf, n) { - return Pervasives.input(ic, buf, 0, n); - }); -} - -function from_string(s) { - return /* record */[ - /* refill_buff */function (lexbuf) { - lexbuf[/* lex_eof_reached */8] = /* true */1; - return /* () */0; - }, - /* lex_buffer */Bytes.of_string(s), - /* lex_buffer_len */s.length, - /* lex_abs_pos */0, - /* lex_start_pos */0, - /* lex_curr_pos */0, - /* lex_last_pos */0, - /* lex_last_action */0, - /* lex_eof_reached : true */1, - /* lex_mem : int array */[], - /* lex_start_p */zero_pos, - /* lex_curr_p */zero_pos - ]; -} - -function lexeme(lexbuf) { - var len = lexbuf[/* lex_curr_pos */5] - lexbuf[/* lex_start_pos */4] | 0; - return Bytes.sub_string(lexbuf[/* lex_buffer */1], lexbuf[/* lex_start_pos */4], len); -} - -function sub_lexeme(lexbuf, i1, i2) { - var len = i2 - i1 | 0; - return Bytes.sub_string(lexbuf[/* lex_buffer */1], i1, len); -} - -function sub_lexeme_opt(lexbuf, i1, i2) { - if (i1 >= 0) { - var len = i2 - i1 | 0; - return /* Some */[Bytes.sub_string(lexbuf[/* lex_buffer */1], i1, len)]; - } - else { - return /* None */0; - } -} - -function sub_lexeme_char(lexbuf, i) { - return Caml_bytes.get(lexbuf[/* lex_buffer */1], i); -} - -function sub_lexeme_char_opt(lexbuf, i) { - if (i >= 0) { - return /* Some */[Caml_bytes.get(lexbuf[/* lex_buffer */1], i)]; - } - else { - return /* None */0; - } -} - -function lexeme_char(lexbuf, i) { - return Caml_bytes.get(lexbuf[/* lex_buffer */1], lexbuf[/* lex_start_pos */4] + i | 0); -} - -function lexeme_start(lexbuf) { - return lexbuf[/* lex_start_p */10][/* pos_cnum */3]; -} - -function lexeme_end(lexbuf) { - return lexbuf[/* lex_curr_p */11][/* pos_cnum */3]; -} - -function lexeme_start_p(lexbuf) { - return lexbuf[/* lex_start_p */10]; -} - -function lexeme_end_p(lexbuf) { - return lexbuf[/* lex_curr_p */11]; -} - -function new_line(lexbuf) { - var lcp = lexbuf[/* lex_curr_p */11]; - lexbuf[/* lex_curr_p */11] = /* record */[ - /* pos_fname */lcp[/* pos_fname */0], - /* pos_lnum */lcp[/* pos_lnum */1] + 1 | 0, - /* pos_bol */lcp[/* pos_cnum */3], - /* pos_cnum */lcp[/* pos_cnum */3] - ]; - return /* () */0; -} - -function flush_input(lb) { - lb[/* lex_curr_pos */5] = 0; - lb[/* lex_abs_pos */3] = 0; - var init = lb[/* lex_curr_p */11]; - lb[/* lex_curr_p */11] = /* record */[ - /* pos_fname */init[/* pos_fname */0], - /* pos_lnum */init[/* pos_lnum */1], - /* pos_bol */init[/* pos_bol */2], - /* pos_cnum */0 - ]; - lb[/* lex_buffer_len */2] = 0; - return /* () */0; -} - -var dummy_pos = /* record */[ - /* pos_fname */"", - /* pos_lnum */0, - /* pos_bol */0, - /* pos_cnum */-1 -]; - -exports.dummy_pos = dummy_pos; -exports.from_channel = from_channel; -exports.from_string = from_string; -exports.from_function = from_function; -exports.lexeme = lexeme; -exports.lexeme_char = lexeme_char; -exports.lexeme_start = lexeme_start; -exports.lexeme_end = lexeme_end; -exports.lexeme_start_p = lexeme_start_p; -exports.lexeme_end_p = lexeme_end_p; -exports.new_line = new_line; -exports.flush_input = flush_input; -exports.sub_lexeme = sub_lexeme; -exports.sub_lexeme_opt = sub_lexeme_opt; -exports.sub_lexeme_char = sub_lexeme_char; -exports.sub_lexeme_char_opt = sub_lexeme_char_opt; -exports.engine = engine; -exports.new_engine = new_engine; -/* No side effect */ -//////// end of lexing.js //////// -    return exports; -  }; - - - _registry['lib'] = function() { -    let exports = {}; -//////// start of lib.js //////// -// Generated by BUCKLESCRIPT VERSION 1.4.3 , PLEASE EDIT WITH CARE -'use strict'; - -var $$Array = require("bs-platform/lib/js/array"); -var Curry = require("bs-platform/lib/js/curry"); -var Int32 = require("bs-platform/lib/js/int32"); -var $$String = require("bs-platform/lib/js/string"); -var Bigarray = require("bs-platform/lib/js/bigarray"); -var Caml_obj = require("bs-platform/lib/js/caml_obj"); -var Caml_array = require("bs-platform/lib/js/caml_array"); -var Caml_int64 = require("bs-platform/lib/js/caml_int64"); -var Pervasives = require("bs-platform/lib/js/pervasives"); -var Caml_builtin_exceptions = require("bs-platform/lib/js/caml_builtin_exceptions"); - -function repeat(_n, f, x) { - while(true) { - var n = _n; - if (n) { - Curry._1(f, x); - _n = n - 1 | 0; - continue ; - - } - else { - return /* () */0; - } - }; -} - -var Fun = /* module */[/* repeat */repeat]; - -function make(n, x) { - if (n) { - return /* :: */[ - x, - make(n - 1 | 0, x) - ]; - } - else { - return /* [] */0; - } -} - -function table$prime(i, n, f) { - if (i === n) { - return /* [] */0; - } - else { - return /* :: */[ - Curry._1(f, i), - table$prime(i + 1 | 0, n, f) - ]; - } -} - -function table(n, f) { - return table$prime(0, n, f); -} - -function take(n, xs) { - if (n !== 0) { - if (xs) { - if (n > 0) { - return /* :: */[ - xs[0], - take(n - 1 | 0, xs[1]) - ]; - } - else { - return Pervasives.failwith("take"); - } - } - else { - return Pervasives.failwith("take"); - } - } - else { - return /* [] */0; - } -} - -function drop(_n, _xs) { - while(true) { - var xs = _xs; - var n = _n; - if (n !== 0) { - if (xs) { - if (n > 0) { - _xs = xs[1]; - _n = n - 1 | 0; - continue ; - - } - else { - return Pervasives.failwith("drop"); - } - } - else { - return Pervasives.failwith("drop"); - } - } - else { - return xs; - } - }; -} - -function last(_param) { - while(true) { - var param = _param; - if (param) { - var xs = param[1]; - if (xs) { - _param = xs; - continue ; - - } - else { - return param[0]; - } - } - else { - return Pervasives.failwith("last"); - } - }; -} - -function split_last(param) { - if (param) { - var xs = param[1]; - var x = param[0]; - if (xs) { - var match = split_last(xs); - return /* tuple */[ - /* :: */[ - x, - match[0] - ], - match[1] - ]; - } - else { - return /* tuple */[ - /* [] */0, - x - ]; - } - } - else { - return Pervasives.failwith("split_last"); - } -} - -function index_of(x, xs) { - var x$1 = x; - var _xs = xs; - var _i = 0; - while(true) { - var i = _i; - var xs$1 = _xs; - if (xs$1) { - if (Caml_obj.caml_equal(x$1, xs$1[0])) { - return /* Some */[i]; - } - else { - _i = i + 1 | 0; - _xs = xs$1[1]; - continue ; - - } - } - else { - return /* None */0; - } - }; -} - -function length(xs) { - var _xs = xs; - var _n = 0; - while(true) { - var n = _n; - var xs$1 = _xs; - if (xs$1) { - if (n < Int32.max_int) { - _n = n + 1 | 0; - _xs = xs$1[1]; - continue ; - - } - else { - return Pervasives.failwith("length"); - } - } - else { - return n; - } - }; -} - -function nth(_xs, _n) { - while(true) { - var n = _n; - var xs = _xs; - if (n !== 0) { - if (xs) { - if (n > 0) { - _n = n - 1 | 0; - _xs = xs[1]; - continue ; - - } - else { - return Pervasives.failwith("nth"); - } - } - else { - return Pervasives.failwith("nth"); - } - } - else if (xs) { - return xs[0]; - } - else { - return Pervasives.failwith("nth"); - } - }; -} - -function take$1(n, xs) { - if (n !== 0) { - if (xs) { - if (n > 0) { - return /* :: */[ - xs[0], - take$1(n - 1 | 0, xs[1]) - ]; - } - else { - return Pervasives.failwith("take"); - } - } - else { - return Pervasives.failwith("take"); - } - } - else { - return /* [] */0; - } -} - -function drop$1(_n, _xs) { - while(true) { - var xs = _xs; - var n = _n; - if (n !== 0) { - if (xs) { - if (n > 0) { - _xs = xs[1]; - _n = n - 1 | 0; - continue ; - - } - else { - return Pervasives.failwith("drop"); - } - } - else { - return Pervasives.failwith("drop"); - } - } - else { - return xs; - } - }; -} - -function make$1(n, x) { - if (n < 0 || Caml_int64.gt(Caml_int64.of_int32(n), Caml_int64.of_int32(Pervasives.max_int))) { - throw [ - Caml_builtin_exceptions.invalid_argument, - "Array32.make" - ]; - } - return Caml_array.caml_make_vect(n, x); -} - -function length$1(a) { - return a.length; -} - -function index_of_int32(i) { - if (i < 0 || Caml_int64.gt(Caml_int64.of_int32(i), Caml_int64.of_int32(Pervasives.max_int))) { - return -1; - } - else { - return i; - } -} - -function get(a, i) { - return a[index_of_int32(i)]; -} - -function set(a, i, x) { - a[index_of_int32(i)] = x; - return /* () */0; -} - -function blit(a1, i1, a2, i2, n) { - return $$Array.blit(a1, index_of_int32(i1), a2, index_of_int32(i2), index_of_int32(n)); -} - -function create(kind, layout, n) { - if (Caml_int64.lt(n, /* int64 */[ - /* hi */0, - /* lo */0 - ]) || Caml_int64.gt(n, Caml_int64.of_int32(Pervasives.max_int))) { - throw [ - Caml_builtin_exceptions.invalid_argument, - "Bigarray.Array1_64.create" - ]; - } - return Curry._3(Bigarray.Array1[/* create */0], kind, layout, n[1] | 0); -} - -function dim() { - return Caml_int64.of_int32(function () { - throw "caml_ba_dim_1 not implemented by bucklescript yet\n"; - }()); -} - -function get$1(_, _$1) { - return function () { - throw "caml_ba_get_1 not implemented by bucklescript yet\n"; - }(); -} - -function set$1(_, _$1, _$2) { - return function () { - throw "caml_ba_set_1 not implemented by bucklescript yet\n"; - }(); -} - -function sub(_, _$1, _$2) { - return function () { - throw "caml_ba_sub not implemented by bucklescript yet\n"; - }(); -} - -function get$2(o, x) { - if (o) { - return o[0]; - } - else { - return x; - } -} - -function map(f, param) { - if (param) { - return /* Some */[Curry._1(f, param[0])]; - } - else { - return /* None */0; - } -} - -function app(f, param) { - if (param) { - return Curry._1(f, param[0]); - } - else { - return /* () */0; - } -} - -var Option = /* module */[ - /* get */get$2, - /* map */map, - /* app */app -]; - -function log2(n) { - if (n <= 0) { - Pervasives.failwith("log2"); - } - var _acc = 0; - var _n = n; - while(true) { - var n$1 = _n; - var acc = _acc; - if (n$1 === 1) { - return acc; - } - else { - _n = (n$1 >>> 1); - _acc = acc + 1 | 0; - continue ; - - } - }; -} - -function is_power_of_two(n) { - if (n < 0) { - Pervasives.failwith("is_power_of_two"); - } - if (n !== 0) { - return +((n & (n - 1 | 0)) === 0); - } - else { - return /* false */0; - } -} - -var Int = /* module */[ - /* log2 */log2, - /* is_power_of_two */is_power_of_two -]; - -function breakup(s, n) { - var loop = function (i) { - var len = Pervasives.min(n, s.length - i | 0); - if (len) { - return /* :: */[ - $$String.sub(s, i, len), - loop(i + len | 0) - ]; - } - else { - return /* [] */0; - } - }; - return loop(0); -} - -var $$String$1 = /* module */[/* breakup */breakup]; - -var List = [ - make, - table, - take, - drop, - last, - split_last, - index_of -]; - -var List32 = [ - length, - nth, - take$1, - drop$1 -]; - -var Array32 = [ - make$1, - length$1, - get, - set, - blit -]; - -var Bigarray$1 = [[ - create, - dim, - get$1, - set$1, - sub - ]]; - -exports.Fun = Fun; -exports.List = List; -exports.List32 = List32; -exports.Array32 = Array32; -exports.Bigarray = Bigarray$1; -exports.Option = Option; -exports.Int = Int; -exports.$$String = $$String$1; -/* Bigarray Not a pure module */ -//////// end of lib.js //////// -    return exports; -  }; - - - _registry['list'] = function() { -    let exports = {}; -//////// start of list.js //////// -'use strict'; - -var Curry = require("./curry"); -var Caml_obj = require("./caml_obj"); -var Pervasives = require("./pervasives"); -var Caml_builtin_exceptions = require("./caml_builtin_exceptions"); - -function length(l) { - var _len = 0; - var _param = l; - while(true) { - var param = _param; - var len = _len; - if (param) { - _param = param[1]; - _len = len + 1 | 0; - continue ; - - } - else { - return len; - } - }; -} - -function hd(param) { - if (param) { - return param[0]; - } - else { - throw [ - Caml_builtin_exceptions.failure, - "hd" - ]; - } -} - -function tl(param) { - if (param) { - return param[1]; - } - else { - throw [ - Caml_builtin_exceptions.failure, - "tl" - ]; - } -} - -function nth(l, n) { - if (n < 0) { - throw [ - Caml_builtin_exceptions.invalid_argument, - "List.nth" - ]; - } - else { - var _l = l; - var _n = n; - while(true) { - var n$1 = _n; - var l$1 = _l; - if (l$1) { - if (n$1) { - _n = n$1 - 1 | 0; - _l = l$1[1]; - continue ; - - } - else { - return l$1[0]; - } - } - else { - throw [ - Caml_builtin_exceptions.failure, - "nth" - ]; - } - }; - } -} - -function rev_append(_l1, _l2) { - while(true) { - var l2 = _l2; - var l1 = _l1; - if (l1) { - _l2 = /* :: */[ - l1[0], - l2 - ]; - _l1 = l1[1]; - continue ; - - } - else { - return l2; - } - }; -} - -function rev(l) { - return rev_append(l, /* [] */0); -} - -function flatten(param) { - if (param) { - return Pervasives.$at(param[0], flatten(param[1])); - } - else { - return /* [] */0; - } -} - -function map(f, param) { - if (param) { - var r = Curry._1(f, param[0]); - return /* :: */[ - r, - map(f, param[1]) - ]; - } - else { - return /* [] */0; - } -} - -function mapi(i, f, param) { - if (param) { - var r = Curry._2(f, i, param[0]); - return /* :: */[ - r, - mapi(i + 1 | 0, f, param[1]) - ]; - } - else { - return /* [] */0; - } -} - -function mapi$1(f, l) { - return mapi(0, f, l); -} - -function rev_map(f, l) { - var _accu = /* [] */0; - var _param = l; - while(true) { - var param = _param; - var accu = _accu; - if (param) { - _param = param[1]; - _accu = /* :: */[ - Curry._1(f, param[0]), - accu - ]; - continue ; - - } - else { - return accu; - } - }; -} - -function iter(f, _param) { - while(true) { - var param = _param; - if (param) { - Curry._1(f, param[0]); - _param = param[1]; - continue ; - - } - else { - return /* () */0; - } - }; -} - -function iteri(f, l) { - var _i = 0; - var f$1 = f; - var _param = l; - while(true) { - var param = _param; - var i = _i; - if (param) { - Curry._2(f$1, i, param[0]); - _param = param[1]; - _i = i + 1 | 0; - continue ; - - } - else { - return /* () */0; - } - }; -} - -function fold_left(f, _accu, _l) { - while(true) { - var l = _l; - var accu = _accu; - if (l) { - _l = l[1]; - _accu = Curry._2(f, accu, l[0]); - continue ; - - } - else { - return accu; - } - }; -} - -function fold_right(f, l, accu) { - if (l) { - return Curry._2(f, l[0], fold_right(f, l[1], accu)); - } - else { - return accu; - } -} - -function map2(f, l1, l2) { - if (l1) { - if (l2) { - var r = Curry._2(f, l1[0], l2[0]); - return /* :: */[ - r, - map2(f, l1[1], l2[1]) - ]; - } - else { - throw [ - Caml_builtin_exceptions.invalid_argument, - "List.map2" - ]; - } - } - else if (l2) { - throw [ - Caml_builtin_exceptions.invalid_argument, - "List.map2" - ]; - } - else { - return /* [] */0; - } -} - -function rev_map2(f, l1, l2) { - var _accu = /* [] */0; - var _l1 = l1; - var _l2 = l2; - while(true) { - var l2$1 = _l2; - var l1$1 = _l1; - var accu = _accu; - if (l1$1) { - if (l2$1) { - _l2 = l2$1[1]; - _l1 = l1$1[1]; - _accu = /* :: */[ - Curry._2(f, l1$1[0], l2$1[0]), - accu - ]; - continue ; - - } - else { - throw [ - Caml_builtin_exceptions.invalid_argument, - "List.rev_map2" - ]; - } - } - else if (l2$1) { - throw [ - Caml_builtin_exceptions.invalid_argument, - "List.rev_map2" - ]; - } - else { - return accu; - } - }; -} - -function iter2(f, _l1, _l2) { - while(true) { - var l2 = _l2; - var l1 = _l1; - if (l1) { - if (l2) { - Curry._2(f, l1[0], l2[0]); - _l2 = l2[1]; - _l1 = l1[1]; - continue ; - - } - else { - throw [ - Caml_builtin_exceptions.invalid_argument, - "List.iter2" - ]; - } - } - else if (l2) { - throw [ - Caml_builtin_exceptions.invalid_argument, - "List.iter2" - ]; - } - else { - return /* () */0; - } - }; -} - -function fold_left2(f, _accu, _l1, _l2) { - while(true) { - var l2 = _l2; - var l1 = _l1; - var accu = _accu; - if (l1) { - if (l2) { - _l2 = l2[1]; - _l1 = l1[1]; - _accu = Curry._3(f, accu, l1[0], l2[0]); - continue ; - - } - else { - throw [ - Caml_builtin_exceptions.invalid_argument, - "List.fold_left2" - ]; - } - } - else if (l2) { - throw [ - Caml_builtin_exceptions.invalid_argument, - "List.fold_left2" - ]; - } - else { - return accu; - } - }; -} - -function fold_right2(f, l1, l2, accu) { - if (l1) { - if (l2) { - return Curry._3(f, l1[0], l2[0], fold_right2(f, l1[1], l2[1], accu)); - } - else { - throw [ - Caml_builtin_exceptions.invalid_argument, - "List.fold_right2" - ]; - } - } - else if (l2) { - throw [ - Caml_builtin_exceptions.invalid_argument, - "List.fold_right2" - ]; - } - else { - return accu; - } -} - -function for_all(p, _param) { - while(true) { - var param = _param; - if (param) { - if (Curry._1(p, param[0])) { - _param = param[1]; - continue ; - - } - else { - return /* false */0; - } - } - else { - return /* true */1; - } - }; -} - -function exists(p, _param) { - while(true) { - var param = _param; - if (param) { - if (Curry._1(p, param[0])) { - return /* true */1; - } - else { - _param = param[1]; - continue ; - - } - } - else { - return /* false */0; - } - }; -} - -function for_all2(p, _l1, _l2) { - while(true) { - var l2 = _l2; - var l1 = _l1; - if (l1) { - if (l2) { - if (Curry._2(p, l1[0], l2[0])) { - _l2 = l2[1]; - _l1 = l1[1]; - continue ; - - } - else { - return /* false */0; - } - } - else { - throw [ - Caml_builtin_exceptions.invalid_argument, - "List.for_all2" - ]; - } - } - else if (l2) { - throw [ - Caml_builtin_exceptions.invalid_argument, - "List.for_all2" - ]; - } - else { - return /* true */1; - } - }; -} - -function exists2(p, _l1, _l2) { - while(true) { - var l2 = _l2; - var l1 = _l1; - if (l1) { - if (l2) { - if (Curry._2(p, l1[0], l2[0])) { - return /* true */1; - } - else { - _l2 = l2[1]; - _l1 = l1[1]; - continue ; - - } - } - else { - throw [ - Caml_builtin_exceptions.invalid_argument, - "List.exists2" - ]; - } - } - else if (l2) { - throw [ - Caml_builtin_exceptions.invalid_argument, - "List.exists2" - ]; - } - else { - return /* false */0; - } - }; -} - -function mem(x, _param) { - while(true) { - var param = _param; - if (param) { - if (Caml_obj.caml_compare(param[0], x)) { - _param = param[1]; - continue ; - - } - else { - return /* true */1; - } - } - else { - return /* false */0; - } - }; -} - -function memq(x, _param) { - while(true) { - var param = _param; - if (param) { - if (param[0] === x) { - return /* true */1; - } - else { - _param = param[1]; - continue ; - - } - } - else { - return /* false */0; - } - }; -} - -function assoc(x, _param) { - while(true) { - var param = _param; - if (param) { - var match = param[0]; - if (Caml_obj.caml_compare(match[0], x)) { - _param = param[1]; - continue ; - - } - else { - return match[1]; - } - } - else { - throw Caml_builtin_exceptions.not_found; - } - }; -} - -function assq(x, _param) { - while(true) { - var param = _param; - if (param) { - var match = param[0]; - if (match[0] === x) { - return match[1]; - } - else { - _param = param[1]; - continue ; - - } - } - else { - throw Caml_builtin_exceptions.not_found; - } - }; -} - -function mem_assoc(x, _param) { - while(true) { - var param = _param; - if (param) { - if (Caml_obj.caml_compare(param[0][0], x)) { - _param = param[1]; - continue ; - - } - else { - return /* true */1; - } - } - else { - return /* false */0; - } - }; -} - -function mem_assq(x, _param) { - while(true) { - var param = _param; - if (param) { - if (param[0][0] === x) { - return /* true */1; - } - else { - _param = param[1]; - continue ; - - } - } - else { - return /* false */0; - } - }; -} - -function remove_assoc(x, param) { - if (param) { - var l = param[1]; - var pair = param[0]; - if (Caml_obj.caml_compare(pair[0], x)) { - return /* :: */[ - pair, - remove_assoc(x, l) - ]; - } - else { - return l; - } - } - else { - return /* [] */0; - } -} - -function remove_assq(x, param) { - if (param) { - var l = param[1]; - var pair = param[0]; - if (pair[0] === x) { - return l; - } - else { - return /* :: */[ - pair, - remove_assq(x, l) - ]; - } - } - else { - return /* [] */0; - } -} - -function find(p, _param) { - while(true) { - var param = _param; - if (param) { - var x = param[0]; - if (Curry._1(p, x)) { - return x; - } - else { - _param = param[1]; - continue ; - - } - } - else { - throw Caml_builtin_exceptions.not_found; - } - }; -} - -function find_all(p) { - return function (param) { - var _accu = /* [] */0; - var _param = param; - while(true) { - var param$1 = _param; - var accu = _accu; - if (param$1) { - var l = param$1[1]; - var x = param$1[0]; - if (Curry._1(p, x)) { - _param = l; - _accu = /* :: */[ - x, - accu - ]; - continue ; - - } - else { - _param = l; - continue ; - - } - } - else { - return rev_append(accu, /* [] */0); - } - }; - }; -} - -function partition(p, l) { - var _yes = /* [] */0; - var _no = /* [] */0; - var _param = l; - while(true) { - var param = _param; - var no = _no; - var yes = _yes; - if (param) { - var l$1 = param[1]; - var x = param[0]; - if (Curry._1(p, x)) { - _param = l$1; - _yes = /* :: */[ - x, - yes - ]; - continue ; - - } - else { - _param = l$1; - _no = /* :: */[ - x, - no - ]; - continue ; - - } - } - else { - return /* tuple */[ - rev_append(yes, /* [] */0), - rev_append(no, /* [] */0) - ]; - } - }; -} - -function split(param) { - if (param) { - var match = param[0]; - var match$1 = split(param[1]); - return /* tuple */[ - /* :: */[ - match[0], - match$1[0] - ], - /* :: */[ - match[1], - match$1[1] - ] - ]; - } - else { - return /* tuple */[ - /* [] */0, - /* [] */0 - ]; - } -} - -function combine(l1, l2) { - if (l1) { - if (l2) { - return /* :: */[ - /* tuple */[ - l1[0], - l2[0] - ], - combine(l1[1], l2[1]) - ]; - } - else { - throw [ - Caml_builtin_exceptions.invalid_argument, - "List.combine" - ]; - } - } - else if (l2) { - throw [ - Caml_builtin_exceptions.invalid_argument, - "List.combine" - ]; - } - else { - return /* [] */0; - } -} - -function merge(cmp, l1, l2) { - if (l1) { - if (l2) { - var h2 = l2[0]; - var h1 = l1[0]; - if (Curry._2(cmp, h1, h2) <= 0) { - return /* :: */[ - h1, - merge(cmp, l1[1], l2) - ]; - } - else { - return /* :: */[ - h2, - merge(cmp, l1, l2[1]) - ]; - } - } - else { - return l1; - } - } - else { - return l2; - } -} - -function chop(_k, _l) { - while(true) { - var l = _l; - var k = _k; - if (k) { - if (l) { - _l = l[1]; - _k = k - 1 | 0; - continue ; - - } - else { - throw [ - Caml_builtin_exceptions.assert_failure, - [ - "list.ml", - 223, - 11 - ] - ]; - } - } - else { - return l; - } - }; -} - -function stable_sort(cmp, l) { - var sort = function (n, l) { - var exit = 0; - if (n !== 2) { - if (n !== 3) { - exit = 1; - } - else if (l) { - var match = l[1]; - if (match) { - var match$1 = match[1]; - if (match$1) { - var x3 = match$1[0]; - var x2 = match[0]; - var x1 = l[0]; - if (Curry._2(cmp, x1, x2) <= 0) { - if (Curry._2(cmp, x2, x3) <= 0) { - return /* :: */[ - x1, - /* :: */[ - x2, - /* :: */[ - x3, - /* [] */0 - ] - ] - ]; - } - else if (Curry._2(cmp, x1, x3) <= 0) { - return /* :: */[ - x1, - /* :: */[ - x3, - /* :: */[ - x2, - /* [] */0 - ] - ] - ]; - } - else { - return /* :: */[ - x3, - /* :: */[ - x1, - /* :: */[ - x2, - /* [] */0 - ] - ] - ]; - } - } - else if (Curry._2(cmp, x1, x3) <= 0) { - return /* :: */[ - x2, - /* :: */[ - x1, - /* :: */[ - x3, - /* [] */0 - ] - ] - ]; - } - else if (Curry._2(cmp, x2, x3) <= 0) { - return /* :: */[ - x2, - /* :: */[ - x3, - /* :: */[ - x1, - /* [] */0 - ] - ] - ]; - } - else { - return /* :: */[ - x3, - /* :: */[ - x2, - /* :: */[ - x1, - /* [] */0 - ] - ] - ]; - } - } - else { - exit = 1; - } - } - else { - exit = 1; - } - } - else { - exit = 1; - } - } - else if (l) { - var match$2 = l[1]; - if (match$2) { - var x2$1 = match$2[0]; - var x1$1 = l[0]; - if (Curry._2(cmp, x1$1, x2$1) <= 0) { - return /* :: */[ - x1$1, - /* :: */[ - x2$1, - /* [] */0 - ] - ]; - } - else { - return /* :: */[ - x2$1, - /* :: */[ - x1$1, - /* [] */0 - ] - ]; - } - } - else { - exit = 1; - } - } - else { - exit = 1; - } - if (exit === 1) { - var n1 = (n >> 1); - var n2 = n - n1 | 0; - var l2 = chop(n1, l); - var s1 = rev_sort(n1, l); - var s2 = rev_sort(n2, l2); - var _l1 = s1; - var _l2 = s2; - var _accu = /* [] */0; - while(true) { - var accu = _accu; - var l2$1 = _l2; - var l1 = _l1; - if (l1) { - if (l2$1) { - var h2 = l2$1[0]; - var h1 = l1[0]; - if (Curry._2(cmp, h1, h2) > 0) { - _accu = /* :: */[ - h1, - accu - ]; - _l1 = l1[1]; - continue ; - - } - else { - _accu = /* :: */[ - h2, - accu - ]; - _l2 = l2$1[1]; - continue ; - - } - } - else { - return rev_append(l1, accu); - } - } - else { - return rev_append(l2$1, accu); - } - }; - } - - }; - var rev_sort = function (n, l) { - var exit = 0; - if (n !== 2) { - if (n !== 3) { - exit = 1; - } - else if (l) { - var match = l[1]; - if (match) { - var match$1 = match[1]; - if (match$1) { - var x3 = match$1[0]; - var x2 = match[0]; - var x1 = l[0]; - if (Curry._2(cmp, x1, x2) > 0) { - if (Curry._2(cmp, x2, x3) > 0) { - return /* :: */[ - x1, - /* :: */[ - x2, - /* :: */[ - x3, - /* [] */0 - ] - ] - ]; - } - else if (Curry._2(cmp, x1, x3) > 0) { - return /* :: */[ - x1, - /* :: */[ - x3, - /* :: */[ - x2, - /* [] */0 - ] - ] - ]; - } - else { - return /* :: */[ - x3, - /* :: */[ - x1, - /* :: */[ - x2, - /* [] */0 - ] - ] - ]; - } - } - else if (Curry._2(cmp, x1, x3) > 0) { - return /* :: */[ - x2, - /* :: */[ - x1, - /* :: */[ - x3, - /* [] */0 - ] - ] - ]; - } - else if (Curry._2(cmp, x2, x3) > 0) { - return /* :: */[ - x2, - /* :: */[ - x3, - /* :: */[ - x1, - /* [] */0 - ] - ] - ]; - } - else { - return /* :: */[ - x3, - /* :: */[ - x2, - /* :: */[ - x1, - /* [] */0 - ] - ] - ]; - } - } - else { - exit = 1; - } - } - else { - exit = 1; - } - } - else { - exit = 1; - } - } - else if (l) { - var match$2 = l[1]; - if (match$2) { - var x2$1 = match$2[0]; - var x1$1 = l[0]; - if (Curry._2(cmp, x1$1, x2$1) > 0) { - return /* :: */[ - x1$1, - /* :: */[ - x2$1, - /* [] */0 - ] - ]; - } - else { - return /* :: */[ - x2$1, - /* :: */[ - x1$1, - /* [] */0 - ] - ]; - } - } - else { - exit = 1; - } - } - else { - exit = 1; - } - if (exit === 1) { - var n1 = (n >> 1); - var n2 = n - n1 | 0; - var l2 = chop(n1, l); - var s1 = sort(n1, l); - var s2 = sort(n2, l2); - var _l1 = s1; - var _l2 = s2; - var _accu = /* [] */0; - while(true) { - var accu = _accu; - var l2$1 = _l2; - var l1 = _l1; - if (l1) { - if (l2$1) { - var h2 = l2$1[0]; - var h1 = l1[0]; - if (Curry._2(cmp, h1, h2) <= 0) { - _accu = /* :: */[ - h1, - accu - ]; - _l1 = l1[1]; - continue ; - - } - else { - _accu = /* :: */[ - h2, - accu - ]; - _l2 = l2$1[1]; - continue ; - - } - } - else { - return rev_append(l1, accu); - } - } - else { - return rev_append(l2$1, accu); - } - }; - } - - }; - var len = length(l); - if (len < 2) { - return l; - } - else { - return sort(len, l); - } -} - -function sort_uniq(cmp, l) { - var sort = function (n, l) { - var exit = 0; - if (n !== 2) { - if (n !== 3) { - exit = 1; - } - else if (l) { - var match = l[1]; - if (match) { - var match$1 = match[1]; - if (match$1) { - var x3 = match$1[0]; - var x2 = match[0]; - var x1 = l[0]; - var c = Curry._2(cmp, x1, x2); - if (c) { - if (c < 0) { - var c$1 = Curry._2(cmp, x2, x3); - if (c$1) { - if (c$1 < 0) { - return /* :: */[ - x1, - /* :: */[ - x2, - /* :: */[ - x3, - /* [] */0 - ] - ] - ]; - } - else { - var c$2 = Curry._2(cmp, x1, x3); - if (c$2) { - if (c$2 < 0) { - return /* :: */[ - x1, - /* :: */[ - x3, - /* :: */[ - x2, - /* [] */0 - ] - ] - ]; - } - else { - return /* :: */[ - x3, - /* :: */[ - x1, - /* :: */[ - x2, - /* [] */0 - ] - ] - ]; - } - } - else { - return /* :: */[ - x1, - /* :: */[ - x2, - /* [] */0 - ] - ]; - } - } - } - else { - return /* :: */[ - x1, - /* :: */[ - x2, - /* [] */0 - ] - ]; - } - } - else { - var c$3 = Curry._2(cmp, x1, x3); - if (c$3) { - if (c$3 < 0) { - return /* :: */[ - x2, - /* :: */[ - x1, - /* :: */[ - x3, - /* [] */0 - ] - ] - ]; - } - else { - var c$4 = Curry._2(cmp, x2, x3); - if (c$4) { - if (c$4 < 0) { - return /* :: */[ - x2, - /* :: */[ - x3, - /* :: */[ - x1, - /* [] */0 - ] - ] - ]; - } - else { - return /* :: */[ - x3, - /* :: */[ - x2, - /* :: */[ - x1, - /* [] */0 - ] - ] - ]; - } - } - else { - return /* :: */[ - x2, - /* :: */[ - x1, - /* [] */0 - ] - ]; - } - } - } - else { - return /* :: */[ - x2, - /* :: */[ - x1, - /* [] */0 - ] - ]; - } - } - } - else { - var c$5 = Curry._2(cmp, x2, x3); - if (c$5) { - if (c$5 < 0) { - return /* :: */[ - x2, - /* :: */[ - x3, - /* [] */0 - ] - ]; - } - else { - return /* :: */[ - x3, - /* :: */[ - x2, - /* [] */0 - ] - ]; - } - } - else { - return /* :: */[ - x2, - /* [] */0 - ]; - } - } - } - else { - exit = 1; - } - } - else { - exit = 1; - } - } - else { - exit = 1; - } - } - else if (l) { - var match$2 = l[1]; - if (match$2) { - var x2$1 = match$2[0]; - var x1$1 = l[0]; - var c$6 = Curry._2(cmp, x1$1, x2$1); - if (c$6) { - if (c$6 < 0) { - return /* :: */[ - x1$1, - /* :: */[ - x2$1, - /* [] */0 - ] - ]; - } - else { - return /* :: */[ - x2$1, - /* :: */[ - x1$1, - /* [] */0 - ] - ]; - } - } - else { - return /* :: */[ - x1$1, - /* [] */0 - ]; - } - } - else { - exit = 1; - } - } - else { - exit = 1; - } - if (exit === 1) { - var n1 = (n >> 1); - var n2 = n - n1 | 0; - var l2 = chop(n1, l); - var s1 = rev_sort(n1, l); - var s2 = rev_sort(n2, l2); - var _l1 = s1; - var _l2 = s2; - var _accu = /* [] */0; - while(true) { - var accu = _accu; - var l2$1 = _l2; - var l1 = _l1; - if (l1) { - if (l2$1) { - var t2 = l2$1[1]; - var h2 = l2$1[0]; - var t1 = l1[1]; - var h1 = l1[0]; - var c$7 = Curry._2(cmp, h1, h2); - if (c$7) { - if (c$7 > 0) { - _accu = /* :: */[ - h1, - accu - ]; - _l1 = t1; - continue ; - - } - else { - _accu = /* :: */[ - h2, - accu - ]; - _l2 = t2; - continue ; - - } - } - else { - _accu = /* :: */[ - h1, - accu - ]; - _l2 = t2; - _l1 = t1; - continue ; - - } - } - else { - return rev_append(l1, accu); - } - } - else { - return rev_append(l2$1, accu); - } - }; - } - - }; - var rev_sort = function (n, l) { - var exit = 0; - if (n !== 2) { - if (n !== 3) { - exit = 1; - } - else if (l) { - var match = l[1]; - if (match) { - var match$1 = match[1]; - if (match$1) { - var x3 = match$1[0]; - var x2 = match[0]; - var x1 = l[0]; - var c = Curry._2(cmp, x1, x2); - if (c) { - if (c > 0) { - var c$1 = Curry._2(cmp, x2, x3); - if (c$1) { - if (c$1 > 0) { - return /* :: */[ - x1, - /* :: */[ - x2, - /* :: */[ - x3, - /* [] */0 - ] - ] - ]; - } - else { - var c$2 = Curry._2(cmp, x1, x3); - if (c$2) { - if (c$2 > 0) { - return /* :: */[ - x1, - /* :: */[ - x3, - /* :: */[ - x2, - /* [] */0 - ] - ] - ]; - } - else { - return /* :: */[ - x3, - /* :: */[ - x1, - /* :: */[ - x2, - /* [] */0 - ] - ] - ]; - } - } - else { - return /* :: */[ - x1, - /* :: */[ - x2, - /* [] */0 - ] - ]; - } - } - } - else { - return /* :: */[ - x1, - /* :: */[ - x2, - /* [] */0 - ] - ]; - } - } - else { - var c$3 = Curry._2(cmp, x1, x3); - if (c$3) { - if (c$3 > 0) { - return /* :: */[ - x2, - /* :: */[ - x1, - /* :: */[ - x3, - /* [] */0 - ] - ] - ]; - } - else { - var c$4 = Curry._2(cmp, x2, x3); - if (c$4) { - if (c$4 > 0) { - return /* :: */[ - x2, - /* :: */[ - x3, - /* :: */[ - x1, - /* [] */0 - ] - ] - ]; - } - else { - return /* :: */[ - x3, - /* :: */[ - x2, - /* :: */[ - x1, - /* [] */0 - ] - ] - ]; - } - } - else { - return /* :: */[ - x2, - /* :: */[ - x1, - /* [] */0 - ] - ]; - } - } - } - else { - return /* :: */[ - x2, - /* :: */[ - x1, - /* [] */0 - ] - ]; - } - } - } - else { - var c$5 = Curry._2(cmp, x2, x3); - if (c$5) { - if (c$5 > 0) { - return /* :: */[ - x2, - /* :: */[ - x3, - /* [] */0 - ] - ]; - } - else { - return /* :: */[ - x3, - /* :: */[ - x2, - /* [] */0 - ] - ]; - } - } - else { - return /* :: */[ - x2, - /* [] */0 - ]; - } - } - } - else { - exit = 1; - } - } - else { - exit = 1; - } - } - else { - exit = 1; - } - } - else if (l) { - var match$2 = l[1]; - if (match$2) { - var x2$1 = match$2[0]; - var x1$1 = l[0]; - var c$6 = Curry._2(cmp, x1$1, x2$1); - if (c$6) { - if (c$6 > 0) { - return /* :: */[ - x1$1, - /* :: */[ - x2$1, - /* [] */0 - ] - ]; - } - else { - return /* :: */[ - x2$1, - /* :: */[ - x1$1, - /* [] */0 - ] - ]; - } - } - else { - return /* :: */[ - x1$1, - /* [] */0 - ]; - } - } - else { - exit = 1; - } - } - else { - exit = 1; - } - if (exit === 1) { - var n1 = (n >> 1); - var n2 = n - n1 | 0; - var l2 = chop(n1, l); - var s1 = sort(n1, l); - var s2 = sort(n2, l2); - var _l1 = s1; - var _l2 = s2; - var _accu = /* [] */0; - while(true) { - var accu = _accu; - var l2$1 = _l2; - var l1 = _l1; - if (l1) { - if (l2$1) { - var t2 = l2$1[1]; - var h2 = l2$1[0]; - var t1 = l1[1]; - var h1 = l1[0]; - var c$7 = Curry._2(cmp, h1, h2); - if (c$7) { - if (c$7 < 0) { - _accu = /* :: */[ - h1, - accu - ]; - _l1 = t1; - continue ; - - } - else { - _accu = /* :: */[ - h2, - accu - ]; - _l2 = t2; - continue ; - - } - } - else { - _accu = /* :: */[ - h1, - accu - ]; - _l2 = t2; - _l1 = t1; - continue ; - - } - } - else { - return rev_append(l1, accu); - } - } - else { - return rev_append(l2$1, accu); - } - }; - } - - }; - var len = length(l); - if (len < 2) { - return l; - } - else { - return sort(len, l); - } -} - -var append = Pervasives.$at; - -var concat = flatten; - -var filter = find_all; - -var sort = stable_sort; - -var fast_sort = stable_sort; - -exports.length = length; -exports.hd = hd; -exports.tl = tl; -exports.nth = nth; -exports.rev = rev; -exports.append = append; -exports.rev_append = rev_append; -exports.concat = concat; -exports.flatten = flatten; -exports.iter = iter; -exports.iteri = iteri; -exports.map = map; -exports.mapi = mapi$1; -exports.rev_map = rev_map; -exports.fold_left = fold_left; -exports.fold_right = fold_right; -exports.iter2 = iter2; -exports.map2 = map2; -exports.rev_map2 = rev_map2; -exports.fold_left2 = fold_left2; -exports.fold_right2 = fold_right2; -exports.for_all = for_all; -exports.exists = exists; -exports.for_all2 = for_all2; -exports.exists2 = exists2; -exports.mem = mem; -exports.memq = memq; -exports.find = find; -exports.filter = filter; -exports.find_all = find_all; -exports.partition = partition; -exports.assoc = assoc; -exports.assq = assq; -exports.mem_assoc = mem_assoc; -exports.mem_assq = mem_assq; -exports.remove_assoc = remove_assoc; -exports.remove_assq = remove_assq; -exports.split = split; -exports.combine = combine; -exports.sort = sort; -exports.stable_sort = stable_sort; -exports.fast_sort = fast_sort; -exports.sort_uniq = sort_uniq; -exports.merge = merge; -/* No side effect */ -//////// end of list.js //////// -    return exports; -  }; - - - _registry['map'] = function() { -    let exports = {}; -//////// start of map.js //////// -'use strict'; - -var Curry = require("./curry"); -var Caml_builtin_exceptions = require("./caml_builtin_exceptions"); - -function Make(funarg) { - var height = function (param) { - if (param) { - return param[4]; - } - else { - return 0; - } - }; - var create = function (l, x, d, r) { - var hl = height(l); - var hr = height(r); - return /* Node */[ - l, - x, - d, - r, - hl >= hr ? hl + 1 | 0 : hr + 1 | 0 - ]; - }; - var singleton = function (x, d) { - return /* Node */[ - /* Empty */0, - x, - d, - /* Empty */0, - 1 - ]; - }; - var bal = function (l, x, d, r) { - var hl = l ? l[4] : 0; - var hr = r ? r[4] : 0; - if (hl > (hr + 2 | 0)) { - if (l) { - var lr = l[3]; - var ld = l[2]; - var lv = l[1]; - var ll = l[0]; - if (height(ll) >= height(lr)) { - return create(ll, lv, ld, create(lr, x, d, r)); - } - else if (lr) { - return create(create(ll, lv, ld, lr[0]), lr[1], lr[2], create(lr[3], x, d, r)); - } - else { - throw [ - Caml_builtin_exceptions.invalid_argument, - "Map.bal" - ]; - } - } - else { - throw [ - Caml_builtin_exceptions.invalid_argument, - "Map.bal" - ]; - } - } - else if (hr > (hl + 2 | 0)) { - if (r) { - var rr = r[3]; - var rd = r[2]; - var rv = r[1]; - var rl = r[0]; - if (height(rr) >= height(rl)) { - return create(create(l, x, d, rl), rv, rd, rr); - } - else if (rl) { - return create(create(l, x, d, rl[0]), rl[1], rl[2], create(rl[3], rv, rd, rr)); - } - else { - throw [ - Caml_builtin_exceptions.invalid_argument, - "Map.bal" - ]; - } - } - else { - throw [ - Caml_builtin_exceptions.invalid_argument, - "Map.bal" - ]; - } - } - else { - return /* Node */[ - l, - x, - d, - r, - hl >= hr ? hl + 1 | 0 : hr + 1 | 0 - ]; - } - }; - var is_empty = function (param) { - if (param) { - return /* false */0; - } - else { - return /* true */1; - } - }; - var add = function (x, data, param) { - if (param) { - var r = param[3]; - var d = param[2]; - var v = param[1]; - var l = param[0]; - var c = Curry._2(funarg[/* compare */0], x, v); - if (c) { - if (c < 0) { - return bal(add(x, data, l), v, d, r); - } - else { - return bal(l, v, d, add(x, data, r)); - } - } - else { - return /* Node */[ - l, - x, - data, - r, - param[4] - ]; - } - } - else { - return /* Node */[ - /* Empty */0, - x, - data, - /* Empty */0, - 1 - ]; - } - }; - var find = function (x, _param) { - while(true) { - var param = _param; - if (param) { - var c = Curry._2(funarg[/* compare */0], x, param[1]); - if (c) { - _param = c < 0 ? param[0] : param[3]; - continue ; - - } - else { - return param[2]; - } - } - else { - throw Caml_builtin_exceptions.not_found; - } - }; - }; - var mem = function (x, _param) { - while(true) { - var param = _param; - if (param) { - var c = Curry._2(funarg[/* compare */0], x, param[1]); - if (c) { - _param = c < 0 ? param[0] : param[3]; - continue ; - - } - else { - return /* true */1; - } - } - else { - return /* false */0; - } - }; - }; - var min_binding = function (_param) { - while(true) { - var param = _param; - if (param) { - var l = param[0]; - if (l) { - _param = l; - continue ; - - } - else { - return /* tuple */[ - param[1], - param[2] - ]; - } - } - else { - throw Caml_builtin_exceptions.not_found; - } - }; - }; - var max_binding = function (_param) { - while(true) { - var param = _param; - if (param) { - var r = param[3]; - if (r) { - _param = r; - continue ; - - } - else { - return /* tuple */[ - param[1], - param[2] - ]; - } - } - else { - throw Caml_builtin_exceptions.not_found; - } - }; - }; - var remove_min_binding = function (param) { - if (param) { - var l = param[0]; - if (l) { - return bal(remove_min_binding(l), param[1], param[2], param[3]); - } - else { - return param[3]; - } - } - else { - throw [ - Caml_builtin_exceptions.invalid_argument, - "Map.remove_min_elt" - ]; - } - }; - var remove = function (x, param) { - if (param) { - var r = param[3]; - var d = param[2]; - var v = param[1]; - var l = param[0]; - var c = Curry._2(funarg[/* compare */0], x, v); - if (c) { - if (c < 0) { - return bal(remove(x, l), v, d, r); - } - else { - return bal(l, v, d, remove(x, r)); - } - } - else { - var t1 = l; - var t2 = r; - if (t1) { - if (t2) { - var match = min_binding(t2); - return bal(t1, match[0], match[1], remove_min_binding(t2)); - } - else { - return t1; - } - } - else { - return t2; - } - } - } - else { - return /* Empty */0; - } - }; - var iter = function (f, _param) { - while(true) { - var param = _param; - if (param) { - iter(f, param[0]); - Curry._2(f, param[1], param[2]); - _param = param[3]; - continue ; - - } - else { - return /* () */0; - } - }; - }; - var map = function (f, param) { - if (param) { - var l$prime = map(f, param[0]); - var d$prime = Curry._1(f, param[2]); - var r$prime = map(f, param[3]); - return /* Node */[ - l$prime, - param[1], - d$prime, - r$prime, - param[4] - ]; - } - else { - return /* Empty */0; - } - }; - var mapi = function (f, param) { - if (param) { - var v = param[1]; - var l$prime = mapi(f, param[0]); - var d$prime = Curry._2(f, v, param[2]); - var r$prime = mapi(f, param[3]); - return /* Node */[ - l$prime, - v, - d$prime, - r$prime, - param[4] - ]; - } - else { - return /* Empty */0; - } - }; - var fold = function (f, _m, _accu) { - while(true) { - var accu = _accu; - var m = _m; - if (m) { - _accu = Curry._3(f, m[1], m[2], fold(f, m[0], accu)); - _m = m[3]; - continue ; - - } - else { - return accu; - } - }; - }; - var for_all = function (p, _param) { - while(true) { - var param = _param; - if (param) { - if (Curry._2(p, param[1], param[2])) { - if (for_all(p, param[0])) { - _param = param[3]; - continue ; - - } - else { - return /* false */0; - } - } - else { - return /* false */0; - } - } - else { - return /* true */1; - } - }; - }; - var exists = function (p, _param) { - while(true) { - var param = _param; - if (param) { - if (Curry._2(p, param[1], param[2])) { - return /* true */1; - } - else if (exists(p, param[0])) { - return /* true */1; - } - else { - _param = param[3]; - continue ; - - } - } - else { - return /* false */0; - } - }; - }; - var add_min_binding = function (k, v, param) { - if (param) { - return bal(add_min_binding(k, v, param[0]), param[1], param[2], param[3]); - } - else { - return singleton(k, v); - } - }; - var add_max_binding = function (k, v, param) { - if (param) { - return bal(param[0], param[1], param[2], add_max_binding(k, v, param[3])); - } - else { - return singleton(k, v); - } - }; - var join = function (l, v, d, r) { - if (l) { - if (r) { - var rh = r[4]; - var lh = l[4]; - if (lh > (rh + 2 | 0)) { - return bal(l[0], l[1], l[2], join(l[3], v, d, r)); - } - else if (rh > (lh + 2 | 0)) { - return bal(join(l, v, d, r[0]), r[1], r[2], r[3]); - } - else { - return create(l, v, d, r); - } - } - else { - return add_max_binding(v, d, l); - } - } - else { - return add_min_binding(v, d, r); - } - }; - var concat = function (t1, t2) { - if (t1) { - if (t2) { - var match = min_binding(t2); - return join(t1, match[0], match[1], remove_min_binding(t2)); - } - else { - return t1; - } - } - else { - return t2; - } - }; - var concat_or_join = function (t1, v, d, t2) { - if (d) { - return join(t1, v, d[0], t2); - } - else { - return concat(t1, t2); - } - }; - var split = function (x, param) { - if (param) { - var r = param[3]; - var d = param[2]; - var v = param[1]; - var l = param[0]; - var c = Curry._2(funarg[/* compare */0], x, v); - if (c) { - if (c < 0) { - var match = split(x, l); - return /* tuple */[ - match[0], - match[1], - join(match[2], v, d, r) - ]; - } - else { - var match$1 = split(x, r); - return /* tuple */[ - join(l, v, d, match$1[0]), - match$1[1], - match$1[2] - ]; - } - } - else { - return /* tuple */[ - l, - /* Some */[d], - r - ]; - } - } - else { - return /* tuple */[ - /* Empty */0, - /* None */0, - /* Empty */0 - ]; - } - }; - var merge = function (f, s1, s2) { - var exit = 0; - if (s1) { - var v1 = s1[1]; - if (s1[4] >= height(s2)) { - var match = split(v1, s2); - return concat_or_join(merge(f, s1[0], match[0]), v1, Curry._3(f, v1, /* Some */[s1[2]], match[1]), merge(f, s1[3], match[2])); - } - else { - exit = 1; - } - } - else if (s2) { - exit = 1; - } - else { - return /* Empty */0; - } - if (exit === 1) { - if (s2) { - var v2 = s2[1]; - var match$1 = split(v2, s1); - return concat_or_join(merge(f, match$1[0], s2[0]), v2, Curry._3(f, v2, match$1[1], /* Some */[s2[2]]), merge(f, match$1[2], s2[3])); - } - else { - throw [ - Caml_builtin_exceptions.assert_failure, - [ - "map.ml", - 270, - 10 - ] - ]; - } - } - - }; - var filter = function (p, param) { - if (param) { - var d = param[2]; - var v = param[1]; - var l$prime = filter(p, param[0]); - var pvd = Curry._2(p, v, d); - var r$prime = filter(p, param[3]); - if (pvd) { - return join(l$prime, v, d, r$prime); - } - else { - return concat(l$prime, r$prime); - } - } - else { - return /* Empty */0; - } - }; - var partition = function (p, param) { - if (param) { - var d = param[2]; - var v = param[1]; - var match = partition(p, param[0]); - var lf = match[1]; - var lt = match[0]; - var pvd = Curry._2(p, v, d); - var match$1 = partition(p, param[3]); - var rf = match$1[1]; - var rt = match$1[0]; - if (pvd) { - return /* tuple */[ - join(lt, v, d, rt), - concat(lf, rf) - ]; - } - else { - return /* tuple */[ - concat(lt, rt), - join(lf, v, d, rf) - ]; - } - } - else { - return /* tuple */[ - /* Empty */0, - /* Empty */0 - ]; - } - }; - var cons_enum = function (_m, _e) { - while(true) { - var e = _e; - var m = _m; - if (m) { - _e = /* More */[ - m[1], - m[2], - m[3], - e - ]; - _m = m[0]; - continue ; - - } - else { - return e; - } - }; - }; - var compare = function (cmp, m1, m2) { - var _e1 = cons_enum(m1, /* End */0); - var _e2 = cons_enum(m2, /* End */0); - while(true) { - var e2 = _e2; - var e1 = _e1; - if (e1) { - if (e2) { - var c = Curry._2(funarg[/* compare */0], e1[0], e2[0]); - if (c !== 0) { - return c; - } - else { - var c$1 = Curry._2(cmp, e1[1], e2[1]); - if (c$1 !== 0) { - return c$1; - } - else { - _e2 = cons_enum(e2[2], e2[3]); - _e1 = cons_enum(e1[2], e1[3]); - continue ; - - } - } - } - else { - return 1; - } - } - else if (e2) { - return -1; - } - else { - return 0; - } - }; - }; - var equal = function (cmp, m1, m2) { - var _e1 = cons_enum(m1, /* End */0); - var _e2 = cons_enum(m2, /* End */0); - while(true) { - var e2 = _e2; - var e1 = _e1; - if (e1) { - if (e2) { - if (Curry._2(funarg[/* compare */0], e1[0], e2[0])) { - return /* false */0; - } - else if (Curry._2(cmp, e1[1], e2[1])) { - _e2 = cons_enum(e2[2], e2[3]); - _e1 = cons_enum(e1[2], e1[3]); - continue ; - - } - else { - return /* false */0; - } - } - else { - return /* false */0; - } - } - else if (e2) { - return /* false */0; - } - else { - return /* true */1; - } - }; - }; - var cardinal = function (param) { - if (param) { - return (cardinal(param[0]) + 1 | 0) + cardinal(param[3]) | 0; - } - else { - return 0; - } - }; - var bindings_aux = function (_accu, _param) { - while(true) { - var param = _param; - var accu = _accu; - if (param) { - _param = param[0]; - _accu = /* :: */[ - /* tuple */[ - param[1], - param[2] - ], - bindings_aux(accu, param[3]) - ]; - continue ; - - } - else { - return accu; - } - }; - }; - var bindings = function (s) { - return bindings_aux(/* [] */0, s); - }; - return [ - /* Empty */0, - is_empty, - mem, - add, - singleton, - remove, - merge, - compare, - equal, - iter, - fold, - for_all, - exists, - filter, - partition, - cardinal, - bindings, - min_binding, - max_binding, - min_binding, - split, - find, - map, - mapi - ]; -} - -exports.Make = Make; -/* No side effect */ -//////// end of map.js //////// -    return exports; -  }; - - - _registry['numeric_error'] = function() { -    let exports = {}; -//////// start of numeric_error.js //////// -// Generated by BUCKLESCRIPT VERSION 1.4.3 , PLEASE EDIT WITH CARE -'use strict'; - -var Caml_exceptions = require("bs-platform/lib/js/caml_exceptions"); - -var IntegerOverflow = Caml_exceptions.create("Numeric_error.IntegerOverflow"); - -var IntegerDivideByZero = Caml_exceptions.create("Numeric_error.IntegerDivideByZero"); - -var InvalidConversionToInteger = Caml_exceptions.create("Numeric_error.InvalidConversionToInteger"); - -exports.IntegerOverflow = IntegerOverflow; -exports.IntegerDivideByZero = IntegerDivideByZero; -exports.InvalidConversionToInteger = InvalidConversionToInteger; -/* No side effect */ -//////// end of numeric_error.js //////// -    return exports; -  }; - - - _registry['obj'] = function() { -    let exports = {}; -//////// start of obj.js //////// -'use strict'; - -var Marshal = require("./marshal"); -var Caml_builtin_exceptions = require("./caml_builtin_exceptions"); - -function double_field(x, i) { - return x[i]; -} - -function set_double_field(x, i, v) { - x[i] = v; - return /* () */0; -} - -function marshal() { - return function () { - throw "caml_output_value_to_string not implemented by bucklescript yet\n"; - }(); -} - -function unmarshal(str, pos) { - return /* tuple */[ - Marshal.from_bytes(str, pos), - pos + Marshal.total_size(str, pos) | 0 - ]; -} - -function extension_slot(x) { - var slot = x.length !== undefined && (x.tag | 0) !== 248 && x.length >= 1 ? x[0] : x; - var name; - if (slot.length !== undefined && slot.tag === 248) { - name = slot[0]; - } - else { - throw Caml_builtin_exceptions.not_found; - } - if (name.tag === 252) { - return slot; - } - else { - throw Caml_builtin_exceptions.not_found; - } -} - -function extension_name(x) { - try { - var slot = extension_slot(x); - return slot[0]; - } - catch (exn){ - if (exn === Caml_builtin_exceptions.not_found) { - throw [ - Caml_builtin_exceptions.invalid_argument, - "Obj.extension_name" - ]; - } - else { - throw exn; - } - } -} - -function extension_id(x) { - try { - var slot = extension_slot(x); - return slot[1]; - } - catch (exn){ - if (exn === Caml_builtin_exceptions.not_found) { - throw [ - Caml_builtin_exceptions.invalid_argument, - "Obj.extension_id" - ]; - } - else { - throw exn; - } - } -} - -function extension_slot$1(x) { - try { - return extension_slot(x); - } - catch (exn){ - if (exn === Caml_builtin_exceptions.not_found) { - throw [ - Caml_builtin_exceptions.invalid_argument, - "Obj.extension_slot" - ]; - } - else { - throw exn; - } - } -} - -var first_non_constant_constructor_tag = 0; - -var last_non_constant_constructor_tag = 245; - -var lazy_tag = 246; - -var closure_tag = 247; - -var object_tag = 248; - -var infix_tag = 249; - -var forward_tag = 250; - -var no_scan_tag = 251; - -var abstract_tag = 251; - -var string_tag = 252; - -var double_tag = 253; - -var double_array_tag = 254; - -var custom_tag = 255; - -var final_tag = 255; - -var int_tag = 1000; - -var out_of_heap_tag = 1001; - -var unaligned_tag = 1002; - -exports.double_field = double_field; -exports.set_double_field = set_double_field; -exports.first_non_constant_constructor_tag = first_non_constant_constructor_tag; -exports.last_non_constant_constructor_tag = last_non_constant_constructor_tag; -exports.lazy_tag = lazy_tag; -exports.closure_tag = closure_tag; -exports.object_tag = object_tag; -exports.infix_tag = infix_tag; -exports.forward_tag = forward_tag; -exports.no_scan_tag = no_scan_tag; -exports.abstract_tag = abstract_tag; -exports.string_tag = string_tag; -exports.double_tag = double_tag; -exports.double_array_tag = double_array_tag; -exports.custom_tag = custom_tag; -exports.final_tag = final_tag; -exports.int_tag = int_tag; -exports.out_of_heap_tag = out_of_heap_tag; -exports.unaligned_tag = unaligned_tag; -exports.extension_name = extension_name; -exports.extension_id = extension_id; -exports.extension_slot = extension_slot$1; -exports.marshal = marshal; -exports.unmarshal = unmarshal; -/* No side effect */ -//////// end of obj.js //////// -    return exports; -  }; - - - _registry['oo'] = function() { -    let exports = {}; -//////// start of oo.js //////// -'use strict'; - -var CamlinternalOO = require("./camlinternalOO"); - -var copy = CamlinternalOO.copy; - -var new_method = CamlinternalOO.public_method_label; - -var public_method_label = CamlinternalOO.public_method_label; - -exports.copy = copy; -exports.new_method = new_method; -exports.public_method_label = public_method_label; -/* No side effect */ -//////// end of oo.js //////// -    return exports; -  }; - - - _registry['operators'] = function() { -    let exports = {}; -//////// start of operators.js //////// -// Generated by BUCKLESCRIPT VERSION 1.4.3 , PLEASE EDIT WITH CARE -'use strict'; - -var Block = require("bs-platform/lib/js/block"); -var Source = require("./source"); - -function i32_const(n) { - return /* Const */Block.__(15, [Source.$at$at(/* I32 */Block.__(0, [n[/* it */1]]), n[/* at */0])]); -} - -function i64_const(n) { - return /* Const */Block.__(15, [Source.$at$at(/* I64 */Block.__(1, [n[/* it */1]]), n[/* at */0])]); -} - -function f32_const(n) { - return /* Const */Block.__(15, [Source.$at$at(/* F32 */Block.__(2, [n[/* it */1]]), n[/* at */0])]); -} - -function f64_const(n) { - return /* Const */Block.__(15, [Source.$at$at(/* F64 */Block.__(3, [n[/* it */1]]), n[/* at */0])]); -} - -function block(ts, es) { - return /* Block */Block.__(0, [ - ts, - es - ]); -} - -function loop(ts, es) { - return /* Loop */Block.__(1, [ - ts, - es - ]); -} - -function br(x) { - return /* Br */Block.__(3, [x]); -} - -function br_if(x) { - return /* BrIf */Block.__(4, [x]); -} - -function br_table(xs, x) { - return /* BrTable */Block.__(5, [ - xs, - x - ]); -} - -function if_(ts, es1, es2) { - return /* If */Block.__(2, [ - ts, - es1, - es2 - ]); -} - -function call(x) { - return /* Call */Block.__(6, [x]); -} - -function call_indirect(x) { - return /* CallIndirect */Block.__(7, [x]); -} - -function get_local(x) { - return /* GetLocal */Block.__(8, [x]); -} - -function set_local(x) { - return /* SetLocal */Block.__(9, [x]); -} - -function tee_local(x) { - return /* TeeLocal */Block.__(10, [x]); -} - -function get_global(x) { - return /* GetGlobal */Block.__(11, [x]); -} - -function set_global(x) { - return /* SetGlobal */Block.__(12, [x]); -} - -function i32_load(align, offset) { - return /* Load */Block.__(13, [/* record */[ - /* ty : I32Type */0, - /* align */align, - /* offset */offset, - /* sz : None */0 - ]]); -} - -function i64_load(align, offset) { - return /* Load */Block.__(13, [/* record */[ - /* ty : I64Type */1, - /* align */align, - /* offset */offset, - /* sz : None */0 - ]]); -} - -function f32_load(align, offset) { - return /* Load */Block.__(13, [/* record */[ - /* ty : F32Type */2, - /* align */align, - /* offset */offset, - /* sz : None */0 - ]]); -} - -function f64_load(align, offset) { - return /* Load */Block.__(13, [/* record */[ - /* ty : F64Type */3, - /* align */align, - /* offset */offset, - /* sz : None */0 - ]]); -} - -function i32_load8_s(align, offset) { - return /* Load */Block.__(13, [/* record */[ - /* ty : I32Type */0, - /* align */align, - /* offset */offset, - /* sz : Some */[/* tuple */[ - /* Mem8 */0, - /* SX */0 - ]] - ]]); -} - -function i32_load8_u(align, offset) { - return /* Load */Block.__(13, [/* record */[ - /* ty : I32Type */0, - /* align */align, - /* offset */offset, - /* sz : Some */[/* tuple */[ - /* Mem8 */0, - /* ZX */1 - ]] - ]]); -} - -function i32_load16_s(align, offset) { - return /* Load */Block.__(13, [/* record */[ - /* ty : I32Type */0, - /* align */align, - /* offset */offset, - /* sz : Some */[/* tuple */[ - /* Mem16 */1, - /* SX */0 - ]] - ]]); -} - -function i32_load16_u(align, offset) { - return /* Load */Block.__(13, [/* record */[ - /* ty : I32Type */0, - /* align */align, - /* offset */offset, - /* sz : Some */[/* tuple */[ - /* Mem16 */1, - /* ZX */1 - ]] - ]]); -} - -function i64_load8_s(align, offset) { - return /* Load */Block.__(13, [/* record */[ - /* ty : I64Type */1, - /* align */align, - /* offset */offset, - /* sz : Some */[/* tuple */[ - /* Mem8 */0, - /* SX */0 - ]] - ]]); -} - -function i64_load8_u(align, offset) { - return /* Load */Block.__(13, [/* record */[ - /* ty : I64Type */1, - /* align */align, - /* offset */offset, - /* sz : Some */[/* tuple */[ - /* Mem8 */0, - /* ZX */1 - ]] - ]]); -} - -function i64_load16_s(align, offset) { - return /* Load */Block.__(13, [/* record */[ - /* ty : I64Type */1, - /* align */align, - /* offset */offset, - /* sz : Some */[/* tuple */[ - /* Mem16 */1, - /* SX */0 - ]] - ]]); -} - -function i64_load16_u(align, offset) { - return /* Load */Block.__(13, [/* record */[ - /* ty : I64Type */1, - /* align */align, - /* offset */offset, - /* sz : Some */[/* tuple */[ - /* Mem16 */1, - /* ZX */1 - ]] - ]]); -} - -function i64_load32_s(align, offset) { - return /* Load */Block.__(13, [/* record */[ - /* ty : I64Type */1, - /* align */align, - /* offset */offset, - /* sz : Some */[/* tuple */[ - /* Mem32 */2, - /* SX */0 - ]] - ]]); -} - -function i64_load32_u(align, offset) { - return /* Load */Block.__(13, [/* record */[ - /* ty : I64Type */1, - /* align */align, - /* offset */offset, - /* sz : Some */[/* tuple */[ - /* Mem32 */2, - /* ZX */1 - ]] - ]]); -} - -function i32_store(align, offset) { - return /* Store */Block.__(14, [/* record */[ - /* ty : I32Type */0, - /* align */align, - /* offset */offset, - /* sz : None */0 - ]]); -} - -function i64_store(align, offset) { - return /* Store */Block.__(14, [/* record */[ - /* ty : I64Type */1, - /* align */align, - /* offset */offset, - /* sz : None */0 - ]]); -} - -function f32_store(align, offset) { - return /* Store */Block.__(14, [/* record */[ - /* ty : F32Type */2, - /* align */align, - /* offset */offset, - /* sz : None */0 - ]]); -} - -function f64_store(align, offset) { - return /* Store */Block.__(14, [/* record */[ - /* ty : F64Type */3, - /* align */align, - /* offset */offset, - /* sz : None */0 - ]]); -} - -function i32_store8(align, offset) { - return /* Store */Block.__(14, [/* record */[ - /* ty : I32Type */0, - /* align */align, - /* offset */offset, - /* sz : Some */[/* Mem8 */0] - ]]); -} - -function i32_store16(align, offset) { - return /* Store */Block.__(14, [/* record */[ - /* ty : I32Type */0, - /* align */align, - /* offset */offset, - /* sz : Some */[/* Mem16 */1] - ]]); -} - -function i64_store8(align, offset) { - return /* Store */Block.__(14, [/* record */[ - /* ty : I64Type */1, - /* align */align, - /* offset */offset, - /* sz : Some */[/* Mem8 */0] - ]]); -} - -function i64_store16(align, offset) { - return /* Store */Block.__(14, [/* record */[ - /* ty : I64Type */1, - /* align */align, - /* offset */offset, - /* sz : Some */[/* Mem16 */1] - ]]); -} - -function i64_store32(align, offset) { - return /* Store */Block.__(14, [/* record */[ - /* ty : I64Type */1, - /* align */align, - /* offset */offset, - /* sz : Some */[/* Mem32 */2] - ]]); -} - -var unreachable = /* Unreachable */0; - -var nop = /* Nop */1; - -var drop = /* Drop */3; - -var $$return = /* Return */2; - -var select = /* Select */4; - -var i32_clz = /* Unary */Block.__(18, [/* I32 */Block.__(0, [/* Clz */0])]); - -var i32_ctz = /* Unary */Block.__(18, [/* I32 */Block.__(0, [/* Ctz */1])]); - -var i32_popcnt = /* Unary */Block.__(18, [/* I32 */Block.__(0, [/* Popcnt */2])]); - -var i64_clz = /* Unary */Block.__(18, [/* I64 */Block.__(1, [/* Clz */0])]); - -var i64_ctz = /* Unary */Block.__(18, [/* I64 */Block.__(1, [/* Ctz */1])]); - -var i64_popcnt = /* Unary */Block.__(18, [/* I64 */Block.__(1, [/* Popcnt */2])]); - -var f32_neg = /* Unary */Block.__(18, [/* F32 */Block.__(2, [/* Neg */0])]); - -var f32_abs = /* Unary */Block.__(18, [/* F32 */Block.__(2, [/* Abs */1])]); - -var f32_sqrt = /* Unary */Block.__(18, [/* F32 */Block.__(2, [/* Sqrt */6])]); - -var f32_ceil = /* Unary */Block.__(18, [/* F32 */Block.__(2, [/* Ceil */2])]); - -var f32_floor = /* Unary */Block.__(18, [/* F32 */Block.__(2, [/* Floor */3])]); - -var f32_trunc = /* Unary */Block.__(18, [/* F32 */Block.__(2, [/* Trunc */4])]); - -var f32_nearest = /* Unary */Block.__(18, [/* F32 */Block.__(2, [/* Nearest */5])]); - -var f64_neg = /* Unary */Block.__(18, [/* F64 */Block.__(3, [/* Neg */0])]); - -var f64_abs = /* Unary */Block.__(18, [/* F64 */Block.__(3, [/* Abs */1])]); - -var f64_sqrt = /* Unary */Block.__(18, [/* F64 */Block.__(3, [/* Sqrt */6])]); - -var f64_ceil = /* Unary */Block.__(18, [/* F64 */Block.__(3, [/* Ceil */2])]); - -var f64_floor = /* Unary */Block.__(18, [/* F64 */Block.__(3, [/* Floor */3])]); - -var f64_trunc = /* Unary */Block.__(18, [/* F64 */Block.__(3, [/* Trunc */4])]); - -var f64_nearest = /* Unary */Block.__(18, [/* F64 */Block.__(3, [/* Nearest */5])]); - -var i32_add = /* Binary */Block.__(19, [/* I32 */Block.__(0, [/* Add */0])]); - -var i32_sub = /* Binary */Block.__(19, [/* I32 */Block.__(0, [/* Sub */1])]); - -var i32_mul = /* Binary */Block.__(19, [/* I32 */Block.__(0, [/* Mul */2])]); - -var i32_div_s = /* Binary */Block.__(19, [/* I32 */Block.__(0, [/* DivS */3])]); - -var i32_div_u = /* Binary */Block.__(19, [/* I32 */Block.__(0, [/* DivU */4])]); - -var i32_rem_s = /* Binary */Block.__(19, [/* I32 */Block.__(0, [/* RemS */5])]); - -var i32_rem_u = /* Binary */Block.__(19, [/* I32 */Block.__(0, [/* RemU */6])]); - -var i32_and = /* Binary */Block.__(19, [/* I32 */Block.__(0, [/* And */7])]); - -var i32_or = /* Binary */Block.__(19, [/* I32 */Block.__(0, [/* Or */8])]); - -var i32_xor = /* Binary */Block.__(19, [/* I32 */Block.__(0, [/* Xor */9])]); - -var i32_shl = /* Binary */Block.__(19, [/* I32 */Block.__(0, [/* Shl */10])]); - -var i32_shr_s = /* Binary */Block.__(19, [/* I32 */Block.__(0, [/* ShrS */11])]); - -var i32_shr_u = /* Binary */Block.__(19, [/* I32 */Block.__(0, [/* ShrU */12])]); - -var i32_rotl = /* Binary */Block.__(19, [/* I32 */Block.__(0, [/* Rotl */13])]); - -var i32_rotr = /* Binary */Block.__(19, [/* I32 */Block.__(0, [/* Rotr */14])]); - -var i64_add = /* Binary */Block.__(19, [/* I64 */Block.__(1, [/* Add */0])]); - -var i64_sub = /* Binary */Block.__(19, [/* I64 */Block.__(1, [/* Sub */1])]); - -var i64_mul = /* Binary */Block.__(19, [/* I64 */Block.__(1, [/* Mul */2])]); - -var i64_div_s = /* Binary */Block.__(19, [/* I64 */Block.__(1, [/* DivS */3])]); - -var i64_div_u = /* Binary */Block.__(19, [/* I64 */Block.__(1, [/* DivU */4])]); - -var i64_rem_s = /* Binary */Block.__(19, [/* I64 */Block.__(1, [/* RemS */5])]); - -var i64_rem_u = /* Binary */Block.__(19, [/* I64 */Block.__(1, [/* RemU */6])]); - -var i64_and = /* Binary */Block.__(19, [/* I64 */Block.__(1, [/* And */7])]); - -var i64_or = /* Binary */Block.__(19, [/* I64 */Block.__(1, [/* Or */8])]); - -var i64_xor = /* Binary */Block.__(19, [/* I64 */Block.__(1, [/* Xor */9])]); - -var i64_shl = /* Binary */Block.__(19, [/* I64 */Block.__(1, [/* Shl */10])]); - -var i64_shr_s = /* Binary */Block.__(19, [/* I64 */Block.__(1, [/* ShrS */11])]); - -var i64_shr_u = /* Binary */Block.__(19, [/* I64 */Block.__(1, [/* ShrU */12])]); - -var i64_rotl = /* Binary */Block.__(19, [/* I64 */Block.__(1, [/* Rotl */13])]); - -var i64_rotr = /* Binary */Block.__(19, [/* I64 */Block.__(1, [/* Rotr */14])]); - -var f32_add = /* Binary */Block.__(19, [/* F32 */Block.__(2, [/* Add */0])]); - -var f32_sub = /* Binary */Block.__(19, [/* F32 */Block.__(2, [/* Sub */1])]); - -var f32_mul = /* Binary */Block.__(19, [/* F32 */Block.__(2, [/* Mul */2])]); - -var f32_div = /* Binary */Block.__(19, [/* F32 */Block.__(2, [/* Div */3])]); - -var f32_min = /* Binary */Block.__(19, [/* F32 */Block.__(2, [/* Min */4])]); - -var f32_max = /* Binary */Block.__(19, [/* F32 */Block.__(2, [/* Max */5])]); - -var f32_copysign = /* Binary */Block.__(19, [/* F32 */Block.__(2, [/* CopySign */6])]); - -var f64_add = /* Binary */Block.__(19, [/* F64 */Block.__(3, [/* Add */0])]); - -var f64_sub = /* Binary */Block.__(19, [/* F64 */Block.__(3, [/* Sub */1])]); - -var f64_mul = /* Binary */Block.__(19, [/* F64 */Block.__(3, [/* Mul */2])]); - -var f64_div = /* Binary */Block.__(19, [/* F64 */Block.__(3, [/* Div */3])]); - -var f64_min = /* Binary */Block.__(19, [/* F64 */Block.__(3, [/* Min */4])]); - -var f64_max = /* Binary */Block.__(19, [/* F64 */Block.__(3, [/* Max */5])]); - -var f64_copysign = /* Binary */Block.__(19, [/* F64 */Block.__(3, [/* CopySign */6])]); - -var i32_eqz = /* Test */Block.__(16, [/* I32 */Block.__(0, [/* Eqz */0])]); - -var i64_eqz = /* Test */Block.__(16, [/* I64 */Block.__(1, [/* Eqz */0])]); - -var i32_eq = /* Compare */Block.__(17, [/* I32 */Block.__(0, [/* Eq */0])]); - -var i32_ne = /* Compare */Block.__(17, [/* I32 */Block.__(0, [/* Ne */1])]); - -var i32_lt_s = /* Compare */Block.__(17, [/* I32 */Block.__(0, [/* LtS */2])]); - -var i32_lt_u = /* Compare */Block.__(17, [/* I32 */Block.__(0, [/* LtU */3])]); - -var i32_le_s = /* Compare */Block.__(17, [/* I32 */Block.__(0, [/* LeS */6])]); - -var i32_le_u = /* Compare */Block.__(17, [/* I32 */Block.__(0, [/* LeU */7])]); - -var i32_gt_s = /* Compare */Block.__(17, [/* I32 */Block.__(0, [/* GtS */4])]); - -var i32_gt_u = /* Compare */Block.__(17, [/* I32 */Block.__(0, [/* GtU */5])]); - -var i32_ge_s = /* Compare */Block.__(17, [/* I32 */Block.__(0, [/* GeS */8])]); - -var i32_ge_u = /* Compare */Block.__(17, [/* I32 */Block.__(0, [/* GeU */9])]); - -var i64_eq = /* Compare */Block.__(17, [/* I64 */Block.__(1, [/* Eq */0])]); - -var i64_ne = /* Compare */Block.__(17, [/* I64 */Block.__(1, [/* Ne */1])]); - -var i64_lt_s = /* Compare */Block.__(17, [/* I64 */Block.__(1, [/* LtS */2])]); - -var i64_lt_u = /* Compare */Block.__(17, [/* I64 */Block.__(1, [/* LtU */3])]); - -var i64_le_s = /* Compare */Block.__(17, [/* I64 */Block.__(1, [/* LeS */6])]); - -var i64_le_u = /* Compare */Block.__(17, [/* I64 */Block.__(1, [/* LeU */7])]); - -var i64_gt_s = /* Compare */Block.__(17, [/* I64 */Block.__(1, [/* GtS */4])]); - -var i64_gt_u = /* Compare */Block.__(17, [/* I64 */Block.__(1, [/* GtU */5])]); - -var i64_ge_s = /* Compare */Block.__(17, [/* I64 */Block.__(1, [/* GeS */8])]); - -var i64_ge_u = /* Compare */Block.__(17, [/* I64 */Block.__(1, [/* GeU */9])]); - -var f32_eq = /* Compare */Block.__(17, [/* F32 */Block.__(2, [/* Eq */0])]); - -var f32_ne = /* Compare */Block.__(17, [/* F32 */Block.__(2, [/* Ne */1])]); - -var f32_lt = /* Compare */Block.__(17, [/* F32 */Block.__(2, [/* Lt */2])]); - -var f32_le = /* Compare */Block.__(17, [/* F32 */Block.__(2, [/* Le */4])]); - -var f32_gt = /* Compare */Block.__(17, [/* F32 */Block.__(2, [/* Gt */3])]); - -var f32_ge = /* Compare */Block.__(17, [/* F32 */Block.__(2, [/* Ge */5])]); - -var f64_eq = /* Compare */Block.__(17, [/* F64 */Block.__(3, [/* Eq */0])]); - -var f64_ne = /* Compare */Block.__(17, [/* F64 */Block.__(3, [/* Ne */1])]); - -var f64_lt = /* Compare */Block.__(17, [/* F64 */Block.__(3, [/* Lt */2])]); - -var f64_le = /* Compare */Block.__(17, [/* F64 */Block.__(3, [/* Le */4])]); - -var f64_gt = /* Compare */Block.__(17, [/* F64 */Block.__(3, [/* Gt */3])]); - -var f64_ge = /* Compare */Block.__(17, [/* F64 */Block.__(3, [/* Ge */5])]); - -var i32_wrap_i64 = /* Convert */Block.__(20, [/* I32 */Block.__(0, [/* WrapI64 */2])]); - -var i32_trunc_s_f32 = /* Convert */Block.__(20, [/* I32 */Block.__(0, [/* TruncSF32 */3])]); - -var i32_trunc_u_f32 = /* Convert */Block.__(20, [/* I32 */Block.__(0, [/* TruncUF32 */4])]); - -var i32_trunc_s_f64 = /* Convert */Block.__(20, [/* I32 */Block.__(0, [/* TruncSF64 */5])]); - -var i32_trunc_u_f64 = /* Convert */Block.__(20, [/* I32 */Block.__(0, [/* TruncUF64 */6])]); - -var i64_extend_s_i32 = /* Convert */Block.__(20, [/* I64 */Block.__(1, [/* ExtendSI32 */0])]); - -var i64_extend_u_i32 = /* Convert */Block.__(20, [/* I64 */Block.__(1, [/* ExtendUI32 */1])]); - -var i64_trunc_s_f32 = /* Convert */Block.__(20, [/* I64 */Block.__(1, [/* TruncSF32 */3])]); - -var i64_trunc_u_f32 = /* Convert */Block.__(20, [/* I64 */Block.__(1, [/* TruncUF32 */4])]); - -var i64_trunc_s_f64 = /* Convert */Block.__(20, [/* I64 */Block.__(1, [/* TruncSF64 */5])]); - -var i64_trunc_u_f64 = /* Convert */Block.__(20, [/* I64 */Block.__(1, [/* TruncUF64 */6])]); - -var f32_convert_s_i32 = /* Convert */Block.__(20, [/* F32 */Block.__(2, [/* ConvertSI32 */0])]); - -var f32_convert_u_i32 = /* Convert */Block.__(20, [/* F32 */Block.__(2, [/* ConvertUI32 */1])]); - -var f32_convert_s_i64 = /* Convert */Block.__(20, [/* F32 */Block.__(2, [/* ConvertSI64 */2])]); - -var f32_convert_u_i64 = /* Convert */Block.__(20, [/* F32 */Block.__(2, [/* ConvertUI64 */3])]); - -var f32_demote_f64 = /* Convert */Block.__(20, [/* F32 */Block.__(2, [/* DemoteF64 */5])]); - -var f64_convert_s_i32 = /* Convert */Block.__(20, [/* F64 */Block.__(3, [/* ConvertSI32 */0])]); - -var f64_convert_u_i32 = /* Convert */Block.__(20, [/* F64 */Block.__(3, [/* ConvertUI32 */1])]); - -var f64_convert_s_i64 = /* Convert */Block.__(20, [/* F64 */Block.__(3, [/* ConvertSI64 */2])]); - -var f64_convert_u_i64 = /* Convert */Block.__(20, [/* F64 */Block.__(3, [/* ConvertUI64 */3])]); - -var f64_promote_f32 = /* Convert */Block.__(20, [/* F64 */Block.__(3, [/* PromoteF32 */4])]); - -var i32_reinterpret_f32 = /* Convert */Block.__(20, [/* I32 */Block.__(0, [/* ReinterpretFloat */7])]); - -var i64_reinterpret_f64 = /* Convert */Block.__(20, [/* I64 */Block.__(1, [/* ReinterpretFloat */7])]); - -var f32_reinterpret_i32 = /* Convert */Block.__(20, [/* F32 */Block.__(2, [/* ReinterpretInt */6])]); - -var f64_reinterpret_i64 = /* Convert */Block.__(20, [/* F64 */Block.__(3, [/* ReinterpretInt */6])]); - -var current_memory = /* CurrentMemory */5; - -var grow_memory = /* GrowMemory */6; - -exports.i32_const = i32_const; -exports.i64_const = i64_const; -exports.f32_const = f32_const; -exports.f64_const = f64_const; -exports.unreachable = unreachable; -exports.nop = nop; -exports.drop = drop; -exports.block = block; -exports.loop = loop; -exports.br = br; -exports.br_if = br_if; -exports.br_table = br_table; -exports.$$return = $$return; -exports.if_ = if_; -exports.select = select; -exports.call = call; -exports.call_indirect = call_indirect; -exports.get_local = get_local; -exports.set_local = set_local; -exports.tee_local = tee_local; -exports.get_global = get_global; -exports.set_global = set_global; -exports.i32_load = i32_load; -exports.i64_load = i64_load; -exports.f32_load = f32_load; -exports.f64_load = f64_load; -exports.i32_load8_s = i32_load8_s; -exports.i32_load8_u = i32_load8_u; -exports.i32_load16_s = i32_load16_s; -exports.i32_load16_u = i32_load16_u; -exports.i64_load8_s = i64_load8_s; -exports.i64_load8_u = i64_load8_u; -exports.i64_load16_s = i64_load16_s; -exports.i64_load16_u = i64_load16_u; -exports.i64_load32_s = i64_load32_s; -exports.i64_load32_u = i64_load32_u; -exports.i32_store = i32_store; -exports.i64_store = i64_store; -exports.f32_store = f32_store; -exports.f64_store = f64_store; -exports.i32_store8 = i32_store8; -exports.i32_store16 = i32_store16; -exports.i64_store8 = i64_store8; -exports.i64_store16 = i64_store16; -exports.i64_store32 = i64_store32; -exports.i32_clz = i32_clz; -exports.i32_ctz = i32_ctz; -exports.i32_popcnt = i32_popcnt; -exports.i64_clz = i64_clz; -exports.i64_ctz = i64_ctz; -exports.i64_popcnt = i64_popcnt; -exports.f32_neg = f32_neg; -exports.f32_abs = f32_abs; -exports.f32_sqrt = f32_sqrt; -exports.f32_ceil = f32_ceil; -exports.f32_floor = f32_floor; -exports.f32_trunc = f32_trunc; -exports.f32_nearest = f32_nearest; -exports.f64_neg = f64_neg; -exports.f64_abs = f64_abs; -exports.f64_sqrt = f64_sqrt; -exports.f64_ceil = f64_ceil; -exports.f64_floor = f64_floor; -exports.f64_trunc = f64_trunc; -exports.f64_nearest = f64_nearest; -exports.i32_add = i32_add; -exports.i32_sub = i32_sub; -exports.i32_mul = i32_mul; -exports.i32_div_s = i32_div_s; -exports.i32_div_u = i32_div_u; -exports.i32_rem_s = i32_rem_s; -exports.i32_rem_u = i32_rem_u; -exports.i32_and = i32_and; -exports.i32_or = i32_or; -exports.i32_xor = i32_xor; -exports.i32_shl = i32_shl; -exports.i32_shr_s = i32_shr_s; -exports.i32_shr_u = i32_shr_u; -exports.i32_rotl = i32_rotl; -exports.i32_rotr = i32_rotr; -exports.i64_add = i64_add; -exports.i64_sub = i64_sub; -exports.i64_mul = i64_mul; -exports.i64_div_s = i64_div_s; -exports.i64_div_u = i64_div_u; -exports.i64_rem_s = i64_rem_s; -exports.i64_rem_u = i64_rem_u; -exports.i64_and = i64_and; -exports.i64_or = i64_or; -exports.i64_xor = i64_xor; -exports.i64_shl = i64_shl; -exports.i64_shr_s = i64_shr_s; -exports.i64_shr_u = i64_shr_u; -exports.i64_rotl = i64_rotl; -exports.i64_rotr = i64_rotr; -exports.f32_add = f32_add; -exports.f32_sub = f32_sub; -exports.f32_mul = f32_mul; -exports.f32_div = f32_div; -exports.f32_min = f32_min; -exports.f32_max = f32_max; -exports.f32_copysign = f32_copysign; -exports.f64_add = f64_add; -exports.f64_sub = f64_sub; -exports.f64_mul = f64_mul; -exports.f64_div = f64_div; -exports.f64_min = f64_min; -exports.f64_max = f64_max; -exports.f64_copysign = f64_copysign; -exports.i32_eqz = i32_eqz; -exports.i64_eqz = i64_eqz; -exports.i32_eq = i32_eq; -exports.i32_ne = i32_ne; -exports.i32_lt_s = i32_lt_s; -exports.i32_lt_u = i32_lt_u; -exports.i32_le_s = i32_le_s; -exports.i32_le_u = i32_le_u; -exports.i32_gt_s = i32_gt_s; -exports.i32_gt_u = i32_gt_u; -exports.i32_ge_s = i32_ge_s; -exports.i32_ge_u = i32_ge_u; -exports.i64_eq = i64_eq; -exports.i64_ne = i64_ne; -exports.i64_lt_s = i64_lt_s; -exports.i64_lt_u = i64_lt_u; -exports.i64_le_s = i64_le_s; -exports.i64_le_u = i64_le_u; -exports.i64_gt_s = i64_gt_s; -exports.i64_gt_u = i64_gt_u; -exports.i64_ge_s = i64_ge_s; -exports.i64_ge_u = i64_ge_u; -exports.f32_eq = f32_eq; -exports.f32_ne = f32_ne; -exports.f32_lt = f32_lt; -exports.f32_le = f32_le; -exports.f32_gt = f32_gt; -exports.f32_ge = f32_ge; -exports.f64_eq = f64_eq; -exports.f64_ne = f64_ne; -exports.f64_lt = f64_lt; -exports.f64_le = f64_le; -exports.f64_gt = f64_gt; -exports.f64_ge = f64_ge; -exports.i32_wrap_i64 = i32_wrap_i64; -exports.i32_trunc_s_f32 = i32_trunc_s_f32; -exports.i32_trunc_u_f32 = i32_trunc_u_f32; -exports.i32_trunc_s_f64 = i32_trunc_s_f64; -exports.i32_trunc_u_f64 = i32_trunc_u_f64; -exports.i64_extend_s_i32 = i64_extend_s_i32; -exports.i64_extend_u_i32 = i64_extend_u_i32; -exports.i64_trunc_s_f32 = i64_trunc_s_f32; -exports.i64_trunc_u_f32 = i64_trunc_u_f32; -exports.i64_trunc_s_f64 = i64_trunc_s_f64; -exports.i64_trunc_u_f64 = i64_trunc_u_f64; -exports.f32_convert_s_i32 = f32_convert_s_i32; -exports.f32_convert_u_i32 = f32_convert_u_i32; -exports.f32_convert_s_i64 = f32_convert_s_i64; -exports.f32_convert_u_i64 = f32_convert_u_i64; -exports.f32_demote_f64 = f32_demote_f64; -exports.f64_convert_s_i32 = f64_convert_s_i32; -exports.f64_convert_u_i32 = f64_convert_u_i32; -exports.f64_convert_s_i64 = f64_convert_s_i64; -exports.f64_convert_u_i64 = f64_convert_u_i64; -exports.f64_promote_f32 = f64_promote_f32; -exports.i32_reinterpret_f32 = i32_reinterpret_f32; -exports.i64_reinterpret_f64 = i64_reinterpret_f64; -exports.f32_reinterpret_i32 = f32_reinterpret_i32; -exports.f64_reinterpret_i64 = f64_reinterpret_i64; -exports.current_memory = current_memory; -exports.grow_memory = grow_memory; -/* No side effect */ -//////// end of operators.js //////// -    return exports; -  }; - - - _registry['parse'] = function() { -    let exports = {}; -//////// start of parse.js //////// -// Generated by BUCKLESCRIPT VERSION 1.4.3 , PLEASE EDIT WITH CARE -'use strict'; - -var Curry = require("bs-platform/lib/js/curry"); -var Lexer = require("./lexer"); -var Lexing = require("bs-platform/lib/js/lexing"); -var Parser = require("./parser"); -var Script = require("./script"); -var Source = require("./source"); -var Caml_obj = require("bs-platform/lib/js/caml_obj"); - -function parse$prime(name, lexbuf, start) { - var init = lexbuf[/* lex_curr_p */11]; - lexbuf[/* lex_curr_p */11] = /* record */[ - /* pos_fname */name, - /* pos_lnum */init[/* pos_lnum */1], - /* pos_bol */init[/* pos_bol */2], - /* pos_cnum */init[/* pos_cnum */3] - ]; - try { - return Curry._2(start, Lexer.token, lexbuf); - } - catch (exn){ - if (exn[0] === Script.Syntax) { - var region = exn[1]; - var region$prime = Caml_obj.caml_notequal(region, Source.no_region) ? region : /* record */[ - /* left */Lexer.convert_pos(lexbuf[/* lex_start_p */10]), - /* right */Lexer.convert_pos(lexbuf[/* lex_curr_p */11]) - ]; - throw [ - Script.Syntax, - region$prime, - exn[2] - ]; - } - else { - throw exn; - } - } -} - -function parse(name, lexbuf, param) { - switch (param) { - case 0 : - return parse$prime(name, lexbuf, Parser.module1); - case 1 : - return parse$prime(name, lexbuf, Parser.script); - case 2 : - return parse$prime(name, lexbuf, Parser.script1); - - } -} - -function string_to(start, s) { - var lexbuf = Lexing.from_string(s); - return parse("string", lexbuf, start); -} - -function string_to_script(s) { - return string_to(/* Script */1, s); -} - -function string_to_module(s) { - return string_to(/* Module */0, s); -} - -var Syntax = Script.Syntax; - -exports.Syntax = Syntax; -exports.parse = parse; -exports.string_to_script = string_to_script; -exports.string_to_module = string_to_module; -/* Lexer Not a pure module */ -//////// end of parse.js //////// -    return exports; -  }; - - - _registry['parser'] = function() { -    let exports = {}; -//////// start of parser.js //////// -// Generated by BUCKLESCRIPT VERSION 1.4.3 , PLEASE EDIT WITH CARE -'use strict'; - -var Ast = require("./ast"); -var I32 = require("./i32"); -var Lib = require("./lib"); -var $$Map = require("bs-platform/lib/js/map"); -var List = require("bs-platform/lib/js/list"); -var Block = require("bs-platform/lib/js/block"); -var Curry = require("bs-platform/lib/js/curry"); -var Script = require("./script"); -var Source = require("./source"); -var $$String = require("bs-platform/lib/js/string"); -var Parsing = require("bs-platform/lib/js/parsing"); -var Caml_obj = require("bs-platform/lib/js/caml_obj"); -var Operators = require("./operators"); -var Pervasives = require("bs-platform/lib/js/pervasives"); -var Caml_format = require("bs-platform/lib/js/caml_format"); -var Caml_builtin_exceptions = require("bs-platform/lib/js/caml_builtin_exceptions"); - -function parse_error(msg) { - var msg$1 = msg === "syntax error" ? "unexpected token" : msg; - throw [ - Script.Syntax, - Source.no_region, - msg$1 - ]; -} - -function position_to_pos(position) { - return /* record */[ - /* file */position[/* pos_fname */0], - /* line */position[/* pos_lnum */1], - /* column */position[/* pos_cnum */3] - position[/* pos_bol */2] | 0 - ]; -} - -function positions_to_region(position1, position2) { - return /* record */[ - /* left */position_to_pos(position1), - /* right */position_to_pos(position2) - ]; -} - -function at() { - return positions_to_region(Parsing.symbol_start_pos(/* () */0), Parsing.symbol_end_pos(/* () */0)); -} - -function ati(i) { - return positions_to_region(Parsing.rhs_start_pos(i), Parsing.rhs_end_pos(i)); -} - -function literal(f, s) { - try { - return Curry._1(f, s); - } - catch (exn){ - if (exn[0] === Caml_builtin_exceptions.failure) { - throw [ - Script.Syntax, - s[/* at */0], - "constant out of range" - ]; - } - else { - throw exn; - } - } -} - -function nat(s, at) { - try { - var n = Caml_format.caml_int_of_string(s); - if (n >= 0) { - return n; - } - else { - throw [ - Caml_builtin_exceptions.failure, - "" - ]; - } - } - catch (exn){ - if (exn[0] === Caml_builtin_exceptions.failure) { - throw [ - Script.Syntax, - at, - "integer constant out of range" - ]; - } - else { - throw exn; - } - } -} - -function nat32(s, at) { - try { - return Curry._1(I32.of_string_u, s); - } - catch (exn){ - if (exn[0] === Caml_builtin_exceptions.failure) { - throw [ - Script.Syntax, - at, - "i32 constant out of range" - ]; - } - else { - throw exn; - } - } -} - -var VarMap = $$Map.Make([$$String.compare]); - -function empty_context() { - return /* record */[ - /* types : record */[ - /* tmap */VarMap[/* empty */0], - /* tlist : [] */0 - ], - /* tables : record */[ - /* map */VarMap[/* empty */0], - /* count */0 - ], - /* memories : record */[ - /* map */VarMap[/* empty */0], - /* count */0 - ], - /* funcs : record */[ - /* map */VarMap[/* empty */0], - /* count */0 - ], - /* locals : record */[ - /* map */VarMap[/* empty */0], - /* count */0 - ], - /* globals : record */[ - /* map */VarMap[/* empty */0], - /* count */0 - ], - /* labels */VarMap[/* empty */0] - ]; -} - -function enter_func(c) { - return /* record */[ - /* types */c[/* types */0], - /* tables */c[/* tables */1], - /* memories */c[/* memories */2], - /* funcs */c[/* funcs */3], - /* locals : record */[ - /* map */VarMap[/* empty */0], - /* count */0 - ], - /* globals */c[/* globals */5], - /* labels */VarMap[/* empty */0] - ]; -} - -function type_(c, x) { - try { - return Curry._2(VarMap[/* find */21], x[/* it */1], c[/* types */0][/* tmap */0]); - } - catch (exn){ - if (exn === Caml_builtin_exceptions.not_found) { - throw [ - Script.Syntax, - x[/* at */0], - "unknown type " + x[/* it */1] - ]; - } - else { - throw exn; - } - } -} - -function lookup(category, space, x) { - try { - return Curry._2(VarMap[/* find */21], x[/* it */1], space[/* map */0]); - } - catch (exn){ - if (exn === Caml_builtin_exceptions.not_found) { - throw [ - Script.Syntax, - x[/* at */0], - "unknown " + (category + (" " + x[/* it */1])) - ]; - } - else { - throw exn; - } - } -} - -function func(c, x) { - return lookup("function", c[/* funcs */3], x); -} - -function local(c, x) { - return lookup("local", c[/* locals */4], x); -} - -function global(c, x) { - return lookup("global", c[/* globals */5], x); -} - -function table(c, x) { - return lookup("table", c[/* tables */1], x); -} - -function memory(c, x) { - return lookup("memory", c[/* memories */2], x); -} - -function label(c, x) { - try { - return Curry._2(VarMap[/* find */21], x[/* it */1], c[/* labels */6]); - } - catch (exn){ - if (exn === Caml_builtin_exceptions.not_found) { - throw [ - Script.Syntax, - x[/* at */0], - "unknown label " + x[/* it */1] - ]; - } - else { - throw exn; - } - } -} - -function anon_type(c, ty) { - c[/* types */0][/* tlist */1] = Pervasives.$at(c[/* types */0][/* tlist */1], /* :: */[ - ty, - /* [] */0 - ]); - return /* () */0; -} - -function bind(category, space, x) { - if (Curry._2(VarMap[/* mem */2], x[/* it */1], space[/* map */0])) { - throw [ - Script.Syntax, - x[/* at */0], - "duplicate " + (category + (" " + x[/* it */1])) - ]; - } - space[/* map */0] = Curry._3(VarMap[/* add */3], x[/* it */1], space[/* count */1], space[/* map */0]); - space[/* count */1] = space[/* count */1] + 1 | 0; - if (space[/* count */1]) { - return 0; - } - else { - throw [ - Script.Syntax, - x[/* at */0], - "too many " + (category + " bindings") - ]; - } -} - -function bind_func(c, x) { - return bind("function", c[/* funcs */3], x); -} - -function bind_local(c, x) { - return bind("local", c[/* locals */4], x); -} - -function bind_global(c, x) { - return bind("global", c[/* globals */5], x); -} - -function bind_table(c, x) { - return bind("table", c[/* tables */1], x); -} - -function bind_memory(c, x) { - return bind("memory", c[/* memories */2], x); -} - -function anon(category, space, n) { - space[/* count */1] = space[/* count */1] + n | 0; - if (Curry._2(I32.lt_u, space[/* count */1], n)) { - throw [ - Script.Syntax, - Source.no_region, - "too many " + (category + " bindings") - ]; - } - else { - return 0; - } -} - -function anon_func(c) { - return anon("function", c[/* funcs */3], 1); -} - -function anon_locals(c, ts) { - return anon("local", c[/* locals */4], Curry._1(Lib.List32[/* length */0], ts)); -} - -function anon_global(c) { - return anon("global", c[/* globals */5], 1); -} - -function anon_table(c) { - return anon("table", c[/* tables */1], 1); -} - -function anon_memory(c) { - return anon("memory", c[/* memories */2], 1); -} - -function anon_label(c) { - var newrecord = c.slice(); - newrecord[/* labels */6] = Curry._2(VarMap[/* map */22], function (param) { - return 1 + param | 0; - }, c[/* labels */6]); - return newrecord; -} - -var empty_type = /* FuncType */[ - /* [] */0, - /* [] */0 -]; - -function explicit_sig(c, var_sem, ty, at) { - var x = Curry._2(var_sem, c, type_); - if (x[/* it */1] < Curry._1(Lib.List32[/* length */0], c[/* types */0][/* tlist */1]) && Caml_obj.caml_notequal(ty, empty_type) && Caml_obj.caml_notequal(ty, Curry._2(Lib.List32[/* nth */1], c[/* types */0][/* tlist */1], x[/* it */1]))) { - throw [ - Script.Syntax, - at, - "signature mismatch" - ]; - } - return x; -} - -function inline_type(c, ty, at) { - var match = Curry._2(Lib.List[/* index_of */6], ty, c[/* types */0][/* tlist */1]); - if (match) { - return Source.$at$at(match[0], at); - } - else { - var i = Curry._1(Lib.List32[/* length */0], c[/* types */0][/* tlist */1]); - anon_type(c, ty); - return Source.$at$at(i, at); - } -} - -var yytransl_const = /* array */[ - 263, - 264, - 265, - 266, - 267, - 268, - 269, - 270, - 271, - 272, - 273, - 274, - 275, - 276, - 277, - 278, - 279, - 280, - 281, - 282, - 283, - 284, - 285, - 286, - 296, - 297, - 298, - 299, - 300, - 301, - 302, - 303, - 304, - 305, - 306, - 307, - 308, - 309, - 310, - 311, - 312, - 313, - 314, - 315, - 316, - 317, - 318, - 319, - 320, - 321, - 322, - 323, - 324, - 325, - 326, - 327, - 0, - 0 -]; - -var yytransl_block = /* array */[ - 257, - 258, - 259, - 260, - 261, - 262, - 287, - 288, - 289, - 290, - 291, - 292, - 293, - 294, - 295, - 328, - 0 -]; - -var yyact = /* array */[ - function () { - return Pervasives.failwith("parser"); - }, - function () { - return ""; - }, - function (__caml_parser_env) { - var _1 = Parsing.peek_val(__caml_parser_env, 1); - var _2 = Parsing.peek_val(__caml_parser_env, 0); - return _1 + _2; - }, - function () { - return /* [] */0; - }, - function (__caml_parser_env) { - var _1 = Parsing.peek_val(__caml_parser_env, 1); - var _2 = Parsing.peek_val(__caml_parser_env, 0); - return /* :: */[ - _1, - _2 - ]; - }, - function () { - return /* AnyFuncType */0; - }, - function (__caml_parser_env) { - var _1 = Parsing.peek_val(__caml_parser_env, 0); - return /* GlobalType */[ - _1, - /* Immutable */0 - ]; - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 1); - return /* GlobalType */[ - _3, - /* Mutable */1 - ]; - }, - function (__caml_parser_env) { - return Parsing.peek_val(__caml_parser_env, 1); - }, - function () { - return /* FuncType */[ - /* [] */0, - /* [] */0 - ]; - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 2); - var _5 = Parsing.peek_val(__caml_parser_env, 0); - var ins = _5[0]; - if (ins !== /* [] */0) { - var at$1 = at(/* () */0); - throw [ - Script.Syntax, - at$1, - "result before parameter" - ]; - } - return /* FuncType */[ - ins, - Pervasives.$at(_3, _5[1]) - ]; - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 2); - var _5 = Parsing.peek_val(__caml_parser_env, 0); - return /* FuncType */[ - Pervasives.$at(_3, _5[0]), - _5[1] - ]; - }, - function (__caml_parser_env) { - Parsing.peek_val(__caml_parser_env, 3); - var _4 = Parsing.peek_val(__caml_parser_env, 2); - var _6 = Parsing.peek_val(__caml_parser_env, 0); - return /* FuncType */[ - /* :: */[ - _4, - _6[0] - ], - _6[1] - ]; - }, - function (__caml_parser_env) { - var _1 = Parsing.peek_val(__caml_parser_env, 1); - var _2 = Parsing.peek_val(__caml_parser_env, 0); - return /* TableType */[ - _1, - _2 - ]; - }, - function (__caml_parser_env) { - var _1 = Parsing.peek_val(__caml_parser_env, 0); - return /* MemoryType */[_1]; - }, - function (__caml_parser_env) { - var _1 = Parsing.peek_val(__caml_parser_env, 0); - return /* record */[ - /* min */nat32(_1, ati(1)), - /* max : None */0 - ]; - }, - function (__caml_parser_env) { - var _1 = Parsing.peek_val(__caml_parser_env, 1); - var _2 = Parsing.peek_val(__caml_parser_env, 0); - return /* record */[ - /* min */nat32(_1, ati(1)), - /* max : Some */[nat32(_2, ati(2))] - ]; - }, - function (__caml_parser_env) { - return Parsing.peek_val(__caml_parser_env, 1); - }, - function (__caml_parser_env) { - var _1 = Parsing.peek_val(__caml_parser_env, 0); - return Source.$at$at(_1, at(/* () */0)); - }, - function (__caml_parser_env) { - var _1 = Parsing.peek_val(__caml_parser_env, 0); - return Source.$at$at(_1, at(/* () */0)); - }, - function (__caml_parser_env) { - var _1 = Parsing.peek_val(__caml_parser_env, 0); - return Source.$at$at(_1, at(/* () */0)); - }, - function (__caml_parser_env) { - var _1 = Parsing.peek_val(__caml_parser_env, 0); - var at$1 = at(/* () */0); - return function (_, _$1) { - return Source.$at$at(nat32(_1, at$1), at$1); - }; - }, - function (__caml_parser_env) { - var _1 = Parsing.peek_val(__caml_parser_env, 0); - var at$1 = at(/* () */0); - return function (c, lookup) { - return Source.$at$at(Curry._2(lookup, c, Source.$at$at(_1, at$1)), at$1); - }; - }, - function () { - return function (_, _$1) { - return /* [] */0; - }; - }, - function (__caml_parser_env) { - var _1 = Parsing.peek_val(__caml_parser_env, 1); - var _2 = Parsing.peek_val(__caml_parser_env, 0); - return function (c, lookup) { - return /* :: */[ - Curry._2(_1, c, lookup), - Curry._2(_2, c, lookup) - ]; - }; - }, - function () { - return function (c, anon, _) { - return Curry._1(anon, c); - }; - }, - function (__caml_parser_env) { - var _1 = Parsing.peek_val(__caml_parser_env, 0); - return function (c, _, bind) { - return Curry._2(bind, c, _1); - }; - }, - function (__caml_parser_env) { - var _1 = Parsing.peek_val(__caml_parser_env, 0); - return Source.$at$at(_1, at(/* () */0)); - }, - function () { - return function (c, xs) { - List.iter(function (x) { - throw [ - Script.Syntax, - x[/* at */0], - "mismatching label" - ]; - }, xs); - return anon_label(c); - }; - }, - function (__caml_parser_env) { - var _1 = Parsing.peek_val(__caml_parser_env, 0); - return function (c, xs) { - List.iter(function (x) { - if (x[/* it */1] !== _1[/* it */1]) { - throw [ - Script.Syntax, - x[/* at */0], - "mismatching label" - ]; - } - else { - return 0; - } - }, xs); - var c$1 = c; - var x = _1; - var newrecord = c$1.slice(); - newrecord[/* labels */6] = Curry._3(VarMap[/* add */3], x[/* it */1], 0, Curry._2(VarMap[/* map */22], function (param) { - return 1 + param | 0; - }, c$1[/* labels */6])); - return newrecord; - }; - }, - function () { - return /* [] */0; - }, - function (__caml_parser_env) { - var _1 = Parsing.peek_val(__caml_parser_env, 0); - return /* :: */[ - _1, - /* [] */0 - ]; - }, - function () { - return 0; - }, - function (__caml_parser_env) { - var _1 = Parsing.peek_val(__caml_parser_env, 0); - return nat32(_1, at(/* () */0)); - }, - function () { - return /* None */0; - }, - function (__caml_parser_env) { - var _1 = Parsing.peek_val(__caml_parser_env, 0); - var n = nat(_1, at(/* () */0)); - if (!Curry._1(Lib.Int[/* is_power_of_two */1], n)) { - var at$1 = at(/* () */0); - throw [ - Script.Syntax, - at$1, - "alignment must be a power of two" - ]; - } - return /* Some */[Curry._1(Lib.Int[/* log2 */0], n)]; - }, - function (__caml_parser_env) { - var _1 = Parsing.peek_val(__caml_parser_env, 0); - var at$1 = at(/* () */0); - return function (c) { - return /* :: */[ - Source.$at$at(Curry._1(_1, c), at$1), - /* [] */0 - ]; - }; - }, - function (__caml_parser_env) { - var _1 = Parsing.peek_val(__caml_parser_env, 0); - var at$1 = at(/* () */0); - return function (c) { - return /* :: */[ - Source.$at$at(Curry._1(_1, c), at$1), - /* [] */0 - ]; - }; - }, - function (__caml_parser_env) { - return Parsing.peek_val(__caml_parser_env, 0); - }, - function () { - return function () { - return Operators.unreachable; - }; - }, - function () { - return function () { - return Operators.nop; - }; - }, - function (__caml_parser_env) { - var _2 = Parsing.peek_val(__caml_parser_env, 0); - return function (c) { - return Operators.br(Curry._2(_2, c, label)); - }; - }, - function (__caml_parser_env) { - var _2 = Parsing.peek_val(__caml_parser_env, 0); - return function (c) { - return Operators.br_if(Curry._2(_2, c, label)); - }; - }, - function (__caml_parser_env) { - var _2 = Parsing.peek_val(__caml_parser_env, 1); - var _3 = Parsing.peek_val(__caml_parser_env, 0); - return function (c) { - var match = Curry._1(Lib.List[/* split_last */5], /* :: */[ - Curry._2(_2, c, label), - Curry._2(_3, c, label) - ]); - return Operators.br_table(match[0], match[1]); - }; - }, - function () { - return function () { - return Operators.$$return; - }; - }, - function (__caml_parser_env) { - var _2 = Parsing.peek_val(__caml_parser_env, 0); - return function (c) { - return Operators.call(Curry._2(_2, c, func)); - }; - }, - function (__caml_parser_env) { - var _2 = Parsing.peek_val(__caml_parser_env, 0); - return function (c) { - return Operators.call_indirect(Curry._2(_2, c, type_)); - }; - }, - function () { - return function () { - return Operators.drop; - }; - }, - function () { - return function () { - return Operators.select; - }; - }, - function (__caml_parser_env) { - var _2 = Parsing.peek_val(__caml_parser_env, 0); - return function (c) { - return Operators.get_local(Curry._2(_2, c, local)); - }; - }, - function (__caml_parser_env) { - var _2 = Parsing.peek_val(__caml_parser_env, 0); - return function (c) { - return Operators.set_local(Curry._2(_2, c, local)); - }; - }, - function (__caml_parser_env) { - var _2 = Parsing.peek_val(__caml_parser_env, 0); - return function (c) { - return Operators.tee_local(Curry._2(_2, c, local)); - }; - }, - function (__caml_parser_env) { - var _2 = Parsing.peek_val(__caml_parser_env, 0); - return function (c) { - return Operators.get_global(Curry._2(_2, c, global)); - }; - }, - function (__caml_parser_env) { - var _2 = Parsing.peek_val(__caml_parser_env, 0); - return function (c) { - return Operators.set_global(Curry._2(_2, c, global)); - }; - }, - function (__caml_parser_env) { - var _1 = Parsing.peek_val(__caml_parser_env, 2); - var _2 = Parsing.peek_val(__caml_parser_env, 1); - var _3 = Parsing.peek_val(__caml_parser_env, 0); - return function () { - return Curry._2(_1, _3, _2); - }; - }, - function (__caml_parser_env) { - var _1 = Parsing.peek_val(__caml_parser_env, 2); - var _2 = Parsing.peek_val(__caml_parser_env, 1); - var _3 = Parsing.peek_val(__caml_parser_env, 0); - return function () { - return Curry._2(_1, _3, _2); - }; - }, - function () { - return function () { - return Operators.current_memory; - }; - }, - function () { - return function () { - return Operators.grow_memory; - }; - }, - function (__caml_parser_env) { - var _1 = Parsing.peek_val(__caml_parser_env, 1); - var _2 = Parsing.peek_val(__caml_parser_env, 0); - return function () { - return literal(_1, _2)[0]; - }; - }, - function (__caml_parser_env) { - var _1 = Parsing.peek_val(__caml_parser_env, 0); - return function () { - return _1; - }; - }, - function (__caml_parser_env) { - var _1 = Parsing.peek_val(__caml_parser_env, 0); - return function () { - return _1; - }; - }, - function (__caml_parser_env) { - var _1 = Parsing.peek_val(__caml_parser_env, 0); - return function () { - return _1; - }; - }, - function (__caml_parser_env) { - var _1 = Parsing.peek_val(__caml_parser_env, 0); - return function () { - return _1; - }; - }, - function (__caml_parser_env) { - var _1 = Parsing.peek_val(__caml_parser_env, 0); - return function () { - return _1; - }; - }, - function (__caml_parser_env) { - var _2 = Parsing.peek_val(__caml_parser_env, 3); - var _3 = Parsing.peek_val(__caml_parser_env, 2); - var _5 = Parsing.peek_val(__caml_parser_env, 0); - return function (c) { - var c$prime = Curry._2(_2, c, _5); - var match = Curry._1(_3, c$prime); - return Operators.block(match[0], match[1]); - }; - }, - function (__caml_parser_env) { - var _2 = Parsing.peek_val(__caml_parser_env, 3); - var _3 = Parsing.peek_val(__caml_parser_env, 2); - var _5 = Parsing.peek_val(__caml_parser_env, 0); - return function (c) { - var c$prime = Curry._2(_2, c, _5); - var match = Curry._1(_3, c$prime); - return Operators.loop(match[0], match[1]); - }; - }, - function (__caml_parser_env) { - var _2 = Parsing.peek_val(__caml_parser_env, 3); - var _3 = Parsing.peek_val(__caml_parser_env, 2); - var _5 = Parsing.peek_val(__caml_parser_env, 0); - return function (c) { - var c$prime = Curry._2(_2, c, _5); - var match = Curry._1(_3, c$prime); - return Operators.if_(match[0], match[1], /* [] */0); - }; - }, - function (__caml_parser_env) { - var _2 = Parsing.peek_val(__caml_parser_env, 6); - var _3 = Parsing.peek_val(__caml_parser_env, 5); - var _5 = Parsing.peek_val(__caml_parser_env, 3); - var _6 = Parsing.peek_val(__caml_parser_env, 2); - var _8 = Parsing.peek_val(__caml_parser_env, 0); - return function (c) { - var c$prime = Curry._2(_2, c, Pervasives.$at(_5, _8)); - var match = Curry._1(_3, c$prime); - return Operators.if_(match[0], match[1], Curry._1(_6, c$prime)); - }; - }, - function (__caml_parser_env) { - var _1 = Parsing.peek_val(__caml_parser_env, 1); - var _2 = Parsing.peek_val(__caml_parser_env, 0); - return function (c) { - return /* tuple */[ - _1, - Curry._1(_2, c) - ]; - }; - }, - function (__caml_parser_env) { - var _2 = Parsing.peek_val(__caml_parser_env, 1); - var at$1 = at(/* () */0); - return function (c) { - var match = Curry._1(_2, c); - return Pervasives.$at(match[0], /* :: */[ - Source.$at$at(match[1], at$1), - /* [] */0 - ]); - }; - }, - function (__caml_parser_env) { - var _1 = Parsing.peek_val(__caml_parser_env, 1); - var _2 = Parsing.peek_val(__caml_parser_env, 0); - return function (c) { - return /* tuple */[ - Curry._1(_2, c)[1], - Curry._1(_1, c) - ]; - }; - }, - function (__caml_parser_env) { - var _2 = Parsing.peek_val(__caml_parser_env, 1); - var _3 = Parsing.peek_val(__caml_parser_env, 0); - return function (c) { - var c$prime = Curry._2(_2, c, /* [] */0); - var match = Curry._1(_3, c$prime); - return /* tuple */[ - /* [] */0, - Operators.block(match[0], match[1]) - ]; - }; - }, - function (__caml_parser_env) { - var _2 = Parsing.peek_val(__caml_parser_env, 1); - var _3 = Parsing.peek_val(__caml_parser_env, 0); - return function (c) { - var c$prime = Curry._2(_2, c, /* [] */0); - var match = Curry._1(_3, c$prime); - return /* tuple */[ - /* [] */0, - Operators.loop(match[0], match[1]) - ]; - }; - }, - function (__caml_parser_env) { - var _2 = Parsing.peek_val(__caml_parser_env, 2); - var _3 = Parsing.peek_val(__caml_parser_env, 1); - var _4 = Parsing.peek_val(__caml_parser_env, 0); - return function (c) { - var c$prime = Curry._2(_2, c, /* [] */0); - var match = Curry._2(_4, c, c$prime); - return /* tuple */[ - match[0], - Operators.if_(_3, match[1], match[2]) - ]; - }; - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 5); - var _7 = Parsing.peek_val(__caml_parser_env, 1); - return function (_, c$prime) { - return /* tuple */[ - /* [] */0, - Curry._1(_3, c$prime), - Curry._1(_7, c$prime) - ]; - }; - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 1); - return function (_, c$prime) { - return /* tuple */[ - /* [] */0, - Curry._1(_3, c$prime), - /* [] */0 - ]; - }; - }, - function (__caml_parser_env) { - var _1 = Parsing.peek_val(__caml_parser_env, 8); - var _4 = Parsing.peek_val(__caml_parser_env, 5); - var _8 = Parsing.peek_val(__caml_parser_env, 1); - return function (c, c$prime) { - return /* tuple */[ - Curry._1(_1, c), - Curry._1(_4, c$prime), - Curry._1(_8, c$prime) - ]; - }; - }, - function (__caml_parser_env) { - var _1 = Parsing.peek_val(__caml_parser_env, 4); - var _4 = Parsing.peek_val(__caml_parser_env, 1); - return function (c, c$prime) { - return /* tuple */[ - Curry._1(_1, c), - Curry._1(_4, c$prime), - /* [] */0 - ]; - }; - }, - function (__caml_parser_env) { - var _1 = Parsing.peek_val(__caml_parser_env, 2); - var _2 = Parsing.peek_val(__caml_parser_env, 1); - var _3 = Parsing.peek_val(__caml_parser_env, 0); - return function (c, c$prime) { - return /* tuple */[ - Curry._1(_1, c), - Curry._1(_2, c$prime), - Curry._1(_3, c$prime) - ]; - }; - }, - function (__caml_parser_env) { - var _1 = Parsing.peek_val(__caml_parser_env, 1); - var _2 = Parsing.peek_val(__caml_parser_env, 0); - return function (c, c$prime) { - return /* tuple */[ - Curry._1(_1, c), - Curry._1(_2, c$prime), - /* [] */0 - ]; - }; - }, - function () { - return function () { - return /* [] */0; - }; - }, - function (__caml_parser_env) { - var _1 = Parsing.peek_val(__caml_parser_env, 1); - var _2 = Parsing.peek_val(__caml_parser_env, 0); - return function (c) { - return Pervasives.$at(Curry._1(_1, c), Curry._1(_2, c)); - }; - }, - function () { - return function () { - return /* tuple */[ - 0, - /* [] */0 - ]; - }; - }, - function (__caml_parser_env) { - var _1 = Parsing.peek_val(__caml_parser_env, 1); - var _2 = Parsing.peek_val(__caml_parser_env, 0); - return function (c) { - var es1 = Curry._1(_1, c); - var match = Curry._1(_2, c); - return /* tuple */[ - match[0] + 1 | 0, - Pervasives.$at(es1, match[1]) - ]; - }; - }, - function (__caml_parser_env) { - var _1 = Parsing.peek_val(__caml_parser_env, 0); - var at$1 = at(/* () */0); - return function (c) { - return Source.$at$at(Curry._1(_1, c), at$1); - }; - }, - function (__caml_parser_env) { - return Parsing.peek_val(__caml_parser_env, 0); - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 2); - var _5 = Parsing.peek_val(__caml_parser_env, 0); - var match = _5[0]; - return /* tuple */[ - /* FuncType */[ - match[0], - Pervasives.$at(_3, match[1]) - ], - function (c) { - return Curry._1(_5[1], c); - } - ]; - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 2); - var _5 = Parsing.peek_val(__caml_parser_env, 0); - var match = _5[0]; - return /* tuple */[ - /* FuncType */[ - Pervasives.$at(_3, match[0]), - match[1] - ], - function (c) { - anon_locals(c, _3); - return Curry._1(_5[1], c); - } - ]; - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 3); - var _4 = Parsing.peek_val(__caml_parser_env, 2); - var _6 = Parsing.peek_val(__caml_parser_env, 0); - var match = _6[0]; - return /* tuple */[ - /* FuncType */[ - /* :: */[ - _4, - match[0] - ], - match[1] - ], - function (c) { - bind_local(c, _3); - return Curry._1(_6[1], c); - } - ]; - }, - function (__caml_parser_env) { - var _1 = Parsing.peek_val(__caml_parser_env, 0); - return /* tuple */[ - empty_type, - function (c) { - var c$prime = anon_label(c); - return /* record */[ - /* ftype */Source.$at$at(-1, at(/* () */0)), - /* locals : [] */0, - /* body */Curry._1(_1, c$prime) - ]; - } - ]; - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 2); - var _5 = Parsing.peek_val(__caml_parser_env, 0); - return /* tuple */[ - _5[0], - function (c) { - anon_locals(c, _3); - var f = Curry._1(_5[1], c); - return /* record */[ - /* ftype */f[/* ftype */0], - /* locals */Pervasives.$at(_3, f[/* locals */1]), - /* body */f[/* body */2] - ]; - } - ]; - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 3); - var _4 = Parsing.peek_val(__caml_parser_env, 2); - var _6 = Parsing.peek_val(__caml_parser_env, 0); - return /* tuple */[ - _6[0], - function (c) { - bind_local(c, _3); - var f = Curry._1(_6[1], c); - return /* record */[ - /* ftype */f[/* ftype */0], - /* locals : :: */[ - _4, - f[/* locals */1] - ], - /* body */f[/* body */2] - ]; - } - ]; - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 4); - var _4 = Parsing.peek_val(__caml_parser_env, 3); - var _5 = Parsing.peek_val(__caml_parser_env, 2); - var _6 = Parsing.peek_val(__caml_parser_env, 1); - var at$1 = at(/* () */0); - return function (c) { - Curry._3(_3, c, anon_func, bind_func); - var t = explicit_sig(c, _5, _6[0], at$1); - return /* tuple */[ - function () { - var init = Curry._1(_6[1], enter_func(c)); - return Source.$at$at(/* record */[ - /* ftype */t, - /* locals */init[/* locals */1], - /* body */init[/* body */2] - ], at$1); - }, - Curry._3(_4, /* FuncExport */0, c[/* funcs */3][/* count */1], c) - ]; - }; - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 3); - var _4 = Parsing.peek_val(__caml_parser_env, 2); - var _5 = Parsing.peek_val(__caml_parser_env, 1); - var at$1 = at(/* () */0); - return function (c) { - Curry._3(_3, c, anon_func, bind_func); - var t = explicit_sig(c, _4, _5[0], at$1); - return /* tuple */[ - function () { - var init = Curry._1(_5[1], enter_func(c)); - return Source.$at$at(/* record */[ - /* ftype */t, - /* locals */init[/* locals */1], - /* body */init[/* body */2] - ], at$1); - }, - /* [] */0 - ]; - }; - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 3); - var _4 = Parsing.peek_val(__caml_parser_env, 2); - var _5 = Parsing.peek_val(__caml_parser_env, 1); - var at$1 = at(/* () */0); - return function (c) { - Curry._3(_3, c, anon_func, bind_func); - var t = inline_type(c, _5[0], at$1); - return /* tuple */[ - function () { - var init = Curry._1(_5[1], enter_func(c)); - return Source.$at$at(/* record */[ - /* ftype */t, - /* locals */init[/* locals */1], - /* body */init[/* body */2] - ], at$1); - }, - Curry._3(_4, /* FuncExport */0, c[/* funcs */3][/* count */1], c) - ]; - }; - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 2); - var _4 = Parsing.peek_val(__caml_parser_env, 1); - var at$1 = at(/* () */0); - return function (c) { - Curry._3(_3, c, anon_func, bind_func); - var t = inline_type(c, _4[0], at$1); - return /* tuple */[ - function () { - var init = Curry._1(_4[1], enter_func(c)); - return Source.$at$at(/* record */[ - /* ftype */t, - /* locals */init[/* locals */1], - /* body */init[/* body */2] - ], at$1); - }, - /* [] */0 - ]; - }; - }, - function (__caml_parser_env) { - return Parsing.peek_val(__caml_parser_env, 1); - }, - function (__caml_parser_env) { - var _1 = Parsing.peek_val(__caml_parser_env, 0); - var at$1 = at(/* () */0); - return function (c) { - return Source.$at$at(Curry._1(_1, c), at$1); - }; - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 3); - var _4 = Parsing.peek_val(__caml_parser_env, 2); - var _5 = Parsing.peek_val(__caml_parser_env, 1); - var at$1 = at(/* () */0); - return function (c) { - return Source.$at$at(/* record */[ - /* index */Curry._2(_3, c, table), - /* offset */Curry._1(_4, c), - /* init */Curry._2(_5, c, func) - ], at$1); - }; - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 2); - var _4 = Parsing.peek_val(__caml_parser_env, 1); - var at$1 = at(/* () */0); - return function (c) { - return Source.$at$at(/* record */[ - /* index */Source.$at$at(0, at$1), - /* offset */Curry._1(_3, c), - /* init */Curry._2(_4, c, func) - ], at$1); - }; - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 3); - var _4 = Parsing.peek_val(__caml_parser_env, 2); - var _5 = Parsing.peek_val(__caml_parser_env, 1); - var at$1 = at(/* () */0); - return function (c) { - Curry._3(_3, c, anon_table, bind_table); - return function () { - return /* tuple */[ - Source.$at$at(/* record */[/* ttype */_5], at$1), - /* [] */0, - Curry._3(_4, /* TableExport */1, c[/* tables */1][/* count */1], c) - ]; - }; - }; - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 7); - var _4 = Parsing.peek_val(__caml_parser_env, 6); - var _5 = Parsing.peek_val(__caml_parser_env, 5); - var _8 = Parsing.peek_val(__caml_parser_env, 2); - var at$1 = at(/* () */0); - return function (c) { - var i = c[/* tables */1][/* count */1]; - Curry._3(_3, c, anon_table, bind_table); - return function () { - var init = Curry._2(_8, c, func); - var size = List.length(init); - return /* tuple */[ - Source.$at$at(/* record */[/* ttype : TableType */[ - /* record */[ - /* min */size, - /* max : Some */[size] - ], - _5 - ]], at$1), - /* :: */[ - Source.$at$at(/* record */[ - /* index */Source.$at$at(i, at$1), - /* offset */Source.$at$at(/* :: */[ - Source.$at$at(Operators.i32_const(Source.$at$at(0, at$1)), at$1), - /* [] */0 - ], at$1), - /* init */init - ], at$1), - /* [] */0 - ], - Curry._3(_4, /* TableExport */1, c[/* tables */1][/* count */1], c) - ]; - }; - }; - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 3); - var _4 = Parsing.peek_val(__caml_parser_env, 2); - var _5 = Parsing.peek_val(__caml_parser_env, 1); - var at$1 = at(/* () */0); - return function (c) { - return Source.$at$at(/* record */[ - /* index */Curry._2(_3, c, memory), - /* offset */Curry._1(_4, c), - /* init */_5 - ], at$1); - }; - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 2); - var _4 = Parsing.peek_val(__caml_parser_env, 1); - var at$1 = at(/* () */0); - return function (c) { - return Source.$at$at(/* record */[ - /* index */Source.$at$at(0, at$1), - /* offset */Curry._1(_3, c), - /* init */_4 - ], at$1); - }; - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 3); - var _4 = Parsing.peek_val(__caml_parser_env, 2); - var _5 = Parsing.peek_val(__caml_parser_env, 1); - var at$1 = at(/* () */0); - return function (c) { - Curry._3(_3, c, anon_memory, bind_memory); - return /* tuple */[ - Source.$at$at(/* record */[/* mtype */_5], at$1), - /* [] */0, - Curry._3(_4, /* MemoryExport */2, c[/* memories */2][/* count */1], c) - ]; - }; - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 6); - var _4 = Parsing.peek_val(__caml_parser_env, 5); - var _7 = Parsing.peek_val(__caml_parser_env, 2); - var at$1 = at(/* () */0); - return function (c) { - var i = c[/* memories */2][/* count */1]; - Curry._3(_3, c, anon_memory, bind_memory); - var size = (_7.length + 65535 | 0) / 65536 | 0; - return /* tuple */[ - Source.$at$at(/* record */[/* mtype : MemoryType */[/* record */[ - /* min */size, - /* max : Some */[size] - ]]], at$1), - /* :: */[ - Source.$at$at(/* record */[ - /* index */Source.$at$at(i, at$1), - /* offset */Source.$at$at(/* :: */[ - Source.$at$at(Operators.i32_const(Source.$at$at(0, at$1)), at$1), - /* [] */0 - ], at$1), - /* init */_7 - ], at$1), - /* [] */0 - ], - Curry._3(_4, /* MemoryExport */2, c[/* memories */2][/* count */1], c) - ]; - }; - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 5); - var _6 = Parsing.peek_val(__caml_parser_env, 2); - var at$1 = at(/* () */0); - return function (c) { - var i = c[/* memories */2][/* count */1]; - Curry._3(_3, c, anon_memory, bind_memory); - var size = (_6.length + 65535 | 0) / 65536 | 0; - return /* tuple */[ - Source.$at$at(/* record */[/* mtype : MemoryType */[/* record */[ - /* min */size, - /* max : Some */[size] - ]]], at$1), - /* :: */[ - Source.$at$at(/* record */[ - /* index */Source.$at$at(i, at$1), - /* offset */Source.$at$at(/* :: */[ - Source.$at$at(Operators.i32_const(Source.$at$at(0, at$1)), at$1), - /* [] */0 - ], at$1), - /* init */_6 - ], at$1), - /* [] */0 - ], - /* [] */0 - ]; - }; - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 4); - var _4 = Parsing.peek_val(__caml_parser_env, 3); - var _5 = Parsing.peek_val(__caml_parser_env, 2); - var _6 = Parsing.peek_val(__caml_parser_env, 1); - var at$1 = at(/* () */0); - return function (c) { - Curry._3(_3, c, anon_global, bind_global); - return /* tuple */[ - function () { - return Source.$at$at(/* record */[ - /* gtype */_5, - /* value */Curry._1(_6, c) - ], at$1); - }, - Curry._3(_4, /* GlobalExport */3, c[/* globals */5][/* count */1], c) - ]; - }; - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 3); - var _4 = Parsing.peek_val(__caml_parser_env, 2); - var _5 = Parsing.peek_val(__caml_parser_env, 1); - var at$1 = at(/* () */0); - return function (c) { - Curry._3(_3, c, anon_global, bind_global); - return /* tuple */[ - function () { - return Source.$at$at(/* record */[ - /* gtype */_4, - /* value */Curry._1(_5, c) - ], at$1); - }, - /* [] */0 - ]; - }; - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 2); - var _4 = Parsing.peek_val(__caml_parser_env, 1); - return function (c) { - Curry._3(_3, c, anon_func, bind_func); - return /* FuncImport */Block.__(0, [Curry._2(_4, c, type_)]); - }; - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 2); - var _4 = Parsing.peek_val(__caml_parser_env, 1); - var at4 = ati(4); - return function (c) { - Curry._3(_3, c, anon_func, bind_func); - return /* FuncImport */Block.__(0, [inline_type(c, _4, at4)]); - }; - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 2); - var _4 = Parsing.peek_val(__caml_parser_env, 1); - return function (c) { - Curry._3(_3, c, anon_table, bind_table); - return /* TableImport */Block.__(1, [_4]); - }; - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 2); - var _4 = Parsing.peek_val(__caml_parser_env, 1); - return function (c) { - Curry._3(_3, c, anon_memory, bind_memory); - return /* MemoryImport */Block.__(2, [_4]); - }; - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 2); - var _4 = Parsing.peek_val(__caml_parser_env, 1); - return function (c) { - Curry._3(_3, c, anon_global, bind_global); - return /* GlobalImport */Block.__(3, [_4]); - }; - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 3); - var _4 = Parsing.peek_val(__caml_parser_env, 2); - var _5 = Parsing.peek_val(__caml_parser_env, 1); - var at$1 = at(/* () */0); - var at5 = ati(5); - return function (c) { - return Source.$at$at(/* record */[ - /* module_name */_3, - /* item_name */_4, - /* ikind */Source.$at$at(Curry._1(_5, c), at5) - ], at$1); - }; - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 3); - var _4 = Parsing.peek_val(__caml_parser_env, 2); - var _5 = Parsing.peek_val(__caml_parser_env, 1); - var at$1 = at(/* () */0); - return function (c) { - Curry._3(_3, c, anon_func, bind_func); - return Source.$at$at(/* record */[ - /* module_name */_4[0], - /* item_name */_4[1], - /* ikind */Source.$at$at(/* FuncImport */Block.__(0, [Curry._2(_5, c, type_)]), at$1) - ], at$1); - }; - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 3); - var _4 = Parsing.peek_val(__caml_parser_env, 2); - var _5 = Parsing.peek_val(__caml_parser_env, 1); - var at$1 = at(/* () */0); - var at5 = ati(5); - return function (c) { - Curry._3(_3, c, anon_func, bind_func); - return Source.$at$at(/* record */[ - /* module_name */_4[0], - /* item_name */_4[1], - /* ikind */Source.$at$at(/* FuncImport */Block.__(0, [inline_type(c, _5, at5)]), at$1) - ], at$1); - }; - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 3); - var _4 = Parsing.peek_val(__caml_parser_env, 2); - var _5 = Parsing.peek_val(__caml_parser_env, 1); - var at$1 = at(/* () */0); - return function (c) { - Curry._3(_3, c, anon_table, bind_table); - return Source.$at$at(/* record */[ - /* module_name */_4[0], - /* item_name */_4[1], - /* ikind */Source.$at$at(/* TableImport */Block.__(1, [_5]), at$1) - ], at$1); - }; - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 3); - var _4 = Parsing.peek_val(__caml_parser_env, 2); - var _5 = Parsing.peek_val(__caml_parser_env, 1); - var at$1 = at(/* () */0); - return function (c) { - Curry._3(_3, c, anon_memory, bind_memory); - return Source.$at$at(/* record */[ - /* module_name */_4[0], - /* item_name */_4[1], - /* ikind */Source.$at$at(/* MemoryImport */Block.__(2, [_5]), at$1) - ], at$1); - }; - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 3); - var _4 = Parsing.peek_val(__caml_parser_env, 2); - var _5 = Parsing.peek_val(__caml_parser_env, 1); - var at$1 = at(/* () */0); - return function (c) { - Curry._3(_3, c, anon_global, bind_global); - return Source.$at$at(/* record */[ - /* module_name */_4[0], - /* item_name */_4[1], - /* ikind */Source.$at$at(/* GlobalImport */Block.__(3, [_5]), at$1) - ], at$1); - }; - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 2); - var _4 = Parsing.peek_val(__caml_parser_env, 1); - return /* tuple */[ - _3, - _4 - ]; - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 1); - return function (c) { - return /* tuple */[ - /* FuncExport */0, - Curry._2(_3, c, func) - ]; - }; - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 1); - return function (c) { - return /* tuple */[ - /* TableExport */1, - Curry._2(_3, c, table) - ]; - }; - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 1); - return function (c) { - return /* tuple */[ - /* MemoryExport */2, - Curry._2(_3, c, memory) - ]; - }; - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 1); - return function (c) { - return /* tuple */[ - /* GlobalExport */3, - Curry._2(_3, c, global) - ]; - }; - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 2); - var _4 = Parsing.peek_val(__caml_parser_env, 1); - var at$1 = at(/* () */0); - var at4 = ati(4); - return function (c) { - var match = Curry._1(_4, c); - return Source.$at$at(/* record */[ - /* name */_3, - /* ekind */Source.$at$at(match[0], at4), - /* item */match[1] - ], at$1); - }; - }, - function () { - return function (_, _$1, _$2) { - return /* [] */0; - }; - }, - function (__caml_parser_env) { - return Parsing.peek_val(__caml_parser_env, 0); - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 1); - var at$1 = at(/* () */0); - return function (k, count, _) { - return /* :: */[ - Source.$at$at(/* record */[ - /* name */_3, - /* ekind */Source.$at$at(k, at$1), - /* item */Source.$at$at(count - 1 | 0, at$1) - ], at$1), - /* [] */0 - ]; - }; - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 1); - return function (c) { - return anon_type(c, _3); - }; - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 2); - var _4 = Parsing.peek_val(__caml_parser_env, 1); - return function (c) { - var c$1 = c; - var x = _3; - var ty = _4; - if (Curry._2(VarMap[/* mem */2], x[/* it */1], c$1[/* types */0][/* tmap */0])) { - throw [ - Script.Syntax, - x[/* at */0], - "duplicate type " + x[/* it */1] - ]; - } - c$1[/* types */0][/* tmap */0] = Curry._3(VarMap[/* add */3], x[/* it */1], Curry._1(Lib.List32[/* length */0], c$1[/* types */0][/* tlist */1]), c$1[/* types */0][/* tmap */0]); - c$1[/* types */0][/* tlist */1] = Pervasives.$at(c$1[/* types */0][/* tlist */1], /* :: */[ - ty, - /* [] */0 - ]); - return /* () */0; - }; - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 1); - return function (c) { - return Curry._2(_3, c, func); - }; - }, - function () { - return function (c) { - var newrecord = Ast.empty_module.slice(); - newrecord[/* types */0] = c[/* types */0][/* tlist */1]; - return newrecord; - }; - }, - function (__caml_parser_env) { - var _1 = Parsing.peek_val(__caml_parser_env, 1); - var _2 = Parsing.peek_val(__caml_parser_env, 0); - return function (c) { - Curry._1(_1, c); - return Curry._1(_2, c); - }; - }, - function (__caml_parser_env) { - var _1 = Parsing.peek_val(__caml_parser_env, 1); - var _2 = Parsing.peek_val(__caml_parser_env, 0); - return function (c) { - var match = Curry._1(_1, c); - var m = Curry._1(_2, c); - if (m[/* imports */8] !== /* [] */0) { - var at = List.hd(m[/* imports */8])[/* at */0]; - throw [ - Script.Syntax, - at, - "import after global definition" - ]; - } - var newrecord = m.slice(); - newrecord[/* globals */1] = /* :: */[ - Curry._1(match[0], /* () */0), - m[/* globals */1] - ]; - newrecord[/* exports */9] = Pervasives.$at(match[1], m[/* exports */9]); - return newrecord; - }; - }, - function (__caml_parser_env) { - var _1 = Parsing.peek_val(__caml_parser_env, 1); - var _2 = Parsing.peek_val(__caml_parser_env, 0); - return function (c) { - var t = Curry._1(_1, c); - var m = Curry._1(_2, c); - var match = Curry._1(t, /* () */0); - if (m[/* imports */8] !== /* [] */0) { - var at = List.hd(m[/* imports */8])[/* at */0]; - throw [ - Script.Syntax, - at, - "import after table definition" - ]; - } - var newrecord = m.slice(); - newrecord[/* tables */2] = /* :: */[ - match[0], - m[/* tables */2] - ]; - newrecord[/* elems */6] = Pervasives.$at(match[1], m[/* elems */6]); - newrecord[/* exports */9] = Pervasives.$at(match[2], m[/* exports */9]); - return newrecord; - }; - }, - function (__caml_parser_env) { - var _1 = Parsing.peek_val(__caml_parser_env, 1); - var _2 = Parsing.peek_val(__caml_parser_env, 0); - return function (c) { - var match = Curry._1(_1, c); - var m = Curry._1(_2, c); - if (m[/* imports */8] !== /* [] */0) { - var at = List.hd(m[/* imports */8])[/* at */0]; - throw [ - Script.Syntax, - at, - "import after memory definition" - ]; - } - var newrecord = m.slice(); - newrecord[/* memories */3] = /* :: */[ - match[0], - m[/* memories */3] - ]; - newrecord[/* data */7] = Pervasives.$at(match[1], m[/* data */7]); - newrecord[/* exports */9] = Pervasives.$at(match[2], m[/* exports */9]); - return newrecord; - }; - }, - function (__caml_parser_env) { - var _1 = Parsing.peek_val(__caml_parser_env, 1); - var _2 = Parsing.peek_val(__caml_parser_env, 0); - return function (c) { - var match = Curry._1(_1, c); - var m = Curry._1(_2, c); - var func = Curry._1(match[0], /* () */0); - if (m[/* imports */8] !== /* [] */0) { - var at = List.hd(m[/* imports */8])[/* at */0]; - throw [ - Script.Syntax, - at, - "import after function definition" - ]; - } - var newrecord = m.slice(); - newrecord[/* funcs */4] = /* :: */[ - func, - m[/* funcs */4] - ]; - newrecord[/* exports */9] = Pervasives.$at(match[1], m[/* exports */9]); - return newrecord; - }; - }, - function (__caml_parser_env) { - var _1 = Parsing.peek_val(__caml_parser_env, 1); - var _2 = Parsing.peek_val(__caml_parser_env, 0); - return function (c) { - var m = Curry._1(_2, c); - var newrecord = m.slice(); - newrecord[/* elems */6] = /* :: */[ - Curry._1(_1, c), - m[/* elems */6] - ]; - return newrecord; - }; - }, - function (__caml_parser_env) { - var _1 = Parsing.peek_val(__caml_parser_env, 1); - var _2 = Parsing.peek_val(__caml_parser_env, 0); - return function (c) { - var m = Curry._1(_2, c); - var newrecord = m.slice(); - newrecord[/* data */7] = /* :: */[ - Curry._1(_1, c), - m[/* data */7] - ]; - return newrecord; - }; - }, - function (__caml_parser_env) { - var _1 = Parsing.peek_val(__caml_parser_env, 1); - var _2 = Parsing.peek_val(__caml_parser_env, 0); - return function (c) { - var m = Curry._1(_2, c); - var x = Curry._1(_1, c); - var match = m[/* start */5]; - if (match) { - throw [ - Script.Syntax, - x[/* at */0], - "multiple start sections" - ]; - } - else { - var newrecord = m.slice(); - newrecord[/* start */5] = /* Some */[x]; - return newrecord; - } - }; - }, - function (__caml_parser_env) { - var _1 = Parsing.peek_val(__caml_parser_env, 1); - var _2 = Parsing.peek_val(__caml_parser_env, 0); - return function (c) { - var i = Curry._1(_1, c); - var m = Curry._1(_2, c); - var newrecord = m.slice(); - newrecord[/* imports */8] = /* :: */[ - i, - m[/* imports */8] - ]; - return newrecord; - }; - }, - function (__caml_parser_env) { - var _1 = Parsing.peek_val(__caml_parser_env, 1); - var _2 = Parsing.peek_val(__caml_parser_env, 0); - return function (c) { - var m = Curry._1(_2, c); - var newrecord = m.slice(); - newrecord[/* exports */9] = /* :: */[ - Curry._1(_1, c), - m[/* exports */9] - ]; - return newrecord; - }; - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 2); - var _4 = Parsing.peek_val(__caml_parser_env, 1); - return /* tuple */[ - _3, - Source.$at$at(/* Textual */Block.__(0, [Source.$at$at(Curry._1(_4, empty_context(/* () */0)), at(/* () */0))]), at(/* () */0)) - ]; - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 3); - var _4 = Parsing.peek_val(__caml_parser_env, 2); - var _5 = Parsing.peek_val(__caml_parser_env, 1); - return /* tuple */[ - _3, - Source.$at$at(/* Encoded */Block.__(1, [ - "binary", - _4 + _5 - ]), at(/* () */0)) - ]; - }, - function () { - return /* None */0; - }, - function (__caml_parser_env) { - var _1 = Parsing.peek_val(__caml_parser_env, 0); - return /* Some */[Source.$at$at(_1, at(/* () */0))]; - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 3); - var _4 = Parsing.peek_val(__caml_parser_env, 2); - var _5 = Parsing.peek_val(__caml_parser_env, 1); - return Source.$at$at(/* Invoke */Block.__(0, [ - _3, - _4, - _5 - ]), at(/* () */0)); - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 2); - var _4 = Parsing.peek_val(__caml_parser_env, 1); - return Source.$at$at(/* Get */Block.__(1, [ - _3, - _4 - ]), at(/* () */0)); - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 2); - var _4 = Parsing.peek_val(__caml_parser_env, 1); - return Source.$at$at(/* AssertMalformed */Block.__(0, [ - _3[1], - _4 - ]), at(/* () */0)); - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 2); - var _4 = Parsing.peek_val(__caml_parser_env, 1); - return Source.$at$at(/* AssertInvalid */Block.__(1, [ - _3[1], - _4 - ]), at(/* () */0)); - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 2); - var _4 = Parsing.peek_val(__caml_parser_env, 1); - return Source.$at$at(/* AssertSoftInvalid */Block.__(2, [ - _3[1], - _4 - ]), at(/* () */0)); - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 2); - var _4 = Parsing.peek_val(__caml_parser_env, 1); - return Source.$at$at(/* AssertUnlinkable */Block.__(3, [ - _3[1], - _4 - ]), at(/* () */0)); - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 2); - var _4 = Parsing.peek_val(__caml_parser_env, 1); - return Source.$at$at(/* AssertUninstantiable */Block.__(4, [ - _3[1], - _4 - ]), at(/* () */0)); - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 2); - var _4 = Parsing.peek_val(__caml_parser_env, 1); - return Source.$at$at(/* AssertReturn */Block.__(5, [ - _3, - _4 - ]), at(/* () */0)); - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 1); - return Source.$at$at(/* AssertReturnNaN */Block.__(6, [_3]), at(/* () */0)); - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 2); - var _4 = Parsing.peek_val(__caml_parser_env, 1); - return Source.$at$at(/* AssertTrap */Block.__(7, [ - _3, - _4 - ]), at(/* () */0)); - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 2); - var _4 = Parsing.peek_val(__caml_parser_env, 1); - return Source.$at$at(/* AssertExhaustion */Block.__(8, [ - _3, - _4 - ]), at(/* () */0)); - }, - function (__caml_parser_env) { - var _1 = Parsing.peek_val(__caml_parser_env, 0); - return Source.$at$at(/* Action */Block.__(2, [_1]), at(/* () */0)); - }, - function (__caml_parser_env) { - var _1 = Parsing.peek_val(__caml_parser_env, 0); - return Source.$at$at(/* Assertion */Block.__(3, [_1]), at(/* () */0)); - }, - function (__caml_parser_env) { - var _1 = Parsing.peek_val(__caml_parser_env, 0); - return Source.$at$at(/* Module */Block.__(0, [ - _1[0], - _1[1] - ]), at(/* () */0)); - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 2); - var _4 = Parsing.peek_val(__caml_parser_env, 1); - return Source.$at$at(/* Register */Block.__(1, [ - _3, - _4 - ]), at(/* () */0)); - }, - function (__caml_parser_env) { - var _1 = Parsing.peek_val(__caml_parser_env, 0); - return Source.$at$at(/* Meta */Block.__(4, [_1]), at(/* () */0)); - }, - function () { - return /* [] */0; - }, - function (__caml_parser_env) { - var _1 = Parsing.peek_val(__caml_parser_env, 1); - var _2 = Parsing.peek_val(__caml_parser_env, 0); - return /* :: */[ - _1, - _2 - ]; - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 2); - var _4 = Parsing.peek_val(__caml_parser_env, 1); - return Source.$at$at(/* Script */Block.__(2, [ - _3, - _4 - ]), at(/* () */0)); - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 2); - var _4 = Parsing.peek_val(__caml_parser_env, 1); - return Source.$at$at(/* Input */Block.__(0, [ - _3, - _4 - ]), at(/* () */0)); - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 2); - var _4 = Parsing.peek_val(__caml_parser_env, 1); - return Source.$at$at(/* Output */Block.__(1, [ - _3, - /* Some */[_4] - ]), at(/* () */0)); - }, - function (__caml_parser_env) { - var _3 = Parsing.peek_val(__caml_parser_env, 1); - return Source.$at$at(/* Output */Block.__(1, [ - _3, - /* None */0 - ]), at(/* () */0)); - }, - function (__caml_parser_env) { - var _2 = Parsing.peek_val(__caml_parser_env, 2); - var _3 = Parsing.peek_val(__caml_parser_env, 1); - return Source.$at$at(literal(_2, _3)[1], ati(3)); - }, - function () { - return /* [] */0; - }, - function (__caml_parser_env) { - var _1 = Parsing.peek_val(__caml_parser_env, 1); - var _2 = Parsing.peek_val(__caml_parser_env, 0); - return /* :: */[ - _1, - _2 - ]; - }, - function (__caml_parser_env) { - return Parsing.peek_val(__caml_parser_env, 1); - }, - function (__caml_parser_env) { - var _1 = Parsing.peek_val(__caml_parser_env, 0); - return /* :: */[ - _1, - /* [] */0 - ]; - }, - function (__caml_parser_env) { - return Parsing.peek_val(__caml_parser_env, 1)[1]; - }, - function (__caml_parser_env) { - throw [ - Parsing.YYexit, - Parsing.peek_val(__caml_parser_env, 0) - ]; - }, - function (__caml_parser_env) { - throw [ - Parsing.YYexit, - Parsing.peek_val(__caml_parser_env, 0) - ]; - }, - function (__caml_parser_env) { - throw [ - Parsing.YYexit, - Parsing.peek_val(__caml_parser_env, 0) - ]; - } -]; - -var yytables = /* record */[ - /* actions */yyact, - /* transl_const */yytransl_const, - /* transl_block */yytransl_block, - /* lhs */'\xff\xff\x04\0\x04\0\x05\0\x05\0\x06\0\x07\0\x07\0\b\0\t\0\t\0\t\0\t\0\x0b\0\r\0\f\0\f\0\x0e\0\x10\0\x10\0\x10\0\x0f\0\x0f\0\x11\0\x11\0\x12\0\x12\0\n\0\x13\0\x13\0\x14\0\x14\0\x15\0\x15\0\x16\0\x16\0\x17\0\x17\0\x17\0\x18\0\x18\0\x18\0\x18\0\x18\0\x18\0\x18\0\x18\0\x18\0\x18\0\x18\0\x18\0\x18\0\x18\0\x18\0\x18\0\x18\0\x18\0\x18\0\x18\0\x18\0\x18\0\x18\0\x18\0\x18\0\x19\0\x19\0\x19\0\x19\0\x1b\0\x1a\0\x1d\0\x1d\0\x1d\0\x1d\0\x1f\0\x1f\0\x1f\0\x1f\0\x1f\0\x1f\0\x1c\0\x1c\0\x1e\0\x1e\0 \0!\0!\0!\0!\0"\0"\0"\0#\0#\0#\0#\0%\0%\0&\0&\0\'\0\'\0)\0)\0*\0*\0*\0+\0+\0,\0,\0,\0,\0,\0-\0-\0-\0-\0-\0-\0.\0/\0/\0/\0/\x000\0(\0(\0$\x001\x001\x002\x003\x003\x003\x003\x003\x003\x003\x003\x003\x003\x003\x004\x004\x005\x005\x006\x006\x008\x008\x008\x008\x008\x008\x008\x008\x008\x009\x009\x009\x009\x009\0;\0;\0:\0:\0:\0:\0<\x007\x007\0\x01\0\x02\0\x03\0\0\0\0\0\0\0', - /* len */"\x02\0\0\0\x02\0\0\0\x02\0\x01\0\x01\0\x04\0\x04\0\0\0\x05\0\x05\0\x06\0\x02\0\x01\0\x01\0\x02\0\x04\0\x01\0\x01\0\x01\0\x01\0\x01\0\0\0\x02\0\0\0\x01\0\x01\0\0\0\x01\0\0\0\x01\0\0\0\x01\0\0\0\x01\0\x01\0\x01\0\x01\0\x01\0\x01\0\x02\0\x02\0\x03\0\x01\0\x02\0\x02\0\x01\0\x01\0\x02\0\x02\0\x02\0\x02\0\x02\0\x03\0\x03\0\x01\0\x01\0\x02\0\x01\0\x01\0\x01\0\x01\0\x01\0\x05\0\x05\0\x05\0\b\0\x02\0\x03\0\x02\0\x03\0\x03\0\x04\0\b\0\x04\0\t\0\x05\0\x03\0\x02\0\0\0\x02\0\0\0\x02\0\x01\0\x01\0\x05\0\x05\0\x06\0\x01\0\x05\0\x06\0\x07\0\x06\0\x06\0\x05\0\x04\0\x01\0\x06\0\x05\0\x06\0\n\0\x06\0\x05\0\x06\0\t\0\b\0\x07\0\x06\0\x05\0\x05\0\x05\0\x05\0\x05\0\x06\0\x06\0\x06\0\x06\0\x06\0\x06\0\x05\0\x04\0\x04\0\x04\0\x04\0\x05\0\0\0\x01\0\x04\0\x04\0\x05\0\x04\0\0\0\x02\0\x02\0\x02\0\x02\0\x02\0\x02\0\x02\0\x02\0\x02\0\x02\0\x05\0\x06\0\0\0\x01\0\x06\0\x05\0\x05\0\x05\0\x05\0\x05\0\x05\0\x05\0\x04\0\x05\0\x05\0\x01\0\x01\0\x01\0\x05\0\x01\0\0\0\x02\0\x05\0\x05\0\x05\0\x04\0\x04\0\0\0\x02\0\x02\0\x01\0\x02\0\x02\0\x02\0\x02\0", - /* defred */"\0\0\0\0\0\0\0\0\0\0\0\0\xaf\0\xa0\0\x9e\0\x9f\0\0\0\xa2\0\0\0\xb0\0\xad\0\0\0\xb1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\xa4\0\xac\0\xae\0\x92\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x01\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x9b\0\0\0\0\0\0\0\0\0\0\0\xa8\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x89\0\x8a\0\x87\0\x8b\0\x88\0\x86\0\x8d\0\x8e\0\x85\0\x8c\0\x8f\0\xa5\0\xa1\0\0\0\x94\0\x95\0\x96\0\x97\0\x98\0\0\0\x9a\0\xab\0\x99\0\x9c\0\x9d\0\xa6\0\xa7\0\x02\0\x90\0\x1b\0\x1a\0\0\0\x15\0\x16\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0a\0\0\0\0\0\0\0\x01\0\0\0\0\0\x93\0\x12\0\x13\0\x14\0\0\0\0\0(\0/\0\0\0\0\x000\0\0\0\0\0\0\0\0\0\0\0\0\0,\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0=\0>\0<\0?\0'\x008\x009\0;\0\0\0\0\0$\0%\0&\0Y\0\0\0U\0\0\0\0\0\x83\0\0\0\x81\0\0\0\x06\0\0\0\0\0\0\0\0\0\0\0\x7f\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x01\0\0\0\0\0\0\0\0\0\xa9\0\0\0\0\0\0\0\0\0\0\0\0\0\x1d\0\0\0\0\0\0\0)\0*\0\0\0-\0.\x001\x002\x003\x004\x005\0!\0\0\0\0\0:\0\0\0\0\0\0\0Q\0_\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x82\0\0\0T\0\0\0\0\0\0\0\0\0\0\0\x05\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0F\0E\0\0\0\x18\0c\0\x01\0\0\0\x0e\0\0\0\0\0\0\0g\0\0\0\0\0\0\0\0\0\0\0\0\0}\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0+\0#\x006\x007\0]\0\0\0^\0\0\0\0\0t\0s\0\b\0\0\0l\0\0\0w\0\x10\0\0\0d\0\r\0u\0G\0\0\0H\0`\0S\0b\0\0\0\x01\0h\0v\0f\0\0\0\0\0\0\0\0\0r\0\0\0\0\0\0\0\0\0\x11\0\x04\0\0\0\0\0\0\0\0\0\0\0\0\0\x80\0D\0\0\0\0\0\0\0\0\0\\\0\0\0\0\0\0\0\x07\0k\0\0\0\0\0\0\0I\0\0\0\0\0\0\0\0\0\0\0\0\0y\0|\0z\0{\0W\0\0\0\0\0V\0Z\0\0\0x\0\x1f\0@\0B\0\0\0A\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0j\0\0\0\0\0\0\0\0\0\0\0\0\0X\0[\0\0\0\x0b\0\0\0\n\0\0\0\0\0\0\0N\0i\0n\0m\0q\0o\0p\0\0\0\f\0e\0\0\0\0\0C\0\0\0\0\0\0\0\0\0\0\0\0\0J\0\0\0L\0", - /* dgoto */'\x04\0\x06\0\r\0\x10\0V\x001\x01\f\x01\xc4\0\x85\0\xff\0\x7f\0\r\x01\x0e\x01\x1d\x01\xb4\0\xd2\0\x96\0\xd3\0\x80\0\xe5\0\x88\x01\xf3\x007\x01\xb5\0\xb6\0\xb7\0\xb8\x002\x01\xb9\0\xd0\0\x15\x01u\x01\x06\x01\xba\0\xbb\x009\0\xbc\0\x8c\0:\0;\0\xc9\0<\0=\0>\0"\x01?\0\xbd\0\xdc\0@\0A\0B\0C\0\x07\0%\0\b\0M\0\t\0\n\0\x0b\0\f\0N\0', - /* sindex */'\xd4\0\x17\xff\x17\xff.\xff\0\0a\xff\0\0\0\0\0\0\0\0\x17\xff\0\0@\0\0\0\0\0"\xff\0\0l\0i\xffi\xffw\xffi\xffi\xff.\xff.\xff.\xff.\xffp\xffp\xff~\xffp\xffi\xffi\xff\0\0\0\0\0\0\0\0\xab\xff\x17\xffi\xff\x92\xff\xac\xff\xc9\xff\xd9\xff\xf6\xff\xf9\xff\f\xff\xa1\xff\xaf\xff\xfc\xfe\xfb\xff\xfe\xff\x15\0\x1c\x001\xff\0\0\x17\0\x1d\0\x1d\0\x1d\0\x1d\0\x1d\0\x1d\0\x1d\0\x1d\0\x1d\0\x1d\0\xb1\xff\xb6\xff\x11\0\xa1\xff-\x007\0=\0?\0D\0/\0J\0\xa1\xff\0\0K\0S\0d\0e\0n\0\0\0[\xffR\0\xb7\xff\xc6\xffR\0R\0\x8f\xffR\0\x8f\xffv\0w\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0y\0\0\0\0\0\0\0\0\0\0\0\x0b\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x16\x02\0\0\0\0z\0V\0\x8a\0\x95\0\xe9\xff\x97\0W\x03\x98\0\0\0\xb7\xff\x99\0\x98\0\0\0\x9b\0\xa1\0\0\0\0\0\0\0\0\0\xbb\0\xd4\x02\0\0\0\0R\0R\0\0\0R\0\xb7\xff\xb7\xff\xb7\xff\xb7\xff\xb7\xff\0\0\xb7\xff\xb7\xff\xb7\xff\xb7\xff\xb7\xff\xa5\0\xa5\0\x0b\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0<\x02b\x02\0\0\0\0\0\0\0\0\xbd\0\0\0\x88\x02\xbf\0\0\0\xc7\0\0\0\xd7\0\0\0\r\xffb\x02\xed\xff\xed\xff\xcd\xff\0\0u\xff\xea\0R\0R\0R\0b\x02\xe3\0\xe4\0\xb7\xff\xb7\xff\xec\0\x98\xff\xfe\0\xea\0\xea\0\0\0\x7f\xff\b\x01\xfe\xfe\t\x01\0\0\xb7\xff\x12\0\xe7\0\x12\0\x0e\x01\x10\x01\0\0\xe7\0\xe7\0\xe7\0\0\0\0\0\xb7\xff\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\xfa\0\xfa\0\0\x001\x03#\x01\xef\x03\0\0\0\0\x0b\x03<\x02-\x01\xe7\xff.\x01/\x01\x99\xff0\x01\0\0<\x01\0\0I\x01U\x01b\x02T\x01^\x01\0\0W\x01o\x01[\x01y\x01\xe7\0\xe7\0\xe7\0z\x01\xe3\0\0\0\0\0{\x01\0\0\0\0\0\0P\x01\0\0\x82\x01\x84\x01\xa9\xff\0\0d\xff\x85\x01\xb7\xff\xb7\xff\xb7\xff\xb7\xff\0\0\x95\x01\xe7\0\x9f\x01b\x01\xa0\x01\xa1\x01\xa6\x01\xaa\x01\xab\x01b\x02\xb7\x01\xe6\xff\xc1\x01\0\0\0\0\0\0\0\0\0\0\xc6\x01\0\0\x12\0\xe7\0\0\0\0\0\0\0\xc7\x01\0\0\xc8\x01\0\0\0\0\x80\x01\0\0\0\0\0\0\0\0\xcf\x01\0\0\0\0\0\0\0\0\xad\xff\0\0\0\0\0\0\0\0R\0R\0R\0R\0\0\0\xd0\x01\xd1\x01\xe1\x01\xeb\x01\0\0\0\0<\x02\xec\x01\xae\x02\xae\x02\xed\x01\xee\x01\0\0\0\0R\0R\0R\0R\0\0\0\xf6\x01\xf4\x01\xf7\x01\0\0\0\0\xb7\xff}\x03\b\x02\0\0\x11\x02\xbb\xff\xbf\0\xed\xff\xea\0\xea\0\0\0\0\0\0\0\0\0\0\0<\x02\xa3\x03\0\0\0\0\xae\x02\0\0\0\0\0\0\0\0b\x02\0\0\xc7\0\x12\x02\xc7\0\x13\x02b\x02\xc9\x03\xe3\0\0\0\x14\x02\x1a\x02\x1c\x02\x1d\x02-\x027\x02\0\0\0\x004\x02\0\0\xc7\0\0\x009\x02:\x02b\x02\0\0\0\0\0\0\0\0\0\0\0\0\0\0R\0\0\0\0\0\x17\x02@\x02\0\x005\x02C\x02b\x02L\x02]\x02b\x02\0\0^\x02\0\0', - /* rindex */"\0\0M\x03\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x01\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0O\xff\x14\0\0\0w\0w\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0w\0\xc2\xff\0\0\0\0\0\0\0\0_\x02`\x02f\x02\0\0\0\0\0\0\0\0\0\0\0\0\0\0h\x02\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0_\x02_\x02_\x02_\x02_\x02_\x02_\x02_\x02_\x02_\x02\0\0\0\0\0\0h\x02\0\0\0\0\0\0\0\0\0\0\0\0\0\0h\x02\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0~\x01\0\0\0\0\xf2\xffh\xff\0\0)\xff\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0i\x02\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x83\xff\0\0\0\0\0\0y\x02k\x02\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0M\0\x16\0\0\0M\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x9a\0\x9a\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0i\x02t\xff\0\0\0\0\0\0\0\0\0\0\0\0i\x02\x83\x02\0\0\x83\x02\0\0\0\0\0\0\0\0i\x02\0\0\0\0\0\0\0\0\0\0\0\0s\0\xf3\xffs\0i\x02\x84\x02\0\0y\x02\xc0\0\0\0\0\0\x8e\x02\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x86\x02\x86\x02\x86\x02\0\0\0\0\0\0\xa4\x01X\x01\xa4\x01\0\0\0\0\xc0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\xe6\0\xe6\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0i\x02\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0i\x02\0\0\xf7\xff\0\0\0\0\0\0\0\0\0\0\xca\x01\x89\x02\xca\x01\0\0\x84\x02\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\f\x01\0\0\0\0\0\0\0\0\0\0\0\0\0\0t\xff\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x86\x02\x86\x02\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0<\0\xf2\xff\x95\x02\x95\x02\0\0\0\0\0\0\0\0\0\0\0\0\0\0i\x02\0\0i\x02i\x02\0\0\0\0\0\0\0\x002\x012\x01\xf0\x012\x01\0\0\0\0\0\0\0\0\0\0\0\0y\x02\0\0\0\0\0\0\0\0\0\0\x83\x02\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0i\x02\0\0\0\0\0\0i\x02\0\0\0\0\0\0\0\0\x8a\x02\0\0\x83\x02\0\0\x83\x02\0\0i\x02\0\0\xaf\xff\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x83\x02\0\0\0\0\0\0i\x02\0\0\0\0\0\0\0\0\0\0\0\0\0\x002\x01\0\0\0\0\x8f\x02\0\0\0\0\0\0\x9f\x02i\x02\0\0\0\0i\x02\0\0\0\0\0\0", - /* gindex */"\0\0\0\0\0\0\0\0x\xffD\xff\xa5\x02Q\xff.\x03F\xff\xa7\xffG\xffH\xff3\xffL\xff\xbc\xff\n\x03P\xff\xb2\xff\x80\xff\xbd\xfe\f\x03\xc4\x02\0\0\x82\xff\0\0\xa6\xffV\xffN\xff\0\0\xa8\x02\0\0B\xffR\xff\xca\xfe\0\0\xca\xff\xb5\xff\0\0\0\x002\x03\0\0\0\0\0\0\0\0\0\0\xe3\xff\0\0\0\0\0\0\0\0\xac\0t\0\x96\0\xbe\0\xf0\xff\0\0\xbc\x03\0\0!\0\0\0", - /* tablesize */1335, - /* table */'\x86\0\xa3\0\x8b\0\xf9\0\x8b\0\x02\x01\xf7\0\xd9\0\xfc\0\0\x01\x1e\x01\xcf\0\x87\0\x88\0\xfd\0\x8d\0\x13\x01\x0f\x01\x05\x01\x8f\0\x83\0\x04\x01\b\x01\t\x01\x8a\0\xcf\0\x8e\0\xe6\0\x05\x01\xe7\0\x1c\x01\x1c\x01\x05\0\x17\x01\x18\x01*\x01,\x01-\x01\x89\x01\x8a\x01\x8b\x01#\x01\x19\0!\0\x83\x01\x84\x01\x12\0$\x01\x8b\0%\x01\x19\0&\x01\x8b\0T\0n\0\x0f\0\x15\0\x16\x005\x01U\x003\x014\x01v\0\xd1\0"\0\xe4\0\xe4\0\xd8\0\xe4\0\xe2\0\xe3\0D\0\x15\0\x16\0C\x01\x10\x01\x11\x01\x12\x01:\x01\x9b\x01\x1f\x01\xc5\0\xc8\0\x91\0\x12\0K\x01\x05\x01\xd5\0\x91\0\x91\0\xe8\0\xe9\0\xea\0\xeb\0\xec\0|\0\xed\0\xee\0\xef\0\xf0\0\xf1\0}\0J\x01\xaf\x01L\x01\x19\0\xc6\0\xca\0#\0_\x01$\0\x19\0\xd7\0\x19\0\xe4\0\xe4\0\xe4\0\x14\x01\n\x01\x11\0\xcf\0.\0\xcf\0\'\0\x0b\x01\xcf\0P\0g\x01m\x01o\x01P\0|\0~\0P\0+\x011\0.\x01 \x01~\0*\0+\0,\0-\0U\x01\x81\x002\0P\x01\x12\0\x82\0V\x01F\0W\x01\x89\0X\x01(\x01\x13\0\x14\0\x15\0\x16\0\x17\0\x18\0\x19\0\x1a\0\x1b\0\x1c\0\x1d\0\x1e\0\x1f\0 \0&\0L\0(\0)\0|\0\x99\x017\0G\0|\0\x80\x01T\x018\x005\x006\0v\x01\x81\0O\0\x14\x01k\0\x82\0E\0\x95\x01|\0l\0\x98\x01\x8f\x01\x1c\x01\x96\x01\x94\x01\x91\0<\x01=\x01w\x01\x97\x01~\0\x91\0H\0\x1a\x01\x84\0\xe2\0\xe3\0\x9d\x01\x9a\x01\x9f\x01\x01\0\x02\0\x03\0\x9c\x01/\x000\x003\x004\0I\0\xa1\x01Z\x01[\x01\\\x01]\x01n\x01\xab\x01a\0b\0c\0d\0e\0f\0g\0h\0i\0j\0\xc2\0\xae\x01t\x01\xc3\0\xc2\0i\x01\xcf\0\x07\x01j\x01\x19\0\x1c\0J\0\x19\0\x1c\0K\0\x0f\0P\0\xb4\x01\x0f\0Q\0\xb7\x01\xcf\0\xe2\0\xe3\0x\x01y\x01z\x01{\x01\xa3\0\x93\0\x94\0\x95\0\x87\x01\x87\x01\x87\x01\x87\x01\xcf\0\xde\0<\x01=\x01~\0)\x01R\0\x92\x01m\0\x1c\0\x91\0\x91\0\x1c\0S\0\x1c\0\x1c\0\x1c\0\x1c\0\x1c\x008\0\x1c\0\x1c\0\x1c\0\x1c\0\x1c\0\x1c\0\x1c\0\x1c\0\x1c\0\x1c\0\x1c\0\x1c\0\x1c\0\x1c\0\x1c\0\x1c\0o\0\xa3\x01\x1c\0\x1c\0\x1c\0\x1c\0\x1c\0\x1c\0\x1c\0\x1c\0p\0W\0X\0Y\0\x19\0\x19\0q\0Z\0r\0[\0\\\0]\0^\0s\0_\0`\0\x87\x01t\0\x1c\0u\0w\0\x1c\0~\0\x1c\0\x1c\0\x1c\0\x1c\0\x1c\0x\0\x1c\0\x1c\0\x1c\0\x1c\0\x1c\0\x1c\0\x1c\0\x1c\0\x1c\0\x1c\0\x1c\0\x1c\0\x1c\0\x1c\0\x1c\0\x1c\0y\0z\0\x1c\0\x1c\0\x1c\0\x1c\0\x1c\0\x1c\0\x1c\0\x1c\0{\0\x1c\0\x90\0\x91\0\x1c\0\x1c\0\x1c\0\x1c\0\x1c\0\xbf\0\x1c\0\x92\0\xbe\0\x1c\0\x1c\0\x1c\0\x1c\0\x1c\0\x1c\0\x1c\0\x1c\0\x1c\0\x1c\0\x1c\0\x1c\0\x1c\0\x1c\0\x1c\0\xc0\0\x1c\0\x1c\0\x1c\0\x1c\0\x1c\0\x1c\0\x1c\0\x1c\0\x1c\0\x84\0\xda\0\xc7\0\x89\0\xd4\0 \0 \0 \0 \0 \0 \0 \0\xdb\0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0 \0\x1c\0 \0 \0 \0 \0 \0 \0 \0 \0 \0\xdd\0\xf2\0\xfa\0\xfe\0\x17\0\x17\0\x17\0\x17\0\x17\0\x17\0\x17\0\x01\x01\x17\0\x17\0\x17\0\x17\0\x17\0\x17\0\x17\0\x17\0\x17\0\x17\0\x17\0\x17\0\x17\0\x17\0\x17\0\x17\0\x03\x01 \0\x17\0\x17\0\x17\0\x17\0\x17\0\x17\0\x17\0\x17\0\n\x01\xf8\0)\x01\x16\x01"\0"\0"\0"\0"\0"\0"\0\x19\x01"\0"\0"\0"\0"\0"\0"\0"\0"\0"\0"\0"\0"\0"\0"\0"\0\x1b\x01\x17\0"\0"\0"\0"\0"\0"\0"\0"\0!\x01/\x01\'\x010\x01\x03\0\x03\0\x03\0\x03\0\x03\0\x03\0\x03\x006\x01\x03\0\x03\0\x03\0\x03\0\x03\0\x03\0\x03\0\x03\0\x03\0\x03\0\x03\0\x03\0\x03\0\x03\0\x03\0\x03\x009\x01"\0\x03\0\x03\0\x03\0\x03\0\x03\0\x03\0\x03\0\x03\0;\x01>\x01?\x01@\x01\x1e\0\x1e\0\x1e\0\x1e\0\x1e\0\x1e\0\x1e\0A\x01\x1e\0\x1e\0\x1e\0\x1e\0\x1e\0\x1e\0\x1e\0\x1e\0\x1e\0\x1e\0\x1e\0\x1e\0\x1e\0\x1e\0\x1e\0\x1e\0B\x01\x03\0\x1e\0\x1e\0\x1e\0\x1e\0\x1e\0\x1e\0\x1e\0\x1e\0\x04\x01D\x01E\x01F\x01\x03\0\x0b\x01\x03\0\x03\0\x03\0\x03\0\x03\0a\x01\x03\0\x03\0\x03\0\x03\0\x03\0\x03\0\x03\0\x03\0\x03\0\x03\0\x03\0\x03\0\x03\0\x03\0\x03\0\x03\0G\x01\x1e\0\x03\0\x03\0\x03\0\x03\0\x03\0\x03\0\x03\0\x03\0I\x01M\x01O\x01Q\x01\x19\0\x19\0\x19\0\x19\0\x19\0R\x01\x19\0S\x01Y\x01\x19\0\x19\0\x19\0\x19\0\x19\0\x19\0\x19\0\x19\0\x19\0\x19\0\x19\0\x19\0\x19\0\x19\0\x19\0^\x01\x03\0\x19\0\x19\0\x19\0\x19\0\x19\0\x19\0\x19\0\x19\0`\x01b\x01c\x01d\x01\x03\0e\x01\x03\0\x03\0\x03\0\x03\0\x03\0r\x01f\x01\x03\0\x03\0\x03\0\x03\0\x03\0\x03\0\x03\0\x03\0\x03\0\x03\0\x03\0\x03\0\x03\0\x03\0\x03\0h\x01\x19\0\x03\0\x03\0\x03\0\x03\0\x03\0\x03\0\x03\0\x03\0k\x01l\x01p\x01q\x01\x03\0\x03\0\x03\0\x03\0\x03\0s\x01\x03\0|\x01}\x01\x03\0\x03\0\x03\0\x03\0\x03\0\x03\0\x03\0\x03\0\x03\0\x03\0\x03\0\x03\0\x03\0\x03\0\x03\0~\x01\x03\0\x03\0\x03\0\x03\0\x03\0\x03\0\x03\0\x03\0\x03\0\x7f\x01\x81\x01\x85\x01\x86\x01\x1e\0\x8d\x01\x1e\0\x1e\0\x1e\0\x1e\0\x1e\0\x8c\x01\x8e\x01\x1e\0\x1e\0\x1e\0\x1e\0\x1e\0\x1e\0\x1e\0\x1e\0\x1e\0\x1e\0\x1e\0\x1e\0\x1e\0\x1e\0\x1e\0\x91\x01\x03\0\x1e\0\x1e\0\x1e\0\x1e\0\x1e\0\x1e\0\x1e\0\x1e\0\x93\x01\x9e\x01\xa0\x01\xa4\x01\x97\0\xb0\x01\x98\0\x99\0\x9a\0\xa5\x01\x9b\0\xa6\x01\xa7\x01\x9c\0\x9d\0\x9e\0\x9f\0\xa0\0\xa1\0\xa2\0\xa3\0\xa4\0\xa5\0\xa6\0\xa7\0\xa8\0\xa9\0\xaa\0\xa8\x01\x1e\0\xab\0\xac\0\xad\0\xae\0\xaf\0\xb0\0\xb1\0\xb2\0\xa9\x01\xaa\x01\xac\x01\xad\x01\xf6\0\xb2\x01\x98\0\x99\0\x9a\0\xb1\x01\x9b\0\xb3\x01\xa3\0\x9c\0\x9d\0\x9e\0\x9f\0\xa0\0\xa1\0\xa2\0\xa3\0\xa4\0\xa5\0\xa6\0\xa7\0\xa8\0\xa9\0\xaa\0\xb5\x01\xb3\0\xab\0\xac\0\xad\0\xae\0\xaf\0\xb0\0\xb1\0\xb2\0\xb6\x01\xb8\x01\x84\0\xa3\0\xf8\0~\0\x98\0\x99\0\x9a\0\x91\0\x9b\0\xaa\0P\0\x9c\0\x9d\0\x9e\0\x9f\0\xa0\0\xa1\0\xa2\0\xa3\0\xa4\0\xa5\0\xa6\0\xa7\0\xa8\0\xa9\0\xaa\0\x17\0\xb3\0\xab\0\xac\0\xad\0\xae\0\xaf\0\xb0\0\xb1\0\xb2\0\t\0R\0\x7f\0\x03\0\xfb\0\x03\0\x98\0\x99\0\x9a\0\x19\0\x9b\0P\0K\0\x9c\0\x9d\0\x9e\0\x9f\0\xa0\0\xa1\0\xa2\0\xa3\0\xa4\0\xa5\0\xa6\0\xa7\0\xa8\0\xa9\0\xaa\0M\0\xb3\0\xab\0\xac\0\xad\0\xae\0\xaf\0\xb0\0\xb1\0\xb2\0H\x01\xc1\0\xf5\0\xf4\0\x82\x018\x01\x98\0\x99\0\x9a\0N\x01\x9b\0\x0e\0\xd6\0\x9c\0\x9d\0\x9e\0\x9f\0\xa0\0\xa1\0\xa2\0\xa3\0\xa4\0\xa5\0\xa6\0\xa7\0\xa8\0\xa9\0\xaa\0\0\0\xb3\0\xab\0\xac\0\xad\0\xae\0\xaf\0\xb0\0\xb1\0\xb2\0\0\0\0\0\0\0\0\0\0\0\0\0\x98\0\x99\0\xcb\0\0\0\xcc\0\0\0\0\0\x9c\0\xcd\0\x9e\0\x9f\0\xa0\0\xa1\0\xa2\0\xa3\0\xa4\0\xa5\0\xa6\0\xa7\0\xa8\0\xa9\0\xaa\0\0\0\xb3\0\xab\0\xac\0\xad\0\xae\0\xaf\0\xb0\0\xb1\0\xb2\0\0\0\0\0\xde\0\xdf\0\xe0\0\xe1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\xe2\0\xe3\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x98\0\x99\0\xcb\0\0\0\xcc\0\0\0\xb3\0\x9c\0\xcd\0\x9e\0\x9f\0\xa0\0\xa1\0\xa2\0\xa3\0\xa4\0\xa5\0\xa6\0\xa7\0\xa8\0\xa9\0\xaa\0\0\0\0\0\xab\0\xac\0\xad\0\xae\0\xaf\0\xb0\0\xb1\0\xb2\0\0\0\0\0\xde\0\xdf\0\xe0\0\xe1\0\x98\0\x99\0\xcb\0\0\0\xcc\0\0\0\0\0\x9c\0\xcd\0\x9e\0\x9f\0\xa0\0\xa1\0\xa2\0\xa3\0\xa4\0\xa5\0\xa6\0\xa7\0\xa8\0\xa9\0\xaa\0\0\0\xb3\0\xab\0\xac\0\xad\0\xae\0\xaf\0\xb0\0\xb1\0\xb2\0\0\0\0\0\0\0\xdf\0\xe0\0\xe1\0\x98\0\x99\0\xcb\0\0\0\xcc\0\0\0\0\0\x9c\0\xcd\0\x9e\0\x9f\0\xa0\0\xa1\0\xa2\0\xa3\0\xa4\0\xa5\0\xa6\0\xa7\0\xa8\0\xa9\0\xaa\0\0\0\xb3\0\xab\0\xac\0\xad\0\xae\0\xaf\0\xb0\0\xb1\0\xb2\0\0\0\0\0\0\0\0\0\0\0\0\0\x98\0\x99\0\xcb\0\0\0\xcc\0\x90\x01\xce\0\x9c\0\xcd\0\x9e\0\x9f\0\xa0\0\xa1\0\xa2\0\xa3\0\xa4\0\xa5\0\xa6\0\xa7\0\xa8\0\xa9\0\xaa\0\0\0\xb3\0\xab\0\xac\0\xad\0\xae\0\xaf\0\xb0\0\xb1\0\xb2\0\0\0\0\0\0\0\0\0\0\0\0\0\x98\0\x99\0\xcb\0\0\0\xcc\0\0\0\0\0\x9c\0\xcd\0\x9e\0\x9f\0\xa0\0\xa1\0\xa2\0\xa3\0\xa4\0\xa5\0\xa6\0\xa7\0\xa8\0\xa9\0\xaa\0\0\0\xb3\0\xab\0\xac\0\xad\0\xae\0\xaf\0\xb0\0\xb1\0\xb2\0\0\0\0\0\0\0\0\0\0\0\xe1\0\x98\0\x99\0\xcb\0\0\0\xcc\0\xa2\x01\0\0\x9c\0\xcd\0\x9e\0\x9f\0\xa0\0\xa1\0\xa2\0\xa3\0\xa4\0\xa5\0\xa6\0\xa7\0\xa8\0\xa9\0\xaa\0\0\0\xb3\0\xab\0\xac\0\xad\0\xae\0\xaf\0\xb0\0\xb1\0\xb2\0\0\0\0\0\0\0\0\0\0\0\0\0\x98\0\x99\0\xcb\0\0\0\xcc\0\0\0\0\0\x9c\0\xcd\0\x9e\0\x9f\0\xa0\0\xa1\0\xa2\0\xa3\0\xa4\0\xa5\0\xa6\0\xa7\0\xa8\0\xa9\0\xaa\0\0\0\xb3\0\xab\0\xac\0\xad\0\xae\0\xaf\0\xb0\0\xb1\0\xb2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\xb3\0', - /* check */"Y\0\0\0\\\0\xb5\0^\0\xbf\0\xb4\0\x8f\0\xbc\0\xbd\0\xd7\0\x89\0Z\0[\0\xbc\0]\0\xce\0\xca\0\xc4\0^\0X\0\b\x01\xc5\0\xc6\0\\\0\x97\0^\0\x9b\0\xce\0\x9d\0\xd6\0\xd7\0\t\x01\xd1\0\xd2\0\xdf\0\xe0\0\xe1\0i\x01j\x01k\x01+\x01\x01\x01\n\0b\x01c\x012\x011\x01\x8a\x003\x01\t\x015\x01\x8e\0\x04\x01F\0\t\x01<\x01=\x01\xea\0\n\x01\xe6\0\xe7\0N\0\x8a\0\0\0\x9a\0\x9b\0\x8e\0\x9d\x008\x019\x01&\0<\x01=\x01\b\x01\xcb\0\xcc\0\xcd\0\xfc\0\x85\x01\xd8\0\x87\0\x88\0\x04\x012\x01\x11\x01\b\x01\x8d\0\t\x01\n\x01\x9e\0\x9f\0\xa0\0\xa1\0\xa2\0\x04\x01\xa4\0\xa5\0\xa6\0\xa7\0\xa8\0\n\x01\x10\x01\xaa\x01\x12\x01\x01\x01\x87\0\x88\0\0\0)\x01\x05\x01\x07\x01\x8d\0\t\x01\xcb\0\xcc\0\xcd\0\xcf\0\x01\x01\x03\0\xf6\0\t\x01\xf8\0\x04\x01\x07\x01\xfb\0\n\x011\x01<\x01=\x01\x0e\x01\x04\x01\x01\x01\x11\x01\xdf\0\t\x01\xe1\0\n\x01\x07\x01\x17\0\x18\0\x19\0\x1a\0+\x01\x01\x01\x1d\0\x1a\x012\x01\x05\x011\x01\x04\x013\x01\t\x015\x01\xde\0:\x01;\x01<\x01=\x01>\x01?\x01@\x01A\x01B\x01C\x01D\x01E\x01F\x01G\x01\x13\0\t\x01\x15\0\x16\0\x04\x01{\x01\x04\x01\x04\x01\x04\x01`\x01\n\x01\t\x01\x1f\0 \0\n\x01\x01\x01\n\x01\x14\x01\n\x01\x05\x01'\0x\x01\x04\x01\n\x01z\x01r\x01{\x01x\x01\n\x01\x04\x01.\x01/\x01Q\x01y\x01\x05\x01\n\x01\x04\x016\x01\t\x018\x019\x01\x8c\x01\x81\x01\x8e\x01\x01\0\x02\0\x03\0\x8a\x01\x1b\0\x1c\0\x1d\0\x1e\0\x04\x01\x90\x01#\x01$\x01%\x01&\x01<\x01\x9e\x019\0:\0;\0<\0=\0>\0?\0@\0A\0B\0\x06\x01\xa2\x01K\x01\t\x01\x06\x01\x0e\x01s\x01\t\x01\x11\x01\x06\x01\x06\x01\x04\x01\t\x01\t\x01\x04\x01\x07\x01\x04\x01\xb2\x01\n\x01\x04\x01\xb5\x01\x82\x018\x019\x01U\x01V\x01W\x01X\x01\n\x01\x01\x01\x02\x01\x03\x01h\x01i\x01j\x01k\x01\x91\x01-\x01.\x01/\x01\x05\x01\x06\x01\x04\x01t\x01\n\x01\x06\x01\t\x01\n\x01\t\x01\x04\x01\x0b\x01\f\x01\r\x01\x0e\x01\x0f\x01\t\x01\x11\x01\x12\x01\x13\x01\x14\x01\x15\x01\x16\x01\x17\x01\x18\x01\x19\x01\x1a\x01\x1b\x01\x1c\x01\x1d\x01\x1e\x01\x1f\x01 \x01\n\x01\x92\x01#\x01$\x01%\x01&\x01'\x01(\x01)\x01*\x01\n\x01+\x01,\x01-\x01\t\x01\n\x01\n\x011\x01\n\x013\x014\x015\x016\x01\n\x018\x019\x01\xaa\x01#\x01\x06\x01\n\x01\n\x01\t\x01\x05\x01\x0b\x01\f\x01\r\x01\x0e\x01\x0f\x01\n\x01H\x01\x12\x01\x13\x01\x14\x01\x15\x01\x16\x01\x17\x01\x18\x01\x19\x01\x1a\x01\x1b\x01\x1c\x01\x1d\x01\x1e\x01\x1f\x01 \x01\n\x01\n\x01#\x01$\x01%\x01&\x01'\x01(\x01)\x01*\x01\n\x01\x06\x01\x04\x01\x04\x01\t\x01\n\x01\x0b\x01\f\x01\r\x01+\x01\x0f\x01\n\x01\n\x01\x12\x01\x13\x01\x14\x01\x15\x01\x16\x01\x17\x01\x18\x01\x19\x01\x1a\x01\x1b\x01\x1c\x01\x1d\x01\x1e\x01\x1f\x01 \x01\n\x01H\x01#\x01$\x01%\x01&\x01'\x01(\x01)\x01*\x01\t\x01\x04\x01\t\x01\t\x01\t\x01\t\x01\n\x01\x0b\x01\f\x01\r\x01\x0e\x01\x0f\x01\t\x01\x11\x01\x12\x01\x13\x01\x14\x01\x15\x01\x16\x01\x17\x01\x18\x01\x19\x01\x1a\x01\x1b\x01\x1c\x01\x1d\x01\x1e\x01\x1f\x01 \x01H\x01\"\x01#\x01$\x01%\x01&\x01'\x01(\x01)\x01*\x01\n\x01!\x01\n\x01\t\x01\t\x01\n\x01\x0b\x01\f\x01\r\x01\x0e\x01\x0f\x01\t\x01\x11\x01\x12\x01\x13\x01\x14\x01\x15\x01\x16\x01\x17\x01\x18\x01\x19\x01\x1a\x01\x1b\x01\x1c\x01\x1d\x01\x1e\x01\x1f\x01 \x01\n\x01H\x01#\x01$\x01%\x01&\x01'\x01(\x01)\x01*\x01\x01\x01\t\x01\x06\x01\n\x01\t\x01\n\x01\x0b\x01\f\x01\r\x01\x0e\x01\x0f\x01\n\x01\x11\x01\x12\x01\x13\x01\x14\x01\x15\x01\x16\x01\x17\x01\x18\x01\x19\x01\x1a\x01\x1b\x01\x1c\x01\x1d\x01\x1e\x01\x1f\x01 \x01\t\x01H\x01#\x01$\x01%\x01&\x01'\x01(\x01)\x01*\x01\t\x01\x04\x01\n\x01\x04\x01\t\x01\n\x01\x0b\x01\f\x01\r\x01\x0e\x01\x0f\x01\"\x01\x11\x01\x12\x01\x13\x01\x14\x01\x15\x01\x16\x01\x17\x01\x18\x01\x19\x01\x1a\x01\x1b\x01\x1c\x01\x1d\x01\x1e\x01\x1f\x01 \x01\n\x01H\x01#\x01$\x01%\x01&\x01'\x01(\x01)\x01*\x01\n\x01\n\x01\n\x01\n\x01\t\x01\n\x01\x0b\x01\f\x01\r\x01\x0e\x01\x0f\x01\x06\x01\x11\x01\x12\x01\x13\x01\x14\x01\x15\x01\x16\x01\x17\x01\x18\x01\x19\x01\x1a\x01\x1b\x01\x1c\x01\x1d\x01\x1e\x01\x1f\x01 \x01\n\x01H\x01#\x01$\x01%\x01&\x01'\x01(\x01)\x01*\x01\b\x01\n\x01\x01\x01\t\x01\t\x01\x07\x01\x0b\x01\f\x01\r\x01\x0e\x01\x0f\x01\x06\x01\x11\x01\x12\x01\x13\x01\x14\x01\x15\x01\x16\x01\x17\x01\x18\x01\x19\x01\x1a\x01\x1b\x01\x1c\x01\x1d\x01\x1e\x01\x1f\x01 \x01\n\x01H\x01#\x01$\x01%\x01&\x01'\x01(\x01)\x01*\x01\n\x01\n\x01\n\x016\x01\t\x01\n\x01\x0b\x01\f\x01\r\x01\n\x01\x0f\x01\n\x01\n\x01\x12\x01\x13\x01\x14\x01\x15\x01\x16\x01\x17\x01\x18\x01\x19\x01\x1a\x01\x1b\x01\x1c\x01\x1d\x01\x1e\x01\x1f\x01 \x01\n\x01H\x01#\x01$\x01%\x01&\x01'\x01(\x01)\x01*\x01\n\x01\n\x01\n\x01\x06\x01\t\x01\x04\x01\x0b\x01\f\x01\r\x01\x0e\x01\x0f\x014\x01\n\x01\x12\x01\x13\x01\x14\x01\x15\x01\x16\x01\x17\x01\x18\x01\x19\x01\x1a\x01\x1b\x01\x1c\x01\x1d\x01\x1e\x01\x1f\x01 \x01\x0e\x01H\x01#\x01$\x01%\x01&\x01'\x01(\x01)\x01*\x01\x0e\x01\n\x01\n\x01\n\x01\t\x01\n\x01\x0b\x01\f\x01\r\x01\t\x01\x0f\x01\n\x01\n\x01\x12\x01\x13\x01\x14\x01\x15\x01\x16\x01\x17\x01\x18\x01\x19\x01\x1a\x01\x1b\x01\x1c\x01\x1d\x01\x1e\x01\x1f\x01 \x01\n\x01H\x01#\x01$\x01%\x01&\x01'\x01(\x01)\x01*\x01\n\x01\n\x01\n\x01\n\x01\t\x01\x06\x01\x0b\x01\f\x01\r\x01\x0e\x01\x0f\x01\n\x01\n\x01\x12\x01\x13\x01\x14\x01\x15\x01\x16\x01\x17\x01\x18\x01\x19\x01\x1a\x01\x1b\x01\x1c\x01\x1d\x01\x1e\x01\x1f\x01 \x01\t\x01H\x01#\x01$\x01%\x01&\x01'\x01(\x01)\x01*\x01\n\x01\n\x01\n\x01\n\x01\t\x01\t\x01\x0b\x01\f\x01\r\x01\n\x01\x0f\x01\n\x01\n\x01\x12\x01\x13\x01\x14\x01\x15\x01\x16\x01\x17\x01\x18\x01\x19\x01\x1a\x01\x1b\x01\x1c\x01\x1d\x01\x1e\x01\x1f\x01 \x01\n\x01H\x01#\x01$\x01%\x01&\x01'\x01(\x01)\x01*\x01\n\x01\x0e\x01\n\x01\n\x01\t\x01\x11\x01\x0b\x01\f\x01\r\x01\n\x01\x0f\x01\t\x01\0\0\x12\x01\x13\x01\x14\x01\x15\x01\x16\x01\x17\x01\x18\x01\x19\x01\x1a\x01\x1b\x01\x1c\x01\x1d\x01\x1e\x01\x1f\x01 \x01\x11\x01H\x01#\x01$\x01%\x01&\x01'\x01(\x01)\x01*\x01\n\x01\n\x01\n\x01\n\x01\t\x01\x01\x01\x0b\x01\f\x01\r\x01\n\x01\x0f\x01\n\x01\n\x01\x12\x01\x13\x01\x14\x01\x15\x01\x16\x01\x17\x01\x18\x01\x19\x01\x1a\x01\x1b\x01\x1c\x01\x1d\x01\x1e\x01\x1f\x01 \x01\n\x01H\x01#\x01$\x01%\x01&\x01'\x01(\x01)\x01*\x01\n\x01\n\x01\x01\x01\n\x01\t\x01\t\x01\x0b\x01\f\x01\r\x01\x01\x01\x0f\x01\x0e\x01\n\x01\x12\x01\x13\x01\x14\x01\x15\x01\x16\x01\x17\x01\x18\x01\x19\x01\x1a\x01\x1b\x01\x1c\x01\x1d\x01\x1e\x01\x1f\x01 \x01\n\x01H\x01#\x01$\x01%\x01&\x01'\x01(\x01)\x01*\x01\x0e\x01\x86\0\xab\0\xaa\0\t\x01\xf4\0\x0b\x01\f\x01\r\x01\x14\x01\x0f\x01\x02\0\x8d\0\x12\x01\x13\x01\x14\x01\x15\x01\x16\x01\x17\x01\x18\x01\x19\x01\x1a\x01\x1b\x01\x1c\x01\x1d\x01\x1e\x01\x1f\x01 \x01\xff\xffH\x01#\x01$\x01%\x01&\x01'\x01(\x01)\x01*\x01\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x0b\x01\f\x01\r\x01\xff\xff\x0f\x01\xff\xff\xff\xff\x12\x01\x13\x01\x14\x01\x15\x01\x16\x01\x17\x01\x18\x01\x19\x01\x1a\x01\x1b\x01\x1c\x01\x1d\x01\x1e\x01\x1f\x01 \x01\xff\xffH\x01#\x01$\x01%\x01&\x01'\x01(\x01)\x01*\x01\xff\xff\xff\xff-\x01.\x01/\x010\x01\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff8\x019\x01\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x0b\x01\f\x01\r\x01\xff\xff\x0f\x01\xff\xffH\x01\x12\x01\x13\x01\x14\x01\x15\x01\x16\x01\x17\x01\x18\x01\x19\x01\x1a\x01\x1b\x01\x1c\x01\x1d\x01\x1e\x01\x1f\x01 \x01\xff\xff\xff\xff#\x01$\x01%\x01&\x01'\x01(\x01)\x01*\x01\xff\xff\xff\xff-\x01.\x01/\x010\x01\x0b\x01\f\x01\r\x01\xff\xff\x0f\x01\xff\xff\xff\xff\x12\x01\x13\x01\x14\x01\x15\x01\x16\x01\x17\x01\x18\x01\x19\x01\x1a\x01\x1b\x01\x1c\x01\x1d\x01\x1e\x01\x1f\x01 \x01\xff\xffH\x01#\x01$\x01%\x01&\x01'\x01(\x01)\x01*\x01\xff\xff\xff\xff\xff\xff.\x01/\x010\x01\x0b\x01\f\x01\r\x01\xff\xff\x0f\x01\xff\xff\xff\xff\x12\x01\x13\x01\x14\x01\x15\x01\x16\x01\x17\x01\x18\x01\x19\x01\x1a\x01\x1b\x01\x1c\x01\x1d\x01\x1e\x01\x1f\x01 \x01\xff\xffH\x01#\x01$\x01%\x01&\x01'\x01(\x01)\x01*\x01\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x0b\x01\f\x01\r\x01\xff\xff\x0f\x01\x10\x017\x01\x12\x01\x13\x01\x14\x01\x15\x01\x16\x01\x17\x01\x18\x01\x19\x01\x1a\x01\x1b\x01\x1c\x01\x1d\x01\x1e\x01\x1f\x01 \x01\xff\xffH\x01#\x01$\x01%\x01&\x01'\x01(\x01)\x01*\x01\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x0b\x01\f\x01\r\x01\xff\xff\x0f\x01\xff\xff\xff\xff\x12\x01\x13\x01\x14\x01\x15\x01\x16\x01\x17\x01\x18\x01\x19\x01\x1a\x01\x1b\x01\x1c\x01\x1d\x01\x1e\x01\x1f\x01 \x01\xff\xffH\x01#\x01$\x01%\x01&\x01'\x01(\x01)\x01*\x01\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff0\x01\x0b\x01\f\x01\r\x01\xff\xff\x0f\x01\x10\x01\xff\xff\x12\x01\x13\x01\x14\x01\x15\x01\x16\x01\x17\x01\x18\x01\x19\x01\x1a\x01\x1b\x01\x1c\x01\x1d\x01\x1e\x01\x1f\x01 \x01\xff\xffH\x01#\x01$\x01%\x01&\x01'\x01(\x01)\x01*\x01\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\x0b\x01\f\x01\r\x01\xff\xff\x0f\x01\xff\xff\xff\xff\x12\x01\x13\x01\x14\x01\x15\x01\x16\x01\x17\x01\x18\x01\x19\x01\x1a\x01\x1b\x01\x1c\x01\x1d\x01\x1e\x01\x1f\x01 \x01\xff\xffH\x01#\x01$\x01%\x01&\x01'\x01(\x01)\x01*\x01\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xff\xffH\x01", - /* error_function */parse_error, - /* names_const */"ANYFUNC\0MUT\0LPAR\0RPAR\0NOP\0DROP\0BLOCK\0END\0IF\0THEN\0ELSE\0SELECT\0LOOP\0BR\0BR_IF\0BR_TABLE\0CALL\0CALL_INDIRECT\0RETURN\0GET_LOCAL\0SET_LOCAL\0TEE_LOCAL\0GET_GLOBAL\0SET_GLOBAL\0UNREACHABLE\0CURRENT_MEMORY\0GROW_MEMORY\0FUNC\0START\0TYPE\0PARAM\0RESULT\0LOCAL\0GLOBAL\0MODULE\0TABLE\0ELEM\0MEMORY\0DATA\0OFFSET\0IMPORT\0EXPORT\0SCRIPT\0REGISTER\0INVOKE\0GET\0ASSERT_MALFORMED\0ASSERT_INVALID\0ASSERT_SOFT_INVALID\0ASSERT_UNLINKABLE\0ASSERT_RETURN\0ASSERT_RETURN_NAN\0ASSERT_TRAP\0ASSERT_EXHAUSTION\0INPUT\0OUTPUT\0EOF\0", - /* names_block */"NAT\0INT\0FLOAT\0TEXT\0VAR\0VALUE_TYPE\0LOAD\0STORE\0OFFSET_EQ_NAT\0ALIGN_EQ_NAT\0CONST\0UNARY\0BINARY\0COMPARE\0CONVERT\0TEST\0" -]; - -function script(lexfun, lexbuf) { - return Parsing.yyparse(yytables, 1, lexfun, lexbuf); -} - -function script1(lexfun, lexbuf) { - return Parsing.yyparse(yytables, 2, lexfun, lexbuf); -} - -function module1(lexfun, lexbuf) { - return Parsing.yyparse(yytables, 3, lexfun, lexbuf); -} - -exports.script = script; -exports.script1 = script1; -exports.module1 = module1; -/* VarMap Not a pure module */ -//////// end of parser.js //////// -    return exports; -  }; - - - _registry['parsing'] = function() { -    let exports = {}; -//////// start of parsing.js //////// -'use strict'; - -var $$Array = require("./array"); -var Curry = require("./curry"); -var Lexing = require("./lexing"); -var Caml_obj = require("./caml_obj"); -var Caml_array = require("./caml_array"); -var Caml_parser = require("./caml_parser"); -var Caml_exceptions = require("./caml_exceptions"); - -var YYexit = Caml_exceptions.create("Parsing.YYexit"); - -var Parse_error = Caml_exceptions.create("Parsing.Parse_error"); - -var env = /* record */[ - /* s_stack */Caml_array.caml_make_vect(100, 0), - /* v_stack */Caml_array.caml_make_vect(100, /* () */0), - /* symb_start_stack */Caml_array.caml_make_vect(100, Lexing.dummy_pos), - /* symb_end_stack */Caml_array.caml_make_vect(100, Lexing.dummy_pos), - /* stacksize */100, - /* stackbase */0, - /* curr_char */0, - /* lval : () */0, - /* symb_start */Lexing.dummy_pos, - /* symb_end */Lexing.dummy_pos, - /* asp */0, - /* rule_len */0, - /* rule_number */0, - /* sp */0, - /* state */0, - /* errflag */0 -]; - -function grow_stacks() { - var oldsize = env[/* stacksize */4]; - var newsize = (oldsize << 1); - var new_s = Caml_array.caml_make_vect(newsize, 0); - var new_v = Caml_array.caml_make_vect(newsize, /* () */0); - var new_start = Caml_array.caml_make_vect(newsize, Lexing.dummy_pos); - var new_end = Caml_array.caml_make_vect(newsize, Lexing.dummy_pos); - $$Array.blit(env[/* s_stack */0], 0, new_s, 0, oldsize); - env[/* s_stack */0] = new_s; - $$Array.blit(env[/* v_stack */1], 0, new_v, 0, oldsize); - env[/* v_stack */1] = new_v; - $$Array.blit(env[/* symb_start_stack */2], 0, new_start, 0, oldsize); - env[/* symb_start_stack */2] = new_start; - $$Array.blit(env[/* symb_end_stack */3], 0, new_end, 0, oldsize); - env[/* symb_end_stack */3] = new_end; - env[/* stacksize */4] = newsize; - return /* () */0; -} - -function clear_parser() { - $$Array.fill(env[/* v_stack */1], 0, env[/* stacksize */4], /* () */0); - env[/* lval */7] = /* () */0; - return /* () */0; -} - -var current_lookahead_fun = [function () { - return /* false */0; - }]; - -function yyparse(tables, start, lexer, lexbuf) { - var init_asp = env[/* asp */10]; - var init_sp = env[/* sp */13]; - var init_stackbase = env[/* stackbase */5]; - var init_state = env[/* state */14]; - var init_curr_char = env[/* curr_char */6]; - var init_lval = env[/* lval */7]; - var init_errflag = env[/* errflag */15]; - env[/* stackbase */5] = env[/* sp */13] + 1 | 0; - env[/* curr_char */6] = start; - env[/* symb_end */9] = lexbuf[/* lex_curr_p */11]; - try { - var _cmd = /* Start */0; - var _arg = /* () */0; - while(true) { - var arg = _arg; - var cmd = _cmd; - var match = Caml_parser.caml_parse_engine(tables, env, cmd, arg); - switch (match) { - case 0 : - var t = Curry._1(lexer, lexbuf); - env[/* symb_start */8] = lexbuf[/* lex_start_p */10]; - env[/* symb_end */9] = lexbuf[/* lex_curr_p */11]; - _arg = t; - _cmd = /* Token_read */1; - continue ; - case 1 : - throw Parse_error; - case 2 : - grow_stacks(/* () */0); - _arg = /* () */0; - _cmd = /* Stacks_grown_1 */2; - continue ; - case 3 : - grow_stacks(/* () */0); - _arg = /* () */0; - _cmd = /* Stacks_grown_2 */3; - continue ; - case 4 : - var match$1; - try { - match$1 = /* tuple */[ - /* Semantic_action_computed */4, - Curry._1(tables[/* actions */0][env[/* rule_number */12]], env) - ]; - } - catch (exn){ - if (exn === Parse_error) { - match$1 = /* tuple */[ - /* Error_detected */5, - /* () */0 - ]; - } - else { - throw exn; - } - } - _arg = match$1[1]; - _cmd = match$1[0]; - continue ; - case 5 : - Curry._1(tables[/* error_function */13], "syntax error"); - _arg = /* () */0; - _cmd = /* Error_detected */5; - continue ; - - } - }; - } - catch (exn$1){ - var curr_char = env[/* curr_char */6]; - env[/* asp */10] = init_asp; - env[/* sp */13] = init_sp; - env[/* stackbase */5] = init_stackbase; - env[/* state */14] = init_state; - env[/* curr_char */6] = init_curr_char; - env[/* lval */7] = init_lval; - env[/* errflag */15] = init_errflag; - if (exn$1[0] === YYexit) { - return exn$1[1]; - } - else { - current_lookahead_fun[0] = function (tok) { - if (tok.length !== undefined) { - return +(tables[/* transl_block */2][tok.tag | 0] === curr_char); - } - else { - return +(tables[/* transl_const */1][tok] === curr_char); - } - }; - throw exn$1; - } - } -} - -function peek_val(env, n) { - return env[/* v_stack */1][env[/* asp */10] - n | 0]; -} - -function symbol_start_pos() { - var _i = env[/* rule_len */11]; - while(true) { - var i = _i; - if (i <= 0) { - return env[/* symb_end_stack */3][env[/* asp */10]]; - } - else { - var st = env[/* symb_start_stack */2][(env[/* asp */10] - i | 0) + 1 | 0]; - var en = env[/* symb_end_stack */3][(env[/* asp */10] - i | 0) + 1 | 0]; - if (Caml_obj.caml_notequal(st, en)) { - return st; - } - else { - _i = i - 1 | 0; - continue ; - - } - } - }; -} - -function symbol_end_pos() { - return env[/* symb_end_stack */3][env[/* asp */10]]; -} - -function rhs_start_pos(n) { - return env[/* symb_start_stack */2][env[/* asp */10] - (env[/* rule_len */11] - n | 0) | 0]; -} - -function rhs_end_pos(n) { - return env[/* symb_end_stack */3][env[/* asp */10] - (env[/* rule_len */11] - n | 0) | 0]; -} - -function symbol_start() { - return symbol_start_pos(/* () */0)[/* pos_cnum */3]; -} - -function symbol_end() { - return symbol_end_pos(/* () */0)[/* pos_cnum */3]; -} - -function rhs_start(n) { - return rhs_start_pos(n)[/* pos_cnum */3]; -} - -function rhs_end(n) { - return rhs_end_pos(n)[/* pos_cnum */3]; -} - -function is_current_lookahead(tok) { - return Curry._1(current_lookahead_fun[0], tok); -} - -function parse_error() { - return /* () */0; -} - -var set_trace = Caml_parser.caml_set_parser_trace; - -exports.symbol_start = symbol_start; -exports.symbol_end = symbol_end; -exports.rhs_start = rhs_start; -exports.rhs_end = rhs_end; -exports.symbol_start_pos = symbol_start_pos; -exports.symbol_end_pos = symbol_end_pos; -exports.rhs_start_pos = rhs_start_pos; -exports.rhs_end_pos = rhs_end_pos; -exports.clear_parser = clear_parser; -exports.Parse_error = Parse_error; -exports.set_trace = set_trace; -exports.YYexit = YYexit; -exports.yyparse = yyparse; -exports.peek_val = peek_val; -exports.is_current_lookahead = is_current_lookahead; -exports.parse_error = parse_error; -/* No side effect */ -//////// end of parsing.js //////// -    return exports; -  }; - - - _registry['pervasives'] = function() { -    let exports = {}; -//////// start of pervasives.js //////// -'use strict'; - -var Curry = require("./curry"); -var Caml_io = require("./caml_io"); -var Caml_obj = require("./caml_obj"); -var Caml_format = require("./caml_format"); -var Caml_string = require("./caml_string"); -var Caml_exceptions = require("./caml_exceptions"); -var Caml_builtin_exceptions = require("./caml_builtin_exceptions"); -var CamlinternalFormatBasics = require("./camlinternalFormatBasics"); - -function failwith(s) { - throw [ - Caml_builtin_exceptions.failure, - s - ]; -} - -function invalid_arg(s) { - throw [ - Caml_builtin_exceptions.invalid_argument, - s - ]; -} - -var Exit = Caml_exceptions.create("Pervasives.Exit"); - -function min(x, y) { - if (Caml_obj.caml_lessequal(x, y)) { - return x; - } - else { - return y; - } -} - -function max(x, y) { - if (Caml_obj.caml_greaterequal(x, y)) { - return x; - } - else { - return y; - } -} - -function abs(x) { - if (x >= 0) { - return x; - } - else { - return -x | 0; - } -} - -function lnot(x) { - return x ^ -1; -} - -var min_int = -2147483648; - -function $caret(a, b) { - return a + b; -} - -function char_of_int(n) { - if (n < 0 || n > 255) { - throw [ - Caml_builtin_exceptions.invalid_argument, - "char_of_int" - ]; - } - else { - return n; - } -} - -function string_of_bool(b) { - if (b) { - return "true"; - } - else { - return "false"; - } -} - -function bool_of_string(param) { - switch (param) { - case "false" : - return /* false */0; - case "true" : - return /* true */1; - default: - throw [ - Caml_builtin_exceptions.invalid_argument, - "bool_of_string" - ]; - } -} - -function string_of_int(param) { - return "" + param; -} - -function valid_float_lexem(s) { - var l = s.length; - var _i = 0; - while(true) { - var i = _i; - if (i >= l) { - return $caret(s, "."); - } - else { - var match = Caml_string.get(s, i); - if (match >= 48) { - if (match >= 58) { - return s; - } - else { - _i = i + 1 | 0; - continue ; - - } - } - else if (match !== 45) { - return s; - } - else { - _i = i + 1 | 0; - continue ; - - } - } - }; -} - -function string_of_float(f) { - return valid_float_lexem(Caml_format.caml_format_float("%.12g", f)); -} - -function $at(l1, l2) { - if (l1) { - return /* :: */[ - l1[0], - $at(l1[1], l2) - ]; - } - else { - return l2; - } -} - -var stdin = Caml_io.stdin; - -var stdout = Caml_io.stdout; - -var stderr = Caml_io.stderr; - -function open_out_gen(_, _$1, _$2) { - return Caml_io.caml_ml_open_descriptor_out(function () { - throw "caml_sys_open not implemented by bucklescript yet\n"; - }()); -} - -function open_out(name) { - return open_out_gen(/* :: */[ - /* Open_wronly */1, - /* :: */[ - /* Open_creat */3, - /* :: */[ - /* Open_trunc */4, - /* :: */[ - /* Open_text */7, - /* [] */0 - ] - ] - ] - ], 438, name); -} - -function open_out_bin(name) { - return open_out_gen(/* :: */[ - /* Open_wronly */1, - /* :: */[ - /* Open_creat */3, - /* :: */[ - /* Open_trunc */4, - /* :: */[ - /* Open_binary */6, - /* [] */0 - ] - ] - ] - ], 438, name); -} - -function flush_all() { - var _param = Caml_io.caml_ml_out_channels_list(/* () */0); - while(true) { - var param = _param; - if (param) { - try { - Caml_io.caml_ml_flush(param[0]); - } - catch (exn){ - - } - _param = param[1]; - continue ; - - } - else { - return /* () */0; - } - }; -} - -function output_bytes(oc, s) { - return Caml_io.caml_ml_output(oc, s, 0, s.length); -} - -function output_string(oc, s) { - return Caml_io.caml_ml_output(oc, s, 0, s.length); -} - -function output(oc, s, ofs, len) { - if (ofs < 0 || len < 0 || ofs > (s.length - len | 0)) { - throw [ - Caml_builtin_exceptions.invalid_argument, - "output" - ]; - } - else { - return Caml_io.caml_ml_output(oc, s, ofs, len); - } -} - -function output_substring(oc, s, ofs, len) { - if (ofs < 0 || len < 0 || ofs > (s.length - len | 0)) { - throw [ - Caml_builtin_exceptions.invalid_argument, - "output_substring" - ]; - } - else { - return Caml_io.caml_ml_output(oc, s, ofs, len); - } -} - -function output_value(_, _$1) { - return function () { - throw "caml_output_value not implemented by bucklescript yet\n"; - }(); -} - -function close_out(oc) { - Caml_io.caml_ml_flush(oc); - return function () { - throw "caml_ml_close_channel not implemented by bucklescript yet\n"; - }(); -} - -function close_out_noerr(oc) { - try { - Caml_io.caml_ml_flush(oc); - } - catch (exn){ - - } - try { - return function () { - throw "caml_ml_close_channel not implemented by bucklescript yet\n"; - }(); - } - catch (exn$1){ - return /* () */0; - } -} - -function open_in_gen(_, _$1, _$2) { - return Caml_io.caml_ml_open_descriptor_in(function () { - throw "caml_sys_open not implemented by bucklescript yet\n"; - }()); -} - -function open_in(name) { - return open_in_gen(/* :: */[ - /* Open_rdonly */0, - /* :: */[ - /* Open_text */7, - /* [] */0 - ] - ], 0, name); -} - -function open_in_bin(name) { - return open_in_gen(/* :: */[ - /* Open_rdonly */0, - /* :: */[ - /* Open_binary */6, - /* [] */0 - ] - ], 0, name); -} - -function input(_, s, ofs, len) { - if (ofs < 0 || len < 0 || ofs > (s.length - len | 0)) { - throw [ - Caml_builtin_exceptions.invalid_argument, - "input" - ]; - } - else { - return function () { - throw "caml_ml_input not implemented by bucklescript yet\n"; - }(); - } -} - -function unsafe_really_input(_, _$1, _ofs, _len) { - while(true) { - var len = _len; - var ofs = _ofs; - if (len <= 0) { - return /* () */0; - } - else { - var r = function () { - throw "caml_ml_input not implemented by bucklescript yet\n"; - }(); - if (r) { - _len = len - r | 0; - _ofs = ofs + r | 0; - continue ; - - } - else { - throw Caml_builtin_exceptions.end_of_file; - } - } - }; -} - -function really_input(ic, s, ofs, len) { - if (ofs < 0 || len < 0 || ofs > (s.length - len | 0)) { - throw [ - Caml_builtin_exceptions.invalid_argument, - "really_input" - ]; - } - else { - return unsafe_really_input(ic, s, ofs, len); - } -} - -function really_input_string(ic, len) { - var s = Caml_string.caml_create_string(len); - really_input(ic, s, 0, len); - return Caml_string.bytes_to_string(s); -} - -function input_line(chan) { - var build_result = function (buf, _pos, _param) { - while(true) { - var param = _param; - var pos = _pos; - if (param) { - var hd = param[0]; - var len = hd.length; - Caml_string.caml_blit_bytes(hd, 0, buf, pos - len | 0, len); - _param = param[1]; - _pos = pos - len | 0; - continue ; - - } - else { - return buf; - } - }; - }; - var scan = function (_accu, _len) { - while(true) { - var len = _len; - var accu = _accu; - var n = function () { - throw "caml_ml_input_scan_line not implemented by bucklescript yet\n"; - }(); - if (n) { - if (n > 0) { - var res = Caml_string.caml_create_string(n - 1 | 0); - (function () { - throw "caml_ml_input not implemented by bucklescript yet\n"; - }()); - Caml_io.caml_ml_input_char(chan); - if (accu) { - var len$1 = (len + n | 0) - 1 | 0; - return build_result(Caml_string.caml_create_string(len$1), len$1, /* :: */[ - res, - accu - ]); - } - else { - return res; - } - } - else { - var beg = Caml_string.caml_create_string(-n | 0); - (function () { - throw "caml_ml_input not implemented by bucklescript yet\n"; - }()); - _len = len - n | 0; - _accu = /* :: */[ - beg, - accu - ]; - continue ; - - } - } - else if (accu) { - return build_result(Caml_string.caml_create_string(len), len, accu); - } - else { - throw Caml_builtin_exceptions.end_of_file; - } - }; - }; - return Caml_string.bytes_to_string(scan(/* [] */0, 0)); -} - -function close_in_noerr() { - try { - return function () { - throw "caml_ml_close_channel not implemented by bucklescript yet\n"; - }(); - } - catch (exn){ - return /* () */0; - } -} - -function print_char(c) { - return Caml_io.caml_ml_output_char(stdout, c); -} - -function print_string(s) { - return output_string(stdout, s); -} - -function print_bytes(s) { - return output_bytes(stdout, s); -} - -function print_int(i) { - return output_string(stdout, "" + i); -} - -function print_float(f) { - return output_string(stdout, valid_float_lexem(Caml_format.caml_format_float("%.12g", f))); -} - -function print_endline(param) { - console.log(param); - return 0; -} - -function print_newline() { - Caml_io.caml_ml_output_char(stdout, /* "\n" */10); - return Caml_io.caml_ml_flush(stdout); -} - -function prerr_char(c) { - return Caml_io.caml_ml_output_char(stderr, c); -} - -function prerr_string(s) { - return output_string(stderr, s); -} - -function prerr_bytes(s) { - return output_bytes(stderr, s); -} - -function prerr_int(i) { - return output_string(stderr, "" + i); -} - -function prerr_float(f) { - return output_string(stderr, valid_float_lexem(Caml_format.caml_format_float("%.12g", f))); -} - -function prerr_endline(param) { - console.error(param); - return 0; -} - -function prerr_newline() { - Caml_io.caml_ml_output_char(stderr, /* "\n" */10); - return Caml_io.caml_ml_flush(stderr); -} - -function read_line() { - Caml_io.caml_ml_flush(stdout); - return input_line(stdin); -} - -function read_int() { - return Caml_format.caml_int_of_string((Caml_io.caml_ml_flush(stdout), input_line(stdin))); -} - -function read_float() { - return Caml_format.caml_float_of_string((Caml_io.caml_ml_flush(stdout), input_line(stdin))); -} - -function string_of_format(param) { - return param[1]; -} - -function $caret$caret(param, param$1) { - return /* Format */[ - CamlinternalFormatBasics.concat_fmt(param[0], param$1[0]), - $caret(param[1], $caret("%,", param$1[1])) - ]; -} - -var exit_function = [flush_all]; - -function at_exit(f) { - var g = exit_function[0]; - exit_function[0] = function () { - Curry._1(f, /* () */0); - return Curry._1(g, /* () */0); - }; - return /* () */0; -} - -function do_at_exit() { - return Curry._1(exit_function[0], /* () */0); -} - -function exit() { - do_at_exit(/* () */0); - return function () { - throw "caml_sys_exit not implemented by bucklescript yet\n"; - }(); -} - -var max_int = 2147483647; - -var infinity = Infinity; - -var neg_infinity = -Infinity; - -var nan = NaN; - -var max_float = Number.MAX_VALUE; - -var min_float = Number.MIN_VALUE; - -var epsilon_float = 2.220446049250313e-16; - -var flush = Caml_io.caml_ml_flush; - -var output_char = Caml_io.caml_ml_output_char; - -var output_byte = Caml_io.caml_ml_output_char; - -function output_binary_int(_, _$1) { - return function () { - throw "caml_ml_output_int not implemented by bucklescript yet\n"; - }(); -} - -function seek_out(_, _$1) { - return function () { - throw "caml_ml_seek_out not implemented by bucklescript yet\n"; - }(); -} - -function pos_out() { - return function () { - throw "caml_ml_pos_out not implemented by bucklescript yet\n"; - }(); -} - -function out_channel_length() { - return function () { - throw "caml_ml_channel_size not implemented by bucklescript yet\n"; - }(); -} - -function set_binary_mode_out(_, _$1) { - return function () { - throw "caml_ml_set_binary_mode not implemented by bucklescript yet\n"; - }(); -} - -var input_char = Caml_io.caml_ml_input_char; - -var input_byte = Caml_io.caml_ml_input_char; - -function input_binary_int() { - return function () { - throw "caml_ml_input_int not implemented by bucklescript yet\n"; - }(); -} - -function input_value() { - return function () { - throw "caml_input_value not implemented by bucklescript yet\n"; - }(); -} - -function seek_in(_, _$1) { - return function () { - throw "caml_ml_seek_in not implemented by bucklescript yet\n"; - }(); -} - -function pos_in() { - return function () { - throw "caml_ml_pos_in not implemented by bucklescript yet\n"; - }(); -} - -function in_channel_length() { - return function () { - throw "caml_ml_channel_size not implemented by bucklescript yet\n"; - }(); -} - -function close_in() { - return function () { - throw "caml_ml_close_channel not implemented by bucklescript yet\n"; - }(); -} - -function set_binary_mode_in(_, _$1) { - return function () { - throw "caml_ml_set_binary_mode not implemented by bucklescript yet\n"; - }(); -} - -function LargeFile_000(_, _$1) { - return function () { - throw "caml_ml_seek_out_64 not implemented by bucklescript yet\n"; - }(); -} - -function LargeFile_001() { - return function () { - throw "caml_ml_pos_out_64 not implemented by bucklescript yet\n"; - }(); -} - -function LargeFile_002() { - return function () { - throw "caml_ml_channel_size_64 not implemented by bucklescript yet\n"; - }(); -} - -function LargeFile_003(_, _$1) { - return function () { - throw "caml_ml_seek_in_64 not implemented by bucklescript yet\n"; - }(); -} - -function LargeFile_004() { - return function () { - throw "caml_ml_pos_in_64 not implemented by bucklescript yet\n"; - }(); -} - -function LargeFile_005() { - return function () { - throw "caml_ml_channel_size_64 not implemented by bucklescript yet\n"; - }(); -} - -var LargeFile = [ - LargeFile_000, - LargeFile_001, - LargeFile_002, - LargeFile_003, - LargeFile_004, - LargeFile_005 -]; - -exports.invalid_arg = invalid_arg; -exports.failwith = failwith; -exports.Exit = Exit; -exports.min = min; -exports.max = max; -exports.abs = abs; -exports.max_int = max_int; -exports.min_int = min_int; -exports.lnot = lnot; -exports.infinity = infinity; -exports.neg_infinity = neg_infinity; -exports.nan = nan; -exports.max_float = max_float; -exports.min_float = min_float; -exports.epsilon_float = epsilon_float; -exports.$caret = $caret; -exports.char_of_int = char_of_int; -exports.string_of_bool = string_of_bool; -exports.bool_of_string = bool_of_string; -exports.string_of_int = string_of_int; -exports.string_of_float = string_of_float; -exports.$at = $at; -exports.stdin = stdin; -exports.stdout = stdout; -exports.stderr = stderr; -exports.print_char = print_char; -exports.print_string = print_string; -exports.print_bytes = print_bytes; -exports.print_int = print_int; -exports.print_float = print_float; -exports.print_endline = print_endline; -exports.print_newline = print_newline; -exports.prerr_char = prerr_char; -exports.prerr_string = prerr_string; -exports.prerr_bytes = prerr_bytes; -exports.prerr_int = prerr_int; -exports.prerr_float = prerr_float; -exports.prerr_endline = prerr_endline; -exports.prerr_newline = prerr_newline; -exports.read_line = read_line; -exports.read_int = read_int; -exports.read_float = read_float; -exports.open_out = open_out; -exports.open_out_bin = open_out_bin; -exports.open_out_gen = open_out_gen; -exports.flush = flush; -exports.flush_all = flush_all; -exports.output_char = output_char; -exports.output_string = output_string; -exports.output_bytes = output_bytes; -exports.output = output; -exports.output_substring = output_substring; -exports.output_byte = output_byte; -exports.output_binary_int = output_binary_int; -exports.output_value = output_value; -exports.seek_out = seek_out; -exports.pos_out = pos_out; -exports.out_channel_length = out_channel_length; -exports.close_out = close_out; -exports.close_out_noerr = close_out_noerr; -exports.set_binary_mode_out = set_binary_mode_out; -exports.open_in = open_in; -exports.open_in_bin = open_in_bin; -exports.open_in_gen = open_in_gen; -exports.input_char = input_char; -exports.input_line = input_line; -exports.input = input; -exports.really_input = really_input; -exports.really_input_string = really_input_string; -exports.input_byte = input_byte; -exports.input_binary_int = input_binary_int; -exports.input_value = input_value; -exports.seek_in = seek_in; -exports.pos_in = pos_in; -exports.in_channel_length = in_channel_length; -exports.close_in = close_in; -exports.close_in_noerr = close_in_noerr; -exports.set_binary_mode_in = set_binary_mode_in; -exports.LargeFile = LargeFile; -exports.string_of_format = string_of_format; -exports.$caret$caret = $caret$caret; -exports.exit = exit; -exports.at_exit = at_exit; -exports.valid_float_lexem = valid_float_lexem; -exports.unsafe_really_input = unsafe_really_input; -exports.do_at_exit = do_at_exit; -/* No side effect */ -//////// end of pervasives.js //////// -    return exports; -  }; - - - _registry['printf'] = function() { -    let exports = {}; -//////// start of printf.js //////// -'use strict'; - -var Curry = require("./curry"); -var Buffer = require("./buffer"); -var Pervasives = require("./pervasives"); -var CamlinternalFormat = require("./camlinternalFormat"); - -function kfprintf(k, o, param) { - return CamlinternalFormat.make_printf(function (o, acc) { - CamlinternalFormat.output_acc(o, acc); - return Curry._1(k, o); - }, o, /* End_of_acc */0, param[0]); -} - -function kbprintf(k, b, param) { - return CamlinternalFormat.make_printf(function (b, acc) { - CamlinternalFormat.bufput_acc(b, acc); - return Curry._1(k, b); - }, b, /* End_of_acc */0, param[0]); -} - -function ikfprintf(k, oc, param) { - return CamlinternalFormat.make_printf(function (oc, _) { - return Curry._1(k, oc); - }, oc, /* End_of_acc */0, param[0]); -} - -function fprintf(oc, fmt) { - return kfprintf(function () { - return /* () */0; - }, oc, fmt); -} - -function bprintf(b, fmt) { - return kbprintf(function () { - return /* () */0; - }, b, fmt); -} - -function ifprintf(oc, fmt) { - return ikfprintf(function () { - return /* () */0; - }, oc, fmt); -} - -function printf(fmt) { - return fprintf(Pervasives.stdout, fmt); -} - -function eprintf(fmt) { - return fprintf(Pervasives.stderr, fmt); -} - -function ksprintf(k, param) { - var k$prime = function (_, acc) { - var buf = Buffer.create(64); - CamlinternalFormat.strput_acc(buf, acc); - return Curry._1(k, Buffer.contents(buf)); - }; - return CamlinternalFormat.make_printf(k$prime, /* () */0, /* End_of_acc */0, param[0]); -} - -function sprintf(fmt) { - return ksprintf(function (s) { - return s; - }, fmt); -} - -var kprintf = ksprintf; - -exports.fprintf = fprintf; -exports.printf = printf; -exports.eprintf = eprintf; -exports.sprintf = sprintf; -exports.bprintf = bprintf; -exports.ifprintf = ifprintf; -exports.kfprintf = kfprintf; -exports.ikfprintf = ikfprintf; -exports.ksprintf = ksprintf; -exports.kbprintf = kbprintf; -exports.kprintf = kprintf; -/* No side effect */ -//////// end of printf.js //////// -    return exports; -  }; - - - _registry['print'] = function() { -    let exports = {}; -//////// start of print.js //////// -// Generated by BUCKLESCRIPT VERSION 1.4.3 , PLEASE EDIT WITH CARE -'use strict'; - -var List = require("bs-platform/lib/js/list"); -var Sexpr = require("./sexpr"); -var Arrange = require("./arrange"); - -function instr(oc, width, e) { - return Sexpr.output(oc, width, Arrange.instr(e)); -} - -function func(oc, width, f) { - return Sexpr.output(oc, width, Arrange.func(f)); -} - -function module_(oc, width, m) { - return Sexpr.output(oc, width, Arrange.module_(m)); -} - -function script(oc, width, mode, s) { - return List.iter(function (param) { - return Sexpr.output(oc, width, param); - }, Arrange.script(mode, s)); -} - -exports.instr = instr; -exports.func = func; -exports.module_ = module_; -exports.script = script; -/* Arrange Not a pure module */ -//////// end of print.js //////// -    return exports; -  }; - - - _registry['script'] = function() { -    let exports = {}; -//////// start of script.js //////// -// Generated by BUCKLESCRIPT VERSION 1.4.3 , PLEASE EDIT WITH CARE -'use strict'; - -var Caml_exceptions = require("bs-platform/lib/js/caml_exceptions"); - -var Syntax = Caml_exceptions.create("Script.Syntax"); - -exports.Syntax = Syntax; -/* No side effect */ -//////// end of script.js //////// -    return exports; -  }; - - - _registry['sexpr'] = function() { -    let exports = {}; -//////// start of sexpr.js //////// -// Generated by BUCKLESCRIPT VERSION 1.4.3 , PLEASE EDIT WITH CARE -'use strict'; - -var List = require("bs-platform/lib/js/list"); -var Block = require("bs-platform/lib/js/block"); -var Curry = require("bs-platform/lib/js/curry"); -var $$String = require("bs-platform/lib/js/string"); -var Pervasives = require("bs-platform/lib/js/pervasives"); - -function $caret$plus(s, r) { - return /* Concat */Block.__(1, [/* :: */[ - /* Leaf */Block.__(0, [s]), - /* :: */[ - r, - /* [] */0 - ] - ]]); -} - -function $plus$caret(r, s) { - return /* Concat */Block.__(1, [/* :: */[ - r, - /* :: */[ - /* Leaf */Block.__(0, [s]), - /* [] */0 - ] - ]]); -} - -function iter(f, param) { - if (param.tag) { - return List.iter(function (param) { - return iter(f, param); - }, param[0]); - } - else { - return Curry._1(f, param[0]); - } -} - -function concat(param) { - if (param.tag) { - return $$String.concat("", List.map(concat, param[0])); - } - else { - return param[0]; - } -} - -function pp(off, width, param) { - if (param.tag) { - var s = param[0]; - var partial_arg = off + 2 | 0; - var match = List.split(List.map(function (param) { - return pp(partial_arg, width, param); - }, param[1])); - var rs = match[1]; - var len = (s.length + List.length(rs) | 0) + List.fold_left(function (prim, prim$1) { - return prim + prim$1 | 0; - }, 2, match[0]) | 0; - var match$1; - if ((off + len | 0) <= width) { - match$1 = /* tuple */[ - " ", - "" - ]; - } - else { - var indent = $$String.make(off, /* " " */32); - match$1 = /* tuple */[ - "\n " + indent, - "\n" + indent - ]; - } - var sep = match$1[0]; - return /* tuple */[ - len, - $caret$plus("(", $caret$plus(s, $plus$caret($plus$caret(/* Concat */Block.__(1, [List.map(function (r) { - return $caret$plus(sep, r); - }, rs)]), match$1[1]), ")"))) - ]; - } - else { - var s$1 = param[0]; - return /* tuple */[ - s$1.length, - /* Leaf */Block.__(0, [s$1]) - ]; - } -} - -function output(oc, width, x) { - iter(function (param) { - return Pervasives.output_string(oc, param); - }, pp(0, width, x)[1]); - Pervasives.output_string(oc, "\n"); - return Curry._1(Pervasives.flush, oc); -} - -function print(param, param$1) { - return output(Pervasives.stdout, param, param$1); -} - -function to_string(width, x) { - return concat(pp(0, width, x)[1]) + "\n"; -} - -exports.output = output; -exports.print = print; -exports.to_string = to_string; -/* No side effect */ -//////// end of sexpr.js //////// -    return exports; -  }; - - - _registry['source'] = function() { -    let exports = {}; -//////// start of source.js //////// -// Generated by BUCKLESCRIPT VERSION 1.4.3 , PLEASE EDIT WITH CARE -'use strict'; - -var Block = require("bs-platform/lib/js/block"); -var Curry = require("bs-platform/lib/js/curry"); -var Printf = require("bs-platform/lib/js/printf"); -var Caml_obj = require("bs-platform/lib/js/caml_obj"); -var Pervasives = require("bs-platform/lib/js/pervasives"); - -function $at$at(x, region) { - return /* record */[ - /* at */region, - /* it */x - ]; -} - -var no_pos = /* record */[ - /* file */"", - /* line */0, - /* column */0 -]; - -var no_region = /* record */[ - /* left */no_pos, - /* right */no_pos -]; - -function string_of_pos(pos) { - if (pos[/* line */1] === -1) { - return Curry._1(Printf.sprintf(/* Format */[ - /* String_literal */Block.__(11, [ - "0x", - /* Int */Block.__(4, [ - /* Int_x */6, - /* No_padding */0, - /* No_precision */0, - /* End_of_format */0 - ]) - ]), - "0x%x" - ]), pos[/* column */2]); - } - else { - return Pervasives.string_of_int(pos[/* line */1]) + ("." + Pervasives.string_of_int(pos[/* column */2] + 1 | 0)); - } -} - -function string_of_region(r) { - return r[/* left */0][/* file */0] + (":" + (string_of_pos(r[/* left */0]) + ( - Caml_obj.caml_equal(r[/* right */1], r[/* left */0]) ? "" : "-" + string_of_pos(r[/* right */1]) - ))); -} - -exports.no_pos = no_pos; -exports.no_region = no_region; -exports.string_of_pos = string_of_pos; -exports.string_of_region = string_of_region; -exports.$at$at = $at$at; -/* No side effect */ -//////// end of source.js //////// -    return exports; -  }; - - - _registry['string'] = function() { -    let exports = {}; -//////// start of string.js //////// -'use strict'; - -var List = require("./list"); -var Bytes = require("./bytes"); -var Caml_int32 = require("./caml_int32"); -var Caml_string = require("./caml_string"); - -function make(n, c) { - return Caml_string.bytes_to_string(Bytes.make(n, c)); -} - -function init(n, f) { - return Caml_string.bytes_to_string(Bytes.init(n, f)); -} - -function copy(s) { - return Caml_string.bytes_to_string(Bytes.copy(Caml_string.bytes_of_string(s))); -} - -function sub(s, ofs, len) { - return Caml_string.bytes_to_string(Bytes.sub(Caml_string.bytes_of_string(s), ofs, len)); -} - -function concat(sep, l) { - if (l) { - var hd = l[0]; - var num = [0]; - var len = [0]; - List.iter(function (s) { - num[0] = num[0] + 1 | 0; - len[0] = len[0] + s.length | 0; - return /* () */0; - }, l); - var r = Caml_string.caml_create_string(len[0] + Caml_int32.imul(sep.length, num[0] - 1 | 0) | 0); - Caml_string.caml_blit_string(hd, 0, r, 0, hd.length); - var pos = [hd.length]; - List.iter(function (s) { - Caml_string.caml_blit_string(sep, 0, r, pos[0], sep.length); - pos[0] = pos[0] + sep.length | 0; - Caml_string.caml_blit_string(s, 0, r, pos[0], s.length); - pos[0] = pos[0] + s.length | 0; - return /* () */0; - }, l[1]); - return Caml_string.bytes_to_string(r); - } - else { - return ""; - } -} - -function iter(f, s) { - return Bytes.iter(f, Caml_string.bytes_of_string(s)); -} - -function iteri(f, s) { - return Bytes.iteri(f, Caml_string.bytes_of_string(s)); -} - -function map(f, s) { - return Caml_string.bytes_to_string(Bytes.map(f, Caml_string.bytes_of_string(s))); -} - -function mapi(f, s) { - return Caml_string.bytes_to_string(Bytes.mapi(f, Caml_string.bytes_of_string(s))); -} - -function is_space(param) { - var switcher = param - 9 | 0; - if (switcher > 4 || switcher < 0) { - if (switcher !== 23) { - return /* false */0; - } - else { - return /* true */1; - } - } - else if (switcher !== 2) { - return /* true */1; - } - else { - return /* false */0; - } -} - -function trim(s) { - if (s === "" || !(is_space(s.charCodeAt(0)) || is_space(s.charCodeAt(s.length - 1 | 0)))) { - return s; - } - else { - return Caml_string.bytes_to_string(Bytes.trim(Caml_string.bytes_of_string(s))); - } -} - -function escaped(s) { - var needs_escape = function (_i) { - while(true) { - var i = _i; - if (i >= s.length) { - return /* false */0; - } - else { - var match = s.charCodeAt(i); - if (match >= 32) { - var switcher = match - 34 | 0; - if (switcher > 58 || switcher < 0) { - if (switcher >= 93) { - return /* true */1; - } - else { - _i = i + 1 | 0; - continue ; - - } - } - else if (switcher > 57 || switcher < 1) { - return /* true */1; - } - else { - _i = i + 1 | 0; - continue ; - - } - } - else { - return /* true */1; - } - } - }; - }; - if (needs_escape(0)) { - return Caml_string.bytes_to_string(Bytes.escaped(Caml_string.bytes_of_string(s))); - } - else { - return s; - } -} - -function index(s, c) { - return Bytes.index(Caml_string.bytes_of_string(s), c); -} - -function rindex(s, c) { - return Bytes.rindex(Caml_string.bytes_of_string(s), c); -} - -function index_from(s, i, c) { - return Bytes.index_from(Caml_string.bytes_of_string(s), i, c); -} - -function rindex_from(s, i, c) { - return Bytes.rindex_from(Caml_string.bytes_of_string(s), i, c); -} - -function contains(s, c) { - return Bytes.contains(Caml_string.bytes_of_string(s), c); -} - -function contains_from(s, i, c) { - return Bytes.contains_from(Caml_string.bytes_of_string(s), i, c); -} - -function rcontains_from(s, i, c) { - return Bytes.rcontains_from(Caml_string.bytes_of_string(s), i, c); -} - -function uppercase(s) { - return Caml_string.bytes_to_string(Bytes.uppercase(Caml_string.bytes_of_string(s))); -} - -function lowercase(s) { - return Caml_string.bytes_to_string(Bytes.lowercase(Caml_string.bytes_of_string(s))); -} - -function capitalize(s) { - return Caml_string.bytes_to_string(Bytes.capitalize(Caml_string.bytes_of_string(s))); -} - -function uncapitalize(s) { - return Caml_string.bytes_to_string(Bytes.uncapitalize(Caml_string.bytes_of_string(s))); -} - -var compare = Caml_string.caml_string_compare; - -var fill = Bytes.fill; - -var blit = Bytes.blit_string; - -exports.make = make; -exports.init = init; -exports.copy = copy; -exports.sub = sub; -exports.fill = fill; -exports.blit = blit; -exports.concat = concat; -exports.iter = iter; -exports.iteri = iteri; -exports.map = map; -exports.mapi = mapi; -exports.trim = trim; -exports.escaped = escaped; -exports.index = index; -exports.rindex = rindex; -exports.index_from = index_from; -exports.rindex_from = rindex_from; -exports.contains = contains; -exports.contains_from = contains_from; -exports.rcontains_from = rcontains_from; -exports.uppercase = uppercase; -exports.lowercase = lowercase; -exports.capitalize = capitalize; -exports.uncapitalize = uncapitalize; -exports.compare = compare; -/* No side effect */ -//////// end of string.js //////// -    return exports; -  }; - - - _registry['sys'] = function() { -    let exports = {}; -//////// start of sys.js //////// -'use strict'; - -var Caml_exceptions = require("./caml_exceptions"); - -var is_js = /* true */1; - -var match_001 = /* array */[]; - -var big_endian = /* false */0; - -var unix = /* true */1; - -var win32 = /* false */0; - -var cygwin = /* false */0; - -var max_array_length = 2147483647; - -var max_string_length = 2147483647; - -var interactive = [/* false */0]; - -function set_signal(_, _$1) { - return /* () */0; -} - -var Break = Caml_exceptions.create("Sys.Break"); - -function catch_break() { - return /* () */0; -} - -var argv = match_001; - -var executable_name = "cmd"; - -var os_type = "Unix"; - -var word_size = 32; - -var sigabrt = -1; - -var sigalrm = -2; - -var sigfpe = -3; - -var sighup = -4; - -var sigill = -5; - -var sigint = -6; - -var sigkill = -7; - -var sigpipe = -8; - -var sigquit = -9; - -var sigsegv = -10; - -var sigterm = -11; - -var sigusr1 = -12; - -var sigusr2 = -13; - -var sigchld = -14; - -var sigcont = -15; - -var sigstop = -16; - -var sigtstp = -17; - -var sigttin = -18; - -var sigttou = -19; - -var sigvtalrm = -20; - -var sigprof = -21; - -var ocaml_version = "4.02.3+dev1-2015-07-10"; - -exports.argv = argv; -exports.executable_name = executable_name; -exports.interactive = interactive; -exports.os_type = os_type; -exports.unix = unix; -exports.win32 = win32; -exports.cygwin = cygwin; -exports.word_size = word_size; -exports.big_endian = big_endian; -exports.is_js = is_js; -exports.max_string_length = max_string_length; -exports.max_array_length = max_array_length; -exports.set_signal = set_signal; -exports.sigabrt = sigabrt; -exports.sigalrm = sigalrm; -exports.sigfpe = sigfpe; -exports.sighup = sighup; -exports.sigill = sigill; -exports.sigint = sigint; -exports.sigkill = sigkill; -exports.sigpipe = sigpipe; -exports.sigquit = sigquit; -exports.sigsegv = sigsegv; -exports.sigterm = sigterm; -exports.sigusr1 = sigusr1; -exports.sigusr2 = sigusr2; -exports.sigchld = sigchld; -exports.sigcont = sigcont; -exports.sigstop = sigstop; -exports.sigtstp = sigtstp; -exports.sigttin = sigttin; -exports.sigttou = sigttou; -exports.sigvtalrm = sigvtalrm; -exports.sigprof = sigprof; -exports.Break = Break; -exports.catch_break = catch_break; -exports.ocaml_version = ocaml_version; -/* No side effect */ -//////// end of sys.js //////// -    return exports; -  }; - - - _registry['types'] = function() { -    let exports = {}; -//////// start of types.js //////// -// Generated by BUCKLESCRIPT VERSION 1.4.3 , PLEASE EDIT WITH CARE -'use strict'; - -var I32 = require("./i32"); -var List = require("bs-platform/lib/js/list"); -var Curry = require("bs-platform/lib/js/curry"); -var $$String = require("bs-platform/lib/js/string"); - -function size(param) { - if (param !== 1 && param < 3) { - return 4; - } - else { - return 8; - } -} - -function string_of_value_type(param) { - switch (param) { - case 0 : - return "i32"; - case 1 : - return "i64"; - case 2 : - return "f32"; - case 3 : - return "f64"; - - } -} - -function string_of_value_types(ts) { - var exit = 0; - if (ts) { - if (ts[1]) { - exit = 1; - } - else { - return string_of_value_type(ts[0]); - } - } - else { - exit = 1; - } - if (exit === 1) { - return "[" + ($$String.concat(" ", List.map(string_of_value_type, ts)) + "]"); - } - -} - -function string_of_elem_type() { - return "anyfunc"; -} - -function string_of_limits(param) { - var max = param[/* max */1]; - return Curry._1(I32.to_string_u, param[/* min */0]) + ( - max ? " " + Curry._1(I32.to_string_u, max[0]) : "" - ); -} - -function string_of_memory_type(param) { - return string_of_limits(param[0]); -} - -function string_of_table_type(param) { - return string_of_limits(param[0]) + " anyfunc"; -} - -function string_of_global_type(param) { - var t = param[0]; - if (param[1] !== 0) { - return "(mut " + (string_of_value_type(t) + ")"); - } - else { - return string_of_value_type(t); - } -} - -function string_of_stack_type(ts) { - return "[" + ($$String.concat(" ", List.map(string_of_value_type, ts)) + "]"); -} - -function string_of_func_type(param) { - return string_of_stack_type(param[0]) + (" -> " + string_of_stack_type(param[1])); -} - -exports.size = size; -exports.string_of_value_type = string_of_value_type; -exports.string_of_value_types = string_of_value_types; -exports.string_of_elem_type = string_of_elem_type; -exports.string_of_limits = string_of_limits; -exports.string_of_memory_type = string_of_memory_type; -exports.string_of_table_type = string_of_table_type; -exports.string_of_global_type = string_of_global_type; -exports.string_of_stack_type = string_of_stack_type; -exports.string_of_func_type = string_of_func_type; -/* I32 Not a pure module */ -//////// end of types.js //////// -    return exports; -  }; - - - _registry['values'] = function() { -    let exports = {}; -//////// start of values.js //////// -// Generated by BUCKLESCRIPT VERSION 1.4.3 , PLEASE EDIT WITH CARE -'use strict'; - -var F32 = require("./f32"); -var F64 = require("./f64"); -var I32 = require("./i32"); -var I64 = require("./i64"); -var List = require("bs-platform/lib/js/list"); -var Block = require("bs-platform/lib/js/block"); -var Curry = require("bs-platform/lib/js/curry"); -var $$String = require("bs-platform/lib/js/string"); -var Caml_exceptions = require("bs-platform/lib/js/caml_exceptions"); - -function type_of(param) { - switch (param.tag | 0) { - case 0 : - return /* I32Type */0; - case 1 : - return /* I64Type */1; - case 2 : - return /* F32Type */2; - case 3 : - return /* F64Type */3; - - } -} - -function default_value(param) { - switch (param) { - case 0 : - return /* I32 */Block.__(0, [I32.zero]); - case 1 : - return /* I64 */Block.__(1, [I64.zero]); - case 2 : - return /* F32 */Block.__(2, [F32.zero]); - case 3 : - return /* F64 */Block.__(3, [F64.zero]); - - } -} - -function value_of_bool(b) { - return /* I32 */Block.__(0, [b ? 1 : 0]); -} - -function string_of_value(param) { - switch (param.tag | 0) { - case 0 : - return Curry._1(I32.to_string_s, param[0]); - case 1 : - return Curry._1(I64.to_string_s, param[0]); - case 2 : - return Curry._1(F32.to_string, param[0]); - case 3 : - return Curry._1(F64.to_string, param[0]); - - } -} - -function string_of_values(vs) { - var exit = 0; - if (vs) { - if (vs[1]) { - exit = 1; - } - else { - return string_of_value(vs[0]); - } - } - else { - exit = 1; - } - if (exit === 1) { - return "[" + ($$String.concat(" ", List.map(string_of_value, vs)) + "]"); - } - -} - -var Value = Caml_exceptions.create("Values.Value"); - -function to_value(i) { - return /* I32 */Block.__(0, [i]); -} - -function of_value(param) { - if (param.tag) { - throw [ - Value, - /* I32Type */0 - ]; - } - else { - return param[0]; - } -} - -var I32Value = /* module */[ - /* to_value */to_value, - /* of_value */of_value -]; - -function to_value$1(i) { - return /* I64 */Block.__(1, [i]); -} - -function of_value$1(param) { - if (param.tag === 1) { - return param[0]; - } - else { - throw [ - Value, - /* I64Type */1 - ]; - } -} - -var I64Value = /* module */[ - /* to_value */to_value$1, - /* of_value */of_value$1 -]; - -function to_value$2(i) { - return /* F32 */Block.__(2, [i]); -} - -function of_value$2(param) { - if (param.tag === 2) { - return param[0]; - } - else { - throw [ - Value, - /* F32Type */2 - ]; - } -} - -var F32Value = /* module */[ - /* to_value */to_value$2, - /* of_value */of_value$2 -]; - -function to_value$3(i) { - return /* F64 */Block.__(3, [i]); -} - -function of_value$3(param) { - if (param.tag === 3) { - return param[0]; - } - else { - throw [ - Value, - /* F64Type */3 - ]; - } -} - -var F64Value = /* module */[ - /* to_value */to_value$3, - /* of_value */of_value$3 -]; - -exports.type_of = type_of; -exports.default_value = default_value; -exports.value_of_bool = value_of_bool; -exports.string_of_value = string_of_value; -exports.string_of_values = string_of_values; -exports.Value = Value; -exports.I32Value = I32Value; -exports.I64Value = I64Value; -exports.F32Value = F32Value; -exports.F64Value = F64Value; -/* F32 Not a pure module */ -//////// end of values.js //////// -    return exports; -  }; - - - _registry['wasm'] = function() { -    let exports = {}; -//////// start of wasm.js //////// -// Generated by BUCKLESCRIPT VERSION 1.4.3 , PLEASE EDIT WITH CARE -'use strict'; - -var Parse = require("./parse"); -var Sexpr = require("./sexpr"); -var Decode = require("./decode"); -var Encode = require("./encode"); -var Arrange = require("./arrange"); -var Caml_int64 = require("bs-platform/lib/js/caml_int64"); -var Pervasives = require("bs-platform/lib/js/pervasives"); - -function encode(s) { - var def = Parse.string_to_module(s); - var match = def[/* it */1]; - if (match.tag) { - return match[1]; - } - else { - return Encode.encode(match[0]); - } -} - -function decode(s, width) { - var m = Decode.decode("(decode)", s); - return Sexpr.to_string(width, Arrange.module_(m)); -} - -function f(x) { - Pervasives.print_string("f"); - return x; -} - -function g(x) { - return Caml_int64.or_(x, (Pervasives.print_string("f"), x)); -} - -exports.encode = encode; -exports.decode = decode; -exports.f = f; -exports.g = g; -/* Parse Not a pure module */ -//////// end of wasm.js //////// -    return exports; -  }; - - - function binary(bytes) { - let buffer = new ArrayBuffer(bytes.length); - let view = new Uint8Array(buffer); - for (let i = 0; i < bytes.length; ++i) { - view[i] = bytes.charCodeAt(i); - } - return buffer; - } - function bytes(buffer) { - let string = ''; - let view = new Uint8Array(buffer); - for (let i = 0; i < view.length; ++i) { - string += String.fromCodePoint(view[i]); - } - return string; - } -  let Wasm = require('wasm'); - return { - encode(s) { return binary(Wasm.encode(s)) }, - decode(b, w = 80) { return Wasm.decode(bytes(b), w) } - }; -})(); - - diff --git a/test/html/indexeddb.js b/test/html/indexeddb.js deleted file mode 100644 index f6e18fb6..00000000 --- a/test/html/indexeddb.js +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright 2017 WebAssembly Community Group participants - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ - -(function testIndexedDB() { - const IDB_NAME = "spec-test"; - const OBJECT_STORE_NAME = "wasm"; - - let db = null; - - function openDB() { - console.log('Opening db...'); - return new Promise((resolve, reject) => { - request = indexedDB.open(IDB_NAME, 1); - request.onerror = reject; - request.onsuccess = () => { - db = request.result; - console.log('Retrieved db:', db); - resolve(); - }; - request.onupgradeneeded = () => { - console.log('Creating object store...'); - request.result.createObjectStore(OBJECT_STORE_NAME); - request.onerror = reject; - request.onupgradeneeded = reject; - request.onsuccess = () => { - db = request.result; - console.log('Created db:', db); - resolve(); - }; - }; - }); - } - - function getObjectStore() { - return db.transaction([OBJECT_STORE_NAME], "readwrite").objectStore(OBJECT_STORE_NAME); - } - - function clearStore() { - console.log('Clearing store...'); - return new Promise((resolve, reject) => { - var request = getObjectStore().clear(); - request.onerror = reject; - request.onupgradeneeded = reject; - request.onsuccess = resolve; - }); - } - - function makeModule() { - return new Promise(resolve => { - let builder = new WasmModuleBuilder(); - builder.addFunction('run', kSig_i_v) - .addBody([ - kExprI32Const, - 42, - kExprReturn, - kExprEnd - ]) - .exportFunc(); - let source = builder.toBuffer(); - - let module = new WebAssembly.Module(source); - let i = new WebAssembly.Instance(module); - assert_equals(i.exports.run(), 42); - - resolve(module); - }); - } - - function storeWasm(module) { - console.log('Storing wasm object...', module); - return new Promise((resolve, reject) => { - request = getObjectStore().add(module, 1); - request.onsuccess = resolve; - request.onerror = reject; - request.onupgradeneeded = reject; - }); - } - - function loadWasm() { - console.log('Loading wasm object...'); - return new Promise((resolve, reject) => { - var request = getObjectStore().get(1); - request.onsuccess = () => { - let i = new WebAssembly.Instance(request.result); - assert_equals(i.exports.run(), 42); - resolve(); - } - request.onerror = reject; - request.onupgradeneeded = reject; - }); - } - - function run() { - return openDB() - .then(() => clearStore()) - .then(() => makeModule()) - .then(wasm => storeWasm(wasm)) - .then(() => loadWasm()); - } - - promise_test(run, "store and load from indexeddb"); -})(); diff --git a/test/js-api/LICENSE.md b/test/js-api/LICENSE.md new file mode 100644 index 00000000..6b346a52 --- /dev/null +++ b/test/js-api/LICENSE.md @@ -0,0 +1,33 @@ +# Dual-License for W3C Test Suites + +All documents in this Repository are licensed by contributors to be distributed under both the [W3C Test Suite License](#w3c-test-suite-license) and the [W3C 3-clause BSD License](#w3c-3-clause-bsd-license), reproduced below. The choice of license is up to the licensee. For more information, see [Licenses for W3C Test Suites](https://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html) + +# W3C Test Suite License + +This document, Test Suites and other documents that link to this statement are provided by the copyright holders under the following license: By using and/or copying this document, or the W3C document from which this statement is linked, you (the licensee) agree that you have read, understood, and will comply with the following terms and conditions: + +Permission to copy, and distribute the contents of this document, or the W3C document from which this statement is linked, in any medium for any purpose and without fee or royalty is hereby granted, provided that you include the following on ALL copies of the document, or portions thereof, that you use: + +* A link or URL to the original W3C document. +* The pre-existing copyright notice of the original author, or if it doesn't exist, a notice (hypertext is preferred, but a textual representation is permitted) of the form: "Copyright © [$date-of-document] World Wide Web Consortium, (MIT, ERCIM, Keio, Beihang) and others. All Rights Reserved. http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html" +* If it exists, the STATUS of the W3C document. + +When space permits, inclusion of the full text of this NOTICE should be provided. We request that authorship attribution be provided in any software, documents, or other items or products that you create pursuant to the implementation of the contents of this document, or any portion thereof. + +No right to create modifications or derivatives of W3C documents is granted pursuant to this license. However, if additional requirements (documented in the Copyright FAQ) are satisfied, the right to create modifications or derivatives is sometimes granted by the W3C to individuals complying with those requirements. + +If a Test Suite distinguishes the test harness (or, framework for navigation) and the actual tests, permission is given to remove or alter the harness or navigation if the Test Suite in question allows to do so. The tests themselves shall NOT be changed in any way. + +The name and trademarks of W3C and other copyright holders may NOT be used in advertising or publicity pertaining to this document or other documents that link to this statement without specific, written prior permission. Title to copyright in this document will at all times remain with copyright holders. Permission is given to use the trademarked string "W3C" within claims of performance concerning W3C Specifications or features described therein, and there only, if the test suite so authorizes. + +THIS WORK IS PROVIDED BY W3C, MIT, ERCIM, KEIO, BEIHANG, THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL W3C, MIT, ERCIM, KEIO, BEIHANG, THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# W3C 3-clause BSD License + +Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: + +* Redistributions of works must retain the original copyright notice, this list of conditions and the following disclaimer. +* Redistributions in binary form must reproduce the original copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. +* Neither the name of the W3C nor the names of its contributors may be used to endorse or promote products derived from this work without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/test/js-api/README.md b/test/js-api/README.md index 7a874741..ca30ca42 100644 --- a/test/js-api/README.md +++ b/test/js-api/README.md @@ -1,19 +1,71 @@ -This directory contains tests specific to the JavaScript API to WebAssembly, as -described in [JS.md](https://github.com/WebAssembly/design/blob/master/JS.md). +This directory contains tests specific to the [JavaScript API] to WebAssembly. -## Harness +These tests exist in the [web-platform-tests project], and are included here +primarily to simplify sharing them between JavaScript engine implementers. These tests can be run in a pure JavaScript environment, that is, a JS shell -(like V8 or spidermonkey's shells), provided a few libraries and functions -emulating the -[testharness.js](http://testthewebforward.org/docs/testharness-library.html) -library. - -- The `../harness/index.js`, `../harness/wasm-constants.js` and - `../harness/wasm-module-builder.js` must be imported first. -- A function `test(function, description)` that tries to run the function under - a try/catch and maybe asserts in case of failure. -- A function `promise_test(function, description)` where `function` returns a - `Promise` run by `promise_test`; a rejection means a failure here. -- Assertion functions: `assert_equals(x, y)`, `assert_true(x)`, - `assert_false(x)`, `assert_unreached()`. +(like V8 or spidermonkey's shells), as well as in the browser. + +The tests use the [testharness.js] library and the [multi-global tests] setup +for smooth integrations with the web-platform-tests project and the existing +test infrastructure in implementations. + +## Metadata + +All tests must have the `.any.js` extension. + +In order to be run in the JavaScript shell, a metadata comment to add the +`jsshell` scope to the default set of scopes (`window` and `dedicatedworker`) +is required at the start of the file: + +```js +// META: global=jsshell +``` + +Additional JavaScript files can be imported with + +```js +// META: script=helper-file.js + +``` + +## Harness + +A single test file contains multiple subtests, which are created with one of +the following functions: + +- For synchronous tests: `test(function, name)` runs the function immediately. + The test fails if any assertion fails or an exception is thrown while calling + the function. +- For asynchronous tests: `promise_test(function, name)` where `function` + returns a `Promise`. The test fails if the returned `Promise` rejects. + +All assertions must be in one of those subtests. + +A number of assertion functions are provided, e.g.: + +- `assert_equals(x, y)`; +- `assert_not_equals(x, y)`; +- `assert_true(x)`; +- `assert_false(x)`; +- `assert_unreached()`; +- `assert_throws(error, function)`: checks if `function` throws an appropriate + exception (a typical value for `error` would be `new TypeError()`); +- `assert_class_string(object, class_name)`: checks if the result of calling + `Object.prototype.toString` on `object` uses `class_name`; +- `promise_rejects`: `assert_throws`, but for `Promise`s. + +All the above functions also take an optional trailing description argument. + +Non-trivial code that runs before the subtests should be put in the function +argument to `setup(function)`, to ensure any exceptions are handled gracefully. + +Finally, the harness also exposes a `format_value` function that provides a +helpful stringification of its argument. + +See the [testharness.js] documentation for more information. + +[JavaScript API]: https://webassembly.github.io/spec/js-api/ +[web-platform-tests project]: https://github.com/web-platform-tests/wpt/tree/master/wasm/jsapi +[testharness.js]: https://web-platform-tests.org/writing-tests/testharness-api.html +[multi-global tests]: https://web-platform-tests.org/writing-tests/testharness.html#multi-global-tests diff --git a/test/js-api/assertions.js b/test/js-api/assertions.js new file mode 100644 index 00000000..bda3ae7b --- /dev/null +++ b/test/js-api/assertions.js @@ -0,0 +1,73 @@ +function assert_function_name(fn, name, description) { + const propdesc = Object.getOwnPropertyDescriptor(fn, "name"); + assert_equals(typeof propdesc, "object", `${description} should have name property`); + assert_false(propdesc.writable, "writable", `${description} name should not be writable`); + assert_false(propdesc.enumerable, "enumerable", `${description} name should not be enumerable`); + assert_true(propdesc.configurable, "configurable", `${description} name should be configurable`); + assert_equals(propdesc.value, name, `${description} name should be ${name}`); +} + +function assert_function_length(fn, length, description) { + const propdesc = Object.getOwnPropertyDescriptor(fn, "length"); + assert_equals(typeof propdesc, "object", `${description} should have length property`); + assert_false(propdesc.writable, "writable", `${description} length should not be writable`); + assert_false(propdesc.enumerable, "enumerable", `${description} length should not be enumerable`); + assert_true(propdesc.configurable, "configurable", `${description} length should be configurable`); + assert_equals(propdesc.value, length, `${description} length should be ${length}`); +} + +function assert_exported_function(fn, { name, length }, description) { + assert_equals(Object.getPrototypeOf(fn), Function.prototype, + `${description}: prototype`); + + assert_function_name(fn, name, description); + assert_function_length(fn, length, description); +} + +function assert_Instance(instance, expected_exports) { + assert_equals(Object.getPrototypeOf(instance), WebAssembly.Instance.prototype, + "prototype"); + assert_true(Object.isExtensible(instance), "extensible"); + + assert_equals(instance.exports, instance.exports, "exports should be idempotent"); + const exports = instance.exports; + + assert_equals(Object.getPrototypeOf(exports), null, "exports prototype"); + assert_false(Object.isExtensible(exports), "extensible exports"); + for (const [key, expected] of Object.entries(expected_exports)) { + const property = Object.getOwnPropertyDescriptor(exports, key); + assert_equals(typeof property, "object", `${key} should be present`); + assert_false(property.writable, `${key}: writable`); + assert_true(property.enumerable, `${key}: enumerable`); + assert_false(property.configurable, `${key}: configurable`); + const actual = property.value; + assert_true(Object.isExtensible(actual), `${key}: extensible`); + + switch (expected.kind) { + case "function": + assert_exported_function(actual, expected, `value of ${key}`); + break; + case "global": + assert_equals(Object.getPrototypeOf(actual), WebAssembly.Global.prototype, + `value of ${key}: prototype`); + assert_equals(actual.value, expected.value, `value of ${key}: value`); + assert_equals(actual.valueOf(), expected.value, `value of ${key}: valueOf()`); + break; + case "memory": + assert_equals(Object.getPrototypeOf(actual), WebAssembly.Memory.prototype, + `value of ${key}: prototype`); + assert_equals(Object.getPrototypeOf(actual.buffer), ArrayBuffer.prototype, + `value of ${key}: prototype of buffer`); + assert_equals(actual.buffer.byteLength, 0x10000 * expected.size, `value of ${key}: size of buffer`); + const array = new Uint8Array(actual.buffer); + assert_equals(array[0], 0, `value of ${key}: first element of buffer`); + assert_equals(array[array.byteLength - 1], 0, `value of ${key}: last element of buffer`); + break; + case "table": + assert_equals(Object.getPrototypeOf(actual), WebAssembly.Table.prototype, + `value of ${key}: prototype`); + assert_equals(actual.length, expected.length, `value of ${key}: length of table`); + break; + } + } +} diff --git a/test/js-api/bad-imports.js b/test/js-api/bad-imports.js new file mode 100644 index 00000000..6c7d8056 --- /dev/null +++ b/test/js-api/bad-imports.js @@ -0,0 +1,152 @@ +/** + * `t` should be a function that takes at least three arguments: + * + * - the name of the test; + * - the expected error (to be passed to `assert_throws` or similar); + * - a function that takes a `WasmModuleBuilder` and initializes it; + * - (optionally) an options object. + * + * The function is expected to create a test that checks if instantiating a + * module with the result of the `WasmModuleBuilder` and the options object + * (if any) yields the correct error. + */ +function test_bad_imports(t) { + for (const value of [null, true, "", Symbol(), 1, 0.1, NaN]) { + t(`Non-object imports argument: ${format_value(value)}`, + new TypeError(), + builder => {}, + value); + } + + for (const value of [undefined, null, true, "", Symbol(), 1, 0.1, NaN]) { + const imports = { + "module": value, + }; + t(`Non-object module: ${format_value(value)}`, + new TypeError(), + builder => { + builder.addImport("module", "fn", kSig_v_v); + }, + imports); + } + + t(`Missing imports argument`, + new TypeError(), + builder => { + builder.addImport("module", "fn", kSig_v_v); + }); + + for (const [value, name] of [[undefined, "undefined"], [{}, "empty object"], [{ "module\0": null }, "wrong property"]]) { + t(`Imports argument with missing property: ${name}`, + new TypeError(), + builder => { + builder.addImport("module", "fn", kSig_v_v); + }, + value); + } + + t(`Importing an i64 global`, + new WebAssembly.LinkError(), + builder => { + builder.addImportedGlobal("module", "global", kWasmI64); + }, + { + "module": { + "global": 0, + }, + }); + + for (const value of [undefined, null, true, "", Symbol(), 1, 0.1, NaN, {}]) { + t(`Importing a function with an incorrectly-typed value: ${format_value(value)}`, + new WebAssembly.LinkError(), + builder => { + builder.addImport("module", "fn", kSig_v_v); + }, + { + "module": { + "fn": value, + }, + }); + } + + const nonGlobals = [ + [undefined], + [null], + [true], + [""], + [Symbol()], + [{}, "plain object"], + [WebAssembly.Global, "WebAssembly.Global"], + [WebAssembly.Global.prototype, "WebAssembly.Global.prototype"], + [Object.create(WebAssembly.Global.prototype), "Object.create(WebAssembly.Global.prototype)"], + ]; + + for (const [value, name = format_value(value)] of nonGlobals) { + t(`Importing a global with an incorrectly-typed value: ${name}`, + new WebAssembly.LinkError(), + builder => { + builder.addImportedGlobal("module", "global", kWasmI32); + }, + { + "module": { + "global": value, + }, + }); + } + + const nonMemories = [ + [undefined], + [null], + [true], + [""], + [Symbol()], + [1], + [0.1], + [NaN], + [{}, "plain object"], + [WebAssembly.Memory, "WebAssembly.Memory"], + [WebAssembly.Memory.prototype, "WebAssembly.Memory.prototype"], + [Object.create(WebAssembly.Memory.prototype), "Object.create(WebAssembly.Memory.prototype)"], + ]; + + for (const [value, name = format_value(value)] of nonMemories) { + t(`Importing memory with an incorrectly-typed value: ${name}`, + new WebAssembly.LinkError(), + builder => { + builder.addImportedMemory("module", "memory", 0, 128); + }, + { + "module": { + "memory": value, + }, + }); + } + + const nonTables = [ + [undefined], + [null], + [true], + [""], + [Symbol()], + [1], + [0.1], + [NaN], + [{}, "plain object"], + [WebAssembly.Table, "WebAssembly.Table"], + [WebAssembly.Table.prototype, "WebAssembly.Table.prototype"], + [Object.create(WebAssembly.Table.prototype), "Object.create(WebAssembly.Table.prototype)"], + ]; + + for (const [value, name = format_value(value)] of nonTables) { + t(`Importing table with an incorrectly-typed value: ${name}`, + new WebAssembly.LinkError(), + builder => { + builder.addImportedTable("module", "table", 0, 128); + }, + { + "module": { + "table": value, + }, + }); + } +} diff --git a/test/js-api/constructor/compile.any.js b/test/js-api/constructor/compile.any.js new file mode 100644 index 00000000..5288d971 --- /dev/null +++ b/test/js-api/constructor/compile.any.js @@ -0,0 +1,80 @@ +// META: global=jsshell +// META: script=/wasm/jsapi/wasm-module-builder.js + +function assert_Module(module) { + assert_equals(Object.getPrototypeOf(module), WebAssembly.Module.prototype, + "Prototype"); + assert_true(Object.isExtensible(module), "Extensibility"); +} + +let emptyModuleBinary; +setup(() => { + emptyModuleBinary = new WasmModuleBuilder().toBuffer(); +}); + +promise_test(t => { + return promise_rejects(t, new TypeError(), WebAssembly.compile()); +}, "Missing argument"); + +promise_test(t => { + const invalidArguments = [ + undefined, + null, + true, + "", + Symbol(), + 1, + {}, + ArrayBuffer, + ArrayBuffer.prototype, + Array.from(emptyModuleBinary), + ]; + return Promise.all(invalidArguments.map(argument => { + return promise_rejects(t, new TypeError(), WebAssembly.compile(argument), + `compile(${format_value(argument)})`); + })); +}, "Invalid arguments"); + +promise_test(() => { + const fn = WebAssembly.compile; + const thisValues = [ + undefined, + null, + true, + "", + Symbol(), + 1, + {}, + WebAssembly, + ]; + return Promise.all(thisValues.map(thisValue => { + return fn.call(thisValue, emptyModuleBinary).then(assert_Module); + })); +}, "Branding"); + +test(() => { + const promise = WebAssembly.compile(emptyModuleBinary); + assert_equals(Object.getPrototypeOf(promise), Promise.prototype, "prototype"); + assert_true(Object.isExtensible(promise), "extensibility"); +}, "Promise type"); + +promise_test(t => { + const buffer = new Uint8Array(); + return promise_rejects(t, new WebAssembly.CompileError(), WebAssembly.compile(buffer)); +}, "Invalid code"); + +promise_test(() => { + return WebAssembly.compile(emptyModuleBinary).then(assert_Module); +}, "Result type"); + +promise_test(() => { + return WebAssembly.compile(emptyModuleBinary, {}).then(assert_Module); +}, "Stray argument"); + +promise_test(() => { + const buffer = new WasmModuleBuilder().toBuffer(); + assert_equals(buffer[0], 0); + const promise = WebAssembly.compile(buffer); + buffer[0] = 1; + return promise.then(assert_Module); +}, "Changing the buffer"); diff --git a/test/js-api/constructor/instantiate-bad-imports.any.js b/test/js-api/constructor/instantiate-bad-imports.any.js new file mode 100644 index 00000000..1eaefdfb --- /dev/null +++ b/test/js-api/constructor/instantiate-bad-imports.any.js @@ -0,0 +1,22 @@ +// META: global=jsshell +// META: script=/wasm/jsapi/wasm-module-builder.js +// META: script=/wasm/jsapi/bad-imports.js + +test_bad_imports((name, error, build, ...arguments) => { + promise_test(t => { + const builder = new WasmModuleBuilder(); + build(builder); + const buffer = builder.toBuffer(); + const module = new WebAssembly.Module(buffer); + return promise_rejects(t, error, WebAssembly.instantiate(module, ...arguments)); + }, `WebAssembly.instantiate(module): ${name}`); +}); + +test_bad_imports((name, error, build, ...arguments) => { + promise_test(t => { + const builder = new WasmModuleBuilder(); + build(builder); + const buffer = builder.toBuffer(); + return promise_rejects(t, error, WebAssembly.instantiate(buffer, ...arguments)); + }, `WebAssembly.instantiate(buffer): ${name}`); +}); diff --git a/test/js-api/constructor/instantiate.any.js b/test/js-api/constructor/instantiate.any.js new file mode 100644 index 00000000..49499127 --- /dev/null +++ b/test/js-api/constructor/instantiate.any.js @@ -0,0 +1,168 @@ +// META: global=jsshell +// META: script=/wasm/jsapi/wasm-module-builder.js +// META: script=/wasm/jsapi/assertions.js +// META: script=/wasm/jsapi/instanceTestFactory.js + +function assert_WebAssemblyInstantiatedSource(actual, expected_exports={}) { + assert_equals(Object.getPrototypeOf(actual), Object.prototype, + "Prototype"); + assert_true(Object.isExtensible(actual), "Extensibility"); + + const module = Object.getOwnPropertyDescriptor(actual, "module"); + assert_equals(typeof module, "object", "module: type of descriptor"); + assert_true(module.writable, "module: writable"); + assert_true(module.enumerable, "module: enumerable"); + assert_true(module.configurable, "module: configurable"); + assert_equals(Object.getPrototypeOf(module.value), WebAssembly.Module.prototype, + "module: prototype"); + + const instance = Object.getOwnPropertyDescriptor(actual, "instance"); + assert_equals(typeof instance, "object", "instance: type of descriptor"); + assert_true(instance.writable, "instance: writable"); + assert_true(instance.enumerable, "instance: enumerable"); + assert_true(instance.configurable, "instance: configurable"); + assert_Instance(instance.value, expected_exports); +} + +let emptyModuleBinary; +setup(() => { + emptyModuleBinary = new WasmModuleBuilder().toBuffer(); +}); + +promise_test(t => { + return promise_rejects(t, new TypeError(), WebAssembly.instantiate()); +}, "Missing arguments"); + +promise_test(() => { + const fn = WebAssembly.instantiate; + const thisValues = [ + undefined, + null, + true, + "", + Symbol(), + 1, + {}, + WebAssembly, + ]; + return Promise.all(thisValues.map(thisValue => { + return fn.call(thisValue, emptyModuleBinary).then(assert_WebAssemblyInstantiatedSource); + })); +}, "Branding"); + +promise_test(t => { + const invalidArguments = [ + undefined, + null, + true, + "", + Symbol(), + 1, + {}, + WebAssembly.Module, + WebAssembly.Module.prototype, + ArrayBuffer, + ArrayBuffer.prototype, + Array.from(emptyModuleBinary), + ]; + return Promise.all(invalidArguments.map(argument => { + return promise_rejects(t, new TypeError(), WebAssembly.instantiate(argument), + `instantiate(${format_value(argument)})`); + })); +}, "Invalid arguments"); + +test(() => { + const promise = WebAssembly.instantiate(emptyModuleBinary); + assert_equals(Object.getPrototypeOf(promise), Promise.prototype, "prototype"); + assert_true(Object.isExtensible(promise), "extensibility"); +}, "Promise type"); + +for (const [name, fn] of instanceTestFactory) { + promise_test(() => { + const { buffer, args, exports, verify } = fn(); + return WebAssembly.instantiate(buffer, ...args).then(result => { + assert_WebAssemblyInstantiatedSource(result, exports); + verify(result.instance); + }); + }, `${name}: BufferSource argument`); + + promise_test(() => { + const { buffer, args, exports, verify } = fn(); + const module = new WebAssembly.Module(buffer); + return WebAssembly.instantiate(module, ...args).then(instance => { + assert_Instance(instance, exports); + verify(instance); + }); + }, `${name}: Module argument`); +} + +promise_test(() => { + const builder = new WasmModuleBuilder(); + builder.addImportedGlobal("module", "global", kWasmI32); + const buffer = builder.toBuffer(); + const order = []; + + const imports = { + get module() { + order.push("module getter"); + return { + get global() { + order.push("global getter"); + return 0; + }, + } + }, + }; + + const expected = [ + "module getter", + "global getter", + ]; + const p = WebAssembly.instantiate(buffer, imports); + assert_array_equals(order, []); + return p.then(result => { + assert_WebAssemblyInstantiatedSource(result); + assert_array_equals(order, expected); + }); +}, "Synchronous options handling: Buffer argument"); + +promise_test(() => { + const builder = new WasmModuleBuilder(); + builder.addImportedGlobal("module", "global", kWasmI32); + const buffer = builder.toBuffer(); + const module = new WebAssembly.Module(buffer); + const order = []; + + const imports = { + get module() { + order.push("module getter"); + return { + get global() { + order.push("global getter"); + return 0; + }, + } + }, + }; + + const expected = [ + "module getter", + "global getter", + ]; + const p = WebAssembly.instantiate(module, imports); + assert_array_equals(order, expected); + return p.then(instance => assert_Instance(instance, {})); +}, "Synchronous options handling: Module argument"); + +promise_test(t => { + const buffer = new Uint8Array(); + return promise_rejects(t, new WebAssembly.CompileError(), WebAssembly.instantiate(buffer)); +}, "Invalid code"); + +promise_test(() => { + const buffer = new WasmModuleBuilder().toBuffer(); + assert_equals(buffer[0], 0); + const promise = WebAssembly.instantiate(buffer); + buffer[0] = 1; + return promise.then(assert_WebAssemblyInstantiatedSource); +}, "Changing the buffer"); diff --git a/test/js-api/constructor/validate.any.js b/test/js-api/constructor/validate.any.js new file mode 100644 index 00000000..57fa3359 --- /dev/null +++ b/test/js-api/constructor/validate.any.js @@ -0,0 +1,99 @@ +// META: global=jsshell +// META: script=/wasm/jsapi/wasm-module-builder.js + +let emptyModuleBinary; +setup(() => { + emptyModuleBinary = new WasmModuleBuilder().toBuffer(); +}); + +test(() => { + assert_throws(new TypeError(), () => WebAssembly.validate()); +}, "Missing argument"); + +test(() => { + const invalidArguments = [ + undefined, + null, + true, + "", + Symbol(), + 1, + {}, + ArrayBuffer, + ArrayBuffer.prototype, + Array.from(emptyModuleBinary), + ]; + for (const argument of invalidArguments) { + assert_throws(new TypeError(), () => WebAssembly.validate(argument), + `validate(${format_value(argument)})`); + } +}, "Invalid arguments"); + +test(() => { + const fn = WebAssembly.validate; + const thisValues = [ + undefined, + null, + true, + "", + Symbol(), + 1, + {}, + WebAssembly, + ]; + for (const thisValue of thisValues) { + assert_true(fn.call(thisValue, emptyModuleBinary), `this=${format_value(thisValue)}`); + } +}, "Branding"); + +const modules = [ + // Incomplete header. + [[], false], + [[0x00], false], + [[0x00, 0x61], false], + [[0x00, 0x61, 0x73], false], + [[0x00, 0x61, 0x73, 0x6d], false], + [[0x00, 0x61, 0x73, 0x6d, 0x01], false], + [[0x00, 0x61, 0x73, 0x6d, 0x01, 0x00], false], + [[0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00], false], + + // Complete header. + [[0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00], true], + + // Invalid version. + [[0x00, 0x61, 0x73, 0x6d, 0x00, 0x00, 0x00, 0x00], false], + [[0x00, 0x61, 0x73, 0x6d, 0x02, 0x00, 0x00, 0x00], false], + + // Nameless custom section. + [[0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00], false], + + // Custom section with empty name. + [[0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00], true], + + // Custom section with name "a". + [[0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x01, 0x61], true], +]; +const bufferTypes = [ + Uint8Array, + Int8Array, + Uint16Array, + Int16Array, + Uint32Array, + Int32Array, +]; +for (const [module, expected] of modules) { + const name = module.map(n => n.toString(16)).join(" "); + for (const bufferType of bufferTypes) { + if (module.length % bufferType.BYTES_PER_ELEMENT === 0) { + test(() => { + const bytes = new Uint8Array(module); + const moduleBuffer = new bufferType(bytes.buffer); + assert_equals(WebAssembly.validate(moduleBuffer), expected); + }, `Validating module [${name}] in ${bufferType.name}`); + } + } +} + +test(() => { + assert_true(WebAssembly.validate(emptyModuleBinary, {})); +}, "Stray argument"); diff --git a/test/js-api/global/constructor.any.js b/test/js-api/global/constructor.any.js new file mode 100644 index 00000000..237f99c8 --- /dev/null +++ b/test/js-api/global/constructor.any.js @@ -0,0 +1,127 @@ +// META: global=jsshell +// META: script=/wasm/jsapi/assertions.js + +function assert_Global(actual, expected) { + assert_equals(Object.getPrototypeOf(actual), WebAssembly.Global.prototype, + "prototype"); + assert_true(Object.isExtensible(actual), "extensible"); + + assert_equals(actual.value, expected, "value"); + assert_equals(actual.valueOf(), expected, "valueOf"); +} + +test(() => { + assert_function_name(WebAssembly.Global, "Global", "WebAssembly.Global"); +}, "name"); + +test(() => { + assert_function_length(WebAssembly.Global, 1, "WebAssembly.Global"); +}, "length"); + +test(() => { + assert_throws(new TypeError(), () => new WebAssembly.Global()); +}, "No arguments"); + +test(() => { + const argument = { "value": "i32" }; + assert_throws(new TypeError(), () => WebAssembly.Global(argument)); +}, "Calling"); + +test(() => { + const order = []; + + new WebAssembly.Global({ + get value() { + order.push("descriptor value"); + return { + toString() { + order.push("descriptor value toString"); + return "f64"; + }, + }; + }, + + get mutable() { + order.push("descriptor mutable"); + return false; + }, + }, { + valueOf() { + order.push("value valueOf()"); + } + }); + + assert_array_equals(order, [ + "descriptor mutable", + "descriptor value", + "descriptor value toString", + "value valueOf()", + ]); +}, "Order of evaluation"); + +test(() => { + const invalidArguments = [ + undefined, + null, + false, + true, + "", + "test", + Symbol(), + 1, + NaN, + {}, + ]; + for (const invalidArgument of invalidArguments) { + assert_throws(new TypeError(), + () => new WebAssembly.Global(invalidArgument), + `new Global(${format_value(invalidArgument)})`); + } +}, "Invalid descriptor argument"); + +test(() => { + const invalidTypes = ["i16", "i128", "f16", "f128", "u32", "u64", "i32\0"]; + for (const value of invalidTypes) { + const argument = { value }; + assert_throws(new TypeError(), () => new WebAssembly.Global(argument)); + } +}, "Invalid type argument"); + +test(() => { + const argument = { "value": "i64" }; + const global = new WebAssembly.Global(argument); + assert_throws(new TypeError(), () => global.value); + assert_throws(new TypeError(), () => global.valueOf()); +}, "i64 with default"); + +for (const type of ["i32", "f32", "f64"]) { + test(() => { + const argument = { "value": type }; + const global = new WebAssembly.Global(argument); + assert_Global(global, 0); + }, `Default value for type ${type}`); + + const valueArguments = [ + [undefined, 0], + [null, 0], + [true, 1], + [false, 0], + [2, 2], + ["3", 3], + [{ toString() { return "5" } }, 5, "object with toString"], + [{ valueOf() { return "8" } }, 8, "object with valueOf"], + ]; + for (const [value, expected, name = format_value(value)] of valueArguments) { + test(() => { + const argument = { "value": type }; + const global = new WebAssembly.Global(argument, value); + assert_Global(global, expected); + }, `Explicit value ${name} for type ${type}`); + } +} + +test(() => { + const argument = { "value": "i32" }; + const global = new WebAssembly.Global(argument, 0, {}); + assert_Global(global, 0); +}, "Stray argument"); diff --git a/test/js-api/global/toString.any.js b/test/js-api/global/toString.any.js new file mode 100644 index 00000000..ca025576 --- /dev/null +++ b/test/js-api/global/toString.any.js @@ -0,0 +1,7 @@ +// META: global=jsshell + +test(() => { + const argument = { "value": "i32" }; + const global = new WebAssembly.Global(argument); + assert_class_string(global, "WebAssembly.Global"); +}, "Object.prototype.toString on an Global"); diff --git a/test/js-api/global/value-get-set.any.js b/test/js-api/global/value-get-set.any.js new file mode 100644 index 00000000..6de62d5f --- /dev/null +++ b/test/js-api/global/value-get-set.any.js @@ -0,0 +1,111 @@ +// META: global=jsshell + +test(() => { + const thisValues = [ + undefined, + null, + true, + "", + Symbol(), + 1, + {}, + WebAssembly.Global, + WebAssembly.Global.prototype, + ]; + + const desc = Object.getOwnPropertyDescriptor(WebAssembly.Global.prototype, "value"); + assert_equals(typeof desc, "object"); + + const getter = desc.get; + assert_equals(typeof getter, "function"); + + const setter = desc.set; + assert_equals(typeof setter, "function"); + + for (const thisValue of thisValues) { + assert_throws(new TypeError(), () => getter.call(thisValue), `getter with this=${format_value(thisValue)}`); + assert_throws(new TypeError(), () => setter.call(thisValue, 1), `setter with this=${format_value(thisValue)}`); + } +}, "Branding"); + +for (const type of ["i32", "f32", "f64"]) { + const immutableOptions = [ + [{}, "missing"], + [{ "mutable": undefined }, "undefined"], + [{ "mutable": null }, "null"], + [{ "mutable": false }, "false"], + [{ "mutable": "" }, "empty string"], + [{ "mutable": 0 }, "zero"], + ]; + for (const [opts, name] of immutableOptions) { + test(() => { + opts.value = type; + const global = new WebAssembly.Global(opts); + assert_equals(global.value, 0, "initial value"); + assert_equals(global.valueOf(), 0, "initial valueOf"); + + assert_throws(new TypeError(), () => global.value = 1); + + assert_equals(global.value, 0, "post-set value"); + assert_equals(global.valueOf(), 0, "post-set valueOf"); + }, `Immutable ${type} (${name})`); + } + + const mutableOptions = [ + [{ "mutable": true }, "true"], + [{ "mutable": 1 }, "one"], + [{ "mutable": "x" }, "string"], + [Object.create({ "mutable": true }), "true on prototype"], + ]; + for (const [opts, name] of mutableOptions) { + test(() => { + opts.value = type; + const global = new WebAssembly.Global(opts); + assert_equals(global.value, 0, "initial value"); + assert_equals(global.valueOf(), 0, "initial valueOf"); + + global.value = 1; + + assert_equals(global.value, 1, "post-set value"); + assert_equals(global.valueOf(), 1, "post-set valueOf"); + }, `Mutable ${type} (${name})`); + } +} + +test(() => { + const argument = { "value": "i64", "mutable": true }; + const global = new WebAssembly.Global(argument); + assert_throws(new TypeError(), () => global.value); + assert_throws(new TypeError(), () => global.value = 0); + assert_throws(new TypeError(), () => global.valueOf()); +}, "i64 with default"); + + +test(() => { + const argument = { "value": "i32", "mutable": true }; + const global = new WebAssembly.Global(argument); + const desc = Object.getOwnPropertyDescriptor(WebAssembly.Global.prototype, "value"); + assert_equals(typeof desc, "object"); + + const setter = desc.set; + assert_equals(typeof setter, "function"); + + assert_throws(new TypeError(), () => setter.call(global)); +}, "Calling setter without argument"); + +test(() => { + const argument = { "value": "i32", "mutable": true }; + const global = new WebAssembly.Global(argument); + const desc = Object.getOwnPropertyDescriptor(WebAssembly.Global.prototype, "value"); + assert_equals(typeof desc, "object"); + + const getter = desc.get; + assert_equals(typeof getter, "function"); + + const setter = desc.set; + assert_equals(typeof setter, "function"); + + assert_equals(getter.call(global, {}), 0); + assert_equals(setter.call(global, 1, {}), undefined); + assert_equals(global.value, 1); +}, "Stray argument"); diff --git a/test/js-api/global/valueOf.any.js b/test/js-api/global/valueOf.any.js new file mode 100644 index 00000000..d4a84b25 --- /dev/null +++ b/test/js-api/global/valueOf.any.js @@ -0,0 +1,28 @@ +// META: global=jsshell + +test(() => { + const argument = { "value": "i32" }; + const thisValues = [ + undefined, + null, + true, + "", + Symbol(), + 1, + {}, + WebAssembly.Global, + WebAssembly.Global.prototype, + ]; + + const fn = WebAssembly.Global.prototype.valueOf; + + for (const thisValue of thisValues) { + assert_throws(new TypeError(), () => fn.call(thisValue), `this=${format_value(thisValue)}`); + } +}, "Branding"); + +test(() => { + const argument = { "value": "i32" }; + const global = new WebAssembly.Global(argument, 0); + assert_equals(global.valueOf({}), 0); +}, "Stray argument"); diff --git a/test/js-api/instance/constructor-bad-imports.any.js b/test/js-api/instance/constructor-bad-imports.any.js new file mode 100644 index 00000000..b90ada25 --- /dev/null +++ b/test/js-api/instance/constructor-bad-imports.any.js @@ -0,0 +1,13 @@ +// META: global=jsshell +// META: script=/wasm/jsapi/wasm-module-builder.js +// META: script=/wasm/jsapi/bad-imports.js + +test_bad_imports((name, error, build, ...arguments) => { + test(() => { + const builder = new WasmModuleBuilder(); + build(builder); + const buffer = builder.toBuffer(); + const module = new WebAssembly.Module(buffer); + assert_throws(error, () => new WebAssembly.Instance(module, ...arguments)); + }, `new WebAssembly.Instance(module): ${name}`); +}); diff --git a/test/js-api/instance/constructor.any.js b/test/js-api/instance/constructor.any.js new file mode 100644 index 00000000..1ce4de90 --- /dev/null +++ b/test/js-api/instance/constructor.any.js @@ -0,0 +1,54 @@ +// META: global=jsshell +// META: script=/wasm/jsapi/wasm-module-builder.js +// META: script=/wasm/jsapi/assertions.js +// META: script=/wasm/jsapi/instanceTestFactory.js + +let emptyModuleBinary; +setup(() => { + emptyModuleBinary = new WasmModuleBuilder().toBuffer(); +}); + +test(() => { + assert_function_name(WebAssembly.Instance, "Instance", "WebAssembly.Instance"); +}, "name"); + +test(() => { + assert_function_length(WebAssembly.Instance, 1, "WebAssembly.Instance"); +}, "length"); + +test(() => { + assert_throws(new TypeError(), () => new WebAssembly.Instance()); +}, "No arguments"); + +test(() => { + const invalidArguments = [ + undefined, + null, + true, + "", + Symbol(), + 1, + {}, + WebAssembly.Module, + WebAssembly.Module.prototype, + ]; + for (const argument of invalidArguments) { + assert_throws(new TypeError(), () => new WebAssembly.Instance(argument), + `new Instance(${format_value(argument)})`); + } +}, "Non-Module arguments"); + +test(() => { + const module = new WebAssembly.Module(emptyModuleBinary); + assert_throws(new TypeError(), () => WebAssembly.Instance(module)); +}, "Calling"); + +for (const [name, fn] of instanceTestFactory) { + test(() => { + const { buffer, args, exports, verify } = fn(); + const module = new WebAssembly.Module(buffer); + const instance = new WebAssembly.Instance(module, ...args); + assert_Instance(instance, exports); + verify(instance); + }, name); +} diff --git a/test/js-api/instance/exports.any.js b/test/js-api/instance/exports.any.js new file mode 100644 index 00000000..2ba57c5e --- /dev/null +++ b/test/js-api/instance/exports.any.js @@ -0,0 +1,66 @@ +// META: global=jsshell +// META: script=/wasm/jsapi/wasm-module-builder.js + +let emptyModuleBinary; +setup(() => { + emptyModuleBinary = new WasmModuleBuilder().toBuffer(); +}); + +test(() => { + const thisValues = [ + undefined, + null, + true, + "", + Symbol(), + 1, + {}, + WebAssembly.Instance, + WebAssembly.Instance.prototype, + ]; + + const desc = Object.getOwnPropertyDescriptor(WebAssembly.Instance.prototype, "exports"); + assert_equals(typeof desc, "object"); + + const getter = desc.get; + assert_equals(typeof getter, "function"); + + assert_equals(typeof desc.set, "undefined"); + + for (const thisValue of thisValues) { + assert_throws(new TypeError(), () => getter.call(thisValue), `this=${format_value(thisValue)}`); + } +}, "Branding"); + +test(() => { + const module = new WebAssembly.Module(emptyModuleBinary); + const instance = new WebAssembly.Instance(module); + const exports = instance.exports; + + const desc = Object.getOwnPropertyDescriptor(WebAssembly.Instance.prototype, "exports"); + assert_equals(typeof desc, "object"); + + const getter = desc.get; + assert_equals(typeof getter, "function"); + + assert_equals(getter.call(instance, {}), exports); +}, "Stray argument"); + +test(() => { + const module = new WebAssembly.Module(emptyModuleBinary); + const instance = new WebAssembly.Instance(module); + const exports = instance.exports; + instance.exports = {}; + assert_equals(instance.exports, exports, "Should not change the exports"); +}, "Setting (sloppy mode)"); + +test(() => { + const module = new WebAssembly.Module(emptyModuleBinary); + const instance = new WebAssembly.Instance(module); + const exports = instance.exports; + assert_throws(new TypeError(), () => { + "use strict"; + instance.exports = {}; + }); + assert_equals(instance.exports, exports, "Should not change the exports"); +}, "Setting (strict mode)"); diff --git a/test/js-api/instance/toString.any.js b/test/js-api/instance/toString.any.js new file mode 100644 index 00000000..ccd665eb --- /dev/null +++ b/test/js-api/instance/toString.any.js @@ -0,0 +1,9 @@ +// META: global=jsshell +// META: script=/wasm/jsapi/wasm-module-builder.js + +test(() => { + const emptyModuleBinary = new WasmModuleBuilder().toBuffer(); + const module = new WebAssembly.Module(emptyModuleBinary); + const instance = new WebAssembly.Instance(module); + assert_class_string(instance, "WebAssembly.Instance"); +}, "Object.prototype.toString on an Instance"); diff --git a/test/js-api/instanceTestFactory.js b/test/js-api/instanceTestFactory.js new file mode 100644 index 00000000..7ccf06c2 --- /dev/null +++ b/test/js-api/instanceTestFactory.js @@ -0,0 +1,224 @@ +const instanceTestFactory = [ + [ + "Empty module without imports argument", + function() { + return { + buffer: emptyModuleBinary, + args: [], + exports: {}, + verify: () => {}, + }; + } + ], + + [ + "Empty module with undefined imports argument", + function() { + return { + buffer: emptyModuleBinary, + args: [undefined], + exports: {}, + verify: () => {}, + }; + } + ], + + [ + "Empty module with empty imports argument", + function() { + return { + buffer: emptyModuleBinary, + args: [{}], + exports: {}, + verify: () => {}, + }; + } + ], + + [ + "getter order for imports object", + function() { + const builder = new WasmModuleBuilder(); + builder.addImportedGlobal("module", "global1", kWasmI32); + builder.addImportedGlobal("module2", "global3", kWasmI32); + builder.addImportedMemory("module", "memory", 0, 128); + builder.addImportedGlobal("module", "global2", kWasmI32); + const buffer = builder.toBuffer(); + const order = []; + + const imports = { + get module() { + order.push("module getter"); + return { + get global1() { + order.push("global1 getter"); + return 0; + }, + get global2() { + order.push("global2 getter"); + return 0; + }, + get memory() { + order.push("memory getter"); + return new WebAssembly.Memory({ "initial": 64, maximum: 128 }); + }, + } + }, + get module2() { + order.push("module2 getter"); + return { + get global3() { + order.push("global3 getter"); + return 0; + }, + } + }, + }; + + const expected = [ + "module getter", + "global1 getter", + "module2 getter", + "global3 getter", + "module getter", + "memory getter", + "module getter", + "global2 getter", + ]; + return { + buffer, + args: [imports], + exports: {}, + verify: () => assert_array_equals(order, expected), + }; + } + ], + + [ + "imports", + function() { + const builder = new WasmModuleBuilder(); + + builder.addImport("module", "fn", kSig_v_v); + builder.addImportedGlobal("module", "global", kWasmI32); + builder.addImportedMemory("module", "memory", 0, 128); + builder.addImportedTable("module", "table", 0, 128); + + const buffer = builder.toBuffer(); + const imports = { + "module": { + "fn": function() {}, + "global": 0, + "memory": new WebAssembly.Memory({ "initial": 64, maximum: 128 }), + "table": new WebAssembly.Table({ "element": "anyfunc", "initial": 64, maximum: 128 }), + }, + get "module2"() { + assert_unreached("Should not get modules that are not imported"); + }, + }; + + return { + buffer, + args: [imports], + exports: {}, + verify: () => {}, + }; + } + ], + + [ + "No imports", + function() { + const builder = new WasmModuleBuilder(); + + builder + .addFunction("fn", kSig_v_d) + .addBody([]) + .exportFunc(); + builder + .addFunction("fn2", kSig_v_v) + .addBody([]) + .exportFunc(); + + builder.setTableBounds(1); + builder.addExportOfKind("table", kExternalTable, 0); + + builder.addGlobal(kWasmI32, true) + .exportAs("global") + .init = 7; + builder.addGlobal(kWasmF64, true) + .exportAs("global2") + .init = 1.2; + + builder.addMemory(4, 8, true); + + const buffer = builder.toBuffer(); + + const exports = { + "fn": { "kind": "function", "name": "0", "length": 1 }, + "fn2": { "kind": "function", "name": "1", "length": 0 }, + "table": { "kind": "table", "length": 1 }, + "global": { "kind": "global", "value": 7 }, + "global2": { "kind": "global", "value": 1.2 }, + "memory": { "kind": "memory", "size": 4 }, + }; + + return { + buffer, + args: [], + exports, + verify: () => {}, + }; + } + ], + + [ + "exports and imports", + function() { + const value = 102; + + const builder = new WasmModuleBuilder(); + + const index = builder.addImportedGlobal("module", "global", kWasmI32); + builder + .addFunction("fn", kSig_i_v) + .addBody([ + kExprGetGlobal, + index, + kExprReturn, + ]) + .exportFunc(); + + const buffer = builder.toBuffer(); + + const imports = { + "module": { + "global": value, + }, + }; + + const exports = { + "fn": { "kind": "function", "name": "0", "length": 0 }, + }; + + return { + buffer, + args: [imports], + exports, + verify: instance => assert_equals(instance.exports.fn(), value) + }; + } + ], + + [ + "stray argument", + function() { + return { + buffer: emptyModuleBinary, + args: [{}, {}], + exports: {}, + verify: () => {} + }; + } + ], +]; diff --git a/test/js-api/interface.any.js b/test/js-api/interface.any.js new file mode 100644 index 00000000..98c4a1d7 --- /dev/null +++ b/test/js-api/interface.any.js @@ -0,0 +1,160 @@ +// META: global=jsshell +// META: script=/wasm/jsapi/assertions.js + +function test_operations(object, object_name, operations) { + for (const [name, length] of operations) { + test(() => { + const propdesc = Object.getOwnPropertyDescriptor(object, name); + assert_equals(typeof propdesc, "object"); + assert_true(propdesc.writable, "writable"); + assert_true(propdesc.enumerable, "enumerable"); + assert_true(propdesc.configurable, "configurable"); + assert_equals(propdesc.value, object[name]); + }, `${object_name}.${name}`); + + test(() => { + assert_function_name(object[name], name, `${object_name}.${name}`); + }, `${object_name}.${name}: name`); + + test(() => { + assert_function_length(object[name], length, `${object_name}.${name}`); + }, `${object_name}.${name}: length`); + } +} + +function test_attributes(object, object_name, attributes) { + for (const [name, mutable] of attributes) { + test(() => { + const propdesc = Object.getOwnPropertyDescriptor(object, name); + assert_equals(typeof propdesc, "object"); + assert_true(propdesc.enumerable, "enumerable"); + assert_true(propdesc.configurable, "configurable"); + }, `${object_name}.${name}`); + + test(() => { + const propdesc = Object.getOwnPropertyDescriptor(object, name); + assert_equals(typeof propdesc, "object"); + assert_equals(typeof propdesc.get, "function"); + assert_function_name(propdesc.get, "get " + name, `getter for "${name}"`); + assert_function_length(propdesc.get, 0, `getter for "${name}"`); + }, `${object_name}.${name}: getter`); + + test(() => { + const propdesc = Object.getOwnPropertyDescriptor(object, name); + assert_equals(typeof propdesc, "object"); + if (mutable) { + assert_equals(typeof propdesc.set, "function"); + assert_function_name(propdesc.set, "set " + name, `setter for "${name}"`); + assert_function_length(propdesc.set, 1, `setter for "${name}"`); + } else { + assert_equals(typeof propdesc.set, "undefined"); + } + }, `${object_name}.${name}: setter`); + } +} + +test(() => { + const propdesc = Object.getOwnPropertyDescriptor(this, "WebAssembly"); + assert_equals(typeof propdesc, "object"); + assert_true(propdesc.writable, "writable"); + assert_false(propdesc.enumerable, "enumerable"); + assert_true(propdesc.configurable, "configurable"); + assert_equals(propdesc.value, this.WebAssembly); +}, "WebAssembly: property descriptor"); + +test(() => { + assert_throws(new TypeError(), () => WebAssembly()); +}, "WebAssembly: calling"); + +test(() => { + assert_throws(new TypeError(), () => new WebAssembly()); +}, "WebAssembly: constructing"); + +const interfaces = [ + "Module", + "Instance", + "Memory", + "Table", + "Global", + "CompileError", + "LinkError", + "RuntimeError", +]; + +for (const name of interfaces) { + test(() => { + const propdesc = Object.getOwnPropertyDescriptor(WebAssembly, name); + assert_equals(typeof propdesc, "object"); + assert_true(propdesc.writable, "writable"); + assert_false(propdesc.enumerable, "enumerable"); + assert_true(propdesc.configurable, "configurable"); + assert_equals(propdesc.value, WebAssembly[name]); + }, `WebAssembly.${name}: property descriptor`); + + test(() => { + const interface_object = WebAssembly[name]; + const propdesc = Object.getOwnPropertyDescriptor(interface_object, "prototype"); + assert_equals(typeof propdesc, "object"); + assert_false(propdesc.writable, "writable"); + assert_false(propdesc.enumerable, "enumerable"); + assert_false(propdesc.configurable, "configurable"); + }, `WebAssembly.${name}: prototype`); + + test(() => { + const interface_object = WebAssembly[name]; + const interface_prototype_object = interface_object.prototype; + const propdesc = Object.getOwnPropertyDescriptor(interface_prototype_object, "constructor"); + assert_equals(typeof propdesc, "object"); + assert_true(propdesc.writable, "writable"); + assert_false(propdesc.enumerable, "enumerable"); + assert_true(propdesc.configurable, "configurable"); + assert_equals(propdesc.value, interface_object); + }, `WebAssembly.${name}: prototype.constructor`); +} + +test_operations(WebAssembly, "WebAssembly", [ + ["validate", 1], + ["compile", 1], + ["instantiate", 1], +]); + + +test_operations(WebAssembly.Module, "WebAssembly.Module", [ + ["exports", 1], + ["imports", 1], + ["customSections", 2], +]); + + +test_attributes(WebAssembly.Instance.prototype, "WebAssembly.Instance", [ + ["exports", false], +]); + + +test_operations(WebAssembly.Memory.prototype, "WebAssembly.Memory", [ + ["grow", 1], +]); + +test_attributes(WebAssembly.Memory.prototype, "WebAssembly.Memory", [ + ["buffer", false], +]); + + +test_operations(WebAssembly.Table.prototype, "WebAssembly.Table", [ + ["grow", 1], + ["get", 1], + ["set", 2], +]); + +test_attributes(WebAssembly.Table.prototype, "WebAssembly.Table", [ + ["length", false], +]); + + +test_operations(WebAssembly.Global.prototype, "WebAssembly.Global", [ + ["valueOf", 0], +]); + +test_attributes(WebAssembly.Global.prototype, "WebAssembly.Global", [ + ["value", true], +]); diff --git a/test/js-api/jsapi.js b/test/js-api/jsapi.js deleted file mode 100644 index 61dd0a6d..00000000 --- a/test/js-api/jsapi.js +++ /dev/null @@ -1,785 +0,0 @@ -/* - * Copyright 2017 WebAssembly Community Group participants - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. -*/ - -(function testJSAPI() { - -const WasmPage = 64 * 1024; - -const emptyModuleBinary = new WasmModuleBuilder().toBuffer(); - -const importingModuleBinary = (() => { - let builder = new WasmModuleBuilder(); - - builder.addImport('', 'f', kSig_v_v); - - return builder.toBuffer(); -})(); - -const complexImportingModuleBinary = (() => { - let builder = new WasmModuleBuilder(); - - builder.addImport('a', 'b', kSig_v_v); - builder.addImportedMemory('c', 'd', 1); - builder.addImportedTable('e', 'f', 1); - builder.addImportedGlobal('g', '⚡', kWasmI32); - - return builder.toBuffer(); -})(); - -const exportingModuleBinary = (() => { - let builder = new WasmModuleBuilder(); - - builder - .addFunction('f', kSig_i_v) - .addBody([ - kExprI32Const, - 42, - kExprEnd - ]) - .exportFunc(); - - return builder.toBuffer(); -})(); - -const complexExportingModuleBinary = (() => { - let builder = new WasmModuleBuilder(); - - builder - .addFunction('a', kSig_v_v) - .addBody([ - kExprEnd - ]) - .exportFunc(); - - builder.addMemory(1, 1, /* exported */ false); - builder.exportMemoryAs('b'); - - builder.setFunctionTableLength(1); - builder.addExportOfKind('c', kExternalTable, 0); - - // Default init for global values is 0. Keep that. - builder.addGlobal(kWasmI32, /* mutable */ false) - .exportAs("⚡"); - - return builder.toBuffer(); -})(); - -const moduleBinaryImporting2Memories = (() => { - var builder = new WasmModuleBuilder(); - builder.addImportedMemory("", "memory1"); - builder.addImportedMemory("", "memory2"); - return builder.toBuffer(); -})(); - -const moduleBinaryWithMemSectionAndMemImport = (() => { - var builder = new WasmModuleBuilder(); - builder.addMemory(1, 1, false); - builder.addImportedMemory("", "memory1"); - return builder.toBuffer(); -})(); - -let Module; -let Instance; -let CompileError; -let LinkError; -let RuntimeError; -let Memory; -let memoryProto; -let mem1; -let Table; -let tbl1; -let tableProto; - -let emptyModule; -let exportingModule; -let exportingInstance; -let exportsObj; -let importingModule; - -// Start of tests. - -test(() => { - const wasmDesc = Object.getOwnPropertyDescriptor(this, 'WebAssembly'); - assert_equals(typeof wasmDesc.value, "object"); - assert_true(wasmDesc.writable); - assert_false(wasmDesc.enumerable); - assert_true(wasmDesc.configurable); -}, "'WebAssembly' data property on global object"); - -test(() => { - const wasmDesc = Object.getOwnPropertyDescriptor(this, 'WebAssembly'); - assert_equals(WebAssembly, wasmDesc.value); - assert_equals(String(WebAssembly), "[object WebAssembly]"); -}, "'WebAssembly' object"); - -test(() => { - const compileErrorDesc = Object.getOwnPropertyDescriptor(WebAssembly, 'CompileError'); - const linkErrorDesc = Object.getOwnPropertyDescriptor(WebAssembly, 'LinkError'); - const runtimeErrorDesc = Object.getOwnPropertyDescriptor(WebAssembly, 'RuntimeError'); - assert_equals(typeof compileErrorDesc.value, "function"); - assert_equals(typeof linkErrorDesc.value, "function"); - assert_equals(typeof runtimeErrorDesc.value, "function"); - assert_equals(compileErrorDesc.writable, true); - assert_equals(linkErrorDesc.writable, true); - assert_equals(runtimeErrorDesc.writable, true); - assert_equals(compileErrorDesc.enumerable, false); - assert_equals(linkErrorDesc.enumerable, false); - assert_equals(runtimeErrorDesc.enumerable, false); - assert_equals(compileErrorDesc.configurable, true); - assert_equals(linkErrorDesc.configurable, true); - assert_equals(runtimeErrorDesc.configurable, true); - - CompileError = WebAssembly.CompileError; - LinkError = WebAssembly.LinkError; - RuntimeError = WebAssembly.RuntimeError; -}, "'WebAssembly.(Compile|Link|Runtime)Error' data property"); - -test(() => { - const compileErrorDesc = Object.getOwnPropertyDescriptor(WebAssembly, 'CompileError'); - const linkErrorDesc = Object.getOwnPropertyDescriptor(WebAssembly, 'LinkError'); - const runtimeErrorDesc = Object.getOwnPropertyDescriptor(WebAssembly, 'RuntimeError'); - assert_equals(CompileError, compileErrorDesc.value); - assert_equals(LinkError, linkErrorDesc.value); - assert_equals(RuntimeError, runtimeErrorDesc.value); - assert_equals(CompileError.length, 1); - assert_equals(LinkError.length, 1); - assert_equals(RuntimeError.length, 1); - assert_equals(CompileError.name, "CompileError"); - assert_equals(LinkError.name, "LinkError"); - assert_equals(RuntimeError.name, "RuntimeError"); -}, "'WebAssembly.(Compile|Runtime)Error' constructor function"); - -test(() => { - const compileError = new CompileError; - const runtimeError = new RuntimeError; - assert_equals(compileError instanceof CompileError, true); - assert_equals(runtimeError instanceof RuntimeError, true); - assert_equals(compileError instanceof Error, true); - assert_equals(runtimeError instanceof Error, true); - assert_equals(compileError instanceof TypeError, false); - assert_equals(runtimeError instanceof TypeError, false); - assert_equals(compileError.message, ""); - assert_equals(runtimeError.message, ""); - assert_equals(new CompileError("hi").message, "hi"); - assert_equals(new RuntimeError("hi").message, "hi"); -}, "'WebAssembly.(Compile|Runtime)Error' instance objects"); - -test(() => { - const moduleDesc = Object.getOwnPropertyDescriptor(WebAssembly, 'Module'); - assert_equals(typeof moduleDesc.value, "function"); - assert_equals(moduleDesc.writable, true); - assert_equals(moduleDesc.enumerable, false); - assert_equals(moduleDesc.configurable, true); - Module = WebAssembly.Module; -}, "'WebAssembly.Module' data property"); - -test(() => { - const moduleDesc = Object.getOwnPropertyDescriptor(WebAssembly, 'Module'); - assert_equals(Module, moduleDesc.value); - assert_equals(Module.length, 1); - assert_equals(Module.name, "Module"); - assertThrows(() => Module(), TypeError); - assertThrows(() => new Module(), TypeError); - assertThrows(() => new Module(undefined), TypeError); - assertThrows(() => new Module(1), TypeError); - assertThrows(() => new Module({}), TypeError); - assertThrows(() => new Module(new Uint8Array()), CompileError); - assertThrows(() => new Module(new ArrayBuffer()), CompileError); - assert_equals(new Module(emptyModuleBinary) instanceof Module, true); - assert_equals(new Module(emptyModuleBinary.buffer) instanceof Module, true); -}, "'WebAssembly.Module' constructor function"); - -test(() => { - const moduleProtoDesc = Object.getOwnPropertyDescriptor(Module, 'prototype'); - assert_equals(typeof moduleProtoDesc.value, "object"); - assert_equals(moduleProtoDesc.writable, false); - assert_equals(moduleProtoDesc.enumerable, false); - assert_equals(moduleProtoDesc.configurable, false); -}, "'WebAssembly.Module.prototype' data property"); - -test(() => { - const moduleProtoDesc = Object.getOwnPropertyDescriptor(Module, 'prototype'); - const moduleProto = Module.prototype; - assert_equals(moduleProto, moduleProtoDesc.value); - assert_equals(String(moduleProto), "[object WebAssembly.Module]"); - assert_equals(Object.getPrototypeOf(moduleProto), Object.prototype); -}, "'WebAssembly.Module.prototype' object"); - -test(() => { - const moduleProto = Module.prototype; - emptyModule = new Module(emptyModuleBinary); - exportingModule = new Module(exportingModuleBinary); - importingModule = new Module(importingModuleBinary); - assert_equals(typeof emptyModule, "object"); - assert_equals(String(emptyModule), "[object WebAssembly.Module]"); - assert_equals(Object.getPrototypeOf(emptyModule), moduleProto); -}, "'WebAssembly.Module' instance objects"); - -test(() => { - const moduleImportsDesc = Object.getOwnPropertyDescriptor(Module, 'imports'); - assert_equals(typeof moduleImportsDesc.value, "function"); - assert_equals(moduleImportsDesc.writable, true); - assert_equals(moduleImportsDesc.enumerable, false); - assert_equals(moduleImportsDesc.configurable, true); -}, "'WebAssembly.Module.imports' data property"); - -test(() => { - const moduleImportsDesc = Object.getOwnPropertyDescriptor(Module, 'imports'); - const moduleImports = moduleImportsDesc.value; - assert_equals(moduleImports.length, 1); - assertThrows(() => moduleImports(), TypeError); - assertThrows(() => moduleImports(undefined), TypeError); - assertThrows(() => moduleImports({}), TypeError); - var arr = moduleImports(emptyModule); - assert_equals(arr instanceof Array, true); - assert_equals(arr.length, 0); - var arr = moduleImports(new Module(complexImportingModuleBinary)); - assert_equals(arr instanceof Array, true); - assert_equals(arr.length, 4); - assert_equals(arr[0].kind, "function"); - assert_equals(arr[0].module, "a"); - assert_equals(arr[0].name, "b"); - assert_equals(arr[1].kind, "memory"); - assert_equals(arr[1].module, "c"); - assert_equals(arr[1].name, "d"); - assert_equals(arr[2].kind, "table"); - assert_equals(arr[2].module, "e"); - assert_equals(arr[2].name, "f"); - assert_equals(arr[3].kind, "global"); - assert_equals(arr[3].module, "g"); - assert_equals(arr[3].name, "⚡"); -}, "'WebAssembly.Module.imports' method"); - -test(() => { - const moduleExportsDesc = Object.getOwnPropertyDescriptor(Module, 'exports'); - assert_equals(typeof moduleExportsDesc.value, "function"); - assert_equals(moduleExportsDesc.writable, true); - assert_equals(moduleExportsDesc.enumerable, false); - assert_equals(moduleExportsDesc.configurable, true); -}, "'WebAssembly.Module.exports' data property"); - -test(() => { - const moduleExportsDesc = Object.getOwnPropertyDescriptor(Module, 'exports'); - const moduleExports = moduleExportsDesc.value; - assert_equals(moduleExports.length, 1); - assertThrows(() => moduleExports(), TypeError); - assertThrows(() => moduleExports(undefined), TypeError); - assertThrows(() => moduleExports({}), TypeError); - var arr = moduleExports(emptyModule); - assert_equals(arr instanceof Array, true); - assert_equals(arr.length, 0); - var arr = moduleExports(new Module(complexExportingModuleBinary)); - assert_equals(arr instanceof Array, true); - assert_equals(arr.length, 4); - assert_equals(arr[0].kind, "function"); - assert_equals(arr[0].name, "a"); - assert_equals(arr[1].kind, "memory"); - assert_equals(arr[1].name, "b"); - assert_equals(arr[2].kind, "table"); - assert_equals(arr[2].name, "c"); - assert_equals(arr[3].kind, "global"); - assert_equals(arr[3].name, "⚡"); -}, "'WebAssembly.Module.exports' method"); - -test(() => { - const customSectionsDesc = Object.getOwnPropertyDescriptor(Module, 'customSections'); - assert_equals(typeof customSectionsDesc.value, "function"); - assert_equals(customSectionsDesc.writable, true); - assert_equals(customSectionsDesc.enumerable, false); - assert_equals(customSectionsDesc.configurable, true); -}, "'WebAssembly.Module.customSections' data property"); - -test(() => { - const customSectionsDesc = Object.getOwnPropertyDescriptor(Module, 'customSections'); - const moduleCustomSections = customSectionsDesc.value; - assert_equals(moduleCustomSections.length, 2); - assertThrows(() => moduleCustomSections(), TypeError); - assertThrows(() => moduleCustomSections(undefined), TypeError); - assertThrows(() => moduleCustomSections({}), TypeError); - var arr = moduleCustomSections(emptyModule); - assert_equals(arr instanceof Array, true); - assert_equals(arr.length, 0); -}, "'WebAssembly.Module.customSections' method"); - -test(() => { - const instanceDesc = Object.getOwnPropertyDescriptor(WebAssembly, 'Instance'); - assert_equals(typeof instanceDesc.value, "function"); - assert_equals(instanceDesc.writable, true); - assert_equals(instanceDesc.enumerable, false); - assert_equals(instanceDesc.configurable, true); - Instance = WebAssembly.Instance; -}, "'WebAssembly.Instance' data property"); - -test(() => { - const instanceDesc = Object.getOwnPropertyDescriptor(WebAssembly, 'Instance'); - assert_equals(Instance, instanceDesc.value); - assert_equals(Instance.length, 1); - assert_equals(Instance.name, "Instance"); - assertThrows(() => Instance(), TypeError); - assertThrows(() => new Instance(1), TypeError); - assertThrows(() => new Instance({}), TypeError); - assertThrows(() => new Instance(emptyModule, null), TypeError); - assertThrows(() => new Instance(importingModule, null), TypeError); - assertThrows(() => new Instance(importingModule, undefined), TypeError); - assertThrows(() => new Instance(importingModule, {}), TypeError); - assertThrows(() => new Instance(importingModule, {"":{g:()=>{}}}), LinkError); - assertThrows(() => new Instance(importingModule, {t:{f:()=>{}}}), TypeError); - assert_equals(new Instance(emptyModule) instanceof Instance, true); - assert_equals(new Instance(emptyModule, {}) instanceof Instance, true); -}, "'WebAssembly.Instance' constructor function"); - -test(() => { - const instanceProtoDesc = Object.getOwnPropertyDescriptor(Instance, 'prototype'); - assert_equals(typeof instanceProtoDesc.value, "object"); - assert_equals(instanceProtoDesc.writable, false); - assert_equals(instanceProtoDesc.enumerable, false); - assert_equals(instanceProtoDesc.configurable, false); -}, "'WebAssembly.Instance.prototype' data property"); - -test(() => { - const instanceProto = Instance.prototype; - const instanceProtoDesc = Object.getOwnPropertyDescriptor(Instance, 'prototype'); - assert_equals(instanceProto, instanceProtoDesc.value); - assert_equals(String(instanceProto), "[object WebAssembly.Instance]"); - assert_equals(Object.getPrototypeOf(instanceProto), Object.prototype); -}, "'WebAssembly.Instance.prototype' object"); - -test(() => { - const instanceProto = Instance.prototype; - exportingInstance = new Instance(exportingModule); - assert_equals(typeof exportingInstance, "object"); - assert_equals(String(exportingInstance), "[object WebAssembly.Instance]"); - assert_equals(Object.getPrototypeOf(exportingInstance), instanceProto); -}, "'WebAssembly.Instance' instance objects"); - -test(() => { - const instanceExportsDesc = Object.getOwnPropertyDescriptor(exportingInstance, 'exports'); - assert_equals(typeof instanceExportsDesc.value, "object"); - assert_equals(instanceExportsDesc.writable, true); - assert_equals(instanceExportsDesc.enumerable, true); - assert_equals(instanceExportsDesc.configurable, true); -}, "'WebAssembly.Instance' 'exports' data property"); - -test(() => { - exportsObj = exportingInstance.exports; - assert_equals(typeof exportsObj, "object"); - assert_equals(Object.isExtensible(exportsObj), false); - assert_equals(Object.getPrototypeOf(exportsObj), null); - assert_equals(Object.keys(exportsObj).join(), "f"); - exportsObj.g = 1; - assert_equals(Object.keys(exportsObj).join(), "f"); - assertThrows(() => Object.setPrototypeOf(exportsObj, {}), TypeError); - assert_equals(Object.getPrototypeOf(exportsObj), null); - assertThrows(() => Object.defineProperty(exportsObj, 'g', {}), TypeError); - assert_equals(Object.keys(exportsObj).join(), "f"); -}, "'WebAssembly.Instance' 'exports' object"); - -test(() => { - const f = exportsObj.f; - assert_equals(f instanceof Function, true); - assert_equals(f.length, 0); - assert_equals('name' in f, true); - assert_equals(Function.prototype.call.call(f), 42); - assertThrows(() => new f(), TypeError); -}, "Exported WebAssembly functions"); - -test(() => { - const memoryDesc = Object.getOwnPropertyDescriptor(WebAssembly, 'Memory'); - assert_equals(typeof memoryDesc.value, "function"); - assert_equals(memoryDesc.writable, true); - assert_equals(memoryDesc.enumerable, false); - assert_equals(memoryDesc.configurable, true); - Memory = WebAssembly.Memory; -}, "'WebAssembly.Memory' data property"); - -test(() => { - const memoryDesc = Object.getOwnPropertyDescriptor(WebAssembly, 'Memory'); - assert_equals(Memory, memoryDesc.value); - assert_equals(Memory.length, 1); - assert_equals(Memory.name, "Memory"); - assertThrows(() => Memory(), TypeError); - assertThrows(() => new Memory(1), TypeError); - assertThrows(() => new Memory({initial:{valueOf() { throw new Error("here")}}}), Error); - assertThrows(() => new Memory({initial:-1}), RangeError); - assertThrows(() => new Memory({initial:Math.pow(2,32)}), RangeError); - assertThrows(() => new Memory({initial:1, maximum: Math.pow(2,32)/Math.pow(2,14) }), RangeError); - assertThrows(() => new Memory({initial:2, maximum:1 }), RangeError); - assertThrows(() => new Memory({maximum: -1 }), RangeError); - assert_equals(new Memory({initial:1}) instanceof Memory, true); - assert_equals(new Memory({initial:1.5}).buffer.byteLength, WasmPage); -}, "'WebAssembly.Memory' constructor function"); - -test(() => { - const memoryProtoDesc = Object.getOwnPropertyDescriptor(Memory, 'prototype'); - assert_equals(typeof memoryProtoDesc.value, "object"); - assert_equals(memoryProtoDesc.writable, false); - assert_equals(memoryProtoDesc.enumerable, false); - assert_equals(memoryProtoDesc.configurable, false); -}, "'WebAssembly.Memory.prototype' data property"); - -test(() => { - memoryProto = Memory.prototype; - const memoryProtoDesc = Object.getOwnPropertyDescriptor(Memory, 'prototype'); - assert_equals(memoryProto, memoryProtoDesc.value); - assert_equals(String(memoryProto), "[object WebAssembly.Memory]"); - assert_equals(Object.getPrototypeOf(memoryProto), Object.prototype); -}, "'WebAssembly.Memory.prototype' object"); - -test(() => { - mem1 = new Memory({initial:1}); - assert_equals(typeof mem1, "object"); - assert_equals(String(mem1), "[object WebAssembly.Memory]"); - assert_equals(Object.getPrototypeOf(mem1), memoryProto); -}, "'WebAssembly.Memory' instance objects"); - -test(() => { - const bufferDesc = Object.getOwnPropertyDescriptor(memoryProto, 'buffer'); - assert_equals(typeof bufferDesc.get, "function"); - assert_equals(bufferDesc.set, undefined); - assert_equals(bufferDesc.enumerable, false); - assert_equals(bufferDesc.configurable, true); -}, "'WebAssembly.Memory.prototype.buffer' accessor property"); - -test(() => { - const bufferDesc = Object.getOwnPropertyDescriptor(memoryProto, 'buffer'); - const bufferGetter = bufferDesc.get; - assertThrows(() => bufferGetter.call(), TypeError); - assertThrows(() => bufferGetter.call({}), TypeError); - assert_equals(bufferGetter.call(mem1) instanceof ArrayBuffer, true); - assert_equals(bufferGetter.call(mem1).byteLength, WasmPage); -}, "'WebAssembly.Memory.prototype.buffer' getter"); - -test(() => { - const memGrowDesc = Object.getOwnPropertyDescriptor(memoryProto, 'grow'); - assert_equals(typeof memGrowDesc.value, "function"); - assert_equals(memGrowDesc.enumerable, false); - assert_equals(memGrowDesc.configurable, true); -}, "'WebAssembly.Memory.prototype.grow' data property"); - -test(() => { - const memGrowDesc = Object.getOwnPropertyDescriptor(memoryProto, 'grow'); - const memGrow = memGrowDesc.value; - assert_equals(memGrow.length, 1); - assertThrows(() => memGrow.call(), TypeError); - assertThrows(() => memGrow.call({}), TypeError); - assertThrows(() => memGrow.call(mem1, -1), RangeError); - assertThrows(() => memGrow.call(mem1, Math.pow(2,32)), RangeError); - var mem = new Memory({initial:1, maximum:2}); - var buf = mem.buffer; - assert_equals(buf.byteLength, WasmPage); - assert_equals(mem.grow(0), 1); - assert_equals(buf !== mem.buffer, true); - assert_equals(buf.byteLength, 0); - buf = mem.buffer; - assert_equals(buf.byteLength, WasmPage); - assert_equals(mem.grow(1), 1); - assert_equals(buf !== mem.buffer, true); - assert_equals(buf.byteLength, 0); - buf = mem.buffer; - assert_equals(buf.byteLength, 2 * WasmPage); - assertThrows(() => mem.grow(1), Error); - assert_equals(buf, mem.buffer); -}, "'WebAssembly.Memory.prototype.grow' method"); - -test(() => { - const tableDesc = Object.getOwnPropertyDescriptor(WebAssembly, 'Table'); - assert_equals(typeof tableDesc.value, "function"); - assert_equals(tableDesc.writable, true); - assert_equals(tableDesc.enumerable, false); - assert_equals(tableDesc.configurable, true); - Table = WebAssembly.Table; -}, "'WebAssembly.Table' data property"); - -test(() => { - const tableDesc = Object.getOwnPropertyDescriptor(WebAssembly, 'Table'); - assert_equals(Table, tableDesc.value); - assert_equals(Table.length, 1); - assert_equals(Table.name, "Table"); - assertThrows(() => Table(), TypeError); - assertThrows(() => new Table(1), TypeError); - assertThrows(() => new Table({initial:1, element:1}), TypeError); - assertThrows(() => new Table({initial:1, element:"any"}), TypeError); - assertThrows(() => new Table({initial:1, element:{valueOf() { return "anyfunc" }}}), TypeError); - assertThrows(() => new Table({initial:{valueOf() { throw new Error("here")}}, element:"anyfunc"}), Error); - assertThrows(() => new Table({initial:-1, element:"anyfunc"}), RangeError); - assertThrows(() => new Table({initial:Math.pow(2,32), element:"anyfunc"}), RangeError); - assertThrows(() => new Table({initial:2, maximum:1, element:"anyfunc"}), RangeError); - assertThrows(() => new Table({initial:2, maximum:Math.pow(2,32), element:"anyfunc"}), RangeError); - assert_equals(new Table({initial:1, element:"anyfunc"}) instanceof Table, true); - assert_equals(new Table({initial:1.5, element:"anyfunc"}) instanceof Table, true); - assert_equals(new Table({initial:1, maximum:1.5, element:"anyfunc"}) instanceof Table, true); - assert_equals(new Table({initial:1, maximum:Math.pow(2,32)-1, element:"anyfunc"}) instanceof Table, true); -}, "'WebAssembly.Table' constructor function"); - -test(() => { - const tableProtoDesc = Object.getOwnPropertyDescriptor(Table, 'prototype'); - assert_equals(typeof tableProtoDesc.value, "object"); - assert_equals(tableProtoDesc.writable, false); - assert_equals(tableProtoDesc.enumerable, false); - assert_equals(tableProtoDesc.configurable, false); -}, "'WebAssembly.Table.prototype' data property"); - -test(() => { - const tableProtoDesc = Object.getOwnPropertyDescriptor(Table, 'prototype'); - tableProto = Table.prototype; - assert_equals(tableProto, tableProtoDesc.value); - assert_equals(String(tableProto), "[object WebAssembly.Table]"); - assert_equals(Object.getPrototypeOf(tableProto), Object.prototype); -}, "'WebAssembly.Table.prototype' object"); - -test(() => { - tbl1 = new Table({initial:2, element:"anyfunc"}); - assert_equals(typeof tbl1, "object"); - assert_equals(String(tbl1), "[object WebAssembly.Table]"); - assert_equals(Object.getPrototypeOf(tbl1), tableProto); -}, "'WebAssembly.Table' instance objects"); - -test(() => { - const lengthDesc = Object.getOwnPropertyDescriptor(tableProto, 'length'); - assert_equals(typeof lengthDesc.get, "function"); - assert_equals(lengthDesc.set, undefined); - assert_equals(lengthDesc.enumerable, false); - assert_equals(lengthDesc.configurable, true); -}, "'WebAssembly.Table.prototype.length' accessor data property"); - -test(() => { - const lengthDesc = Object.getOwnPropertyDescriptor(tableProto, 'length'); - const lengthGetter = lengthDesc.get; - assert_equals(lengthGetter.length, 0); - assertThrows(() => lengthGetter.call(), TypeError); - assertThrows(() => lengthGetter.call({}), TypeError); - assert_equals(typeof lengthGetter.call(tbl1), "number"); - assert_equals(lengthGetter.call(tbl1), 2); -}, "'WebAssembly.Table.prototype.length' getter"); - -test(() => { - const getDesc = Object.getOwnPropertyDescriptor(tableProto, 'get'); - assert_equals(typeof getDesc.value, "function"); - assert_equals(getDesc.enumerable, false); - assert_equals(getDesc.configurable, true); -}, "'WebAssembly.Table.prototype.get' data property"); - -test(() => { - const getDesc = Object.getOwnPropertyDescriptor(tableProto, 'get'); - const get = getDesc.value; - assert_equals(get.length, 1); - assertThrows(() => get.call(), TypeError); - assertThrows(() => get.call({}), TypeError); - assert_equals(get.call(tbl1, 0), null); - assert_equals(get.call(tbl1, 1), null); - assert_equals(get.call(tbl1, 1.5), null); - assertThrows(() => get.call(tbl1, 2), RangeError); - assertThrows(() => get.call(tbl1, 2.5), RangeError); - assertThrows(() => get.call(tbl1, -1), RangeError); - assertThrows(() => get.call(tbl1, Math.pow(2,33)), RangeError); - assertThrows(() => get.call(tbl1, {valueOf() { throw new Error("hi") }}), Error); -}, "'WebAssembly.Table.prototype.get' method"); - -test(() => { - const setDesc = Object.getOwnPropertyDescriptor(tableProto, 'set'); - assert_equals(typeof setDesc.value, "function"); - assert_equals(setDesc.enumerable, false); - assert_equals(setDesc.configurable, true); -}, "'WebAssembly.Table.prototype.set' data property"); - -test(() => { - const setDesc = Object.getOwnPropertyDescriptor(tableProto, 'set'); - const set = setDesc.value; - assert_equals(set.length, 2); - assertThrows(() => set.call(), TypeError); - assertThrows(() => set.call({}), TypeError); - assertThrows(() => set.call(tbl1, 0), TypeError); - assertThrows(() => set.call(tbl1, 2, null), RangeError); - assertThrows(() => set.call(tbl1, -1, null), RangeError); - assertThrows(() => set.call(tbl1, Math.pow(2,33), null), RangeError); - assertThrows(() => set.call(tbl1, 0, undefined), TypeError); - assertThrows(() => set.call(tbl1, 0, {}), TypeError); - assertThrows(() => set.call(tbl1, 0, function() {}), TypeError); - assertThrows(() => set.call(tbl1, 0, Math.sin), TypeError); - assertThrows(() => set.call(tbl1, {valueOf() { throw Error("hai") }}, null), Error); - assert_equals(set.call(tbl1, 0, null), undefined); - assert_equals(set.call(tbl1, 1, null), undefined); -}, "'WebAssembly.Table.prototype.set' method"); - -test(() => { - const tblGrowDesc = Object.getOwnPropertyDescriptor(tableProto, 'grow'); - assert_equals(typeof tblGrowDesc.value, "function"); - assert_equals(tblGrowDesc.enumerable, false); - assert_equals(tblGrowDesc.configurable, true); -}, "'WebAssembly.Table.prototype.grow' data property"); - -test(() => { - const tblGrowDesc = Object.getOwnPropertyDescriptor(tableProto, 'grow'); - const tblGrow = tblGrowDesc.value; - assert_equals(tblGrow.length, 1); - assertThrows(() => tblGrow.call(), TypeError); - assertThrows(() => tblGrow.call({}), TypeError); - assertThrows(() => tblGrow.call(tbl1, -1), RangeError); - assertThrows(() => tblGrow.call(tbl1, Math.pow(2,32)), RangeError); - var tbl = new Table({element:"anyfunc", initial:1, maximum:2}); - assert_equals(tbl.length, 1); - assert_equals(tbl.grow(0), 1); - assert_equals(tbl.length, 1); - assert_equals(tbl.grow(1), 1); - assert_equals(tbl.length, 2); - assertThrows(() => tbl.grow(1), Error); -}, "'WebAssembly.Table.prototype.grow' method"); - -test(() => { - assertThrows(() => WebAssembly.validate(), TypeError); - assertThrows(() => WebAssembly.validate("hi"), TypeError); - assert_true(WebAssembly.validate(emptyModuleBinary)); - assert_true(WebAssembly.validate(complexImportingModuleBinary)); - assert_false(WebAssembly.validate(moduleBinaryImporting2Memories)); - assert_false(WebAssembly.validate(moduleBinaryWithMemSectionAndMemImport)); -}, "'WebAssembly.validate' method"), - -test(() => { - const compileDesc = Object.getOwnPropertyDescriptor(WebAssembly, 'compile'); - assert_equals(typeof compileDesc.value, "function"); - assert_equals(compileDesc.writable, true); - assert_equals(compileDesc.enumerable, false); - assert_equals(compileDesc.configurable, true); -}, "'WebAssembly.compile' data property"); - -test(() => { - const compile = WebAssembly.compile; - const compileDesc = Object.getOwnPropertyDescriptor(WebAssembly, 'compile'); - - assert_equals(compile, compileDesc.value); - assert_equals(compile.length, 1); - assert_equals(compile.name, "compile"); -}, "'WebAssembly.compile' function"); - -var num_tests = 1; -function assertCompileError(args, err) { - promise_test(() => { - return WebAssembly.compile(...args) - .then(_ => { - throw null; - }) - .catch(error => { - assert_equals(error instanceof err, true); - return Promise.resolve() - }); - }, `assertCompileError ${num_tests++}`); -} - -assertCompileError([], TypeError); -assertCompileError([undefined], TypeError); -assertCompileError([1], TypeError); -assertCompileError([{}], TypeError); -assertCompileError([new Uint8Array()], CompileError); -assertCompileError([new ArrayBuffer()], CompileError); -assertCompileError([new Uint8Array("hi!")], CompileError); -assertCompileError([new ArrayBuffer("hi!")], CompileError); - -num_tests = 1; -function assertCompileSuccess(bytes) { - promise_test(() => { - return WebAssembly.compile(bytes) - .then(module => { - assert_equals(module instanceof Module, true); - }); - }, `assertCompileSuccess ${num_tests++}`); -} - -assertCompileSuccess(emptyModuleBinary); -assertCompileSuccess(emptyModuleBinary.buffer); - -test(() => { - const instantiateDesc = Object.getOwnPropertyDescriptor(WebAssembly, 'instantiate'); - assert_equals(typeof instantiateDesc.value, "function"); - assert_equals(instantiateDesc.writable, true); - assert_equals(instantiateDesc.enumerable, false); - assert_equals(instantiateDesc.configurable, true); -}, "'WebAssembly.instantiate' data property"); - -test(() => { - const instantiateDesc = Object.getOwnPropertyDescriptor(WebAssembly, 'instantiate'); - const instantiate = WebAssembly.instantiate; - assert_equals(instantiate, instantiateDesc.value); - assert_equals(instantiate.length, 1); - assert_equals(instantiate.name, "instantiate"); - function assertInstantiateError(args, err) { - promise_test(() => { - return instantiate(...args) - .then(m => { - throw null; - }) - .catch(error => { - assert_equals(error instanceof err, true); - }) - }, 'unexpected success in assertInstantiateError'); - } - var scratch_memory = new WebAssembly.Memory({initial:1}); - var scratch_table = new WebAssembly.Table({element:"anyfunc", initial:1, maximum:1}); - assertInstantiateError([], TypeError); - assertInstantiateError([undefined], TypeError); - assertInstantiateError([1], TypeError); - assertInstantiateError([{}], TypeError); - assertInstantiateError([new Uint8Array()], CompileError); - assertInstantiateError([new ArrayBuffer()], CompileError); - assertInstantiateError([new Uint8Array("hi!")], CompileError); - assertInstantiateError([new ArrayBuffer("hi!")], CompileError); - assertInstantiateError([importingModule], TypeError); - assertInstantiateError([importingModule, null], TypeError); - assertInstantiateError([importingModuleBinary, null], TypeError); - assertInstantiateError([emptyModule, null], TypeError); - assertInstantiateError([importingModuleBinary, null], TypeError); - assertInstantiateError([importingModuleBinary, undefined], TypeError); - assertInstantiateError([importingModuleBinary, {}], TypeError); - assertInstantiateError([importingModuleBinary, {"":{g:()=>{}}}], LinkError); - assertInstantiateError([importingModuleBinary, {t:{f:()=>{}}}], TypeError); - assertInstantiateError([complexImportingModuleBinary, null], TypeError); - assertInstantiateError([complexImportingModuleBinary, undefined], TypeError); - assertInstantiateError([complexImportingModuleBinary, {}], TypeError); - assertInstantiateError([complexImportingModuleBinary, {"c": {"d": scratch_memory}}], TypeError); - - function assertInstantiateSuccess(module, imports) { - promise_test(()=> { - return instantiate(module, imports) - .then(result => { - if (module instanceof Module) { - assert_equals(result instanceof Instance, true); - } else { - assert_equals(result.module instanceof Module, true); - assert_equals(result.instance instanceof Instance, true); - var desc = Object.getOwnPropertyDescriptor(result, 'module'); - assert_equals(desc.writable, true); - assert_equals(desc.enumerable, true); - assert_equals(desc.configurable, true); - desc = Object.getOwnPropertyDescriptor(result, 'instance'); - assert_equals(desc.writable, true); - assert_equals(desc.enumerable, true); - assert_equals(desc.configurable, true); - } - })}, 'unexpected failure in assertInstantiateSuccess'); - } - assertInstantiateSuccess(emptyModule); - assertInstantiateSuccess(emptyModuleBinary); - assertInstantiateSuccess(emptyModuleBinary.buffer); - assertInstantiateSuccess(importingModule, {"":{f:()=>{}}}); - assertInstantiateSuccess(importingModuleBinary, {"":{f:()=>{}}}); - assertInstantiateSuccess(importingModuleBinary.buffer, {"":{f:()=>{}}}); - assertInstantiateSuccess(complexImportingModuleBinary, { - a:{b:()=>{}}, - c:{d:scratch_memory}, - e:{f:scratch_table}, - g:{'⚡':1}}); -}, "'WebAssembly.instantiate' function"); - -})(); diff --git a/test/js-api/limits.any.js b/test/js-api/limits.any.js new file mode 100644 index 00000000..d49a51eb --- /dev/null +++ b/test/js-api/limits.any.js @@ -0,0 +1,196 @@ +// META: global=jsshell +// META: script=/wasm/jsapi/wasm-module-builder.js +// META: timeout=long + +const kJSEmbeddingMaxTypes = 1000000; +const kJSEmbeddingMaxFunctions = 1000000; +const kJSEmbeddingMaxImports = 100000; +const kJSEmbeddingMaxExports = 100000; +const kJSEmbeddingMaxGlobals = 1000000; +const kJSEmbeddingMaxDataSegments = 100000; + +const kJSEmbeddingMaxMemoryPages = 65536; +const kJSEmbeddingMaxModuleSize = 1024 * 1024 * 1024; // = 1 GiB +const kJSEmbeddingMaxFunctionSize = 7654321; +const kJSEmbeddingMaxFunctionLocals = 50000; +const kJSEmbeddingMaxFunctionParams = 1000; +const kJSEmbeddingMaxFunctionReturns = 1; +const kJSEmbeddingMaxTableSize = 10000000; +const kJSEmbeddingMaxElementSegments = 10000000; +const kJSEmbeddingMaxTables = 100000; +const kJSEmbeddingMaxMemories = 1; + +// This function runs the {gen} function with the values {min}, {limit}, and +// {limit+1}, assuming that values below and including the limit should +// pass. {name} is used for test names. +function testLimit(name, min, limit, gen) { + function get_buffer(count) { + const builder = new WasmModuleBuilder(); + gen(builder, count); + return builder.toBuffer(); + } + + const buffer_with_min = get_buffer(min); + const buffer_with_limit = get_buffer(limit); + const buffer_with_limit_plus_1 = get_buffer(limit + 1); + + test(() => { + assert_true(WebAssembly.validate(buffer_with_min)); + }, `Validate ${name} minimum`); + test(() => { + assert_true(WebAssembly.validate(buffer_with_limit)); + }, `Validate ${name} limit`); + test(() => { + assert_false(WebAssembly.validate(buffer_with_limit_plus_1)); + }, `Validate ${name} over limit`); + + test(() => { + new WebAssembly.Module(buffer_with_min); + }, `Compile ${name} minimum`); + test(() => { + new WebAssembly.Module(buffer_with_limit); + }, `Compile ${name} limit`); + test(() => { + assert_throws(new WebAssembly.CompileError(), () => new WebAssembly.Module(buffer_with_limit_plus_1)); + }, `Compile ${name} over limit`); + + promise_test(t => { + return WebAssembly.compile(buffer_with_min); + }, `Async compile ${name} minimum`); + promise_test(t => { + return WebAssembly.compile(buffer_with_limit); + }, `Async compile ${name} limit`); + promise_test(t => { + return promise_rejects(t, new WebAssembly.CompileError(), WebAssembly.compile(buffer_with_limit_plus_1)); + }, `Async compile ${name} over limit`); +} + +testLimit("types", 1, kJSEmbeddingMaxTypes, (builder, count) => { + for (let i = 0; i < count; i++) { + builder.addType(kSig_i_i); + } + }); + +testLimit("functions", 1, kJSEmbeddingMaxFunctions, (builder, count) => { + const type = builder.addType(kSig_v_v); + const body = []; + for (let i = 0; i < count; i++) { + builder.addFunction(/*name=*/ undefined, type).addBody(body); + } + }); + +testLimit("imports", 1, kJSEmbeddingMaxImports, (builder, count) => { + const type = builder.addType(kSig_v_v); + for (let i = 0; i < count; i++) { + builder.addImport("", "", type); + } + }); + +testLimit("exports", 1, kJSEmbeddingMaxExports, (builder, count) => { + const type = builder.addType(kSig_v_v); + const f = builder.addFunction(/*name=*/ undefined, type); + f.addBody([]); + for (let i = 0; i < count; i++) { + builder.addExport("f" + i, f.index); + } + }); + +testLimit("globals", 1, kJSEmbeddingMaxGlobals, (builder, count) => { + for (let i = 0; i < count; i++) { + builder.addGlobal(kWasmI32, true); + } + }); + +testLimit("data segments", 1, kJSEmbeddingMaxDataSegments, (builder, count) => { + const data = []; + builder.addMemory(1, 1, false, false); + for (let i = 0; i < count; i++) { + builder.addDataSegment(0, data); + } + }); + +testLimit("initial declared memory pages", 1, kJSEmbeddingMaxMemoryPages, + (builder, count) => { + builder.addMemory(count, undefined, false, false); + }); + +testLimit("maximum declared memory pages", 1, kJSEmbeddingMaxMemoryPages, + (builder, count) => { + builder.addMemory(1, count, false, false); + }); + +testLimit("initial imported memory pages", 1, kJSEmbeddingMaxMemoryPages, + (builder, count) => { + builder.addImportedMemory("mod", "mem", count, undefined); + }); + +testLimit("maximum imported memory pages", 1, kJSEmbeddingMaxMemoryPages, + (builder, count) => { + builder.addImportedMemory("mod", "mem", 1, count); + }); + +testLimit("function size", 2, kJSEmbeddingMaxFunctionSize, (builder, count) => { + const type = builder.addType(kSig_v_v); + const nops = count - 2; + const array = new Array(nops); + for (let i = 0; i < nops; i++) array[i] = kExprNop; + builder.addFunction(undefined, type).addBody(array); + }); + +testLimit("function locals", 1, kJSEmbeddingMaxFunctionLocals, (builder, count) => { + const type = builder.addType(kSig_v_v); + builder.addFunction(undefined, type) + .addLocals({i32_count: count}) + .addBody([]); + }); + +testLimit("function params", 1, kJSEmbeddingMaxFunctionParams, (builder, count) => { + const array = new Array(count); + for (let i = 0; i < count; i++) { + array[i] = kWasmI32; + } + const type = builder.addType({params: array, results: []}); + }); + +testLimit("function params+locals", 1, kJSEmbeddingMaxFunctionLocals - 2, (builder, count) => { + const type = builder.addType(kSig_i_ii); + builder.addFunction(undefined, type) + .addLocals({i32_count: count}) + .addBody([kExprUnreachable]); + }); + +testLimit("function returns", 0, kJSEmbeddingMaxFunctionReturns, (builder, count) => { + const array = new Array(count); + for (let i = 0; i < count; i++) { + array[i] = kWasmI32; + } + const type = builder.addType({params: [], results: array}); + }); + +testLimit("initial table size", 1, kJSEmbeddingMaxTableSize, (builder, count) => { + builder.setTableBounds(count, undefined); + }); + +testLimit("maximum table size", 1, kJSEmbeddingMaxTableSize, (builder, count) => { + builder.setTableBounds(1, count); + }); + +testLimit("element segments", 1, kJSEmbeddingMaxElementSegments, (builder, count) => { + builder.setTableBounds(1, 1); + const array = []; + for (let i = 0; i < count; i++) { + builder.addElementSegment(0, false, array, false); + } + }); + +testLimit("tables", 0, kJSEmbeddingMaxTables, (builder, count) => { + for (let i = 0; i < count; i++) { + builder.addImportedTable("", "", 1, 1); + } + }); + +testLimit("memories", 0, kJSEmbeddingMaxMemories, (builder, count) => { + for (let i = 0; i < count; i++) { + builder.addImportedMemory("", "", 1, 1, false); + } + }); diff --git a/test/js-api/memory/buffer.any.js b/test/js-api/memory/buffer.any.js new file mode 100644 index 00000000..4788ffcf --- /dev/null +++ b/test/js-api/memory/buffer.any.js @@ -0,0 +1,64 @@ +// META: global=jsshell + +test(() => { + const thisValues = [ + undefined, + null, + true, + "", + Symbol(), + 1, + {}, + WebAssembly.Memory, + WebAssembly.Memory.prototype, + ]; + + const desc = Object.getOwnPropertyDescriptor(WebAssembly.Memory.prototype, "buffer"); + assert_equals(typeof desc, "object"); + + const getter = desc.get; + assert_equals(typeof getter, "function"); + + assert_equals(typeof desc.set, "undefined"); + + for (const thisValue of thisValues) { + assert_throws(new TypeError(), () => getter.call(thisValue), `this=${format_value(thisValue)}`); + } +}, "Branding"); + +test(() => { + const argument = { "initial": 0 }; + const memory = new WebAssembly.Memory(argument); + const buffer = memory.buffer; + + const desc = Object.getOwnPropertyDescriptor(WebAssembly.Memory.prototype, "buffer"); + assert_equals(typeof desc, "object"); + + const getter = desc.get; + assert_equals(typeof getter, "function"); + + assert_equals(getter.call(memory, {}), buffer); +}, "Stray argument"); + +test(() => { + const argument = { "initial": 0 }; + const memory = new WebAssembly.Memory(argument); + const memory2 = new WebAssembly.Memory(argument); + const buffer = memory.buffer; + assert_not_equals(buffer, memory2.buffer, "Need two distinct buffers"); + memory.buffer = memory2.buffer; + assert_equals(memory.buffer, buffer, "Should not change the buffer"); +}, "Setting (sloppy mode)"); + +test(() => { + const argument = { "initial": 0 }; + const memory = new WebAssembly.Memory(argument); + const memory2 = new WebAssembly.Memory(argument); + const buffer = memory.buffer; + assert_not_equals(buffer, memory2.buffer, "Need two distinct buffers"); + assert_throws(new TypeError(), () => { + "use strict"; + memory.buffer = memory2.buffer; + }); + assert_equals(memory.buffer, buffer, "Should not change the buffer"); +}, "Setting (strict mode)"); diff --git a/test/js-api/memory/constructor.any.js b/test/js-api/memory/constructor.any.js new file mode 100644 index 00000000..11e309fe --- /dev/null +++ b/test/js-api/memory/constructor.any.js @@ -0,0 +1,147 @@ +// META: global=jsshell +// META: script=/wasm/jsapi/assertions.js + +function assert_Memory(memory, expected) { + assert_equals(Object.getPrototypeOf(memory), WebAssembly.Memory.prototype, + "prototype"); + assert_true(Object.isExtensible(memory), "extensible"); + + // https://github.com/WebAssembly/spec/issues/840 + assert_equals(memory.buffer, memory.buffer, "buffer should be idempotent"); + assert_equals(Object.getPrototypeOf(memory.buffer), ArrayBuffer.prototype, + "prototype of buffer"); + assert_true(Object.isExtensible(memory.buffer), "buffer extensibility"); + assert_equals(memory.buffer.byteLength, 0x10000 * expected.size, "size of buffer"); + if (expected.size > 0) { + const array = new Uint8Array(memory.buffer); + assert_equals(array[0], 0, "first element of buffer"); + assert_equals(array[array.byteLength - 1], 0, "last element of buffer"); + } +} + +test(() => { + assert_function_name(WebAssembly.Memory, "Memory", "WebAssembly.Memory"); +}, "name"); + +test(() => { + assert_function_length(WebAssembly.Memory, 1, "WebAssembly.Memory"); +}, "length"); + +test(() => { + assert_throws(new TypeError(), () => new WebAssembly.Memory()); +}, "No arguments"); + +test(() => { + const argument = { "initial": 0 }; + assert_throws(new TypeError(), () => WebAssembly.Memory(argument)); +}, "Calling"); + +test(() => { + const invalidArguments = [ + undefined, + null, + false, + true, + "", + "test", + Symbol(), + 1, + NaN, + {}, + ]; + for (const invalidArgument of invalidArguments) { + assert_throws(new TypeError(), + () => new WebAssembly.Memory(invalidArgument), + `new Memory(${format_value(invalidArgument)})`); + } +}, "Invalid descriptor argument"); + +test(() => { + assert_throws(new TypeError(), () => new WebAssembly.Memory({ "initial": undefined })); +}, "Undefined initial value in descriptor"); + +const outOfRangeValues = [ + NaN, + Infinity, + -Infinity, + -1, + 0x100000000, + 0x1000000000, +]; + +for (const value of outOfRangeValues) { + test(() => { + assert_throws(new TypeError(), () => new WebAssembly.Memory({ "initial": value })); + }, `Out-of-range initial value in descriptor: ${format_value(value)}`); + + test(() => { + assert_throws(new TypeError(), () => new WebAssembly.Memory({ "initial": 0, "maximum": value })); + }, `Out-of-range maximum value in descriptor: ${format_value(value)}`); +} + +test(() => { + assert_throws(new RangeError(), () => new WebAssembly.Memory({ "initial": 10, "maximum": 9 })); +}, "Initial value exceeds maximum"); + +test(() => { + const proxy = new Proxy({}, { + has(o, x) { + assert_unreached(`Should not call [[HasProperty]] with ${x}`); + }, + get(o, x) { + return 0; + }, + }); + new WebAssembly.Memory(proxy); +}, "Proxy descriptor"); + +test(() => { + const order = []; + + new WebAssembly.Memory({ + get maximum() { + order.push("maximum"); + return { + valueOf() { + order.push("maximum valueOf"); + return 1; + }, + }; + }, + + get initial() { + order.push("initial"); + return { + valueOf() { + order.push("initial valueOf"); + return 1; + }, + }; + }, + }); + + assert_array_equals(order, [ + "initial", + "initial valueOf", + "maximum", + "maximum valueOf", + ]); +}, "Order of evaluation for descriptor"); + +test(() => { + const argument = { "initial": 0 }; + const memory = new WebAssembly.Memory(argument); + assert_Memory(memory, { "size": 0 }); +}, "Zero initial"); + +test(() => { + const argument = { "initial": 4 }; + const memory = new WebAssembly.Memory(argument); + assert_Memory(memory, { "size": 4 }); +}, "Non-zero initial"); + +test(() => { + const argument = { "initial": 0 }; + const memory = new WebAssembly.Memory(argument, {}); + assert_Memory(memory, { "size": 0 }); +}, "Stray argument"); diff --git a/test/js-api/memory/grow.any.js b/test/js-api/memory/grow.any.js new file mode 100644 index 00000000..1ccfb946 --- /dev/null +++ b/test/js-api/memory/grow.any.js @@ -0,0 +1,185 @@ +// META: global=jsshell + +function assert_ArrayBuffer(actual, expected, message) { + // https://github.com/WebAssembly/spec/issues/840 + assert_equals(Object.getPrototypeOf(actual), ArrayBuffer.prototype, + `${message}: prototype`); + if (expected.detached) { + // https://github.com/tc39/ecma262/issues/678 + let byteLength; + try { + byteLength = actual.byteLength; + } catch (e) { + byteLength = 0; + } + assert_equals(byteLength, 0, `${message}: detached size`); + } else { + assert_equals(actual.byteLength, 0x10000 * expected.size, `${message}: size`); + if (expected.size > 0) { + const array = new Uint8Array(actual); + assert_equals(array[0], 0, `${message}: first element`); + assert_equals(array[array.byteLength - 1], 0, `${message}: last element`); + } + } +} + +test(() => { + const argument = { "initial": 0 }; + const memory = new WebAssembly.Memory(argument); + assert_throws(new TypeError(), () => memory.grow()); +}, "Missing arguments"); + +test(t => { + const thisValues = [ + undefined, + null, + true, + "", + Symbol(), + 1, + {}, + WebAssembly.Memory, + WebAssembly.Memory.prototype, + ]; + + const argument = { + valueOf: t.unreached_func("Should not touch the argument (valueOf)"), + toString: t.unreached_func("Should not touch the argument (toString)"), + }; + + const fn = WebAssembly.Memory.prototype.grow; + + for (const thisValue of thisValues) { + assert_throws(new TypeError(), () => fn.call(thisValue, argument), `this=${format_value(thisValue)}`); + } +}, "Branding"); + +test(() => { + const argument = { "initial": 0 }; + const memory = new WebAssembly.Memory(argument); + const oldMemory = memory.buffer; + assert_ArrayBuffer(oldMemory, { "size": 0 }, "Buffer before growing"); + + const result = memory.grow(2); + assert_equals(result, 0); + + const newMemory = memory.buffer; + assert_not_equals(oldMemory, newMemory); + assert_ArrayBuffer(oldMemory, { "detached": true }, "Old buffer after growing"); + assert_ArrayBuffer(newMemory, { "size": 2 }, "New buffer after growing"); +}, "Zero initial"); + +test(() => { + const argument = { "initial": { valueOf() { return 0 } } }; + const memory = new WebAssembly.Memory(argument); + const oldMemory = memory.buffer; + assert_ArrayBuffer(oldMemory, { "size": 0 }, "Buffer before growing"); + + const result = memory.grow({ valueOf() { return 2 } }); + assert_equals(result, 0); + + const newMemory = memory.buffer; + assert_not_equals(oldMemory, newMemory); + assert_ArrayBuffer(oldMemory, { "detached": true }, "Old buffer after growing"); + assert_ArrayBuffer(newMemory, { "size": 2 }, "New buffer after growing"); +}, "Zero initial with valueOf"); + +test(() => { + const argument = { "initial": 3 }; + const memory = new WebAssembly.Memory(argument); + const oldMemory = memory.buffer; + assert_ArrayBuffer(oldMemory, { "size": 3 }, "Buffer before growing"); + + const result = memory.grow(2); + assert_equals(result, 3); + + const newMemory = memory.buffer; + assert_not_equals(oldMemory, newMemory); + assert_ArrayBuffer(oldMemory, { "detached": true }, "Old buffer after growing"); + assert_ArrayBuffer(newMemory, { "size": 5 }, "New buffer after growing"); +}, "Non-zero initial"); + +test(() => { + const argument = { "initial": 0, "maximum": 2 }; + const memory = new WebAssembly.Memory(argument); + const oldMemory = memory.buffer; + assert_ArrayBuffer(oldMemory, { "size": 0 }, "Buffer before growing"); + + const result = memory.grow(2); + assert_equals(result, 0); + + const newMemory = memory.buffer; + assert_not_equals(oldMemory, newMemory); + assert_ArrayBuffer(oldMemory, { "detached": true }, "Old buffer after growing"); + assert_ArrayBuffer(newMemory, { "size": 2 }, "New buffer after growing"); +}, "Zero initial with respected maximum"); + +test(() => { + const argument = { "initial": 0, "maximum": 2 }; + const memory = new WebAssembly.Memory(argument); + const oldMemory = memory.buffer; + assert_ArrayBuffer(oldMemory, { "size": 0 }, "Buffer before growing"); + + const result = memory.grow(1); + assert_equals(result, 0); + + const newMemory = memory.buffer; + assert_not_equals(oldMemory, newMemory); + assert_ArrayBuffer(oldMemory, { "detached": true }, "Old buffer after growing once"); + assert_ArrayBuffer(newMemory, { "size": 1 }, "New buffer after growing once"); + + const result2 = memory.grow(1); + assert_equals(result2, 1); + + const newestMemory = memory.buffer; + assert_not_equals(newMemory, newestMemory); + assert_ArrayBuffer(oldMemory, { "detached": true }, "New buffer after growing twice"); + assert_ArrayBuffer(newMemory, { "detached": true }, "New buffer after growing twice"); + assert_ArrayBuffer(newestMemory, { "size": 2 }, "Newest buffer after growing twice"); +}, "Zero initial with respected maximum grown twice"); + +test(() => { + const argument = { "initial": 1, "maximum": 2 }; + const memory = new WebAssembly.Memory(argument); + const oldMemory = memory.buffer; + assert_ArrayBuffer(oldMemory, { "size": 1 }, "Buffer before growing"); + + assert_throws(new RangeError(), () => memory.grow(2)); + assert_equals(memory.buffer, oldMemory); + assert_ArrayBuffer(memory.buffer, { "size": 1 }, "Buffer before trying to grow"); +}, "Zero initial growing too much"); + +const outOfRangeValues = [ + undefined, + NaN, + Infinity, + -Infinity, + -1, + 0x100000000, + 0x1000000000, + "0x100000000", + { valueOf() { return 0x100000000; } }, +]; + +for (const value of outOfRangeValues) { + test(() => { + const argument = { "initial": 0 }; + const memory = new WebAssembly.Memory(argument); + assert_throws(new TypeError(), () => memory.grow(value)); + }, `Out-of-range argument: ${format_value(value)}`); +} + +test(() => { + const argument = { "initial": 0 }; + const memory = new WebAssembly.Memory(argument); + const oldMemory = memory.buffer; + assert_ArrayBuffer(oldMemory, { "size": 0 }, "Buffer before growing"); + + const result = memory.grow(2, {}); + assert_equals(result, 0); + + const newMemory = memory.buffer; + assert_not_equals(oldMemory, newMemory); + assert_ArrayBuffer(oldMemory, { "detached": true }, "Old buffer after growing"); + assert_ArrayBuffer(newMemory, { "size": 2 }, "New buffer after growing"); +}, "Stray argument"); diff --git a/test/js-api/memory/toString.any.js b/test/js-api/memory/toString.any.js new file mode 100644 index 00000000..4e15d75e --- /dev/null +++ b/test/js-api/memory/toString.any.js @@ -0,0 +1,7 @@ +// META: global=jsshell + +test(() => { + const argument = { "initial": 0 }; + const memory = new WebAssembly.Memory(argument); + assert_class_string(memory, "WebAssembly.Memory"); +}, "Object.prototype.toString on an Memory"); diff --git a/test/js-api/module/constructor.any.js b/test/js-api/module/constructor.any.js new file mode 100644 index 00000000..1d01ea5b --- /dev/null +++ b/test/js-api/module/constructor.any.js @@ -0,0 +1,64 @@ +// META: global=jsshell +// META: script=/wasm/jsapi/wasm-module-builder.js +// META: script=/wasm/jsapi/assertions.js + +let emptyModuleBinary; +setup(() => { + emptyModuleBinary = new WasmModuleBuilder().toBuffer(); +}); + +test(() => { + assert_function_name(WebAssembly.Module, "Module", "WebAssembly.Module"); +}, "name"); + +test(() => { + assert_function_length(WebAssembly.Module, 1, "WebAssembly.Module"); +}, "length"); + +test(() => { + assert_throws(new TypeError(), () => new WebAssembly.Module()); +}, "No arguments"); + +test(() => { + assert_throws(new TypeError(), () => WebAssembly.Module(emptyModuleBinary)); +}, "Calling"); + +test(() => { + const invalidArguments = [ + undefined, + null, + true, + "test", + Symbol(), + 7, + NaN, + {}, + ArrayBuffer, + ArrayBuffer.prototype, + Array.from(emptyModuleBinary), + ]; + for (const argument of invalidArguments) { + assert_throws(new TypeError(), () => new WebAssembly.Module(argument), + `new Module(${format_value(argument)})`); + } +}, "Invalid arguments"); + +test(() => { + const buffer = new Uint8Array(); + assert_throws(new WebAssembly.CompileError(), () => new WebAssembly.Module(buffer)); +}, "Empty buffer"); + +test(() => { + const module = new WebAssembly.Module(emptyModuleBinary); + assert_equals(Object.getPrototypeOf(module), WebAssembly.Module.prototype); +}, "Prototype"); + +test(() => { + const module = new WebAssembly.Module(emptyModuleBinary); + assert_true(Object.isExtensible(module)); +}, "Extensibility"); + +test(() => { + const module = new WebAssembly.Module(emptyModuleBinary, {}); + assert_equals(Object.getPrototypeOf(module), WebAssembly.Module.prototype); +}, "Stray argument"); diff --git a/test/js-api/module/customSections.any.js b/test/js-api/module/customSections.any.js new file mode 100644 index 00000000..8e9732e5 --- /dev/null +++ b/test/js-api/module/customSections.any.js @@ -0,0 +1,164 @@ +// META: global=jsshell +// META: script=/wasm/jsapi/wasm-module-builder.js + +function assert_ArrayBuffer(buffer, expected) { + assert_equals(Object.getPrototypeOf(buffer), ArrayBuffer.prototype, "Prototype"); + assert_true(Object.isExtensible(buffer), "isExtensible"); + assert_array_equals(new Uint8Array(buffer), expected); +} + +function assert_sections(sections, expected) { + assert_true(Array.isArray(sections), "Should be array"); + assert_equals(Object.getPrototypeOf(sections), Array.prototype, "Prototype"); + assert_true(Object.isExtensible(sections), "isExtensible"); + + assert_equals(sections.length, expected.length); + for (let i = 0; i < expected.length; ++i) { + assert_ArrayBuffer(sections[i], expected[i]); + } +} + +let emptyModuleBinary; +setup(() => { + emptyModuleBinary = new WasmModuleBuilder().toBuffer(); +}); + +test(() => { + assert_throws(new TypeError(), () => WebAssembly.Module.customSections()); + const module = new WebAssembly.Module(emptyModuleBinary); + assert_throws(new TypeError(), () => WebAssembly.Module.customSections(module)); +}, "Missing arguments"); + +test(() => { + const invalidArguments = [ + undefined, + null, + true, + "", + Symbol(), + 1, + {}, + WebAssembly.Module, + WebAssembly.Module.prototype, + ]; + for (const argument of invalidArguments) { + assert_throws(new TypeError(), () => WebAssembly.Module.customSections(argument, ""), + `customSections(${format_value(argument)})`); + } +}, "Non-Module arguments"); + +test(() => { + const module = new WebAssembly.Module(emptyModuleBinary); + const fn = WebAssembly.Module.customSections; + const thisValues = [ + undefined, + null, + true, + "", + Symbol(), + 1, + {}, + WebAssembly.Module, + WebAssembly.Module.prototype, + ]; + for (const thisValue of thisValues) { + assert_sections(fn.call(thisValue, module, ""), []); + } +}, "Branding"); + +test(() => { + const module = new WebAssembly.Module(emptyModuleBinary); + assert_sections(WebAssembly.Module.customSections(module, ""), []); +}, "Empty module"); + +test(() => { + const module = new WebAssembly.Module(emptyModuleBinary); + assert_not_equals(WebAssembly.Module.customSections(module, ""), + WebAssembly.Module.customSections(module, "")); +}, "Empty module: array caching"); + +test(() => { + const bytes1 = [87, 101, 98, 65, 115, 115, 101, 109, 98, 108, 121]; + const bytes2 = [74, 83, 65, 80, 73]; + + const binary = new Binary; + binary.emit_section(kUnknownSectionCode, section => { + section.emit_string("name"); + section.emit_bytes(bytes1); + }); + binary.emit_section(kUnknownSectionCode, section => { + section.emit_string("name"); + section.emit_bytes(bytes2); + }); + binary.emit_section(kUnknownSectionCode, section => { + section.emit_string("foo"); + section.emit_bytes(bytes1); + }); + + const builder = new WasmModuleBuilder(); + builder.addExplicitSection(binary.trunc_buffer()); + const buffer = builder.toBuffer() + const module = new WebAssembly.Module(buffer); + + assert_sections(WebAssembly.Module.customSections(module, "name"), [ + bytes1, + bytes2, + ]) + + assert_sections(WebAssembly.Module.customSections(module, "foo"), [ + bytes1, + ]) + + assert_sections(WebAssembly.Module.customSections(module, ""), []) + assert_sections(WebAssembly.Module.customSections(module, "\0"), []) + assert_sections(WebAssembly.Module.customSections(module, "name\0"), []) + assert_sections(WebAssembly.Module.customSections(module, "foo\0"), []) +}, "Custom sections"); + +test(() => { + const bytes = [87, 101, 98, 65, 115, 115, 101, 109, 98, 108, 121]; + const name = "yee\uD801\uDC37eey" + + const binary = new Binary; + binary.emit_section(kUnknownSectionCode, section => { + section.emit_string(name); + section.emit_bytes(bytes); + }); + + const builder = new WasmModuleBuilder(); + builder.addExplicitSection(binary.trunc_buffer()); + const buffer = builder.toBuffer(); + const module = new WebAssembly.Module(buffer); + + assert_sections(WebAssembly.Module.customSections(module, name), [ + bytes, + ]); + assert_sections(WebAssembly.Module.customSections(module, "yee\uFFFDeey"), []); + assert_sections(WebAssembly.Module.customSections(module, "yee\uFFFD\uFFFDeey"), []); +}, "Custom sections with surrogate pairs"); + +test(() => { + const bytes = [87, 101, 98, 65, 115, 115, 101, 109, 98, 108, 121]; + + const binary = new Binary; + binary.emit_section(kUnknownSectionCode, section => { + section.emit_string("na\uFFFDme"); + section.emit_bytes(bytes); + }); + + const builder = new WasmModuleBuilder(); + builder.addExplicitSection(binary.trunc_buffer()); + const buffer = builder.toBuffer(); + const module = new WebAssembly.Module(buffer); + + assert_sections(WebAssembly.Module.customSections(module, "name"), []); + assert_sections(WebAssembly.Module.customSections(module, "na\uFFFDme"), [ + bytes, + ]); + assert_sections(WebAssembly.Module.customSections(module, "na\uDC01me"), []); +}, "Custom sections with U+FFFD"); + +test(() => { + const module = new WebAssembly.Module(emptyModuleBinary); + assert_sections(WebAssembly.Module.customSections(module, "", {}), []); +}, "Stray argument"); diff --git a/test/js-api/module/exports.any.js b/test/js-api/module/exports.any.js new file mode 100644 index 00000000..eadfc84f --- /dev/null +++ b/test/js-api/module/exports.any.js @@ -0,0 +1,131 @@ +// META: global=jsshell +// META: script=/wasm/jsapi/wasm-module-builder.js + +let emptyModuleBinary; +setup(() => { + emptyModuleBinary = new WasmModuleBuilder().toBuffer(); +}); + +function assert_ModuleExportDescriptor(export_, expected) { + assert_equals(Object.getPrototypeOf(export_), Object.prototype, "Prototype"); + assert_true(Object.isExtensible(export_), "isExtensible"); + + const name = Object.getOwnPropertyDescriptor(export_, "name"); + assert_true(name.writable, "name: writable"); + assert_true(name.enumerable, "name: enumerable"); + assert_true(name.configurable, "name: configurable"); + assert_equals(name.value, expected.name); + + const kind = Object.getOwnPropertyDescriptor(export_, "kind"); + assert_true(kind.writable, "kind: writable"); + assert_true(kind.enumerable, "kind: enumerable"); + assert_true(kind.configurable, "kind: configurable"); + assert_equals(kind.value, expected.kind); +} + +function assert_exports(exports, expected) { + assert_true(Array.isArray(exports), "Should be array"); + assert_equals(Object.getPrototypeOf(exports), Array.prototype, "Prototype"); + assert_true(Object.isExtensible(exports), "isExtensible"); + + assert_equals(exports.length, expected.length); + for (let i = 0; i < expected.length; ++i) { + assert_ModuleExportDescriptor(exports[i], expected[i]); + } +} + +test(() => { + assert_throws(new TypeError(), () => WebAssembly.Module.exports()); +}, "Missing arguments"); + +test(() => { + const invalidArguments = [ + undefined, + null, + true, + "", + Symbol(), + 1, + {}, + WebAssembly.Module, + WebAssembly.Module.prototype, + ]; + for (const argument of invalidArguments) { + assert_throws(new TypeError(), () => WebAssembly.Module.exports(argument), + `exports(${format_value(argument)})`); + } +}, "Non-Module arguments"); + +test(() => { + const module = new WebAssembly.Module(emptyModuleBinary); + const fn = WebAssembly.Module.exports; + const thisValues = [ + undefined, + null, + true, + "", + Symbol(), + 1, + {}, + WebAssembly.Module, + WebAssembly.Module.prototype, + ]; + for (const thisValue of thisValues) { + assert_array_equals(fn.call(thisValue, module), []); + } +}, "Branding"); + +test(() => { + const module = new WebAssembly.Module(emptyModuleBinary); + const exports = WebAssembly.Module.exports(module); + assert_exports(exports, []); +}, "Empty module"); + +test(() => { + const module = new WebAssembly.Module(emptyModuleBinary); + assert_not_equals(WebAssembly.Module.exports(module), WebAssembly.Module.exports(module)); +}, "Empty module: array caching"); + +test(() => { + const builder = new WasmModuleBuilder(); + + builder + .addFunction("fn", kSig_v_v) + .addBody([]) + .exportFunc(); + builder + .addFunction("fn2", kSig_v_v) + .addBody([]) + .exportFunc(); + + builder.setTableBounds(1); + builder.addExportOfKind("table", kExternalTable, 0); + + builder.addGlobal(kWasmI32, true) + .exportAs("global") + .init = 7; + builder.addGlobal(kWasmF64, true) + .exportAs("global2") + .init = 1.2; + + builder.addMemory(0, 256, true); + + const buffer = builder.toBuffer() + const module = new WebAssembly.Module(buffer); + const exports = WebAssembly.Module.exports(module); + const expected = [ + { "kind": "function", "name": "fn" }, + { "kind": "function", "name": "fn2" }, + { "kind": "table", "name": "table" }, + { "kind": "global", "name": "global" }, + { "kind": "global", "name": "global2" }, + { "kind": "memory", "name": "memory" }, + ]; + assert_exports(exports, expected); +}, "exports"); + +test(() => { + const module = new WebAssembly.Module(emptyModuleBinary); + const exports = WebAssembly.Module.exports(module, {}); + assert_exports(exports, []); +}, "Stray argument"); diff --git a/test/js-api/module/imports.any.js b/test/js-api/module/imports.any.js new file mode 100644 index 00000000..9d7ef2f0 --- /dev/null +++ b/test/js-api/module/imports.any.js @@ -0,0 +1,125 @@ +// META: global=jsshell +// META: script=/wasm/jsapi/wasm-module-builder.js + +function assert_ModuleImportDescriptor(import_, expected) { + assert_equals(Object.getPrototypeOf(import_), Object.prototype, "Prototype"); + assert_true(Object.isExtensible(import_), "isExtensible"); + + const module = Object.getOwnPropertyDescriptor(import_, "module"); + assert_true(module.writable, "module: writable"); + assert_true(module.enumerable, "module: enumerable"); + assert_true(module.configurable, "module: configurable"); + assert_equals(module.value, expected.module); + + const name = Object.getOwnPropertyDescriptor(import_, "name"); + assert_true(name.writable, "name: writable"); + assert_true(name.enumerable, "name: enumerable"); + assert_true(name.configurable, "name: configurable"); + assert_equals(name.value, expected.name); + + const kind = Object.getOwnPropertyDescriptor(import_, "kind"); + assert_true(kind.writable, "kind: writable"); + assert_true(kind.enumerable, "kind: enumerable"); + assert_true(kind.configurable, "kind: configurable"); + assert_equals(kind.value, expected.kind); +} + +function assert_imports(imports, expected) { + assert_true(Array.isArray(imports), "Should be array"); + assert_equals(Object.getPrototypeOf(imports), Array.prototype, "Prototype"); + assert_true(Object.isExtensible(imports), "isExtensible"); + + assert_equals(imports.length, expected.length); + for (let i = 0; i < expected.length; ++i) { + assert_ModuleImportDescriptor(imports[i], expected[i]); + } +} + +let emptyModuleBinary; +setup(() => { + emptyModuleBinary = new WasmModuleBuilder().toBuffer(); +}); + +test(() => { + assert_throws(new TypeError(), () => WebAssembly.Module.imports()); +}, "Missing arguments"); + +test(() => { + const invalidArguments = [ + undefined, + null, + true, + "", + Symbol(), + 1, + {}, + WebAssembly.Module, + WebAssembly.Module.prototype, + ]; + for (const argument of invalidArguments) { + assert_throws(new TypeError(), () => WebAssembly.Module.imports(argument), + `imports(${format_value(argument)})`); + } +}, "Non-Module arguments"); + +test(() => { + const module = new WebAssembly.Module(emptyModuleBinary); + const fn = WebAssembly.Module.imports; + const thisValues = [ + undefined, + null, + true, + "", + Symbol(), + 1, + {}, + WebAssembly.Module, + WebAssembly.Module.prototype, + ]; + for (const thisValue of thisValues) { + assert_array_equals(fn.call(thisValue, module), []); + } +}, "Branding"); + +test(() => { + const module = new WebAssembly.Module(emptyModuleBinary); + const imports = WebAssembly.Module.imports(module); + assert_true(Array.isArray(imports)); +}, "Return type"); + +test(() => { + const module = new WebAssembly.Module(emptyModuleBinary); + const imports = WebAssembly.Module.imports(module); + assert_imports(imports, []); +}, "Empty module"); + +test(() => { + const module = new WebAssembly.Module(emptyModuleBinary); + assert_not_equals(WebAssembly.Module.imports(module), WebAssembly.Module.imports(module)); +}, "Empty module: array caching"); + +test(() => { + const builder = new WasmModuleBuilder(); + + builder.addImport("module", "fn", kSig_v_v); + builder.addImportedGlobal("module", "global", kWasmI32); + builder.addImportedMemory("module", "memory", 0, 128); + builder.addImportedTable("module", "table", 0, 128); + + const buffer = builder.toBuffer() + const module = new WebAssembly.Module(buffer); + const imports = WebAssembly.Module.imports(module); + const expected = [ + { "module": "module", "kind": "function", "name": "fn" }, + { "module": "module", "kind": "global", "name": "global" }, + { "module": "module", "kind": "memory", "name": "memory" }, + { "module": "module", "kind": "table", "name": "table" }, + ]; + assert_imports(imports, expected); +}, "imports"); + +test(() => { + const module = new WebAssembly.Module(emptyModuleBinary); + const imports = WebAssembly.Module.imports(module, {}); + assert_imports(imports, []); +}, "Stray argument"); diff --git a/test/js-api/module/toString.any.js b/test/js-api/module/toString.any.js new file mode 100644 index 00000000..2db2002f --- /dev/null +++ b/test/js-api/module/toString.any.js @@ -0,0 +1,8 @@ +// META: global=jsshell +// META: script=/wasm/jsapi/wasm-module-builder.js + +test(() => { + const emptyModuleBinary = new WasmModuleBuilder().toBuffer(); + const module = new WebAssembly.Module(emptyModuleBinary); + assert_class_string(module, "WebAssembly.Module"); +}, "Object.prototype.toString on an Module"); diff --git a/test/js-api/table/assertions.js b/test/js-api/table/assertions.js new file mode 100644 index 00000000..c88972b4 --- /dev/null +++ b/test/js-api/table/assertions.js @@ -0,0 +1,13 @@ +function assert_equal_to_array(table, expected, message) { + assert_equals(table.length, expected.length, `${message}: length`); + // The argument check in get() happens before the range check, and negative numbers + // are illegal, hence will throw TypeError per spec. + assert_throws(new TypeError(), () => table.get(-1), `${message}: table.get(-1)`); + for (let i = 0; i < expected.length; ++i) { + assert_equals(table.get(i), expected[i], `${message}: table.get(${i} of ${expected.length})`); + } + assert_throws(new RangeError(), () => table.get(expected.length), + `${message}: table.get(${expected.length} of ${expected.length})`); + assert_throws(new RangeError(), () => table.get(expected.length + 1), + `${message}: table.get(${expected.length + 1} of ${expected.length})`); +} diff --git a/test/js-api/table/constructor.any.js b/test/js-api/table/constructor.any.js new file mode 100644 index 00000000..99eee19f --- /dev/null +++ b/test/js-api/table/constructor.any.js @@ -0,0 +1,179 @@ +// META: global=jsshell +// META: script=/wasm/jsapi/assertions.js + +function assert_Table(actual, expected) { + assert_equals(Object.getPrototypeOf(actual), WebAssembly.Table.prototype, + "prototype"); + assert_true(Object.isExtensible(actual), "extensible"); + + assert_equals(actual.length, expected.length, "length"); + for (let i = 0; i < expected.length; ++i) { + assert_equals(actual.get(i), null, `actual.get(${i})`); + } +} + +test(() => { + assert_function_name(WebAssembly.Table, "Table", "WebAssembly.Table"); +}, "name"); + +test(() => { + assert_function_length(WebAssembly.Table, 1, "WebAssembly.Table"); +}, "length"); + +test(() => { + assert_throws(new TypeError(), () => new WebAssembly.Table()); +}, "No arguments"); + +test(() => { + const argument = { "element": "anyfunc", "initial": 0 }; + assert_throws(new TypeError(), () => WebAssembly.Table(argument)); +}, "Calling"); + +test(() => { + assert_throws(new TypeError(), () => new WebAssembly.Table({})); +}, "Empty descriptor"); + +test(() => { + const invalidArguments = [ + undefined, + null, + false, + true, + "", + "test", + Symbol(), + 1, + NaN, + {}, + ]; + for (const invalidArgument of invalidArguments) { + assert_throws(new TypeError(), + () => new WebAssembly.Table(invalidArgument), + `new Table(${format_value(invalidArgument)})`); + } +}, "Invalid descriptor argument"); + +test(() => { + assert_throws(new TypeError(), () => new WebAssembly.Table({ "element": "anyfunc", "initial": undefined })); +}, "Undefined initial value in descriptor"); + +test(() => { + assert_throws(new TypeError(), () => new WebAssembly.Table({ "element": undefined, "initial": 0 })); +}, "Undefined element value in descriptor"); + +const outOfRangeValues = [ + NaN, + Infinity, + -Infinity, + -1, + 0x100000000, + 0x1000000000, +]; + +for (const value of outOfRangeValues) { + test(() => { + assert_throws(new TypeError(), () => new WebAssembly.Table({ "element": "anyfunc", "initial": value })); + }, `Out-of-range initial value in descriptor: ${format_value(value)}`); + + test(() => { + assert_throws(new TypeError(), () => new WebAssembly.Table({ "element": "anyfunc", "initial": 0, "maximum": value })); + }, `Out-of-range maximum value in descriptor: ${format_value(value)}`); +} + +test(() => { + assert_throws(new RangeError(), () => new WebAssembly.Table({ "element": "anyfunc", "initial": 10, "maximum": 9 })); +}, "Initial value exceeds maximum"); + +test(() => { + const argument = { "element": "anyfunc", "initial": 0 }; + const table = new WebAssembly.Table(argument); + assert_Table(table, { "length": 0 }); +}, "Basic (zero)"); + +test(() => { + const argument = { "element": "anyfunc", "initial": 5 }; + const table = new WebAssembly.Table(argument); + assert_Table(table, { "length": 5 }); +}, "Basic (non-zero)"); + +test(() => { + const argument = { "element": "anyfunc", "initial": 0 }; + const table = new WebAssembly.Table(argument, {}); + assert_Table(table, { "length": 0 }); +}, "Stray argument"); + +test(() => { + const proxy = new Proxy({}, { + has(o, x) { + assert_unreached(`Should not call [[HasProperty]] with ${x}`); + }, + get(o, x) { + switch (x) { + case "element": + return "anyfunc"; + case "initial": + case "maximum": + return 0; + default: + return undefined; + } + }, + }); + const table = new WebAssembly.Table(proxy); + assert_Table(table, { "length": 0 }); +}, "Proxy descriptor"); + +test(() => { + const table = new WebAssembly.Table({ + "element": { + toString() { return "anyfunc"; }, + }, + "initial": 1, + }); + assert_Table(table, { "length": 1 }); +}, "Type conversion for descriptor.element"); + +test(() => { + const order = []; + + new WebAssembly.Table({ + get maximum() { + order.push("maximum"); + return { + valueOf() { + order.push("maximum valueOf"); + return 1; + }, + }; + }, + + get initial() { + order.push("initial"); + return { + valueOf() { + order.push("initial valueOf"); + return 1; + }, + }; + }, + + get element() { + order.push("element"); + return { + toString() { + order.push("element toString"); + return "anyfunc"; + }, + }; + }, + }); + + assert_array_equals(order, [ + "element", + "element toString", + "initial", + "initial valueOf", + "maximum", + "maximum valueOf", + ]); +}, "Order of evaluation for descriptor"); diff --git a/test/js-api/table/get-set.any.js b/test/js-api/table/get-set.any.js new file mode 100644 index 00000000..82aa8895 --- /dev/null +++ b/test/js-api/table/get-set.any.js @@ -0,0 +1,225 @@ +// META: global=jsshell +// META: script=/wasm/jsapi/wasm-module-builder.js +// META: script=assertions.js + +let functions; +setup(() => { + const builder = new WasmModuleBuilder(); + + builder + .addFunction("fn", kSig_v_d) + .addBody([]) + .exportFunc(); + builder + .addFunction("fn2", kSig_v_v) + .addBody([]) + .exportFunc(); + + const buffer = builder.toBuffer() + const module = new WebAssembly.Module(buffer); + const instance = new WebAssembly.Instance(module, {}); + functions = instance.exports; +}); + +test(() => { + const argument = { "element": "anyfunc", "initial": 5 }; + const table = new WebAssembly.Table(argument); + assert_throws(new TypeError(), () => table.get()); +}, "Missing arguments: get"); + +test(t => { + const thisValues = [ + undefined, + null, + true, + "", + Symbol(), + 1, + {}, + WebAssembly.Table, + WebAssembly.Table.prototype, + ]; + + const argument = { + valueOf: t.unreached_func("Should not touch the argument (valueOf)"), + toString: t.unreached_func("Should not touch the argument (toString)"), + }; + + const fn = WebAssembly.Table.prototype.get; + + for (const thisValue of thisValues) { + assert_throws(new TypeError(), () => fn.call(thisValue, argument), `this=${format_value(thisValue)}`); + } +}, "Branding: get"); + +test(() => { + const argument = { "element": "anyfunc", "initial": 5 }; + const table = new WebAssembly.Table(argument); + assert_throws(new TypeError(), () => table.set()); + assert_throws(new TypeError(), () => table.set(0)); +}, "Missing arguments: set"); + +test(t => { + const thisValues = [ + undefined, + null, + true, + "", + Symbol(), + 1, + {}, + WebAssembly.Table, + WebAssembly.Table.prototype, + ]; + + const argument = { + valueOf: t.unreached_func("Should not touch the argument (valueOf)"), + toString: t.unreached_func("Should not touch the argument (toString)"), + }; + + const fn = WebAssembly.Table.prototype.set; + + for (const thisValue of thisValues) { + assert_throws(new TypeError(), () => fn.call(thisValue, argument, null), `this=${format_value(thisValue)}`); + } +}, "Branding: set"); + +test(() => { + const argument = { "element": "anyfunc", "initial": 5 }; + const table = new WebAssembly.Table(argument); + assert_equal_to_array(table, [null, null, null, null, null]); + + const {fn, fn2} = functions; + + assert_equals(table.set(0, fn), undefined, "set() returns undefined."); + table.set(2, fn2); + table.set(4, fn); + + assert_equal_to_array(table, [fn, null, fn2, null, fn]); + + table.set(0, null); + assert_equal_to_array(table, [null, null, fn2, null, fn]); +}, "Basic"); + +test(() => { + const argument = { "element": "anyfunc", "initial": 5 }; + const table = new WebAssembly.Table(argument); + assert_equal_to_array(table, [null, null, null, null, null]); + + const {fn, fn2} = functions; + + table.set(0, fn); + table.set(2, fn2); + table.set(4, fn); + + assert_equal_to_array(table, [fn, null, fn2, null, fn]); + + table.grow(4); + + assert_equal_to_array(table, [fn, null, fn2, null, fn, null, null, null, null]); +}, "Growing"); + +test(() => { + const argument = { "element": "anyfunc", "initial": 5 }; + const table = new WebAssembly.Table(argument); + assert_equal_to_array(table, [null, null, null, null, null]); + + const {fn} = functions; + + // -1 is the wrong type hence the type check on entry gets this + // before the range check does. + assert_throws(new TypeError(), () => table.set(-1, fn)); + assert_throws(new RangeError(), () => table.set(5, fn)); + assert_equal_to_array(table, [null, null, null, null, null]); +}, "Setting out-of-bounds"); + +test(() => { + const argument = { "element": "anyfunc", "initial": 1 }; + const table = new WebAssembly.Table(argument); + assert_equal_to_array(table, [null]); + + const invalidArguments = [ + undefined, + true, + false, + "test", + Symbol(), + 7, + NaN, + {}, + ]; + for (const argument of invalidArguments) { + assert_throws(new TypeError(), () => table.set(0, argument), + `set(${format_value(argument)})`); + } + assert_equal_to_array(table, [null]); +}, "Setting non-function"); + +test(() => { + const argument = { "element": "anyfunc", "initial": 1 }; + const table = new WebAssembly.Table(argument); + assert_equal_to_array(table, [null]); + + const fn = function() {}; + assert_throws(new TypeError(), () => table.set(0, fn)); + assert_equal_to_array(table, [null]); +}, "Setting non-wasm function"); + +test(() => { + const argument = { "element": "anyfunc", "initial": 1 }; + const table = new WebAssembly.Table(argument); + assert_equal_to_array(table, [null]); + + const fn = () => {}; + assert_throws(new TypeError(), () => table.set(0, fn)); + assert_equal_to_array(table, [null]); +}, "Setting non-wasm arrow function"); + +const outOfRangeValues = [ + undefined, + NaN, + Infinity, + -Infinity, + -1, + 0x100000000, + 0x1000000000, + "0x100000000", + { valueOf() { return 0x100000000; } }, +]; + +for (const value of outOfRangeValues) { + test(() => { + const argument = { "element": "anyfunc", "initial": 1 }; + const table = new WebAssembly.Table(argument); + assert_throws(new TypeError(), () => table.get(value)); + }, `Getting out-of-range argument: ${format_value(value)}`); + + test(() => { + const argument = { "element": "anyfunc", "initial": 1 }; + const table = new WebAssembly.Table(argument); + assert_throws(new TypeError(), () => table.set(value, null)); + }, `Setting out-of-range argument: ${format_value(value)}`); +} + +test(() => { + const argument = { "element": "anyfunc", "initial": 1 }; + const table = new WebAssembly.Table(argument); + let called = 0; + const value = { + valueOf() { + called++; + return 0; + }, + }; + assert_throws(new TypeError(), () => table.set(value, {})); + assert_equals(called, 1); +}, "Order of argument conversion"); + +test(() => { + const {fn} = functions; + const argument = { "element": "anyfunc", "initial": 1 }; + const table = new WebAssembly.Table(argument); + + assert_equals(table.get(0, {}), null); + assert_equals(table.set(0, fn, {}), undefined); +}, "Stray argument"); diff --git a/test/js-api/table/grow.any.js b/test/js-api/table/grow.any.js new file mode 100644 index 00000000..4978e3ca --- /dev/null +++ b/test/js-api/table/grow.any.js @@ -0,0 +1,96 @@ +// META: global=jsshell +// META: script=assertions.js + +function nulls(n) { + return Array(n).fill(null); +} + +test(() => { + const argument = { "element": "anyfunc", "initial": 5 }; + const table = new WebAssembly.Table(argument); + assert_throws(new TypeError(), () => table.grow()); +}, "Missing arguments"); + +test(t => { + const thisValues = [ + undefined, + null, + true, + "", + Symbol(), + 1, + {}, + WebAssembly.Table, + WebAssembly.Table.prototype, + ]; + + const argument = { + valueOf: t.unreached_func("Should not touch the argument (valueOf)"), + toString: t.unreached_func("Should not touch the argument (toString)"), + }; + + const fn = WebAssembly.Table.prototype.grow; + + for (const thisValue of thisValues) { + assert_throws(new TypeError(), () => fn.call(thisValue, argument), `this=${format_value(thisValue)}`); + } +}, "Branding"); + +test(() => { + const argument = { "element": "anyfunc", "initial": 5 }; + const table = new WebAssembly.Table(argument); + assert_equal_to_array(table, nulls(5), "before"); + + const result = table.grow(3); + assert_equals(result, 5); + assert_equal_to_array(table, nulls(8), "after"); +}, "Basic"); + +test(() => { + const argument = { "element": "anyfunc", "initial": 3, "maximum": 5 }; + const table = new WebAssembly.Table(argument); + assert_equal_to_array(table, nulls(3), "before"); + + const result = table.grow(2); + assert_equals(result, 3); + assert_equal_to_array(table, nulls(5), "after"); +}, "Reached maximum"); + +test(() => { + const argument = { "element": "anyfunc", "initial": 2, "maximum": 5 }; + const table = new WebAssembly.Table(argument); + assert_equal_to_array(table, nulls(2), "before"); + + assert_throws(new RangeError(), () => table.grow(4)); + assert_equal_to_array(table, nulls(2), "after"); +}, "Exceeded maximum"); + +const outOfRangeValues = [ + undefined, + NaN, + Infinity, + -Infinity, + -1, + 0x100000000, + 0x1000000000, + "0x100000000", + { valueOf() { return 0x100000000; } }, +]; + +for (const value of outOfRangeValues) { + test(() => { + const argument = { "element": "anyfunc", "initial": 1 }; + const table = new WebAssembly.Table(argument); + assert_throws(new TypeError(), () => table.grow(value)); + }, `Out-of-range argument: ${format_value(value)}`); +} + +test(() => { + const argument = { "element": "anyfunc", "initial": 5 }; + const table = new WebAssembly.Table(argument); + assert_equal_to_array(table, nulls(5), "before"); + + const result = table.grow(3, {}); + assert_equals(result, 5); + assert_equal_to_array(table, nulls(8), "after"); +}, "Stray argument"); diff --git a/test/js-api/table/length.any.js b/test/js-api/table/length.any.js new file mode 100644 index 00000000..b1bfa6cf --- /dev/null +++ b/test/js-api/table/length.any.js @@ -0,0 +1,60 @@ +// META: global=jsshell + +test(() => { + const thisValues = [ + undefined, + null, + true, + "", + Symbol(), + 1, + {}, + WebAssembly.Table, + WebAssembly.Table.prototype, + ]; + + const desc = Object.getOwnPropertyDescriptor(WebAssembly.Table.prototype, "length"); + assert_equals(typeof desc, "object"); + + const getter = desc.get; + assert_equals(typeof getter, "function"); + + assert_equals(typeof desc.set, "undefined"); + + for (const thisValue of thisValues) { + assert_throws(new TypeError(), () => getter.call(thisValue), `this=${format_value(thisValue)}`); + } +}, "Branding"); + +test(() => { + const argument = { "element": "anyfunc", "initial": 2 }; + const table = new WebAssembly.Table(argument); + assert_equals(table.length, 2, "Initial length"); + + const desc = Object.getOwnPropertyDescriptor(WebAssembly.Table.prototype, "length"); + assert_equals(typeof desc, "object"); + + const getter = desc.get; + assert_equals(typeof getter, "function"); + + assert_equals(getter.call(table, {}), 2); +}, "Stray argument"); + +test(() => { + const argument = { "element": "anyfunc", "initial": 2 }; + const table = new WebAssembly.Table(argument); + assert_equals(table.length, 2, "Initial length"); + table.length = 4; + assert_equals(table.length, 2, "Should not change the length"); +}, "Setting (sloppy mode)"); + +test(() => { + const argument = { "element": "anyfunc", "initial": 2 }; + const table = new WebAssembly.Table(argument); + assert_equals(table.length, 2, "Initial length"); + assert_throws(new TypeError(), () => { + "use strict"; + table.length = 4; + }); + assert_equals(table.length, 2, "Should not change the length"); +}, "Setting (strict mode)"); diff --git a/test/js-api/table/toString.any.js b/test/js-api/table/toString.any.js new file mode 100644 index 00000000..e5764779 --- /dev/null +++ b/test/js-api/table/toString.any.js @@ -0,0 +1,7 @@ +// META: global=jsshell + +test(() => { + const argument = { "element": "anyfunc", "initial": 0 }; + const table = new WebAssembly.Table(argument); + assert_class_string(table, "WebAssembly.Table"); +}, "Object.prototype.toString on an Table"); diff --git a/test/js-api/wasm-module-builder.js b/test/js-api/wasm-module-builder.js new file mode 100644 index 00000000..a937eed4 --- /dev/null +++ b/test/js-api/wasm-module-builder.js @@ -0,0 +1,952 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Used for encoding f32 and double constants to bits. +let f32_view = new Float32Array(1); +let f32_bytes_view = new Uint8Array(f32_view.buffer); +let f64_view = new Float64Array(1); +let f64_bytes_view = new Uint8Array(f64_view.buffer); + +// The bytes function receives one of +// - several arguments, each of which is either a number or a string of length +// 1; if it's a string, the charcode of the contained character is used. +// - a single array argument containing the actual arguments +// - a single string; the returned buffer will contain the char codes of all +// contained characters. +function bytes(...input) { + if (input.length == 1 && typeof input[0] == 'array') input = input[0]; + if (input.length == 1 && typeof input[0] == 'string') { + let len = input[0].length; + let view = new Uint8Array(len); + for (let i = 0; i < len; i++) view[i] = input[0].charCodeAt(i); + return view.buffer; + } + let view = new Uint8Array(input.length); + for (let i = 0; i < input.length; i++) { + let val = input[i]; + if (typeof val == 'string') { + assertEquals(1, val.length, 'string inputs must have length 1'); + val = val.charCodeAt(0); + } + view[i] = val | 0; + } + return view.buffer; +} + +// Header declaration constants +var kWasmH0 = 0; +var kWasmH1 = 0x61; +var kWasmH2 = 0x73; +var kWasmH3 = 0x6d; + +var kWasmV0 = 0x1; +var kWasmV1 = 0; +var kWasmV2 = 0; +var kWasmV3 = 0; + +var kHeaderSize = 8; +var kPageSize = 65536; +var kSpecMaxPages = 65535; +var kMaxVarInt32Size = 5; +var kMaxVarInt64Size = 10; + +let kDeclNoLocals = 0; + +// Section declaration constants +let kUnknownSectionCode = 0; +let kTypeSectionCode = 1; // Function signature declarations +let kImportSectionCode = 2; // Import declarations +let kFunctionSectionCode = 3; // Function declarations +let kTableSectionCode = 4; // Indirect function table and other tables +let kMemorySectionCode = 5; // Memory attributes +let kGlobalSectionCode = 6; // Global declarations +let kExportSectionCode = 7; // Exports +let kStartSectionCode = 8; // Start function declaration +let kElementSectionCode = 9; // Elements section +let kCodeSectionCode = 10; // Function code +let kDataSectionCode = 11; // Data segments + +// Name section types +let kModuleNameCode = 0; +let kFunctionNamesCode = 1; +let kLocalNamesCode = 2; + +let kWasmFunctionTypeForm = 0x60; +let kWasmAnyFunctionTypeForm = 0x70; + +let kHasMaximumFlag = 1; +let kResizableMaximumFlag = 1; + +// Function declaration flags +let kDeclFunctionName = 0x01; +let kDeclFunctionImport = 0x02; +let kDeclFunctionLocals = 0x04; +let kDeclFunctionExport = 0x08; + +// Local types +let kWasmStmt = 0x40; +let kWasmI32 = 0x7f; +let kWasmI64 = 0x7e; +let kWasmF32 = 0x7d; +let kWasmF64 = 0x7c; +let kWasmS128 = 0x7b; + +let kExternalFunction = 0; +let kExternalTable = 1; +let kExternalMemory = 2; +let kExternalGlobal = 3; + +let kTableZero = 0; +let kMemoryZero = 0; + +// Useful signatures +let kSig_i_i = makeSig([kWasmI32], [kWasmI32]); +let kSig_l_l = makeSig([kWasmI64], [kWasmI64]); +let kSig_i_l = makeSig([kWasmI64], [kWasmI32]); +let kSig_i_ii = makeSig([kWasmI32, kWasmI32], [kWasmI32]); +let kSig_i_iii = makeSig([kWasmI32, kWasmI32, kWasmI32], [kWasmI32]); +let kSig_v_iiii = makeSig([kWasmI32, kWasmI32, kWasmI32, kWasmI32], []); +let kSig_f_ff = makeSig([kWasmF32, kWasmF32], [kWasmF32]); +let kSig_d_dd = makeSig([kWasmF64, kWasmF64], [kWasmF64]); +let kSig_l_ll = makeSig([kWasmI64, kWasmI64], [kWasmI64]); +let kSig_i_dd = makeSig([kWasmF64, kWasmF64], [kWasmI32]); +let kSig_v_v = makeSig([], []); +let kSig_i_v = makeSig([], [kWasmI32]); +let kSig_l_v = makeSig([], [kWasmI64]); +let kSig_f_v = makeSig([], [kWasmF32]); +let kSig_d_v = makeSig([], [kWasmF64]); +let kSig_v_i = makeSig([kWasmI32], []); +let kSig_v_ii = makeSig([kWasmI32, kWasmI32], []); +let kSig_v_iii = makeSig([kWasmI32, kWasmI32, kWasmI32], []); +let kSig_v_l = makeSig([kWasmI64], []); +let kSig_v_d = makeSig([kWasmF64], []); +let kSig_v_dd = makeSig([kWasmF64, kWasmF64], []); +let kSig_v_ddi = makeSig([kWasmF64, kWasmF64, kWasmI32], []); + +let kSig_v_f = makeSig([kWasmF32], []); +let kSig_f_f = makeSig([kWasmF32], [kWasmF32]); +let kSig_f_d = makeSig([kWasmF64], [kWasmF32]); +let kSig_d_d = makeSig([kWasmF64], [kWasmF64]); + +function makeSig(params, results) { + return {params: params, results: results}; +} + +function makeSig_v_x(x) { + return makeSig([x], []); +} + +function makeSig_v_xx(x) { + return makeSig([x, x], []); +} + +function makeSig_r_v(r) { + return makeSig([], [r]); +} + +function makeSig_r_x(r, x) { + return makeSig([x], [r]); +} + +function makeSig_r_xx(r, x) { + return makeSig([x, x], [r]); +} + +// Opcodes +let kExprUnreachable = 0x00; +let kExprNop = 0x01; +let kExprBlock = 0x02; +let kExprLoop = 0x03; +let kExprIf = 0x04; +let kExprElse = 0x05; +let kExprTry = 0x06; +let kExprCatch = 0x07; +let kExprThrow = 0x08; +let kExprEnd = 0x0b; +let kExprBr = 0x0c; +let kExprBrIf = 0x0d; +let kExprBrTable = 0x0e; +let kExprReturn = 0x0f; +let kExprCallFunction = 0x10; +let kExprCallIndirect = 0x11; +let kExprDrop = 0x1a; +let kExprSelect = 0x1b; +let kExprGetLocal = 0x20; +let kExprSetLocal = 0x21; +let kExprTeeLocal = 0x22; +let kExprGetGlobal = 0x23; +let kExprSetGlobal = 0x24; +let kExprI32LoadMem = 0x28; +let kExprI64LoadMem = 0x29; +let kExprF32LoadMem = 0x2a; +let kExprF64LoadMem = 0x2b; +let kExprI32LoadMem8S = 0x2c; +let kExprI32LoadMem8U = 0x2d; +let kExprI32LoadMem16S = 0x2e; +let kExprI32LoadMem16U = 0x2f; +let kExprI64LoadMem8S = 0x30; +let kExprI64LoadMem8U = 0x31; +let kExprI64LoadMem16S = 0x32; +let kExprI64LoadMem16U = 0x33; +let kExprI64LoadMem32S = 0x34; +let kExprI64LoadMem32U = 0x35; +let kExprI32StoreMem = 0x36; +let kExprI64StoreMem = 0x37; +let kExprF32StoreMem = 0x38; +let kExprF64StoreMem = 0x39; +let kExprI32StoreMem8 = 0x3a; +let kExprI32StoreMem16 = 0x3b; +let kExprI64StoreMem8 = 0x3c; +let kExprI64StoreMem16 = 0x3d; +let kExprI64StoreMem32 = 0x3e; +let kExprMemorySize = 0x3f; +let kExprMemoryGrow = 0x40; +let kExprI32Const = 0x41; +let kExprI64Const = 0x42; +let kExprF32Const = 0x43; +let kExprF64Const = 0x44; +let kExprI32Eqz = 0x45; +let kExprI32Eq = 0x46; +let kExprI32Ne = 0x47; +let kExprI32LtS = 0x48; +let kExprI32LtU = 0x49; +let kExprI32GtS = 0x4a; +let kExprI32GtU = 0x4b; +let kExprI32LeS = 0x4c; +let kExprI32LeU = 0x4d; +let kExprI32GeS = 0x4e; +let kExprI32GeU = 0x4f; +let kExprI64Eqz = 0x50; +let kExprI64Eq = 0x51; +let kExprI64Ne = 0x52; +let kExprI64LtS = 0x53; +let kExprI64LtU = 0x54; +let kExprI64GtS = 0x55; +let kExprI64GtU = 0x56; +let kExprI64LeS = 0x57; +let kExprI64LeU = 0x58; +let kExprI64GeS = 0x59; +let kExprI64GeU = 0x5a; +let kExprF32Eq = 0x5b; +let kExprF32Ne = 0x5c; +let kExprF32Lt = 0x5d; +let kExprF32Gt = 0x5e; +let kExprF32Le = 0x5f; +let kExprF32Ge = 0x60; +let kExprF64Eq = 0x61; +let kExprF64Ne = 0x62; +let kExprF64Lt = 0x63; +let kExprF64Gt = 0x64; +let kExprF64Le = 0x65; +let kExprF64Ge = 0x66; +let kExprI32Clz = 0x67; +let kExprI32Ctz = 0x68; +let kExprI32Popcnt = 0x69; +let kExprI32Add = 0x6a; +let kExprI32Sub = 0x6b; +let kExprI32Mul = 0x6c; +let kExprI32DivS = 0x6d; +let kExprI32DivU = 0x6e; +let kExprI32RemS = 0x6f; +let kExprI32RemU = 0x70; +let kExprI32And = 0x71; +let kExprI32Ior = 0x72; +let kExprI32Xor = 0x73; +let kExprI32Shl = 0x74; +let kExprI32ShrS = 0x75; +let kExprI32ShrU = 0x76; +let kExprI32Rol = 0x77; +let kExprI32Ror = 0x78; +let kExprI64Clz = 0x79; +let kExprI64Ctz = 0x7a; +let kExprI64Popcnt = 0x7b; +let kExprI64Add = 0x7c; +let kExprI64Sub = 0x7d; +let kExprI64Mul = 0x7e; +let kExprI64DivS = 0x7f; +let kExprI64DivU = 0x80; +let kExprI64RemS = 0x81; +let kExprI64RemU = 0x82; +let kExprI64And = 0x83; +let kExprI64Ior = 0x84; +let kExprI64Xor = 0x85; +let kExprI64Shl = 0x86; +let kExprI64ShrS = 0x87; +let kExprI64ShrU = 0x88; +let kExprI64Rol = 0x89; +let kExprI64Ror = 0x8a; +let kExprF32Abs = 0x8b; +let kExprF32Neg = 0x8c; +let kExprF32Ceil = 0x8d; +let kExprF32Floor = 0x8e; +let kExprF32Trunc = 0x8f; +let kExprF32NearestInt = 0x90; +let kExprF32Sqrt = 0x91; +let kExprF32Add = 0x92; +let kExprF32Sub = 0x93; +let kExprF32Mul = 0x94; +let kExprF32Div = 0x95; +let kExprF32Min = 0x96; +let kExprF32Max = 0x97; +let kExprF32CopySign = 0x98; +let kExprF64Abs = 0x99; +let kExprF64Neg = 0x9a; +let kExprF64Ceil = 0x9b; +let kExprF64Floor = 0x9c; +let kExprF64Trunc = 0x9d; +let kExprF64NearestInt = 0x9e; +let kExprF64Sqrt = 0x9f; +let kExprF64Add = 0xa0; +let kExprF64Sub = 0xa1; +let kExprF64Mul = 0xa2; +let kExprF64Div = 0xa3; +let kExprF64Min = 0xa4; +let kExprF64Max = 0xa5; +let kExprF64CopySign = 0xa6; +let kExprI32ConvertI64 = 0xa7; +let kExprI32SConvertF32 = 0xa8; +let kExprI32UConvertF32 = 0xa9; +let kExprI32SConvertF64 = 0xaa; +let kExprI32UConvertF64 = 0xab; +let kExprI64SConvertI32 = 0xac; +let kExprI64UConvertI32 = 0xad; +let kExprI64SConvertF32 = 0xae; +let kExprI64UConvertF32 = 0xaf; +let kExprI64SConvertF64 = 0xb0; +let kExprI64UConvertF64 = 0xb1; +let kExprF32SConvertI32 = 0xb2; +let kExprF32UConvertI32 = 0xb3; +let kExprF32SConvertI64 = 0xb4; +let kExprF32UConvertI64 = 0xb5; +let kExprF32ConvertF64 = 0xb6; +let kExprF64SConvertI32 = 0xb7; +let kExprF64UConvertI32 = 0xb8; +let kExprF64SConvertI64 = 0xb9; +let kExprF64UConvertI64 = 0xba; +let kExprF64ConvertF32 = 0xbb; +let kExprI32ReinterpretF32 = 0xbc; +let kExprI64ReinterpretF64 = 0xbd; +let kExprF32ReinterpretI32 = 0xbe; +let kExprF64ReinterpretI64 = 0xbf; + +class Binary { + constructor() { + this.length = 0; + this.buffer = new Uint8Array(8192); + } + + ensure_space(needed) { + if (this.buffer.length - this.length >= needed) return; + let new_capacity = this.buffer.length * 2; + while (new_capacity - this.length < needed) new_capacity *= 2; + let new_buffer = new Uint8Array(new_capacity); + new_buffer.set(this.buffer); + this.buffer = new_buffer; + } + + trunc_buffer() { + return this.buffer = this.buffer.slice(0, this.length); + } + + reset() { + this.length = 0; + } + + emit_u8(val) { + this.ensure_space(1); + this.buffer[this.length++] = val; + } + + emit_u16(val) { + this.ensure_space(2); + this.buffer[this.length++] = val; + this.buffer[this.length++] = val >> 8; + } + + emit_u32(val) { + this.ensure_space(4); + this.buffer[this.length++] = val; + this.buffer[this.length++] = val >> 8; + this.buffer[this.length++] = val >> 16; + this.buffer[this.length++] = val >> 24; + } + + emit_leb(val, max_len) { + this.ensure_space(max_len); + for (let i = 0; i < max_len; ++i) { + let v = val & 0xff; + val = val >>> 7; + if (val == 0) { + this.buffer[this.length++] = v; + return; + } + this.buffer[this.length++] = v | 0x80; + } + throw new Error("Leb value exceeds maximum length of " + max_len); + } + + emit_u32v(val) { + this.emit_leb(val, kMaxVarInt32Size); + } + + emit_u64v(val) { + this.emit_leb(val, kMaxVarInt64Size); + } + + emit_bytes(data) { + this.ensure_space(data.length); + this.buffer.set(data, this.length); + this.length += data.length; + } + + emit_string(string) { + // When testing illegal names, we pass a byte array directly. + if (string instanceof Array) { + this.emit_u32v(string.length); + this.emit_bytes(string); + return; + } + + // This is the hacky way to convert a JavaScript string to a UTF8 encoded + // string only containing single-byte characters. + let string_utf8 = unescape(encodeURIComponent(string)); + this.emit_u32v(string_utf8.length); + for (let i = 0; i < string_utf8.length; i++) { + this.emit_u8(string_utf8.charCodeAt(i)); + } + } + + emit_header() { + this.emit_bytes([ + kWasmH0, kWasmH1, kWasmH2, kWasmH3, kWasmV0, kWasmV1, kWasmV2, kWasmV3 + ]); + } + + emit_section(section_code, content_generator) { + // Emit section name. + this.emit_u8(section_code); + // Emit the section to a temporary buffer: its full length isn't know yet. + const section = new Binary; + content_generator(section); + // Emit section length. + this.emit_u32v(section.length); + // Copy the temporary buffer. + // Avoid spread because {section} can be huge. + this.emit_bytes(section.trunc_buffer()); + } +} + +class WasmFunctionBuilder { + constructor(module, name, type_index) { + this.module = module; + this.name = name; + this.type_index = type_index; + this.body = []; + } + + exportAs(name) { + this.module.addExport(name, this.index); + return this; + } + + exportFunc() { + this.exportAs(this.name); + return this; + } + + addBody(body) { + const bodyCopy = body.slice(); + bodyCopy.push(kExprEnd); + return this.addBodyWithEnd(bodyCopy); + } + + addBodyWithEnd(body) { + this.body = body; + return this; + } + + addLocals(locals) { + this.locals = locals; + return this; + } + + end() { + return this.module; + } +} + +class WasmGlobalBuilder { + constructor(module, type, mutable) { + this.module = module; + this.type = type; + this.mutable = mutable; + this.init = 0; + } + + exportAs(name) { + this.module.exports.push({name: name, kind: kExternalGlobal, + index: this.index}); + return this; + } +} + +class WasmModuleBuilder { + constructor() { + this.types = []; + this.imports = []; + this.exports = []; + this.globals = []; + this.functions = []; + this.table_length_min = 0; + this.table_length_max = undefined; + this.element_segments = []; + this.data_segments = []; + this.segments = []; + this.explicit = []; + this.num_imported_funcs = 0; + this.num_imported_globals = 0; + return this; + } + + addStart(start_index) { + this.start_index = start_index; + return this; + } + + addMemory(min, max, exp) { + this.memory = {min: min, max: max, exp: exp}; + return this; + } + + addExplicitSection(bytes) { + this.explicit.push(bytes); + return this; + } + + addType(type) { + this.types.push(type); + var pl = type.params.length; // should have params + var rl = type.results.length; // should have results + return this.types.length - 1; + } + + addGlobal(local_type, mutable) { + let glob = new WasmGlobalBuilder(this, local_type, mutable); + glob.index = this.globals.length + this.num_imported_globals; + this.globals.push(glob); + return glob; + } + + addFunction(name, type) { + let type_index = (typeof type) == "number" ? type : this.addType(type); + let func = new WasmFunctionBuilder(this, name, type_index); + func.index = this.functions.length + this.num_imported_funcs; + this.functions.push(func); + return func; + } + + addImport(module, name, type) { + let type_index = (typeof type) == "number" ? type : this.addType(type); + this.imports.push({module: module, name: name, kind: kExternalFunction, + type: type_index}); + return this.num_imported_funcs++; + } + + addImportedGlobal(module, name, type) { + let o = {module: module, name: name, kind: kExternalGlobal, type: type, + mutable: false} + this.imports.push(o); + return this.num_imported_globals++; + } + + addImportedMemory(module, name, initial = 0, maximum) { + let o = {module: module, name: name, kind: kExternalMemory, + initial: initial, maximum: maximum}; + this.imports.push(o); + return this; + } + + addImportedTable(module, name, initial, maximum) { + let o = {module: module, name: name, kind: kExternalTable, initial: initial, + maximum: maximum}; + this.imports.push(o); + } + + addExport(name, index) { + this.exports.push({name: name, kind: kExternalFunction, index: index}); + return this; + } + + addExportOfKind(name, kind, index) { + this.exports.push({name: name, kind: kind, index: index}); + return this; + } + + addDataSegment(addr, data, is_global = false) { + this.data_segments.push( + {addr: addr, data: data, is_global: is_global}); + return this.data_segments.length - 1; + } + + exportMemoryAs(name) { + this.exports.push({name: name, kind: kExternalMemory, index: 0}); + } + + addElementSegment(base, is_global, array, is_import = false) { + this.element_segments.push({base: base, is_global: is_global, + array: array}); + if (!is_global) { + var length = base + array.length; + if (length > this.table_length_min && !is_import) { + this.table_length_min = length; + } + if (length > this.table_length_max && !is_import) { + this.table_length_max = length; + } + } + return this; + } + + appendToTable(array) { + for (let n of array) { + if (typeof n != 'number') + throw new Error('invalid table (entries have to be numbers): ' + array); + } + return this.addElementSegment(this.table_length_min, false, array); + } + + setTableBounds(min, max = undefined) { + this.table_length_min = min; + this.table_length_max = max; + return this; + } + + toBuffer(debug = false) { + let binary = new Binary; + let wasm = this; + + // Add header + binary.emit_header(); + + // Add type section + if (wasm.types.length > 0) { + if (debug) print("emitting types @ " + binary.length); + binary.emit_section(kTypeSectionCode, section => { + section.emit_u32v(wasm.types.length); + for (let type of wasm.types) { + section.emit_u8(kWasmFunctionTypeForm); + section.emit_u32v(type.params.length); + for (let param of type.params) { + section.emit_u8(param); + } + section.emit_u32v(type.results.length); + for (let result of type.results) { + section.emit_u8(result); + } + } + }); + } + + // Add imports section + if (wasm.imports.length > 0) { + if (debug) print("emitting imports @ " + binary.length); + binary.emit_section(kImportSectionCode, section => { + section.emit_u32v(wasm.imports.length); + for (let imp of wasm.imports) { + section.emit_string(imp.module); + section.emit_string(imp.name || ''); + section.emit_u8(imp.kind); + if (imp.kind == kExternalFunction) { + section.emit_u32v(imp.type); + } else if (imp.kind == kExternalGlobal) { + section.emit_u32v(imp.type); + section.emit_u8(imp.mutable); + } else if (imp.kind == kExternalMemory) { + var has_max = (typeof imp.maximum) != "undefined"; + section.emit_u8(has_max ? 1 : 0); // flags + section.emit_u32v(imp.initial); // initial + if (has_max) section.emit_u32v(imp.maximum); // maximum + } else if (imp.kind == kExternalTable) { + section.emit_u8(kWasmAnyFunctionTypeForm); + var has_max = (typeof imp.maximum) != "undefined"; + section.emit_u8(has_max ? 1 : 0); // flags + section.emit_u32v(imp.initial); // initial + if (has_max) section.emit_u32v(imp.maximum); // maximum + } else { + throw new Error("unknown/unsupported import kind " + imp.kind); + } + } + }); + } + + // Add functions declarations + let has_names = false; + let names = false; + if (wasm.functions.length > 0) { + if (debug) print("emitting function decls @ " + binary.length); + binary.emit_section(kFunctionSectionCode, section => { + section.emit_u32v(wasm.functions.length); + for (let func of wasm.functions) { + has_names = has_names || (func.name != undefined && + func.name.length > 0); + section.emit_u32v(func.type_index); + } + }); + } + + // Add table section + if (wasm.table_length_min > 0) { + if (debug) print("emitting table @ " + binary.length); + binary.emit_section(kTableSectionCode, section => { + section.emit_u8(1); // one table entry + section.emit_u8(kWasmAnyFunctionTypeForm); + const max = wasm.table_length_max; + const has_max = max !== undefined; + section.emit_u8(has_max ? kHasMaximumFlag : 0); + section.emit_u32v(wasm.table_length_min); + if (has_max) section.emit_u32v(max); + }); + } + + // Add memory section + if (wasm.memory !== undefined) { + if (debug) print("emitting memory @ " + binary.length); + binary.emit_section(kMemorySectionCode, section => { + section.emit_u8(1); // one memory entry + const has_max = wasm.memory.max !== undefined; + section.emit_u8(has_max ? 1 : 0); + section.emit_u32v(wasm.memory.min); + if (has_max) section.emit_u32v(wasm.memory.max); + }); + } + + // Add global section. + if (wasm.globals.length > 0) { + if (debug) print ("emitting globals @ " + binary.length); + binary.emit_section(kGlobalSectionCode, section => { + section.emit_u32v(wasm.globals.length); + for (let global of wasm.globals) { + section.emit_u8(global.type); + section.emit_u8(global.mutable); + if ((typeof global.init_index) == "undefined") { + // Emit a constant initializer. + switch (global.type) { + case kWasmI32: + section.emit_u8(kExprI32Const); + section.emit_u32v(global.init); + break; + case kWasmI64: + section.emit_u8(kExprI64Const); + section.emit_u8(global.init); + break; + case kWasmF32: + section.emit_u8(kExprF32Const); + f32_view[0] = global.init; + section.emit_bytes(f32_bytes_view); + break; + case kWasmF64: + section.emit_u8(kExprF64Const); + f64_view[0] = global.init; + section.emit_bytes(f64_bytes_view); + break; + } + } else { + // Emit a global-index initializer. + section.emit_u8(kExprGetGlobal); + section.emit_u32v(global.init_index); + } + section.emit_u8(kExprEnd); // end of init expression + } + }); + } + + // Add export table. + var mem_export = (wasm.memory !== undefined && wasm.memory.exp); + var exports_count = wasm.exports.length + (mem_export ? 1 : 0); + if (exports_count > 0) { + if (debug) print("emitting exports @ " + binary.length); + binary.emit_section(kExportSectionCode, section => { + section.emit_u32v(exports_count); + for (let exp of wasm.exports) { + section.emit_string(exp.name); + section.emit_u8(exp.kind); + section.emit_u32v(exp.index); + } + if (mem_export) { + section.emit_string("memory"); + section.emit_u8(kExternalMemory); + section.emit_u8(0); + } + }); + } + + // Add start function section. + if (wasm.start_index !== undefined) { + if (debug) print("emitting start function @ " + binary.length); + binary.emit_section(kStartSectionCode, section => { + section.emit_u32v(wasm.start_index); + }); + } + + // Add element segments + if (wasm.element_segments.length > 0) { + if (debug) print("emitting element segments @ " + binary.length); + binary.emit_section(kElementSectionCode, section => { + var inits = wasm.element_segments; + section.emit_u32v(inits.length); + + for (let init of inits) { + section.emit_u8(0); // table index / flags + if (init.is_global) { + section.emit_u8(kExprGetGlobal); + } else { + section.emit_u8(kExprI32Const); + } + section.emit_u32v(init.base); + section.emit_u8(kExprEnd); + section.emit_u32v(init.array.length); + for (let index of init.array) { + section.emit_u32v(index); + } + } + }); + } + + // Add function bodies. + if (wasm.functions.length > 0) { + // emit function bodies + if (debug) print("emitting code @ " + binary.length); + binary.emit_section(kCodeSectionCode, section => { + section.emit_u32v(wasm.functions.length); + let header = new Binary; + for (let func of wasm.functions) { + header.reset(); + // Function body length will be patched later. + let local_decls = []; + let l = func.locals; + if (l != undefined) { + let local_decls_count = 0; + if (l.i32_count > 0) { + local_decls.push({count: l.i32_count, type: kWasmI32}); + } + if (l.i64_count > 0) { + local_decls.push({count: l.i64_count, type: kWasmI64}); + } + if (l.f32_count > 0) { + local_decls.push({count: l.f32_count, type: kWasmF32}); + } + if (l.f64_count > 0) { + local_decls.push({count: l.f64_count, type: kWasmF64}); + } + } + + header.emit_u32v(local_decls.length); + for (let decl of local_decls) { + header.emit_u32v(decl.count); + header.emit_u8(decl.type); + } + + section.emit_u32v(header.length + func.body.length); + section.emit_bytes(header.trunc_buffer()); + section.emit_bytes(func.body); + } + }); + } + + // Add data segments. + if (wasm.data_segments.length > 0) { + if (debug) print("emitting data segments @ " + binary.length); + binary.emit_section(kDataSectionCode, section => { + section.emit_u32v(wasm.data_segments.length); + for (let seg of wasm.data_segments) { + section.emit_u8(0); // linear memory index 0 / flags + if (seg.is_global) { + // initializer is a global variable + section.emit_u8(kExprGetGlobal); + section.emit_u32v(seg.addr); + } else { + // initializer is a constant + section.emit_u8(kExprI32Const); + section.emit_u32v(seg.addr); + } + section.emit_u8(kExprEnd); + section.emit_u32v(seg.data.length); + section.emit_bytes(seg.data); + } + }); + } + + // Add any explicitly added sections + for (let exp of wasm.explicit) { + if (debug) print("emitting explicit @ " + binary.length); + binary.emit_bytes(exp); + } + + // Add function names. + if (has_names) { + if (debug) print("emitting names @ " + binary.length); + binary.emit_section(kUnknownSectionCode, section => { + section.emit_string("name"); + var count = wasm.functions.length + wasm.num_imported_funcs; + section.emit_u32v(count); + for (var i = 0; i < wasm.num_imported_funcs; i++) { + section.emit_u8(0); // empty string + section.emit_u8(0); // local names count == 0 + } + for (let func of wasm.functions) { + var name = func.name == undefined ? "" : func.name; + section.emit_string(name); + section.emit_u8(0); // local names count == 0 + } + }); + } + + return binary.trunc_buffer(); + } + + toArray(debug = false) { + return Array.from(this.toBuffer(debug)); + } + + instantiate(ffi) { + let module = this.toModule(); + let instance = new WebAssembly.Instance(module, ffi); + return instance; + } + + asyncInstantiate(ffi) { + return WebAssembly.instantiate(this.toBuffer(), ffi) + .then(({module, instance}) => instance); + } + + toModule(debug = false) { + return new WebAssembly.Module(this.toBuffer(debug)); + } +} + +function wasmI32Const(val) { + let bytes = [kExprI32Const]; + for (let i = 0; i < 4; ++i) { + bytes.push(0x80 | ((val >> (7 * i)) & 0x7f)); + } + bytes.push((val >> (7 * 4)) & 0x7f); + return bytes; +} + +function wasmF32Const(f) { + f32_view[0] = f; + return [ + kExprF32Const, f32_bytes_view[0], f32_bytes_view[1], f32_bytes_view[2], + f32_bytes_view[3] + ]; +} + +function wasmF64Const(f) { + f64_view[0] = f; + return [ + kExprF64Const, f64_bytes_view[0], f64_bytes_view[1], f64_bytes_view[2], + f64_bytes_view[3], f64_bytes_view[4], f64_bytes_view[5], f64_bytes_view[6], + f64_bytes_view[7] + ]; +} diff --git a/w3c.json b/w3c.json new file mode 100644 index 00000000..a1d0c033 --- /dev/null +++ b/w3c.json @@ -0,0 +1,5 @@ + { + "group": [78073] +, "contacts": ["ericprud"] +, "repo-type": "cg-report" +}