aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/backend
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #1725 from dotty-staging/change-pickle-earlyGuillaume Martres2016-11-221-2/+1
|\ | | | | Don't retain picklers until backend.
| * Don't keep full picklers around until backend.Martin Odersky2016-11-181-2/+1
| | | | | | | | | | | | The memory footprint captured by pickler seems to be about 1/3rd of total footprint. So we gain a lot by not making this die sooner rather than later.
* | Make This and Super take idents as qualifier/mixinMartin Odersky2016-11-211-2/+2
|/ | | | | The qualifier of a This and the mixin of a Super were names, which meant that their positions were lost. Now they are untyped idents.
* Fix #1637: Future defs are always OKMartin Odersky2016-10-311-13/+8
| | | | | | | Drop special mode that handles future defs without which we get DenotationNotDefinedHere errors. In more than a year, this has only turned up false negatives. So I think it's better to drop the check, and the contortions needed to deal with it.
* Merge GenericType, TypeLambda and PolyTypeMartin Odersky2016-10-121-1/+1
|
* 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-183-33/+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 loading static fields in the Scala.js back-end.Sébastien Doeraene2016-04-181-3/+21
|
* Upgrade to Scala.js 0.6.8.Sébastien Doeraene2016-03-181-17/+4
| | | | | | This allows to remove the ugly workaround for default methods. There is also a slight adaptation for the new way to encode a reference to the JS global scope in the IR.
* Merge pull request #1148 from sjrd/scalajs-gen-exprsodersky2016-03-185-81/+1472
|\ | | | | Implement most of the Scala.js IR code generator.
| * More documentation for some Scala.js-specific methods.Sébastien Doeraene2016-03-163-4/+33
| |
| * Cache the Phases we need in JSCodeGen like all other phases.Sébastien Doeraene2016-03-161-8/+3
| |
| * Implement most of use-site JavaScript interop.Sébastien Doeraene2016-03-102-16/+437
| | | | | | | | | | | | Notable things that are not yet implemented: * JS exports * Scala.js-defined JS classes.
| * Implement most of the Scala.js IR code generator.Sébastien Doeraene2016-03-105-74/+1020
| | | | | | | | | | | | | | | | Notable things that are missing at this point: * Pattern matching * Try * Most of the JavaScript interop
* | 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
* Store the JSDefinitions in a custom platform SJSPlatform.Sébastien Doeraene2016-03-011-15/+5
| | | | | | This required the ability to instantiate a different `Platform` depending on settings, which, in turn, required to defer the initialization of `ContextBase.platform`.
* Initial infrastructure and hello world for the Scala.js back-end.Sébastien Doeraene2016-03-017-0/+1971
| | | | | | | | | | | | | | | | The Scala.js back-end can be enabled with the `-scalajs` command-line option. Currently, it adds one phase to the pipeline, which emits .sjsir files from trees. A sandbox project `sjsSandbox`, in `sandbox/scalajs/`, can be used to easily test Scala.js compilation. One can run the `main()` method of the `hello.world` object with > sjsSandbox/run The back-end only contains the bare mimimum to compile the hello world application in the sandbox. Anything else will blow up (for example, primitive method calls). It is a work-in-progress.
* 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.