enso/docs/runtime
Pavel Marek f0de43a970
Add org.enso.compiler.dumpIr system prop (#10740)
Working on compiler IR is a daunting task. I have therefore added a new system property `enso.compiler.dumpIr` that will help with that. It dumps the encountered IRs to `ir-dumps` directory in the [GraphViz](www.graphviz.org) format. More info in updated docs.

Note that all the functionality to dump IRs to `dot` files was already implemented. This PR just adds the command line option and updates docs.

# Important Notes
- `--dump-graphs` cmd line option is removed as per [Jaroslav's request](https://github.com/enso-org/enso/pull/10740#pullrequestreview-2216676140).
- To dump graphs, use `-Dgraal.Dump=Truffle:2` system property passed via `JAVA_OPTS` env var.

If you run `env JAVA_OPTS='-Denso.compiler.dumpIr=true' enso --run tmp.enso` where `tmp.enso` is, e.g.:
```
from Standard.Base import all
main = 42
```
You will then have something like:
```
$ ls ir-dumps
Standard.Base.Data.Filter_Condition.dot     Standard.Base.Data.Time.dot              Standard.Base.System.Advanced.dot       Standard.Base.Warning.dot
Standard.Base.Data.Locale.dot               Standard.Base.Enso_Cloud.Enso_File.dot   Standard.Base.System.File.Advanced.dot  tmp.dot
Standard.Base.Data.Numeric.dot              Standard.Base.Errors.dot                 Standard.Base.System.File.dot
Standard.Base.Data.Numeric.Internal.dot     Standard.Base.Network.HTTP.Internal.dot  Standard.Base.System.File.Generic.dot
Standard.Base.Data.Text.Regex.Internal.dot  Standard.Base.Runtime.dot                Standard.Base.System.Internal.dot
```
You can then visualize any of these with `dot -Tsvg -O ir-dumps/tmp.dot`.

An example how that could look like is
![image.svg](https://github.com/user-attachments/assets/26ab8415-72cf-46da-bc63-f475e9fa628e)
2024-08-06 12:00:27 +00:00
..
builtin-base-methods.md Opt-in TCO (#1219) 2020-10-15 16:52:26 +02:00
caching.md [Gui2] Opening projects and language server connection (#7813) 2023-09-22 03:43:25 +00:00
compiler-ir.md Add org.enso.compiler.dumpIr system prop (#10740) 2024-08-06 12:00:27 +00:00
demand-analysis.md Add a markdown style guide (#1022) 2020-07-21 13:59:40 +01:00
execution-server-flow.md Add a markdown style guide (#1022) 2020-07-21 13:59:40 +01:00
function-call-flow.md Opt-in TCO (#1219) 2020-10-15 16:52:26 +02:00
instruments.md Register instruments/language in their own compilation units to fix the sbt build issues (#3509) 2022-06-13 14:09:08 +00:00
ir-caching.md Introduce hash seed to invaldiate caches (#9082) 2024-02-16 23:43:30 +00:00
README.md Add org.enso.compiler.dumpIr system prop (#10740) 2024-08-06 12:00:27 +00:00
runtime-features.md Add a markdown style guide (#1022) 2020-07-21 13:59:40 +01:00
searcher.md Remove SQL versions repo (#6242) 2023-04-11 19:22:30 +00:00
unbounded-recursion.md Add a markdown style guide (#1022) 2020-07-21 13:59:40 +01:00

layout title category tags order
section-summary Enso Runtime runtime
runtime
readme
0

Enso Runtime

The Enso runtime refers to both the compiler and the optimising JIT runtime for Enso. While this might seem like a strange choice, it makes sense internally as the components are integrated to a level not seen in most languages. It encompasses the following functionality:

  • Parsing: Taking Enso code as input and generating an AST that maintains a sophisticated set of information about the input.
  • Desugaring: Reducing the user-facing Enso code into a simplified language known as Core.
  • Type Inference: Inferring the types of bindings in the user's code.
  • Type Checking: Checking that the inferred and provided types for bindings match up across the codebase.
  • Optimisation: Static optimisation processes to improve the performance of the user's program.
  • Code Execution: Actually running the Enso code.
  • Introspection Hooks: Providing hooks into the running code to allow the language server to inspect information about the code as it runs.

This folder contains all of the documentation related to the runtime, which is broken up as follows:

  • Caching: A description of the runtime's value caching mechanism.
  • Demand Analysis: A specification for the demand analysis process in the Enso compiler that assists users with working with suspended computations.
  • Function Calling Flow: A description of the involved logic that goes into a calling a function performantly in the Enso runtime, while also supporting the flexible function syntax.
  • Runtime Features: A description of (and plan for) the features of the Enso runtime.
  • Unbounded Recursion: An exploration of techniques for achieving unbounded recursion on the JVM.
  • Instruments: A description of instrumentation in the language runtime.
  • Execution Server Flow: An explanation of how the execution server orchestrates Enso's execution.
  • Builtin Base Methods: An explanation of the DSL we use for defining builtin types and methods.
  • Searcher: An explanation of how the searcher works.
  • Instruments: An explanation of how we compile Truffle instrumentation.
  • Compiler IR: An explanation of the Enso compiler IR.
  • IR Caching: An explanation of how we cache the compiler IR to reduce startup times.