Do not wish to derail your question, but we should answer that question.
https://issues.scala-lang.org/browse/SI-5442
I would think one should have to "opt in" to creating bytecode which
will not interoperate with other bytecode, more so than giving
"-optimise" represents opting in. I want things the optimizer does,
some of which are relatively simple but critical to the quality of the
bytecode, without taking a hit like that.
Basically, throughout the compiler things have their access altered
fairly casually as if it were a decision without impact beyond the
disappointment one might feel at seeing declared private things
public; when in fact it is a huge far-reaching decision to change the
access of something, and the slightest misstep will gift you with
runtime failures and/or nondeterministic compilation products.
Agreed. So, I'm blocked until this bug is fixed.I'm afraid I'll have to revert my commit that enables the new pattern matcher by default unless this is resolved.I don't want to release something that I know to be broken, and know how to fix. (But can't.)
On Sun, Apr 15, 2012 at 4:18 PM, Paul Phillips <pa...@improving.org> wrote:
On Sun, Apr 15, 2012 at 3:00 PM, Adriaan Moors <adriaa...@epfl.ch> wrote:Do not wish to derail your question, but we should answer that question.
> (but I'm tempted to say the underlying bug is in the inliner)
https://issues.scala-lang.org/browse/SI-5442
I would think one should have to "opt in" to creating bytecode which
will not interoperate with other bytecode, more so than giving
"-optimise" represents opting in. I want things the optimizer does,
some of which are relatively simple but critical to the quality of the
bytecode, without taking a hit like that.
Basically, throughout the compiler things have their access altered
fairly casually as if it were a decision without impact beyond the
disappointment one might feel at seeing declared private things
public; when in fact it is a huge far-reaching decision to change the
access of something, and the slightest misstep will gift you with
runtime failures and/or nondeterministic compilation products.
Basically, throughout the compiler things have their access altered
fairly casually as if it were a decision without impact beyond the
disappointment one might feel at seeing declared private things
public; when in fact it is a huge far-reaching decision to change the
access of something, and the slightest misstep will gift you with
runtime failures and/or nondeterministic compilation products.
This bug is not related to virtPartMat's code generation. And thinking more about it led to the conclusion that @inline and -optimize should be treated separately:
- when encountering @inline functions, scalac should either transform all members accessed by the @inline function to public and issue member public-isation warnings OR if it can't make the members public (e.g. one lies in a class that is not being recompiled) just remove the @inline flag and once again warn.
- actual inlining should be done after this analysis and public-isation phase, only if -optimize is added
The motivation is: if you care about your members remaining private/protected, don't use @inline. If you're okay with the fields becoming public, ignore the warning and go on.
Unfortunately this won't make it into M3, as it takes quite a bit of work to come up with a decent implementation and testcases for everything.
How about generating a name-mangled public forwarder to the private method that is needed elsewhere for inlining to succeed?
Hi,
I've made some progress regarding the root cause of the test.stability failure reported in [1]
To find what the inliner does differently, I started by reverting the last band-aid [2] to later compare the -Ylog:inliner output across compiler runs.
That output can be obtained by:
(1) "ant all.clean build"
(2) use the resulting compiler and library from build\pack\lib to compile the compiler and library sources.
(3) run the compiler and library emitted above, on the same sources.
In both cases with "-optimize -Ylog:inliner"
The logs reveal some inlinings occurring in the first but not in the second compilation (I tried also a third compilation, but the logs were identical to those for the second). Details about those inlinings below. They're about Range.{apply, inclusive} and RichInt.to.
"Some progress" because there are at least four pending questions:
(a) why that happens (macros at play for Range, RichInt?)
More precisely, we have two reify macros defined in Context and Universe and not used anywhere, and a bunch of tag materializers defined in reflect.makro.internal in the lib and used by implicit resolution.
On Apr 24, 2012 10:52 AM, "martin odersky" <martin....@epfl.ch> wrote:
On Tue, Apr 24, 2012 at 2:38 AM, Miguel Garcia <miguel...@tuhh.de> wrote:
>
> Hi,
>
> I've made ...
I don't think they are used yet in the stdlib.Cheers- Martin
>
> (b) a more fine-grain comparison (per classfile) via -Ygen-javap
>
> (c) going over the l...
It might be enough to check if both caller and callee have source
files; that is, that both are being compiled simultaneously.
In the meeting martin resisted the idea of trying to finesse the
inliner behavior this late in the game, that's why it's being
revisited.
Yeah, that has exactly the "transitive property of influencing
compilation products" we anticipated.
As to what is causing the initial difference: it occurred to me from
something josh said that it could be the order things are fed to
scalac. We know there are bugs which happen with "scalac a.scala
b.scala" but not with "scalac b.scala a.scala", and I imagine there
are similar ones if the classpath isn't given in exactly the same
order, even if it has the same elements on it.
Speaking of that last one, we could always sort the input source files
for scalac before compiling, so that order is deterministic. Pro:
more predictable behavior. Cons: masking bugs; losing a (pretty grim)
"workaround" if the sorted order turns out to be "bug variant" and not
"working variant" for your situation; and the risk of a general
malaise setting in since it feels a little like giving up. Still, it
might be the right thing to do.
sbt always sorts the input sources in alphabetical order before handing them to scalac for this reason. However, separate compilation can still create situations with symptoms like the ones described here. I don't know if the cause is the same because I suspect unpickling is a confounding variable here.
-Mark