summaryrefslogtreecommitdiff
path: root/src/reflect
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #5047 from kmizu/resolve-several-warningsAdriaan Moors2016-03-221-1/+1
|\ | | | | Resolve several deprecation warnings
| * * Replace isPackage with hasPackageFlagKota Mizushima2016-03-171-1/+1
| |
* | Merge pull request #5043 from dongjoon-hyun/fix_typos_in_spec_and_commentsJason Zaugg2016-03-213-3/+3
|\ \ | | | | | | Fix some typos in `spec` documents and comments.
| * | Fix some typos in `spec` documents and comments.Dongjoon Hyun2016-03-153-3/+3
| |/
* / New trait encoding: use default methods, jettison impl classesJason Zaugg2016-03-1811-90/+18
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Until now, concrete methods in traits were encoded with "trait implementation classes". - Such a trait would compile to two class files - the trait interface, a Java interface, and - the implementation class, containing "trait implementation methods" - trait implementation methods are static methods has an explicit self parameter. - some methods don't require addition of an interface method, such as private methods. Calls to these directly call the implementation method - classes that mixin a trait install "trait forwarders", which implement the abstract method in the interface by forwarding to the trait implementation method. The new encoding: - no longer emits trait implementation classes or trait implementation methods. - instead, concrete methods are simply retained in the interface, as JVM 8 default interface methods (the JVM spec changes in [JSR-335](http://download.oracle.com/otndocs/jcp/lambda-0_9_3-fr-eval-spec/index.html) pave the way) - use `invokespecial` to call private or particular super implementations of a method (rather `invokestatic`) - in cases when we `invokespecial` to a method in an indirect ancestor, we add that ancestor redundantly as a direct parent. We are investigating alternatives approaches here. - we still emit trait fowrarders, although we are [investigating](https://github.com/scala/scala-dev/issues/98) ways to only do this when the JVM would be unable to resolve the correct method using its rules for default method resolution. Here's an example: ``` trait T { println("T") def m1 = m2 private def m2 = "m2" } trait U extends T { println("T") override def m1 = super[T].m1 } class C extends U { println("C") def test = m1 } ``` The old and new encodings are displayed and diffed here: https://gist.github.com/retronym/f174d23f859f0e053580 Some notes in the implementation: - No need to filter members from class decls at all in AddInterfaces (although we do have to trigger side effecting info transformers) - We can now emit an EnclosingMethod attribute for classes nested in private trait methods - Created a factory method for an AST shape that is used in a number of places to symbolically bind to a particular super method without needed to specify the qualifier of the `Super` tree (which is too limiting, as it only allows you to refer to direct parents.) - I also found a similar tree shape created in Delambdafy, that is better expressed with an existing tree creation factory method, mkSuperInit.
* Merge pull request #4974 from szeiger/wip/patmat-outertestAdriaan Moors2016-03-142-41/+24
|\ | | | | More conservative optimization for unnecessary outer ref checks
| * Improved outer ref checking in pattern matches:Adriaan Moors2016-03-072-41/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The old algorithm omitted necessary outer ref checks in some places. This new one is more conservative. It only omits outer ref checks when the expected type and the scrutinee type match up, or when the expected type is defined in a static location. For this specific purpose the top level of a method or other code block (which is not a trait or class definition) is also considered static because it does not have a prefix. This change comes with a spec update to clarify the prefix rule for type patterns. The new wording makes it clear that the presence of a prefix is to be interpreted in a *semantic* way, i.e. the existence of a prefix determines the necessity for an outer ref check, no matter if the prefix is actually spelled out *syntactically*. Note that the old outer ref check implementation did not use the alternative interpretation of requiring prefixes to be given syntactically. It never created an outer ref check for a local class `C`, no matter if the pattern was `_: C` or `_: this.C`, thus violating both interpretations of the spec. There is now explicit support for unchecked matches (like `case _: (T @unchecked) =>`) to suppress warnings for unchecked outer refs. `@unchecked` worked before and was used for this purpose in `neg/t7721` but never actually existed as a feature. It was a result of a bug that prevented an outer ref check from being generated in the first place if *any* annotation was used on an expected type in a type pattern. This new version will still generate the outer ref check if an outer ref is available but suppress the warning otherwise. Other annotations on type patterns are ignored. New tests are in `neg/outer-ref-checks`. The expected results of tests `neg/t7171` and `neg/t7171b` have changed because the compiler now tries to generate additional outer ref checks that were not present before (which was a bug).
* | Fix var spelling in WeakHashSetJanek Bogucki2016-03-091-6/+6
|/ | | | | WeakHashSet is internal so an exception was made against binary compatibility to allow the var to be made private.
* Merge remote-tracking branch 'origin/2.11.x' into ↵Jason Zaugg2016-02-251-13/+25
|\ | | | | | | | | | | | | | | | | | | | | merge/2.11.x-to-2.12.x-20160225 Conflicts: scripts/jobs/integrate/bootstrap src/build/maven/scala-actors-pom.xml test/files/pos/t3420.flags Conflicts were trivial to resolve.
| * Micro optimise Symbol#fullNameJason Zaugg2016-02-091-13/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The old approach of recursively calling `fullNameAsName` creates a lot of garbage for intermediate results, in addition to needless interning of those results into the name table. This commit instead creates a string buffer of the correct capacity and writes the component names directly into this. I compared old and new approaches and this shows a 2x speedup. ``` scala> val th = ichi.bench.Thyme.warmed(verbose = print) th: ichi.bench.Thyme = ichi.bench.Thyme@1643e817 scala> val w_old = th.Warm(sym.fullNameAsNameOld('.')) w_old: th.Warm[$r.intp.global.Name] = ichi.bench.Thyme$Warm@7a8d001b scala> val w_new = th.Warm(sym.fullNameAsName('.')) w_new: th.Warm[$r.intp.global.Name] = ichi.bench.Thyme$Warm@1ec14586 scala> th.pbenchOffWarm("", x => println(x))(w_old, 10, "old")(w_new, 10, "new") Benchmark comparison (in 4.084 s) old vs new Significantly different (p ~= 0) Time ratio: 0.53572 95% CI 0.51618 - 0.55525 (n=20) old 64.54 ns 95% CI 62.41 ns - 66.67 ns new 34.57 ns 95% CI 34.04 ns - 35.11 ns res3: $r.intp.global.Name = scala.collection.parallel.mutable.ParSeq ``` It is still expensive enough that we should still consider caching. The call to full name in `classBTypeFromSymbol` in the new backed is a prime candidate for optimization.
* | Merge pull request #4958 from adriaanm/typerefrefactorAdriaan Moors2016-02-242-175/+176
|\ \ | | | | | | Simplify TypeRef hierarchy. baseType returns NoType, as needed for isSubtype. Also improves performance.
| * | thisInfo.parents also needs separate treatmentAdriaan Moors2016-02-121-1/+5
| | |
| * | Less distribution of logic across TypeRef subclassesAdriaan Moors2016-02-122-108/+128
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Redeem myself for e1c732db44 -- hopefully. I inlined `thisInfo` (== `sym.info`), and made sure to use `relativeInfo` wherever prefix and args influence the result of the query that we're delegating to the underlying type. For type aliases, use `normalize` for `baseClasses` and `decls`, since `relativeInfo` breaks the gnarly SI-8177. I think normalize is okay for aliases, as the prefix should not matter when computing base classes, and infos for the members in `decls` are given the `asSeenFrom` treatment individually downstream. (It's a tight rope between rewriting too many symbols and maintaining correctness. Documented the trade-off in the code.) Renamed the unimaginative `transform` to `relativize`, which, although everything is relative, hopefully says a bit more about its usage than `transform`. Removed a lot of over-factoring in the TypeRef hierarchy. Ultimately, we need to reduce the number of TypeRef subclasses further, I think. It's really hard to follow what's going on. Removed the `thisInfo` cache, since `sym.info` and `relativeInfo` are both cached. Made the cache invalidation hooks a bit more OO-y. Compare `Symbol`s with `eq` -- they don't define an `equals` method. Also, don't recurse in isSubtype when a `baseType` results in `NoType`. This happens a lot and is cheap to check, so I posit (without proof), that it's better for performance (and clarity) to check before recursing.
| * | Towards understanding `TypeRef`'s `transformInfo`/`baseType`Adriaan Moors2016-02-101-94/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By reducing excessive factoring, we can save an extraneous call to `asSeenFrom`, and hopefully in a following commit figure out a bigger problem with `baseType` that is causing wrong subtyping results. This commit is a pure refactoring, save for the dropped ASF call, which is explained below. To motivate the following change to `relativeInfo`: ``` private[Types] def relativeInfo = /*trace(s"relativeInfo(${safeToString}})")*/{ if (relativeInfoPeriod != currentPeriod) { - val memberInfo = pre.memberInfo(sym) - relativeInfoCache = transformInfo(memberInfo) + relativeInfoCache = memberInfoInstantiated ``` Let's consolidate the two removed line in this new method: ``` def memberInfoInstantiated = transformInfo(pre.memberInfo(sym)) ``` To understand what `transformInfo` does, take these helpers spread over various `*TypeRef` traits, and consolidate them: ``` - def asSeenFromOwner(tp: Type) = tp.asSeenFrom(pre, sym.owner) // regular type refs: - def transformInfo(tp: Type): Type = appliedType(asSeenFromOwner(tp), args) // for no-args type refs: - override def transformInfo(tp: Type): Type = appliedType(asSeenFromOwner(tp), dummyArgs) ``` By removing the dynamic dispatch, we get the following method (given `require(args0 ne Nil, this)` in `ArgsTypeRef`, and `args eq Nil` by construction in `NoArgsTypeRef` ): ``` def transformInfo(tp: Type) = appliedType(tp.asSeenFrom(pre, sym.owner), if (args.isEmpty) dummyArgs else args) ``` Inlining `memberInfo`, which is defined as: ``` def memberInfo(sym: Symbol): Type = { require(sym ne NoSymbol, this) sym.info.asSeenFrom(this, sym.owner) } ``` gives us: ``` def memberInfoInstantiated = transformInfo(sym.info.asSeenFrom(pre, sym.owner)) ``` Inlining `transformInfo` as reworked above: ``` def memberInfoInstantiated = appliedType(sym.info.asSeenFrom(pre, sym.owner).asSeenFrom(pre, sym.owner), if (args.isEmpty) dummyArgs else args) ``` Whoops! One `asSeenFrom` should do... ``` + final protected def memberInfoInstantiated: Type = + appliedType(sym.info.asSeenFrom(pre, sym.owner), if (args.isEmpty) dummyArgs else args) ```
* | | Merge pull request #4896 from retronym/topic/indy-all-the-thingsJason Zaugg2016-02-123-0/+15
|\ \ \ | |/ / |/| | Use invokedynamic for structural calls, symbol literals, lambda ser.
| * | Use invokedynamic for structural calls, symbol literals, lamba ser.Jason Zaugg2016-01-293-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The previous encodings created static fields in the enclosing class to host caches. However, this isn't an option once emit code in default methods of interfaces, as Java interfaces don't allow private static fields. We could continue to emit fields, and make them public when added to traits. Or, as chosen in this commit, we can emulate a call-site specific static field by using invokedynamic: when the call site is linked, our bootstrap methid can perform one-time computation, and we can capture the result in the CallSite. To implement this, I've allowed encoding of arbitrary invokedynamic calls in ApplyDynamic. The encoding is: ApplyDynamic( NoSymbol.newTermSymbol(TermName("methodName")).setInfo(invokedType) Literal(Constant(bootstrapMethodSymbol)) :: ( Literal(Constant(staticArg0)) :: Literal(Constant(staticArgN)) :: Nil ) ::: (dynArg0 :: dynArgN :: Nil) ) So far, static args may be `MethodType`, numeric or string literals, or method symbols, all of which can be converted to constant pool entries. `MethodTypes` are transformed to the erased JVM type and are converted to descriptors as String constants. I've taken advantage of this for symbol literal caching and for the structural call site cache. I've also included a test case that shows how a macro could target this (albeit using private APIs) to cache compiled regexes. I haven't managed to use this for LambdaMetafactory yet, not sure if the facility is general enough.
* | | Merge pull request #4868 from retronym/ticket/9542-comboJason Zaugg2016-02-102-22/+17
|\ \ \ | | | | | | | | SI-9542 Fix regression in value classes (served two ways)
| * | | SI-9542 Unify different reprs. of module type refsJason Zaugg2016-02-012-22/+17
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new unit test shows failures in transitivity of subtyping and type equivalence, which boil down the the inconsistent handling of the semantically equivalent: ThisType(pre, ModuleClass) ModuleTypeRef(pre, ModuleClass) SingleType(pre, Module) This commit: - adds a case to `normalizePlus` to unwrap a `ThisType` to a `ModuleTypeRef` - Use `normalizePlus` more widely during subtype comparison - refactor `fourthTry` (part of `isSubType`) to remove code that becomes obviated by the use of `normalizePlus`. This fixes the regression in the extension methods phase which was triggered by https://github.com/scala/scala/pull/4749. We can also fix that regression by tweaking the extension methods phase itself to emit the `ThisType` representation of the owner of the value class, as before. I plan to demonstrate the two approaches to fixing the regression on separate branches, and the propose that the merged result of these two is useds.
* | | Merge remote-tracking branch 'origin/2.12.x' into ↵Jason Zaugg2016-02-042-8/+12
|\ \ \ | | | | | | | | | | | | merge/2.11.x-to-2.12.x-20160203
| * | | SI-9315 Desugar string concat to java.lang.StringBuilder ...Simon Ochsenreither2016-02-032-8/+12
| |/ / | | | | | | | | | | | | | | | ... instead of scala.collection.mutable.StringBuilder to benefit from JVM optimizations. Unfortunately primitives are already boxed in erasure when they end up in this part of the backend.
* | | Merge commit 'bf599bc' into merge/2.11.x-to-2.12.x-20160203Jason Zaugg2016-02-031-2/+2
|\ \ \ | |/ / |/| / | |/ | | | | | | | | | | Conflicts: src/compiler/scala/tools/nsc/backend/opt/ConstantOptimization.scala src/compiler/scala/tools/nsc/transform/Constructors.scala src/compiler/scala/tools/nsc/typechecker/Contexts.scala src/scaladoc/scala/tools/nsc/doc/html/page/Template.scala src/scaladoc/scala/tools/nsc/doc/html/resource/lib/jquery.layout.js
| * Fix some simple extra wordsEitan Adler2016-01-171-2/+2
| | | | | | | | The the word 'the' is often used twice. Fix that.
* | Merge pull request #4735 from soc/SI-9437Lukas Rytz2016-01-261-0/+1
|\ \ | | | | | | SI-9437 Emit and support parameter names in class files
| * | SI-9437 Emit and support parameter names in class filesSimon Ochsenreither2016-01-251-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | JEP 118 added a MethodParameters attribute to the class file spec which holds the parameter names of methods when compiling Java code with `javac -parameters`. We emit parameter names by default now.
* | | Merge remote-tracking branch 'upstream/2.12.x' into opt/elimBoxesLukas Rytz2016-01-2444-161/+159
|\| |
| * | SD-70 Don't share footnotes across multiple calls to universe.showRawLukas Rytz2016-01-192-26/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | Before this commit, multiple invocations of universe.showRaw used a shared weak map that caches footnotes. If the two printed objects have equal components printed as footnotes, e.g., an equal TypeRef, the result of the second invocation depends on whether the object has been collected (and removed from the weak map) or not. See https://github.com/scala/scala-dev/issues/70#issuecomment-171701671
| * | Remove unused imports and other minor cleanupsSimon Ochsenreither2015-12-1838-89/+62
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Language imports are preceding other imports - Deleted empty file: InlineErasure - Removed some unused private[parallel] methods in scala/collection/parallel/package.scala This removes hundreds of warnings when compiling with "-Xlint -Ywarn-dead-code -Ywarn-unused -Ywarn-unused-import".
| * | Merge pull request #4729 from retronym/topic-trait-defaults-moduleLukas Rytz2015-12-183-3/+3
| |\ \ | | | | | | | | Desugar module var and accessor in refchecks/lazyvals
| | * | Desugar module var and accessor in refchecks/lazyvalsJason Zaugg2015-10-083-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rather than leaving it until mixin. The broader motivation is to simplify the mixin phase of the compiler before we get rid of implementatation classes in favour of using JDK8 default interface methods. The current code in mixin is used for both lazy val and modules, and puts the "slow path" code that uses the monitor into a dedicated method (`moduleName$lzyCompute`). I tracked this back to a3d4d17b77. I can't tell from that commit whether the performance sensititivity was related to modules or lazy vals, from the commit message I'd say the latter. As the initialization code for a module is just a constructor call, rather than an arbitraryly large chunk of code for a lazy initializer, this commit opts to inline the `lzycompute` method. During refchecks, mixin module accessors are added to classes, so that mixed in and defined modules are translated uniformly. Trait owned modules get an accessor method with an empty body (that shares the module symbol), but no module var. Defer synthesis of the double checked locking idiom to the lazyvals phase, which gets us a step closer to a unified translation of modules and lazy vals. I had to change the `atOwner` methods to to avoid using the non-existent module class of a module accessor method as the current owner. This fixes a latent bug. Without this change, retypechecking of the module accessor method during erasure crashes with an accessibility error selecting the module var. In the process, I've tweaked a tree generation utility method to wvoid synthesizing redundant blocks in module desugaring.
| * | | Merge pull request #4265 from retronym/ticket/9110Lukas Rytz2015-12-181-1/+2
| |\ \ \ | | | | | | | | | | SI-9110 Pattern `O.C` must check `$outer eq O` for a top level O
| | * | | SI-9110 Pattern `O.C` must check `$outer eq O` for a top level OJason Zaugg2015-11-261-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The outer check was not being generated when the prefix was a top level module. The enclosed test shows that we in fact must synthesize the outer check in that case. Perhaps the bug was introduced by neglecting to consider that a module can inherit member classes.
| * | | | Merge commit '5e99f82' into merge-2.11-to-2.12-nov-27Lukas Rytz2015-11-274-8/+8
| |\ \ \ \ | | |/ / / | |/| | / | | | |/ | | |/|
| | * | Apply some static code analysis recommendationsJanek Bogucki2015-11-264-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix a batch of code inspection recommendations generated by IntelliJ 14.1.5. Categories of fix, Unnecessary public modifier in interface Replace filter+size with count Replace filter+nonEmpty with exists Replace filter+headOption with find Replace `if (x != null) Some(x) else None` with Option(x) Replace getOrElse null with orNull Drop redundant semicolons Replace anon fun with PF Replace anon fun with method
| * | | Merge commit '8eb1d4c' into merge-2.11-to-2.12-nov-24Lukas Rytz2015-11-242-13/+29
| |\| |
| | * | Attacking exponential complexity in TypeMapsJason Zaugg2015-11-132-13/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Don't normalize existentials during the `contain`-s type map; `ExistentialType#normalize' calls contains internally and an exponential blowup ensues. - Ensure that the type map used in variance validation never returns modified types in order to avoid needless cloning of symbols. The enclosed test case still gets stuck in Uncurry, thanks to the way that `TypeMap#mapOver(List[Symbol])` recurses through the type first to check whether the type map would be an no-op or not. If not, it repeats the type map with cloned symbols. Doing the work twice at each level of recursion blows up the complexity. Removing that "fast path" allows the enclosed test to compile completely. As at this commit, it gets stuck in uncurry, which dealiases `s.List` to `s.c.i.List` within the type. Some more background on the troublesome part of `TypeMap`: http://lrytz.github.io/scala-aladdin-bugtracker/displayItem.do%3Fid=1210.html https://github.com/scala/scala/commit/f8b2b21050e7a2ca0f537ef70e3e0c8eead43abc
| * | | Clean up a bit more in Constructors.Adriaan Moors2015-11-121-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | Comment about my poor naming choice in Types. NullaryMethodType sounds like the method has one empty argument list, whereas it really has no argument lists at all.
| * | | Sbt-compatible implementation of `isPastXXXPhase`Adriaan Moors2015-11-121-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | sbt's [API extraction phase](https://github.com/sbt/sbt/blob/0.13/compile/interface/src/main/scala/xsbt/API.scala#L25) extends `scala.reflect.internal.Phase`, which implements a bunch of methods, such as `erasedTypes` as `false`, which are then overridden by scalac in `GlobalPhase` (nested in scala.tools.nsc.Global). (`erasedTypes` in particular is again overridden in the back-end -- for performance?) However, since sbt's compiler phases extend `reflect.internal.Phase`, the logic for detecting the current phase does not work, as the default implementation is called (simply returning `false`), when chasing the `prev` pointers hits an sbt-injected phase, as its implementation is `reflect.internal`'s constant `false`.
| * | | Annotation filtering & derivation in one place.Adriaan Moors2015-11-121-0/+16
| | | | | | | | | | | | | | | | | | | | This logic was scattered all over the hierarchy, even though it's only needed in one spot, and is unlikely to evolve.
| * | | Also mutate module *class*'s owner in ChangeOwnerTraverserAdriaan Moors2015-11-122-15/+5
| | | | | | | | | | | | | | | | | | | | Keep owner for module (symbol of the tree) and module class (holds the members) in synch while moving trees between owners (e.g., while duplicating them in specialization)
| * | | Use BTypes when building the lambdaMetaFactoryBootstrapHandleLukas Rytz2015-11-062-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | All class internal names that are referenced from a class being compiled should be referenced through their ClassBType. This makes sure that the ClassBType is cached in `classBTypeFromInternalName`, which is required during classfile writing: when ASM computes stack map frames, we need to answer subtyping queries, for which we need to look up the ClassBTypes.
* | | | Harden methods to recognize method invocations to optimizeLukas Rytz2016-01-232-0/+5
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The previous methods to identify method invocations that can be optimized, such as `isPredefAutoBox`, were String-based. Now we obtain class and method signatures from symbols through the BTypes infrastructure. We also piggy-back on specialization's type transformer to create all specialized subclasses of Tuple1/Tuple2. We'll do the same in the future for FunctionN, but the current JFunctionN are written in Java and specialized artisanally.
* | | SI-9535 correct bytecode and generic signatures for @throws[TypeParam]Lukas Rytz2015-10-262-12/+6
| | | | | | | | | | | | | | | | | | | | | For @throws[E] where E is not a class type, GenASM incorrectly writes the non-class type to the classfile. GenBCode used to crash before this commit. Now GenBCode correctly emits the erased type (like javac) and adds a generic signature.
* | | Allow @inline/noinline at callsites (in addition to def-site)Lukas Rytz2015-10-202-0/+6
| |/ |/| | | | | | | | | | | Allow annotating individual callsites @inline / @noinline using an annotation ascription c.foo(): @inline
* | Merge commit 'bb3ded3' into merge-2.11-to-2.12-oct-5Lukas Rytz2015-10-055-4/+18
|\|
| * Merge pull request #4770 from SethTisue/windows-testing-fixesLukas Rytz2015-10-051-0/+8
| |\ | | | | | | get test suite passing on Windows
| | * add comments warning of InputStream leaks in scala.io.reflectSeth Tisue2015-09-251-0/+8
| | |
| * | Merge pull request #4768 from SethTisue/fix-indentationSeth Tisue2015-09-241-1/+1
| |\ \ | | |/ | |/| fix indentation
| | * fix indentationSeth Tisue2015-09-241-1/+1
| | | | | | | | | | | | this sneaked into 2d025fe2d0c9cd0e01e390055b0531166988f901
| * | Improve presentation compilation of annotationsJason Zaugg2015-09-243-3/+9
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | A trio of problems were hampering autocompletion of annotations. First, given that that annotation is written before the annotated member, it is very common to end parse incomplete code that has a floating annotation without an anotatee. The parser was discarding the annotations (ie, the modifiers) and emitting an `EmptyTree`. Second, the presetation compiler was only looking for annotations in the Modifiers of a member def, but after typechecking annotations are moved into the symbol. Third, if an annotation failed to typecheck, it was being discarded in place of `ErroneousAnnotation`. This commit: - modifies the parser to uses a dummy class- or type-def tree, instead of EmptyTree, which can carry the annotations. - updates the locator to look in the symbol annotations of the modifiers contains no annotations. - uses a separate instance of `ErroneousAnnotation` for each erroneous annotation, and stores the original tree in its `original` tree.
* | SI-9498 Centralize and bolster TypeRef cache invalidationJason Zaugg2015-09-301-11/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | I found another spot where I had previously needed to manually invalidate a TypeRef cache, and modified that to route through the newly added `invalidatedCaches`. `invalidatedCaches` now invalidates all the other caches I could find in our types of types. I opted for a non-OO approach here, as we've got a fairly intricate lattice of traits in place that define caches, and I didn't have the stomach for adding a polymorphic `Type::invalidatedCaches` with the the right sprinkling over overrides and super calls.