{"record":{"id":"035b1a223a2d5666","repo":"oracle/graal","slug":"linearscan-no-register-found","errorCode":null,"errorMessage":"LinearScan: no register found","messagePattern":"LinearScan: no register found","errorType":"exception","errorClass":"OutOfRegistersException","httpStatus":null,"severity":"critical","filePath":"compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/lir/alloc/lsra/LinearScanWalker.java","lineNumber":1060,"sourceCode":"                    if (firstUsage <= interval.from() + 1) {\n                        if (registerPriority.equals(RegisterPriority.LiveAtLoopEnd)) {\n                            /*\n                             * Tool of last resort: we can not spill the current interval so we try\n                             * to spill an active interval that has a usage but do not require a\n                             * register.\n                             */\n                            debug.log(\"retry with register priority must have register\");\n                            continue;\n                        }\n                        String description = generateOutOfRegErrorMsg(interval, firstUsage, availableRegs);\n                        /*\n                         * assign a reasonable register and do a bailout in product mode to avoid\n                         * errors\n                         */\n                        allocator.assignSpillSlot(interval);\n                        debug.dump(DebugContext.INFO_LEVEL, allocator.getLIR(), description);\n                        allocator.printIntervals(description);\n                        throw new OutOfRegistersException(\"LinearScan: no register found\", description);\n                    }\n\n                    splitAndSpillInterval(interval, reg, regUsePos);\n                    return;\n                } else {\n                    if (debug.isLogEnabled()) {\n                        debug.log(\"not able to spill current interval. firstUsage(register): %d, usePos: %d\", firstUsage, regUsePos);\n                    }\n                }\n                break;\n            }\n\n            // Fortify: Suppress Null Dereference false positive\n            assert reg != null;\n\n            boolean needSplit = blockPos[reg.number] <= intervalTo;\n\n            int splitPos = blockPos[reg.number];","sourceCodeStart":1042,"sourceCodeEnd":1078,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/lir/alloc/lsra/LinearScanWalker.java#L1042-L1078","documentation":"Thrown by LinearScanWalker when register allocation cannot satisfy an interval: no free register exists, the current interval cannot be spilled, and even the retry with register priority 'must have register' (for intervals with a pinned first usage) fails. The allocator assigns a spill slot, dumps/logs the detailed description, and rethrows as OutOfRegistersException so the compilation aborts cleanly instead of producing broken code.","triggerScenarios":"A live interval's first usage requires a specific register class where all allocatable registers of that class are occupied by other pinned intervals; trySplitWhenSpillingException / splitAndSpillInterval cannot free anything. Common with highly vector-heavy or floating-point code where the allocatable set for the platform kind is small, or when many intervals have fixed-register constraints at the same program point (e.g., calling conventions, native method handles).","commonSituations":"Long expressions with many simultaneously-live values of the same kind (SIMD vectors, FP doubles), aggressive inlining producing one huge method, custom backends with a reduced allocatable-register set, or huge method signatures forcing many fixed registers at once.","solutions":["Split the offending method into smaller methods to shorten live ranges and reduce peak register pressure","Reduce inlining pressure around the failing code (e.g., lower inline thresholds or mark hot helpers @TruffleBoundary/not-inlinable)","Run with -Dgraal.Dump=:2 and -Dgraal.PrintInlining=true to confirm which method/method context fails, then target that method","If using a custom RegisterConfiguration, verify the allocatable register set for the affected kind is not accidentally empty or too small","File a GraalVM issue with the dump: the detailed out-of-reg message (generateOutOfRegErrorMsg) identifies the interval and usage"],"exampleFix":"// before: many simultaneously live vectors exhaust the SIMD register file\ndouble r = a0.add(a1).add(a2).add(a3)...add(a15).x;\n\n// after: stage intermediates through locals that die early / reorder to shorten live ranges\nvar t0 = a0.add(a1); var t1 = a2.add(a3);\ndouble r = t0.add(t1).x;","handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    result = compile(method);\n} catch (OutOfRegistersException e) {\n    // compilation failed cleanly; recompile without the aggressive config or run interpreted\n    result = compileWithoutInlining(method); // or mark method non-compilable temporarily\n}","preventionTips":["Avoid extremely long expressions with many simultaneously-live values of one kind; stage intermediates","Watch -Dgraal.PrintInlining output for methods that inline into giant units","If building a custom backend, validate allocatable-register sets for every kind you emit"],"tags":["graalvm","register-allocation","lsra","out-of-registers"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}