[rvm-research] Problem with optimizing compiler

View: New views
6 Messages — Rating Filter:   Alert me  

[rvm-research] Problem with optimizing compiler

by Anthony Hocquet :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello,

For my research purposes, I'm currently trying to optimize Jikes RVM write barrier. Thus, I've brought some modifications to fastPath() method of GenMutator class. But, I have a compilation problem concerning a while loop:

  while(state != false) {
    ;       
  }

Indeed, OptimizingCompiler probably "thinks" that we could'nt get in/out of this while loop. The variable state is a class field and has a public accessibility  :
public volatile boolean state = false;

This variable is modified by another thread. So there is concurrent access arount it. To get ride of this issue, I need to use @NoOptCompile annotation for the method containing the while statement. But I don't want to use this annotation as performance is my main goal. How could I avoid using @NoOptCompile ?

Here is the trace of the compilation error :
build-bootimage:
     [echo] Building bootimage. Output redirected to : /home/ahocquet/jikesrvm/
target/production_ia32-linux/BootImageWriterOutput.txt
     [echo] MMTk properties = /home/ahocquet/jikesrvm/build/mmtk/default.properties
     [java] BootImageWriter: compiler arg: O2
     [java] Java Result: 101
     [echo] BootImageCompiler: init (opt compiler)
     [echo] Compiler failure during compilation of < BootstrapCL, Lorg/jikesrvm/classloader/RVMClass; >.resolve ()V
     [echo] java.lang.NullPointerException
     [echo]     at org.jikesrvm.compilers.opt.regalloc.LinearScan$ActiveSet.allocate(LinearScan.java:1146)
     [echo]     at org.jikesrvm.compilers.opt.regalloc.LinearScan$LinearScanPhase.perform(LinearScan.java:322)
     [echo]     at org.jikesrvm.compilers.opt.driver.CompilerPhase.performPhase(CompilerPhase.java:205)
     [echo]     at org.jikesrvm.compilers.opt.driver.OptimizationPlanAtomicElement.perform(OptimizationPlanAtomicElement.java:88)
     [echo]     at org.jikesrvm.compilers.opt.driver.OptimizationPlanCompositeElement.perform(OptimizationPlanCompositeElement.java:143)
     [echo]     at org.jikesrvm.compilers.opt.driver.OptimizationPlanCompositeElement.perform(OptimizationPlanCompositeElement.java:143)
     [echo]     at org.jikesrvm.compilers.opt.driver.OptimizationPlanCompositeElement.perform(OptimizationPlanCompositeElement.java:143)
     [echo]     at org.jikesrvm.compilers.opt.driver.CompilationPlan.execute(CompilationPlan.java:131)
     [echo]     at org.jikesrvm.compilers.opt.driver.OptimizingCompiler.compile(OptimizingCompiler.java:224)
     [echo]     at org.jikesrvm.compilers.opt.driver.OptimizingBootImageCompiler.compileMethod(OptimizingBootImageCompiler.java:119)
     [echo]     at org.jikesrvm.compilers.common.BootImageCompiler.compile(BootImageCompiler.java:62)
     [echo]     at org.jikesrvm.compilers.common.BootImageCompiler.compile(BootImageCompiler.java:66)
     [echo]     at org.jikesrvm.classloader.NormalMethod.genCode(NormalMethod.java:180)
     [echo]     at org.jikesrvm.classloader.RVMMethod.compile(RVMMethod.java:729)
     [echo]     at org.jikesrvm.classloader.RVMMethod.getCurrentEntryCodeArray(RVMMethod.java:713)
     [echo]     at org.jikesrvm.classloader.RVMClass.instantiate(RVMClass.java:1441)
     [echo]     at org.jikesrvm.tools.bootImageWriter.BootImageWorker.run(BootImageWorker.java:44)
     [echo]     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
     [echo]     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
     [echo]     at java.lang.Thread.run(Thread.java:636)
     [echo] Error compiling method: < BootstrapCL, Lorg/jikesrvm/classloader/RVMClass; >.resolve ()V
     [echo] org.jikesrvm.compilers.opt.OptimizingCompilerException: ERROR produced in module:Compiler
     [echo]     failure during compilation of < BootstrapCL, Lorg/jikesrvm/classloader/RVMClass; >.resolve ()V
     [echo]
     [echo]     at org.jikesrvm.compilers.opt.driver.OptimizingCompiler.fail(OptimizingCompiler.java:319)
     [echo]     at org.jikesrvm.compilers.opt.driver.OptimizingCompiler.compile(OptimizingCompiler.java:238)
     [echo]     at org.jikesrvm.compilers.opt.driver.OptimizingBootImageCompiler.compileMethod(OptimizingBootImageCompiler.java:119)
     [echo]     at org.jikesrvm.compilers.common.BootImageCompiler.compile(BootImageCompiler.java:62)
     [echo]     at org.jikesrvm.compilers.common.BootImageCompiler.compile(BootImageCompiler.java:66)
     [echo]     at org.jikesrvm.classloader.NormalMethod.genCode(NormalMethod.java:180)
     [echo]     at org.jikesrvm.classloader.RVMMethod.compile(RVMMethod.java:729)
     [echo]     at org.jikesrvm.classloader.RVMMethod.getCurrentEntryCodeArray(RVMMethod.java:713)
     [echo]     at org.jikesrvm.classloader.RVMClass.instantiate(RVMClass.java:1441)
     [echo]     at org.jikesrvm.tools.bootImageWriter.BootImageWorker.run(BootImageWorker.java:44)
     [echo]     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
     [echo]     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
     [echo]     at java.lang.Thread.run(Thread.java:636)

