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

Redefine class can't handle addition of 64 bit constants in JDK1.5.0_04

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P2
    • Resolution: Fixed
    • Affects Version/s: 5.0u4
    • Fix Version/s: 6
    • Component/s: hotspot
    • Subcomponent:
    • Resolved In Build:
      b79
    • CPU:
      x86
    • OS:
      linux

      Backports

        Description

        FULL PRODUCT VERSION :
        java version "1.5.0_05"
        Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_05-b05)
        Java HotSpot(TM) Client VM (build 1.5.0_05-b05, mixed mode, sharing)


        FULL OS VERSION :
        Linux Fedora Core 3 kernel 2.6.12-1.1372_FC3


        A DESCRIPTION OF THE PROBLEM :
        Adding a double or long constant to a class and forcing a redefiniton of it through JDI redefineClasses picks up a seeming random value of the constant.
        The correct behaviour is seen for 32 bit constants. JRE1.5.0-b64 does not exhibit this bug.

        This makes it difficult to rely on class redefinition for fast prototyping.

        THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: Yes

        THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Yes

        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Compile the source code under JDK 1.5.0 and execute it using JRE 1.5.0_05

        Then change the line System.out.println(a); to System.out.println(a*2L); or (a*2.0); and force a class redefinion through JDI


        EXPECTED VERSUS ACTUAL BEHAVIOR :
        Expected: 1000 should be printed once per second
        Actual:
        1000
        1000
        1000
        1000
        ==JDIHarness: agen.bin.Test will be replaced
        ==JDIHarness: Suspending JVM
        ==JDIHarness: Uploading 1 classes
        ==JDIHarness: Resuming JVM
        -6624593188399085616
        -6624593188399085616
        [the number printed following redefiniton appears random, and subsequent redefinitions change this number and sometimes get it correct]
        REPRODUCIBILITY :
        This bug can be reproduced always.

        ---------- BEGIN SOURCE ----------
        public class Test {
            public static void main(String argv[]) throws InterruptedException {
        while (true) {
        doStuff(1000);
        Thread.sleep(1000);
        }
            }
            private static void doStuff(int a) {
        System.out.println(a);
            }
        }
        ---------- END SOURCE ----------

        CUSTOMER SUBMITTED WORKAROUND :
        Revert to JRE1.5.0 or (possibly) perform the redefinition twice.

          Attachments

            Issue Links

              Activity

                People

                • Assignee:
                  dcubed Daniel Daugherty
                  Reporter:
                  tbell Tim Bell
                • Votes:
                  0 Vote for this issue
                  Watchers:
                  0 Start watching this issue

                  Dates

                  • Created:
                    Updated:
                    Resolved:
                    Imported:
                    Indexed: