Skip to content

Typos, better assertions, dead code #37

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 3, 2014

Conversation

DarkDimius
Copy link
Contributor

@sjrd @odersky please review

More verbose assertions.
Unnecessary semicolons removed.
@@ -787,10 +787,6 @@ object Trees {

def flatten[T >: Untyped](trees: List[Tree[T]]): List[Tree[T]] = {
var buf: ListBuffer[Tree[T]] = null
def add(tree: Tree[T]) = {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is dead code

@odersky
Copy link
Contributor

odersky commented Mar 3, 2014

LGTM

1 similar comment
@sjrd
Copy link
Member

sjrd commented Mar 3, 2014

LGTM

DarkDimius added a commit that referenced this pull request Mar 3, 2014
Typos, better assertions, dead code
@DarkDimius DarkDimius merged commit 340ec61 into scala:master Mar 3, 2014
noti0na1 added a commit to noti0na1/dotty that referenced this pull request Nov 4, 2019
odersky referenced this pull request in dotty-staging/dotty Jun 10, 2022
Some tests by Matt had cases where `.nn` figured prominently in the flamegraph.
I optimized it so that the fast path is streamlined and inlined.

In the following test code:
```

  def x: String | Null = "abc"
  val y = x.nn
```
the new implementation is
```
      10: getstatic     #20                 // Field MODULE$:LTest$;
      13: invokevirtual #24                 // Method x:()Ljava/lang/String;
      16: astore_0
      17: getstatic     #29                 // Field scala/runtime/Scala3RunTime$.MODULE$:Lscala/runtime/Scala3RunTime$;
      20: aload_0
      21: invokevirtual #33                 // Method scala/runtime/Scala3RunTime$.nn:(Ljava/lang/Object;)Ljava/lang/Object;
      24: checkcast     #35                 // class java/lang/String
      27: putstatic     #37                 // Field y:Ljava/lang/String;
```
The previous implementation was two bytes shorter, but contained in the critical path

 - A call to a ScalaRuntime method, which was not inlineable by the JIT compiler due to its size,
 - A conversion of a cmparison to a Boolean value (not sure this matters)
 - A cast from the return type `Object` to the actual type.
bishabosha referenced this pull request in dotty-staging/dotty Oct 18, 2022
Some tests by Matt had cases where `.nn` figured prominently in the flamegraph.
I optimized it so that the fast path is streamlined and inlined.

In the following test code:
```

  def x: String | Null = "abc"
  val y = x.nn
```
the new implementation is
```
      10: getstatic     #20                 // Field MODULE$:LTest$;
      13: invokevirtual #24                 // Method x:()Ljava/lang/String;
      16: astore_0
      17: getstatic     #29                 // Field scala/runtime/Scala3RunTime$.MODULE$:Lscala/runtime/Scala3RunTime$;
      20: aload_0
      21: invokevirtual #33                 // Method scala/runtime/Scala3RunTime$.nn:(Ljava/lang/Object;)Ljava/lang/Object;
      24: checkcast     #35                 // class java/lang/String
      27: putstatic     #37                 // Field y:Ljava/lang/String;
```
The previous implementation was two bytes shorter, but contained in the critical path

 - A call to a ScalaRuntime method, which was not inlineable by the JIT compiler due to its size,
 - A conversion of a cmparison to a Boolean value (not sure this matters)
 - A cast from the return type `Object` to the actual type.
szymon-rd pushed a commit that referenced this pull request Dec 9, 2022
WojciechMazur pushed a commit to WojciechMazur/dotty that referenced this pull request Mar 19, 2025
Backport "Avoid using the current denotation in NamedType.disambiguate" to 3.3 LTS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants