├── .gitignore
├── .mvn
└── wrapper
│ ├── MavenWrapperDownloader.java
│ └── maven-wrapper.properties
├── LICENSE
├── README.md
├── doc
└── resources.ja.md
├── mvnw
├── mvnw.cmd
├── pom.xml
└── src
├── main
└── java
│ └── jp
│ └── hisano
│ └── wasm
│ └── interpreter
│ ├── ByteBuffer.java
│ ├── ExportedFunction.java
│ ├── Frame.java
│ ├── Instance.java
│ ├── Interpreter.java
│ ├── InterpreterException.java
│ ├── Leb128.java
│ ├── Memory.java
│ ├── Module.java
│ ├── Parser.java
│ ├── Table.java
│ ├── TrapException.java
│ └── Value.java
└── test
├── java
└── jp
│ └── hisano
│ └── wasm
│ └── interpreter
│ ├── AddressTest.java
│ ├── BrIfTest.java
│ ├── CallTest.java
│ ├── ConversionsTest.java
│ ├── F32BitwiseTest.java
│ ├── F32CmpTest.java
│ ├── F32Test.java
│ ├── F64BitwiseTest.java
│ ├── F64CmpTest.java
│ ├── F64Test.java
│ ├── GlobalTest.java
│ ├── I32Test.java
│ ├── I64Test.java
│ ├── LocalGetTest.java
│ ├── NopTest.java
│ ├── SampleTest.java
│ ├── TestUtils.java
│ ├── WastValue.java
│ └── WastValueConverter.java
└── resources
└── jp
└── hisano
└── wasm
└── interpreter
├── sample
├── add.wasm
└── add.wat
└── spec
├── address
├── address.0.wasm
├── address.1.wat
├── address.2.wasm
├── address.3.wasm
├── address.4.wasm
├── address.json
└── address.wast
├── br_if
├── br_if.0.wasm
├── br_if.1.wasm
├── br_if.10.wasm
├── br_if.11.wasm
├── br_if.12.wasm
├── br_if.13.wasm
├── br_if.14.wasm
├── br_if.15.wasm
├── br_if.16.wasm
├── br_if.17.wasm
├── br_if.18.wasm
├── br_if.19.wasm
├── br_if.2.wasm
├── br_if.20.wasm
├── br_if.21.wasm
├── br_if.22.wasm
├── br_if.23.wasm
├── br_if.24.wasm
├── br_if.25.wasm
├── br_if.26.wasm
├── br_if.27.wasm
├── br_if.28.wasm
├── br_if.29.wasm
├── br_if.3.wasm
├── br_if.4.wasm
├── br_if.5.wasm
├── br_if.6.wasm
├── br_if.7.wasm
├── br_if.8.wasm
├── br_if.9.wasm
├── br_if.json
└── br_if.wast
├── call
├── call.0.wasm
├── call.1.wasm
├── call.10.wasm
├── call.11.wasm
├── call.12.wasm
├── call.13.wasm
├── call.14.wasm
├── call.15.wasm
├── call.16.wasm
├── call.17.wasm
├── call.18.wasm
├── call.2.wasm
├── call.3.wasm
├── call.4.wasm
├── call.5.wasm
├── call.6.wasm
├── call.7.wasm
├── call.8.wasm
├── call.9.wasm
├── call.json
└── call.wast
├── conversions
├── conversions.0.wasm
├── conversions.1.wasm
├── conversions.10.wasm
├── conversions.11.wasm
├── conversions.12.wasm
├── conversions.13.wasm
├── conversions.14.wasm
├── conversions.15.wasm
├── conversions.16.wasm
├── conversions.17.wasm
├── conversions.18.wasm
├── conversions.19.wasm
├── conversions.2.wasm
├── conversions.20.wasm
├── conversions.21.wasm
├── conversions.22.wasm
├── conversions.23.wasm
├── conversions.24.wasm
├── conversions.25.wasm
├── conversions.3.wasm
├── conversions.4.wasm
├── conversions.5.wasm
├── conversions.6.wasm
├── conversions.7.wasm
├── conversions.8.wasm
├── conversions.9.wasm
├── conversions.json
└── conversions.wast
├── f32
├── f32.0.wasm
├── f32.1.wasm
├── f32.10.wasm
├── f32.11.wasm
├── f32.12.wat
├── f32.13.wat
├── f32.2.wasm
├── f32.3.wasm
├── f32.4.wasm
├── f32.5.wasm
├── f32.6.wasm
├── f32.7.wasm
├── f32.8.wasm
├── f32.9.wasm
├── f32.json
└── f32.wast
├── f32_bitwise
├── f32_bitwise.0.wasm
├── f32_bitwise.1.wasm
├── f32_bitwise.2.wasm
├── f32_bitwise.3.wasm
├── f32_bitwise.json
└── f32_bitwise.wast
├── f32_cmp
├── f32_cmp.0.wasm
├── f32_cmp.1.wasm
├── f32_cmp.2.wasm
├── f32_cmp.3.wasm
├── f32_cmp.4.wasm
├── f32_cmp.5.wasm
├── f32_cmp.6.wasm
├── f32_cmp.json
└── f32_cmp.wast
├── f64
├── f64.0.wasm
├── f64.1.wasm
├── f64.10.wasm
├── f64.11.wasm
├── f64.12.wat
├── f64.13.wat
├── f64.2.wasm
├── f64.3.wasm
├── f64.4.wasm
├── f64.5.wasm
├── f64.6.wasm
├── f64.7.wasm
├── f64.8.wasm
├── f64.9.wasm
├── f64.json
└── f64.wast
├── f64_bitwise
├── f64_bitwise.0.wasm
├── f64_bitwise.1.wasm
├── f64_bitwise.2.wasm
├── f64_bitwise.3.wasm
├── f64_bitwise.json
└── f64_bitwise.wast
├── f64_cmp
├── f64_cmp.0.wasm
├── f64_cmp.1.wasm
├── f64_cmp.2.wasm
├── f64_cmp.3.wasm
├── f64_cmp.4.wasm
├── f64_cmp.5.wasm
├── f64_cmp.6.wasm
├── f64_cmp.json
└── f64_cmp.wast
├── global
├── global.0.wasm
├── global.1.wasm
├── global.10.wasm
├── global.11.wasm
├── global.12.wasm
├── global.13.wasm
├── global.14.wasm
├── global.15.wasm
├── global.16.wasm
├── global.17.wasm
├── global.18.wasm
├── global.19.wasm
├── global.2.wasm
├── global.20.wasm
├── global.21.wasm
├── global.22.wasm
├── global.23.wasm
├── global.24.wasm
├── global.25.wasm
├── global.26.wasm
├── global.27.wasm
├── global.28.wasm
├── global.29.wasm
├── global.3.wasm
├── global.30.wasm
├── global.31.wasm
├── global.32.wasm
├── global.33.wasm
├── global.34.wasm
├── global.35.wasm
├── global.36.wasm
├── global.37.wasm
├── global.38.wasm
├── global.39.wasm
├── global.4.wasm
├── global.40.wasm
├── global.41.wasm
├── global.42.wasm
├── global.43.wasm
├── global.44.wasm
├── global.45.wasm
├── global.46.wasm
├── global.47.wat
├── global.48.wat
├── global.49.wat
├── global.5.wasm
├── global.6.wasm
├── global.7.wasm
├── global.8.wasm
├── global.9.wasm
├── global.json
└── global.wast
├── i32
├── i32.0.wasm
├── i32.1.wasm
├── i32.10.wasm
├── i32.11.wasm
├── i32.12.wasm
├── i32.13.wasm
├── i32.14.wasm
├── i32.15.wasm
├── i32.16.wasm
├── i32.17.wasm
├── i32.18.wasm
├── i32.19.wasm
├── i32.2.wasm
├── i32.20.wasm
├── i32.21.wasm
├── i32.22.wasm
├── i32.23.wasm
├── i32.24.wasm
├── i32.25.wasm
├── i32.26.wasm
├── i32.27.wasm
├── i32.28.wasm
├── i32.29.wasm
├── i32.3.wasm
├── i32.30.wasm
├── i32.31.wasm
├── i32.32.wasm
├── i32.33.wasm
├── i32.34.wasm
├── i32.35.wasm
├── i32.36.wasm
├── i32.37.wasm
├── i32.38.wasm
├── i32.39.wasm
├── i32.4.wasm
├── i32.40.wasm
├── i32.41.wasm
├── i32.42.wasm
├── i32.43.wasm
├── i32.44.wasm
├── i32.45.wasm
├── i32.46.wasm
├── i32.47.wasm
├── i32.48.wasm
├── i32.49.wasm
├── i32.5.wasm
├── i32.50.wasm
├── i32.51.wasm
├── i32.52.wasm
├── i32.53.wasm
├── i32.54.wasm
├── i32.55.wasm
├── i32.56.wasm
├── i32.57.wasm
├── i32.58.wasm
├── i32.59.wasm
├── i32.6.wasm
├── i32.60.wasm
├── i32.61.wasm
├── i32.62.wasm
├── i32.63.wasm
├── i32.64.wasm
├── i32.65.wasm
├── i32.66.wasm
├── i32.67.wasm
├── i32.68.wasm
├── i32.69.wasm
├── i32.7.wasm
├── i32.70.wasm
├── i32.71.wasm
├── i32.72.wasm
├── i32.73.wasm
├── i32.74.wasm
├── i32.75.wasm
├── i32.76.wasm
├── i32.77.wasm
├── i32.78.wasm
├── i32.79.wasm
├── i32.8.wasm
├── i32.80.wasm
├── i32.81.wasm
├── i32.82.wasm
├── i32.83.wasm
├── i32.84.wat
├── i32.85.wat
├── i32.9.wasm
├── i32.json
└── i32.wast
├── i64
├── i64.0.wasm
├── i64.1.wasm
├── i64.10.wasm
├── i64.11.wasm
├── i64.12.wasm
├── i64.13.wasm
├── i64.14.wasm
├── i64.15.wasm
├── i64.16.wasm
├── i64.17.wasm
├── i64.18.wasm
├── i64.19.wasm
├── i64.2.wasm
├── i64.20.wasm
├── i64.21.wasm
├── i64.22.wasm
├── i64.23.wasm
├── i64.24.wasm
├── i64.25.wasm
├── i64.26.wasm
├── i64.27.wasm
├── i64.28.wasm
├── i64.29.wasm
├── i64.3.wasm
├── i64.30.wat
├── i64.31.wat
├── i64.4.wasm
├── i64.5.wasm
├── i64.6.wasm
├── i64.7.wasm
├── i64.8.wasm
├── i64.9.wasm
├── i64.json
└── i64.wast
├── local_get
├── local_get.0.wasm
├── local_get.1.wasm
├── local_get.10.wasm
├── local_get.11.wasm
├── local_get.12.wasm
├── local_get.13.wasm
├── local_get.14.wasm
├── local_get.15.wasm
├── local_get.16.wasm
├── local_get.2.wasm
├── local_get.3.wasm
├── local_get.4.wasm
├── local_get.5.wasm
├── local_get.6.wasm
├── local_get.7.wasm
├── local_get.8.wasm
├── local_get.9.wasm
├── local_get.json
└── local_get.wast
└── nop
├── nop.0.wasm
├── nop.1.wasm
├── nop.2.wasm
├── nop.3.wasm
├── nop.4.wasm
├── nop.json
└── nop.wast
/.gitignore:
--------------------------------------------------------------------------------
1 | # Maven
2 | target/
3 | .mvn/wrapper/maven-wrapper.jar
4 |
5 | # Ignore Gradle GUI config
6 | gradle-app.setting
7 |
8 | # Eclipse
9 | /.classpath
10 | /.settings/
11 | /.project
12 | /bin/
13 |
14 | # IntelliJ
15 | .idea
16 | *.iml
17 | *.ipr
18 | *.iws
19 |
20 | # Misc
21 | *.log
22 |
--------------------------------------------------------------------------------
/.mvn/wrapper/MavenWrapperDownloader.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2007-present the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | import java.net.*;
17 | import java.io.*;
18 | import java.nio.channels.*;
19 | import java.util.Properties;
20 |
21 | public class MavenWrapperDownloader {
22 |
23 | private static final String WRAPPER_VERSION = "0.5.6";
24 | /**
25 | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
26 | */
27 | private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
28 | + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
29 |
30 | /**
31 | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
32 | * use instead of the default one.
33 | */
34 | private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
35 | ".mvn/wrapper/maven-wrapper.properties";
36 |
37 | /**
38 | * Path where the maven-wrapper.jar will be saved to.
39 | */
40 | private static final String MAVEN_WRAPPER_JAR_PATH =
41 | ".mvn/wrapper/maven-wrapper.jar";
42 |
43 | /**
44 | * Name of the property which should be used to override the default download url for the wrapper.
45 | */
46 | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
47 |
48 | public static void main(String args[]) {
49 | System.out.println("- Downloader started");
50 | File baseDirectory = new File(args[0]);
51 | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
52 |
53 | // If the maven-wrapper.properties exists, read it and check if it contains a custom
54 | // wrapperUrl parameter.
55 | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
56 | String url = DEFAULT_DOWNLOAD_URL;
57 | if(mavenWrapperPropertyFile.exists()) {
58 | FileInputStream mavenWrapperPropertyFileInputStream = null;
59 | try {
60 | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
61 | Properties mavenWrapperProperties = new Properties();
62 | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
63 | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
64 | } catch (IOException e) {
65 | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
66 | } finally {
67 | try {
68 | if(mavenWrapperPropertyFileInputStream != null) {
69 | mavenWrapperPropertyFileInputStream.close();
70 | }
71 | } catch (IOException e) {
72 | // Ignore ...
73 | }
74 | }
75 | }
76 | System.out.println("- Downloading from: " + url);
77 |
78 | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
79 | if(!outputFile.getParentFile().exists()) {
80 | if(!outputFile.getParentFile().mkdirs()) {
81 | System.out.println(
82 | "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
83 | }
84 | }
85 | System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
86 | try {
87 | downloadFileFromURL(url, outputFile);
88 | System.out.println("Done");
89 | System.exit(0);
90 | } catch (Throwable e) {
91 | System.out.println("- Error downloading");
92 | e.printStackTrace();
93 | System.exit(1);
94 | }
95 | }
96 |
97 | private static void downloadFileFromURL(String urlString, File destination) throws Exception {
98 | if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
99 | String username = System.getenv("MVNW_USERNAME");
100 | char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
101 | Authenticator.setDefault(new Authenticator() {
102 | @Override
103 | protected PasswordAuthentication getPasswordAuthentication() {
104 | return new PasswordAuthentication(username, password);
105 | }
106 | });
107 | }
108 | URL website = new URL(urlString);
109 | ReadableByteChannel rbc;
110 | rbc = Channels.newChannel(website.openStream());
111 | FileOutputStream fos = new FileOutputStream(destination);
112 | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
113 | fos.close();
114 | rbc.close();
115 | }
116 |
117 | }
118 |
--------------------------------------------------------------------------------
/.mvn/wrapper/maven-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.8.5/apache-maven-3.8.5-bin.zip
2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
3 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "[]"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright [yyyy] [name of copyright owner]
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # WebAssembly Interpreter on Java
2 |
3 | WebAssembly Interpreter written in Java (Java 8, Pure Java, No library dependencies)
4 |
5 | ## Features (under development)
6 |
7 | * Pure Java
8 | * No library dependencies
9 | * `wasm` file support
10 | * Integer operations
11 | * Control flow
12 | * Functions
13 | * Linear memory
14 |
15 | ## Example
16 |
17 | ```java
18 | byte[] wasmFileContent = Files.toByteArray(new File("add.wasm"));
19 | int result = new Interpreter(wasmFileContent).invoke("add", 1, 2);
20 | System.out.println("1 + 2 = " + result);
21 | ```
22 |
23 | ## How to build
24 |
25 | ```sh
26 | $ ./mvnw install
27 | ```
28 |
29 | ## License
30 |
31 | Apache License Version 2.0
32 |
--------------------------------------------------------------------------------
/doc/resources.ja.md:
--------------------------------------------------------------------------------
1 | # 参考資料
2 |
3 | ## 仕様書
4 |
5 | - [WebAssembly Reference Manual](https://github.com/sunfishcode/wasm-reference-manual/blob/master/WebAssembly.md)
6 | - 非公式の読みやすい仕様解説ドキュメント
7 | - [WEBASSEMBLY USUI BOOK](https://ukyo.github.io/wasm-usui-book/webroot/binary-format.html)
8 | - 日本語の仕様解説
9 |
10 |
11 | - [MDN WebAssembly JavaScript API](https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly)
12 | - [MDN WebAssembly instructions](https://developer.mozilla.org/en-US/docs/WebAssembly/Reference)
13 | - 豊富なWATサンプル
14 |
15 |
16 | - [WebAssembly Core Specification 1.0](https://www.w3.org/TR/wasm-core-1/)
17 | - [WebAssembly Core Specification 2.0](https://www.w3.org/TR/wasm-core-2/)
18 | - [WebAssembly Core Specification (Draft)](https://webassembly.github.io/spec/core/)
19 |
20 | ## テストスイート
21 |
22 | - [本家テストスイート](https://github.com/WebAssembly/spec/tree/main/test/core)
23 | - [WABTのwast2jsonコマンドでwasmファイルを生成](https://github.com/WebAssembly/wabt)
24 | - [各種仕様を集約したテストスイート](https://github.com/WebAssembly/testsuite)
25 |
26 | ## 変換ツール
27 |
28 | - [WABT: The WebAssembly Binary Toolkit](https://github.com/WebAssembly/wabt)
29 | - [Webでwatからwasmに変換(実装が古めでサポートしていない命令あり)](https://webassembly.github.io/wabt/demo/wat2wasm/)
30 | - [Webでwasmからwatに変換](https://webassembly.github.io/wabt/demo/wasm2wat/)
31 |
--------------------------------------------------------------------------------
/mvnw:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # ----------------------------------------------------------------------------
3 | # Licensed to the Apache Software Foundation (ASF) under one
4 | # or more contributor license agreements. See the NOTICE file
5 | # distributed with this work for additional information
6 | # regarding copyright ownership. The ASF licenses this file
7 | # to you under the Apache License, Version 2.0 (the
8 | # "License"); you may not use this file except in compliance
9 | # with the License. You may obtain a copy of the License at
10 | #
11 | # http://www.apache.org/licenses/LICENSE-2.0
12 | #
13 | # Unless required by applicable law or agreed to in writing,
14 | # software distributed under the License is distributed on an
15 | # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 | # KIND, either express or implied. See the License for the
17 | # specific language governing permissions and limitations
18 | # under the License.
19 | # ----------------------------------------------------------------------------
20 |
21 | # ----------------------------------------------------------------------------
22 | # Maven Start Up Batch script
23 | #
24 | # Required ENV vars:
25 | # ------------------
26 | # JAVA_HOME - location of a JDK home dir
27 | #
28 | # Optional ENV vars
29 | # -----------------
30 | # M2_HOME - location of maven2's installed home dir
31 | # MAVEN_OPTS - parameters passed to the Java VM when running Maven
32 | # e.g. to debug Maven itself, use
33 | # set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
34 | # MAVEN_SKIP_RC - flag to disable loading of mavenrc files
35 | # ----------------------------------------------------------------------------
36 |
37 | if [ -z "$MAVEN_SKIP_RC" ] ; then
38 |
39 | if [ -f /etc/mavenrc ] ; then
40 | . /etc/mavenrc
41 | fi
42 |
43 | if [ -f "$HOME/.mavenrc" ] ; then
44 | . "$HOME/.mavenrc"
45 | fi
46 |
47 | fi
48 |
49 | # OS specific support. $var _must_ be set to either true or false.
50 | cygwin=false;
51 | darwin=false;
52 | mingw=false
53 | case "`uname`" in
54 | CYGWIN*) cygwin=true ;;
55 | MINGW*) mingw=true;;
56 | Darwin*) darwin=true
57 | # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
58 | # See https://developer.apple.com/library/mac/qa/qa1170/_index.html
59 | if [ -z "$JAVA_HOME" ]; then
60 | if [ -x "/usr/libexec/java_home" ]; then
61 | export JAVA_HOME="`/usr/libexec/java_home`"
62 | else
63 | export JAVA_HOME="/Library/Java/Home"
64 | fi
65 | fi
66 | ;;
67 | esac
68 |
69 | if [ -z "$JAVA_HOME" ] ; then
70 | if [ -r /etc/gentoo-release ] ; then
71 | JAVA_HOME=`java-config --jre-home`
72 | fi
73 | fi
74 |
75 | if [ -z "$M2_HOME" ] ; then
76 | ## resolve links - $0 may be a link to maven's home
77 | PRG="$0"
78 |
79 | # need this for relative symlinks
80 | while [ -h "$PRG" ] ; do
81 | ls=`ls -ld "$PRG"`
82 | link=`expr "$ls" : '.*-> \(.*\)$'`
83 | if expr "$link" : '/.*' > /dev/null; then
84 | PRG="$link"
85 | else
86 | PRG="`dirname "$PRG"`/$link"
87 | fi
88 | done
89 |
90 | saveddir=`pwd`
91 |
92 | M2_HOME=`dirname "$PRG"`/..
93 |
94 | # make it fully qualified
95 | M2_HOME=`cd "$M2_HOME" && pwd`
96 |
97 | cd "$saveddir"
98 | # echo Using m2 at $M2_HOME
99 | fi
100 |
101 | # For Cygwin, ensure paths are in UNIX format before anything is touched
102 | if $cygwin ; then
103 | [ -n "$M2_HOME" ] &&
104 | M2_HOME=`cygpath --unix "$M2_HOME"`
105 | [ -n "$JAVA_HOME" ] &&
106 | JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
107 | [ -n "$CLASSPATH" ] &&
108 | CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
109 | fi
110 |
111 | # For Mingw, ensure paths are in UNIX format before anything is touched
112 | if $mingw ; then
113 | [ -n "$M2_HOME" ] &&
114 | M2_HOME="`(cd "$M2_HOME"; pwd)`"
115 | [ -n "$JAVA_HOME" ] &&
116 | JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
117 | fi
118 |
119 | if [ -z "$JAVA_HOME" ]; then
120 | javaExecutable="`which javac`"
121 | if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
122 | # readlink(1) is not available as standard on Solaris 10.
123 | readLink=`which readlink`
124 | if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
125 | if $darwin ; then
126 | javaHome="`dirname \"$javaExecutable\"`"
127 | javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
128 | else
129 | javaExecutable="`readlink -f \"$javaExecutable\"`"
130 | fi
131 | javaHome="`dirname \"$javaExecutable\"`"
132 | javaHome=`expr "$javaHome" : '\(.*\)/bin'`
133 | JAVA_HOME="$javaHome"
134 | export JAVA_HOME
135 | fi
136 | fi
137 | fi
138 |
139 | if [ -z "$JAVACMD" ] ; then
140 | if [ -n "$JAVA_HOME" ] ; then
141 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
142 | # IBM's JDK on AIX uses strange locations for the executables
143 | JAVACMD="$JAVA_HOME/jre/sh/java"
144 | else
145 | JAVACMD="$JAVA_HOME/bin/java"
146 | fi
147 | else
148 | JAVACMD="`which java`"
149 | fi
150 | fi
151 |
152 | if [ ! -x "$JAVACMD" ] ; then
153 | echo "Error: JAVA_HOME is not defined correctly." >&2
154 | echo " We cannot execute $JAVACMD" >&2
155 | exit 1
156 | fi
157 |
158 | if [ -z "$JAVA_HOME" ] ; then
159 | echo "Warning: JAVA_HOME environment variable is not set."
160 | fi
161 |
162 | CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
163 |
164 | # traverses directory structure from process work directory to filesystem root
165 | # first directory with .mvn subdirectory is considered project base directory
166 | find_maven_basedir() {
167 |
168 | if [ -z "$1" ]
169 | then
170 | echo "Path not specified to find_maven_basedir"
171 | return 1
172 | fi
173 |
174 | basedir="$1"
175 | wdir="$1"
176 | while [ "$wdir" != '/' ] ; do
177 | if [ -d "$wdir"/.mvn ] ; then
178 | basedir=$wdir
179 | break
180 | fi
181 | # workaround for JBEAP-8937 (on Solaris 10/Sparc)
182 | if [ -d "${wdir}" ]; then
183 | wdir=`cd "$wdir/.."; pwd`
184 | fi
185 | # end of workaround
186 | done
187 | echo "${basedir}"
188 | }
189 |
190 | # concatenates all lines of a file
191 | concat_lines() {
192 | if [ -f "$1" ]; then
193 | echo "$(tr -s '\n' ' ' < "$1")"
194 | fi
195 | }
196 |
197 | BASE_DIR=`find_maven_basedir "$(pwd)"`
198 | if [ -z "$BASE_DIR" ]; then
199 | exit 1;
200 | fi
201 |
202 | ##########################################################################################
203 | # Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
204 | # This allows using the maven wrapper in projects that prohibit checking in binary data.
205 | ##########################################################################################
206 | if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
207 | if [ "$MVNW_VERBOSE" = true ]; then
208 | echo "Found .mvn/wrapper/maven-wrapper.jar"
209 | fi
210 | else
211 | if [ "$MVNW_VERBOSE" = true ]; then
212 | echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
213 | fi
214 | if [ -n "$MVNW_REPOURL" ]; then
215 | jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
216 | else
217 | jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
218 | fi
219 | while IFS="=" read key value; do
220 | case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
221 | esac
222 | done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
223 | if [ "$MVNW_VERBOSE" = true ]; then
224 | echo "Downloading from: $jarUrl"
225 | fi
226 | wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
227 | if $cygwin; then
228 | wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
229 | fi
230 |
231 | if command -v wget > /dev/null; then
232 | if [ "$MVNW_VERBOSE" = true ]; then
233 | echo "Found wget ... using wget"
234 | fi
235 | if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
236 | wget "$jarUrl" -O "$wrapperJarPath"
237 | else
238 | wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath"
239 | fi
240 | elif command -v curl > /dev/null; then
241 | if [ "$MVNW_VERBOSE" = true ]; then
242 | echo "Found curl ... using curl"
243 | fi
244 | if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
245 | curl -o "$wrapperJarPath" "$jarUrl" -f
246 | else
247 | curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
248 | fi
249 |
250 | else
251 | if [ "$MVNW_VERBOSE" = true ]; then
252 | echo "Falling back to using Java to download"
253 | fi
254 | javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
255 | # For Cygwin, switch paths to Windows format before running javac
256 | if $cygwin; then
257 | javaClass=`cygpath --path --windows "$javaClass"`
258 | fi
259 | if [ -e "$javaClass" ]; then
260 | if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
261 | if [ "$MVNW_VERBOSE" = true ]; then
262 | echo " - Compiling MavenWrapperDownloader.java ..."
263 | fi
264 | # Compiling the Java class
265 | ("$JAVA_HOME/bin/javac" "$javaClass")
266 | fi
267 | if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
268 | # Running the downloader
269 | if [ "$MVNW_VERBOSE" = true ]; then
270 | echo " - Running MavenWrapperDownloader.java ..."
271 | fi
272 | ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
273 | fi
274 | fi
275 | fi
276 | fi
277 | ##########################################################################################
278 | # End of extension
279 | ##########################################################################################
280 |
281 | export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
282 | if [ "$MVNW_VERBOSE" = true ]; then
283 | echo $MAVEN_PROJECTBASEDIR
284 | fi
285 | MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
286 |
287 | # For Cygwin, switch paths to Windows format before running java
288 | if $cygwin; then
289 | [ -n "$M2_HOME" ] &&
290 | M2_HOME=`cygpath --path --windows "$M2_HOME"`
291 | [ -n "$JAVA_HOME" ] &&
292 | JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
293 | [ -n "$CLASSPATH" ] &&
294 | CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
295 | [ -n "$MAVEN_PROJECTBASEDIR" ] &&
296 | MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
297 | fi
298 |
299 | # Provide a "standardized" way to retrieve the CLI args that will
300 | # work with both Windows and non-Windows executions.
301 | MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
302 | export MAVEN_CMD_LINE_ARGS
303 |
304 | WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
305 |
306 | exec "$JAVACMD" \
307 | $MAVEN_OPTS \
308 | -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
309 | "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
310 | ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
311 |
--------------------------------------------------------------------------------
/mvnw.cmd:
--------------------------------------------------------------------------------
1 | @REM ----------------------------------------------------------------------------
2 | @REM Licensed to the Apache Software Foundation (ASF) under one
3 | @REM or more contributor license agreements. See the NOTICE file
4 | @REM distributed with this work for additional information
5 | @REM regarding copyright ownership. The ASF licenses this file
6 | @REM to you under the Apache License, Version 2.0 (the
7 | @REM "License"); you may not use this file except in compliance
8 | @REM with the License. You may obtain a copy of the License at
9 | @REM
10 | @REM http://www.apache.org/licenses/LICENSE-2.0
11 | @REM
12 | @REM Unless required by applicable law or agreed to in writing,
13 | @REM software distributed under the License is distributed on an
14 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 | @REM KIND, either express or implied. See the License for the
16 | @REM specific language governing permissions and limitations
17 | @REM under the License.
18 | @REM ----------------------------------------------------------------------------
19 |
20 | @REM ----------------------------------------------------------------------------
21 | @REM Maven Start Up Batch script
22 | @REM
23 | @REM Required ENV vars:
24 | @REM JAVA_HOME - location of a JDK home dir
25 | @REM
26 | @REM Optional ENV vars
27 | @REM M2_HOME - location of maven2's installed home dir
28 | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
29 | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
30 | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
31 | @REM e.g. to debug Maven itself, use
32 | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
33 | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
34 | @REM ----------------------------------------------------------------------------
35 |
36 | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
37 | @echo off
38 | @REM set title of command window
39 | title %0
40 | @REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
41 | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
42 |
43 | @REM set %HOME% to equivalent of $HOME
44 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
45 |
46 | @REM Execute a user defined script before this one
47 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
48 | @REM check for pre script, once with legacy .bat ending and once with .cmd ending
49 | if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
50 | if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
51 | :skipRcPre
52 |
53 | @setlocal
54 |
55 | set ERROR_CODE=0
56 |
57 | @REM To isolate internal variables from possible post scripts, we use another setlocal
58 | @setlocal
59 |
60 | @REM ==== START VALIDATION ====
61 | if not "%JAVA_HOME%" == "" goto OkJHome
62 |
63 | echo.
64 | echo Error: JAVA_HOME not found in your environment. >&2
65 | echo Please set the JAVA_HOME variable in your environment to match the >&2
66 | echo location of your Java installation. >&2
67 | echo.
68 | goto error
69 |
70 | :OkJHome
71 | if exist "%JAVA_HOME%\bin\java.exe" goto init
72 |
73 | echo.
74 | echo Error: JAVA_HOME is set to an invalid directory. >&2
75 | echo JAVA_HOME = "%JAVA_HOME%" >&2
76 | echo Please set the JAVA_HOME variable in your environment to match the >&2
77 | echo location of your Java installation. >&2
78 | echo.
79 | goto error
80 |
81 | @REM ==== END VALIDATION ====
82 |
83 | :init
84 |
85 | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
86 | @REM Fallback to current working directory if not found.
87 |
88 | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
89 | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
90 |
91 | set EXEC_DIR=%CD%
92 | set WDIR=%EXEC_DIR%
93 | :findBaseDir
94 | IF EXIST "%WDIR%"\.mvn goto baseDirFound
95 | cd ..
96 | IF "%WDIR%"=="%CD%" goto baseDirNotFound
97 | set WDIR=%CD%
98 | goto findBaseDir
99 |
100 | :baseDirFound
101 | set MAVEN_PROJECTBASEDIR=%WDIR%
102 | cd "%EXEC_DIR%"
103 | goto endDetectBaseDir
104 |
105 | :baseDirNotFound
106 | set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
107 | cd "%EXEC_DIR%"
108 |
109 | :endDetectBaseDir
110 |
111 | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
112 |
113 | @setlocal EnableExtensions EnableDelayedExpansion
114 | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
115 | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
116 |
117 | :endReadAdditionalConfig
118 |
119 | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
120 | set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
121 | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
122 |
123 | set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
124 |
125 | FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
126 | IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
127 | )
128 |
129 | @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
130 | @REM This allows using the maven wrapper in projects that prohibit checking in binary data.
131 | if exist %WRAPPER_JAR% (
132 | if "%MVNW_VERBOSE%" == "true" (
133 | echo Found %WRAPPER_JAR%
134 | )
135 | ) else (
136 | if not "%MVNW_REPOURL%" == "" (
137 | SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
138 | )
139 | if "%MVNW_VERBOSE%" == "true" (
140 | echo Couldn't find %WRAPPER_JAR%, downloading it ...
141 | echo Downloading from: %DOWNLOAD_URL%
142 | )
143 |
144 | powershell -Command "&{"^
145 | "$webclient = new-object System.Net.WebClient;"^
146 | "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
147 | "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
148 | "}"^
149 | "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
150 | "}"
151 | if "%MVNW_VERBOSE%" == "true" (
152 | echo Finished downloading %WRAPPER_JAR%
153 | )
154 | )
155 | @REM End of extension
156 |
157 | @REM Provide a "standardized" way to retrieve the CLI args that will
158 | @REM work with both Windows and non-Windows executions.
159 | set MAVEN_CMD_LINE_ARGS=%*
160 |
161 | %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
162 | if ERRORLEVEL 1 goto error
163 | goto end
164 |
165 | :error
166 | set ERROR_CODE=1
167 |
168 | :end
169 | @endlocal & set ERROR_CODE=%ERROR_CODE%
170 |
171 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
172 | @REM check for post script, once with legacy .bat ending and once with .cmd ending
173 | if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
174 | if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
175 | :skipRcPost
176 |
177 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
178 | if "%MAVEN_BATCH_PAUSE%" == "on" pause
179 |
180 | if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
181 |
182 | exit /B %ERROR_CODE%
183 |
--------------------------------------------------------------------------------
/pom.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 | 4.0.0
6 |
7 | jp.hisano
8 | wasm-interpreter-on-java
9 | 1.0-SNAPSHOT
10 |
11 |
12 | UTF-8
13 | 1.8
14 | ${maven.compiler.source}
15 |
16 |
17 |
18 |
19 |
20 | org.junit
21 | junit-bom
22 | 5.8.2
23 | pom
24 | import
25 |
26 |
27 |
28 |
29 |
30 |
31 | org.junit.jupiter
32 | junit-jupiter
33 | test
34 |
35 |
36 | com.google.guava
37 | guava
38 | 32.0.0-jre
39 | test
40 |
41 |
42 |
43 |
44 |
45 |
46 | maven-compiler-plugin
47 | 3.8.1
48 |
49 |
50 | maven-surefire-plugin
51 | 3.0.0-M6
52 |
53 |
54 |
55 |
56 |
--------------------------------------------------------------------------------
/src/main/java/jp/hisano/wasm/interpreter/ByteBuffer.java:
--------------------------------------------------------------------------------
1 | package jp.hisano.wasm.interpreter;
2 |
3 | import static java.lang.Double.*;
4 | import static java.lang.Float.*;
5 | import static jp.hisano.wasm.interpreter.Leb128.*;
6 |
7 | final class ByteBuffer {
8 | private final byte[] bytes;
9 | private int readIndex;
10 |
11 | ByteBuffer(byte[] bytes) {
12 | this.bytes = bytes;
13 | }
14 |
15 | boolean canRead() {
16 | return readIndex < bytes.length;
17 | }
18 |
19 | void skipBytes(int count) {
20 | readIndex += count;
21 | }
22 |
23 | int getReadIndex() {
24 | return readIndex;
25 | }
26 |
27 | String readUtf8() {
28 | return new String(readInt8Array());
29 | }
30 |
31 | byte[] readInt8Array() {
32 | return readInt8Array(readVaruint32());
33 | }
34 |
35 | byte[] readInt8Array(int length) {
36 | byte[] result = new byte[length];
37 | System.arraycopy(bytes, readIndex, result, 0, length);
38 | readIndex += length;
39 | return result;
40 | }
41 |
42 | byte readUint1() {
43 | return readByte();
44 | }
45 |
46 | byte readVarsint7() {
47 | return readByte();
48 | }
49 |
50 | byte readVaruint7() {
51 | return readByte();
52 | }
53 |
54 | int readVarsint32() {
55 | return readSignedLeb128(this);
56 | }
57 |
58 | int readVaruint32() {
59 | return readUnsignedLeb128(this);
60 | }
61 |
62 | int[] readVaruint32Array() {
63 | int length = readVaruint32();
64 | int[] result = new int[length];
65 | for (int i = 0; i < length; i++) {
66 | result[i] = readVaruint32();
67 | }
68 | return result;
69 | }
70 |
71 | long readVarsint64() {
72 | return readSignedLongLeb128(this);
73 | }
74 |
75 | float readFloat32() {
76 | return intBitsToFloat(readInt32());
77 | }
78 |
79 | double readFloat64() {
80 | return longBitsToDouble(readInt64());
81 | }
82 |
83 | int readUint32() {
84 | return readInt32();
85 | }
86 |
87 | int readInt32() {
88 | return readUint8AsInt() | (readUint8AsInt() << 8) | (readUint8AsInt() << 16) | (readUint8AsInt() << 24);
89 | }
90 |
91 | long readInt64() {
92 | return readUint8AsLong() | (readUint8AsLong() << 8) | (readUint8AsLong() << 16) | (readUint8AsLong() << 24) | (readUint8AsLong() << 32) | (readUint8AsLong() << 40) | (readUint8AsLong() << 48) | (readUint8AsLong() << 56);
93 | }
94 |
95 | private long readUint8AsLong() {
96 | return readByte() & 0xffL;
97 | }
98 |
99 | int readUint8AsInt() {
100 | return readByte() & 0xff;
101 | }
102 |
103 | byte readByte() {
104 | return bytes[readIndex++];
105 | }
106 | }
107 |
--------------------------------------------------------------------------------
/src/main/java/jp/hisano/wasm/interpreter/ExportedFunction.java:
--------------------------------------------------------------------------------
1 | package jp.hisano.wasm.interpreter;
2 |
3 | import jp.hisano.wasm.interpreter.Module.Function;
4 |
5 | final class ExportedFunction {
6 | private final Function function;
7 |
8 | ExportedFunction(Function function) {
9 | this.function = function;
10 | }
11 |
12 | T invoke(Instance instance, Object... parameters) {
13 | Frame frame = new Frame(instance, function);
14 | for (int i = 0; i < parameters.length; i++) {
15 | Object parameter = parameters[i];
16 | if (parameter instanceof Number) {
17 | Number number = (Number) parameter;
18 | switch (function.parameterTypes[i]) {
19 | case I32:
20 | frame.getLocalVariable(i).getValue().setI32(number.intValue());
21 | break;
22 | case I64:
23 | frame.getLocalVariable(i).getValue().setI64(number.longValue());
24 | break;
25 | case F32:
26 | frame.getLocalVariable(i).getValue().setF32(number.floatValue());
27 | break;
28 | case F64:
29 | frame.getLocalVariable(i).getValue().setF64(number.doubleValue());
30 | break;
31 | }
32 | }
33 | }
34 |
35 | function.invoke(frame);
36 |
37 | if (function.returnTypes.length == 0) {
38 | return null;
39 | }
40 |
41 | switch (function.returnTypes[0]) {
42 | case I32:
43 | return (T) (Integer)frame.pop().getI32();
44 | case I64:
45 | return (T) (Long)frame.pop().getI64();
46 | case F32:
47 | return (T) (Float)frame.pop().getF32();
48 | case F64:
49 | return (T) (Double)frame.pop().getF64();
50 |
51 | default:
52 | return null;
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/main/java/jp/hisano/wasm/interpreter/Frame.java:
--------------------------------------------------------------------------------
1 | package jp.hisano.wasm.interpreter;
2 |
3 | import java.util.LinkedList;
4 | import java.util.List;
5 | import java.util.Stack;
6 |
7 | import jp.hisano.wasm.interpreter.Module.Function;
8 | import jp.hisano.wasm.interpreter.Module.ValueType;
9 |
10 | final class Frame {
11 | private final Instance instance;
12 | private final LocalVariable[] localVariables;
13 |
14 | private final Stack stack = new Stack<>();
15 |
16 | Frame(Instance instance, Function function) {
17 | this.instance = instance;
18 |
19 | if (function == null) {
20 | localVariables = new LocalVariable[0];
21 | } else {
22 | List localVariables = new LinkedList<>();
23 | for (int i = 0, length = function.parameterTypes.length; i < length; i++) {
24 | localVariables.add(new LocalVariable(function.parameterTypes[i]));
25 | }
26 | for (int i = 0, length = function.locals.length; i < length; i++) {
27 | for (int j = 0; j < function.locals[i].getCount(); j++) {
28 | localVariables.add(new LocalVariable(function.locals[i].getType()));
29 | }
30 | }
31 | this.localVariables = localVariables.toArray(new LocalVariable[localVariables.size()]);
32 | }
33 | }
34 |
35 | Instance getInstance() {
36 | return instance;
37 | }
38 |
39 | Value pop() {
40 | return stack.pop();
41 | }
42 |
43 | void pushI32(int i32Value) {
44 | stack.push(new Value(i32Value));
45 | }
46 |
47 | void pushI64(long i64Value) {
48 | stack.push(new Value(i64Value));
49 | }
50 |
51 | void pushF32(float f32Value) {
52 | stack.push(new Value(f32Value));
53 | }
54 |
55 | void pushF64(double f64Value) {
56 | stack.push(new Value(f64Value));
57 | }
58 |
59 | LocalVariable getLocalVariable(int index) {
60 | return localVariables[index];
61 | }
62 |
63 | void throwExceptionToExitBlock(int depth) {
64 | throw new ExceptionToExitBlock(depth);
65 | }
66 |
67 | static class ExceptionToExitBlock extends RuntimeException {
68 | private int depth;
69 |
70 | private ExceptionToExitBlock(int depth) {
71 | this.depth = depth;
72 | }
73 |
74 | boolean isMoreExitRequired() {
75 | return depth != 0;
76 | }
77 |
78 | void decrementDepth() {
79 | depth--;
80 | }
81 | }
82 |
83 | void throwExceptionToReturn() {
84 | throw new ExceptionToReturn();
85 | }
86 |
87 | static class ExceptionToReturn extends RuntimeException {
88 | private ExceptionToReturn() {
89 | }
90 | }
91 |
92 | static class LocalVariable {
93 | private final Value value;
94 |
95 | LocalVariable(ValueType type) {
96 | value = new Value(type);
97 | }
98 |
99 | Value getValue() {
100 | return value;
101 | }
102 | }
103 | }
104 |
--------------------------------------------------------------------------------
/src/main/java/jp/hisano/wasm/interpreter/Instance.java:
--------------------------------------------------------------------------------
1 | package jp.hisano.wasm.interpreter;
2 |
3 | import java.util.List;
4 | import java.util.stream.Collectors;
5 |
6 | import jp.hisano.wasm.interpreter.Module.GlobalVariableType;
7 | import jp.hisano.wasm.interpreter.Module.Instruction;
8 |
9 | public final class Instance {
10 | private final Module module;
11 |
12 | private final List tables;
13 | private final List memories;
14 | private final List globalVariables;
15 |
16 | public Instance(Module module) {
17 | this.module = module;
18 |
19 | tables = createTables();
20 |
21 | memories = createMemories();
22 |
23 | globalVariables = module.getGlobalVariableTypes().stream().map(GlobalVariable::new).collect(Collectors.toList());
24 | prepareGlobalVariables();
25 | }
26 |
27 | private List createTables() {
28 | List tables = module.getTableTypes().stream().map(tableType -> new Table(module, tableType)).collect(Collectors.toList());
29 | module.getElementTypes().stream().forEach(elementType -> {
30 | Table table = tables.get(elementType.getTableIndex());
31 | int offset = getOffset(elementType.getOffsetInstructions());
32 | table.setElements(offset, elementType.getElements());
33 | });
34 | return tables;
35 | }
36 |
37 | private List createMemories() {
38 | return module.getMemoryTypes().stream().map(memoryType -> {
39 | Memory memory = new Memory(memoryType.getMinimumPageLength(), memoryType.getMaximumPageLength());
40 | memoryType.getData().stream().forEach(data -> {
41 | int offset = getOffset(data.getOffsetInstructions());
42 | memory.setData(offset, data.getData());
43 | });
44 | return memory;
45 | }).collect(Collectors.toList());
46 | }
47 |
48 | private int getOffset(List offsetInstructions) {
49 | Frame frame = new Frame(Instance.this, null);
50 | offsetInstructions.forEach(instruction -> {
51 | instruction.execute(frame);
52 | });
53 | int offset = frame.pop().getI32();
54 | return offset;
55 | }
56 |
57 | private void prepareGlobalVariables() {
58 | globalVariables.stream().forEach(globalVariable -> {
59 | GlobalVariableType type = globalVariable.getType();
60 | if (type.getType() == Module.ValueType.I32) {
61 | List instructions = type.getInstructions();
62 | // モジュールでインポートされたGlobalはスキップ
63 | if (!instructions.isEmpty()) {
64 | Frame frame = new Frame(Instance.this, null);
65 | instructions.forEach(instruction -> {
66 | instruction.execute(frame);
67 | });
68 | globalVariable.getValue().setI32(frame.pop().getI32());
69 | }
70 | }
71 | });
72 | }
73 |
74 | public T invoke(String name, Object... parameters) {
75 | return module.getExportedFunction(name).invoke(this, parameters);
76 | }
77 |
78 | Module getModule() {
79 | return module;
80 | }
81 |
82 | Table getTable(int index) {
83 | return tables.get(index);
84 | }
85 |
86 | Memory getMemory() {
87 | return memories.get(0);
88 | }
89 |
90 | GlobalVariable getGlobalVariable(int index) {
91 | return globalVariables.get(index);
92 | }
93 |
94 | static class GlobalVariable {
95 | private final GlobalVariableType type;
96 | private final Value value;
97 |
98 | GlobalVariable(GlobalVariableType type) {
99 | this.type = type;
100 | value = new Value(type.getType());
101 | }
102 |
103 | GlobalVariableType getType() {
104 | return type;
105 | }
106 |
107 | Value getValue() {
108 | return value;
109 | }
110 | }
111 | }
112 |
--------------------------------------------------------------------------------
/src/main/java/jp/hisano/wasm/interpreter/Interpreter.java:
--------------------------------------------------------------------------------
1 | package jp.hisano.wasm.interpreter;
2 |
3 | public final class Interpreter {
4 | private final Instance instance;
5 |
6 | public Interpreter(byte[] wasmFileContent) {
7 | instance = new Instance(new Module(wasmFileContent));
8 | }
9 |
10 | public T invoke(String name, Object... parameters) {
11 | return (T) instance.invoke(name, parameters);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/main/java/jp/hisano/wasm/interpreter/InterpreterException.java:
--------------------------------------------------------------------------------
1 | package jp.hisano.wasm.interpreter;
2 |
3 | public final class InterpreterException extends RuntimeException {
4 | private Type type;
5 |
6 | InterpreterException(Type type) {
7 | this.type = type;
8 | }
9 |
10 | public Type getType() {
11 | return type;
12 | }
13 |
14 | public enum Type {
15 | ILLEGAL_BINARY, UNREACHABLE,
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/src/main/java/jp/hisano/wasm/interpreter/Leb128.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright (C) 2008 The Android Open Source Project
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 |
17 | package jp.hisano.wasm.interpreter;
18 |
19 | // Modified from https://github.com/facebook/buck/blob/master/third-party/java/dx/src/com/android/dex/Leb128.java
20 |
21 | import static jp.hisano.wasm.interpreter.InterpreterException.Type.*;
22 |
23 | /**
24 | * Reads and writes DWARFv3 LEB 128 signed and unsigned integers. See DWARF v3
25 | * section 7.6.
26 | */
27 | final class Leb128 {
28 | /**
29 | * Reads an signed integer from {@code in}.
30 | */
31 | static int readSignedLeb128(ByteBuffer in) {
32 | int result = 0;
33 | int cur;
34 | int count = 0;
35 | int signBits = -1;
36 |
37 | do {
38 | cur = in.readByte() & 0xff;
39 | result |= (cur & 0x7f) << (count * 7);
40 | signBits <<= 7;
41 | count++;
42 | } while (((cur & 0x80) == 0x80) && count < 5);
43 |
44 | if ((cur & 0x80) == 0x80) {
45 | throw new InterpreterException(ILLEGAL_BINARY);
46 | }
47 |
48 | // Sign extend if appropriate
49 | if (((signBits >> 1) & result) != 0 ) {
50 | result |= signBits;
51 | }
52 |
53 | return result;
54 | }
55 |
56 | static long readSignedLongLeb128(ByteBuffer in) {
57 | int result = 0;
58 | int cur;
59 | int count = 0;
60 | int signBits = -1;
61 |
62 | do {
63 | cur = in.readByte() & 0xff;
64 | result |= (cur & 0x7f) << (count * 7);
65 | signBits <<= 7;
66 | count++;
67 | } while (((cur & 0x80) == 0x80) && count < 10);
68 |
69 | if ((cur & 0x80) == 0x80) {
70 | throw new InterpreterException(ILLEGAL_BINARY);
71 | }
72 |
73 | // Sign extend if appropriate
74 | if (((signBits >> 1) & result) != 0 ) {
75 | result |= signBits;
76 | }
77 |
78 | return result;
79 | }
80 |
81 | /**
82 | * Reads an unsigned integer from {@code in}.
83 | */
84 | static int readUnsignedLeb128(ByteBuffer in) {
85 | int result = 0;
86 | int cur;
87 | int count = 0;
88 |
89 | do {
90 | cur = in.readByte() & 0xff;
91 | result |= (cur & 0x7f) << (count * 7);
92 | count++;
93 | } while (((cur & 0x80) == 0x80) && count < 5);
94 |
95 | if ((cur & 0x80) == 0x80) {
96 | throw new InterpreterException(ILLEGAL_BINARY);
97 | }
98 |
99 | return result;
100 | }
101 |
102 | private Leb128() {
103 | }
104 | }
105 |
--------------------------------------------------------------------------------
/src/main/java/jp/hisano/wasm/interpreter/Memory.java:
--------------------------------------------------------------------------------
1 | package jp.hisano.wasm.interpreter;
2 |
3 | public final class Memory {
4 | private final byte[] data;
5 | private final int maximumPageLength;
6 |
7 | public Memory(int initialPageLength, int maximumPageLength) {
8 | data = new byte[initialPageLength * 64 * 1024];
9 | this.maximumPageLength = maximumPageLength;
10 | }
11 |
12 | void setData(int offset, byte[] data) {
13 | System.arraycopy(data, 0, this.data,offset,data.length);
14 | }
15 |
16 | int readInt32(int address) {
17 | return readInt8(address) | (readUint8AsInt(address + 1) << 8) | (readUint8AsInt(address + 2) << 16) | (readUint8AsInt(address + 3) << 24);
18 | }
19 |
20 | int readInt16AsInt(int address) {
21 | return (short) readUint16AsInt(address);
22 | }
23 |
24 | int readUint16AsInt(int address) {
25 | return readUint8AsInt(address) | (readUint8AsInt(address + 1) << 8);
26 | }
27 |
28 | int readUint8AsInt(int address) {
29 | return readInt8(address) & 0xff;
30 | }
31 |
32 | byte readInt8(int address) {
33 | return data[address];
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/src/main/java/jp/hisano/wasm/interpreter/Table.java:
--------------------------------------------------------------------------------
1 | package jp.hisano.wasm.interpreter;
2 |
3 | import jp.hisano.wasm.interpreter.Module.Function;
4 | import jp.hisano.wasm.interpreter.Module.TableType;
5 |
6 | final class Table {
7 | private final Module module;
8 | private final Function[] functions;
9 |
10 | Table(Module module, TableType tableType) {
11 | this.module = module;
12 | if (tableType.getElementType() == Module.ValueType.FUNCREF) {
13 | functions = new Function[tableType.getMinimumElementLength()];
14 | } else {
15 | functions = new Function[0];
16 | }
17 | }
18 |
19 | void setElements(int offset, int[] elements) {
20 | for (int i = 0, length = elements.length; i < length; i++) {
21 | functions[offset + i] = module.getFunction(elements[i]);
22 | }
23 | }
24 |
25 | Function getFunction(int index) {
26 | return functions[index];
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/main/java/jp/hisano/wasm/interpreter/TrapException.java:
--------------------------------------------------------------------------------
1 | package jp.hisano.wasm.interpreter;
2 |
3 | public final class TrapException extends RuntimeException {
4 | TrapException(String message) {
5 | super(message);
6 | }
7 |
8 | TrapException(String message, Throwable cause) {
9 | super(message, cause);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/main/java/jp/hisano/wasm/interpreter/Value.java:
--------------------------------------------------------------------------------
1 | package jp.hisano.wasm.interpreter;
2 |
3 | import jp.hisano.wasm.interpreter.Module.ValueType;
4 | import static jp.hisano.wasm.interpreter.Module.ValueType.*;
5 |
6 | final class Value {
7 | private final ValueType type;
8 |
9 | private int i32Value;
10 | private long i64Value;
11 | private float f32Value;
12 | private double f64Value;
13 |
14 | Value(ValueType type) {
15 | this.type = type;
16 | }
17 |
18 | Value(int i32Value) {
19 | this(I32);
20 | setI32(i32Value);
21 | }
22 |
23 | Value(long i64Value) {
24 | this(I64);
25 | setI64(i64Value);
26 | }
27 |
28 | Value(float f32Value) {
29 | this(F32);
30 | setF32(f32Value);
31 | }
32 |
33 | Value(double f64Value) {
34 | this(F64);
35 | setF64(f64Value);
36 | }
37 |
38 | ValueType getType() {
39 | return type;
40 | }
41 |
42 | void setI32(int newValue) {
43 | assureType(I32);
44 | i32Value = newValue;
45 | }
46 |
47 | int getI32() {
48 | assureType(I32);
49 | return i32Value;
50 | }
51 |
52 | void setI64(long newValue) {
53 | assureType(I64);
54 | i64Value = newValue;
55 | }
56 |
57 | long getI64() {
58 | assureType(I64);
59 | return i64Value;
60 | }
61 |
62 | void setF32(float newValue) {
63 | assureType(F32);
64 | f32Value = newValue;
65 | }
66 |
67 | float getF32() {
68 | assureType(F32);
69 | return f32Value;
70 | }
71 |
72 | void setF64(double newValue) {
73 | assureType(F64);
74 | f64Value = newValue;
75 | }
76 |
77 | double getF64() {
78 | assureType(F64);
79 | return f64Value;
80 | }
81 |
82 | private void assureType(ValueType type) {
83 | if (this.type != type) {
84 | throw new TrapException("type mismatch");
85 | }
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/src/test/java/jp/hisano/wasm/interpreter/AddressTest.java:
--------------------------------------------------------------------------------
1 | package jp.hisano.wasm.interpreter;
2 |
3 | import java.io.IOException;
4 |
5 | import org.junit.jupiter.api.DisplayName;
6 | import org.junit.jupiter.params.ParameterizedTest;
7 | import org.junit.jupiter.params.provider.CsvSource;
8 |
9 | import static jp.hisano.wasm.interpreter.TestUtils.*;
10 | import static org.junit.jupiter.api.Assertions.*;
11 |
12 | @DisplayName("address.wast")
13 | class AddressTest {
14 | @DisplayName("i32.load*")
15 | @ParameterizedTest(name = "{0}({1}) = {2}")
16 | @CsvSource({
17 | "8u_good1,0,97",
18 | "8u_good2,0,97",
19 | "8u_good3,0,98",
20 | "8u_good4,0,99",
21 | "8u_good5,0,122",
22 | "8s_good1,0,97",
23 | "8s_good2,0,97",
24 | "8s_good3,0,98",
25 | "8s_good4,0,99",
26 | "8s_good5,0,122",
27 | "16u_good1,0,25185",
28 | "16u_good2,0,25185",
29 | "16u_good3,0,25442",
30 | "16u_good4,0,25699",
31 | "16u_good5,0,122",
32 | "16s_good1,0,25185",
33 | "16s_good2,0,25185",
34 | "16s_good3,0,25442",
35 | "16s_good4,0,25699",
36 | "16s_good5,0,122",
37 | "32_good1,0,1684234849",
38 | "32_good2,0,1684234849",
39 | "32_good3,0,1701077858",
40 | "32_good4,0,1717920867",
41 | "32_good5,0,122",
42 | "8u_good1,65507,0",
43 | "8u_good2,65507,0",
44 | "8u_good3,65507,0",
45 | "8u_good4,65507,0",
46 | "8u_good5,65507,0",
47 | "8s_good1,65507,0",
48 | "8s_good2,65507,0",
49 | "8s_good3,65507,0",
50 | "8s_good4,65507,0",
51 | "8s_good5,65507,0",
52 | "16u_good1,65507,0",
53 | "16u_good2,65507,0",
54 | "16u_good3,65507,0",
55 | "16u_good4,65507,0",
56 | "16u_good5,65507,0",
57 | "16s_good1,65507,0",
58 | "16s_good2,65507,0",
59 | "16s_good3,65507,0",
60 | "16s_good4,65507,0",
61 | "16s_good5,65507,0",
62 | "32_good1,65507,0",
63 | "32_good2,65507,0",
64 | "32_good3,65507,0",
65 | "32_good4,65507,0",
66 | "32_good5,65507,0",
67 | "8u_good1,65508,0",
68 | "8u_good2,65508,0",
69 | "8u_good3,65508,0",
70 | "8u_good4,65508,0",
71 | "8u_good5,65508,0",
72 | "8s_good1,65508,0",
73 | "8s_good2,65508,0",
74 | "8s_good3,65508,0",
75 | "8s_good4,65508,0",
76 | "8s_good5,65508,0",
77 | "16u_good1,65508,0",
78 | "16u_good2,65508,0",
79 | "16u_good3,65508,0",
80 | "16u_good4,65508,0",
81 | "16u_good5,65508,0",
82 | "16s_good1,65508,0",
83 | "16s_good2,65508,0",
84 | "16s_good3,65508,0",
85 | "16s_good4,65508,0",
86 | "16s_good5,65508,0",
87 | "32_good1,65508,0",
88 | "32_good2,65508,0",
89 | "32_good3,65508,0",
90 | "32_good4,65508,0",
91 | })
92 | void load(String functionName, int address, int expectedValue) throws IOException {
93 | int resultValue = createInterpreter("spec/address/address.0.wasm").invoke(functionName, address);
94 | assertEquals(expectedValue, resultValue);
95 | }
96 | }
97 |
--------------------------------------------------------------------------------
/src/test/java/jp/hisano/wasm/interpreter/BrIfTest.java:
--------------------------------------------------------------------------------
1 | package jp.hisano.wasm.interpreter;
2 |
3 | import java.io.IOException;
4 |
5 | import org.junit.jupiter.api.Test;
6 | import org.junit.jupiter.params.ParameterizedTest;
7 | import org.junit.jupiter.params.provider.CsvSource;
8 |
9 | import static jp.hisano.wasm.interpreter.TestUtils.*;
10 | import static org.junit.jupiter.api.Assertions.*;
11 |
12 | class BrIfTest {
13 | @Test
14 | void type_i32() throws IOException {
15 | getInterpreter().invoke("type-i32");
16 | }
17 |
18 | @ParameterizedTest(name = "{0} -> {1}")
19 | @CsvSource({
20 | "0,2",
21 | "1,3",
22 | })
23 | void as_block_first(long value, long expectedValue) throws IOException {
24 | invoke("as-block-first", value, expectedValue);
25 | }
26 |
27 | @ParameterizedTest(name = "{0} -> {1}")
28 | @CsvSource({
29 | "0,2",
30 | "1,3",
31 | })
32 | void as_block_mid(long value, long expectedValue) throws IOException {
33 | invoke("as-block-mid", value, expectedValue);
34 | }
35 |
36 | @ParameterizedTest(name = "{0} -> {1}")
37 | @CsvSource({
38 | "0,2",
39 | "1,4",
40 | })
41 | void as_loop_mid(long value, long expectedValue) throws IOException {
42 | invoke("as-loop-mid", value, expectedValue);
43 | }
44 |
45 | @Test
46 | void as_br_value() throws IOException {
47 | invoke("as-br-value", 1);
48 | }
49 |
50 | @ParameterizedTest(name = "{0} -> {1}")
51 | @CsvSource({
52 | "0,2",
53 | "1,1",
54 | })
55 | void as_br_if_value_cond(long value, long expectedValue) throws IOException {
56 | invoke("as-br_if-value-cond", value, expectedValue);
57 | }
58 |
59 | @Test
60 | void as_br_table_value() throws IOException {
61 | invoke("as-br_table-value", 1);
62 | }
63 |
64 | @Test
65 | void as_br_table_value_index() throws IOException {
66 | invoke("as-br_table-value-index", 1);
67 | }
68 |
69 | @ParameterizedTest(name = "{0} -> {1}")
70 | @CsvSource({
71 | "0,2",
72 | "1,1",
73 | })
74 | void as_if_cond(long value, long expectedValue) throws IOException {
75 | invoke("as-if-cond", value, expectedValue);
76 | }
77 |
78 | private static void invoke(String functionName, long expectedValue) throws IOException {
79 | int resultValue = getInterpreter().invoke(functionName);
80 | assertEquals((int) expectedValue, resultValue);
81 | }
82 |
83 | private static void invoke(String functionName, long value, long expectedValue) throws IOException {
84 | int resultValue = getInterpreter().invoke(functionName, (int) value);
85 | assertEquals((int) expectedValue, resultValue);
86 | }
87 |
88 | private static Interpreter getInterpreter() throws IOException {
89 | return createInterpreter("spec/br_if/br_if.0.wasm");
90 | }
91 | }
92 |
--------------------------------------------------------------------------------
/src/test/java/jp/hisano/wasm/interpreter/CallTest.java:
--------------------------------------------------------------------------------
1 | package jp.hisano.wasm.interpreter;
2 |
3 | import java.io.IOException;
4 |
5 | import org.junit.jupiter.api.Test;
6 |
7 | import static jp.hisano.wasm.interpreter.TestUtils.*;
8 | import static org.junit.jupiter.api.Assertions.*;
9 |
10 | class CallTest {
11 | @Test
12 | void type_i32() throws IOException {
13 | int resultValue = getInterpreter().invoke("type-i32");
14 | assertEquals(306, resultValue);
15 | }
16 |
17 | @Test
18 | void as_call_indirect_mid() throws IOException {
19 | int resultValue = getInterpreter().invoke("as-call_indirect-mid");
20 | assertEquals(2, resultValue);
21 | }
22 |
23 | private static Interpreter getInterpreter() throws IOException {
24 | return createInterpreter("spec/call/call.0.wasm");
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/test/java/jp/hisano/wasm/interpreter/ConversionsTest.java:
--------------------------------------------------------------------------------
1 | package jp.hisano.wasm.interpreter;
2 |
3 | import java.io.IOException;
4 |
5 | import org.junit.jupiter.api.DisplayName;
6 | import org.junit.jupiter.params.ParameterizedTest;
7 | import org.junit.jupiter.params.provider.CsvSource;
8 |
9 | import static jp.hisano.wasm.interpreter.TestUtils.*;
10 | import static org.junit.jupiter.api.Assertions.*;
11 |
12 | @DisplayName("conversions.wast")
13 | class ConversionsTest {
14 | @DisplayName("i64.extend_i32_s")
15 | @ParameterizedTest(name = "i64.extend_i32_s({0}) = {1}")
16 | @CsvSource({
17 | "0,0",
18 | "10000,10000",
19 | "-10000,-10000",
20 | "-1,-1",
21 | "0x7fffffff,0x000000007fffffff",
22 | "0x80000000,0xffffffff80000000",
23 | })
24 | void i64_extend_i32_s(@WastValue int parameter, @WastValue long expectedResult) throws IOException {
25 | assertEquals(expectedResult, (long) invoke("i64.extend_i32_s", parameter));
26 | }
27 |
28 | @DisplayName("i64.extend_i32_u")
29 | @ParameterizedTest(name = "i64.extend_i32_u({0}) = {1}")
30 | @CsvSource({
31 | "0,0",
32 | "10000,10000",
33 | "-10000,0x00000000ffffd8f0",
34 | "-1,0xffffffff",
35 | "0x7fffffff,0x000000007fffffff",
36 | "0x80000000,0x0000000080000000",
37 | })
38 | void i64_extend_i32_u(@WastValue int parameter, @WastValue long expectedResult) throws IOException {
39 | assertEquals(expectedResult, (long) invoke("i64.extend_i32_u", parameter));
40 | }
41 |
42 | @DisplayName("i32.wrap_i64")
43 | @ParameterizedTest(name = "i32.wrap_i64({0}) = {1}")
44 | @CsvSource({
45 | "-1,-1",
46 | "-100000,-100000",
47 | "0x80000000,0x80000000",
48 | "0xffffffff7fffffff,0x7fffffff",
49 | "0xffffffff00000000,0x00000000",
50 | "0xfffffffeffffffff,0xffffffff",
51 | "0xffffffff00000001,0x00000001",
52 | "0,0",
53 | "1311768467463790320,0x9abcdef0",
54 | "0x00000000ffffffff,0xffffffff",
55 | "0x0000000100000000,0x00000000",
56 | "0x0000000100000001,0x00000001",
57 | })
58 | void i32_wrap_i64(@WastValue long parameter, @WastValue int expectedResult) throws IOException {
59 | assertEquals(expectedResult, (int) invoke("i32.wrap_i64", parameter));
60 | }
61 |
62 | @DisplayName("i32.trunc_f32_s")
63 | @ParameterizedTest(name = "i32.trunc_f32_s({0}) = {1}")
64 | @CsvSource({
65 | "0.0,0",
66 | "-0.0,0",
67 | "0x1p-149,0",
68 | "-0x1p-149,0",
69 | "1.0,1",
70 | "0x1.19999ap+0,1",
71 | "1.5,1",
72 | "-1.0,-1",
73 | "-0x1.19999ap+0,-1",
74 | "-1.5,-1",
75 | "-1.9,-1",
76 | "-2.0,-2",
77 | "2147483520.0,2147483520",
78 | "-2147483648.0,-2147483648",
79 | })
80 | void i32_trunc_f32_s(@WastValue float parameter, @WastValue int expectedResult) throws IOException {
81 | assertEquals(expectedResult, (int) invoke("i32.trunc_f32_s", parameter));
82 | }
83 |
84 | @DisplayName("i32.trunc_f32_u")
85 | @ParameterizedTest(name = "i32.trunc_f32_u({0}) = {1}")
86 | @CsvSource({
87 | "0.0,0",
88 | "-0.0,0",
89 | "0x1p-149,0",
90 | "-0x1p-149,0",
91 | "1.0,1",
92 | "0x1.19999ap+0,1",
93 | "1.5,1",
94 | "1.9,1",
95 | "2.0,2",
96 | // "2147483648,-2147483648",
97 | // "4294967040.0,-256",
98 | "-0x1.ccccccp-1,0",
99 | "-0x1.fffffep-1,0",
100 | })
101 | void i32_trunc_f32_u(@WastValue float parameter, @WastValue int expectedResult) throws IOException {
102 | assertEquals(expectedResult, (int) invoke("i32.trunc_f32_u", parameter));
103 | }
104 |
105 | @DisplayName("i32.trunc_f64_s")
106 | @ParameterizedTest(name = "i32.trunc_f64_s({0}) = {1}")
107 | @CsvSource({
108 | "0.0,0",
109 | "-0.0,0",
110 | "0x0.0000000000001p-1022,0",
111 | "-0x0.0000000000001p-1022,0",
112 | "1.0,1",
113 | "0x1.199999999999ap+0,1",
114 | "1.5,1",
115 | "-1.0,-1",
116 | "-0x1.199999999999ap+0,-1",
117 | "-1.5,-1",
118 | "-1.9,-1",
119 | "-2.0,-2",
120 | "2147483647.0,2147483647",
121 | "-2147483648.0,-2147483648",
122 | "-2147483648.9,-2147483648",
123 | " 2147483647.9, 2147483647",
124 | })
125 | void i32_trunc_f64_s(@WastValue double parameter, @WastValue int expectedResult) throws IOException {
126 | assertEquals(expectedResult, (int) invoke("i32.trunc_f64_s", parameter));
127 | }
128 |
129 | private T invoke(String functionName, Object... parameters) throws IOException {
130 | return createInterpreter("spec/conversions/conversions.0.wasm").invoke(functionName, parameters);
131 | }
132 | }
133 |
--------------------------------------------------------------------------------
/src/test/java/jp/hisano/wasm/interpreter/F32CmpTest.java:
--------------------------------------------------------------------------------
1 | package jp.hisano.wasm.interpreter;
2 |
3 | import java.io.IOException;
4 |
5 | import org.junit.jupiter.params.ParameterizedTest;
6 | import org.junit.jupiter.params.provider.CsvSource;
7 |
8 | import static jp.hisano.wasm.interpreter.TestUtils.*;
9 | import static org.junit.jupiter.api.Assertions.*;
10 |
11 | class F32CmpTest {
12 | @ParameterizedTest(name = "({0} == {1}) = {2} (f32.eq)")
13 | @CsvSource({
14 | "-0x0p+0,-0x0p+0,1",
15 | })
16 | void copysign(float first, float second, int expectedValue) throws IOException {
17 | invoke("eq", first, second, expectedValue);
18 | }
19 |
20 | @ParameterizedTest(name = "({0} != {1}) = {2} (f32.ne)")
21 | @CsvSource({
22 | "-0x0p+0,-0x0p+0,0",
23 | })
24 | void ne(float first, float second, int expectedValue) throws IOException {
25 | invoke("ne", first, second, expectedValue);
26 | }
27 |
28 | @ParameterizedTest(name = "({0} < {1}) = {2} (f32.lt)")
29 | @CsvSource({
30 | "0x1p-149,-0x1p-126,0",
31 | })
32 | void lt(float first, float second, int expectedValue) throws IOException {
33 | invoke("lt", first, second, expectedValue);
34 | }
35 |
36 | @ParameterizedTest(name = "({0} <= {1}) = {2} (f32.le)")
37 | @CsvSource({
38 | "-0x1p-149,-0x1p-149,1",
39 | "-0x1p-149,0x1p-149,1",
40 | "0x1p-149,-0x1p-149,0",
41 | })
42 | void le(float first, float second, int expectedValue) throws IOException {
43 | invoke("le", first, second, expectedValue);
44 | }
45 |
46 | @ParameterizedTest(name = "({0} > {1}) = {2} (f32.gt)")
47 | @CsvSource({
48 | "-0x1p-149,-0x1p-149,0",
49 | "-0x1p-149,0x1p-149,0",
50 | "0x1p-149,-0x1p-149,1",
51 | })
52 | void gt(float first, float second, int expectedValue) throws IOException {
53 | invoke("gt", first, second, expectedValue);
54 | }
55 |
56 | @ParameterizedTest(name = "({0} >= {1}) = {2} (f32.ge)")
57 | @CsvSource({
58 | "-0x1p-149,-0x1p-149,1",
59 | "-0x1p-149,0x1p-149,0",
60 | "0x1p-149,-0x1p-149,1",
61 | })
62 | void ge(float first, float second, int expectedValue) throws IOException {
63 | invoke("ge", first, second, expectedValue);
64 | }
65 |
66 | private static void invoke(String operatorName, float first, float second, int expectedValue) throws IOException {
67 | int resultValue = createInterpreter("spec/f32_cmp/f32_cmp.0.wasm").invoke(operatorName, first, second);
68 | assertEquals(expectedValue, resultValue);
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/src/test/java/jp/hisano/wasm/interpreter/F32Test.java:
--------------------------------------------------------------------------------
1 | package jp.hisano.wasm.interpreter;
2 |
3 | import java.io.IOException;
4 |
5 | import org.junit.jupiter.params.ParameterizedTest;
6 | import org.junit.jupiter.params.provider.CsvSource;
7 |
8 | import static jp.hisano.wasm.interpreter.TestUtils.*;
9 | import static org.junit.jupiter.api.Assertions.*;
10 |
11 | class F32Test {
12 | @ParameterizedTest(name = "{0} + {1} = {2} (f32.add)")
13 | @CsvSource({
14 | "1,1,2",
15 | })
16 | void add(float first, float second, float expectedValue) throws IOException {
17 | invoke("add", first, second, expectedValue);
18 | }
19 |
20 | @ParameterizedTest(name = "{0} - {1} = {2} (f32.sub)")
21 | @CsvSource({
22 | "1,1,0",
23 | })
24 | void sub(float first, float second, float expectedValue) throws IOException {
25 | invoke("sub", first, second, expectedValue);
26 | }
27 |
28 | @ParameterizedTest(name = "{0} * {1} = {2} (f32.mul)")
29 | @CsvSource({
30 | "1,2,2",
31 | })
32 | void mul(float first, float second, float expectedValue) throws IOException {
33 | invoke("mul", first, second, expectedValue);
34 | }
35 |
36 | @ParameterizedTest(name = "{0} / {1} = {2} (f32.div)")
37 | @CsvSource({
38 | "6,3,2",
39 | })
40 | void div(float first, float second, float expectedValue) throws IOException {
41 | invoke("div", first, second, expectedValue);
42 | }
43 |
44 | @ParameterizedTest(name = "min({0},{1}) = {2} (f32.min)")
45 | @CsvSource({
46 | "1,0,0",
47 | })
48 | void min(float first, float second, float expectedValue) throws IOException {
49 | invoke("min", first, second, expectedValue);
50 | }
51 |
52 | @ParameterizedTest(name = "max({0},{1}) = {2} (f32.max)")
53 | @CsvSource({
54 | "1,0,1",
55 | })
56 | void max(float first, float second, float expectedValue) throws IOException {
57 | invoke("max", first, second, expectedValue);
58 | }
59 |
60 | @ParameterizedTest(name = "sqrt({0}) = {1} (f32.sqrt)")
61 | @CsvSource({
62 | "4,2",
63 | })
64 | void sqrt(float value, float expectedValue) throws IOException {
65 | invoke("sqrt", value,expectedValue);
66 | }
67 |
68 | @ParameterizedTest(name = "floor({0}) = {1} (f32.floor)")
69 | @CsvSource({
70 | "1.1,1",
71 | })
72 | void floor(float value, float expectedValue) throws IOException {
73 | invoke("floor", value,expectedValue);
74 | }
75 |
76 | @ParameterizedTest(name = "ceil({0}) = {1} (f32.ceil)")
77 | @CsvSource({
78 | "1.1,2",
79 | })
80 | void ceil(float value, float expectedValue) throws IOException {
81 | invoke("ceil", value,expectedValue);
82 | }
83 |
84 | @ParameterizedTest(name = "trunc({0}) = {1} (f32.trunc)")
85 | @CsvSource({
86 | "1.1,1",
87 | "-1.1,-1",
88 | })
89 | void trunc(float value, float expectedValue) throws IOException {
90 | invoke("trunc", value,expectedValue);
91 | }
92 |
93 | @ParameterizedTest(name = "nearest({0}) = {1} (f32.nearest)")
94 | @CsvSource({
95 | "5.2,5",
96 | "5.5,6",
97 | "4.5,4",
98 | })
99 | void nearest(float value, float expectedValue) throws IOException {
100 | invoke("nearest", value,expectedValue);
101 | }
102 |
103 | private static void invoke(String operatorName, float value, float expectedValue) throws IOException {
104 | float resultValue = createInterpreter("spec/f32/f32.0.wasm").invoke(operatorName, value);
105 | assertEquals(expectedValue, resultValue);
106 | }
107 |
108 | private static void invoke(String operatorName, float first, float second, float expectedValue) throws IOException {
109 | float resultValue = createInterpreter("spec/f32/f32.0.wasm").invoke(operatorName, first, second);
110 | assertEquals(expectedValue, resultValue);
111 | }
112 | }
113 |
--------------------------------------------------------------------------------
/src/test/java/jp/hisano/wasm/interpreter/F64BitwiseTest.java:
--------------------------------------------------------------------------------
1 | package jp.hisano.wasm.interpreter;
2 |
3 | import java.io.IOException;
4 |
5 | import org.junit.jupiter.params.ParameterizedTest;
6 | import org.junit.jupiter.params.provider.CsvSource;
7 |
8 | import static jp.hisano.wasm.interpreter.TestUtils.*;
9 | import static org.junit.jupiter.api.Assertions.*;
10 |
11 | class F64BitwiseTest {
12 | @ParameterizedTest(name = "copysign({0},{1}) = {2} (f64.copysign)")
13 | @CsvSource({
14 | "1,-2,-1",
15 | })
16 | void copysign(double first, double second, double expectedValue) throws IOException {
17 | invoke("copysign", first, second, expectedValue);
18 | }
19 |
20 | @ParameterizedTest(name = "abs({0}) = {1} (f64.abs)")
21 | @CsvSource({
22 | "-1,1",
23 | })
24 | void abs(double value, double expectedValue) throws IOException {
25 | invoke("abs", value,expectedValue);
26 | }
27 |
28 | @ParameterizedTest(name = "neg({0}) = {1} (f64.neg)")
29 | @CsvSource({
30 | "-1,1",
31 | })
32 | void neg(double value, double expectedValue) throws IOException {
33 | invoke("neg", value,expectedValue);
34 | }
35 |
36 | private static void invoke(String operatorName, double value, double expectedValue) throws IOException {
37 | double resultValue = createInterpreter("spec/f64_bitwise/f64_bitwise.0.wasm").invoke(operatorName, value);
38 | assertEquals(expectedValue, resultValue);
39 | }
40 |
41 | private static void invoke(String operatorName, double first, double second, double expectedValue) throws IOException {
42 | double resultValue = createInterpreter("spec/f64_bitwise/f64_bitwise.0.wasm").invoke(operatorName, first, second);
43 | assertEquals(expectedValue, resultValue);
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/src/test/java/jp/hisano/wasm/interpreter/F64CmpTest.java:
--------------------------------------------------------------------------------
1 | package jp.hisano.wasm.interpreter;
2 |
3 | import java.io.IOException;
4 |
5 | import org.junit.jupiter.params.ParameterizedTest;
6 | import org.junit.jupiter.params.provider.CsvSource;
7 |
8 | import static jp.hisano.wasm.interpreter.TestUtils.*;
9 | import static org.junit.jupiter.api.Assertions.*;
10 |
11 | class F64CmpTest {
12 | @ParameterizedTest(name = "({0} == {1}) = {2} (f64.eq)")
13 | @CsvSource({
14 | "-0x0p+0,-0x0p+0,1",
15 | })
16 | void copysign(double first, double second, int expectedValue) throws IOException {
17 | invoke("eq", first, second, expectedValue);
18 | }
19 |
20 | @ParameterizedTest(name = "({0} != {1}) = {2} (f64.ne)")
21 | @CsvSource({
22 | "-0x0p+0,-0x0p+0,0",
23 | })
24 | void ne(double first, double second, int expectedValue) throws IOException {
25 | invoke("ne", first, second, expectedValue);
26 | }
27 |
28 | @ParameterizedTest(name = "({0} < {1}) = {2} (f64.lt)")
29 | @CsvSource({
30 | "0x1p-149,-0x1p-126,0",
31 | })
32 | void lt(double first, double second, int expectedValue) throws IOException {
33 | invoke("lt", first, second, expectedValue);
34 | }
35 |
36 | @ParameterizedTest(name = "({0} <= {1}) = {2} (f64.le)")
37 | @CsvSource({
38 | "-0x1p-149,-0x1p-149,1",
39 | "-0x1p-149,0x1p-149,1",
40 | "0x1p-149,-0x1p-149,0",
41 | })
42 | void le(double first, double second, int expectedValue) throws IOException {
43 | invoke("le", first, second, expectedValue);
44 | }
45 |
46 | @ParameterizedTest(name = "({0} > {1}) = {2} (f64.gt)")
47 | @CsvSource({
48 | "-0x1p-149,-0x1p-149,0",
49 | "-0x1p-149,0x1p-149,0",
50 | "0x1p-149,-0x1p-149,1",
51 | })
52 | void gt(double first, double second, int expectedValue) throws IOException {
53 | invoke("gt", first, second, expectedValue);
54 | }
55 |
56 | @ParameterizedTest(name = "({0} >= {1}) = {2} (f64.ge)")
57 | @CsvSource({
58 | "-0x1p-149,-0x1p-149,1",
59 | "-0x1p-149,0x1p-149,0",
60 | "0x1p-149,-0x1p-149,1",
61 | })
62 | void ge(double first, double second, int expectedValue) throws IOException {
63 | invoke("ge", first, second, expectedValue);
64 | }
65 |
66 | private static void invoke(String operatorName, double first, double second, int expectedValue) throws IOException {
67 | int resultValue = createInterpreter("spec/f64_cmp/f64_cmp.0.wasm").invoke(operatorName, first, second);
68 | assertEquals(expectedValue, resultValue);
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/src/test/java/jp/hisano/wasm/interpreter/F64Test.java:
--------------------------------------------------------------------------------
1 | package jp.hisano.wasm.interpreter;
2 |
3 | import java.io.IOException;
4 |
5 | import org.junit.jupiter.params.ParameterizedTest;
6 | import org.junit.jupiter.params.provider.CsvSource;
7 |
8 | import static jp.hisano.wasm.interpreter.TestUtils.*;
9 | import static org.junit.jupiter.api.Assertions.*;
10 |
11 | class F64Test {
12 | @ParameterizedTest(name = "{0} + {1} = {2} (f64.add)")
13 | @CsvSource({
14 | "1,1,2",
15 | })
16 | void add(double first, double second, double expectedValue) throws IOException {
17 | invoke("add", first, second, expectedValue);
18 | }
19 |
20 | @ParameterizedTest(name = "{0} - {1} = {2} (f64.sub)")
21 | @CsvSource({
22 | "1,1,0",
23 | })
24 | void sub(double first, double second, double expectedValue) throws IOException {
25 | invoke("sub", first, second, expectedValue);
26 | }
27 |
28 | @ParameterizedTest(name = "{0} * {1} = {2} (f64.mul)")
29 | @CsvSource({
30 | "1,2,2",
31 | })
32 | void mul(double first, double second, double expectedValue) throws IOException {
33 | invoke("mul", first, second, expectedValue);
34 | }
35 |
36 | @ParameterizedTest(name = "{0} / {1} = {2} (f64.div)")
37 | @CsvSource({
38 | "6,3,2",
39 | })
40 | void div(double first, double second, double expectedValue) throws IOException {
41 | invoke("div", first, second, expectedValue);
42 | }
43 |
44 | @ParameterizedTest(name = "min({0},{1}) = {2} (f64.min)")
45 | @CsvSource({
46 | "1,0,0",
47 | })
48 | void min(double first, double second, double expectedValue) throws IOException {
49 | invoke("min", first, second, expectedValue);
50 | }
51 |
52 | @ParameterizedTest(name = "max({0},{1}) = {2} (f64.max)")
53 | @CsvSource({
54 | "1,0,1",
55 | })
56 | void max(double first, double second, double expectedValue) throws IOException {
57 | invoke("max", first, second, expectedValue);
58 | }
59 |
60 | @ParameterizedTest(name = "sqrt({0}) = {1} (f64.sqrt)")
61 | @CsvSource({
62 | "4,2",
63 | })
64 | void sqrt(double value, double expectedValue) throws IOException {
65 | invoke("sqrt", value,expectedValue);
66 | }
67 |
68 | @ParameterizedTest(name = "floor({0}) = {1} (f64.floor)")
69 | @CsvSource({
70 | "1.1,1",
71 | })
72 | void floor(double value, double expectedValue) throws IOException {
73 | invoke("floor", value,expectedValue);
74 | }
75 |
76 | @ParameterizedTest(name = "ceil({0}) = {1} (f64.ceil)")
77 | @CsvSource({
78 | "1.1,2",
79 | })
80 | void ceil(double value, double expectedValue) throws IOException {
81 | invoke("ceil", value,expectedValue);
82 | }
83 |
84 | @ParameterizedTest(name = "trunc({0}) = {1} (f64.trunc)")
85 | @CsvSource({
86 | "1.1,1",
87 | "-1.1,-1",
88 | })
89 | void trunc(double value, double expectedValue) throws IOException {
90 | invoke("trunc", value,expectedValue);
91 | }
92 |
93 | @ParameterizedTest(name = "nearest({0}) = {1} (f64.nearest)")
94 | @CsvSource({
95 | "5.2,5",
96 | "5.5,6",
97 | "4.5,4",
98 | })
99 | void nearest(double value, double expectedValue) throws IOException {
100 | invoke("nearest", value,expectedValue);
101 | }
102 |
103 | private static void invoke(String operatorName, double value, double expectedValue) throws IOException {
104 | double resultValue = createInterpreter("spec/f64/f64.0.wasm").invoke(operatorName, value);
105 | assertEquals(expectedValue, resultValue);
106 | }
107 |
108 | private static void invoke(String operatorName, double first, double second, double expectedValue) throws IOException {
109 | double resultValue = createInterpreter("spec/f64/f64.0.wasm").invoke(operatorName, first, second);
110 | assertEquals(expectedValue, resultValue);
111 | }
112 | }
113 |
--------------------------------------------------------------------------------
/src/test/java/jp/hisano/wasm/interpreter/GlobalTest.java:
--------------------------------------------------------------------------------
1 | package jp.hisano.wasm.interpreter;
2 |
3 | import java.io.IOException;
4 |
5 | import org.junit.jupiter.api.Test;
6 |
7 | import static jp.hisano.wasm.interpreter.TestUtils.*;
8 | import static org.junit.jupiter.api.Assertions.*;
9 |
10 | class GlobalTest {
11 | @Test
12 | void get_a() throws IOException {
13 | int resultValue = getInterpreter().invoke("get-a");
14 | assertEquals(-2, resultValue);
15 | }
16 |
17 | private static Interpreter getInterpreter() throws IOException {
18 | return createInterpreter("spec/global/global.0.wasm");
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/test/java/jp/hisano/wasm/interpreter/I32Test.java:
--------------------------------------------------------------------------------
1 | package jp.hisano.wasm.interpreter;
2 |
3 | import java.io.IOException;
4 |
5 | import org.junit.jupiter.api.DisplayName;
6 | import org.junit.jupiter.api.Nested;
7 | import org.junit.jupiter.params.ParameterizedTest;
8 | import org.junit.jupiter.params.provider.CsvSource;
9 |
10 | import static jp.hisano.wasm.interpreter.TestUtils.*;
11 | import static org.junit.jupiter.api.Assertions.*;
12 |
13 | // https://www.w3.org/TR/wasm-core-2/
14 | class I32Test {
15 | @ParameterizedTest(name = "{0} + {1} = {2} (i32.add)")
16 | @CsvSource({
17 | "1,1,2",
18 | "1,0,1",
19 | "4294967295,4294967295,4294967294",
20 | "4294967295,1,0",
21 | "2147483647,1,2147483648",
22 | "2147483648,4294967295,2147483647",
23 | "2147483648,2147483648,0",
24 | "1073741823,1,1073741824",
25 | })
26 | void add(long first, long second, long expectedValue) throws IOException {
27 | invoke("add", first, second, expectedValue);
28 | }
29 |
30 | @ParameterizedTest(name = "{0} - {1} = {2} (i32.sub)")
31 | @CsvSource({
32 | "1,1,0",
33 | "1,0,1",
34 | })
35 | void sub(long first, long second, long expectedValue) throws IOException {
36 | invoke("sub", first, second, expectedValue);
37 | }
38 |
39 | @ParameterizedTest(name = "{0} * {1} = {2} (i32.mul)")
40 | @CsvSource({
41 | "1,1,1",
42 | "1,0,0",
43 | "4294967295,4294967295,1",
44 | "268435456,4096,0",
45 | "2147483648,0,0",
46 | "2147483648,4294967295,2147483648",
47 | "2147483647,4294967295,2147483649",
48 | "19088743,1985229328,898528368",
49 | "2147483647,2147483647,1",
50 | })
51 | void mul(long first, long second, long expectedValue) throws IOException {
52 | invoke("mul", first, second, expectedValue);
53 | }
54 |
55 | @ParameterizedTest(name = "{0} / {1} = {2} (i32.div_s)")
56 | @CsvSource({
57 | "1,1,1",
58 | "0,1,0",
59 | "2147483648,2,3221225472",
60 | })
61 | void div_s(long first, long second, long expectedValue) throws IOException {
62 | invoke("div_s", first, second, expectedValue);
63 | }
64 |
65 | @ParameterizedTest(name = "{0} / {1} = {2} (i32.div_u)")
66 | @CsvSource({
67 | "1,1,1",
68 | "0,1,0",
69 | "4294967295,4294967295,1",
70 | "4294967291,2,2147483645"
71 | })
72 | void div_u(long first, long second, long expectedValue) throws IOException {
73 | invoke("div_u", first, second, expectedValue);
74 | }
75 |
76 | @ParameterizedTest(name = "{0} % {1} = {2} (i32.rem_s)")
77 | @CsvSource({
78 | "11,5,1",
79 | "17,7,3",
80 | })
81 | void rem_s(long first, long second, long expectedValue) throws IOException {
82 | invoke("rem_s", first, second, expectedValue);
83 | }
84 |
85 | @ParameterizedTest(name = "{0} % {1} = {2} (i32.rem_u)")
86 | @CsvSource({
87 | "11,5,1",
88 | "17,7,3",
89 | })
90 | void rem_u(long first, long second, long expectedValue) throws IOException {
91 | invoke("rem_u", first, second, expectedValue);
92 | }
93 |
94 | @ParameterizedTest(name = "{0} & {1} = {2} (i32.and)")
95 | @CsvSource({
96 | "1,0,0",
97 | "0,1,0",
98 | "1,1,1",
99 | "0,0,0",
100 | })
101 | void and(long first, long second, long expectedValue) throws IOException {
102 | invoke("and", first, second, expectedValue);
103 | }
104 |
105 | @ParameterizedTest(name = "{0} | {1} = {2} (i32.or)")
106 | @CsvSource({
107 | "1,0,1",
108 | "0,1,1",
109 | "1,1,1",
110 | "0,0,0",
111 | })
112 | void or(long first, long second, long expectedValue) throws IOException {
113 | invoke("or", first, second, expectedValue);
114 | }
115 |
116 | @ParameterizedTest(name = "{0} ^ {1} = {2} (i32.xor)")
117 | @CsvSource({
118 | "1,0,1",
119 | "0,1,1",
120 | "1,1,0",
121 | "0,0,0",
122 | "2147483647,2147483648,4294967295",
123 | "2147483648,0,2147483648",
124 | "4294967295,2147483648,2147483647",
125 | "4294967295,2147483647,2147483648",
126 | "4042326015,4294963440,252645135",
127 | "4294967295,4294967295,0",
128 | })
129 | void xor(long first, long second, long expectedValue) throws IOException {
130 | invoke("xor", first, second, expectedValue);
131 | }
132 |
133 | @ParameterizedTest(name = "{0} << {1} = {2} (i32.shl)")
134 | @CsvSource({
135 | "1,1,2",
136 | })
137 | void shl(long first, long second, long expectedValue) throws IOException {
138 | invoke("shl", first, second, expectedValue);
139 | }
140 |
141 | @ParameterizedTest(name = "{0} >> {1} = {2} (i32.shr_s)")
142 | @CsvSource({
143 | "1,1,0",
144 | "1,0,1",
145 | })
146 | void shr_s(long first, long second, long expectedValue) throws IOException {
147 | invoke("shr_s", first, second, expectedValue);
148 | }
149 |
150 | @ParameterizedTest(name = "{0} >>> {1} = {2} (i32.shr_u)")
151 | @CsvSource({
152 | "1,1,0",
153 | "1,0,1",
154 | "4294967295,1,2147483647"
155 | })
156 | void shr_u(long first, long second, long expectedValue) throws IOException {
157 | invoke("shr_u", first, second, expectedValue);
158 | }
159 |
160 | @ParameterizedTest(name = "{0} rotl {1} = {2} (i32.rotl)")
161 | @CsvSource({
162 | "1,1,2",
163 | "1,0,1",
164 | })
165 | void rotl(long first, long second, long expectedValue) throws IOException {
166 | invoke("rotl", first, second, expectedValue);
167 | }
168 |
169 | @ParameterizedTest(name = "{0} rotr {1} = {2} (i32.rotr)")
170 | @CsvSource({
171 | "1,1,2147483648",
172 | "1,0,1",
173 | })
174 | void rotr(long first, long second, long expectedValue) throws IOException {
175 | invoke("rotr", first, second, expectedValue);
176 | }
177 |
178 | @DisplayName("i32.clz")
179 | @ParameterizedTest(name = "clz({0}) = {1}")
180 | @CsvSource({
181 | "4294967295,0",
182 | "0,32",
183 | "32768,16"
184 | })
185 | void clz(long value, long expectedValue) throws IOException {
186 | invoke("clz", value, expectedValue);
187 | }
188 |
189 | @DisplayName("i32.ctz")
190 | @ParameterizedTest(name = "ctz({0}) = {1}")
191 | @CsvSource({
192 | "4294967295,0",
193 | "0,32",
194 | "32768,15"
195 | })
196 | void ctz(long value, long expectedValue) throws IOException {
197 | invoke("ctz", value, expectedValue);
198 | }
199 |
200 | @DisplayName("i32.popcnt")
201 | @ParameterizedTest(name = "popcnt({0}) = {1}")
202 | @CsvSource({
203 | "4294967295,32",
204 | "0,0",
205 | "32768,1"
206 | })
207 | void popcnt(long value, long expectedValue) throws IOException {
208 | invoke("popcnt", value, expectedValue);
209 | }
210 |
211 | // https://github.com/WebAssembly/sign-extension-ops
212 | @Nested
213 | @DisplayName("Sign Extension Operators")
214 | class SignExtensionOperatorsTest {
215 | @ParameterizedTest(name = "{0} -> {1} (i32.extend8_s)")
216 | @CsvSource({
217 | "0,0",
218 | "127,127",
219 | "128,4294967168",
220 | "255,4294967295",
221 | "19088640,0",
222 | "4275878528,4294967168",
223 | "4294967295,4294967295",
224 | })
225 | void extend8_s(long value, long expectedValue) throws IOException {
226 | invoke("extend8_s", value, expectedValue);
227 | }
228 |
229 | @ParameterizedTest(name = "{0} -> {1} (i32.extend16_s)")
230 | @CsvSource({
231 | "0,0",
232 | "32767,32767",
233 | "32768,4294934528",
234 | "65535,4294967295",
235 | "19070976,0",
236 | "4275863552,4294934528",
237 | "4294967295,4294967295",
238 | })
239 | void extend16_s(long value, long expectedValue) throws IOException {
240 | invoke("extend16_s", value, expectedValue);
241 | }
242 | }
243 |
244 | @DisplayName("i32.eqz")
245 | @ParameterizedTest(name = "({0} == 0) = {1}")
246 | @CsvSource({
247 | "0,1",
248 | "1,0",
249 | "2147483648,0"
250 | })
251 | void eqz(long value, long expectedValue) throws IOException {
252 | invoke("eqz", value, expectedValue);
253 | }
254 |
255 | @DisplayName("i32.eq")
256 | @ParameterizedTest(name = "({0} == {1}) = {2}")
257 | @CsvSource({
258 | "0,0,1",
259 | "1,1,1",
260 | "4294967295,1,0"
261 | })
262 | void eq(long first, long second, long expectedValue) throws IOException {
263 | invoke("eq", first, second, expectedValue);
264 | }
265 |
266 | @DisplayName("i32.ne")
267 | @ParameterizedTest(name = "({0} != {1}) = {2}")
268 | @CsvSource({
269 | "0,0,0",
270 | "1,1,0",
271 | "4294967295,1,1"
272 | })
273 | void ne(long first, long second, long expectedValue) throws IOException {
274 | invoke("ne", first, second, expectedValue);
275 | }
276 |
277 | @DisplayName("i32.lt_s")
278 | @ParameterizedTest(name = "({0} < {1}) = {2}")
279 | @CsvSource({
280 | "0,0,0",
281 | "1,1,0",
282 | "4294967295,1,1",
283 | "1,0,0",
284 | "0,1,1",
285 | })
286 | void lt_s(long first, long second, long expectedValue) throws IOException {
287 | invoke("lt_s", first, second, expectedValue);
288 | }
289 |
290 | @DisplayName("i32.lt_u")
291 | @ParameterizedTest(name = "({0} < {1}) = {2}")
292 | @CsvSource({
293 | "0,0,0",
294 | "1,1,0",
295 | "4294967295,1,0",
296 | "1,0,0",
297 | "0,1,1",
298 | })
299 | void lt_u(long first, long second, long expectedValue) throws IOException {
300 | invoke("lt_u", first, second, expectedValue);
301 | }
302 |
303 | @DisplayName("i32.le_s")
304 | @ParameterizedTest(name = "({0} <= {1}) = {2}")
305 | @CsvSource({
306 | "0,0,1",
307 | "1,1,1",
308 | "4294967295,1,1",
309 | "1,0,0",
310 | "0,1,1",
311 | })
312 | void le_s(long first, long second, long expectedValue) throws IOException {
313 | invoke("le_s", first, second, expectedValue);
314 | }
315 |
316 | @DisplayName("i32.le_u")
317 | @ParameterizedTest(name = "({0} <= {1}) = {2}")
318 | @CsvSource({
319 | "0,0,1",
320 | "1,1,1",
321 | "4294967295,1,0",
322 | "1,0,0",
323 | "0,1,1",
324 | })
325 | void le_u(long first, long second, long expectedValue) throws IOException {
326 | invoke("le_u", first, second, expectedValue);
327 | }
328 |
329 | @DisplayName("i32.gt_s")
330 | @ParameterizedTest(name = "({0} > {1}) = {2}")
331 | @CsvSource({
332 | "0,0,0",
333 | "1,1,0",
334 | "4294967295,1,0",
335 | "1,0,1",
336 | "0,1,0",
337 | })
338 | void gt_s(long first, long second, long expectedValue) throws IOException {
339 | invoke("gt_s", first, second, expectedValue);
340 | }
341 |
342 | @DisplayName("i32.gt_u")
343 | @ParameterizedTest(name = "({0} > {1}) = {2}")
344 | @CsvSource({
345 | "0,0,0",
346 | "1,1,0",
347 | "4294967295,1,1",
348 | "1,0,1",
349 | "0,1,0",
350 | })
351 | void gt_u(long first, long second, long expectedValue) throws IOException {
352 | invoke("gt_u", first, second, expectedValue);
353 | }
354 |
355 | @DisplayName("i32.ge_s")
356 | @ParameterizedTest(name = "({0} >= {1}) = {2}")
357 | @CsvSource({
358 | "0,0,1",
359 | "1,1,1",
360 | "4294967295,1,0",
361 | "1,0,1",
362 | "0,1,0",
363 | })
364 | void ge_s(long first, long second, long expectedValue) throws IOException {
365 | invoke("ge_s", first, second, expectedValue);
366 | }
367 |
368 | @DisplayName("i32.ge_u")
369 | @ParameterizedTest(name = "({0} >= {1}) = {2}")
370 | @CsvSource({
371 | "0,0,1",
372 | "1,1,1",
373 | "4294967295,1,1",
374 | "1,0,1",
375 | "0,1,0",
376 | })
377 | void ge_u(long first, long second, long expectedValue) throws IOException {
378 | invoke("ge_u", first, second, expectedValue);
379 | }
380 |
381 | private static void invoke(String operatorName, long value, long expectedValue) throws IOException {
382 | int resultValue = createInterpreter("spec/i32/i32.0.wasm").invoke(operatorName, (int) value);
383 | assertEquals((int)expectedValue, resultValue);
384 | }
385 |
386 | private static void invoke(String operatorName, long first, long second, long expectedValue) throws IOException {
387 | int resultValue = createInterpreter("spec/i32/i32.0.wasm").invoke(operatorName, (int) first, (int) second);
388 | assertEquals((int)expectedValue, resultValue);
389 | }
390 | }
391 |
--------------------------------------------------------------------------------
/src/test/java/jp/hisano/wasm/interpreter/LocalGetTest.java:
--------------------------------------------------------------------------------
1 | package jp.hisano.wasm.interpreter;
2 |
3 | import java.io.IOException;
4 |
5 | import org.junit.jupiter.api.DisplayName;
6 | import org.junit.jupiter.api.Test;
7 |
8 | import static jp.hisano.wasm.interpreter.TestUtils.*;
9 | import static org.junit.jupiter.api.Assertions.*;
10 |
11 | @DisplayName("local_get")
12 | class LocalGetTest {
13 | @DisplayName("type-local-i32")
14 | @Test
15 | void type_local_i32() throws IOException {
16 | assertEquals(0, (int) invoke("type-local-i32"));
17 | }
18 |
19 | @DisplayName("type-local-i64")
20 | @Test
21 | void type_local_i64() throws IOException {
22 | assertEquals(0, (long) invoke("type-local-i64"));
23 | }
24 |
25 | @DisplayName("type-local-f32")
26 | @Test
27 | void type_local_f32() throws IOException {
28 | assertEquals(0, (float) invoke("type-local-f32"));
29 | }
30 |
31 | @DisplayName("type-local-f64")
32 | @Test
33 | void type_local_f64() throws IOException {
34 | assertEquals(0, (double) invoke("type-local-f64"));
35 | }
36 |
37 | @DisplayName("type-param-i32")
38 | @Test
39 | void type_param_i32() throws IOException {
40 | assertEquals(2, (int) invoke("type-param-i32", 2));
41 | }
42 |
43 | @DisplayName("type-param-i64")
44 | @Test
45 | void type_param_i64() throws IOException {
46 | assertEquals(3, (long) invoke("type-param-i64", 3L));
47 | }
48 |
49 | @DisplayName("type-param-f32")
50 | @Test
51 | void type_param_f32() throws IOException {
52 | assertEquals(4.4f, (float) invoke("type-param-f32", 4.4f));
53 | }
54 |
55 | @DisplayName("type-param-f64")
56 | @Test
57 | void type_param_f64() throws IOException {
58 | assertEquals(5.5, (double) invoke("type-param-f64", 5.5));
59 | }
60 |
61 | @DisplayName("as-block-value")
62 | @Test
63 | void as_block_value() throws IOException {
64 | assertEquals(6, (int) invoke("as-block-value", 6));
65 | }
66 |
67 | @DisplayName("as-loop-value")
68 | @Test
69 | void as_loop_value() throws IOException {
70 | assertEquals(7, (int) invoke("as-loop-value", 7));
71 | }
72 |
73 | @DisplayName("as-br-value")
74 | @Test
75 | void as_br_value() throws IOException {
76 | assertEquals(8, (int) invoke("as-br-value", 8));
77 | }
78 |
79 | @DisplayName("as-br_if-value")
80 | @Test
81 | void as_br_if_value() throws IOException {
82 | assertEquals(9, (int) invoke("as-br_if-value", 9));
83 | }
84 |
85 | @DisplayName("as-br_if-value-cond")
86 | @Test
87 | void as_br_if_value_cond() throws IOException {
88 | assertEquals(10, (int) invoke("as-br_if-value-cond", 10));
89 | }
90 |
91 | @DisplayName("as-br_table-value")
92 | @Test
93 | void as_br_table_value() throws IOException {
94 | assertEquals(2, (int) invoke("as-br_table-value", 1));
95 | }
96 |
97 | @DisplayName("as-return-value")
98 | @Test
99 | void as_return_value() throws IOException {
100 | assertEquals(0, (int) invoke("as-return-value", 0));
101 | }
102 |
103 | @DisplayName("as-if-then")
104 | @Test
105 | void as_if_then() throws IOException {
106 | assertEquals(1, (int) invoke("as-if-then", 1));
107 | }
108 |
109 | @DisplayName("as-if-else")
110 | @Test
111 | void as_if_else() throws IOException {
112 | assertEquals(0, (int) invoke("as-if-else", 0));
113 | }
114 |
115 | @DisplayName("type-mixed")
116 | @Test
117 | void type_mixed() throws IOException {
118 | invoke("type-mixed", 1, 2.2f, 3.3, 4, 5);
119 | }
120 |
121 | @DisplayName("read")
122 | @Test
123 | void read() throws IOException {
124 | assertEquals(34.8, (double) invoke("read", 1L, 2f, 3.3, 4, 5));
125 | }
126 |
127 | private T invoke(String functionName, Object... parameters) throws IOException {
128 | return createInterpreter("spec/local_get/local_get.0.wasm").invoke(functionName, parameters);
129 | }
130 | }
131 |
--------------------------------------------------------------------------------
/src/test/java/jp/hisano/wasm/interpreter/NopTest.java:
--------------------------------------------------------------------------------
1 | package jp.hisano.wasm.interpreter;
2 |
3 | import java.io.IOException;
4 |
5 | import org.junit.jupiter.api.DisplayName;
6 | import org.junit.jupiter.api.Test;
7 |
8 | import static jp.hisano.wasm.interpreter.TestUtils.*;
9 | import static org.junit.jupiter.api.Assertions.*;
10 |
11 | @DisplayName("nop.wast")
12 | class NopTest {
13 | @DisplayName("as-func-first")
14 | @Test
15 | void as_func_first() throws IOException {
16 | invoke("as-func-first", 1);
17 | }
18 |
19 | private static void invoke(String functionName, int expectedResult) throws IOException {
20 | assertEquals(expectedResult, (int)invokeFunction(functionName));
21 | }
22 |
23 | private static T invokeFunction(String functionName, Object... parameters) throws IOException {
24 | return createInterpreter("spec/nop/nop.0.wasm").invoke(functionName, parameters);
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/test/java/jp/hisano/wasm/interpreter/SampleTest.java:
--------------------------------------------------------------------------------
1 | package jp.hisano.wasm.interpreter;
2 |
3 | import java.io.IOException;
4 |
5 | import org.junit.jupiter.api.Test;
6 |
7 | import static jp.hisano.wasm.interpreter.TestUtils.*;
8 | import static org.junit.jupiter.api.Assertions.*;
9 |
10 | class SampleTest {
11 | @Test
12 | void addTwo() throws IOException {
13 | int resultValue = createInterpreter("sample/add.wasm").invoke("add", 1, 1);
14 | assertEquals(2, resultValue);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/test/java/jp/hisano/wasm/interpreter/TestUtils.java:
--------------------------------------------------------------------------------
1 | package jp.hisano.wasm.interpreter;
2 |
3 | import java.io.IOException;
4 |
5 | import static com.google.common.io.Resources.*;
6 |
7 | final class TestUtils {
8 | static Interpreter createInterpreter(String wasmFilePath) throws IOException {
9 | byte[] wasmBinary = toByteArray(getResource(TestUtils.class, wasmFilePath));
10 | return new Interpreter(wasmBinary);
11 | }
12 |
13 | private TestUtils() {
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/test/java/jp/hisano/wasm/interpreter/WastValue.java:
--------------------------------------------------------------------------------
1 | package jp.hisano.wasm.interpreter;
2 |
3 | import java.lang.annotation.ElementType;
4 | import java.lang.annotation.Retention;
5 | import java.lang.annotation.RetentionPolicy;
6 | import java.lang.annotation.Target;
7 |
8 | import org.junit.jupiter.params.converter.ConvertWith;
9 |
10 | @Target({ ElementType.ANNOTATION_TYPE, ElementType.PARAMETER })
11 | @Retention(RetentionPolicy.RUNTIME)
12 | @ConvertWith(WastValueConverter.class)
13 | @interface WastValue {
14 | }
15 |
--------------------------------------------------------------------------------
/src/test/java/jp/hisano/wasm/interpreter/WastValueConverter.java:
--------------------------------------------------------------------------------
1 | package jp.hisano.wasm.interpreter;
2 |
3 | import org.junit.jupiter.params.converter.ArgumentConversionException;
4 | import org.junit.jupiter.params.converter.SimpleArgumentConverter;
5 |
6 | import static java.lang.Double.*;
7 | import static java.lang.Float.*;
8 | import static java.lang.Integer.*;
9 | import static java.lang.Long.*;
10 |
11 | class WastValueConverter extends SimpleArgumentConverter {
12 | @Override
13 | protected Object convert(Object source, Class> targetType) throws ArgumentConversionException {
14 | String value = source.toString();
15 | if (targetType == float.class) {
16 | switch (value) {
17 | case "inf":
18 | return Float.POSITIVE_INFINITY;
19 | case "-inf":
20 | return Float.NEGATIVE_INFINITY;
21 | case "nan":
22 | return Float.NaN;
23 | case "-nan":
24 | // Suppress canonical NaN
25 | return intBitsToFloat(0xffc0_0000);
26 | default:
27 | return parseFloat(value);
28 | }
29 | } else if (targetType == double.class) {
30 | switch (value) {
31 | case "inf":
32 | return Double.POSITIVE_INFINITY;
33 | case "-inf":
34 | return Double.NEGATIVE_INFINITY;
35 | case "nan":
36 | return Double.NaN;
37 | case "-nan":
38 | // Suppress canonical NaN
39 | return (double) intBitsToFloat(0xffc0_0000);
40 | default:
41 | return parseDouble(value);
42 | }
43 | } else if (targetType == long.class) {
44 | if (value.startsWith("0x")) {
45 | return parseUnsignedLong(value.substring(2).replace("_", ""), 16);
46 | } else if (value.startsWith("-0x")) {
47 | return -parseUnsignedLong(value.substring(3).replace("_", ""), 16);
48 | } else {
49 | return parseLong(value);
50 | }
51 | } else if (targetType == int.class) {
52 | if (value.startsWith("0x")) {
53 | return parseUnsignedInt(value.substring(2).replace("_", ""), 16);
54 | } else if (value.startsWith("-0x")) {
55 | return -parseUnsignedInt(value.substring(3).replace("_", ""), 16);
56 | } else {
57 | return parseInt(value);
58 | }
59 | }
60 | throw new ArgumentConversionException("not supported type: " + targetType.getSimpleName());
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/sample/add.wasm:
--------------------------------------------------------------------------------
1 | asm ` add
2 | j
3 | name
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/sample/add.wat:
--------------------------------------------------------------------------------
1 | (module
2 | (func (export "add") (param i32 i32) (result i32)
3 | local.get 0
4 | local.get 1
5 | i32.add))
6 |
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/address/address.0.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/address/address.0.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/address/address.1.wat:
--------------------------------------------------------------------------------
1 | (memory 1)(func (drop (i32.load offset=4294967296 (i32.const 0))))
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/address/address.2.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/address/address.2.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/address/address.3.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/address/address.3.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/address/address.4.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/address/address.4.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/br_if/br_if.0.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/br_if/br_if.0.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/br_if/br_if.1.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 |
3 | @A
h
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/br_if/br_if.10.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 |
A
A
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/br_if/br_if.11.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 |
@A A
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/br_if/br_if.12.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 |
@A A
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/br_if/br_if.13.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 | A
A
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/br_if/br_if.14.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 | A
A
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/br_if/br_if.15.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 | BA
A
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/br_if/br_if.16.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 | BA
A
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/br_if/br_if.17.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 | @
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/br_if/br_if.18.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 |
3 | @
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/br_if/br_if.19.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 | @B
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/br_if/br_if.2.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 |
3 | @A
z
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/br_if/br_if.20.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 | A
A
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/br_if/br_if.21.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 | A @A
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/br_if/br_if.22.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 |
A B
A
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/br_if/br_if.23.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 | @A A
E
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/br_if/br_if.24.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 | @A A A
E
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/br_if/br_if.25.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 |
3 |
E
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/br_if/br_if.26.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 | A
E
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/br_if/br_if.27.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 | A
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/br_if/br_if.28.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 | @@A
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/br_if/br_if.29.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/br_if/br_if.29.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/br_if/br_if.3.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/br_if/br_if.3.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/br_if/br_if.4.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/br_if/br_if.4.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/br_if/br_if.5.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 |
3 | @A
h
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/br_if/br_if.6.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 |
3 | @B
z
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/br_if/br_if.7.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/br_if/br_if.7.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/br_if/br_if.8.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/br_if/br_if.8.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/br_if/br_if.9.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 |
A
A
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/call/call.0.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/call/call.0.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/call/call.1.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 |
3 | E
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/call/call.10.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/call/call.10.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/call/call.11.wasm:
--------------------------------------------------------------------------------
1 | asm ` `
2 | @
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/call/call.12.wasm:
--------------------------------------------------------------------------------
1 | asm ` `
2 | @A
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/call/call.13.wasm:
--------------------------------------------------------------------------------
1 | asm ` `
2 | @
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/call/call.14.wasm:
--------------------------------------------------------------------------------
1 | asm ` `
2 | @A
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/call/call.15.wasm:
--------------------------------------------------------------------------------
1 | asm ` `
2 | A @
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/call/call.16.wasm:
--------------------------------------------------------------------------------
1 | asm ` `
2 | A @A
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/call/call.17.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 |
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/call/call.18.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/call/call.18.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/call/call.2.wasm:
--------------------------------------------------------------------------------
1 | asm ` ` ~
2 | E B
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/call/call.3.wasm:
--------------------------------------------------------------------------------
1 | asm ` `
2 |
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/call/call.4.wasm:
--------------------------------------------------------------------------------
1 | asm ` `|
2 |
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/call/call.5.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 | A
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/call/call.6.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 | D @A
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/call/call.7.wasm:
--------------------------------------------------------------------------------
1 | asm ` `
2 | A
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/call/call.8.wasm:
--------------------------------------------------------------------------------
1 | asm ` `
2 | A
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/call/call.9.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/call/call.9.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/conversions/conversions.0.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/conversions/conversions.0.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/conversions/conversions.1.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/conversions/conversions.1.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/conversions/conversions.10.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/conversions/conversions.10.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/conversions/conversions.11.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/conversions/conversions.11.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/conversions/conversions.12.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/conversions/conversions.12.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/conversions/conversions.13.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/conversions/conversions.13.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/conversions/conversions.14.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/conversions/conversions.14.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/conversions/conversions.15.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/conversions/conversions.15.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/conversions/conversions.16.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/conversions/conversions.16.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/conversions/conversions.17.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/conversions/conversions.17.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/conversions/conversions.18.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/conversions/conversions.18.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/conversions/conversions.19.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/conversions/conversions.19.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/conversions/conversions.2.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/conversions/conversions.2.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/conversions/conversions.20.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/conversions/conversions.20.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/conversions/conversions.21.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/conversions/conversions.21.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/conversions/conversions.22.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/conversions/conversions.22.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/conversions/conversions.23.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/conversions/conversions.23.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/conversions/conversions.24.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/conversions/conversions.24.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/conversions/conversions.25.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/conversions/conversions.25.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/conversions/conversions.3.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/conversions/conversions.3.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/conversions/conversions.4.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/conversions/conversions.4.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/conversions/conversions.5.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/conversions/conversions.5.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/conversions/conversions.6.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/conversions/conversions.6.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/conversions/conversions.7.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/conversions/conversions.7.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/conversions/conversions.8.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/conversions/conversions.8.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/conversions/conversions.9.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/conversions/conversions.9.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/f32/f32.0.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/f32/f32.0.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/f32/f32.1.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/f32/f32.1.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/f32/f32.10.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/f32/f32.10.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/f32/f32.11.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/f32/f32.11.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/f32/f32.12.wat:
--------------------------------------------------------------------------------
1 | (func (result f32) (f32.const nan:arithmetic))
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/f32/f32.13.wat:
--------------------------------------------------------------------------------
1 | (func (result f32) (f32.const nan:canonical))
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/f32/f32.2.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/f32/f32.2.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/f32/f32.3.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/f32/f32.3.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/f32/f32.4.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/f32/f32.4.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/f32/f32.5.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/f32/f32.5.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/f32/f32.6.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/f32/f32.6.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/f32/f32.7.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/f32/f32.7.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/f32/f32.8.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/f32/f32.8.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/f32/f32.9.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/f32/f32.9.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/f32_bitwise/f32_bitwise.0.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/f32_bitwise/f32_bitwise.0.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/f32_bitwise/f32_bitwise.1.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/f32_bitwise/f32_bitwise.1.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/f32_bitwise/f32_bitwise.2.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/f32_bitwise/f32_bitwise.2.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/f32_bitwise/f32_bitwise.3.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/f32_bitwise/f32_bitwise.3.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/f32_cmp/f32_cmp.0.wasm:
--------------------------------------------------------------------------------
1 | asm `}} eq ne lt le gt ge
2 | 1 [ \ ] _ ^ `
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/f32_cmp/f32_cmp.1.wasm:
--------------------------------------------------------------------------------
1 | asm ` }
2 | B D [
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/f32_cmp/f32_cmp.2.wasm:
--------------------------------------------------------------------------------
1 | asm ` }
2 | B D `
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/f32_cmp/f32_cmp.3.wasm:
--------------------------------------------------------------------------------
1 | asm ` }
2 | B D ^
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/f32_cmp/f32_cmp.4.wasm:
--------------------------------------------------------------------------------
1 | asm ` }
2 | B D _
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/f32_cmp/f32_cmp.5.wasm:
--------------------------------------------------------------------------------
1 | asm ` }
2 | B D ]
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/f32_cmp/f32_cmp.6.wasm:
--------------------------------------------------------------------------------
1 | asm ` }
2 | B D \
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/f64/f64.0.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/f64/f64.0.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/f64/f64.1.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/f64/f64.1.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/f64/f64.10.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/f64/f64.10.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/f64/f64.11.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/f64/f64.11.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/f64/f64.12.wat:
--------------------------------------------------------------------------------
1 | (func (result f64) (f64.const nan:arithmetic))
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/f64/f64.13.wat:
--------------------------------------------------------------------------------
1 | (func (result f64) (f64.const nan:canonical))
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/f64/f64.2.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/f64/f64.2.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/f64/f64.3.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/f64/f64.3.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/f64/f64.4.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/f64/f64.4.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/f64/f64.5.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/f64/f64.5.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/f64/f64.6.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/f64/f64.6.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/f64/f64.7.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/f64/f64.7.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/f64/f64.8.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/f64/f64.8.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/f64/f64.9.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/f64/f64.9.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/f64_bitwise/f64_bitwise.0.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/f64_bitwise/f64_bitwise.0.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/f64_bitwise/f64_bitwise.1.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/f64_bitwise/f64_bitwise.1.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/f64_bitwise/f64_bitwise.2.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/f64_bitwise/f64_bitwise.2.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/f64_bitwise/f64_bitwise.3.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/f64_bitwise/f64_bitwise.3.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/f64_cmp/f64_cmp.0.wasm:
--------------------------------------------------------------------------------
1 | asm `|| eq ne lt le gt ge
2 | 1 a b c e d f
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/f64_cmp/f64_cmp.1.wasm:
--------------------------------------------------------------------------------
1 | asm ` |
2 |
3 | B C a
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/f64_cmp/f64_cmp.2.wasm:
--------------------------------------------------------------------------------
1 | asm ` |
2 |
3 | B C f
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/f64_cmp/f64_cmp.3.wasm:
--------------------------------------------------------------------------------
1 | asm ` |
2 |
3 | B C d
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/f64_cmp/f64_cmp.4.wasm:
--------------------------------------------------------------------------------
1 | asm ` |
2 |
3 | B C e
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/f64_cmp/f64_cmp.5.wasm:
--------------------------------------------------------------------------------
1 | asm ` |
2 |
3 | B C c
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/f64_cmp/f64_cmp.6.wasm:
--------------------------------------------------------------------------------
1 | asm ` |
2 |
3 | B C b
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/global/global.0.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/global/global.0.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/global/global.1.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/global/global.1.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/global/global.10.wasm:
--------------------------------------------------------------------------------
1 | asm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/global/global.11.wasm:
--------------------------------------------------------------------------------
1 | asm C
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/global/global.12.wasm:
--------------------------------------------------------------------------------
1 | asm A A
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/global/global.13.wasm:
--------------------------------------------------------------------------------
1 | asm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/global/global.14.wasm:
--------------------------------------------------------------------------------
1 | asm o p #
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/global/global.15.wasm:
--------------------------------------------------------------------------------
1 | asm test
2 | global-i32 # #
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/global/global.16.wasm:
--------------------------------------------------------------------------------
1 | asm test
2 | global-i32 A #
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/global/global.17.wasm:
--------------------------------------------------------------------------------
1 | asm #
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/global/global.18.wasm:
--------------------------------------------------------------------------------
1 | asm # A
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/global/global.19.wasm:
--------------------------------------------------------------------------------
1 | asm test
2 | global-i32 #
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/global/global.2.wasm:
--------------------------------------------------------------------------------
1 | asm ` spectest
2 | global_i32
3 | A$
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/global/global.20.wasm:
--------------------------------------------------------------------------------
1 | asm testglobal-mut-i32 #
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/global/global.21.wasm:
--------------------------------------------------------------------------------
1 | asm spectest
2 | global_i32
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/global/global.22.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/global/global.22.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/global/global.23.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/global/global.23.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/global/global.24.wasm:
--------------------------------------------------------------------------------
1 | asm A
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/global/global.25.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/global/global.25.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/global/global.26.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/global/global.26.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/global/global.27.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 | #
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/global/global.28.wasm:
--------------------------------------------------------------------------------
1 | asm ` A
2 | #
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/global/global.29.wasm:
--------------------------------------------------------------------------------
1 | asm ` spectest
2 | global_i32
3 | #
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/global/global.3.wasm:
--------------------------------------------------------------------------------
1 | asm }C a
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/global/global.30.wasm:
--------------------------------------------------------------------------------
1 | asm ` spectest
2 | global_i32 A
3 | #
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/global/global.31.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 | A $
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/global/global.32.wasm:
--------------------------------------------------------------------------------
1 | asm ` A
2 | A $
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/global/global.33.wasm:
--------------------------------------------------------------------------------
1 | asm ` spectest
2 | global_i32
3 | A $
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/global/global.34.wasm:
--------------------------------------------------------------------------------
1 | asm ` spectest
2 | global_i32 A
3 | A $
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/global/global.35.wasm:
--------------------------------------------------------------------------------
1 | asm ` A
2 | $
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/global/global.36.wasm:
--------------------------------------------------------------------------------
1 | asm ` A
2 | A @$
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/global/global.37.wasm:
--------------------------------------------------------------------------------
1 | asm ` A
2 | A @$
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/global/global.38.wasm:
--------------------------------------------------------------------------------
1 | asm ` A
2 |
A A @$
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/global/global.39.wasm:
--------------------------------------------------------------------------------
1 | asm ` A
2 | A A A $
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/global/global.4.wasm:
--------------------------------------------------------------------------------
1 | asm }C a
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/global/global.40.wasm:
--------------------------------------------------------------------------------
1 | asm ` A
2 |
A @$
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/global/global.41.wasm:
--------------------------------------------------------------------------------
1 | asm ` A
2 |
A @$
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/global/global.42.wasm:
--------------------------------------------------------------------------------
1 | asm ` A
2 | A @$
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/global/global.43.wasm:
--------------------------------------------------------------------------------
1 | asm ` A
2 | $
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/global/global.44.wasm:
--------------------------------------------------------------------------------
1 | asm ` A
2 | $ AA
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/global/global.45.wasm:
--------------------------------------------------------------------------------
1 | asm ` ` A
2 |
$
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/global/global.46.wasm:
--------------------------------------------------------------------------------
1 | asm `` pA A
2 | $ A
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/global/global.47.wat:
--------------------------------------------------------------------------------
1 | (global $foo i32 (i32.const 0))(global $foo i32 (i32.const 0))
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/global/global.48.wat:
--------------------------------------------------------------------------------
1 | (import "" "" (global $foo i32))(global $foo i32 (i32.const 0))
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/global/global.49.wat:
--------------------------------------------------------------------------------
1 | (import "" "" (global $foo i32))(import "" "" (global $foo i32))
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/global/global.5.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/global/global.5.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/global/global.6.wasm:
--------------------------------------------------------------------------------
1 | asm }
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/global/global.7.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/global/global.7.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/global/global.8.wasm:
--------------------------------------------------------------------------------
1 | asm A
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/global/global.9.wasm:
--------------------------------------------------------------------------------
1 | asm A h
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.0.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.0.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.1.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 | E
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.10.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 | EAA
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.11.wasm:
--------------------------------------------------------------------------------
1 | asm ` `
2 |
E
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.12.wasm:
--------------------------------------------------------------------------------
1 | asm `` p A
2 | EA
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.13.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 |
3 | E!
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.14.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 |
3 | E"
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.15.wasm:
--------------------------------------------------------------------------------
1 | asm ` A
2 |
3 | E$ #
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.16.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 | E@
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.17.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 | E(
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.18.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 |
3 | EA6
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.19.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 | j
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.2.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 | A @E
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.20.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 | A j
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.21.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 |
A A @j
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.22.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 |
A @A j
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.23.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 |
A A @j
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.24.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 |
A @A j
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.25.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 |
A A A j@
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.26.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 | A A A @j
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.27.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 | A A A A jA
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.28.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 | A A A j
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.29.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 |
A A @j
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.3.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 | A @E
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.30.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 |
A @A j
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.31.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 | A A @jA
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.32.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 | A @A jA
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.33.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 | A A @j
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.34.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 | A @A j
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.35.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 | j
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.36.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 | A j
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.37.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 | jAA
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.38.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 |
A jAA
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.39.wasm:
--------------------------------------------------------------------------------
1 | asm
2 | ` `
3 |
j
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.4.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 |
A A @E
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.40.wasm:
--------------------------------------------------------------------------------
1 | asm
2 | ` `
3 | A j
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.41.wasm:
--------------------------------------------------------------------------------
1 | asm `` p A
2 | jA
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.42.wasm:
--------------------------------------------------------------------------------
1 | asm `` p A
2 | A jA
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.43.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 |
3 | j!
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.44.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 | A j!
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.45.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 |
3 | j"
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.46.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 |
3 | A j"
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.47.wasm:
--------------------------------------------------------------------------------
1 | asm ` A
2 |
3 | j$ #
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.48.wasm:
--------------------------------------------------------------------------------
1 | asm ` A
2 |
3 | A j$ #
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.49.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 | j@
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.5.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 | A A A E
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.50.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 |
3 | A j@
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.51.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 | j(
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.52.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 | A j(
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.53.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 |
3 | jA6
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.54.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 |
3 | AjA 6
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.55.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 |
3 | B C j
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.56.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 |
3 | B C q
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.57.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 |
3 | B C m
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.58.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 |
3 | B C n
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.59.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 |
3 | B C l
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.6.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 |
A @E
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.60.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 |
3 | B C r
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.61.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 |
3 | B C o
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.62.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 |
3 | B C p
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.63.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 |
3 | B C w
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.64.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 |
3 | B C x
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.65.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 |
3 | B C t
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.66.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 |
3 | B C u
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.67.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 |
3 | B C v
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.68.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 |
3 | B C k
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.69.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 |
3 | B C s
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.7.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 |
A @EA
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.70.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 | B E
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.71.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 | B g
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.72.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 | B h
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.73.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 | B i
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.74.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 |
3 | B C F
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.75.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 |
3 | B C N
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.76.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 |
3 | B C O
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.77.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 |
3 | B C J
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.78.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 |
3 | B C K
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.79.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 |
3 | B C L
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.8.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 | A @E
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.80.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 |
3 | B C M
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.81.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 |
3 | B C H
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.82.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 |
3 | B C I
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.83.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 |
3 | B C G
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.84.wat:
--------------------------------------------------------------------------------
1 | (func (result i32) (i32.const nan:arithmetic))
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.85.wat:
--------------------------------------------------------------------------------
1 | (func (result i32) (i32.const nan:canonical))
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i32/i32.9.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 | E
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i64/i64.0.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/i64/i64.0.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i64/i64.1.wasm:
--------------------------------------------------------------------------------
1 | asm ` ~
2 |
3 | A C |
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i64/i64.10.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/i64/i64.10.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i64/i64.11.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/i64/i64.11.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i64/i64.12.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/i64/i64.12.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i64/i64.13.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/i64/i64.13.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i64/i64.14.wasm:
--------------------------------------------------------------------------------
1 | asm ` ~
2 |
3 | A C }
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i64/i64.15.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/i64/i64.15.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i64/i64.16.wasm:
--------------------------------------------------------------------------------
1 | asm ` ~
2 | A P
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i64/i64.17.wasm:
--------------------------------------------------------------------------------
1 | asm ` ~
2 | A y
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i64/i64.18.wasm:
--------------------------------------------------------------------------------
1 | asm ` ~
2 | A z
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i64/i64.19.wasm:
--------------------------------------------------------------------------------
1 | asm ` ~
2 | A {
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i64/i64.2.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/i64/i64.2.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i64/i64.20.wasm:
--------------------------------------------------------------------------------
1 | asm ` ~
2 |
3 | A C Q
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i64/i64.21.wasm:
--------------------------------------------------------------------------------
1 | asm ` ~
2 |
3 | A C Y
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i64/i64.22.wasm:
--------------------------------------------------------------------------------
1 | asm ` ~
2 |
3 | A C Z
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i64/i64.23.wasm:
--------------------------------------------------------------------------------
1 | asm ` ~
2 |
3 | A C U
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i64/i64.24.wasm:
--------------------------------------------------------------------------------
1 | asm ` ~
2 |
3 | A C V
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i64/i64.25.wasm:
--------------------------------------------------------------------------------
1 | asm ` ~
2 |
3 | A C W
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i64/i64.26.wasm:
--------------------------------------------------------------------------------
1 | asm ` ~
2 |
3 | A C X
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i64/i64.27.wasm:
--------------------------------------------------------------------------------
1 | asm ` ~
2 |
3 | A C S
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i64/i64.28.wasm:
--------------------------------------------------------------------------------
1 | asm ` ~
2 |
3 | A C T
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i64/i64.29.wasm:
--------------------------------------------------------------------------------
1 | asm ` ~
2 |
3 | A C R
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i64/i64.3.wasm:
--------------------------------------------------------------------------------
1 | asm ` ~
2 |
3 | A C
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i64/i64.30.wat:
--------------------------------------------------------------------------------
1 | (func (result i64) (i64.const nan:arithmetic))
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i64/i64.31.wat:
--------------------------------------------------------------------------------
1 | (func (result i64) (i64.const nan:canonical))
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i64/i64.4.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/i64/i64.4.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i64/i64.5.wasm:
--------------------------------------------------------------------------------
1 | asm ` ~
2 |
3 | A C ~
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i64/i64.6.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/i64/i64.6.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i64/i64.7.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/i64/i64.7.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i64/i64.8.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/i64/i64.8.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/i64/i64.9.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/i64/i64.9.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/local_get/local_get.0.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/local_get/local_get.0.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/local_get/local_get.1.wasm:
--------------------------------------------------------------------------------
1 | asm ` ~
2 |
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/local_get/local_get.10.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 | |
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/local_get/local_get.11.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 | ~
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/local_get/local_get.12.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/local_get/local_get.12.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/local_get/local_get.13.wasm:
--------------------------------------------------------------------------------
1 | asm `~
2 |
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/local_get/local_get.14.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/local_get/local_get.14.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/local_get/local_get.15.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 | ~
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/local_get/local_get.16.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/local_get/local_get.16.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/local_get/local_get.2.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 | } E
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/local_get/local_get.3.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/local_get/local_get.3.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/local_get/local_get.4.wasm:
--------------------------------------------------------------------------------
1 | asm `~
2 |
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/local_get/local_get.5.wasm:
--------------------------------------------------------------------------------
1 | asm `}
2 | E
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/local_get/local_get.6.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/local_get/local_get.6.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/local_get/local_get.7.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 |
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/local_get/local_get.8.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 | ~
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/local_get/local_get.9.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 | }
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/local_get/local_get.json:
--------------------------------------------------------------------------------
1 | {"source_filename": "local_get.wast",
2 | "commands": [
3 | {"type": "module", "line": 3, "filename": "local_get.0.wasm"},
4 | {"type": "assert_return", "line": 109, "action": {"type": "invoke", "field": "type-local-i32", "args": []}, "expected": [{"type": "i32", "value": "0"}]},
5 | {"type": "assert_return", "line": 110, "action": {"type": "invoke", "field": "type-local-i64", "args": []}, "expected": [{"type": "i64", "value": "0"}]},
6 | {"type": "assert_return", "line": 111, "action": {"type": "invoke", "field": "type-local-f32", "args": []}, "expected": [{"type": "f32", "value": "0"}]},
7 | {"type": "assert_return", "line": 112, "action": {"type": "invoke", "field": "type-local-f64", "args": []}, "expected": [{"type": "f64", "value": "0"}]},
8 | {"type": "assert_return", "line": 114, "action": {"type": "invoke", "field": "type-param-i32", "args": [{"type": "i32", "value": "2"}]}, "expected": [{"type": "i32", "value": "2"}]},
9 | {"type": "assert_return", "line": 115, "action": {"type": "invoke", "field": "type-param-i64", "args": [{"type": "i64", "value": "3"}]}, "expected": [{"type": "i64", "value": "3"}]},
10 | {"type": "assert_return", "line": 116, "action": {"type": "invoke", "field": "type-param-f32", "args": [{"type": "f32", "value": "1082969293"}]}, "expected": [{"type": "f32", "value": "1082969293"}]},
11 | {"type": "assert_return", "line": 117, "action": {"type": "invoke", "field": "type-param-f64", "args": [{"type": "f64", "value": "4617878467915022336"}]}, "expected": [{"type": "f64", "value": "4617878467915022336"}]},
12 | {"type": "assert_return", "line": 119, "action": {"type": "invoke", "field": "as-block-value", "args": [{"type": "i32", "value": "6"}]}, "expected": [{"type": "i32", "value": "6"}]},
13 | {"type": "assert_return", "line": 120, "action": {"type": "invoke", "field": "as-loop-value", "args": [{"type": "i32", "value": "7"}]}, "expected": [{"type": "i32", "value": "7"}]},
14 | {"type": "assert_return", "line": 122, "action": {"type": "invoke", "field": "as-br-value", "args": [{"type": "i32", "value": "8"}]}, "expected": [{"type": "i32", "value": "8"}]},
15 | {"type": "assert_return", "line": 123, "action": {"type": "invoke", "field": "as-br_if-value", "args": [{"type": "i32", "value": "9"}]}, "expected": [{"type": "i32", "value": "9"}]},
16 | {"type": "assert_return", "line": 124, "action": {"type": "invoke", "field": "as-br_if-value-cond", "args": [{"type": "i32", "value": "10"}]}, "expected": [{"type": "i32", "value": "10"}]},
17 | {"type": "assert_return", "line": 125, "action": {"type": "invoke", "field": "as-br_table-value", "args": [{"type": "i32", "value": "1"}]}, "expected": [{"type": "i32", "value": "2"}]},
18 | {"type": "assert_return", "line": 127, "action": {"type": "invoke", "field": "as-return-value", "args": [{"type": "i32", "value": "0"}]}, "expected": [{"type": "i32", "value": "0"}]},
19 | {"type": "assert_return", "line": 129, "action": {"type": "invoke", "field": "as-if-then", "args": [{"type": "i32", "value": "1"}]}, "expected": [{"type": "i32", "value": "1"}]},
20 | {"type": "assert_return", "line": 130, "action": {"type": "invoke", "field": "as-if-else", "args": [{"type": "i32", "value": "0"}]}, "expected": [{"type": "i32", "value": "0"}]},
21 | {"type": "assert_return", "line": 133, "action": {"type": "invoke", "field": "type-mixed", "args": [{"type": "i64", "value": "1"}, {"type": "f32", "value": "1074580685"}, {"type": "f64", "value": "4614613358185178726"}, {"type": "i32", "value": "4"}, {"type": "i32", "value": "5"}]}, "expected": []},
22 | {"type": "assert_return", "line": 139, "action": {"type": "invoke", "field": "read", "args": [{"type": "i64", "value": "1"}, {"type": "f32", "value": "1073741824"}, {"type": "f64", "value": "4614613358185178726"}, {"type": "i32", "value": "4"}, {"type": "i32", "value": "5"}]}, "expected": [{"type": "f64", "value": "4630094481904264806"}]},
23 | {"type": "assert_invalid", "line": 149, "filename": "local_get.1.wasm", "text": "type mismatch", "module_type": "binary"},
24 | {"type": "assert_invalid", "line": 153, "filename": "local_get.2.wasm", "text": "type mismatch", "module_type": "binary"},
25 | {"type": "assert_invalid", "line": 157, "filename": "local_get.3.wasm", "text": "type mismatch", "module_type": "binary"},
26 | {"type": "assert_invalid", "line": 165, "filename": "local_get.4.wasm", "text": "type mismatch", "module_type": "binary"},
27 | {"type": "assert_invalid", "line": 169, "filename": "local_get.5.wasm", "text": "type mismatch", "module_type": "binary"},
28 | {"type": "assert_invalid", "line": 173, "filename": "local_get.6.wasm", "text": "type mismatch", "module_type": "binary"},
29 | {"type": "assert_invalid", "line": 181, "filename": "local_get.7.wasm", "text": "type mismatch", "module_type": "binary"},
30 | {"type": "assert_invalid", "line": 185, "filename": "local_get.8.wasm", "text": "type mismatch", "module_type": "binary"},
31 | {"type": "assert_invalid", "line": 189, "filename": "local_get.9.wasm", "text": "type mismatch", "module_type": "binary"},
32 | {"type": "assert_invalid", "line": 193, "filename": "local_get.10.wasm", "text": "type mismatch", "module_type": "binary"},
33 | {"type": "assert_invalid", "line": 201, "filename": "local_get.11.wasm", "text": "unknown local", "module_type": "binary"},
34 | {"type": "assert_invalid", "line": 205, "filename": "local_get.12.wasm", "text": "unknown local", "module_type": "binary"},
35 | {"type": "assert_invalid", "line": 210, "filename": "local_get.13.wasm", "text": "unknown local", "module_type": "binary"},
36 | {"type": "assert_invalid", "line": 214, "filename": "local_get.14.wasm", "text": "unknown local", "module_type": "binary"},
37 | {"type": "assert_invalid", "line": 219, "filename": "local_get.15.wasm", "text": "unknown local", "module_type": "binary"},
38 | {"type": "assert_invalid", "line": 223, "filename": "local_get.16.wasm", "text": "unknown local", "module_type": "binary"}]}
39 |
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/local_get/local_get.wast:
--------------------------------------------------------------------------------
1 | ;; Test `local.get` operator
2 |
3 | (module
4 | ;; Typing
5 |
6 | (func (export "type-local-i32") (result i32) (local i32) (local.get 0))
7 | (func (export "type-local-i64") (result i64) (local i64) (local.get 0))
8 | (func (export "type-local-f32") (result f32) (local f32) (local.get 0))
9 | (func (export "type-local-f64") (result f64) (local f64) (local.get 0))
10 |
11 | (func (export "type-param-i32") (param i32) (result i32) (local.get 0))
12 | (func (export "type-param-i64") (param i64) (result i64) (local.get 0))
13 | (func (export "type-param-f32") (param f32) (result f32) (local.get 0))
14 | (func (export "type-param-f64") (param f64) (result f64) (local.get 0))
15 |
16 | (func (export "type-mixed") (param i64 f32 f64 i32 i32)
17 | (local f32 i64 i64 f64)
18 | (drop (i64.eqz (local.get 0)))
19 | (drop (f32.neg (local.get 1)))
20 | (drop (f64.neg (local.get 2)))
21 | (drop (i32.eqz (local.get 3)))
22 | (drop (i32.eqz (local.get 4)))
23 | (drop (f32.neg (local.get 5)))
24 | (drop (i64.eqz (local.get 6)))
25 | (drop (i64.eqz (local.get 7)))
26 | (drop (f64.neg (local.get 8)))
27 | )
28 |
29 | ;; Reading
30 |
31 | (func (export "read") (param i64 f32 f64 i32 i32) (result f64)
32 | (local f32 i64 i64 f64)
33 | (local.set 5 (f32.const 5.5))
34 | (local.set 6 (i64.const 6))
35 | (local.set 8 (f64.const 8))
36 | (f64.add
37 | (f64.convert_i64_u (local.get 0))
38 | (f64.add
39 | (f64.promote_f32 (local.get 1))
40 | (f64.add
41 | (local.get 2)
42 | (f64.add
43 | (f64.convert_i32_u (local.get 3))
44 | (f64.add
45 | (f64.convert_i32_s (local.get 4))
46 | (f64.add
47 | (f64.promote_f32 (local.get 5))
48 | (f64.add
49 | (f64.convert_i64_u (local.get 6))
50 | (f64.add
51 | (f64.convert_i64_u (local.get 7))
52 | (local.get 8)
53 | )
54 | )
55 | )
56 | )
57 | )
58 | )
59 | )
60 | )
61 | )
62 |
63 | ;; As parameter of control constructs and instructions
64 |
65 | (func (export "as-block-value") (param i32) (result i32)
66 | (block (result i32) (local.get 0))
67 | )
68 | (func (export "as-loop-value") (param i32) (result i32)
69 | (loop (result i32) (local.get 0))
70 | )
71 | (func (export "as-br-value") (param i32) (result i32)
72 | (block (result i32) (br 0 (local.get 0)))
73 | )
74 | (func (export "as-br_if-value") (param i32) (result i32)
75 | (block $l0 (result i32) (br_if $l0 (local.get 0) (i32.const 1)))
76 | )
77 |
78 | (func (export "as-br_if-value-cond") (param i32) (result i32)
79 | (block (result i32)
80 | (br_if 0 (local.get 0) (local.get 0))
81 | )
82 | )
83 | (func (export "as-br_table-value") (param i32) (result i32)
84 | (block
85 | (block
86 | (block
87 | (br_table 0 1 2 (local.get 0))
88 | (return (i32.const 0))
89 | )
90 | (return (i32.const 1))
91 | )
92 | (return (i32.const 2))
93 | )
94 | (i32.const 3)
95 | )
96 |
97 | (func (export "as-return-value") (param i32) (result i32)
98 | (return (local.get 0))
99 | )
100 |
101 | (func (export "as-if-then") (param i32) (result i32)
102 | (if (result i32) (local.get 0) (then (local.get 0)) (else (i32.const 0)))
103 | )
104 | (func (export "as-if-else") (param i32) (result i32)
105 | (if (result i32) (local.get 0) (then (i32.const 1)) (else (local.get 0)))
106 | )
107 | )
108 |
109 | (assert_return (invoke "type-local-i32") (i32.const 0))
110 | (assert_return (invoke "type-local-i64") (i64.const 0))
111 | (assert_return (invoke "type-local-f32") (f32.const 0))
112 | (assert_return (invoke "type-local-f64") (f64.const 0))
113 |
114 | (assert_return (invoke "type-param-i32" (i32.const 2)) (i32.const 2))
115 | (assert_return (invoke "type-param-i64" (i64.const 3)) (i64.const 3))
116 | (assert_return (invoke "type-param-f32" (f32.const 4.4)) (f32.const 4.4))
117 | (assert_return (invoke "type-param-f64" (f64.const 5.5)) (f64.const 5.5))
118 |
119 | (assert_return (invoke "as-block-value" (i32.const 6)) (i32.const 6))
120 | (assert_return (invoke "as-loop-value" (i32.const 7)) (i32.const 7))
121 |
122 | (assert_return (invoke "as-br-value" (i32.const 8)) (i32.const 8))
123 | (assert_return (invoke "as-br_if-value" (i32.const 9)) (i32.const 9))
124 | (assert_return (invoke "as-br_if-value-cond" (i32.const 10)) (i32.const 10))
125 | (assert_return (invoke "as-br_table-value" (i32.const 1)) (i32.const 2))
126 |
127 | (assert_return (invoke "as-return-value" (i32.const 0)) (i32.const 0))
128 |
129 | (assert_return (invoke "as-if-then" (i32.const 1)) (i32.const 1))
130 | (assert_return (invoke "as-if-else" (i32.const 0)) (i32.const 0))
131 |
132 | (assert_return
133 | (invoke "type-mixed"
134 | (i64.const 1) (f32.const 2.2) (f64.const 3.3) (i32.const 4) (i32.const 5)
135 | )
136 | )
137 |
138 | (assert_return
139 | (invoke "read"
140 | (i64.const 1) (f32.const 2) (f64.const 3.3) (i32.const 4) (i32.const 5)
141 | )
142 | (f64.const 34.8)
143 | )
144 |
145 |
146 | ;; Invalid typing of access to locals
147 |
148 | (assert_invalid
149 | (module (func $type-local-num-vs-num (result i64) (local i32) (local.get 0)))
150 | "type mismatch"
151 | )
152 | (assert_invalid
153 | (module (func $type-local-num-vs-num (result i32) (local f32) (i32.eqz (local.get 0))))
154 | "type mismatch"
155 | )
156 | (assert_invalid
157 | (module (func $type-local-num-vs-num (result f64) (local f64 i64) (f64.neg (local.get 1))))
158 | "type mismatch"
159 | )
160 |
161 |
162 | ;; Invalid typing of access to parameters
163 |
164 | (assert_invalid
165 | (module (func $type-param-num-vs-num (param i32) (result i64) (local.get 0)))
166 | "type mismatch"
167 | )
168 | (assert_invalid
169 | (module (func $type-param-num-vs-num (param f32) (result i32) (i32.eqz (local.get 0))))
170 | "type mismatch"
171 | )
172 | (assert_invalid
173 | (module (func $type-param-num-vs-num (param f64 i64) (result f64) (f64.neg (local.get 1))))
174 | "type mismatch"
175 | )
176 |
177 |
178 | ;; local.set should have retval
179 |
180 | (assert_invalid
181 | (module (func $type-empty-vs-i32 (local i32) (local.get 0)))
182 | "type mismatch"
183 | )
184 | (assert_invalid
185 | (module (func $type-empty-vs-i64 (local i64) (local.get 0)))
186 | "type mismatch"
187 | )
188 | (assert_invalid
189 | (module (func $type-empty-vs-f32 (local f32) (local.get 0)))
190 | "type mismatch"
191 | )
192 | (assert_invalid
193 | (module (func $type-empty-vs-f64 (local f64) (local.get 0)))
194 | "type mismatch"
195 | )
196 |
197 |
198 | ;; Invalid local index
199 |
200 | (assert_invalid
201 | (module (func $unbound-local (local i32 i64) (local.get 3) drop))
202 | "unknown local"
203 | )
204 | (assert_invalid
205 | (module (func $large-local (local i32 i64) (local.get 14324343) drop))
206 | "unknown local"
207 | )
208 |
209 | (assert_invalid
210 | (module (func $unbound-param (param i32 i64) (local.get 2) drop))
211 | "unknown local"
212 | )
213 | (assert_invalid
214 | (module (func $large-param (param i32 i64) (local.get 714324343) drop))
215 | "unknown local"
216 | )
217 |
218 | (assert_invalid
219 | (module (func $unbound-mixed (param i32) (local i32 i64) (local.get 3) drop))
220 | "unknown local"
221 | )
222 | (assert_invalid
223 | (module (func $large-mixed (param i64) (local i32 i64) (local.get 214324343) drop))
224 | "unknown local"
225 | )
226 |
227 |
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/nop/nop.0.wasm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/hisano/wasm-interpreter-on-java/57721f5c279978e530fcee05e2ce49fff33b9829/src/test/resources/jp/hisano/wasm/interpreter/spec/nop/nop.0.wasm
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/nop/nop.1.wasm:
--------------------------------------------------------------------------------
1 | asm `
2 |
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/nop/nop.2.wasm:
--------------------------------------------------------------------------------
1 | asm ` ~
2 |
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/nop/nop.3.wasm:
--------------------------------------------------------------------------------
1 | asm ` }
2 |
--------------------------------------------------------------------------------
/src/test/resources/jp/hisano/wasm/interpreter/spec/nop/nop.4.wasm:
--------------------------------------------------------------------------------
1 | asm ` |
2 |
--------------------------------------------------------------------------------