Skip to content

New ci #19

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

Closed
wants to merge 6 commits into from
Closed

New ci #19

wants to merge 6 commits into from

Conversation

adriaanm
Copy link
Owner

No description provided.

kanielc and others added 2 commits December 5, 2014 22:24
These two files were missing headers.
There is other work on-going to automate updating of the headers, but
that likely won't crossover with this.
Don't consume literal brace as Scala pattern.

Previously, leading space would let the text parser `xText`
handle it correctly instead.
@adriaanm adriaanm force-pushed the new-ci branch 6 times, most recently from 70407c6 to f725327 Compare January 22, 2015 02:48
SI-5817: Add header to language.scala and languageFeature.scala
SI-5154 Parse leading literal brace in XML pattern
@adriaanm
Copy link
Owner Author

/sync

@adriaanm
Copy link
Owner Author

/rebuild

@adriaanm
Copy link
Owner Author

/synch

@adriaanm
Copy link
Owner Author

/rebuild

@adriaanm adriaanm closed this Jan 30, 2015
adriaanm pushed a commit that referenced this pull request Aug 3, 2015
And do the same for the specialized variants.

Tested by a Java source file that uses lambda syntax to create
instances of generic and specialized `Function{0,1}`.

Here's how the interfaces look now:

```
% javap -c -classpath /tmp/function 'scala.Function1'
Compiled from "Function1.scala"
public interface scala.Function1<T1, R> {
  public abstract R apply(T1);

  public <A> scala.Function1<A, R> compose(scala.Function1<A, T1>);
    Code:
       0: aload_0
       1: aload_1
       2: invokestatic  #18                 // Method scala/Function1$class.compose:(Lscala/Function1;Lscala/Function1;)Lscala/Function1;
       5: areturn

  public <A> scala.Function1<T1, A> andThen(scala.Function1<R, A>);
    Code:
       0: aload_0
       1: aload_1
       2: invokestatic  #24                 // Method scala/Function1$class.andThen:(Lscala/Function1;Lscala/Function1;)Lscala/Function1;
       5: areturn

  public abstract java.lang.String toString();

  public int apply$mcII$sp(int);
    Code:
       0: aload_0
       1: iload_1
       2: invokestatic  scala#110                // Method scala/Function1$class.apply$mcII$sp:(Lscala/Function1;I)I
       5: ireturn

  public long apply$mcJI$sp(int);
    Code:
       0: aload_0
       1: iload_1
       2: invokestatic  scala#115                // Method scala/Function1$class.apply$mcJI$sp:(Lscala/Function1;I)J
       5: lreturn
    ...
}

% javap -c -classpath /tmp/function 'scala.Function1$mcII$sp'
Compiled from "Function1.scala"
public interface scala.Function1$mcII$sp extends scala.Function1<java.lang.Object, java.lang.Object> {
  public java.lang.Object apply(java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: invokestatic  #16                 // Method scala/runtime/BoxesRunTime.unboxToInt:(Ljava/lang/Object;)I
       5: invokeinterface #19,  2           // InterfaceMethod apply:(I)I
      10: invokestatic  #23                 // Method scala/runtime/BoxesRunTime.boxToInteger:(I)Ljava/lang/Integer;
      13: areturn

  public abstract int apply$mcII$sp(int);

  public int apply(int);
    Code:
       0: aload_0
       1: iload_1
       2: invokeinterface scala#30,  2           // InterfaceMethod apply$mcII$sp:(I)I
       7: ireturn
}
```
adriaanm pushed a commit that referenced this pull request Aug 8, 2015
And do the same for the specialized variants.

Tested by a Java source file that uses lambda syntax to create
instances of generic and specialized `Function{0,1}`.

Here's how the interfaces look now:

```
% javap -c -classpath /tmp/function 'scala.Function1'
Compiled from "Function1.scala"
public interface scala.Function1<T1, R> {
  public abstract R apply(T1);

  public <A> scala.Function1<A, R> compose(scala.Function1<A, T1>);
    Code:
       0: aload_0
       1: aload_1
       2: invokestatic  #18                 // Method scala/Function1$class.compose:(Lscala/Function1;Lscala/Function1;)Lscala/Function1;
       5: areturn

  public <A> scala.Function1<T1, A> andThen(scala.Function1<R, A>);
    Code:
       0: aload_0
       1: aload_1
       2: invokestatic  #24                 // Method scala/Function1$class.andThen:(Lscala/Function1;Lscala/Function1;)Lscala/Function1;
       5: areturn

  public abstract java.lang.String toString();

  public int apply$mcII$sp(int);
    Code:
       0: aload_0
       1: iload_1
       2: invokestatic  scala#110                // Method scala/Function1$class.apply$mcII$sp:(Lscala/Function1;I)I
       5: ireturn

  public long apply$mcJI$sp(int);
    Code:
       0: aload_0
       1: iload_1
       2: invokestatic  scala#115                // Method scala/Function1$class.apply$mcJI$sp:(Lscala/Function1;I)J
       5: lreturn
    ...
}

% javap -c -classpath /tmp/function 'scala.Function1$mcII$sp'
Compiled from "Function1.scala"
public interface scala.Function1$mcII$sp extends scala.Function1<java.lang.Object, java.lang.Object> {
  public java.lang.Object apply(java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: invokestatic  #16                 // Method scala/runtime/BoxesRunTime.unboxToInt:(Ljava/lang/Object;)I
       5: invokeinterface #19,  2           // InterfaceMethod apply:(I)I
      10: invokestatic  #23                 // Method scala/runtime/BoxesRunTime.boxToInteger:(I)Ljava/lang/Integer;
      13: areturn

  public abstract int apply$mcII$sp(int);

  public int apply(int);
    Code:
       0: aload_0
       1: iload_1
       2: invokeinterface scala#30,  2           // InterfaceMethod apply$mcII$sp:(I)I
       7: ireturn
}
```
@adriaanm adriaanm deleted the new-ci branch September 2, 2015 23:20
adriaanm pushed a commit that referenced this pull request Sep 2, 2015
And do the same for the specialized variants.

