summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/backend/icode/Members.scala
Commit message (Collapse)AuthorAgeFilesLines
* Avoid needless Name creationJason Zaugg2014-01-311-4/+4
| | | | | - Don't create names just to perform prefix/suffix checks - Don't create names, decode, *and* intern strings in ICode
* Merge commit '97b9b2c06a' from 2.10.x into masterAdriaan Moors2014-01-171-0/+4
|\ | | | | | | | | | | | | | | | | Check files updated: test/files/presentation/t8085*.check Conflicts: build.xml src/compiler/scala/tools/nsc/ast/parser/Parsers.scala src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala
| * SI-8062 Fix inliner cycle with recursion, separate compilationJason Zaugg2013-12-101-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ICodeReaders, which decompiles JVM bytecode to ICode, was not setting the `recursive` attribute of `IMethod`. This meant that the inliner got into a cycle, repeatedly inlining the recursive call. The method name `filter` was needed to trigger this as the inliner heuristically treats that as a more attractive inlining candidate, based on `isMonadicMethod`. This commit: - refactors the checking / setting of `virtual` - adds this to ICodeReaders - tests the case involving `invokevirtual` I'm not sure how to setup a test that fails without the other changes to `ICodeReader` (for invokestatic and invokespecial).
* | Removing unused code.Paul Phillips2013-10-021-6/+0
| | | | | | | | | | | | | | Most of this was revealed via -Xlint with a flag which assumes closed world. I can't see how to check the assumes-closed-world code in without it being an ordeal. I'll leave it in a branch in case anyone wants to finish the long slog to the merge.
* | Adds equals and hashCode to three classes that implement Ordered.Lex Spoon2013-06-261-0/+8
| |
* | Absolutized paths involving the scala package.Paul Phillips2013-05-031-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Confusing, now-it-happens now-it-doesn't mysteries lurk in the darkness. When scala packages are declared like this: package scala.collection.mutable Then paths relative to scala can easily be broken via the unlucky presence of an empty (or nonempty) directory. Example: // a.scala package scala.foo class Bar { new util.Random } % scalac ./a.scala % mkdir util % scalac ./a.scala ./a.scala:4: error: type Random is not a member of package util new util.Random ^ one error found There are two ways to play defense against this: - don't use relative paths; okay sometimes, less so others - don't "opt out" of the scala package This commit mostly pursues the latter, with occasional doses of the former. I created a scratch directory containing these empty directories: actors annotation ant api asm beans cmd collection compat concurrent control convert docutil dtd duration event factory forkjoin generic hashing immutable impl include internal io logging macros man1 matching math meta model mutable nsc parallel parsing partest persistent process pull ref reflect reify remote runtime scalap scheduler script swing sys text threadpool tools transform unchecked util xml I stopped when I could compile the main src directories even with all those empties on my classpath.
* | Merge pull request #2327 from paulp/pr/2315-rebasedPaul Phillips2013-04-021-1/+1
|\ \ | | | | | | SI-7261 Implicit conversion of BooleanSetting to Boolean and BooleanFlag
| * | SI-7261 Implicit conversion of BooleanSetting to Boolean and BooleanFlagSom Snytt2013-03-271-1/+1
| | | | | | | | | | | | | | | | | | | | | This commit shortens expressions of the form `if (settings.debug.value)` to `if (settings.debug)` for various settings. Rarely, the setting is supplied as a method argument. The conversion is not employed in simple definitions where the Boolean type would have to be specified.
* | | Merge remote tracking branch 'origin/2.10.x' into ↵Jason Zaugg2013-04-021-0/+1
|\ \ \ | |/ / |/| / | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | topic/merge-2.10.x-to-v2.11.0-M2-74-g00e6c8b Conflicts: bincompat-backward.whitelist.conf bincompat-forward.whitelist.conf build.xml src/compiler/scala/reflect/reify/utils/Extractors.scala src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala src/compiler/scala/tools/nsc/symtab/classfile/ICodeReader.scala src/compiler/scala/tools/nsc/transform/patmat/MatchOptimization.scala src/compiler/scala/tools/nsc/typechecker/Typers.scala src/partest/scala/tools/partest/nest/ReflectiveRunner.scala src/reflect/scala/reflect/internal/Types.scala src/reflect/scala/reflect/runtime/JavaUniverse.scala test/files/run/inline-ex-handlers.check test/files/run/t6223.check test/files/run/t6223.scala test/scaladoc/scalacheck/IndexTest.scala
| * Read version 51 (JDK 7) class files.James Iry2013-03-141-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit makes the ClassFileReader/ICodeReader parse class files from JDK 7 (class file version 51). It does that by skipping over the method handle related entries in the constant pool and by doing some dummy processing on invoke dynamic instructions. The inliner is updated to not try to inline a method with an invoke dynamic instruction. A place holder INVOKE_DYNAMIC instruction is added to ICode but it is designed to create an error if there's ever any attempt to analyze it. Because the inliner is the only phase that ever tries to analyze ICode instructions not generated from Scala source and because Scala source will never emit an INVOKE_DYNAMIC, the place holder INVOKE_DYNAMIC should never cause any errors. A test is included that generates a class file with INVOKE_DYNAMIC and then compiles Scala code that depends on it.
* | SI-7006 Improve jump-elision code in GenASMJames Iry2013-02-251-8/+9
| | | | | | | | | | | | 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.
* | Banish needless semicolons.Jason Zaugg2013-02-241-12/+12
| |
* | Be explicit about empty param list calls.Jason Zaugg2013-02-241-6/+6
| | | | | | | | With the exception of toString and the odd JavaBean getter.
* | Eliminate allocations in uncurry and the backend.Paul Phillips2012-12-271-2/+7
| |
* | Members removed in the backend.Paul Phillips2012-11-191-28/+0
| |
* | Revert "Commenting out unused members."Paul Phillips2012-11-191-25/+25
| | | | | | | | This reverts commit 951fc3a486.
* | Commenting out unused members.Paul Phillips2012-11-191-25/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I want to get this commit into the history because the tests pass here, which demonstrates that every commented out method is not only unnecessary internally but has zero test coverage. Since I know (based on the occasional source code comment, or more often based on knowing something about other source bases) that some of these can't be removed without breaking other things, I want to at least record a snapshot of the identities of all these unused and untested methods. This commit will be reverted; then there will be another commit which removes the subset of these methods which I believe to be removable. The remainder are in great need of tests which exercise the interfaces upon which other repositories depend.
* | Removed unused imports.Paul Phillips2012-11-061-2/+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 ```
* SI-6188 ICodeReader notes exception handlers, Inliner takes them into accountMiguel Garcia2012-08-061-0/+1
|
* moves positions to scala.reflect.internal.utilEugene Burmako2012-06-081-1/+1
| | | | This is the first step of factoring out scala-reflect.jar.
* Implemented functionality to invalidate classpath entries, to enable ↵Martin Odersky2012-05-281-1/+1
| | | | incremental compiles.
* fix for SI-5672Miguel Garcia2012-05-211-4/+16
|
* Enabling postfix ops feature warning, and working on libs to avoid them.Martin Odersky2012-04-121-1/+1
|
* More consistent use of atPhase.Paul Phillips2012-03-011-6/+1
|
* Whitespace commit.Paul Phillips2012-02-291-3/+3
| | | | | | | Removed all the trailing whitespace to make eugene happier. Will try to keep it that way by protecting at the merge level. Left the tabs in place because they can't be uniformly changed to spaces, some are 2, some are 4, some are 8, whee.
* Toward a higher level abstraction than atPhase.Paul Phillips2012-02-251-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I guess these are self-explanatory. @inline final def afterErasure[T](op: => T): T = afterPhase(currentRun.erasurePhase)(op) @inline final def afterExplicitOuter[T](op: => T): T = afterPhase(currentRun.explicitouterPhase)(op) ... @inline final def beforeTyper[T](op: => T): T = beforePhase(currentRun.typerPhase)(op) @inline final def beforeUncurry[T](op: => T): T = beforePhase(currentRun.uncurryPhase)(op) This commit is basically pure substitution. To get anywhere interesting with all the phase-related bugs we have to determine why we use atPhase and capture that reasoning directly. With the exception of erasure, most phases don't have much meaning outside of the compiler. How can anyone know why a block of code which says atPhase(explicitouter.prev) { ... } needs to run there? Too much cargo cult, and it should stop. Every usage of atPhase should be commented as to intention. It's easy to find bugs like atPhase(uncurryPhase.prev) which was probably intended to run before uncurry, but actually runs before whatever happens to be before uncurry - which, luckily enough, is non-deterministic because the continuations plugin inserts phases between refchecks and uncurry. % scalac -Xplugin-disable:continuations -Xshow-phases refchecks 7 reference/override checking, translate nested objects uncurry 8 uncurry, translate function values to anonymous classes % scalac -Xshow-phases selectivecps 9 uncurry 10 uncurry, translate function values to anonymous classes Expressions like atPhase(somePhase.prev) are never right or are at best highly suboptimal, because most of the time you have no guarantees about what phase precedes you. Anyway, I think most or all atPhases expressed that way only wanted to run before somePhase, and because one can never be too sure without searching for documentation whether "atPhase" means before or after, people err on the side of caution and overshoot by a phase. Unfortunately, this usually works. (I prefer bugs which never work.)
* one less TODO and null checkSzabolcs Berecz2012-02-051-2/+1
|
* More consistent use of Names.Paul Phillips2012-01-051-1/+0
| | | | | | | | 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.
* Optimization/robustness in the backend.Paul Phillips2012-01-031-20/+40
| | | | | | | | | | Trying to help icode/jvm get through their business a bit faster, and also make things more robust. Less null, more distinguished objects. More encapsulation, fewer public vars. Helping updateSuccessorList() to avoid assembling a list of successors on every call only to find most of the time that it's the same list it already had (e.g. compiling quick.lib it says "59076 calls, 690 requiring allocation" rather than 59076 calls, 59076 requiring allocation.)
* Created VariantTypeMap.Paul Phillips2011-12-301-1/+2
| | | | | | | Noticed most TypeMaps ignore variance but perform all the variance bookkeeping regardless. Made it so only variant TypeMaps pay that cost. Also lent some organization to the one place making real use of VariantTypeMap, existentialAbstraction.
* Optimization in backend.Paul Phillips2011-12-301-4/+2
| | | | | | | Eliminated one source of the thousands of copies of the same Strings we had/have (strongly reachable) on the heap. It is another good example of how constructor parameters unintentionally become fields and how that in turn brings the pain.
* Fix for erroneous bytecode generation.Paul Phillips2011-11-281-1/+0
| | | | | | | | | | | | | | | | | | | A remedy for an IllegalAccessError where generated bytecode referred to an inaccessible type. Closes SI-1430. Bonus materials: - tore out all the invokedynamic support. The shipped jdk7 implementation shows limited resemblance to the one this was written against; the code mostly serves to distract. (I think I could get invokedynamic working pretty quickly, except that it would mean having a codebase for java7 and one for 5-6, which is not a yak I wish to shave today.) - gave NullClass and NothingClass objects of their own, which allowed a nice polymorphic simplification of isSubClass, plus a couple other streamlinings.
* Reversed the values of "is" and "is not" in rec...Paul Phillips2011-08-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Reversed the values of "is" and "is not" in recent for comprehension deprecation. DO NOT BLOW HATCH REPEAT DO NOT BLOW HATCH "Roger! Hatch blown." Events reveal it was all baby, no bathwater. It turns out that the specification is merely a document, not infallible holy writ as we had all previously believed. So it is not the ABSENCE of val in a for comprehension assignment which is deprecated, it is the PRESENCE of val. Summarizing again, more accurately perhaps: for (x <- 1 to 5 ; y = x) yield x+y // THAT's the one for (val x <- 1 to 5 ; y = x) yield x+y // fail for (val x <- 1 to 5 ; val y = x) yield x+y // fail for (x <- 1 to 5 ; val y = x) yield x+y // deprecated No review.
* Finished up some backend cleanups I'd had lying...Paul Phillips2011-08-031-3/+2
| | | | | | Finished up some backend cleanups I'd had lying around since scala days. No review.
* Adding some Sets/Maps to perRunCaches, and elim...Paul Phillips2011-07-141-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Adding some Sets/Maps to perRunCaches, and eliminating ambiguously named imports. Did a tour of the compiler adding a few longer-lived mutable structures to the per-run cache clearing mechanism. Some of these were not a big threat, but there is (almost) literally no cost to tracking them and the fewer mutable structures which are created "lone wolf style" the easier it is to spot the one playing by his own rules. While I was at it I followed through on long held ambition to eliminate the importing of highly ambiguous names like "Map" and "HashSet" from the mutable and immutable packages. I didn't quite manage elimination but it's pretty close. Something potentially as pernicious which I didn't do much about is this import: import scala.collection._ Imagine coming across that one on lines 407 and 474 of a 1271 file. That's not cool. Some poor future programmer will be on line 1100 and use "Map[A, B]" in some function and only after the product has shipped will it be discovered that the signature is wrong and the rocket will now be crashing into the mountainside straightaway. No review.
* Some minor cleanups in the inliner, no review.Paul Phillips2011-05-141-0/+3
|
* After having to update the code for someone els...Paul Phillips2011-04-301-2/+2
| | | | | | | After having to update the code for someone else, ran damarau levenshtein on trunk again. Patchwise, I guess correcting spelling errors in comments is about as safe as it gets. No review.
* I wrote a warning when nullary methods return U...Paul Phillips2011-04-281-3/+3
| | | | | | | | | | | | | | | I wrote a warning when nullary methods return Unit. I wimped out of including it in this patch because we had about 200 of them, and that's what is fixed in this patch. I will add the warning to some kind of "-Xlint" feature after 2.9. This is motivated at least partly by the resolution of #4506, which indicates the distinction between "def foo()" and "def foo" will continue to jab its pointy stick into our eyes, so I believe we have a minimal duty of at least following our own advice about what they mean and not making a semirandom choice as to whether a method has parens or not. Review by community.
* Updated copyright notices to 2011Antonio Cunei2011-01-201-1/+1
|
* Misc icode cleanup. No review.Paul Phillips2011-01-041-0/+1
|
* Some accumulated cleanup done while profiling a...Paul Phillips2010-12-291-3/+1
| | | | | | Some accumulated cleanup done while profiling and reducing uses of length. No review.
* One of those annoying patches for which I apolo...Paul Phillips2010-11-021-3/+1
| | | | | | | | | | One of those annoying patches for which I apologize in advance. It's a step toward a better world. Almost all the changes herein are simple transformations of "x hasFlag FOO" to "x.isFoo", with the remainder minor cleanups. It's too big to review, so let's say no review: but I'm still all ears for input on the issues mostly outlined in HasFlags.scala.
* While trying to come to an understanding with #...Paul Phillips2010-09-301-2/+2
| | | | | | | | | | | | | | | | | | | | | | | While trying to come to an understanding with #3869 I had one of those "what are we doing" moments regarding the reams of output generated under -Ydebug. We have all these places where extra info is logged under -Ydebug -- like "if (debug) log(...)" -- and if you try for those you are also saddled with all these irrelevant places which instead say if (debug) Console.println(...). I changed about every one of them to send it to log() instead. So if you were enjoying that 600 MB of debugging output when you compile "goodbye world", you can have it back and then some with -Ylog:all. Until then, enjoy the calm, quiet competence of the new -Ydebug. Also herein: raised default ANT_OPTS permgen because I can no longer build a dist with the former defaults, and gave some synthetics a better home in StdNames. No review (but if anyone just can't live without some particular piece of output every single time -Ydebug is given, I can put it back.)
* Bringing the tree and icode checkers back to life.Paul Phillips2010-09-271-3/+13
| | | | | | | | | | | | | | | | | | | | | | | | build/pack/bin/scalac -d /tmp -Ycheck-debug -Ycheck:all \ src/compiler/scala/tools/nsc/Global.scala That blows up in constructors as most files do, so also try it with -Ycheck:icode to see the pretty icode output (for a little while anyway, after which it will again blow up.) Our work has only just begun! See test/checker-tests/fail*.scala for 11 examples of places where the checker cries foul. Many of them are telling us about real issues and we should listen, but I will need help to figure out which are legitimate and which should be eliminated by altering the checkers. This patch also hacks on some territory the checkers drew me into, especially TypeKinds, where I figured anything which had been commented out since 2005 was fair game. (Optional) review by dragos. (The one place I know I could use a look is in Checkers.scala, because I had to relax some checks and add at least one newer opcode.)
* A cleanup of the inliner.Paul Phillips2010-09-221-75/+61
| | | | | | and still came out of the washing machine smiling. Already reviewed by a certain i. dragos so no review.
* Fixed various issues with Icode, mainly fixing ...Iulian Dragos2010-08-231-0/+1
| | | | | Fixed various issues with Icode, mainly fixing empty/open blocks.
* Removed more than 3400 svn '$Id' keywords and r...Antonio Cunei2010-05-121-1/+0
| | | | | Removed more than 3400 svn '$Id' keywords and related junk.
* missing bits of r20746.Martin Odersky2010-02-011-2/+2
|