Skip to content

Commit

Permalink
Merge pull request scala-js#4702 from sjrd/inline-idhashcode-in-objec…
Browse files Browse the repository at this point in the history
…t-hashcode

Manually inline System.identityHashCode into Object.hashCode.
  • Loading branch information
sjrd authored Jul 25, 2022
2 parents 8bc832f + 2103212 commit c6ac7d3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
10 changes: 3 additions & 7 deletions project/JavaLangObject.scala
Original file line number Diff line number Diff line change
Expand Up @@ -63,20 +63,16 @@ object JavaLangObject {
GetClass(This()(ThisType))
})(OptimizerHints.empty.withInline(true), None),

/* def hashCode(): Int = System.identityHashCode(this) */
/* def hashCode(): Int = <identityHashCode>(this) */
MethodDef(
MemberFlags.empty,
MethodIdent(MethodName("hashCode", Nil, IntRef)),
NoOriginalName,
Nil,
IntType,
Some {
Apply(
EAF,
LoadModule(ClassName("java.lang.System$")),
MethodIdent(MethodName("identityHashCode", List(ObjectClassRef), IntRef)),
List(This()(ThisType)))(IntType)
})(OptimizerHints.empty, None),
IdentityHashCode(This()(ThisType))
})(OptimizerHints.empty.withInline(true), None),

/* def equals(that: Object): Boolean = this eq that */
MethodDef(
Expand Down
1 change: 0 additions & 1 deletion project/MiniLib.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ object MiniLib {
val inJavaLang = List(
"Object",
"Class",
"System",

"CharSequence",
"Cloneable",
Expand Down

0 comments on commit c6ac7d3

Please sign in to comment.