Print this page
rev 3108 : 7131259: compile_method and CompilationPolicy::event shouldn't be declared TRAPS
Summary: Make sure that CompilationPolicy::event() doesn't throw exceptions
Reviewed-by: kvn, never

Split Split Close
Expand all
Collapse all
          --- old/src/share/vm/runtime/simpleThresholdPolicy.hpp
          +++ new/src/share/vm/runtime/simpleThresholdPolicy.hpp
↓ open down ↓ 59 lines elided ↑ open up ↑
  60   60    int c1_count() const     { return _c1_count; }
  61   61    int c2_count() const     { return _c2_count; }
  62   62    void set_c1_count(int x) { _c1_count = x;    }
  63   63    void set_c2_count(int x) { _c2_count = x;    }
  64   64  
  65   65    enum EventType { CALL, LOOP, COMPILE, REMOVE_FROM_QUEUE, UPDATE_IN_QUEUE, REPROFILE, MAKE_NOT_ENTRANT };
  66   66    void print_event(EventType type, methodHandle mh, methodHandle imh, int bci, CompLevel level);
  67   67    // Print policy-specific information if necessary
  68   68    virtual void print_specific(EventType type, methodHandle mh, methodHandle imh, int bci, CompLevel level) { }
  69   69    // Check if the method can be compiled, change level if necessary
  70      -  void compile(methodHandle mh, int bci, CompLevel level, TRAPS);
       70 +  void compile(methodHandle mh, int bci, CompLevel level, JavaThread* thread);
  71   71    // Submit a given method for compilation
  72      -  virtual void submit_compile(methodHandle mh, int bci, CompLevel level, TRAPS);
       72 +  virtual void submit_compile(methodHandle mh, int bci, CompLevel level, JavaThread* thread);
  73   73    // Simple methods are as good being compiled with C1 as C2.
  74   74    // This function tells if it's such a function.
  75   75    inline bool is_trivial(methodOop method);
  76   76  
  77   77    // Predicate helpers are used by .*_predicate() methods as well as others.
  78   78    // They check the given counter values, multiplied by the scale against the thresholds.
  79   79    template<CompLevel level> static inline bool call_predicate_helper(int i, int b, double scale);
  80   80    template<CompLevel level> static inline bool loop_predicate_helper(int i, int b, double scale);
  81   81  
  82   82    // Get a compilation level for a given method.
  83   83    static CompLevel comp_level(methodOop method) {
  84   84      nmethod *nm = method->code();
  85   85      if (nm != NULL && nm->is_in_use()) {
  86   86        return (CompLevel)nm->comp_level();
  87   87      }
  88   88      return CompLevel_none;
  89   89    }
  90   90    virtual void method_invocation_event(methodHandle method, methodHandle inlinee,
  91      -                                       CompLevel level, nmethod* nm, TRAPS);
       91 +                                       CompLevel level, nmethod* nm, JavaThread* thread);
  92   92    virtual void method_back_branch_event(methodHandle method, methodHandle inlinee,
  93      -                                        int bci, CompLevel level, nmethod* nm, TRAPS);
       93 +                                        int bci, CompLevel level, nmethod* nm, JavaThread* thread);
  94   94  public:
  95   95    SimpleThresholdPolicy() : _c1_count(0), _c2_count(0) { }
  96   96    virtual int compiler_count(CompLevel comp_level) {
  97   97      if (is_c1_compile(comp_level)) return c1_count();
  98   98      if (is_c2_compile(comp_level)) return c2_count();
  99   99      return 0;
 100  100    }
 101  101    virtual CompLevel initial_compile_level() { return MIN2((CompLevel)TieredStopAtLevel, CompLevel_initial_compile); }
 102  102    virtual void do_safepoint_work() { }
 103  103    virtual void delay_compilation(methodOop method) { }
 104  104    virtual void disable_compilation(methodOop method) { }
 105  105    virtual void reprofile(ScopeDesc* trap_scope, bool is_osr);
 106  106    virtual nmethod* event(methodHandle method, methodHandle inlinee,
 107      -                         int branch_bci, int bci, CompLevel comp_level, nmethod* nm, TRAPS);
      107 +                         int branch_bci, int bci, CompLevel comp_level, nmethod* nm, JavaThread* thread);
 108  108    // Select task is called by CompileBroker. We should return a task or NULL.
 109  109    virtual CompileTask* select_task(CompileQueue* compile_queue);
 110  110    // Tell the runtime if we think a given method is adequately profiled.
 111  111    virtual bool is_mature(methodOop method);
 112  112    // Initialize: set compiler thread count
 113  113    virtual void initialize();
 114  114    virtual bool should_not_inline(ciEnv* env, ciMethod* callee) {
 115  115      return (env->comp_level() == CompLevel_limited_profile ||
 116  116              env->comp_level() == CompLevel_full_profile) &&
 117  117              callee->has_loops();
 118  118    }
 119  119  };
 120  120  
 121  121  #endif // SHARE_VM_RUNTIME_SIMPLETHRESHOLDPOLICY_HPP