RFR: 8295060: Port PrintDeoptimizationDetails to UL

Johan Sjölen jsjolen at openjdk.org
Wed Oct 12 08:31:07 UTC 2022


On Wed, 12 Oct 2022 00:04:01 GMT, David Holmes <dholmes at openjdk.org> wrote:

>> src/hotspot/share/runtime/vframeArray.cpp line 338:
>> 
>>> 336: 
>>> 337: #ifndef PRODUCT
>>> 338:   auto log_deopt = [](int i, intptr_t* addr) {
>> 
>> This usage of lambdas is needed to avoid crossing initialization in the switch statement.
>
> ?? I only see one usage in the switch statement so don't understand why this is not inline as normal logging code would be.

I should've said "crosses initialization error", not "crossing."

Check out this SO question: https://stackoverflow.com/questions/11578936/getting-a-bunch-of-crosses-initialization-error

So `LogTarget(Debug, deoptimization) lt;` is the error here. I *think* that we can inline it if we introduce a surrounding  scope, is that preferable to you?

So:


case T_OBJECT:
*addr = value->get_int(T_OBJECT);
{ // Scope off LogTarget
    LogTarget(Debug, deoptimization) lt;
    if (lt.is_enabled()) {
      LogStream ls(lt);
      ls.print(" - Reconstructed expression %d (OBJECT): ", i);
      oop o = cast_to_oop((address)(*addr));
      if (o == NULL) {
        ls.print_cr("NULL");
      } else {
        ResourceMark rm;
        ls.print_raw_cr(o->klass()->name()->as_C_string());
      }
    }
}

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

PR: https://git.openjdk.org/jdk/pull/10645


More information about the hotspot-dev mailing list