AgentSkillsCN

tracing-inlining-decisions

在编译过程中,通过调用树直观展示内联决策及其背后的原因——哪些调用会被内联,哪些则不会。借助此工具,您可以验证关键调用是否已被内联,深入了解内联失败的具体原因(如调用过大、存在递归调用或触及边界限制),并据此优化方法的规模。良好的内联效果,往往能显著提升编译效率。对于递归函数,“未内联”这一结果也在意料之中——这正是字节码 DSL 的固有局限所致。

SKILL.md
--- frontmatter
name: tracing-inlining-decisions
description: Shows inlining decisions during compilation with call tree and reasons for inline/don't-inline. Use to verify critical calls are inlined, understand why inlining failed (too large, recursive, boundary), and optimize method sizes. Good inlining = better compilation. Recursive functions show 'not inlined' - expected behavior for Bytecode DSL limitation.

Tracing Inlining Decisions

Shows inlining decisions during compilation with call tree structure and reasons. Essential for understanding why calls aren't being optimized.

When to Use This Skill

  • Verify critical calls are being inlined
  • Understand why inlining failed
  • Optimize method sizes for better inlining
  • Debug recursive function compilation

Quick Start

bash
# Basic inlining trace
<launcher> --experimental-options \
  --engine.TraceInlining <program>

# Combined with compilation trace (RECOMMENDED)
<launcher> --experimental-options \
  --engine.TraceInlining \
  --engine.TraceCompilation \
  <program> 2>&1 | tee inlining.log

# Focus on specific function
<launcher> --experimental-options \
  --engine.TraceInlining \
  --engine.CompileOnly="*hotFunction*" \
  <program>

⚠️ REQUIRED: Fermi Verification (Every Tool Invocation)

Before running:

  • Pre-calculate: Expected hot helper functions to inline (list 2-5 function names)
  • Smoke test: <launcher> --experimental-options --engine.TraceInlining -c 'print 1;' → Verify inlining decisions appear

After running:

  • Validate: Critical functions inlined as expected? YES / NO
  • If NO: Document why (budgetExhausted, TooLarge, TruffleBoundary)
  • Save output: tool-outputs/trace-inlining-[benchmark].txt

Gate: All boxes checked? → Proceed to analysis

Key Options

OptionDescription
--engine.TraceInliningShow inlining decisions
--engine.TraceInliningDetailsDetailed reasoning
--engine.CompileOnly=<name>Filter to specific function

Understanding Output

Inlined Successfully

code
[engine] Inlined: hasConflict
  Reason: trivialSize

Not Inlined

code
[engine] Not inlined: recursiveFunc
  Reason: RecursiveInlining
code
[engine] Not inlined: bigFunction
  Reason: budgetExhausted

Inlining Reasons

Good (Inlined)

ReasonMeaning
trivialSizeSmall enough to inline
forced@Specialization forced inline
relevantDeemed performance-relevant

Bad (Not Inlined)

ReasonMeaningFix
RecursiveInliningRecursive callExpected for recursion
budgetExhaustedInlining budget usedReduce method sizes
TooLargeMethod too bigSplit method
TruffleBoundaryMarked as boundaryReview boundary usage
notRelevantNot performance-criticalMay be OK

Problem Patterns

Pattern 1: Budget Exhausted for Hot Functions

Symptom: Critical function not inlined due to budget Fix: Reduce sizes of other methods, or increase budget

Pattern 2: Unexpected Boundary

Symptom: Hot call not inlined due to TruffleBoundary Fix: Remove boundary if not needed, or restructure

Pattern 3: Too Many Recursive Levels

Symptom: Recursive function shows "RecursiveInlining" Expected: Normal for recursive algorithms (Bytecode DSL limitation)

Integration with Other Skills

FindingNext Skill
Budget issuesRefactor code, reduce sizes
BoundariesReview TruffleBoundary usage
Still slowprofiling-with-cpu-sampler

Related Skills

  • profiling-with-cpu-sampler - Identify hot functions first
  • tracing-compilation-events - Overall compilation status
  • detecting-performance-warnings - Find barriers
  • fetching-truffle-documentation - API reference

Reference

bash
<launcher> --help:engine | grep -i inlin