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

Cleanup error message generation in LinkResolver::resolve_field

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b18

      Description

      Move ResourceMarks and stringStreams only used for exception messages - reduces mallocs and has a small effect on startup that scales with number of classes linked:

      diff -r 8ce76418da2d src/hotspot/share/interpreter/linkResolver.cpp
      --- a/src/hotspot/share/interpreter/linkResolver.cpp Mon Mar 30 12:33:46 2020 +0200
      +++ b/src/hotspot/share/interpreter/linkResolver.cpp Mon Mar 30 16:30:51 2020 +0200
      @@ -986,10 +986,10 @@
           // (2) by the <clinit> method (in case of a static field)
           // or by the <init> method (in case of an instance field).
           if (is_put && fd.access_flags().is_final()) {
      - ResourceMark rm(THREAD);
      - stringStream ss;
       
             if (sel_klass != current_klass) {
      + ResourceMark rm(THREAD);
      + stringStream ss;
               ss.print("Update to %s final field %s.%s attempted from a different class (%s) than the field's declaring class",
                        is_static ? "static" : "non-static", resolved_klass->external_name(), fd.name()->as_C_string(),
                       current_klass->external_name());
      @@ -1007,6 +1007,8 @@
                                                            !m->is_object_initializer());
       
               if (is_initialized_static_final_update || is_initialized_instance_final_update) {
      + ResourceMark rm(THREAD);
      + stringStream ss;
                 ss.print("Update to %s final field %s.%s attempted from a different method (%s) than the initializer method %s ",
                          is_static ? "static" : "non-static", resolved_klass->external_name(), fd.name()->as_C_string(),
                          m->name()->as_C_string(),

        Attachments

          Activity

            People

            Assignee:
            redestad Claes Redestad
            Reporter:
            redestad Claes Redestad
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: