readConstantField
public <T> T readConstantField(jdk.vm.ci.meta.ResolvedJavaField field,
org.graalvm.compiler.core.common.spi.ConstantFieldProvider.ConstantFieldTool<T> tool)
The CompilerDirectives.CompilationFinal annotation allows to mark arrays as stable so that array
elements can be constant folded. However, this constant folding must not happen during native
image generation: that would be too early since the array can still be modified before
compilation. So we disable the constant folding of such fields when preparing graphs, so that
during partial evaluation the TruffleConstantFieldProvider can do the correct
constant folding that takes stable array dimensions into account.
- Specified by:
readConstantField in interface org.graalvm.compiler.core.common.spi.ConstantFieldProvider