From e40f9fd1c304426d6e544915299457da9c602152 Mon Sep 17 00:00:00 2001 From: roland Date: Fri, 18 Apr 2014 14:25:21 +0200 Subject: [PATCH] 8039975: SIGSEGV in MethodData::next_data(ProfileData*) Summary: profiling code in interpreter broken when argument profiling is off. Reviewed-by: iveresov, kvn --- src/cpu/sparc/vm/interp_masm_sparc.cpp | 2 +- src/cpu/x86/vm/interp_masm_x86.cpp | 2 +- src/share/vm/c1/c1_LIRGenerator.cpp | 4 ++-- src/share/vm/oops/methodData.hpp | 7 ++++++- 4 files changed, 10 insertions(+), 5 deletions(-) diff --git a/src/cpu/sparc/vm/interp_masm_sparc.cpp b/src/cpu/sparc/vm/interp_masm_sparc.cpp index c22f20a23..d80c7a59e 100644 --- a/src/cpu/sparc/vm/interp_masm_sparc.cpp +++ b/src/cpu/sparc/vm/interp_masm_sparc.cpp @@ -2003,7 +2003,7 @@ void InterpreterMacroAssembler::profile_arguments_type(Register callee, Register } } else { assert(MethodData::profile_return(), "either profile call args or call ret"); - update_mdp_by_constant(in_bytes(ReturnTypeEntry::size())); + update_mdp_by_constant(in_bytes(TypeEntriesAtCall::return_only_size())); } // mdp points right after the end of the diff --git a/src/cpu/x86/vm/interp_masm_x86.cpp b/src/cpu/x86/vm/interp_masm_x86.cpp index 799be1303..42a826d77 100644 --- a/src/cpu/x86/vm/interp_masm_x86.cpp +++ b/src/cpu/x86/vm/interp_masm_x86.cpp @@ -137,7 +137,7 @@ void InterpreterMacroAssembler::profile_arguments_type(Register mdp, Register ca movptr(Address(rbp, frame::interpreter_frame_mdx_offset * wordSize), mdp); } else { assert(MethodData::profile_return(), "either profile call args or call ret"); - update_mdp_by_constant(mdp, in_bytes(ReturnTypeEntry::size())); + update_mdp_by_constant(mdp, in_bytes(TypeEntriesAtCall::return_only_size())); } // mdp points right after the end of the diff --git a/src/share/vm/c1/c1_LIRGenerator.cpp b/src/share/vm/c1/c1_LIRGenerator.cpp index 5ed047656..914f8c4fa 100644 --- a/src/share/vm/c1/c1_LIRGenerator.cpp +++ b/src/share/vm/c1/c1_LIRGenerator.cpp @@ -3186,8 +3186,8 @@ void LIRGenerator::profile_arguments(ProfileCall* x) { #ifdef ASSERT Bytecodes::Code code = x->method()->raw_code_at_bci(x->bci_of_invoke()); int n = x->nb_profiled_args(); - assert(MethodData::profile_parameters() && x->inlined() && - ((code == Bytecodes::_invokedynamic && n <= 1) || (code == Bytecodes::_invokehandle && n <= 2)), + assert(MethodData::profile_parameters() && (MethodData::profile_arguments_jsr292_only() || + (x->inlined() && ((code == Bytecodes::_invokedynamic && n <= 1) || (code == Bytecodes::_invokehandle && n <= 2)))), "only at JSR292 bytecodes"); #endif } diff --git a/src/share/vm/oops/methodData.hpp b/src/share/vm/oops/methodData.hpp index c763779c3..b3936def0 100644 --- a/src/share/vm/oops/methodData.hpp +++ b/src/share/vm/oops/methodData.hpp @@ -1022,6 +1022,11 @@ public: static ByteSize argument_type_offset(int i) { return in_ByteSize(argument_type_local_offset(i) * DataLayout::cell_size); } + + static ByteSize return_only_size() { + return ReturnTypeEntry::size() + in_ByteSize(header_cell_count() * DataLayout::cell_size); + } + }; // CallTypeData @@ -2172,7 +2177,6 @@ private: static bool profile_jsr292(methodHandle m, int bci); static int profile_arguments_flag(); - static bool profile_arguments_jsr292_only(); static bool profile_all_arguments(); static bool profile_arguments_for_invoke(methodHandle m, int bci); static int profile_return_flag(); @@ -2475,6 +2479,7 @@ public: static bool profile_parameters_for_method(methodHandle m); static bool profile_arguments(); + static bool profile_arguments_jsr292_only(); static bool profile_return(); static bool profile_parameters(); static bool profile_return_jsr292_only(); -- GitLab