AOT 检测是什么意思?

What does AOT instrumentation mean?

我知道字节码检测是什么。它只是在运行时更改 .class 文件字节码,这似乎从 JDK 1.5 开始可用。但是,据说是在 class 加载期间而不是运行时。

现在我的问题是,什么是 AOT 或提前检测?相反的程序是什么?随着时间的推移仪器?

Instrumenting Your Code
Quasar fibers rely on bytecode instrumentation. This can be done at classloading time via a Java Agent, or at compilation time with an Ant task.

Running the Instrumentation
Java Agent Quasar’s lightweight thread implementation relies on bytecode instrumentation. Instrumentation can be performed at compilation time (detailed below) or at runtime using a Java agent. To run the Java agent, the following must be added to the java command line (or use your favorite build tool to add this as a JVM argument):

-javaagent:path-to-quasar-jar.jar

Ahead-of-Time (AOT) Instrumentation
The easy and preferable way to instrument programs using Quasar is with the Java agent, which instruments code at runtime. Sometimes, however, running a Java agent is not an option.

Quasar supports AOT instrumentation with an Ant task. The task is co.paralleluniverse.fibers.instrument.InstrumentationTask found in quasar-core.jar, and it accepts a fileset of classes to instrument. Not all classes will actually be instrumented – only those with suspendable methods (see below) – so simply give the task all of the class files in your program. In fact, Quasar itself is instrumented ahead-of-time.

Source

提前 (AOT) compilation/instrumentation 就是这样,它发生在 运行 程序之前。

AOT 的对立面是 Just-in-time,即 JIT。它发生在运行时。在 Java 中,class 加载是在 运行时 完成的,并且有 fiddle 的机制。

在您的示例中,AOT 检测是通过 运行 程序之前的 Ant 任务完成的,并将更改写入 .class 文件。

另一种可能的方法是使用 Java 代理进行 JIT。在这种情况下,在加载 class 时在运行时进行检测,并且结果不会写入文件,而是必须在每次加载 class 时重新执行。

有关详细信息,请参阅 Wikipedia/Ahead-of-time-compilation and Wikipedia/Just-in-time-compilation