src/hotspot/share/services/dtraceAttacher.cpp
changeset 55479 80b27dc96ca3
parent 55005 9b70ebd131b4
child 57876 30db6422848b
equal deleted inserted replaced
55478:ae2e53e379cb 55479:80b27dc96ca3
     1 /*
     1 /*
     2  * Copyright (c) 2006, 2019, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2006, 2018, 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 
    36 static void set_bool_flag(const char* flag, bool value) {
    53 static void set_bool_flag(const char* flag, bool value) {
    37   JVMFlag::boolAtPut((char*)flag, strlen(flag), &value,
    54   JVMFlag::boolAtPut((char*)flag, strlen(flag), &value,
    38                               JVMFlag::ATTACH_ON_DEMAND);
    55                               JVMFlag::ATTACH_ON_DEMAND);
    39 }
    56 }
    40 
    57 
    55     changed = true;
    72     changed = true;
    56   }
    73   }
    57 
    74 
    58   if (changed) {
    75   if (changed) {
    59     // one or more flags changed, need to deoptimize
    76     // one or more flags changed, need to deoptimize
    60     CodeCache::mark_all_nmethods_for_deoptimization();
    77     VM_DeoptimizeTheWorld op;
    61     Deoptimization::deoptimize_all_marked();
    78     VMThread::execute(&op);
    62   }
    79   }
    63 }
    80 }
    64 
    81 
    65 // Disable only the "fine grained" flags. Do *not* touch
    82 // Disable only the "fine grained" flags. Do *not* touch
    66 // the overall "ExtendedDTraceProbes" flag.
    83 // the overall "ExtendedDTraceProbes" flag.
    78     set_bool_flag("DTraceMonitorProbes", false);
    95     set_bool_flag("DTraceMonitorProbes", false);
    79     changed = true;
    96     changed = true;
    80   }
    97   }
    81   if (changed) {
    98   if (changed) {
    82     // one or more flags changed, need to deoptimize
    99     // one or more flags changed, need to deoptimize
    83     CodeCache::mark_all_nmethods_for_deoptimization();
   100     VM_DeoptimizeTheWorld op;
    84     Deoptimization::deoptimize_all_marked();
   101     VMThread::execute(&op);
    85   }
   102   }
    86 }
   103 }
    87 
   104 
    88 // Do clean-up on "all door clients detached" event.
   105 // Do clean-up on "all door clients detached" event.
    89 void DTrace::detach_all_clients() {
   106 void DTrace::detach_all_clients() {