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

os::get_native_stack() could use some cleanup

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Closed
    • Priority: P4
    • Resolution: Won't Fix
    • Affects Version/s: 9
    • Fix Version/s: 12
    • Component/s: hotspot

      Description

      The second set of checks in the code below are not needed. They are covered by the first set of checks:

          if (fr.fp() == NULL || fr.cb() != NULL ||
              fr.sender_pc() == NULL || os::is_first_C_frame(&fr)) break;

          if (fr.sender_pc() && !os::is_first_C_frame(&fr)) {
            fr = os::get_sender_for_C_frame(&fr);
          } else {
            break;
          }

      Is the same as:

          if (fr.fp() == NULL || fr.cb() != NULL ||
              fr.sender_pc() == NULL || os::is_first_C_frame(&fr)) break;

          fr = os::get_sender_for_C_frame(&fr);

      Also, the code should really not be calling sender_pc(), and there is no need to. It will become fp.pc() after the next frame is fetched, and will check at the top of the while loop on the next iteration. The following would be safer:

            if (fr.fp() == NULL || // not walkable
                fr.cb() != NULL || // not 'native'
                os::is_first_C_frame(&fr)) {
              break;
            }

            fr = os::get_sender_for_C_frame(&fr);

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            cjplummer Chris Plummer
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: