Uploaded image for project: 'Groovy'
  1. Groovy
  2. GROOVY-5105

Avoid temporary bytecode variable on simple declaration assignments

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 2.0-beta-1
    • None
    • None

    Description

      The following code :

      void m() { int i=0 }
      

      will generate bytecode like this:

      ICONST_0
      ISTORE 1
      ILOAD 1
      ISTORE 2
      ILOAD 2
      

      although everything could "fit" into a single slot :

      ICONST_0
      ISTORE 1
      ILOAD 1
      

      Attachments

        Activity

          People

            melix Cédric Champeau
            melix Cédric Champeau
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: