You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Vera Petrashkova (JIRA)" <ji...@apache.org> on 2006/11/08 05:40:51 UTC

[jira] Created: (HARMONY-2092) [drlvm] Harmony works with volatile variables incorrectly

[drlvm] Harmony works with volatile variables incorrectly
---------------------------------------------------------

                 Key: HARMONY-2092
                 URL: http://issues.apache.org/jira/browse/HARMONY-2092
             Project: Harmony
          Issue Type: Bug
          Components: DRLVM
         Environment: Windows and Linux
            Reporter: Vera Petrashkova


When Long_MAX_VALUE or Long.MIN_VALUE should be assigned to volatile variable then
VM works incorrectly.
Code for reproducing:
------------------volatileTest.java-----------------
public class volatileTest  {

    public static int delay = 5000;
    private boolean interruptFlag = false;

    long hi;
    long lo;
    volatile long v;

    public static void main(String [] args ) {
        int maxI = 20;
        for (int i = 0; i < maxI; i++) {
            int t = new volatileTest().test(delay);
            System.out.println((t == 104 ? "Test passed: ": "Test failed: ") 
                + t + "  (step: " + i + ")");
        }
    }

    public synchronized void interrupt() {
        interruptFlag = true;
    }

    public synchronized boolean interrupted() {
        return interruptFlag;
    }

    public volatileTest() {
        super();
        hi = Long.MAX_VALUE;
        lo = Long.MIN_VALUE;
        v = hi;              
    }


    public int test(int delay)  {        
        boolean passed = true;
        Thread_1_class  t1 = new Thread_1_class(this);
        Thread_2_class t2 = new Thread_2_class(this);
        Interruptor killer = new Interruptor(this, delay);
        try {
            t1.start();
            t2.start();
            killer.start();
      
            while (!interrupted()) {
                Thread.yield();
                long v3 = v;
                if (v3 != hi && v3 != lo) { 
                    System.out.println(v3+"  "+hi +"  "+lo);
                    passed = false;
                    break;
                }            
            }
            t1.interrupt();
            t2.interrupt();
            return passed ? 104 : 105;
       } catch (Throwable e) {
           e.printStackTrace();
           return 106;
       }
    }
}
class Thread_1_class extends Thread {
   volatileTest thh;
   public Thread_1_class (volatileTest t) {
       super();
       thh = t;
   }
   public void run() {
       while (!isInterrupted()) {
           thh.v = thh.lo;
           thh.v = thh.hi;
       }
   }
}

class Thread_2_class extends Thread {
   volatileTest thh;
   public Thread_2_class (volatileTest t) {
       super();
       thh = t;
   }
   public void run() {
       while (!isInterrupted()) {
                thh.v = thh.hi;
                thh.v = thh.lo;
            }
   }
}

class Interruptor extends Thread {
    volatileTest t;
    int delay;

    public Interruptor(volatileTest t, int delay) {
        this.t = t;
        this.delay = delay;
    }

    public void run() {
        try {
            Thread.sleep(delay);
        } catch (InterruptedException e) {
        }
        t.interrupt();
    }
}
----------------------------

Output on RI:
================
java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)

Test passed: 104  (step: 0)
Test passed: 104  (step: 1)
Test passed: 104  (step: 2)
Test passed: 104  (step: 3)
Test passed: 104  (step: 4)
Test passed: 104  (step: 5)
Test passed: 104  (step: 6)
Test passed: 104  (step: 7)
Test passed: 104  (step: 8)
Test passed: 104  (step: 9)
Test passed: 104  (step: 10)
Test passed: 104  (step: 11)
Test passed: 104  (step: 12)
Test passed: 104  (step: 13)
Test passed: 104  (step: 14)
Test passed: 104  (step: 15)
Test passed: 104  (step: 16)
Test passed: 104  (step: 17)
Test passed: 104  (step: 18)
Test passed: 104  (step: 19)

Output on Harmony:
====================
Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
java version "1.5.0"
pre-alpha : not complete or compatible
svn = r471468, (Nov  7 2006), Windows/ia32/msvc 1310, release build
http://incubator.apache.org/harmony
Test passed: 104  (step: 0)
Test passed: 104  (step: 1)
Test passed: 104  (step: 2)
Test passed: 104  (step: 3)
Test passed: 104  (step: 4)
Test passed: 104  (step: 5)
Test passed: 104  (step: 6)
Test passed: 104  (step: 7)
Test passed: 104  (step: 8)
Test passed: 104  (step: 9)
Test passed: 104  (step: 10)
9223372032559808512  9223372036854775807  -9223372036854775808
Test failed: 105  (step: 11)
Test passed: 104  (step: 12)
9223372032559808512  9223372036854775807  -9223372036854775808
Test failed: 105  (step: 13)
Test passed: 104  (step: 14)
Test passed: 104  (step: 15)
-9223372032559808513  9223372036854775807  -9223372036854775808
Test failed: 105  (step: 16)
-9223372032559808513  9223372036854775807  -9223372036854775808
Test failed: 105  (step: 17)
Test passed: 104  (step: 18)
Test passed: 104  (step: 19)

Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
java version "1.5.0" 
pre-alpha : not complete or compatible
svn = r471468, (Nov  7 2006), Linux/ia32/gcc 3.3.3, release build
http://incubator.apache.org/harmony
-9223372032559808513  9223372036854775807  -9223372036854775808
Test failed: 105  (step: 0)
9223372032559808512  9223372036854775807  -9223372036854775808
Test failed: 105  (step: 1)
9223372032559808512  9223372036854775807  -9223372036854775808
Test failed: 105  (step: 2)
9223372032559808512  9223372036854775807  -9223372036854775808
Test failed: 105  (step: 3)
9223372032559808512  9223372036854775807  -9223372036854775808
Test failed: 105  (step: 4)
-9223372032559808513  9223372036854775807  -9223372036854775808
Test failed: 105  (step: 5)
9223372032559808512  9223372036854775807  -9223372036854775808
Test failed: 105  (step: 6)
9223372032559808512  9223372036854775807  -9223372036854775808
Test failed: 105  (step: 7)
-9223372032559808513  9223372036854775807  -9223372036854775808
Test failed: 105  (step: 8)
9223372032559808512  9223372036854775807  -9223372036854775808
Test failed: 105  (step: 9)
9223372032559808512  9223372036854775807  -9223372036854775808
Test failed: 105  (step: 10)
-9223372032559808513  9223372036854775807  -9223372036854775808
Test failed: 105  (step: 11)
-9223372032559808513  9223372036854775807  -9223372036854775808
Test failed: 105  (step: 12)
9223372032559808512  9223372036854775807  -9223372036854775808
Test failed: 105  (step: 13)
-9223372032559808513  9223372036854775807  -9223372036854775808
Test failed: 105  (step: 14)
-9223372032559808513  9223372036854775807  -9223372036854775808
Test failed: 105  (step: 15)
9223372032559808512  9223372036854775807  -9223372036854775808
Test failed: 105  (step: 16)
9223372032559808512  9223372036854775807  -9223372036854775808
Test failed: 105  (step: 17)
-9223372032559808513  9223372036854775807  -9223372036854775808
Test failed: 105  (step: 18)
9223372032559808512  9223372036854775807  -9223372036854775808
Test failed: 105  (step: 19)



This bug is reproducible on Jitrino (JET/OPT) and on interpreter:
java -cp . volatileTest
java -cp . -Xint volatileTest
java -cp . -Xem:opt volatileTest




-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (HARMONY-2092) [drlvm] Harmony works with volatile variables incorrectly

Posted by "Ivan Volosyuk (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-2092?page=comments#action_12448189 ] 
            
Ivan Volosyuk commented on HARMONY-2092:
----------------------------------------

The bug doesn't exist on interpreter. It always uses 64 bit read / write operations for 64 bit fields.


