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

Avoid String allocations in JVM_FindLoadedClass

XMLWordPrintable

    • b18

      JVM_FindLoadedClass takes the given jstring class name and calls internalize_classname - which returns a new java String after converting '.' to '/' in the original one. We then turn that string into an UTF-8 string. This means we're allocating a String object on heap, which we then instantly throw away, and unless I'm missing something we could just get rid of this intermediary allocation.

      internalize_classname is only used in this one place, so it should be inlined and simplified to remove a String allocation by doing the conversion to utf-8 first, then update that in place.

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

              Created:
              Updated:
              Resolved: