- About Scala
- Documentation
- Code Examples
- Software
- Scala Developers
Deactivating Constant Folding?
Fri, 2011-01-07, 12:45
Hi all
A change to Scala trunk somewhere between the 3. and 6. January seems to have
changed something related to constant folding. I noticed because I suddenly
get ~40 test failures like the following while generating source code for
trees:
expected: but was:
In the test suite of my refactorings, I'm simply using an instance of
interactive.Global. Is there a new option or another way to disable constant
folding?
Thanks a lot!
Mirko
Sat, 2011-01-08, 11:17
#2
Re: Deactivating Constant Folding?
Hi,
On Saturday 08 January 2011 10:57:27 martin odersky wrote:
> On Fri, Jan 7, 2011 at 12:47 PM, Mirko Stocker wrote:
> > Hi all
> >
> > A change to Scala trunk somewhere between the 3. and 6. January seems to
> > have
> > changed something related to constant folding. I noticed because I
> > suddenly get ~40 test failures like the following while generating
> > source code for trees:
> >
> > expected: but was:
> >
> > I don't know what might have happened here. Anyone else?
I took a closer look at the commits during that period, and I suspect it is
23897, where forInteractive and forScaladoc were introduced. And indeed, when
I override val forScaladoc = true in my global, all my test failures go away.
I hope this helps locating the problem.
Thanks,
Mirko
Sat, 2011-01-08, 13:17
#3
Re: Deactivating Constant Folding?
Mirko,
It sounds as if that test expects constant-folding *not* to take place (but
why? constant folding is a good thing :-)
In case you want to explore where constant folding happens, breakpoints can
be placed on the two apply methods in
scala.tools.nsc.typechecker.ConstantFolder,
and then run using the same command-line options as for the test.
For additional context, the usages of
/** Fold constants */
object constfold extends {
val global: Global.this.type = Global.this
} with ConstantFolder
can also be looked up (just three places, all of them in Typers).
Miguel
http://lamp.epfl.ch/~magarcia/ScalaCompilerCornerReloaded/
Mon, 2011-01-10, 11:07
#4
Re: Deactivating Constant Folding?
On Sat, Jan 8, 2011 at 11:16 AM, Mirko Stocker <me@misto.ch> wrote:
Hi,
On Saturday 08 January 2011 10:57:27 martin odersky wrote:
> On Fri, Jan 7, 2011 at 12:47 PM, Mirko Stocker <me@misto.ch> wrote:
> > Hi all
> >
> > A change to Scala trunk somewhere between the 3. and 6. January seems to
> > have
> > changed something related to constant folding. I noticed because I
> > suddenly get ~40 test failures like the following while generating
> > source code for trees:
> >
> > expected:<val a = {[4 + 3] }> but was:<val a = {[7] }>
> >
> > I don't know what might have happened here. Anyone else?
I took a closer look at the commits during that period, and I suspect it is
23897, where forInteractive and forScaladoc were introduced. And indeed, when
I override val forScaladoc = true in my global, all my test failures go away.
Yes, it's that commit. I can disable constant folding in the interactive compiler. Gilles, should it be the same for Scaladoc, or it doesn't matter?
thanks,iulian
I hope this helps locating the problem.
Thanks,
Mirko
--
Mirko Stocker | me@misto.ch
Work: http://ifs.hsr.ch | http://infoq.com
Personal: http://misto.ch | http://twitter.com/m_st
--
« Je déteste la montagne, ça cache le paysage »
Alphonse Allais
Mon, 2011-01-10, 12:47
#5
Re: Deactivating Constant Folding?
I think constant folding needs to be deactivated for interactive as well. Otherwise we loose a lot of position info.
-- Martin
On Mon, Jan 10, 2011 at 11:00 AM, iulian dragos <iulian.dragos@epfl.ch> wrote:
--
------------------------------------------------
Martin Odersky
Prof., EPFL and CEO, Scala Solutions
PSED, 1015 Lausanne, Switzerland
-- Martin
On Mon, Jan 10, 2011 at 11:00 AM, iulian dragos <iulian.dragos@epfl.ch> wrote:
On Sat, Jan 8, 2011 at 11:16 AM, Mirko Stocker <me@misto.ch> wrote:
Hi,
On Saturday 08 January 2011 10:57:27 martin odersky wrote:
> On Fri, Jan 7, 2011 at 12:47 PM, Mirko Stocker <me@misto.ch> wrote:
> > Hi all
> >
> > A change to Scala trunk somewhere between the 3. and 6. January seems to
> > have
> > changed something related to constant folding. I noticed because I
> > suddenly get ~40 test failures like the following while generating
> > source code for trees:
> >
> > expected:<val a = {[4 + 3] }> but was:<val a = {[7] }>
> >
> > I don't know what might have happened here. Anyone else?
I took a closer look at the commits during that period, and I suspect it is
23897, where forInteractive and forScaladoc were introduced. And indeed, when
I override val forScaladoc = true in my global, all my test failures go away.
Yes, it's that commit. I can disable constant folding in the interactive compiler. Gilles, should it be the same for Scaladoc, or it doesn't matter?
thanks,iulian
I hope this helps locating the problem.
Thanks,
Mirko
--
Mirko Stocker | me@misto.ch
Work: http://ifs.hsr.ch | http://infoq.com
Personal: http://misto.ch | http://twitter.com/m_st
--
« Je déteste la montagne, ça cache le paysage »
Alphonse Allais
--
------------------------------------------------
Martin Odersky
Prof., EPFL and CEO, Scala Solutions
PSED, 1015 Lausanne, Switzerland
Mon, 2011-01-10, 12:57
#6
Re: Deactivating Constant Folding?
On Mon, Jan 10, 2011 at 12:44 PM, martin odersky <martin.odersky@epfl.ch> wrote:
I think constant folding needs to be deactivated for interactive as well. Otherwise we loose a lot of position info.
Ok, it's done now. No constant folding when in interactive or scaladoc mode.
iulian
-- Martin
On Mon, Jan 10, 2011 at 11:00 AM, iulian dragos <iulian.dragos@epfl.ch> wrote:
On Sat, Jan 8, 2011 at 11:16 AM, Mirko Stocker <me@misto.ch> wrote:
Hi,
On Saturday 08 January 2011 10:57:27 martin odersky wrote:
> On Fri, Jan 7, 2011 at 12:47 PM, Mirko Stocker <me@misto.ch> wrote:
> > Hi all
> >
> > A change to Scala trunk somewhere between the 3. and 6. January seems to
> > have
> > changed something related to constant folding. I noticed because I
> > suddenly get ~40 test failures like the following while generating
> > source code for trees:
> >
> > expected:<val a = {[4 + 3] }> but was:<val a = {[7] }>
> >
> > I don't know what might have happened here. Anyone else?
I took a closer look at the commits during that period, and I suspect it is
23897, where forInteractive and forScaladoc were introduced. And indeed, when
I override val forScaladoc = true in my global, all my test failures go away.
Yes, it's that commit. I can disable constant folding in the interactive compiler. Gilles, should it be the same for Scaladoc, or it doesn't matter?
thanks,iulian
I hope this helps locating the problem.
Thanks,
Mirko
--
Mirko Stocker | me@misto.ch
Work: http://ifs.hsr.ch | http://infoq.com
Personal: http://misto.ch | http://twitter.com/m_st
--
« Je déteste la montagne, ça cache le paysage »
Alphonse Allais
--
------------------------------------------------
Martin Odersky
Prof., EPFL and CEO, Scala Solutions
PSED, 1015 Lausanne, Switzerland
--
« Je déteste la montagne, ça cache le paysage »
Alphonse Allais
Mon, 2011-01-10, 13:57
#7
Re: Deactivating Constant Folding?
On Monday 10 January 2011 12:52:53 iulian dragos wrote:
> Ok, it's done now. No constant folding when in interactive or scaladoc
> mode.
Thanks!
On Fri, Jan 7, 2011 at 12:47 PM, Mirko Stocker <me@misto.ch> wrote:
I don't know what might have happened here. Anyone else?
-- Martin
--
--------------------------------------------------
Martin Odersky
Prof., EPFL and CEO, Scala Solutions
PSED, 1015 Lausanne, Switzerland