├── .github └── workflows │ ├── apidocs.yml │ └── ci.yml ├── .gitignore ├── .pylintrc ├── LICENSE ├── Makefile ├── README.md ├── RELEASING.md ├── bin ├── .gitignore ├── jqf-afl-cmin ├── jqf-afl-cmin-py ├── jqf-afl-fuzz ├── jqf-afl-showmap ├── jqf-afl-target ├── jqf-ei ├── jqf-random ├── jqf-repro └── jqf-zest ├── examples ├── fen.txt ├── pom.xml └── src │ ├── main │ └── java │ │ └── edu │ │ └── berkeley │ │ └── cs │ │ └── jqf │ │ └── examples │ │ ├── algs4 │ │ └── BoyerMoore.java │ │ ├── bcel │ │ ├── FieldGenerator.java │ │ ├── JavaClassGenerator.java │ │ ├── JavaClassNameGenerator.java │ │ ├── JavaIdentifierGenerator.java │ │ ├── MethodGenerator.java │ │ └── TypeGenerator.java │ │ ├── chess │ │ └── FENGenerator.java │ │ ├── chocopy │ │ └── ChocoPySemanticGenerator.java │ │ ├── common │ │ ├── AlphaStringGenerator.java │ │ ├── ArbitraryLengthStringGenerator.java │ │ ├── AsciiStringGenerator.java │ │ ├── Dictionary.java │ │ ├── DictionaryBackedStringGenerator.java │ │ └── FixedSize.java │ │ ├── guava │ │ └── CacheRequestsGenerator.java │ │ ├── imageio │ │ └── ImageInputStreamGenerator.java │ │ ├── jgrapht │ │ ├── BitSetBasedSimpleGraphGenerator.java │ │ ├── FastGnmRandomGraphGenerator.java │ │ ├── GraphModel.java │ │ ├── ModelBasedDirectedGraphGenerator.java │ │ ├── ModelBasedGraphGenerator.java │ │ └── Renderer.java │ │ ├── js │ │ └── JavaScriptCodeGenerator.java │ │ ├── kaitai │ │ ├── AbstractKaitaiGenerator.java │ │ ├── KaitaiStream.java │ │ ├── KaitaiStruct.java │ │ └── PngKaitaiGenerator.java │ │ ├── trees │ │ ├── BinaryTree.java │ │ ├── RedBlackBST.java │ │ ├── RedBlackBSTGenerator.java │ │ ├── RedBlackBSTNode.java │ │ └── RedBlackBSTNodeGenerator.java │ │ └── xml │ │ ├── XMLDocumentUtils.java │ │ └── XmlDocumentGenerator.java │ └── test │ ├── crashes │ ├── kitty.crash │ └── kitty.hang │ ├── java │ ├── edu │ │ └── berkeley │ │ │ └── cs │ │ │ └── jqf │ │ │ └── examples │ │ │ ├── ConstructorExceptionTest.java │ │ │ ├── MultiThreadedTest.java │ │ │ ├── RobustnessTest.java │ │ │ ├── TraceEventTest.java │ │ │ ├── algs4 │ │ │ └── StringSearchTest.java │ │ │ ├── ant │ │ │ └── ProjectBuilderTest.java │ │ │ ├── bcel │ │ │ └── ParserTest.java │ │ │ ├── chess │ │ │ ├── FENTest.java │ │ │ └── MoveTest.java │ │ │ ├── chocopy │ │ │ └── SemanticAnalysisTest.java │ │ │ ├── closure │ │ │ └── CompilerTest.java │ │ │ ├── commons │ │ │ ├── CompressTest.java │ │ │ ├── DecompressTest.java │ │ │ ├── HashedMapTest.java │ │ │ ├── MathTest.java │ │ │ └── PatriciaTrieTest.java │ │ │ ├── errorprone │ │ │ └── CompilerTest.java │ │ │ ├── gson │ │ │ └── JsonTest.java │ │ │ ├── guava │ │ │ └── CacheEvictionTest.java │ │ │ ├── imageio │ │ │ ├── GifReaderTest.java │ │ │ ├── JpegReaderTest.java │ │ │ └── PngReaderTest.java │ │ │ ├── jackson │ │ │ └── JsonTest.java │ │ │ ├── jdk │ │ │ ├── DateFormatterTest.java │ │ │ ├── HashTest.java │ │ │ ├── MultiThreadedTest.java │ │ │ ├── RegexTest.java │ │ │ ├── SetsTest.java │ │ │ ├── SortTest.java │ │ │ └── URLTest.java │ │ │ ├── jgrapht │ │ │ ├── CyclesTest.java │ │ │ ├── DirectedGraphTest.java │ │ │ ├── LayoutTest.java │ │ │ ├── ShortestPathTest.java │ │ │ ├── SimpleGraphTest.java │ │ │ ├── SpanningTreeTest.java │ │ │ └── WeightedGraphTest.java │ │ │ ├── maven │ │ │ └── ModelReaderTest.java │ │ │ ├── rhino │ │ │ └── CompilerTest.java │ │ │ ├── simple │ │ │ ├── SimpleClass.java │ │ │ └── SimpleClassTest.java │ │ │ ├── tika │ │ │ └── TikaParserTest.java │ │ │ ├── tomcat │ │ │ ├── HeadersTest.java │ │ │ ├── ParametersTest.java │ │ │ └── WebXmlTest.java │ │ │ └── trees │ │ │ ├── BinaryTreeTest.java │ │ │ └── RedBlackBSTTest.java │ └── org │ │ └── apache │ │ ├── bcel │ │ └── verifier │ │ │ └── StatelessVerifierFactory.java │ │ └── coyote │ │ └── http11 │ │ └── HeaderParser.java │ ├── resources │ ├── META-INF │ │ └── services │ │ │ └── com.pholser.junit.quickcheck.generator.Generator │ └── dictionaries │ │ ├── ant-project-afl.dict │ │ ├── ant-project.dict │ │ ├── fen.dict │ │ ├── javaclass.dict │ │ ├── javascript.dict │ │ ├── maven-model-afl.dict │ │ ├── maven-model.dict │ │ ├── tomcat-webxml-afl.dict │ │ └── tomcat-webxml.dict │ └── seeds │ ├── afl-all-testcases │ ├── hello_world.txt │ ├── not_kitty.bmp │ ├── not_kitty.gif │ ├── not_kitty.ico │ ├── not_kitty.jp2 │ ├── not_kitty.jpg │ ├── not_kitty.jxr │ ├── not_kitty.png │ ├── not_kitty.tiff │ ├── not_kitty.webp │ ├── not_kitty_alpha.png │ ├── not_kitty_gamma.png │ ├── not_kitty_icc.png │ ├── simple_queries.sql │ ├── small.pdf │ ├── small_archive.bz2 │ ├── small_archive.gz │ ├── small_capture.pcap │ ├── small_document.rtf │ ├── small_document.xml │ ├── small_exec.elf │ ├── small_movie.mp4 │ └── small_script.js │ ├── bz2 │ └── zeros1024.bz2 │ ├── fen │ └── initial.fen │ ├── fqn │ ├── bad │ ├── map │ └── test │ ├── gif │ └── pixel.gif │ ├── javaclass │ └── Hello.class │ ├── jpeg │ └── Blank.jpg │ ├── js │ └── react.production.min.js │ ├── png │ └── pixel.png │ ├── random │ └── random1024.input │ ├── tiff │ └── not_kitty.tiff │ ├── url │ ├── ftp │ └── http │ ├── xml │ ├── build.xml │ └── pom.xml │ └── zeros │ └── zeros1024.input ├── fuzz ├── pom.xml └── src │ ├── main │ ├── assembly │ │ └── assembly.xml │ ├── c │ │ ├── afl-proxy.c │ │ └── afl-proxy.h │ ├── java │ │ └── edu │ │ │ └── berkeley │ │ │ └── cs │ │ │ └── jqf │ │ │ └── fuzz │ │ │ ├── Fuzz.java │ │ │ ├── JQF.java │ │ │ ├── afl │ │ │ ├── AFLDriver.java │ │ │ ├── AFLGuidance.java │ │ │ ├── PerfFuzzDriver.java │ │ │ └── PerfFuzzGuidance.java │ │ │ ├── difffuzz │ │ │ ├── Comparison.java │ │ │ ├── DiffException.java │ │ │ ├── DiffFuzz.java │ │ │ ├── DiffFuzzGuidance.java │ │ │ ├── DiffFuzzNoGuidance.java │ │ │ ├── DiffFuzzReproGuidance.java │ │ │ ├── Outcome.java │ │ │ └── Serializer.java │ │ │ ├── ei │ │ │ ├── ExecutionContext.java │ │ │ ├── ExecutionIndex.java │ │ │ ├── ExecutionIndexingDriver.java │ │ │ ├── ExecutionIndexingGuidance.java │ │ │ ├── ZestCLI.java │ │ │ ├── ZestDriver.java │ │ │ ├── ZestGuidance.java │ │ │ └── state │ │ │ │ ├── AbstractExecutionIndexingState.java │ │ │ │ ├── FastExecutionIndexingState.java │ │ │ │ └── JanalaExecutionIndexingState.java │ │ │ ├── guidance │ │ │ ├── Guidance.java │ │ │ ├── GuidanceException.java │ │ │ ├── Result.java │ │ │ ├── StreamBackedRandom.java │ │ │ └── TimeoutException.java │ │ │ ├── junit │ │ │ ├── GuidedFuzzing.java │ │ │ ├── TrialRunner.java │ │ │ └── quickcheck │ │ │ │ ├── FastSourceOfRandomness.java │ │ │ │ ├── FuzzStatement.java │ │ │ │ ├── InputStreamGenerator.java │ │ │ │ └── NonTrackingGenerationStatus.java │ │ │ ├── random │ │ │ ├── NoGuidance.java │ │ │ └── RandomDriver.java │ │ │ ├── repro │ │ │ ├── ReproDriver.java │ │ │ ├── ReproGuidance.java │ │ │ ├── ReproServerDriver.java │ │ │ └── ReproServerGuidance.java │ │ │ └── util │ │ │ ├── Counter.java │ │ │ ├── Coverage.java │ │ │ ├── CoverageFactory.java │ │ │ ├── FastNonCollidingCounter.java │ │ │ ├── FastNonCollidingCoverage.java │ │ │ ├── Hashing.java │ │ │ ├── ICoverage.java │ │ │ ├── IOUtils.java │ │ │ ├── MapOfCounters.java │ │ │ ├── MovingAverage.java │ │ │ ├── NonZeroCachingCounter.java │ │ │ ├── Observability.java │ │ │ ├── ProducerHashMap.java │ │ │ └── ThrowingRunnable.java │ └── resources │ │ └── META-INF │ │ └── services │ │ └── com.pholser.junit.quickcheck.generator.Generator │ └── test │ └── java │ └── edu │ └── berkeley │ └── cs │ └── jqf │ └── fuzz │ ├── afl │ └── RedundancyTest.java │ ├── ei │ ├── ExecutionIndexingGuidanceTest.java │ └── ExecutionIndexingTest.java │ ├── guidance │ └── GuidanceTest.java │ └── util │ ├── CountersTest.java │ ├── CoverageTest.java │ └── NonZeroCachingCountersTest.java ├── instrument ├── pom.xml └── src │ ├── main │ └── java │ │ ├── edu │ │ └── berkeley │ │ │ └── cs │ │ │ └── jqf │ │ │ └── instrument │ │ │ ├── InstrumentationException.java │ │ │ ├── InstrumentingClassLoader.java │ │ │ ├── tracing │ │ │ ├── ControlFlowInstructionVisitor.java │ │ │ ├── DefaultInstructionVisitor.java │ │ │ ├── FastCoverageSnoop.java │ │ │ ├── PrintLogger.java │ │ │ ├── SingleSnoop.java │ │ │ ├── ThreadTracer.java │ │ │ ├── TraceLogger.java │ │ │ └── events │ │ │ │ ├── AllocEvent.java │ │ │ │ ├── BranchEvent.java │ │ │ │ ├── CallEvent.java │ │ │ │ ├── ReadEvent.java │ │ │ │ ├── ReturnEvent.java │ │ │ │ ├── TraceEvent.java │ │ │ │ └── TraceEventVisitor.java │ │ │ └── util │ │ │ ├── DoublyLinkedList.java │ │ │ ├── FastBlockingQueue.java │ │ │ └── Stack.java │ │ └── janala │ │ ├── LICENSE │ │ ├── instrument │ │ ├── Config.java │ │ ├── FastCoverageListener.java │ │ ├── FastCoverageMethodAdapter.java │ │ ├── GlobalStateForInstrumentation.java │ │ ├── SafeClassWriter.java │ │ ├── SnoopInstructionClassAdapter.java │ │ ├── SnoopInstructionMethodAdapter.java │ │ ├── SnoopInstructionTransformer.java │ │ ├── TryCatchBlock.java │ │ └── Utils.java │ │ └── logger │ │ ├── AbstractLogger.java │ │ ├── Logger.java │ │ ├── StringLogger.java │ │ ├── StringPrintLogger.java │ │ └── inst │ │ ├── AALOAD.java │ │ ├── AASTORE.java │ │ ├── ACONST_NULL.java │ │ ├── ALOAD.java │ │ ├── ANEWARRAY.java │ │ ├── ARETURN.java │ │ ├── ARRAYLENGTH.java │ │ ├── ASTORE.java │ │ ├── ATHROW.java │ │ ├── BALOAD.java │ │ ├── BASTORE.java │ │ ├── BIPUSH.java │ │ ├── CALOAD.java │ │ ├── CASTORE.java │ │ ├── CHECKCAST.java │ │ ├── ConditionalBranch.java │ │ ├── D2F.java │ │ ├── D2I.java │ │ ├── D2L.java │ │ ├── DADD.java │ │ ├── DALOAD.java │ │ ├── DASTORE.java │ │ ├── DCMPG.java │ │ ├── DCMPL.java │ │ ├── DCONST_0.java │ │ ├── DCONST_1.java │ │ ├── DDIV.java │ │ ├── DLOAD.java │ │ ├── DMUL.java │ │ ├── DNEG.java │ │ ├── DREM.java │ │ ├── DRETURN.java │ │ ├── DSTORE.java │ │ ├── DSUB.java │ │ ├── DUP.java │ │ ├── DUP2.java │ │ ├── DUP2_X1.java │ │ ├── DUP2_X2.java │ │ ├── DUP_X1.java │ │ ├── DUP_X2.java │ │ ├── F2D.java │ │ ├── F2I.java │ │ ├── F2L.java │ │ ├── FADD.java │ │ ├── FALOAD.java │ │ ├── FASTORE.java │ │ ├── FCMPG.java │ │ ├── FCMPL.java │ │ ├── FCONST_0.java │ │ ├── FCONST_1.java │ │ ├── FCONST_2.java │ │ ├── FDIV.java │ │ ├── FLOAD.java │ │ ├── FMUL.java │ │ ├── FNEG.java │ │ ├── FREM.java │ │ ├── FRETURN.java │ │ ├── FSTORE.java │ │ ├── FSUB.java │ │ ├── GETFIELD.java │ │ ├── GETSTATIC.java │ │ ├── GETVALUE.java │ │ ├── GETVALUE_Object.java │ │ ├── GETVALUE_boolean.java │ │ ├── GETVALUE_byte.java │ │ ├── GETVALUE_char.java │ │ ├── GETVALUE_double.java │ │ ├── GETVALUE_float.java │ │ ├── GETVALUE_int.java │ │ ├── GETVALUE_long.java │ │ ├── GETVALUE_short.java │ │ ├── GETVALUE_void.java │ │ ├── GOTO.java │ │ ├── HEAPLOAD.java │ │ ├── I2B.java │ │ ├── I2C.java │ │ ├── I2D.java │ │ ├── I2F.java │ │ ├── I2L.java │ │ ├── I2S.java │ │ ├── IADD.java │ │ ├── IALOAD.java │ │ ├── IAND.java │ │ ├── IASTORE.java │ │ ├── ICONST_0.java │ │ ├── ICONST_1.java │ │ ├── ICONST_2.java │ │ ├── ICONST_3.java │ │ ├── ICONST_4.java │ │ ├── ICONST_5.java │ │ ├── ICONST_M1.java │ │ ├── IDIV.java │ │ ├── IFEQ.java │ │ ├── IFGE.java │ │ ├── IFGT.java │ │ ├── IFLE.java │ │ ├── IFLT.java │ │ ├── IFNE.java │ │ ├── IFNONNULL.java │ │ ├── IFNULL.java │ │ ├── IF_ACMPEQ.java │ │ ├── IF_ACMPNE.java │ │ ├── IF_ICMPEQ.java │ │ ├── IF_ICMPGE.java │ │ ├── IF_ICMPGT.java │ │ ├── IF_ICMPLE.java │ │ ├── IF_ICMPLT.java │ │ ├── IF_ICMPNE.java │ │ ├── IINC.java │ │ ├── ILOAD.java │ │ ├── IMUL.java │ │ ├── INEG.java │ │ ├── INSTANCEOF.java │ │ ├── INVOKEINTERFACE.java │ │ ├── INVOKEMETHOD_END.java │ │ ├── INVOKEMETHOD_EXCEPTION.java │ │ ├── INVOKESPECIAL.java │ │ ├── INVOKESTATIC.java │ │ ├── INVOKEVIRTUAL.java │ │ ├── IOR.java │ │ ├── IREM.java │ │ ├── IRETURN.java │ │ ├── ISHL.java │ │ ├── ISHR.java │ │ ├── ISTORE.java │ │ ├── ISUB.java │ │ ├── IUSHR.java │ │ ├── IVisitor.java │ │ ├── IXOR.java │ │ ├── Instruction.java │ │ ├── InvokeInstruction.java │ │ ├── JSR.java │ │ ├── L2D.java │ │ ├── L2F.java │ │ ├── L2I.java │ │ ├── LADD.java │ │ ├── LALOAD.java │ │ ├── LAND.java │ │ ├── LASTORE.java │ │ ├── LCMP.java │ │ ├── LCONST_0.java │ │ ├── LCONST_1.java │ │ ├── LDC_Object.java │ │ ├── LDC_String.java │ │ ├── LDC_double.java │ │ ├── LDC_float.java │ │ ├── LDC_int.java │ │ ├── LDC_long.java │ │ ├── LDIV.java │ │ ├── LLOAD.java │ │ ├── LMUL.java │ │ ├── LNEG.java │ │ ├── LOOKUPSWITCH.java │ │ ├── LOR.java │ │ ├── LREM.java │ │ ├── LRETURN.java │ │ ├── LSHL.java │ │ ├── LSHR.java │ │ ├── LSTORE.java │ │ ├── LSUB.java │ │ ├── LUSHR.java │ │ ├── LXOR.java │ │ ├── MAKE_SYMBOLIC.java │ │ ├── METHOD_BEGIN.java │ │ ├── METHOD_THROW.java │ │ ├── MONITORENTER.java │ │ ├── MONITOREXIT.java │ │ ├── MULTIANEWARRAY.java │ │ ├── MemberRef.java │ │ ├── NEW.java │ │ ├── NEWARRAY.java │ │ ├── NOP.java │ │ ├── POP.java │ │ ├── POP2.java │ │ ├── PUTFIELD.java │ │ ├── PUTSTATIC.java │ │ ├── RET.java │ │ ├── RETURN.java │ │ ├── SALOAD.java │ │ ├── SASTORE.java │ │ ├── SIPUSH.java │ │ ├── SPECIAL.java │ │ ├── SWAP.java │ │ └── TABLESWITCH.java │ └── test │ └── java │ ├── BinaryTree.java │ ├── CancelReturn.java │ ├── DataStructures.java │ ├── HelloWorld.java │ ├── MultiThreaded.java │ ├── Outer.java │ ├── Recursion.java │ ├── StaticInit.java │ ├── StaticInitDriver.java │ ├── UninitializedThis.java │ └── Wrapper.java ├── integration-tests ├── pom.xml └── src │ └── test │ └── java │ └── edu │ └── berkeley │ └── cs │ └── jqf │ └── fuzz │ └── guidance │ ├── AbstractGuidanceIT.java │ └── ZestGuidanceIT.java ├── maven-plugin ├── pom.xml └── src │ └── main │ └── java │ └── edu │ └── berkeley │ └── cs │ └── jqf │ └── plugin │ ├── FuzzGoal.java │ └── ReproGoal.java ├── pom.xml ├── scripts ├── classpath.sh ├── examples_classpath.sh ├── experiments │ ├── ei │ │ ├── bench.sh │ │ ├── cov.sh │ │ ├── cov_all.sh │ │ ├── data-processing │ │ │ ├── process_data.py │ │ │ ├── sns_settings.py │ │ │ └── visualize.py │ │ └── run_all.sh │ └── zest │ │ ├── bench.sh │ │ ├── cov.sh │ │ ├── cov_all.sh │ │ ├── run_all.sh │ │ ├── synt_sem.sh │ │ └── synt_sem_all.sh ├── janala.conf └── jqf-driver.sh └── setup.sh /.github/workflows/apidocs.yml: -------------------------------------------------------------------------------- 1 | # This workflow builds and deploys the JavaDoc API docs for the library modules 2 | 3 | name: API Docs 4 | 5 | # Run this on releases and on demand (manually) 6 | on: [release, workflow_dispatch] 7 | jobs: 8 | build-javadoc-and-deploy: 9 | runs-on: ubuntu-latest 10 | steps: 11 | - name: Checkout latest # release or manually selected ref 12 | uses: actions/checkout@v2 13 | 14 | - name: Cache Maven dependencies 15 | uses: actions/cache@v2 16 | with: 17 | path: ~/.m2/repository 18 | key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} 19 | restore-keys: | 20 | ${{ runner.os }}-maven- 21 | 22 | - name: Build JavaDoc 23 | run: "mvn -B javadoc:aggregate -pl :jqf-instrument,:jqf-fuzz,:jqf" 24 | 25 | - name: Deploy to gh-pages 26 | uses: JamesIves/github-pages-deploy-action@4.1.4 27 | with: 28 | branch: gh-pages 29 | folder: target/site 30 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | on: 3 | push: 4 | branches: [ master ] 5 | pull_request: 6 | branches: [ master ] 7 | workflow_dispatch: 8 | jobs: 9 | build-and-test: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: actions/checkout@v2 13 | - name: Set up JDK 11 14 | uses: actions/setup-java@v2 15 | with: 16 | java-version: '11' 17 | distribution: 'adopt' 18 | - name: Cache Maven dependencies 19 | uses: actions/cache@v4 20 | with: 21 | path: ~/.m2/repository 22 | key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} 23 | restore-keys: | 24 | ${{ runner.os }}-maven- 25 | - name: Build AFL proxy 26 | run: make 27 | - name: Build and test JQF 28 | run: mvn -B verify -P continuous-integration 29 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | build/ 3 | target/ 4 | *.iml 5 | *.pyc 6 | .cache/ 7 | .idea/ 8 | .janala/ 9 | *.log 10 | results-*/ 11 | *_crashes/ 12 | *.swp 13 | apidocs/ 14 | experiments/*-results-* 15 | *-results/ 16 | .java-version 17 | .vscode 18 | -------------------------------------------------------------------------------- /.pylintrc: -------------------------------------------------------------------------------- 1 | [MASTER] 2 | disable= 3 | C0116, C0114 4 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2017-2020 The Regents of the University of California 2 | Copyright (c) 2021-2023 Rohan Padhye and JQF Contributors 3 | 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions are 8 | met: 9 | 10 | 1. Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | 13 | 2. Redistributions in binary form must reproduce the above copyright 14 | notice, this list of conditions and the following disclaimer in the 15 | documentation and/or other materials provided with the distribution. 16 | 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | CC ?= clang 2 | 3 | all: bin/afl-proxy 4 | 5 | bin/afl-proxy: fuzz/src/main/c/afl-proxy.c 6 | $(CC) $(CFLAGS) $< -o $@ 7 | 8 | clean: 9 | rm -f bin/afl-proxy 10 | 11 | -------------------------------------------------------------------------------- /RELEASING.md: -------------------------------------------------------------------------------- 1 | These notes are for the project maintainers to help with releasing artifacts to Maven Central. 2 | 3 | # One-time setup 4 | 5 | 1. Set up `~/.m2/settings.xml` with `$username` and `$password` from `https://oss.sonatype.org/`: 6 | 7 | ``` 8 | 9 | 10 | 11 | ossrh 12 | $username 13 | $password 14 | 15 | 16 | 17 | ``` 18 | 19 | 2. Configure PGP keys locally using GnuPG (aka GPG) so that artifacts can be signed. 20 | 21 | 22 | # Every Release 23 | 24 | 1. Make sure GPG can use TTY to get password. In bash: 25 | ```bash 26 | export GPG_TTY=$(tty) 27 | ``` 28 | 29 | 2. Prepare release: 30 | ``` 31 | mvn release:prepare -P release-profile -DpushChanges=false 32 | ``` 33 | 34 | The `-DpushChanges=false` avoids pushing the new release commits to GitHub, in case there's some problem that requires a rollback. 35 | 36 | 3. Check if everything went okay, then deploy: 37 | ``` 38 | mvn release:perform -P release-profile -DlocalCheckout 39 | ``` 40 | 41 | The `-DlocalCheckout` is needed if changes were not pushed above. This tells Maven to use the new release from the local repo instead of pulling from GitHub. 42 | 43 | 4. Update `scripts/jqf-driver.sh` and `scripts/instrument.sh` with new version numbers. 44 | 45 | 5. Log on to the [Nexus Repository Manager](https://oss.sonatype.org) to close + release. Wait. 46 | 47 | 6. If the release went file and changes were not pushed in step 2, then run `git push`. 48 | -------------------------------------------------------------------------------- /bin/.gitignore: -------------------------------------------------------------------------------- 1 | afl-proxy 2 | -------------------------------------------------------------------------------- /bin/jqf-afl-target: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Figure out script absolute path 4 | pushd `dirname $0` > /dev/null 5 | BIN_DIR=`pwd` 6 | popd > /dev/null 7 | 8 | ROOT_DIR=`dirname $BIN_DIR` 9 | 10 | # Ensure that proxy is built 11 | if [ ! -f "$ROOT_DIR/bin/afl-proxy" ]; then 12 | echo "The AFL proxy is not built! Make sure to run ./setup.sh or run 'make' in afl/" >&2 13 | exit 2 14 | fi 15 | 16 | # Set defaults and parse options to override 17 | driver="edu.berkeley.cs.jqf.fuzz.afl.AFLDriver" 18 | java_log="/dev/stdout" 19 | afl_log="/dev/null" 20 | 21 | while getopts ":avr" opt; do 22 | case $opt in 23 | /?) 24 | echo "Invalid option: -$OPTARG" >&2 25 | exit 1 26 | ;; 27 | v) 28 | java_log="jqf.log" 29 | ;; 30 | a) 31 | afl_log="proxy.log" 32 | ;; 33 | r) 34 | driver="edu.berkeley.cs.jqf.fuzz.afl.PerfFuzzDriver" 35 | export JQF_PERF_MAP=1 36 | ;; 37 | esac 38 | done 39 | shift $((OPTIND-1)) 40 | 41 | # Check positional arguments 42 | if [ $# -lt 3 ]; then 43 | echo "Usage: $0 [-v] [-r] TEST_CLASS TEST_METHOD INPUT_FILE" >&2 44 | exit 1 45 | fi 46 | 47 | # Ready to go 48 | class=$1 49 | method=$2 50 | input=$3 51 | 52 | tmpdir=$(mktemp -d /tmp/jqf.XXX) 53 | 54 | a2j="$tmpdir/a2j" 55 | j2a="$tmpdir/j2a" 56 | 57 | mkfifo "$a2j" 58 | mkfifo "$j2a" 59 | 60 | # Run the AFL driver in the background 61 | "$ROOT_DIR/scripts/jqf-driver.sh" \ 62 | $driver $class $method $input $a2j $j2a \ 63 | 1> $java_log 2>&1 & 64 | 65 | # Run the proxy 66 | exec "$ROOT_DIR/bin/afl-proxy" $a2j $j2a $afl_log 67 | 68 | 69 | -------------------------------------------------------------------------------- /bin/jqf-ei: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Figure out script absolute path 4 | pushd `dirname $0` > /dev/null 5 | BIN_DIR=`pwd` 6 | popd > /dev/null 7 | 8 | ROOT_DIR=`dirname $BIN_DIR` 9 | 10 | print_usage() { 11 | echo "Usage: $0 [-c CLASSPATH] [-v] TEST_CLASS TEST_METHOD [OUT_DIR [SEED_FILES...]]" 12 | } 13 | 14 | while getopts ":c:v" opt; do 15 | case $opt in 16 | /?) 17 | echo "Invalid option: -$OPTARG" >&2 18 | print_usage >&1 19 | exit 1 20 | ;; 21 | c) 22 | export CLASSPATH="$OPTARG" 23 | ;; 24 | v) 25 | export JVM_OPTS="$JVM_OPTS -Djqf.logCoverage=true" 26 | ;; 27 | esac 28 | done 29 | shift $((OPTIND-1)) 30 | 31 | # Check arguments 32 | if [ $# -lt 2 ]; then 33 | print_usage >&1 34 | exit 1 35 | fi 36 | 37 | # Make sure that caller/callee names are matched 38 | export JVM_OPTS="$JVM_OPTS -Djqf.tracing.MATCH_CALLEE_NAMES=true -Djqf.tracing.TRACE_GENERATORS=true" 39 | 40 | # Run the execution indexing input driver 41 | $ROOT_DIR/scripts/jqf-driver.sh edu.berkeley.cs.jqf.fuzz.ei.ExecutionIndexingDriver $@ 42 | 43 | -------------------------------------------------------------------------------- /bin/jqf-random: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Figure out script absolute path 4 | pushd `dirname $0` > /dev/null 5 | BIN_DIR=`pwd` 6 | popd > /dev/null 7 | 8 | ROOT_DIR=`dirname $BIN_DIR` 9 | 10 | print_usage() { 11 | echo "Usage: $0 [-c CLASSPATH] [-v] TEST_CLASS TEST_METHOD [MAX_TRIALS]" 12 | } 13 | 14 | while getopts ":c:v" opt; do 15 | case $opt in 16 | /?) 17 | echo "Invalid option: -$OPTARG" >&2 18 | print_usage >&1 19 | exit 1 20 | ;; 21 | c) 22 | export CLASSPATH="$OPTARG" 23 | ;; 24 | v) 25 | export JVM_OPTS="$JVM_OPTS -Djqf.logCoverage=true" 26 | ;; 27 | esac 28 | done 29 | shift $((OPTIND-1)) 30 | 31 | # Check arguments 32 | if [ $# -lt 2 ]; then 33 | print_usage >&1 34 | exit 1 35 | fi 36 | 37 | # Run the random input driver 38 | $ROOT_DIR/scripts/jqf-driver.sh edu.berkeley.cs.jqf.fuzz.random.RandomDriver $@ 39 | -------------------------------------------------------------------------------- /bin/jqf-repro: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Figure out script absolute path 4 | pushd `dirname $0` > /dev/null 5 | BIN_DIR=`pwd` 6 | popd > /dev/null 7 | 8 | ROOT_DIR=`dirname $BIN_DIR` 9 | 10 | print_usage() { 11 | echo "Usage: $0 [-c CLASSPATH] [-i] [-v] [-r] TEST_CLASS TEST_METHOD INPUT_FILE.." 12 | } 13 | 14 | while getopts ":c:ivre" opt; do 15 | case $opt in 16 | /?) 17 | echo "Invalid option: -$OPTARG" >&2 18 | print_usage >&1 19 | exit 1 20 | ;; 21 | c) 22 | export CLASSPATH="$OPTARG" 23 | ;; 24 | i) 25 | instrument=1 26 | ;; 27 | r) 28 | results=1 29 | ;; 30 | v) 31 | verbose=1 32 | export JVM_OPTS="$JVM_OPTS -Djqf.logCoverage=true -Djanala.verbose=true" 33 | ;; 34 | e) 35 | export JVM_OPTS="$JVM_OPTS -Djqf.tracing.MATCH_CALLEE_NAMES=true -Djqf.tracing.TRACE_GENERATORS=true" 36 | ;; 37 | esac 38 | done 39 | shift $((OPTIND-1)) 40 | 41 | if [ -n "$verbose" -o -n "$results" ]; then 42 | export JVM_OPTS="-Djqf.repro.traceDir=. $JVM_OPTS" 43 | fi 44 | 45 | if [ -z "$instrument" ]; then 46 | export JQF_DISABLE_INSTRUMENTATION=1 47 | fi 48 | 49 | # Check arguments 50 | if [ $# -lt 3 ]; then 51 | print_usage >&1 52 | exit 1 53 | fi 54 | 55 | 56 | # Run the repro input driver 57 | $ROOT_DIR/scripts/jqf-driver.sh edu.berkeley.cs.jqf.fuzz.repro.ReproDriver $@ 58 | -------------------------------------------------------------------------------- /bin/jqf-zest: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Figure out script absolute path 4 | pushd `dirname $0` > /dev/null 5 | BIN_DIR=`pwd` 6 | popd > /dev/null 7 | 8 | ROOT_DIR=`dirname $BIN_DIR` 9 | 10 | print_usage() { 11 | echo "Usage: $0 [-c CLASSPATH] [-v] TEST_CLASS TEST_METHOD [OUT_DIR [SEED_FILES...]]" 12 | } 13 | 14 | while getopts ":c:vt:" opt; do 15 | case $opt in 16 | /?) 17 | echo "Invalid option: -$OPTARG" >&2 18 | print_usage >&1 19 | exit 1 20 | ;; 21 | c) 22 | export CLASSPATH="$OPTARG" 23 | ;; 24 | v) 25 | export JVM_OPTS="$JVM_OPTS -Djqf.logCoverage=true" 26 | ;; 27 | t) 28 | export JVM_OPTS="$JVM_OPTS -Djqf.ei.TIMEOUT=$OPTARG" 29 | ;; 30 | esac 31 | done 32 | shift $((OPTIND-1)) 33 | 34 | # Check arguments 35 | if [ $# -lt 2 ]; then 36 | print_usage >&1 37 | exit 1 38 | fi 39 | 40 | # Run the Zest input driver 41 | $ROOT_DIR/scripts/jqf-driver.sh edu.berkeley.cs.jqf.fuzz.ei.ZestDriver $@ 42 | -------------------------------------------------------------------------------- /examples/fen.txt: -------------------------------------------------------------------------------- 1 | rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1 2 | -------------------------------------------------------------------------------- /examples/src/main/java/edu/berkeley/cs/jqf/examples/bcel/JavaClassNameGenerator.java: -------------------------------------------------------------------------------- 1 | package edu.berkeley.cs.jqf.examples.bcel; 2 | 3 | import com.pholser.junit.quickcheck.generator.GenerationStatus; 4 | import com.pholser.junit.quickcheck.generator.Generator; 5 | import com.pholser.junit.quickcheck.random.SourceOfRandomness; 6 | 7 | public class JavaClassNameGenerator extends Generator { 8 | private static final String[] BASIC_CLASS_NAMES = {"java/lang/Object", 9 | "java/util/List", 10 | "java/util/Map", 11 | "java/lang/String", 12 | "example/A", 13 | "example/B", 14 | "java/lang/Throwable", 15 | "java/lang/RuntimeException"}; 16 | private final Generator identifierGenerator = new JavaIdentifierGenerator(); 17 | private final String delimiter; 18 | 19 | public JavaClassNameGenerator() { 20 | this("/"); 21 | } 22 | 23 | public JavaClassNameGenerator(String delimiter) { 24 | super(String.class); 25 | this.delimiter = delimiter; 26 | } 27 | 28 | @Override 29 | public String generate(SourceOfRandomness random, GenerationStatus status) { 30 | if (random.nextBoolean()) { 31 | return random.choose(BASIC_CLASS_NAMES); 32 | } 33 | String[] parts = new String[random.nextInt(1, 5)]; 34 | for (int i = 0; i < parts.length; i++) { 35 | parts[i] = identifierGenerator.generate(random, status); 36 | } 37 | return String.join(delimiter, parts); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /examples/src/main/java/edu/berkeley/cs/jqf/examples/common/Dictionary.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017-2018 The Regents of the University of California 3 | * 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are 8 | * met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | package edu.berkeley.cs.jqf.examples.common; 30 | 31 | import java.lang.annotation.ElementType; 32 | import java.lang.annotation.Retention; 33 | import java.lang.annotation.RetentionPolicy; 34 | import java.lang.annotation.Target; 35 | 36 | import com.pholser.junit.quickcheck.generator.GeneratorConfiguration; 37 | 38 | @Target({ElementType.PARAMETER, ElementType.FIELD, ElementType.ANNOTATION_TYPE, ElementType.TYPE_USE}) 39 | @Retention(RetentionPolicy.RUNTIME) 40 | @GeneratorConfiguration 41 | public @interface Dictionary { 42 | String value(); 43 | } 44 | -------------------------------------------------------------------------------- /examples/src/main/java/edu/berkeley/cs/jqf/examples/common/FixedSize.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017-2018 The Regents of the University of California 3 | * 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are 8 | * met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | package edu.berkeley.cs.jqf.examples.common; 30 | 31 | import java.lang.annotation.ElementType; 32 | import java.lang.annotation.Retention; 33 | import java.lang.annotation.RetentionPolicy; 34 | import java.lang.annotation.Target; 35 | 36 | import com.pholser.junit.quickcheck.generator.GeneratorConfiguration; 37 | 38 | @Target({ElementType.PARAMETER, ElementType.FIELD, ElementType.ANNOTATION_TYPE, ElementType.TYPE_USE}) 39 | @Retention(RetentionPolicy.RUNTIME) 40 | @GeneratorConfiguration 41 | public @interface FixedSize { 42 | int value(); 43 | } 44 | -------------------------------------------------------------------------------- /examples/src/main/java/edu/berkeley/cs/jqf/examples/kaitai/KaitaiStruct.java: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright 2015-2016 Kaitai Project: MIT license 3 | * 4 | * Permission is hereby granted, free of charge, to any person obtaining 5 | * a copy of this software and associated documentation files (the 6 | * "Software"), to deal in the Software without restriction, including 7 | * without limitation the rights to use, copy, modify, merge, publish, 8 | * distribute, sublicense, and/or sell copies of the Software, and to 9 | * permit persons to whom the Software is furnished to do so, subject to 10 | * the following conditions: 11 | * 12 | * The above copyright notice and this permission notice shall be 13 | * included in all copies or substantial portions of the Software. 14 | * 15 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 17 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 19 | * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 20 | * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 21 | * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 22 | */ 23 | 24 | package edu.berkeley.cs.jqf.examples.kaitai; 25 | 26 | /** 27 | * Common base class for all structured generated by Kaitai Struct. 28 | * Stores stream object that this object was parsed from in {@link #_io}. 29 | */ 30 | public class KaitaiStruct { 31 | /** 32 | * Stream object that this KaitaiStruct-based structure was parsed from. 33 | */ 34 | protected KaitaiStream _io; 35 | 36 | public KaitaiStruct(KaitaiStream _io) { 37 | this._io = _io; 38 | } 39 | 40 | public KaitaiStream _io() { return _io; } 41 | } 42 | -------------------------------------------------------------------------------- /examples/src/main/java/edu/berkeley/cs/jqf/examples/trees/RedBlackBSTNode.java: -------------------------------------------------------------------------------- 1 | package edu.berkeley.cs.jqf.examples.trees; 2 | 3 | /** 4 | * Created by clemieux on 9/18/17. 5 | */ 6 | public class RedBlackBSTNode { 7 | 8 | public Key key; // key 9 | public Value val; // associated data 10 | public RedBlackBSTNode left, right; // links to left and right subtrees 11 | public boolean color; // color of parent link 12 | public int size; // subtree count 13 | 14 | public RedBlackBSTNode(Key key, Value val, boolean color, int size) { 15 | this.key = key; 16 | this.val = val; 17 | this.color = color; 18 | this.size = size; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /examples/src/main/java/edu/berkeley/cs/jqf/examples/trees/RedBlackBSTNodeGenerator.java: -------------------------------------------------------------------------------- 1 | package edu.berkeley.cs.jqf.examples.trees; 2 | 3 | import java.util.Optional; 4 | 5 | import com.pholser.junit.quickcheck.generator.GenerationStatus; 6 | import com.pholser.junit.quickcheck.generator.Generator; 7 | import com.pholser.junit.quickcheck.random.SourceOfRandomness; 8 | 9 | /** 10 | * Created by clemieux on 9/15/17. 11 | */ 12 | public class RedBlackBSTNodeGenerator extends Generator { 13 | 14 | private static final GenerationStatus.Key SUBTREE_SIZE = new GenerationStatus.Key<>("treesize", Integer.class); 15 | 16 | public RedBlackBSTNodeGenerator() { 17 | super(RedBlackBSTNode.class); 18 | } 19 | 20 | @Override public RedBlackBSTNode generate(SourceOfRandomness r, GenerationStatus status){ 21 | Optional treesizeOpt = status.valueOf(SUBTREE_SIZE); 22 | if (!treesizeOpt.isPresent()) return null; 23 | Integer treesize = treesizeOpt.get(); 24 | if (treesize == 0 ){ 25 | return null; 26 | } 27 | treesize = treesize -1; 28 | int leftSize = r.nextInt(0, treesize); 29 | int rightSize = treesize - leftSize; 30 | //System.out.println("leftSize: " + leftSize + ", rightSize: " + rightSize); 31 | 32 | 33 | RedBlackBSTNode retNode = new RedBlackBSTNode<>(r.nextInt(), r.nextInt(), r.nextBoolean(), treesize + 1); 34 | // System.out.println(retNode.key); 35 | retNode.left= generate(r, status.setValue(SUBTREE_SIZE, leftSize)); 36 | retNode.right = generate(r, status.setValue(SUBTREE_SIZE, rightSize)); 37 | return retNode; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /examples/src/test/crashes/kitty.crash: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rohanpadhye/JQF/5e24bbcc62b2b4412dd0fece177daf369c6f4e2a/examples/src/test/crashes/kitty.crash -------------------------------------------------------------------------------- /examples/src/test/crashes/kitty.hang: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rohanpadhye/JQF/5e24bbcc62b2b4412dd0fece177daf369c6f4e2a/examples/src/test/crashes/kitty.hang -------------------------------------------------------------------------------- /examples/src/test/java/edu/berkeley/cs/jqf/examples/ConstructorExceptionTest.java: -------------------------------------------------------------------------------- 1 | package edu.berkeley.cs.jqf.examples; 2 | 3 | import edu.berkeley.cs.jqf.fuzz.Fuzz; 4 | import edu.berkeley.cs.jqf.fuzz.JQF; 5 | import org.junit.runner.RunWith; 6 | 7 | // Testing fix for: https://github.com/rohanpadhye/JQF/issues/65 8 | @RunWith(JQF.class) 9 | public class ConstructorExceptionTest { 10 | 11 | class Foo { 12 | public Foo(int x) throws Exception { 13 | this(thr0w()); 14 | } 15 | 16 | public Foo(boolean b) { 17 | // Do nothing 18 | } 19 | } 20 | 21 | static boolean thr0w() throws Exception { 22 | throw new Exception(); 23 | } 24 | 25 | @Fuzz 26 | public void testThrowingConstructors(int x) throws Exception { 27 | new Foo(x); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /examples/src/test/java/edu/berkeley/cs/jqf/examples/MultiThreadedTest.java: -------------------------------------------------------------------------------- 1 | package edu.berkeley.cs.jqf.examples; 2 | 3 | import edu.berkeley.cs.jqf.fuzz.Fuzz; 4 | import edu.berkeley.cs.jqf.fuzz.JQF; 5 | import org.junit.runner.RunWith; 6 | 7 | @RunWith(JQF.class) 8 | public class MultiThreadedTest { 9 | 10 | private volatile int counter = 0; 11 | 12 | @Fuzz 13 | public void testMultiThreaded(int x) { 14 | Thread t1 = new Thread(() -> { 15 | if (x > 10) { 16 | if (x < 20) { 17 | counter += x; 18 | } 19 | } 20 | }); 21 | Thread t2 = new Thread(() -> { 22 | if (x < 25) { 23 | if (x > 15) { 24 | counter += x; 25 | } 26 | } 27 | }); 28 | t1.start(); 29 | t2.start(); 30 | try { 31 | t1.join(); 32 | t2.join(); 33 | } catch (InterruptedException e) { 34 | throw new RuntimeException(e); 35 | } 36 | 37 | } 38 | 39 | 40 | } 41 | -------------------------------------------------------------------------------- /examples/src/test/java/edu/berkeley/cs/jqf/examples/chocopy/SemanticAnalysisTest.java: -------------------------------------------------------------------------------- 1 | package edu.berkeley.cs.jqf.examples.chocopy; 2 | 3 | import chocopy.ChocoPy; 4 | import chocopy.common.astnodes.Program; 5 | import chocopy.reference.RefAnalysis; 6 | import chocopy.reference.RefParser; 7 | import com.pholser.junit.quickcheck.From; 8 | import edu.berkeley.cs.jqf.fuzz.Fuzz; 9 | import edu.berkeley.cs.jqf.fuzz.JQF; 10 | import org.junit.runner.RunWith; 11 | 12 | import static org.junit.Assert.assertTrue; 13 | import static org.junit.Assume.assumeTrue; 14 | 15 | @RunWith(JQF.class) 16 | public class SemanticAnalysisTest { 17 | 18 | /** Entry point for fuzzing reference ChocoPy semantic analysis with ChocoPy code generator */ 19 | @Fuzz 20 | public void fuzzSemanticAnalysis(@From(ChocoPySemanticGenerator.class) String code) { 21 | Program program = RefParser.process(code, false); 22 | assumeTrue(!program.hasErrors()); 23 | RefAnalysis.process(program); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /examples/src/test/java/edu/berkeley/cs/jqf/examples/gson/JsonTest.java: -------------------------------------------------------------------------------- 1 | package edu.berkeley.cs.jqf.examples.gson; 2 | 3 | import com.google.gson.Gson; 4 | import com.google.gson.GsonBuilder; 5 | import com.google.gson.JsonIOException; 6 | import com.google.gson.JsonSyntaxException; 7 | import com.pholser.junit.quickcheck.From; 8 | import edu.berkeley.cs.jqf.examples.common.AsciiStringGenerator; 9 | import edu.berkeley.cs.jqf.fuzz.JQF; 10 | import edu.berkeley.cs.jqf.fuzz.Fuzz; 11 | import org.junit.Assume; 12 | import org.junit.runner.RunWith; 13 | 14 | @RunWith(JQF.class) 15 | public class JsonTest { 16 | 17 | private Gson gson = new Gson(); 18 | 19 | @Fuzz 20 | public void fuzzJSONParser(@From(AsciiStringGenerator.class) String input) { 21 | try { 22 | gson.fromJson(input, Object.class); 23 | } catch (JsonSyntaxException e) { 24 | Assume.assumeNoException(e); 25 | } catch (JsonIOException e) { 26 | Assume.assumeNoException(e); 27 | } 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /examples/src/test/java/edu/berkeley/cs/jqf/examples/jackson/JsonTest.java: -------------------------------------------------------------------------------- 1 | package edu.berkeley.cs.jqf.examples.jackson; 2 | 3 | import com.fasterxml.jackson.core.JsonProcessingException; 4 | import com.fasterxml.jackson.databind.ObjectMapper; 5 | import com.pholser.junit.quickcheck.From; 6 | import edu.berkeley.cs.jqf.examples.common.AsciiStringGenerator; 7 | import edu.berkeley.cs.jqf.fuzz.JQF; 8 | import edu.berkeley.cs.jqf.fuzz.Fuzz; 9 | import org.junit.Assume; 10 | import org.junit.runner.RunWith; 11 | import org.w3c.dom.Document; 12 | 13 | @RunWith(JQF.class) 14 | public class JsonTest { 15 | 16 | private ObjectMapper objectMapper = new ObjectMapper(); 17 | 18 | @Fuzz 19 | public void fuzzJsonReadValue(@From(AsciiStringGenerator.class) String input) { 20 | Object output = null; 21 | try { 22 | objectMapper.readValue(input, Object.class); 23 | } catch (JsonProcessingException e) { 24 | Assume.assumeNoException(e); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /examples/src/test/java/edu/berkeley/cs/jqf/examples/jdk/HashTest.java: -------------------------------------------------------------------------------- 1 | package edu.berkeley.cs.jqf.examples.jdk; 2 | 3 | /** 4 | * Created by clemieux on 10/6/17. 5 | */ 6 | public class HashTest { 7 | } 8 | -------------------------------------------------------------------------------- /examples/src/test/java/edu/berkeley/cs/jqf/examples/simple/SimpleClass.java: -------------------------------------------------------------------------------- 1 | package edu.berkeley.cs.jqf.examples.simple; 2 | 3 | public class SimpleClass { 4 | public static int test(int a) { 5 | int b = 0; 6 | if (a > 0) { 7 | b += 1; 8 | } else { 9 | b -= 1; 10 | } 11 | if (a % 2 == 0) { 12 | b += 1; 13 | } else { 14 | b -= 1; 15 | } 16 | return b; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /examples/src/test/java/edu/berkeley/cs/jqf/examples/simple/SimpleClassTest.java: -------------------------------------------------------------------------------- 1 | package edu.berkeley.cs.jqf.examples.simple; 2 | 3 | import com.pholser.junit.quickcheck.From; 4 | import com.pholser.junit.quickcheck.generator.GenerationStatus; 5 | import com.pholser.junit.quickcheck.generator.Generator; 6 | import com.pholser.junit.quickcheck.random.SourceOfRandomness; 7 | import edu.berkeley.cs.jqf.fuzz.Fuzz; 8 | import edu.berkeley.cs.jqf.fuzz.JQF; 9 | import org.junit.runner.RunWith; 10 | 11 | @RunWith(JQF.class) 12 | public class SimpleClassTest { 13 | 14 | public static class SimpleGenerator extends Generator { 15 | public SimpleGenerator() { 16 | super(Integer.class); 17 | } 18 | 19 | @Override 20 | public Integer generate(SourceOfRandomness sourceOfRandomness, GenerationStatus generationStatus) { 21 | return sourceOfRandomness.nextInt(); 22 | } 23 | } 24 | 25 | @Fuzz 26 | public void testWithGenerator(@From(SimpleGenerator.class) Integer a) { 27 | SimpleClass.test(a); 28 | } 29 | } -------------------------------------------------------------------------------- /examples/src/test/java/edu/berkeley/cs/jqf/examples/trees/BinaryTreeTest.java: -------------------------------------------------------------------------------- 1 | package edu.berkeley.cs.jqf.examples.trees; 2 | 3 | import java.util.Set; 4 | 5 | import com.pholser.junit.quickcheck.generator.InRange; 6 | import com.pholser.junit.quickcheck.generator.Size; 7 | import edu.berkeley.cs.jqf.fuzz.Fuzz; 8 | import edu.berkeley.cs.jqf.fuzz.JQF; 9 | import org.junit.Assert; 10 | import org.junit.runner.RunWith; 11 | 12 | @RunWith(JQF.class) 13 | public class BinaryTreeTest { 14 | 15 | 16 | @Fuzz 17 | public void insert(int @Size(min=100, max=100)[] elements) { 18 | BinaryTree b = new BinaryTree(); 19 | for (int e : elements) { 20 | b.insert(e); 21 | } 22 | 23 | } 24 | 25 | @Fuzz 26 | public void contains(@Size(max=100) Set<@InRange(minInt=0, maxInt=100) Integer> elements, @InRange(minInt=0, maxInt=100) int @Size(max=10) [] queries) { 27 | BinaryTree b = new BinaryTree(); 28 | for (Integer e : elements) { 29 | b.insert(e); 30 | 31 | } 32 | 33 | for (int q : queries) { 34 | Assert.assertEquals(elements.contains(q), b.contains(q)); 35 | } 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /examples/src/test/java/org/apache/bcel/verifier/StatelessVerifierFactory.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, The Regents of the University of California 3 | * 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are 8 | * met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | package org.apache.bcel.verifier; 30 | 31 | /** 32 | * A producer of Verifier instances that does not cause memory leaks. 33 | * 34 | * @author Rohan Padhye 35 | */ 36 | public class StatelessVerifierFactory { 37 | 38 | // Expose a public method for a package-private constructor 39 | public static Verifier getVerifier(String fqn) { 40 | return new Verifier(fqn); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /examples/src/test/resources/META-INF/services/com.pholser.junit.quickcheck.generator.Generator: -------------------------------------------------------------------------------- 1 | edu.berkeley.cs.jqf.examples.imageio.ImageInputStreamGenerator 2 | edu.berkeley.cs.jqf.examples.jgrapht.ModelBasedDirectedGraphGenerator 3 | edu.berkeley.cs.jqf.examples.jgrapht.ModelBasedDirectedGraphGenerator 4 | 5 | -------------------------------------------------------------------------------- /examples/src/test/resources/dictionaries/ant-project.dict: -------------------------------------------------------------------------------- 1 | basedir 2 | default 3 | depends 4 | description 5 | file 6 | id 7 | if 8 | name 9 | parsing buildfile 10 | project 11 | resolving systemId 12 | target 13 | unless 14 | ant 15 | antcall 16 | antstructure 17 | antversion 18 | apply 19 | attributenamespacedef 20 | augment 21 | available 22 | basename 23 | bindtargets 24 | buildnumber 25 | bunzip2 26 | bzip2 27 | checksum 28 | chmod 29 | classloader 30 | commandlauncher 31 | componentdef 32 | concat 33 | condition 34 | copy 35 | cvs 36 | cvschangelog 37 | cvspass 38 | cvstagdiff 39 | cvsversion 40 | defaultexcludes 41 | delete 42 | dependset 43 | diagnostics 44 | dirname 45 | ear 46 | echo 47 | echoproperties 48 | echoxml 49 | exec 50 | fail 51 | filter 52 | fixcrlf 53 | 54 | genkey 55 | get 56 | gunzip 57 | gzip 58 | hostinfo 59 | import 60 | include 61 | input 62 | jar 63 | java 64 | javac 65 | javadoc 66 | length 67 | loadfile 68 | loadproperties 69 | loadresource 70 | local 71 | macrodef 72 | mail 73 | makeurl 74 | manifest 75 | manifestclasspath 76 | mkdir 77 | move 78 | nice 79 | parallel 80 | patch 81 | pathconvert 82 | presetdef 83 | projecthelper 84 | property 85 | propertyhelper 86 | record 87 | replace 88 | resourcecount 89 | retry 90 | rmic 91 | setpermissions 92 | sequential 93 | signjar 94 | sleep 95 | sql 96 | subant 97 | sync 98 | tar 99 | taskdef 100 | tempfile 101 | touch 102 | tstamp 103 | truncate 104 | typedef 105 | unjar 106 | untar 107 | unwar 108 | unxz 109 | unzip 110 | uptodate 111 | waitfor 112 | war 113 | whichresource 114 | xmlproperty 115 | xslt 116 | xz 117 | zip 118 | -------------------------------------------------------------------------------- /examples/src/test/resources/dictionaries/fen.dict: -------------------------------------------------------------------------------- 1 | token="KQkq" 2 | -------------------------------------------------------------------------------- /examples/src/test/resources/dictionaries/javaclass.dict: -------------------------------------------------------------------------------- 1 | header="\xca\xfe\xba\xbe" 2 | -------------------------------------------------------------------------------- /examples/src/test/resources/dictionaries/javascript.dict: -------------------------------------------------------------------------------- 1 | token="^!" 2 | token="!=" 3 | token="!==" 4 | token="%" 5 | token="%=" 6 | token="&" 7 | token="&&" 8 | token="&=" 9 | token="(" 10 | token=")" 11 | token="*" 12 | token="*=" 13 | token="+" 14 | token="++" 15 | token="+=" 16 | token="," 17 | token="-" 18 | token="--" 19 | token="-=" 20 | token="." 21 | token="/" 22 | token="/=" 23 | token=":" 24 | token=";" 25 | token="<" 26 | token="<<" 27 | token="<<=" 28 | token="<=" 29 | token="=" 30 | token="==" 31 | token="===" 32 | token="=>" 33 | token=">" 34 | token=">=" 35 | token=">>" 36 | token=">>=" 37 | token=">>>" 38 | token=">>>=" 39 | token="?" 40 | token="[" 41 | token="]" 42 | token="^" 43 | token="^=" 44 | token="{" 45 | token="|" 46 | token="|=" 47 | token="||" 48 | token="}" 49 | token="~" 50 | token="break" 51 | token="case" 52 | token="catch" 53 | token="class" 54 | token="const" 55 | token="continue" 56 | token="debugger" 57 | token="default" 58 | token="delete" 59 | token="do" 60 | token="else" 61 | token="enum" 62 | token="export" 63 | token="extends" 64 | token="false" 65 | token="finally" 66 | token="for" 67 | token="function" 68 | token="if" 69 | token="implements" 70 | token="import" 71 | token="in" 72 | token="instanceof" 73 | token="interface" 74 | token="let" 75 | token="new" 76 | token="null" 77 | token="package" 78 | token="private" 79 | token="protected" 80 | token="public" 81 | token="return" 82 | token="static" 83 | token="super" 84 | token="switch" 85 | token="this" 86 | token="throw" 87 | token="true" 88 | token="try" 89 | token="typeof" 90 | token="var" 91 | token="void" 92 | token="while" 93 | token="with" 94 | token="yield" 95 | -------------------------------------------------------------------------------- /examples/src/test/seeds/afl-all-testcases/hello_world.txt: -------------------------------------------------------------------------------- 1 | hello 2 | -------------------------------------------------------------------------------- /examples/src/test/seeds/afl-all-testcases/not_kitty.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rohanpadhye/JQF/5e24bbcc62b2b4412dd0fece177daf369c6f4e2a/examples/src/test/seeds/afl-all-testcases/not_kitty.bmp -------------------------------------------------------------------------------- /examples/src/test/seeds/afl-all-testcases/not_kitty.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rohanpadhye/JQF/5e24bbcc62b2b4412dd0fece177daf369c6f4e2a/examples/src/test/seeds/afl-all-testcases/not_kitty.gif -------------------------------------------------------------------------------- /examples/src/test/seeds/afl-all-testcases/not_kitty.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rohanpadhye/JQF/5e24bbcc62b2b4412dd0fece177daf369c6f4e2a/examples/src/test/seeds/afl-all-testcases/not_kitty.ico -------------------------------------------------------------------------------- /examples/src/test/seeds/afl-all-testcases/not_kitty.jp2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rohanpadhye/JQF/5e24bbcc62b2b4412dd0fece177daf369c6f4e2a/examples/src/test/seeds/afl-all-testcases/not_kitty.jp2 -------------------------------------------------------------------------------- /examples/src/test/seeds/afl-all-testcases/not_kitty.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rohanpadhye/JQF/5e24bbcc62b2b4412dd0fece177daf369c6f4e2a/examples/src/test/seeds/afl-all-testcases/not_kitty.jpg -------------------------------------------------------------------------------- /examples/src/test/seeds/afl-all-testcases/not_kitty.jxr: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rohanpadhye/JQF/5e24bbcc62b2b4412dd0fece177daf369c6f4e2a/examples/src/test/seeds/afl-all-testcases/not_kitty.jxr -------------------------------------------------------------------------------- /examples/src/test/seeds/afl-all-testcases/not_kitty.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rohanpadhye/JQF/5e24bbcc62b2b4412dd0fece177daf369c6f4e2a/examples/src/test/seeds/afl-all-testcases/not_kitty.png -------------------------------------------------------------------------------- /examples/src/test/seeds/afl-all-testcases/not_kitty.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rohanpadhye/JQF/5e24bbcc62b2b4412dd0fece177daf369c6f4e2a/examples/src/test/seeds/afl-all-testcases/not_kitty.tiff -------------------------------------------------------------------------------- /examples/src/test/seeds/afl-all-testcases/not_kitty.webp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rohanpadhye/JQF/5e24bbcc62b2b4412dd0fece177daf369c6f4e2a/examples/src/test/seeds/afl-all-testcases/not_kitty.webp -------------------------------------------------------------------------------- /examples/src/test/seeds/afl-all-testcases/not_kitty_alpha.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rohanpadhye/JQF/5e24bbcc62b2b4412dd0fece177daf369c6f4e2a/examples/src/test/seeds/afl-all-testcases/not_kitty_alpha.png -------------------------------------------------------------------------------- /examples/src/test/seeds/afl-all-testcases/not_kitty_gamma.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rohanpadhye/JQF/5e24bbcc62b2b4412dd0fece177daf369c6f4e2a/examples/src/test/seeds/afl-all-testcases/not_kitty_gamma.png -------------------------------------------------------------------------------- /examples/src/test/seeds/afl-all-testcases/not_kitty_icc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rohanpadhye/JQF/5e24bbcc62b2b4412dd0fece177daf369c6f4e2a/examples/src/test/seeds/afl-all-testcases/not_kitty_icc.png -------------------------------------------------------------------------------- /examples/src/test/seeds/afl-all-testcases/simple_queries.sql: -------------------------------------------------------------------------------- 1 | create table t1(one smallint); 2 | insert into t1 values(1); 3 | select * from t1; 4 | -------------------------------------------------------------------------------- /examples/src/test/seeds/afl-all-testcases/small.pdf: -------------------------------------------------------------------------------- 1 | %PDF-1.0 2 | 1 0 obj<>endobj 2 0 obj<>endobj 3 0 obj<>endobj trailer<> -------------------------------------------------------------------------------- /examples/src/test/seeds/afl-all-testcases/small_archive.bz2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rohanpadhye/JQF/5e24bbcc62b2b4412dd0fece177daf369c6f4e2a/examples/src/test/seeds/afl-all-testcases/small_archive.bz2 -------------------------------------------------------------------------------- /examples/src/test/seeds/afl-all-testcases/small_archive.gz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rohanpadhye/JQF/5e24bbcc62b2b4412dd0fece177daf369c6f4e2a/examples/src/test/seeds/afl-all-testcases/small_archive.gz -------------------------------------------------------------------------------- /examples/src/test/seeds/afl-all-testcases/small_capture.pcap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rohanpadhye/JQF/5e24bbcc62b2b4412dd0fece177daf369c6f4e2a/examples/src/test/seeds/afl-all-testcases/small_capture.pcap -------------------------------------------------------------------------------- /examples/src/test/seeds/afl-all-testcases/small_document.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1\pard Test\par} -------------------------------------------------------------------------------- /examples/src/test/seeds/afl-all-testcases/small_document.xml: -------------------------------------------------------------------------------- 1 | d 2 | -------------------------------------------------------------------------------- /examples/src/test/seeds/afl-all-testcases/small_exec.elf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rohanpadhye/JQF/5e24bbcc62b2b4412dd0fece177daf369c6f4e2a/examples/src/test/seeds/afl-all-testcases/small_exec.elf -------------------------------------------------------------------------------- /examples/src/test/seeds/afl-all-testcases/small_movie.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rohanpadhye/JQF/5e24bbcc62b2b4412dd0fece177daf369c6f4e2a/examples/src/test/seeds/afl-all-testcases/small_movie.mp4 -------------------------------------------------------------------------------- /examples/src/test/seeds/afl-all-testcases/small_script.js: -------------------------------------------------------------------------------- 1 | if (1==1) eval('1'); -------------------------------------------------------------------------------- /examples/src/test/seeds/bz2/zeros1024.bz2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rohanpadhye/JQF/5e24bbcc62b2b4412dd0fece177daf369c6f4e2a/examples/src/test/seeds/bz2/zeros1024.bz2 -------------------------------------------------------------------------------- /examples/src/test/seeds/fen/initial.fen: -------------------------------------------------------------------------------- 1 | rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1 2 | -------------------------------------------------------------------------------- /examples/src/test/seeds/fqn/bad: -------------------------------------------------------------------------------- 1 | ??? -------------------------------------------------------------------------------- /examples/src/test/seeds/fqn/map: -------------------------------------------------------------------------------- 1 | java.util.Map -------------------------------------------------------------------------------- /examples/src/test/seeds/fqn/test: -------------------------------------------------------------------------------- 1 | Test -------------------------------------------------------------------------------- /examples/src/test/seeds/gif/pixel.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rohanpadhye/JQF/5e24bbcc62b2b4412dd0fece177daf369c6f4e2a/examples/src/test/seeds/gif/pixel.gif -------------------------------------------------------------------------------- /examples/src/test/seeds/javaclass/Hello.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rohanpadhye/JQF/5e24bbcc62b2b4412dd0fece177daf369c6f4e2a/examples/src/test/seeds/javaclass/Hello.class -------------------------------------------------------------------------------- /examples/src/test/seeds/jpeg/Blank.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rohanpadhye/JQF/5e24bbcc62b2b4412dd0fece177daf369c6f4e2a/examples/src/test/seeds/jpeg/Blank.jpg -------------------------------------------------------------------------------- /examples/src/test/seeds/png/pixel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rohanpadhye/JQF/5e24bbcc62b2b4412dd0fece177daf369c6f4e2a/examples/src/test/seeds/png/pixel.png -------------------------------------------------------------------------------- /examples/src/test/seeds/random/random1024.input: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rohanpadhye/JQF/5e24bbcc62b2b4412dd0fece177daf369c6f4e2a/examples/src/test/seeds/random/random1024.input -------------------------------------------------------------------------------- /examples/src/test/seeds/tiff/not_kitty.tiff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rohanpadhye/JQF/5e24bbcc62b2b4412dd0fece177daf369c6f4e2a/examples/src/test/seeds/tiff/not_kitty.tiff -------------------------------------------------------------------------------- /examples/src/test/seeds/url/ftp: -------------------------------------------------------------------------------- 1 | ftp://foo:bar@ftp.gnu.org/proj/file.gz 2 | -------------------------------------------------------------------------------- /examples/src/test/seeds/url/http: -------------------------------------------------------------------------------- 1 | http://www.example.com?p=q&c=d#line123 2 | -------------------------------------------------------------------------------- /examples/src/test/seeds/xml/build.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | simple example build file 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 19 | 20 | 21 | 22 | 23 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /examples/src/test/seeds/zeros/zeros1024.input: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /fuzz/src/main/assembly/assembly.xml: -------------------------------------------------------------------------------- 1 | 5 | zest-cli 6 | 7 | jar 8 | 9 | false 10 | 11 | 12 | / 13 | true 14 | true 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /fuzz/src/main/c/afl-proxy.h: -------------------------------------------------------------------------------- 1 | #ifndef PROXY_H 2 | #define PROXY_H 3 | 4 | /* 5 | Collection of definitions taken 6 | from AFL's config.h and types.h. 7 | 8 | These definitions are duplicated here so 9 | that JQF would not need to depend on AFL 10 | being locally installed with header files, et al. 11 | */ 12 | 13 | #include 14 | #include 15 | 16 | typedef uint8_t u8; 17 | typedef uint16_t u16; 18 | typedef uint32_t u32; 19 | 20 | #define MAP_SIZE (1 << 16) 21 | #define PERF_SIZE (1 << 14) 22 | 23 | #define SHM_ENV_VAR "__AFL_SHM_ID" 24 | #define FORKSRV_FD 198 25 | 26 | #endif // PROXY_H 27 | -------------------------------------------------------------------------------- /fuzz/src/main/java/edu/berkeley/cs/jqf/fuzz/difffuzz/Comparison.java: -------------------------------------------------------------------------------- 1 | package edu.berkeley.cs.jqf.fuzz.difffuzz; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * The {@link Comparison} annotation marks a method as a comparison 10 | * function for regression-based fuzz testing. 11 | */ 12 | @Target({ElementType.METHOD}) 13 | @Retention(RetentionPolicy.RUNTIME) 14 | public @interface Comparison { 15 | } 16 | -------------------------------------------------------------------------------- /fuzz/src/main/java/edu/berkeley/cs/jqf/fuzz/difffuzz/DiffException.java: -------------------------------------------------------------------------------- 1 | package edu.berkeley.cs.jqf.fuzz.difffuzz; 2 | 3 | public class DiffException extends RuntimeException { 4 | Outcome out1, out2; 5 | public DiffException(Outcome o1, Outcome o2) { 6 | super("diff between \"" + o1 + "\" and \"" + o2 + "\""); 7 | out1 = o1; 8 | out2 = o2; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /fuzz/src/main/java/edu/berkeley/cs/jqf/fuzz/difffuzz/DiffFuzz.java: -------------------------------------------------------------------------------- 1 | package edu.berkeley.cs.jqf.fuzz.difffuzz; 2 | 3 | import java.lang.annotation.ElementType; 4 | import java.lang.annotation.Retention; 5 | import java.lang.annotation.RetentionPolicy; 6 | import java.lang.annotation.Target; 7 | 8 | /** 9 | * The {@link DiffFuzz} annotation marks a method as an entry-point for 10 | * regression-based fuzz testing. 11 | */ 12 | @Target({ElementType.METHOD}) 13 | @Retention(RetentionPolicy.RUNTIME) 14 | public @interface DiffFuzz { 15 | String cmp() default ""; 16 | } 17 | -------------------------------------------------------------------------------- /fuzz/src/main/java/edu/berkeley/cs/jqf/fuzz/difffuzz/DiffFuzzGuidance.java: -------------------------------------------------------------------------------- 1 | package edu.berkeley.cs.jqf.fuzz.difffuzz; 2 | 3 | import edu.berkeley.cs.jqf.fuzz.guidance.Guidance; 4 | import edu.berkeley.cs.jqf.fuzz.guidance.GuidanceException; 5 | import edu.berkeley.cs.jqf.fuzz.junit.TrialRunner; 6 | import edu.berkeley.cs.jqf.instrument.InstrumentationException; 7 | import org.junit.runners.model.FrameworkMethod; 8 | 9 | import java.lang.reflect.Method; 10 | 11 | public interface DiffFuzzGuidance extends Guidance { 12 | void setCompare(Method m); 13 | 14 | /** common utility method for use in run */ 15 | default Outcome getOutcome(Class clazz, FrameworkMethod method, Object[] args) { 16 | try { 17 | TrialRunner dtr = new TrialRunner(clazz, method, args); 18 | dtr.run(); 19 | return new Outcome(dtr.getOutput(), null); 20 | } catch(InstrumentationException e) { 21 | throw new GuidanceException(e); 22 | } catch (GuidanceException e) { 23 | throw e; 24 | } catch(Throwable e) { 25 | return new Outcome(null, e); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /fuzz/src/main/java/edu/berkeley/cs/jqf/fuzz/difffuzz/DiffFuzzNoGuidance.java: -------------------------------------------------------------------------------- 1 | package edu.berkeley.cs.jqf.fuzz.difffuzz; 2 | 3 | import edu.berkeley.cs.jqf.fuzz.junit.TrialRunner; 4 | import edu.berkeley.cs.jqf.fuzz.random.NoGuidance; 5 | import org.junit.runners.model.FrameworkMethod; 6 | import org.junit.runners.model.TestClass; 7 | 8 | import java.io.PrintStream; 9 | import java.lang.reflect.Method; 10 | 11 | public class DiffFuzzNoGuidance extends NoGuidance implements DiffFuzzGuidance { 12 | public DiffFuzzNoGuidance(long maxTrials, PrintStream out) { 13 | super(maxTrials, out); 14 | } 15 | 16 | @Override 17 | public void setCompare(Method m) {} 18 | } 19 | -------------------------------------------------------------------------------- /fuzz/src/main/java/edu/berkeley/cs/jqf/fuzz/difffuzz/Outcome.java: -------------------------------------------------------------------------------- 1 | package edu.berkeley.cs.jqf.fuzz.difffuzz; 2 | 3 | import java.io.Serializable; 4 | import java.lang.reflect.InvocationTargetException; 5 | import java.lang.reflect.Method; 6 | 7 | /* 8 | To make outcomes easier to deal with and keep track of 9 | (diff functions always terminate either with a return value or by throwing something) 10 | */ 11 | public class Outcome implements Serializable { 12 | public final Object output; 13 | public final Throwable thrown; 14 | 15 | public Outcome(Object o, Throwable t) { 16 | output = o; 17 | thrown = t; 18 | } 19 | 20 | public static boolean same(Outcome o1, Outcome o2, Method compare) throws InvocationTargetException, IllegalAccessException { 21 | if ((o1.thrown == null) ^ (o2.thrown == null)) return false; 22 | if (o1.thrown != null) { 23 | return o1.thrown.getClass().getName().equals(o2.thrown.getClass().getName()); 24 | } 25 | return Boolean.TRUE.equals(compare.invoke(null, o1.output, o2.output)); 26 | } 27 | 28 | @Override 29 | public String toString() { 30 | if(thrown == null) return "threw nothing, output " + output; 31 | return "threw " + thrown + ", no output"; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /fuzz/src/main/java/edu/berkeley/cs/jqf/fuzz/ei/state/FastExecutionIndexingState.java: -------------------------------------------------------------------------------- 1 | package edu.berkeley.cs.jqf.fuzz.ei.state; 2 | 3 | import janala.instrument.FastCoverageListener; 4 | 5 | // This logic is similar to FastNonCollidingCoverage. 6 | // We should consider merging them. Note we only 7 | // track EI in main thread to avoid non-determinism. 8 | public class FastExecutionIndexingState extends AbstractExecutionIndexingState implements FastCoverageListener { 9 | @Override 10 | public void logMethodBegin(int iid) { 11 | if (Thread.currentThread().getId() == 1) { 12 | setLastEventIid(iid); 13 | pushCall(iid); 14 | } 15 | } 16 | 17 | @Override 18 | public void logMethodEnd(int iid) { 19 | if (Thread.currentThread().getId() == 1) { 20 | setLastEventIid(iid); 21 | popReturn(iid); 22 | } 23 | } 24 | 25 | @Override 26 | public void logJump(int iid, int branch) { 27 | if (Thread.currentThread().getId() == 1) { 28 | setLastEventIid(iid + branch); 29 | } 30 | } 31 | 32 | @Override 33 | public void logLookUpSwitch(int value, int iid, int dflt, int[] cases) { 34 | // Compute arm index or else default 35 | if (Thread.currentThread().getId() == 1) { 36 | int arm = cases.length; 37 | for (int i = 0; i < cases.length; i++) { 38 | if (value == cases[i]) { 39 | arm = i; 40 | break; 41 | } 42 | } 43 | arm++; 44 | setLastEventIid(iid + arm); 45 | } 46 | } 47 | 48 | @Override 49 | public void logTableSwitch(int value, int iid, int min, int max, int dflt) { 50 | if (Thread.currentThread().getId() == 1) { 51 | int arm = 1 + max - min; 52 | if (value >= min && value <= max) { 53 | arm = value - min; 54 | } 55 | arm++; 56 | setLastEventIid(iid + arm); 57 | } 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /fuzz/src/main/java/edu/berkeley/cs/jqf/fuzz/guidance/TimeoutException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018, The Regents of the University of California 3 | * 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are 8 | * met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | package edu.berkeley.cs.jqf.fuzz.guidance; 30 | 31 | 32 | public class TimeoutException extends RuntimeException { 33 | 34 | public TimeoutException() { 35 | super("Timeout"); 36 | } 37 | 38 | public TimeoutException(long elapsed, long limit) { 39 | super(String.format("Timeout - %s msec elapsed; limit was %s", elapsed, limit)); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /fuzz/src/main/java/edu/berkeley/cs/jqf/fuzz/util/CoverageFactory.java: -------------------------------------------------------------------------------- 1 | package edu.berkeley.cs.jqf.fuzz.util; 2 | 3 | import edu.berkeley.cs.jqf.fuzz.ei.state.AbstractExecutionIndexingState; 4 | import edu.berkeley.cs.jqf.fuzz.ei.state.FastExecutionIndexingState; 5 | import edu.berkeley.cs.jqf.fuzz.ei.state.JanalaExecutionIndexingState; 6 | 7 | import java.io.FileInputStream; 8 | import java.io.IOException; 9 | import java.io.InputStream; 10 | import java.util.Properties; 11 | 12 | public class CoverageFactory { 13 | 14 | public static final String propFile = System.getProperty("janala.conf", "janala.conf"); 15 | 16 | private static boolean FAST_NON_COLLIDING_COVERAGE_ENABLED; 17 | static 18 | { 19 | Properties properties = new Properties(); 20 | try (InputStream propStream = new FileInputStream(propFile)) { 21 | properties.load(propStream); 22 | } catch (IOException e) { 23 | // Swallow exception and continue with defaults 24 | // System.err.println("Warning: No janala.conf file found"); 25 | } 26 | properties.putAll(System.getProperties()); 27 | FAST_NON_COLLIDING_COVERAGE_ENABLED = Boolean.parseBoolean(properties.getProperty("useFastNonCollidingCoverageInstrumentation", "false")); 28 | } 29 | 30 | public static ICoverage newInstance() { 31 | if (FAST_NON_COLLIDING_COVERAGE_ENABLED) { 32 | return new FastNonCollidingCoverage(); 33 | } else { 34 | return new Coverage(); 35 | } 36 | } 37 | 38 | public static AbstractExecutionIndexingState newEIState() { 39 | if (FAST_NON_COLLIDING_COVERAGE_ENABLED) { 40 | return new FastExecutionIndexingState(); 41 | } else { 42 | return new JanalaExecutionIndexingState(); 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /fuzz/src/main/java/edu/berkeley/cs/jqf/fuzz/util/ICoverage.java: -------------------------------------------------------------------------------- 1 | package edu.berkeley.cs.jqf.fuzz.util; 2 | 3 | import org.eclipse.collections.api.list.primitive.IntList; 4 | 5 | public interface ICoverage { 6 | /** 7 | * Returns the size of the coverage map. 8 | * 9 | * @return the size of the coverage map 10 | */ 11 | int size(); 12 | 13 | /** 14 | * Returns the number of edges covered. 15 | * 16 | * @return the number of edges with non-zero counts 17 | */ 18 | int getNonZeroCount(); 19 | 20 | /** 21 | * Returns a collection of branches that are covered. 22 | * 23 | * @return a collection of keys that are covered 24 | */ 25 | IntList getCovered(); 26 | 27 | /** 28 | * Returns a set of edges in this coverage that don't exist in baseline 29 | * 30 | * @param baseline the baseline coverage 31 | * @return the set of edges that do not exist in {@code baseline} 32 | */ 33 | IntList computeNewCoverage(ICoverage baseline); 34 | 35 | /** 36 | * Clears the coverage map. 37 | */ 38 | void clear(); 39 | 40 | /** 41 | * Updates this coverage with bits from the parameter. 42 | * 43 | * @param that the run coverage whose bits to OR 44 | * 45 | * @return true iff that is not a subset 46 | * of this, causing this to change. 47 | */ 48 | boolean updateBits(ICoverage that); 49 | 50 | /** 51 | * Returns a hash code of the list of edges that have been covered at least once. 52 | * 53 | * @return a hash of non-zero entries 54 | */ 55 | int nonZeroHashCode(); 56 | 57 | Counter getCounter(); 58 | 59 | ICoverage copy(); 60 | } 61 | -------------------------------------------------------------------------------- /fuzz/src/main/java/edu/berkeley/cs/jqf/fuzz/util/MovingAverage.java: -------------------------------------------------------------------------------- 1 | package edu.berkeley.cs.jqf.fuzz.util; 2 | 3 | import java.util.Arrays; 4 | 5 | /** 6 | * MovingAverage - A data structure for collecting a moving average. 7 | * 8 | * @author Raffi Sanna 9 | */ 10 | public class MovingAverage { 11 | /** The most recently seen values */ 12 | int recent[]; 13 | 14 | /** The amount of elements filled with valid values */ 15 | int size = 0; 16 | 17 | /** The next slot to be filled in */ 18 | int next = 0; 19 | 20 | /** 21 | * Constructs a moving average of the most recent {@code cap} arguments 22 | * 23 | * @param cap The number of elements to be remembered 24 | */ 25 | public MovingAverage(int cap) { 26 | assert cap > 0; 27 | recent = new int[cap]; 28 | } 29 | 30 | /** 31 | * Adds a number to the set of numbers used to find the moving average. 32 | * 33 | * @param a The number to be added 34 | */ 35 | public void add(int a) { 36 | size = Integer.min(recent.length, size + 1); 37 | recent[next] = a; 38 | next = (next + 1) % recent.length; 39 | } 40 | 41 | /** 42 | * Gets the moving average itself, or {@code 0} if nothing has been added. 43 | * 44 | * @return the moving average 45 | */ 46 | public double get() { 47 | return Arrays.stream(recent).limit(size).average().orElse(0); 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /fuzz/src/main/java/edu/berkeley/cs/jqf/fuzz/util/ThrowingRunnable.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2020, The Regents of the University of California 3 | * 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are 8 | * met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | package edu.berkeley.cs.jqf.fuzz.util; 30 | 31 | /** 32 | * A version of {@link Runnable} that throws arbitrary, possibly checked, exceptions. 33 | * 34 | * Useful for wrapping checked exceptions with unchecked exceptions, such as during 35 | * guided fuzzing 36 | * (see: {@link edu.berkeley.cs.jqf.fuzz.guidance.GuidanceException#wrap(ThrowingRunnable)}) 37 | */ 38 | @FunctionalInterface 39 | public interface ThrowingRunnable { 40 | void run() throws Exception; 41 | } 42 | -------------------------------------------------------------------------------- /fuzz/src/main/resources/META-INF/services/com.pholser.junit.quickcheck.generator.Generator: -------------------------------------------------------------------------------- 1 | edu.berkeley.cs.jqf.fuzz.junit.quickcheck.InputStreamGenerator 2 | 3 | -------------------------------------------------------------------------------- /instrument/src/main/java/edu/berkeley/cs/jqf/instrument/InstrumentationException.java: -------------------------------------------------------------------------------- 1 | package edu.berkeley.cs.jqf.instrument; 2 | 3 | public class InstrumentationException extends RuntimeException { 4 | public InstrumentationException(String msg) { 5 | super(msg); 6 | } 7 | 8 | public InstrumentationException(String msg, Throwable cause) { 9 | super(msg, cause); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /instrument/src/main/java/edu/berkeley/cs/jqf/instrument/tracing/FastCoverageSnoop.java: -------------------------------------------------------------------------------- 1 | package edu.berkeley.cs.jqf.instrument.tracing; 2 | 3 | import janala.instrument.FastCoverageListener; 4 | 5 | public class FastCoverageSnoop { 6 | static FastCoverageListener coverageListener = new FastCoverageListener.Default(); 7 | 8 | @SuppressWarnings("unused") //Invoked by instrumentation 9 | public static void LOGMETHODBEGIN(int iid) { 10 | coverageListener.logMethodBegin(iid); 11 | } 12 | 13 | public static void LOGMETHODEND(int iid) { 14 | coverageListener.logMethodEnd(iid); 15 | } 16 | 17 | @SuppressWarnings("unused") //Invoked by instrumentation 18 | public static void LOGJUMP(int iid, int branch) { 19 | coverageListener.logJump(iid, branch); 20 | } 21 | 22 | @SuppressWarnings("unused") //Invoked by instrumentation 23 | public static void LOGLOOKUPSWITCH(int value, int iid, int dflt, int[] cases) { 24 | coverageListener.logLookUpSwitch(value, iid, dflt, cases); 25 | } 26 | 27 | @SuppressWarnings("unused") //Invoked by instrumentation 28 | public static void LOGTABLESWITCH(int value, int iid, int min, int max, int dflt) { 29 | coverageListener.logTableSwitch(value, iid, min, max, dflt); 30 | } 31 | 32 | public static void setFastCoverageListener(FastCoverageListener runCoverage) { 33 | coverageListener = runCoverage; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /instrument/src/main/java/edu/berkeley/cs/jqf/instrument/tracing/events/TraceEventVisitor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017-2018 The Regents of the University of California 3 | * 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are 8 | * met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | package edu.berkeley.cs.jqf.instrument.tracing.events; 30 | 31 | /** 32 | * Visitor class for {@code TraceEvent} instances. 33 | * 34 | * @author Rohan Padhye 35 | */ 36 | public interface TraceEventVisitor { 37 | 38 | default void visitAllocEvent(AllocEvent e) {} 39 | 40 | default void visitBranchEvent(BranchEvent e) {} 41 | 42 | default void visitCallEvent(CallEvent e) {} 43 | 44 | default void visitReadEvent(ReadEvent e) {} 45 | 46 | default void visitReturnEvent(ReturnEvent e) {} 47 | } 48 | -------------------------------------------------------------------------------- /instrument/src/main/java/edu/berkeley/cs/jqf/instrument/util/Stack.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017-2018 The Regents of the University of California 3 | * 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are 8 | * met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | package edu.berkeley.cs.jqf.instrument.util; 31 | 32 | /** 33 | * @author Rohan Padhye 34 | */ 35 | public interface Stack { 36 | void push(T item); 37 | T peek(); 38 | T pop(); 39 | boolean isEmpty(); 40 | void clear(); 41 | } 42 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2012, NTT Multimedia Communications Laboratories, Inc. and Koushik Sen 2 | Copyright (c) 2017-18, The Regents of the University of California 3 | Copyright (c) 2020-2021 Rohan Padhye 4 | 5 | All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are 9 | met: 10 | 11 | 1. Redistributions of source code must retain the above copyright 12 | notice, this list of conditions and the following disclaimer. 13 | 14 | 2. Redistributions in binary form must reproduce the above copyright 15 | notice, this list of conditions and the following disclaimer in the 16 | documentation and/or other materials provided with the distribution. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/instrument/FastCoverageListener.java: -------------------------------------------------------------------------------- 1 | package janala.instrument; 2 | 3 | public interface FastCoverageListener { 4 | class Default implements FastCoverageListener { 5 | public void logMethodBegin(int iid) {} 6 | 7 | public void logMethodEnd(int iid) {} 8 | 9 | public void logJump(int iid, int branch) {} 10 | 11 | public void logLookUpSwitch(int value, int iid, int dflt, int[] cases) {} 12 | 13 | public void logTableSwitch(int value, int iid, int min, int max, int dflt) {} 14 | } 15 | 16 | void logMethodBegin(int iid); 17 | 18 | void logMethodEnd(int iid); 19 | 20 | void logJump(int iid, int branch); 21 | 22 | void logLookUpSwitch(int value, int iid, int dflt, int[] cases); 23 | 24 | void logTableSwitch(int value, int iid, int min, int max, int dflt); 25 | } 26 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/instrument/GlobalStateForInstrumentation.java: -------------------------------------------------------------------------------- 1 | package janala.instrument; 2 | 3 | /** An object to keep track of (classId, methodId, instructionId) tuples during 4 | instrumentation. */ 5 | public class GlobalStateForInstrumentation { 6 | public static GlobalStateForInstrumentation instance = new GlobalStateForInstrumentation(); 7 | private int iid = 0; 8 | private int mid = 0; 9 | private int cid = 0; 10 | 11 | // JQF's Fast Coverage implementation uses a plain int, no bit packing, no truncation errors 12 | private int fastCoverageIID = 0; 13 | public int incAndGetFastCoverageId(){ 14 | fastCoverageIID++; 15 | return fastCoverageIID; 16 | } 17 | 18 | 19 | // When one gets the id, she gets the result of merging all three ids. 20 | // NOTE: Beaware of truncation errors. 21 | private final static int CBITS = 10; // CID occupies the upper 10 bits 22 | private final static int MBITS = 10; // MID occupies the next 10 bits 23 | private final static int IBITS = 32 - CBITS - MBITS; // MID occupies the remaining 12 bits 24 | 25 | public int incAndGetId() { 26 | iid++; 27 | validate(iid, IBITS); 28 | return getId(); 29 | } 30 | 31 | public int getId() { 32 | return (cid << (32 - CBITS)) + (mid << (32 - CBITS - MBITS)) + iid; 33 | } 34 | 35 | public int getMid() { 36 | return mid; 37 | } 38 | 39 | public void incMid() { 40 | this.mid++; 41 | validate(mid, MBITS); 42 | this.iid = 0; 43 | } 44 | 45 | public int getCid() { 46 | return cid; 47 | } 48 | 49 | public void setCid(int cid) { 50 | cid = Math.abs(cid) % (1 << CBITS); 51 | this.iid = 0; 52 | this.mid = 0; 53 | this.cid = cid; 54 | } 55 | 56 | private void validate(int id, int bits) { 57 | if (id < 0 || id >= (1 << bits)) { 58 | throw new IllegalArgumentException("Invalid instruction ID range"); 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/instrument/SnoopInstructionClassAdapter.java: -------------------------------------------------------------------------------- 1 | 2 | package janala.instrument; 3 | 4 | import org.objectweb.asm.ClassVisitor; 5 | import org.objectweb.asm.MethodVisitor; 6 | import org.objectweb.asm.Opcodes; 7 | 8 | 9 | public class SnoopInstructionClassAdapter extends ClassVisitor { 10 | private final String className; 11 | private String superName; 12 | 13 | public SnoopInstructionClassAdapter(ClassVisitor cv, String className) { 14 | super(Opcodes.ASM8, cv); 15 | this.className = className; 16 | } 17 | 18 | @Override 19 | public void visit(int version, 20 | int access, 21 | String name, 22 | String signature, 23 | String superName, 24 | String[] interfaces) { 25 | assert name.equals(this.className); 26 | this.superName = superName; 27 | cv.visit(version, access, name, signature, superName, interfaces); 28 | } 29 | 30 | @Override 31 | public MethodVisitor visitMethod(int access, String name, String desc, 32 | String signature, String[] exceptions) { 33 | MethodVisitor mv = cv.visitMethod(access, name, desc, signature, exceptions); 34 | if (mv != null) { 35 | if(Config.instance.useFastCoverageInstrumentation){ 36 | return new FastCoverageMethodAdapter(mv, className, name, desc, superName, GlobalStateForInstrumentation.instance); 37 | }else { 38 | return new SnoopInstructionMethodAdapter(mv, className, name, desc, superName, 39 | GlobalStateForInstrumentation.instance, (access & Opcodes.ACC_STATIC) != 0); 40 | } 41 | } 42 | return null; 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/instrument/TryCatchBlock.java: -------------------------------------------------------------------------------- 1 | package janala.instrument; 2 | 3 | import org.objectweb.asm.Label; 4 | import org.objectweb.asm.MethodVisitor; 5 | 6 | /** 7 | * Author: Koushik Sen (ksen@cs.berkeley.edu) 8 | * Date: 7/1/12 9 | * Time: 10:50 PM 10 | */ 11 | public class TryCatchBlock { 12 | Label label; 13 | Label label1; 14 | Label label2; 15 | String type; 16 | 17 | public TryCatchBlock(Label label, Label label1, Label label2, String type) { 18 | this.label = label; 19 | this.label1 = label1; 20 | this.label2 = label2; 21 | this.type = type; 22 | } 23 | 24 | public void visit(MethodVisitor mv) { 25 | mv.visitTryCatchBlock(label, label1, label2, type); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/StringLogger.java: -------------------------------------------------------------------------------- 1 | package janala.logger; 2 | 3 | import janala.logger.inst.Instruction; 4 | 5 | public class StringLogger extends AbstractLogger { 6 | 7 | private StringBuffer buffer; 8 | private boolean init; 9 | 10 | public StringLogger() { 11 | buffer = new StringBuffer(); 12 | init = true; 13 | } 14 | 15 | @Override 16 | protected void log(Instruction insn) { 17 | if (!init) { 18 | buffer.append("\n"); 19 | } else { 20 | init = false; 21 | } 22 | buffer.append(insn.toString()); 23 | } 24 | 25 | public String getLog() { 26 | return buffer.toString(); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/StringPrintLogger.java: -------------------------------------------------------------------------------- 1 | package janala.logger; 2 | 3 | import janala.logger.inst.Instruction; 4 | 5 | public class StringPrintLogger extends AbstractLogger { 6 | private final StringLogger logger; 7 | 8 | private class FinishThread extends Thread { 9 | @Override 10 | public void run() { 11 | System.out.println("========== Instructions ========="); 12 | System.out.println(logger.getLog()); 13 | System.out.println("========== End ========="); 14 | } 15 | } 16 | 17 | public StringPrintLogger() { 18 | logger = new StringLogger(); 19 | Runtime.getRuntime().addShutdownHook(new FinishThread()); 20 | } 21 | 22 | @Override 23 | protected void log(Instruction insn) { 24 | logger.log(insn); 25 | } 26 | 27 | 28 | } 29 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/AALOAD.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class AALOAD extends Instruction { 4 | public AALOAD(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitAALOAD(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "AALOAD iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/AASTORE.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class AASTORE extends Instruction { 4 | public AASTORE(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitAASTORE(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "AASTORE iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/ACONST_NULL.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class ACONST_NULL extends Instruction { 4 | public ACONST_NULL(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitACONST_NULL(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "ACONST_NULL iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/ALOAD.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class ALOAD extends Instruction { 4 | public int var; 5 | 6 | public ALOAD(int iid, int mid, int var) { 7 | super(iid, mid); 8 | this.var = var; 9 | } 10 | 11 | public void visit(IVisitor visitor) { 12 | visitor.visitALOAD(this); 13 | } 14 | 15 | @Override 16 | public String toString() { 17 | return "ALOAD iid=" + iid + " mid=" + mid + " var=" + var; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/ANEWARRAY.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class ANEWARRAY extends Instruction { 4 | String type; 5 | 6 | public ANEWARRAY(int iid, int mid, String type) { 7 | super(iid, mid); 8 | this.type = type; 9 | } 10 | 11 | public void visit(IVisitor visitor) { 12 | visitor.visitANEWARRAY(this); 13 | } 14 | 15 | @Override 16 | public String toString() { 17 | return "ANEWARRAY iid=" + iid + " mid=" + mid + " type=" + type; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/ARETURN.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class ARETURN extends Instruction { 4 | public ARETURN(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitARETURN(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "ARETURN iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/ARRAYLENGTH.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class ARRAYLENGTH extends Instruction { 4 | public ARRAYLENGTH(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitARRAYLENGTH(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "ARRAYLENGTH iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/ASTORE.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class ASTORE extends Instruction { 4 | public int var; 5 | 6 | public ASTORE(int iid, int mid, int var) { 7 | super(iid, mid); 8 | this.var = var; 9 | } 10 | 11 | public void visit(IVisitor visitor) { 12 | visitor.visitASTORE(this); 13 | } 14 | 15 | @Override 16 | public String toString() { 17 | return "ASTORE iid=" + iid + " mid=" + mid + " var=" + var; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/ATHROW.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class ATHROW extends Instruction { 4 | public ATHROW(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitATHROW(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "ATHROW iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/BALOAD.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class BALOAD extends Instruction { 4 | public BALOAD(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitBALOAD(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "BALOAD iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/BASTORE.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class BASTORE extends Instruction { 4 | public BASTORE(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitBASTORE(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "BASTORE iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/BIPUSH.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class BIPUSH extends Instruction { 4 | public int value; 5 | 6 | public BIPUSH(int iid, int mid, int value) { 7 | super(iid, mid); 8 | this.value = value; 9 | } 10 | 11 | public void visit(IVisitor visitor) { 12 | visitor.visitBIPUSH(this); 13 | } 14 | 15 | @Override 16 | public String toString() { 17 | return "BIPUSH iid=" + iid + " mid=" + mid + " value=" + value; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/CALOAD.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class CALOAD extends Instruction { 4 | public CALOAD(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitCALOAD(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "CALOAD iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/CASTORE.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class CASTORE extends Instruction { 4 | public CASTORE(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitCASTORE(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "CASTORE iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/CHECKCAST.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class CHECKCAST extends Instruction { 4 | String type; 5 | 6 | public CHECKCAST(int iid, int mid, String type) { 7 | super(iid, mid); 8 | this.type = type; 9 | } 10 | 11 | public void visit(IVisitor visitor) { 12 | visitor.visitCHECKCAST(this); 13 | } 14 | 15 | @Override 16 | public String toString() { 17 | return "CHECKCAST iid=" + iid + " mid=" + mid + " type=" + type; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/ConditionalBranch.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017-2018 The Regents of the University of California 3 | * 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are 8 | * met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | package janala.logger.inst; 30 | 31 | /** 32 | * @author Rohan Padhye 33 | */ 34 | public interface ConditionalBranch { 35 | } 36 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/D2F.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class D2F extends Instruction { 4 | public D2F(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitD2F(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "D2F iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/D2I.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class D2I extends Instruction { 4 | public D2I(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitD2I(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "D2I iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/D2L.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class D2L extends Instruction { 4 | public D2L(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitD2L(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "D2L iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/DADD.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class DADD extends Instruction { 4 | public DADD(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitDADD(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "DADD iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/DALOAD.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class DALOAD extends Instruction { 4 | public DALOAD(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitDALOAD(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "DALOAD iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/DASTORE.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class DASTORE extends Instruction { 4 | public DASTORE(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitDASTORE(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "DASTORE iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/DCMPG.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class DCMPG extends Instruction { 4 | public DCMPG(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitDCMPG(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "DCMPG iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/DCMPL.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class DCMPL extends Instruction { 4 | public DCMPL(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitDCMPL(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "DCMPL iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/DCONST_0.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class DCONST_0 extends Instruction { 4 | public DCONST_0(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitDCONST_0(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "DCONST_0 iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/DCONST_1.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class DCONST_1 extends Instruction { 4 | public DCONST_1(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitDCONST_1(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "DCONST_1 iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/DDIV.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class DDIV extends Instruction { 4 | public DDIV(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitDDIV(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "DDIV iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/DLOAD.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class DLOAD extends Instruction { 4 | public int var; 5 | 6 | public DLOAD(int iid, int mid, int var) { 7 | super(iid, mid); 8 | this.var = var; 9 | } 10 | 11 | public void visit(IVisitor visitor) { 12 | visitor.visitDLOAD(this); 13 | } 14 | 15 | @Override 16 | public String toString() { 17 | return "DLOAD iid=" + iid + " mid=" + mid + " var=" + var; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/DMUL.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class DMUL extends Instruction { 4 | public DMUL(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitDMUL(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "DMUL iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/DNEG.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class DNEG extends Instruction { 4 | public DNEG(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitDNEG(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "DNEG iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/DREM.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class DREM extends Instruction { 4 | public DREM(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitDREM(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "DREM iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/DRETURN.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class DRETURN extends Instruction { 4 | public DRETURN(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitDRETURN(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "DRETURN iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/DSTORE.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class DSTORE extends Instruction { 4 | public int var; 5 | 6 | public DSTORE(int iid, int mid, int var) { 7 | super(iid, mid); 8 | this.var = var; 9 | } 10 | 11 | public void visit(IVisitor visitor) { 12 | visitor.visitDSTORE(this); 13 | } 14 | 15 | @Override 16 | public String toString() { 17 | return "DSTORE iid=" + iid + " mid=" + mid + " var=" + var; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/DSUB.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class DSUB extends Instruction { 4 | public DSUB(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitDSUB(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "DSUB iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/DUP.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class DUP extends Instruction { 4 | public DUP(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitDUP(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "DUP iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/DUP2.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class DUP2 extends Instruction { 4 | public DUP2(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitDUP2(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "DUP2 iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/DUP2_X1.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class DUP2_X1 extends Instruction { 4 | public DUP2_X1(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitDUP2_X1(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "DUP2_X1 iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/DUP2_X2.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class DUP2_X2 extends Instruction { 4 | public DUP2_X2(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitDUP2_X2(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "DUP2_X2 iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/DUP_X1.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class DUP_X1 extends Instruction { 4 | public DUP_X1(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitDUP_X1(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "DUP_X1 iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/DUP_X2.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class DUP_X2 extends Instruction { 4 | public DUP_X2(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitDUP_X2(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "DUP_X2 iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/F2D.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class F2D extends Instruction { 4 | public F2D(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitF2D(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "F2D iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/F2I.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class F2I extends Instruction { 4 | public F2I(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitF2I(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "F2I iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/F2L.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class F2L extends Instruction { 4 | public F2L(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitF2L(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "F2L iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/FADD.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class FADD extends Instruction { 4 | public FADD(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitFADD(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "FADD iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/FALOAD.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class FALOAD extends Instruction { 4 | public FALOAD(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitFALOAD(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "FALOAD iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/FASTORE.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class FASTORE extends Instruction { 4 | public FASTORE(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitFASTORE(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "FASTORE iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/FCMPG.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class FCMPG extends Instruction { 4 | public FCMPG(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitFCMPG(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "FCMPG iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/FCMPL.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class FCMPL extends Instruction { 4 | public FCMPL(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitFCMPL(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "FCMPL iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/FCONST_0.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class FCONST_0 extends Instruction { 4 | public FCONST_0(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitFCONST_0(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "FCONST_0 iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/FCONST_1.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class FCONST_1 extends Instruction { 4 | public FCONST_1(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitFCONST_1(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "FCONST_1 iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/FCONST_2.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class FCONST_2 extends Instruction { 4 | public FCONST_2(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitFCONST_2(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "FCONST_2 iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/FDIV.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class FDIV extends Instruction { 4 | public FDIV(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitFDIV(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "FDIV iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/FLOAD.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class FLOAD extends Instruction { 4 | public int var; 5 | 6 | public FLOAD(int iid, int mid, int var) { 7 | super(iid, mid); 8 | this.var = var; 9 | } 10 | 11 | public void visit(IVisitor visitor) { 12 | visitor.visitFLOAD(this); 13 | } 14 | 15 | @Override 16 | public String toString() { 17 | return "FLOAD iid=" + iid + " mid=" + mid + " var=" + var; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/FMUL.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class FMUL extends Instruction { 4 | public FMUL(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitFMUL(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "FMUL iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/FNEG.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class FNEG extends Instruction { 4 | public FNEG(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitFNEG(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "FNEG iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/FREM.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class FREM extends Instruction { 4 | public FREM(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitFREM(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "FREM iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/FRETURN.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class FRETURN extends Instruction { 4 | public FRETURN(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitFRETURN(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "FRETURN iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/FSTORE.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class FSTORE extends Instruction { 4 | public int var; 5 | 6 | public FSTORE(int iid, int mid, int var) { 7 | super(iid, mid); 8 | this.var = var; 9 | } 10 | 11 | public void visit(IVisitor visitor) { 12 | visitor.visitFSTORE(this); 13 | } 14 | 15 | @Override 16 | public String toString() { 17 | return "FSTORE iid=" + iid + " mid=" + mid + " var=" + var; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/FSUB.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class FSUB extends Instruction { 4 | public FSUB(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitFSUB(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "FSUB iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/GETFIELD.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class GETFIELD extends Instruction { 4 | public int cIdx; 5 | public int fIdx; 6 | public String desc; 7 | 8 | public GETFIELD(int iid, int mid, int cIdx, int fIdx, String desc) { 9 | super(iid, mid); 10 | this.cIdx = cIdx; 11 | this.fIdx = fIdx; 12 | this.desc = desc; 13 | } 14 | 15 | public void visit(IVisitor visitor) { 16 | visitor.visitGETFIELD(this); 17 | } 18 | 19 | @Override 20 | public String toString() { 21 | return "GETFIELD iid=" 22 | + iid 23 | + " mid=" 24 | + mid 25 | + " cIdx=" 26 | + cIdx 27 | + " fIdx=" 28 | + fIdx 29 | + " desc=" 30 | + desc; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/GETSTATIC.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class GETSTATIC extends Instruction { 4 | public int cIdx; 5 | public int fIdx; 6 | public String desc; 7 | 8 | public GETSTATIC(int iid, int mid, int cIdx, int fIdx, String desc) { 9 | super(iid, mid); 10 | this.cIdx = cIdx; 11 | this.fIdx = fIdx; 12 | this.desc = desc; 13 | } 14 | 15 | public void visit(IVisitor visitor) { 16 | visitor.visitGETSTATIC(this); 17 | } 18 | 19 | @Override 20 | public String toString() { 21 | return "GETSTATIC iid=" 22 | + iid 23 | + " mid=" 24 | + mid 25 | + " cIdx=" 26 | + cIdx 27 | + " fIdx=" 28 | + fIdx 29 | + " desc=" 30 | + desc; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/GETVALUE.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017-2018 The Regents of the University of California 3 | * 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are 8 | * met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | package janala.logger.inst; 30 | 31 | public interface GETVALUE { 32 | // Implemented by all GETVALUE instructions 33 | } 34 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/GETVALUE_Object.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class GETVALUE_Object extends Instruction implements GETVALUE { 4 | public int v; 5 | public boolean isString; 6 | public String string; 7 | 8 | public GETVALUE_Object(int v, String string, boolean isString) { 9 | super(-1, -1); 10 | this.v = v; 11 | this.string = string; 12 | this.isString = isString; 13 | } 14 | 15 | public void visit(IVisitor visitor) { 16 | visitor.visitGETVALUE_Object(this); 17 | } 18 | 19 | @Override 20 | public String toString() { 21 | return "GETVALUE_Object v=" 22 | + Integer.toHexString(v) 23 | + " isString=" 24 | + isString 25 | + (isString ? " string=" + string : ""); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/GETVALUE_boolean.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class GETVALUE_boolean extends Instruction implements GETVALUE { 4 | public boolean v; 5 | 6 | public GETVALUE_boolean(boolean v) { 7 | super(-1, -1); 8 | this.v = v; 9 | } 10 | 11 | public void visit(IVisitor visitor) { 12 | visitor.visitGETVALUE_boolean(this); 13 | } 14 | 15 | @Override 16 | public String toString() { 17 | return "GETVALUE_boolean v=" + v; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/GETVALUE_byte.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class GETVALUE_byte extends Instruction implements GETVALUE { 4 | public byte v; 5 | 6 | public GETVALUE_byte(byte v) { 7 | super(-1, -1); 8 | this.v = v; 9 | } 10 | 11 | public void visit(IVisitor visitor) { 12 | visitor.visitGETVALUE_byte(this); 13 | } 14 | 15 | @Override 16 | public String toString() { 17 | return "GETVALUE_byte v=" + v; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/GETVALUE_char.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class GETVALUE_char extends Instruction implements GETVALUE { 4 | public char v; 5 | 6 | public GETVALUE_char(char v) { 7 | super(-1, -1); 8 | this.v = v; 9 | } 10 | 11 | public void visit(IVisitor visitor) { 12 | visitor.visitGETVALUE_char(this); 13 | } 14 | 15 | @Override 16 | public String toString() { 17 | return "GETVALUE_char v=" + v; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/GETVALUE_double.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class GETVALUE_double extends Instruction implements GETVALUE { 4 | public double v; 5 | 6 | public GETVALUE_double(double v) { 7 | super(-1, -1); 8 | this.v = v; 9 | } 10 | 11 | public void visit(IVisitor visitor) { 12 | visitor.visitGETVALUE_double(this); 13 | } 14 | 15 | @Override 16 | public String toString() { 17 | return "GETVALUE_double v=" + v; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/GETVALUE_float.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class GETVALUE_float extends Instruction implements GETVALUE { 4 | public float v; 5 | 6 | public GETVALUE_float(float v) { 7 | super(-1, -1); 8 | this.v = v; 9 | } 10 | 11 | public void visit(IVisitor visitor) { 12 | visitor.visitGETVALUE_float(this); 13 | } 14 | 15 | @Override 16 | public String toString() { 17 | return "GETVALUE_float v=" + v; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/GETVALUE_int.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class GETVALUE_int extends Instruction implements GETVALUE { 4 | public int v; 5 | 6 | public GETVALUE_int(int v) { 7 | super(-1, -1); 8 | this.v = v; 9 | } 10 | 11 | public void visit(IVisitor visitor) { 12 | visitor.visitGETVALUE_int(this); 13 | } 14 | 15 | @Override 16 | public String toString() { 17 | return "GETVALUE_int v=" + v; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/GETVALUE_long.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class GETVALUE_long extends Instruction implements GETVALUE { 4 | public long v; 5 | 6 | public GETVALUE_long(long v) { 7 | super(-1, -1); 8 | this.v = v; 9 | } 10 | 11 | public void visit(IVisitor visitor) { 12 | visitor.visitGETVALUE_long(this); 13 | } 14 | 15 | @Override 16 | public String toString() { 17 | return "GETVALUE_long v=" + v; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/GETVALUE_short.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class GETVALUE_short extends Instruction implements GETVALUE { 4 | public short v; 5 | 6 | public GETVALUE_short(short v) { 7 | super(-1, -1); 8 | this.v = v; 9 | } 10 | 11 | public void visit(IVisitor visitor) { 12 | visitor.visitGETVALUE_short(this); 13 | } 14 | 15 | @Override 16 | public String toString() { 17 | return "GETVALUE_short v=" + v; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/GETVALUE_void.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class GETVALUE_void extends Instruction implements GETVALUE { 4 | 5 | public GETVALUE_void() { 6 | super(-1, -1); 7 | } 8 | 9 | public void visit(IVisitor visitor) { 10 | visitor.visitGETVALUE_void(this); 11 | } 12 | 13 | @Override 14 | public String toString() { 15 | return "GETVALUE_void"; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/GOTO.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class GOTO extends Instruction { 4 | int label; 5 | 6 | public GOTO(int iid, int mid, int label) { 7 | super(iid, mid); 8 | this.label = label; 9 | } 10 | 11 | public void visit(IVisitor visitor) { 12 | visitor.visitGOTO(this); 13 | } 14 | 15 | @Override 16 | public String toString() { 17 | return "GOTO iid=" + iid + " mid=" + mid + " label=" + label; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/HEAPLOAD.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class HEAPLOAD extends Instruction { 4 | public int objectId; 5 | public String field; 6 | 7 | public HEAPLOAD(int iid, int mid, int objectId, String field) { 8 | super(iid, mid); 9 | this.objectId = objectId; 10 | this.field = field; 11 | } 12 | 13 | public void visit(IVisitor visitor) { 14 | visitor.visitHEAPLOAD(this); 15 | } 16 | 17 | @Override 18 | public String toString() { 19 | return "HEAPLOAD iid=" 20 | + iid 21 | + " mid=" 22 | + mid 23 | + " objectId=" 24 | + objectId 25 | + " field=" 26 | + field; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/I2B.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class I2B extends Instruction { 4 | public I2B(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitI2B(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "I2B iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/I2C.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class I2C extends Instruction { 4 | public I2C(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitI2C(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "I2C iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/I2D.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class I2D extends Instruction { 4 | public I2D(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitI2D(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "I2D iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/I2F.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class I2F extends Instruction { 4 | public I2F(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitI2F(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "I2F iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/I2L.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class I2L extends Instruction { 4 | public I2L(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitI2L(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "I2L iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/I2S.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class I2S extends Instruction { 4 | public I2S(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitI2S(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "I2S iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/IADD.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class IADD extends Instruction { 4 | public IADD(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitIADD(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "IADD iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/IALOAD.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class IALOAD extends Instruction { 4 | public IALOAD(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitIALOAD(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "IALOAD iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/IAND.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class IAND extends Instruction { 4 | public IAND(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitIAND(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "IAND iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/IASTORE.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class IASTORE extends Instruction { 4 | public IASTORE(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitIASTORE(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "IASTORE iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/ICONST_0.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class ICONST_0 extends Instruction { 4 | public ICONST_0(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitICONST_0(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "ICONST_0 iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/ICONST_1.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class ICONST_1 extends Instruction { 4 | public ICONST_1(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitICONST_1(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "ICONST_1 iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/ICONST_2.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class ICONST_2 extends Instruction { 4 | public ICONST_2(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitICONST_2(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "ICONST_2 iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/ICONST_3.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class ICONST_3 extends Instruction { 4 | public ICONST_3(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitICONST_3(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "ICONST_3 iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/ICONST_4.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class ICONST_4 extends Instruction { 4 | public ICONST_4(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitICONST_4(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "ICONST_4 iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/ICONST_5.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class ICONST_5 extends Instruction { 4 | public ICONST_5(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitICONST_5(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "ICONST_5 iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/ICONST_M1.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class ICONST_M1 extends Instruction { 4 | public ICONST_M1(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitICONST_M1(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "ICONST_M1 iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/IDIV.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class IDIV extends Instruction { 4 | public IDIV(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitIDIV(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "IDIV iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/IFEQ.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class IFEQ extends Instruction implements ConditionalBranch { 4 | int label; 5 | 6 | public IFEQ(int iid, int mid, int label) { 7 | super(iid, mid); 8 | this.label = label; 9 | } 10 | 11 | public void visit(IVisitor visitor) { 12 | visitor.visitIFEQ(this); 13 | } 14 | 15 | @Override 16 | public String toString() { 17 | return "IFEQ iid=" + iid + " mid=" + mid + " label=" + label; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/IFGE.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class IFGE extends Instruction implements ConditionalBranch { 4 | int label; 5 | 6 | public IFGE(int iid, int mid, int label) { 7 | super(iid, mid); 8 | this.label = label; 9 | } 10 | 11 | public void visit(IVisitor visitor) { 12 | visitor.visitIFGE(this); 13 | } 14 | 15 | @Override 16 | public String toString() { 17 | return "IFGE iid=" + iid + " mid=" + mid + " label=" + label; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/IFGT.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class IFGT extends Instruction implements ConditionalBranch { 4 | int label; 5 | 6 | public IFGT(int iid, int mid, int label) { 7 | super(iid, mid); 8 | this.label = label; 9 | } 10 | 11 | public void visit(IVisitor visitor) { 12 | visitor.visitIFGT(this); 13 | } 14 | 15 | @Override 16 | public String toString() { 17 | return "IFGT iid=" + iid + " mid=" + mid + " label=" + label; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/IFLE.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class IFLE extends Instruction implements ConditionalBranch { 4 | int label; 5 | 6 | public IFLE(int iid, int mid, int label) { 7 | super(iid, mid); 8 | this.label = label; 9 | } 10 | 11 | public void visit(IVisitor visitor) { 12 | visitor.visitIFLE(this); 13 | } 14 | 15 | @Override 16 | public String toString() { 17 | return "IFLE iid=" + iid + " mid=" + mid + " label=" + label; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/IFLT.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class IFLT extends Instruction implements ConditionalBranch { 4 | int label; 5 | 6 | public IFLT(int iid, int mid, int label) { 7 | super(iid, mid); 8 | this.label = label; 9 | } 10 | 11 | public void visit(IVisitor visitor) { 12 | visitor.visitIFLT(this); 13 | } 14 | 15 | @Override 16 | public String toString() { 17 | return "IFLT iid=" + iid + " mid=" + mid + " label=" + label; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/IFNE.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class IFNE extends Instruction implements ConditionalBranch { 4 | int label; 5 | 6 | public IFNE(int iid, int mid, int label) { 7 | super(iid, mid); 8 | this.label = label; 9 | } 10 | 11 | public void visit(IVisitor visitor) { 12 | visitor.visitIFNE(this); 13 | } 14 | 15 | @Override 16 | public String toString() { 17 | return "IFNE iid=" + iid + " mid=" + mid + " label=" + label; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/IFNONNULL.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class IFNONNULL extends Instruction implements ConditionalBranch { 4 | int label; 5 | 6 | public IFNONNULL(int iid, int mid, int label) { 7 | super(iid, mid); 8 | this.label = label; 9 | } 10 | 11 | public void visit(IVisitor visitor) { 12 | visitor.visitIFNONNULL(this); 13 | } 14 | 15 | @Override 16 | public String toString() { 17 | return "IFNONNULL iid=" + iid + " mid=" + mid + " label=" + label; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/IFNULL.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class IFNULL extends Instruction implements ConditionalBranch { 4 | int label; 5 | 6 | public IFNULL(int iid, int mid, int label) { 7 | super(iid, mid); 8 | this.label = label; 9 | } 10 | 11 | public void visit(IVisitor visitor) { 12 | visitor.visitIFNULL(this); 13 | } 14 | 15 | @Override 16 | public String toString() { 17 | return "IFNULL iid=" + iid + " mid=" + mid + " label=" + label; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/IF_ACMPEQ.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class IF_ACMPEQ extends Instruction implements ConditionalBranch { 4 | int label; 5 | 6 | public IF_ACMPEQ(int iid, int mid, int label) { 7 | super(iid, mid); 8 | this.label = label; 9 | } 10 | 11 | public void visit(IVisitor visitor) { 12 | visitor.visitIF_ACMPEQ(this); 13 | } 14 | 15 | @Override 16 | public String toString() { 17 | return "IF_ACMPEQ iid=" + iid + " mid=" + mid + " label=" + label; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/IF_ACMPNE.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class IF_ACMPNE extends Instruction implements ConditionalBranch { 4 | int label; 5 | 6 | public IF_ACMPNE(int iid, int mid, int label) { 7 | super(iid, mid); 8 | this.label = label; 9 | } 10 | 11 | public void visit(IVisitor visitor) { 12 | visitor.visitIF_ACMPNE(this); 13 | } 14 | 15 | @Override 16 | public String toString() { 17 | return "IF_ACMPNE iid=" + iid + " mid=" + mid + " label=" + label; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/IF_ICMPEQ.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class IF_ICMPEQ extends Instruction implements ConditionalBranch { 4 | int label; 5 | 6 | public IF_ICMPEQ(int iid, int mid, int label) { 7 | super(iid, mid); 8 | this.label = label; 9 | } 10 | 11 | public void visit(IVisitor visitor) { 12 | visitor.visitIF_ICMPEQ(this); 13 | } 14 | 15 | @Override 16 | public String toString() { 17 | return "IF_ICMPEQ iid=" + iid + " mid=" + mid + " label=" + label; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/IF_ICMPGE.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class IF_ICMPGE extends Instruction implements ConditionalBranch { 4 | int label; 5 | 6 | public IF_ICMPGE(int iid, int mid, int label) { 7 | super(iid, mid); 8 | this.label = label; 9 | } 10 | 11 | public void visit(IVisitor visitor) { 12 | visitor.visitIF_ICMPGE(this); 13 | } 14 | 15 | @Override 16 | public String toString() { 17 | return "IF_ICMPGE iid=" + iid + " mid=" + mid + " label=" + label; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/IF_ICMPGT.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class IF_ICMPGT extends Instruction implements ConditionalBranch { 4 | int label; 5 | 6 | public IF_ICMPGT(int iid, int mid, int label) { 7 | super(iid, mid); 8 | this.label = label; 9 | } 10 | 11 | public void visit(IVisitor visitor) { 12 | visitor.visitIF_ICMPGT(this); 13 | } 14 | 15 | @Override 16 | public String toString() { 17 | return "IF_ICMPGT iid=" + iid + " mid=" + mid + " label=" + label; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/IF_ICMPLE.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class IF_ICMPLE extends Instruction implements ConditionalBranch { 4 | int label; 5 | 6 | public IF_ICMPLE(int iid, int mid, int label) { 7 | super(iid, mid); 8 | this.label = label; 9 | } 10 | 11 | public void visit(IVisitor visitor) { 12 | visitor.visitIF_ICMPLE(this); 13 | } 14 | 15 | @Override 16 | public String toString() { 17 | return "IF_ICMPLE iid=" + iid + " mid=" + mid + " label=" + label; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/IF_ICMPLT.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class IF_ICMPLT extends Instruction implements ConditionalBranch { 4 | int label; 5 | 6 | public IF_ICMPLT(int iid, int mid, int label) { 7 | super(iid, mid); 8 | this.label = label; 9 | } 10 | 11 | public void visit(IVisitor visitor) { 12 | visitor.visitIF_ICMPLT(this); 13 | } 14 | 15 | @Override 16 | public String toString() { 17 | return "IF_ICMPLT iid=" + iid + " mid=" + mid + " label=" + label; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/IF_ICMPNE.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class IF_ICMPNE extends Instruction implements ConditionalBranch { 4 | int label; 5 | 6 | public IF_ICMPNE(int iid, int mid, int label) { 7 | super(iid, mid); 8 | this.label = label; 9 | } 10 | 11 | public void visit(IVisitor visitor) { 12 | visitor.visitIF_ICMPNE(this); 13 | } 14 | 15 | @Override 16 | public String toString() { 17 | return "IF_ICMPNE iid=" + iid + " mid=" + mid + " label=" + label; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/IINC.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class IINC extends Instruction { 4 | public int var; 5 | public int increment; 6 | 7 | public IINC(int iid, int mid, int var, int increment) { 8 | super(iid, mid); 9 | this.var = var; 10 | this.increment = increment; 11 | } 12 | 13 | public void visit(IVisitor visitor) { 14 | visitor.visitIINC(this); 15 | } 16 | 17 | @Override 18 | public String toString() { 19 | return "IINC iid=" + iid + " mid=" + mid + " var=" + var + " increment=" + increment; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/ILOAD.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class ILOAD extends Instruction { 4 | public int var; 5 | 6 | public ILOAD(int iid, int mid, int var) { 7 | super(iid, mid); 8 | this.var = var; 9 | } 10 | 11 | public void visit(IVisitor visitor) { 12 | visitor.visitILOAD(this); 13 | } 14 | 15 | @Override 16 | public String toString() { 17 | return "ILOAD iid=" + iid + " mid=" + mid + " var=" + var; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/IMUL.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class IMUL extends Instruction { 4 | public IMUL(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitIMUL(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "IMUL iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/INEG.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class INEG extends Instruction { 4 | public INEG(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitINEG(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "INEG iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/INSTANCEOF.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class INSTANCEOF extends Instruction { 4 | String type; 5 | 6 | public INSTANCEOF(int iid, int mid, String type) { 7 | super(iid, mid); 8 | this.type = type; 9 | } 10 | 11 | public void visit(IVisitor visitor) { 12 | visitor.visitINSTANCEOF(this); 13 | } 14 | 15 | @Override 16 | public String toString() { 17 | return "INSTANCEOF iid=" + iid + " mid=" + mid + " type=" + type; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/INVOKEINTERFACE.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class INVOKEINTERFACE extends Instruction implements InvokeInstruction { 4 | public String owner; 5 | public String name; 6 | public String desc; 7 | 8 | public INVOKEINTERFACE(int iid, int mid, String owner, String name, String desc) { 9 | super(iid, mid); 10 | this.owner = owner; 11 | this.name = name; 12 | this.desc = desc; 13 | } 14 | 15 | public void visit(IVisitor visitor) { 16 | visitor.visitINVOKEINTERFACE(this); 17 | } 18 | 19 | @Override 20 | public String toString() { 21 | return "INVOKEINTERFACE iid=" 22 | + iid 23 | + " mid=" 24 | + mid 25 | + " owner=" 26 | + owner 27 | + " name=" 28 | + name 29 | + " desc=" 30 | + desc; 31 | } 32 | 33 | @Override 34 | public String getOwner() { 35 | return owner; 36 | } 37 | 38 | @Override 39 | public String getName() { 40 | return name; 41 | } 42 | 43 | @Override 44 | public String getDesc() { 45 | return desc; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/INVOKEMETHOD_END.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class INVOKEMETHOD_END extends Instruction { 4 | 5 | public INVOKEMETHOD_END() { 6 | super(-1, -1); 7 | } 8 | 9 | public void visit(IVisitor visitor) { 10 | visitor.visitINVOKEMETHOD_END(this); 11 | } 12 | 13 | @Override 14 | public String toString() { 15 | return "INVOKEMETHOD_END"; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/INVOKEMETHOD_EXCEPTION.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class INVOKEMETHOD_EXCEPTION extends Instruction { 4 | 5 | private Throwable exception; 6 | 7 | public INVOKEMETHOD_EXCEPTION(Throwable t) { 8 | super(-1, -1); 9 | this.exception = t; 10 | } 11 | 12 | public void visit(IVisitor visitor) { 13 | visitor.visitINVOKEMETHOD_EXCEPTION(this); 14 | } 15 | 16 | @Override 17 | public String toString() { 18 | return "INVOKEMETHOD_EXCEPTION"; 19 | } 20 | 21 | public Throwable getException() { 22 | return exception; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/INVOKESPECIAL.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class INVOKESPECIAL extends Instruction implements InvokeInstruction { 4 | public String owner; 5 | public String name; 6 | public String desc; 7 | 8 | public INVOKESPECIAL(int iid, int mid, String owner, String name, String desc) { 9 | super(iid, mid); 10 | this.owner = owner; 11 | this.name = name; 12 | this.desc = desc; 13 | } 14 | 15 | public void visit(IVisitor visitor) { 16 | visitor.visitINVOKESPECIAL(this); 17 | } 18 | 19 | @Override 20 | public String toString() { 21 | return "INVOKESPECIAL iid=" 22 | + iid 23 | + " mid=" 24 | + mid 25 | + " owner=" 26 | + owner 27 | + " name=" 28 | + name 29 | + " desc=" 30 | + desc; 31 | } 32 | 33 | @Override 34 | public String getOwner() { 35 | return owner; 36 | } 37 | 38 | @Override 39 | public String getName() { 40 | return name; 41 | } 42 | 43 | @Override 44 | public String getDesc() { 45 | return desc; 46 | } 47 | } 48 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/INVOKESTATIC.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class INVOKESTATIC extends Instruction implements InvokeInstruction { 4 | public String owner; 5 | public String name; 6 | public String desc; 7 | 8 | public INVOKESTATIC(int iid, int mid, String owner, String name, String desc) { 9 | super(iid, mid); 10 | this.owner = owner; 11 | this.name = name; 12 | this.desc = desc; 13 | } 14 | 15 | public void visit(IVisitor visitor) { 16 | visitor.visitINVOKESTATIC(this); 17 | } 18 | 19 | @Override 20 | public String toString() { 21 | return "INVOKESTATIC iid=" 22 | + iid 23 | + " mid=" 24 | + mid 25 | + " owner=" 26 | + owner 27 | + " name=" 28 | + name 29 | + " desc=" 30 | + desc; 31 | } 32 | 33 | 34 | @Override 35 | public String getOwner() { 36 | return owner; 37 | } 38 | 39 | @Override 40 | public String getName() { 41 | return name; 42 | } 43 | 44 | @Override 45 | public String getDesc() { 46 | return desc; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/INVOKEVIRTUAL.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | 4 | public class INVOKEVIRTUAL extends Instruction implements InvokeInstruction { 5 | public String owner; 6 | public String name; 7 | public String desc; 8 | 9 | public INVOKEVIRTUAL(int iid, int mid, String owner, String name, String desc) { 10 | super(iid, mid); 11 | this.owner = owner; 12 | this.name = name; 13 | this.desc = desc; 14 | } 15 | 16 | public void visit(IVisitor visitor) { 17 | visitor.visitINVOKEVIRTUAL(this); 18 | } 19 | 20 | @Override 21 | public String toString() { 22 | return "INVOKEVIRTUAL iid=" 23 | + iid 24 | + " mid=" 25 | + mid 26 | + " owner=" 27 | + owner 28 | + " name=" 29 | + name 30 | + " desc=" 31 | + desc; 32 | } 33 | 34 | @Override 35 | public String getOwner() { 36 | return owner; 37 | } 38 | 39 | @Override 40 | public String getName() { 41 | return name; 42 | } 43 | 44 | @Override 45 | public String getDesc() { 46 | return desc; 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/IOR.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class IOR extends Instruction { 4 | public IOR(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitIOR(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "IOR iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/IREM.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class IREM extends Instruction { 4 | public IREM(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitIREM(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "IREM iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/IRETURN.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class IRETURN extends Instruction { 4 | public IRETURN(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitIRETURN(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "IRETURN iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/ISHL.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class ISHL extends Instruction { 4 | public ISHL(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitISHL(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "ISHL iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/ISHR.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class ISHR extends Instruction { 4 | public ISHR(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitISHR(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "ISHR iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/ISTORE.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class ISTORE extends Instruction { 4 | public int var; 5 | 6 | public ISTORE(int iid, int mid, int var) { 7 | super(iid, mid); 8 | this.var = var; 9 | } 10 | 11 | public void visit(IVisitor visitor) { 12 | visitor.visitISTORE(this); 13 | } 14 | 15 | @Override 16 | public String toString() { 17 | return "ISTORE iid=" + iid + " mid=" + mid + " var=" + var; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/ISUB.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class ISUB extends Instruction { 4 | public ISUB(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitISUB(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "ISUB iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/IUSHR.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class IUSHR extends Instruction { 4 | public IUSHR(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitIUSHR(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "IUSHR iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/IXOR.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class IXOR extends Instruction { 4 | public IXOR(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitIXOR(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "IXOR iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/Instruction.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | import java.io.Serializable; 4 | 5 | public abstract class Instruction implements Serializable { 6 | public final int iid; 7 | public final int mid; 8 | 9 | public abstract void visit(IVisitor visitor); 10 | 11 | public Instruction(int iid, int mid) { 12 | this.iid = iid; 13 | this.mid = mid; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/InvokeInstruction.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017-2018 The Regents of the University of California 3 | * 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are 8 | * met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | package janala.logger.inst; 30 | 31 | /** 32 | * @author Rohan Padhye 33 | */ 34 | public interface InvokeInstruction extends MemberRef { 35 | } 36 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/JSR.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class JSR extends Instruction { 4 | int label; 5 | 6 | public JSR(int iid, int mid, int label) { 7 | super(iid, mid); 8 | this.label = label; 9 | } 10 | 11 | public void visit(IVisitor visitor) { 12 | visitor.visitJSR(this); 13 | } 14 | 15 | @Override 16 | public String toString() { 17 | return "JSR iid=" + iid + " mid=" + mid + " label=" + label; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/L2D.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class L2D extends Instruction { 4 | public L2D(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitL2D(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "L2D iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/L2F.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class L2F extends Instruction { 4 | public L2F(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitL2F(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "L2F iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/L2I.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class L2I extends Instruction { 4 | public L2I(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitL2I(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "L2I iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/LADD.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class LADD extends Instruction { 4 | public LADD(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitLADD(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "LADD iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/LALOAD.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class LALOAD extends Instruction { 4 | public LALOAD(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitLALOAD(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "LALOAD iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/LAND.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class LAND extends Instruction { 4 | public LAND(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitLAND(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "LAND iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/LASTORE.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class LASTORE extends Instruction { 4 | public LASTORE(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitLASTORE(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "LASTORE iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/LCMP.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class LCMP extends Instruction { 4 | public LCMP(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitLCMP(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "LCMP iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/LCONST_0.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class LCONST_0 extends Instruction { 4 | public LCONST_0(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitLCONST_0(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "LCONST_0 iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/LCONST_1.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class LCONST_1 extends Instruction { 4 | public LCONST_1(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitLCONST_1(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "LCONST_1 iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/LDC_Object.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | 4 | public class LDC_Object extends Instruction { 5 | public int c; 6 | 7 | public LDC_Object(int iid, int mid, int c) { 8 | super(iid, mid); 9 | this.c = c; 10 | } 11 | 12 | public void visit(IVisitor visitor) { 13 | visitor.visitLDC_Object(this); 14 | } 15 | 16 | @Override 17 | public String toString() { 18 | return "LDC_Object iid=" + iid + " mid=" + mid + " c=" + c; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/LDC_String.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class LDC_String extends Instruction { 4 | public String c; 5 | public int address; 6 | 7 | public LDC_String(int iid, int mid, String c, int address) { 8 | super(iid, mid); 9 | this.c = c; 10 | this.address = address; 11 | } 12 | 13 | public void visit(IVisitor visitor) { 14 | visitor.visitLDC_String(this); 15 | } 16 | 17 | @Override 18 | public String toString() { 19 | return "LDC_String iid=" + iid + " mid=" + mid + " c=" + c + " address=" + address; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/LDC_double.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class LDC_double extends Instruction { 4 | public double c; 5 | 6 | public LDC_double(int iid, int mid, double c) { 7 | super(iid, mid); 8 | this.c = c; 9 | } 10 | 11 | public void visit(IVisitor visitor) { 12 | visitor.visitLDC_double(this); 13 | } 14 | 15 | @Override 16 | public String toString() { 17 | return "LDC_double iid=" + iid + " mid=" + mid + " c=" + c; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/LDC_float.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class LDC_float extends Instruction { 4 | public float c; 5 | 6 | public LDC_float(int iid, int mid, float c) { 7 | super(iid, mid); 8 | this.c = c; 9 | } 10 | 11 | public void visit(IVisitor visitor) { 12 | visitor.visitLDC_float(this); 13 | } 14 | 15 | @Override 16 | public String toString() { 17 | return "LDC_float iid=" + iid + " mid=" + mid + " c=" + c; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/LDC_int.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class LDC_int extends Instruction { 4 | public int c; 5 | 6 | public LDC_int(int iid, int mid, int c) { 7 | super(iid, mid); 8 | this.c = c; 9 | } 10 | 11 | public void visit(IVisitor visitor) { 12 | visitor.visitLDC_int(this); 13 | } 14 | 15 | @Override 16 | public String toString() { 17 | return "LDC_int iid=" + iid + " mid=" + mid + " c=" + c; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/LDC_long.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class LDC_long extends Instruction { 4 | public long c; 5 | 6 | public LDC_long(int iid, int mid, long c) { 7 | super(iid, mid); 8 | this.c = c; 9 | } 10 | 11 | public void visit(IVisitor visitor) { 12 | visitor.visitLDC_long(this); 13 | } 14 | 15 | @Override 16 | public String toString() { 17 | return "LDC_long iid=" + iid + " mid=" + mid + " c=" + c; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/LDIV.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class LDIV extends Instruction { 4 | public LDIV(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitLDIV(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "LDIV iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/LLOAD.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class LLOAD extends Instruction { 4 | public int var; 5 | 6 | public LLOAD(int iid, int mid, int var) { 7 | super(iid, mid); 8 | this.var = var; 9 | } 10 | 11 | public void visit(IVisitor visitor) { 12 | visitor.visitLLOAD(this); 13 | } 14 | 15 | @Override 16 | public String toString() { 17 | return "LLOAD iid=" + iid + " mid=" + mid + " var=" + var; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/LMUL.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class LMUL extends Instruction { 4 | public LMUL(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitLMUL(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "LMUL iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/LNEG.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class LNEG extends Instruction { 4 | public LNEG(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitLNEG(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "LNEG iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/LOOKUPSWITCH.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class LOOKUPSWITCH extends Instruction { 4 | public int dflt; 5 | public int[] keys; 6 | public int[] labels; 7 | 8 | public LOOKUPSWITCH(int iid, int mid, int dflt, int[] keys, int[] labels) { 9 | super(iid, mid); 10 | this.dflt = dflt; 11 | this.keys = keys; 12 | this.labels = labels; 13 | } 14 | 15 | public void visit(IVisitor visitor) { 16 | visitor.visitLOOKUPSWITCH(this); 17 | } 18 | 19 | @Override 20 | public String toString() { 21 | return "LOOKUPSWITCH iid=" 22 | + iid 23 | + " mid=" 24 | + mid 25 | + " dflt=" 26 | + dflt 27 | + " keys=" 28 | + keys 29 | + " labels=" 30 | + labels; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/LOR.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class LOR extends Instruction { 4 | public LOR(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitLOR(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "LOR iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/LREM.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class LREM extends Instruction { 4 | public LREM(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitLREM(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "LREM iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/LRETURN.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class LRETURN extends Instruction { 4 | public LRETURN(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitLRETURN(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "LRETURN iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/LSHL.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class LSHL extends Instruction { 4 | public LSHL(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitLSHL(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "LSHL iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/LSHR.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class LSHR extends Instruction { 4 | public LSHR(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitLSHR(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "LSHR iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/LSTORE.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class LSTORE extends Instruction { 4 | public int var; 5 | 6 | public LSTORE(int iid, int mid, int var) { 7 | super(iid, mid); 8 | this.var = var; 9 | } 10 | 11 | public void visit(IVisitor visitor) { 12 | visitor.visitLSTORE(this); 13 | } 14 | 15 | @Override 16 | public String toString() { 17 | return "LSTORE iid=" + iid + " mid=" + mid + " var=" + var; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/LSUB.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class LSUB extends Instruction { 4 | public LSUB(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitLSUB(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "LSUB iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/LUSHR.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class LUSHR extends Instruction { 4 | public LUSHR(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitLUSHR(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "LUSHR iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/LXOR.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class LXOR extends Instruction { 4 | public LXOR(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitLXOR(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "LXOR iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/MAKE_SYMBOLIC.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | /** 4 | * Author: Koushik Sen (ksen@cs.berkeley.edu) 5 | * Date: 6/21/12 6 | * Time: 5:02 PM 7 | */ 8 | public class MAKE_SYMBOLIC extends Instruction { 9 | 10 | public MAKE_SYMBOLIC() { 11 | super(-1, -1); 12 | } 13 | 14 | public void visit(IVisitor visitor) { 15 | visitor.visitMAKE_SYMBOLIC(this); 16 | } 17 | 18 | @Override 19 | public String toString() { 20 | return "MAKE_SYMBOLIC"; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/METHOD_BEGIN.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class METHOD_BEGIN extends Instruction implements MemberRef { 4 | public final String owner; 5 | public final String name; 6 | public final String desc; 7 | private final Object obj; 8 | 9 | public METHOD_BEGIN(String owner, String name, String desc) { 10 | super(-1, -1); 11 | this.owner = owner; 12 | this.name = name; 13 | this.desc = desc; 14 | this.obj = null; 15 | } 16 | 17 | public METHOD_BEGIN(String owner, String name, String desc, Object obj) { 18 | super(-1, -1); 19 | this.owner = owner; 20 | this.name = name; 21 | this.desc = desc; 22 | this.obj = obj; 23 | } 24 | 25 | public void visit(IVisitor visitor) { 26 | visitor.visitMETHOD_BEGIN(this); 27 | } 28 | 29 | public Object getObject() { 30 | return obj; 31 | } 32 | 33 | @Override 34 | public String toString() { 35 | return "METHOD_BEGIN" 36 | + " owner=" 37 | + owner 38 | + " name=" 39 | + name 40 | + " desc=" 41 | + desc; 42 | } 43 | 44 | 45 | @Override 46 | public String getOwner() { 47 | return owner; 48 | } 49 | 50 | @Override 51 | public String getName() { 52 | return name; 53 | } 54 | 55 | @Override 56 | public String getDesc() { 57 | return desc; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/METHOD_THROW.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | /** A special marker instruction indicating that the method 4 | * is exiting abruptly due to an exception being thrown, and thus 5 | * the stack frame must be destroyed. 6 | */ 7 | public class METHOD_THROW extends Instruction { 8 | 9 | public METHOD_THROW() { 10 | super(-1, -1); 11 | } 12 | 13 | public void visit(IVisitor visitor) { 14 | visitor.visitMETHOD_THROW(this); 15 | } 16 | 17 | @Override 18 | public String toString() { 19 | return "METHOD_THROW"; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/MONITORENTER.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class MONITORENTER extends Instruction { 4 | public MONITORENTER(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitMONITORENTER(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "MONITORENTER iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/MONITOREXIT.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class MONITOREXIT extends Instruction { 4 | public MONITOREXIT(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitMONITOREXIT(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "MONITOREXIT iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/MULTIANEWARRAY.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class MULTIANEWARRAY extends Instruction { 4 | String desc; // Is it used? 5 | public int dims; 6 | 7 | public MULTIANEWARRAY(int iid, int mid, String desc, int dims) { 8 | super(iid, mid); 9 | this.desc = desc; 10 | this.dims = dims; 11 | } 12 | 13 | public void visit(IVisitor visitor) { 14 | visitor.visitMULTIANEWARRAY(this); 15 | } 16 | 17 | @Override 18 | public String toString() { 19 | return "MULTIANEWARRAY iid=" + iid + " mid=" + mid + " desc=" + desc + " dims=" + dims; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/MemberRef.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017-2018 The Regents of the University of California 3 | * 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are 8 | * met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | package janala.logger.inst; 31 | 32 | /** 33 | * @author Rohan Padhye 34 | */ 35 | public interface MemberRef { 36 | String getOwner(); 37 | String getName(); 38 | String getDesc(); 39 | 40 | } 41 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/NEW.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class NEW extends Instruction { 4 | String type; 5 | public int cIdx; 6 | 7 | public NEW(int iid, int mid, String type, int cIdx) { 8 | super(iid, mid); 9 | this.type = type; 10 | this.cIdx = cIdx; 11 | } 12 | 13 | public void visit(IVisitor visitor) { 14 | visitor.visitNEW(this); 15 | } 16 | 17 | @Override 18 | public String toString() { 19 | return "NEW iid=" + iid + " mid=" + mid + " cIdx=" + cIdx; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/NEWARRAY.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class NEWARRAY extends Instruction { 4 | public NEWARRAY(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitNEWARRAY(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "NEWARRAY iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/NOP.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class NOP extends Instruction { 4 | public NOP(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitNOP(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "NOP iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/POP.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class POP extends Instruction { 4 | public POP(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitPOP(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "POP iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/POP2.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class POP2 extends Instruction { 4 | public POP2(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitPOP2(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "POP2 iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/PUTFIELD.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class PUTFIELD extends Instruction { 4 | public int cIdx; 5 | public int fIdx; 6 | public String desc; 7 | 8 | public PUTFIELD(int iid, int mid, int cIdx, int fIdx, String desc) { 9 | super(iid, mid); 10 | this.cIdx = cIdx; 11 | this.fIdx = fIdx; 12 | this.desc = desc; 13 | } 14 | 15 | public void visit(IVisitor visitor) { 16 | visitor.visitPUTFIELD(this); 17 | } 18 | 19 | @Override 20 | public String toString() { 21 | return "PUTFIELD iid=" 22 | + iid 23 | + " mid=" 24 | + mid 25 | + " cIdx=" 26 | + cIdx 27 | + " fIdx=" 28 | + fIdx 29 | + " desc=" 30 | + desc; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/PUTSTATIC.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class PUTSTATIC extends Instruction { 4 | public int cIdx; 5 | public int fIdx; 6 | public String desc; 7 | 8 | public PUTSTATIC(int iid, int mid, int cIdx, int fIdx, String desc) { 9 | super(iid, mid); 10 | this.cIdx = cIdx; 11 | this.fIdx = fIdx; 12 | this.desc = desc; 13 | } 14 | 15 | public void visit(IVisitor visitor) { 16 | visitor.visitPUTSTATIC(this); 17 | } 18 | 19 | @Override 20 | public String toString() { 21 | return "PUTSTATIC iid=" 22 | + iid 23 | + " mid=" 24 | + mid 25 | + " cIdx=" 26 | + cIdx 27 | + " fIdx=" 28 | + fIdx 29 | + " desc=" 30 | + desc; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/RET.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class RET extends Instruction { 4 | int var; 5 | 6 | public RET(int iid, int mid, int var) { 7 | super(iid, mid); 8 | this.var = var; 9 | } 10 | 11 | public void visit(IVisitor visitor) { 12 | visitor.visitRET(this); 13 | } 14 | 15 | @Override 16 | public String toString() { 17 | return "RET iid=" + iid + " mid=" + mid + " var=" + var; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/RETURN.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class RETURN extends Instruction { 4 | public RETURN(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitRETURN(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "RETURN iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/SALOAD.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class SALOAD extends Instruction { 4 | public SALOAD(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitSALOAD(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "SALOAD iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/SASTORE.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class SASTORE extends Instruction { 4 | public SASTORE(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitSASTORE(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "SASTORE iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/SIPUSH.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class SIPUSH extends Instruction { 4 | public int value; 5 | 6 | public SIPUSH(int iid, int mid, int value) { 7 | super(iid, mid); 8 | this.value = value; 9 | } 10 | 11 | public void visit(IVisitor visitor) { 12 | visitor.visitSIPUSH(this); 13 | } 14 | 15 | @Override 16 | public String toString() { 17 | return "SIPUSH iid=" + iid + " mid=" + mid + " value=" + value; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/SPECIAL.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | /** A special probe instruction added by the instrumentation. 4 | * The int value identifies which branch does the instruction correspond to. 5 | */ 6 | public class SPECIAL extends Instruction { 7 | 8 | public static final int NON_EXCEPTIONAL = 0; 9 | public static final int DID_NOT_BRANCH = 1; 10 | public static final int CALLING_SUPER_OR_THIS = 2; 11 | 12 | public int i; 13 | 14 | public SPECIAL(int i) { 15 | super(-1, -1); 16 | this.i = i; 17 | } 18 | 19 | public void visit(IVisitor visitor) { 20 | visitor.visitSPECIAL(this); 21 | } 22 | 23 | @Override 24 | public String toString() { 25 | return "SPECIAL i=" + i; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/SWAP.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class SWAP extends Instruction { 4 | public SWAP(int iid, int mid) { 5 | super(iid, mid); 6 | } 7 | 8 | public void visit(IVisitor visitor) { 9 | visitor.visitSWAP(this); 10 | } 11 | 12 | @Override 13 | public String toString() { 14 | return "SWAP iid=" + iid + " mid=" + mid; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /instrument/src/main/java/janala/logger/inst/TABLESWITCH.java: -------------------------------------------------------------------------------- 1 | package janala.logger.inst; 2 | 3 | public class TABLESWITCH extends Instruction { 4 | public int min; 5 | public int max; 6 | public int dflt; 7 | public int[] labels; 8 | 9 | public TABLESWITCH(int iid, int mid, int min, int max, int dflt, int[] labels) { 10 | super(iid, mid); 11 | this.min = min; 12 | this.max = max; 13 | this.dflt = dflt; 14 | this.labels = labels; 15 | } 16 | 17 | public void visit(IVisitor visitor) { 18 | visitor.visitTABLESWITCH(this); 19 | } 20 | 21 | @Override 22 | public String toString() { 23 | return "TABLESWITCH iid=" 24 | + iid 25 | + " mid=" 26 | + mid 27 | + " min=" 28 | + min 29 | + " max=" 30 | + max 31 | + " dflt=" 32 | + dflt 33 | + " labels=" 34 | + labels; 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /instrument/src/test/java/CancelReturn.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2017-2018 The Regents of the University of California 3 | * 4 | * All rights reserved. 5 | * 6 | * Redistribution and use in source and binary forms, with or without 7 | * modification, are permitted provided that the following conditions are 8 | * met: 9 | * 10 | * 1. Redistributions of source code must retain the above copyright 11 | * notice, this list of conditions and the following disclaimer. 12 | * 13 | * 2. Redistributions in binary form must reproduce the above copyright 14 | * notice, this list of conditions and the following disclaimer in the 15 | * documentation and/or other materials provided with the distribution. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 20 | * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 21 | * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 22 | * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 23 | * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 | */ 29 | 30 | package benchmarks; 31 | 32 | /** 33 | * @author Rohan Padhye 34 | */ 35 | public class CancelReturn { 36 | 37 | public static void main(String[] args) { 38 | System.out.print(foo()); 39 | } 40 | 41 | private static int foo() { 42 | for (int i = 0; i < 10; i++) { 43 | try { 44 | System.out.println("Returning " + i); 45 | return i; 46 | } finally { 47 | continue; 48 | } 49 | } 50 | return 42; 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /instrument/src/test/java/DataStructures.java: -------------------------------------------------------------------------------- 1 | package benchmarks; 2 | 3 | import java.util.*; 4 | 5 | /** 6 | * @author Rohan Padhye 7 | */ 8 | public class DataStructures { 9 | public static void main(String[] args) { 10 | long startTime = System.currentTimeMillis(); 11 | Map env = System.getenv(); 12 | for (int i = 0; i < 1; i++) { 13 | NavigableMap treeMap = new TreeMap<>(env); 14 | for (Map.Entry e : treeMap.entrySet()) { 15 | System.out.println(e.getKey() + " = " + e.getValue()); 16 | } 17 | List values = new LinkedList<>(treeMap.values()); 18 | Collections.sort(values); 19 | for (String val : values) { 20 | System.out.println("value --> " + val); 21 | } 22 | } 23 | long endTime = System.currentTimeMillis(); 24 | System.err.println("Total time = " + (endTime - startTime) + " ms"); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /instrument/src/test/java/HelloWorld.java: -------------------------------------------------------------------------------- 1 | package benchmarks; 2 | 3 | public class HelloWorld { 4 | public static void main(String[] args) { 5 | System.out.println("Hello World!"); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /instrument/src/test/java/MultiThreaded.java: -------------------------------------------------------------------------------- 1 | package benchmarks; 2 | 3 | import java.util.TreeSet; 4 | 5 | /** 6 | * @author Rohan Padhye 7 | */ 8 | public class MultiThreaded { 9 | public static void main(String[] args) throws InterruptedException { 10 | NamePrinter n0 = new NamePrinter(); 11 | NamePrinter n1 = new NamePrinter("Numba1"); 12 | NamePrinter n2 = new NamePrinter("Numba2"); 13 | n0.start(); 14 | n1.start(); 15 | n2.start(); 16 | n1.join(); 17 | n2.join(); 18 | n0.join(); 19 | } 20 | 21 | static class NamePrinter extends Thread { 22 | NamePrinter() { 23 | super(); 24 | } 25 | NamePrinter(String name) { 26 | super(name); 27 | } 28 | @Override 29 | public void run() { 30 | TreeSet map = new TreeSet<>(); 31 | for (char c : this.getName().toCharArray()) { 32 | map.add(c); 33 | } 34 | 35 | System.out.println("I am thread: " + Thread.currentThread().getName()); 36 | System.out.println(map.contains('u')); 37 | } 38 | }; 39 | } 40 | -------------------------------------------------------------------------------- /instrument/src/test/java/Recursion.java: -------------------------------------------------------------------------------- 1 | package benchmarks; 2 | 3 | /** 4 | * @author Rohan Padhye 5 | */ 6 | public class Recursion { 7 | 8 | public static void main(String args[]) { 9 | int[] data = {1, 34, 21, 15, 61, 31, -2, 14, 8, 99, 7}; 10 | benchmarks.BinaryTree tree = new benchmarks.BinaryTree(); 11 | for (int x : data) { 12 | tree.insert(x); 13 | } 14 | 15 | int[] queries = {1, 4, 8, 15, 16, 23, 42}; 16 | for (int x: queries) { 17 | System.out.println(tree.contains(x)); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /instrument/src/test/java/StaticInit.java: -------------------------------------------------------------------------------- 1 | package benchmarks; 2 | 3 | /** 4 | * @author Rohan Padhye 5 | */ 6 | public class StaticInit { 7 | private static int X = 10; 8 | 9 | public static int get() { 10 | return X; 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /instrument/src/test/java/StaticInitDriver.java: -------------------------------------------------------------------------------- 1 | package benchmarks; 2 | 3 | /** 4 | * @author Rohan Padhye 5 | */ 6 | public class StaticInitDriver { 7 | public static void main(String[] args) { 8 | System.out.println(StaticInit.get()); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /instrument/src/test/java/UninitializedThis.java: -------------------------------------------------------------------------------- 1 | 2 | package benchmarks; 3 | 4 | /** 5 | * @author Rohan Padhye 6 | */ 7 | public class UninitializedThis extends Wrapper { 8 | 9 | 10 | public UninitializedThis() { 11 | 12 | } 13 | 14 | public UninitializedThis(String s) { 15 | super(s); 16 | } 17 | 18 | public static void main(String[] args) { 19 | if (args.length > 0) 20 | new UninitializedThis(args[0]); 21 | else 22 | new UninitializedThis(); 23 | } 24 | 25 | 26 | } 27 | -------------------------------------------------------------------------------- /instrument/src/test/java/Wrapper.java: -------------------------------------------------------------------------------- 1 | package benchmarks; 2 | 3 | public class Wrapper { 4 | private String data; 5 | public static void main(String args[]) { 6 | try { 7 | Wrapper w = args.length > 0 ? new Wrapper(args[0]) : new Wrapper(); 8 | String s = w.getData(); 9 | if (s.equals("ERROR")) { 10 | throw new Exception("Data is errornous"); 11 | } 12 | System.out.println(s); 13 | } catch (Exception e) { 14 | System.err.println(e.getClass().getCanonicalName() + ": " + e.getMessage()); 15 | } 16 | } 17 | 18 | public Wrapper(String x) { 19 | this.data = x; 20 | } 21 | 22 | public Wrapper() { 23 | this.data = getData(); 24 | } 25 | 26 | public String getData() { 27 | return this.data.toString(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /integration-tests/src/test/java/edu/berkeley/cs/jqf/fuzz/guidance/AbstractGuidanceIT.java: -------------------------------------------------------------------------------- 1 | package edu.berkeley.cs.jqf.fuzz.guidance; 2 | 3 | import edu.berkeley.cs.jqf.instrument.InstrumentingClassLoader; 4 | import org.junit.After; 5 | import org.junit.Before; 6 | 7 | import java.io.File; 8 | import java.io.IOException; 9 | import java.nio.file.Files; 10 | import java.nio.file.Path; 11 | import java.nio.file.Paths; 12 | import java.util.List; 13 | import java.util.stream.Collectors; 14 | 15 | public abstract class AbstractGuidanceIT { 16 | 17 | // Temp directory to store fuzz results 18 | protected static File resultsDir; 19 | 20 | // Class loader to instrument test 21 | protected ClassLoader classLoader; 22 | 23 | @Before 24 | public void initTempDir() throws IOException { 25 | resultsDir = Files.createTempDirectory("fuzz-results").toFile(); 26 | } 27 | 28 | @Before 29 | public void initClassLoader() throws IOException { 30 | // Walk dependency tree of jqf-examples 31 | List paths = Files.walk(Paths.get("../examples/target/dependency")) 32 | .map(Path::toString).collect(Collectors.toList()); 33 | paths.add("../examples/target/classes/"); // add sources from jqf-examples 34 | paths.add("../examples/target/test-classes/"); // also add fuzz drivers in jqf-examples 35 | 36 | // Create coverage-instrumenting class loader 37 | classLoader = new InstrumentingClassLoader(paths.stream().toArray(String[]::new), 38 | getClass().getClassLoader()); 39 | } 40 | 41 | @After 42 | public void clearTempDir() { 43 | resultsDir.delete(); 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /maven-plugin/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | edu.berkeley.cs.jqf 5 | jqf 6 | 2.2-SNAPSHOT 7 | 8 | 4.0.0 9 | 10 | jqf-maven-plugin 11 | 12 | jqf-maven-plugin 13 | JQF: Feedback-directed Quickcheck for Java - Maven plugin 14 | 15 | maven-plugin 16 | 17 | 18 | 19 | org.apache.maven 20 | maven-plugin-api 21 | 3.9.9 22 | 23 | 24 | org.apache.maven.plugin-tools 25 | maven-plugin-annotations 26 | 3.15.1 27 | provided 28 | 29 | 30 | org.apache.maven 31 | maven-core 32 | 3.9.9 33 | 34 | 35 | edu.berkeley.cs.jqf 36 | jqf-instrument 37 | 38 | 39 | edu.berkeley.cs.jqf 40 | jqf-fuzz 41 | 42 | 43 | 44 | 45 | 46 | 47 | org.apache.maven.plugins 48 | maven-plugin-plugin 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /scripts/classpath.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Figure out script absolute path 4 | pushd `dirname $0` > /dev/null 5 | SCRIPT_DIR=`pwd` 6 | popd > /dev/null 7 | 8 | # The root dir is one up 9 | ROOT_DIR=`dirname $SCRIPT_DIR` 10 | 11 | # Create classpath using all classes from and dependencies of the `fuzz` and `instrument` packages 12 | 13 | cp="$ROOT_DIR/fuzz/target/classes:$ROOT_DIR/fuzz/target/test-classes" 14 | 15 | for jar in $ROOT_DIR/fuzz/target/dependency/*.jar; do 16 | cp="$cp:$jar" 17 | done 18 | 19 | cp="$cp:$ROOT_DIR/instrument/target/classes:$ROOT_DIR/instrument/target/test-classes" 20 | 21 | for jar in $ROOT_DIR/instrument/target/dependency/*.jar; do 22 | cp="$cp:$jar" 23 | done 24 | 25 | echo $cp 26 | -------------------------------------------------------------------------------- /scripts/examples_classpath.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Figure out script absolute path 4 | pushd `dirname $0` > /dev/null 5 | SCRIPT_DIR=`pwd` 6 | popd > /dev/null 7 | 8 | # The root dir is one up 9 | ROOT_DIR=`dirname $SCRIPT_DIR` 10 | 11 | # Create classpath 12 | cp="$ROOT_DIR/examples/target/classes:$ROOT_DIR/examples/target/test-classes" 13 | 14 | for jar in $ROOT_DIR/examples/target/dependency/*.jar; do 15 | cp="$cp:$jar" 16 | done 17 | 18 | echo $cp 19 | -------------------------------------------------------------------------------- /scripts/experiments/ei/cov_all.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) 4 | 5 | 6 | # $SCRIPT_DIR/cov.sh chess chess.FENTest $1 7 | $SCRIPT_DIR/cov.sh ant ant.ProjectBuilderTest $1 8 | $SCRIPT_DIR/cov.sh maven maven.ModelReaderTest $1 9 | $SCRIPT_DIR/cov.sh bcel bcel.ParserTest $1 10 | $SCRIPT_DIR/cov.sh closure closure.CompilerTest $1 11 | $SCRIPT_DIR/cov.sh rhino rhino.CompilerTest $1 12 | -------------------------------------------------------------------------------- /scripts/experiments/ei/data-processing/sns_settings.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # -*- coding: utf-8 -*- 3 | import seaborn as sns 4 | import matplotlib.pyplot as plt 5 | 6 | sns.set_style("whitegrid", {'axes.grid' : True}) 7 | sns.set_context("paper", font_scale=1.5) 8 | 9 | plt.rcParams.update({'axes.edgecolor': 'black', 'axes.linewidth': 2, 10 | 'axes.grid': True, 'grid.linestyle': '--'}) 11 | colors = ['#2A587A', '#FABC75', '#83B828', '#F83A25', '#FDD8EB'] 12 | sns.palplot(colors) 13 | sns.set_palette(sns.color_palette(colors), 8, .75) 14 | sub_figure_title = {"fontweight": 700, 'fontname':'Times New Roman', 'fontsize': 18} 15 | plt.tight_layout() 16 | -------------------------------------------------------------------------------- /scripts/experiments/ei/run_all.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ $# -lt 2 ]; then 4 | echo "Usage: $0 ID-FROM ID-TO" 2>/dev/null 5 | exit 1 6 | fi 7 | 8 | id1=$1 9 | id2=$2 10 | time=$((3*60*60)) 11 | 12 | SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) 13 | 14 | for id in $(seq $id1 $id2); do 15 | 16 | $SCRIPT_DIR/bench.sh ant ant.ProjectBuilderTest $id $time ant-project-afl.dict xml/build.xml 17 | sleep $time 18 | sleep 10 19 | 20 | $SCRIPT_DIR/bench.sh maven maven.ModelReaderTest $id $time maven-model-afl.dict xml/pom.xml 21 | sleep $time 22 | sleep 10 23 | 24 | $SCRIPT_DIR/bench.sh bcel bcel.ParserTest $id $time javaclass.dict javaclass/Hello.class 25 | sleep $time 26 | sleep 10 27 | 28 | $SCRIPT_DIR/bench.sh closure closure.CompilerTest $id $time javascript.dict js/react.production.min.js 29 | sleep $time 30 | sleep 10 31 | 32 | $SCRIPT_DIR/bench.sh rhino rhino.CompilerTest $id $time javascript.dict js/react.production.min.js 33 | sleep $time 34 | sleep 10 35 | 36 | ./bench.sh chess chess.FENTest $id $time fen.dict fen/initial.fen 37 | sleep $time 38 | sleep 10 39 | 40 | done 41 | -------------------------------------------------------------------------------- /scripts/experiments/zest/cov_all.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | ./cov.sh chess chess.FENTest $1 4 | ./cov.sh ant ant.ProjectBuilderTest $1 5 | ./cov.sh maven maven.ModelReaderTest $1 6 | ./cov.sh bcel bcel.ParserTest $1 7 | ./cov.sh closure closure.CompilerTest $1 8 | ./cov.sh rhino rhino.CompilerTest $1 9 | -------------------------------------------------------------------------------- /scripts/experiments/zest/run_all.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ $# -lt 2 ]; then 4 | echo "Usage: $0 ID-FROM ID-TO" 2>/dev/null 5 | exit 1 6 | fi 7 | 8 | id1=$1 9 | id2=$2 10 | time=3h 11 | 12 | for id in $(seq $id1 $id2); do 13 | 14 | ./bench.sh ant ant.ProjectBuilderTest $id $time ant-project-afl.dict xml/build.xml 15 | sleep $time 10s 16 | 17 | ./bench.sh maven maven.ModelReaderTest $id $time maven-model-afl.dict xml/pom.xml 18 | sleep $time 10s 19 | 20 | ./bench.sh bcel bcel.ParserTest $id $time javaclass.dict javaclass/Hello.class 21 | sleep $time 10s 22 | 23 | ./bench.sh closure closure.CompilerTest $id $time javascript.dict js/react.production.min.js 24 | sleep $time 10s 25 | 26 | ./bench.sh rhino rhino.CompilerTest $id $time javascript.dict js/react.production.min.js 27 | sleep $time 10s 28 | 29 | ./bench.sh chess chess.FENTest $id $time fen.dict fen/initial.fen 30 | sleep $time 10s 31 | 32 | done 33 | -------------------------------------------------------------------------------- /scripts/experiments/zest/synt_sem.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #$1: bench 3 | #$2: synct 4 | #$3: sem 5 | #$4: runs 6 | 7 | echo "--------------$1 results ---------------" 8 | for tech in afl rnd seq jqf; do 9 | echo $tech 10 | for i in $(seq $4); do 11 | if [ ! -f $1-$tech-results-$i/cov-all.log ]; then 12 | echo "" 13 | else 14 | echo `egrep $2 $1-$tech-results-$i/cov-all.log | wc -l` ' ' `egrep $3 $1-$tech-results-$i/cov-all.log | wc -l || echo` 15 | fi 16 | done 17 | echo "" 18 | echo "" 19 | done 20 | -------------------------------------------------------------------------------- /scripts/experiments/zest/synt_sem_all.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | #$1: Runs 3 | 4 | ./synt_sem.sh maven "org/codehaus/plexus/util/xml" "org/apache/maven/model" $1 5 | ./synt_sem.sh ant "com/sun/org/apache/xerces" "org/apache/tools/ant" $1 6 | ./synt_sem.sh closure "com/google/javascript/jscomp/parsing" "com/google/javascript/jscomp/[A-Z]" $1 7 | ./synt_sem.sh rhino "org/mozilla/javascript/Parser" "org/mozilla/javascript/(optimizer|CodeGenerator)" $1 8 | ./synt_sem.sh chess "chess/format" "chess/variant" $1 9 | ./synt_sem.sh bcel "org/apache/bcel/classfile" " org/apache/bcel/verifier" $1 10 | -------------------------------------------------------------------------------- /scripts/janala.conf: -------------------------------------------------------------------------------- 1 | janala.excludes=java/,com/sun/proxy/,com/intellij/,edu/berkeley/cs/jqf/,org/junit/,com/pholser/junit/quickcheck/,ru/vyarus/java/generics/resolver/,org/javaruntype/,ognl,org/hamcrest/,org/omg/,org/netbeans/,org/mozilla/javascript/gen 2 | janala.includes=edu/berkeley/cs/jqf/examples,java/text,java/time,com/sun/imageio,com/pholser/junit/quickcheck/internal,com/pholser/junit/quickcheck/generator 3 | -------------------------------------------------------------------------------- /scripts/jqf-driver.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Figure out script absolute path 4 | pushd `dirname $0` > /dev/null 5 | SCRIPT_DIR=`pwd` 6 | popd > /dev/null 7 | 8 | ROOT_DIR=`dirname $SCRIPT_DIR` 9 | 10 | # Find JQF classes and JARs 11 | project="jqf" 12 | version="2.2-SNAPSHOT" 13 | 14 | FUZZ_DIR="${ROOT_DIR}/fuzz/target/" 15 | INST_DIR="${ROOT_DIR}/instrument/target/" 16 | 17 | FUZZ_JAR="${FUZZ_DIR}/$project-fuzz-$version.jar" 18 | INST_JAR="${INST_DIR}/$project-instrument-$version.jar" 19 | 20 | # Compute classpaths (the /classes are only for development; 21 | # if empty the JARs will have whatever is needed) 22 | INST_CLASSPATH="${INST_DIR}/classes:${INST_JAR}:${INST_DIR}/dependency/asm-9.8.jar" 23 | FUZZ_CLASSPATH="${FUZZ_DIR}/classes:${FUZZ_JAR}" 24 | 25 | # If user-defined classpath is not set, default to '.' 26 | if [ -z "${CLASSPATH}" ]; then 27 | CLASSPATH="." 28 | fi 29 | 30 | # Java Agent config (can be turned off using env var) 31 | if [ -z "$JQF_DISABLE_INSTRUMENTATION" ]; then 32 | JAVAAGENT="-javaagent:${INST_JAR}" 33 | fi 34 | 35 | # Run Java 36 | if [ -n "$JAVA_HOME" ]; then 37 | java="$JAVA_HOME"/bin/java 38 | else 39 | java="java" 40 | fi 41 | "$java" -ea \ 42 | -Xbootclasspath/a:"$INST_CLASSPATH" \ 43 | ${JAVAAGENT} \ 44 | -Djanala.conf="${SCRIPT_DIR}/janala.conf" \ 45 | -cp "${FUZZ_CLASSPATH}:${CLASSPATH}" \ 46 | ${JVM_OPTS} \ 47 | $@ 48 | 49 | -------------------------------------------------------------------------------- /setup.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | pushd `dirname $0` > /dev/null 6 | ROOT_DIR=`pwd` 7 | popd > /dev/null 8 | 9 | cd ${ROOT_DIR} 10 | 11 | # Build AFL proxy 12 | make 13 | 14 | # Build JQF 15 | mvn package 16 | 17 | --------------------------------------------------------------------------------