codespecs / daikon

Dynamic detection of likely invariants
http://plse.cs.washington.edu/daikon/
Other
214 stars 54 forks source link

Daikon crash on some benchmarks in NJR dataset #549

Open nimakarimipour opened 2 months ago

nimakarimipour commented 2 months ago

Environment

Daikon Version: 5.8.20 OS Version: Mac OS 14.5 (Sonoma) Java Version: 11

Steps followed to install Daikon

wget http://plse.cs.washington.edu/daikon/download/daikon-5.8.20.tar.gz
export DAIKONDIR=daikonparentpath/daikon-5.8.20
source $DAIKONDIR/scripts/daikon.bashrc
make -C $DAIKONDIR rebuild-everything
make -C $DAIKONDIR/java dcomp_rt.jar

Daikon crashes on few benchmarks in NJR dataset. A common type of crash among them appears in the form below, though there are other types of crashes as well.

Exception in thread "main" java.lang.AssertionError: not comparable this.x 
com.example.Foo at ppt ...:::OBJECT
        at daikon.inv.Equality.<init>(Equality.java:122)

I extracted a benchmark from those on which Daikon crashed and created a repository. You can run Daikon by executing daikon.sh, provided you have followed the installation steps mentioned above. You can find it here.

In the repository you can find the source code under benchmark/src and the jar file under benchmark/jarfile. The provided script in the repository (daikon.sh) will run daikon on the created jar from the sources.

Please find the commands I used to execute dailkon:

#!/bin/bash
current_dir=$(pwd)
java -cp $current_dir/benchmark/jarfile/AMD64ExecutionEngine.jar:$DAIKONDIR/daikon.jar daikon.DynComp edu.syr.bytecast.interp.amd64.AMD64ExecutionEngine 
java -cp $current_dir/benchmark/jarfile/AMD64ExecutionEngine.jar:$DAIKONDIR/daikon.jar daikon.Chicory --daikon --comparability-file=AMD64ExecutionEngine.decls-DynComp edu.syr.bytecast.interp.amd64.AMD64ExecutionEngine 

Full output of running daikon:

Running the program under the control of DynComp
4
Running the program under the control of the Chicory front
4
Daikon version 5.8.20, released May 14, 2024; http://plse.cs.washington.edu/daikon.
Reading declaration files Processing trace data; reading 1 dtrace file:

Exception in thread "main" java.lang.AssertionError: not comparable this.m_base edu.syr.bytecast.amd64.api.constants.RegisterType.RBP at ppt edu.syr.bytecast.amd64.api.constants.OperandTypeMemoryEffectiveAddress:::OBJECT
        at daikon.inv.Equality.<init>(Equality.java:122)
        at daikon.PptSliceEquality.instantiate_from_pairs(PptSliceEquality.java:234)
        at daikon.PptTopLevel.mergeInvs(PptTopLevel.java:3787)
        at daikon.Daikon.createUpperPpts(Daikon.java:1813)
        at daikon.Daikon.process_data(Daikon.java:2445)
        at daikon.Daikon.mainHelper(Daikon.java:801)
        at daikon.Daikon.main(Daikon.java:679)

Please let me know if I made a mistake in running daikon on the jar or this is an unexpected behavior from Daikon.

Best

markro49 commented 2 months ago

I was able to reproduce your problem - but there is a very simple work around. Don't use the '--daikon' option for Chicory and run Daikon as a separate step:

java -cp benchmark/jarfile/AMD64ExecutionEngine.jar:$DAIKONDIR/daikon.jar daikon.DynComp edu.syr.bytecast.interp.amd64.AMD64ExecutionEngine

java -cp benchmark/jarfile/AMD64ExecutionEngine.jar:$DAIKONDIR/daikon.jar daikon.Chicory --comparability-file=AMD64ExecutionEngine.decls-DynComp edu.syr.bytecast.interp.amd64.AMD64ExecutionEngine

java -cp benchmark/jarfile/AMD64ExecutionEngine.jar:$DAIKONDIR/daikon.jar daikon.Daikon AMD64ExecutionEngine.dtrace.gz

nimakarimipour commented 2 months ago

@markro49 Thank you very much, really helpful. Your suggested solution worked for me. Please let me know if I should close this issue.