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

(bf) ByteBuffer implementations classes do not call specialized putX

XMLWordPrintable

    • b23
    • 19
    • generic
    • generic

      A DESCRIPTION OF THE PROBLEM :
      I am working with java.nio.ByteBuffer in performance sensitive code. Upon inspecting the source code for specialized buffers that wrap ByteBuffer (i.e. ByteBufferAsIntBufferB, etc) I have noticed the fact that their putX methods is calling SCOPED_MEMORY_ACCESS.putXUnaligned, whereas my first instinct would be that they should be calling SCOPED_MEMORY_ACCESS.putX since the position() is always aligned for these buffers.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      This is the template from which the wrapping buffer classes are generated: https://github.com/openjdk/jdk/blob/master/src/java.base/share/classes/java/nio/ByteBufferAs-X-Buffer.java.template.

      In the template the "put" method always delegates to "SCOPED_MEMORY_ACCESS.put$Memtype$Unaligned"



            bpb Brian Burkhalter
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: