--- old/src/share/vm/oops/method.cpp 2015-11-03 19:03:23.729273575 +0300 +++ new/src/share/vm/oops/method.cpp 2015-11-03 19:03:23.673273807 +0300 @@ -581,7 +581,7 @@ return can_be_statically_bound(method_holder()->access_flags()); } -bool Method::is_accessor() const { +bool Method::is_simple_accessor() const { if (code_size() != 5) return false; if (size_of_parameters() != 1) return false; if (java_code_at(0) != Bytecodes::_aload_0 ) return false; @@ -591,6 +591,47 @@ return true; } +bool Method::is_accessor() const { + if (code_size() == 5) { // potential getter + if (size_of_parameters() != 1) return false; + if (java_code_at(0) != Bytecodes::_aload_0) return false; + if (java_code_at(1) != Bytecodes::_getfield) return false; + switch (java_code_at(4)) { + case Bytecodes::_ireturn: + case Bytecodes::_lreturn: + case Bytecodes::_freturn: + case Bytecodes::_dreturn: + case Bytecodes::_areturn: + break; + default: + return false; + } + return true; + } + + if (code_size() == 6) { // potential setter + if (java_code_at(0) != Bytecodes::_aload_0) return false; + switch (java_code_at(1)) { + case Bytecodes::_iload_1: + case Bytecodes::_aload_1: + case Bytecodes::_fload_1: + if (size_of_parameters() != 2) return false; + break; + case Bytecodes::_dload_1: + case Bytecodes::_lload_1: + if (size_of_parameters() != 3) return false; + break; + default: + return false; + } + if (java_code_at(2) != Bytecodes::_putfield) return false; + if (java_code_at(5) != Bytecodes::_return) return false; + return true; + } + + return false; +} + bool Method::is_constant_getter() const { int last_index = code_size() - 1; // Check if the first 1-3 bytecodes are a constant push