| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
The symbol of This, if it points to a package class, isn't touched, just
as usual, so that our Select(Select(Select(...))) => This(...) optimization
works fine with attr reset.
However the tpe is now erased, so that subsequent reflective compilation
doesn't spuriously fail when seeing that some subtrees of a tree being
compiled are typed.
Erasing the tpe doesn't pose even a tiniest problem, because, as it can
be seen in typedThis, type is trivially reconstructed from the symbol.
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
We need to force info of the `cls` in `parseExceptions`
because we pass `cls` to `addThrowsAnnotation` which in turn calls
`Symbol.isMonomorphicType` that relies on a symbol being initialized
to give right answers.
In the future we should just clean up implementation of
`isMonomorphicType` method to not rely on a symbol being initialized
as there's no inherent reason for that in most cases. In cases where
there's reason for that we should just force the initialization.
This patch does not come with a test-case because it's hard to reproduce
not initialized symbols in partest reliably.
|
| | |\ \ \ \ \
| | | | | | | |
| | | | | | | | |
SI-7074 Fix xml attribute sorting
|
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | | |
Sorting the attributes of an xml element could drop some of the
attributes. It was caused by the incorrect use of MetaData#copy() to
concatenate "smaller" with the rest of the attributes. The
MetaData#copy() method is similar to the following hypothetical method
on a List:
def copy(other: List): List = head :: other
The fix prepends all elements of "smaller" to the rest of the attributes
in the proper order.
|
|\ \ \ \ \ \ \ \
| |/ / / / / / /
|/| | | | | | | |
SI-7159 Distinguish between assignability and subtyping in TypeKinds
|
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | | |
TypeKinds said SHORT <:< INT. But that's not quite true on the JVM. You
can assign SHORT to INT, but you can't assign an ARRAY[SHORT] to
ARRAY[INT]. Since JVM arrays are covariant it's clear that assignability
and subtyping are distinct on the JVM.
This commit adds an isAssignable method and moves the rules about
the int sized primitives there. ICodeCheckers, ICodeReader, and
GenICode are all updated to use isAssignable instead of <:<.
|
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | | |
TypeKinds said INT <:< LONG. But that's not true on the JVM, you need
a coercion to move up. And GenICode#adapt was checking for just that
special case.
This commit removes the INT <:< LONG rule and then removes the special
case from GenICode#adapt.
|
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | | |
In preparation for dealing with a problem in TypeKinds, this commit
does some cleanup of code related to doing coercions.
* Comments are added to clarify.
* A println when converting between BOOL and anything else is removed
and the code is allowed to flow through to an assertion.
* Assertions are refactored to use string interpolation.
* A few pattern matches were reformulated to equivalent variants
In addition, a test is created for SI-107, the bug that necessitated
the special case in GenICode#adapt for LONG coercion
|
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | | |
This commit removes some unreachable code in GenICode#adapt. It's
hard to prove that these cases are unreachable, but they do appear to be
and I wasn't able to find a way to get to them. Code archaeology
was un-fruitful; they're very old. Which may mean they are legacies
from a time when Null and Nothing types weren't fully baked.
|
|\ \ \ \ \ \ \ \
| | | | | | | | |
| | | | | | | | | |
Reconcile definitions of stability.
|
| | | | | | | | | |
|
|\ \ \ \ \ \ \ \ \
| |_|/ / / / / / /
|/| | | | | | | | |
SI-7181 Eliminate unnecessary duplicates of finally blocks
|
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | | |
The main body of a try and each exception handler were getting a copy of
the finally block for the "normal" flow case (i.e. where they don't
throw an uncaught exception or use "return" to exit early). But that's
not necessary.
With this commit the try body and each exception handler can all jump
to the same copy of the finally block on a normal exit.
A byte code test is included to ensure we're getting fewer copies of
the finally block.
inline-ex-handlers.check is updated because the icode is a bit different
without the extra finally block copies.
|
| |/ / / / / / /
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | | |
As a first step towards fixing 7181, this commit improves the
comments and variable names around generating try/catch/finally blocks
in GenICode and adds a test verifying the current functionality of
try/catch/finally blocks
|
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | | |
With proper reachability analysis, the code for finding the final
destination of jump-only blocks was more complicated than needed. This
commit simplifies and speeds up that process using a standard
Tortoise and Hare algorithm on a Map from jump-only blocks to their
immediate destinations.
Test t7006 is increased a bit to make sure we don't get stuck on
infinite loops and to make sure we're deleting all but the essential
jump.
|
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | | |
GenASM was doing a bunch of stuff to eliminate unreachable exception
handlers, but it was still leaving behind other unreachable blocks, for
instance a finally block associated with an exception handler that got
removed would still be left lying around. ASM would in turn turn those
into a big pile of NOPs, which just take up space uselessly.
This commit replaces all the logic for eliding exception handlers with
a single unreachable block remover that catches unused exception
handlers and a whole lot more.
|
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | | |
During ASM code emission we would recognize a block that consisted of
ICode-only artifacts (ENTER_SCOPE, EXIT_SCOPE, and LOAD_EXCEPTION)
followed by a jump. But we weren't using the same logic to recognize
all jump-only blocks. So jump-elision wasn't removing them. And that
in fact was why the ASM code emission had to do its special case.
This commit makes all jump-only block recognition use the same logic:
a jump-only block is one that has 0 or more ICode-only instructions
followed by a JUMP. It does't necessarily have to start with a JUMP.
There's now a debugWarning if the old NOP emitting code is triggered and
test t6102 is enhanced to error if that warning occurs.
|
|/ / / / / / /
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
While working on SI-7006 I found a O(N*M) loop in jump-elision that
should be O(N). This commit clean that up. It also improves the
diagnostics in Members#removeBlock.
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
- @param tags whose name drifted from the corresponding parameter
- Remove or complete a few stray stub comments (@param foo ...)
- Use @tparam where appropriate.
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
Was: ``blah''
Now: `blah`
|
| | | | | | | |
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
Use .length directly, avoiding the allocation of the WrappedArray.
|
| | | | | | | |
|
| | | | | | | |
|
| | | | | | | |
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
It isn't, because LOOP_HEADER and friends are compile time
constants. But I'd argue that its clearer not to rely on that here.
|
| | | | | | | |
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
With the exception of toString and the odd JavaBean getter.
|
| | | | | | |
| | | | | | |
| | | | | | |
| | | | | | | |
An exception is made for toString.
|
|\ \ \ \ \ \ \
| | | | | | | |
| | | | | | | | |
SI-7120 Erasure must honor typeref prefixes
|
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | | |
Erasure was discarding these, which led to unnecessarily
wide types in quite particular circumstances. This showed
up as a double definition error in the reported bug when the
bridge method clashed with the erased signature.
|
|\ \ \ \ \ \ \ \
| | |/ / / / / /
| |/| | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | |
| | | | | | | | |
* origin/2.10.x:
SI-7171 Consider prefix when assessing type finality.
please ant with filenames, add comments
Fixed error in reflection API docs about linearization order on method baseClasses
Shadowed Implict typo (fixes no issue)
remove unused imports
Conflicts:
src/reflect/scala/reflect/internal/Types.scala
|
| |\ \ \ \ \ \ \
| | | | | | | | |
| | | | | | | | | |
SI-7171 Consider prefix when assessing type finality.
|
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | |
| | | | | | | | | |
`Type#isFinalType` determines if a type could have a
non-bottom subtype. This property is exploited by
the pattern matcher to flag impossible patterns.
This check was ignoring the type's prefix, and
incorrectly deemed that `T#A` in `trait T { final class A }`
was a final type. But it could have been subtyped by
`U#A` where `U` <:< `T`, or, more simply, by `T.this.A`.
Now, type finality requires that the prefix is stable.
The existing test cases in neg/patmat-type-check.scala
still correctly flag incompatiblities.
`isFinalType` is also used by some code that massages
pattern matches post specialization. That is actually
either broken or obsolete under virtpatmat, I've opened
SI-7172 to invesigate that.
It is also used by GenICode to determine whether to emit
the appropriate equality checks that are correct in the
face of boxing. It is possible that this change will force
the slow path in some rare cases, but it won't affect
correctness.
|
| |\ \ \ \ \ \ \ \
| | | | | | | | | |
| | | | | | | | | | |
refactor the pattern matcher into smaller files
|
| | | | | | | | | | |
|
| | | | | | | | | | |
|
| |\ \ \ \ \ \ \ \ \
| | |_|/ / / / / / /
| |/| | | | | | | | |
Fixed error in reflection API docs about linearization order on method baseClasses
|
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | | |
baseClasses
|
| |\ \ \ \ \ \ \ \ \
| | |_|_|_|/ / / / /
| |/| | | | | | | | |
Shadowed Implict typo (fixes no issue)
|
| | | |_|_|/ / / /
| | |/| | | | | | |
|
|\ \ \ \ \ \ \ \ \
| | | | | | | | | |
| | | | | | | | | | |
SI-7015 Removes redundant aconst_null; pop; aconst_null creation
|
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | | |
Based on feedback on https://github.com/scala/scala/pull/2147
* Assertion in GenICode#adaptNullRef reports the erroneous type
* Test makes the Null type explicit for greater clarity
|
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | | |
In an effort to adapt methods and field accesses of type Null to
other types, we were always emitting
aconst_null
pop
aconst_null
The problem is we were doing that even when the JVM was in a position
to know it had null value, e.g. when the user had written a null
constant. This commit fixes that and includes a test to show that the
resulting byte code still works even without repeating ourselves and/or
repeating ourselves.
This commit also makes the scala.runtim.Null$ constructor private. It
was a sealed abstract class which prevented subclassing in Scala, but
it didn't prevent subclassing in Java. A private constructor takes care
of that hole so now the only value of type Null$ should be null.
Along the way I found some other questionable things in adapt and I've
added TODO's and issue https://issues.scala-lang.org/browse/SI-7159 to
track.
|
|\ \ \ \ \ \ \ \ \ \
| | | | | | | | | | |
| | | | | | | | | | | |
merge the patmat refactoring into master
|
| |\ \ \ \ \ \ \ \ \ \
| | | |_|_|_|/ / / / /
| | |/| | | | / / / /
| | |_|_|_|_|/ / / /
| |/| | | | | | | | |
Conflicts:
src/compiler/scala/tools/nsc/typechecker/PatternMatching.scala
|
| | | | | | | | | | |
|
| | | | | | | | | | |
|
| | | | | | | | | | |
|
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | |
| | | | | | | | | | |
This brings the optimizations and the analyses closer together.
In the future we may consider using a solver in the optimizations.
For now, implication is checked ad-hoc using hash-consing and equality/subset tests...
NOTE: prepareNewAnalysis resets said hash-consing, so must be
called before approximating a match to propositions
|