diff --git a/compiler-maven-plugin/src/main/java/run/endive/build/time/maven/EndiveCompilerGenMojo.java b/compiler-maven-plugin/src/main/java/run/endive/build/time/maven/EndiveCompilerGenMojo.java index a0304507a..87327d102 100644 --- a/compiler-maven-plugin/src/main/java/run/endive/build/time/maven/EndiveCompilerGenMojo.java +++ b/compiler-maven-plugin/src/main/java/run/endive/build/time/maven/EndiveCompilerGenMojo.java @@ -74,9 +74,7 @@ public class EndiveCompilerGenMojo extends AbstractMojo { /** * Fully qualified name of a MethodPrefixer implementation used to name the compiled methods. * Defaults to naming them func_0, func_1 and so on. Set it to - * run.endive.compiler.NameSectionMethodPrefixer to name them after the module's name section, - * which makes thread dumps and profiler output readable, or to your own implementation. A - * custom class must be a dependency of this plugin, not of the project. + * run.endive.compiler.NameSectionMethodPrefixer to name them after the module's name section. */ @Parameter(required = false) String methodPrefixer; diff --git a/docs/docs/execution/build-time-compiler.md b/docs/docs/execution/build-time-compiler.md index da8123301..71f3fe790 100644 --- a/docs/docs/execution/build-time-compiler.md +++ b/docs/docs/execution/build-time-compiler.md @@ -39,11 +39,9 @@ If this happens you can configure your build tool, to just issue warning message ### Method Names -By default the compiler names each generated method `func_0`, `func_1`, etc. The `methodPrefixer` -parameter takes the fully qualified name of a `MethodPrefixer` implementation that supplies a more -recognisable prefix instead, which makes thread dumps, profiler output and stack traces identify -functions by name. `NameSectionMethodPrefixer` uses the function names from the module's name -section: +By default the compiler names each generated method `func_0`, `func_1`, etc. Set `methodPrefixer` to +name them after the module's name section instead, so that thread dumps, profiler output and stack +traces identify functions by name: ```xml @@ -53,38 +51,12 @@ section: ``` -You can name your own implementation instead, for example one that demangles Rust or C++ symbols. -It must implement `run.endive.compiler.MethodPrefixer` and have a public no-argument constructor. -The class is loaded by the plugin, so it has to be a dependency of the plugin declaration rather -than of the project: +The names are resolved at build time and baked into the generated classes; the name section itself is +not shipped with them. -```xml - - run.endive - endive-compiler-maven-plugin - - - org.acme - my-demangler - 1.0.0 - - - - -``` - -Names are resolved once, at build time. This is the only opportunity to do so: the meta Wasm module -emitted next to the compiled classes has all of its custom sections stripped, so the name section is -no longer available when the module is loaded. Resolving names here also costs nothing at runtime. - -Whatever the prefixer returns, the compiler appends `_` to produce the method name, so names -stay unique and the Wasm function index remains recoverable from any method name. Characters that are -illegal in JVM method names (`. ; [ / < >`) are replaced with underscores. The prefix is a hint for -humans; tools should use the function index instead. See -[Method Names](runtime-compiler.md#method-names) for the full contract. - -Since the name section is not retained, mapping a function index back to its original name requires -the original Wasm module, which is a build input rather than something shipped with the classes. +The parameter accepts any `run.endive.compiler.MethodPrefixer` with a public no-argument constructor, +declared as a dependency of the plugin. See [Method Names](runtime-compiler.md#method-names) for the +naming contract. ## Using Maven @@ -241,9 +213,7 @@ endive:compile Fully qualified name of a MethodPrefixer implementation used to name the compiled methods. Defaults to naming them func_0, func_1 and so on. Set it to run.endive.compiler.NameSectionMethodPrefixer to name them after - the module's name section, which makes thread dumps and profiler output - readable, or to your own implementation. A custom class must be a - dependency of this plugin, not of the project. + the module's name section. moduleInterface Fully qualified name of the user's class for which to generate