From d3e3c4ff5dbd6a7890d9ee44243e2bf0bb15427d Mon Sep 17 00:00:00 2001 From: Volker Berlin Date: Sun, 15 Mar 2020 11:09:10 +0100 Subject: [PATCH] API docu --- .../jwebassembly/module/StringManager.java | 6 +++--- .../jwebassembly/module/TypeManager.java | 18 ++++++++++++------ 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/de/inetsoftware/jwebassembly/module/StringManager.java b/src/de/inetsoftware/jwebassembly/module/StringManager.java index b412589..143894b 100644 --- a/src/de/inetsoftware/jwebassembly/module/StringManager.java +++ b/src/de/inetsoftware/jwebassembly/module/StringManager.java @@ -29,7 +29,7 @@ import de.inetsoftware.jwebassembly.api.annotation.WasmTextCode; import de.inetsoftware.jwebassembly.wasm.ValueType; /** - * Handle all the constant strings. The constant strings will be write into the data section. + * Handle all the constant strings. The constant strings will be write into the data section. At runtime the strings will be instantiate on the fly and hold in a table. * * @author Volker Berlin */ @@ -233,7 +233,7 @@ public class StringManager extends LinkedHashMap { /** * WASM code

- * Set a string from the string table. Should be inlined from the optimizer. + * Set a string in the string table. Should be inlined from the optimizer. * * @param strIdx * the id/index of the string. @@ -249,7 +249,7 @@ public class StringManager extends LinkedHashMap { /** * WASM code

* Placeholder for a synthetic function. Should be inlined from the optimizer. - * @return the memory offset of the string data in the element section + * @return the memory offset of the serialized string data in the element section */ private static native int stringsMemoryOffset(); diff --git a/src/de/inetsoftware/jwebassembly/module/TypeManager.java b/src/de/inetsoftware/jwebassembly/module/TypeManager.java index 3e2d083..3d46f5b 100644 --- a/src/de/inetsoftware/jwebassembly/module/TypeManager.java +++ b/src/de/inetsoftware/jwebassembly/module/TypeManager.java @@ -486,19 +486,25 @@ public class TypeManager { public void writeToStream( ByteArrayOutputStream dataStream, ToIntFunction getFunctionsID ) throws IOException { /* ┌───────────────────────────────────────┐ - | Offset to the interfaces (4 bytes) | + | Offset to the interfaces [4 bytes] | ├───────────────────────────────────────┤ - | Offset to the instanceof (4 bytes) | + | Offset to the instanceof [4 bytes] | ├───────────────────────────────────────┤ - | String id of the class name (4 bytes) | + | String id of the class name [4 bytes] | ├───────────────────────────────────────┤ - | first vtable entry (4 bytes) | + | first vtable entry [4 bytes] | ├───────────────────────────────────────┤ - | ..... | + | ..... | ├───────────────────────────────────────┤ | interface calls (itable) | ├───────────────────────────────────────┤ - | list of implemented interface | + | list of instanceof [4*(n+1) bytes] | + ├───────────────────────────────────────┤ + | count of entries [4 bytes] | + ├───────────────────────────────────────┤ + | own class id [4 bytes] | + ├───────────────────────────────────────┤ + | ..... [4*(n-1) bytes] | └───────────────────────────────────────┘ */ this.vtableOffset = dataStream.size();