summaryrefslogtreecommitdiff
path: root/test/files/run
Commit message (Collapse)AuthorAgeFilesLines
...
* | | SI-8601 Test that `null.synchronized` NPEs under -optimizeJason Zaugg2014-05-192-0/+9
| | | | | | | | | | | | As part of my sweep through the side-effecting byte code instructions.
* | | SI-8601 Don't treat newarray as dead codeJason Zaugg2014-05-191-0/+3
| | | | | | | | | | | | Otherwise we lose the side effect of a `NegativeArraySizeException`.
* | | Add a test for array loadJason Zaugg2014-05-191-1/+3
| | |
* | | SI-8601 Avoid over-eager optimization of LOAD_FIELDJason Zaugg2014-05-194-0/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It can NPE or trigger static class initilization, we can't elimiate it without changing semantics. To make sure we don't thwart closure elimination, I've allowed DCE to eliminate a non-static LOAD_FIELD of a member of a closure class. It would be more general to track nullity of the reciever (e.g, `this` or `new Foo` cannot be null), but that would require more infrastructure in this phase. I've added a test for closure inlining based on a a suggestion by @dragos. This actually passes if we remove the (LOAD_FIELD, DROP) peephole optimization for `closelim` altogether. But I chose to adapt that optimization (only allow it for non-static, closure fields), rather then remove it alogether, in the interests of treading lightly.
* | | SI-8601 Don't treat int/long division, or arraylength, as dead-codeJason Zaugg2014-05-194-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `{i, l}div` and `{i, l}rem` throw an `ArithmeticException` if the divisor is 0. `arraylength` throws a `NullPointerException` on a null reference. JVM Spec: > The only integer operations that can throw an exception are the > integer divide instructions (idiv and ldiv) and the integer > remainder instructions (irem and lrem), which throw an > ArithmeticException if the divisor is zero. > The Java virtual machine's floating-point operators do not throw > runtime exceptions > If the arrayref is null, the arraylength instruction throws a > NullPointerException. I checked the other primitives in `ICode` to see if anything else should be considered as live code. Pure: // jvm : {i, l, f, d}neg case class Negation(kind: TypeKind) extends Primitive // jvm : if{eq, ne, lt, ge, le, gt}, if{null, nonnull} // if_icmp{eq, ne, lt, ge, le, gt}, if_acmp{eq,ne} case class Test(op: TestOp, kind: TypeKind, zero: Boolean) extends Primitive // jvm : lcmp, {f, d}cmp{l, g} case class Comparison(op: ComparisonOp, kind: TypeKind) extends Primitive Impure: {i, l}{div, rem}, otherwise pure // jvm : {i, l, f, d}{add, sub, mul, div, rem} case class Arithmetic(op: ArithmeticOp, kind: TypeKind) extends Primitive Pure (overflow is silent, NaN.toInt is defined): // jvm : {i, l}{and, or, xor} case class Logical(op: LogicalOp, kind: TypeKind) extends Primitive // jvm : {i, l}{shl, ushl, shr} case class Shift(op: ShiftOp, kind: TypeKind) extends Primitive // jvm : i2{l, f, d}, l2{i, f, d}, f2{i, l, d}, d2{i, l, f}, i2{b, c, s} case class Conversion(src: TypeKind, dst: TypeKind) extends Primitive Impure! May NPE! // jvm : arraylength case class ArrayLength(kind: TypeKind) extends Primitive Pure (we know that StringBuilder.{<init>, append, toString} are pure and `append` is null safe.) // jvm : It should call the appropiate 'append' method on StringBuffer case class StringConcat(el: TypeKind) extends Primitive // jvm: it should create a new StringBuffer case object StartConcat extends Primitive // jvm: convert StringBuffer to a String case object EndConcat extends Primitive
* | | Revert "SI-8601 Don't treat int/long division, or arraylength, as dead-code"Adriaan Moors2014-05-194-26/+0
| | | | | | | | | | | | This reverts commit ee611cd76c29fedd416162e482c7ab3f15b831ca.
* | | Revert "SI-8601 Avoid over-eager optimization of LOAD_FIELD"Adriaan Moors2014-05-192-13/+0
| | | | | | | | | | | | This reverts commit 0b432f9cd22b6e9770852e5b331a15f0534a312c.
* | | Revert "Add a test for array load"Adriaan Moors2014-05-191-3/+1
| | | | | | | | | | | | This reverts commit 99b4ef8d8472f154d73160f5fe72daf081abb24e.
* | | Revert "SI-8601 Don't treat newarray as dead code"Adriaan Moors2014-05-191-3/+0
| | | | | | | | | | | | This reverts commit 70b912a87433c9589af33e4f8b33dca39abb66e5.
* | | Revert "SI-8601 Test that `null.synchronized` NPEs under -optimize"Adriaan Moors2014-05-192-9/+0
| | | | | | | | | | | | This reverts commit dcade51d751b389fb5137040f7e1006b4bc633c6.
* | | SI-8601 Test that `null.synchronized` NPEs under -optimizeJason Zaugg2014-05-182-0/+9
| | | | | | | | | | | | As part of my sweep through the side-effecting byte code instructions.
* | | SI-8601 Don't treat newarray as dead codeJason Zaugg2014-05-181-0/+3
| | | | | | | | | | | | Otherwise we lose the side effect of a `NegativeArraySizeException`.
* | | Add a test for array loadJason Zaugg2014-05-181-1/+3
| | |
* | | SI-8601 Avoid over-eager optimization of LOAD_FIELDJason Zaugg2014-05-182-0/+13
| | | | | | | | | | | | | | | It can NPE or trigger static class initilization, we can't elimiate it without changing semantics.
* | | SI-8601 Don't treat int/long division, or arraylength, as dead-codeJason Zaugg2014-05-184-0/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `{i, l}div` and `{i, l}rem` throw an `ArithmeticException` if the divisor is 0. `arraylength` throws a `NullPointerException` on a null reference. JVM Spec: > The only integer operations that can throw an exception are the > integer divide instructions (idiv and ldiv) and the integer > remainder instructions (irem and lrem), which throw an > ArithmeticException if the divisor is zero. > The Java virtual machine's floating-point operators do not throw > runtime exceptions > If the arrayref is null, the arraylength instruction throws a > NullPointerException. I checked the other primitives in `ICode` to see if anything else should be considered as live code. Pure: // jvm : {i, l, f, d}neg case class Negation(kind: TypeKind) extends Primitive // jvm : if{eq, ne, lt, ge, le, gt}, if{null, nonnull} // if_icmp{eq, ne, lt, ge, le, gt}, if_acmp{eq,ne} case class Test(op: TestOp, kind: TypeKind, zero: Boolean) extends Primitive // jvm : lcmp, {f, d}cmp{l, g} case class Comparison(op: ComparisonOp, kind: TypeKind) extends Primitive Impure: {i, l}{div, rem}, otherwise pure // jvm : {i, l, f, d}{add, sub, mul, div, rem} case class Arithmetic(op: ArithmeticOp, kind: TypeKind) extends Primitive Pure (overflow is silent, NaN.toInt is defined): // jvm : {i, l}{and, or, xor} case class Logical(op: LogicalOp, kind: TypeKind) extends Primitive // jvm : {i, l}{shl, ushl, shr} case class Shift(op: ShiftOp, kind: TypeKind) extends Primitive // jvm : i2{l, f, d}, l2{i, f, d}, f2{i, l, d}, d2{i, l, f}, i2{b, c, s} case class Conversion(src: TypeKind, dst: TypeKind) extends Primitive Impure! May NPE! // jvm : arraylength case class ArrayLength(kind: TypeKind) extends Primitive Pure (we know that StringBuilder.{<init>, append, toString} are pure and `append` is null safe.) // jvm : It should call the appropiate 'append' method on StringBuffer case class StringConcat(el: TypeKind) extends Primitive // jvm: it should create a new StringBuffer case object StartConcat extends Primitive // jvm: convert StringBuffer to a String case object EndConcat extends Primitive
* | | Merge pull request #3738 from retronym/ticket/8574Jason Zaugg2014-05-171-0/+27
|\ \ \ | |_|/ |/| | SI-8574 Copy @SerialVersionUID, etc, to specialized subclasses
| * | SI-8574 Copy @SerialVersionUID, etc, to specialized subclassesJason Zaugg2014-05-161-0/+27
| |/ | | | | | | | | | | | | | | | | | | | | | | The test case demonstrates that this is important for serialization and for strictfp. (Although the latter is still pretty broken, see SI-7954.) Now that the synthetic subclass of `Tuple2[Int, Int]` also has the `@deprecatedInheritance` annotation, I had to change the spot that issues this warning to be silent after the typer phase. Otherwise, we get two warnings in `run/t3888.scala`. This also remedies double warnings that were incurred in `neg/t6162-inheritance`.
* | Move t8582 to test/files/jvmLukas Rytz2014-05-132-125/+0
| |
* | SI-8582 emit InnerClasses attribute in GenBCodeLukas Rytz2014-05-132-5/+112
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I removed the `-bcode` test since we have a build that passes `-Ybackend:GenBCode` to all tests. Short intro do the [`InnerClass` attribute][1]: - A class needs one `InnerClass` attribute for each of its nested classes - A class needs the `InnerClass` attribute for all (nested) classes that are mentioned in its constant pool The attribute for a nested class `A$B$C` consists of the long name of the outer class `A$B`, the short name of the inner class `C`, and an access flag set describig the visibility. The attribute seems to be used for reflection. [1]: http://docs.oracle.com/javase/specs/jvms/se7/html/jvms-4.html#jvms-4.7.6
* | SI-8582 Pending test for InnerClasses bug in GenBCodeJason Zaugg2014-05-122-0/+18
| | | | | | | | | | As seen in a runtime reflection failure in Slick during a GenBCode enabled run of our beloved Community Build.
* | SI-8576 Temporarily disable part of serialization testJason Zaugg2014-05-101-23/+34
|/ | | | | | | | | | | | | | | | | Parts of this test fail if testing a library built with -Xcheckinit. The failures seem to be in two categories: - A component of the serialized structure does not have a declared SerialVersionUID, meaning that the extra field added to track initialization results in a different ID. This manifests as a `java.io.InvalidClassException` when deserializing the blobs of data saved in the test case. - Spurious `UnitializedFieldErrors` when calling methods on the object that has been serialized and then deserialized. Until we figure out the right course of action (more @SerialVersionUID annotations / weaker tests / ...), this commit disabled those tests.
* Merge pull request #3730 from lrytz/checkinitJason Zaugg2014-05-099-3/+33
|\ | | | | Fix checkinit build
| * Disable run/t7974 under checkinitLukas Rytz2014-05-092-1/+2
| |
| * SI-8570 set the checkinit bit for unit-typed fields of traitsLukas Rytz2014-05-095-0/+27
| | | | | | | | Fix only, refactoring in subsequent commit.
| * Fix run/t5256h.scala under checkinitLukas Rytz2014-05-081-1/+2
| |
| * Fix run/t3569.scala under checkinitLukas Rytz2014-05-081-1/+2
| |
* | Merge origin/master into topic/master-to-2.11.x-2Jason Zaugg2014-05-094-0/+46
|\ \
| * | Revert "SI-5905 Clarify test case"Jason Zaugg2014-05-092-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 78bd175afcc89878ca1c00cce69d0517909c6ff3. See discussion: https://github.com/scala/scala/pull/3597#commitcomment-6270375
| * | Merge pull request #3597 from som-snytt/issue/5905-feature-helpJason Zaugg2014-05-093-0/+47
| |\ \ | | | | | | | | SI-5905 Sanity check -language options
| | * | SI-5905 Clarify test caseSom Snytt2014-05-082-4/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The language feature options are discovered reflectively, but it is nice to enforce that expected options are supplied. Short of that, the code string includes a rowdy postfix operator. It still does enforce that at least one option was discovered. Delete -nowarn flags file. Let's see if that was to suppress a warning in the standard build.
| | * | SI-5905 Restore -language:_Som Snytt2014-03-021-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Underscore means all. -x:c,b,a,_ results in value c,b,a,a,b,c,d,... Currently, -Xprint does not present phases as a closed set of choices; there is ad hoc checking in Global. That would be a nice unification. (You don't know the list of choices until after global is constructed.)
| | * | SI-5905 Sanity check -language optionsSom Snytt2014-02-284-0/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The option names are hardcoded, but checked by a test. There are no hooks to verify options after the compiler is constructed. Introduced a `MultiChoiceSetting` required for the setting creation framework.
* | | | Merge commit 'b5392a0' into merge/master-to-2.11.xJason Zaugg2014-05-095-0/+203
|\| | |
| * | | SI-6988 Test case for non-literal / non-constant SerialVersionUIDJason Zaugg2014-05-052-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The `neg` test was already working since `SerialVersionUID` was changed to a `ClassFileAnnotation`; the `run` test only started working since the recently preceding commit that made a compensatory test in the backend.
| * | | SI-8549 Enforce serialization stability for selected collectionsJason Zaugg2014-05-052-0/+176
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To date, we've been hesidant to offer any guarantees about Java serialization of standard library types among heteregenous Scala versions. Nonetheless, we have added `SerialVersionUID` annotations to parts of the standard library, to offer some stability. This protects against two winds of change: automatic calculation of this UID might differ between JVM versions, or it might differ due to otherwise immaterial changes to the library in Scala releases. With this commit, we strengthen the guarantees. Classes marked with `SerialVersionUID` will be serialization compatible within minor releases of Scala. This is backed up by the enclosed test. After major releases, we reserve the right to break this. But the test will serve to avoid *accidental* changes. Specifically, the test case checks: - deserialize(serialize(x)) == x - serialize(x) is stable over time I have included values of all types marked with `@SerialVersionUID` in the library. For some types, I've added variations in the values to exercise different subclasses, such as `Set1` / `Set2`. This found that that the serialized form of predefined `ClassTags` included the cached identity hash code and failed the stability test. This wasn't an issue for correctness as they also provide `readResolve`, but I marked those fields as `@transient` in any case to comply with the test expectations. That whole area is good example of a serialization worst-practice: using anonymous classes in code like: val Object: Manifest[java.lang.Object] = new PhantomManifest[...](...) { private def readResolve(): Any = Manifest.AnyVal } ... will lead to instability if these declarations are shifted around in the file. Named classes would be preferred. I've noted this in a TODO comment for 2.12.
| * | | SI-8549 Honour the @SerialVersionUID annotatationJason Zaugg2014-05-051-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In PR #1673 / 4267444, the annotation `SerialVersionId` was changed from a `StaticAnnotation` to `ClassFileAnnotation` in order to avoid silently ignoring non-literal UIDs like: @SerialVersionUID(0 - 12345L) class C And to flag non-constant UIDs: @SerialVersionUID("!!!".length) While this indeed was fold constants, the change was incomplete. The compiler API for reading the argument from a `ClassFileAnnoation` is different, on must look for a `LiteralAnnotArg`, rather than a `Literal`. This commit: - amends the backend accordingly - removes relevant duplication between `GenASM` and `GenBCode` - tests that the static field is generated accordingly This will mean that we will break deserialization of objects from Scalal 2.11.0 that use this annotation.
* | | | Merge pull request #3721 from lrytz/t7852Jason Zaugg2014-05-081-1/+1
|\ \ \ \ | | | | | | | | | | SI-7852 for GenBCode
| * | | | SI-7852 for GenBCodeLukas Rytz2014-05-071-1/+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.
* | | | Merge commit 'ec05aeb' into topic/merge-2.10.xJason Zaugg2014-05-085-0/+42
|\ \ \ \
| * \ \ \ Merge pull request #3655 from retronym/ticket/8442Grzegorz Kossakowski2014-03-265-0/+42
| |\ \ \ \ | | | | | | | | | | | | SI-8442 Ignore stub annotation symbols in `AnnotationInfo#matches`
| | * | | | SI-8442 Ignore stub annotation symbols in `AnnotationInfo#matches`Jason Zaugg2014-03-255-0/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | And update the java `ClassFileParser` to create distinguished `StubClassSymbol`s, rather that a regular `ClassSymbol`s, when encountering a deficient classpath. This brings it into line with `Unpickler`, which has done as much since a55788e275f. This stops the enclosed test case from crashing when determining if the absent symbol, `A_1`, is a subclass of `@deprecated`. This is ostensibly fixes a regression, although it only worked in `2.10.[0-3]` by a fluke: the class file parser's promiscious exception handling caught and recovered from the NPE introduced in SI-7439! % javac -d /tmp test/files/run/t8442/{A,B}_1.java && qbin/scalac -classpath /tmp -d /tmp test/files/run/t8442/C_2.scala && (rm /tmp/A_1.class; true) && scalac-hash v2.10.0 -classpath /tmp -d /tmp test/files/run/t8442/C_2.scala warning: Class A_1 not found - continuing with a stub. warning: Caught: java.lang.NullPointerException while parsing annotations in /tmp/B_1.class two warnings found
| * | | | | Merge pull request #3551 from xeno-by/topic/typecheck-member-defJason Zaugg2014-03-253-0/+32
| |\ \ \ \ \ | | | | | | | | | | | | | | [nomaster] backports 609047ba37
| | * | | | | [nomaster] typecheck(q"class C") no longer crashesEugene Burmako2014-03-233-0/+32
| | |/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MemberDefs alone can't be typechecked as is, because namer only names contents of PackageDefs, Templates and Blocks. And, if not named, a tree can't be typed. This commit solves this problem by wrapping typecheckees in a trivial block and then unwrapping the result when it returns back from the typechecker. (cherry picked from commit 609047ba372ceaf06916d3361954bc949a6906ee)
* | | | | / Merge commit '876590b' into topic/merge-2.10.xJason Zaugg2014-05-082-0/+58
|\| | | | | | |_|_|_|/ |/| | | | | | | | | | | | | | | | | | | Conflicts: bincompat-forward.whitelist.conf src/reflect/scala/reflect/runtime/JavaMirrors.scala
| * | | | Merge pull request #3614 from retronym/ticket/8196Jason Zaugg2014-03-252-0/+54
| |\ \ \ \ | | | | | | | | | | | | SI-8196 Runtime reflection robustness for STATIC impl details
| | * | | | SI-8195 Test case to show this is a dup of SI-8196Jason Zaugg2014-03-111-2/+23
| | | | | | | | | | | | | | | | | | | | | | | | Which was fixed in the previous commit.
| | * | | | SI-8196 Runtime reflection robustness for STATIC impl detailsJason Zaugg2014-03-112-0/+33
| | |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Scala's runtime reflection works in few modes. The primary mode reads reads out the pickled signatures from ScalaSig annotations, if avaialable. However, these aren't available for Java-defined classes (obviously) nor for local Scala-defined classes (less obviously.), and the Scala `Symbol`s and `Types` must be reconstructed from the Java generic reflection metadata. This bug occurs in the last case, and is centered in `FromJavaClassCompleter`. In that completer, member fields and methods are given an owner based on the STATIC modifier. That makes sense for Java defined classes. I'm not 100% if it makes sense for Scala defined classes; maybe we should just skip them entirely? This patch still includes them, but makes the ownership-assignment more robust in the face of STATIC members emitted by the Scala compiler backend, such as the cache fields for structural calls. (It's reflection all the way down!). We might not have a companion module at all, so before we ended up owning those by `NoSymbol`, and before too long hit the dreaded NSDHNAO crash. That crash doesn't exist any more on 2.11 (it is demoted to a -Xdev warning), but this patch still makes sense on that branch. This commit makes `followStatic` and `enter` more robust when finding a suitable owner for static members. I've also factored out the duplicated logic between the two.
| * / / / [backport] no longer warns on calls to vampire macrosEugene Burmako2014-03-054-0/+61
| |/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As eloquently elaborated and cleverly named by Travis Brown, macros defined in structural types are useful: http://meta.plasm.us/posts/2013/07/12/vampire-methods-for-structural-types/. However, since such macros are on the intersection of a number of language features, as usual, there are bugs. This commit fixes an unwanted interaction of macros defined in structural types with the scala.language.reflectiveCalls guard. Since macro calls aren't going to be carried to runtime, there's no need to warn about them.
| * | | [nomaster] SI-8114 Binary compat. workaround for erasure bug SI-7120Jason Zaugg2014-01-091-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We can't backport SI-7120 to 2.10.x as it changes erased signatures, which can lead to interop problems between 2.10.3 and 2.10.4. But, we can detect one of the nasty symptoms -- a bridge method with the same signature as its target -- and treat that. This commit detects duplicate bridges in the ASM (only) backend and removes them.
* | | | Respect -Dpartest.scalac_opts when running the test suite through ANTLukas Rytz2014-05-0710-1/+11
| |/ / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Used to enable `-Xcheckinit` (now also `-Ybackend:GenBCode`) when compiling tests in the respective jenkins builds. This is currently broken, as you can see in [recent build logs] [1], `-Xcheckinit` is missing: [partest] Scalac options are: -optimise Adds `.flags` files for macro tests (correct range positions not enforced) and for tests failing due to SI-8560 or SI-8562. [1]: https://scala-webapps.epfl.ch/jenkins/view/nightlies/job/scala-nightly-checkinit/2058/consoleFull