From cce701650143d13c8b292bffd590bf7c8eb532d7 Mon Sep 17 00:00:00 2001 From: Sébastien Doeraene Date: Wed, 20 Apr 2016 15:12:14 +0200 Subject: 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. --- src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala | 1 - src/compiler/scala/tools/nsc/backend/jvm/CoreBTypes.scala | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) (limited to 'src/compiler/scala/tools/nsc/backend/jvm') diff --git a/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala b/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala index 6d3d458324..bc09d78f42 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/BCodeBodyBuilder.scala @@ -1119,7 +1119,6 @@ abstract class BCodeBodyBuilder extends BCodeSkelBuilder { /* Generate the scala ## method. */ def genScalaHash(tree: Tree, applyPos: Position): BType = { - genLoadModule(ScalaRunTimeModule) // TODO why load ScalaRunTimeModule if ## has InvokeStyle of Static(false) ? genLoad(tree, ObjectRef) genCallMethod(hashMethodSym, InvokeStyle.Static, applyPos) INT diff --git a/src/compiler/scala/tools/nsc/backend/jvm/CoreBTypes.scala b/src/compiler/scala/tools/nsc/backend/jvm/CoreBTypes.scala index 4d03f9851e..0b53ea2fb1 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/CoreBTypes.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/CoreBTypes.scala @@ -251,7 +251,7 @@ class CoreBTypes[BTFS <: BTypesFromSymbols[_ <: Global]](val bTypes: BTFS) { ) } - lazy val hashMethodSym: Symbol = getMember(ScalaRunTimeModule, nme.hash_) + lazy val hashMethodSym: Symbol = getMember(RuntimeStaticsModule, nme.anyHash) // TODO @lry avoiding going through through missingHook for every line in the REPL: https://github.com/scala/scala/commit/8d962ed4ddd310cc784121c426a2e3f56a112540 lazy val AndroidParcelableInterface : Symbol = getClassIfDefined("android.os.Parcelable") -- cgit v1.2.3