enso/docs/runtime/instruments.md
Radosław Waśko 033db71100
Add task fixing Instruments compilation. (#814)
Incremental compilation of instruments may lead to runtime errors when
only some of the instruments are recompiled (because the unchanged
instruments are not registered by the Annotation Processor).
To fix this, we add a task that ensures all instruments are recompiled
when at least one of them changes.
2020-06-08 13:56:03 +02:00

1.2 KiB

layout title category tags order
developer-doc Instruments runtime
runtime
instruments
6

Instruments

Instruments are used to track runtime events to allow for profiling, debugging and other kinds of behavior analysis at runtime.

Naming Conventions

Every Instrument must be implemented in Java and have name that ends with Instrument. This requirement is to ensure that the fix described below works.

Fixing Compilation

Annotations are used to register the implemented instruments with Graal. The annotation processor is triggered when recompiling the Java files. Unfortunately, when doing an incremental compilation, only the changed files are recompiled and the annotation processor 'forgets' about other instruments that haven't been recompiled, leading to runtime errors about missing instruments.

To fix that, we add the FixInstrumentsGeneration.scala task which detects changes to any of the instruments and forces recompilation of all instruments in the project by removing their classfiles.