RFR: 8329126: No native wrappers generated anymore with -XX:-TieredCompilation after JDK-8251462 [v3]

Volker Simonis simonis at openjdk.org
Wed Mar 27 19:15:21 UTC 2024


On Wed, 27 Mar 2024 16:18:37 GMT, Igor Veresov <iveresov at openjdk.org> wrote:

> Regarding the solution. You seem to be tapping into the `is_method_profiled()` functionality and applying the threshold rule meant for methods with MDOs, which is a bit hacky. How about a more straightforward way:
> 
> ```
> diff --git a/src/hotspot/share/compiler/compilationPolicy.cpp b/src/hotspot/share/compiler/compilationPolicy.cpp
> index d61de7cc866..57173ed621c 100644
> --- a/src/hotspot/share/compiler/compilationPolicy.cpp
> +++ b/src/hotspot/share/compiler/compilationPolicy.cpp
> @@ -1026,7 +1026,7 @@ CompLevel CompilationPolicy::common(const methodHandle& method, CompLevel cur_le
>    if (force_comp_at_level_simple(method)) {
>      next_level = CompLevel_simple;
>    } else {
> -    if (is_trivial(method)) {
> +    if (is_trivial(method) || method->is_native()) {
>        next_level = CompilationModeFlag::disable_intermediate() ? CompLevel_full_optimization : CompLevel_simple;
>      } else {
>        switch(cur_level) {
> ```
> 
> What do you think? Would that work?

I think it will work, but wouldn't that instantly create a native wrapper for *every* native method? Shouldn't we only create native wrappers for hot native methods?

> Have you found out why exact are the wrappers not created with `-XX:-TieredCompilation` ? I don't see any conditional with `is_native()` that would prevent that?

The reason why they are not created is because native methods have no MDO so we always bail out here:

      case CompLevel_full_profile:
        {
          MethodData* mdo = method->method_data();
          if (mdo != nullptr) {
            if (mdo->would_profile() || CompilationModeFlag::disable_intermediate()) {
              int mdo_i = mdo->invocation_count_delta();
              int mdo_b = mdo->backedge_count_delta();
              if (Predicate::apply(method, cur_level, mdo_i, mdo_b)) {
                next_level = CompLevel_full_optimization;
              }
            } else {
              next_level = CompLevel_full_optimization;
            }
          }

-------------

PR Comment: https://git.openjdk.org/jdk/pull/18496#issuecomment-2023771418
PR Comment: https://git.openjdk.org/jdk/pull/18496#issuecomment-2023777728


More information about the hotspot-compiler-dev mailing list