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

javac generates wrong ldc instruction for dynamic constant loads

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4
    • 22
    • 11, 17, 21, 22
    • tools
    • b22

    Description

      From JVMS description of "ldc"/"ldc_w" opcode:

      ```
       If the run-time constant pool entry is a numeric constant of type int or float, then the value of that numeric constant is pushed onto the operand stack as an int or float, respectively.
      ```

      That is, we cannot use ldc to load a two-slot constant. We need to use ldc2_w for that. Unfortunately, javac always emits ldc/ldc_w for all dynamic constants, regardless of their type. This can lead to verifier errors.

      Attachments

        Issue Links

          Activity

            People

              mcimadamore Maurizio Cimadamore
              mcimadamore Maurizio Cimadamore
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: