{"record":{"id":"f5818d365e64466c","repo":"oracle/graal","slug":"emitting-code-to-return-the-current-value-of-the-p","errorCode":null,"errorMessage":"Emitting code to return the current value of the procid is not currently supported on %s","messagePattern":"Emitting code to return the current value of the procid is not currently supported on (.+?)","errorType":"exception","errorClass":"GraalError","httpStatus":null,"severity":"error","filePath":"compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/lir/gen/LIRGeneratorTool.java","lineNumber":1042,"sourceCode":"     * Read contents of the protection key register.\n     *\n     * @return value read from the register\n     */\n    default Value emitProtectionKeyRegisterRead() {\n        throw new GraalError(\"Emitting code to read the contents of the protection key register is not currently supported on %s\", target().arch);\n    }\n\n    default VirtualStackSlot allocateStackMemory(int sizeInBytes, int alignmentInBytes) {\n        return getResult().getFrameMapBuilder().allocateStackMemory(sizeInBytes, alignmentInBytes);\n    }\n\n    default Value emitTimeStamp() {\n        throw new GraalError(\"Emitting code to return the current value of the timestamp counter is not currently supported on %s\", target().arch);\n    }\n\n    @SuppressWarnings(\"unused\")\n    default void emitProcid(AllocatableValue dst) {\n        throw new GraalError(\"Emitting code to return the current value of the procid is not currently supported on %s\", target().arch);\n    }\n\n    default Value emitReadCallerStackPointer(Stamp wordStamp) {\n        /*\n         * We do not know the frame size yet. So we load the address of the first spill slot\n         * relative to the beginning of the frame, which is equivalent to the stack pointer of the\n         * caller.\n         */\n        return emitAddress(StackSlot.get(getLIRKind(wordStamp), 0, true));\n    }\n\n    default Value emitReadReturnAddress(Stamp wordStamp, int returnAddressSize) {\n        return emitMove(StackSlot.get(getLIRKind(wordStamp), -returnAddressSize, true));\n    }\n\n    @SuppressWarnings(\"unused\")\n    default void emitZeroMemory(Value address, Value length, boolean isAligned) {\n        throw GraalError.unimplemented(\"Bulk zeroing is not implemented on this architecture\"); // ExcludeFromJacocoGeneratedReport","sourceCodeStart":1024,"sourceCodeEnd":1060,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/lir/gen/LIRGeneratorTool.java#L1024-L1060","documentation":"emitProcid(AllocatableValue) defaults to throwing GraalError in LIRGeneratorTool, listing the architecture in the message. It represents emitting code that returns the processor ID; only backends that implement it can compile nodes lowering to this operation. The @SuppressWarnings(\"unused\") parameter signals this is a pure capability hook.","triggerScenarios":"Lowering a procid node/intrinsic while compiling on any backend whose LIRGenerator does not override emitProcid. The failing architecture appears in the interpolated %s.","commonSituations":"NUMA-aware or per-CPU affinity code reading processor identifiers; new architecture ports where the intrinsic was not wired up; language runtimes probing hardware topology inside JIT-compiled code.","solutions":["Obtain the processor ID through a supported channel (runtime call / OS API) instead of the compiler intrinsic","Guard the lowering of the procid node on target().arch so it is only emitted on backends implementing it","Implement emitProcid in the backend's LIRGenerator if the architecture has such an instruction"],"exampleFix":"// before\n@NodeIntrinsic public static native long procid();\nreturn procid(); // throws on unported backends\n\n// after\nif (supportsProcid(arch)) { return procid(); }\nreturn OsBridge.getThreadId();","handlingStrategy":"validation","validationCode":"if (backendOverrides(lirGen.getClass(), \"emitProcid\")) {\n    id = gen.emitProcid(dst);\n} else {\n    id = callOsThreadSelf(); // portable fallback\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Retrieve processor/CPU identity via runtime APIs rather than compiler intrinsics unless per-arch support is confirmed","Add arch guards in node lowering for capability-style operations","Maintain backend coverage tests for every emit* capability you use"],"tags":["graalvm","lir","backend","procid","unsupported-operation"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}