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

infinite loop in the inliner #4579

Closed
scabug opened this issue May 14, 2011 · 9 comments
Closed

infinite loop in the inliner #4579

scabug opened this issue May 14, 2011 · 9 comments
Assignees
Milestone

Comments

@scabug
Copy link

scabug commented May 14, 2011

Is test-opt no longer a jenkins tested target? On my machine, this never terminates, including with 2.9.0 final.

  scalac -optimise ./test/files/run/lisp.scala 

Here's where it stops producing output under -Ylog:all:

[log parser] parsing ScalaRunTime$$$$anonfun$$inner$$1$$5.class
[log inliner] Inlining scala.runtime.ScalaRunTime.inlinedEquals in LispAny.asBoolean at pos: 9620
[log inliner] Analyzing LispAny.asBoolean count 0 with 15 blocks
[log inliner]  LispAny.asBoolean blocks before inlining: 4 (13) after: 13 (44)
[log inliner] Analyzing LispAny.normalize count 0 with 105 blocks

And if you wait long enough:

Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
	at scala.tools.nsc.util.HashSet.growTable(HashSet.scala:98)
	at scala.tools.nsc.util.HashSet.findEntryOrUpdate(HashSet.scala:40)
	at scala.tools.nsc.symtab.Types$$class.scala$$tools$$nsc$$symtab$$Types$$$$unique(Types.scala:2891)
	at scala.tools.nsc.symtab.Types$$TypeRef$$.apply(Types.scala:1948)
	at scala.tools.nsc.symtab.Types$$class.typeRef(Types.scala:2677)
	at scala.tools.nsc.symtab.SymbolTable.typeRef(SymbolTable.scala:13)
	at scala.tools.nsc.symtab.Types$$SubstSymMap.toType(Types.scala:3482)
	at scala.tools.nsc.symtab.Types$$SubstSymMap.toType(Types.scala:3480)
	at scala.tools.nsc.symtab.Types$$SubstMap.subst(Types.scala:3435)
	at scala.tools.nsc.symtab.Types$$SubstMap.apply(Types.scala:3470)

A look at the method it is analyzing might tempt one to implicate the pattern matcher, and one might be right, but I'm attaching -Xprint:expl, which looks well normal range.

def normalize(x: Data): Data = x match {
  case CONS(SYM("def"),
         CONS(CONS(SYM(name), args), CONS(body, CONS(expr, NIL())))) =>
    normalize(list(SYM("def"),
      SYM(name), list(SYM("lambda"), args, body), expr))
  case CONS(SYM("cond"), CONS(CONS(SYM("else"), CONS(expr, NIL())),NIL())) =>
    normalize(expr)
  case CONS(SYM("cond"), CONS(CONS(test, CONS(expr, NIL())), rest)) =>
    normalize(list(SYM("if"), test, expr, CONS(SYM("cond"), rest)))
  case CONS(h, t) => CONS(normalize(h), normalize(t))
  case _ => x
}
@scabug
Copy link
Author

scabug commented May 14, 2011

Imported From: https://issues.scala-lang.org/browse/SI-4579?orig=1
Reporter: @paulp
Other Milestones: 2.10.0
Attachments:

  • normalize.txt (created on May 14, 2011 2:43:06 PM UTC, 10579 bytes)

@scabug
Copy link
Author

scabug commented May 14, 2011

@paulp said:
-Xprint:expl

@scabug
Copy link
Author

scabug commented May 14, 2011

Trond Olsen (tolsen77) said:
Looks similar to the problem with pattern matching with lists I reported in #4576.

@scabug
Copy link
Author

scabug commented May 17, 2011

@dragos said:
Seem related to the fix to #2171. I bet it's a catch 22.

@scabug
Copy link
Author

scabug commented May 27, 2012

@retronym said:
This was fixed between 2.10.0-M1 and 2.10.0-M2. I'm not game to move this test out of disabled, but I'm going to close this regardless.

@scabug scabug closed this as completed May 27, 2012
@scabug
Copy link
Author

scabug commented May 27, 2012

@ijuma said:
I don't understand. If it is fixed and we have a test, we should move it out of disabled before closing the ticket, no?

@scabug
Copy link
Author

scabug commented May 27, 2012

@paulp said:
I think it's because I've broken the build half a dozen times by trying to enable the lisp test.

@scabug
Copy link
Author

scabug commented May 27, 2012

@retronym said:
Right you are; we should be able to add it as a pos test, even if it isn't stable enough as a run test.

scala/scala#634

@scabug
Copy link
Author

scabug commented May 27, 2012

@ijuma said:
Fair enough. :)

@scabug scabug added this to the 2.10.0-M3 milestone Apr 7, 2017
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