agentleFS
rainoftimerainoftime/pl-skills/graalvm-truffle-implementer/SKILL.md

graalvm-truffle-implementer

Skill17 starsChanged 9 months agoApache-2.0View on GitHub

Implements language runtimes using GraalVM Truffle framework. Use when:

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 3 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Start with correct interpreter, optimize later

    line 59
  2. Distinctive:

    Use profiles to guide specialization

    line 60
  3. Distinctive:

    Use Truffle libraries when available

    line 63

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

GraalVM Truffle Implementer

Implements language runtimes using the GraalVM Truffle framework for high-performance interpretation.

When to Use

  • Building interpreters for existing languages
  • Creating new programming languages
  • Achieving JIT performance without compilation
  • Building polyglot applications
  • Embedding multiple languages together

What This Skill Does

  1. Creates AST interpreters - Tree-walking interpreters
  2. Implements Truffle nodes - Specializable nodes
  3. Adds profiling - Runtime profiling for optimization
  4. Enables JIT compilation - Automatic JIT via Graal

Key Concepts

ConceptDescription
AST interpreterTree-walking execution
Node specializationType-specific fast paths
Polymorphic inline cacheCached type information
AssumptionCompilation hint
TruffleLanguageLanguage registration

Optimization Techniques

TechniqueDescription
SpecializationType-specific nodes
InliningInline function calls
AssumptionsStable property hints
DeoptimizationFall back to interpreter

Tips

  • Start with correct interpreter, optimize later
  • Use profiles to guide specialization
  • Implement all operations at least twice
  • Handle deoptimization gracefully
  • Use Truffle libraries when available

Related Skills

  • lambda-calculus-interpreter - Basic interpretation
  • jit-compiler-builder - JIT compilation
  • garbage-collector-implementer - Memory management
  • abstract-interpretation-engine - Static analysis

Canonical References

ReferenceWhy It Matters
Wöß et al., "Truffle: A Self-Optimizing Runtime System" (2014)Truffle paper
GraalVM DocumentationOfficial docs
SimpleLanguage TutorialReference implementation
Writing RPython in TruffleAdvanced patterns

Tradeoffs and Limitations

Approaches

ApproachProsCons
Pure TruffleFast, simpleJVM required
TruffleRubyFast RubyComplex
Guest languageExisting langsLess control

Limitations

  • Requires JVM (GraalVM)
  • Memory overhead for AST
  • Startup time
  • Complex debugging
  • Learning curve

Research Tools & Artifacts

Real-world Truffle implementations:

ToolWhy It Matters
TruffleRubyFast Ruby implementation
GraalJSJavaScript on Graal
FastRR implementation
SimpleLanguageReference implementation
SulongLLVM on Truffle

Key Languages

  • TruffleRuby: Fast Ruby via Truffle
  • GraalPython: Python on Graal

Research Frontiers

Current Truffle research:

DirectionKey PapersChallenge
Self-optimization"Truffle" paperAuto-optimization
Specialization"Specialization" (2018)Type specialization
Partial evaluation"Partial Evaluation"AOT compilation

Hot Topics

  1. Native image: NativeImage compilation
  2. Polyglot: Multi-language interop

Implementation Pitfalls

Common Truffle bugs:

PitfallReal ExamplePrevention
Deopt loopsSpecialization thrashingProfile carefully
MemoryAST node overheadReuse nodes
AssumptionAssumption violatedCheck assumption

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

Reviews can't be read right now.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.