Skip to content

Commit 676ed13

Browse files
committed
[GR-62602] Throw consistent error type for unsafe accesses of static word fields
PullRequest: graal/20271
2 parents e97caec + 0e35d0b commit 676ed13

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/jdk/VarHandleFeature.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
import com.oracle.graal.pointsto.ObjectScanner;
3939
import com.oracle.graal.pointsto.meta.AnalysisField;
4040
import com.oracle.graal.pointsto.meta.AnalysisUniverse;
41+
import com.oracle.graal.pointsto.util.AnalysisError;
4142
import com.oracle.graal.pointsto.util.GraalAccess;
4243
import com.oracle.svm.core.StaticFieldsSupport;
4344
import com.oracle.svm.core.feature.AutomaticallyRegisteredFeature;
@@ -107,7 +108,7 @@ protected ResolvedJavaField findVarHandleField(Object varHandle, boolean guarant
107108

108109
if (guaranteeUnsafeAccessed) {
109110
AnalysisField aField = result instanceof AnalysisField ? (AnalysisField) result : ((HostedField) result).getWrapped();
110-
VMError.guarantee(aField.isUnsafeAccessed(), "Field not registered as unsafe accessed %s", aField);
111+
AnalysisError.guarantee(aField.isUnsafeAccessed(), "Field not registered as unsafe accessed %s", aField);
111112
}
112113

113114
return result;

substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/reflect/StaticFieldValidatorImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@
2525
package com.oracle.svm.hosted.reflect;
2626

2727
import com.oracle.graal.pointsto.meta.AnalysisField;
28+
import com.oracle.graal.pointsto.util.AnalysisError;
2829
import com.oracle.svm.core.StaticFieldsSupport;
2930
import com.oracle.svm.core.feature.AutomaticallyRegisteredImageSingleton;
3031
import com.oracle.svm.core.meta.SharedField;
3132
import com.oracle.svm.core.meta.SharedType;
32-
import com.oracle.svm.core.util.VMError;
3333

3434
import jdk.vm.ci.meta.ResolvedJavaField;
3535

@@ -46,6 +46,6 @@ public void hostedCheckFieldOffsetAllowed(ResolvedJavaField field) {
4646
wordType = ((SharedType) sField.getType()).isWordType();
4747
}
4848

49-
VMError.guarantee(!wordType, "static Word field offsets cannot be queried %s", field);
49+
AnalysisError.guarantee(!wordType, "static Word field offsets cannot be queried %s", field);
5050
}
5151
}

0 commit comments

Comments
 (0)