src/hotspot/share/services/dtraceAttacher.cpp
changeset 58226 408c445d04e8
parent 57876 30db6422848b
child 58679 9c3209ff7550
equal deleted inserted replaced
58225:4eebb9aadbe3 58226:408c445d04e8
     1 /*
     1 /*
     2  * Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2006, 2019, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    31 #include "runtime/vmOperations.hpp"
    31 #include "runtime/vmOperations.hpp"
    32 #include "services/dtraceAttacher.hpp"
    32 #include "services/dtraceAttacher.hpp"
    33 
    33 
    34 #ifdef SOLARIS
    34 #ifdef SOLARIS
    35 
    35 
    36 class VM_DeoptimizeTheWorld : public VM_Operation {
       
    37  public:
       
    38   VMOp_Type type() const {
       
    39     return VMOp_DeoptimizeTheWorld;
       
    40   }
       
    41   void doit() {
       
    42     CodeCache::mark_all_nmethods_for_deoptimization();
       
    43     ResourceMark rm;
       
    44     DeoptimizationMarker dm;
       
    45     // Deoptimize all activations depending on marked methods
       
    46     Deoptimization::deoptimize_dependents();
       
    47 
       
    48     // Mark the dependent methods non entrant
       
    49     CodeCache::make_marked_nmethods_not_entrant();
       
    50   }
       
    51 };
       
    52 
       
    53 static void set_bool_flag(const char* name, bool value) {
    36 static void set_bool_flag(const char* name, bool value) {
    54   JVMFlag* flag = JVMFlag::find_flag(name);
    37   JVMFlag* flag = JVMFlag::find_flag(name);
    55   JVMFlag::boolAtPut(flag, &value, JVMFlag::ATTACH_ON_DEMAND);
    38   JVMFlag::boolAtPut(flag, &value, JVMFlag::ATTACH_ON_DEMAND);
    56 }
    39 }
    57 
    40 
    72     changed = true;
    55     changed = true;
    73   }
    56   }
    74 
    57 
    75   if (changed) {
    58   if (changed) {
    76     // one or more flags changed, need to deoptimize
    59     // one or more flags changed, need to deoptimize
    77     VM_DeoptimizeTheWorld op;
    60     CodeCache::mark_all_nmethods_for_deoptimization();
    78     VMThread::execute(&op);
    61     Deoptimization::deoptimize_all_marked();
    79   }
    62   }
    80 }
    63 }
    81 
    64 
    82 // Disable only the "fine grained" flags. Do *not* touch
    65 // Disable only the "fine grained" flags. Do *not* touch
    83 // the overall "ExtendedDTraceProbes" flag.
    66 // the overall "ExtendedDTraceProbes" flag.
    95     set_bool_flag("DTraceMonitorProbes", false);
    78     set_bool_flag("DTraceMonitorProbes", false);
    96     changed = true;
    79     changed = true;
    97   }
    80   }
    98   if (changed) {
    81   if (changed) {
    99     // one or more flags changed, need to deoptimize
    82     // one or more flags changed, need to deoptimize
   100     VM_DeoptimizeTheWorld op;
    83     CodeCache::mark_all_nmethods_for_deoptimization();
   101     VMThread::execute(&op);
    84     Deoptimization::deoptimize_all_marked();
   102   }
    85   }
   103 }
    86 }
   104 
    87 
   105 // Do clean-up on "all door clients detached" event.
    88 // Do clean-up on "all door clients detached" event.
   106 void DTrace::detach_all_clients() {
    89 void DTrace::detach_all_clients() {