mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-25 07:27:52 +01:00
status update
This commit is contained in:
parent
0d0e606983
commit
80e922fa26
14
README.md
14
README.md
@ -8,9 +8,13 @@ JWebAssembly
|
|||||||
JWebAssembly is a Java bytecode to [WebAssembly](http://webassembly.org/) compiler. It uses Java class files as input. That it can compile any language that compile to Java bytecode.
|
JWebAssembly is a Java bytecode to [WebAssembly](http://webassembly.org/) compiler. It uses Java class files as input. That it can compile any language that compile to Java bytecode.
|
||||||
As output it generates the binary format (.wasm file) or the text format (.wat file).
|
As output it generates the binary format (.wasm file) or the text format (.wat file).
|
||||||
|
|
||||||
|
The difference to similar projects is that not a complete VM with GC and memory management should be ported. It's more like a 1: 1 conversion. The generated WebAssembly code is similar in size to the original Java class files.
|
||||||
|
|
||||||
Status of the project
|
Status of the project
|
||||||
----
|
----
|
||||||
|
|
||||||
|
The project is currently not production ready but you can run already some tests.
|
||||||
|
|
||||||
### Finished Components
|
### Finished Components
|
||||||
* Java byte code parser
|
* Java byte code parser
|
||||||
* test framework
|
* test framework
|
||||||
@ -18,7 +22,7 @@ Status of the project
|
|||||||
* [Gradle Plugin](https://github.com/i-net-software/JWebAssembly-Gradle)
|
* [Gradle Plugin](https://github.com/i-net-software/JWebAssembly-Gradle)
|
||||||
|
|
||||||
### Partially Finished
|
### Partially Finished
|
||||||
* Binary format file writer and Text format file writer (171 of 201 byte code instructions)
|
* Binary format file writer and Text format file writer (183 of 201 Java byte code instructions)
|
||||||
* Support for native methods [#2](https://github.com/i-net-software/JWebAssembly/issues/2)
|
* Support for native methods [#2](https://github.com/i-net-software/JWebAssembly/issues/2)
|
||||||
* Exception handling - required the next version of WebAssembly
|
* Exception handling - required the next version of WebAssembly
|
||||||
* Multiple threads - required the next version of WebAssembly
|
* Multiple threads - required the next version of WebAssembly
|
||||||
@ -48,12 +52,12 @@ To use it also some flags and switches are needed.
|
|||||||
|
|
||||||
Required Java Version
|
Required Java Version
|
||||||
----
|
----
|
||||||
JWebAssembly requires Java SE 8 or higher. It is tested with Java SE 8 on [travis-ci.org](https://travis-ci.org/i-net-software/jwebassembly).
|
The JWebAssembly compiler requires Java SE 8 or higher. It is tested with Java SE 8 on [travis-ci.org](https://travis-ci.org/i-net-software/jwebassembly).
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
### Exporting functions
|
### Exporting functions
|
||||||
To export a Java function to make it accessible from JavaScript you need add the annotation de.inetsoftware.jwebassembly.api.annotation.Export.
|
To export a Java function to make it accessible from JavaScript, you must add the annotation de.inetsoftware.jwebassembly.api.annotation.Export.
|
||||||
|
|
||||||
```java
|
```java
|
||||||
import de.inetsoftware.jwebassembly.api.annotation.Export;
|
import de.inetsoftware.jwebassembly.api.annotation.Export;
|
||||||
@ -65,7 +69,7 @@ public static int add( int a, int b ) {
|
|||||||
```
|
```
|
||||||
|
|
||||||
### importing functions
|
### importing functions
|
||||||
To import a JavaScript function to make it accessible from Java you need add the annotation de.inetsoftware.jwebassembly.api.annotation.Import.
|
To import a JavaScript function to make it accessible from Java, you must add the annotation de.inetsoftware.jwebassembly.api.annotation.Import.
|
||||||
The method can be declared native or can have a Java implementation which will be ignored on compiling.
|
The method can be declared native or can have a Java implementation which will be ignored on compiling.
|
||||||
|
|
||||||
```java
|
```java
|
||||||
@ -83,6 +87,8 @@ In version 1 of WebAssembly you can only compile:
|
|||||||
* static methods
|
* static methods
|
||||||
* use the data types int, long float and double
|
* use the data types int, long float and double
|
||||||
|
|
||||||
|
This is state of JWebAssembly 0.1.
|
||||||
|
|
||||||
### Alternatives
|
### Alternatives
|
||||||
* [TeaVM](https://github.com/konsoletyper/teavm)
|
* [TeaVM](https://github.com/konsoletyper/teavm)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user