Created
April 27, 2017 08:46
-
-
Save guersam/a45565915a00a068131cbf037cd0b0df to your computer and use it in GitHub Desktop.
cross-libraries optimization in Scala 2.12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
object Main { | |
val xs = (1 to 10).toList | |
def simple(): List[Int] = | |
xs.map { i => | |
i + 1 | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Compiled from "Main.scala" | |
public final class Main$ { | |
public static Main$ MODULE$; | |
public static {}; | |
Code: | |
0: new #2 // class Main$ | |
3: invokespecial #25 // Method "<init>":()V | |
6: return | |
public scala.collection.immutable.List<java.lang.Object> xs(); | |
Code: | |
0: aload_0 | |
1: getfield #28 // Field xs:Lscala/collection/immutable/List; | |
4: areturn | |
public scala.collection.immutable.List<java.lang.Object> simple(); | |
Code: | |
0: aload_0 | |
1: invokevirtual #32 // Method xs:()Lscala/collection/immutable/List; | |
4: invokedynamic #53, 0 // InvokeDynamic #0:apply$mcII$sp:()Lscala/runtime/java8/JFunction1$mcII$sp; | |
9: getstatic #58 // Field scala/collection/immutable/List$.MODULE$:Lscala/collection/immutable/List$; | |
12: invokevirtual #62 // Method scala/collection/immutable/List$.canBuildFrom:()Lscala/collection/generic/CanBuildFrom; | |
15: invokevirtual #68 // Method scala/collection/immutable/List.map:(Lscala/Function1;Lscala/collection/generic/CanBuildFrom;)Ljava/lang/Object; | |
18: checkcast #64 // class scala/collection/immutable/List | |
21: areturn | |
public static final int $anonfun$simple$1(int); | |
Code: | |
0: iload_0 | |
1: iconst_1 | |
2: iadd | |
3: ireturn | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Compiled from "Main.scala" | |
public final class Main$ { | |
public static Main$ MODULE$; | |
public static {}; | |
Code: | |
0: new #2 // class Main$ | |
3: invokespecial #30 // Method "<init>":()V | |
6: return | |
public scala.collection.immutable.List<java.lang.Object> xs(); | |
Code: | |
0: aload_0 | |
1: getfield #33 // Field xs:Lscala/collection/immutable/List; | |
4: areturn | |
public scala.collection.immutable.List<java.lang.Object> simple(); | |
Code: | |
0: aload_0 | |
1: invokevirtual #37 // Method xs:()Lscala/collection/immutable/List; | |
4: invokedynamic #58, 0 // InvokeDynamic #0:apply$mcII$sp:()Lscala/runtime/java8/JFunction1$mcII$sp; | |
9: getstatic #63 // Field scala/collection/immutable/List$.MODULE$:Lscala/collection/immutable/List$; | |
12: invokevirtual #67 // Method scala/collection/immutable/List$.canBuildFrom:()Lscala/collection/generic/CanBuildFrom; | |
15: astore_3 | |
16: astore_2 | |
17: dup | |
18: ifnonnull 23 | |
21: aconst_null | |
22: athrow | |
23: astore_1 | |
24: aload_3 | |
25: getstatic #63 // Field scala/collection/immutable/List$.MODULE$:Lscala/collection/immutable/List$; | |
28: invokevirtual #71 // Method scala/collection/immutable/List$.ReusableCBF:()Lscala/collection/generic/GenTraversableFactory$GenericCanBuildFrom; | |
31: if_acmpne 152 | |
34: aload_1 | |
35: getstatic #76 // Field scala/collection/immutable/Nil$.MODULE$:Lscala/collection/immutable/Nil$; | |
38: if_acmpne 49 | |
41: getstatic #76 // Field scala/collection/immutable/Nil$.MODULE$:Lscala/collection/immutable/Nil$; | |
44: astore 8 | |
46: goto 160 | |
49: new #78 // class scala/collection/immutable/$colon$colon | |
52: dup | |
53: aload_1 | |
54: invokevirtual #84 // Method scala/collection/immutable/List.head:()Ljava/lang/Object; | |
57: invokestatic #90 // Method scala/runtime/BoxesRunTime.unboxToInt:(Ljava/lang/Object;)I | |
60: invokestatic #49 // Method $anonfun$simple$1:(I)I | |
63: invokestatic #94 // Method scala/runtime/BoxesRunTime.boxToInteger:(I)Ljava/lang/Integer; | |
66: getstatic #76 // Field scala/collection/immutable/Nil$.MODULE$:Lscala/collection/immutable/Nil$; | |
69: invokespecial #97 // Method scala/collection/immutable/$colon$colon."<init>":(Ljava/lang/Object;Lscala/collection/immutable/List;)V | |
72: astore 4 | |
74: aload 4 | |
76: astore 5 | |
78: aload_1 | |
79: invokevirtual #100 // Method scala/collection/immutable/List.tail:()Ljava/lang/Object; | |
82: checkcast #80 // class scala/collection/immutable/List | |
85: astore 6 | |
87: aload 6 | |
89: getstatic #76 // Field scala/collection/immutable/Nil$.MODULE$:Lscala/collection/immutable/Nil$; | |
92: if_acmpeq 145 | |
95: new #78 // class scala/collection/immutable/$colon$colon | |
98: dup | |
99: aload 6 | |
101: invokevirtual #84 // Method scala/collection/immutable/List.head:()Ljava/lang/Object; | |
104: invokestatic #90 // Method scala/runtime/BoxesRunTime.unboxToInt:(Ljava/lang/Object;)I | |
107: invokestatic #49 // Method $anonfun$simple$1:(I)I | |
110: invokestatic #94 // Method scala/runtime/BoxesRunTime.boxToInteger:(I)Ljava/lang/Integer; | |
113: getstatic #76 // Field scala/collection/immutable/Nil$.MODULE$:Lscala/collection/immutable/Nil$; | |
116: invokespecial #97 // Method scala/collection/immutable/$colon$colon."<init>":(Ljava/lang/Object;Lscala/collection/immutable/List;)V | |
119: astore 7 | |
121: aload 5 | |
123: aload 7 | |
125: invokevirtual #104 // Method scala/collection/immutable/$colon$colon.tl_$eq:(Lscala/collection/immutable/List;)V | |
128: aload 7 | |
130: astore 5 | |
132: aload 6 | |
134: invokevirtual #100 // Method scala/collection/immutable/List.tail:()Ljava/lang/Object; | |
137: checkcast #80 // class scala/collection/immutable/List | |
140: astore 6 | |
142: goto 87 | |
145: aload 4 | |
147: astore 8 | |
149: goto 160 | |
152: aload_1 | |
153: aload_2 | |
154: aload_3 | |
155: invokestatic #110 // InterfaceMethod scala/collection/TraversableLike.map$:(Lscala/collection/TraversableLike;Lscala/Function1;Lscala/collection/generic/CanBuildFrom;)Ljava/lang/Object; | |
158: astore 8 | |
160: aload 8 | |
162: checkcast #80 // class scala/collection/immutable/List | |
165: areturn | |
public static final int $anonfun$simple$1(int); | |
Code: | |
0: iload_0 | |
1: iconst_1 | |
2: iadd | |
3: ireturn | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment