hotspot/src/share/vm/oops/methodOop.hpp
changeset 6453 970dc585ab63
parent 5547 f4b087cbb361
child 6463 f4362c8da849
--- a/hotspot/src/share/vm/oops/methodOop.hpp	Thu Sep 02 11:40:02 2010 -0700
+++ b/hotspot/src/share/vm/oops/methodOop.hpp	Fri Sep 03 17:51:07 2010 -0700
@@ -62,9 +62,9 @@
 // | method_size             | max_stack                  |
 // | max_locals              | size_of_parameters         |
 // |------------------------------------------------------|
-// | intrinsic_id, highest_tier  |       (unused)         |
+// | intrinsic_id, (unused)  |  throwout_count            |
 // |------------------------------------------------------|
-// | throwout_count          | num_breakpoints            |
+// | num_breakpoints         |  (unused)                  |
 // |------------------------------------------------------|
 // | invocation_counter                                   |
 // | backedge_counter                                     |
@@ -83,7 +83,6 @@
 class CheckedExceptionElement;
 class LocalVariableTableElement;
 class AdapterHandlerEntry;
-
 class methodDataOopDesc;
 
 class methodOopDesc : public oopDesc {
@@ -93,7 +92,7 @@
   constMethodOop    _constMethod;                // Method read-only data.
   constantPoolOop   _constants;                  // Constant pool
   methodDataOop     _method_data;
-  int               _interpreter_invocation_count; // Count of times invoked
+  int               _interpreter_invocation_count; // Count of times invoked (reused as prev_event_count in tiered)
   AccessFlags       _access_flags;               // Access flags
   int               _vtable_index;               // vtable index of this method (see VtableIndexFlag)
                                                  // note: can have vtables with >2**16 elements (because of inheritance)
@@ -105,11 +104,11 @@
   u2                _max_locals;                 // Number of local variables used by this method
   u2                _size_of_parameters;         // size of the parameter block (receiver + arguments) in words
   u1                _intrinsic_id;               // vmSymbols::intrinsic_id (0 == _none)
-  u1                _highest_tier_compile;       // Highest compile level this method has ever seen.
   u2                _interpreter_throwout_count; // Count of times method was exited via exception while interpreting
   u2                _number_of_breakpoints;      // fullspeed debugging support
   InvocationCounter _invocation_counter;         // Incremented before each activation of the method - used to trigger frequency-based optimizations
   InvocationCounter _backedge_counter;           // Incremented before each backedge taken - used to trigger frequencey-based optimizations
+
 #ifndef PRODUCT
   int               _compiled_invocation_count;  // Number of nmethod invocations so far (for perf. debugging)
 #endif
@@ -221,8 +220,11 @@
   // max locals
   int  max_locals() const                        { return _max_locals; }
   void set_max_locals(int size)                  { _max_locals = size; }
-  int highest_tier_compile()                     { return _highest_tier_compile;}
-  void set_highest_tier_compile(int level)      { _highest_tier_compile = level;}
+
+  int highest_comp_level() const;
+  void set_highest_comp_level(int level);
+  int highest_osr_comp_level() const;
+  void set_highest_osr_comp_level(int level);
 
   // Count of times method was exited via exception while interpreting
   void interpreter_throwout_increment() {
@@ -276,21 +278,29 @@
   }
 
   // invocation counter
-  InvocationCounter* invocation_counter()        { return &_invocation_counter; }
-  InvocationCounter* backedge_counter()          { return &_backedge_counter; }
-  int invocation_count() const                   { return _invocation_counter.count(); }
-  int backedge_count() const                     { return _backedge_counter.count(); }
-  bool was_executed_more_than(int n) const;
-  bool was_never_executed() const                { return !was_executed_more_than(0); }
+  InvocationCounter* invocation_counter() { return &_invocation_counter; }
+  InvocationCounter* backedge_counter()   { return &_backedge_counter; }
+
+  int invocation_count();
+  int backedge_count();
+
+  bool was_executed_more_than(int n);
+  bool was_never_executed()                      { return !was_executed_more_than(0); }
 
   static void build_interpreter_method_data(methodHandle method, TRAPS);
 
-  int interpreter_invocation_count() const       { return _interpreter_invocation_count; }
+  int interpreter_invocation_count() {
+    if (TieredCompilation) return invocation_count();
+    else return _interpreter_invocation_count;
+  }
   void set_interpreter_invocation_count(int count) { _interpreter_invocation_count = count; }
-  int increment_interpreter_invocation_count() { return ++_interpreter_invocation_count; }
+  int increment_interpreter_invocation_count() {
+    if (TieredCompilation) ShouldNotReachHere();
+    return ++_interpreter_invocation_count;
+  }
 
 #ifndef PRODUCT
-  int  compiled_invocation_count() const         { return _compiled_invocation_count; }
+  int  compiled_invocation_count() const         { return _compiled_invocation_count;  }
   void set_compiled_invocation_count(int count)  { _compiled_invocation_count = count; }
 #endif // not PRODUCT
 
@@ -361,7 +371,7 @@
 
 #ifndef PRODUCT
   // operations on invocation counter
-  void print_invocation_count() const;
+  void print_invocation_count();
 #endif
 
   // byte codes
@@ -587,8 +597,13 @@
   static vmSymbols::SID klass_id_for_intrinsics(klassOop holder);
 
   // On-stack replacement support
-  bool has_osr_nmethod()                         { return instanceKlass::cast(method_holder())->lookup_osr_nmethod(this, InvocationEntryBci) != NULL; }
-  nmethod* lookup_osr_nmethod_for(int bci)       { return instanceKlass::cast(method_holder())->lookup_osr_nmethod(this, bci); }
+  bool has_osr_nmethod(int level, bool match_level) {
+   return instanceKlass::cast(method_holder())->lookup_osr_nmethod(this, InvocationEntryBci, level, match_level) != NULL;
+  }
+
+  nmethod* lookup_osr_nmethod_for(int bci, int level, bool match_level) {
+    return instanceKlass::cast(method_holder())->lookup_osr_nmethod(this, bci, level, match_level);
+  }
 
   // Inline cache support
   void cleanup_inline_caches();
@@ -600,22 +615,24 @@
   // Indicates whether compilation failed earlier for this method, or
   // whether it is not compilable for another reason like having a
   // breakpoint set in it.
-  bool is_not_compilable(int comp_level = CompLevel_highest_tier) const;
-  void set_not_compilable(int comp_level = CompLevel_highest_tier, bool report = true);
-  void set_not_compilable_quietly(int comp_level = CompLevel_highest_tier) {
+  bool is_not_compilable(int comp_level = CompLevel_any) const;
+  void set_not_compilable(int comp_level = CompLevel_all, bool report = true);
+  void set_not_compilable_quietly(int comp_level = CompLevel_all) {
     set_not_compilable(comp_level, false);
   }
-
-  bool is_not_osr_compilable() const             { return is_not_compilable() || access_flags().is_not_osr_compilable(); }
-  void set_not_osr_compilable()                  { _access_flags.set_not_osr_compilable(); }
-
-  bool is_not_tier1_compilable() const           { return access_flags().is_not_tier1_compilable(); }
-  void set_not_tier1_compilable()                { _access_flags.set_not_tier1_compilable(); }
+  bool is_not_osr_compilable(int comp_level = CompLevel_any) const {
+    return is_not_compilable(comp_level) || access_flags().is_not_osr_compilable();
+  }
+  void set_not_osr_compilable()               { _access_flags.set_not_osr_compilable();       }
+  bool is_not_c1_compilable() const           { return access_flags().is_not_c1_compilable(); }
+  void set_not_c1_compilable()                { _access_flags.set_not_c1_compilable();        }
+  bool is_not_c2_compilable() const           { return access_flags().is_not_c2_compilable(); }
+  void set_not_c2_compilable()                { _access_flags.set_not_c2_compilable();        }
 
   // Background compilation support
-  bool queued_for_compilation() const            { return access_flags().queued_for_compilation();    }
-  void set_queued_for_compilation()              { _access_flags.set_queued_for_compilation(); }
-  void clear_queued_for_compilation()            { _access_flags.clear_queued_for_compilation(); }
+  bool queued_for_compilation() const  { return access_flags().queued_for_compilation(); }
+  void set_queued_for_compilation()    { _access_flags.set_queued_for_compilation();     }
+  void clear_queued_for_compilation()  { _access_flags.clear_queued_for_compilation();   }
 
   static methodOop method_from_bcp(address bcp);