summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala
Commit message (Collapse)AuthorAgeFilesLines
* Remove ICodeSimon Ochsenreither2015-10-311-2239/+0
|
* Merge remote-tracking branch 'origin/2.11.x' into 2.12.xSeth Tisue2015-09-081-2/+2
| | | | | | | | only trivial merge conflicts here. not dealing with PR #4333 in this merge because there is a substantial conflict there -- so that's why I stopped at 63daba33ae99471175e9d7b20792324615f5999b for now
* Merge branch '2.11.x' into merge/2.11.x-to-2.12.x-20150624Jason Zaugg2015-06-241-2/+2
|\
| * Fix 36 typos (d-f)Janek Bogucki2015-06-211-2/+2
| |
* | Merge commit 'fedbfd7' into merge/2.11-to-2.12-apr-21Lukas Rytz2015-04-211-1/+6
|\|
| * SI-9264 An even-better diagnostic for an unexplained crashJason Zaugg2015-04-071-1/+6
| | | | | | | | | | | | | | | | | | | | We have seen an intermittent crasher in the backend for the last month or so. In https://github.com/scala/scala/pull/4397, I added a diagnostic to show the actual locals in scope in the method. This commit further expands the diagnistic to show the method's tree.
* | Merge commit '32f520f' into merge/2.11-to-2.12-apr-1Lukas Rytz2015-04-011-7/+9
|\|
| * Improve diagnostic error on failed genLoadIdentJason Zaugg2015-03-241-7/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This error has been haunting us recently, firstly on Greg's machine when compiling the compiler using the new SBT build, and more recently during PR validation in #4316. This commit will output an error like: symbol value c#16812 does not exist in Macro.impl, which contains locals value a#16810, value b#16811 I've included symbol IDs in the hope that they will prove useful. It seems that synthetic identifiers generated by the pattern matcher are often seen in the vicinity of this bug.
* | Merge remote-tracking branch 'origin/2.11.x' into ↵Jason Zaugg2015-01-291-1/+1
|\| | | | | | | | | | | | | | | | | merge/2.11.x-to-2.12.x-20150129 Conflicts: build.number src/library/scala/concurrent/Future.scala versions.properties
| * Merge pull request #4201 from mpociecha/fix-typos-in-docs-and-commentsGrzegorz Kossakowski2015-01-141-1/+1
| |\ | | | | | | Fix many typos in docs and comments
| | * Fix many typos in docs and commentsmpociecha2014-12-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit corrects many typos found in scaladocs, comments and documentation. It should reduce a bit number of PRs which fix one typo. There are no changes in the 'real' code except one corrected name of a JUnit test method and some error messages in exceptions. In the case of typos in other method or field names etc., I just skipped them. Obviously this commit doesn't fix all existing typos. I just generated in IntelliJ the list of potential typos and looked through it quickly.
| * | [nomerge] SI-9030 don't call private BoxesRunTime.equalsNumCharLukas Rytz2014-12-111-1/+1
| |/ | | | | | | | | | | When comparing a Number and a Character, the would emit a call to the private method. For binary compatibility, this method remains private in 2.11, so we just use equalsNumObject instead.
* / More uniform treatment of package objectsJason Zaugg2014-11-071-1/+1
|/ | | | | | | | | | | | | | | | | | | - Introduce `Symbol#packageObject` and `Type#packageObject` to lookup the member package object of a package class/module, and use this far and wide. - Replace the overly complicated (and still buggy) implementation of `Context#isInPackageObject` with a one liner. The simplifying insight is that if we select a symbol from a package prefix that does not own that symbol, it *must* have really been selected from the package object. - Change implicit search to use the cache in `ModuleSymbol#implicitMembers` via `Type#implicitMembers`, which lets the client code read more naturally. Fixes a bug with `adapt::insertApply` that Adriaan spotted in a feat of lateral thinking. This is tested in t8862b.scala. alladin763.scala adds the test case from the bug originally remedied by `insertApply` to check we haven't regressed.
* Rip out reporting indirection from CompilationUnitAdriaan Moors2014-07-041-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Inline the forwarders from CompilationUnit, which should not affect behavior. Since all forwarders lead to global.reporter, don't first navigate to a compilation unit, only to then forward back to global.reporter. The cleanup in the previous commits revealed a ton of confusion regarding how to report an error. This was a mechanical search/replace, which has low potential for messing things up, since the list of available methods are disjoint between `reporter` and `currentRun.reporting`. The changes involving `typer.context` were done previously. Essentially, there are three ways to report: - via typer.context, so that reporting can be silenced (buffered) - via global.currentRun.reporting, which summarizes (e.g., deprecation) - via global.reporter, which is (mostly) stateless and straightforward. Ideally, these should all just go through `global.currentRun.reporting`, with the typing context changing that reporter to buffer where necessary. After the refactor, these are the ways in which we report (outside of typer): - reporter.comment - reporter.echo - reporter.error - reporter.warning - currentRun.reporting.deprecationWarning - currentRun.reporting.incompleteHandled - currentRun.reporting.incompleteInputError - currentRun.reporting.inlinerWarning - currentRun.reporting.uncheckedWarning Before: - c.cunit.error - c.enclosingUnit.deprecationWarning - context.unit.error - context.unit.warning - csymCompUnit.warning - cunit.error - cunit.warning - currentClass.cunit.warning - currentIClazz.cunit.inlinerWarning - currentRun.currentUnit.error - currentRun.reporting - currentUnit.deprecationWarning - currentUnit.error - currentUnit.warning - getContext.unit.warning - getCurrentCUnit.error - global.currentUnit.uncheckedWarning - global.currentUnit.warning - global.reporter - icls.cunit.warning - item.cunit.warning - reporter.comment - reporter.echo - reporter.error - reporter.warning - reporting.deprecationWarning - reporting.incompleteHandled - reporting.incompleteInputError - reporting.inlinerWarning - reporting.uncheckedWarning - typer.context.unit.warning - unit.deprecationWarning - unit.echo - unit.error - unit.incompleteHandled - unit.incompleteInputError - unit.uncheckedWarning - unit.warning - v1.cunit.warning All these methods ended up calling a method on `global.reporter` or on `global.currentRun.reporting` (their interfaces are disjoint). Also clean up `TypeDiagnostics`: inline nearly-single-use private methods.
* SI-8625 fix unreachability analysis for boolean expressionsLukas Rytz2014-05-271-3/+10
|
* BCodeICodeCommon through composition rather than inheritanceLukas Rytz2014-05-081-1/+4
|
* SI-7852 for GenBCodeLukas Rytz2014-05-071-11/+1
| | | | | | | | Avoid null checks for "someLiteral".== and SomeModule.==. This has been implemented in GenICode in #2954. Introduces a trait to share code between GenICode and GenBCode. This is just a start, more such refactorings will come quite certainly.
* SI-8330: Mismatch in stack heightsGrzegorz Kossakowski2014-02-241-1/+2
| | | | | | | | | | | | The SI-8233 / 9506d52 missed one case when we need to DROP a null from a stack: when unboxed Unit is an expected type. If we forgot to do that in a context where two branches were involved we could end up with unbalanced stack sizes. Let's fix that omission and a test covering that specific case to the original test for SI-8233. Fixes SI-8330.
* SI-6732 deprecates internal#Symbol.isPackageEugene Burmako2014-02-141-1/+1
| | | | | | | | This is the first step in disentangling api#Symbol.isPackage, which is supposed to return false for package classes, and internal#Symbol.isPackage, which has traditionally being used as a synonym for hasPackageFlag and hence returned true for package classes (unlike isModule which is false for module classes).
* Merge pull request #3449 from retronym/topic/opt11Grzegorz Kossakowski2014-02-051-2/+4
|\ | | | | Another grab bag of compiler optimizations
| * Avoid work in GenICode#run when inactive.Jason Zaugg2014-01-311-2/+4
| | | | | | | | | | scalaPrimitives.init() represented 1% of a small (1s) compilation run.
* | SI-8233 Fix regression in backend with boxed nullsJason Zaugg2014-02-051-2/+12
|/ | | | | | | | | | | Regressed in SI-7015 / 1b6661b8. We do need to "unbox" the null (ie, drop a stack from and load a null) in general. The only time we can avoid this is if the tree we are adapting is a `Constant(Literal(null))`. I've added a test for both backends. Only GenICode exhibited the problem.
* Merge commit '97b9b2c06a' from 2.10.x into masterAdriaan Moors2014-01-171-4/+1
|\ | | | | | | | | | | | | | | | | 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-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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).
| * [backport] SI-6301 / SI-6572 specialization regressionsJason Zaugg2013-01-291-38/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Squashed commit of the following: commit a3680be29ccd5314c5d027d473b37940eaecd530 Author: Paul Phillips <paulp@improving.org> Date: Fri Aug 31 10:20:16 2012 -0700 Actual fix for SI-6301, specialized crasher. This means the workaround in the previous commit is no longer reached, but it should remain where it is as a much needed layer of robustness/useful error reporting. Conflicts: src/compiler/scala/tools/nsc/transform/SpecializeTypes.scala src/compiler/scala/tools/nsc/typechecker/Duplicators.scala commit f4c45ae204ce3ff3c16b19cab266d0b6515b6e0f Author: Paul Phillips <paulp@improving.org> Date: Fri Aug 31 10:49:24 2012 -0700 Rewrite of GenICode adapt. Started for debuggability, stayed for clarify/performance. Conflicts: src/compiler/scala/tools/nsc/backend/icode/GenICode.scala commit 74842f72a0af485e5def796f777f7003f969d75b Author: Paul Phillips <paulp@improving.org> Date: Fri Aug 31 08:45:34 2012 -0700 Workaround for SI-6301, @specialize crasher. SpecializeTypes is generating symbols with overloaded types which then proceed to crash in CleanUp or GenICode. Until I or someone works out why that is, take a look in case the overload is easily disambiguated by the argument list arity, in which case warn and proceed.
* | SI-7678 Don't cache member symbols of TypeTags in Definitions.Jason Zaugg2013-11-081-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It we can only safely use vals in Definitions for top-level symbols. Otherwise, when the IDE switches to loading the symbol from source, we can hold on to a stale symbol, which in turn impedes implicit materialization of TypeTags. This commit moves (most) of the accessors for member symbols into RunDefinitions, and changes calling code accordingly. This is a win for presentation compiler correctness, and might even shave of a few cycles. In a few cases, I have had to leave a `def` to a member symbol in Definitions so we can get to it from the SymbolTable cake, which doesn't see RunDefinitions. The macro FastTrack facility now correctly recreates the mapping from Symbol to macro implementation each run, using a new facility in perRunCaches to create a run-indexed cache. The enclosed test recreates the situation reported in the ticket, in which TypeTags.scala is loaded from source.
* | SI-7852 Omit null check for SomeModule.==Jason Zaugg2013-09-181-2/+7
| | | | | | | | For the same reasons outlined in the previous commits.
* | SI-7852 Omit null check for "".==Jason Zaugg2013-09-171-0/+14
| | | | | | | | | | | | | | | | | | | | Although the same the code would be later optimized by -Yconst-opt, we can offer the same lean byte code to those compiling without that option by being more discerning when translating ==. This helps people using bytecode based code coverage tools such as jacoco that would emit "branch not covered" warnings for the impossible null check.
* | Logging cleanup.Paul Phillips2013-08-251-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Reduced the amount of extraneous logging noise at the default logging level. Was brought to my usual crashing halt by the discovery of identical logging statements throughout GenASM and elsewhere. I'm supposing the reason people so grossly underestimate the cost of such duplication is that most of the effects are in things which don't happen, aka "silent evidence". An example of a thing which isn't happening is the remainder of this commit, which exists only in parallel universes.
* | Fix Platform type in Global to be JavaPlatform.Grzegorz Kossakowski2013-07-271-20/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | At the moment we have just one Platform: JavaPlatform in the compiler. The whole Platform abstraction feels dubious and Java backends need to downcast to JavaPlatform to implement some optimizations. It seems like for now it's just better to fix platform declared in Global to be JavaPlatform and get rid of downcasting. I checked that even JavaScript backend declares itself as a subtype of JavaPlatform so it seems like our abstraction is not that useful. If we have an alternative platform with specific requirements we might want to refactor our Platform abstraction again but for now it seems dubious to pay a price for abstraction nobody uses.
* | Refactor the cake so SymbolTable does not depend on GlobalGrzegorz Kossakowski2013-07-271-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Merge pull request #2693 from lexspoon/semmle-lintAdriaan Moors2013-07-011-1/+1
|\ \ | | | | | | Lint-like fixes found by Semmle
| * | Seals some case class hierarchies.Lex Spoon2013-06-261-1/+1
| | |
* | | new bytecode emitter, GenBCode, for now under a flagMiguel Garcia2013-06-011-0/+1
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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).
* | Concision contribution.Paul Phillips2013-05-231-10/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We have lots of core classes for which we need not go through the symbol to get the type: ObjectClass.tpe -> ObjectTpe AnyClass.tpe -> AnyTpe I updated everything to use the concise/direct version, and eliminated a bunch of noise where places were calling typeConstructor, erasedTypeRef, and other different-seeming methods only to always wind up with the same type they would have received from sym.tpe. There's only one Object type, before or after erasure, with or without type arguments. Calls to typeConstructor were especially damaging because (see previous commit) it had a tendency to cache a different type than the type one would find via other means. The two types would compare =:=, but possibly not == and definitely not eq. (I still don't understand what == is expected to do with types.)
* | SI-7427 stop crashing under -Ydebug.Paul Phillips2013-05-191-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change "dumpClassesAndAbort" to "devWarning". You can witness it happen like so. % scalac test/files/pos/t7427.scala -Ydebug -Xdev ... [running phase cleanup on t7427.scala] [running phase icode on t7427.scala] warning: !!! PJUMP(method matchEnd4)/scala.tools.nsc.backend.icode.GenICode$PJUMP is not a control flow instruction warning: !!! PJUMP(method case6)/scala.tools.nsc.backend.icode.GenICode$PJUMP is not a control flow instruction [running phase inliner on t7427.scala] [running phase inlinehandlers on t7427.scala] Having now lived with this for months, I have no ambition to unravel the actual problem, I just want it to stop crashing.
* | Absolutized paths involving the scala package.Paul Phillips2013-05-031-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | SI-7261 Implicit conversion of BooleanSetting to Boolean and BooleanFlagSom Snytt2013-03-271-6/+6
| | | | | | | | | | | | | | 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 pull request #2285 from vigdorchik/silence_scaladocPaul Phillips2013-03-231-13/+13
|\ \ | | | | | | Remove unrecognized doc comments
| * | Doc -> C-style comments for local symbols to avoid "discardingEugene Vigdorchik2013-03-211-13/+13
| | | | | | | | | | | | | | | unmoored doc comment" warning when building distribution for scala itself.
* | | Eliminate a bunch of -Xlint warnings.Paul Phillips2013-03-121-21/+21
|/ / | | | | | | | | | | Mostly unused private code, unused imports, and points where an extra pair of parentheses is necessary for scalac to have confidence in our intentions.
* | Merge pull request #2216 from JamesIry/master_7231James Iry2013-03-081-1/+1
|\ \ | | | | | | SI-7231 Fix assertion when adapting Null type to Array type
| * | SI-7231 Fix assertion when adapting Null type to Array typeJames Iry2013-03-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | GenICode was doing a sanity check when adapting an expression of type Null to something else. It was just doing the wrong one. Instead of checking whether the result expression type was a reference type it was checking to see if it was an class reference type. This commit fixes that and adds a test to make sure both forms of adaptation work as expected.
* | | SI-7006 Cleanup from code reviewJames Iry2013-03-071-4/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | Minor cleanup from review of https://github.com/scala/scala/pull/2185 * Changed several instances of |= to ||= for better clarity (and bonus savings!) * Documented the return of two methods that compute the reachability of follow-on blocks.
* | | SI-7006 Prevent unreachable blocks in GenICodeJames Iry2013-03-061-36/+81
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit makes GenICode prevent the generation of most unreachable blocks. The new unreachable block prevention code can be disabled with a compiler flag. Because full unreachable analysis is no longer necessary for normal code it makes the unreachable block analysis run only under -optimise. A test is included to make sure unreachable code doesn't cause issues in code gen. A concrete example will help. def foo(): X = { try return something() catch { case e: Throwable => println(e) throw e } unreachableCode() ] Here unreachableCode() is unreachable but GenICode would create ICode for it and then ASM would turn it into a pile of NOPS. A previous commit added a reachability analysis step to eliminate that unreachable code but that added a bit of time to the compilation process even when optimization was turned off. This commit avoids generating most unreachable ICode in the first place so that full reachability analysis is only needed after doing other optimization work. The new code works by extending a mechanism that was already in place. When GenICode encountered a THROW or RETURN it would put the current block into "ignore" mode so that no further instructions would be written into the block. However, that ignore mode flag was itself ignored when it came to figuring out if follow on blocks should be written. So this commit goes through places like try/catch and if/else and uses the ignore mode of the current block to decide whether to create follow on blocks, or if it already has, to kill by putting them into ignore mode and closing them where they'll be removed from the method's list of active blocks. It's not quite as good as full reachability analysis. In particular because a label def can be emitted before anything that jumps to it, this simple logic is forced to leave label defs alone and that means some of them may be unreachable without being removed. However, in practice it gets close the the benefit of reachability analysis at very nearly no cost.
* | Name boolean arguments in src/compiler.Jason Zaugg2013-03-051-6/+6
| | | | | | | | | | | | | | | | | | | | What would you prefer? adaptToMemberWithArgs(tree, qual, name, mode, false, false) Or: adaptToMemberWithArgs(tree, qual, name, mode, reportAmbiguous = false, saveErrors = false)
* | Merge pull request #2177 from JamesIry/master_SI-7159Grzegorz Kossakowski2013-02-281-18/+14
|\ \ | | | | | | SI-7159 Distinguish between assignability and subtyping in TypeKinds
| * | SI-7159 Distinguish between assignability and sub typing in TypeKindsJames Iry2013-02-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | TypeKinds said SHORT <:< INT. But that's not quite true on the JVM. You can assign SHORT to INT, but you can't assign an ARRAY[SHORT] to ARRAY[INT]. Since JVM arrays are covariant it's clear that assignability and subtyping are distinct on the JVM. This commit adds an isAssignable method and moves the rules about the int sized primitives there. ICodeCheckers, ICodeReader, and GenICode are all updated to use isAssignable instead of <:<.
| * | SI-7159 Remove erroneous INT <:< LONG in TypeKindsJames Iry2013-02-261-5/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | TypeKinds said INT <:< LONG. But that's not true on the JVM, you need a coercion to move up. And GenICode#adapt was checking for just that special case. This commit removes the INT <:< LONG rule and then removes the special case from GenICode#adapt.
| * | SI-7159 Prepare to remove erroneous INT <:< LONG in TypeKindsJames Iry2013-02-261-16/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In preparation for dealing with a problem in TypeKinds, this commit does some cleanup of code related to doing coercions. * Comments are added to clarify. * A println when converting between BOOL and anything else is removed and the code is allowed to flow through to an assertion. * Assertions are refactored to use string interpolation. * A few pattern matches were reformulated to equivalent variants In addition, a test is created for SI-107, the bug that necessitated the special case in GenICode#adapt for LONG coercion