Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8265180

JvmtiCompiledMethodLoadEvent should include the stub section of nmethods

    XMLWordPrintable

Details

    • Bug
    • Status: Resolved
    • P4
    • Resolution: Fixed
    • None
    • 17
    • hotspot
    • None
    • b19

    Description

      The entire code_begin() to code_end() region contains executable assembly but JVMTI dumps only insts_begin() to insts_end() which leaves out the stubs section. PrintNMethod output always dumps the code_begin() to code_end(). It's not usually a hot part of the nmethod but it can get profiler ticks so it's confusing to leave it out. Following the pattern from the dynamic generated code notification the fix should be something like this:
      diff --git a/src/share/vm/prims/jvmtiExport.cpp b/src/share/vm/prims/jvmtiExport.cpp
      index bac36634d6..b41be2c3f2 100644
      --- a/src/share/vm/prims/jvmtiExport.cpp
      +++ b/src/share/vm/prims/jvmtiExport.cpp
      @@ -720,8 +720,8 @@ class JvmtiCompiledMethodLoadEventMark : public JvmtiMethodEventMark {
        public:
         JvmtiCompiledMethodLoadEventMark(JavaThread *thread, nmethod *nm, void* compile_info_ptr = NULL)
                 : JvmtiMethodEventMark(thread,methodHandle(thread, nm->method())) {
      - _code_data = nm->insts_begin();
      - _code_size = nm->insts_size();
      + _code_data = nm->code_begin();
      + _code_size = (jint)pointer_delta(nm->code_end(), nm->code_begin(), sizeof(char));
           _compile_info = compile_info_ptr; // Set void pointer of compiledMethodLoad Event. Default value is NULL.
           JvmtiCodeBlobEvents::build_jvmti_addr_location_map(nm, &_map, &_map_length);
         }

      Attachments

        Issue Links

          Activity

            People

              never Tom Rodriguez
              never Tom Rodriguez
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: