{"record":{"id":"c78f72e2ef681d41","repo":"oracle/graal","slug":"emitting-code-to-return-the-current-value-of-the-t","errorCode":null,"errorMessage":"Emitting code to return the current value of the timestamp counter is not currently supported on %s","messagePattern":"Emitting code to return the current value of the timestamp counter 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":1037,"sourceCode":"    default void emitProtectionKeyRegisterWrite(Value value) {\n        throw new GraalError(\"Emitting code to write a value to the protection key register is not currently supported on %s\", target().arch);\n    }\n\n    /**\n     * 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));","sourceCodeStart":1019,"sourceCodeEnd":1055,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/lir/gen/LIRGeneratorTool.java#L1019-L1055","documentation":"emitTimeStamp() is a default LIRGeneratorTool method that throws GraalError for architectures without an instruction to read the timestamp counter. Hitting it means lowering reached a 'read timestamp counter' node (e.g., an rdtsc-style intrinsic) on a backend that has not implemented the operation.","triggerScenarios":"Lowering a timestamp-counter node/intrinsic on a backend whose LIRGenerator does not override emitTimeStamp(). The offending architecture is printed in the message via target().arch.","commonSituations":"Benchmarks, entropy sources, or profiling code that reads hardware timestamps being JIT-compiled on an architecture without a ported rdtsc equivalent; new intrinsics added to the frontend before backend coverage.","solutions":["Replace the timestamp intrinsic with a supported mechanism on that platform (e.g., System.nanoTime(), a native call)","Gate the node's lowering on target().arch so unsupported architectures never emit it","Implement emitTimeStamp in the relevant backend LIRGenerator"],"exampleFix":"// before\n@NodeIntrinsic public static native long timeStamp();\n... timeStamp() ... // lowers on every arch, throws on unported ones\n\n// after\nif (arch instanceof AMD64) { emitTimeStamp(); } else { System.nanoTime(); }","handlingStrategy":"validation","validationCode":"if (backendOverrides(lirGen.getClass(), \"emitTimeStamp\")) {\n    ts = gen.emitTimeStamp();\n} else {\n    ts = emitNativeCallToClockMono(); // supported on every arch\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Prefer portable APIs (System.nanoTime) for timestamps in code compiled across architectures","Gate hardware-counter intrinsics on arch checks in lowering","Verify intrinsic support per backend before shipping cross-platform code"],"tags":["graalvm","lir","backend","timestamp","unsupported-operation"],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}