Skip to content

Project Terminus: Self-hosting Native ImageΒ #12236

@dougxc

Description

@dougxc

TL;DR

Terminus will make it possible for Native Image to be self-hosted. That is, Native Image will be able to produce and image of itself such that it runs as a native executable without any need for an underlying JVM such as HotSpot.

This will be achieved by using separate heaps at build time.

  • The host heap will be used for host types and data structures.
  • An Espresso context with its own heap will be used for guest types and data structures.

This avoids complications due to state being mixed between host classes and guest classes.

This is a work in progress but aspects of the current design are outlined here:

  • Load both user and SubstrateVM runtime classes into an Espresso context. JDK classes are then loaded twice, once in host and once in Espresso. Each has its own copy of static fields.
  • Perform closed world analysis exclusively on Espresso loaded types.
  • No more ability to convert an arbitrary AnalysisType to a java.lang.Class instance.
  • Run user features within the Espresso context. Provide necessary data structures and access to the host system for external features via Espresso interoperability.
  • TBD: Audit internal features for "guest" vs "host" build time code and run it in the right context.
  • Change host code to use JVMCI instead of core reflection when accessing Espresso context types (e.g., Class, Method, Field are replaced with ResolvedJavaType, ResolvedJavaMethod, ResolvedJavaField).

"Terminus" is the Roman god of borders. This project is about drawing a much stronger "border" between the native image generator and the application it's building.

Goals

  • Build Native Image as a native executable that does not need a host JVM.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

In Progress

Relationships

None yet

Development

No branches or pull requests

Issue actions