oracle/graal · error · GraalError
Emitting code to write a value to the protection key registe
Error message
Emitting code to write a value to the protection key register is not currently supported on %s
What it means
LIRGeneratorTool declares emitProtectionKeyRegisterWrite(Value) as a default method that throws GraalError, naming the unsupported target architecture. It is the fallback implementation backends inherit when they have not implemented writing the protection key (PKRU/PKEY) register. Hitting it means frontend lowering reached a protection-key-write node on an architecture whose LIRGenerator does not support it.
Source
Thrown at compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/lir/gen/LIRGeneratorTool.java:1020
}
default void emitConvertZeroToNull(AllocatableValue result, Value input) {
emitMove(result, input);
}
/**
* Emits an instruction that prevents speculative execution from proceeding: no instruction
* after this fence will execute until all previous instructions have retired.
*/
void emitSpeculationFence();
/**
* Write value to the protection key register.
*
* @param value to be written
*/
default void emitProtectionKeyRegisterWrite(Value value) {
throw new GraalError("Emitting code to write a value to the protection key register is not currently supported on %s", target().arch);
}
/**
* Read contents of the protection key register.
*
* @return value read from the register
*/
default Value emitProtectionKeyRegisterRead() {
throw new GraalError("Emitting code to read the contents of the protection key register is not currently supported on %s", target().arch);
}
default VirtualStackSlot allocateStackMemory(int sizeInBytes, int alignmentInBytes) {
return getResult().getFrameMapBuilder().allocateStackMemory(sizeInBytes, alignmentInBytes);
}
default Value emitTimeStamp() {
throw new GraalError("Emitting code to return the current value of the timestamp counter is not currently supported on %s", target().arch);
}View on GitHub (pinned to a66e9ccd1d)
Solutions
- Guard the feature at the frontend: do not lower protection-key writes on architectures whose backend does not implement them (check target().arch in the node's lower())
- Implement emitProtectionKeyRegisterWrite in the relevant backend's LIRGenerator (see how existing intrinsics emit raw register writes)
- Disable the language/feature requiring protection keys on that architecture
Example fix
// before
@Override
public void lower(LoweringTool tool) {
getLIRGeneratorTool().emitProtectionKeyRegisterWrite(key);
}
// after
@Override
public void lower(LoweringTool tool) {
Architecture arch = graph().getProviders().getCodeCache().getTarget().arch;
if (!(arch instanceof SPARCArch)) { // only backends that implement it
throw GraalError.unsupported("protection keys not supported on " + arch);
}
getLIRGeneratorTool().emitProtectionKeyRegisterWrite(key);
} Defensive patterns
Strategy: validation
Validate before calling
// Frontend: only emit the operation on backends that implement it
if (backendOverrides(lirGen.getClass(), "emitProtectionKeyRegisterWrite")) {
gen.emitProtectionKeyRegisterWrite(value);
} else {
throw GraalError.unsupported("pkey write not available on " + arch);
} Prevention
- Gate intrinsics on target().arch in lower(), never assume every backend implements a capability hook
- Keep a capability matrix per backend when adding new LIRGeneratorTool operations
- Test new intrinsics on all supported architectures in CI
When it happens
Trigger: Lowering a node/intrinsic that emits a protection key register write (e.g., pkey write modeled via ProtectedWord / memory-protection intrinsics) while compiling for a backend (AMD64, AArch64 as of this code) whose LIRGenerator does not override emitProtectionKeyRegisterWrite.
Common situations: Running code using Intel MPK / protection-key APIs under a Graal configuration or architecture where the backend support is missing; new feature branches emitting the operation before all backends implement it.
Related errors
- Emitting code to read the contents of the protection key reg
- Emitting code to return the current value of the timestamp c
- Emitting code to return the current value of the procid is n
- injectProfiles during replay
- There are no allocatable registers for kind %s, consider ass
AI-assisted analysis of oracle/graal@a66e9ccd1d (2026-08-14).
Data as JSON: /api/errors/486465842bbec745.
Report an issue: GitHub.