1ab705f60c
Adds a @pragma("vm:recognized", <kind>) to all recognized methods, where
<kind> is one of "intrinsic", "graph" or "other", corresponding to the
kind of recognized method.
When running in debug mode, it is checked that all recognized methods
are marked with the correct kind of pragma, and that all methods marked
with the pragma are in fact recognized.
This enables kernel-level analyses and optimizations to query whether
a method is recognized by the VM.
TEST=Asserts that check the correspondence both ways, covered by test
suite, in particular the various CompileAll tests that compile all code.
Change-Id: I12f3305c72a93ecb1aefae2d66e3d9a7dae23b44
Cq-Do-Not-Cancel-Tryjobs: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168951
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
1.8 KiB
1.8 KiB
VM-Specific Pragma Annotations
Pragmas for general use
These pragmas are part of the VM's API and are safe for use in external code.
| Pragma | Meaning |
|---|---|
vm:entry-point |
Defining entry-points into Dart code for an embedder or native methods |
vm:never-inline |
Never inline a function or method |
vm:prefer-inline |
Inline a function or method when possible |
Pragmas for internal use
These pragmas can cause unsound behavior if used incorrectly and therefore are only allowed within the core SDK libraries.
| Pragma | Meaning |
|---|---|
vm:exact-result-type |
Declaring an exact result type of a method |
vm:recognized |
Marking this as a recognized method |
Pragmas for internal testing
These pragmas are used for inspecting or modifying internal VM state and should be used exclusively by SDK tests.
They must be enabled with the --enable-testing-pragmas flag.
The names of these pragmas are prefixed with "testing".
Additionally, they are categorized into "safe" and "unsafe" forms: "safe" pragmas should not affect the behavior of the program and can be safely added anywhere, whereas "unsafe" pragmas may change the code's behavior or may cause the VM to crash if used improperly.
| Pragma | Meaning |
|---|---|
vm:testing.unsafe.trace-entrypoints-fn |
Observing which flow-graph-level entry-point was used when a function was called |