{"record":{"id":"d888be921c6d7b33","repo":"oracle/graal","slug":"osr-with-stack-entries-not-supported-s","errorCode":null,"errorMessage":"OSR with stack entries not supported: %s","messagePattern":"OSR with stack entries not supported: (.+?)","errorType":"exception","errorClass":"PermanentBailoutException","httpStatus":null,"severity":"error","filePath":"compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/phases/OnStackReplacementPhase.java","lineNumber":356,"sourceCode":"     *\n     * @return a bit set with a bit set for each local variable that contains a live oop at\n     *         {@code bci}\n     */\n    private static BitSet getOopMapAt(ResolvedJavaMethod method, int bci) {\n        return ((HotSpotResolvedJavaMethod) method).getOopMapAt(bci);\n    }\n\n    private static EntryMarkerNode getEntryMarker(StructuredGraph graph) {\n        NodeIterable<EntryMarkerNode> osrNodes = graph.getNodes(EntryMarkerNode.TYPE);\n        EntryMarkerNode osr = osrNodes.first();\n        if (osr == null) {\n            throw new GraalError(\"No OnStackReplacementNode generated\");\n        }\n        if (osrNodes.count() > 1) {\n            throw new GraalError(\"Multiple OnStackReplacementNodes generated\");\n        }\n        if (osr.stateAfter().stackSize() != 0) {\n            throw new PermanentBailoutException(\"OSR with stack entries not supported: %s\", osr.stateAfter().toString(Verbosity.All));\n        }\n        return osr;\n    }\n\n    private static LoopBeginNode osrLoop(EntryMarkerNode osr, CoreProviders providers) {\n        // Check that there is an OSR loop for the OSR begin\n        LoopsData loops = providers.getLoopsDataProvider().getLoopsData(osr.graph());\n        CFGLoop<HIRBlock> l = loops.getCFG().getNodeToBlock().get(osr).getLoop();\n        if (l == null) {\n            return null;\n        }\n        return (LoopBeginNode) l.getHeader().getBeginNode();\n    }\n\n    private static boolean osrWithLocks(EntryMarkerNode osr) {\n        return osr.stateAfter().locksSize() != 0;\n    }\n","sourceCodeStart":338,"sourceCodeEnd":374,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/hotspot/phases/OnStackReplacementPhase.java#L338-L374","documentation":"PermanentBailoutException thrown by OnStackReplacementPhase.getEntryMarker when the EntryMarkerNode's frame state has a non-empty operand stack (stackSize() != 0). An OSR entry with live operand-stack entries cannot be reconstructed as a normal compilation start, so Graal bails out permanently (with the full frame state appended to the message).","triggerScenarios":"HotSpot requests OSR at a bci whose interpreter frame has values on the expression stack — e.g. the loop backedge bci sits in the middle of an expression, or the OSR trigger point is between operand pushes; parser produces an EntryMarkerNode whose stateAfter carries stack slots.","commonSituations":"Specific bytecode shapes where the OSR invocation point is not at a stack-empty position (long chained expressions inside hot loops); typically transient — the method usually gets OSR-compiled at another bci or runs interpreted. Mostly seen by compiler developers when frontend changes alter frame states.","solutions":["Accept the bailout: execution continues in the interpreter; often a later OSR at a different bci succeeds.","If it is performance-critical, restructure the hot loop so the loop header is at a stack-empty position (avoid splitting expressions across the backedge).","Compiler developers: dump the graph at OnStackReplacement initial and inspect osr.stateAfter() to see which stack entries survive."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    compileResult = compile(task);\n} catch (PermanentBailoutException e) {\n    if (e.getMessage().startsWith(\"OSR with stack entries not supported\")) {\n        // interpreter continues; a later OSR at another bci may succeed\n    }\n}","preventionTips":["Avoid splitting long expressions across loop backedges in extremely hot code.","Treat this as a compiler limitation signal, not an application bug."],"tags":["graalvm","osr","frame-state","compiler","bailout"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}