BUILD FAILED
/home/ahocquet/jikesrvm/build.xml:1434: The following error occurred while executing this line:
/home/ahocquet/jikesrvm/build.xml:1443: Failed to write bootimage.


Best regards,
--
Anthony Hocquet

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Jikesrvm-researchers mailing list
Jikesrvm-researchers@...
https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers

Re: [rvm-research] Problem with optimizing compiler

by David P Grove :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Anthony Hocquet <anthony.hocquet@...> wrote on 09/01/2009 10:40:04 PM:
>
> Hello,
>
> For my research purposes, I'm currently trying to optimize Jikes RVM
> write barrier. Thus, I've brought some modifications to fastPath()
> method of GenMutator class. But, I have a compilation problem
> concerning a while loop:
>
>   while(state != false) {
>     ;       
>   }
>

Any chance you could put together a standalone test case that causes the opt compiler to crash?  That might make it a lot easier for someone to try to help you by fixing the bug.

--dave
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Jikesrvm-researchers mailing list
Jikesrvm-researchers@...
https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers


Re: [rvm-research] Problem with optimizing compiler

by Anthony Hocquet :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Well, it just needs to add an instance variable in GenMutator class :
public volatile boolean state = false;
Then, insert in fastpath() method, at the beginning :
while(state != false) {
    ;       
  }


And you will get exactly the same compilation error that could be avoided using @NoOptCompile.

Cheers,

On Wed, Sep 2, 2009 at 5:55 AM, David P Grove <groved@...> wrote:

Anthony Hocquet <anthony.hocquet@...> wrote on 09/01/2009 10:40:04 PM:


>
> Hello,
>
> For my research purposes, I'm currently trying to optimize Jikes RVM
> write barrier. Thus, I've brought some modifications to fastPath()
> method of GenMutator class. But, I have a compilation problem
> concerning a while loop:
>
>   while(state != false) {
>     ;       
>   }
>

Any chance you could put together a standalone test case that causes the opt compiler to crash?  That might make it a lot easier for someone to try to help you by fixing the bug.

--dave


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Jikesrvm-researchers mailing list
Jikesrvm-researchers@...
https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers




--
Anthony Hocquet

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Jikesrvm-researchers mailing list
Jikesrvm-researchers@...
https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers

Re: [rvm-research] Problem with optimizing compiler

by Michael Bond :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Anthony,

I'm responding to your original e-mail since it has the stack trace.

