Skip to content

Passing -optimise currently overrides -Ybackend:GenBCode and enables GenASM #9

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
retronym opened this issue Aug 5, 2015 · 0 comments

Comments

@retronym
Copy link
Member

retronym commented Aug 5, 2015

This should not be the case. There should be a warning when using -Ybackend:GenBCode and -optimise together.

@retronym retronym closed this as completed Aug 5, 2015
@lrytz lrytz changed the title [CLOSED] Passing -optimise currently overrides -Ybackend:GenBCode and enables GenASM Passing -optimise currently overrides -Ybackend:GenBCode and enables GenASM Aug 10, 2015
retronym added a commit that referenced this issue Aug 24, 2015
Calls to synthetic case class apply methods are inlined to the
underlying constructor invocation in refchecks.

However, this can lead to accessibility errors if the constructor
is private.

This commit ensures that the constructor is at least as accessible
as the apply method before performing this tranform.

I've manually checked that other the optimization still works in other
cases:

scala> class CaseApply { Some(42)  }
defined class CaseApply

    scala> :javap -c CaseApply
    Compiled from "<console>"
    public class CaseApply {
      public CaseApply();
        Code:
           0: aload_0
           1: invokespecial #9                  // Method java/lang/Object."<init>":()V
           4: new           #11                 // class scala/Some
           7: dup
           8: bipush        42
          10: invokestatic  #17                 // Method scala/runtime/BoxesRunTime.boxToInteger:(I)Ljava/lang/Integer;
          13: invokespecial #20                 // Method scala/Some."<init>":(Ljava/lang/Object;)V
          16: pop
          17: return
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant