summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/backend/JavaPlatform.scala
Commit message (Collapse)AuthorAgeFilesLines
* Remove abstraction layer in classpath implementationLukas Rytz2016-05-021-13/+11
|
* remove recursive classpath implementationLukas Rytz2016-04-231-22/+4
|
* Support :require when using the flat classpath representation.Lukas Rytz2016-03-221-6/+19
| | | | | | :require was re-incarnated in https://github.com/scala/scala/pull/4051, it seems to be used by the spark repl. This commit makes it work when using the flat classpath representation.
* Remove GenASM, merge remaining common code snippetsSimon Ochsenreither2015-10-271-6/+2
| | | | | | | | With GenBCode being the default and only supported backend for Java 8, we can get rid of GenASM. This commit also fixes/migrates/moves to pending/deletes tests which depended on GenASM before.
* Integrate flat classpath with the compilermpociecha2014-12-051-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit integrates with the compiler the whole flat classpath representation build next to the recursive one as an alternative. From now flat classpath really works and can be turned on. There's added flag -YclasspathImpl with two options: recursive (the default one) and flat. It was needed to make the dynamic dispatch to the particular classpath representation according to the chosen type of a classpath representation. There's added PathResolverFactory which is used instead of a concrete implementation of a path resolver. It turned out that only a small subset of path resolvers methods is used outside this class in Scala sources. Therefore, PathResolverFactory returns an instance of a base interface PathResolverResult providing only these used methods. PathResolverFactory in combination with matches in some other places ensures that in all places using classpath we create/get the proper representation. Also the classPath method in Global is modified to use the dynamic dispatch. This is very important change as a return type changed to the base ClassFileLookup providing subset of old ClassPath public methods. It can be problematic if someone was using in his project the explicit ClassPath type or public methods which are not provided via ClassFileLookup. I tested flat classpath with sbt and Scala IDE and there were no problems. Also was looking at sources of some other projects like e.g. Scala plugin for IntelliJ and there shouldn't be problems, I think, but it would be better to check these changes using the community build. Scalap's Main.scala is changed to be able to use both implementations and also to use flags related to the classpath implementation. The classpath invalidation is modified to work properly with the old (recursive) classpath representation after changes made in a Global. In the case of the attempt to use the invalidation for the flat cp it just throws exception with a message that the flat one currently doesn't support the invalidation. And also that's why the partest's test for the invalidation has been changed to use (always) the old implementation. There's added an adequate comment with TODO to this file. There's added partest test generating various dependencies (directories, zips and jars with sources and class files) and testing whether the compilation and further running an application works correctly, when there are these various types of entries specified as -classpath and -sourcepath. It should be a good approximation of real use cases.
* SI-6502 Reenables loading jars into the running REPL (regression in 2.10)Heather Miller2014-11-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | Fixes SI-6502, reenables loading jars into the running REPL (regression in 2.10). This PR allows adding a jar to the compile and runtime classpaths without resetting the REPL state (crucial for Spark SPARK-3257). This follows the lead taken by @som-snytt in PR #3986, which differentiates two jar-loading behaviors (muddled by cp): - adding jars and replaying REPL expressions (using replay) - adding jars without resetting the REPL (deprecated cp, introduced require) This PR implements require (left unimplemented in #3986) This PR is a simplification of a similar approach taken by @gkossakowski in #3884. In this attempt, we check first to make sure that a jar is only added if it only contains new classes/traits/objects, otherwise we emit an error. This differs from the old invalidation approach which also tracked deleted classpath entries.
* Get rid of Platform.doLoad method.Grzegorz Kossakowski2014-05-071-2/+0
| | | | Since .NET backend got removed this method is a no-op.
* Refactor the cake so SymbolTable does not depend on GlobalGrzegorz Kossakowski2013-07-271-5/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is rather large commit so I'll first explain the motivation behind it and then go through all changes in detail explaining the choices I made. The motivation behind this refactoring was to make SymbolTable unit testable. I wanted a lightweight way of initializing SymbolTable and then writing unit tests for subtyping algorithm, various functionality related to Symbols, etc. All of that should be possible by precisely controlling what we test, e.g., create types and symbols by hand and not have them defined in source code as we normally do in partest (functional) tests. The other motivation was to reduce and clarify dependencies we have in the compiler. Explicit dependencies lead to cleaner design. Also, explicit and reduces dependencies help incremental compilation which is a big problem for us in compiler's code base at the moment. One of the challenges I faced during that refactoring was cyclic dependency between Platform and SymbolLoaders. Platform depended on `SymbolLoaders.SymbolLoader` because it would define a root loader. SymbolLoaders depended on Platform for numerous reasons like deferring decision how to load a given symbol based on some Platform-specific hooks. I decided to break that cycle by removing methods related to symbol loading from Platform interface. One could argue, that better fix would be to make SymbolLoaders to not depend on Platform (backend) concept but that would be much bigger refactoring. Also, we have a new concept for dealing with symbol loading: Mirrors. For those reasons both `newClassLoader` and `rootLoader` were dropped from Platform interface. Note that JavaPlatform still depends on Global so it can access phases defined in Global to implement `platformPhases` method. Both GenICode and BCodeBodyBuilder have some Platform specific logic that requires casting because pattern matcher doesn't narrow types to give them a proper refinement. Check the changes for details. Some logging utilities has been moved from Global to SymbolTable because they are accessed by SymbolTable. Since Global inherits from SymbolTable this should be a source compatible change. The SymbolLoaders has dependency on `compileLate` method defined in Global. The purpose behind `compileLate` is not clear to me but the dependency looks a little bit dubious. At least we made that dependency explicit. ScaladocGlobal and Global defined in interactive has been adapted in a way that makes them compile both with quick.comp and 2.11.0-M4 so my refactorings are not blocking the modularization effort.
* Deprecate Platform.BinaryRepr.Grzegorz Kossakowski2013-07-271-16/+5
| | | | | | | | | | | | | | | | | | | | The 27c8266e introduced `Platform.BinaryRepr` abstract type that was meant to abstract over binary representation of a classfile. The abstraction was needed at the time because we had both jvm backend and msil backend. The msil backend has been removed but the abstraction was kept in place. The type has been deprecated and set to be an alias for AbstractFile. The alias will be removed later in 2.11 milestone cycle. All references to `Platform.BinaryRepr` has been removed in the compiler in favour of using AbstractFile directly. If we ever need to abstract over multiple backends we should do that based on real requirements of given backends. This is a first step towards breaking the cyclic dependency between Platform and SymbolLoaders.
* new bytecode emitter, GenBCode, for now under a flagMiguel Garcia2013-06-011-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GenBCode is a drop-in replacement for GenASM with several advantages: - faster: ICode isn't necessary anymore. Instead, the ASTs delivered by CleanUp (an expression language) are translated directly into a stack-language (ASM Tree nodes) - future-proofing for Java 8 (MethodHandles, invokedynamic). - documentation included, shared mutable state kept to a minimum, all contributing to making GenBCode more maintainable than its counterpart (its counterpart being GenICode + GenASM). A few tests are modified in this commit, for reasons given below. (1) files/neg/case-collision Just like GenASM, GenBCode also detects output classfiles differing only in case. However the error message differs from that of GenASM (collisions may be show in different order). Thus the original test now has a flags file containing -neo:GenASM and a new test (files/neg/case-collision2) has been added for GenBCode. The .check files in each case show expected output. (2) files/pos/t5031_3 Currently the test above doesn't work with GenBCode (try with -neo:GenBCode in the flags file) The root cause lies in the fix to https://issues.scala-lang.org/browse/SI-5031 which weakened an assertion in GenASM (GenBCode keeps the original assertion). Actually that ticket mentions the fix is a "workaround" (3) files/run/t7008-scala-defined This test also passes only under GenASM and not GenBCode, thus the flags file. GenASM turns a bling eye to: An AbstractTypeSymbol (SI-7122) has reached the bytecode emitter, for which no JVM-level internal name can be found: ScalaClassWithCheckedExceptions_1.E1 The error message above (shown by GenBCode) highlights there's no ScalaClassWithCheckedExceptions_1.E1 class, thus shouldn't show up in the emitted bytecode (GenASM emits bytecode that mentions the inexistent class).
* Eliminate a bunch of -Xlint warnings.Paul Phillips2013-03-121-1/+1
| | | | | | Mostly unused private code, unused imports, and points where an extra pair of parentheses is necessary for scalac to have confidence in our intentions.
* SI-6964 Remove build managers, both simple and refined.Jason Zaugg2013-01-121-5/+1
| | | | | | | | | Deprecated in 2.10.0, out to pasture in 2.11.0. Users are advised to migrate to: https://github.com/typesafehub/zinc http://www.scala-sbt.org/
* SI-6769 Removes GenJVM backendJames Iry2012-12-051-5/+1
| | | | | Get rid of GenJVM and everything that refers to it. Also get rid of GenAndroid since it's dead code that refers to GenJVM.
* Removed unused imports.Paul Phillips2012-11-061-1/+0
| | | | | | | | | A dizzying number of unused imports, limited to files in src/compiler. I especially like that the unused import option (not quite ready for checkin itself) finds places where feature implicits have been imported which are no longer necessary, e.g. this commit includes half a dozen removals of "import scala.language.implicitConversions".
* Brings all copyrights (in comments) up-to-date, from 2011/12 to 2013Heather Miller2012-11-021-1/+1
|
* update and normalize copyright noticeAdriaan Moors2012-08-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These are the regexp replacements performed: Sxcala -> Scala Copyright (\d*) LAMP/EPFL -> Copyright $1-2012 LAMP/EPFL Copyright (\d*)-(\d*)(,?) LAMP/EPFL -> Copyright $1-2012 LAMP/EPFL Copyright (\d*)-(\d*) Scala Solutions and LAMP/EPFL -> Copyright $1-2012 Scala Solutions and LAMP/EPFL \(C\) (\d*)-(\d*) LAMP/EPFL -> (C) $1-2012 LAMP/EPFL Copyright \(c\) (\d*)-(\d*)(.*?)EPFL -> Copyright (c) $1-2012$3EPFL The last one was needed for two HTML-ified copyright notices. Here's the summarized diff: Created using ``` git diff -w | grep ^- | sort | uniq | mate git diff -w | grep ^+ | sort | uniq | mate ``` ``` - <div id="footer">Scala programming documentation. Copyright (c) 2003-2011 <a href="http://www.epfl.ch" target="_top">EPFL</a>, with contributions from <a href="http://typesafe.com" target="_top">Typesafe</a>.</div> - copyright.string=Copyright 2002-2011, LAMP/EPFL - <meta name="Copyright" content="(C) 2002-2011 LAMP/EPFL"/> - * Copyright 2002-2011 LAMP/EPFL - * Copyright 2004-2011 LAMP/EPFL - * Copyright 2005 LAMP/EPFL - * Copyright 2005-2011 LAMP/EPFL - * Copyright 2006-2011 LAMP/EPFL - * Copyright 2007 LAMP/EPFL - * Copyright 2007-2011 LAMP/EPFL - * Copyright 2009-2011 Scala Solutions and LAMP/EPFL - * Copyright 2009-2011 Scxala Solutions and LAMP/EPFL - * Copyright 2010-2011 LAMP/EPFL - * Copyright 2012 LAMP/EPFL -# Copyright 2002-2011, LAMP/EPFL -* Copyright 2005-2011 LAMP/EPFL -/* NSC -- new Scala compiler -- Copyright 2007-2011 LAMP/EPFL */ -rem # Copyright 2002-2011, LAMP/EPFL ``` ``` + <div id="footer">Scala programming documentation. Copyright (c) 2003-2012 <a href="http://www.epfl.ch" target="_top">EPFL</a>, with contributions from <a href="http://typesafe.com" target="_top">Typesafe</a>.</div> + copyright.string=Copyright 2002-2012 LAMP/EPFL + <meta name="Copyright" content="(C) 2002-2012 LAMP/EPFL"/> + * Copyright 2002-2012 LAMP/EPFL + * Copyright 2004-2012 LAMP/EPFL + * Copyright 2005-2012 LAMP/EPFL + * Copyright 2006-2012 LAMP/EPFL + * Copyright 2007-2012 LAMP/EPFL + * Copyright 2009-2012 Scala Solutions and LAMP/EPFL + * Copyright 2010-2012 LAMP/EPFL + * Copyright 2011-2012 LAMP/EPFL +# Copyright 2002-2012 LAMP/EPFL +* Copyright 2005-2012 LAMP/EPFL +/* NSC -- new Scala compiler -- Copyright 2007-2012 LAMP/EPFL */ +rem # Copyright 2002-2012 LAMP/EPFL ```
* GenASM becomes default backend, 1.5 classfiles remain as defaultMiguel Garcia2012-07-061-1/+1
|
* Partial redesign of incremental compiler invalidation.Martin Odersky2012-05-301-3/+3
| | | | | | | | | | We now do the right thing when packages are either newly created or deleted. Previously there was a problem when a new package was created inside a system package (and, unofrtunately, root is a system package). That's fixed now. We also approximate more tightly now when packages are newly created (iei the newly created symbol gets rescanned, instead of its owner). Incremental class invalidation: dealing with empty package. The compiler can now also invalidate the empty package. Previously, no invalidation was done because empty was identified with root, which is considered a system package. (1) Fixed NPE when creating a new toplevel package in invalidation. (2) generalized interface to deal with multiple entries at a time.
* Implemented functionality to invalidate classpath entries, to enable ↵Martin Odersky2012-05-281-2/+12
| | | | incremental compiles.
* GenASM activated via -target:jvm-1.6 or -target:jvm-1.5-asmMiguel Garcia2012-05-081-2/+6
|
* Fix for SI-5644.Paul Phillips2012-04-061-4/+4
| | | | | | | Don't let OverloadedTypes reach the backend. When you want a method from a particular symbol, avoid getMember, which may inflict upon you an OverloadedType if an inherited member has the same name. Instead, use the (just now appearing) definitions.getDecl.
* More consistent use of Names.Paul Phillips2012-01-051-3/+3
| | | | | | | | Several large helpings of tedium later, fewer strings are being discarded like so much refuse. Some names now cache a String, but only "named Names", so it's not very many and they pay for themselves pretty quickly. Many fewer name-related implicit conversions now taking place. A number of efficiency related measures.
* Distentangled platform specific code from loade...Martin Odersky2011-11-081-3/+22
| | | | | | | Distentangled platform specific code from loaders so that it becomes possible to reset class symbols to their initial loader wihtout going through an all-or-nothing recursive buildups of package scopes,.
* Always include `liftcode` phase in a compiler run.Grzegorz Kossakowski2011-08-261-1/+0
| | | | | | | | | | | | | | It turns out that `liftcode` phase must be always executed or other phases will fail. Specifically, at the moment `explicitouter` seems to depend on `liftcode`. One can observe compiler crash by compiling scala/Array.scala file without `liftcode` included. At `explicitouter` phase compiler will crash with assertion error saying it cannot lift some code. Review by odersky
* Fairly ruthlessly optimized ZipArchive.Paul Phillips2011-05-121-9/+8
| | | | | | results from the profiler, but it sure isn't slower and it shed 125 lines or so. No review.
* Updated copyright notices to 2011Antonio Cunei2011-01-201-1/+1
|
* Found several minor thigns wrong with checkSens...Paul Phillips2010-11-301-1/+7
| | | | | | | Found several minor thigns wrong with checkSensible, which tries to issue warnings for comparisons which will always be true or false. No review.
* Deprecated the @serializable annotation, introd...Lukas Rytz2010-11-301-1/+1
| | | | | | | | | | | | | | | | | | | Deprecated the @serializable annotation, introduce a new trait "scala.Serializable" which has to be extended instead (cross-platform). Known issues: - Companion objects of serializable classes (including case classes) are automatically made serializable. However, they don't extend "Serializable" statically because of the known difficulty (should be done before typing, but hard). - Writing "case class C() extends Serializable" gives "error: trait Serializable is inherited twice" - Functions are serializable, but don't extend Serializable dynamically (could be fixed by making FunctionN Serializable - shouldn't we?) Note that @SerialVersionUID continues to be an annotation; it generates a static field, which is not possible otherwise in scala. Review by dragos, extempore. Question to dragos: in JavaPlatform.isMaybeBoxed, why is there a test for "JavaSerializableClass"? Is that correct?
* An overhaul of Global.Paul Phillips2010-11-071-1/+4
| | | | | | | | | | | | | | | | | | consistently, and remove things which are not being used anywhere in the visible universe. Beyond general polish here are some of the feature-like additions I can remember: * -Xshow-phases now includes descriptions of the phases. * -Xshow-class and -Xshow-object did not work as far as I could tell: if they didn't, now they do. If they did, now they work better. And you don't have to give it a fully qualified name anymore. * -Xprint-icode will generate *.icode files (don't also have to say -Xprint:icode) * counts of deprecation and unchcked warnings are given * More documentation of what global is doing. I tried not to break anything which might be using Global, but let me know if I overshot somewhere. No review.
* Returning to the thrilling world of equality an...Paul Phillips2010-03-191-0/+3
| | | | | | | | Returning to the thrilling world of equality and hashCodes now that Any.## is a reality. Moved the hash functions from Predef to ScalaRunTime, and made what appears to be an optimization to equals by not losing the result of an instanceof test. Review by community.
* Abstracting out a few more platform specific el...Paul Phillips2010-02-231-3/+14
| | | | | | Abstracting out a few more platform specific elements now that we have a facility for doing so. Review by rytz.
* The first reasonably satisfying classpath commit.Paul Phillips2010-02-181-11/+1
| | | | | there with this one. Documentation to come. Review by community.
* Reducing the amount of low-level classpath mani...Paul Phillips2010-02-141-1/+5
| | | | | | Reducing the amount of low-level classpath manipulation going on around town. No review.
* More work on classpaths.Paul Phillips2010-02-101-5/+1
| | | | | | | | to have command line options following source files, at the price of temporarily breaking tools/pathResolver. Working my way through all the usages of classpath in trunk zeroing in on fully consistent handling. Review by community.
* Some work on classpaths.Paul Phillips2010-02-081-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | at https://lampsvn.epfl.ch/trac/scala/wiki/Classpath modulo some minor details which remain to be investigated. It is not entirely integrated, and should not involve any behavioral changes. The patch also contains a number of small improvements targetting widely duplicated code. PathResolver offers a main method. If run with no arguments it will output a pile of information about classpath relevant environment vars and properties. If given arguments, it will output the classpath info that any scala runner script would use if given the same args. There is a wrapper in the tools directory. Example: tools/pathResolver -extdirs /foo -sourcepath /bar | egrep "sourcePath|scalaExtDirs" scalaExtDirs = /foo sourcePath = /bar There is also a (probably temporary) command line option -Ylog-classpath which will print out the settings.classpath value anytime it changes. Review by community.
* A more MSIL-aware attempt at isolating the plat...Paul Phillips2010-02-061-0/+36
A more MSIL-aware attempt at isolating the platform dependent pieces of Global and ClassPath so we don't introduce unwanted dependencies. Introduces a small interface backend.Platform which encapsulates that data. Review by rytz, odersky.