> [drlvm] Harmony works with volatile variables incorrectly
> ---------------------------------------------------------
>
>                 Key: HARMONY-2092
>                 URL: http://issues.apache.org/jira/browse/HARMONY-2092
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: Windows and Linux
>            Reporter: Vera Petrashkova
>         Attachments: volatileTest.zip
>
>
> When Long_MAX_VALUE or Long.MIN_VALUE should be assigned to volatile variable then
> VM works incorrectly.
> Code for reproducing:
> ------------------volatileTest.java-----------------
> public class volatileTest  {
>     public static int delay = 5000;
>     private boolean interruptFlag = false;
>     long hi;
>     long lo;
>     volatile long v;
>     public static void main(String [] args ) {
>         int maxI = 20;
>         for (int i = 0; i < maxI; i++) {
>             int t = new volatileTest().test(delay);
>             System.out.println((t == 104 ? "Test passed: ": "Test failed: ") 
>                 + t + "  (step: " + i + ")");
>         }
>     }
>     public synchronized void interrupt() {
>         interruptFlag = true;
>     }
>     public synchronized boolean interrupted() {
>         return interruptFlag;
>     }
>     public volatileTest() {
>         super();
>         hi = Long.MAX_VALUE;
>         lo = Long.MIN_VALUE;
>         v = hi;              
>     }
>     public int test(int delay)  {        
>         boolean passed = true;
>         Thread_1_class  t1 = new Thread_1_class(this);
>         Thread_2_class t2 = new Thread_2_class(this);
>         Interruptor killer = new Interruptor(this, delay);
>         try {
>             t1.start();
>             t2.start();
>             killer.start();
>       
>             while (!interrupted()) {
>                 Thread.yield();
>                 long v3 = v;
>                 if (v3 != hi && v3 != lo) { 
>                     System.out.println(v3+"  "+hi +"  "+lo);
>                     passed = false;
>                     break;
>                 }            
>             }
>             t1.interrupt();
>             t2.interrupt();
>             return passed ? 104 : 105;
>        } catch (Throwable e) {
>            e.printStackTrace();
>            return 106;
>        }
>     }
> }
> class Thread_1_class extends Thread {
>    volatileTest thh;
>    public Thread_1_class (volatileTest t) {
>        super();
>        thh = t;
>    }
>    public void run() {
>        while (!isInterrupted()) {
>            thh.v = thh.lo;
>            thh.v = thh.hi;
>        }
>    }
> }
> class Thread_2_class extends Thread {
>    volatileTest thh;
>    public Thread_2_class (volatileTest t) {
>        super();
>        thh = t;
>    }
>    public void run() {
>        while (!isInterrupted()) {
>                 thh.v = thh.hi;
>                 thh.v = thh.lo;
>             }
>    }
> }
> class Interruptor extends Thread {
>     volatileTest t;
>     int delay;
>     public Interruptor(volatileTest t, int delay) {
>         this.t = t;
>         this.delay = delay;
>     }
>     public void run() {
>         try {
>             Thread.sleep(delay);
>         } catch (InterruptedException e) {
>         }
>         t.interrupt();
>     }
> }
> ----------------------------
> Output on RI:
> ================
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> Test passed: 104  (step: 0)
> Test passed: 104  (step: 1)
> Test passed: 104  (step: 2)
> Test passed: 104  (step: 3)
> Test passed: 104  (step: 4)
> Test passed: 104  (step: 5)
> Test passed: 104  (step: 6)
> Test passed: 104  (step: 7)
> Test passed: 104  (step: 8)
> Test passed: 104  (step: 9)
> Test passed: 104  (step: 10)
> Test passed: 104  (step: 11)
> Test passed: 104  (step: 12)
> Test passed: 104  (step: 13)
> Test passed: 104  (step: 14)
> Test passed: 104  (step: 15)
> Test passed: 104  (step: 16)
> Test passed: 104  (step: 17)
> Test passed: 104  (step: 18)
> Test passed: 104  (step: 19)
> Output on Harmony:
> ====================
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
> java version "1.5.0"
> pre-alpha : not complete or compatible
> svn = r471468, (Nov  7 2006), Windows/ia32/msvc 1310, release build
> http://incubator.apache.org/harmony
> Test passed: 104  (step: 0)
> Test passed: 104  (step: 1)
> Test passed: 104  (step: 2)
> Test passed: 104  (step: 3)
> Test passed: 104  (step: 4)
> Test passed: 104  (step: 5)
> Test passed: 104  (step: 6)
> Test passed: 104  (step: 7)
> Test passed: 104  (step: 8)
> Test passed: 104  (step: 9)
> Test passed: 104  (step: 10)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 11)
> Test passed: 104  (step: 12)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 13)
> Test passed: 104  (step: 14)
> Test passed: 104  (step: 15)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 16)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 17)
> Test passed: 104  (step: 18)
> Test passed: 104  (step: 19)
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
> java version "1.5.0" 
> pre-alpha : not complete or compatible
> svn = r471468, (Nov  7 2006), Linux/ia32/gcc 3.3.3, release build
> http://incubator.apache.org/harmony
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 0)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 1)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 2)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 3)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 4)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 5)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 6)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 7)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 8)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 9)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 10)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 11)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 12)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 13)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 14)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 15)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 16)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 17)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 18)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 19)
> This bug is reproducible on Jitrino (JET/OPT) and on interpreter:
> java -cp . volatileTest
> java -cp . -Xint volatileTest
> java -cp . -Xem:opt volatileTest

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (HARMONY-2092) [drlvm] Harmony works with volatile variables incorrectly

Posted by "Mikhail Fursov (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-2092?page=comments#action_12448068 ] 
            
Mikhail Fursov commented on HARMONY-2092:
-----------------------------------------

>Extra synchronization will decrease performance on some tests significantly. 
I hope it won't. Unless some specs use volatile variables heaviliy.

I think if we have the same performance for volatile minitests as RI - it is OK.


> [drlvm] Harmony works with volatile variables incorrectly
> ---------------------------------------------------------
>
>                 Key: HARMONY-2092
>                 URL: http://issues.apache.org/jira/browse/HARMONY-2092
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: Windows and Linux
>            Reporter: Vera Petrashkova
>         Attachments: volatileTest.zip
>
>
> When Long_MAX_VALUE or Long.MIN_VALUE should be assigned to volatile variable then
> VM works incorrectly.
> Code for reproducing:
> ------------------volatileTest.java-----------------
> public class volatileTest  {
>     public static int delay = 5000;
>     private boolean interruptFlag = false;
>     long hi;
>     long lo;
>     volatile long v;
>     public static void main(String [] args ) {
>         int maxI = 20;
>         for (int i = 0; i < maxI; i++) {
>             int t = new volatileTest().test(delay);
>             System.out.println((t == 104 ? "Test passed: ": "Test failed: ") 
>                 + t + "  (step: " + i + ")");
>         }
>     }
>     public synchronized void interrupt() {
>         interruptFlag = true;
>     }
>     public synchronized boolean interrupted() {
>         return interruptFlag;
>     }
>     public volatileTest() {
>         super();
>         hi = Long.MAX_VALUE;
>         lo = Long.MIN_VALUE;
>         v = hi;              
>     }
>     public int test(int delay)  {        
>         boolean passed = true;
>         Thread_1_class  t1 = new Thread_1_class(this);
>         Thread_2_class t2 = new Thread_2_class(this);
>         Interruptor killer = new Interruptor(this, delay);
>         try {
>             t1.start();
>             t2.start();
>             killer.start();
>       
>             while (!interrupted()) {
>                 Thread.yield();
>                 long v3 = v;
>                 if (v3 != hi && v3 != lo) { 
>                     System.out.println(v3+"  "+hi +"  "+lo);
>                     passed = false;
>                     break;
>                 }            
>             }
>             t1.interrupt();
>             t2.interrupt();
>             return passed ? 104 : 105;
>        } catch (Throwable e) {
>            e.printStackTrace();
>            return 106;
>        }
>     }
> }
> class Thread_1_class extends Thread {
>    volatileTest thh;
>    public Thread_1_class (volatileTest t) {
>        super();
>        thh = t;
>    }
>    public void run() {
>        while (!isInterrupted()) {
>            thh.v = thh.lo;
>            thh.v = thh.hi;
>        }
>    }
> }
> class Thread_2_class extends Thread {
>    volatileTest thh;
>    public Thread_2_class (volatileTest t) {
>        super();
>        thh = t;
>    }
>    public void run() {
>        while (!isInterrupted()) {
>                 thh.v = thh.hi;
>                 thh.v = thh.lo;
>             }
>    }
> }
> class Interruptor extends Thread {
>     volatileTest t;
>     int delay;
>     public Interruptor(volatileTest t, int delay) {
>         this.t = t;
>         this.delay = delay;
>     }
>     public void run() {
>         try {
>             Thread.sleep(delay);
>         } catch (InterruptedException e) {
>         }
>         t.interrupt();
>     }
> }
> ----------------------------
> Output on RI:
> ================
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> Test passed: 104  (step: 0)
> Test passed: 104  (step: 1)
> Test passed: 104  (step: 2)
> Test passed: 104  (step: 3)
> Test passed: 104  (step: 4)
> Test passed: 104  (step: 5)
> Test passed: 104  (step: 6)
> Test passed: 104  (step: 7)
> Test passed: 104  (step: 8)
> Test passed: 104  (step: 9)
> Test passed: 104  (step: 10)
> Test passed: 104  (step: 11)
> Test passed: 104  (step: 12)
> Test passed: 104  (step: 13)
> Test passed: 104  (step: 14)
> Test passed: 104  (step: 15)
> Test passed: 104  (step: 16)
> Test passed: 104  (step: 17)
> Test passed: 104  (step: 18)
> Test passed: 104  (step: 19)
> Output on Harmony:
> ====================
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
> java version "1.5.0"
> pre-alpha : not complete or compatible
> svn = r471468, (Nov  7 2006), Windows/ia32/msvc 1310, release build
> http://incubator.apache.org/harmony
> Test passed: 104  (step: 0)
> Test passed: 104  (step: 1)
> Test passed: 104  (step: 2)
> Test passed: 104  (step: 3)
> Test passed: 104  (step: 4)
> Test passed: 104  (step: 5)
> Test passed: 104  (step: 6)
> Test passed: 104  (step: 7)
> Test passed: 104  (step: 8)
> Test passed: 104  (step: 9)
> Test passed: 104  (step: 10)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 11)
> Test passed: 104  (step: 12)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 13)
> Test passed: 104  (step: 14)
> Test passed: 104  (step: 15)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 16)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 17)
> Test passed: 104  (step: 18)
> Test passed: 104  (step: 19)
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
> java version "1.5.0" 
> pre-alpha : not complete or compatible
> svn = r471468, (Nov  7 2006), Linux/ia32/gcc 3.3.3, release build
> http://incubator.apache.org/harmony
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 0)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 1)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 2)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 3)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 4)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 5)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 6)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 7)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 8)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 9)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 10)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 11)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 12)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 13)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 14)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 15)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 16)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 17)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 18)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 19)
> This bug is reproducible on Jitrino (JET/OPT) and on interpreter:
> java -cp . volatileTest
> java -cp . -Xint volatileTest
> java -cp . -Xem:opt volatileTest

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Assigned: (HARMONY-2092) [drlvm] Harmony works with volatile variables incorrectly

Posted by "Gregory Shimansky (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-2092?page=all ]

Gregory Shimansky reassigned HARMONY-2092:
------------------------------------------

    Assignee: Gregory Shimansky

> [drlvm] Harmony works with volatile variables incorrectly
> ---------------------------------------------------------
>
>                 Key: HARMONY-2092
>                 URL: http://issues.apache.org/jira/browse/HARMONY-2092
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: Windows and Linux
>            Reporter: Vera Petrashkova
>         Assigned To: Gregory Shimansky
>         Attachments: classloader_and_gc_quick_fix.diff, volatileTest.zip
>
>
> When Long_MAX_VALUE or Long.MIN_VALUE should be assigned to volatile variable then
> VM works incorrectly.
> Code for reproducing:
> ------------------volatileTest.java-----------------
> public class volatileTest  {
>     public static int delay = 5000;
>     private boolean interruptFlag = false;
>     long hi;
>     long lo;
>     volatile long v;
>     public static void main(String [] args ) {
>         int maxI = 20;
>         for (int i = 0; i < maxI; i++) {
>             int t = new volatileTest().test(delay);
>             System.out.println((t == 104 ? "Test passed: ": "Test failed: ") 
>                 + t + "  (step: " + i + ")");
>         }
>     }
>     public synchronized void interrupt() {
>         interruptFlag = true;
>     }
>     public synchronized boolean interrupted() {
>         return interruptFlag;
>     }
>     public volatileTest() {
>         super();
>         hi = Long.MAX_VALUE;
>         lo = Long.MIN_VALUE;
>         v = hi;              
>     }
>     public int test(int delay)  {        
>         boolean passed = true;
>         Thread_1_class  t1 = new Thread_1_class(this);
>         Thread_2_class t2 = new Thread_2_class(this);
>         Interruptor killer = new Interruptor(this, delay);
>         try {
>             t1.start();
>             t2.start();
>             killer.start();
>       
>             while (!interrupted()) {
>                 Thread.yield();
>                 long v3 = v;
>                 if (v3 != hi && v3 != lo) { 
>                     System.out.println(v3+"  "+hi +"  "+lo);
>                     passed = false;
>                     break;
>                 }            
>             }
>             t1.interrupt();
>             t2.interrupt();
>             return passed ? 104 : 105;
>        } catch (Throwable e) {
>            e.printStackTrace();
>            return 106;
>        }
>     }
> }
> class Thread_1_class extends Thread {
>    volatileTest thh;
>    public Thread_1_class (volatileTest t) {
>        super();
>        thh = t;
>    }
>    public void run() {
>        while (!isInterrupted()) {
>            thh.v = thh.lo;
>            thh.v = thh.hi;
>        }
>    }
> }
> class Thread_2_class extends Thread {
>    volatileTest thh;
>    public Thread_2_class (volatileTest t) {
>        super();
>        thh = t;
>    }
>    public void run() {
>        while (!isInterrupted()) {
>                 thh.v = thh.hi;
>                 thh.v = thh.lo;
>             }
>    }
> }
> class Interruptor extends Thread {
>     volatileTest t;
>     int delay;
>     public Interruptor(volatileTest t, int delay) {
>         this.t = t;
>         this.delay = delay;
>     }
>     public void run() {
>         try {
>             Thread.sleep(delay);
>         } catch (InterruptedException e) {
>         }
>         t.interrupt();
>     }
> }
> ----------------------------
> Output on RI:
> ================
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> Test passed: 104  (step: 0)
> Test passed: 104  (step: 1)
> Test passed: 104  (step: 2)
> Test passed: 104  (step: 3)
> Test passed: 104  (step: 4)
> Test passed: 104  (step: 5)
> Test passed: 104  (step: 6)
> Test passed: 104  (step: 7)
> Test passed: 104  (step: 8)
> Test passed: 104  (step: 9)
> Test passed: 104  (step: 10)
> Test passed: 104  (step: 11)
> Test passed: 104  (step: 12)
> Test passed: 104  (step: 13)
> Test passed: 104  (step: 14)
> Test passed: 104  (step: 15)
> Test passed: 104  (step: 16)
> Test passed: 104  (step: 17)
> Test passed: 104  (step: 18)
> Test passed: 104  (step: 19)
> Output on Harmony:
> ====================
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
> java version "1.5.0"
> pre-alpha : not complete or compatible
> svn = r471468, (Nov  7 2006), Windows/ia32/msvc 1310, release build
> http://incubator.apache.org/harmony
> Test passed: 104  (step: 0)
> Test passed: 104  (step: 1)
> Test passed: 104  (step: 2)
> Test passed: 104  (step: 3)
> Test passed: 104  (step: 4)
> Test passed: 104  (step: 5)
> Test passed: 104  (step: 6)
> Test passed: 104  (step: 7)
> Test passed: 104  (step: 8)
> Test passed: 104  (step: 9)
> Test passed: 104  (step: 10)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 11)
> Test passed: 104  (step: 12)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 13)
> Test passed: 104  (step: 14)
> Test passed: 104  (step: 15)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 16)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 17)
> Test passed: 104  (step: 18)
> Test passed: 104  (step: 19)
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
> java version "1.5.0" 
> pre-alpha : not complete or compatible
> svn = r471468, (Nov  7 2006), Linux/ia32/gcc 3.3.3, release build
> http://incubator.apache.org/harmony
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 0)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 1)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 2)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 3)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 4)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 5)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 6)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 7)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 8)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 9)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 10)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 11)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 12)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 13)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 14)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 15)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 16)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 17)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 18)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 19)
> This bug is reproducible on Jitrino (JET/OPT) and on interpreter:
> java -cp . volatileTest
> java -cp . -Xint volatileTest
> java -cp . -Xem:opt volatileTest

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (HARMONY-2092) [drlvm] Harmony works with volatile variables incorrectly

Posted by "Ivan Volosyuk (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-2092?page=all ]

Ivan Volosyuk updated HARMONY-2092:
-----------------------------------

    Attachment: classloader_and_gc_quick_fix.diff

Here is a quick and dirty fix for the problem in classloader and gc object alignment.
After the fix interpreter works fine on the attached test.

It makes sense to do the corresponding changes in jitrino now.

> [drlvm] Harmony works with volatile variables incorrectly
> ---------------------------------------------------------
>
>                 Key: HARMONY-2092
>                 URL: http://issues.apache.org/jira/browse/HARMONY-2092
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: Windows and Linux
>            Reporter: Vera Petrashkova
>         Attachments: classloader_and_gc_quick_fix.diff, volatileTest.zip
>
>
> When Long_MAX_VALUE or Long.MIN_VALUE should be assigned to volatile variable then
> VM works incorrectly.
> Code for reproducing:
> ------------------volatileTest.java-----------------
> public class volatileTest  {
>     public static int delay = 5000;
>     private boolean interruptFlag = false;
>     long hi;
>     long lo;
>     volatile long v;
>     public static void main(String [] args ) {
>         int maxI = 20;
>         for (int i = 0; i < maxI; i++) {
>             int t = new volatileTest().test(delay);
>             System.out.println((t == 104 ? "Test passed: ": "Test failed: ") 
>                 + t + "  (step: " + i + ")");
>         }
>     }
>     public synchronized void interrupt() {
>         interruptFlag = true;
>     }
>     public synchronized boolean interrupted() {
>         return interruptFlag;
>     }
>     public volatileTest() {
>         super();
>         hi = Long.MAX_VALUE;
>         lo = Long.MIN_VALUE;
>         v = hi;              
>     }
>     public int test(int delay)  {        
>         boolean passed = true;
>         Thread_1_class  t1 = new Thread_1_class(this);
>         Thread_2_class t2 = new Thread_2_class(this);
>         Interruptor killer = new Interruptor(this, delay);
>         try {
>             t1.start();
>             t2.start();
>             killer.start();
>       
>             while (!interrupted()) {
>                 Thread.yield();
>                 long v3 = v;
>                 if (v3 != hi && v3 != lo) { 
>                     System.out.println(v3+"  "+hi +"  "+lo);
>                     passed = false;
>                     break;
>                 }            
>             }
>             t1.interrupt();
>             t2.interrupt();
>             return passed ? 104 : 105;
>        } catch (Throwable e) {
>            e.printStackTrace();
>            return 106;
>        }
>     }
> }
> class Thread_1_class extends Thread {
>    volatileTest thh;
>    public Thread_1_class (volatileTest t) {
>        super();
>        thh = t;
>    }
>    public void run() {
>        while (!isInterrupted()) {
>            thh.v = thh.lo;
>            thh.v = thh.hi;
>        }
>    }
> }
> class Thread_2_class extends Thread {
>    volatileTest thh;
>    public Thread_2_class (volatileTest t) {
>        super();
>        thh = t;
>    }
>    public void run() {
>        while (!isInterrupted()) {
>                 thh.v = thh.hi;
>                 thh.v = thh.lo;
>             }
>    }
> }
> class Interruptor extends Thread {
>     volatileTest t;
>     int delay;
>     public Interruptor(volatileTest t, int delay) {
>         this.t = t;
>         this.delay = delay;
>     }
>     public void run() {
>         try {
>             Thread.sleep(delay);
>         } catch (InterruptedException e) {
>         }
>         t.interrupt();
>     }
> }
> ----------------------------
> Output on RI:
> ================
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> Test passed: 104  (step: 0)
> Test passed: 104  (step: 1)
> Test passed: 104  (step: 2)
> Test passed: 104  (step: 3)
> Test passed: 104  (step: 4)
> Test passed: 104  (step: 5)
> Test passed: 104  (step: 6)
> Test passed: 104  (step: 7)
> Test passed: 104  (step: 8)
> Test passed: 104  (step: 9)
> Test passed: 104  (step: 10)
> Test passed: 104  (step: 11)
> Test passed: 104  (step: 12)
> Test passed: 104  (step: 13)
> Test passed: 104  (step: 14)
> Test passed: 104  (step: 15)
> Test passed: 104  (step: 16)
> Test passed: 104  (step: 17)
> Test passed: 104  (step: 18)
> Test passed: 104  (step: 19)
> Output on Harmony:
> ====================
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
> java version "1.5.0"
> pre-alpha : not complete or compatible
> svn = r471468, (Nov  7 2006), Windows/ia32/msvc 1310, release build
> http://incubator.apache.org/harmony
> Test passed: 104  (step: 0)
> Test passed: 104  (step: 1)
> Test passed: 104  (step: 2)
> Test passed: 104  (step: 3)
> Test passed: 104  (step: 4)
> Test passed: 104  (step: 5)
> Test passed: 104  (step: 6)
> Test passed: 104  (step: 7)
> Test passed: 104  (step: 8)
> Test passed: 104  (step: 9)
> Test passed: 104  (step: 10)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 11)
> Test passed: 104  (step: 12)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 13)
> Test passed: 104  (step: 14)
> Test passed: 104  (step: 15)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 16)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 17)
> Test passed: 104  (step: 18)
> Test passed: 104  (step: 19)
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
> java version "1.5.0" 
> pre-alpha : not complete or compatible
> svn = r471468, (Nov  7 2006), Linux/ia32/gcc 3.3.3, release build
> http://incubator.apache.org/harmony
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 0)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 1)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 2)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 3)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 4)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 5)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 6)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 7)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 8)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 9)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 10)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 11)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 12)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 13)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 14)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 15)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 16)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 17)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 18)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 19)
> This bug is reproducible on Jitrino (JET/OPT) and on interpreter:
> java -cp . volatileTest
> java -cp . -Xint volatileTest
> java -cp . -Xem:opt volatileTest

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (HARMONY-2092) [drlvm] Harmony works with volatile variables incorrectly

Posted by "Ivan Volosyuk (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-2092?page=comments#action_12448203 ] 
            
Ivan Volosyuk commented on HARMONY-2092:
----------------------------------------

IMHO, to make it pass on interpreter we need changes in GC and classloader to align objects on 64bit boundary, otherwise we will have problems with objects crossing borders of cache lines.

> [drlvm] Harmony works with volatile variables incorrectly
> ---------------------------------------------------------
>
>                 Key: HARMONY-2092
>                 URL: http://issues.apache.org/jira/browse/HARMONY-2092
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: Windows and Linux
>            Reporter: Vera Petrashkova
>         Attachments: volatileTest.zip
>
>
> When Long_MAX_VALUE or Long.MIN_VALUE should be assigned to volatile variable then
> VM works incorrectly.
> Code for reproducing:
> ------------------volatileTest.java-----------------
> public class volatileTest  {
>     public static int delay = 5000;
>     private boolean interruptFlag = false;
>     long hi;
>     long lo;
>     volatile long v;
>     public static void main(String [] args ) {
>         int maxI = 20;
>         for (int i = 0; i < maxI; i++) {
>             int t = new volatileTest().test(delay);
>             System.out.println((t == 104 ? "Test passed: ": "Test failed: ") 
>                 + t + "  (step: " + i + ")");
>         }
>     }
>     public synchronized void interrupt() {
>         interruptFlag = true;
>     }
>     public synchronized boolean interrupted() {
>         return interruptFlag;
>     }
>     public volatileTest() {
>         super();
>         hi = Long.MAX_VALUE;
>         lo = Long.MIN_VALUE;
>         v = hi;              
>     }
>     public int test(int delay)  {        
>         boolean passed = true;
>         Thread_1_class  t1 = new Thread_1_class(this);
>         Thread_2_class t2 = new Thread_2_class(this);
>         Interruptor killer = new Interruptor(this, delay);
>         try {
>             t1.start();
>             t2.start();
>             killer.start();
>       
>             while (!interrupted()) {
>                 Thread.yield();
>                 long v3 = v;
>                 if (v3 != hi && v3 != lo) { 
>                     System.out.println(v3+"  "+hi +"  "+lo);
>                     passed = false;
>                     break;
>                 }            
>             }
>             t1.interrupt();
>             t2.interrupt();
>             return passed ? 104 : 105;
>        } catch (Throwable e) {
>            e.printStackTrace();
>            return 106;
>        }
>     }
> }
> class Thread_1_class extends Thread {
>    volatileTest thh;
>    public Thread_1_class (volatileTest t) {
>        super();
>        thh = t;
>    }
>    public void run() {
>        while (!isInterrupted()) {
>            thh.v = thh.lo;
>            thh.v = thh.hi;
>        }
>    }
> }
> class Thread_2_class extends Thread {
>    volatileTest thh;
>    public Thread_2_class (volatileTest t) {
>        super();
>        thh = t;
>    }
>    public void run() {
>        while (!isInterrupted()) {
>                 thh.v = thh.hi;
>                 thh.v = thh.lo;
>             }
>    }
> }
> class Interruptor extends Thread {
>     volatileTest t;
>     int delay;
>     public Interruptor(volatileTest t, int delay) {
>         this.t = t;
>         this.delay = delay;
>     }
>     public void run() {
>         try {
>             Thread.sleep(delay);
>         } catch (InterruptedException e) {
>         }
>         t.interrupt();
>     }
> }
> ----------------------------
> Output on RI:
> ================
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> Test passed: 104  (step: 0)
> Test passed: 104  (step: 1)
> Test passed: 104  (step: 2)
> Test passed: 104  (step: 3)
> Test passed: 104  (step: 4)
> Test passed: 104  (step: 5)
> Test passed: 104  (step: 6)
> Test passed: 104  (step: 7)
> Test passed: 104  (step: 8)
> Test passed: 104  (step: 9)
> Test passed: 104  (step: 10)
> Test passed: 104  (step: 11)
> Test passed: 104  (step: 12)
> Test passed: 104  (step: 13)
> Test passed: 104  (step: 14)
> Test passed: 104  (step: 15)
> Test passed: 104  (step: 16)
> Test passed: 104  (step: 17)
> Test passed: 104  (step: 18)
> Test passed: 104  (step: 19)
> Output on Harmony:
> ====================
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
> java version "1.5.0"
> pre-alpha : not complete or compatible
> svn = r471468, (Nov  7 2006), Windows/ia32/msvc 1310, release build
> http://incubator.apache.org/harmony
> Test passed: 104  (step: 0)
> Test passed: 104  (step: 1)
> Test passed: 104  (step: 2)
> Test passed: 104  (step: 3)
> Test passed: 104  (step: 4)
> Test passed: 104  (step: 5)
> Test passed: 104  (step: 6)
> Test passed: 104  (step: 7)
> Test passed: 104  (step: 8)
> Test passed: 104  (step: 9)
> Test passed: 104  (step: 10)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 11)
> Test passed: 104  (step: 12)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 13)
> Test passed: 104  (step: 14)
> Test passed: 104  (step: 15)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 16)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 17)
> Test passed: 104  (step: 18)
> Test passed: 104  (step: 19)
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
> java version "1.5.0" 
> pre-alpha : not complete or compatible
> svn = r471468, (Nov  7 2006), Linux/ia32/gcc 3.3.3, release build
> http://incubator.apache.org/harmony
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 0)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 1)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 2)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 3)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 4)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 5)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 6)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 7)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 8)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 9)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 10)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 11)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 12)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 13)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 14)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 15)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 16)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 17)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 18)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 19)
> This bug is reproducible on Jitrino (JET/OPT) and on interpreter:
> java -cp . volatileTest
> java -cp . -Xint volatileTest
> java -cp . -Xem:opt volatileTest

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (HARMONY-2092) [drlvm] Harmony works with volatile variables incorrectly

Posted by "Ivan Volosyuk (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-2092?page=comments#action_12448435 ] 
            
Ivan Volosyuk commented on HARMONY-2092:
----------------------------------------

Memory fence istructions can be still required for volatile fields on interpreter for correctness.

> [drlvm] Harmony works with volatile variables incorrectly
> ---------------------------------------------------------
>
>                 Key: HARMONY-2092
>                 URL: http://issues.apache.org/jira/browse/HARMONY-2092
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: Windows and Linux
>            Reporter: Vera Petrashkova
>         Assigned To: Gregory Shimansky
>         Attachments: classloader_and_gc_quick_fix.diff, volatileTest.zip
>
>
> When Long_MAX_VALUE or Long.MIN_VALUE should be assigned to volatile variable then
> VM works incorrectly.
> Code for reproducing:
> ------------------volatileTest.java-----------------
> public class volatileTest  {
>     public static int delay = 5000;
>     private boolean interruptFlag = false;
>     long hi;
>     long lo;
>     volatile long v;
>     public static void main(String [] args ) {
>         int maxI = 20;
>         for (int i = 0; i < maxI; i++) {
>             int t = new volatileTest().test(delay);
>             System.out.println((t == 104 ? "Test passed: ": "Test failed: ") 
>                 + t + "  (step: " + i + ")");
>         }
>     }
>     public synchronized void interrupt() {
>         interruptFlag = true;
>     }
>     public synchronized boolean interrupted() {
>         return interruptFlag;
>     }
>     public volatileTest() {
>         super();
>         hi = Long.MAX_VALUE;
>         lo = Long.MIN_VALUE;
>         v = hi;              
>     }
>     public int test(int delay)  {        
>         boolean passed = true;
>         Thread_1_class  t1 = new Thread_1_class(this);
>         Thread_2_class t2 = new Thread_2_class(this);
>         Interruptor killer = new Interruptor(this, delay);
>         try {
>             t1.start();
>             t2.start();
>             killer.start();
>       
>             while (!interrupted()) {
>                 Thread.yield();
>                 long v3 = v;
>                 if (v3 != hi && v3 != lo) { 
>                     System.out.println(v3+"  "+hi +"  "+lo);
>                     passed = false;
>                     break;
>                 }            
>             }
>             t1.interrupt();
>             t2.interrupt();
>             return passed ? 104 : 105;
>        } catch (Throwable e) {
>            e.printStackTrace();
>            return 106;
>        }
>     }
> }
> class Thread_1_class extends Thread {
>    volatileTest thh;
>    public Thread_1_class (volatileTest t) {
>        super();
>        thh = t;
>    }
>    public void run() {
>        while (!isInterrupted()) {
>            thh.v = thh.lo;
>            thh.v = thh.hi;
>        }
>    }
> }
> class Thread_2_class extends Thread {
>    volatileTest thh;
>    public Thread_2_class (volatileTest t) {
>        super();
>        thh = t;
>    }
>    public void run() {
>        while (!isInterrupted()) {
>                 thh.v = thh.hi;
>                 thh.v = thh.lo;
>             }
>    }
> }
> class Interruptor extends Thread {
>     volatileTest t;
>     int delay;
>     public Interruptor(volatileTest t, int delay) {
>         this.t = t;
>         this.delay = delay;
>     }
>     public void run() {
>         try {
>             Thread.sleep(delay);
>         } catch (InterruptedException e) {
>         }
>         t.interrupt();
>     }
> }
> ----------------------------
> Output on RI:
> ================
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> Test passed: 104  (step: 0)
> Test passed: 104  (step: 1)
> Test passed: 104  (step: 2)
> Test passed: 104  (step: 3)
> Test passed: 104  (step: 4)
> Test passed: 104  (step: 5)
> Test passed: 104  (step: 6)
> Test passed: 104  (step: 7)
> Test passed: 104  (step: 8)
> Test passed: 104  (step: 9)
> Test passed: 104  (step: 10)
> Test passed: 104  (step: 11)
> Test passed: 104  (step: 12)
> Test passed: 104  (step: 13)
> Test passed: 104  (step: 14)
> Test passed: 104  (step: 15)
> Test passed: 104  (step: 16)
> Test passed: 104  (step: 17)
> Test passed: 104  (step: 18)
> Test passed: 104  (step: 19)
> Output on Harmony:
> ====================
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
> java version "1.5.0"
> pre-alpha : not complete or compatible
> svn = r471468, (Nov  7 2006), Windows/ia32/msvc 1310, release build
> http://incubator.apache.org/harmony
> Test passed: 104  (step: 0)
> Test passed: 104  (step: 1)
> Test passed: 104  (step: 2)
> Test passed: 104  (step: 3)
> Test passed: 104  (step: 4)
> Test passed: 104  (step: 5)
> Test passed: 104  (step: 6)
> Test passed: 104  (step: 7)
> Test passed: 104  (step: 8)
> Test passed: 104  (step: 9)
> Test passed: 104  (step: 10)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 11)
> Test passed: 104  (step: 12)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 13)
> Test passed: 104  (step: 14)
> Test passed: 104  (step: 15)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 16)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 17)
> Test passed: 104  (step: 18)
> Test passed: 104  (step: 19)
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
> java version "1.5.0" 
> pre-alpha : not complete or compatible
> svn = r471468, (Nov  7 2006), Linux/ia32/gcc 3.3.3, release build
> http://incubator.apache.org/harmony
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 0)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 1)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 2)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 3)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 4)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 5)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 6)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 7)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 8)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 9)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 10)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 11)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 12)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 13)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 14)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 15)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 16)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 17)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 18)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 19)
> This bug is reproducible on Jitrino (JET/OPT) and on interpreter:
> java -cp . volatileTest
> java -cp . -Xint volatileTest
> java -cp . -Xem:opt volatileTest

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (HARMONY-2092) [drlvm] Harmony works with volatile variables incorrectly

Posted by "Vera Petrashkova (JIRA)" <ji...@apache.org>.
     [ http://issues.apache.org/jira/browse/HARMONY-2092?page=all ]

Vera Petrashkova updated HARMONY-2092:
--------------------------------------

    Attachment: volatileTest.zip

volatileTest.zip contains test source code and class files

> [drlvm] Harmony works with volatile variables incorrectly
> ---------------------------------------------------------
>
>                 Key: HARMONY-2092
>                 URL: http://issues.apache.org/jira/browse/HARMONY-2092
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: Windows and Linux
>            Reporter: Vera Petrashkova
>         Attachments: volatileTest.zip
>
>
> When Long_MAX_VALUE or Long.MIN_VALUE should be assigned to volatile variable then
> VM works incorrectly.
> Code for reproducing:
> ------------------volatileTest.java-----------------
> public class volatileTest  {
>     public static int delay = 5000;
>     private boolean interruptFlag = false;
>     long hi;
>     long lo;
>     volatile long v;
>     public static void main(String [] args ) {
>         int maxI = 20;
>         for (int i = 0; i < maxI; i++) {
>             int t = new volatileTest().test(delay);
>             System.out.println((t == 104 ? "Test passed: ": "Test failed: ") 
>                 + t + "  (step: " + i + ")");
>         }
>     }
>     public synchronized void interrupt() {
>         interruptFlag = true;
>     }
>     public synchronized boolean interrupted() {
>         return interruptFlag;
>     }
>     public volatileTest() {
>         super();
>         hi = Long.MAX_VALUE;
>         lo = Long.MIN_VALUE;
>         v = hi;              
>     }
>     public int test(int delay)  {        
>         boolean passed = true;
>         Thread_1_class  t1 = new Thread_1_class(this);
>         Thread_2_class t2 = new Thread_2_class(this);
>         Interruptor killer = new Interruptor(this, delay);
>         try {
>             t1.start();
>             t2.start();
>             killer.start();
>       
>             while (!interrupted()) {
>                 Thread.yield();
>                 long v3 = v;
>                 if (v3 != hi && v3 != lo) { 
>                     System.out.println(v3+"  "+hi +"  "+lo);
>                     passed = false;
>                     break;
>                 }            
>             }
>             t1.interrupt();
>             t2.interrupt();
>             return passed ? 104 : 105;
>        } catch (Throwable e) {
>            e.printStackTrace();
>            return 106;
>        }
>     }
> }
> class Thread_1_class extends Thread {
>    volatileTest thh;
>    public Thread_1_class (volatileTest t) {
>        super();
>        thh = t;
>    }
>    public void run() {
>        while (!isInterrupted()) {
>            thh.v = thh.lo;
>            thh.v = thh.hi;
>        }
>    }
> }
> class Thread_2_class extends Thread {
>    volatileTest thh;
>    public Thread_2_class (volatileTest t) {
>        super();
>        thh = t;
>    }
>    public void run() {
>        while (!isInterrupted()) {
>                 thh.v = thh.hi;
>                 thh.v = thh.lo;
>             }
>    }
> }
> class Interruptor extends Thread {
>     volatileTest t;
>     int delay;
>     public Interruptor(volatileTest t, int delay) {
>         this.t = t;
>         this.delay = delay;
>     }
>     public void run() {
>         try {
>             Thread.sleep(delay);
>         } catch (InterruptedException e) {
>         }
>         t.interrupt();
>     }
> }
> ----------------------------
> Output on RI:
> ================
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> Test passed: 104  (step: 0)
> Test passed: 104  (step: 1)
> Test passed: 104  (step: 2)
> Test passed: 104  (step: 3)
> Test passed: 104  (step: 4)
> Test passed: 104  (step: 5)
> Test passed: 104  (step: 6)
> Test passed: 104  (step: 7)
> Test passed: 104  (step: 8)
> Test passed: 104  (step: 9)
> Test passed: 104  (step: 10)
> Test passed: 104  (step: 11)
> Test passed: 104  (step: 12)
> Test passed: 104  (step: 13)
> Test passed: 104  (step: 14)
> Test passed: 104  (step: 15)
> Test passed: 104  (step: 16)
> Test passed: 104  (step: 17)
> Test passed: 104  (step: 18)
> Test passed: 104  (step: 19)
> Output on Harmony:
> ====================
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
> java version "1.5.0"
> pre-alpha : not complete or compatible
> svn = r471468, (Nov  7 2006), Windows/ia32/msvc 1310, release build
> http://incubator.apache.org/harmony
> Test passed: 104  (step: 0)
> Test passed: 104  (step: 1)
> Test passed: 104  (step: 2)
> Test passed: 104  (step: 3)
> Test passed: 104  (step: 4)
> Test passed: 104  (step: 5)
> Test passed: 104  (step: 6)
> Test passed: 104  (step: 7)
> Test passed: 104  (step: 8)
> Test passed: 104  (step: 9)
> Test passed: 104  (step: 10)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 11)
> Test passed: 104  (step: 12)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 13)
> Test passed: 104  (step: 14)
> Test passed: 104  (step: 15)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 16)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 17)
> Test passed: 104  (step: 18)
> Test passed: 104  (step: 19)
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
> java version "1.5.0" 
> pre-alpha : not complete or compatible
> svn = r471468, (Nov  7 2006), Linux/ia32/gcc 3.3.3, release build
> http://incubator.apache.org/harmony
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 0)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 1)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 2)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 3)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 4)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 5)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 6)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 7)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 8)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 9)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 10)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 11)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 12)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 13)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 14)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 15)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 16)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 17)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 18)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 19)
> This bug is reproducible on Jitrino (JET/OPT) and on interpreter:
> java -cp . volatileTest
> java -cp . -Xint volatileTest
> java -cp . -Xem:opt volatileTest

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (HARMONY-2092) [drlvm] Harmony works with volatile variables incorrectly

Posted by "Egor Pasko (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-2092?page=comments#action_12448071 ] 
            
Egor Pasko commented on HARMONY-2092:
-------------------------------------

> I think if we have the same performance for volatile minitests as RI - it is OK. 

agreed. I created a subtask for such kind of mini-test

> [drlvm] Harmony works with volatile variables incorrectly
> ---------------------------------------------------------
>
>                 Key: HARMONY-2092
>                 URL: http://issues.apache.org/jira/browse/HARMONY-2092
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: Windows and Linux
>            Reporter: Vera Petrashkova
>         Attachments: volatileTest.zip
>
>
> When Long_MAX_VALUE or Long.MIN_VALUE should be assigned to volatile variable then
> VM works incorrectly.
> Code for reproducing:
> ------------------volatileTest.java-----------------
> public class volatileTest  {
>     public static int delay = 5000;
>     private boolean interruptFlag = false;
>     long hi;
>     long lo;
>     volatile long v;
>     public static void main(String [] args ) {
>         int maxI = 20;
>         for (int i = 0; i < maxI; i++) {
>             int t = new volatileTest().test(delay);
>             System.out.println((t == 104 ? "Test passed: ": "Test failed: ") 
>                 + t + "  (step: " + i + ")");
>         }
>     }
>     public synchronized void interrupt() {
>         interruptFlag = true;
>     }
>     public synchronized boolean interrupted() {
>         return interruptFlag;
>     }
>     public volatileTest() {
>         super();
>         hi = Long.MAX_VALUE;
>         lo = Long.MIN_VALUE;
>         v = hi;              
>     }
>     public int test(int delay)  {        
>         boolean passed = true;
>         Thread_1_class  t1 = new Thread_1_class(this);
>         Thread_2_class t2 = new Thread_2_class(this);
>         Interruptor killer = new Interruptor(this, delay);
>         try {
>             t1.start();
>             t2.start();
>             killer.start();
>       
>             while (!interrupted()) {
>                 Thread.yield();
>                 long v3 = v;
>                 if (v3 != hi && v3 != lo) { 
>                     System.out.println(v3+"  "+hi +"  "+lo);
>                     passed = false;
>                     break;
>                 }            
>             }
>             t1.interrupt();
>             t2.interrupt();
>             return passed ? 104 : 105;
>        } catch (Throwable e) {
>            e.printStackTrace();
>            return 106;
>        }
>     }
> }
> class Thread_1_class extends Thread {
>    volatileTest thh;
>    public Thread_1_class (volatileTest t) {
>        super();
>        thh = t;
>    }
>    public void run() {
>        while (!isInterrupted()) {
>            thh.v = thh.lo;
>            thh.v = thh.hi;
>        }
>    }
> }
> class Thread_2_class extends Thread {
>    volatileTest thh;
>    public Thread_2_class (volatileTest t) {
>        super();
>        thh = t;
>    }
>    public void run() {
>        while (!isInterrupted()) {
>                 thh.v = thh.hi;
>                 thh.v = thh.lo;
>             }
>    }
> }
> class Interruptor extends Thread {
>     volatileTest t;
>     int delay;
>     public Interruptor(volatileTest t, int delay) {
>         this.t = t;
>         this.delay = delay;
>     }
>     public void run() {
>         try {
>             Thread.sleep(delay);
>         } catch (InterruptedException e) {
>         }
>         t.interrupt();
>     }
> }
> ----------------------------
> Output on RI:
> ================
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> Test passed: 104  (step: 0)
> Test passed: 104  (step: 1)
> Test passed: 104  (step: 2)
> Test passed: 104  (step: 3)
> Test passed: 104  (step: 4)
> Test passed: 104  (step: 5)
> Test passed: 104  (step: 6)
> Test passed: 104  (step: 7)
> Test passed: 104  (step: 8)
> Test passed: 104  (step: 9)
> Test passed: 104  (step: 10)
> Test passed: 104  (step: 11)
> Test passed: 104  (step: 12)
> Test passed: 104  (step: 13)
> Test passed: 104  (step: 14)
> Test passed: 104  (step: 15)
> Test passed: 104  (step: 16)
> Test passed: 104  (step: 17)
> Test passed: 104  (step: 18)
> Test passed: 104  (step: 19)
> Output on Harmony:
> ====================
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
> java version "1.5.0"
> pre-alpha : not complete or compatible
> svn = r471468, (Nov  7 2006), Windows/ia32/msvc 1310, release build
> http://incubator.apache.org/harmony
> Test passed: 104  (step: 0)
> Test passed: 104  (step: 1)
> Test passed: 104  (step: 2)
> Test passed: 104  (step: 3)
> Test passed: 104  (step: 4)
> Test passed: 104  (step: 5)
> Test passed: 104  (step: 6)
> Test passed: 104  (step: 7)
> Test passed: 104  (step: 8)
> Test passed: 104  (step: 9)
> Test passed: 104  (step: 10)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 11)
> Test passed: 104  (step: 12)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 13)
> Test passed: 104  (step: 14)
> Test passed: 104  (step: 15)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 16)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 17)
> Test passed: 104  (step: 18)
> Test passed: 104  (step: 19)
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
> java version "1.5.0" 
> pre-alpha : not complete or compatible
> svn = r471468, (Nov  7 2006), Linux/ia32/gcc 3.3.3, release build
> http://incubator.apache.org/harmony
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 0)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 1)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 2)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 3)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 4)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 5)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 6)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 7)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 8)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 9)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 10)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 11)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 12)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 13)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 14)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 15)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 16)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 17)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 18)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 19)
> This bug is reproducible on Jitrino (JET/OPT) and on interpreter:
> java -cp . volatileTest
> java -cp . -Xint volatileTest
> java -cp . -Xem:opt volatileTest

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (HARMONY-2092) [drlvm] Harmony works with volatile variables incorrectly

Posted by "Egor Pasko (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-2092?page=comments#action_12448065 ] 
            
Egor Pasko commented on HARMONY-2092:
-------------------------------------

If I get it right, volatile variables should be atomic regardless of their type (JVM Spec: "8.7 Rules for volatile Variables"). 
There is a special exception for volatile variables of the types 'double' and 'long' (JVM Spec: "8.4 Nonatomic Treatment of double and long Variables")

This bug should be fixed in several components (int, JET, OPT, VM). Extra synchronization will decrease performance on some tests significantly. Any ideas for alternative solutions?

P.S.: I think, the test can be somewhat reduced.
P.P.S.: I would have changed the subject to "[drlvm][jit][int] non-atomic treatment of volatile variables of type 'long'"


> [drlvm] Harmony works with volatile variables incorrectly
> ---------------------------------------------------------
>
>                 Key: HARMONY-2092
>                 URL: http://issues.apache.org/jira/browse/HARMONY-2092
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: Windows and Linux
>            Reporter: Vera Petrashkova
>         Attachments: volatileTest.zip
>
>
> When Long_MAX_VALUE or Long.MIN_VALUE should be assigned to volatile variable then
> VM works incorrectly.
> Code for reproducing:
> ------------------volatileTest.java-----------------
> public class volatileTest  {
>     public static int delay = 5000;
>     private boolean interruptFlag = false;
>     long hi;
>     long lo;
>     volatile long v;
>     public static void main(String [] args ) {
>         int maxI = 20;
>         for (int i = 0; i < maxI; i++) {
>             int t = new volatileTest().test(delay);
>             System.out.println((t == 104 ? "Test passed: ": "Test failed: ") 
>                 + t + "  (step: " + i + ")");
>         }
>     }
>     public synchronized void interrupt() {
>         interruptFlag = true;
>     }
>     public synchronized boolean interrupted() {
>         return interruptFlag;
>     }
>     public volatileTest() {
>         super();
>         hi = Long.MAX_VALUE;
>         lo = Long.MIN_VALUE;
>         v = hi;              
>     }
>     public int test(int delay)  {        
>         boolean passed = true;
>         Thread_1_class  t1 = new Thread_1_class(this);
>         Thread_2_class t2 = new Thread_2_class(this);
>         Interruptor killer = new Interruptor(this, delay);
>         try {
>             t1.start();
>             t2.start();
>             killer.start();
>       
>             while (!interrupted()) {
>                 Thread.yield();
>                 long v3 = v;
>                 if (v3 != hi && v3 != lo) { 
>                     System.out.println(v3+"  "+hi +"  "+lo);
>                     passed = false;
>                     break;
>                 }            
>             }
>             t1.interrupt();
>             t2.interrupt();
>             return passed ? 104 : 105;
>        } catch (Throwable e) {
>            e.printStackTrace();
>            return 106;
>        }
>     }
> }
> class Thread_1_class extends Thread {
>    volatileTest thh;
>    public Thread_1_class (volatileTest t) {
>        super();
>        thh = t;
>    }
>    public void run() {
>        while (!isInterrupted()) {
>            thh.v = thh.lo;
>            thh.v = thh.hi;
>        }
>    }
> }
> class Thread_2_class extends Thread {
>    volatileTest thh;
>    public Thread_2_class (volatileTest t) {
>        super();
>        thh = t;
>    }
>    public void run() {
>        while (!isInterrupted()) {
>                 thh.v = thh.hi;
>                 thh.v = thh.lo;
>             }
>    }
> }
> class Interruptor extends Thread {
>     volatileTest t;
>     int delay;
>     public Interruptor(volatileTest t, int delay) {
>         this.t = t;
>         this.delay = delay;
>     }
>     public void run() {
>         try {
>             Thread.sleep(delay);
>         } catch (InterruptedException e) {
>         }
>         t.interrupt();
>     }
> }
> ----------------------------
> Output on RI:
> ================
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> Test passed: 104  (step: 0)
> Test passed: 104  (step: 1)
> Test passed: 104  (step: 2)
> Test passed: 104  (step: 3)
> Test passed: 104  (step: 4)
> Test passed: 104  (step: 5)
> Test passed: 104  (step: 6)
> Test passed: 104  (step: 7)
> Test passed: 104  (step: 8)
> Test passed: 104  (step: 9)
> Test passed: 104  (step: 10)
> Test passed: 104  (step: 11)
> Test passed: 104  (step: 12)
> Test passed: 104  (step: 13)
> Test passed: 104  (step: 14)
> Test passed: 104  (step: 15)
> Test passed: 104  (step: 16)
> Test passed: 104  (step: 17)
> Test passed: 104  (step: 18)
> Test passed: 104  (step: 19)
> Output on Harmony:
> ====================
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
> java version "1.5.0"
> pre-alpha : not complete or compatible
> svn = r471468, (Nov  7 2006), Windows/ia32/msvc 1310, release build
> http://incubator.apache.org/harmony
> Test passed: 104  (step: 0)
> Test passed: 104  (step: 1)
> Test passed: 104  (step: 2)
> Test passed: 104  (step: 3)
> Test passed: 104  (step: 4)
> Test passed: 104  (step: 5)
> Test passed: 104  (step: 6)
> Test passed: 104  (step: 7)
> Test passed: 104  (step: 8)
> Test passed: 104  (step: 9)
> Test passed: 104  (step: 10)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 11)
> Test passed: 104  (step: 12)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 13)
> Test passed: 104  (step: 14)
> Test passed: 104  (step: 15)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 16)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 17)
> Test passed: 104  (step: 18)
> Test passed: 104  (step: 19)
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
> java version "1.5.0" 
> pre-alpha : not complete or compatible
> svn = r471468, (Nov  7 2006), Linux/ia32/gcc 3.3.3, release build
> http://incubator.apache.org/harmony
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 0)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 1)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 2)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 3)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 4)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 5)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 6)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 7)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 8)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 9)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 10)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 11)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 12)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 13)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 14)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 15)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 16)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 17)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 18)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 19)
> This bug is reproducible on Jitrino (JET/OPT) and on interpreter:
> java -cp . volatileTest
> java -cp . -Xint volatileTest
> java -cp . -Xem:opt volatileTest

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (HARMONY-2092) [drlvm] Harmony works with volatile variables incorrectly

Posted by "Ivan Volosyuk (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-2092?page=comments#action_12448206 ] 
            
Ivan Volosyuk commented on HARMONY-2092:
----------------------------------------

I'm going to make the changes in GC and classloader and check whether it fixes the problem on interpreter. Then we can make changes in jitrino to generate 64 bit read / writes on the volatile long/double fields.

> [drlvm] Harmony works with volatile variables incorrectly
> ---------------------------------------------------------
>
>                 Key: HARMONY-2092
>                 URL: http://issues.apache.org/jira/browse/HARMONY-2092
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: Windows and Linux
>            Reporter: Vera Petrashkova
>         Attachments: volatileTest.zip
>
>
> When Long_MAX_VALUE or Long.MIN_VALUE should be assigned to volatile variable then
> VM works incorrectly.
> Code for reproducing:
> ------------------volatileTest.java-----------------
> public class volatileTest  {
>     public static int delay = 5000;
>     private boolean interruptFlag = false;
>     long hi;
>     long lo;
>     volatile long v;
>     public static void main(String [] args ) {
>         int maxI = 20;
>         for (int i = 0; i < maxI; i++) {
>             int t = new volatileTest().test(delay);
>             System.out.println((t == 104 ? "Test passed: ": "Test failed: ") 
>                 + t + "  (step: " + i + ")");
>         }
>     }
>     public synchronized void interrupt() {
>         interruptFlag = true;
>     }
>     public synchronized boolean interrupted() {
>         return interruptFlag;
>     }
>     public volatileTest() {
>         super();
>         hi = Long.MAX_VALUE;
>         lo = Long.MIN_VALUE;
>         v = hi;              
>     }
>     public int test(int delay)  {        
>         boolean passed = true;
>         Thread_1_class  t1 = new Thread_1_class(this);
>         Thread_2_class t2 = new Thread_2_class(this);
>         Interruptor killer = new Interruptor(this, delay);
>         try {
>             t1.start();
>             t2.start();
>             killer.start();
>       
>             while (!interrupted()) {
>                 Thread.yield();
>                 long v3 = v;
>                 if (v3 != hi && v3 != lo) { 
>                     System.out.println(v3+"  "+hi +"  "+lo);
>                     passed = false;
>                     break;
>                 }            
>             }
>             t1.interrupt();
>             t2.interrupt();
>             return passed ? 104 : 105;
>        } catch (Throwable e) {
>            e.printStackTrace();
>            return 106;
>        }
>     }
> }
> class Thread_1_class extends Thread {
>    volatileTest thh;
>    public Thread_1_class (volatileTest t) {
>        super();
>        thh = t;
>    }
>    public void run() {
>        while (!isInterrupted()) {
>            thh.v = thh.lo;
>            thh.v = thh.hi;
>        }
>    }
> }
> class Thread_2_class extends Thread {
>    volatileTest thh;
>    public Thread_2_class (volatileTest t) {
>        super();
>        thh = t;
>    }
>    public void run() {
>        while (!isInterrupted()) {
>                 thh.v = thh.hi;
>                 thh.v = thh.lo;
>             }
>    }
> }
> class Interruptor extends Thread {
>     volatileTest t;
>     int delay;
>     public Interruptor(volatileTest t, int delay) {
>         this.t = t;
>         this.delay = delay;
>     }
>     public void run() {
>         try {
>             Thread.sleep(delay);
>         } catch (InterruptedException e) {
>         }
>         t.interrupt();
>     }
> }
> ----------------------------
> Output on RI:
> ================
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> Test passed: 104  (step: 0)
> Test passed: 104  (step: 1)
> Test passed: 104  (step: 2)
> Test passed: 104  (step: 3)
> Test passed: 104  (step: 4)
> Test passed: 104  (step: 5)
> Test passed: 104  (step: 6)
> Test passed: 104  (step: 7)
> Test passed: 104  (step: 8)
> Test passed: 104  (step: 9)
> Test passed: 104  (step: 10)
> Test passed: 104  (step: 11)
> Test passed: 104  (step: 12)
> Test passed: 104  (step: 13)
> Test passed: 104  (step: 14)
> Test passed: 104  (step: 15)
> Test passed: 104  (step: 16)
> Test passed: 104  (step: 17)
> Test passed: 104  (step: 18)
> Test passed: 104  (step: 19)
> Output on Harmony:
> ====================
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
> java version "1.5.0"
> pre-alpha : not complete or compatible
> svn = r471468, (Nov  7 2006), Windows/ia32/msvc 1310, release build
> http://incubator.apache.org/harmony
> Test passed: 104  (step: 0)
> Test passed: 104  (step: 1)
> Test passed: 104  (step: 2)
> Test passed: 104  (step: 3)
> Test passed: 104  (step: 4)
> Test passed: 104  (step: 5)
> Test passed: 104  (step: 6)
> Test passed: 104  (step: 7)
> Test passed: 104  (step: 8)
> Test passed: 104  (step: 9)
> Test passed: 104  (step: 10)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 11)
> Test passed: 104  (step: 12)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 13)
> Test passed: 104  (step: 14)
> Test passed: 104  (step: 15)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 16)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 17)
> Test passed: 104  (step: 18)
> Test passed: 104  (step: 19)
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
> java version "1.5.0" 
> pre-alpha : not complete or compatible
> svn = r471468, (Nov  7 2006), Linux/ia32/gcc 3.3.3, release build
> http://incubator.apache.org/harmony
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 0)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 1)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 2)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 3)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 4)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 5)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 6)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 7)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 8)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 9)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 10)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 11)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 12)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 13)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 14)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 15)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 16)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 17)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 18)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 19)
> This bug is reproducible on Jitrino (JET/OPT) and on interpreter:
> java -cp . volatileTest
> java -cp . -Xint volatileTest
> java -cp . -Xem:opt volatileTest

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (HARMONY-2092) [drlvm] Harmony works with volatile variables incorrectly

Posted by "Vera Petrashkova (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-2092?page=comments#action_12448048 ] 
            
Vera Petrashkova commented on HARMONY-2092:
-------------------------------------------

It is not reproducible when "int" volatile variable is used.
I run the test on 1- and 2-processor machines.


> [drlvm] Harmony works with volatile variables incorrectly
> ---------------------------------------------------------
>
>                 Key: HARMONY-2092
>                 URL: http://issues.apache.org/jira/browse/HARMONY-2092
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: Windows and Linux
>            Reporter: Vera Petrashkova
>         Attachments: volatileTest.zip
>
>
> When Long_MAX_VALUE or Long.MIN_VALUE should be assigned to volatile variable then
> VM works incorrectly.
> Code for reproducing:
> ------------------volatileTest.java-----------------
> public class volatileTest  {
>     public static int delay = 5000;
>     private boolean interruptFlag = false;
>     long hi;
>     long lo;
>     volatile long v;
>     public static void main(String [] args ) {
>         int maxI = 20;
>         for (int i = 0; i < maxI; i++) {
>             int t = new volatileTest().test(delay);
>             System.out.println((t == 104 ? "Test passed: ": "Test failed: ") 
>                 + t + "  (step: " + i + ")");
>         }
>     }
>     public synchronized void interrupt() {
>         interruptFlag = true;
>     }
>     public synchronized boolean interrupted() {
>         return interruptFlag;
>     }
>     public volatileTest() {
>         super();
>         hi = Long.MAX_VALUE;
>         lo = Long.MIN_VALUE;
>         v = hi;              
>     }
>     public int test(int delay)  {        
>         boolean passed = true;
>         Thread_1_class  t1 = new Thread_1_class(this);
>         Thread_2_class t2 = new Thread_2_class(this);
>         Interruptor killer = new Interruptor(this, delay);
>         try {
>             t1.start();
>             t2.start();
>             killer.start();
>       
>             while (!interrupted()) {
>                 Thread.yield();
>                 long v3 = v;
>                 if (v3 != hi && v3 != lo) { 
>                     System.out.println(v3+"  "+hi +"  "+lo);
>                     passed = false;
>                     break;
>                 }            
>             }
>             t1.interrupt();
>             t2.interrupt();
>             return passed ? 104 : 105;
>        } catch (Throwable e) {
>            e.printStackTrace();
>            return 106;
>        }
>     }
> }
> class Thread_1_class extends Thread {
>    volatileTest thh;
>    public Thread_1_class (volatileTest t) {
>        super();
>        thh = t;
>    }
>    public void run() {
>        while (!isInterrupted()) {
>            thh.v = thh.lo;
>            thh.v = thh.hi;
>        }
>    }
> }
> class Thread_2_class extends Thread {
>    volatileTest thh;
>    public Thread_2_class (volatileTest t) {
>        super();
>        thh = t;
>    }
>    public void run() {
>        while (!isInterrupted()) {
>                 thh.v = thh.hi;
>                 thh.v = thh.lo;
>             }
>    }
> }
> class Interruptor extends Thread {
>     volatileTest t;
>     int delay;
>     public Interruptor(volatileTest t, int delay) {
>         this.t = t;
>         this.delay = delay;
>     }
>     public void run() {
>         try {
>             Thread.sleep(delay);
>         } catch (InterruptedException e) {
>         }
>         t.interrupt();
>     }
> }
> ----------------------------
> Output on RI:
> ================
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> Test passed: 104  (step: 0)
> Test passed: 104  (step: 1)
> Test passed: 104  (step: 2)
> Test passed: 104  (step: 3)
> Test passed: 104  (step: 4)
> Test passed: 104  (step: 5)
> Test passed: 104  (step: 6)
> Test passed: 104  (step: 7)
> Test passed: 104  (step: 8)
> Test passed: 104  (step: 9)
> Test passed: 104  (step: 10)
> Test passed: 104  (step: 11)
> Test passed: 104  (step: 12)
> Test passed: 104  (step: 13)
> Test passed: 104  (step: 14)
> Test passed: 104  (step: 15)
> Test passed: 104  (step: 16)
> Test passed: 104  (step: 17)
> Test passed: 104  (step: 18)
> Test passed: 104  (step: 19)
> Output on Harmony:
> ====================
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
> java version "1.5.0"
> pre-alpha : not complete or compatible
> svn = r471468, (Nov  7 2006), Windows/ia32/msvc 1310, release build
> http://incubator.apache.org/harmony
> Test passed: 104  (step: 0)
> Test passed: 104  (step: 1)
> Test passed: 104  (step: 2)
> Test passed: 104  (step: 3)
> Test passed: 104  (step: 4)
> Test passed: 104  (step: 5)
> Test passed: 104  (step: 6)
> Test passed: 104  (step: 7)
> Test passed: 104  (step: 8)
> Test passed: 104  (step: 9)
> Test passed: 104  (step: 10)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 11)
> Test passed: 104  (step: 12)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 13)
> Test passed: 104  (step: 14)
> Test passed: 104  (step: 15)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 16)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 17)
> Test passed: 104  (step: 18)
> Test passed: 104  (step: 19)
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
> java version "1.5.0" 
> pre-alpha : not complete or compatible
> svn = r471468, (Nov  7 2006), Linux/ia32/gcc 3.3.3, release build
> http://incubator.apache.org/harmony
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 0)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 1)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 2)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 3)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 4)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 5)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 6)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 7)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 8)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 9)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 10)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 11)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 12)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 13)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 14)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 15)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 16)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 17)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 18)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 19)
> This bug is reproducible on Jitrino (JET/OPT) and on interpreter:
> java -cp . volatileTest
> java -cp . -Xint volatileTest
> java -cp . -Xem:opt volatileTest

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (HARMONY-2092) [drlvm] Harmony works with volatile variables incorrectly

Posted by "Ivan Volosyuk (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-2092?page=comments#action_12448202 ] 
            
Ivan Volosyuk commented on HARMONY-2092:
----------------------------------------

Well, test fails on interpreter on multi CPU system, but works on MT systems.

> [drlvm] Harmony works with volatile variables incorrectly
> ---------------------------------------------------------
>
>                 Key: HARMONY-2092
>                 URL: http://issues.apache.org/jira/browse/HARMONY-2092
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: Windows and Linux
>            Reporter: Vera Petrashkova
>         Attachments: volatileTest.zip
>
>
> When Long_MAX_VALUE or Long.MIN_VALUE should be assigned to volatile variable then
> VM works incorrectly.
> Code for reproducing:
> ------------------volatileTest.java-----------------
> public class volatileTest  {
>     public static int delay = 5000;
>     private boolean interruptFlag = false;
>     long hi;
>     long lo;
>     volatile long v;
>     public static void main(String [] args ) {
>         int maxI = 20;
>         for (int i = 0; i < maxI; i++) {
>             int t = new volatileTest().test(delay);
>             System.out.println((t == 104 ? "Test passed: ": "Test failed: ") 
>                 + t + "  (step: " + i + ")");
>         }
>     }
>     public synchronized void interrupt() {
>         interruptFlag = true;
>     }
>     public synchronized boolean interrupted() {
>         return interruptFlag;
>     }
>     public volatileTest() {
>         super();
>         hi = Long.MAX_VALUE;
>         lo = Long.MIN_VALUE;
>         v = hi;              
>     }
>     public int test(int delay)  {        
>         boolean passed = true;
>         Thread_1_class  t1 = new Thread_1_class(this);
>         Thread_2_class t2 = new Thread_2_class(this);
>         Interruptor killer = new Interruptor(this, delay);
>         try {
>             t1.start();
>             t2.start();
>             killer.start();
>       
>             while (!interrupted()) {
>                 Thread.yield();
>                 long v3 = v;
>                 if (v3 != hi && v3 != lo) { 
>                     System.out.println(v3+"  "+hi +"  "+lo);
>                     passed = false;
>                     break;
>                 }            
>             }
>             t1.interrupt();
>             t2.interrupt();
>             return passed ? 104 : 105;
>        } catch (Throwable e) {
>            e.printStackTrace();
>            return 106;
>        }
>     }
> }
> class Thread_1_class extends Thread {
>    volatileTest thh;
>    public Thread_1_class (volatileTest t) {
>        super();
>        thh = t;
>    }
>    public void run() {
>        while (!isInterrupted()) {
>            thh.v = thh.lo;
>            thh.v = thh.hi;
>        }
>    }
> }
> class Thread_2_class extends Thread {
>    volatileTest thh;
>    public Thread_2_class (volatileTest t) {
>        super();
>        thh = t;
>    }
>    public void run() {
>        while (!isInterrupted()) {
>                 thh.v = thh.hi;
>                 thh.v = thh.lo;
>             }
>    }
> }
> class Interruptor extends Thread {
>     volatileTest t;
>     int delay;
>     public Interruptor(volatileTest t, int delay) {
>         this.t = t;
>         this.delay = delay;
>     }
>     public void run() {
>         try {
>             Thread.sleep(delay);
>         } catch (InterruptedException e) {
>         }
>         t.interrupt();
>     }
> }
> ----------------------------
> Output on RI:
> ================
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> Test passed: 104  (step: 0)
> Test passed: 104  (step: 1)
> Test passed: 104  (step: 2)
> Test passed: 104  (step: 3)
> Test passed: 104  (step: 4)
> Test passed: 104  (step: 5)
> Test passed: 104  (step: 6)
> Test passed: 104  (step: 7)
> Test passed: 104  (step: 8)
> Test passed: 104  (step: 9)
> Test passed: 104  (step: 10)
> Test passed: 104  (step: 11)
> Test passed: 104  (step: 12)
> Test passed: 104  (step: 13)
> Test passed: 104  (step: 14)
> Test passed: 104  (step: 15)
> Test passed: 104  (step: 16)
> Test passed: 104  (step: 17)
> Test passed: 104  (step: 18)
> Test passed: 104  (step: 19)
> Output on Harmony:
> ====================
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
> java version "1.5.0"
> pre-alpha : not complete or compatible
> svn = r471468, (Nov  7 2006), Windows/ia32/msvc 1310, release build
> http://incubator.apache.org/harmony
> Test passed: 104  (step: 0)
> Test passed: 104  (step: 1)
> Test passed: 104  (step: 2)
> Test passed: 104  (step: 3)
> Test passed: 104  (step: 4)
> Test passed: 104  (step: 5)
> Test passed: 104  (step: 6)
> Test passed: 104  (step: 7)
> Test passed: 104  (step: 8)
> Test passed: 104  (step: 9)
> Test passed: 104  (step: 10)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 11)
> Test passed: 104  (step: 12)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 13)
> Test passed: 104  (step: 14)
> Test passed: 104  (step: 15)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 16)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 17)
> Test passed: 104  (step: 18)
> Test passed: 104  (step: 19)
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
> java version "1.5.0" 
> pre-alpha : not complete or compatible
> svn = r471468, (Nov  7 2006), Linux/ia32/gcc 3.3.3, release build
> http://incubator.apache.org/harmony
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 0)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 1)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 2)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 3)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 4)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 5)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 6)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 7)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 8)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 9)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 10)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 11)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 12)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 13)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 14)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 15)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 16)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 17)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 18)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 19)
> This bug is reproducible on Jitrino (JET/OPT) and on interpreter:
> java -cp . volatileTest
> java -cp . -Xint volatileTest
> java -cp . -Xem:opt volatileTest

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Commented: (HARMONY-2092) [drlvm] Harmony works with volatile variables incorrectly

Posted by "Egor Pasko (JIRA)" <ji...@apache.org>.
    [ http://issues.apache.org/jira/browse/HARMONY-2092?page=comments#action_12448042 ] 
            
Egor Pasko commented on HARMONY-2092:
-------------------------------------

does it fail if 'long' arithmetic is changed to 'int'? could you experiment, please? did you run the test on a multiprocessor machine?

> [drlvm] Harmony works with volatile variables incorrectly
> ---------------------------------------------------------
>
>                 Key: HARMONY-2092
>                 URL: http://issues.apache.org/jira/browse/HARMONY-2092
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>         Environment: Windows and Linux
>            Reporter: Vera Petrashkova
>         Attachments: volatileTest.zip
>
>
> When Long_MAX_VALUE or Long.MIN_VALUE should be assigned to volatile variable then
> VM works incorrectly.
> Code for reproducing:
> ------------------volatileTest.java-----------------
> public class volatileTest  {
>     public static int delay = 5000;
>     private boolean interruptFlag = false;
>     long hi;
>     long lo;
>     volatile long v;
>     public static void main(String [] args ) {
>         int maxI = 20;
>         for (int i = 0; i < maxI; i++) {
>             int t = new volatileTest().test(delay);
>             System.out.println((t == 104 ? "Test passed: ": "Test failed: ") 
>                 + t + "  (step: " + i + ")");
>         }
>     }
>     public synchronized void interrupt() {
>         interruptFlag = true;
>     }
>     public synchronized boolean interrupted() {
>         return interruptFlag;
>     }
>     public volatileTest() {
>         super();
>         hi = Long.MAX_VALUE;
>         lo = Long.MIN_VALUE;
>         v = hi;              
>     }
>     public int test(int delay)  {        
>         boolean passed = true;
>         Thread_1_class  t1 = new Thread_1_class(this);
>         Thread_2_class t2 = new Thread_2_class(this);
>         Interruptor killer = new Interruptor(this, delay);
>         try {
>             t1.start();
>             t2.start();
>             killer.start();
>       
>             while (!interrupted()) {
>                 Thread.yield();
>                 long v3 = v;
>                 if (v3 != hi && v3 != lo) { 
>                     System.out.println(v3+"  "+hi +"  "+lo);
>                     passed = false;
>                     break;
>                 }            
>             }
>             t1.interrupt();
>             t2.interrupt();
>             return passed ? 104 : 105;
>        } catch (Throwable e) {
>            e.printStackTrace();
>            return 106;
>        }
>     }
> }
> class Thread_1_class extends Thread {
>    volatileTest thh;
>    public Thread_1_class (volatileTest t) {
>        super();
>        thh = t;
>    }
>    public void run() {
>        while (!isInterrupted()) {
>            thh.v = thh.lo;
>            thh.v = thh.hi;
>        }
>    }
> }
> class Thread_2_class extends Thread {
>    volatileTest thh;
>    public Thread_2_class (volatileTest t) {
>        super();
>        thh = t;
>    }
>    public void run() {
>        while (!isInterrupted()) {
>                 thh.v = thh.hi;
>                 thh.v = thh.lo;
>             }
>    }
> }
> class Interruptor extends Thread {
>     volatileTest t;
>     int delay;
>     public Interruptor(volatileTest t, int delay) {
>         this.t = t;
>         this.delay = delay;
>     }
>     public void run() {
>         try {
>             Thread.sleep(delay);
>         } catch (InterruptedException e) {
>         }
>         t.interrupt();
>     }
> }
> ----------------------------
> Output on RI:
> ================
> java version "1.5.0_06"
> Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
> Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode)
> Test passed: 104  (step: 0)
> Test passed: 104  (step: 1)
> Test passed: 104  (step: 2)
> Test passed: 104  (step: 3)
> Test passed: 104  (step: 4)
> Test passed: 104  (step: 5)
> Test passed: 104  (step: 6)
> Test passed: 104  (step: 7)
> Test passed: 104  (step: 8)
> Test passed: 104  (step: 9)
> Test passed: 104  (step: 10)
> Test passed: 104  (step: 11)
> Test passed: 104  (step: 12)
> Test passed: 104  (step: 13)
> Test passed: 104  (step: 14)
> Test passed: 104  (step: 15)
> Test passed: 104  (step: 16)
> Test passed: 104  (step: 17)
> Test passed: 104  (step: 18)
> Test passed: 104  (step: 19)
> Output on Harmony:
> ====================
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
> java version "1.5.0"
> pre-alpha : not complete or compatible
> svn = r471468, (Nov  7 2006), Windows/ia32/msvc 1310, release build
> http://incubator.apache.org/harmony
> Test passed: 104  (step: 0)
> Test passed: 104  (step: 1)
> Test passed: 104  (step: 2)
> Test passed: 104  (step: 3)
> Test passed: 104  (step: 4)
> Test passed: 104  (step: 5)
> Test passed: 104  (step: 6)
> Test passed: 104  (step: 7)
> Test passed: 104  (step: 8)
> Test passed: 104  (step: 9)
> Test passed: 104  (step: 10)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 11)
> Test passed: 104  (step: 12)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 13)
> Test passed: 104  (step: 14)
> Test passed: 104  (step: 15)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 16)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 17)
> Test passed: 104  (step: 18)
> Test passed: 104  (step: 19)
> Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors, as applicable.
> java version "1.5.0" 
> pre-alpha : not complete or compatible
> svn = r471468, (Nov  7 2006), Linux/ia32/gcc 3.3.3, release build
> http://incubator.apache.org/harmony
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 0)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 1)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 2)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 3)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 4)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 5)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 6)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 7)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 8)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 9)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 10)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 11)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 12)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 13)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 14)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 15)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 16)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 17)
> -9223372032559808513  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 18)
> 9223372032559808512  9223372036854775807  -9223372036854775808
> Test failed: 105  (step: 19)
> This bug is reproducible on Jitrino (JET/OPT) and on interpreter:
> java -cp . volatileTest
> java -cp . -Xint volatileTest
> java -cp . -Xem:opt volatileTest

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira