Skip to content

[GR-79193][Native Image] Ristretto: enterprise byte[] arraycopy with INIT_LOCATION has no descriptor #14312

Description

@sgammon

Describe the Issue

Ristretto's runtime compiler cannot lower a fast byte[] arraycopy whose killed location is INIT_LOCATION. The Oracle GraalVM enterprise arraycopy descriptor lookup throws:

UnsupportedFeatureError: Fast ArrayCopy on byte, uninit false, killing INIT_LOCATION not supported yet.

The runtime compilation is abandoned and affected methods remain interpreted. A minimal Maven project triggers the unsupported shape during startup. In the current run, 5 of 94 compilations failed (5%); Maven itself still completed successfully, so this is a silent performance fallback apart from the stderr warning.

This is distinct from general fast-arraycopy support: the enterprise provider supports primitive copies only when the killed location equals the kind's array location, but this lowering requests LocationIdentity.init().

Using the latest version of GraalVM can resolve many issues.

  • Reproduced with the latest available Oracle GraalVM EA build.

GraalVM Version

java version "25.0.4.1" 2026-08-18 LTS
Oracle GraalVM 25.3.4.1-dev+0.1 (build 25.0.4.1+0-LTS-jvmci-25.3-b21)
Substrate VM Oracle GraalVM 25.3.4.1-dev+0.1 (serial gc, compressed references)

Also reproduced previously with Oracle GraalVM 25.2.4+7.1 on linux-amd64.

Operating System and Version

macOS 26.5 (Darwin 25.5.0), arm64. Also reproduced on Linux 6.6 / WSL2, amd64.

Troubleshooting Confirmation

  • I tried the suggestions in the Native Image troubleshooting guide.

Run Command

With a Crema/Ristretto image installed as JAVA_HOME:

JAVA_HOME=/path/to/runtime mvn clean

Expected Behavior

The byte[] arraycopy should lower to a valid foreign call descriptor, so runtime compilation can complete.

Actual Behavior

SubstrateEnterpriseArrayCopyLookup.lookupArraycopyDescriptor rejects the byte, uninit=false, INIT_LOCATION tuple. Affected methods fall back to the interpreter and the systemic compilation detector warns on stderr.

Steps to Reproduce

Create this pom.xml in an empty directory:

<project xmlns="http://maven.apache.org/POM/4.0.0">
  <modelVersion>4.0.0</modelVersion>
  <groupId>demo</groupId>
  <artifactId>demo</artifactId>
  <version>1.0</version>
</project>

Then run Maven 3.9.x with a -H:+RuntimeClassLoading -H:+GraalJITCompileAtRuntime Oracle GraalVM native-image runtime as JAVA_HOME:

mkdir -p target/classes
touch target/classes/marker
JAVA_HOME=/path/to/runtime mvn clean

On a cold Maven cache the extra startup/download work makes the failure especially easy to observe. It also reproduced repeatedly in prior warm-cache runs on linux-amd64 (9/82, 10/85, and 13/87 failed compilations).

I do not yet have a smaller standalone Java program. Hot guest loops over Arrays.copyOf(byte[], int), Arrays.copyOfRange, System.arraycopy, ByteArrayOutputStream.toByteArray, String.getBytes, and byte[].clone() did not produce this lowering shape. The minimal Maven project above is deterministic enough to reproduce the compiler request, but the exact Maven/JDK method producing it is not named by the systemic warning.

Additional Context

The failing provider is in svm-enterprise.jar, not the open tree. Inspecting the implementation from the same distribution shows that primitive, initialized copies are accepted only when:

!uninit && killedLocation.equals(NamedLocationIdentity.getArrayLocation(kind))

INIT_LOCATION is therefore the rejected dimension; uninit=false is the supported side and is misleading in the exception text.

The open HotSpot provider already models this dimension. HotSpotHostForeignCallsProvider.lookupArraycopyDescriptor distinguishes killInit and selects from [aligned][disjoint][killInit], with descriptors registered using LocationIdentity.init(). That suggests the enterprise SVM table needs an equivalent killInit dimension, although the correct implementation is necessarily an upstream decision.

There is no downstream interception point: ArrayCopyCallNode.lower asks SubstrateForeignCallsProvider, whose registered enterprise delegate rejects the tuple. Disabling that feature is not a workaround; without a delegate, all fast array copies are unsupported.

Run-Time Log Output and Error Messages

Warning: Systemic Graal compilation failure detected: 5 of 94 (5%) of compilations failed
during last 806 ms [max rate set by SystemicCompilationFailureRate is 1%].
Current failure: com.oracle.svm.core.jdk.UnsupportedFeatureError:
Fast ArrayCopy on byte, uninit false, killing INIT_LOCATION not supported yet.
    at org.graalvm.nativeimage.shared/com.oracle.svm.shared.util.VMError.unsupportedFeature(VMError.java:123)
    at com.oracle.svm.svm_enterprise/com.oracle.svm.enterprise.core.copying.SubstrateEnterpriseArrayCopyLookup.lookupArraycopyDescriptor(ArrayCopyForeignCallsFeature.java:96)
    at org.graalvm.nativeimage.builder/com.oracle.svm.core.graal.meta.SubstrateForeignCallsProvider.lookupArraycopyDescriptor(SubstrateForeignCallsProvider.java:104)
    at jdk.graal.compiler/jdk.graal.compiler.replacements.arraycopy.ArrayCopyCallNode.lower(ArrayCopyCallNode.java:188)
    at jdk.graal.compiler/jdk.graal.compiler.phases.common.LoweringPhase.process(LoweringPhase.java:712)
    ...
    at org.graalvm.nativeimage.builder/com.oracle.svm.interpreter.ristretto.RistrettoUtils.compileAndInstallForPublication(RistrettoUtils.java:365)

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions