aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/backend/jvm
Commit message (Collapse)AuthorAgeFilesLines
* Eliminate tpd.Modifiers.Martin Odersky2016-09-261-4/+4
| | | | | | Backend does not need them after all, can just use nulls there. So the functionality is only used for printing, and it makes sense to move everything there.
* Drop tpd.modsDecoMartin Odersky2016-09-261-3/+3
| | | | Prefer to access directly via symbol.
* Fix CollectSuperMartin Odersky2016-09-211-7/+8
| | | | | Add comment what it is supposed to achieve and change the implementation to follow the comment.
* Fix handling of superCalls.Dmitry Petrashko2016-09-192-3/+10
| | | | | 1. There may be calls to super on non-this. 2. there may be calls to in-dirrect super-traits.
* Merge pull request #1414 from dotty-staging/add-array-strawmanodersky2016-08-141-1/+3
|\ | | | | Add arrays to collection strawman
| * Quick-fix eclosingMethod attribute generation for t3048.scalaDmitry Petrashko2016-07-271-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's a funny interaction between: elim-by-name(and erasure specifically); lift-static; supercalls. object E extends F2(new B {}) Here we have an anonymous class new B {} that looks like it is created by erasure. For some reason this class forgets the link to original anonymous class: SymDenot(E$annon1).initial.phase == erasure. I guess this is a bug. Additionally, the owner of E$annon1 is an anonymous method inside E, that is inSuperCall and thus we have an anonymous nested class that has enclosingClass be package. This class looks like a top-level anonymous class breaking a lot of assumptions in shared backend and taking multiple branches in unexpected ways. I'm not sure that this is a proper fix. I assume there's a bigger bug around, but I don't quite understand it right now and I need to work on other stuff. Making a quick fix to unblock @odersky.
* | Fix #1423: Fix owners of called methods in CollectSuperCalls.Nicolas Stucki2016-07-291-7/+8
|/
* Fix #1209: Skip redundant superclasses\supertraits.Nicolas Stucki2016-07-133-4/+57
|
* DottyBackendInterface: fix a bug in methodSymbols.Dmitry Petrashko2016-06-071-1/+1
| | | | | This method is only used to find static initialisers. Previously, it was always wrong, but we didn't care as we never had them.
* MoveStatic: Move static methods & fields into companion classDmitry Petrashko2016-06-071-3/+6
| | | | | | | As a funny side-effect this allows to execute arbitrary code in static initialisers: @static val a: Unit = {println("loaded")}
* Add sbt incremental compilation supportGuillaume Martres2016-05-281-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To test this with sbt, see https://github.com/lampepfl/dotty/wiki/Using-Dotty-with-sbt The following flags are added: - -Yforce-sbt-phases: Run the phases used by sbt for incremental compilation (ExtractDependencies and ExtractAPI) even if the compiler is ran outside of sbt, for debugging. - -Ydump-sbt-inc: For every compiled foo.scala, output the API representation and dependencies used for sbt incremental compilation in foo.inc, implies -Yforce-sbt-phases. This commit introduces two new phases which do not transform trees: - `ExtractDependencies` which extracts the dependency information of the current compilation unit and sends it to sbt via callbacks - `ExtractAPI` which creates a representation of the API of the current compilation unit and sends it to sbt via callbacks Briefly, when a file changes sbt will recompile it, if its API has changed (determined by what `ExtractAPI` sent) then sbt will determine which reverse-dependencies (determined by what `ExtractDependencies` sent) of the API have to be recompiled depending on what changed. See http://www.scala-sbt.org/0.13/docs/Understanding-Recompilation.html for more information on how sbt incremental compilation works. This phase was originally based on https://github.com/adriaanm/scala/tree/sbt-api-consolidate/src/compiler/scala/tools/sbt which attempts to integrate the sbt phases into scalac (and is itself based on https://github.com/sbt/sbt/tree/0.13/compile/interface/src/main/scala/xsbt), but it has been heavily refactored and adapted to Dotty. The main functional differences are: - ExtractDependencies runs right after Frontend (so that we don't lose dependency informations because of the simplifications done by PostTyper), but ExtractAPI runs right after PostTyper (so that SuperAccessors are part of the API). - `ExtractAPI` only extract types as they are defined and never "as seen from" some some specific prefix, see its documentation for more details. - `ExtractDependenciesTraverser` and `ExtractUsedNames` have been fused into one tree traversal in `ExtractDependenciesCollector`. TODO: Try to run these phases in parallel with the rest of the compiler pipeline since they're independent (except for the sbt callbacks in `GenBCode`) ?
* Safe equality for core classes:Martin Odersky2016-05-231-5/+5
| | | | | | | Name, Symbol, Denotation, Type. This uncovered two nonsensical comparisons, one in CollectEntryPoints, the other in DottyBackendInterface.
* Update to new version of DottyBackendInterface.Dmitry Petrashko2016-04-181-8/+1
| | | | That knows that there exists only single magical array method.
* Fix #1167: Remove the magic from Arrays.newRefArray.Sébastien Doeraene2016-04-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Previously, the method `Arrays.newRefArray` was one of the only 3 methods that are kept generic after erasure. This commit removes this magic, by making it take an actual `j.l.Class[T]` as parameter. Moreover, the methods `newXArray` all receive an actual body, implemented on top of Java reflection, which means that a back-end does not *have to* special-case those methods for correctness. It might still be required for performance, though, depending on the back-end. The JVM back-end is made non-optimal in this commit, precisely because it does not specialize that method anymore. Doing so requires modifying the fork of scalac that we use, which should be done separately. The JS back-end is adapted simply by doing nothing at all on any of the newXArray methods. It will normally call the user-space implementations which use reflection. The Scala.js optimizer will inline and intrinsify the reflective calls, producing optimal code, at the end of the day.
* Implement @static sip.Dmitry Petrashko2016-03-071-1/+2
| | | | | | | | This pull request implements most of machinery needed for https://github.com/scala/scala.github.com/pull/491 Only 3-rd check is not implemented by this commit. I propose to get this in faster to fix #1149
* Add a `dotty-interfaces` packageGuillaume Martres2016-02-281-4/+16
| | | | | | | | | | | | | | | | | | | | | | We introduce a new entry point for the compiler in `dotty.tools.dotc.Driver`: ``` def process(args: Array[String], simple: interfaces.SimpleReporter, callback: interfaces.CompilerCallback): interfaces.ReporterResult ``` Except for `args` which is just an array, the argument types and return type of this method are Java interfaces defined in a new package called `dotty-interfaces` which has a stable ABI. This means that you can programmatically run a compiler with a custom reporter and callbacks without having to recompile it against every version of dotty: you only need to have `dotty-interfaces` present at compile-time and call the `process` method using Java reflection. See `test/test/InterfaceEntryPointTest.scala` for a concrete example. This design is based on discussions with the IntelliJ IDEA Scala plugin team. Thanks to Nikolay Tropin for the discussions and his PR proposal (see #1011).
* Make output directory overridableMartin Odersky2016-02-172-3/+6
| | | | | | | The interpreter needs to install a virtual directory as output directory. This is not supported with the -d option in ScalaSettings. The solution is to make the output directory overridable in the GenBCode phase.
* Enforce rule that laziness is preserved when overriding.Martin Odersky2016-02-091-1/+1
|
* Add initial CompilerCallback implementation for IntelliJGuillaume Martres2015-12-031-0/+11
| | | | | This adds some simple callbacks to Dotty that should be enough to get basic integration from IntelliJ.
* Swap order of arguments in annotationsMartin Odersky2015-11-221-1/+1
| | | | | | | | | The fact that the annotation comes first is weird, because when I write an annotated type it's <type> @<annotation>. Also, annotated types are like RefinedTypes in that they derive from a parent type. And in RefinedTypes the parent comes first. So swapping the arguments improves consistency.
* Make symbol methods in Definitions depend on implicit contextMartin Odersky2015-11-091-2/+2
| | | | | | | Otherwise they would always return the symbol in the original context where Definitions was first created. Also, cache two more arrays of symbols per run.
* Renamings in DefinitionsMartin Odersky2015-11-092-7/+4
| | | | | | TypeRef becomes Type, thus removing duplicates. Where ...Type was used in an extraction (e.g. ArrayType(...), FunctionType(...)), we now use ...Of.
* Avoid overhead of generating symbol sets on each accessMartin Odersky2015-11-091-3/+2
| | | | | | 1) Have symbol sets cached per run 2) Use methods Denotation#isPrimitiveValueClass, Denotation#isNumericValueClass instead of calling contains directly on symbol sets.
* Match on _name rather than TypeRef in scalaPrimitivesMartin Odersky2015-11-091-31/+31
|
* Standardize requiredMethod callsMartin Odersky2015-11-091-3/+3
| | | | | Remve versions in Symbols, always go through version in Denotations. Avoids having two equivalent ways to do the same thing.
* First versions of Definitions based on TypeRefs not Symbols.Martin Odersky2015-11-092-36/+33
| | | | | | | | | | | | | | | Symbols are not stable between runs, so if some symbol referred to from Definitions gets recompiled, there are then two Symbols that are both visible, one referenced from Definitions, the other the one that got compiled. Thos led to a crash when e.g. compiling scala.Short, because the newly compiled symbol was not recognized as a primitive value class. The present commit tries to make systematic changes without regard to simplicity or aesthetics. This will be polished in future commits. // ### comments signal areas that need further attention.
* Fix DottyBackendInterafec.isStaticModuleClass.Dmitry Petrashko2015-10-221-1/+1
| | | | Used to pass wrong context.
* Do not emit static forwarders in non-static modules.Dmitry Petrashko2015-08-131-2/+2
|
* Fix emission of static initialisers for Modules.Dmitry Petrashko2015-08-131-1/+10
| | | | | They should not be emitted for non-static modules. All modules look as if they were static by backend.
* Merge pull request #735 from dotty-staging/ycheck-methodsodersky2015-08-041-1/+1
|\ | | | | Ycheck that methods defined in ClassInfo exist in tree.
| * Fix enumeration of all members of the classDmitry Petrashko2015-07-281-1/+1
| | | | | | | | | | | | | | used a wrong member function inside, led to errors similar to: java.lang.ClassFormatError: Duplicate method name&signature in class file dotty/tools/dotc/core/Types$WildcardType
* | Merge pull request #727 from dotty-staging/genbcode-annotationsDmitry Petrashko2015-07-151-1/+1
|\ \ | | | | | | Implement emission of annotations in GenBCode.
| * | Implement emotion of annotations in GenBCode.Dmitry Petrashko2015-07-141-1/+1
| |/ | | | | | | Fixes #688
* / Fix #713. Put tasty attribute on mirror class of modules.Dmitry Petrashko2015-07-141-1/+1
|/
* Merge pull request #715 from dotty-staging/repeated-arraysDmitry Petrashko2015-07-051-2/+9
|\ | | | | Fixes to generic arrays in backend.
| * Arrays.newRefArray has multiple symbols that coexist during bootstrap.Dmitry Petrashko2015-07-051-2/+9
| | | | | | | | More magic is needed, as enumerating array symbols does not work in backend.
* | Document that lines and columns start at 0.Martin Odersky2015-06-251-1/+1
|/ | | | And adjust for it in DottyBackendInterface
* Make normalizeToRef survive annotated typesMartin Odersky2015-05-211-1/+1
| | | | Did not handle this case before.
* Merge pull request #565 from retronym/topic/cleanupsDmitry Petrashko2015-05-153-5/+5
|\ | | | | Fix typos, scaladoc tags, and some minor code smells.
| * Correct a large number of typos.Jason Zaugg2015-05-143-5/+5
| | | | | | | | | | I scanned the main sources with IntellIJ's spell checker and corrected what showed up.
* | Fix #560 - refactor flatNameMartin Odersky2015-05-131-1/+1
|/ | | | | | - Merge flatName and fullNameSeparated - Treat nested members of modules specially, to conform to scalac conventions - Use `~` as separator for term members.
* Cleanup non-deviation.Martin Odersky2015-05-121-6/+1
| | | | | There was a "dotty deviation - does not work" in DottyBackendInterface, which does work after all. Reverting to more idiomatic code.
* Remove NonExistentTree.Dmitry Petrashko2015-05-081-3/+2
|
* Workaround dotty deviation in for loop patterns.Dmitry Petrashko2015-05-081-5/+10
|
* Address some of dotty deviations in backend.Dmitry Petrashko2015-05-082-2/+2
| | | | Implicit vals need explicit type, anonymous classes are widened.
* Do not use deprecated procedure syntax in GenBCode.Dmitry Petrashko2015-05-082-16/+21
|
* Rename localClasses -> definedClassesMartin Odersky2015-05-071-3/+3
|
* Fix #536 - only load member classes of classes that are currently compiled.Martin Odersky2015-05-071-2/+18
| | | | | | | It seems wasteful to load the member classes even of classes that are not currently compiled. It also makes us vulnerable to any misinterpretation of Java file formats. In th particular case of #536, we parsed a class an anonymous Collection$1 which was referring to the type parameter of its enclosing class, but was not diagnosed as an inner class of the enclosing class.
* Merge pull request #509 from dotty-staging/add/expandSAMsDmitry Petrashko2015-05-041-2/+2
|\ | | | | Expand SAM closures to anonymous classes if needed
| * Refactoring and renaming of superClass/superInterfacesMartin Odersky2015-05-021-2/+2
| | | | | | | | | | | | | | | | superClass was a duplicate; we already have one in SymDenotation, so we delete the one in SymUtils. superInterfaces is too easy to confused with the JVM notion, which is different. I replaced with directlyInheritedTraits.