| Commit message (Collapse) | Author | Age | Files | Lines |
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
partest has custom code for -Xplugin handling (see
DirectCompiler.updatePluginPath for details). that code has its own
idea of what the syntax of -Xplugin is, different from Scalac's.
partest's idea is that multiple paths should be separated by the
platform classpath separator character, so : on Unix and ; on Windows.
the .flags file here was using a colon, and that confuses partest on
Windows, since partest was expecting a semicolon.
it might be nice to fix partest to accept comma as the separator
instead, which is standard for a scalac MultiStringSetting such
as -Xplugin. but it turns out we have an out: we can just provide
multiple -Xplugin flags.
what evidence do I have that this is the right change?
* the test still passes on both Windows and Mac OS X (manually
tested); if Travis likes it, we'll know it passes on Linux too
* I tried reverting Som's fix for SI-9370 (c32ba93) and the test failed,
as expected, both with and without my change
* I added a bunch of debugging output to
DirectCompiler.updatePluginPath in partest, built a new partest jar,
and used it to run the test on Windows with and without my fix, and
verified by eye that the logic there was operating as expected in
both cases
and in conclusion, for Som's benefit: <insert cryptic joke here>
|
| |
| |
| |
| | |
Such that uncurry can correctly un-dependify them.
|
| |\
| | |
| | | |
unset inappropriate execute bits
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
I imagine these date back to old Subversion days and are probably the
result of inadvertent commits from Windows users with vcs client
configs.
having the bit set isn't really harmful most of the time,
but it's just not right, and it makes the files stand out in directory
listings for no reason
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
A previous optimization (d44a86f432a7f9ca250b014acdeab02ac9f2c304) for
pattern matcher exhaustivity checks used a smarter encoding to ensure
that the scrutinee can be equal to one child only.
However, in case of traits between the root and leave type, a child can
be of several types and these types should not be in a mutually exclusive
group. A simple solution (hat tip to retronym) is to just put traits
and classes into separate groups.
|
| |\ \
| | | |
| | | | |
SI-9442 Fix the uncurry-erasure types
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Using the "uncurry-erased" type (the one after the uncurry phase) can
lead to incorrect tree transformations. For example, compiling:
```
def foo(c: Ctx)(l: c.Tree): Unit = {
val l2: c.Tree = l
}
```
Results in the following AST:
```
def foo(c: Ctx, l: Ctx#Tree): Unit = {
val l$1: Ctx#Tree = l.asInstanceOf[Ctx#Tree]
val l2: c.Tree = l$1 // no, not really, it's not.
}
```
Of course, this is incorrect, since `l$1` has type `Ctx#Tree`, which is
not a subtype of `c.Tree`.
So what we need to do is to use the pre-uncurry type when creating
`l$1`, which is `c.Tree` and is correct. Now, there are two
additional problems:
1. when varargs and byname params are involved, the uncurry
transformation desugares these special cases to actual
typerefs, eg:
```
T* ~> Seq[T] (Scala-defined varargs)
T* ~> Array[T] (Java-defined varargs)
=>T ~> Function0[T] (by name params)
```
we use the DesugaredParameterType object (defined in
scala.reflect.internal.transform.UnCurry) to redo this desugaring
manually here
2. the type needs to be normalized, since `gen.mkCast` checks this
(no HK here, just aliases have to be expanded before handing the
type to `gen.mkAttributedCast`, which calls `gen.mkCast`)
|
| |\ \ \
| | |_|/
| |/| | |
SI-6636 Fix macro expansion in toolboxes
|
| | | | |
|
| |\ \ \
| | | | |
| | | | | |
SI-9450 Fix triple quoted strings in REPL :power mode
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Some extra synthetic code generated under this mode failed to escape
input before adding it to a literal string. It used to get away with
this most of the time by triple quoting the literal.
This commit reuses Scala string escaping logic buried in `Constant`
to do this properly. Actually, the proper approach would be to build
the synthetic code with trees and quasiquotes, and avoid the mess
of stringly-genererated code.
I threw in some defensive hygiene for the reference to `Nil` while
I was in the neighbourhood.
|
| |/ / /
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
toSet needs to rebuild some child classes, but not others, as toSet is
allowed to widen element types (which the invariant Set normally cannot do),
and some sets rely upon their invariance. Thus, sets that rely upon their
invariance now rebuild themselves into a generic set upon toSet, while those
that do not just sit there.
Note: there was a similar patch previously that fixed the same problem, but
this is a reimplementation to circumvent license issues.
Note: the newBuilder method was benchmarked as (surprisingly!) the most
efficient way to create small sets, so it is used where sets may need to
be rebuild.
|
| | |/
| |/| |
|
|\ \ \
| | | |
| | | | |
Inliner heuristic for higher-order methods
|
| |\ \ \ |
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Test that no warning is issued with the default flags when an inlining
fails and the callee is not annotated @inline.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
When invoking a higher-order method and the value passed for the
SAM type is either a function literal or a parameter of the callsite
method, inline the higher-order method into the callee.
This is a first version, the heuristics will be refined further.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Handler tables are lists of tuples (try-start, try-end,
handler-start, exception-type). When an instruction throws, the first
handler in the list that covers the instruction and matches the type
is executed. For nested handlers, it is the job of the compiler to
add them to the handler table in the correct order.
When inlining a method, the handlers of the callee are prepended to
the list of handlers in the callsite method. This ensures that the
callee's handlers are tested first if an exception is thrown in the
inlined code.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Introduce a cache to remember which methods have maxLocals and
maxStack already computed. Before we were computing these values
on every run of eliminateUnreachableCode.
Also update the implementation of eliminateUnreachableCode to keep
correct max values.
|
| | | | | |
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
The call graph holds an argInfos field for every callsite, which
contains additional information about the argument passed to the
callee. For example, an argInfo specifies if the argument is a
function literal or a parameter of the callsite method.
Computing the argInfo requires running an ASM analyzer, which is not
cheap. This change assembles the argInfos for callsites that are
created or changed by the inliner / closure optimizer from the
available information instead of just running the analyzer again.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Because that's what the field holds: the parameter types that are SAM
types.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Make InlinerHeuristics a backend component like the others, instead
of nested within the Inliner component.
|
| | | | |
| | | | |
| | | | |
| | | | | |
The new optimizer doesn't have this problem.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Remember in the call graph if a function literal is passed as an
argument to a higher-order function.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
For higher order methods, the call graph contains a map from
parameter positions to SAM types.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Inline requests have a list of post-inline requests: callsites within
the inlined method that should be inlined into the initial callee.
This commit changes the inliner to actually perform post-inline
requests.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
The computed value was too large previously: inlining stores receiver
and argument values of the inlined method into locals.
A too large value doesn't cause any bugs, but data flow analyses would
allocate too large frames.
The test (InlinerTest.maxLocalsMaxStackAfterInline) didn't catch the
bug because it tested the methods of the wrong ClassNode. The
CodeGenTools.compileClasses method returns a ClassNode that is created
from the classfile byte array emitted by the compiler. This ClassNode
is a new object and unrelated to the ClassNode used in the compiler
backend. The test now takes the correct ClassNode from the hash map in
the backend's byteCodeRepository.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
If a class (trait) is a SAM type, store the name and descriptor of the
SAM in the ClassBType's InlineInfo.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Store classes being compiled in a separate hash map. This allows
efficiently traversing all classes being compiled. It also simplifies
limiting the size of the cache of class nodes parsed from classfiles.
Also change the cache of class nodes parsed from classfiles to LRU
instead of FIFO.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Change the hash maps in the call graph to index callsites and
closure instantiations by the containing method. This is beneficial
for implementing inliner heuristics and the closure optimizer.
|
|\ \ \ \ \
| | | | | |
| | | | | | |
SI-9473 Cleaner references to statically owned symbols
|
| | |/ / /
| |/| | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Ever wonder why `identity("")` typechecks to
`scala.this.Predef.identity("")`?
It turns out that `mkAttributedRef` was importing
`q"$scalaPackageClass.this.Predef._"` for all these years,
rather than `q"$scalaModule.Predef._"`.
This commit makes `mkAttributedRef` special case static owners
by referring the the corresponding module, instead.
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
One shouldn't base any decisions of the owner of an overloaded
symbol. Instead, the owner of each of the alternatives should
be considered.
This gotcha is super easy to forget, as I did with my change to
simplify the way we detect whether we need to add the `.package`
prefix to a tree.
|
|\ \ \ \ \
| | | | | |
| | | | | | |
SI-8647 Used immutable scheme for mutable.BitSet to resolve canBuildFrom
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
mutable.BitSet had a conflict between its own implicit canBuildFrom and the one inherited from SortedSetFactory in mutable.SortedSet.
The immutable hierarchy already had a workaround; this just copies it on the mutable side.
Test written to verify compilation.
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | | |
Include owner in ErrorNonExistentField message
|
| | |_|/ / /
| |/| | | |
| | | | | |
| | | | | | |
This should be particularly helpful for synthetic field names like `evidence$21`.
|
|\ \ \ \ \ \
| |_|_|/ / /
|/| | | | | |
Preparation for using default methods in traits
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
A DefDef owned by a trait may now have have a method body.
Such a method must be emitted without ACC_ABSTRACT, and
with the code attribute.
Tested by intercepting the compile pipeline and adding the
DEFAULTMETHOD flag and a method body before running
the backend.
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
The term "specialized override" is used to describe a method
in a synthetic specialized subclass that generically substitutes
the specialized type args into the siganture of a generic method.
For example, `trait T[@spec A] { def t(a: A) }` gives rise to
`def t(a: Int)` under the type environment `A=Int`.
This commit avoids doing this for specialized traits, only classes
have these overrides now. The motivation is to make it simpler to
use specialized interfaces (like `T$mcI$sp` from the example above)
as Java functional interfaces.
|
| |/ / / /
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
A deferred method in the generic interface ends up with a
corresponding, generically substituted version in the specialized
sub interface.
This is superfluous and problematic when we start adding default
methods to the interfaces. The subsequent commit will remove them.
|
|\ \ \ \ \
| | | | | |
| | | | | | |
Merge 2.11.x into 2.12.x [ci: last-only]
|
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | |
| | | | | | |
only trivial merge conflicts here.
not dealing with PR #4333 in this merge because there is a substantial
conflict there -- so that's why I stopped at
63daba33ae99471175e9d7b20792324615f5999b for now
|
|\ \ \ \ \ \
| |/ / / / /
|/| | | | | |
SI-7155 Remove deprecated private s.c.m.AVLTree
|
| | | | | | |
|
|\ \ \ \ \ \
| | | | | | |
| | | | | | | |
SI-9375 add synthetic readResolve only for static modules
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
For inner modules, the synthetic readResolve method would cause the
module constructor to be invoked on de-serialization in certain
situations. See the discussion in the ticket.
Adds a comprehensive test around serializing and de-serializing
modules.
|
|\ \ \ \ \ \ \
| |_|/ / / / /
|/| | | | | | |
SI-6806 Add an @implicitAmbiguous annotation
|