src/share/vm/runtime/deoptimization.hpp

Print this page


   1 /*
   2  * Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 






  25 class ProfileData;
  26 class vframeArray;
  27 class MonitorValue;
  28 class ObjectValue;
  29 
  30 class Deoptimization : AllStatic {
  31  public:
  32   // What condition caused the deoptimization?
  33   enum DeoptReason {
  34     Reason_many = -1,             // indicates presence of several reasons
  35     Reason_none = 0,              // indicates absence of a relevant deopt.
  36     // Next 7 reasons are recorded per bytecode in DataLayout::trap_bits
  37     Reason_null_check,            // saw unexpected null or zero divisor (@bci)
  38     Reason_null_assert,           // saw unexpected non-null or non-zero (@bci)
  39     Reason_range_check,           // saw unexpected array index (@bci)
  40     Reason_class_check,           // saw unexpected object class (@bci)
  41     Reason_array_check,           // saw unexpected array class (aastore @bci)
  42     Reason_intrinsic,             // saw unexpected operand to intrinsic (@bci)
  43     Reason_bimorphic,             // saw unexpected object class in bimorphic inlining (@bci)
  44 


 327   static UnrollBlock* fetch_unroll_info_helper(JavaThread* thread);
 328 
 329   static DeoptAction _unloaded_action; // == Action_reinterpret;
 330   static const char* _trap_reason_name[Reason_LIMIT];
 331   static const char* _trap_action_name[Action_LIMIT];
 332 
 333   static juint _deoptimization_hist[Reason_LIMIT][1+Action_LIMIT][BC_CASE_LIMIT];
 334   // Note:  Histogram array size is 1-2 Kb.
 335 
 336  public:
 337   static void update_method_data_from_interpreter(methodDataHandle trap_mdo, int trap_bci, int reason);
 338 };
 339 
 340 class DeoptimizationMarker : StackObj {  // for profiling
 341   static bool _is_active;
 342 public:
 343   DeoptimizationMarker()  { _is_active = true; }
 344   ~DeoptimizationMarker() { _is_active = false; }
 345   static bool is_active() { return _is_active; }
 346 };


   1 /*
   2  * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_RUNTIME_DEOPTIMIZATION_HPP
  26 #define SHARE_VM_RUNTIME_DEOPTIMIZATION_HPP
  27 
  28 #include "memory/allocation.hpp"
  29 #include "runtime/frame.inline.hpp"
  30 
  31 class ProfileData;
  32 class vframeArray;
  33 class MonitorValue;
  34 class ObjectValue;
  35 
  36 class Deoptimization : AllStatic {
  37  public:
  38   // What condition caused the deoptimization?
  39   enum DeoptReason {
  40     Reason_many = -1,             // indicates presence of several reasons
  41     Reason_none = 0,              // indicates absence of a relevant deopt.
  42     // Next 7 reasons are recorded per bytecode in DataLayout::trap_bits
  43     Reason_null_check,            // saw unexpected null or zero divisor (@bci)
  44     Reason_null_assert,           // saw unexpected non-null or non-zero (@bci)
  45     Reason_range_check,           // saw unexpected array index (@bci)
  46     Reason_class_check,           // saw unexpected object class (@bci)
  47     Reason_array_check,           // saw unexpected array class (aastore @bci)
  48     Reason_intrinsic,             // saw unexpected operand to intrinsic (@bci)
  49     Reason_bimorphic,             // saw unexpected object class in bimorphic inlining (@bci)
  50 


 333   static UnrollBlock* fetch_unroll_info_helper(JavaThread* thread);
 334 
 335   static DeoptAction _unloaded_action; // == Action_reinterpret;
 336   static const char* _trap_reason_name[Reason_LIMIT];
 337   static const char* _trap_action_name[Action_LIMIT];
 338 
 339   static juint _deoptimization_hist[Reason_LIMIT][1+Action_LIMIT][BC_CASE_LIMIT];
 340   // Note:  Histogram array size is 1-2 Kb.
 341 
 342  public:
 343   static void update_method_data_from_interpreter(methodDataHandle trap_mdo, int trap_bci, int reason);
 344 };
 345 
 346 class DeoptimizationMarker : StackObj {  // for profiling
 347   static bool _is_active;
 348 public:
 349   DeoptimizationMarker()  { _is_active = true; }
 350   ~DeoptimizationMarker() { _is_active = false; }
 351   static bool is_active() { return _is_active; }
 352 };
 353 
 354 #endif // SHARE_VM_RUNTIME_DEOPTIMIZATION_HPP