Skip to content
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

Remove -Ystruct-dispatch and associated (unused/untested) code #7492

Closed
scabug opened this issue May 17, 2013 · 2 comments
Closed

Remove -Ystruct-dispatch and associated (unused/untested) code #7492

scabug opened this issue May 17, 2013 · 2 comments

Comments

@scabug
Copy link

scabug commented May 17, 2013

There doesn't seem to exist a single test for these different structural dispatch implementations. no-cache and mono-cache seem to work (only did some superficial testing), but invoke-dynamic fails:

scala -Ystruct-dispatch:invoke-dynamic
Welcome to Scala version 2.11.0-20130424-145255-b291e28c75 (OpenJDK 64-Bit Server VM, Java 1.7.0_21).
Type in expressions to have them evaluated.
Type :help for more information.

scala> type Foo = AnyRef { def foo: Int }
defined type alias Foo

scala> def getFoo(foo: Foo) = foo.foo
error:
     while compiling: <console>
        during phase: icode
     library version: version 2.11.0-20130424-145255-b291e28c75
    compiler version: version 2.11.0-20130424-145255-b291e28c75
  reconstructed args: -Ystruct-dispatch:invoke-dynamic

  last tree to typer: ApplyDynamic(method foo)
              symbol: method foo (flags: <method> <deferred> <triedcooking>)
   symbol definition: def foo(): Int
                 tpe: Int
       symbol owners: method foo -> $line4 -> package $line4
      context owners: object iw -> package $line5

== Enclosing template or block ==

Template( // val <local $iw>: <notype>, tree.tpe=type
  "java.lang.Object" // parents
  ValDef(
    private
    "_"
    <tpt>
    <empty>
  )
  DefDef( // def <init>(): type
    <method>
    "<init>"
    []
    List(Nil)
    <tpt> // tree.tpe=type
    Block( // tree.tpe=Unit
      Apply( // def <init>(): Object in class Object, tree.tpe=Object
        iw.super."<init>" // def <init>(): Object in class Object, tree.tpe=()Object
        Nil
      )
      ()
    )
  )
)

== Expanded type of tree ==

TypeRef(TypeSymbol(final abstract class Int extends ))

uncaught exception during compilation: RuntimeException("No invokedynamic support yet.") @ scala.sys.package$.error(package.scala:27)
java.lang.RuntimeException: No invokedynamic support yet.
    at scala.sys.package$.error(package.scala:27)
    at scala.tools.nsc.backend.icode.GenICode$ICodePhase.scala$tools$nsc$backend$icode$GenICode$ICodePhase$$genLoad(GenICode.scala:815)
    at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:122)
    at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:70)
    at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:147)
    at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:97)
    at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:70)
    at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:88)
    at scala.tools.nsc.backend.icode.GenICode$ICodePhase.gen(GenICode.scala:66)
    at scala.tools.nsc.backend.icode.GenICode$ICodePhase.apply(GenICode.scala:62)
    at scala.tools.nsc.Global$GlobalPhase.applyPhase(Global.scala:413)
    at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:380)
    at scala.tools.nsc.Global$GlobalPhase$$anonfun$run$1.apply(Global.scala:380)
    at scala.collection.Iterator$class.foreach(Iterator.scala:743)
    at scala.collection.AbstractIterator.foreach(Iterator.scala:1174)
    at scala.tools.nsc.Global$GlobalPhase.run(Global.scala:380)
    at scala.tools.nsc.backend.icode.GenICode$ICodePhase.run(GenICode.scala:55)
    at scala.tools.nsc.Global$Run.compileUnitsInternal(Global.scala:1518)
    at scala.tools.nsc.Global$Run.compileUnits(Global.scala:1493)
    at scala.tools.nsc.Global$Run.compileSources(Global.scala:1489)
    at scala.tools.nsc.interpreter.IMain.compileSourcesKeepingRun(IMain.scala:408)
    at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.compileAndSaveRun(IMain.scala:820)
    at scala.tools.nsc.interpreter.IMain$ReadEvalPrint.compile(IMain.scala:779)
    at scala.tools.nsc.interpreter.IMain$Request.compile$lzycompute(IMain.scala:924)
    at scala.tools.nsc.interpreter.IMain$Request.compile(IMain.scala:919)
    at scala.tools.nsc.interpreter.IMain.compile(IMain.scala:550)
    at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:538)
    at scala.tools.nsc.interpreter.IMain.interpret(IMain.scala:536)
    at scala.tools.nsc.interpreter.ILoop.reallyInterpret$1(ILoop.scala:566)
    at scala.tools.nsc.interpreter.ILoop.interpretStartingWith(ILoop.scala:611)
    at scala.tools.nsc.interpreter.ILoop.command(ILoop.scala:523)
    at scala.tools.nsc.interpreter.ILoop.processLine(ILoop.scala:379)
    at scala.tools.nsc.interpreter.ILoop.loop(ILoop.scala:396)
    at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply$mcZ$sp(ILoop.scala:679)
    at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply(ILoop.scala:665)
    at scala.tools.nsc.interpreter.ILoop$$anonfun$process$1.apply(ILoop.scala:665)
    at scala.tools.nsc.util.ScalaClassLoader$.savingContextLoader(ScalaClassLoader.scala:95)
    at scala.tools.nsc.interpreter.ILoop.process(ILoop.scala:665)
    at scala.tools.nsc.MainGenericRunner.runTarget$1(MainGenericRunner.scala:80)
    at scala.tools.nsc.MainGenericRunner.process(MainGenericRunner.scala:93)
    at scala.tools.nsc.MainGenericRunner$.main(MainGenericRunner.scala:102)
    at scala.tools.nsc.MainGenericRunner.main(MainGenericRunner.scala)

That entry seems to have slain the compiler.  Shall I replay
your session? I can re-run each line except the last one.
[y/n]

I think we should reduce the amount of options. I have never seen an issue were someone told the mailing list “I have issue X” and the answer was “Use a different setting for -Ystruct-dispatch”.

And in the future, it makes more sense to merge this decision into the backend (so that the backend which targets Java 6 uses reflection and the backend which targets Java 8 uses invokedynamic).

@scabug
Copy link
Author

scabug commented May 17, 2013

Imported From: https://issues.scala-lang.org/browse/SI-7492?orig=1
Reporter: @soc
Affected Versions: 2.11.0-M2

@scabug
Copy link
Author

scabug commented May 17, 2013

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

2 participants