summaryrefslogtreecommitdiff
path: root/test
Commit message (Collapse)AuthorAgeFilesLines
* SI-9373 Restore the test for t8960 with IndyLamba enabledLukas Rytz2015-07-032-72/+78
|
* SI-9377 Update ScalaVersion error textSom Snytt2015-07-022-1/+5
| | | | Simplify and sweeten the message.
* SI-9377 ScalaVersion init no longer fails if versionlessSom Snytt2015-07-021-0/+5
| | | | | | If the version string was empty, ScalaVersion would indignantly refuse to initialize. Now it takes a missing property as "none".
* Fix superclass for Java interface symbols created in JavaMirrorsLukas Rytz2015-07-0215-0/+0
| | | | | | | | | | According to the spec [1] the superclass of an interface is always Object. Restores the tests that were moved to pending in bf951ec1, fixex part of SI-9374. [1] https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html#jvms-4.1
* Fix some tests, move others to pending/Lukas Rytz2015-07-0141-323/+94
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Move run/t8960 to pending It tests the serialVersionUID field on closure classes. The field doesn't exist for indyLambda closures. See https://issues.scala-lang.org/browse/SI-9373 Move some reify tests to pending They fail at runtime in GenBCode since scala is built with indyLambda enabled: java.lang.AssertionError: assertion failed: Bad superClass for trait JFunction1: class Any at scala.tools.nsc.Global.assert(Global.scala:261) at scala.tools.nsc.backend.jvm.BTypesFromSymbols.setClassInfo(BTypesFromSymbols.scala:228) Noted in https://issues.scala-lang.org/browse/SI-9374 force t6546 to GenASM - no closure elimination in GenBCode yet Noted in https://issues.scala-lang.org/browse/SI-9364. Fix or disable some tests that fail because of the old optimizer The old inliner fails more often when the library is built with indylambda. Noted in https://issues.scala-lang.org/browse/SI-9374. Example: List.foreach ➜ sandbox git:(jfun) ✗ qs -Ybackend:GenASM -optimize -Yinline-warnings Welcome to Scala version 2.12.0-20150630-220939-1cb032d806 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_45). Type in expressions to have them evaluated. Type :help for more information. scala> List(1,2,3).foreach(x => x + 1) <console>:11: warning: Could not inline required method foreach because bytecode unavailable. List(1,2,3).foreach(x => x + 1) ^ <console>:11: warning: At the end of the day, could not inline @inline-marked method foreach List(1,2,3).foreach(x => x + 1) ^ Upate a number of tests for having indyLambda enabled The delambdafyLambdaClassNames tests was removed, there's nothing to tests with indyLambda.
* Include sources for scala-java8-compat instead of jarLukas Rytz2015-07-011-0/+193
| | | | | | | | | | | | | This reverts commit e1895d64f87dc3c699a3ccbc8a3143b18d3b5bb1, titled "Add scala-java8-compat to scala-library.jar". Move SAM functions and `LambdaDeserializer` (from scala/scala-java8-compat@9253ed9) into `scala.runtime.java8` package under `src/library`. (The package name is the only diff -- they were in `scala.compat.java8` before). The original LambdaDeserializer: https://github.com/scala/scala-java8-compat/blob/c0732e6/src/main/java/scala/compat/java8/runtime/LambdaDeserializer.scala
* Java parser: default methods in interfaces are not `DEFERRED`Lukas Rytz2015-07-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Java parser should not set the `DEFERRED` flag for default methods or static methods in interfaces. Their bytecode doesn't have it either. Also tightens parsing of Java abstract methods to disallow a method body. Here's the log of how Lukas diagnosed this: ``` quick.bin: ... BUILD FAILED /Users/luc/scala/scala/build.xml:69: The following error occurred while executing this line: ... /Users/luc/scala/scala/build-ant-macros.xml:350: Could not create type mk-bin due to java.lang.BootstrapMethodError: call site initialization exception at java.lang.invoke.CallSite.makeSite(CallSite.java:341) at java.lang.invoke.MethodHandleNatives.linkCallSiteImpl(MethodHandleNatives.java:307) at java.lang.invoke.MethodHandleNatives.linkCallSite(MethodHandleNatives.java:297) at scala.sys.BooleanProp$.keyExists(BooleanProp.scala:72) at scala.sys.SystemProperties$.bool(SystemProperties.scala:78) at scala.sys.SystemProperties$.noTraceSupression$lzycompute(SystemProperties.scala:89) at scala.sys.SystemProperties$.noTraceSupression(SystemProperties.scala:89) at scala.util.control.NoStackTrace$.<init>(NoStackTrace.scala:31) at scala.util.control.NoStackTrace$.<clinit>(NoStackTrace.scala) at scala.util.control.NoStackTrace$class.fillInStackTrace(NoStackTrace.scala:22) at scala.util.control.BreakControl.fillInStackTrace(Breaks.scala:94) at java.lang.Throwable.<init>(Throwable.java:250) at scala.util.control.BreakControl.<init>(Breaks.scala:94) at scala.util.control.Breaks.<init>(Breaks.scala:29) at scala.collection.Traversable$.<init>(Traversable.scala:95) at scala.collection.Traversable$.<clinit>(Traversable.scala) at scala.package$.<init>(package.scala:40) at scala.package$.<clinit>(package.scala) at scala.Predef$.<init>(Predef.scala:89) at scala.Predef$.<clinit>(Predef.scala) at scala.tools.ant.ScalaTool.<init>(ScalaTool.scala:58) [...] Caused by: java.lang.invoke.LambdaConversionException: Incorrect number of parameters for static method invokeStatic scala.sys.BooleanProp$.scala$sys$BooleanProp$$$anonfun$2$adapted:(String)Object; 0 captured parameters, 0 functional interface method parameters, 1 implementation parameters at java.lang.invoke.AbstractValidatingLambdaMetafactory.validateMetafactoryArgs(AbstractValidatingLambdaMetafactory.java:193) at java.lang.invoke.LambdaMetafactory.altMetafactory(LambdaMetafactory.java:473) at java.lang.invoke.CallSite.makeSite(CallSite.java:325) ``` [source code](https://github.com/scala/scala/blob/2.11.x/src/library/scala/sys/BooleanProp.scala#L72): ``` s => s == "" || s.equalsIgnoreCase("true") ``` bytecode: ``` INVOKEDYNAMIC $init$()Lscala/compat/java8/JFunction1; [ // handle kind 0x6 : INVOKESTATIC java/lang/invoke/LambdaMetafactory.altMetafactory(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;[Ljava/lang/Object;)Ljava/lang/invoke/CallSite; // arguments: ()V, // handle kind 0x6 : INVOKESTATIC scala/sys/BooleanProp$.scala$sys$BooleanProp$$$anonfun$2$adapted(Ljava/lang/String;)Ljava/lang/Object;, (Ljava/lang/String;)Ljava/lang/Object;, 3, 1, Lscala/Serializable;.class, 0 ] CHECKCAST scala/Function1 ``` The mistake seems to be that the Scala compiler incorrectly selects `$init$` ([which is a default method](https://github.com/scala/scala/blob/640ffe7fceb5d573b2c12a7c7da09bfd751036a0/src/library/scala/compat/java8/JFunction1.java#L10)) as the abstract method of `JFunction1`, whereas it should be `apply` (inherited from `Function1`). Since we're doing mixed compilation, this is almost certainly a problem of the Java parser.
* Merge pull request #4585 from ruippeixotog/fix-mutable-treemap-clearSeth Tisue2015-06-301-2/+2
|\ | | | | Fix size update on `mutable.TreeMap#clear()`
| * Fix size update on `mutable.TreeMap#clear()`Rui Gonçalves2015-06-261-2/+2
| | | | | | | | | | | | The previous implementation has a major bug - although `clear()` sets the root node to `null`, the `size` attribute of the `Tree` was not updated. This effectively meant that even after a `map.clear()`, a call to `map.size` would still yield the old size of the map. The scalacheck test suite was updated to contemplate this issue.
* | Merge commit 'bb102e7' into merge-2.11-to-2.12-june-26Lukas Rytz2015-06-264-13/+263
|\ \ | |/ |/|
| * Merge pull request #4577 from janekdb/2.11.x-typos-j-lSeth Tisue2015-06-241-1/+1
| |\ | | | | | | Fix 8 typos (j-l)
| | * Fix 8 typos (j-l)Janek Bogucki2015-06-231-1/+1
| | |
| * | Merge pull request #4552 from lrytz/opt/closureInliningJason Zaugg2015-06-243-12/+262
| |\ \ | | |/ | |/| Closure elimination for new backend
| | * Producers / Consumers AnalysisLukas Rytz2015-06-223-12/+262
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ASM has a built-in `SourceValue` analysis which computes for each value a set of instructions that may possibly have constructed it. The ProdConsAnalyzer class provides additional queries over the result of the SourceValue analysis: - consumers of values - tracking producers / consumers through copying operations (load, store, etc) A fix to (and therefore a new version of) ASM was required. See here: https://github.com/scala/scala-asm/commit/94106a5472
* | | SI-6613 fixed in GenBCodeLukas Rytz2015-06-264-0/+0
| | | | | | | | | | | | It was fixed in GenASM in 44807a7852.
* | | Default to delambdafy:method and backend:GenBCodeLukas Rytz2015-06-2624-198/+145
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Switch the defaults of `-Ydelambdafy` and `-Ybackend`. Rewrite t6288b-jump-position test - no more icode Don't crash GenBCode beyond JVM code size limits A similar patch is in GenASM, see 3fa2c97 Fix check files for GenBCode / delambdafy:method defaults Force copy propagation test to ASM, see SI-9364 Force inline-ex-handlers test to GenASM, see SI-9364 Move t6613 test to pending - still broken in GenBCode Adding a `flags` file with `-Ybackend:GenASM` doesn't seem to have the desired effect. SI-6613 is re-opened. Force a few tests to GenASM, see SI-9364
* | | Merge pull request #4460 from som-snytt/topic/javap-decomJason Zaugg2015-06-269-107/+3
|\ \ \ | | | | | | | | SI-9277 Downgrade marginal javap features
| * | | SI-9277 Downgrade marginal javap featuresSom Snytt2015-06-259-107/+3
| | | | | | | | | | | | | | | | Drop Java 6 support, -fun, -app, and -raw options.
* | | | Merge pull request #4504 from ruippeixotog/mutable-treemapAdriaan Moors2015-06-253-3/+337
|\ \ \ \ | | | | | | | | | | SI-4147 Add an implementation of `mutable.TreeMap`
| * | | | SI-4147 Add an implementation of `mutable.TreeMap`Rui Gonçalves2015-05-303-3/+337
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit contains an implementation of a mutable red-black tree with focus on performance. It also contains a new `mutable.TreeMap` Scala collection that is backed by the aforementioned tree. The common generic factories and traits related to mutable sorted maps didn't exist yet, so this commit also adds them. Regarding performance, `TreeMap` overrides (from `MapLike` and `SortedMapLike`) all of the most common methods for maps and also those whose default implementations are asymptotically worse than direct red-black tree algorithms (e.g. `last`, `clear`). The `rangeImpl` method of `TreeMap` returns an instance of `TreeMapView`, an inner class of `TreeMap`. This view is backed by the same `RedBlackTree.Tree` instance, and therefore changes to the original map are reflected in the view and vice-versa. The semantics of mutating a view by adding and removing keys outside the view's range are the same of the current `mutable.TreeSet`. A bit less focus was given on the performance of views - in particular, getting the `size` of a `TreeMapView` is O(n) on the number of elements inside the view bounds. That can be improved in the future. In a future commit, `mutable.TreeSet` can be changed to be backed by this red-black tree implementation.
* | | | | Merge pull request #4514 from martijnhoekstra/patch-2Adriaan Moors2015-06-251-0/+6
|\ \ \ \ \ | |_|/ / / |/| | | | Documentation for split [ci: last-only]
| * | | | StringLike.split fixed for surrogates and docmartijnhoekstra2015-05-281-0/+6
| |/ / / | | | | | | | | | | | | | | | | | | | | Reverts to calling String.split(re: String), but change escape to always put us on the JDK7 fast-path if possible, which is for everything but Chars representing surrogate codeunits
* | | | Merge branch '2.11.x' into merge/2.11.x-to-2.12.x-20150624Jason Zaugg2015-06-24129-350/+1248
|\ \ \ \ | |/ / / |/| / / | |/ /
| * | Merge pull request #4574 from janekdb/2.11.x-typos-g-iJason Zaugg2015-06-2315-15/+15
| |\ \ | | | | | | | | Fix 25 typos (g-i)
| | * | Fix 25 typos (g-i)Janek Bogucki2015-06-2215-15/+15
| | |/
| * | Merge pull request #4564 from som-snytt/issue/promptv2.11.7Adriaan Moors2015-06-2222-167/+206
| |\ \ | | | | | | | | SI-9206 Fix REPL code indentation
| | * | SI-9206 Accept paste with custom promptSom Snytt2015-06-211-0/+13
| | | | | | | | | | | | | | | | But sans test.
| | * | SI-9206 Fix REPL code indentationSom Snytt2015-06-1922-167/+193
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To make code in error messages line up with the original line of code, templated code is indented by the width of the prompt. Use the raw prompt (without ANSI escapes or newlines) to determine the indentation. Also, indent only once per line.
| * | | Merge pull request #4566 from lrytz/t9359Adriaan Moors2015-06-228-10/+90
| |\ \ \ | | |_|/ | |/| | SI-9359 Fix InnerClass entry flags for nested Java enums
| | * | Fix spurious test failure under -Ybackend:GenBCodeLukas Rytz2015-06-204-10/+6
| | | |
| | * | SI-9359 Fix InnerClass entry flags for nested Java enumsLukas Rytz2015-06-194-0/+84
| | |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The access flags in InnerClass entries for nested Java enums were basically completely off. A first step is to use the recently introduced backend method `javaClassfileFlags`, which is now moved to BCodeAsmCommon. See its doc for an explanation. Then the flags of the enum class symbol were off. An enum is - final if none of its values has a class body - abstract if it has an abstract method (https://docs.oracle.com/javase/specs/jls/se7/html/jls-8.html#jls-8.9) When using the ClassfileParser: - ENUM was never added. I guess that's just an oversight. - ABSTRACT (together with SEALED) was always added. This is to enable exhaustiveness checking, see 3f7b8b5. This is a hack and we have to go through the class members in the backend to find out if the enum actually has the `ACC_ABSTRACT` flag or not. When using the JavaParser: - FINAL was never added. - ABSTRACT was never added. This commit fixes all of the above and tests cases (Java enum read from the classfile and from source).
| * / Fix 36 typos (d-f)Janek Bogucki2015-06-2117-18/+18
| |/
| * Merge pull request #4559 from janekdb/2.11.x-scaladoc-2Seth Tisue2015-06-1814-16/+16
| |\ | | | | | | Fix some typos (a-c)
| | * Fix another several typosMichał Pociecha2015-06-185-5/+5
| | | | | | | | | | | | | | | | | | I just used text search to check whether there are no more typos like these corrected by janekdb, and by the way fixed also some other ones which I saw.
| | * Fix some typos (a-c)Janek Bogucki2015-06-189-11/+11
| | |
| * | Merge pull request #4529 from lrytz/inlineAccessibilityJason Zaugg2015-06-194-7/+19
| |\ \ | | |/ | |/| Fix illegal inlining of instructions accessing protected members
| | * Fix illegal inlining of instructions accessing protected membersLukas Rytz2015-05-284-7/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There were two issues in the new inliner that would cause a VerifyError and an IllegalAccessError. First, an access to a public member of package protected class C can only be inlined if the destination class can access C. This is tested by t7582b. Second, an access to a protected member requires the receiver object to be a subtype of the class where the instruction is located. So when inlining such an access, we need to know the type of the receiver object - which we don't have. Therefore we don't inline in this case for now. This can be fixed once we have a type propagation analyis. https://github.com/scala-opt/scala/issues/13. This case is tested by t2106. Force kmpSliceSearch test to delambdafy:inline See discussion on https://github.com/scala/scala/pull/4505. The issue will go away when moving to indy-lambda.
| * | Merge pull request #4527 from nicky-zs/fix_BigDecimalLukas Rytz2015-06-181-0/+32
| |\ \ | | | | | | | | fix BigDecimal losing MathContext
| | * | make BigDecimalTest.testMathContext a bit easier to understandZhong Sheng2015-06-181-13/+14
| | | |
| | * | add more test for testMathContextZhong Sheng2015-05-291-2/+26
| | | |
| | * | add unit test for MathContext lostZhong Sheng2015-05-281-0/+7
| | | |
| * | | Merge pull request #4560 from adriaanm/t9356Adriaan Moors2015-06-173-0/+21
| |\ \ \ | | | | | | | | | | SI-9356 more careful assertion in back-end
| | * | | SI-9356 more careful assertion in back-endAdriaan Moors2015-06-163-0/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Calling `exists` on a `Symbol` triggers unpickling, which failed for reasons I did not investigate. Replaced `sym.exists` by `sym != NoSymbol`, which is good enough here. Also replaced assertion by a `devWarning`, since the logic seems too ad-hoc to actually crash the compiler when it's invalidated. Partially reverts b45a91fe22. See also #1532.
| * | | | Merge pull request #4541 from vuakko/SI-9348_2.11.xAdriaan Moors2015-06-173-8/+49
| |\ \ \ \ | | | | | | | | | | | | SI-9348 Fix missing last element in exclusive floating point ranges
| | * | | | SI-9348 Fix missing last element in exclusive floating point rangesNiko Vuokko2015-06-173-8/+49
| | |/ / / | | | | | | | | | | | | | | | | | | | | Fix exclusive floating point ranges to contain also the last element when the end-start difference is not an integer multiple of step.
| * | | | Merge pull request #4545 from retronym/topic/constr-varargs-toolboxAdriaan Moors2015-06-172-0/+21
| |\ \ \ \ | | |/ / / | |/| | | Fix toolbox with varargs constructors
| | * | | SI-9212 Fix toolbox with varargs constructorsJason Zaugg2015-06-092-0/+21
| | | | | | | | | | | | | | | | | | | | It was already working for methods, but not for constructors.
| * | | | Merge pull request #4534 from Ichoran/sorting-reimplAdriaan Moors2015-06-161-0/+69
| |\ \ \ \ | | | | | | | | | | | | Clean implementation of sorts for scala.util.Sorting.
| | * | | | Clean implementation of sorts for scala.util.Sorting.Rex Kerr2015-06-011-0/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Removed code based on Sun JDK sorts and implemented new (basic) sorts from scratch. Deferred to Java Arrays.sort whenever practical. Behavior of `scala.util.Sorting` should be unchanged, but changed documentation to specify when the Java methods are being used (as they're typically very fast). A JUnit test is provided. Performance is important for sorts. Everything is better with this patch, though it could be better yet, as described below. Below are sort times (in microseconds, SEM < 5%) for various 1024-element arrays of small case classes that compare on an int field (quickSort), or int arrays that use custom ordering (stableSort). Note: "degenerate" means there are only 16 values possible, so there are lots of ties. Times are all with fresh data (no re-using cache from run to run). Results: ``` random sorted reverse degenerate big:64k tiny:16 Old Sorting.quickSort 234 181 178 103 25,700 1.4 New Sorting.quickSort 170 27 115 74 18,600 0.8 Old Sorting.stableSort 321 234 236 282 32,600 2.1 New Sorting.stableSort 239 16 194 194 25,100 1.2 java.util.Arrays.sort 124 4 8 105 13,500 0.8 java.util.Arrays.sort|Box 126 15 13 112 13,200 0.9 ``` The new versions are uniformly faster, but uniformly slower than Java sorting. scala.util.Sorting has use cases that don't map easily in to Java unless everything is pre-boxed, but the overhead of pre-boxing is minimal compared to the sort. A snapshot of some of my benchmarking code is below. (Yes, lots of repeating myself--it's dangerous not to when trying to get somewhat accurate benchmarks.) ``` import java.util.Arrays import java.util.Comparator import math.Ordering import util.Sorting import reflect.ClassTag val th = ichi.bench.Thyme.warmed() case class N(i: Int, j: Int) {} val a = Array.fill(1024)( Array.tabulate(1024)(i => N(util.Random.nextInt, i)) ) var ai = 0 val b = Array.fill(1024)( Array.tabulate(1024)(i => N(i, i)) ) var bi = 0 val c = Array.fill(1024)( Array.tabulate(1024)(i => N(1024-i, i)) ) var ci = 0 val d = Array.fill(1024)( Array.tabulate(1024)(i => N(util.Random.nextInt(16), i)) ) var di = 0 val e = Array.fill(16)( Array.tabulate(65536)(i => N(util.Random.nextInt, i)) ) var ei = 0 val f = Array.fill(65535)( Array.tabulate(16)(i => N(util.Random.nextInt, i)) ) var fi = 0 val o = new Ordering[N]{ def compare(a: N, b: N) = if (a.i < b.i) -1 else if (a.i > b.i) 1 else 0 } for (s <- Seq("one", "two", "three")) { println(s) th.pbench{ val x = a(ai).clone; ai = (ai+1)%a.length; Sorting.quickSort(x)(o); x(x.length/3) } th.pbench{ val x = b(bi).clone; bi = (bi+1)%b.length; Sorting.quickSort(x)(o); x(x.length/3) } th.pbench{ val x = c(ci).clone; ci = (ci+1)%c.length; Sorting.quickSort(x)(o); x(x.length/3) } th.pbench{ val x = d(di).clone; di = (di+1)%d.length; Sorting.quickSort(x)(o); x(x.length/3) } th.pbench{ val x = e(ei).clone; ei = (ei+1)%e.length; Sorting.quickSort(x)(o); x(x.length/3) } th.pbench{ val x = f(fi).clone; fi = (fi+1)%f.length; Sorting.quickSort(x)(o); x(x.length/3) } } def ix(ns: Array[N]) = { val is = new Array[Int](ns.length) var i = 0 while (i < ns.length) { is(i) = ns(i).i i += 1 } is } val p = new Ordering[Int]{ def compare(a: Int, b: Int) = if (a > b) 1 else if (a < b) -1 else 0 } for (s <- Seq("one", "two", "three")) { println(s) val tag: ClassTag[Int] = implicitly[ClassTag[Int]] th.pbench{ val x = ix(a(ai)); ai = (ai+1)%a.length; Sorting.stableSort(x)(tag, p); x(x.length/3) } th.pbench{ val x = ix(b(bi)); bi = (bi+1)%b.length; Sorting.stableSort(x)(tag, p); x(x.length/3) } th.pbench{ val x = ix(c(ci)); ci = (ci+1)%c.length; Sorting.stableSort(x)(tag, p); x(x.length/3) } th.pbench{ val x = ix(d(di)); di = (di+1)%d.length; Sorting.stableSort(x)(tag, p); x(x.length/3) } th.pbench{ val x = ix(e(ei)); ei = (ei+1)%e.length; Sorting.stableSort(x)(tag, p); x(x.length/3) } th.pbench{ val x = ix(f(fi)); fi = (fi+1)%f.length; Sorting.stableSort(x)(tag, p); x(x.length/3) } } for (s <- Seq("one", "two", "three")) { println(s) th.pbench{ val x = a(ai).clone; ai = (ai+1)%a.length; Arrays.sort(x, o); x(x.length/3) } th.pbench{ val x = b(bi).clone; bi = (bi+1)%b.length; Arrays.sort(x, o); x(x.length/3) } th.pbench{ val x = c(ci).clone; ci = (ci+1)%c.length; Arrays.sort(x, o); x(x.length/3) } th.pbench{ val x = d(di).clone; di = (di+1)%d.length; Arrays.sort(x, o); x(x.length/3) } th.pbench{ val x = e(ei).clone; ei = (ei+1)%e.length; Arrays.sort(x, o); x(x.length/3) } th.pbench{ val x = f(fi).clone; fi = (fi+1)%f.length; Arrays.sort(x, o); x(x.length/3) } } def bx(is: Array[Int]): Array[java.lang.Integer] = { val Is = new Array[java.lang.Integer](is.length) var i = 0 while (i < is.length) { Is(i) = java.lang.Integer.valueOf(is(i)) i += 1 } Is } def xb(Is: Array[java.lang.Integer]): Array[Int] = { val is = new Array[Int](Is.length) var i = 0 while (i < is.length) { is(i) = Is(i).intValue i += 1 } is } val q = new Comparator[java.lang.Integer]{ def compare(a: java.lang.Integer, b: java.lang.Integer) = o.compare(a.intValue, b.intValue) } for (s <- Seq("one", "two", "three")) { println(s) val tag: ClassTag[Int] = implicitly[ClassTag[Int]] th.pbench{ val x = bx(ix(a(ai))); ai = (ai+1)%a.length; Arrays.sort(x, q); xb(x)(x.length/3) } th.pbench{ val x = bx(ix(b(bi))); bi = (bi+1)%b.length; Arrays.sort(x, q); xb(x)(x.length/3) } th.pbench{ val x = bx(ix(c(ci))); ci = (ci+1)%c.length; Arrays.sort(x, q); xb(x)(x.length/3) } th.pbench{ val x = bx(ix(d(di))); di = (di+1)%d.length; Arrays.sort(x, q); xb(x)(x.length/3) } th.pbench{ val x = bx(ix(e(ei))); ei = (ei+1)%e.length; Arrays.sort(x, q); xb(x)(x.length/3) } th.pbench{ val x = bx(ix(f(fi))); fi = (fi+1)%f.length; Arrays.sort(x, q); xb(x)(x.length/3) } } ```
| * | | | | Merge pull request #4548 from ScrapCodes/git_4522Jason Zaugg2015-06-144-9/+131
| |\ \ \ \ \ | | |_|/ / / | |/| | | | SI-7747 Make REPL wrappers serialization friendly.