Dumps and analyzes Graal IR compiler graphs showing optimization decisions. Use BGV format with bgv2json/seafoam to inspect escape analysis, boxing removal, inlining decisions, and call node types. Reveals what compiler actually optimized vs intended. Use as last resort after basic profiling when root cause remains unclear. (project)
Dumps and analyzes Graal IR compiler graphs showing optimization decisions.
/plugin marketplace add antonykamp/cc-truffle-performance-plugin/plugin install antonykamp-cc-truffle-performance-plugin@antonykamp/cc-truffle-performance-pluginThis skill inherits all available tools. When active, it can use any tool Claude has access to.
DUMPING.mdPATTERNS.mdQUERIES.mdDeep-dive tool for understanding Graal compiler optimization decisions at the IR level. Dumps BGV files and analyzes them to reveal exactly what the compiler optimized.
Use AFTER simpler profiling tools when:
Prerequisites:
# Basic dump for Truffle compilations
EXTRA_JAVA_ARGS="-Djdk.graal.Dump=Truffle:1 \
-Djdk.graal.PrintGraph=File \
-Djdk.graal.DumpPath=compiler_graphs" \
<launcher> <program>
# Focused dump for specific method (recommended)
EXTRA_JAVA_ARGS="-Djdk.graal.Dump=Truffle:1 \
-Djdk.graal.MethodFilter='*hotFunction*' \
-Djdk.graal.DumpPath=compiler_graphs" \
<launcher> --engine.CompileOnly='*hotFunction*' <program>
# Get help
seafoam help
# Describe graph characteristics
seafoam --json compiler_graphs/*.bgv.gz:2 describe
# Render to SVG
seafoam compiler_graphs/*.bgv.gz:2 render > graph.svg
bgv2json compiler_graphs/*.bgv > graphs.json
See DUMPING.md for detailed dump options. See QUERIES.md for jq analysis queries.
Before dumping graphs:
After dumping:
ls -lh compiler_graphs/*.bgvAfter analyzing graphs:
tool-outputs/compiler-graph-analysis-[function].txtGate: All boxes checked? → Proceed to interpretation
| Phase | Purpose | What to Check |
|---|---|---|
| After TruffleTier | Most important | Direct calls, constant nodes, no VirtualFrame refs |
| After PartialEscape | Allocation elimination | Zero allocation nodes if EA worked |
| Final | Generic Graal optimizations | Overall node reduction |
seafoam --json file.bgv.gz:2 describe | \
jq '.node_counts | to_entries | .[] | select(.key | contains("Call"))'
Good: OptimizedDirectCallNode
Bad: OptimizedIndirectCallNode, InvokeNode
cat graphs.json | jq 'select(.name | contains("After PartialEscape")) |
.nodes[] | select(.props.label | test("Alloc|New"))'
Good: Empty output
Bad: CommitAllocationNode, NewInstanceNode present
seafoam --json file.bgv.gz:2 describe | \
jq '.node_counts | to_entries | .[] | select(.key | test("Box|Unbox"))'
Good: Empty output
Bad: BoxNode, UnboxNode present
OptimizedDirectCallNode - Specialized calls ✅AddNode, MulNode, SubNode - Primitive arithmetic ✅ConstantNode - Constants from partial evaluation ✅OptimizedIndirectCallNode - Need caching ⚠️InvokeNode - Unspecialized method calls ⚠️CommitAllocationNode, NewInstanceNode - Escape analysis failed ⚠️BoxNode, UnboxNode - Missing primitive specializations ⚠️DeoptimizeNode in hot paths - Unstable assumptions ⚠️Fix: Add @Cached for CallTarget lookup
Fix: Keep object lifetime strictly local
Fix: Add primitive specializations
See PATTERNS.md for detailed fix examples.
gzip compiler_graphs/*.bgvprofiling-with-cpu-sampler - Identify hot functions FIRSTdetecting-performance-warnings - Find optimization barrierstracing-compilation-events - See compilation eventstracing-inlining-decisions - Check inliningdetecting-deoptimizations - Find instabilitiesfetching-truffle-documentation - API referenceThis skill should be used when the user asks to "create a hookify rule", "write a hook rule", "configure hookify", "add a hookify rule", or needs guidance on hookify rule syntax and patterns.
Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.