changeset 492:8680e3b4be3b

meth-lazy: undo changes that caused a problem
author twisti
date Fri, 20 Jul 2012 14:39:12 -0700
parents 89a156565b76
children a8cb0e14256a
files meth-lazy-7023639.review.patch
diffstat 1 files changed, 166 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/meth-lazy-7023639.review.patch	Thu Jul 19 17:38:53 2012 -0700
+++ b/meth-lazy-7023639.review.patch	Fri Jul 20 14:39:12 2012 -0700
@@ -1,5 +1,5 @@
 # HG changeset patch
-# Parent 2decd0611811b96605f0a5baf657ec969538d7c0
+# Parent fe6edd334f2d863f8b842505ef37ea0b4c608f68
 
 diff --git a/agent/src/share/classes/sun/jvm/hotspot/code/CodeBlob.java b/agent/src/share/classes/sun/jvm/hotspot/code/CodeBlob.java
 --- a/agent/src/share/classes/sun/jvm/hotspot/code/CodeBlob.java
@@ -914,6 +914,19 @@
    int       get_method_signature_index();
  
    ciCPCache*  get_cpcache() const;
+diff --git a/src/share/vm/classfile/classFileParser.cpp b/src/share/vm/classfile/classFileParser.cpp
+--- a/src/share/vm/classfile/classFileParser.cpp
++++ b/src/share/vm/classfile/classFileParser.cpp
+@@ -2224,9 +2224,6 @@
+   // Copy byte codes
+   m->set_code(code_start);
+ 
+-  // Now we have some bytecodes, compute the bytecode flags.
+-  m->compute_bytecode_flags();
+-
+   // Copy line number table
+   if (linenumber_table != NULL) {
+     memcpy(m->compressed_linenumber_table(),
 diff --git a/src/share/vm/classfile/javaClasses.cpp b/src/share/vm/classfile/javaClasses.cpp
 --- a/src/share/vm/classfile/javaClasses.cpp
 +++ b/src/share/vm/classfile/javaClasses.cpp
@@ -1199,6 +1212,20 @@
  }
  
  void nmethod::print_code() {
+diff --git a/src/share/vm/interpreter/bytecodes.hpp b/src/share/vm/interpreter/bytecodes.hpp
+--- a/src/share/vm/interpreter/bytecodes.hpp
++++ b/src/share/vm/interpreter/bytecodes.hpp
+@@ -359,8 +359,8 @@
+ 
+  public:
+   // Conversion
+-  static void        check          (Code code)    { assert(is_defined(code), "illegal code"); }
+-  static void        wide_check     (Code code)    { assert(wide_is_defined(code), "illegal code"); }
++  static void        check          (Code code)    { assert(is_defined(code),      err_msg("illegal code: %d", (int)code)); }
++  static void        wide_check     (Code code)    { assert(wide_is_defined(code), err_msg("illegal code: %d", (int)code)); }
+   static Code        cast           (int  code)    { return (Code)code; }
+ 
+ 
 diff --git a/src/share/vm/interpreter/linkResolver.cpp b/src/share/vm/interpreter/linkResolver.cpp
 --- a/src/share/vm/interpreter/linkResolver.cpp
 +++ b/src/share/vm/interpreter/linkResolver.cpp
@@ -1272,7 +1299,76 @@
 diff --git a/src/share/vm/oops/methodOop.cpp b/src/share/vm/oops/methodOop.cpp
 --- a/src/share/vm/oops/methodOop.cpp
 +++ b/src/share/vm/oops/methodOop.cpp
-@@ -1181,13 +1181,8 @@
+@@ -396,39 +396,41 @@
+ }
+ 
+ 
+-void methodOopDesc::compute_bytecode_flags() {
++bool methodOopDesc::compute_has_loops_flag() {
+   BytecodeStream bcs(methodOop(this));
+   Bytecodes::Code bc;
+ 
+-  while ((bc = bcs.next()) != Bytecodes::_illegal) {
+-    switch (bc) {
+-    case Bytecodes::_ifeq:
+-    case Bytecodes::_ifnull:
+-    case Bytecodes::_iflt:
+-    case Bytecodes::_ifle:
+-    case Bytecodes::_ifne:
+-    case Bytecodes::_ifnonnull:
+-    case Bytecodes::_ifgt:
+-    case Bytecodes::_ifge:
+-    case Bytecodes::_if_icmpeq:
+-    case Bytecodes::_if_icmpne:
+-    case Bytecodes::_if_icmplt:
+-    case Bytecodes::_if_icmpgt:
+-    case Bytecodes::_if_icmple:
+-    case Bytecodes::_if_icmpge:
+-    case Bytecodes::_if_acmpeq:
+-    case Bytecodes::_if_acmpne:
+-    case Bytecodes::_goto:
+-    case Bytecodes::_jsr:
+-      if (bcs.dest()   < bcs.next_bci())  _access_flags.set_has_loops();
+-      break;
++  while ((bc = bcs.next()) >= 0) {
++    switch( bc ) {
++      case Bytecodes::_ifeq:
++      case Bytecodes::_ifnull:
++      case Bytecodes::_iflt:
++      case Bytecodes::_ifle:
++      case Bytecodes::_ifne:
++      case Bytecodes::_ifnonnull:
++      case Bytecodes::_ifgt:
++      case Bytecodes::_ifge:
++      case Bytecodes::_if_icmpeq:
++      case Bytecodes::_if_icmpne:
++      case Bytecodes::_if_icmplt:
++      case Bytecodes::_if_icmpgt:
++      case Bytecodes::_if_icmple:
++      case Bytecodes::_if_icmpge:
++      case Bytecodes::_if_acmpeq:
++      case Bytecodes::_if_acmpne:
++      case Bytecodes::_goto:
++      case Bytecodes::_jsr:
++        if( bcs.dest() < bcs.next_bci() ) _access_flags.set_has_loops();
++        break;
+ 
+-    case Bytecodes::_goto_w:
+-    case Bytecodes::_jsr_w:
+-      if (bcs.dest_w() < bcs.next_bci())  _access_flags.set_has_loops();
+-      break;
++      case Bytecodes::_goto_w:
++      case Bytecodes::_jsr_w:
++        if( bcs.dest_w() < bcs.next_bci() ) _access_flags.set_has_loops();
++        break;
+     }
+   }
++  _access_flags.set_loops_flag_init();
++  return _access_flags.has_loops();
+ }
+ 
+ 
+@@ -1181,13 +1183,8 @@
  #endif
    name()->print_symbol_on(st);
    if (WizardMode) signature()->print_symbol_on(st);
@@ -1288,6 +1384,34 @@
  }
  
  // This is only done during class loading, so it is OK to assume method_idnum matches the methods() array
+diff --git a/src/share/vm/oops/methodOop.hpp b/src/share/vm/oops/methodOop.hpp
+--- a/src/share/vm/oops/methodOop.hpp
++++ b/src/share/vm/oops/methodOop.hpp
+@@ -492,13 +492,19 @@
+   // true if method needs no dynamic dispatch (final and/or no vtable entry)
+   bool can_be_statically_bound() const;
+ 
+-  void compute_bytecode_flags();
++  // returns true if the method has any backward branches.
++  bool has_loops() {
++    return access_flags().loops_flag_init() ? access_flags().has_loops() : compute_has_loops_flag();
++  };
+ 
+-  // returns true if the method has any backward branches.
+-  bool has_loops()          const { return access_flags().has_loops();          }
++  bool compute_has_loops_flag();
+ 
+-  bool has_jsrs()                 { return access_flags().has_jsrs();           }
+-  void set_has_jsrs()             {       _access_flags.set_has_jsrs();         }
++  bool has_jsrs() {
++    return access_flags().has_jsrs();
++  };
++  void set_has_jsrs() {
++    _access_flags.set_has_jsrs();
++  }
+ 
+   // returns true if the method has any monitors.
+   bool has_monitors() const                      { return is_synchronized() || access_flags().has_monitor_bytecodes(); }
 diff --git a/src/share/vm/oops/symbol.cpp b/src/share/vm/oops/symbol.cpp
 --- a/src/share/vm/oops/symbol.cpp
 +++ b/src/share/vm/oops/symbol.cpp
@@ -1904,3 +2028,43 @@
    }
  
    virtual void print(outputStream* st, int total_ticks) {
+diff --git a/src/share/vm/runtime/vmStructs.cpp b/src/share/vm/runtime/vmStructs.cpp
+--- a/src/share/vm/runtime/vmStructs.cpp
++++ b/src/share/vm/runtime/vmStructs.cpp
+@@ -2231,7 +2231,7 @@
+   declare_constant(JVM_ACC_MONITOR_MATCH)                                 \
+   declare_constant(JVM_ACC_HAS_MONITOR_BYTECODES)                         \
+   declare_constant(JVM_ACC_HAS_LOOPS)                                     \
+-  declare_constant(JVM_ACC_UNUSED)                                        \
++  declare_constant(JVM_ACC_LOOPS_FLAG_INIT)                               \
+   declare_constant(JVM_ACC_QUEUED)                                        \
+   declare_constant(JVM_ACC_NOT_OSR_COMPILABLE)                            \
+   declare_constant(JVM_ACC_HAS_LINE_NUMBER_TABLE)                         \
+diff --git a/src/share/vm/utilities/accessFlags.hpp b/src/share/vm/utilities/accessFlags.hpp
+--- a/src/share/vm/utilities/accessFlags.hpp
++++ b/src/share/vm/utilities/accessFlags.hpp
+@@ -43,7 +43,7 @@
+   JVM_ACC_MONITOR_MATCH           = 0x10000000,     // True if we know that monitorenter/monitorexit bytecodes match
+   JVM_ACC_HAS_MONITOR_BYTECODES   = 0x20000000,     // Method contains monitorenter/monitorexit bytecodes
+   JVM_ACC_HAS_LOOPS               = 0x40000000,     // Method has loops
+-  JVM_ACC_UNUSED                  = (int)0x80000000,// currently unused
++  JVM_ACC_LOOPS_FLAG_INIT         = (int)0x80000000,// The loop flag has been initialized
+   JVM_ACC_QUEUED                  = 0x01000000,     // Queued for compilation
+   JVM_ACC_NOT_C2_COMPILABLE       = 0x02000000,
+   JVM_ACC_NOT_C1_COMPILABLE       = 0x04000000,
+@@ -118,6 +118,7 @@
+   bool is_monitor_matching     () const { return (_flags & JVM_ACC_MONITOR_MATCH          ) != 0; }
+   bool has_monitor_bytecodes   () const { return (_flags & JVM_ACC_HAS_MONITOR_BYTECODES  ) != 0; }
+   bool has_loops               () const { return (_flags & JVM_ACC_HAS_LOOPS              ) != 0; }
++  bool loops_flag_init         () const { return (_flags & JVM_ACC_LOOPS_FLAG_INIT        ) != 0; }
+   bool queued_for_compilation  () const { return (_flags & JVM_ACC_QUEUED                 ) != 0; }
+   bool is_not_c1_compilable () const    { return (_flags & JVM_ACC_NOT_C1_COMPILABLE      ) != 0; }
+   bool is_not_c2_compilable () const    { return (_flags & JVM_ACC_NOT_C2_COMPILABLE      ) != 0; }
+@@ -180,6 +181,7 @@
+   void set_monitor_matching()          { atomic_set_bits(JVM_ACC_MONITOR_MATCH);           }
+   void set_has_monitor_bytecodes()     { atomic_set_bits(JVM_ACC_HAS_MONITOR_BYTECODES);   }
+   void set_has_loops()                 { atomic_set_bits(JVM_ACC_HAS_LOOPS);               }
++  void set_loops_flag_init()           { atomic_set_bits(JVM_ACC_LOOPS_FLAG_INIT);         }
+   void set_not_c1_compilable()         { atomic_set_bits(JVM_ACC_NOT_C1_COMPILABLE);       }
+   void set_not_c2_compilable()         { atomic_set_bits(JVM_ACC_NOT_C2_COMPILABLE);       }
+   void set_not_osr_compilable()        { atomic_set_bits(JVM_ACC_NOT_OSR_COMPILABLE);      }