<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Vasily Levchenko on Medium]]></title>
        <description><![CDATA[Stories by Vasily Levchenko on Medium]]></description>
        <link>https://medium.com/@vvlevchenko?source=rss-eb455d0babe------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*7emGUkePDM3qvvQQ.</url>
            <title>Stories by Vasily Levchenko on Medium</title>
            <link>https://medium.com/@vvlevchenko?source=rss-eb455d0babe------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 00:55:41 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@vvlevchenko/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Hexana for VS Code 0.3.0 release — WASM run targets, JAR/ZIP browsing]]></title>
            <link>https://medium.com/@vvlevchenko/hexana-for-vs-code-0-3-0-release-wasm-run-targets-jar-zip-browsing-36357f4ed71e?source=rss-eb455d0babe------2</link>
            <guid isPermaLink="false">https://medium.com/p/36357f4ed71e</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[vscode-extension]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[webassembly]]></category>
            <category><![CDATA[vscode]]></category>
            <dc:creator><![CDATA[Vasily Levchenko]]></dc:creator>
            <pubDate>Sat, 13 Jun 2026 15:12:19 GMT</pubDate>
            <atom:updated>2026-06-13T15:12:19.729Z</atom:updated>
            <content:encoded><![CDATA[<h3>Running WebAssembly on NodeJS or the Browser from VS Code — Hexana 0.3.0</h3><p><em>Hexana for VS Code 0.3.0 release notes.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YG0aIPFx-cV6pXLgpwu8AA.png" /></figure><p><strong>TL;DR.</strong> Hexana for VS Code 0.3.0 adds NodeJS and browser as WASM run targets in run configurations (run-only — no debug yet), adds JAR/ZIP browsing with binary entries opening through the hex viewer, and improves debugging stability on Windows. Requires VS Code 1.102+(preview).</p><h3>What Hexana for VS Code is</h3><p>Hexana for VS Code is an extension that makes compiled artifacts — WebAssembly modules and native binaries (ELF/Mach-O/PE) — first-class things you can open and read in the editor. It is a binary-aware editor companion, not a disassembler or reverse-engineering toolkit, and it complements your existing tooling.</p><h3>NodeJS and browser as WASM run targets</h3><p>0.3.0 adds two new runtimes to WASM run configurations: NodeJS and the browser. These join the existing run/debug options. The honest scope: NodeJS and browser are <strong>run-only</strong> in this release — debug support for them is not yet available. The existing wasmtime/WAMR debug paths are unchanged. The selected runtime is remembered between runs, and when more than one is available you get a picker.</p><h3>JAR/ZIP browsing</h3><p>Open a .jar or .zip (the editor also handles .war/.apk) and Hexana lists the archive entries; clicking an entry opens it in a new tab, and binary entries — WASM modules, class files, nested jars — route through the hex viewer automatically. It keeps archive inspection inside the editor instead of an external unzip-and-open dance.</p><h3>Windows debugging</h3><p>Debugging on Windows gets better breakpoint detection and overall stability in this release.</p><h3>Get it</h3><ul><li><strong>VS Code Marketplace (preview, 1.102+):</strong> <a href="https://marketplace.visualstudio.com/items?itemName=JetBrains.hexana-wasm">https://marketplace.visualstudio.com/items?itemName=JetBrains.hexana-wasm</a></li><li><strong>Open VSX:</strong> <a href="https://open-vsx.org/extension/JetBrains/hexana-wasm">https://open-vsx.org/extension/JetBrains/hexana-wasm</a></li><li><strong>Docs:</strong> <a href="https://jetbrains.github.io/hexana">https://jetbrains.github.io/hexana</a></li></ul><p><em>(The JetBrains IDEs 0.11 release — GraalVM native-image SBOM + CVE reachability — has its own, meatier notes.)</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=36357f4ed71e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hexana 0.11 (JetBrains IDEs) release — native-image SBOM + CVE]]></title>
            <link>https://medium.com/@vvlevchenko/hexana-0-11-jetbrains-ides-release-native-image-sbom-cve-107e585a4cf9?source=rss-eb455d0babe------2</link>
            <guid isPermaLink="false">https://medium.com/p/107e585a4cf9</guid>
            <category><![CDATA[security]]></category>
            <category><![CDATA[graalvm]]></category>
            <category><![CDATA[webassembly]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[development]]></category>
            <dc:creator><![CDATA[Vasily Levchenko]]></dc:creator>
            <pubDate>Fri, 12 Jun 2026 05:10:12 GMT</pubDate>
            <atom:updated>2026-06-12T05:10:12.455Z</atom:updated>
            <content:encoded><![CDATA[<h3>Reading a GraalVM Native Image’s SBOM — and Its Reachable CVEs — Inside the IDE</h3><p><em>Hexana 0.11 (JetBrains IDEs) release notes.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o1eMUbNhE5CaLrs16qC2AA.png" /></figure><p><strong>TL;DR.</strong> Hexana 0.11 for JetBrains IDEs detects GraalVM native-image binaries, renders the CycloneDX SBOM they embed, and matches it against the OSV vulnerability database — overlaying CVSS severity, fixed version, and advisory link. Because native-image performs dead-code elimination, every component in that SBOM was actually retained in the binary, and --enable-sbom=class-level refines further to &quot;vulnerable class retained&quot; vs &quot;eliminated by DCE.&quot; 0.11 also adds NodeJS and browser as WASM run/debug runtimes. Hexana is a binary-aware IDE companion — it complements your SCA tooling, it doesn&#39;t replace it.</p><h3>Why a native-image binary is hard to audit</h3><p>When you ship a JVM application as a GraalVM Native Image, the artifact you distribute is an ELF, Mach-O, or PE executable. There are no class files inside it. A software-composition tool that scans JAR manifests or pom.xml files in the distribution finds nothing useful. You need something that understands what native-image actually embedded — and, ideally, what it <em>kept</em>, since native-image aggressively eliminates unreachable code.</p><p>Hexana 0.11 addresses detection, the SBOM itself, and reachability.</p><h3>Detection</h3><p>Native executables and shared libraries produced by native-image are recognized by their SubstrateVM fingerprint — the com.oracle.svm.core.VM=GraalVM … identity string, .svm_*/__svm* sections, and the __svm_version_info marker — and tagged with a &quot;Native Image&quot; badge whose tooltip shows version, edition, and target platform. Because the identity string lives in read-only data, detection survives release stripping.</p><h3>The CycloneDX SBOM viewer</h3><p>Oracle GraalVM for JDK 25 enables --enable-sbom by default, so native-image embeds a CycloneDX bill of materials directly in the binary. Hexana 0.11 surfaces an &quot;SBOM&quot; badge and a dedicated tab:</p><ul><li>a metadata header — subject, timestamp, generating tool;</li><li>a searchable, sortable component table — type, group, name, version, licenses, PURL;</li><li>a “View raw JSON” action for the decompressed document.</li></ul><h3>CVE reachability: retained vs eliminated</h3><p>The viewer alone is table stakes. The reachability overlay is the interesting part. Hexana matches the embedded component list against the OSV database and overlays known CVEs with CVSS severity, the fixed version, and an advisory link.</p><p>What’s specific to native-image: the SBOM reflects the post-DCE, closed-world binary — native-image does not embed components it pruned, so a component listed here was in the reachable set at build time. With --enable-sbom=class-level, native-image embeds a compiled-in class/method tree, and Hexana uses it to separate &quot;vulnerable class retained&quot; from &quot;eliminated by DCE.&quot; That&#39;s a tighter signal than manifest-level scanning, where unused transitive dependencies still show up as findings.</p><p>Matching is offline by default — the database is downloaded once and the component list never leaves your machine — with an opt-in to also query osv.dev online. It is off until enabled in Settings → Tools → Hexana.</p><h3>WASM runtimes and Windows stability</h3><p>0.11 adds NodeJS and browser as WASM run/debug runtimes; debug is Chrome only, over the Chrome DevTools Protocol. It also improves WASM breakpoint handling on Windows.</p><h3>Get it</h3><ul><li><strong>JetBrains IDEs (IntelliJ IDEA 2026.1+):</strong> <a href="https://plugins.jetbrains.com/plugin/29090-hexana">https://plugins.jetbrains.com/plugin/29090-hexana</a></li><li><strong>Docs:</strong> <a href="https://jetbrains.github.io/hexana">https://jetbrains.github.io/hexana</a></li></ul><p><em>(A separate VS Code 0.3.0 release — NodeJS/browser run targets and JAR/ZIP browsing — has its own notes.)</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=107e585a4cf9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Seeing C2’s Machine Code Made the Optimization Obvious]]></title>
            <link>https://medium.com/@vvlevchenko/seeing-c2s-machine-code-made-the-optimization-obvious-6fcd1cbc90fc?source=rss-eb455d0babe------2</link>
            <guid isPermaLink="false">https://medium.com/p/6fcd1cbc90fc</guid>
            <category><![CDATA[claude]]></category>
            <category><![CDATA[claude-code]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[compilers]]></category>
            <category><![CDATA[jvm]]></category>
            <dc:creator><![CDATA[Vasily Levchenko]]></dc:creator>
            <pubDate>Thu, 11 Jun 2026 07:02:36 GMT</pubDate>
            <atom:updated>2026-06-11T07:02:36.363Z</atom:updated>
            <content:encoded><![CDATA[<p><em>What happens when you can read HotSpot’s output side-by-side with your bytecode — and two ways to cut a hot interpreter from 385 to 26 ns/op.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sc9Q7TBNNZ5m-knsro893A.png" /></figure><p><strong>TL;DR.</strong> I pointed a JIT viewer — one that shows what HotSpot’s C2 actually compiled a method into, side-by-side with the bytecode it came from — at a bytecode interpreter running a fixed 16-round kernel. The machine-code dump made the problem visible in seconds. Then I tried two routes to fix it: a classic ASM-agent trick and a hand-written JVMCI compiler. The simpler one won.</p><p><strong>The Gap C2 Cannot Close on Its Own</strong></p><p>A stack-machine bytecode interpreter with a while(true) switchdispatch loop is a canonical case where a general-purpose JIT struggles. C2 compiles <em>run</em> for every possible caller and every possible program, so it keeps:</p><ul><li>a full opcode compare/branch tree for each instruction,</li><li>the operand stack as a heap-allocated <em>long[] </em>with bounds checks on every push/pop,</li><li>code[pc++] re-fetched and bounds-checked every iteration.</li></ul><p>None of that is removable by C2: it doesn’t know the program is fixed at compile time. I could see this directly in a JIT viewer that captures what C2 compiled a hot method into and renders the machine code side-by-side with the bytecode it came from. In the dump, the pattern was unmistakable: roughly <strong>1.5 KB of dispatch + bounds-check + deopt stubs</strong> sitting next to bytecode that is, semantically, sixteen rounds of straight-line <em>long</em> arithmetic.</p><p>That gap is the whole opportunity, and you can point at it.</p><p><strong>Baseline</strong> (Apple Silicon, JVMCI-enabled JBR jbr21, JMH avgt, -f 0):</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/61e5695539fd1d14538a11b93f38d406/href">https://medium.com/media/61e5695539fd1d14538a11b93f38d406/href</a></iframe><p><em>All verified correct on 4096 distinct inputs. Arithmetic: 385/33 ≈ 11.7, 385/26 ≈ 14.8.</em></p><p><strong>Route 1: Give C2 the Right Shape</strong></p><p>The instrumentation route uses a -javaagent built with ASM to rewrite run at class-load time:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/795cc30849cf62c0a90f52a4ba0fe4b2/href">https://medium.com/media/795cc30849cf62c0a90f52a4ba0fe4b2/href</a></iframe><p>matcheschecks whether the incomingcode[]is the program we specialized for.eval` is the partial-evaluated body: no dispatch, no operand stack, constants folded, rounds unrolled. You hand C2 a method shaped so it can do its best work, and it inlines and optimizes to near the hand-written ceiling.</p><p>The result: <strong>26 ns/op, ~15×</strong> over the generic C2 baseline.</p><p>What’s notable here is what you <em>didn’t</em> do. No compiler was written. No machine code was emitted. The transformation reaches back to java.lang.instrument, part of the platform since <strong>Java 5</strong> — so the same pattern applies to legacy JVM applications going back twenty years. Give C2 the right shape; it closes the gap for free.</p><p><strong>Route 2: Become the Compiler</strong></p><p>A custom JVMCI compiler (JEP 243) lets you intercept compilation for a specific method and emit machine code directly, bypassing C2. The compiler ignores every method except run; for run, it reads the fixed code[] and consts[] via constant reflection at compile time and emits straight-line AArch64:</p><ul><li>operand stack held in registers rather than on the heap,</li><li>PUSH_CONST / SHR instructions folded to immediates,</li><li>an identity guard that deopts back to the interpreter if a caller passes a different program.</li></ul><p>That guard is what makes this safe to install as a default nmethod. At entry, the compiled code compares the incoming code[] and consts[] against the exact arrays it specialized for. On a match it runs the straight-line body; on a mismatch it traps — handing control back to HotSpot, which reconstructs the interpreter frame from the recorded debug info and re-executes run normally with the original arguments. So the specialization is opportunistic, not a correctness bet: any program it wasn&#39;t built for falls back to the interpreter, exactly as if the compiler had never been there.</p><p>This is the first Futamura projection, implemented by hand. The result: <strong>33 ns/op, ~12×.</strong></p><p>The co-author on this part was Claude Opus 4.8. About 130 lines of new AArch64 bit-field encodings and 330 lines of partial-evaluator logic are new work. Around 550 lines in the compiler module are vendored from the JDK’s own JVMCI test assembler (GPL-licensed) — that scaffolding is there in the repo; judge it yourself.</p><p><strong>The Entry-Barrier Wall</strong></p><p>The first install attempt failed with:</p><pre>nmethod entry barrier is missing</pre><p>JDK 17 introduced a mandatory nmethod entry barrier: HotSpot rejects a JVMCI-installed nmethod without it <em>and</em> verifies its exact instruction pattern. The fix is not obvious from the public documentation.</p><p>After a fan-out of AI sub-agents (HotSpot/JBR internals, AArch64, JVMCI) reverse-engineering the contract, the working sequence is: an ldr-literal guard load pointing to a DataSection word with a section_word relocation, then a compare against the thread&#39;s disarmed_offset, then a conditional branch to skip, then the barrier stub call if not disarmed.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0836d041536ad5842135195a01878c36/href">https://medium.com/media/0836d041536ad5842135195a01878c36/href</a></iframe><p>That emitter is the real “systems-heavy” part of the project. Everything else is arithmetic; this one required reading HotSpot’s verifier path directly.</p><p><strong>The Honest Finding: Simpler Won</strong></p><p>The instrumentation route (26 ns) beat the custom JVMCI compiler (33 ns). The JVMCI compiler’s extra overhead comes from not yet deduplicating repeated constant loads — a known gap, not a fundamental ceiling. But the broader point stands: <strong>JVMCI’s value is control, not raw speed</strong>. When the goal is a transform C2 can be coaxed into with the right method shape, the ASM route is faster to write, safer to ship, and portable across JDKs without a JVMCI-enabled runtime.</p><p>The practical takeaway, if you’re staring at a hot method of your own: reach for the method <em>shape</em> before you reach for a compiler. Profile it, find the path C2 is compiling generically, and ask whether a guarded specialized variant would hand the JIT something it can actually optimize. That answers most cases. Keep JVMCI in reserve for the ones it genuinely can’t reach.</p><p>JVMCI becomes valuable for transforms C2 cannot be coaxed into at all — methods HotSpot refuses to compile because they exceed its ~8 KB huge-method bytecode limit and silently stay in the interpreter forever, or specializations that require runtime-constant folding C2’s analysis cannot prove. Those are the cases where a targeted compiler wins and the general JIT has already given up.</p><p><strong>JVMCI in the Wild</strong></p><p>In practice, JVMCI has one production consumer: GraalVM’s Graal compiler — both as a drop-in JVM JIT (-XX:+UseJVMCICompiler) and as the engine Truffle-based languages are partially-evaluated through: GraalWasm, GraalJS, TruffleRuby. Hand-writing a raw-JVMCI compiler for a single HotSpot Java method, as done here, is genuinely off the beaten path.</p><p>The open question that makes this interesting: <strong>could the same approach target any known hotspot</strong>, including the huge-method cases where HotSpot has already given up? The combination of a view that shows you <em>what the JIT actually produced</em> alongside the bytecode it came from, plus a targeted compiler that can step in where C2 won’t, makes that question tractable.</p><p><strong>Caveats</strong></p><p>These are lab numbers, not production results. One method, one fixed program, one machine (Apple Silicon, JBR jbr21). For the C2 and instrumentation rows, JVMCI is present in the JDK but not the active compiler — only the JVMCI row sets -XX:+UseJVMCICompiler. The JVMCI measurements use -f 0 (no forks) because with a custom top-tier compiler, there is no C2, and JMH forks cannot be used; everything except run runs at C1. The entry-barrier emitter touches a HotSpot-internal detail that is version-specific. This is a demonstration, not something to ship.</p><p><strong>What to Read Next</strong></p><p>Code, both compilers, full RESULTS.md: <a href="https://github.com/minamoto79/interpreter-benchmark">interpreter-benchmark</a></p><p>If you want the view that made this analysis possible — C2 machine code next to bytecode, in the IDE, captured from your run configuration or JMH benchmark — that’s <strong>jitview</strong> in Hexana: <a href="https://plugins.jetbrains.com/plugin/29090-hexana">Hexana on JetBrains Marketplace</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6fcd1cbc90fc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[IPv6 #in Java On Darwin]]></title>
            <link>https://medium.com/@vvlevchenko/ipv6-in-java-on-darwin-72bf7cfbef45?source=rss-eb455d0babe------2</link>
            <guid isPermaLink="false">https://medium.com/p/72bf7cfbef45</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[mac]]></category>
            <category><![CDATA[ipv6]]></category>
            <dc:creator><![CDATA[Vasily Levchenko]]></dc:creator>
            <pubDate>Tue, 21 Jun 2016 19:38:53 GMT</pubDate>
            <atom:updated>2016-06-21T19:38:53.183Z</atom:updated>
            <content:encoded><![CDATA[<p>For the couple last years I’d been involved in development of several java libraries for home made map reduce implementations as secondrary priority projects. Everything were going more or less good until our clusters became IPv6 only and our internal customers analytics inverted in java from Python camp :) (poor guys) start to gave up and blaming of inability java to handle IPv6 correctly on theirs Mac Airs.</p><p>To reproduce the issue it’s enough to create really small class which will try to create socket with IPv6 address here it is:</p><pre># cat src/main/java/junk/minamoto/IPv6Test.java<br>package junk.minamoto;</pre><pre>import java.net.InetAddress;<br>import java.net.Socket;</pre><pre>/**<br> * Created by minamoto on 01/06/16.<br> */<br>public class IPv6Test {<br> public static void main(String[] arg) throws Exception {<br> InetAddress addr = InetAddress.getByName(“2a02:6b8:a::a”); /* yandex.ru */<br> Socket socket = new Socket(addr, 80, null, 0);<br> }<br>}</pre><p>With out any modification the output will be the following:</p><pre># $JAVA -Djava.net.preferIPv6Addresses=true -cp target/classes junk.minamoto.IPv6Test<br>Exception in thread “main” java.net.NoRouteToHostException: No route to host<br> at java.net.PlainSocketImpl.socketConnect(Native Method)<br> at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350)<br> at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)<br> at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)<br> at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)<br> at java.net.Socket.connect(Socket.java:589)<br> at java.net.Socket.connect(Socket.java:538)<br> at java.net.Socket.&lt;init&gt;(Socket.java:434)<br> at java.net.Socket.&lt;init&gt;(Socket.java:328)<br> at junk.minamoto.IPv6Test.main(IPv6Test.java:13)</pre><p>To understand the problem I’d tried honestly to build full jdk from the sources … But I’d been really surprised with dependencies it requires to have Xcode 4. Huh, it something from 201o? It’s rather lazy to install separately Xcode 4 and so on, especially thath I needed only one library libnet.dylib from whole java package. Tadam and rather elegant <a href="https://github.com/vvlevchenko/darwin-net-jvm/blob/master/Makefile">Makefile</a> (at least I found it so) helped me to achieve the goal.</p><p>Other surprise were waiting me later when I’d prepare lldb and zillion casting to debug both native and java sides…</p><pre># DYLD_LIBRARY_PATH=/Users/minamoto/ws/ipv6 $JAVA -Djava.net.preferIPv6Addresses=true -cp target/classes junk.minamoto.IPv6Test<br># echo $?<br>0</pre><p>The application just launched and finished as required without any issues and the problems with IPv6. Also my colleges which have tried to this build were happy to debug and launch their application without moving them to Linux hosts just on theirs Mac machines.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=72bf7cfbef45" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>