From e31b87d093b29b95104aa8b10bf4b280c0599ec4 Mon Sep 17 00:00:00 2001 From: Raphael Mosaner Date: Fri, 15 Dec 2023 10:11:54 +0100 Subject: [PATCH] [GR-49481] Document explicit NPE for GraphBuilderContext#nullCheckedValue. --- .../nodes/graphbuilderconf/GraphBuilderContext.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/nodes/graphbuilderconf/GraphBuilderContext.java b/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/nodes/graphbuilderconf/GraphBuilderContext.java index 3742b8bf73b8..23cc93d846c2 100644 --- a/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/nodes/graphbuilderconf/GraphBuilderContext.java +++ b/compiler/src/jdk.graal.compiler/src/jdk/graal/compiler/nodes/graphbuilderconf/GraphBuilderContext.java @@ -318,6 +318,11 @@ default boolean isPluginEnabled(GraphBuilderPlugin plugin) { BailoutException bailout(String string); + /** + * Gets a version of a given value that has a non-null stamp. Emits a guard or an explicit + * exception check which is triggered if the value is null. Thus, use only for values where + * the underlying bytecode can throw a {@link NullPointerException}! + */ default ValueNode nullCheckedValue(ValueNode value) { return nullCheckedValue(value, InvalidateReprofile); } @@ -336,8 +341,9 @@ default GuardingNode intrinsicRangeCheck(LogicNode condition, boolean negated) { } /** - * Gets a version of a given value that has a {@linkplain StampTool#isPointerNonNull(ValueNode) - * non-null} stamp. + * Gets a version of a given value that has a non-null stamp. Emits a guard or an explicit + * exception check which is triggered if the value is null. Thus, use only for values where + * the underlying bytecode can throw a {@link NullPointerException}! */ default ValueNode nullCheckedValue(ValueNode value, DeoptimizationAction action) { if (!StampTool.isPointerNonNull(value)) {