Skip to content

Parse bytecode only once when building a native image #4923

@christianwimmer

Description

@christianwimmer

TL;DR

Historically, the native image generator parsed the bytecode of each method (at least) twice: once for static analysis, and then again for AOT compilation. This limits the amount of optimizations that can be performed before the static analysis runs. Bytecode should be parsed only once before static analysis.

Goals

  • Enable the option -H:+ParseOnce in all configurations, and then remove the option completely.
  • Enable optimizations that depend on "parse once", like method inlining before static analysis, also for images contain Truffle languages.

Details

Parsing the bytecode only once is already available and the default for most native images: only when the native image uses JIT compilation and deotimization, i.e., only when a Truffle language is included in the image, bytecode is still parsed multiple times. Fixing this requires a significant re-work of how the image generator handles JIT compilation and deoptimization.

Metadata

Metadata

Labels

Type

No type

Projects

Status

Released

Relationships

None yet

Development

No branches or pull requests

Issue actions