ponder-lab / Optimize-Java-8-Streams-Refactoring

Refactorings for optimizing Java 8 stream client code for greater parallelism and efficiency.
http://cuny.is/streams
Eclipse Public License 1.0
8 stars 7 forks source link

Got UnknownIfReduceOrderMattersException while evaluating doma2 #167

Closed yiming-tang-cs closed 6 years ago

yiming-tang-cs commented 6 years ago

I got

Unable to derive ROM for : parameter.keySet().stream()
edu.cuny.hunter.streamrefactoring.core.analysis.UnknownIfReduceOrderMattersException: Cannot decifer whether ordering matters for method: < Application, Ljava/util/stream/Stream, collect(Ljava/util/stream/Collector;)Ljava/lang/Object; >
    at edu.cuny.hunter.streamrefactoring.core.analysis.StreamStateMachine.deriveRomForScalarMethod(StreamStateMachine.java:282)
    at edu.cuny.hunter.streamrefactoring.core.analysis.StreamStateMachine.discoverIfReduceOrderingPossiblyMatters(StreamStateMachine.java:700)
    at edu.cuny.hunter.streamrefactoring.core.analysis.StreamStateMachine.start(StreamStateMachine.java:1108)
    at edu.cuny.hunter.streamrefactoring.core.analysis.StreamAnalyzer.analyze(StreamAnalyzer.java:158)
    at edu.cuny.hunter.streamrefactoring.core.refactorings.ConvertToParallelStreamRefactoringProcessor.checkFinalConditions(ConvertToParallelStreamRefactoringProcessor.java:220)
    at org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring.checkFinalConditions(ProcessorBasedRefactoring.java:222)
    at org.eclipse.ltk.core.refactoring.Refactoring.checkAllConditions(Refactoring.java:162)
    at edu.cuny.hunter.streamrefactoring.eval.handlers.EvaluateConvertToParallelStreamRefactoringHandler.lambda$0(EvaluateConvertToParallelStreamRefactoringHandler.java:257)
    at org.eclipse.core.runtime.jobs.Job$1.run(Job.java:161)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:56)

while evaluating doma2: https://github.com/domaframework/doma

My version is 2.19.1 and SHA-1 is ff49766.

I set values of three options (test, benchmark and main method) are all true. It should take long time before getting the exception.

yiming-tang-cs commented 6 years ago

The project could be built on command line:

C:\Users\tangy\Experiments\doma>gradlew build
Downloading http://services.gradle.org/distributions/gradle-2.0-bin.zip
.........................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................................
Unzipping C:\Users\tangy\.gradle\wrapper\dists\gradle-2.0-bin\34ooqmq1urnnhvpv2dlmidjcrc\gradle-2.0-bin.zip to C:\Users\tangy\.gradle\wrapper\dists\gradle-2.0-bin\34ooqmq1urnnhvpv2dlmidjcrc
:compileJava
:compileGroovy UP-TO-DATE
:processResources
:classes
:jar
:javadoc
:javadocJar
:sourcesJar
:signArchives SKIPPED
:assemble
:compileTestJava
:compileTestGroovy UP-TO-DATE
:processTestResources
:testClasses
:test
:check
:install
:build

BUILD SUCCESSFUL

I imported this project by Existing gradle projects, but there are 2 errors about encode problems (because of some Japanese characters). Then, I changed them into common characters.

After that, I can run the tool.

khatchad commented 6 years ago

How many entry points?

khatchad commented 6 years ago

DOMO is a framework. Probably there's no main method, and the junit test methods don't work well.

khatchad commented 6 years ago

Can you just try main method entry points?

khatchad commented 6 years ago

I'm also pretty sure that exception is caught.

yiming-tang-cs commented 6 years ago

How many entry points?

More than 274. The console cannot show all entry points.

yiming-tang-cs commented 6 years ago

Can you just try main method entry points?

The result is:

WARNING: Project: doma has no entry points.

The result.csv:

subject SLOC #entrypoints #streams #optimization available streams #optimizable streams #failed preconditions CONVERT_SEQUENTIAL_STREAM_TO_PARALLEL OPTIMIZE_PARALLEL_STREAM P1 P2 P3 P4 P5 CONVERT_TO_PARALLEL UNORDER CONVERT_TO_SEQUENTIAL time (s)
doma 0 0 23 0 0 0 0 0 0 0 0 0 0 0 0 0 3.402
khatchad commented 6 years ago

That makes sense because it is a framework, so you'll have to use the test entry points if you want to use it. The stack trace you have above is just a log. The exception is caught, so it wouldn't be the cause of a crash.

khatchad commented 6 years ago

274 is quite a lot though. So, if it is taking too long to complete, may be best to skip.

khatchad commented 6 years ago

How long does it take? And, are you sure the tool is not crashing?

khatchad commented 6 years ago

If it is crashing, that isn't the reason.

yiming-tang-cs commented 6 years ago

It takes almost one hour. I think the tool is crashing because the result in csv file is incomplete.

subject SLOC #entrypoints #streams #optimization available streams #optimizable streams #failed preconditions CONVERT_SEQUENTIAL_STREAM_TO_PARALLEL OPTIMIZE_PARALLEL_STREAM P1 P2 P3 P4 P5 CONVERT_TO_PARALLEL UNORDER CONVERT_TO_SEQUENTIAL time (s)
doma 0
khatchad commented 6 years ago

Yes, certainly seems so. Probably best to skip this one.

khatchad commented 6 years ago

I just got one similar to this, but it's uncaught:

!ENTRY org.eclipse.jdt.ui 4 10001 2018-01-27 01:25:43.270
!MESSAGE Internal Error
!STACK 0
java.lang.IllegalStateException: Can't decipher ROM for method: < Application, Ljava/util/stream/Stream, collect(Ljava/util/stream/Collector;)Ljava/lang/Object; >
        at edu.cuny.hunter.streamrefactoring.core.analysis.StreamStateMachine.deriveRomForVoidMethod(StreamStateMachine.java:297)
        at edu.cuny.hunter.streamrefactoring.core.analysis.StreamStateMachine.discoverIfReduceOrderingPossiblyMatters(StreamStateMachine.java:695)
        at edu.cuny.hunter.streamrefactoring.core.analysis.StreamStateMachine.start(StreamStateMachine.java:1108)
        at edu.cuny.hunter.streamrefactoring.core.analysis.StreamAnalyzer.analyze(StreamAnalyzer.java:158)
        at edu.cuny.hunter.streamrefactoring.core.refactorings.ConvertToParallelStreamRefactoringProcessor.checkFinalConditions(ConvertToParallelStreamRefactoringProcessor.java:220)
        at org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring.checkFinalConditions(ProcessorBasedRefactoring.java:222)
        at org.eclipse.ltk.core.refactoring.Refactoring.checkAllConditions(Refactoring.java:162)
        at edu.cuny.hunter.streamrefactoring.eval.handlers.EvaluateConvertToParallelStreamRefactoringHandler.lambda$0(EvaluateConvertToParallelStreamRefactoringHandler.java:257)
        at org.eclipse.core.runtime.jobs.Job$1.run(Job.java:161)
        at org.eclipse.core.internal.jobs.Worker.run(Worker.java:56)

!ENTRY edu.cuny.hunter.streamrefactoring.eval 4 0 2018-01-27 01:25:43.278
!MESSAGE Encountered exception during evaluation
!STACK 0
java.lang.IllegalStateException: Can't decipher ROM for method: < Application, Ljava/util/stream/Stream, collect(Ljava/util/stream/Collector;)Ljava/lang/Object; >
        at edu.cuny.hunter.streamrefactoring.core.analysis.StreamStateMachine.deriveRomForVoidMethod(StreamStateMachine.java:297)
        at edu.cuny.hunter.streamrefactoring.core.analysis.StreamStateMachine.discoverIfReduceOrderingPossiblyMatters(StreamStateMachine.java:695)
        at edu.cuny.hunter.streamrefactoring.core.analysis.StreamStateMachine.start(StreamStateMachine.java:1108)
        at edu.cuny.hunter.streamrefactoring.core.analysis.StreamAnalyzer.analyze(StreamAnalyzer.java:158)
        at edu.cuny.hunter.streamrefactoring.core.refactorings.ConvertToParallelStreamRefactoringProcessor.checkFinalConditions(ConvertToParallelStreamRefactoringProcessor.java:220)
        at org.eclipse.ltk.core.refactoring.participants.ProcessorBasedRefactoring.checkFinalConditions(ProcessorBasedRefactoring.java:222)
        at org.eclipse.ltk.core.refactoring.Refactoring.checkAllConditions(Refactoring.java:162)
        at edu.cuny.hunter.streamrefactoring.eval.handlers.EvaluateConvertToParallelStreamRefactoringHandler.lambda$0(EvaluateConvertToParallelStreamRefactoringHandler.java:257)
        at org.eclipse.core.runtime.jobs.Job$1.run(Job.java:161)
        at org.eclipse.core.internal.jobs.Worker.run(Worker.java:56)
khatchad commented 6 years ago

Fixed in 7f9e14f91e70e84350f5cb5a66d4d73421212401.