I think the opt compiler may be failing for a reason other than because it
thinks the while loop is infinite (also, wouldn't it think the loop could
get skipped altogether since state could be false?).  The JVM spec says
the following about Java volatiles: (1) they must be re-loaded from memory
on each use (i.e., the same as in C) and (2) a read of a volatile field
induces a happens-before edge from previous write(s) of the same field to
the read
(http://www.cs.umd.edu/~pugh/java/memoryModel/jsr-133-faq.html#volatile).
I'm pretty sure that Jikes enforces (1) but not (2), in both the baseline
and optimizing compilers.

I think your changes may be triggering an unrelated bug in the opt
compiler, likely in register allocation.  Looking at the failure point, I
think it might trigger an assertion earlier if assertions were enabled.
Could you please try a "development" build rather than a "production"
build (they're the same except development enables assertions)?

Thanks,
Mike


On Wed, 2 Sep 2009, Anthony Hocquet wrote:

> Hello,
>
> For my research purposes, I'm currently trying to optimize Jikes RVM write barrier. Thus, I've brought some modifications
> to fastPath() method of GenMutator class. But, I have a compilation problem concerning a while loop:
>
>   while(state != false) {
>     ;       
>   }
>
> Indeed, OptimizingCompiler probably "thinks" that we could'nt get in/out of this while loop. The variable state is a class
> field and has a public accessibility  :
> public volatile boolean state = false;
>
> This variable is modified by another thread. So there is concurrent access arount it. To get ride of this issue, I need to
> use @NoOptCompile annotation for the method containing the while statement. But I don't want to use this annotation as
> performance is my main goal. How could I avoid using @NoOptCompile ?
>
> Here is the trace of the compilation error :
> build-bootimage:
>      [echo] Building bootimage. Output redirected to :
> /home/ahocquet/jikesrvm/target/production_ia32-linux/BootImageWriterOutput.txt
>      [echo] MMTk properties = /home/ahocquet/jikesrvm/build/mmtk/default.properties
>      [java] BootImageWriter: compiler arg: O2
>      [java] Java Result: 101
>      [echo] BootImageCompiler: init (opt compiler)
>      [echo] Compiler failure during compilation of < BootstrapCL, Lorg/jikesrvm/classloader/RVMClass; >.resolve ()V
>      [echo] java.lang.NullPointerException
>      [echo]     at org.jikesrvm.compilers.opt.regalloc.LinearScan$ActiveSet.allocate(LinearScan.java:1146)
>      [echo]     at org.jikesrvm.compilers.opt.regalloc.LinearScan$LinearScanPhase.perform(LinearScan.java:322)
>      [echo]     at org.jikesrvm.compilers.opt.driver.CompilerPhase.performPhase(CompilerPhase.java:205)
>      [echo]     at
> org.jikesrvm.compilers.opt.driver.OptimizationPlanAtomicElement.perform(OptimizationPlanAtomicElement.java:88)
>      [echo]     at
> org.jikesrvm.compilers.opt.driver.OptimizationPlanCompositeElement.perform(OptimizationPlanCompositeElement.java:143)
>      [echo]     at
> org.jikesrvm.compilers.opt.driver.OptimizationPlanCompositeElement.perform(OptimizationPlanCompositeElement.java:143)
>      [echo]     at
> org.jikesrvm.compilers.opt.driver.OptimizationPlanCompositeElement.perform(OptimizationPlanCompositeElement.java:143)
>      [echo]     at org.jikesrvm.compilers.opt.driver.CompilationPlan.execute(CompilationPlan.java:131)
>      [echo]     at org.jikesrvm.compilers.opt.driver.OptimizingCompiler.compile(OptimizingCompiler.java:224)
>      [echo]     at
> org.jikesrvm.compilers.opt.driver.OptimizingBootImageCompiler.compileMethod(OptimizingBootImageCompiler.java:119)
>      [echo]     at org.jikesrvm.compilers.common.BootImageCompiler.compile(BootImageCompiler.java:62)
>      [echo]     at org.jikesrvm.compilers.common.BootImageCompiler.compile(BootImageCompiler.java:66)
>      [echo]     at org.jikesrvm.classloader.NormalMethod.genCode(NormalMethod.java:180)
>      [echo]     at org.jikesrvm.classloader.RVMMethod.compile(RVMMethod.java:729)
>      [echo]     at org.jikesrvm.classloader.RVMMethod.getCurrentEntryCodeArray(RVMMethod.java:713)
>      [echo]     at org.jikesrvm.classloader.RVMClass.instantiate(RVMClass.java:1441)
>      [echo]     at org.jikesrvm.tools.bootImageWriter.BootImageWorker.run(BootImageWorker.java:44)
>      [echo]     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
>      [echo]     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
>      [echo]     at java.lang.Thread.run(Thread.java:636)
>      [echo] Error compiling method: < BootstrapCL, Lorg/jikesrvm/classloader/RVMClass; >.resolve ()V
>      [echo] org.jikesrvm.compilers.opt.OptimizingCompilerException: ERROR produced in module:Compiler
>      [echo]     failure during compilation of < BootstrapCL, Lorg/jikesrvm/classloader/RVMClass; >.resolve ()V
>      [echo]
>      [echo]     at org.jikesrvm.compilers.opt.driver.OptimizingCompiler.fail(OptimizingCompiler.java:319)
>      [echo]     at org.jikesrvm.compilers.opt.driver.OptimizingCompiler.compile(OptimizingCompiler.java:238)
>      [echo]     at
> org.jikesrvm.compilers.opt.driver.OptimizingBootImageCompiler.compileMethod(OptimizingBootImageCompiler.java:119)
>      [echo]     at org.jikesrvm.compilers.common.BootImageCompiler.compile(BootImageCompiler.java:62)
>      [echo]     at org.jikesrvm.compilers.common.BootImageCompiler.compile(BootImageCompiler.java:66)
>      [echo]     at org.jikesrvm.classloader.NormalMethod.genCode(NormalMethod.java:180)
>      [echo]     at org.jikesrvm.classloader.RVMMethod.compile(RVMMethod.java:729)
>      [echo]     at org.jikesrvm.classloader.RVMMethod.getCurrentEntryCodeArray(RVMMethod.java:713)
>      [echo]     at org.jikesrvm.classloader.RVMClass.instantiate(RVMClass.java:1441)
>      [echo]     at org.jikesrvm.tools.bootImageWriter.BootImageWorker.run(BootImageWorker.java:44)
>      [echo]     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
>      [echo]     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
>      [echo]     at java.lang.Thread.run(Thread.java:636)
>
> BUILD FAILED
> /home/ahocquet/jikesrvm/build.xml:1434: The following error occurred while executing this line:
> /home/ahocquet/jikesrvm/build.xml:1443: Failed to write bootimage.
>
>
> Best regards,
> --
> Anthony Hocquet
>
>
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Jikesrvm-researchers mailing list
Jikesrvm-researchers@...
https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers

Re: [rvm-research] Problem with optimizing compiler

by Daniel Frampton :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I have put in a possible fix/workaround for the compiler issue in 15774.
 
I only tested the trivial case you sent. Please let us know if it is working for you now.
 
Cheers,
Daniel.

On Thu, Sep 3, 2009 at 12:02 AM, Michael Bond <mikebond@...> wrote:
Hi Anthony,

I'm responding to your original e-mail since it has the stack trace.

I think the opt compiler may be failing for a reason other than because it thinks the while loop is infinite (also, wouldn't it think the loop could get skipped altogether since state could be false?).  The JVM spec says the following about Java volatiles: (1) they must be re-loaded from memory on each use (i.e., the same as in C) and (2) a read of a volatile field induces a happens-before edge from previous write(s) of the same field to the read (http://www.cs.umd.edu/~pugh/java/memoryModel/jsr-133-faq.html#volatile). I'm pretty sure that Jikes enforces (1) but not (2), in both the baseline and optimizing compilers.

I think your changes may be triggering an unrelated bug in the opt compiler, likely in register allocation.  Looking at the failure point, I think it might trigger an assertion earlier if assertions were enabled. Could you please try a "development" build rather than a "production" build (they're the same except development enables assertions)?

Thanks,
Mike



On Wed, 2 Sep 2009, Anthony Hocquet wrote:

Hello,

For my research purposes, I'm currently trying to optimize Jikes RVM write barrier. Thus, I've brought some modifications
to fastPath() method of GenMutator class. But, I have a compilation problem concerning a while loop:

  while(state != false) {
    ;       
  }

Indeed, OptimizingCompiler probably "thinks" that we could'nt get in/out of this while loop. The variable state is a class
field and has a public accessibility  :
public volatile boolean state = false;

This variable is modified by another thread. So there is concurrent access arount it. To get ride of this issue, I need to
use @NoOptCompile annotation for the method containing the while statement. But I don't want to use this annotation as
performance is my main goal. How could I avoid using @NoOptCompile ?

Here is the trace of the compilation error :
build-bootimage:
     [echo] Building bootimage. Output redirected to :
/home/ahocquet/jikesrvm/target/production_ia32-linux/BootImageWriterOutput.txt
     [echo] MMTk properties = /home/ahocquet/jikesrvm/build/mmtk/default.properties
     [java] BootImageWriter: compiler arg: O2
     [java] Java Result: 101
     [echo] BootImageCompiler: init (opt compiler)
     [echo] Compiler failure during compilation of < BootstrapCL, Lorg/jikesrvm/classloader/RVMClass; >.resolve ()V
     [echo] java.lang.NullPointerException
     [echo]     at org.jikesrvm.compilers.opt.regalloc.LinearScan$ActiveSet.allocate(LinearScan.java:1146)
     [echo]     at org.jikesrvm.compilers.opt.regalloc.LinearScan$LinearScanPhase.perform(LinearScan.java:322)
     [echo]     at org.jikesrvm.compilers.opt.driver.CompilerPhase.performPhase(CompilerPhase.java:205)
     [echo]     at
org.jikesrvm.compilers.opt.driver.OptimizationPlanAtomicElement.perform(OptimizationPlanAtomicElement.java:88)
     [echo]     at
org.jikesrvm.compilers.opt.driver.OptimizationPlanCompositeElement.perform(OptimizationPlanCompositeElement.java:143)
     [echo]     at
org.jikesrvm.compilers.opt.driver.OptimizationPlanCompositeElement.perform(OptimizationPlanCompositeElement.java:143)
     [echo]     at
org.jikesrvm.compilers.opt.driver.OptimizationPlanCompositeElement.perform(OptimizationPlanCompositeElement.java:143)
     [echo]     at org.jikesrvm.compilers.opt.driver.CompilationPlan.execute(CompilationPlan.java:131)
     [echo]     at org.jikesrvm.compilers.opt.driver.OptimizingCompiler.compile(OptimizingCompiler.java:224)
     [echo]     at
org.jikesrvm.compilers.opt.driver.OptimizingBootImageCompiler.compileMethod(OptimizingBootImageCompiler.java:119)
     [echo]     at org.jikesrvm.compilers.common.BootImageCompiler.compile(BootImageCompiler.java:62)
     [echo]     at org.jikesrvm.compilers.common.BootImageCompiler.compile(BootImageCompiler.java:66)
     [echo]     at org.jikesrvm.classloader.NormalMethod.genCode(NormalMethod.java:180)
     [echo]     at org.jikesrvm.classloader.RVMMethod.compile(RVMMethod.java:729)
     [echo]     at org.jikesrvm.classloader.RVMMethod.getCurrentEntryCodeArray(RVMMethod.java:713)
     [echo]     at org.jikesrvm.classloader.RVMClass.instantiate(RVMClass.java:1441)
     [echo]     at org.jikesrvm.tools.bootImageWriter.BootImageWorker.run(BootImageWorker.java:44)
     [echo]     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
     [echo]     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
     [echo]     at java.lang.Thread.run(Thread.java:636)
     [echo] Error compiling method: < BootstrapCL, Lorg/jikesrvm/classloader/RVMClass; >.resolve ()V
     [echo] org.jikesrvm.compilers.opt.OptimizingCompilerException: ERROR produced in module:Compiler
     [echo]     failure during compilation of < BootstrapCL, Lorg/jikesrvm/classloader/RVMClass; >.resolve ()V
     [echo]
     [echo]     at org.jikesrvm.compilers.opt.driver.OptimizingCompiler.fail(OptimizingCompiler.java:319)
     [echo]     at org.jikesrvm.compilers.opt.driver.OptimizingCompiler.compile(OptimizingCompiler.java:238)
     [echo]     at
org.jikesrvm.compilers.opt.driver.OptimizingBootImageCompiler.compileMethod(OptimizingBootImageCompiler.java:119)
     [echo]     at org.jikesrvm.compilers.common.BootImageCompiler.compile(BootImageCompiler.java:62)
     [echo]     at org.jikesrvm.compilers.common.BootImageCompiler.compile(BootImageCompiler.java:66)
     [echo]     at org.jikesrvm.classloader.NormalMethod.genCode(NormalMethod.java:180)
     [echo]     at org.jikesrvm.classloader.RVMMethod.compile(RVMMethod.java:729)
     [echo]     at org.jikesrvm.classloader.RVMMethod.getCurrentEntryCodeArray(RVMMethod.java:713)
     [echo]     at org.jikesrvm.classloader.RVMClass.instantiate(RVMClass.java:1441)
     [echo]     at org.jikesrvm.tools.bootImageWriter.BootImageWorker.run(BootImageWorker.java:44)
     [echo]     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
     [echo]     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
     [echo]     at java.lang.Thread.run(Thread.java:636)

BUILD FAILED
/home/ahocquet/jikesrvm/build.xml:1434: The following error occurred while executing this line:
/home/ahocquet/jikesrvm/build.xml:1443: Failed to write bootimage.


Best regards,
--
Anthony Hocquet


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Jikesrvm-researchers mailing list
Jikesrvm-researchers@...
https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers



------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Jikesrvm-researchers mailing list
Jikesrvm-researchers@...
https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers

Re: [rvm-research] Problem with optimizing compiler

by Anthony Hocquet :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

Thank you very much, it worked like a charm !


Best regards,

On Thu, Sep 3, 2009 at 1:51 AM, Daniel Frampton <zyridium@...> wrote:
I have put in a possible fix/workaround for the compiler issue in 15774.
 
I only tested the trivial case you sent. Please let us know if it is working for you now.
 
Cheers,
Daniel.

On Thu, Sep 3, 2009 at 12:02 AM, Michael Bond <mikebond@...> wrote:
Hi Anthony,

I'm responding to your original e-mail since it has the stack trace.

I think the opt compiler may be failing for a reason other than because it thinks the while loop is infinite (also, wouldn't it think the loop could get skipped altogether since state could be false?).  The JVM spec says the following about Java volatiles: (1) they must be re-loaded from memory on each use (i.e., the same as in C) and (2) a read of a volatile field induces a happens-before edge from previous write(s) of the same field to the read (http://www.cs.umd.edu/~pugh/java/memoryModel/jsr-133-faq.html#volatile). I'm pretty sure that Jikes enforces (1) but not (2), in both the baseline and optimizing compilers.

I think your changes may be triggering an unrelated bug in the opt compiler, likely in register allocation.  Looking at the failure point, I think it might trigger an assertion earlier if assertions were enabled. Could you please try a "development" build rather than a "production" build (they're the same except development enables assertions)?

Thanks,
Mike



On Wed, 2 Sep 2009, Anthony Hocquet wrote:

Hello,

For my research purposes, I'm currently trying to optimize Jikes RVM write barrier. Thus, I've brought some modifications
to fastPath() method of GenMutator class. But, I have a compilation problem concerning a while loop:

  while(state != false) {
    ;       
  }

Indeed, OptimizingCompiler probably "thinks" that we could'nt get in/out of this while loop. The variable state is a class
field and has a public accessibility  :
public volatile boolean state = false;

This variable is modified by another thread. So there is concurrent access arount it. To get ride of this issue, I need to
use @NoOptCompile annotation for the method containing the while statement. But I don't want to use this annotation as
performance is my main goal. How could I avoid using @NoOptCompile ?

Here is the trace of the compilation error :
build-bootimage:
     [echo] Building bootimage. Output redirected to :
/home/ahocquet/jikesrvm/target/production_ia32-linux/BootImageWriterOutput.txt
     [echo] MMTk properties = /home/ahocquet/jikesrvm/build/mmtk/default.properties
     [java] BootImageWriter: compiler arg: O2
     [java] Java Result: 101
     [echo] BootImageCompiler: init (opt compiler)
     [echo] Compiler failure during compilation of < BootstrapCL, Lorg/jikesrvm/classloader/RVMClass; >.resolve ()V
     [echo] java.lang.NullPointerException
     [echo]     at org.jikesrvm.compilers.opt.regalloc.LinearScan$ActiveSet.allocate(LinearScan.java:1146)
     [echo]     at org.jikesrvm.compilers.opt.regalloc.LinearScan$LinearScanPhase.perform(LinearScan.java:322)
     [echo]     at org.jikesrvm.compilers.opt.driver.CompilerPhase.performPhase(CompilerPhase.java:205)
     [echo]     at
org.jikesrvm.compilers.opt.driver.OptimizationPlanAtomicElement.perform(OptimizationPlanAtomicElement.java:88)
     [echo]     at
org.jikesrvm.compilers.opt.driver.OptimizationPlanCompositeElement.perform(OptimizationPlanCompositeElement.java:143)
     [echo]     at
org.jikesrvm.compilers.opt.driver.OptimizationPlanCompositeElement.perform(OptimizationPlanCompositeElement.java:143)
     [echo]     at
org.jikesrvm.compilers.opt.driver.OptimizationPlanCompositeElement.perform(OptimizationPlanCompositeElement.java:143)
     [echo]     at org.jikesrvm.compilers.opt.driver.CompilationPlan.execute(CompilationPlan.java:131)
     [echo]     at org.jikesrvm.compilers.opt.driver.OptimizingCompiler.compile(OptimizingCompiler.java:224)
     [echo]     at
org.jikesrvm.compilers.opt.driver.OptimizingBootImageCompiler.compileMethod(OptimizingBootImageCompiler.java:119)
     [echo]     at org.jikesrvm.compilers.common.BootImageCompiler.compile(BootImageCompiler.java:62)
     [echo]     at org.jikesrvm.compilers.common.BootImageCompiler.compile(BootImageCompiler.java:66)
     [echo]     at org.jikesrvm.classloader.NormalMethod.genCode(NormalMethod.java:180)
     [echo]     at org.jikesrvm.classloader.RVMMethod.compile(RVMMethod.java:729)
     [echo]     at org.jikesrvm.classloader.RVMMethod.getCurrentEntryCodeArray(RVMMethod.java:713)
     [echo]     at org.jikesrvm.classloader.RVMClass.instantiate(RVMClass.java:1441)
     [echo]     at org.jikesrvm.tools.bootImageWriter.BootImageWorker.run(BootImageWorker.java:44)
     [echo]     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
     [echo]     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
     [echo]     at java.lang.Thread.run(Thread.java:636)
     [echo] Error compiling method: < BootstrapCL, Lorg/jikesrvm/classloader/RVMClass; >.resolve ()V
     [echo] org.jikesrvm.compilers.opt.OptimizingCompilerException: ERROR produced in module:Compiler
     [echo]     failure during compilation of < BootstrapCL, Lorg/jikesrvm/classloader/RVMClass; >.resolve ()V
     [echo]
     [echo]     at org.jikesrvm.compilers.opt.driver.OptimizingCompiler.fail(OptimizingCompiler.java:319)
     [echo]     at org.jikesrvm.compilers.opt.driver.OptimizingCompiler.compile(OptimizingCompiler.java:238)
     [echo]     at
org.jikesrvm.compilers.opt.driver.OptimizingBootImageCompiler.compileMethod(OptimizingBootImageCompiler.java:119)
     [echo]     at org.jikesrvm.compilers.common.BootImageCompiler.compile(BootImageCompiler.java:62)
     [echo]     at org.jikesrvm.compilers.common.BootImageCompiler.compile(BootImageCompiler.java:66)
     [echo]     at org.jikesrvm.classloader.NormalMethod.genCode(NormalMethod.java:180)
     [echo]     at org.jikesrvm.classloader.RVMMethod.compile(RVMMethod.java:729)
     [echo]     at org.jikesrvm.classloader.RVMMethod.getCurrentEntryCodeArray(RVMMethod.java:713)
     [echo]     at org.jikesrvm.classloader.RVMClass.instantiate(RVMClass.java:1441)
     [echo]     at org.jikesrvm.tools.bootImageWriter.BootImageWorker.run(BootImageWorker.java:44)
     [echo]     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
     [echo]     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
     [echo]     at java.lang.Thread.run(Thread.java:636)

BUILD FAILED
/home/ahocquet/jikesrvm/build.xml:1434: The following error occurred while executing this line:
/home/ahocquet/jikesrvm/build.xml:1443: Failed to write bootimage.


Best regards,
--
Anthony Hocquet


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Jikesrvm-researchers mailing list
Jikesrvm-researchers@...
https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers



------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Jikesrvm-researchers mailing list
Jikesrvm-researchers@...
https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers




--
Anthony Hocquet

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Jikesrvm-researchers mailing list
Jikesrvm-researchers@...
https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers