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

javac changes for JEP 306

    XMLWordPrintable

    Details

    • Type: CSR
    • Status: Closed
    • Priority: P4
    • Resolution: Approved
    • Fix Version/s: 17
    • Component/s: tools
    • Labels:
      None
    • Subcomponent:
    • Compatibility Kind:
      behavioral
    • Compatibility Risk:
      low
    • Compatibility Risk Description:
      Hide
      The strictfp language feature is not commonly used. The behavioral impact is a new lint warning enabled by default under -source/--release 17. The warning can be suppressed using the usual mechanisms. In the JVM, certain modifier combinations (ACC_STRICT and ACC_ABSTRACT) are rejected for major class file versions 45 through 60 but are allowed for major version 61 and later.
      Show
      The strictfp language feature is not commonly used. The behavioral impact is a new lint warning enabled by default under -source/--release 17. The warning can be suppressed using the usual mechanisms. In the JVM, certain modifier combinations (ACC_STRICT and ACC_ABSTRACT) are rejected for major class file versions 45 through 60 but are allowed for major version 61 and later.
    • Interface Kind:
      Language construct, Class file construct, add/remove/modify command line option
    • Scope:
      SE

      Description

      Summary

      Change the language and virtual machine to only support a single, strict, set of semantics for floating-point expressions.

      Problem

      Since Java SE 1.2, the language and VM have allowed two variants of floating-point semantics:

      • "strict" semantics: marked with strictfp in the language, ACC_STRICT in the VM
      • non-strict semantics: the default

      The non-strict semantics allow, in some circumstances, extra exponent range to be used for intermediate float and double values. This flexibility allowed faster code execution for certain popular processors common circa the Java SE 1.2. However, the processor family in question no longer benefits from this spec laxity and the existence of two subtly different variants of floating-point semantics causes on-going costs in maintenance and in developing new platform features.

      Solution

      Require all floating-point to be done strictly under a single set of semantics.

      Specification

      For javac, a new lint option strictfp whose usage text is:

      Warn about unnecessary use of the strictfp modifier.

      For the detailed JLS and JVMS changes, see the attached documents. In summary, in the JLS the notions of value set and value set conversion are removed from the specification. The language-level checks about combinations of other modifiers with strictfp remain. Otherwise, for the purposes of floating-point semantics, strictfp is a no-op. Many small edits in chapter 15, Expressions, are needed to implement this change. In the JVMS, value set conversion, FP-strict mode, and not FP-strict mode are removed as concepts. The ACC_STRICT method modifier is undefined for class file with major version 61 and above. Therefore the VM checks for ACC_STRICT and ACC_ABSTRACT methods do not apply for class file with major version 61 and above. The check still occurs for class file major versions 46 through 60. This is a deliberate design difference between the handling of "strict abstract" methods in the language the VM. Chapter 6 of the JVMS, The Java Virtual Machine Instruction Set, has small edits in many floating-point instructions.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              darcy Joe Darcy
              Reporter:
              darcy Joe Darcy
              Reviewed By:
              Brian Goetz, John Rose, Srikanth Adayapalam
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: