hotspot/src/share/vm/runtime/simpleThresholdPolicy.hpp
changeset 38133 78b95467b9f1
parent 33593 60764a78fa5c
child 38666 5ff19807abd5
equal deleted inserted replaced
38132:ba888a4f352a 38133:78b95467b9f1
     1 /*
     1 /*
     2  * Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2010, 2016, 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.
    79   template<CompLevel level> static inline bool call_predicate_helper(int i, int b, double scale, Method* method);
    79   template<CompLevel level> static inline bool call_predicate_helper(int i, int b, double scale, Method* method);
    80   template<CompLevel level> static inline bool loop_predicate_helper(int i, int b, double scale, Method* method);
    80   template<CompLevel level> static inline bool loop_predicate_helper(int i, int b, double scale, Method* method);
    81 
    81 
    82   // Get a compilation level for a given method.
    82   // Get a compilation level for a given method.
    83   static CompLevel comp_level(Method* method) {
    83   static CompLevel comp_level(Method* method) {
    84     nmethod *nm = method->code();
    84     CompiledMethod *nm = method->code();
    85     if (nm != NULL && nm->is_in_use()) {
    85     if (nm != NULL && nm->is_in_use()) {
    86       return (CompLevel)nm->comp_level();
    86       return (CompLevel)nm->comp_level();
    87     }
    87     }
    88     return CompLevel_none;
    88     return CompLevel_none;
    89   }
    89   }
    90   virtual void method_invocation_event(const methodHandle& method, const methodHandle& inlinee,
    90   virtual void method_invocation_event(const methodHandle& method, const methodHandle& inlinee,
    91                                        CompLevel level, nmethod* nm, JavaThread* thread);
    91                                        CompLevel level, CompiledMethod* nm, JavaThread* thread);
    92   virtual void method_back_branch_event(const methodHandle& method, const methodHandle& inlinee,
    92   virtual void method_back_branch_event(const methodHandle& method, const methodHandle& inlinee,
    93                                         int bci, CompLevel level, nmethod* nm, JavaThread* thread);
    93                                         int bci, CompLevel level, CompiledMethod* nm, JavaThread* thread);
    94 public:
    94 public:
    95   SimpleThresholdPolicy() : _c1_count(0), _c2_count(0) { }
    95   SimpleThresholdPolicy() : _c1_count(0), _c2_count(0) { }
    96   virtual int compiler_count(CompLevel comp_level) {
    96   virtual int compiler_count(CompLevel comp_level) {
    97     if (is_c1_compile(comp_level)) return c1_count();
    97     if (is_c1_compile(comp_level)) return c1_count();
    98     if (is_c2_compile(comp_level)) return c2_count();
    98     if (is_c2_compile(comp_level)) return c2_count();
   102   virtual void do_safepoint_work() { }
   102   virtual void do_safepoint_work() { }
   103   virtual void delay_compilation(Method* method) { }
   103   virtual void delay_compilation(Method* method) { }
   104   virtual void disable_compilation(Method* method) { }
   104   virtual void disable_compilation(Method* method) { }
   105   virtual void reprofile(ScopeDesc* trap_scope, bool is_osr);
   105   virtual void reprofile(ScopeDesc* trap_scope, bool is_osr);
   106   virtual nmethod* event(const methodHandle& method, const methodHandle& inlinee,
   106   virtual nmethod* event(const methodHandle& method, const methodHandle& inlinee,
   107                          int branch_bci, int bci, CompLevel comp_level, nmethod* nm, JavaThread* thread);
   107                          int branch_bci, int bci, CompLevel comp_level, CompiledMethod* nm, JavaThread* thread);
   108   // Select task is called by CompileBroker. We should return a task or NULL.
   108   // Select task is called by CompileBroker. We should return a task or NULL.
   109   virtual CompileTask* select_task(CompileQueue* compile_queue);
   109   virtual CompileTask* select_task(CompileQueue* compile_queue);
   110   // Tell the runtime if we think a given method is adequately profiled.
   110   // Tell the runtime if we think a given method is adequately profiled.
   111   virtual bool is_mature(Method* method);
   111   virtual bool is_mature(Method* method);
   112   // Initialize: set compiler thread count
   112   // Initialize: set compiler thread count