Skip to content

Consider using Java agent for detecting transitively initialized classes #15

@borkdude

Description

@borkdude

See https://github.com/luontola/clojure-native-image-agent for an approach.

Benefit of the Java agent approach:

  • single segment namespaces would be supported (which is an anti-pattern, but still).
  • top-level instantiated Java classes would be also included in the config. One should always try to avoid this, so perhaps we should emit a warning if this happens, but it adds to the usability.

Downsides:

  • Must run Java agent after AOT-ing Clojure (on uberjar or classpath) which is an extra step compared to what we have now.

Questions:

  • Can we combine both approaches into one and run the Java agent during the native image build by shelling out to a different VM?
  • Is there another way of detecting transitively instantiated classes by e.g. inspecting bytecode?
  • Why doesn't GraalVM support this out of the box?
  • In practice the current basic approach is usually enough, so is it worth the extra complexity? Perhaps we should add an expert mode using a Java property that then invokes the agent.

@luontola Perhaps you're willing to team up?

Context: oracle/graal#3476 (reply in thread)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions