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

Start using fullOptsJS instead of fastOptJS again #271

Open
olafurpg opened this issue May 28, 2021 · 2 comments
Open

Start using fullOptsJS instead of fastOptJS again #271

olafurpg opened this issue May 28, 2021 · 2 comments

Comments

@olafurpg
Copy link
Member

To unblock the Scala.js v1.0 upgrade, we updated the build to use only fastOptJS instead of fullOptJS. Full optimization was failing with the following error from com.google.javascript.jscomp

sbt:metabrowse> last js / Compile / fullLinkJS
[info] Full optimizing /Users/olafurpg/dev/scalameta/metabrowse/metabrowse-js/target/scala-2.13/metabrowse-js-opt
[debug] Linker: Compute reachability: 1020002 us
[debug] Linker: Assemble LinkedClasses: 97469 us
[debug] Linker: Check IR: 672343 us
[debug] Linker: 1867273 us
[debug] Optimizer: Batch mode: true
[debug] Optimizer: Incremental part: 258541 us
[debug] Optimizer: Optimizing 26648 methods.
[debug] Optimizer: Optimizer part: 2344534 us
[debug] Optimizer: 2616057 us
[debug] Refiner: Compute reachability: 254856 us
[debug] Refiner: Assemble LinkedClasses: 18135 us
[debug] Refiner: 299668 us
[debug] Module Splitter: Calculate Dependency Info: 4730 us
[debug] Module Splitter: Analyze Modules: 1701 us
[debug] Module Splitter: Assemble Modules: 14870 us
[debug] Module Splitter: 22834 us
[debug] Emitter: Generate Classes: 1528297 us
[debug] Emitter: Write trees: 41128 us
[debug] Emitter: Class tree cache stats: reused: 0 -- invalidated: 2685
[debug] Emitter: Method tree cache stats: reused: 0 -- invalidated: 16066
[debug] Emitter: 1658313 us
[debug] Closure: Create trees): 1101883 us
[info] Closure: 0 error(s), 0 warning(s)
[error] java.lang.IllegalStateException
[error] 	at com.google.javascript.jscomp.jarjar.com.google.common.base.Preconditions.checkState(Preconditions.java:492)
[error] 	at com.google.javascript.jscomp.OptimizeParameters.addVariableToFunction(OptimizeParameters.java:995)
[error] 	at com.google.javascript.jscomp.OptimizeParameters.optimizeFunctionDefinition(OptimizeParameters.java:903)
[error] 	at com.google.javascript.jscomp.OptimizeParameters.tryEliminateConstantArgs(OptimizeParameters.java:614)
[error] 	at com.google.javascript.jscomp.OptimizeParameters.process(OptimizeParameters.java:128)
[error] 	at com.google.javascript.jscomp.OptimizeCalls.process(OptimizeCalls.java:125)
[error] 	at com.google.javascript.jscomp.PhaseOptimizer$NamedPass.process(PhaseOptimizer.java:317)
[error] 	at com.google.javascript.jscomp.PhaseOptimizer$Loop.process(PhaseOptimizer.java:462)
[error] 	at com.google.javascript.jscomp.PhaseOptimizer.process(PhaseOptimizer.java:232)
[error] 	at com.google.javascript.jscomp.Compiler.performOptimizations(Compiler.java:2438)
[error] 	at com.google.javascript.jscomp.Compiler.lambda$stage2Passes$1(Compiler.java:808)
[error] 	at com.google.javascript.jscomp.CompilerExecutor.lambda$runInCompilerThread$0(CompilerExecutor.java:101)
[error] 	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
[error] 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
[error] 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
[error] 	at java.lang.Thread.run(Thread.java:748)
[error] (js / Compile / fullLinkJS) java.lang.IllegalStateException

We should figure out what's causing this error and start using fullOptJS again

@alexarchambault
Copy link
Contributor

Oh, that's why tests pass locally for me in https://github.com/scalameta/metabrowse/pull/269…

@viktor-podzigun
Copy link

viktor-podzigun commented Jan 13, 2022

FYI: I've temporarily "fixed" the same error in my project with the following sbt config, to continue generate full opt code:

scalaJSLinkerConfig in fullOptJS ~= {
  _.withOptimizer(false)
}

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

No branches or pull requests

3 participants