-
Notifications
You must be signed in to change notification settings - Fork 3.1k
-Ydump-classes: the option to dump the generated bytecode #32
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
Conversation
This file contains hidden or 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
-Ydump-classes option is intended to dump the compiler generated bytecode to the .class files in given directory. It can be pretty useful for reflective compilation that utilizes in-memory classloaders, for example to check the files if compiler produces invalid bytecode. In this case the dump helps to understand what exactly is wrong with the emitted class. The option format is -Ydump-classes <dir>.
gkossakowski
added a commit
to gkossakowski/scala
that referenced
this pull request
Jan 11, 2012
Fix for refArrayOps call to use ClassManifest.
densh
pushed a commit
to densh/scala
that referenced
this pull request
Feb 27, 2013
JIT macro compiler
non
added a commit
to non/scala
that referenced
this pull request
Sep 30, 2014
…s-annotation Add an @implicitAmbiguous annotation
retronym
referenced
this pull request
in retronym/scala
May 19, 2015
See also: https://github.com/retronym/indy-structural ``` qscalac -target:jvm-1.8 -Ybackend:GenBCode sandbox/structural.scala && qscala Test && javap -v 'Test$' | cat -v warning: there was one feature warning; re-run with -feature for details one warning found QUACK! A QUICK! A Classfile /Users/jason/code/scala2/Test$.class { public static final Test$ MODULE$; descriptor: LTest$; flags: ACC_PUBLIC, ACC_STATIC, ACC_FINAL public void main(java.lang.String[]); descriptor: ([Ljava/lang/String;)V flags: ACC_PUBLIC Code: stack=4, locals=2, args_size=2 0: getstatic #19 // Field scala/Predef$.MODULE$:Lscala/Predef$; 3: aload_0 4: new #21 // class C 7: dup 8: invokespecial #22 // Method C."<init>":()V 11: invokevirtual #26 // Method duckduck:(Ljava/lang/Object;)Ljava/lang/String; 14: invokevirtual #30 // Method scala/Predef$.println:(Ljava/lang/Object;)V 17: getstatic #19 // Field scala/Predef$.MODULE$:Lscala/Predef$; 20: aload_0 21: new #32 // class D 24: dup 25: invokespecial #33 // Method D."<init>":()V 28: invokevirtual #26 // Method duckduck:(Ljava/lang/Object;)Ljava/lang/String; 31: invokevirtual #30 // Method scala/Predef$.println:(Ljava/lang/Object;)V 34: return public java.lang.String duckduck(java.lang.Object); descriptor: (Ljava/lang/Object;)Ljava/lang/String; flags: ACC_PUBLIC Code: stack=2, locals=2, args_size=2 0: aload_1 1: ldc #38 // String A 3: invokedynamic #49, 0 // InvokeDynamic #0:"dyn:callMethod:quack":(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/String; 8: checkcast #51 // class java/lang/String 11: areturn } BootstrapMethods: 0: #45 invokestatic jdk/internal/dynalink/DefaultBootstrapper.bootstrap:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite; Method arguments: ```
retronym
referenced
this pull request
in retronym/scala
May 19, 2015
See also: https://github.com/retronym/indy-structural ``` // sandbox/structural.scala object Test { def main(args: Array[String]): Unit = { println(duckduck(new C)) println(duckduck(new D)) } def duckduck(a: { def quack(a: String): String }): String = { a.quack("A") } } class C { def quack(a: String) = "QUACK! " + a } class D { def quack(a: String) = "QUICK! " + a } ``` ``` qscalac -target:jvm-1.8 -Ybackend:GenBCode sandbox/structural.scala && qscala Test && javap -v 'Test$' | cat -v warning: there was one feature warning; re-run with -feature for details one warning found QUACK! A QUICK! A Classfile /Users/jason/code/scala2/Test$.class { public static final Test$ MODULE$; descriptor: LTest$; flags: ACC_PUBLIC, ACC_STATIC, ACC_FINAL public void main(java.lang.String[]); descriptor: ([Ljava/lang/String;)V flags: ACC_PUBLIC Code: stack=4, locals=2, args_size=2 0: getstatic #19 // Field scala/Predef$.MODULE$:Lscala/Predef$; 3: aload_0 4: new #21 // class C 7: dup 8: invokespecial #22 // Method C."<init>":()V 11: invokevirtual #26 // Method duckduck:(Ljava/lang/Object;)Ljava/lang/String; 14: invokevirtual #30 // Method scala/Predef$.println:(Ljava/lang/Object;)V 17: getstatic #19 // Field scala/Predef$.MODULE$:Lscala/Predef$; 20: aload_0 21: new #32 // class D 24: dup 25: invokespecial #33 // Method D."<init>":()V 28: invokevirtual #26 // Method duckduck:(Ljava/lang/Object;)Ljava/lang/String; 31: invokevirtual #30 // Method scala/Predef$.println:(Ljava/lang/Object;)V 34: return public java.lang.String duckduck(java.lang.Object); descriptor: (Ljava/lang/Object;)Ljava/lang/String; flags: ACC_PUBLIC Code: stack=2, locals=2, args_size=2 0: aload_1 1: ldc #38 // String A 3: invokedynamic #49, 0 // InvokeDynamic #0:"dyn:callMethod:quack":(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/String; 8: checkcast #51 // class java/lang/String 11: areturn } BootstrapMethods: 0: #45 invokestatic jdk/internal/dynalink/DefaultBootstrapper.bootstrap:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite; Method arguments: ```
retronym
referenced
this pull request
in retronym/scala
May 19, 2015
See also: https://github.com/retronym/indy-structural ``` // sandbox/structural.scala object Test { def main(args: Array[String]): Unit = { println(duckduck(new C)) println(duckduck(new D)) } def duckduck(a: { def quack(a: String): String }): String = { a.quack("A") } } class C { def quack(a: String) = "QUACK! " + a } class D { def quack(a: String) = "QUICK! " + a } ``` ``` qscalac -target:jvm-1.8 -Ybackend:GenBCode sandbox/structural.scala && qscala Test && javap -v 'Test$' | cat -v warning: there was one feature warning; re-run with -feature for details one warning found QUACK! A QUICK! A Classfile /Users/jason/code/scala2/Test$.class { public static final Test$ MODULE$; descriptor: LTest$; flags: ACC_PUBLIC, ACC_STATIC, ACC_FINAL public void main(java.lang.String[]); descriptor: ([Ljava/lang/String;)V flags: ACC_PUBLIC Code: stack=4, locals=2, args_size=2 0: getstatic #19 // Field scala/Predef$.MODULE$:Lscala/Predef$; 3: aload_0 4: new #21 // class C 7: dup 8: invokespecial #22 // Method C."<init>":()V 11: invokevirtual #26 // Method duckduck:(Ljava/lang/Object;)Ljava/lang/String; 14: invokevirtual #30 // Method scala/Predef$.println:(Ljava/lang/Object;)V 17: getstatic #19 // Field scala/Predef$.MODULE$:Lscala/Predef$; 20: aload_0 21: new #32 // class D 24: dup 25: invokespecial #33 // Method D."<init>":()V 28: invokevirtual #26 // Method duckduck:(Ljava/lang/Object;)Ljava/lang/String; 31: invokevirtual #30 // Method scala/Predef$.println:(Ljava/lang/Object;)V 34: return public java.lang.String duckduck(java.lang.Object); descriptor: (Ljava/lang/Object;)Ljava/lang/String; flags: ACC_PUBLIC Code: stack=2, locals=2, args_size=2 0: aload_1 1: ldc #38 // String A 3: invokedynamic #49, 0 // InvokeDynamic #0:"dyn:callMethod:quack":(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/String; 8: checkcast #51 // class java/lang/String 11: areturn } BootstrapMethods: 0: #45 invokestatic jdk/internal/dynalink/DefaultBootstrapper.bootstrap:(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite; Method arguments: ```
retronym
referenced
this pull request
in retronym/scala
May 4, 2016
And use this as the target of the default methods or
statically resolved super or $init calls.
The call-site change is predicated on `-Yuse-trait-statics`
as a stepping stone for experimentation / bootstrapping.
I have performed this transformation in the backend,
rather than trying to reflect this in the view from
Scala symbols + ASTs.
```
> ;scalac sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:13 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokespecial #17 // Method T.$init$:()V
[info] 8: getstatic #23 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #24 // String C
[info] 13: invokevirtual #28 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokespecial #32 // Method T.foo:()I
[info] 20: pop
[info] 21: return
[info] }
> ;scalac -Yuse-trait-statics sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:39 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokestatic #18 // Method T.$init$:(LT;)V
[info] 8: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #25 // String C
[info] 13: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokestatic #33 // Method T.foo:(LT;)I
[info] 20: pop
[info] 21: return
[info] }
> eval "javap -classpath . -c -private T".!!
[info] ans: String = Compiled from "test.scala"
[info] public interface T {
[info] public static int foo(T);
[info] Code:
[info] 0: iconst_0
[info] 1: ireturn
[info]
[info] public int foo();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #15 // Method foo:(LT;)I
[info] 4: ireturn
[info]
[info] public static void $init$(T);
[info] Code:
[info] 0: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 3: ldc #25 // String T
[info] 5: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 8: return
[info]
[info] public void $init$();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #32 // Method $init$:(LT;)V
[info] 4: return
[info] }
```
retronym
referenced
this pull request
in retronym/scala
May 4, 2016
And use this as the target of the default methods or
statically resolved super or $init calls.
The call-site change is predicated on `-Yuse-trait-statics`
as a stepping stone for experimentation / bootstrapping.
I have performed this transformation in the backend,
rather than trying to reflect this in the view from
Scala symbols + ASTs.
Once we commit to this change, we can remove the
`lateInterfaces` bookkeeping from the backend, as we no
long will need to add ancestor interfaces as direct
parents to allow use of invokespecial for super calls.
```
> ;scalac sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:13 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokespecial #17 // Method T.$init$:()V
[info] 8: getstatic #23 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #24 // String C
[info] 13: invokevirtual #28 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokespecial #32 // Method T.foo:()I
[info] 20: pop
[info] 21: return
[info] }
> ;scalac -Yuse-trait-statics sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:39 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokestatic #18 // Method T.$init$:(LT;)V
[info] 8: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #25 // String C
[info] 13: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokestatic #33 // Method T.foo:(LT;)I
[info] 20: pop
[info] 21: return
[info] }
> eval "javap -classpath . -c -private T".!!
[info] ans: String = Compiled from "test.scala"
[info] public interface T {
[info] public static int foo(T);
[info] Code:
[info] 0: iconst_0
[info] 1: ireturn
[info]
[info] public int foo();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #15 // Method foo:(LT;)I
[info] 4: ireturn
[info]
[info] public static void $init$(T);
[info] Code:
[info] 0: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 3: ldc #25 // String T
[info] 5: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 8: return
[info]
[info] public void $init$();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #32 // Method $init$:(LT;)V
[info] 4: return
[info] }
```
retronym
referenced
this pull request
in retronym/scala
May 4, 2016
And use this as the target of the default methods or
statically resolved super or $init calls.
The call-site change is predicated on `-Yuse-trait-statics`
as a stepping stone for experimentation / bootstrapping.
I have performed this transformation in the backend,
rather than trying to reflect this in the view from
Scala symbols + ASTs.
Once we commit to this change, we can remove the
`lateInterfaces` bookkeeping from the backend, as we no
long will need to add ancestor interfaces as direct
parents to allow use of invokespecial for super calls.
```
> ;scalac sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:13 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokespecial #17 // Method T.$init$:()V
[info] 8: getstatic #23 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #24 // String C
[info] 13: invokevirtual #28 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokespecial #32 // Method T.foo:()I
[info] 20: pop
[info] 21: return
[info] }
> ;scalac -Yuse-trait-statics sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:39 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokestatic #18 // Method T.$init$:(LT;)V
[info] 8: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #25 // String C
[info] 13: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokestatic #33 // Method T.foo:(LT;)I
[info] 20: pop
[info] 21: return
[info] }
> eval "javap -classpath . -c -private T".!!
[info] ans: String = Compiled from "test.scala"
[info] public interface T {
[info] public static int foo(T);
[info] Code:
[info] 0: iconst_0
[info] 1: ireturn
[info]
[info] public int foo();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #15 // Method foo:(LT;)I
[info] 4: ireturn
[info]
[info] public static void $init$(T);
[info] Code:
[info] 0: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 3: ldc #25 // String T
[info] 5: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 8: return
[info]
[info] public void $init$();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #32 // Method $init$:(LT;)V
[info] 4: return
[info] }
```
retronym
referenced
this pull request
in retronym/scala
May 4, 2016
And use this as the target of the default methods or
statically resolved super or $init calls.
The call-site change is predicated on `-Yuse-trait-statics`
as a stepping stone for experimentation / bootstrapping.
I have performed this transformation in the backend,
rather than trying to reflect this in the view from
Scala symbols + ASTs.
Once we commit to this change, we can remove the
`lateInterfaces` bookkeeping from the backend, as we no
long will need to add ancestor interfaces as direct
parents to allow use of invokespecial for super calls.
```
> ;scalac sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:13 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokespecial #17 // Method T.$init$:()V
[info] 8: getstatic #23 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #24 // String C
[info] 13: invokevirtual #28 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokespecial #32 // Method T.foo:()I
[info] 20: pop
[info] 21: return
[info] }
> ;scalac -Yuse-trait-statics sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:39 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokestatic #18 // Method T.$init$:(LT;)V
[info] 8: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #25 // String C
[info] 13: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokestatic #33 // Method T.foo:(LT;)I
[info] 20: pop
[info] 21: return
[info] }
> eval "javap -classpath . -c -private T".!!
[info] ans: String = Compiled from "test.scala"
[info] public interface T {
[info] public static int foo(T);
[info] Code:
[info] 0: iconst_0
[info] 1: ireturn
[info]
[info] public int foo();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #15 // Method foo:(LT;)I
[info] 4: ireturn
[info]
[info] public static void $init$(T);
[info] Code:
[info] 0: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 3: ldc #25 // String T
[info] 5: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 8: return
[info]
[info] public void $init$();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #32 // Method $init$:(LT;)V
[info] 4: return
[info] }
```
retronym
referenced
this pull request
in retronym/scala
May 4, 2016
And use this as the target of the default methods or
statically resolved super or $init calls.
The call-site change is predicated on `-Yuse-trait-statics`
as a stepping stone for experimentation / bootstrapping.
I have performed this transformation in the backend,
rather than trying to reflect this in the view from
Scala symbols + ASTs.
Once we commit to this change, we can remove the
`lateInterfaces` bookkeeping from the backend, as we no
long will need to add ancestor interfaces as direct
parents to allow use of invokespecial for super calls.
```
> ;scalac sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:13 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokespecial #17 // Method T.$init$:()V
[info] 8: getstatic #23 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #24 // String C
[info] 13: invokevirtual #28 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokespecial #32 // Method T.foo:()I
[info] 20: pop
[info] 21: return
[info] }
> ;scalac -Yuse-trait-statics sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:39 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokestatic #18 // Method T.$init$:(LT;)V
[info] 8: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #25 // String C
[info] 13: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokestatic #33 // Method T.foo:(LT;)I
[info] 20: pop
[info] 21: return
[info] }
> eval "javap -classpath . -c -private T".!!
[info] ans: String = Compiled from "test.scala"
[info] public interface T {
[info] public static int foo(T);
[info] Code:
[info] 0: iconst_0
[info] 1: ireturn
[info]
[info] public int foo();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #15 // Method foo:(LT;)I
[info] 4: ireturn
[info]
[info] public static void $init$(T);
[info] Code:
[info] 0: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 3: ldc #25 // String T
[info] 5: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 8: return
[info]
[info] public void $init$();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #32 // Method $init$:(LT;)V
[info] 4: return
[info] }
```
retronym
referenced
this pull request
in retronym/scala
May 5, 2016
And use this as the target of the default methods or
statically resolved super or $init calls.
The call-site change is predicated on `-Yuse-trait-statics`
as a stepping stone for experimentation / bootstrapping.
I have performed this transformation in the backend,
rather than trying to reflect this in the view from
Scala symbols + ASTs.
Once we commit to this change, we can remove the
`lateInterfaces` bookkeeping from the backend, as we no
long will need to add ancestor interfaces as direct
parents to allow use of invokespecial for super calls.
```
> ;scalac sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:13 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokespecial #17 // Method T.$init$:()V
[info] 8: getstatic #23 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #24 // String C
[info] 13: invokevirtual #28 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokespecial #32 // Method T.foo:()I
[info] 20: pop
[info] 21: return
[info] }
> ;scalac -Yuse-trait-statics sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:39 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokestatic #18 // Method T.$init$:(LT;)V
[info] 8: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #25 // String C
[info] 13: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokestatic #33 // Method T.foo:(LT;)I
[info] 20: pop
[info] 21: return
[info] }
> eval "javap -classpath . -c -private T".!!
[info] ans: String = Compiled from "test.scala"
[info] public interface T {
[info] public static int foo(T);
[info] Code:
[info] 0: iconst_0
[info] 1: ireturn
[info]
[info] public int foo();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #15 // Method foo:(LT;)I
[info] 4: ireturn
[info]
[info] public static void $init$(T);
[info] Code:
[info] 0: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 3: ldc #25 // String T
[info] 5: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 8: return
[info]
[info] public void $init$();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #32 // Method $init$:(LT;)V
[info] 4: return
[info] }
```
retronym
referenced
this pull request
in retronym/scala
May 9, 2016
And use this as the target of the default methods or
statically resolved super or $init calls.
The call-site change is predicated on `-Yuse-trait-statics`
as a stepping stone for experimentation / bootstrapping.
I have performed this transformation in the backend,
rather than trying to reflect this in the view from
Scala symbols + ASTs.
Once we commit to this change, we can remove the
`lateInterfaces` bookkeeping from the backend, as we no
long will need to add ancestor interfaces as direct
parents to allow use of invokespecial for super calls.
```
> ;scalac sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:13 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokespecial #17 // Method T.$init$:()V
[info] 8: getstatic #23 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #24 // String C
[info] 13: invokevirtual #28 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokespecial #32 // Method T.foo:()I
[info] 20: pop
[info] 21: return
[info] }
> ;scalac -Yuse-trait-statics sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:39 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokestatic #18 // Method T.$init$:(LT;)V
[info] 8: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #25 // String C
[info] 13: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokestatic #33 // Method T.foo:(LT;)I
[info] 20: pop
[info] 21: return
[info] }
> eval "javap -classpath . -c -private T".!!
[info] ans: String = Compiled from "test.scala"
[info] public interface T {
[info] public static int foo(T);
[info] Code:
[info] 0: iconst_0
[info] 1: ireturn
[info]
[info] public int foo();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #15 // Method foo:(LT;)I
[info] 4: ireturn
[info]
[info] public static void $init$(T);
[info] Code:
[info] 0: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 3: ldc #25 // String T
[info] 5: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 8: return
[info]
[info] public void $init$();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #32 // Method $init$:(LT;)V
[info] 4: return
[info] }
```
retronym
referenced
this pull request
in retronym/scala
May 11, 2016
And use this as the target of the default methods or
statically resolved super or $init calls.
The call-site change is predicated on `-Yuse-trait-statics`
as a stepping stone for experimentation / bootstrapping.
I have performed this transformation in the backend,
rather than trying to reflect this in the view from
Scala symbols + ASTs.
Once we commit to this change, we can remove the
`lateInterfaces` bookkeeping from the backend, as we no
long will need to add ancestor interfaces as direct
parents to allow use of invokespecial for super calls.
```
> ;scalac sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:13 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokespecial #17 // Method T.$init$:()V
[info] 8: getstatic #23 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #24 // String C
[info] 13: invokevirtual #28 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokespecial #32 // Method T.foo:()I
[info] 20: pop
[info] 21: return
[info] }
> ;scalac -Yuse-trait-statics sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:39 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokestatic #18 // Method T.$init$:(LT;)V
[info] 8: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #25 // String C
[info] 13: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokestatic #33 // Method T.foo:(LT;)I
[info] 20: pop
[info] 21: return
[info] }
> eval "javap -classpath . -c -private T".!!
[info] ans: String = Compiled from "test.scala"
[info] public interface T {
[info] public static int foo(T);
[info] Code:
[info] 0: iconst_0
[info] 1: ireturn
[info]
[info] public int foo();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #15 // Method foo:(LT;)I
[info] 4: ireturn
[info]
[info] public static void $init$(T);
[info] Code:
[info] 0: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 3: ldc #25 // String T
[info] 5: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 8: return
[info]
[info] public void $init$();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #32 // Method $init$:(LT;)V
[info] 4: return
[info] }
```
retronym
referenced
this pull request
in retronym/scala
May 11, 2016
And use this as the target of the default methods or
statically resolved super or $init calls.
The call-site change is predicated on `-Yuse-trait-statics`
as a stepping stone for experimentation / bootstrapping.
I have performed this transformation in the backend,
rather than trying to reflect this in the view from
Scala symbols + ASTs.
Once we commit to this change, we can remove the
`lateInterfaces` bookkeeping from the backend, as we no
long will need to add ancestor interfaces as direct
parents to allow use of invokespecial for super calls.
```
> ;scalac sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:13 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokespecial #17 // Method T.$init$:()V
[info] 8: getstatic #23 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #24 // String C
[info] 13: invokevirtual #28 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokespecial #32 // Method T.foo:()I
[info] 20: pop
[info] 21: return
[info] }
> ;scalac -Yuse-trait-statics sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:39 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokestatic #18 // Method T.$init$:(LT;)V
[info] 8: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #25 // String C
[info] 13: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokestatic #33 // Method T.foo:(LT;)I
[info] 20: pop
[info] 21: return
[info] }
> eval "javap -classpath . -c -private T".!!
[info] ans: String = Compiled from "test.scala"
[info] public interface T {
[info] public static int foo(T);
[info] Code:
[info] 0: iconst_0
[info] 1: ireturn
[info]
[info] public int foo();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #15 // Method foo:(LT;)I
[info] 4: ireturn
[info]
[info] public static void $init$(T);
[info] Code:
[info] 0: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 3: ldc #25 // String T
[info] 5: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 8: return
[info]
[info] public void $init$();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #32 // Method $init$:(LT;)V
[info] 4: return
[info] }
```
retronym
referenced
this pull request
in retronym/scala
May 17, 2016
And use this as the target of the default methods or
statically resolved super or $init calls.
The call-site change is predicated on `-Yuse-trait-statics`
as a stepping stone for experimentation / bootstrapping.
I have performed this transformation in the backend,
rather than trying to reflect this in the view from
Scala symbols + ASTs.
Once we commit to this change, we can remove the
`lateInterfaces` bookkeeping from the backend, as we no
long will need to add ancestor interfaces as direct
parents to allow use of invokespecial for super calls.
```
> ;scalac sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:13 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokespecial #17 // Method T.$init$:()V
[info] 8: getstatic #23 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #24 // String C
[info] 13: invokevirtual #28 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokespecial #32 // Method T.foo:()I
[info] 20: pop
[info] 21: return
[info] }
> ;scalac -Yuse-trait-statics sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:39 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokestatic #18 // Method T.$init$:(LT;)V
[info] 8: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #25 // String C
[info] 13: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokestatic #33 // Method T.foo:(LT;)I
[info] 20: pop
[info] 21: return
[info] }
> eval "javap -classpath . -c -private T".!!
[info] ans: String = Compiled from "test.scala"
[info] public interface T {
[info] public static int foo(T);
[info] Code:
[info] 0: iconst_0
[info] 1: ireturn
[info]
[info] public int foo();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #15 // Method foo:(LT;)I
[info] 4: ireturn
[info]
[info] public static void $init$(T);
[info] Code:
[info] 0: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 3: ldc #25 // String T
[info] 5: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 8: return
[info]
[info] public void $init$();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #32 // Method $init$:(LT;)V
[info] 4: return
[info] }
```
retronym
referenced
this pull request
in retronym/scala
May 19, 2016
And use this as the target of the default methods or
statically resolved super or $init calls.
The call-site change is predicated on `-Yuse-trait-statics`
as a stepping stone for experimentation / bootstrapping.
I have performed this transformation in the backend,
rather than trying to reflect this in the view from
Scala symbols + ASTs.
Once we commit to this change, we can remove the
`lateInterfaces` bookkeeping from the backend, as we no
long will need to add ancestor interfaces as direct
parents to allow use of invokespecial for super calls.
```
> ;scalac sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:13 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokespecial #17 // Method T.$init$:()V
[info] 8: getstatic #23 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #24 // String C
[info] 13: invokevirtual #28 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokespecial #32 // Method T.foo:()I
[info] 20: pop
[info] 21: return
[info] }
> ;scalac -Yuse-trait-statics sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:39 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokestatic #18 // Method T.$init$:(LT;)V
[info] 8: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #25 // String C
[info] 13: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokestatic #33 // Method T.foo:(LT;)I
[info] 20: pop
[info] 21: return
[info] }
> eval "javap -classpath . -c -private T".!!
[info] ans: String = Compiled from "test.scala"
[info] public interface T {
[info] public static int foo(T);
[info] Code:
[info] 0: iconst_0
[info] 1: ireturn
[info]
[info] public int foo();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #15 // Method foo:(LT;)I
[info] 4: ireturn
[info]
[info] public static void $init$(T);
[info] Code:
[info] 0: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 3: ldc #25 // String T
[info] 5: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 8: return
[info]
[info] public void $init$();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #32 // Method $init$:(LT;)V
[info] 4: return
[info] }
```
retronym
referenced
this pull request
in retronym/scala
May 19, 2016
And use this as the target of the default methods or
statically resolved super or $init calls.
The call-site change is predicated on `-Yuse-trait-statics`
as a stepping stone for experimentation / bootstrapping.
I have performed this transformation in the backend,
rather than trying to reflect this in the view from
Scala symbols + ASTs.
Once we commit to this change, we can remove the
`lateInterfaces` bookkeeping from the backend, as we no
long will need to add ancestor interfaces as direct
parents to allow use of invokespecial for super calls.
```
> ;scalac sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:13 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokespecial #17 // Method T.$init$:()V
[info] 8: getstatic #23 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #24 // String C
[info] 13: invokevirtual #28 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokespecial #32 // Method T.foo:()I
[info] 20: pop
[info] 21: return
[info] }
> ;scalac -Yuse-trait-statics sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:39 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokestatic #18 // Method T.$init$:(LT;)V
[info] 8: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #25 // String C
[info] 13: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokestatic #33 // Method T.foo:(LT;)I
[info] 20: pop
[info] 21: return
[info] }
> eval "javap -classpath . -c -private T".!!
[info] ans: String = Compiled from "test.scala"
[info] public interface T {
[info] public static int foo(T);
[info] Code:
[info] 0: iconst_0
[info] 1: ireturn
[info]
[info] public int foo();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #15 // Method foo:(LT;)I
[info] 4: ireturn
[info]
[info] public static void $init$(T);
[info] Code:
[info] 0: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 3: ldc #25 // String T
[info] 5: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 8: return
[info]
[info] public void $init$();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #32 // Method $init$:(LT;)V
[info] 4: return
[info] }
```
retronym
referenced
this pull request
in retronym/scala
May 19, 2016
And use this as the target of the default methods or
statically resolved super or $init calls.
The call-site change is predicated on `-Yuse-trait-statics`
as a stepping stone for experimentation / bootstrapping.
I have performed this transformation in the backend,
rather than trying to reflect this in the view from
Scala symbols + ASTs.
Once we commit to this change, we can remove the
`lateInterfaces` bookkeeping from the backend, as we no
long will need to add ancestor interfaces as direct
parents to allow use of invokespecial for super calls.
```
> ;scalac sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:13 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokespecial #17 // Method T.$init$:()V
[info] 8: getstatic #23 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #24 // String C
[info] 13: invokevirtual #28 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokespecial #32 // Method T.foo:()I
[info] 20: pop
[info] 21: return
[info] }
> ;scalac -Yuse-trait-statics sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:39 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokestatic #18 // Method T.$init$:(LT;)V
[info] 8: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #25 // String C
[info] 13: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokestatic #33 // Method T.foo:(LT;)I
[info] 20: pop
[info] 21: return
[info] }
> eval "javap -classpath . -c -private T".!!
[info] ans: String = Compiled from "test.scala"
[info] public interface T {
[info] public static int foo(T);
[info] Code:
[info] 0: iconst_0
[info] 1: ireturn
[info]
[info] public int foo();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #15 // Method foo:(LT;)I
[info] 4: ireturn
[info]
[info] public static void $init$(T);
[info] Code:
[info] 0: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 3: ldc #25 // String T
[info] 5: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 8: return
[info]
[info] public void $init$();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #32 // Method $init$:(LT;)V
[info] 4: return
[info] }
```
retronym
referenced
this pull request
in retronym/scala
May 25, 2016
And use this as the target of the default methods or
statically resolved super or $init calls.
The call-site change is predicated on `-Yuse-trait-statics`
as a stepping stone for experimentation / bootstrapping.
I have performed this transformation in the backend,
rather than trying to reflect this in the view from
Scala symbols + ASTs.
Once we commit to this change, we can remove the
`lateInterfaces` bookkeeping from the backend, as we no
long will need to add ancestor interfaces as direct
parents to allow use of invokespecial for super calls.
```
> ;scalac sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:13 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokespecial #17 // Method T.$init$:()V
[info] 8: getstatic #23 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #24 // String C
[info] 13: invokevirtual #28 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokespecial #32 // Method T.foo:()I
[info] 20: pop
[info] 21: return
[info] }
> ;scalac -Yuse-trait-statics sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:39 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokestatic #18 // Method T.$init$:(LT;)V
[info] 8: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #25 // String C
[info] 13: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokestatic #33 // Method T.foo:(LT;)I
[info] 20: pop
[info] 21: return
[info] }
> eval "javap -classpath . -c -private T".!!
[info] ans: String = Compiled from "test.scala"
[info] public interface T {
[info] public static int foo(T);
[info] Code:
[info] 0: iconst_0
[info] 1: ireturn
[info]
[info] public int foo();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #15 // Method foo:(LT;)I
[info] 4: ireturn
[info]
[info] public static void $init$(T);
[info] Code:
[info] 0: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 3: ldc #25 // String T
[info] 5: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 8: return
[info]
[info] public void $init$();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #32 // Method $init$:(LT;)V
[info] 4: return
[info] }
```
retronym
referenced
this pull request
in retronym/scala
May 30, 2016
And use this as the target of the default methods or
statically resolved super or $init calls.
The call-site change is predicated on `-Yuse-trait-statics`
as a stepping stone for experimentation / bootstrapping.
I have performed this transformation in the backend,
rather than trying to reflect this in the view from
Scala symbols + ASTs.
```
> ;scalac sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:13 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokespecial #17 // Method T.$init$:()V
[info] 8: getstatic #23 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #24 // String C
[info] 13: invokevirtual #28 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokespecial #32 // Method T.foo:()I
[info] 20: pop
[info] 21: return
[info] }
> ;scalac -Yuse-trait-statics sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:39 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokestatic #18 // Method T.$init$:(LT;)V
[info] 8: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #25 // String C
[info] 13: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokestatic #33 // Method T.foo:(LT;)I
[info] 20: pop
[info] 21: return
[info] }
> eval "javap -classpath . -c -private T".!!
[info] ans: String = Compiled from "test.scala"
[info] public interface T {
[info] public static int foo(T);
[info] Code:
[info] 0: iconst_0
[info] 1: ireturn
[info]
[info] public int foo();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #15 // Method foo:(LT;)I
[info] 4: ireturn
[info]
[info] public static void $init$(T);
[info] Code:
[info] 0: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 3: ldc #25 // String T
[info] 5: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 8: return
[info]
[info] }
```
retronym
referenced
this pull request
in retronym/scala
May 30, 2016
And use this as the target of the default methods or
statically resolved super or $init calls.
The call-site change is predicated on `-Yuse-trait-statics`
as a stepping stone for experimentation / bootstrapping.
I have performed this transformation in the backend,
rather than trying to reflect this in the view from
Scala symbols + ASTs.
```
> ;scalac sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:13 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokespecial #17 // Method T.$init$:()V
[info] 8: getstatic #23 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #24 // String C
[info] 13: invokevirtual #28 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokespecial #32 // Method T.foo:()I
[info] 20: pop
[info] 21: return
[info] }
> ;scalac -Yuse-trait-statics sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:39 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokestatic #18 // Method T.$init$:(LT;)V
[info] 8: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #25 // String C
[info] 13: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokestatic #33 // Method T.foo:(LT;)I
[info] 20: pop
[info] 21: return
[info] }
> eval "javap -classpath . -c -private T".!!
[info] ans: String = Compiled from "test.scala"
[info] public interface T {
[info] public static int foo(T);
[info] Code:
[info] 0: iconst_0
[info] 1: ireturn
[info]
[info] public int foo();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #15 // Method foo:(LT;)I
[info] 4: ireturn
[info]
[info] public static void $init$(T);
[info] Code:
[info] 0: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 3: ldc #25 // String T
[info] 5: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 8: return
[info]
[info] }
```
retronym
referenced
this pull request
in retronym/scala
May 31, 2016
And use this as the target of the default methods or
statically resolved super or $init calls.
The call-site change is predicated on `-Yuse-trait-statics`
as a stepping stone for experimentation / bootstrapping.
I have performed this transformation in the backend,
rather than trying to reflect this in the view from
Scala symbols + ASTs.
```
> ;scalac sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:13 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokespecial #17 // Method T.$init$:()V
[info] 8: getstatic #23 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #24 // String C
[info] 13: invokevirtual #28 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokespecial #32 // Method T.foo:()I
[info] 20: pop
[info] 21: return
[info] }
> ;scalac -Yuse-trait-statics sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:39 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokestatic #18 // Method T.$init$:(LT;)V
[info] 8: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #25 // String C
[info] 13: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokestatic #33 // Method T.foo:(LT;)I
[info] 20: pop
[info] 21: return
[info] }
> eval "javap -classpath . -c -private T".!!
[info] ans: String = Compiled from "test.scala"
[info] public interface T {
[info] public static int foo(T);
[info] Code:
[info] 0: iconst_0
[info] 1: ireturn
[info]
[info] public int foo();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #15 // Method foo:(LT;)I
[info] 4: ireturn
[info]
[info] public static void $init$(T);
[info] Code:
[info] 0: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 3: ldc #25 // String T
[info] 5: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 8: return
[info]
[info] }
```
retronym
referenced
this pull request
in retronym/scala
May 31, 2016
And use this as the target of the default methods or
statically resolved super or $init calls.
The call-site change is predicated on `-Yuse-trait-statics`
as a stepping stone for experimentation / bootstrapping.
I have performed this transformation in the backend,
rather than trying to reflect this in the view from
Scala symbols + ASTs.
```
> ;scalac sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:13 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokespecial #17 // Method T.$init$:()V
[info] 8: getstatic #23 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #24 // String C
[info] 13: invokevirtual #28 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokespecial #32 // Method T.foo:()I
[info] 20: pop
[info] 21: return
[info] }
> ;scalac -Yuse-trait-statics sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:39 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokestatic #18 // Method T.$init$:(LT;)V
[info] 8: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #25 // String C
[info] 13: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokestatic #33 // Method T.foo:(LT;)I
[info] 20: pop
[info] 21: return
[info] }
> eval "javap -classpath . -c -private T".!!
[info] ans: String = Compiled from "test.scala"
[info] public interface T {
[info] public static int foo(T);
[info] Code:
[info] 0: iconst_0
[info] 1: ireturn
[info]
[info] public int foo();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #15 // Method foo:(LT;)I
[info] 4: ireturn
[info]
[info] public static void $init$(T);
[info] Code:
[info] 0: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 3: ldc #25 // String T
[info] 5: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 8: return
[info]
[info] }
```
retronym
referenced
this pull request
in retronym/scala
Jun 1, 2016
And use this as the target of the default methods or
statically resolved super or $init calls.
The call-site change is predicated on `-Yuse-trait-statics`
as a stepping stone for experimentation / bootstrapping.
I have performed this transformation in the backend,
rather than trying to reflect this in the view from
Scala symbols + ASTs.
```
> ;scalac sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:13 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokespecial #17 // Method T.$init$:()V
[info] 8: getstatic #23 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #24 // String C
[info] 13: invokevirtual #28 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokespecial #32 // Method T.foo:()I
[info] 20: pop
[info] 21: return
[info] }
> ;scalac -Yuse-trait-statics sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:39 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokestatic #18 // Method T.$init$:(LT;)V
[info] 8: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #25 // String C
[info] 13: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokestatic #33 // Method T.foo:(LT;)I
[info] 20: pop
[info] 21: return
[info] }
> eval "javap -classpath . -c -private T".!!
[info] ans: String = Compiled from "test.scala"
[info] public interface T {
[info] public static int foo(T);
[info] Code:
[info] 0: iconst_0
[info] 1: ireturn
[info]
[info] public int foo();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #15 // Method foo:(LT;)I
[info] 4: ireturn
[info]
[info] public static void $init$(T);
[info] Code:
[info] 0: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 3: ldc #25 // String T
[info] 5: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 8: return
[info]
[info] }
```
retronym
referenced
this pull request
in retronym/scala
Jun 6, 2016
And use this as the target of the default methods or
statically resolved super or $init calls.
The call-site change is predicated on `-Yuse-trait-statics`
as a stepping stone for experimentation / bootstrapping.
I have performed this transformation in the backend,
rather than trying to reflect this in the view from
Scala symbols + ASTs.
```
> ;scalac sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:13 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokespecial #17 // Method T.$init$:()V
[info] 8: getstatic #23 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #24 // String C
[info] 13: invokevirtual #28 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokespecial #32 // Method T.foo:()I
[info] 20: pop
[info] 21: return
[info] }
> ;scalac -Yuse-trait-statics sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:39 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokestatic #18 // Method T.$init$:(LT;)V
[info] 8: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #25 // String C
[info] 13: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokestatic #33 // Method T.foo:(LT;)I
[info] 20: pop
[info] 21: return
[info] }
> eval "javap -classpath . -c -private T".!!
[info] ans: String = Compiled from "test.scala"
[info] public interface T {
[info] public static int foo(T);
[info] Code:
[info] 0: iconst_0
[info] 1: ireturn
[info]
[info] public int foo();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #15 // Method foo:(LT;)I
[info] 4: ireturn
[info]
[info] public static void $init$(T);
[info] Code:
[info] 0: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 3: ldc #25 // String T
[info] 5: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 8: return
[info]
[info] }
```
retronym
referenced
this pull request
in retronym/scala
Jun 6, 2016
And use this as the target of the default methods or
statically resolved super or $init calls.
The call-site change is predicated on `-Yuse-trait-statics`
as a stepping stone for experimentation / bootstrapping.
I have performed this transformation in the backend,
rather than trying to reflect this in the view from
Scala symbols + ASTs.
```
> ;scalac sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:13 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokespecial #17 // Method T.$init$:()V
[info] 8: getstatic #23 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #24 // String C
[info] 13: invokevirtual #28 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokespecial #32 // Method T.foo:()I
[info] 20: pop
[info] 21: return
[info] }
> ;scalac -Yuse-trait-statics sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:39 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokestatic #18 // Method T.$init$:(LT;)V
[info] 8: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #25 // String C
[info] 13: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokestatic #33 // Method T.foo:(LT;)I
[info] 20: pop
[info] 21: return
[info] }
> eval "javap -classpath . -c -private T".!!
[info] ans: String = Compiled from "test.scala"
[info] public interface T {
[info] public static int foo(T);
[info] Code:
[info] 0: iconst_0
[info] 1: ireturn
[info]
[info] public int foo();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #15 // Method foo:(LT;)I
[info] 4: ireturn
[info]
[info] public static void $init$(T);
[info] Code:
[info] 0: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 3: ldc #25 // String T
[info] 5: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 8: return
[info]
[info] }
```
retronym
referenced
this pull request
in retronym/scala
Jun 6, 2016
And use this as the target of the default methods or
statically resolved super or $init calls.
The call-site change is predicated on `-Yuse-trait-statics`
as a stepping stone for experimentation / bootstrapping.
I have performed this transformation in the backend,
rather than trying to reflect this in the view from
Scala symbols + ASTs.
```
> ;scalac sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:13 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokespecial #17 // Method T.$init$:()V
[info] 8: getstatic #23 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #24 // String C
[info] 13: invokevirtual #28 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokespecial #32 // Method T.foo:()I
[info] 20: pop
[info] 21: return
[info] }
> ;scalac -Yuse-trait-statics sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:39 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokestatic #18 // Method T.$init$:(LT;)V
[info] 8: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #25 // String C
[info] 13: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokestatic #33 // Method T.foo:(LT;)I
[info] 20: pop
[info] 21: return
[info] }
> eval "javap -classpath . -c -private T".!!
[info] ans: String = Compiled from "test.scala"
[info] public interface T {
[info] public static int foo(T);
[info] Code:
[info] 0: iconst_0
[info] 1: ireturn
[info]
[info] public int foo();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #15 // Method foo:(LT;)I
[info] 4: ireturn
[info]
[info] public static void $init$(T);
[info] Code:
[info] 0: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 3: ldc #25 // String T
[info] 5: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 8: return
[info]
[info] }
```
retronym
referenced
this pull request
in retronym/scala
Jun 6, 2016
And use this as the target of the default methods or
statically resolved super or $init calls.
The call-site change is predicated on `-Yuse-trait-statics`
as a stepping stone for experimentation / bootstrapping.
I have performed this transformation in the backend,
rather than trying to reflect this in the view from
Scala symbols + ASTs.
```
> ;scalac sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:13 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokespecial #17 // Method T.$init$:()V
[info] 8: getstatic #23 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #24 // String C
[info] 13: invokevirtual #28 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokespecial #32 // Method T.foo:()I
[info] 20: pop
[info] 21: return
[info] }
> ;scalac -Yuse-trait-statics sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:39 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokestatic #18 // Method T.$init$:(LT;)V
[info] 8: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #25 // String C
[info] 13: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokestatic #33 // Method T.foo:(LT;)I
[info] 20: pop
[info] 21: return
[info] }
> eval "javap -classpath . -c -private T".!!
[info] ans: String = Compiled from "test.scala"
[info] public interface T {
[info] public static int foo(T);
[info] Code:
[info] 0: iconst_0
[info] 1: ireturn
[info]
[info] public int foo();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #15 // Method foo:(LT;)I
[info] 4: ireturn
[info]
[info] public static void $init$(T);
[info] Code:
[info] 0: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 3: ldc #25 // String T
[info] 5: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 8: return
[info]
[info] }
```
retronym
referenced
this pull request
in retronym/scala
Jun 6, 2016
And use this as the target of the default methods or
statically resolved super or $init calls.
The call-site change is predicated on `-Yuse-trait-statics`
as a stepping stone for experimentation / bootstrapping.
I have performed this transformation in the backend,
rather than trying to reflect this in the view from
Scala symbols + ASTs.
```
> ;scalac sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:13 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokespecial #17 // Method T.$init$:()V
[info] 8: getstatic #23 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #24 // String C
[info] 13: invokevirtual #28 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokespecial #32 // Method T.foo:()I
[info] 20: pop
[info] 21: return
[info] }
> ;scalac -Yuse-trait-statics sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:39 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokestatic #18 // Method T.$init$:(LT;)V
[info] 8: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #25 // String C
[info] 13: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokestatic #33 // Method T.foo:(LT;)I
[info] 20: pop
[info] 21: return
[info] }
> eval "javap -classpath . -c -private T".!!
[info] ans: String = Compiled from "test.scala"
[info] public interface T {
[info] public static int foo(T);
[info] Code:
[info] 0: iconst_0
[info] 1: ireturn
[info]
[info] public int foo();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #15 // Method foo:(LT;)I
[info] 4: ireturn
[info]
[info] public static void $init$(T);
[info] Code:
[info] 0: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 3: ldc #25 // String T
[info] 5: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 8: return
[info]
[info] }
```
retronym
referenced
this pull request
in retronym/scala
Jun 6, 2016
And use this as the target of the default methods or
statically resolved super or $init calls.
The call-site change is predicated on `-Yuse-trait-statics`
as a stepping stone for experimentation / bootstrapping.
I have performed this transformation in the backend,
rather than trying to reflect this in the view from
Scala symbols + ASTs.
```
> ;scalac sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:13 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokespecial #17 // Method T.$init$:()V
[info] 8: getstatic #23 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #24 // String C
[info] 13: invokevirtual #28 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokespecial #32 // Method T.foo:()I
[info] 20: pop
[info] 21: return
[info] }
> ;scalac -Yuse-trait-statics sandbox/test.scala ; scala Test
[info] Running scala.tools.nsc.MainGenericRunner -usejavacp Test
T
C
[success] Total time: 2 s, completed 04/05/2016 11:07:39 AM
> eval "javap -classpath . -c -private C".!!
[info] ans: String = Compiled from "test.scala"
[info] public class C implements T {
[info] public C();
[info] Code:
[info] 0: aload_0
[info] 1: invokespecial #14 // Method java/lang/Object."<init>":()V
[info] 4: aload_0
[info] 5: invokestatic #18 // Method T.$init$:(LT;)V
[info] 8: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 11: ldc #25 // String C
[info] 13: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 16: aload_0
[info] 17: invokestatic #33 // Method T.foo:(LT;)I
[info] 20: pop
[info] 21: return
[info] }
> eval "javap -classpath . -c -private T".!!
[info] ans: String = Compiled from "test.scala"
[info] public interface T {
[info] public static int foo(T);
[info] Code:
[info] 0: iconst_0
[info] 1: ireturn
[info]
[info] public int foo();
[info] Code:
[info] 0: aload_0
[info] 1: invokestatic #15 // Method foo:(LT;)I
[info] 4: ireturn
[info]
[info] public static void $init$(T);
[info] Code:
[info] 0: getstatic #24 // Field scala/Predef$.MODULE$:Lscala/Predef$;
[info] 3: ldc #25 // String T
[info] 5: invokevirtual #29 // Method scala/Predef$.println:(Ljava/lang/Object;)V
[info] 8: return
[info]
[info] }
```
retronym
referenced
this pull request
in retronym/scala
Aug 8, 2016
Dmitry learned that we've been relying on a bug in the
verifier that will be fixed in JDK 9 under the new
classfile format.
Assignment to a static final must occur lexically
within the <clinit>. We were performing this assignment
from the constructor of the module class.
I'd like to move the assignment to <clinit> but that would
change behaviour of "benign" cyclic references between modules.
Example:
```
package p1; class CC { def foo = O.bar}; object O {new CC().foo; def bar = println(1)};
// Exiting paste mode, now interpreting.
scala> p1.O
1
```
We currently assign the MODULE$ field after the super class constructors are finished,
but before the rest of the module constructor is called.
```
private p1.O$();
Code:
0: aload_0
1: invokespecial #30 // Method java/lang/Object."<init>":()V
4: aload_0
5: putstatic #32 // Field MODULE$:Lp1/O$;
8: new #34 // class p1/CC
11: dup
12: invokespecial #35 // Method p1/CC."<init>":()V
15: invokevirtual #38 // Method p1/CC.foo:()V
18: return
```
This commit removes the ACC_FINAL bit from the field. It actually wasn't
behaving as final at all, precisely the issue that the stricter verifier
now alerts us to.
```
scala> :paste -raw
// Entering paste mode (ctrl-D to finish)
package p1; object O
// Exiting paste mode, now interpreting.
scala> val O1 = p1.O
O1: p1.O.type = p1.O$@ee7d9f1
scala> scala.reflect.ensureAccessible(p1.O.getClass.getDeclaredConstructor()).newInstance()
res0: p1.O.type = p1.O$@64cee07
scala> O1 eq p1.O
res1: Boolean = false
```
retronym
referenced
this pull request
in retronym/scala
Aug 8, 2016
Dmitry learned that we've been relying on a bug in the
verifier that will be fixed in JDK 9 under the new
classfile format.
Assignment to a static final must occur lexically
within the <clinit>. We were performing this assignment
from the constructor of the module class.
I'd like to move the assignment to <clinit> but that would
change behaviour of "benign" cyclic references between modules.
Example:
```
package p1; class CC { def foo = O.bar}; object O {new CC().foo; def bar = println(1)};
// Exiting paste mode, now interpreting.
scala> p1.O
1
```
We currently assign the MODULE$ field after the super class constructors are finished,
but before the rest of the module constructor is called.
```
private p1.O$();
Code:
0: aload_0
1: invokespecial #30 // Method java/lang/Object."<init>":()V
4: aload_0
5: putstatic #32 // Field MODULE$:Lp1/O$;
8: new #34 // class p1/CC
11: dup
12: invokespecial #35 // Method p1/CC."<init>":()V
15: invokevirtual #38 // Method p1/CC.foo:()V
18: return
```
This commit removes the ACC_FINAL bit from the field. It actually wasn't
behaving as final at all, precisely the issue that the stricter verifier
now alerts us to.
```
scala> :paste -raw
// Entering paste mode (ctrl-D to finish)
package p1; object O
// Exiting paste mode, now interpreting.
scala> val O1 = p1.O
O1: p1.O.type = p1.O$@ee7d9f1
scala> scala.reflect.ensureAccessible(p1.O.getClass.getDeclaredConstructor()).newInstance()
res0: p1.O.type = p1.O$@64cee07
scala> O1 eq p1.O
res1: Boolean = false
```
Fixes scala/scala-dev#SD-194
retronym
referenced
this pull request
in retronym/scala
Aug 8, 2016
Dmitry learned that we've been relying on a bug in the
verifier that will be fixed in JDK 9 under the new
classfile format.
Assignment to a static final must occur lexically
within the <clinit>. We were performing this assignment
from the constructor of the module class.
I'd like to move the assignment to <clinit> but that would
change behaviour of "benign" cyclic references between modules.
Example:
```
package p1; class CC { def foo = O.bar}; object O {new CC().foo; def bar = println(1)};
// Exiting paste mode, now interpreting.
scala> p1.O
1
```
We currently assign the MODULE$ field after the super class constructors are finished,
but before the rest of the module constructor is called.
```
private p1.O$();
Code:
0: aload_0
1: invokespecial #30 // Method java/lang/Object."<init>":()V
4: aload_0
5: putstatic #32 // Field MODULE$:Lp1/O$;
8: new #34 // class p1/CC
11: dup
12: invokespecial #35 // Method p1/CC."<init>":()V
15: invokevirtual #38 // Method p1/CC.foo:()V
18: return
```
This commit removes the ACC_FINAL bit from the field. It actually wasn't
behaving as final at all, precisely the issue that the stricter verifier
now alerts us to.
```
scala> :paste -raw
// Entering paste mode (ctrl-D to finish)
package p1; object O
// Exiting paste mode, now interpreting.
scala> val O1 = p1.O
O1: p1.O.type = p1.O$@ee7d9f1
scala> scala.reflect.ensureAccessible(p1.O.getClass.getDeclaredConstructor()).newInstance()
res0: p1.O.type = p1.O$@64cee07
scala> O1 eq p1.O
res1: Boolean = false
```
Fixes scala/scala-dev#SD-194
retronym
referenced
this pull request
in retronym/scala
Aug 13, 2016
Dmitry learned that we've been relying on a bug in the
verifier that will be fixed in JDK 9 under the new
classfile format.
Assignment to a static final must occur lexically
within the <clinit>. We were performing this assignment
from the constructor of the module class.
I'd like to move the assignment to <clinit> but that would
change behaviour of "benign" cyclic references between modules.
Example:
```
package p1; class CC { def foo = O.bar}; object O {new CC().foo; def bar = println(1)};
// Exiting paste mode, now interpreting.
scala> p1.O
1
```
We currently assign the MODULE$ field after the super class constructors are finished,
but before the rest of the module constructor is called.
```
private p1.O$();
Code:
0: aload_0
1: invokespecial #30 // Method java/lang/Object."<init>":()V
4: aload_0
5: putstatic #32 // Field MODULE$:Lp1/O$;
8: new #34 // class p1/CC
11: dup
12: invokespecial #35 // Method p1/CC."<init>":()V
15: invokevirtual #38 // Method p1/CC.foo:()V
18: return
```
This commit removes the ACC_FINAL bit from the field. It actually wasn't
behaving as final at all, precisely the issue that the stricter verifier
now alerts us to.
```
scala> :paste -raw
// Entering paste mode (ctrl-D to finish)
package p1; object O
// Exiting paste mode, now interpreting.
scala> val O1 = p1.O
O1: p1.O.type = p1.O$@ee7d9f1
scala> scala.reflect.ensureAccessible(p1.O.getClass.getDeclaredConstructor()).newInstance()
res0: p1.O.type = p1.O$@64cee07
scala> O1 eq p1.O
res1: Boolean = false
```
Fixes scala/scala-dev#SD-194
retronym
referenced
this pull request
in retronym/scala
Apr 6, 2017
Non local returns aren't eliminated after inlined in 2.11 or 2.12
```
⚡ scala
Welcome to Scala 2.12.1 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_112).
Type in expressions for evaluation. Or try :help.
scala> @inlune def foo(a: => Any) = if ("".isEmpty) a else ""
<console>:11: error: not found: type inlune
@inlune def foo(a: => Any) = if ("".isEmpty) a else ""
^
scala> @inline def foo(a: => Any) = if ("".isEmpty) a else ""
foo: (a: => Any)Any
scala> class InlineReturn { def test: Any = foo(return "") }
defined class InlineReturn
scala> :javap -c InlineReturn#test
public java.lang.Object test();
Code:
0: new #4 // class java/lang/Object
3: dup
4: invokespecial #32 // Method java/lang/Object."<init>":()V
7: astore_1
8: getstatic #36 // Field $line4/$read$$iw$$iw$.MODULE$:L$line4/$read$$iw$$iw$;
11: aload_1
12: invokedynamic #59, 0 // InvokeDynamic #0:apply:(Ljava/lang/Object;)Lscala/Function0;
17: invokevirtual #63 // Method $line4/$read$$iw$$iw$.foo:(Lscala/Function0;)Ljava/lang/Object;
20: goto 44
23: astore_2
24: aload_2
25: invokevirtual #66 // Method scala/runtime/NonLocalReturnControl.key:()Ljava/lang/Object;
28: aload_1
29: if_acmpne 39
32: aload_2
33: invokevirtual #69 // Method scala/runtime/NonLocalReturnControl.value:()Ljava/lang/Object;
36: goto 41
39: aload_2
40: athrow
41: goto 44
44: areturn
Exception table:
from to target type
8 20 23 Class scala/runtime/NonLocalReturnControl
```
```
⚡ ~/scala/2.11.8/bin/scala
Welcome to Scala 2.11.8 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_112).
Type in expressions for evaluation. Or try :help.
scala> @inline def foo(a: => Any) = if ("".isEmpty) a else ""
foo: (a: => Any)Any
scala> class InlineReturn { def test: Any = foo(return "") }
defined class InlineReturn
scala> :javap -c InlineReturn#test
public java.lang.Object test();
Code:
0: new #4 // class java/lang/Object
3: dup
4: invokespecial #13 // Method java/lang/Object."<init>":()V
7: astore_1
8: getstatic #19 // Field .MODULE$:L;
11: new #21 // class InlineReturn$$anonfun$test$1
14: dup
15: aload_0
16: aload_1
17: invokespecial #24 // Method InlineReturn$$anonfun$test$1."<init>":(LInlineReturn;Ljava/lang/Object;)V
20: invokevirtual #28 // Method .foo:(Lscala/Function0;)Ljava/lang/Object;
23: goto 39
26: astore_2
27: aload_2
28: invokevirtual #31 // Method scala/runtime/NonLocalReturnControl.key:()Ljava/lang/Object;
31: aload_1
32: if_acmpne 40
35: aload_2
36: invokevirtual #34 // Method scala/runtime/NonLocalReturnControl.value:()Ljava/lang/Object;
39: areturn
40: aload_2
41: athrow
Exception table:
from to target type
8 26 26 Class scala/runtime/NonLocalReturnControl
scala> :quit
```
retronym
referenced
this pull request
in retronym/scala
Apr 23, 2017
Non local returns aren't eliminated after inlined in 2.11 or 2.12
```
⚡ scala
Welcome to Scala 2.12.1 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_112).
Type in expressions for evaluation. Or try :help.
scala> @inlune def foo(a: => Any) = if ("".isEmpty) a else ""
<console>:11: error: not found: type inlune
@inlune def foo(a: => Any) = if ("".isEmpty) a else ""
^
scala> @inline def foo(a: => Any) = if ("".isEmpty) a else ""
foo: (a: => Any)Any
scala> class InlineReturn { def test: Any = foo(return "") }
defined class InlineReturn
scala> :javap -c InlineReturn#test
public java.lang.Object test();
Code:
0: new #4 // class java/lang/Object
3: dup
4: invokespecial #32 // Method java/lang/Object."<init>":()V
7: astore_1
8: getstatic #36 // Field $line4/$read$$iw$$iw$.MODULE$:L$line4/$read$$iw$$iw$;
11: aload_1
12: invokedynamic #59, 0 // InvokeDynamic #0:apply:(Ljava/lang/Object;)Lscala/Function0;
17: invokevirtual #63 // Method $line4/$read$$iw$$iw$.foo:(Lscala/Function0;)Ljava/lang/Object;
20: goto 44
23: astore_2
24: aload_2
25: invokevirtual #66 // Method scala/runtime/NonLocalReturnControl.key:()Ljava/lang/Object;
28: aload_1
29: if_acmpne 39
32: aload_2
33: invokevirtual #69 // Method scala/runtime/NonLocalReturnControl.value:()Ljava/lang/Object;
36: goto 41
39: aload_2
40: athrow
41: goto 44
44: areturn
Exception table:
from to target type
8 20 23 Class scala/runtime/NonLocalReturnControl
```
```
⚡ ~/scala/2.11.8/bin/scala
Welcome to Scala 2.11.8 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_112).
Type in expressions for evaluation. Or try :help.
scala> @inline def foo(a: => Any) = if ("".isEmpty) a else ""
foo: (a: => Any)Any
scala> class InlineReturn { def test: Any = foo(return "") }
defined class InlineReturn
scala> :javap -c InlineReturn#test
public java.lang.Object test();
Code:
0: new #4 // class java/lang/Object
3: dup
4: invokespecial #13 // Method java/lang/Object."<init>":()V
7: astore_1
8: getstatic #19 // Field .MODULE$:L;
11: new #21 // class InlineReturn$$anonfun$test$1
14: dup
15: aload_0
16: aload_1
17: invokespecial #24 // Method InlineReturn$$anonfun$test$1."<init>":(LInlineReturn;Ljava/lang/Object;)V
20: invokevirtual #28 // Method .foo:(Lscala/Function0;)Ljava/lang/Object;
23: goto 39
26: astore_2
27: aload_2
28: invokevirtual #31 // Method scala/runtime/NonLocalReturnControl.key:()Ljava/lang/Object;
31: aload_1
32: if_acmpne 40
35: aload_2
36: invokevirtual #34 // Method scala/runtime/NonLocalReturnControl.value:()Ljava/lang/Object;
39: areturn
40: aload_2
41: athrow
Exception table:
from to target type
8 26 26 Class scala/runtime/NonLocalReturnControl
scala> :quit
```
retronym
referenced
this pull request
in retronym/scala
Apr 28, 2017
Non local returns aren't eliminated after inlined in 2.11 or 2.12
```
⚡ scala
Welcome to Scala 2.12.1 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_112).
Type in expressions for evaluation. Or try :help.
scala> @inlune def foo(a: => Any) = if ("".isEmpty) a else ""
<console>:11: error: not found: type inlune
@inlune def foo(a: => Any) = if ("".isEmpty) a else ""
^
scala> @inline def foo(a: => Any) = if ("".isEmpty) a else ""
foo: (a: => Any)Any
scala> class InlineReturn { def test: Any = foo(return "") }
defined class InlineReturn
scala> :javap -c InlineReturn#test
public java.lang.Object test();
Code:
0: new #4 // class java/lang/Object
3: dup
4: invokespecial #32 // Method java/lang/Object."<init>":()V
7: astore_1
8: getstatic #36 // Field $line4/$read$$iw$$iw$.MODULE$:L$line4/$read$$iw$$iw$;
11: aload_1
12: invokedynamic #59, 0 // InvokeDynamic #0:apply:(Ljava/lang/Object;)Lscala/Function0;
17: invokevirtual #63 // Method $line4/$read$$iw$$iw$.foo:(Lscala/Function0;)Ljava/lang/Object;
20: goto 44
23: astore_2
24: aload_2
25: invokevirtual #66 // Method scala/runtime/NonLocalReturnControl.key:()Ljava/lang/Object;
28: aload_1
29: if_acmpne 39
32: aload_2
33: invokevirtual #69 // Method scala/runtime/NonLocalReturnControl.value:()Ljava/lang/Object;
36: goto 41
39: aload_2
40: athrow
41: goto 44
44: areturn
Exception table:
from to target type
8 20 23 Class scala/runtime/NonLocalReturnControl
```
```
⚡ ~/scala/2.11.8/bin/scala
Welcome to Scala 2.11.8 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_112).
Type in expressions for evaluation. Or try :help.
scala> @inline def foo(a: => Any) = if ("".isEmpty) a else ""
foo: (a: => Any)Any
scala> class InlineReturn { def test: Any = foo(return "") }
defined class InlineReturn
scala> :javap -c InlineReturn#test
public java.lang.Object test();
Code:
0: new #4 // class java/lang/Object
3: dup
4: invokespecial #13 // Method java/lang/Object."<init>":()V
7: astore_1
8: getstatic #19 // Field .MODULE$:L;
11: new #21 // class InlineReturn$$anonfun$test$1
14: dup
15: aload_0
16: aload_1
17: invokespecial #24 // Method InlineReturn$$anonfun$test$1."<init>":(LInlineReturn;Ljava/lang/Object;)V
20: invokevirtual #28 // Method .foo:(Lscala/Function0;)Ljava/lang/Object;
23: goto 39
26: astore_2
27: aload_2
28: invokevirtual #31 // Method scala/runtime/NonLocalReturnControl.key:()Ljava/lang/Object;
31: aload_1
32: if_acmpne 40
35: aload_2
36: invokevirtual #34 // Method scala/runtime/NonLocalReturnControl.value:()Ljava/lang/Object;
39: areturn
40: aload_2
41: athrow
Exception table:
from to target type
8 26 26 Class scala/runtime/NonLocalReturnControl
scala> :quit
```
retronym
referenced
this pull request
in retronym/scala
Apr 29, 2017
Non local returns aren't eliminated after inlined in 2.11 or 2.12
```
⚡ scala
Welcome to Scala 2.12.1 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_112).
Type in expressions for evaluation. Or try :help.
scala> @inlune def foo(a: => Any) = if ("".isEmpty) a else ""
<console>:11: error: not found: type inlune
@inlune def foo(a: => Any) = if ("".isEmpty) a else ""
^
scala> @inline def foo(a: => Any) = if ("".isEmpty) a else ""
foo: (a: => Any)Any
scala> class InlineReturn { def test: Any = foo(return "") }
defined class InlineReturn
scala> :javap -c InlineReturn#test
public java.lang.Object test();
Code:
0: new #4 // class java/lang/Object
3: dup
4: invokespecial #32 // Method java/lang/Object."<init>":()V
7: astore_1
8: getstatic #36 // Field $line4/$read$$iw$$iw$.MODULE$:L$line4/$read$$iw$$iw$;
11: aload_1
12: invokedynamic #59, 0 // InvokeDynamic #0:apply:(Ljava/lang/Object;)Lscala/Function0;
17: invokevirtual #63 // Method $line4/$read$$iw$$iw$.foo:(Lscala/Function0;)Ljava/lang/Object;
20: goto 44
23: astore_2
24: aload_2
25: invokevirtual #66 // Method scala/runtime/NonLocalReturnControl.key:()Ljava/lang/Object;
28: aload_1
29: if_acmpne 39
32: aload_2
33: invokevirtual #69 // Method scala/runtime/NonLocalReturnControl.value:()Ljava/lang/Object;
36: goto 41
39: aload_2
40: athrow
41: goto 44
44: areturn
Exception table:
from to target type
8 20 23 Class scala/runtime/NonLocalReturnControl
```
```
⚡ ~/scala/2.11.8/bin/scala
Welcome to Scala 2.11.8 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_112).
Type in expressions for evaluation. Or try :help.
scala> @inline def foo(a: => Any) = if ("".isEmpty) a else ""
foo: (a: => Any)Any
scala> class InlineReturn { def test: Any = foo(return "") }
defined class InlineReturn
scala> :javap -c InlineReturn#test
public java.lang.Object test();
Code:
0: new #4 // class java/lang/Object
3: dup
4: invokespecial #13 // Method java/lang/Object."<init>":()V
7: astore_1
8: getstatic #19 // Field .MODULE$:L;
11: new #21 // class InlineReturn$$anonfun$test$1
14: dup
15: aload_0
16: aload_1
17: invokespecial #24 // Method InlineReturn$$anonfun$test$1."<init>":(LInlineReturn;Ljava/lang/Object;)V
20: invokevirtual #28 // Method .foo:(Lscala/Function0;)Ljava/lang/Object;
23: goto 39
26: astore_2
27: aload_2
28: invokevirtual #31 // Method scala/runtime/NonLocalReturnControl.key:()Ljava/lang/Object;
31: aload_1
32: if_acmpne 40
35: aload_2
36: invokevirtual #34 // Method scala/runtime/NonLocalReturnControl.value:()Ljava/lang/Object;
39: areturn
40: aload_2
41: athrow
Exception table:
from to target type
8 26 26 Class scala/runtime/NonLocalReturnControl
scala> :quit
```
retronym
referenced
this pull request
in retronym/scala
May 23, 2017
Non local returns aren't eliminated after inlined in 2.11 or 2.12
```
⚡ scala
Welcome to Scala 2.12.1 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_112).
Type in expressions for evaluation. Or try :help.
scala> @inlune def foo(a: => Any) = if ("".isEmpty) a else ""
<console>:11: error: not found: type inlune
@inlune def foo(a: => Any) = if ("".isEmpty) a else ""
^
scala> @inline def foo(a: => Any) = if ("".isEmpty) a else ""
foo: (a: => Any)Any
scala> class InlineReturn { def test: Any = foo(return "") }
defined class InlineReturn
scala> :javap -c InlineReturn#test
public java.lang.Object test();
Code:
0: new #4 // class java/lang/Object
3: dup
4: invokespecial #32 // Method java/lang/Object."<init>":()V
7: astore_1
8: getstatic #36 // Field $line4/$read$$iw$$iw$.MODULE$:L$line4/$read$$iw$$iw$;
11: aload_1
12: invokedynamic #59, 0 // InvokeDynamic #0:apply:(Ljava/lang/Object;)Lscala/Function0;
17: invokevirtual #63 // Method $line4/$read$$iw$$iw$.foo:(Lscala/Function0;)Ljava/lang/Object;
20: goto 44
23: astore_2
24: aload_2
25: invokevirtual #66 // Method scala/runtime/NonLocalReturnControl.key:()Ljava/lang/Object;
28: aload_1
29: if_acmpne 39
32: aload_2
33: invokevirtual #69 // Method scala/runtime/NonLocalReturnControl.value:()Ljava/lang/Object;
36: goto 41
39: aload_2
40: athrow
41: goto 44
44: areturn
Exception table:
from to target type
8 20 23 Class scala/runtime/NonLocalReturnControl
```
```
⚡ ~/scala/2.11.8/bin/scala
Welcome to Scala 2.11.8 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0_112).
Type in expressions for evaluation. Or try :help.
scala> @inline def foo(a: => Any) = if ("".isEmpty) a else ""
foo: (a: => Any)Any
scala> class InlineReturn { def test: Any = foo(return "") }
defined class InlineReturn
scala> :javap -c InlineReturn#test
public java.lang.Object test();
Code:
0: new #4 // class java/lang/Object
3: dup
4: invokespecial #13 // Method java/lang/Object."<init>":()V
7: astore_1
8: getstatic #19 // Field .MODULE$:L;
11: new #21 // class InlineReturn$$anonfun$test$1
14: dup
15: aload_0
16: aload_1
17: invokespecial #24 // Method InlineReturn$$anonfun$test$1."<init>":(LInlineReturn;Ljava/lang/Object;)V
20: invokevirtual #28 // Method .foo:(Lscala/Function0;)Ljava/lang/Object;
23: goto 39
26: astore_2
27: aload_2
28: invokevirtual #31 // Method scala/runtime/NonLocalReturnControl.key:()Ljava/lang/Object;
31: aload_1
32: if_acmpne 40
35: aload_2
36: invokevirtual #34 // Method scala/runtime/NonLocalReturnControl.value:()Ljava/lang/Object;
39: areturn
40: aload_2
41: athrow
Exception table:
from to target type
8 26 26 Class scala/runtime/NonLocalReturnControl
scala> :quit
```
szeiger
pushed a commit
to szeiger/scala
that referenced
this pull request
Mar 20, 2018
Update build to publish snapshots
sjrd
pushed a commit
to sjrd/scala
that referenced
this pull request
Aug 19, 2018
Remove compiler dependency on @BeanInfo and @Remote
bishabosha
added a commit
to bishabosha/scala
that referenced
this pull request
Jan 28, 2020
run ci on use merge commit instead
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
-Ydump-classes option is intended to dump the compiler
generated bytecode to the .class files in given directory.
It can be pretty useful for reflective compilation that utilizes
in-memory classloaders, for example to check the files if compiler
produces invalid bytecode. In this case the dump helps to understand what
exactly is wrong with the emitted class.
The option format is -Ydump-classes
.