Tested by a Java source file that uses lambda syntax to create
instances of generic and specialized `Function{0,1}`.

Here's how the interfaces look now:

```
% javap -c -classpath /tmp/function 'scala.Function1'
Compiled from "Function1.scala"
public interface scala.Function1<T1, R> {
  public abstract R apply(T1);

  public <A> scala.Function1<A, R> compose(scala.Function1<A, T1>);
    Code:
       0: aload_0
       1: aload_1
       2: invokestatic  #18                 // Method scala/Function1$class.compose:(Lscala/Function1;Lscala/Function1;)Lscala/Function1;
       5: areturn

  public <A> scala.Function1<T1, A> andThen(scala.Function1<R, A>);
    Code:
       0: aload_0
       1: aload_1
       2: invokestatic  #24                 // Method scala/Function1$class.andThen:(Lscala/Function1;Lscala/Function1;)Lscala/Function1;
       5: areturn

  public abstract java.lang.String toString();

  public int apply$mcII$sp(int);
    Code:
       0: aload_0
       1: iload_1
       2: invokestatic  scala#110                // Method scala/Function1$class.apply$mcII$sp:(Lscala/Function1;I)I
       5: ireturn

  public long apply$mcJI$sp(int);
    Code:
       0: aload_0
       1: iload_1
       2: invokestatic  scala#115                // Method scala/Function1$class.apply$mcJI$sp:(Lscala/Function1;I)J
       5: lreturn
    ...
}

% javap -c -classpath /tmp/function 'scala.Function1$mcII$sp'
Compiled from "Function1.scala"
public interface scala.Function1$mcII$sp extends scala.Function1<java.lang.Object, java.lang.Object> {
  public java.lang.Object apply(java.lang.Object);
    Code:
       0: aload_0
       1: aload_1
       2: invokestatic  #16                 // Method scala/runtime/BoxesRunTime.unboxToInt:(Ljava/lang/Object;)I
       5: invokeinterface #19,  2           // InterfaceMethod apply:(I)I
      10: invokestatic  #23                 // Method scala/runtime/BoxesRunTime.boxToInteger:(I)Ljava/lang/Integer;
      13: areturn

  public abstract int apply$mcII$sp(int);

  public int apply(int);
    Code:
       0: aload_0
       1: iload_1
       2: invokeinterface scala#30,  2           // InterfaceMethod apply$mcII$sp:(I)I
       7: ireturn
}
```
adriaanm pushed a commit that referenced this pull request Jun 10, 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 scala#32                 // Method java/lang/Object."<init>":()V
       7: astore_1
       8: getstatic     scala#36                 // Field $line4/$read$$iw$$iw$.MODULE$:L$line4/$read$$iw$$iw$;
      11: aload_1
      12: invokedynamic scala#59,  0             // InvokeDynamic #0:apply:(Ljava/lang/Object;)Lscala/Function0;
      17: invokevirtual scala#63                 // Method $line4/$read$$iw$$iw$.foo:(Lscala/Function0;)Ljava/lang/Object;
      20: goto          44
      23: astore_2
      24: aload_2
      25: invokevirtual scala#66                 // Method scala/runtime/NonLocalReturnControl.key:()Ljava/lang/Object;
      28: aload_1
      29: if_acmpne     39
      32: aload_2
      33: invokevirtual scala#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 scala#28                 // Method .foo:(Lscala/Function0;)Ljava/lang/Object;
      23: goto          39
      26: astore_2
      27: aload_2
      28: invokevirtual scala#31                 // Method scala/runtime/NonLocalReturnControl.key:()Ljava/lang/Object;
      31: aload_1
      32: if_acmpne     40
      35: aload_2
      36: invokevirtual scala#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
```
SethTisue pushed a commit that referenced this pull request Apr 25, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants