<?xml version="1.0" encoding="utf-8"?><?xml-stylesheet type="text/xsl" href="atom.xsl"?>
<feed xmlns="http://www.w3.org/2005/Atom">
    <id>https://chicory.dev/blog</id>
    <title>Chicory Blog</title>
    <updated>2026-02-25T00:00:00.000Z</updated>
    <generator>https://github.com/jpmonette/feed</generator>
    <link rel="alternate" href="https://chicory.dev/blog"/>
    <subtitle>Chicory Blog</subtitle>
    <icon>https://chicory.dev/img/favicon.ico</icon>
    <entry>
        <title type="html"><![CDATA[Chicory 1.7.0 – WasmGC, Multi-Memory, and Threads Improvements]]></title>
        <id>https://chicory.dev/blog/chicory-1.7.0</id>
        <link href="https://chicory.dev/blog/chicory-1.7.0"/>
        <updated>2026-02-25T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[Chicory 1.7.0: WasmGC, Multi-Memory, and Threads Improvements]]></summary>
        <content type="html"><![CDATA[<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="chicory-170-wasmgc-multi-memory-and-threads-improvements">Chicory <strong>1.7.0</strong>: WasmGC, Multi-Memory, and Threads Improvements<a href="https://chicory.dev/blog/chicory-1.7.0#chicory-170-wasmgc-multi-memory-and-threads-improvements" class="hash-link" aria-label="Direct link to chicory-170-wasmgc-multi-memory-and-threads-improvements" title="Direct link to chicory-170-wasmgc-multi-memory-and-threads-improvements" translate="no">​</a></h2>
<p><strong>Release date: 2026-02-25</strong></p>
<p>Chicory 1.7.0 is a big step forward! This release brings WasmGC support across the board, Multi-Memory, and community-driven Threads proposal performance improvements. With these additions, Chicory is getting closer and closer to full <a href="https://webassembly.org/news/2025-09-17-wasm-3.0/" target="_blank" rel="noopener noreferrer" class="">Wasm 3.0</a> compliance.</p>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="highlights">Highlights<a href="https://chicory.dev/blog/chicory-1.7.0#highlights" class="hash-link" aria-label="Direct link to Highlights" title="Direct link to Highlights" translate="no">​</a></h3>
<h4 class="anchor anchorTargetStickyNavbar_Vzrq" id="wasmgc-support">WasmGC Support<a href="https://chicory.dev/blog/chicory-1.7.0#wasmgc-support" class="hash-link" aria-label="Direct link to WasmGC Support" title="Direct link to WasmGC Support" translate="no">​</a></h4>
<ul>
<li class="">Full support for the WasmGC proposal in both the interpreter and compiler, passing the entire spec testsuite! This enables garbage-collected struct and array types in WebAssembly modules.</li>
<li class="">Performance improvements are planned for upcoming releases to make this faster.</li>
</ul>
<h4 class="anchor anchorTargetStickyNavbar_Vzrq" id="multi-memory-support">Multi-Memory Support<a href="https://chicory.dev/blog/chicory-1.7.0#multi-memory-support" class="hash-link" aria-label="Direct link to Multi-Memory Support" title="Direct link to Multi-Memory Support" translate="no">​</a></h4>
<ul>
<li class="">Implementation of the Multi-Memory proposal, allowing WebAssembly modules to declare and access multiple memory instances simultaneously.</li>
<li class="">This is a key building block for static linking of WebAssembly modules and brings Chicory closer to full Wasm 3.0 compliance.</li>
</ul>
<h4 class="anchor anchorTargetStickyNavbar_Vzrq" id="threads-proposal-improvements">Threads Proposal Improvements<a href="https://chicory.dev/blog/chicory-1.7.0#threads-proposal-improvements" class="hash-link" aria-label="Direct link to Threads Proposal Improvements" title="Direct link to Threads Proposal Improvements" translate="no">​</a></h4>
<ul>
<li class="">Community-contributed fixes to memory wait and notify operations, bringing performance improvements to concurrent WebAssembly execution.</li>
<li class="">Moved atomic primitives to Memory for a cleaner architecture and better separation of concerns.</li>
<li class="">Fixed test flakiness in atomic fence ordering tests.</li>
</ul>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="other-improvements">Other Improvements<a href="https://chicory.dev/blog/chicory-1.7.0#other-improvements" class="hash-link" aria-label="Direct link to Other Improvements" title="Direct link to Other Improvements" translate="no">​</a></h3>
<ul>
<li class=""><strong>WASI</strong>: New option to avoid throwing on WASI exit code 0, improving compatibility with modules that call <code>proc_exit(0)</code>.</li>
<li class=""><strong>Compiler</strong>: Extended JVM workaround for Java <code>&lt;=</code> 17 to <code>I32_GE_U</code> for improved correctness (see <a href="https://bugs.openjdk.org/browse/JDK-8376400" target="_blank" rel="noopener noreferrer" class="">JDK-8376400</a>).</li>
</ul>
<p>A huge thank you to all contributors for their valuable contributions! Check out the commit history for detailed implementation notes, and as always, we'd love to hear your feedback!</p>
<p>Happy WebAssembly-in-the-JVM coding! 🚀</p>]]></content>
        <author>
            <name>Andrea Peruffo</name>
            <uri>https://github.com/andreaTP</uri>
        </author>
        <category label="Wasm" term="Wasm"/>
        <category label="Chicory" term="Chicory"/>
        <category label="Release" term="Release"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[Syntax highlighting in Java, without the pain]]></title>
        <id>https://chicory.dev/blog/syntax-highlight</id>
        <link href="https://chicory.dev/blog/syntax-highlight"/>
        <updated>2026-02-02T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[A week ago, my friend Max told me he couldn't find a good library for code syntax highlighting in Java.]]></summary>
        <content type="html"><![CDATA[<p>A week ago, my friend Max told me he couldn't find a good library for code syntax highlighting in Java.</p>
<p>That statement alone says a lot.</p>
<p>Syntax highlighting is a solved problem. It’s not novel, it’s not research-grade, and yet in the Java ecosystem it still feels complex, expensive, and tedious to integrate.
You either end up with half-maintained ports, JNI bindings, or large dependencies that are painful to distribute and maintain.</p>
<p>The real question is:
<strong>how do we make things that were previously considered complex, expensive, and fragile easy, robust, and boring?</strong></p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="the-traditional-options-and-their-cost">The traditional options (and their cost)<a href="https://chicory.dev/blog/syntax-highlight#the-traditional-options-and-their-cost" class="hash-link" aria-label="Direct link to The traditional options (and their cost)" title="Direct link to The traditional options (and their cost)" translate="no">​</a></h2>
<p>Sure, with the help of LLMs, it's now much easier than before to port a library from another language to Java.
But that’s only the first step.
Once you port it, you <strong>own it</strong>:</p>
<ul>
<li class="">ongoing maintenance</li>
<li class="">vulnerability fixes</li>
<li class="">bug reports</li>
<li class="">releases</li>
<li class="">code drift with the upstream</li>
</ul>
<p>That maintenance burden never goes away.</p>
<p>Fortunately, in many cases, the library we want already exists and is excellent, just not written in Java.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="wasm-to-the-rescue">Wasm to the rescue<a href="https://chicory.dev/blog/syntax-highlight#wasm-to-the-rescue" class="hash-link" aria-label="Direct link to Wasm to the rescue" title="Direct link to Wasm to the rescue" translate="no">​</a></h2>
<p>WebAssembly changes the equation.</p>
<p>With Wasm, we can reuse libraries written in <strong>C, C++, Go, Rust, or even JavaScript</strong>, without falling into rewriting or the usual JNI traps:</p>
<ul>
<li class="">no platform-specific builds</li>
<li class="">no cross-compilation matrix</li>
<li class="">no native binaries to ship</li>
<li class="">no “works on my machine” surprises</li>
</ul>
<p>Everything runs in a sandboxed, lightweight, and portable runtime.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="two-candidates-highlightjs-and-tree-sitter">Two candidates: highlight.js and tree-sitter<a href="https://chicory.dev/blog/syntax-highlight#two-candidates-highlightjs-and-tree-sitter" class="hash-link" aria-label="Direct link to Two candidates: highlight.js and tree-sitter" title="Direct link to Two candidates: highlight.js and tree-sitter" translate="no">​</a></h2>
<p>When Max asked about highlighting, two obvious candidates came to mind:</p>
<ul>
<li class=""><strong>highlight.js</strong></li>
<li class=""><strong>tree-sitter</strong></li>
</ul>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="highlightjs-via-quickjs">highlight.js via QuickJS<a href="https://chicory.dev/blog/syntax-highlight#highlightjs-via-quickjs" class="hash-link" aria-label="Direct link to highlight.js via QuickJS" title="Direct link to highlight.js via QuickJS" translate="no">​</a></h3>
<p>For <code>highlight.js</code>, the fastest proof of concept was to run it inside a JavaScript engine.</p>
<p>Using <strong>QuickJs4J</strong>
<a href="https://github.com/roastedroot/quickjs4j" target="_blank" rel="noopener noreferrer" class="">https://github.com/roastedroot/quickjs4j</a></p>
<p>I put together a quick experiment:
<a href="https://github.com/andreaTP/highlightjs4j" target="_blank" rel="noopener noreferrer" class="">https://github.com/andreaTP/highlightjs4j</a></p>
<p>QuickJs4J exists to embed the QuickJS engine into the JVM.
As long as a JS library doesn’t depend on browser or Node APIs, QuickJS is a very capable engine and can run surprisingly complex code with ease.</p>
<p>The experiment worked well and validated the approach.</p>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="tree-sitter-and-native-performance">tree-sitter and native performance<a href="https://chicory.dev/blog/syntax-highlight#tree-sitter-and-native-performance" class="hash-link" aria-label="Direct link to tree-sitter and native performance" title="Direct link to tree-sitter and native performance" translate="no">​</a></h3>
<p>Tree-sitter is even more appealing:</p>
<ul>
<li class="">written in C</li>
<li class="">widely used in editors and IDEs</li>
<li class="">extremely fast</li>
<li class="">grammar-based and precise</li>
</ul>
<p>Looking around, there are several projects in this space, among others:</p>
<ul>
<li class=""><a href="https://github.com/bearcove/arborium" target="_blank" rel="noopener noreferrer" class="">arborium</a></li>
<li class=""><a href="https://github.com/RubixDev/syntastica" target="_blank" rel="noopener noreferrer" class="">syntastica</a></li>
<li class=""><a href="https://github.com/leandrocp/lumis" target="_blank" rel="noopener noreferrer" class="">lumis</a></li>
</ul>
<p>In the end, <strong>Lumis</strong> stood out:
<a href="https://github.com/leandrocp/lumis" target="_blank" rel="noopener noreferrer" class="">https://github.com/leandrocp/lumis</a></p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="why-lumis-on-wasm-works-so-well">Why Lumis on Wasm works so well<a href="https://chicory.dev/blog/syntax-highlight#why-lumis-on-wasm-works-so-well" class="hash-link" aria-label="Direct link to Why Lumis on Wasm works so well" title="Direct link to Why Lumis on Wasm works so well" translate="no">​</a></h2>
<p>Lumis is written in Rust, which already has first-class support for compiling to WebAssembly.
Even better, it works out of the box with <strong>WASI</strong>.</p>
<p>That means:</p>
<ul>
<li class="">printing to stdout just works</li>
<li class="">debugging is straightforward</li>
<li class="">no weird shims or hacks</li>
</ul>
<p>This made it a perfect candidate.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="lumis4j-wrapping-once-reusing-forever">Lumis4J: wrapping once, reusing forever<a href="https://chicory.dev/blog/syntax-highlight#lumis4j-wrapping-once-reusing-forever" class="hash-link" aria-label="Direct link to Lumis4J: wrapping once, reusing forever" title="Direct link to Lumis4J: wrapping once, reusing forever" translate="no">​</a></h2>
<p>That’s how <strong>Lumis4J</strong> started:
<a href="https://github.com/roastedroot/lumis4j" target="_blank" rel="noopener noreferrer" class="">https://github.com/roastedroot/lumis4j</a></p>
<p>The idea is simple:</p>
<ul>
<li class="">compile Lumis to Wasm and then to Java Bytecode thanks to Chicory</li>
<li class="">write a small Rust wrapper exposing a clean API</li>
<li class="">map that API to Java</li>
</ul>
<p>The <a href="https://github.com/roastedroot/lumis4j/blob/main/wasm-build/src/lib.rs" target="_blank" rel="noopener noreferrer" class="">Rust side</a> is intentionally minimal.
It exposes just enough surface to drive Lumis without leaking implementation details.
On the Java side, this maps to a small, idiomatic API that feels native to the JVM:</p>
<div class="language-java codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-java codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">try</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token class-name">Lumis</span><span class="token plain"> lumis </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Lumis</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">builder</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">                        </span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">withLang</span><span class="token punctuation" style="color:#393A34">(</span><span class="token class-name">Lang</span><span class="token punctuation" style="color:#393A34">.</span><span class="token constant" style="color:#36acaa">JAVA</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">                        </span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">withTheme</span><span class="token punctuation" style="color:#393A34">(</span><span class="token class-name">Theme</span><span class="token punctuation" style="color:#393A34">.</span><span class="token constant" style="color:#36acaa">CATPPUCCIN_FRAPPE</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">                        </span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">withFormatter</span><span class="token punctuation" style="color:#393A34">(</span><span class="token class-name">Formatter</span><span class="token punctuation" style="color:#393A34">.</span><span class="token constant" style="color:#36acaa">HTML_INLINE</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">                        </span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">build</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    </span><span class="token keyword" style="color:#00009f">var</span><span class="token plain"> htmlResult </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> lumis</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">highlight</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"public class Hello { }"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    </span><span class="token class-name">System</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain">out</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">println</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">htmlResult</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">string</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></div></code></pre></div></div>
<p>Result:</p>
<pre class="athl" style="color:#c6d0f5;background-color:#303446"><code class="language-java" translate="no" tabindex="0"><div class="line" data-line="1"><span style="color:#ca9ee6">public</span> <span style="color:#ca9ee6">class</span> <span style="color:#e5c890">Hello</span> <span style="color:#949cbb">{</span> <span style="color:#949cbb">}</span></div></code></pre>
<p>You can easily run a minimal JBang <a href="https://gist.github.com/andreaTP/6945e9ff3223686b600fda184ae94e2f" target="_blank" rel="noopener noreferrer" class="">demo</a>:</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:#393A34"><span class="token plain">jbang https://gist.github.com/andreaTP/6945e9ff3223686b600fda184ae94e2f</span><br></div></code></pre></div></div>
<p>The core of the integration is tiny. What would have been a massive port a few years ago is now just glue code.</p>
<p>Full reuse, zero reimplementation.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="performance-wizer-to-the-rescue">Performance: Wizer to the rescue<a href="https://chicory.dev/blog/syntax-highlight#performance-wizer-to-the-rescue" class="hash-link" aria-label="Direct link to Performance: Wizer to the rescue" title="Direct link to Performance: Wizer to the rescue" translate="no">​</a></h2>
<p>Out of the box, Lumis works great. One issue remained: loading a language the first time could take seconds.</p>
<p>Enter <strong>Wizer</strong>.
<a href="https://github.com/bytecodealliance/wizer" target="_blank" rel="noopener noreferrer" class="">https://github.com/bytecodealliance/wizer</a></p>
<p>Wizer is a Wasm pre-initializer.
It allows you to pre-load data and state at build time, so the module is already warm at runtime.
By preloading grammars and themes, startup time drops dramatically and, even the first invocation, is finally fast.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="shipping-the-result">Shipping the result<a href="https://chicory.dev/blog/syntax-highlight#shipping-the-result" class="hash-link" aria-label="Direct link to Shipping the result" title="Direct link to Shipping the result" translate="no">​</a></h2>
<p>The final library includes:</p>
<ul>
<li class="">all languages</li>
<li class="">all themes</li>
<li class="">fully battery-included</li>
</ul>
<p>Numbers:</p>
<ul>
<li class="">around 80Mb of Wasm payload</li>
<li class="">compiled to Java bytecode via <strong>Chicory</strong></li>
<li class="">less than 10Mb final jar</li>
</ul>
<p>And the resulting artifact is:</p>
<ul>
<li class="">easy to distribute</li>
<li class="">no native dependencies</li>
<li class="">runs on the JVM and Android</li>
<li class="">fully self-contained</li>
<li class="">minimal Java dependencies, just the Chicory runtime</li>
</ul>
<p>But most importantly, it is <strong>secure</strong>.</p>
<p>The Wasm sandbox uses a heap fully separated from the JVM heap.
Any memory bugs or vulnerabilities at the C or Rust level surface as normal Java exceptions, not undefined behavior, not crashes, not security nightmares.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="the-bigger-picture">The bigger picture<a href="https://chicory.dev/blog/syntax-highlight#the-bigger-picture" class="hash-link" aria-label="Direct link to The bigger picture" title="Direct link to The bigger picture" translate="no">​</a></h2>
<p>WebAssembly is a W3C standard. More and more libraries are quietly adding Wasm support to run in browsers, and that same support can be reused outside the browser, including on the JVM.</p>
<p>We should expect this trend to steadily continue.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="conclusion">Conclusion<a href="https://chicory.dev/blog/syntax-highlight#conclusion" class="hash-link" aria-label="Direct link to Conclusion" title="Direct link to Conclusion" translate="no">​</a></h2>
<p>Being able to reuse complex, high-quality libraries everywhere, while staying within JVM boundaries, feels like a superpower.</p>
<p>Wasm unlocks scenarios that used to be impractical or outright impossible in Java, and it does so with less code, less risk, and less maintenance.</p>
<p>Thanks for reading. I hope it’s clear by now, syntax highlighting was just the excuse ✨</p>]]></content>
        <author>
            <name>Andrea Peruffo</name>
            <uri>https://github.com/andreaTP</uri>
        </author>
        <category label="Wasm" term="Wasm"/>
        <category label="Chicory" term="Chicory"/>
        <category label="highlight" term="highlight"/>
        <category label="treesitter" term="treesitter"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[Chicory 1.6.0 – Java Modules, Performance, and Enhanced Proposals]]></title>
        <id>https://chicory.dev/blog/chicory-1.6.0</id>
        <link href="https://chicory.dev/blog/chicory-1.6.0"/>
        <updated>2025-11-10T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[Chicory 1.6.0: Java Modules, Performance, and Enhanced Proposals]]></summary>
        <content type="html"><![CDATA[<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="chicory-160-java-modules-performance-and-enhanced-proposals">Chicory <strong>1.6.0</strong>: Java Modules, Performance, and Enhanced Proposals<a href="https://chicory.dev/blog/chicory-1.6.0#chicory-160-java-modules-performance-and-enhanced-proposals" class="hash-link" aria-label="Direct link to chicory-160-java-modules-performance-and-enhanced-proposals" title="Direct link to chicory-160-java-modules-performance-and-enhanced-proposals" translate="no">​</a></h2>
<p><strong>Release date: 2025-11-10</strong></p>
<p>Chicory 1.6.0 brings Java Platform Module System (JPMS) support, significant performance improvements with directory-backed caching, enhanced Threads proposal support, and Extended Constant Expressions. This release also adds Java 25 support and improves the developer experience with better APIs.</p>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="highlights">Highlights<a href="https://chicory.dev/blog/chicory-1.6.0#highlights" class="hash-link" aria-label="Direct link to Highlights" title="Direct link to Highlights" translate="no">​</a></h3>
<h4 class="anchor anchorTargetStickyNavbar_Vzrq" id="java-platform-module-system-jpms-support">Java Platform Module System (JPMS) Support<a href="https://chicory.dev/blog/chicory-1.6.0#java-platform-module-system-jpms-support" class="hash-link" aria-label="Direct link to Java Platform Module System (JPMS) Support" title="Direct link to Java Platform Module System (JPMS) Support" translate="no">​</a></h4>
<ul>
<li class="">Full Java module definitions (<code>module-info.java</code>) added across all Chicory modules, enabling proper module boundaries and encapsulation.</li>
<li class="">Chicory is now fully compatible with Java 9+ module system requirements, making it easier to use in modular Java applications.</li>
</ul>
<h4 class="anchor anchorTargetStickyNavbar_Vzrq" id="directory-backed-runtime-compiler-cache">Directory-Backed Runtime Compiler Cache<a href="https://chicory.dev/blog/chicory-1.6.0#directory-backed-runtime-compiler-cache" class="hash-link" aria-label="Direct link to Directory-Backed Runtime Compiler Cache" title="Direct link to Directory-Backed Runtime Compiler Cache" translate="no">​</a></h4>
<ul>
<li class="">New experimental directory-based cache implementation for the runtime compiler, significantly improving startup performance for repeated module executions.</li>
<li class="">Thread-safe and process-safe cache implementation using atomic file operations.</li>
<li class="">Cache entries are stored as JAR files, keyed by module digest, enabling fast subsequent loads without recompilation.</li>
</ul>
<h4 class="anchor anchorTargetStickyNavbar_Vzrq" id="enhanced-threads-proposal-support">Enhanced Threads Proposal Support<a href="https://chicory.dev/blog/chicory-1.6.0#enhanced-threads-proposal-support" class="hash-link" aria-label="Direct link to Enhanced Threads Proposal Support" title="Direct link to Enhanced Threads Proposal Support" translate="no">​</a></h4>
<ul>
<li class="">Atomic fence instruction implementation, completing the Threads proposal support for proper memory ordering in concurrent WebAssembly execution.</li>
<li class="">Full spec-compliant atomic operations for multi-threaded WebAssembly modules.</li>
</ul>
<h4 class="anchor anchorTargetStickyNavbar_Vzrq" id="extended-constant-expressions-proposal">Extended Constant Expressions Proposal<a href="https://chicory.dev/blog/chicory-1.6.0#extended-constant-expressions-proposal" class="hash-link" aria-label="Direct link to Extended Constant Expressions Proposal" title="Direct link to Extended Constant Expressions Proposal" translate="no">​</a></h4>
<ul>
<li class="">Implementation of the Extended Constant Expressions proposal, enabling more complex constant expressions in WebAssembly modules.</li>
<li class="">Supports advanced constant evaluation capabilities in WebAssembly modules.</li>
</ul>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="other-improvements">Other Improvements<a href="https://chicory.dev/blog/chicory-1.6.0#other-improvements" class="hash-link" aria-label="Direct link to Other Improvements" title="Direct link to Other Improvements" translate="no">​</a></h3>
<ul>
<li class=""><strong>CompiledModule Interface</strong>: New interface to make it easier to work with multiple build-time compiled modules, improving the developer experience.</li>
<li class=""><strong>Performance Optimization</strong>: Cache <code>WasmModule</code> in static fields to avoid parsing modules multiple times.</li>
<li class=""><strong>Java 25 Support</strong>: Full compatibility with the latest Java release.</li>
<li class=""><strong>API Improvements</strong>: Sanitized method and field names in annotation processor for better code generation.</li>
<li class=""><strong>Bug Fixes</strong>: Fixed WASI testsuite returning unsupported operation errors.</li>
</ul>
<p>A huge thank you to all contributors for their valuable contributions. Check out the commit history for detailed implementation notes, and as always, let us know how it performs in your workloads!</p>
<p>Happy WebAssembly-in-the-JVM coding! 🚀</p>]]></content>
        <author>
            <name>Andrea Peruffo</name>
            <uri>https://github.com/andreaTP</uri>
        </author>
        <category label="Wasm" term="Wasm"/>
        <category label="Chicory" term="Chicory"/>
        <category label="Release" term="Release"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[Chicory 1.5.0 – EH and Threads, Across the Board]]></title>
        <id>https://chicory.dev/blog/chicory-1.5.0</id>
        <link href="https://chicory.dev/blog/chicory-1.5.0"/>
        <updated>2025-07-04T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[Chicory 1.5.0: Spec-Compliant EH and Threads, Across the Board]]></summary>
        <content type="html"><![CDATA[<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="chicory-150-spec-compliant-eh-and-threads-across-the-board">Chicory <strong>1.5.0</strong>: Spec-Compliant EH and Threads, Across the Board<a href="https://chicory.dev/blog/chicory-1.5.0#chicory-150-spec-compliant-eh-and-threads-across-the-board" class="hash-link" aria-label="Direct link to chicory-150-spec-compliant-eh-and-threads-across-the-board" title="Direct link to chicory-150-spec-compliant-eh-and-threads-across-the-board" translate="no">​</a></h2>
<p><strong>Release date: 2025-07-04</strong></p>
<p>Chicory 1.5.0 introduces full support for both the WebAssembly Exception Handling and Threads proposals, implemented across both the compiler and interpreter. This release ensures spec-compliant control flow and concurrent execution for your WebAssembly modules on the JVM.</p>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="highlights">Highlights<a href="https://chicory.dev/blog/chicory-1.5.0#highlights" class="hash-link" aria-label="Direct link to Highlights" title="Direct link to Highlights" translate="no">​</a></h3>
<h4 class="anchor anchorTargetStickyNavbar_Vzrq" id="webassembly-exception-handling-support">WebAssembly Exception Handling Support<a href="https://chicory.dev/blog/chicory-1.5.0#webassembly-exception-handling-support" class="hash-link" aria-label="Direct link to WebAssembly Exception Handling Support" title="Direct link to WebAssembly Exception Handling Support" translate="no">​</a></h4>
<ul>
<li class="">Implemented the official WebAssembly Exception Handling proposal in the compiler, complementing existing interpreter support.</li>
<li class="">End-to-end exception handling support: compiler and interpreter fully round-trip exception constructs across boundaries.</li>
</ul>
<h4 class="anchor anchorTargetStickyNavbar_Vzrq" id="webassembly-threads-proposal-implementation">WebAssembly Threads Proposal Implementation<a href="https://chicory.dev/blog/chicory-1.5.0#webassembly-threads-proposal-implementation" class="hash-link" aria-label="Direct link to WebAssembly Threads Proposal Implementation" title="Direct link to WebAssembly Threads Proposal Implementation" translate="no">​</a></h4>
<ul>
<li class="">Added support for the Threads proposal in both compiler and interpreter.</li>
</ul>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="other-improvements">Other Improvements<a href="https://chicory.dev/blog/chicory-1.5.0#other-improvements" class="hash-link" aria-label="Direct link to Other Improvements" title="Direct link to Other Improvements" translate="no">​</a></h3>
<ul>
<li class="">Increased CI coverage running nightly the Zig standard library testsuite</li>
</ul>
<p>A huge thank you, as usual, to all contributors for bringing full WebAssembly Exception Handling and Threads support to Chicory across both compiler and interpreter. Check out the commit history for detailed implementation notes, and as always, let us know how it performs in your workloads!</p>
<p>Happy WebAssembly-in-the-JVM coding! 🚀</p>]]></content>
        <author>
            <name>Andrea Peruffo</name>
            <uri>https://github.com/andreaTP</uri>
        </author>
        <category label="Wasm" term="Wasm"/>
        <category label="Chicory" term="Chicory"/>
        <category label="Release" term="Release"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[Chicory 1.4.0 – Compiler Graduates, Annotations Stabilize, and WasmGC Advances]]></title>
        <id>https://chicory.dev/blog/chicory-1.4.0</id>
        <link href="https://chicory.dev/blog/chicory-1.4.0"/>
        <updated>2025-05-30T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[We’re excited to announce Chicory 1.4.0, a release that marks a significant milestone in our journey.]]></summary>
        <content type="html"><![CDATA[<p>We’re excited to announce <strong>Chicory 1.4.0</strong>, a release that marks a significant milestone in our journey.
This version brings the <strong>Compiler</strong>(Runtime and Build time) and <strong>Annotations</strong> out of the experimental phase, and introduces foundational support for <strong>WebAssembly Garbage Collection (WasmGC)</strong> with reference types.</p>
<hr>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="-compiler-graduates-from-experimental">🎓 Compiler Graduates from Experimental<a href="https://chicory.dev/blog/chicory-1.4.0#-compiler-graduates-from-experimental" class="hash-link" aria-label="Direct link to 🎓 Compiler Graduates from Experimental" title="Direct link to 🎓 Compiler Graduates from Experimental" translate="no">​</a></h2>
<p>After extensive development and testing, the Compiler is now officially stable. It enables the compilation of WebAssembly modules into plain Java bytecode at build time or runtime, offering improved performance and seamless integration into Java applications.</p>
<p><strong>Key Benefits:</strong></p>
<ul>
<li class=""><strong>Performance</strong>: Faster execution by eliminating interpretation overhead.</li>
<li class=""><strong>Integration</strong>: Generates standard Java bytecode, facilitating integration with existing Java tools and libraries.</li>
<li class=""><strong>Stability</strong>: Extensively tested to ensure reliability across various use cases(with real-world modules like CPython, SQLite, etc.).</li>
</ul>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="️-annotations-are-now-stable">🏷️ Annotations are Now Stable<a href="https://chicory.dev/blog/chicory-1.4.0#%EF%B8%8F-annotations-are-now-stable" class="hash-link" aria-label="Direct link to 🏷️ Annotations are Now Stable" title="Direct link to 🏷️ Annotations are Now Stable" translate="no">​</a></h2>
<p>The annotation system has matured and is now considered stable too. It provides high level APIs to for exports and host function's declaration and usage, enhancing developer productivity and code clarity.</p>
<p><strong>Highlights:</strong></p>
<ul>
<li class=""><strong>Ease of Use</strong>: Simplifies configuration through familiar Java annotations.</li>
<li class=""><strong>Flexibility</strong>: Allows fine-grained control over module behavior and integration.</li>
</ul>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="-progress-towards-wasmgc-with-reference-types">🧪 Progress Towards WasmGC with Reference Types<a href="https://chicory.dev/blog/chicory-1.4.0#-progress-towards-wasmgc-with-reference-types" class="hash-link" aria-label="Direct link to 🧪 Progress Towards WasmGC with Reference Types" title="Direct link to 🧪 Progress Towards WasmGC with Reference Types" translate="no">​</a></h2>
<p>Chicory 1.4.0 lays the groundwork for supporting WebAssembly's Garbage Collection(WasmGC) proposal, including reference types. This advancement moves us closer to full compliance with emerging WebAssembly proposals, enabling more modules to run efficiently.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="-acknowledgments">🙌 Acknowledgments<a href="https://chicory.dev/blog/chicory-1.4.0#-acknowledgments" class="hash-link" aria-label="Direct link to 🙌 Acknowledgments" title="Direct link to 🙌 Acknowledgments" translate="no">​</a></h2>
<p>We extend our heartfelt thanks to the community contributors whose efforts have been instrumental in this release. Your feedback, code contributions, and support continue to drive Chicory forward.</p>
<p>For a detailed list of changes and contributions, please refer to the <a href="https://github.com/dylibso/chicory/commits/main/" target="_blank" rel="noopener noreferrer" class="">commit history</a>.</p>
<hr>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="️-migration-guide">⚠️ Migration Guide<a href="https://chicory.dev/blog/chicory-1.4.0#%EF%B8%8F-migration-guide" class="hash-link" aria-label="Direct link to ⚠️ Migration Guide" title="Direct link to ⚠️ Migration Guide" translate="no">​</a></h2>
<p>As we transition out of an experimental phase, the old experimental modules are not going to be supported anymore.
In this guide you can find the notes on how to move to the stable release of the functionalities. If there is any missing detail, please, don't be afraid to <a href="https://github.com/dylibso/chicory/issues/new" target="_blank" rel="noopener noreferrer" class="">open an issue</a> asking for clarifications.</p>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="artifactid-renames">ArtifactId renames<a href="https://chicory.dev/blog/chicory-1.4.0#artifactid-renames" class="hash-link" aria-label="Direct link to ArtifactId renames" title="Direct link to ArtifactId renames" translate="no">​</a></h3>
<p>The ArtifactId of the modules have changed in this way:</p>
<table><thead><tr><th>Old</th><th>New</th></tr></thead><tbody><tr><td><code>aot-experimental</code></td><td><code>compiler</code></td></tr><tr><td><code>aot-maven-plugin-experimental</code></td><td><code>chicory-compiler-maven-plugin</code></td></tr><tr><td><code>aot-build-time-experimental</code></td><td><code>build-time-compiler</code></td></tr><tr><td><code>aot-build-time-cli-experimental</code></td><td><code>build-time-compiler-cli-experimental</code></td></tr><tr><td><code>host-module-annotations-experimental</code></td><td><code>annotations</code></td></tr><tr><td><code>host-module-processor-experimental</code></td><td><code>annotations-processor</code></td></tr></tbody></table>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="package-names">Package names<a href="https://chicory.dev/blog/chicory-1.4.0#package-names" class="hash-link" aria-label="Direct link to Package names" title="Direct link to Package names" translate="no">​</a></h3>
<p>The name of the Java packages changed</p>
<table><thead><tr><th>Old</th><th>New</th></tr></thead><tbody><tr><td><code>com.dylibso.chicory.experimental.aot</code></td><td><code>com.dylibso.chicory.compiler</code></td></tr><tr><td><code>com.dylibso.chicory.experimental.build.time.aot</code></td><td><code>com.dylibso.chicory.build.time.compiler</code></td></tr><tr><td><code>com.dylibso.chicory.experimental.hostmodule.annotations</code></td><td><code>com.dylibso.chicory.annotations</code></td></tr></tbody></table>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="maven-plugin">Maven plugin<a href="https://chicory.dev/blog/chicory-1.4.0#maven-plugin" class="hash-link" aria-label="Direct link to Maven plugin" title="Direct link to Maven plugin" translate="no">​</a></h3>
<p>Two main changes specific to the Maven plugin:</p>
<ul>
<li class="">The name of the goal of the compiler changed from <code>wasm-aot-gen</code> to <code>compile</code></li>
<li class="">The <code>name</code> configuration corresponds to the name of the generated class, i.e. the "Module" suffix is not added anymore automatically</li>
</ul>]]></content>
        <author>
            <name>Andrea Peruffo</name>
            <uri>https://github.com/andreaTP</uri>
        </author>
        <category label="Wasm" term="Wasm"/>
        <category label="Chicory" term="Chicory"/>
        <category label="Release" term="Release"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[Closing the Gap – Chicory 1.3.0 is Here!]]></title>
        <id>https://chicory.dev/blog/chicory-1.3.0</id>
        <link href="https://chicory.dev/blog/chicory-1.3.0"/>
        <updated>2025-04-24T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[🚀 AOT Just Got Serious]]></summary>
        <content type="html"><![CDATA[<p>🚀 <strong>AOT Just Got Serious</strong></p>
<p>With incredible contributions from <strong>Hiram Chirino</strong>, Chicory's ahead-of-time (AOT) compiler continues to mature, bringing us one step closer to leaving the experimental phase behind.</p>
<p><strong>Highlights include:</strong></p>
<ul>
<li class="">🧠 <strong>No More Param Limits</strong>: The previous cap of 255 function parameters? Gone.</li>
<li class="">🏗️ <strong>Bye-Bye <code>ClassTooLargeError</code></strong>: We've refactored code generation for large WASM modules to avoid hitting JVM class size limits.</li>
</ul>
<hr>
<p>🛠️ <strong>Bug Fixes &amp; Improvements</strong></p>
<p>This release includes the usual refinements and one particularly notable fix:</p>
<ul>
<li class="">💡 <strong>Random, Now Smarter</strong>: To resolve issues with <code>native-image</code> compilation, we've changed the default random source in <code>WasiOptions</code> from <code>SecureRandom</code> to <code>ThreadLocalRandom</code>. This makes it more compatible with GraalVM.</li>
</ul>
<p>If your application relies on the previous behavior, you can restore it with:</p>
<div class="language-java codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-java codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:#393A34"><span class="token class-name">WasiOptions</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">builder</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">withRandom</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">SecureRandom</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">build</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></div></code></pre></div></div>
<p>For a full list of changes and commits, check out the <a href="https://github.com/dylibso/chicory/commits/main/" target="_blank" rel="noopener noreferrer" class="">commit history</a>.</p>]]></content>
        <author>
            <name>Andrea Peruffo</name>
            <uri>https://github.com/andreaTP</uri>
        </author>
        <category label="Wasm" term="Wasm"/>
        <category label="Chicory" term="Chicory"/>
        <category label="Release" term="Release"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[Announcing an `Exception`al Chicory 1.2.0]]></title>
        <id>https://chicory.dev/blog/chicory-1.2.0</id>
        <link href="https://chicory.dev/blog/chicory-1.2.0"/>
        <updated>2025-03-21T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[Chicory 1.2.0 is here! Along with the usual bug fixes and dependency updates, this release brings key improvements. Here’s what’s new:]]></summary>
        <content type="html"><![CDATA[<p>Chicory <strong>1.2.0</strong> is here! Along with the usual bug fixes and dependency updates, this release brings key improvements. Here’s what’s new:</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="-exception-handling">🚀 Exception Handling<a href="https://chicory.dev/blog/chicory-1.2.0#-exception-handling" class="hash-link" aria-label="Direct link to 🚀 Exception Handling" title="Direct link to 🚀 Exception Handling" translate="no">​</a></h2>
<p>The <a href="https://github.com/WebAssembly/exception-handling" target="_blank" rel="noopener noreferrer" class="">Exception Handling proposal</a>, now at Phase 4, has been implemented in the interpreter.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="-wasmmoduleinterface">🔧 WasmModuleInterface<a href="https://chicory.dev/blog/chicory-1.2.0#-wasmmoduleinterface" class="hash-link" aria-label="Direct link to 🔧 WasmModuleInterface" title="Direct link to 🔧 WasmModuleInterface" translate="no">​</a></h2>
<p>This is a <strong>breaking change</strong> in the experimental module: <code>host-module-processor-experimental</code>.<br>
<!-- -->Exports now generate a <strong>class</strong> instead of an <strong>interface</strong>, enabling caching for faster lookups and invocations.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="-tail-call-support">🔁 Tail Call Support<a href="https://chicory.dev/blog/chicory-1.2.0#-tail-call-support" class="hash-link" aria-label="Direct link to 🔁 Tail Call Support" title="Direct link to 🔁 Tail Call Support" translate="no">​</a></h2>
<p>Tail call opcodes are now recognized in the compiler, improving optimization potential.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="-join-the-chicory-community">📢 Join the Chicory Community<a href="https://chicory.dev/blog/chicory-1.2.0#-join-the-chicory-community" class="hash-link" aria-label="Direct link to 📢 Join the Chicory Community" title="Direct link to 📢 Join the Chicory Community" translate="no">​</a></h2>
<p>A huge thank you to all our <a href="https://github.com/dylibso/chicory/graphs/contributors" target="_blank" rel="noopener noreferrer" class="">contributors</a> for their exceptional work on this release!</p>
<p>Try out <strong>Chicory 1.2.0</strong> today and let us know what you think! 🚀</p>]]></content>
        <author>
            <name>Andrea Peruffo</name>
            <uri>https://github.com/andreaTP</uri>
        </author>
        <category label="Wasm" term="Wasm"/>
        <category label="Chicory" term="Chicory"/>
        <category label="Release" term="Release"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[Announcing Chicory 1.1.0: Faster and More Compliant]]></title>
        <id>https://chicory.dev/blog/chicory-1.1.0</id>
        <link href="https://chicory.dev/blog/chicory-1.1.0"/>
        <updated>2025-02-20T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[We’re excited to announce the release of Chicory 1.1.0! This update brings significant performance improvements, enhanced compliance, and greater flexibility—all while maintaining full backward compatibility.]]></summary>
        <content type="html"><![CDATA[<p>We’re excited to announce the release of <strong>Chicory 1.1.0</strong>! This update brings significant performance improvements, enhanced compliance, and greater flexibility—all while maintaining full backward compatibility.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="simd-support">SIMD Support<a href="https://chicory.dev/blog/chicory-1.1.0#simd-support" class="hash-link" aria-label="Direct link to SIMD Support" title="Direct link to SIMD Support" translate="no">​</a></h2>
<p>After extensive development and testing, Chicory now fully supports <strong>SIMD instructions</strong> in the interpreter. This implementation leverages the experimental <strong>Vector API</strong> available in Java 21+, unlocking substantial performance gains for workloads that can take advantage of parallel processing.</p>
<p>Find out how to enable SIMD in your project by visiting the <a class="" href="https://chicory.dev/docs/usage/simd">documentation</a>.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="optimized-memory-management">Optimized Memory Management<a href="https://chicory.dev/blog/chicory-1.1.0#optimized-memory-management" class="hash-link" aria-label="Direct link to Optimized Memory Management" title="Direct link to Optimized Memory Management" translate="no">​</a></h2>
<p>Memory management is now highly customizable, allowing fine-tuned control based on your application’s needs. Additionally, we’ve a new optimized <code>Memory</code> implementation to deliver <strong>the best possible performance</strong>, informed by real-world benchmarks and user feedback.</p>
<p>Learn how to configure memory settings in the <a class="" href="https://chicory.dev/docs/advanced/memory">documentation</a>.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="improved-android-support">Improved Android Support<a href="https://chicory.dev/blog/chicory-1.1.0#improved-android-support" class="hash-link" aria-label="Direct link to Improved Android Support" title="Direct link to Improved Android Support" translate="no">​</a></h2>
<p>We've enhanced our Android compatibility by introducing automated checks in CI and reducing the minimum supported API level to 28.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="join-the-chicory-community">Join the Chicory Community<a href="https://chicory.dev/blog/chicory-1.1.0#join-the-chicory-community" class="hash-link" aria-label="Direct link to Join the Chicory Community" title="Direct link to Join the Chicory Community" translate="no">​</a></h2>
<p>Chicory continues to evolve, and we encourage you to upgrade to <strong>1.1.0</strong> to take advantage of these improvements. A huge thank you to all our <a href="https://github.com/dylibso/chicory/graphs/contributors" target="_blank" rel="noopener noreferrer" class="">contributors</a> for making this project even better!</p>
<p>With this release, we’re introducing a <strong>“Who Uses Chicory?”</strong> section in the main <a href="https://github.com/dylibso/chicory/README.md" target="_blank" rel="noopener noreferrer" class="">README</a>. If you’re using Chicory in your projects, we’d love to hear about it!</p>
<p>Try out <strong>Chicory 1.1.0</strong> today, and let us know what you think!</p>]]></content>
        <author>
            <name>Andrea Peruffo</name>
            <uri>https://github.com/andreaTP</uri>
        </author>
        <category label="Wasm" term="Wasm"/>
        <category label="Chicory" term="Chicory"/>
        <category label="Release" term="Release"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[The Chicory Photo Album: Celebrating 1.0.0 and a Year of Wasm]]></title>
        <id>https://chicory.dev/blog/chicory-1.0.0</id>
        <link href="https://chicory.dev/blog/chicory-1.0.0"/>
        <updated>2024-12-25T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[Intro]]></summary>
        <content type="html"><![CDATA[<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="intro">Intro<a href="https://chicory.dev/blog/chicory-1.0.0#intro" class="hash-link" aria-label="Direct link to Intro" title="Direct link to Intro" translate="no">​</a></h2>
<p align="left"><picture><img width="100" src="https://chicory.dev/img/blog-2024-12-25/intro.png"></picture></p>
<p>Christmas is a time of tradition, and I’m delighted to continue the one we started last year. On this very same date and blog, we unveiled the development of Chicory: Chicory: WebAssembly on the JVM.</p>
<p>WebAssembly continues to grow steadily and strongly, much like we’ve come to expect from web technologies ([link to this year Edoardo’s blog]). While it’s not perfect yet, the ecosystem is expanding. For instance, CPython 3.13 is now officially released for WASI, and SQLite has added official support for WebAssembly builds using Emscripten.</p>
<p>This year, I’m thrilled to share an exciting announcement: Chicory, the pure Java WebAssembly runtime, has reached its first stable release: 1.0.0!</p>
<p>Last year, we unpacked a toolbox. This year, we’re unwrapping a heartfelt photo album, showcasing the magical journey that brought us to this incredible milestone.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="the-cover">The Cover<a href="https://chicory.dev/blog/chicory-1.0.0#the-cover" class="hash-link" aria-label="Direct link to The Cover" title="Direct link to The Cover" translate="no">​</a></h2>
<p align="left"><picture><img width="100" src="https://chicory.dev/img/blog-2024-12-25/cover.png"></picture></p>
<p>Let’s start with the cover!</p>
<p>Chicory now has a brand-new official website: <a href="https://chicory.dev/" target="_blank" rel="noopener noreferrer" class="">chicory.dev</a>.
We’re continuously improving and updating it.
A curious detail for the most attentive visitors: the documentation is tested continuously in CI using a clever combination of J<a href="https://jestjs.io/" target="_blank" rel="noopener noreferrer" class="">Jest</a> + <a href="https://approvaltests.com/" target="_blank" rel="noopener noreferrer" class="">Approval Tests</a> powered by <a href="https://www.jbang.dev/" target="_blank" rel="noopener noreferrer" class="">JBang</a>. This ensures that every code snippet displayed in the docs can be successfully compiled by users.</p>
<p>At the forefront of this release is the prominent <strong>1.0.0</strong>, marking Chicory’s first stable release.
But what does that really mean? Over the past 12 months, we’ve been rapidly developing the engine, and early adopters likely noticed significant changes to the public API. There were several reasons for this:</p>
<ul>
<li class="">we learned a lot about WebAssembly along the way.</li>
<li class="">we improved the API, making it more intuitive for those familiar with other runtimes.</li>
<li class="">we introduced additional modules, ensuring they integrate seamlessly.</li>
<li class="">we focused on performance, eliminating bottlenecks from the public API.</li>
</ul>
<h4 class="anchor anchorTargetStickyNavbar_Vzrq" id="what-to-expect">What to expect?<a href="https://chicory.dev/blog/chicory-1.0.0#what-to-expect" class="hash-link" aria-label="Direct link to What to expect?" title="Direct link to What to expect?" translate="no">​</a></h4>
<p>With <code>1.0.0</code>, we’re committing to maintaining compatibility with this API. It’s time to dive in confidently, knowing that the code you write won’t become outdated early.</p>
<p>Beyond the public API, we’re proud to say Chicory is now stable and useful to start providing active support for it.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="the-family-picture">The Family Picture<a href="https://chicory.dev/blog/chicory-1.0.0#the-family-picture" class="hash-link" aria-label="Direct link to The Family Picture" title="Direct link to The Family Picture" translate="no">​</a></h2>
<p align="left"><picture><img width="100" src="https://chicory.dev/img/blog-2024-12-25/family.png"></picture></p>
<p>When you open the cover, the first thing you see is a traditional, unmissable family photo.</p>
<p>Here are the key members of our Chicory family:</p>
<ul>
<li class="">
<p>The basic building block: <code>wasm</code>
This is the core module, responsible for handling the nitty-gritty details of the WebAssembly specification. It provides idiomatic Java APIs for working with arbitrary binary Wasm modules.</p>
</li>
<li class="">
<p>The main character: <code>runtime</code>
At its core, this is the interpreter we introduced last year. Now, it supports the full V1 WASM specification(except simd) along with some additional <a href="https://github.com/WebAssembly/proposals" target="_blank" rel="noopener noreferrer" class="">"proposals"</a>. While it’s slow compared to other options, it’s extremely reliable and portable. We take pride in its readability, making it a pleasure to hack on!</p>
</li>
<li class="">
<p>The system interface layer: <code>wasi</code>
This module provides an implementation of Wasi Preview 1, still a widely supported compilation target for languages like Go, Rust, and C++. In our experience, it enables Chicory to run various real-world Wasm modules effectively. While there are limitations, you’re encouraged to roll your own implementation when the provided one doesn’t suffice.</p>
</li>
<li class="">
<p>The mandatory: <code>log</code>
This module allows(when necessary) decoupling from the Java Platform Logging (JEP 264), which isn’t available on Android devices.</p>
</li>
<li class="">
<p>The cool kid: <a href="https://github.com/WebAssembly/wabt" target="_blank" rel="noopener noreferrer" class=""><code>wabt</code></a>
External tools like <code>wat2wasm</code>(for converting WebAssembly Text format <code>.wat</code> files to binary) and <code>wast2json</code>(for parsing <code>.wast</code> files and emitting <code>.wasm</code> files and <code>.json</code> assertion description) are essential for building Chicory. These incredibly valuable tools officially ship as Wasm modules. We bundle a pure Java executable version (through Chicory, of course) to make them easily consumable as Jar artifacts.</p>
</li>
<li class="">
<p>Finally, the: <a href="https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#bill-of-materials-bom-poms" target="_blank" rel="noopener noreferrer" class=""><code>bom</code></a>
This module keeps all the others aligned and smiling for the camera.</p>
</li>
</ul>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="the-newborns">The Newborns<a href="https://chicory.dev/blog/chicory-1.0.0#the-newborns" class="hash-link" aria-label="Direct link to The Newborns" title="Direct link to The Newborns" translate="no">​</a></h2>
<p align="left"><picture><img width="100" src="https://chicory.dev/img/blog-2024-12-25/newborns.png"></picture></p>
<p>Turning the first page reveals a collection of little creatures, freshly born and still in need of nurturing before they fully join the family. These modules are released with the <code>-experimental</code> suffix and placed in the relevant <code>experimental</code> namespace to indicate they’re not yet fully mature.</p>
<p>We encourage you to try them out and explore their potential, but keep in mind that they may not yet offer full stability as they grow towards maturity.</p>
<ul>
<li class="">
<p>The one eager to start walking: <code>aot-experimental</code>
AoT stands for “Ahead Of Time.” This module translates Wasm to Java Bytecode (at the right distance, they look surprisingly similar!), generating pure Java artifacts from Wasm modules. Compiling and running modules dynamically requires some reflection, and this module depends on <a href="https://asm.ow2.io/" target="_blank" rel="noopener noreferrer" class="">ASM</a>. While it’s incredibly fast, there are still some rough edges to refine.</p>
</li>
<li class="">
<p>The lightweight companion to the first one: <code>aot-maven-plugin-experimental</code>
This lightweight Maven plugin makes it easy to use the AoT translator at compile time. The resulting artifacts are persisted to disk, eliminating the need for external dependencies or runtime reflection. However, this approach sacrifices dynamic module loading.</p>
</li>
<li class="">
<p>The quiet one that flies under the radar: <code>cli-experimental</code>
This CLI allows you to quickly evaluate Chicory directly in the comfort of your terminal.</p>
</li>
<li class="">
<p>The twins: <code>host-module-annotations-experimental</code> &amp; <code>host-module-processor-experimental</code>
These consist of annotations and the corresponding annotation processor, making it easier to integrate Chicory through a higher-level, fully Java-idiomatic, generated API.</p>
</li>
</ul>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="the-travel-memories">The Travel Memories<a href="https://chicory.dev/blog/chicory-1.0.0#the-travel-memories" class="hash-link" aria-label="Direct link to The Travel Memories" title="Direct link to The Travel Memories" translate="no">​</a></h2>
<p align="left"><picture><img width="100" src="https://chicory.dev/img/blog-2024-12-25/travels.png"></picture></p>
<p>Turning another page takes us through a colorful spread of memories, showcasing the countless places where Wasm has made its mark across the software world. These moments are as diverse as they are inspiring, reminding us that WebAssembly is truly everywhere! Here’s a glimpse, in no particular order:</p>
<ul>
<li class="">
<p>Through a refracted spectrum:
With our great friends at JRuby, we got <a href="https://blog.jruby.org/2024/02/jruby-prism-parser" target="_blank" rel="noopener noreferrer" class="">Prism</a> running as a pure Java artifact, enabling the bootstrapping of JRuby without any native dependencies.</p>
</li>
<li class="">
<p>From the deserts:
A <a href="https://camel.apache.org/components/4.8.x/wasm-component.html" target="_blank" rel="noopener noreferrer" class="">Wasm Camel</a> found its way into a low-level integration.</p>
</li>
<li class="">
<p>Large highways:
<a href="https://lburgazzoli.github.io/posts/2024-02-01_apache_kafka_connect_meets_wasm_part_1/" target="_blank" rel="noopener noreferrer" class="">Kafka Connect</a> and <a href="https://lburgazzoli.github.io/posts/2023-06-13-apache-camel-pulsar-function-pt_1/" target="_blank" rel="noopener noreferrer" class="">Apache Pulsar</a> opened up the road to polyglot data transformations built on message queues.</p>
</li>
<li class="">
<p>A river capturing every ripple:
<a href="https://github.com/debezium/debezium-examples/tree/main/engine-wasm" target="_blank" rel="noopener noreferrer" class="">Debezium</a> uses Wasm plugins to track <em>C</em>hange <em>D</em>ata <em>C</em>apture events as they flow through your data streams.</p>
</li>
<li class="">
<p>The wrought iron gate:
<a href="https://github.com/pedroigor/keycloak-wasm-policy-provider" target="_blank" rel="noopener noreferrer" class="">Keycloak</a> stands tall, demonstrating pluggable Policy Providers in languages beyond Java.</p>
</li>
<li class="">
<p>From the shallow waters of a river:
A (Kafka Proxy)<a href="https://github.com/andreaTP/kroxylicious-wasm" target="_blank" rel="noopener noreferrer" class="">Kroxy</a> opens its jaws, providing unprecedented extensibility.</p>
</li>
<li class="">
<p>A friendly agent:
<a href="https://github.com/StyraInc/opa-java-wasm" target="_blank" rel="noopener noreferrer" class="">OPA(<strong>O</strong>pen <strong>P</strong>olicy <strong>A</strong>gent) policy</a> issues policy fees on our virtual dashboard. Thankfully, we avoided the speed trap by removing the network!</p>
</li>
<li class="">
<p>Comfortably eating data on the Java train:
<a href="https://www.infoq.com/articles/sqlite-java-integration-webassembly/" target="_blank" rel="noopener noreferrer" class="">SQLite</a> offers a tasty and safer option for data consumption.</p>
</li>
<li class="">
<p>In the middle of a gray sky of clouds:
A <a href="https://github.com/slyons/spark-wasm-udf" target="_blank" rel="noopener noreferrer" class="">Spark</a> lights up Big Data processing in new ecosystems.</p>
</li>
<li class="">
<p>Timeless snapshots:
Rusty gems like <a href="https://github.com/robertknight/ocrs" target="_blank" rel="noopener noreferrer" class="">Ocrs</a>, <a href="https://github.com/silvia-odwyer/photon" target="_blank" rel="noopener noreferrer" class="">Photon</a>, and others are the must-have selfies of this journey.</p>
</li>
</ul>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="the-parties">The Parties<a href="https://chicory.dev/blog/chicory-1.0.0#the-parties" class="hash-link" aria-label="Direct link to The Parties" title="Direct link to The Parties" translate="no">​</a></h2>
<p align="left"><picture><img width="100" src="https://chicory.dev/img/blog-2024-12-25/parties.png"></picture></p>
<p>Exploring the software world is always a thrill, but the most valuable part of the journey is meeting, chatting, and spending time with others who share your passions.</p>
<p>We’ve been fortunate to be accepted at various events, proudly taking the stage to showcase our juggling skills with compilers, runtimes, and integrations.</p>
<p>If you’d like to experience our journey firsthand, here are a few highlights you can watch:</p>
<ul>
<li class="">
<p><strong>Wasm I/O 2024</strong>:
The ultimate destination for anyone building with WebAssembly. A small but top-notch gathering of experts pushing the boundaries of this technology. Check out our talk: <a href="https://www.youtube.com/watch?v=00LYdZS0YlI" target="_blank" rel="noopener noreferrer" class="">Chicory: Creating a Language-Native Wasm Runtime by Benjamin Eckel / Andrea Peruffo</a>.</p>
</li>
<li class="">
<p><strong>Dylibso Insiders</strong>:
A comprehensive and approachable retelling of Chicory’s journey. Dive into the full story with: <a href="https://youtu.be/acF_cJ70n04?si=jpMAfAmjl5UaEWWa" target="_blank" rel="noopener noreferrer" class="">Chicory, a JVM Native WebAssembly Runtime by Benjamin Eckel</a>.</p>
</li>
<li class="">
<p><strong>Devoxx BE 2024</strong>:
The largest Java conference in Europe and a pivotal moment for Chicory. We connected with new and old friends, paving the way for the future. Watch our talk: <a href="https://www.youtube.com/watch?v=7a1yrDSh9rA" target="_blank" rel="noopener noreferrer" class="">Meet Chicory, exploit the power of WebAssembly on the server side! by Andrea Peruffo</a>.</p>
</li>
</ul>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="the-race-day">The Race Day<a href="https://chicory.dev/blog/chicory-1.0.0#the-race-day" class="hash-link" aria-label="Direct link to The Race Day" title="Direct link to The Race Day" translate="no">​</a></h2>
<p align="left"><picture><img width="100" src="https://chicory.dev/img/blog-2024-12-25/race.png"></picture></p>
<p>This year, GraalWASM by Oracle was announced as "production ready", and we’ve had the pleasure of chatting with the incredible team behind the project.</p>
<p>Picture an adrenaline-filled drag race: vehicles lined up at the starting line, tires burning, and engines roaring. Naturally, you’re curious about how they perform when the rubber meets the road.</p>
<p>These benchmarks are preliminary, and more work is needed before drawing any definitive conclusions. However, we’d like to share the results of running <a href="https://github.com/shaunsmith/wasm-bench" target="_blank" rel="noopener noreferrer" class="">this suite</a> on a dedicated machine, encouraging you to take a closer look and explore further.</p>
<p align="left"><picture><img width="300" src="https://chicory.dev/img/blog-2024-12-25/bench-hello.png"></picture><picture><img width="300" src="https://chicory.dev/img/blog-2024-12-25/photon.png"></picture></p>
<p>Removing the outliers of the interpreters, a close up look at the Photon benchmark:</p>
<p align="left"><picture><img width="300" src="https://chicory.dev/img/blog-2024-12-25/photon-zoom.png"></picture></p>
<p>The results highlight the distinct design choices of each project:</p>
<ul>
<li class="">
<p><strong>Chicory’s pure interpreter</strong>
Its focus on simplicity and portability comes with a trade-off: slower performance.</p>
</li>
<li class="">
<p><strong>GraalWASM</strong>
GraalWasm delivers great performance using Graal JIT, when available, to compile WASM directly to machine code.</p>
</li>
<li class="">
<p><strong>Chicory’s AoT translator</strong>
Produces pure bytecode artifacts that achive competitive performance on any standard JVM.</p>
</li>
</ul>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="the-road-ahead">The Road Ahead<a href="https://chicory.dev/blog/chicory-1.0.0#the-road-ahead" class="hash-link" aria-label="Direct link to The Road Ahead" title="Direct link to The Road Ahead" translate="no">​</a></h2>
<p align="left"><picture><img width="100" src="https://chicory.dev/img/blog-2024-12-25/tickets.png"></picture></p>
<p>We’ve already bought our tickets for the next leg of this journey, and the adventure has only just begun. We’re eager to explore wilder and uncharted territories, confident that exciting times lie ahead.</p>
<p>Here’s what we’re looking forward to:</p>
<ul>
<li class="">
<p><strong>Integrations and usage</strong> of Chicory
Expanding its availability in major frameworks and products.</p>
</li>
<li class="">
<p>Spec <strong>Proposals</strong> compliance
Achieving full compliance with WebAssembly standards, including Exception Handling, Garbage Collection, and full support for SIMD.</p>
</li>
<li class="">
<p>Maturity and stability of <code>-experimental</code> modules
Refining these modules by removing limitations, fixing bugs, and ironing out their APIs.</p>
</li>
<li class="">
<p><strong>Speed</strong>
We have not spent much time on performance, and it's time to take a serious stab at it.</p>
</li>
</ul>
<p>We’re excited to connect with the community along the way, whether at local JUGs, conferences, or meetups. If you’re curious about WebAssembly and its growing impact on development, don’t hesitate to reach out—we’d love to hear from you!</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="the-back-cover">The Back Cover<a href="https://chicory.dev/blog/chicory-1.0.0#the-back-cover" class="hash-link" aria-label="Direct link to The Back Cover" title="Direct link to The Back Cover" translate="no">​</a></h2>
<p align="left"><picture><img width="100" src="https://chicory.dev/img/blog-2024-12-25/back-cover.png"></picture></p>
<p>None of this would have been possible without the help of incredible contributors. On the back cover, you’ll find the names of some of the key authors who made this journey possible:</p>
<ul>
<li class=""><strong>David Philips</strong>:
Outstanding work on Wasi and the AoT translator.</li>
<li class=""><strong>Edoardo Vacchi</strong>:
His mark is visible in the Store and public API as he joined the brawl.</li>
<li class=""><strong>Daniel Perano</strong>:
Instrumental in contributing the first steps of the AoT compiler.</li>
<li class=""><strong>Ben Eckel</strong>
That shaped the initial foundation of the project.</li>
<li class="">The Team at <strong>Dylibso</strong>:
For their continuous support and collaboration throughout this journey.</li>
</ul>
<p>As we close this chapter, we hope these snapshots have entertained and inspired you during the festivities. The journey doesn’t end here—come along and join us!</p>
<hr>
<p>originally published on <a href="https://www.javaadvent.com/2024/12/wasm-chicory-1.html" target="_blank" rel="noopener noreferrer" class="">Java Advent 2024 edition</a></p>]]></content>
        <author>
            <name>Andrea Peruffo</name>
            <uri>https://github.com/andreaTP</uri>
        </author>
        <category label="Wasm" term="Wasm"/>
        <category label="Chicory" term="Chicory"/>
        <category label="Release" term="Release"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[Announcing Chicory 1.0.0-M2: Second Milestone Release]]></title>
        <id>https://chicory.dev/blog/chicory-1.0.0-M2</id>
        <link href="https://chicory.dev/blog/chicory-1.0.0-M2"/>
        <updated>2024-11-26T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[We are working hard on smoothing the edges of Chicory and integrating feedback from the usage of the first Milestone release.]]></summary>
        <content type="html"><![CDATA[<p>We are working hard on smoothing the edges of Chicory and integrating feedback from the usage of the first Milestone release.
To keep the ball rolling and give people early access to the changes we are making we are announcing a second Milestone.</p>
<p>Despite the little time from the previous version there are a bunch of relevant changes.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="api-breaking-changes">API breaking changes<a href="https://chicory.dev/blog/chicory-1.0.0-M2#api-breaking-changes" class="hash-link" aria-label="Direct link to API breaking changes" title="Direct link to API breaking changes" translate="no">​</a></h2>
<p>The name of <code>com.dylibso.chicory.wasm.Module</code> was clashing with the automatic import of <code>java.lang.Module</code>, making it inconvenient in some situations, and we renamed it to <code>com.dylibso.chicory.wasm.WasmModule</code>.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="features">Features<a href="https://chicory.dev/blog/chicory-1.0.0-M2#features" class="hash-link" aria-label="Direct link to Features" title="Direct link to Features" translate="no">​</a></h2>
<p>To maximize compatibility with the spec, we implemented the <a href="https://github.com/WebAssembly/tail-call/blob/main/proposals/tail-call/Overview.md" target="_blank" rel="noopener noreferrer" class="">Tail-Call Optimization Proposal</a> in the interpreter.</p>
<p>We bootstrapped the implementation of the missing SIMD opcodes in a layered way, we are keeping compatibility with Java 11 when they are not necessary, and we started encoding those with the upcoming <a href="https://openjdk.org/jeps/448" target="_blank" rel="noopener noreferrer" class="">Vector API</a>.
There is a lot of work that can be easily parallelized here, come and join the effort if this sounds like an exciting challenge to you!</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="aot-improvements">AOT improvements<a href="https://chicory.dev/blog/chicory-1.0.0-M2#aot-improvements" class="hash-link" aria-label="Direct link to AOT improvements" title="Direct link to AOT improvements" translate="no">​</a></h2>
<p>We finished making modules compiled at build time with the <code>aot-maven-plugin-experimental</code> completely self-contained! You can now emit a binary that runs pure Java Bytecode and only depends on the Chicory runtime library: the original WASM file is not needed. The <code>WasmModule</code> is now provided by the compiled code. Additionally, we changed the Maven configuration so that you now specify the class name prefix rather than the <code>Machine</code> class name. See the documentation for <a class="" href="https://chicory.dev/docs/usage/build-time-compiler">Build-time AOT</a> for more details.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="documentation">Documentation<a href="https://chicory.dev/blog/chicory-1.0.0-M2#documentation" class="hash-link" aria-label="Direct link to Documentation" title="Direct link to Documentation" translate="no">​</a></h2>
<p>A number of improvements happened in the documentation site, making the project more accessible to newcomers.
We are happy to hear feedback and integrate improvements when you find gaps!</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="conclusion">Conclusion<a href="https://chicory.dev/blog/chicory-1.0.0-M2#conclusion" class="hash-link" aria-label="Direct link to Conclusion" title="Direct link to Conclusion" translate="no">​</a></h2>
<p>Chicory is quickly stabilizing, and we have also to thank all of our wonderful <a href="https://github.com/dylibso/chicory/graphs/contributors" target="_blank" rel="noopener noreferrer" class="">contributors</a>: without you we would not be where we are today!</p>
<p>Check out Chicory 1.0.0-M2 and we are looking forward to hear from you!</p>]]></content>
        <author>
            <name>Andrea Peruffo</name>
            <uri>https://github.com/andreaTP</uri>
        </author>
        <author>
            <name>David Phillips</name>
            <uri>https://github.com/electrum</uri>
        </author>
        <category label="Wasm" term="Wasm"/>
        <category label="Chicory" term="Chicory"/>
        <category label="Release" term="Release"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[Announcing Chicory 1.0.0-M1: First Milestone Release]]></title>
        <id>https://chicory.dev/blog/chicory-1.0.0-M1</id>
        <link href="https://chicory.dev/blog/chicory-1.0.0-M1"/>
        <updated>2024-11-08T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[It's been a while since our pure-Java WebAssembly runtime released version 0.0.12,]]></summary>
        <content type="html"><![CDATA[<p>It's been a while since our <strong>pure-Java WebAssembly runtime</strong> released version <a href="https://github.com/dylibso/chicory/releases/tag/0.0.12" target="_blank" rel="noopener noreferrer" class="">0.0.12</a>,
so you might say a new release was almost overdue.</p>
<p>In the previous months we concentrated on <strong>correctness</strong> and <strong>spec-compliance</strong> of our WebAssembly runtime; <strong>now</strong> it is time to <strong>harden the codebase</strong> and make it <strong>a solid platform to build upon</strong>.</p>
<p>This release is somewhat special:</p>
<ul>
<li class="">first of all, you will notice we have a <strong>brand-new website</strong>. We are continuously working
on improving the <a class="" href="https://chicory.dev/docs/">documentation</a> to make it a convenient and detailed resource to get started</li>
<li class="">but also, this release marks the beginning of our path toward a final <strong>1.0 version</strong>.</li>
</ul>
<p>The reason why this release took some time is we wanted to get many things right. In this release:</p>
<ul>
<li class="">we <a href="https://chicory.dev/blog/chicory-1.0.0-M1#public-api" class="">updated the public API</a>, including <a href="https://chicory.dev/blog/chicory-1.0.0-M1#generated-host-modules" class="">a new way to write host functions</a></li>
<li class="">some modules are now <a href="https://chicory.dev/blog/chicory-1.0.0-M1#experimental-modules" class="">marked as experimental</a></li>
<li class="">we are now more confident in <a href="https://chicory.dev/blog/chicory-1.0.0-M1#ahead-of-time-translation" class="">the <strong>Ahead-of-Time</strong> translator</a>:
this translator is a drop-in replacement for the interpreter, and is 100% compatible
with the specs that we support in interpreter mode (<code>aot</code> is currently marked as experimental).</li>
<li class="">we <a href="https://chicory.dev/blog/chicory-1.0.0-M1#webassembly-system-interface-improvements" class="">improved our WASI implementation</a></li>
</ul>
<p>Let's take a look in detail.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="public-api">Public API<a href="https://chicory.dev/blog/chicory-1.0.0-M1#public-api" class="hash-link" aria-label="Direct link to Public API" title="Direct link to Public API" translate="no">​</a></h2>
<p>In the name of simplicity and readability (but also encapsulation), we refactored a lot of code,
so we made some important changes to our <strong>public API</strong>. You will find all the
<a class="" href="https://chicory.dev/docs/">updated instructions on the docs</a>.</p>
<p>There is now a clearer boundary between <code>Parser</code>, <code>Module</code> and <code>Instance</code>:</p>
<div class="language-java codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-java codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">var</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">module</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Parser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">parse</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"path/to/your.wasm"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">var</span><span class="token plain"> instance </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Instance</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">builder</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">module</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">build</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></div></code></pre></div></div>
<p>We have also introduced a new unified mechanism to define host functions
and instantiate collections of related modules together, all at once.
We call this utility the <a class="" href="https://chicory.dev/docs/usage/linking"><code>Store</code></a>:</p>
<div class="language-java codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-java codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// instantiate the store</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">var</span><span class="token plain"> store </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">Store</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// registers a host function in the store</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">store</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">addFunction</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">myFunction</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token comment" style="color:#999988;font-style:italic">// create a named `instance` with name `logger`</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">var</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">module</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Parser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">parse</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">File</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"logger.wasm"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">var</span><span class="token plain"> instance </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> store</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">instantiate</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"logger"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">module</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></div></code></pre></div></div>
<p>You can read more about the <a class="" href="https://chicory.dev/docs/usage/linking"><code>Store</code> in the docs</a>.</p>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="host-functions">Host Functions<a href="https://chicory.dev/blog/chicory-1.0.0-M1#host-functions" class="hash-link" aria-label="Direct link to Host Functions" title="Direct link to Host Functions" translate="no">​</a></h3>
<p>We changed the signature for <code>HostFunction</code>. This is probably the biggest surface change
you will notice. Not only has the order of the arguments changed, but also their types:</p>
<div class="language-java codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-java codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:#393A34"><span class="token comment" style="color:#999988;font-style:italic">// defines `console.log`</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">var</span><span class="token plain"> func </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token class-name">HostFunction</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">        </span><span class="token string" style="color:#e3116c">"console"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">        </span><span class="token string" style="color:#e3116c">"log"</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">        </span><span class="token class-name">List</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">of</span><span class="token punctuation" style="color:#393A34">(</span><span class="token class-name">ValueType</span><span class="token punctuation" style="color:#393A34">.</span><span class="token constant" style="color:#36acaa">I32</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token class-name">ValueType</span><span class="token punctuation" style="color:#393A34">.</span><span class="token constant" style="color:#36acaa">I32</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">        </span><span class="token class-name">List</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">of</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">        </span><span class="token punctuation" style="color:#393A34">(</span><span class="token class-name">Instance</span><span class="token plain"> instance</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">long</span><span class="token punctuation" style="color:#393A34">.</span><span class="token punctuation" style="color:#393A34">.</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain"> args</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">-&gt;</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"> </span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">            </span><span class="token keyword" style="color:#00009f">var</span><span class="token plain"> len </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">int</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> args</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">            </span><span class="token keyword" style="color:#00009f">var</span><span class="token plain"> offset </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">int</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> args</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">1</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">            </span><span class="token keyword" style="color:#00009f">var</span><span class="token plain"> message </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> instance</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">memory</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">readString</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">offset</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> len</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">            </span><span class="token function" style="color:#d73a49">println</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain">message</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">            </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">new</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">long</span><span class="token punctuation" style="color:#393A34">[</span><span class="token number" style="color:#36acaa">0</span><span class="token punctuation" style="color:#393A34">]</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">        </span><span class="token punctuation" style="color:#393A34">}</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></div></code></pre></div></div>
<p>Specifically, you will notice that function arguments and return values are all now arrays of primitive <code>long</code>s.
This coincided with a huge refactoring/rewrite of the internals of our engine.</p>
<p>Such <code>long</code> values are treated as raw bits, and should be usually converted back and forth
to the appropriate types by downcasting or using the <a href="https://github.com/dylibso/chicory/blob/c369d287f724b2297211c6dd02e7bbaeaaed321a/wasm/src/main/java/com/dylibso/chicory/wasm/types/Value.java#L26-L44" target="_blank" rel="noopener noreferrer" class="">public methods of the <code>Value</code> class</a></p>
<p>For instance, in the example above, we know it is safe to assume
that those longs were originally widened integers.</p>
<p>We have however introduced a higher-level abstraction for convenience.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="generated-host-modules">Generated Host Modules<a href="https://chicory.dev/blog/chicory-1.0.0-M1#generated-host-modules" class="hash-link" aria-label="Direct link to Generated Host Modules" title="Direct link to Generated Host Modules" translate="no">​</a></h2>
<p>The new <code>HostFunction</code> API gives you raw access to the arguments of a function
as they are represented in the Wasm runtime, but it can be inconvenient to use.
Thus, we are now also providing an annotation processor to express <code>HostFunction</code>s
in a more ergonomic way.</p>
<p>This feature requires you to depend on the experimental annotation processor:</p>
<div class="language-xml codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-xml codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:#393A34"><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">dependency</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">groupId</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain">com.dylibso.chicory</span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">groupId</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">artifactId</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain">host-module-annotations-experimental</span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">artifactId</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">dependency</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><br></div></code></pre></div></div>
<p>You can now annotate a class as <code>@HostModule("your-wasm-module-name")</code>
and export instance members of such a class by annotating them as <code>@WasmExport</code>.</p>
<p>They will generate a <code>HostFunction</code> called <code>wasm_module_name.your_function_name</code>.</p>
<p>For instance, the following generates a HostFunction called wasi_snapshot_preview1.fd_close:</p>
<div class="language-java codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-java codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:#393A34"><span class="token annotation punctuation" style="color:#393A34">@HostModule</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"wasi_snapshot_preview1"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">public</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">final</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">class</span><span class="token plain"> </span><span class="token class-name">WasiPreview1</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    </span><span class="token punctuation" style="color:#393A34">.</span><span class="token punctuation" style="color:#393A34">.</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    </span><span class="token annotation punctuation" style="color:#393A34">@WasmExport</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    </span><span class="token keyword" style="color:#00009f">public</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">int</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">fdClose</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">int</span><span class="token plain"> fd</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">        </span><span class="token punctuation" style="color:#393A34">.</span><span class="token punctuation" style="color:#393A34">.</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></div></code></pre></div></div>
<p>As you might have noticed from the example above, we are now using this feature ourselves
to implement the <a class="" href="https://chicory.dev/docs/usage/wasi">WASI host functions</a>.</p>
<p>The annotation processor generates a companion <code>&lt;YourClassName&gt;_ModuleFactory</code>, with a
static member <code>&lt;YourClassName&gt;_ModuleFactory#toHostFunctions(&lt;YourClassName&gt;)</code>.</p>
<p>This static member returns an array of <code>HostFunction</code>s that perform the
conversion between raw longs to the type signature you have declared.</p>
<p>You can expose this member in the most convenient way for your end users.</p>
<p>For instance in this case:</p>
<div class="language-java codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-java codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:#393A34"><span class="token annotation punctuation" style="color:#393A34">@HostModule</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"wasi_snapshot_preview1"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">public</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">final</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">class</span><span class="token plain"> </span><span class="token class-name">WasiPreview1</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    </span><span class="token punctuation" style="color:#393A34">.</span><span class="token punctuation" style="color:#393A34">.</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain" style="display:inline-block"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    </span><span class="token keyword" style="color:#00009f">public</span><span class="token plain"> </span><span class="token class-name">HostFunction</span><span class="token punctuation" style="color:#393A34">[</span><span class="token punctuation" style="color:#393A34">]</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">toHostFunctions</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">        </span><span class="token keyword" style="color:#00009f">return</span><span class="token plain"> </span><span class="token class-name">WasiPreview1_ModuleFactory</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">toHostFunctions</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">this</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    </span><span class="token punctuation" style="color:#393A34">}</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    </span><span class="token punctuation" style="color:#393A34">.</span><span class="token punctuation" style="color:#393A34">.</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></div></code></pre></div></div>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="supported-types">Supported Types<a href="https://chicory.dev/blog/chicory-1.0.0-M1#supported-types" class="hash-link" aria-label="Direct link to Supported Types" title="Direct link to Supported Types" translate="no">​</a></h3>
<p>Supported input and output types for <code>@WasmExport</code> are primitives <code>int</code>, <code>long</code>, <code>float</code>, <code>double</code>,
which correspond to WASM types <code>I32</code>, <code>I64</code>, <code>F32</code>, <code>F64</code>.</p>
<p>We also support <code>java.lang.String</code> arguments, provided that they are only passed as an input value,
and they are annotated. We support two annotations:</p>
<ul>
<li class=""><code>@Buffer</code>: the code generator translates the <code>String</code> value to a pair of integers:<!-- -->
<ul>
<li class="">the first is the index of (or pointer to) the start of the string UTF-8 bytes in the linear memory</li>
<li class="">the second is the length of the string in bytes</li>
</ul>
</li>
<li class=""><code>@CString</code>: the code generator translates the <code>String</code> into an index (pointer to) the beginning
of a null-terminated string of UTF-8 bytes</li>
</ul>
<p>For instance:</p>
<div class="language-java codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-java codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:#393A34"><span class="token annotation punctuation" style="color:#393A34">@WasmExport</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">public</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">int</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">pathFilestatSetTimes</span><span class="token punctuation" style="color:#393A34">(</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">        </span><span class="token keyword" style="color:#00009f">int</span><span class="token plain"> fd</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">        </span><span class="token keyword" style="color:#00009f">int</span><span class="token plain"> lookupFlags</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">        </span><span class="token annotation punctuation" style="color:#393A34">@Buffer</span><span class="token plain"> </span><span class="token class-name">String</span><span class="token plain"> rawPath</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">        </span><span class="token keyword" style="color:#00009f">long</span><span class="token plain"> accessTime</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">        </span><span class="token keyword" style="color:#00009f">long</span><span class="token plain"> modifiedTime</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">        </span><span class="token keyword" style="color:#00009f">int</span><span class="token plain"> fstFlags</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    </span><span class="token punctuation" style="color:#393A34">.</span><span class="token punctuation" style="color:#393A34">.</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></div></code></pre></div></div>
<p>is translated to the host function <code>wasi_snapshot_preview1.path_filestat_set_times</code>
with a signature equivalent to:</p>
<div class="language-text codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:#393A34"><span class="token plain">public long[] path_filestat_set_times(</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    long fd            // ValueType.I32</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    long lookup_flags  // ValueType.I32</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    long raw_path_ptr  // ValueType.I32 =&gt; string pointer</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    long raw_path_size // ValueType.I32 =&gt; string length</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    long access_time   // ValueType.I64</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    long modified_time // ValueType.I64</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    long fst_flags     // ValueType.I32</span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">)</span><br></div></code></pre></div></div>
<p>You can additionally accept <code>com.dylibso.chicory.runtime.Instance</code> and
<code>com.dylibso.chicory.runtime.Memory</code> as input arguments; for example:</p>
<div class="language-java codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-java codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:#393A34"><span class="token annotation punctuation" style="color:#393A34">@WasmExport</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">public</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">int</span><span class="token plain"> </span><span class="token function" style="color:#d73a49">fdFdstatGet</span><span class="token punctuation" style="color:#393A34">(</span><span class="token class-name">Memory</span><span class="token plain"> memory</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">int</span><span class="token plain"> fd</span><span class="token punctuation" style="color:#393A34">,</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">int</span><span class="token plain"> buf</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"> </span><span class="token punctuation" style="color:#393A34">{</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    </span><span class="token punctuation" style="color:#393A34">.</span><span class="token punctuation" style="color:#393A34">.</span><span class="token punctuation" style="color:#393A34">.</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token punctuation" style="color:#393A34">}</span><br></div></code></pre></div></div>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="experimental-modules">Experimental Modules<a href="https://chicory.dev/blog/chicory-1.0.0-M1#experimental-modules" class="hash-link" aria-label="Direct link to Experimental Modules" title="Direct link to Experimental Modules" translate="no">​</a></h2>
<p>We are now clearly marking some modules as <code>experimental</code>: while we might still need to introduce a few breaking changes
here and there before the final 1.0 release <em>throughout the codebase</em>, we explicitly call a module
<code>experimental</code> if it is still under development and might be reworked in the near future.</p>
<p>You might notice that some old modules might have changed their name:
for instance, <code>aot</code> is now called <code>aot-experimental</code> and the package name has been renamed
from <code>com.dylibso.chicory.aot</code> to <code>com.dylibso.chicory.experimental.aot</code></p>
<p>Nonetheless, we invite you to try them and welcome any feedback.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="ahead-of-time-translation">Ahead of Time Translation<a href="https://chicory.dev/blog/chicory-1.0.0-M1#ahead-of-time-translation" class="hash-link" aria-label="Direct link to Ahead of Time Translation" title="Direct link to Ahead of Time Translation" translate="no">​</a></h2>
<p>Chicory has been initially developed as a Java interpreter for WebAssembly; but it has soon acquired
a bytecode translator from Wasm bytecode to Java bytecode. This is what we call the <strong>Ahead-of-Time</strong> backend.
The Ahead-of-Time backend is a <strong>drop-in replacement</strong> for the interpreter, and it passes <strong>100% of the same
spec tests</strong> that the interpreter already supports.</p>
<p>You can instantiate a module by explicitly providing a <code>MachineFactory</code>. The default <code>Machine</code> implementation
is the <code>InterpreterMachine</code>. You can opt in to the AoT mode by writing:</p>
<div class="language-java codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-java codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:#393A34"><span class="token keyword" style="color:#00009f">var</span><span class="token plain"> </span><span class="token keyword" style="color:#00009f">module</span><span class="token plain"> </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Parser</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">parse</span><span class="token punctuation" style="color:#393A34">(</span><span class="token string" style="color:#e3116c">"path/to/your.wasm"</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token keyword" style="color:#00009f">var</span><span class="token plain"> instance </span><span class="token operator" style="color:#393A34">=</span><span class="token plain"> </span><span class="token class-name">Instance</span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">builder</span><span class="token punctuation" style="color:#393A34">(</span><span class="token keyword" style="color:#00009f">module</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">        </span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">withMachineFactory</span><span class="token punctuation" style="color:#393A34">(</span><span class="token class-name">AotMachine</span><span class="token operator" style="color:#393A34">::</span><span class="token keyword" style="color:#00009f">new</span><span class="token punctuation" style="color:#393A34">)</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">        </span><span class="token punctuation" style="color:#393A34">.</span><span class="token function" style="color:#d73a49">build</span><span class="token punctuation" style="color:#393A34">(</span><span class="token punctuation" style="color:#393A34">)</span><span class="token punctuation" style="color:#393A34">;</span><br></div></code></pre></div></div>
<p>You must add the dependency for AoT:</p>
<div class="language-xml codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-xml codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:#393A34"><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">dependency</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">groupId</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain">com.dylibso.chicory</span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">groupId</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">artifactId</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain">aot-experimental</span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">artifactId</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">dependency</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><br></div></code></pre></div></div>
<p>This will translate every module you instantiate into Java bytecode on-the-fly and in-memory.
The resulting code is usually expected to evaluate faster and consume less memory. This was
already present in our last release.</p>
<p>With 1.0.0-M1 we are also introducing a new mode of execution: build-time code generation.
This mode of execution reduces startup time and will remove the need for distributing
the original Wasm binary.</p>
<ul>
<li class="">this improves startup time because the translation occurs only once,
when you are packaging your application</li>
<li class="">it virtually allows you to distribute Wasm modules
as self-contained jars, making it a convenient way to distribute software that
was not originally meant to run on the Java platform</li>
<li class="">it still maintains the same performance properties as the in-memory compiler (in fact,
the compilation backend is virtually the same)</li>
</ul>
<p>The translation is performed during your build using a <a href="https://github.com/dylibso/chicory/tree/16c7fe4d5cd3d7365b8bc78425d968af12f61dba/aot-maven-plugin" target="_blank" rel="noopener noreferrer" class="">Maven plug-in</a>.</p>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="build-time-ahead-of-time-translation">Build-Time Ahead-of-Time Translation<a href="https://chicory.dev/blog/chicory-1.0.0-M1#build-time-ahead-of-time-translation" class="hash-link" aria-label="Direct link to Build-Time Ahead-of-Time Translation" title="Direct link to Build-Time Ahead-of-Time Translation" translate="no">​</a></h3>
<blockquote>
<p><strong>Note</strong>: This mode of execution requires configuring a Maven plug-in.</p>
</blockquote>
<p><a href="https://github.com/dylibso/chicory/tree/16c7fe4d5cd3d7365b8bc78425d968af12f61dba/wabt" target="_blank" rel="noopener noreferrer" class="">An example can be found in the Chicory codebase</a>. The <a href="https://github.com/WebAssembly/wabt" target="_blank" rel="noopener noreferrer" class="">WABT</a> suite of tools allows
manipulating Wasm bytecode in a number of ways.
For instance, the <code>wat2wasm</code> tool takes WAT source files (written in "WebAssembly Text Format")
and translates them into Wasm.</p>
<p>The WABT tool set is written in C++, and the tools can be compiled to Wasm themselves.
So, in the <a href="https://github.com/dylibso/chicory/tree/16c7fe4d5cd3d7365b8bc78425d968af12f61dba/wabt" target="_blank" rel="noopener noreferrer" class=""><code>wabt</code></a> submodule in the Chicory codebase,
we translate the Wasm version of <code>wat2wasm</code> into Java bytecode so that we can invoke it without
calling a native executable.</p>
<div class="language-xml codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-xml codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:#393A34"><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">build</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">plugins</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">plugin</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">      </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">groupId</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain">com.dylibso.chicory</span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">groupId</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">      </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">artifactId</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain">aot-maven-plugin-experimental</span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">artifactId</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">      </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">executions</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">        </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">execution</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">          </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">id</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain">wat2wasm</span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">id</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">          </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">goals</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">            </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">goal</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain">wasm-aot-gen</span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">goal</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">          </span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">goals</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">          </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">configuration</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">            </span><span class="token comment" style="color:#999988;font-style:italic">&lt;!-- Translate the Wasm binary `wat2wasm` into bytecode --&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">            </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">wasmFile</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain">src/main/resources/wat2wasm</span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">wasmFile</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">            </span><span class="token comment" style="color:#999988;font-style:italic">&lt;!-- Generate the following class file as a result --&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">            </span><span class="token tag punctuation" style="color:#393A34">&lt;</span><span class="token tag" style="color:#00009f">name</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain">com.dylibso.chicory.wabt.Wat2WasmModule</span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">name</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">          </span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">configuration</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">        </span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">execution</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">      </span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">executions</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    </span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">plugin</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">  </span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">plugins</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><span class="token plain"></span><br></div><div class="token-line" style="color:#393A34"><span class="token plain"></span><span class="token tag punctuation" style="color:#393A34">&lt;/</span><span class="token tag" style="color:#00009f">build</span><span class="token tag punctuation" style="color:#393A34">&gt;</span><br></div></code></pre></div></div>
<p>Refer to <a href="https://github.com/dylibso/chicory/tree/16c7fe4d5cd3d7365b8bc78425d968af12f61dba/wabt" target="_blank" rel="noopener noreferrer" class="">the <code>wabt</code> module in the Chicory codebase</a> to see how we expose the <code>wat2wasm</code> tool
as a library.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="webassembly-system-interface-improvements">WebAssembly System Interface Improvements<a href="https://chicory.dev/blog/chicory-1.0.0-M1#webassembly-system-interface-improvements" class="hash-link" aria-label="Direct link to WebAssembly System Interface Improvements" title="Direct link to WebAssembly System Interface Improvements" translate="no">​</a></h2>
<p>Besides using the new Host Module annotation processor, we introduced many more <a class="" href="https://chicory.dev/docs/usage/wasi">WASI functions</a>.
This improves the compatibility of our engine with the output of the majority of compilers targeting <code>wasip1</code>;
at this point, the most used functions should be all supported. Refer to the <a class="" href="https://chicory.dev/docs/usage/wasi">WASI docs</a> for details.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="conclusion">Conclusion<a href="https://chicory.dev/blog/chicory-1.0.0-M1#conclusion" class="hash-link" aria-label="Direct link to Conclusion" title="Direct link to Conclusion" translate="no">​</a></h2>
<p>Chicory has come a long way since its first release, and we have also to thank all of our wonderful
<a href="https://github.com/dylibso/chicory/graphs/contributors" target="_blank" rel="noopener noreferrer" class=""><strong>contributors</strong></a>: without you we would not be where we are today!</p>
<p>There is still some way to go before our final release, but we are already looking forward to what you will be building.
Check out Chicory 1.0.0-M1 right now and let us know what you think!</p>]]></content>
        <author>
            <name>Edoardo Vacchi</name>
            <uri>https://github.com/evacchi</uri>
        </author>
        <category label="Wasm" term="Wasm"/>
        <category label="Chicory" term="Chicory"/>
        <category label="Release" term="Release"/>
    </entry>
    <entry>
        <title type="html"><![CDATA[A zero dependency Wasm runtime for the JVM]]></title>
        <id>https://chicory.dev/blog/first-announcement</id>
        <link href="https://chicory.dev/blog/first-announcement"/>
        <updated>2023-12-25T00:00:00.000Z</updated>
        <summary type="html"><![CDATA[All I want for Xmas is Chicory]]></summary>
        <content type="html"><![CDATA[<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="all-i-want-for-xmas-is-chicory">All I want for Xmas is Chicory<a href="https://chicory.dev/blog/first-announcement#all-i-want-for-xmas-is-chicory" class="hash-link" aria-label="Direct link to All I want for Xmas is Chicory" title="Direct link to All I want for Xmas is Chicory" translate="no">​</a></h2>
<img src="https://chicory.dev/img/blog-2023-12-25/main.png">
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="a-zero-dependency-wasm-runtime-for-the-jvm">A zero dependency Wasm runtime for the JVM<a href="https://chicory.dev/blog/first-announcement#a-zero-dependency-wasm-runtime-for-the-jvm" class="hash-link" aria-label="Direct link to A zero dependency Wasm runtime for the JVM" title="Direct link to A zero dependency Wasm runtime for the JVM" translate="no">​</a></h2>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="intro">INTRO<a href="https://chicory.dev/blog/first-announcement#intro" class="hash-link" aria-label="Direct link to INTRO" title="Direct link to INTRO" translate="no">​</a></h2>
<p>In a lot of cultures, during Christmas time, Santa would distribute toys and presents to the good kids around. If you are reading Java Advent Of Code, that means that you care about Java and I’m sure you are a good one who deserves a present!</p>
<p>Let me be your Santa today and I’ll show you a new shiny present:</p>
<p>From the outside, the box looks small. We are not going to find any full-fledged framework to write Enterprise applications.</p>
<p>On the front, there are pictures of mythical integrations and fancy plugin systems, but a note on the back catches the attention: “requires assembly”. Gotcha, this is the kind of educational toy that requires us to read the guide to make some sense out of the pieces.</p>
<p>Are you ready for the unboxing?<br>
<!-- -->Here you have a fancy early version of a Wasm interpreter called Chicory!</p>
<p>Whaaaat????<br>
<!-- -->What does that even mean?<br>
<!-- -->Don’t get upset, the instructions are detailed, let’s go through them together.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="webassembly-wasm">WebAssembly (Wasm)<a href="https://chicory.dev/blog/first-announcement#webassembly-wasm" class="hash-link" aria-label="Direct link to WebAssembly (Wasm)" title="Direct link to WebAssembly (Wasm)" translate="no">​</a></h2>
<p>From Wiki we can read:</p>
<blockquote>
<p>defines a portable binary-code format and a corresponding text format for executable programs as well as software interfaces for facilitating interactions between such programs and their host environment.</p>
</blockquote>
<p><a href="https://en.wikipedia.org/wiki/WebAssembly" target="_blank" rel="noopener noreferrer" class="">https://en.wikipedia.org/wiki/WebAssembly</a></p>
<p>Ok, I get it, it’s another bytecode format to express programs, but how and why should we use it? Is the JVM bytecode not good enough?</p>
<p>Wasm has some different characteristics that give it an advantage over the JVM for some use cases. Because it was born on the web, Wasm has a sandboxed memory model which prevents modules from reading memory or jumping to code outside of their own scope. And by default, Wasm will not allow you to access any system resources such as files or networks. Wasm also has no concepts of objects or heap and that means it can run low-level languages very efficiently. This makes Wasm an ideal candidate for running untrusted / third party code written in a variety of languages.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="included-pieces">Included pieces<a href="https://chicory.dev/blog/first-announcement#included-pieces" class="hash-link" aria-label="Direct link to Included pieces" title="Direct link to Included pieces" translate="no">​</a></h2>
<p>Wasm has something like an assembly language that maps directly to its instructions. You can write this by hand, but like Assembly, you typically don't. Fortunately, we do have much better and higher level languages to solve the nitty-gritty problems of the low-level for us.</p>
<p>Many of the most popular languages are starting to offer the possibility of TARGETING WASM, translating your program written in a high-level programming language into a series of Wasm instructions.</p>
<img src="https://chicory.dev/img/blog-2023-12-25/image1.png">
<p>Often, the instructions for educational games are informative, but you don’t truly understand it until you play it yourself. Let’s connect the first pieces and compile a simple program to Wasm.</p>
<p>The program:</p>
<img src="https://chicory.dev/img/blog-2023-12-25/image2.png">
<p>Compile with:</p>
<div class="language-bash codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-bash codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:#393A34"><span class="token plain">rustc count\_vowels.rs \--target=wasm32-unknown-unknown \--crate-type=cdylib \-C opt-level=0 \-C debuginfo=0 \-o count\_vowels.wasm</span><br></div></code></pre></div></div>
<p>For simplicity, you can use the provided <a href="https://github.com/andreaTP/first-chicory-blog/blob/main/compile_to_wasm/Dockerfile" target="_blank" rel="noopener noreferrer" class="">Dockerfile</a>.</p>
<p>Now that we have a `.wasm` file to try things out we need “something” to run the instructions.</p>
<p>Without getting too fancy and cutting nuances off we have two main options:</p>
<ul>
<li class="">Another compiler: This should be able to take the `wasm` format and translate it to machine code that a computer can run (e.g. <a href="https://github.com/WebAssembly/wabt/tree/main/wasm2c" target="_blank" rel="noopener noreferrer" class="">wasm2c</a>)</li>
<li class="">An interpreter: This will process the content of the `wasm` file directly executing the instructions.</li>
</ul>
<p>Chicory, as of today, is a Pure Java (no dependencies other than the Java standard library) interpreter and there are tradeoffs to consider here:</p>
<ul>
<li class="">Compiler:<!-- -->
<ul>
<li class=""><strong>PRO</strong>: fast execution</li>
<li class=""><strong>CONS</strong>: needs a “developer” toolchain to be executed, more opportunity for security vulnerabilities</li>
</ul>
</li>
<li class="">Interpreter:<!-- -->
<ul>
<li class=""><strong>PRO</strong>: self-contained and easily portable, less opportunity for security vulnerabilities</li>
<li class=""><strong>CONS</strong>: can be slow for heavy compute programs</li>
</ul>
</li>
</ul>
<p>More specifically a compiler can apply optimizations and transformations before emitting the target output, effectively making the resulting binary, usually, better in terms of speed and efficiency.<br>
<!-- -->An interpreter instead can directly run WASM code without the need for additional toolchains, this makes it a natural fit for running arbitrary, user-defined functions unknown at compile time of your application.</p>
<p>Chicory is doing a direct mapping from the Wasm format to the JVM's native primitives, which doesn’t need any advanced technique like introspection and, more importantly, reflection making it a great candidate for embedding in <a href="https://www.graalvm.org/22.0/reference-manual/native-image/" target="_blank" rel="noopener noreferrer" class="">GraalVM <code>native-image</code> binaries</a>.</p>
<p>Using our experience and test suite of the interpreter engine, we're also working on a compiler from Wasm to JVM Bytecode. As demonstrated in the Go ecosystem with Wazero both an interpreter and a compiler are extremely useful for different use cases.</p>
<p>Now, let’s stop looking at the separately sold additional pieces of our present and keep reading the instructions :-)</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="usage-instructions">Usage instructions<a href="https://chicory.dev/blog/first-announcement#usage-instructions" class="hash-link" aria-label="Direct link to Usage instructions" title="Direct link to Usage instructions" translate="no">​</a></h2>
<p>When we start thinking about the possible use cases for a WASM interpreter, the sky's the limit. But, let’s look closer at the examples to see how we can employ such technology.</p>
<ul>
<li class="">
<p><strong>Enable polyglot plugin systems</strong><br>
<a href="https://kroxylicious.io/" target="_blank" rel="noopener noreferrer" class="">Kroxylicious</a> is a pluggable proxy for Kafka, it enables you to write “filters” in Java to perform various kinds of operations, for example, data manipulation of the messages.<br>
<a href="https://github.com/kroxylicious/kroxylicious/pull/721" target="_blank" rel="noopener noreferrer" class="">In this example</a> you can see how to plug in the Chicory interpreter and automagically offer support for plugins written in other languages. <a href="https://extism.org/" target="_blank" rel="noopener noreferrer" class="">Extism</a> is another great example of an ultra-portable plug-in system.</p>
</li>
<li class="">
<p><strong>Reuse of libraries from different ecosystems</strong><br>
<!-- -->It’s not always desirable to rewrite a functionality in multiple different languages, for the sake of speed, correctness and maintenance.</p>
</li>
<li class="">
<p><strong>Dynamic functions execution</strong><br>
<a href="https://www.graalvm.org/22.0/reference-manual/native-image/" target="_blank" rel="noopener noreferrer" class="">GraalVM native-image</a> makes it viable for Java programs to be compiled into static binaries. The downside is that the usage of reflection becomes an obstacle and should be configured Ahead Of Time. This takes out a good slice of “dynamicity”.<br>
<a href="https://github.com/andreaTP/first-chicory-blog/tree/main/dynamic-loading" target="_blank" rel="noopener noreferrer" class="">In this example</a> we are including Chicory in a statically built CLI binary that can execute user-provided code provided via the command line.</p>
</li>
</ul>
<p>So, the pictures are nice, now let’s try to write and run an example on our own.</p>
<img src="https://chicory.dev/img/blog-2023-12-25/image3.png">
<p>Now we are going to write a Quarkus Web Server from scratch that will expose two endpoints:</p>
<ul>
<li class="">Load code dynamically</li>
<li class="">Execute the loaded code on the user input</li>
</ul>
<p>You can think of it like a mini Java-powered "functions as a service" platform.  And with native image, we will be compiling it to native binaries so it should be fast.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="step-by-step">Step-by-step<a href="https://chicory.dev/blog/first-announcement#step-by-step" class="hash-link" aria-label="Direct link to Step-by-step" title="Direct link to Step-by-step" translate="no">​</a></h2>
<ol>
<li class="">
<p><a href="https://quarkus.io/get-started/" target="_blank" rel="noopener noreferrer" class="">Install the Quarkus CLI</a> and create a standard Quarkus application:</p>
<p><code>quarkus create</code></p>
<p>This command will automatically scaffold a full-blown server-side application in the folder <code>code-with-quarkus</code> , so open it with your favorite IDE/Editor and we can start to play!</p>
</li>
<li class="">
<p>Fix the dependencies in <code>pom.xml</code> as shown in this diff:</p>
<img src="https://chicory.dev/img/blog-2023-12-25/image4.png">
<ul>
<li class="">use plain RestEasy (as opposed to the default reactive version)</li>
<li class="">add the dependency on Jackson to handle Json objects from your API</li>
<li class="">add the dependency on the Chicory runtime! ( as described in the project <a href="https://github.com/dylibso/chicory#install-dependency" target="_blank" rel="noopener noreferrer" class="">Readme</a> )</li>
</ul>
</li>
<li class="">
<p>Remove the default content in <code>src/main/java/org/acme</code> and scaffold your implementation with the content available <a href="https://github.com/andreaTP/first-chicory-blog/tree/main/quarkus/scaffold" target="_blank" rel="noopener noreferrer" class="">here</a>.<br>
<!-- -->In the code we are defining a stateful “Service” shared between 2 “Resource”s depending on it:</p>
<ul>
<li class="">“WasmResource” defines one endpoint able to receive a wasm file in binary format</li>
<li class="">“ComputeResource” is the endpoint that will provide the final “functionality” executing the last wasm function uploaded against the user input</li>
<li class="">the “WasmService” example API exposes two methods to perform the desired operations:</li>
</ul>
<img src="https://chicory.dev/img/blog-2023-12-25/image5.png">
</li>
<li class="">
<p>Fill the empty “WasmService” implementation to finally perform the desired actions using Chicory’s primitives</p>
<img src="https://chicory.dev/img/blog-2023-12-25/image6.png">
<ul>
<li class="">“setModule” takes an <code>InputStream</code> and builds a Wasm Module out of it, reading the structure and the instructions contained. The Module will be stored into an example local variable to be reused.</li>
<li class="">“compute” is a method that takes a simple user input (an <code>int</code> !) and perform the rest of the operations:<!-- -->
<ul>
<li class="">instantiate the module to be ready to run</li>
<li class="">find a declared function named “exported_function”</li>
<li class="">invoke the function passing the user content to it</li>
<li class="">return the result as an “int”</li>
</ul>
</li>
</ul>
</li>
<li class="">
<p>Congratulations! You have just written your first application server leveraging a Wasm interpreter! Let’s test it out by running the server in a shell:<br>
<code>mvn quarkus:dev</code><br>
<!-- -->Spin another shell and use the endpoints:</p>
<ul>
<li class="">
<p>let’s first upload a Wasm module, to try things out in an easy way you can use the pre-built example (feel free to modify and recompile it!):</p>
<div class="language-text codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:#393A34"><span class="token plain">curl \-sL https://raw.githubusercontent.com/andreaTP/first-chicory-blog/main/dynamic-loading/example.wasm  \--output example.wasm</span><br></div></code></pre></div></div>
<p>and upload it to the running web-server:</p>
<div class="language-text codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:#393A34"><span class="token plain">curl \-H 'Content-Type: application/octet-stream' \-X POST \--data-binary @example.wasm http://localhost:8080/wasm</span><br></div></code></pre></div></div>
</li>
<li class="">
<p>finally, we can call the “compute” endpoint:</p>
<div class="language-text codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:#393A34"><span class="token plain">curl \-v 'http://localhost:8080/compute' \-H 'Content-Type: application/json' \--data-raw '41'</span><br></div></code></pre></div></div>
</li>
<li class="">
<p>and we should receive the long-awaited answer:</p>
<div class="language-text codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:#393A34"><span class="token plain">{"value":42}</span><br></div></code></pre></div></div>
<p>as the compiled example <a href="https://github.com/andreaTP/first-chicory-blog/blob/5a0fe4f8b22809d7b0d932348ec4f826714d30b6/dynamic-loading/example.rs#L3" target="_blank" rel="noopener noreferrer" class="">is simply adding 1 to the user input</a>.</p>
</li>
</ul>
</li>
<li class="">
<p>To make sure that there is nothing that depends on the development environment we can now containerize our application. Drop a file named <code>Dockerfile.native-scratch</code> in the <code>src/main/docker</code> folder of our Quarkus application, and fill it with the following content (adapted from the <a href="https://quarkus.io/guides/building-native-image#build-a-container-image-from-scratch" target="_blank" rel="noopener noreferrer" class="">official documentation</a>):</p>
</li>
</ol>
<div class="language-docker codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-docker codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:#393A34"><span class="token plain">FROM quay.io/quarkus/ubi-quarkus-graalvmce-builder-image:jdk-21 AS build  </span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">USER root  </span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">RUN microdnf install make gcc  </span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">RUN mkdir /musl &amp;&amp; \\  </span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    curl \-L \-o musl.tar.gz https://more.musl.cc/11.2.1/x86\_64-linux-musl/x86\_64-linux-musl-native.tgz &amp;&amp; \\  </span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    tar \-xvzf musl.tar.gz \-C /musl \--strip-components 1 &amp;&amp; \\  </span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    curl \-L \-o zlib.tar.gz https://www.zlib.net/zlib-1.3.tar.gz &amp;&amp; \\  </span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    mkdir zlib &amp;&amp; tar \-xvzf zlib.tar.gz \-C zlib \--strip-components 1 &amp;&amp; \\  </span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    cd zlib &amp;&amp; ./configure \--static \--prefix=/musl &amp;&amp; \\  </span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    make &amp;&amp; make install &amp;&amp; \\  </span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    cd .. &amp;&amp; rm \-rf zlib &amp;&amp; rm \-f zlib.tar.gz &amp;&amp; rm \-f musl.tar.gz  </span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">ENV PATH\="/musl/bin:${PATH}"  </span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">USER quarkus  </span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">WORKDIR /code  </span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">COPY . .  </span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">RUN ./mvnw package \-Dnative \-DskipTests \-Dquarkus.native.additional-build-args="--static","--libc=musl"  </span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">    </span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">*\#\# Stage 2 : create the final image*  </span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">FROM scratch  </span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">COPY \--from\=build /code/target/\*-runner /application  </span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">EXPOSE 8080  </span><br></div><div class="token-line" style="color:#393A34"><span class="token plain">ENTRYPOINT \[ "/application" \]  </span><br></div></code></pre></div></div>
<p>Build the container image:</p>
<div class="language-text codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:#393A34"><span class="token plain">docker build -f src/main/docker/Dockerfile.native-scratch -t chicory/getting-started .</span><br></div></code></pre></div></div>
<p>And run it:</p>
<div class="language-text codeBlockContainer_Ckt0 theme-code-block" style="--prism-color:#393A34;--prism-background-color:#f6f8fa"><div class="codeBlockContent_QJqH"><pre tabindex="0" class="prism-code language-text codeBlock_bY9V thin-scrollbar" style="color:#393A34;background-color:#f6f8fa"><code class="codeBlockLines_e6Vv"><div class="token-line" style="color:#393A34"><span class="token plain">docker run -i --rm -p 8080:8080 chicory/getting-started</span><br></div></code></pre></div></div>
<p>You can notice that the final image is built <code>FROM scratch</code> making sure that our application will not be accessing any system-level resource. You can exercise the built image by using the same <code>curl</code> demo commands provided before.</p>
<p>Pretty cool, right?<br>
<!-- -->Now you have a toy server that can run your users' Wasm code against the user input running as a <em>native-image</em> !</p>
<p>You can find all the code we used in this exercise <a href="https://github.com/andreaTP/first-chicory-blog/tree/main/quarkus" target="_blank" rel="noopener noreferrer" class="">here</a>.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="warranty">Warranty<a href="https://chicory.dev/blog/first-announcement#warranty" class="hash-link" aria-label="Direct link to Warranty" title="Direct link to Warranty" translate="no">​</a></h2>
<p>Chicory is in an early stage of development, there are rough edges and the current implementation doesn’t cover the full specification just yet. Although we're missing some pieces of the puzzle, now is a great time to join and help!</p>
<p>If you are brave enough to try things out, please report any failure along with your use case! We are eager to receive early feedback on the current work.</p>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="next">Next<a href="https://chicory.dev/blog/first-announcement#next" class="hash-link" aria-label="Direct link to Next" title="Direct link to Next" translate="no">​</a></h2>
<p>Thanks for bearing with these instructions, I hope that you are reading this final comment while basking, feeling accomplished, with a working example.</p>
<p>We can silently leave the room, to get back, heads down, implementing the last details of the WebAssembly specification.</p>
<p>This year we have built a little rocket toy, but we strongly believe that this innovation brings great benefits to Java and the ecosystem and we are looking at landing on the Moon and making this project a solid building block for the Java applications of tomorrow!</p>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="what-else">What else?<a href="https://chicory.dev/blog/first-announcement#what-else" class="hash-link" aria-label="Direct link to What else?" title="Direct link to What else?" translate="no">​</a></h3>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="demo-repo">Demo repo:<a href="https://chicory.dev/blog/first-announcement#demo-repo" class="hash-link" aria-label="Direct link to Demo repo:" title="Direct link to Demo repo:" translate="no">​</a></h3>
<p><a href="https://github.com/andreaTP/first-chicory-blog" target="_blank" rel="noopener noreferrer" class="">​​https://github.com/andreaTP/first-chicory-blog</a></p>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="acknowledgmentfurther-reads">Acknowledgment/Further reads:<a href="https://chicory.dev/blog/first-announcement#acknowledgmentfurther-reads" class="hash-link" aria-label="Direct link to Acknowledgment/Further reads:" title="Direct link to Acknowledgment/Further reads:" translate="no">​</a></h3>
<p>Edoardo Vacchi has written a series of 2 blog posts to track the progress of Wasm related projects especially targeting Java developers:</p>
<ul>
<li class=""><a href="https://www.javaadvent.com/2022/12/webassembly-for-the-java-geek.html" target="_blank" rel="noopener noreferrer" class="">https://www.javaadvent.com/2022/12/webassembly-for-the-java-geek.html</a></li>
<li class=""><a href="https://www.javaadvent.com/2023/12/a-return-to-webassembly-for-the-java-geek.html" target="_blank" rel="noopener noreferrer" class="">https://www.javaadvent.com/2023/12/a-return-to-webassembly-for-the-java-geek.html</a></li>
</ul>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="similar-projects">Similar projects:<a href="https://chicory.dev/blog/first-announcement#similar-projects" class="hash-link" aria-label="Direct link to Similar projects:" title="Direct link to Similar projects:" translate="no">​</a></h3>
<p><a href="https://www.graalvm.org/latest/reference-manual/wasm/" target="_blank" rel="noopener noreferrer" class="">GraalVM implementation of WebAssembly</a> objectives are pretty much the same as Chicory’s, and this implementation is, at the time of writing, somehow more mature and complete.<br>
<!-- -->Chicory’s differentiates itself for a few, but we believe compelling, reasons:</p>
<ul>
<li class="">Zero dependencies: Chicory’s doesn’t need any additional dependency(other than itself obviously)</li>
<li class="">No platform lock-in: Chicory’s can, and will always, run on any compatible implementation of the JVM as it’s not based on any opinionated framework.</li>
</ul>
<h2 class="anchor anchorTargetStickyNavbar_Vzrq" id="bio">Bio:<a href="https://chicory.dev/blog/first-announcement#bio" class="hash-link" aria-label="Direct link to Bio:" title="Direct link to Bio:" translate="no">​</a></h2>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="andrea-peruffo">Andrea Peruffo<a href="https://chicory.dev/blog/first-announcement#andrea-peruffo" class="hash-link" aria-label="Direct link to Andrea Peruffo" title="Direct link to Andrea Peruffo" translate="no">​</a></h3>
<p>Andrea Peruffo is an all-around software developer with experience in delivering software systems of any kind. He has experience in many different fields, like embedded controllers, cloud infrastructures, PLCs, BigData platforms, FPGAs, microservices etc. etc. Fond in hands-on code development and contributor to several Open Source projects.</p>
<h3 class="anchor anchorTargetStickyNavbar_Vzrq" id="benjamin-eckel">Benjamin Eckel<a href="https://chicory.dev/blog/first-announcement#benjamin-eckel" class="hash-link" aria-label="Direct link to Benjamin Eckel" title="Direct link to Benjamin Eckel" translate="no">​</a></h3>
<p>Benjamin Eckel is the CTO and co-founder of Dylibso, a company focused on accelerating Wasm adoption and tooling.</p>]]></content>
        <author>
            <name>Andrea Peruffo</name>
            <uri>https://github.com/andreaTP</uri>
        </author>
        <author>
            <name>Benjamin Eckel</name>
            <uri>https://github.com/bhelx</uri>
        </author>
        <category label="Wasm" term="Wasm"/>
        <category label="Chicory" term="Chicory"/>
    </entry>
</feed>