| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
| |
Provide higher-priority implicit conversion methods whose names don't
clash with methods in JavaConverters. This allows implicit conversions
to work when importing both JavaConverters._ and JavaConversions._.
|
| |
|
|
|
|
|
|
|
|
|
| |
Implicit conversions are now in package convert as ImplicitConversions,
ImplicitConversionsToScala and ImplicitConversionsToJava.
Deprecated WrapAsJava, WrapAsScala and the values in package object.
Improve documentation.
|
|\
| |
| | |
Remove the duplicate implem of hash codes for numbers.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Previously, there were two separate implementations of hash
code for boxed number classes:
* One in Statics, used by the codegen of case class methods.
* One in ScalaRunTime + BoxesRunTime, used by everything else.
This commit removes the variant implemented in ScalaRunTime +
BoxesRunTime, and always uses Statics instead. We use Statics
because the one from ScalaRunTime causes an unnecessary module
load.
The entry point ScalaRunTime.hash() is kept, as deprecated,
for bootstrapping reasons.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The two algorithms were different, and could result in different
hash codes for some values, namely, valid long values that were
not also valid int values.
The other two functions `longHash` and `floatHash` are rewritten
to keep a common style with `doubleHash`, but their algorithm
does not change.
|
| |
| |
| | |
The package list is on the right.
|
|\ \
| |/
|/| |
SI-6710 / PR 5072 follow-up: fix Unit.box / Unit.unbox
|
| |
| |
| |
| |
| |
| |
| | |
The backend replaces .box / .unbox methods by corresponding invocations
to BoxesRunTime, but not for Unit.
This commit restores the body of `Unit.box` and `Unit.unbox`.
|
| | |
|
| | |
|
| |
| |
| |
| | |
Because it was its only call site.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This method was awful. Not only it was using run-time type
tests to essentially encode compile-time overloading. But
it also did 2 slightly different things for the Class case
and ClassTag case.
All in all, it is much more readable to inline the
appropriate implementation at every call site.
|
| |
| |
| |
| | |
Because that is the only call site of that method.
|
| |
| |
| |
| | |
Because it is otherwise unused.
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
ScalaRunTime had a bunch of overloads of the `hash()` method,
but only the `Any` version is ever used by the codegen. Worse,
their implementation was not in sync with the actual
implementations in BoxesRunTime, called by the `Any` version.
For example,
hash(0x80000000L) != hash(0x80000000L: Any)
This commit simply removes all of this dead code.
Similarly, we remove BoxesRunTime.hashFromObject(), which was
never called either.
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
| |
Support for Array[T].clone() was introduced in
36ef60e68c03bc1c7fd2e910ae7d70d4ec32d3bf. At the time, all
calls to array.clone() were redirected to
ScalaRunTime.array_clone(), which meant that array_clone()
itself could not be implemented in terms of `x.clone()`. A
Java binding was necessary.
Now, the rewriting to `array_clone()` is only done for
unbounded generic arrays. Since all the calls within
`array_clone()` are monomorphic arrays, the rewriting is not
applied, and the Java binding is unnecessary.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
The sbt command `generateSources` now generates both the AnyVal
sources and the tuple/function sources (previously done by `genprod`).
Source generation is part of the sbt build, the `scala.tools.cmd.gen`
package is removed from `scala-compiler`. This simplifies bootstrapping.
Generated sources are still in the same location and checked into git.
The shell scripts `tools/codegen` and `tools/codegen-anyvals` are
also removed. The ant build and the build scripts do not call these.
Regenerating sources is a manual step at the moment.
|
| |
|
|
|
|
|
|
|
|
|
| |
- Replaces the implementations of box/unbox in AnyVal companions by
`???`, the methods are only stubs, and the impls did not correspond
to the actual behavior. The doc comment already points to the actual
implementation in BoxesRunTime.
- Replaces the body of `getClass` from `null` to `???` and clarifies in
a comment why the overrides exist.
|
|\
| |
| | |
Accomodate and exploit new library, lang features JDK 8
|
| | |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The original code came from 2008, (a4ace382), at which point
we probably couldn't use JDK 1.5+ methods.
I haven't changed `unsignedCompare` yet to use the standard
library version, as it our version might have different
performance characteristics.
Background: http://www.drmaciver.com/2008/08/unsigned-comparison-in-javascala/
|
| | |
|
| |
| |
| |
| |
| |
| |
| | |
... in parallel collection operations.
Followup to bcbe38d18, which did away with the the approach to
use a composite exception when more than one error happened.
|
| |
| |
| |
| | |
The API for doing so efficiently was made regular in Java 1.8.
|
| |
| |
| |
| |
| | |
By using newly introduced static methods in the Java standard
library.
|
|\ \
| | |
| | | |
Fix typo in the docs for the ++ method of Stream
|
| | | |
|
|\ \ \
| | | |
| | | | |
Add initial unit test for Catch and augment documentation
|
| |/ /
| | |
| | |
| | |
| | |
| | | |
- Add unit test for andFinally
- Reduce code duplication in andFinally
- Extend documentation
|
|\ \ \
| |/ /
|/| | |
Unify treatment of built-in functions and SAMs
|
| |/
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
We compile FunctionN to Java 8's idea of a function now,
so no need to target the artisanal JFunction and friends,
except when the function is specialized, as I don't yet
see how we can use LMF with the way specialization handles
FunctionN:
First, the working status quo -- the hand-crafted specialized
versions of JFunction0. Notice how `apply$mcB$sp` is looking
pretty SAMmy:
```
@FunctionalInterface
public interface JFunction0$mcB$sp extends JFunction0 {
@Override
public byte apply$mcB$sp();
@Override
default public Object apply() {
return BoxesRunTime.boxToByte(this.apply$mcB$sp());
}
}
```
Contrast this with our specialized standard FunctionN:
```
public interface Function0<R> {
public R apply();
default public byte apply$mcB$sp() {
return BoxesRunTime.unboxToByte(this.apply());
}
}
public interface Function0$mcB$sp extends Function0<Object> { }
```
The single abstract method in `Function0$mcB$sp` is `apply`, and
the method that would let us avoid boxing, if it were abstract,
is `apply$mcB$sp`...
TODO (after M4):
- do same for specialized functions (issues with boxing?)
- remove scala/runtime/java8/JFunction* (need new STARR?)
|
|\ \
| | |
| | | |
Replace JoinIterator & improve ConcatIterator
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The new `ConcatIterator` requires only one extra lightweight wrapper
object (cons cell) to be allocated compared to `JoinIterator`. All
additional concatenations are then done in place with one cons cell per
appended iterator.
Running 1000000 iterations of the following benchmark for LHS recursion:
```
def lhs(n: Int) =
(1 to n).foldLeft(Iterator.empty: Iterator[Int])((res, _) => res ++ Iterator(1)).sum
```
On 2.12.x before SI-9623 fix:
```
$ ../scala/build-sbt/quick/bin/scala -J-Xmx1024M -nc concatit.scala
1000000: 555ms
1000000: 344ms
1000000: 397ms
1000000: 309ms
1000000: 290ms
1000000: 283ms
1000000: 282ms
1000000: 281ms
1000000: 290ms
1000000: 279ms
```
With SI-9623 fix:
```
$ ../scala/build-sbt/quick/bin/scala -J-Xmx1024M -nc concatit.scala
1000000: 610ms
1000000: 324ms
1000000: 387ms
1000000: 315ms
1000000: 296ms
1000000: 300ms
1000000: 341ms
1000000: 294ms
1000000: 291ms
1000000: 281ms
```
With this version:
```
$ ../scala/build-sbt/quick/bin/scala -J-Xmx1024M -nc concatit.scala
1000000: 362ms
1000000: 162ms
1000000: 140ms
1000000: 150ms
1000000: 110ms
1000000: 57ms
1000000: 79ms
1000000: 109ms
1000000: 120ms
1000000: 49ms
```
And for RHS recursion:
```
def rhs(n: Int) =
(1 to n).foldLeft(Iterator.empty: Iterator[Int])((res, _) => Iterator(1) ++ res).sum
```
On 2.12.x before SI-9623 fix:
```
StackOverflowError
```
With SI-9623 fix:
```
StackOverflowError
```
With this version:
```
$ ../scala/build-sbt/quick/bin/scala -J-Xmx1024M -nc concatit.scala
1000000: 3156ms
1000000: 1536ms
1000000: 1240ms
1000000: 1575ms
1000000: 439ms
1000000: 706ms
1000000: 1043ms
1000000: 1211ms
1000000: 515ms
1000000: 314ms
```
|
|\ \ \
| | | |
| | | | |
Remove deprecated Predef.error
|
| | |/
| |/|
| | |
| | |
| | |
| | | |
error was deprecated in 2.9.0 but remained to ensure compatibility with sbt.
This changes follows on from an update to the latest sbt version (0.13.11).
|
|\ \ \
| |/ /
|/| | |
Seal collection classes that were annotated with deprecatedInheritance in 2.11.0
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
They were all annotated with `@deprecatedInheritance` in 2.11.0. Some
deprecated classes are moved to new source files in order to seal the
parent class. The package-private class `DoublingUnrolledBuffer` is
moved from `scala.collection.parallel.mutable` to
`scala.collection.mutable` in order to seal `UnrolledBuffer`.
|
|\ \ \
| | | |
| | | | |
Improve documentation of `GenSeqLike#length`
|
| |/ /
| | |
| | |
| | | |
invocation of length method
|
|\ \ \
| | | |
| | | | |
Resolve several deprecation warnings
|
| |/ /
| | |
| | |
| | | |
Replace it with SyncVar#put
|
|\ \ \
| | | |
| | | | |
Organise Predef methods into Scaladoc groups
|
| |/ /
| | |
| | |
| | |
| | | |
By grouping members and providing descriptions the signal to noise
ratio in Predef is usefully enhanced.
|
|\ \ \
| | | |
| | | | |
Fix some typos in `spec` documents and comments.
|
| |/ / |
|
|/ /
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
These manual mixins were forwarding to the impl classes have
just been removed. We can now rely on default methods instead.
Update Tests:
- Fix test/files/pos/t1237.scala, we can't have an outer field
in an interface, always use the outer method.
- Don't crash on meaningless trait early init fields
test/files/neg/t2796.scala
- Remove impl class relate parts of inner class test
- Remove impl class relate parts of elidable test
- Remove impl class related reflection test.
- Remove test solely about trait impl classes renaming
- Update check file with additional stub symbol error
- Disable unstable parts of serialization test.
- TODO explain, and reset the expectation
|
|\ \
| | |
| | | |
Fix Scaladoc links in scala.io.Source
|