From 5ba6dd3745884814192024936017413ae00e89b7 Mon Sep 17 00:00:00 2001 From: cvs2git Date: Mon, 11 Aug 2008 23:17:48 +0000 Subject: [PATCH] This commit was manufactured by cvs2svn to create tag 'preEdgeChange'. --- CVSROOT/checkoutlist | 17 - CVSROOT/commitinfo | 26 - CVSROOT/config | 37 - CVSROOT/cvslog | 1417 ------ CVSROOT/cvsprep | 185 - CVSROOT/cvswrappers | 19 - CVSROOT/loginfo | 35 - CVSROOT/modules | 26 - CVSROOT/notify | 17 - CVSROOT/rcsinfo | 13 - CVSROOT/taginfo | 40 - CVSROOT/verifymsg | 29 - Robust/JavaGrammar/COPYING | 339 -- Robust/JavaGrammar/Lex/BooleanLiteral.java | 12 - Robust/JavaGrammar/Lex/CharacterLiteral.java | 14 - Robust/JavaGrammar/Lex/Comment.java | 26 - .../JavaGrammar/Lex/DocumentationComment.java | 6 - Robust/JavaGrammar/Lex/DoubleLiteral.java | 9 - Robust/JavaGrammar/Lex/EOF.java | 9 - Robust/JavaGrammar/Lex/EndOfLineComment.java | 5 - .../JavaGrammar/Lex/EscapedUnicodeReader.java | 70 - Robust/JavaGrammar/Lex/FIFO.java | 64 - Robust/JavaGrammar/Lex/FloatLiteral.java | 9 - Robust/JavaGrammar/Lex/Identifier.java | 17 - Robust/JavaGrammar/Lex/InputElement.java | 3 - Robust/JavaGrammar/Lex/IntegerLiteral.java | 9 - Robust/JavaGrammar/Lex/Keyword.java | 69 - Robust/JavaGrammar/Lex/Lexer.java | 528 -- Robust/JavaGrammar/Lex/Literal.java | 3 - Robust/JavaGrammar/Lex/LongLiteral.java | 9 - Robust/JavaGrammar/Lex/NullLiteral.java | 11 - Robust/JavaGrammar/Lex/NumericLiteral.java | 7 - Robust/JavaGrammar/Lex/Operator.java | 57 - Robust/JavaGrammar/Lex/Separator.java | 29 - Robust/JavaGrammar/Lex/StringLiteral.java | 14 - Robust/JavaGrammar/Lex/Token.java | 21 - .../JavaGrammar/Lex/TraditionalComment.java | 5 - Robust/JavaGrammar/Lex/WhiteSpace.java | 18 - Robust/JavaGrammar/Main/Main.java | 39 - Robust/JavaGrammar/Makefile | 89 - Robust/JavaGrammar/Parse/Lexer.java | 13 - Robust/JavaGrammar/Parse/java10.cup | 825 --- Robust/JavaGrammar/Parse/java11.cup | 862 ---- Robust/JavaGrammar/Parse/java12.cup | 874 ---- Robust/JavaGrammar/Parse/java14.cup | 877 ---- Robust/JavaGrammar/Parse/java15.cup | 1355 ----- Robust/JavaGrammar/README | 146 - Robust/JavaGrammar/tests/Eric.java | 45 - Robust/JavaGrammar/tests/Eric15.java | 7 - Robust/JavaGrammar/tests/Escape.java | 4 - Robust/JavaGrammar/tests/Test15.java | 72 - Robust/JavaGrammar/tests/TestJSR201.java | 104 - Robust/cup/CHANGELOG | 313 -- Robust/cup/INSTALL | 107 - Robust/cup/INSTALL.QUICK | 17 - Robust/cup/LICENSE | 20 - Robust/cup/README | 48 - Robust/cup/cup_logo.gif | Bin 8054 -> 0 bytes Robust/cup/gnuwin/README | 30 - Robust/cup/gnuwin/makefile | 26 - Robust/cup/java_cup/CUP$parser$actions.class | Bin 15583 -> 0 bytes Robust/cup/java_cup/Main.class | Bin 14758 -> 0 bytes Robust/cup/java_cup/Main.java | 854 ---- Robust/cup/java_cup/action_part.class | Bin 1107 -> 0 bytes Robust/cup/java_cup/action_part.java | 93 - Robust/cup/java_cup/action_production.class | Bin 604 -> 0 bytes Robust/cup/java_cup/action_production.java | 39 - Robust/cup/java_cup/assoc.class | Bin 333 -> 0 bytes Robust/cup/java_cup/assoc.java | 16 - Robust/cup/java_cup/emit.class | Bin 13997 -> 0 bytes Robust/cup/java_cup/emit.java | 897 ---- Robust/cup/java_cup/internal_error.class | Bin 580 -> 0 bytes Robust/cup/java_cup/internal_error.java | 22 - Robust/cup/java_cup/lalr_item.class | Bin 3745 -> 0 bytes Robust/cup/java_cup/lalr_item.java | 330 -- Robust/cup/java_cup/lalr_item_set.class | Bin 3945 -> 0 bytes Robust/cup/java_cup/lalr_item_set.java | 371 -- Robust/cup/java_cup/lalr_state.class | Bin 9712 -> 0 bytes Robust/cup/java_cup/lalr_state.java | 884 ---- Robust/cup/java_cup/lalr_transition.class | Bin 1508 -> 0 bytes Robust/cup/java_cup/lalr_transition.java | 93 - Robust/cup/java_cup/lexer.class | Bin 5298 -> 0 bytes Robust/cup/java_cup/lexer.java | 543 -- Robust/cup/java_cup/lr_item_core.class | Bin 3162 -> 0 bytes Robust/cup/java_cup/lr_item_core.java | 280 -- Robust/cup/java_cup/non_terminal.class | Bin 3771 -> 0 bytes Robust/cup/java_cup/non_terminal.java | 301 -- Robust/cup/java_cup/nonassoc_action.class | Bin 675 -> 0 bytes Robust/cup/java_cup/nonassoc_action.java | 71 - Robust/cup/java_cup/parse_action.class | Bin 740 -> 0 bytes Robust/cup/java_cup/parse_action.java | 92 - Robust/cup/java_cup/parse_action_row.class | Bin 1035 -> 0 bytes Robust/cup/java_cup/parse_action_row.java | 106 - Robust/cup/java_cup/parse_action_table.class | Bin 2262 -> 0 bytes Robust/cup/java_cup/parse_action_table.java | 143 - Robust/cup/java_cup/parse_reduce_row.class | Bin 529 -> 0 bytes Robust/cup/java_cup/parse_reduce_row.java | 41 - Robust/cup/java_cup/parse_reduce_table.class | Bin 1295 -> 0 bytes Robust/cup/java_cup/parse_reduce_table.java | 99 - Robust/cup/java_cup/parser.class | Bin 7471 -> 0 bytes Robust/cup/java_cup/parser.cup | 863 ---- Robust/cup/java_cup/parser.java | 1849 ------- Robust/cup/java_cup/production.class | Bin 8092 -> 0 bytes Robust/cup/java_cup/production.java | 756 --- Robust/cup/java_cup/production_part.class | Bin 966 -> 0 bytes Robust/cup/java_cup/production_part.java | 94 - Robust/cup/java_cup/reduce_action.class | Bin 1218 -> 0 bytes Robust/cup/java_cup/reduce_action.java | 84 - Robust/cup/java_cup/runtime/Scanner.class | Bin 211 -> 0 bytes Robust/cup/java_cup/runtime/Scanner.java | 25 - Robust/cup/java_cup/runtime/Symbol.class | Bin 1045 -> 0 bytes Robust/cup/java_cup/runtime/Symbol.java | 105 - Robust/cup/java_cup/runtime/lr_parser.class | Bin 9947 -> 0 bytes Robust/cup/java_cup/runtime/lr_parser.java | 1238 ----- .../runtime/virtual_parse_stack.class | Bin 1508 -> 0 bytes .../java_cup/runtime/virtual_parse_stack.java | 145 - Robust/cup/java_cup/shift_action.class | Bin 1199 -> 0 bytes Robust/cup/java_cup/shift_action.java | 82 - .../simple_calc/CUP$parser$actions.class | Bin 4656 -> 0 bytes Robust/cup/java_cup/simple_calc/Main.class | Bin 1119 -> 0 bytes Robust/cup/java_cup/simple_calc/Main.java | 32 - Robust/cup/java_cup/simple_calc/parser.class | Bin 2711 -> 0 bytes Robust/cup/java_cup/simple_calc/parser.cup | 55 - Robust/cup/java_cup/simple_calc/parser.java | 318 -- Robust/cup/java_cup/simple_calc/scanner.class | Bin 1922 -> 0 bytes Robust/cup/java_cup/simple_calc/scanner.java | 63 - Robust/cup/java_cup/simple_calc/sym.class | Bin 668 -> 0 bytes Robust/cup/java_cup/simple_calc/sym.java | 25 - Robust/cup/java_cup/sym.class | Bin 1111 -> 0 bytes Robust/cup/java_cup/sym.java | 43 - Robust/cup/java_cup/symbol.class | Bin 925 -> 0 bytes Robust/cup/java_cup/symbol.java | 107 - Robust/cup/java_cup/symbol_part.class | Bin 1431 -> 0 bytes Robust/cup/java_cup/symbol_part.java | 100 - Robust/cup/java_cup/symbol_set.class | Bin 2612 -> 0 bytes Robust/cup/java_cup/symbol_set.java | 231 - Robust/cup/java_cup/terminal.class | Bin 2196 -> 0 bytes Robust/cup/java_cup/terminal.java | 169 - Robust/cup/java_cup/terminal_set.class | Bin 2459 -> 0 bytes Robust/cup/java_cup/terminal_set.java | 253 - Robust/cup/java_cup/version.class | Bin 549 -> 0 bytes Robust/cup/java_cup/version.java | 55 - Robust/cup/manual.html | 1452 ------ Robust/cup/winnt/README | 17 - Robust/cup/winnt/makefile | 51 - Robust/rolebasedcomputation | 34 - Robust/src/Analysis/CallGraph/CallGraph.java | 237 - .../src/Analysis/FlatIRGraph/FlatIRGraph.java | 117 - .../Locality/GenerateConversions.java | 215 - .../Analysis/Locality/LocalityAnalysis.java | 727 --- .../Analysis/Locality/LocalityBinding.java | 173 - .../src/Analysis/Locality/TempNodePair.java | 48 - .../Analysis/Prefetch/IndexDescriptor.java | 93 - Robust/src/Analysis/Prefetch/LoopExit.java | 90 - Robust/src/Analysis/Prefetch/PairMap.java | 77 - .../Analysis/Prefetch/PrefetchAnalysis.java | 1003 ---- .../src/Analysis/Prefetch/PrefetchPair.java | 139 - Robust/src/Analysis/Scheduling/ClassNode.java | 151 - .../Analysis/Scheduling/CombinationUtil.java | 547 -- .../Analysis/Scheduling/CoreSimulator.java | 188 - .../Analysis/Scheduling/FIFORSchedule.java | 49 - .../src/Analysis/Scheduling/ObjectInfo.java | 32 - .../Analysis/Scheduling/ObjectSimulator.java | 74 - .../Analysis/Scheduling/RuntimeSchedule.java | 19 - Robust/src/Analysis/Scheduling/Schedule.java | 141 - .../Analysis/Scheduling/ScheduleAnalysis.java | 1036 ---- .../src/Analysis/Scheduling/ScheduleEdge.java | 223 - .../src/Analysis/Scheduling/ScheduleNode.java | 382 -- .../Scheduling/ScheduleSimulator.java | 477 -- .../Analysis/Scheduling/SchedulingUtil.java | 519 -- .../Analysis/Scheduling/TaskSimulator.java | 285 -- .../Scheduling/TransTaskSimulator.java | 38 - .../TaskStateAnalysis/Allocations.java | 26 - .../Analysis/TaskStateAnalysis/EGEdge.java | 20 - .../TaskStateAnalysis/EGTaskNode.java | 96 - .../TaskStateAnalysis/ExecutionGraph.java | 142 - .../src/Analysis/TaskStateAnalysis/FEdge.java | 197 - .../TaskStateAnalysis/FlagComparator.java | 30 - .../Analysis/TaskStateAnalysis/FlagInfo.java | 52 - .../Analysis/TaskStateAnalysis/FlagState.java | 472 -- .../TaskStateAnalysis/FlagTagState.java | 27 - .../TaskStateAnalysis/GarbageAnalysis.java | 81 - .../TaskStateAnalysis/ObjWrapper.java | 24 - .../OptionalTaskDescriptor.java | 57 - .../Analysis/TaskStateAnalysis/Predicate.java | 33 - .../TaskStateAnalysis/SafetyAnalysis.java | 569 --- .../src/Analysis/TaskStateAnalysis/TEdge.java | 30 - .../TaskStateAnalysis/TagAnalysis.java | 229 - .../TaskStateAnalysis/TagBinding.java | 66 - .../Analysis/TaskStateAnalysis/TagEdge.java | 39 - .../Analysis/TaskStateAnalysis/TagState.java | 111 - .../TaskStateAnalysis/TagWrapper.java | 31 - .../TaskStateAnalysis/Task Analysis.pdf | Bin 12095 -> 0 bytes .../TaskStateAnalysis/TaskAnalysis.java | 444 -- .../TaskStateAnalysis/TaskAnalysisAlgorithm | 50 - .../TaskStateAnalysis/TaskBinding.java | 122 - .../Analysis/TaskStateAnalysis/TaskEdges.java | 25 - .../Analysis/TaskStateAnalysis/TaskGraph.java | 231 - .../Analysis/TaskStateAnalysis/TaskIndex.java | 46 - .../Analysis/TaskStateAnalysis/TaskNode.java | 76 - .../TaskStateAnalysis/TaskNodeNamer.java | 15 - .../Analysis/TaskStateAnalysis/TaskQueue.java | 46 - .../TaskStateAnalysis/TaskQueueIterator.java | 154 - .../TaskStateAnalysis/TaskTagAnalysis.java | 642 --- .../Analysis/TaskStateAnalysis/Wrapper.java | 5 - .../src/Benchmarks/BankApp/BankAccount.java | 70 - Robust/src/Benchmarks/BankApp/BankApp.java | 357 -- Robust/src/Benchmarks/BankApp/BankAppRead.dat | 1 - .../src/Benchmarks/BankApp/BankAppSocket.java | 26 - .../src/Benchmarks/BankApp/BankAppWrite.dat | 1 - .../src/Benchmarks/BankApp/BankDatabase.java | 107 - .../BankAppJava/BankAppClientTeller.java | 374 -- .../Benchmarks/BankAppJava/BankAppServer.java | 697 --- .../BankAppJava/BankAppTestClient.java | 48 - Robust/src/Benchmarks/BankAppJava/accts.txt | 14 - Robust/src/Benchmarks/Chat/BRISTLECONE | 1 - Robust/src/Benchmarks/Chat/ChatServer.java | 35 - Robust/src/Benchmarks/Chat/ChatSocket.java | 30 - Robust/src/Benchmarks/Chat/Message.java | 12 - Robust/src/Benchmarks/Chat/NetsClient.java | 148 - Robust/src/Benchmarks/Chat/Room.java | 22 - Robust/src/Benchmarks/Chat/RoomObject.java | 15 - Robust/src/Benchmarks/Chat/analyze.java | 21 - Robust/src/Benchmarks/Chat/doall | 7 - Robust/src/Benchmarks/Chat/runtest.sh | 12 - .../src/Benchmarks/ChatJava/ChatServer.java | 17 - .../src/Benchmarks/ChatJava/ChatThread.java | 57 - Robust/src/Benchmarks/ChatJava/Room.java | 22 - .../src/Benchmarks/ChatJava/RoomObject.java | 14 - Robust/src/Benchmarks/ChatTag/ChatServer.java | 36 - Robust/src/Benchmarks/ChatTag/ChatSocket.java | 31 - Robust/src/Benchmarks/ChatTag/Message.java | 12 - Robust/src/Benchmarks/ChatTag/Room.java | 22 - Robust/src/Benchmarks/ChatTag/RoomObject.java | 15 - .../Benchmarks/Conglomerator/Java/Google.java | 10 - .../Conglomerator/Java/Inventory.java | 88 - .../Conglomerator/Java/ItemInfo.java | 8 - .../Benchmarks/Conglomerator/Java/Logger.java | 27 - .../Benchmarks/Conglomerator/Java/Lookup.java | 37 - .../Benchmarks/Conglomerator/Java/Stock.java | 10 - .../Conglomerator/Java/Weather.java | 9 - .../Conglomerator/Java/WebServerExample.java | 93 - .../Conglomerator/Java/WebServerSocket.java | 135 - .../Benchmarks/Conglomerator/Tag/Google.java | 10 - .../Conglomerator/Tag/Inventory.java | 89 - .../Conglomerator/Tag/ItemInfo.java | 8 - .../Benchmarks/Conglomerator/Tag/Logger.java | 28 - .../Benchmarks/Conglomerator/Tag/Lookup.java | 62 - .../Conglomerator/Tag/MySocket.java | 6 - .../Tag/Nrm/WebServerExample.java | 136 - .../Tag/Opt/WebServerExampleOpt.java | 82 - .../Benchmarks/Conglomerator/Tag/Stock.java | 11 - .../Benchmarks/Conglomerator/Tag/Weather.java | 9 - .../Tag/WebServerExampleBUGSTUDY.java | 136 - .../Conglomerator/Tag/WebServerSocket.java | 139 - .../Jhttpp2/BR/Jhttpp2ClientInputStream.java | 134 - .../Jhttpp2/BR/Jhttpp2HTTPSession.java | 31 - .../Benchmarks/Jhttpp2/BR/Jhttpp2Server.java | 310 -- .../Benchmarks/Jhttpp2/BR/Jhttpp2Task.java | 184 - .../Jhttpp2/BR/Jhttpp2URLMatch.java | 41 - .../src/Benchmarks/Jhttpp2/BR/MySocket.java | 7 - .../Benchmarks/Jhttpp2/BR/OnURLAction.java | 81 - Robust/src/Benchmarks/Jhttpp2/BR/Request.java | 129 - .../Jhttpp2/BR/WildcardDictionary.java | 182 - .../Java/Jhttpp2ClientInputStream.java | 342 -- .../Jhttpp2/Java/Jhttpp2HTTPSession.java | 353 -- .../Jhttpp2/Java/Jhttpp2Launcher.java | 31 - .../Benchmarks/Jhttpp2/Java/Jhttpp2Read.java | 58 - .../Jhttpp2/Java/Jhttpp2Server.java | 323 -- .../Jhttpp2/Java/Jhttpp2URLMatch.java | 41 - .../Benchmarks/Jhttpp2/Java/OnURLAction.java | 81 - .../Jhttpp2/Java/WildcardDictionary.java | 182 - .../MapReduce/Java/Configuration.java | 55 - .../Benchmarks/MapReduce/Java/Configured.java | 22 - .../Benchmarks/MapReduce/Java/JobClient.java | 59 - .../MapReduce/Java/MapReduceBase.java | 13 - .../Benchmarks/MapReduce/Java/MapWorker.java | 119 - .../src/Benchmarks/MapReduce/Java/Master.java | 158 - .../MapReduce/Java/OutputCollector.java | 31 - .../MapReduce/Java/ReduceWorker.java | 167 - .../Benchmarks/MapReduce/Java/Splitter.java | 83 - .../src/Benchmarks/MapReduce/Java/Tool.java | 5 - .../Benchmarks/MapReduce/Java/ToolRunner.java | 9 - .../MapReduce/Java/WordCounter.java | 138 - .../Benchmarks/MapReduce/Nor/MapReduce.java | 140 - .../MapReduce/Nor/MapReduceBase.java | 55 - .../Benchmarks/MapReduce/Nor/MapWorker.java | 102 - .../src/Benchmarks/MapReduce/Nor/Master.java | 149 - .../MapReduce/Nor/OutputCollector.java | 27 - .../MapReduce/Nor/ReduceWorker.java | 138 - .../Benchmarks/MapReduce/Nor/Splitter.java | 73 - .../Benchmarks/MapReduce/Tag/MapReduce.java | 140 - .../MapReduce/Tag/MapReduceBase.java | 55 - .../Benchmarks/MapReduce/Tag/MapWorker.java | 102 - .../src/Benchmarks/MapReduce/Tag/Master.java | 149 - .../MapReduce/Tag/OutputCollector.java | 27 - .../MapReduce/Tag/ReduceWorker.java | 138 - .../Benchmarks/MapReduce/Tag/Splitter.java | 73 - .../src/Benchmarks/PERT/Java/Estimator.java | 108 - Robust/src/Benchmarks/PERT/Java/PERT.java | 104 - Robust/src/Benchmarks/PERT/Java/Stage.java | 85 - Robust/src/Benchmarks/PERT/Tag/Estimator.java | 111 - Robust/src/Benchmarks/PERT/Tag/PERT.java | 86 - Robust/src/Benchmarks/PERT/Tag/Stage.java | 87 - .../src/Benchmarks/Prefetch/Array/Array.java | 37 - Robust/src/Benchmarks/Prefetch/Array/makefile | 13 - .../src/Benchmarks/Prefetch/Chase/Chase.java | 38 - Robust/src/Benchmarks/Prefetch/Chase/makefile | 15 - .../Crypt/dsm/JGFCryptBenchSizeA.java | 281 -- .../Prefetch/Crypt/dsm/crypt/IDEATest.java | 592 --- .../Crypt/dsm/crypt/JGFCryptBench.java | 387 -- .../Crypt/dsm/jgfutil/JGFInstrumentor.java | 206 - .../Prefetch/Crypt/dsm/jgfutil/JGFTimer.java | 130 - .../Benchmarks/Prefetch/Crypt/dsm/makefile | 16 - .../Prefetch/Crypt/java/JGFCryptBench.java | 389 -- .../Crypt/java/JGFCryptBenchSizeA.java | 248 - .../Prefetch/Crypt/java/JGFInstrumentor.java | 206 - .../Prefetch/Crypt/java/JGFTimer.java | 130 - .../Benchmarks/Prefetch/Crypt/java/makefile | 8 - .../Benchmarks/Prefetch/Em3d/dsm/Barrier.java | 54 - .../Benchmarks/Prefetch/Em3d/dsm/BiGraph.java | 107 - .../Prefetch/Em3d/dsm/BiGraph2.java | 104 - .../Prefetch/Em3d/dsm/BiGraphN.java | 179 - .../Prefetch/Em3d/dsm/BiGraphNold.java | 107 - .../Benchmarks/Prefetch/Em3d/dsm/EVector.java | 83 - .../Benchmarks/Prefetch/Em3d/dsm/Em3d.java | 243 - .../Benchmarks/Prefetch/Em3d/dsm/Em3d2.java | 259 - .../Benchmarks/Prefetch/Em3d/dsm/Em3dN.java | 441 -- .../Prefetch/Em3d/dsm/Em3dNold.java | 242 - .../Prefetch/Em3d/dsm/Em3dWrap.java | 9 - .../Benchmarks/Prefetch/Em3d/dsm/Node.java | 144 - .../Benchmarks/Prefetch/Em3d/dsm/Node2.java | 121 - .../src/Benchmarks/Prefetch/Em3d/dsm/README | 6 - .../src/Benchmarks/Prefetch/Em3d/dsm/makefile | 36 - .../Prefetch/Em3d/java/Barrier.java | 48 - .../Prefetch/Em3d/java/BiGraph.java | 130 - .../Benchmarks/Prefetch/Em3d/java/Em3d.java | 207 - .../Benchmarks/Prefetch/Em3d/java/Node.java | 210 - .../Benchmarks/Prefetch/Em3d/java/makefile | 7 - .../Prefetch/LUFact/dsm/Barrier.java | 52 - .../Prefetch/LUFact/dsm/JGFInstrumentor.java | 199 - .../Prefetch/LUFact/dsm/JGFLUFactBench.java | 416 -- .../LUFact/dsm/JGFLUFactBenchSizeA.java | 62 - .../Prefetch/LUFact/dsm/JGFTimer.java | 123 - .../Prefetch/LUFact/dsm/Linpack.java | 327 -- .../Prefetch/LUFact/dsm/LinpackRunner.java | 233 - .../LUFact/dsm/TournamentBarrier.java | 94 - .../Benchmarks/Prefetch/LUFact/dsm/makefile | 25 - .../Prefetch/LUFact/java/JGFInstrumentor.java | 200 - .../Prefetch/LUFact/java/JGFLUFactBench.java | 441 -- .../LUFact/java/JGFLUFactBenchSizeA.java | 50 - .../Prefetch/LUFact/java/JGFTimer.java | 124 - .../Prefetch/LUFact/java/Linpack.java | 327 -- .../Prefetch/LUFact/java/LinpackRunner.java | 205 - .../LUFact/java/TournamentBarrier.java | 96 - .../Benchmarks/Prefetch/LUFact/java/makefile | 8 - .../MatrixMultiply/MatrixMultiply.java | 192 - .../MatrixMultiply/MatrixMultiplyN.java | 163 - .../MatrixMultiply/MatrixMultiplyNrun.java | 153 - .../MatrixMultiply/java/MatrixMultiply.java | 156 - .../Prefetch/MatrixMultiply/java/makefile | 9 - .../Prefetch/MatrixMultiply/makefile | 20 - .../Prefetch/Moldyn/dsm/Barrier.java | 54 - .../Prefetch/Moldyn/dsm/DebugBarrier.java | 56 - .../Prefetch/Moldyn/dsm/JGFInstrumentor.java | 199 - .../Prefetch/Moldyn/dsm/JGFMolDynBench.java | 696 --- .../Moldyn/dsm/JGFMolDynBenchSizeA.java | 84 - .../Prefetch/Moldyn/dsm/JGFTimer.java | 123 - .../Moldyn/dsm/TournamentBarrier.java | 94 - .../Benchmarks/Prefetch/Moldyn/dsm/makefile | 16 - .../Prefetch/Moldyn/java/Barrier.java | 48 - .../Prefetch/Moldyn/java/JGFInstrumentor.java | 199 - .../Prefetch/Moldyn/java/JGFMolDynBench.java | 697 --- .../Moldyn/java/JGFMolDynBenchSizeA.java | 81 - .../Prefetch/Moldyn/java/JGFTimer.java | 123 - .../Moldyn/java/TournamentBarrier.java | 96 - .../Benchmarks/Prefetch/Moldyn/java/makefile | 26 - .../Prefetch/SOR/dsm/JGFInstrumentor.java | 199 - .../Prefetch/SOR/dsm/JGFSORBench.java | 124 - .../Prefetch/SOR/dsm/JGFSORBenchSizeA.java | 67 - .../Prefetch/SOR/dsm/JGFSORBenchSizeB.java | 66 - .../Prefetch/SOR/dsm/JGFSORBenchSizeC.java | 66 - .../Benchmarks/Prefetch/SOR/dsm/JGFTimer.java | 123 - .../Prefetch/SOR/dsm/SORRunner.java | 151 - .../Prefetch/SOR/dsm/SORRunner2.java | 157 - .../Benchmarks/Prefetch/SOR/dsm/SORWrap.java | 9 - .../src/Benchmarks/Prefetch/SOR/dsm/makefile | 25 - .../Prefetch/SOR/java/JGFInstrumentor.java | 200 - .../Prefetch/SOR/java/JGFSORBench.java | 165 - .../Prefetch/SOR/java/JGFSORBenchSizeA.java | 54 - .../Prefetch/SOR/java/JGFSORBenchSizeB.java | 52 - .../Prefetch/SOR/java/JGFSORBenchSizeC.java | 53 - .../Prefetch/SOR/java/JGFTimer.java | 124 - .../Prefetch/SOR/java/SORRunner.java | 119 - .../src/Benchmarks/Prefetch/SOR/java/makefile | 8 - Robust/src/Benchmarks/Prefetch/avg.sh | 7 - Robust/src/Benchmarks/Prefetch/bm.txt | 7 - Robust/src/Benchmarks/Prefetch/run.sh | 154 - .../Scheduling/JGFSeries/JGFSeriesBench.java | 38 - .../Scheduling/JGFSeries/SeriesRunner.java | 235 - .../Scheduling/JGFSeries/c/JGFSeriesBench.c | 196 - .../Scheduling/JGFSeries/c/Makefile | 18 - .../Scheduling/MapReduce/MapReduce.java | 134 - .../Scheduling/MapReduce/MapReduceBase.java | 55 - .../Scheduling/MapReduce/MapWorker.java | 76 - .../Scheduling/MapReduce/Master.java | 171 - .../Scheduling/MapReduce/OutputCollector.java | 27 - .../Scheduling/MapReduce/ReduceWorker.java | 106 - .../Scheduling/MapReduce/Splitter.java | 33 - Robust/src/Benchmarks/Spider/BR/Query.java | 84 - .../src/Benchmarks/Spider/BR/QueryList.java | 14 - Robust/src/Benchmarks/Spider/BR/Spider.java | 103 - Robust/src/Benchmarks/Spider/BRTag/Query.java | 84 - .../Benchmarks/Spider/BRTag/QueryList.java | 14 - .../src/Benchmarks/Spider/BRTag/Spider.java | 107 - Robust/src/Benchmarks/Spider/Java/Query.java | 71 - .../src/Benchmarks/Spider/Java/QueryList.java | 13 - .../Benchmarks/Spider/Java/QueryQueue.java | 17 - .../Benchmarks/Spider/Java/QueryThread.java | 129 - Robust/src/Benchmarks/Spider/Java/Spider.java | 23 - Robust/src/Benchmarks/Spider/dotest | 25 - .../src/Benchmarks/Spider/tests/generate.java | 29 - Robust/src/Benchmarks/Spider/testscript | 8 - Robust/src/Benchmarks/TTT/Board.java | 93 - Robust/src/Benchmarks/TTT/TTTServer.java | 58 - .../src/Benchmarks/TTT/TTTServerSocket.java | 101 - Robust/src/Benchmarks/TTTJava/TTTServer.java | 293 -- Robust/src/Benchmarks/TTTTag/Board.java | 93 - Robust/src/Benchmarks/TTTTag/TTTServer.java | 66 - .../Benchmarks/TTTTag/TTTServerSocket.java | 109 - .../TileSearch/Java/SubProblem.java | 223 - .../src/Benchmarks/TileSearch/Java/Tile.java | 56 - .../Benchmarks/TileSearch/Java/TileGrid.java | 407 -- .../TileSearch/Java/TileSearch.java | 95 - .../TileSearch/Tag/GlobalCounter.java | 10 - .../Benchmarks/TileSearch/Tag/SubProblem.java | 168 - .../src/Benchmarks/TileSearch/Tag/Tile.java | 481 -- .../Benchmarks/TileSearch/Tag/TileSearch.java | 239 - .../src/Benchmarks/WebServer/Inventory.java | 91 - Robust/src/Benchmarks/WebServer/ItemInfo.java | 8 - Robust/src/Benchmarks/WebServer/Logger.java | 29 - .../WebServer/WebServerExample.java | 111 - .../Benchmarks/WebServer/WebServerSocket.java | 141 - .../WebServer/Workload/batch/difference.sh | 32 - .../batch/pure/trans_inventory.sorted | 7 - .../WebServer/Workload/batch/run.sh | 31 - .../WebServer/Workload/batch/run2.sh | 64 - .../WebServer/Workload/generate.java | 19 - .../Benchmarks/WebServer/Workload/workload | 4402 ----------------- .../WebServer/Workload/workloaderror | 101 - .../WebServer/Workload/workloadfile1000 | 1000 ---- .../WebServer/Workload/workloadmix1000 | 1000 ---- .../WebServer/Workload/workloadtrans | 101 - .../WebServer/Workload/workloadtrans1000 | 980 ---- Robust/src/Benchmarks/WebServer/compileserver | 2 - .../WebServer/htmlfiles/index1.html | 25 - .../WebServer/htmlfiles/index2.html | 8 - .../WebServer/htmlfiles/request.log | 16 - .../src/Benchmarks/WebServerJ/Inventory.java | 94 - .../src/Benchmarks/WebServerJ/ItemInfo.java | 8 - Robust/src/Benchmarks/WebServerJ/Logger.java | 46 - .../WebServerJ/WebServerExample.java | 31 - .../WebServerJ/WebServerThread.java | 275 - .../Benchmarks/WebServerJava/Inventory.java | 87 - .../Benchmarks/WebServerJava/ItemInfo.java | 8 - .../src/Benchmarks/WebServerJava/Logger.java | 27 - .../WebServerJava/WebServerExampleJava.java | 23 - .../WebServerJava/WebServerThread.java | 227 - .../Benchmarks/WebServerTag/Inventory.java | 91 - .../src/Benchmarks/WebServerTag/ItemInfo.java | 8 - .../src/Benchmarks/WebServerTag/Logger.java | 29 - .../WebServerTag/WebServerExample.java | 110 - .../WebServerTag/WebServerSocket.java | 141 - Robust/src/ClassLibrary/Barrier.java | 52 - .../src/ClassLibrary/BufferedInputStream.java | 17 - .../ClassLibrary/BufferedOutputStream.java | 19 - Robust/src/ClassLibrary/BufferedWriter.java | 24 - Robust/src/ClassLibrary/Character.java | 17 - Robust/src/ClassLibrary/Date.java | 5 - Robust/src/ClassLibrary/Dictionary.java | 3 - Robust/src/ClassLibrary/Enumeration.java | 3 - Robust/src/ClassLibrary/File.java | 17 - Robust/src/ClassLibrary/FileInputStream.java | 34 - Robust/src/ClassLibrary/FileOutputStream.java | 57 - Robust/src/ClassLibrary/FileWriter.java | 6 - Robust/src/ClassLibrary/HashEntry.java | 6 - Robust/src/ClassLibrary/HashMap.java | 132 - Robust/src/ClassLibrary/HashMapIterator.java | 46 - Robust/src/ClassLibrary/HashSet.java | 30 - Robust/src/ClassLibrary/InetAddress.java | 62 - Robust/src/ClassLibrary/InputStream.java | 12 - Robust/src/ClassLibrary/Integer.java | 60 - Robust/src/ClassLibrary/Math.java | 34 - Robust/src/ClassLibrary/Object.java | 30 - Robust/src/ClassLibrary/ObjectJava.java | 33 - Robust/src/ClassLibrary/ObjectJavaDSM.java | 30 - Robust/src/ClassLibrary/ObjectJavaNT.java | 28 - Robust/src/ClassLibrary/OutputStream.java | 23 - .../src/ClassLibrary/OutputStreamWriter.java | 14 - Robust/src/ClassLibrary/ServerSocket.java | 37 - Robust/src/ClassLibrary/ServerSocketJava.java | 28 - Robust/src/ClassLibrary/Signal.java | 8 - Robust/src/ClassLibrary/Socket.java | 71 - .../src/ClassLibrary/SocketInputStream.java | 22 - Robust/src/ClassLibrary/SocketJava.java | 61 - .../src/ClassLibrary/SocketOutputStream.java | 24 - Robust/src/ClassLibrary/StartupObject.java | 5 - Robust/src/ClassLibrary/String.java | 343 -- Robust/src/ClassLibrary/StringBuffer.java | 75 - Robust/src/ClassLibrary/System.java | 20 - Robust/src/ClassLibrary/TagDescriptor.java | 5 - Robust/src/ClassLibrary/Thread.java | 26 - Robust/src/ClassLibrary/ThreadDSM.java | 20 - Robust/src/ClassLibrary/Vector.java | 83 - Robust/src/ClassLibrary/Writer.java | 17 - Robust/src/ClassLibrary/gnu/Random.java | 421 -- Robust/src/IR/AssignOperation.java | 131 - Robust/src/IR/ClassDescriptor.java | 142 - Robust/src/IR/Descriptor.java | 46 - Robust/src/IR/FieldDescriptor.java | 50 - Robust/src/IR/FlagDescriptor.java | 28 - Robust/src/IR/Flat/BuildCode.java | 2836 ----------- Robust/src/IR/Flat/BuildCodeMultiCore.java | 1254 ----- Robust/src/IR/Flat/BuildFlat.java | 1014 ---- Robust/src/IR/Flat/FKind.java | 25 - Robust/src/IR/Flat/FlatAtomicEnterNode.java | 26 - Robust/src/IR/Flat/FlatAtomicExitNode.java | 21 - Robust/src/IR/Flat/FlatBackEdge.java | 15 - Robust/src/IR/Flat/FlatCall.java | 83 - Robust/src/IR/Flat/FlatCastNode.java | 43 - Robust/src/IR/Flat/FlatCheckNode.java | 33 - Robust/src/IR/Flat/FlatCondBranch.java | 69 - Robust/src/IR/Flat/FlatElementNode.java | 46 - Robust/src/IR/Flat/FlatFieldNode.java | 42 - Robust/src/IR/Flat/FlatFlagActionNode.java | 145 - Robust/src/IR/Flat/FlatGlobalConvNode.java | 48 - Robust/src/IR/Flat/FlatLiteralNode.java | 57 - Robust/src/IR/Flat/FlatMethod.java | 183 - Robust/src/IR/Flat/FlatNew.java | 61 - Robust/src/IR/Flat/FlatNode.java | 57 - Robust/src/IR/Flat/FlatNop.java | 15 - Robust/src/IR/Flat/FlatOpNode.java | 59 - Robust/src/IR/Flat/FlatPrefetchNode.java | 46 - Robust/src/IR/Flat/FlatReturnNode.java | 28 - Robust/src/IR/Flat/FlatSetElementNode.java | 42 - Robust/src/IR/Flat/FlatSetFieldNode.java | 38 - Robust/src/IR/Flat/FlatTagDeclaration.java | 36 - Robust/src/IR/Flat/NodePair.java | 19 - Robust/src/IR/Flat/ParamsObject.java | 95 - Robust/src/IR/Flat/TempDescriptor.java | 82 - Robust/src/IR/Flat/TempFlagPair.java | 37 - Robust/src/IR/Flat/TempObject.java | 104 - Robust/src/IR/Flat/TempTagPair.java | 48 - Robust/src/IR/MethodDescriptor.java | 187 - Robust/src/IR/NameDescriptor.java | 40 - Robust/src/IR/Operation.java | 168 - Robust/src/IR/State.java | 188 - Robust/src/IR/SymbolTable.java | 125 - Robust/src/IR/TagDescriptor.java | 29 - Robust/src/IR/TagVarDescriptor.java | 56 - Robust/src/IR/TaskDescriptor.java | 113 - Robust/src/IR/Tree/ArrayAccessNode.java | 33 - Robust/src/IR/Tree/AssignmentNode.java | 39 - Robust/src/IR/Tree/AtomicNode.java | 20 - Robust/src/IR/Tree/BlockExpressionNode.java | 20 - Robust/src/IR/Tree/BlockNode.java | 84 - Robust/src/IR/Tree/BlockStatementNode.java | 11 - Robust/src/IR/Tree/BuildIR.java | 792 --- Robust/src/IR/Tree/CastNode.java | 47 - Robust/src/IR/Tree/ConstraintCheck.java | 51 - Robust/src/IR/Tree/CreateObjectNode.java | 81 - Robust/src/IR/Tree/DNFFlag.java | 115 - Robust/src/IR/Tree/DNFFlagAtom.java | 32 - Robust/src/IR/Tree/DeclarationNode.java | 29 - Robust/src/IR/Tree/ExpressionNode.java | 12 - Robust/src/IR/Tree/FieldAccessNode.java | 41 - Robust/src/IR/Tree/FlagEffect.java | 37 - Robust/src/IR/Tree/FlagEffects.java | 64 - Robust/src/IR/Tree/FlagExpressionNode.java | 12 - Robust/src/IR/Tree/FlagNode.java | 41 - Robust/src/IR/Tree/FlagOpNode.java | 56 - Robust/src/IR/Tree/IfStatementNode.java | 35 - Robust/src/IR/Tree/Kind.java | 25 - Robust/src/IR/Tree/LiteralNode.java | 63 - Robust/src/IR/Tree/LoopNode.java | 64 - Robust/src/IR/Tree/MethodInvokeNode.java | 90 - Robust/src/IR/Tree/Modifiers.java | 73 - Robust/src/IR/Tree/NameNode.java | 76 - Robust/src/IR/Tree/OpNode.java | 71 - Robust/src/IR/Tree/ParseNode.java | 234 - Robust/src/IR/Tree/ParseNodeDOTVisitor.java | 71 - Robust/src/IR/Tree/ParseNodeVector.java | 27 - Robust/src/IR/Tree/ReturnNode.java | 27 - Robust/src/IR/Tree/SemanticCheck.java | 978 ---- Robust/src/IR/Tree/SubBlockNode.java | 20 - Robust/src/IR/Tree/TagDeclarationNode.java | 35 - Robust/src/IR/Tree/TagEffect.java | 37 - Robust/src/IR/Tree/TagExpressionList.java | 43 - Robust/src/IR/Tree/TaskExitNode.java | 27 - Robust/src/IR/Tree/TreeNode.java | 18 - Robust/src/IR/Tree/Walkable.java | 34 - Robust/src/IR/TypeDescriptor.java | 297 -- Robust/src/IR/TypeUtil.java | 267 - Robust/src/IR/VarDescriptor.java | 35 - Robust/src/IR/Virtual.java | 125 - Robust/src/Interface/HTTPHeader.java | 110 - Robust/src/Interface/HTTPResponse.java | 7 - Robust/src/Interface/HTTPServices.java | 82 - Robust/src/Interface/HashStrings.java | 39 - Robust/src/Interface/IdentityRelation.java | 27 - Robust/src/Interface/Imap.java | 148 - Robust/src/Interface/JhttpServer.java | 49 - Robust/src/Interface/JhttpWorker.java | 191 - Robust/src/Interface/LogFile.java | 73 - Robust/src/Interface/WebInterface.java | 280 -- Robust/src/Lex/BooleanLiteral.java | 13 - Robust/src/Lex/CharacterLiteral.java | 15 - Robust/src/Lex/Comment.java | 26 - Robust/src/Lex/DocumentationComment.java | 6 - Robust/src/Lex/DoubleLiteral.java | 10 - Robust/src/Lex/EOF.java | 10 - Robust/src/Lex/EndOfLineComment.java | 5 - Robust/src/Lex/EscapedUnicodeReader.java | 70 - Robust/src/Lex/FIFO.java | 64 - Robust/src/Lex/FloatLiteral.java | 10 - Robust/src/Lex/Identifier.java | 18 - Robust/src/Lex/InputElement.java | 3 - Robust/src/Lex/IntegerLiteral.java | 10 - Robust/src/Lex/Keyword.java | 79 - Robust/src/Lex/Lexer.java | 522 -- Robust/src/Lex/Literal.java | 3 - Robust/src/Lex/LongLiteral.java | 10 - Robust/src/Lex/NullLiteral.java | 12 - Robust/src/Lex/NumericLiteral.java | 7 - Robust/src/Lex/Operator.java | 58 - Robust/src/Lex/Separator.java | 30 - Robust/src/Lex/StringLiteral.java | 15 - Robust/src/Lex/Token.java | 21 - Robust/src/Lex/TraditionalComment.java | 5 - Robust/src/Lex/WhiteSpace.java | 18 - Robust/src/Main/Main.java | 488 -- Robust/src/Makefile | 138 - Robust/src/Makefile.raw.1 | 19 - Robust/src/Makefile.raw.2 | 19 - Robust/src/Makefile.raw.4 | 19 - Robust/src/Makefile.raw.i.1 | 19 - Robust/src/Makefile.raw.i.2 | 19 - Robust/src/Makefile.raw.i.4 | 19 - Robust/src/Parse/java14.cup | 1843 ------- Robust/src/README | 2 - Robust/src/RepairTest/TaskExample.java | 48 - .../specs/Example/Example.constraints | 1 - .../RepairTest/specs/Example/Example.label | 1 - .../RepairTest/specs/Example/Example.model | 4 - .../RepairTest/specs/Example/Example.space | 6 - .../specs/Example2/Example2.constraints | 1 - .../RepairTest/specs/Example2/Example2.label | 1 - .../RepairTest/specs/Example2/Example2.model | 4 - .../RepairTest/specs/Example2/Example2.space | 6 - Robust/src/Runtime/DSTM/docs/commitnotes | 77 - Robust/src/Runtime/DSTM/docs/messages | 72 - Robust/src/Runtime/DSTM/docs/prefetch | 7 - Robust/src/Runtime/DSTM/docs/prefetchnotes | 61 - Robust/src/Runtime/DSTM/docs/readme.txt | 1 - .../Runtime/DSTM/interface/ISSUESTOADDRESS | 33 - Robust/src/Runtime/DSTM/interface/Makefile | 22 - .../DSTM/interface/addPrefetchEnhance.c | 147 - .../DSTM/interface/addPrefetchEnhance.h | 24 - .../Runtime/DSTM/interface/addUdpEnhance.c | 210 - .../Runtime/DSTM/interface/addUdpEnhance.h | 26 - Robust/src/Runtime/DSTM/interface/clookup.c | 202 - Robust/src/Runtime/DSTM/interface/clookup.h | 35 - Robust/src/Runtime/DSTM/interface/dht.c | 1750 ------- Robust/src/Runtime/DSTM/interface/dht.h | 38 - Robust/src/Runtime/DSTM/interface/dsmdebug.h | 15 - Robust/src/Runtime/DSTM/interface/dstm.c | 9 - Robust/src/Runtime/DSTM/interface/dstm.h | 304 -- .../src/Runtime/DSTM/interface/dstmserver.c | 819 --- Robust/src/Runtime/DSTM/interface/gCollect.c | 175 - Robust/src/Runtime/DSTM/interface/gCollect.h | 32 - Robust/src/Runtime/DSTM/interface/ip.c | 104 - Robust/src/Runtime/DSTM/interface/ip.h | 16 - Robust/src/Runtime/DSTM/interface/llookup.c | 228 - Robust/src/Runtime/DSTM/interface/llookup.h | 40 - .../src/Runtime/DSTM/interface/localobjects.c | 63 - .../src/Runtime/DSTM/interface/localobjects.h | 14 - .../src/Runtime/DSTM/interface/machinepile.c | 80 - .../src/Runtime/DSTM/interface/machinepile.h | 10 - Robust/src/Runtime/DSTM/interface/main.c | 25 - Robust/src/Runtime/DSTM/interface/mcpileq.c | 71 - Robust/src/Runtime/DSTM/interface/mcpileq.h | 37 - Robust/src/Runtime/DSTM/interface/mlookup.c | 218 - Robust/src/Runtime/DSTM/interface/mlookup.h | 35 - Robust/src/Runtime/DSTM/interface/objstr.c | 58 - Robust/src/Runtime/DSTM/interface/plookup.c | 81 - Robust/src/Runtime/DSTM/interface/plookup.h | 28 - Robust/src/Runtime/DSTM/interface/prelookup.c | 224 - Robust/src/Runtime/DSTM/interface/prelookup.h | 43 - Robust/src/Runtime/DSTM/interface/queue.c | 85 - Robust/src/Runtime/DSTM/interface/queue.h | 16 - Robust/src/Runtime/DSTM/interface/signal.c | 45 - Robust/src/Runtime/DSTM/interface/sockpool.c | 321 -- Robust/src/Runtime/DSTM/interface/sockpool.h | 51 - .../Runtime/DSTM/interface/tests/testclient.c | 817 --- .../DSTM/interface/tests/testclookup.c | 58 - .../Runtime/DSTM/interface/tests/testd-3.c | 657 --- .../Runtime/DSTM/interface/tests/testd-4.c | 344 -- .../Runtime/DSTM/interface/tests/testdht.c | 159 - .../DSTM/interface/tests/testllookup.c | 43 - .../DSTM/interface/tests/testmlookup.c | 45 - .../Runtime/DSTM/interface/tests/testobjstr.c | 32 - .../Runtime/DSTM/interface/tests/testserver.c | 469 -- .../src/Runtime/DSTM/interface/threadnotify.c | 220 - .../src/Runtime/DSTM/interface/threadnotify.h | 52 - Robust/src/Runtime/DSTM/interface/trans.c | 1873 ------- Robust/src/Runtime/GenericHashtable.c | 307 -- Robust/src/Runtime/GenericHashtable.h | 55 - Robust/src/Runtime/ObjectHash.c | 342 -- Robust/src/Runtime/ObjectHash.h | 83 - Robust/src/Runtime/Queue.c | 84 - Robust/src/Runtime/Queue.h | 28 - Robust/src/Runtime/SimpleHash.c | 365 -- Robust/src/Runtime/SimpleHash.h | 80 - Robust/src/Runtime/callconventions | 10 - Robust/src/Runtime/checkpoint.c | 352 -- Robust/src/Runtime/checkpoint.h | 11 - Robust/src/Runtime/file.c | 71 - Robust/src/Runtime/garbage.c | 592 --- Robust/src/Runtime/garbage.h | 29 - Robust/src/Runtime/math.c | 63 - Robust/src/Runtime/mem.c | 58 - Robust/src/Runtime/mem.h | 36 - Robust/src/Runtime/multicoreruntime.c | 245 - Robust/src/Runtime/multicoretask.c | 3443 ------------- Robust/src/Runtime/object.c | 85 - Robust/src/Runtime/object.h | 11 - Robust/src/Runtime/option.c | 80 - Robust/src/Runtime/option.h | 4 - Robust/src/Runtime/raw_dataCache.s | 40 - Robust/src/Runtime/raw_interrupt.s | 121 - Robust/src/Runtime/raw_interrupt2.s | 122 - Robust/src/Runtime/raw_interrupt4.s | 122 - Robust/src/Runtime/runtime.c | 252 - Robust/src/Runtime/runtime.h | 189 - Robust/src/Runtime/signal.c | 27 - Robust/src/Runtime/socket.c | 430 -- Robust/src/Runtime/task.c | 1667 ------- Robust/src/Runtime/thread.c | 302 -- Robust/src/Runtime/thread.h | 27 - Robust/src/TODO | 2 - Robust/src/Tests/Array.java | 12 - Robust/src/Tests/Array2.java | 19 - Robust/src/Tests/Atomic.java | 15 - Robust/src/Tests/Atomic2.java | 36 - Robust/src/Tests/Atomic3.java | 76 - Robust/src/Tests/Atomic4.java | 92 - Robust/src/Tests/Atomic5.java | 102 - Robust/src/Tests/BoundsFail.java | 7 - Robust/src/Tests/BoundsFail2.java | 7 - Robust/src/Tests/BoundsFail3.java | 7 - Robust/src/Tests/BoundsFail4.java | 7 - Robust/src/Tests/CallGraph/makefile | 26 - Robust/src/Tests/CallGraph/reduceDotFile | 24 - Robust/src/Tests/CallGraph/testCallGraph.java | 44 - Robust/src/Tests/CommandLineTest.java | 8 - Robust/src/Tests/DoTests | 18 - Robust/src/Tests/FileLength.java | 10 - Robust/src/Tests/IncTest.java | 28 - Robust/src/Tests/IntegerTest.java | 11 - .../TestRuntime/TestRuntime1/Object.java | 37 - .../TestRuntime/TestRuntime1/Willy.java | 59 - .../TestRuntime/TestRuntime2/Important | 1 - .../TestRuntime/TestRuntime2/Object.java | 37 - .../TestRuntime/TestRuntime2/Willy.java | 72 - .../TestRuntime/TestRuntime3/Object.java | 37 - .../TestRuntime/TestRuntime3/Willy.java | 74 - .../TestStaticAnalysis/Test1/Object.java | 26 - .../TestStaticAnalysis/Test1/Willy.java | 54 - .../TestStaticAnalysis/Test10/Object.java | 26 - .../TestStaticAnalysis/Test10/Willy.java | 58 - .../TestStaticAnalysis/Test11/Object.java | 26 - .../TestStaticAnalysis/Test11/Willy.java | 60 - .../TestStaticAnalysis/Test12/Object.java | 26 - .../TestStaticAnalysis/Test12/Willy.java | 57 - .../TestStaticAnalysis/Test2/Object.java | 26 - .../TestStaticAnalysis/Test2/Willy.java | 54 - .../TestStaticAnalysis/Test3/Object.java | 26 - .../TestStaticAnalysis/Test3/Willy.java | 56 - .../TestStaticAnalysis/Test4/Object.java | 26 - .../TestStaticAnalysis/Test4/Willy.java | 57 - .../TestStaticAnalysis/Test5/Object.java | 26 - .../TestStaticAnalysis/Test5/Willy.java | 57 - .../TestStaticAnalysis/Test6/Object.java | 26 - .../TestStaticAnalysis/Test6/Willy.java | 57 - .../TestStaticAnalysis/Test7/Object.java | 26 - .../TestStaticAnalysis/Test7/Willy.java | 57 - .../TestStaticAnalysis/Test8/Object.java | 26 - .../TestStaticAnalysis/Test8/Willy.java | 58 - .../TestStaticAnalysis/Test9/Object.java | 26 - .../TestStaticAnalysis/Test9/Willy.java | 58 - .../TestMultiple/Object.java | 26 - .../TestMultiple/Object2.java | 26 - .../TestMultiple/Willy.java | 29 - .../TestStaticAnalysis/TestTag/Object.java | 26 - .../TestStaticAnalysis/TestTag/Willy.java | 56 - Robust/src/Tests/OwnershipAnalysisTest/README | 20 - .../OwnershipAnalysisTest/test01/makefile | 60 - .../OwnershipAnalysisTest/test01/test01.java | 284 -- .../OwnershipAnalysisTest/test02/makefile | 38 - .../OwnershipAnalysisTest/test02/test02.java | 175 - .../OwnershipAnalysisTest/test03/makefile | 57 - .../OwnershipAnalysisTest/test03/test03.java | 50 - .../testGraphs/Main.java | 107 - .../OwnershipAnalysisTest/testGraphs/makefile | 11 - .../testTokens/Main.java | 318 -- .../OwnershipAnalysisTest/testTokens/makefile | 11 - Robust/src/Tests/Prefetch/ArrayTest.java | 38 - Robust/src/Tests/Prefetch/FieldPointer.java | 46 - Robust/src/Tests/Prefetch/QuickSort.java | 83 - Robust/src/Tests/ReadFile.java | 12 - Robust/src/Tests/ServerExample.java | 27 - Robust/src/Tests/StringBufferTest.java | 8 - Robust/src/Tests/StringTest.java | 13 - Robust/src/Tests/TagTest/Object.java | 26 - Robust/src/Tests/TagTest/Willy.java | 56 - Robust/src/Tests/TaskExample.java | 49 - Robust/src/Tests/Test.java | 20 - Robust/src/Tests/ThreadTest.java | 31 - Robust/src/Tests/ThreadTest2.java | 29 - Robust/src/Tests/WriteFile.java | 10 - Robust/src/Tests/dotest | 11 - Robust/src/Tests/output/Array.output.goal | 2 - Robust/src/Tests/output/Array2.output.goal | 10 - .../src/Tests/output/BoundsFail.output.goal | 1 - .../src/Tests/output/BoundsFail2.output.goal | 1 - .../src/Tests/output/BoundsFail3.output.goal | 1 - .../src/Tests/output/BoundsFail4.output.goal | 1 - .../Tests/output/CommandLineTest.output.goal | 2 - .../src/Tests/output/FileLength.output.goal | 1 - Robust/src/Tests/output/IncTest.output.goal | 41 - .../src/Tests/output/IntegerTest.output.goal | 2 - Robust/src/Tests/output/ReadFile.output.goal | 1 - .../Tests/output/StringBufferTest.output.goal | 1 - .../src/Tests/output/StringTest.output.goal | 5 - Robust/src/Tests/output/Test.output.goal | 1228 ----- Robust/src/Tests/output/WriteFile.output.goal | 0 .../Tests/output/virtualcalltest.output.goal | 0 Robust/src/Tests/remotethreadtest.java | 22 - Robust/src/Tests/virtualcalltest.java | 47 - Robust/src/Util/Edge.java | 72 - Robust/src/Util/GraphNode.java | 541 -- Robust/src/Util/Namer.java | 21 - Robust/src/Util/Relation.java | 45 - Robust/src/buildscript | 406 -- Robust/src/buildscripttask | 4 - Robust/src/buildscripttaskerror | 3 - Robust/src/designnotes | 118 - Robust/src/docs/schedulerdesign | 32 - Robust/src/docs/tagimplementation | 20 - 859 files changed, 115726 deletions(-) delete mode 100644 CVSROOT/checkoutlist delete mode 100644 CVSROOT/commitinfo delete mode 100644 CVSROOT/config delete mode 100755 CVSROOT/cvslog delete mode 100755 CVSROOT/cvsprep delete mode 100644 CVSROOT/cvswrappers delete mode 100644 CVSROOT/loginfo delete mode 100644 CVSROOT/modules delete mode 100644 CVSROOT/notify delete mode 100644 CVSROOT/rcsinfo delete mode 100644 CVSROOT/taginfo delete mode 100644 CVSROOT/verifymsg delete mode 100644 Robust/JavaGrammar/COPYING delete mode 100644 Robust/JavaGrammar/Lex/BooleanLiteral.java delete mode 100644 Robust/JavaGrammar/Lex/CharacterLiteral.java delete mode 100644 Robust/JavaGrammar/Lex/Comment.java delete mode 100644 Robust/JavaGrammar/Lex/DocumentationComment.java delete mode 100644 Robust/JavaGrammar/Lex/DoubleLiteral.java delete mode 100644 Robust/JavaGrammar/Lex/EOF.java delete mode 100644 Robust/JavaGrammar/Lex/EndOfLineComment.java delete mode 100644 Robust/JavaGrammar/Lex/EscapedUnicodeReader.java delete mode 100644 Robust/JavaGrammar/Lex/FIFO.java delete mode 100644 Robust/JavaGrammar/Lex/FloatLiteral.java delete mode 100644 Robust/JavaGrammar/Lex/Identifier.java delete mode 100644 Robust/JavaGrammar/Lex/InputElement.java delete mode 100644 Robust/JavaGrammar/Lex/IntegerLiteral.java delete mode 100644 Robust/JavaGrammar/Lex/Keyword.java delete mode 100644 Robust/JavaGrammar/Lex/Lexer.java delete mode 100644 Robust/JavaGrammar/Lex/Literal.java delete mode 100644 Robust/JavaGrammar/Lex/LongLiteral.java delete mode 100644 Robust/JavaGrammar/Lex/NullLiteral.java delete mode 100644 Robust/JavaGrammar/Lex/NumericLiteral.java delete mode 100644 Robust/JavaGrammar/Lex/Operator.java delete mode 100644 Robust/JavaGrammar/Lex/Separator.java delete mode 100644 Robust/JavaGrammar/Lex/StringLiteral.java delete mode 100644 Robust/JavaGrammar/Lex/Token.java delete mode 100644 Robust/JavaGrammar/Lex/TraditionalComment.java delete mode 100644 Robust/JavaGrammar/Lex/WhiteSpace.java delete mode 100644 Robust/JavaGrammar/Main/Main.java delete mode 100644 Robust/JavaGrammar/Makefile delete mode 100644 Robust/JavaGrammar/Parse/Lexer.java delete mode 100644 Robust/JavaGrammar/Parse/java10.cup delete mode 100644 Robust/JavaGrammar/Parse/java11.cup delete mode 100644 Robust/JavaGrammar/Parse/java12.cup delete mode 100644 Robust/JavaGrammar/Parse/java14.cup delete mode 100644 Robust/JavaGrammar/Parse/java15.cup delete mode 100644 Robust/JavaGrammar/README delete mode 100644 Robust/JavaGrammar/tests/Eric.java delete mode 100644 Robust/JavaGrammar/tests/Eric15.java delete mode 100644 Robust/JavaGrammar/tests/Escape.java delete mode 100644 Robust/JavaGrammar/tests/Test15.java delete mode 100644 Robust/JavaGrammar/tests/TestJSR201.java delete mode 100644 Robust/cup/CHANGELOG delete mode 100755 Robust/cup/INSTALL delete mode 100644 Robust/cup/INSTALL.QUICK delete mode 100644 Robust/cup/LICENSE delete mode 100644 Robust/cup/README delete mode 100644 Robust/cup/cup_logo.gif delete mode 100644 Robust/cup/gnuwin/README delete mode 100644 Robust/cup/gnuwin/makefile delete mode 100644 Robust/cup/java_cup/CUP$parser$actions.class delete mode 100644 Robust/cup/java_cup/Main.class delete mode 100644 Robust/cup/java_cup/Main.java delete mode 100644 Robust/cup/java_cup/action_part.class delete mode 100644 Robust/cup/java_cup/action_part.java delete mode 100644 Robust/cup/java_cup/action_production.class delete mode 100644 Robust/cup/java_cup/action_production.java delete mode 100644 Robust/cup/java_cup/assoc.class delete mode 100644 Robust/cup/java_cup/assoc.java delete mode 100644 Robust/cup/java_cup/emit.class delete mode 100644 Robust/cup/java_cup/emit.java delete mode 100644 Robust/cup/java_cup/internal_error.class delete mode 100644 Robust/cup/java_cup/internal_error.java delete mode 100644 Robust/cup/java_cup/lalr_item.class delete mode 100644 Robust/cup/java_cup/lalr_item.java delete mode 100644 Robust/cup/java_cup/lalr_item_set.class delete mode 100644 Robust/cup/java_cup/lalr_item_set.java delete mode 100644 Robust/cup/java_cup/lalr_state.class delete mode 100644 Robust/cup/java_cup/lalr_state.java delete mode 100644 Robust/cup/java_cup/lalr_transition.class delete mode 100644 Robust/cup/java_cup/lalr_transition.java delete mode 100644 Robust/cup/java_cup/lexer.class delete mode 100644 Robust/cup/java_cup/lexer.java delete mode 100644 Robust/cup/java_cup/lr_item_core.class delete mode 100644 Robust/cup/java_cup/lr_item_core.java delete mode 100644 Robust/cup/java_cup/non_terminal.class delete mode 100644 Robust/cup/java_cup/non_terminal.java delete mode 100644 Robust/cup/java_cup/nonassoc_action.class delete mode 100644 Robust/cup/java_cup/nonassoc_action.java delete mode 100644 Robust/cup/java_cup/parse_action.class delete mode 100644 Robust/cup/java_cup/parse_action.java delete mode 100644 Robust/cup/java_cup/parse_action_row.class delete mode 100644 Robust/cup/java_cup/parse_action_row.java delete mode 100644 Robust/cup/java_cup/parse_action_table.class delete mode 100644 Robust/cup/java_cup/parse_action_table.java delete mode 100644 Robust/cup/java_cup/parse_reduce_row.class delete mode 100644 Robust/cup/java_cup/parse_reduce_row.java delete mode 100644 Robust/cup/java_cup/parse_reduce_table.class delete mode 100644 Robust/cup/java_cup/parse_reduce_table.java delete mode 100644 Robust/cup/java_cup/parser.class delete mode 100644 Robust/cup/java_cup/parser.cup delete mode 100644 Robust/cup/java_cup/parser.java delete mode 100644 Robust/cup/java_cup/production.class delete mode 100644 Robust/cup/java_cup/production.java delete mode 100644 Robust/cup/java_cup/production_part.class delete mode 100644 Robust/cup/java_cup/production_part.java delete mode 100644 Robust/cup/java_cup/reduce_action.class delete mode 100644 Robust/cup/java_cup/reduce_action.java delete mode 100644 Robust/cup/java_cup/runtime/Scanner.class delete mode 100644 Robust/cup/java_cup/runtime/Scanner.java delete mode 100644 Robust/cup/java_cup/runtime/Symbol.class delete mode 100644 Robust/cup/java_cup/runtime/Symbol.java delete mode 100644 Robust/cup/java_cup/runtime/lr_parser.class delete mode 100644 Robust/cup/java_cup/runtime/lr_parser.java delete mode 100644 Robust/cup/java_cup/runtime/virtual_parse_stack.class delete mode 100644 Robust/cup/java_cup/runtime/virtual_parse_stack.java delete mode 100644 Robust/cup/java_cup/shift_action.class delete mode 100644 Robust/cup/java_cup/shift_action.java delete mode 100644 Robust/cup/java_cup/simple_calc/CUP$parser$actions.class delete mode 100644 Robust/cup/java_cup/simple_calc/Main.class delete mode 100644 Robust/cup/java_cup/simple_calc/Main.java delete mode 100644 Robust/cup/java_cup/simple_calc/parser.class delete mode 100644 Robust/cup/java_cup/simple_calc/parser.cup delete mode 100644 Robust/cup/java_cup/simple_calc/parser.java delete mode 100644 Robust/cup/java_cup/simple_calc/scanner.class delete mode 100644 Robust/cup/java_cup/simple_calc/scanner.java delete mode 100644 Robust/cup/java_cup/simple_calc/sym.class delete mode 100644 Robust/cup/java_cup/simple_calc/sym.java delete mode 100644 Robust/cup/java_cup/sym.class delete mode 100644 Robust/cup/java_cup/sym.java delete mode 100644 Robust/cup/java_cup/symbol.class delete mode 100644 Robust/cup/java_cup/symbol.java delete mode 100644 Robust/cup/java_cup/symbol_part.class delete mode 100644 Robust/cup/java_cup/symbol_part.java delete mode 100644 Robust/cup/java_cup/symbol_set.class delete mode 100644 Robust/cup/java_cup/symbol_set.java delete mode 100644 Robust/cup/java_cup/terminal.class delete mode 100644 Robust/cup/java_cup/terminal.java delete mode 100644 Robust/cup/java_cup/terminal_set.class delete mode 100644 Robust/cup/java_cup/terminal_set.java delete mode 100644 Robust/cup/java_cup/version.class delete mode 100644 Robust/cup/java_cup/version.java delete mode 100644 Robust/cup/manual.html delete mode 100644 Robust/cup/winnt/README delete mode 100644 Robust/cup/winnt/makefile delete mode 100644 Robust/rolebasedcomputation delete mode 100644 Robust/src/Analysis/CallGraph/CallGraph.java delete mode 100644 Robust/src/Analysis/FlatIRGraph/FlatIRGraph.java delete mode 100644 Robust/src/Analysis/Locality/GenerateConversions.java delete mode 100644 Robust/src/Analysis/Locality/LocalityAnalysis.java delete mode 100644 Robust/src/Analysis/Locality/LocalityBinding.java delete mode 100644 Robust/src/Analysis/Locality/TempNodePair.java delete mode 100644 Robust/src/Analysis/Prefetch/IndexDescriptor.java delete mode 100644 Robust/src/Analysis/Prefetch/LoopExit.java delete mode 100644 Robust/src/Analysis/Prefetch/PairMap.java delete mode 100644 Robust/src/Analysis/Prefetch/PrefetchAnalysis.java delete mode 100644 Robust/src/Analysis/Prefetch/PrefetchPair.java delete mode 100644 Robust/src/Analysis/Scheduling/ClassNode.java delete mode 100644 Robust/src/Analysis/Scheduling/CombinationUtil.java delete mode 100644 Robust/src/Analysis/Scheduling/CoreSimulator.java delete mode 100644 Robust/src/Analysis/Scheduling/FIFORSchedule.java delete mode 100644 Robust/src/Analysis/Scheduling/ObjectInfo.java delete mode 100644 Robust/src/Analysis/Scheduling/ObjectSimulator.java delete mode 100644 Robust/src/Analysis/Scheduling/RuntimeSchedule.java delete mode 100644 Robust/src/Analysis/Scheduling/Schedule.java delete mode 100644 Robust/src/Analysis/Scheduling/ScheduleAnalysis.java delete mode 100644 Robust/src/Analysis/Scheduling/ScheduleEdge.java delete mode 100644 Robust/src/Analysis/Scheduling/ScheduleNode.java delete mode 100644 Robust/src/Analysis/Scheduling/ScheduleSimulator.java delete mode 100644 Robust/src/Analysis/Scheduling/SchedulingUtil.java delete mode 100644 Robust/src/Analysis/Scheduling/TaskSimulator.java delete mode 100644 Robust/src/Analysis/Scheduling/TransTaskSimulator.java delete mode 100644 Robust/src/Analysis/TaskStateAnalysis/Allocations.java delete mode 100644 Robust/src/Analysis/TaskStateAnalysis/EGEdge.java delete mode 100644 Robust/src/Analysis/TaskStateAnalysis/EGTaskNode.java delete mode 100644 Robust/src/Analysis/TaskStateAnalysis/ExecutionGraph.java delete mode 100644 Robust/src/Analysis/TaskStateAnalysis/FEdge.java delete mode 100644 Robust/src/Analysis/TaskStateAnalysis/FlagComparator.java delete mode 100644 Robust/src/Analysis/TaskStateAnalysis/FlagInfo.java delete mode 100644 Robust/src/Analysis/TaskStateAnalysis/FlagState.java delete mode 100644 Robust/src/Analysis/TaskStateAnalysis/FlagTagState.java delete mode 100644 Robust/src/Analysis/TaskStateAnalysis/GarbageAnalysis.java delete mode 100644 Robust/src/Analysis/TaskStateAnalysis/ObjWrapper.java delete mode 100644 Robust/src/Analysis/TaskStateAnalysis/OptionalTaskDescriptor.java delete mode 100644 Robust/src/Analysis/TaskStateAnalysis/Predicate.java delete mode 100644 Robust/src/Analysis/TaskStateAnalysis/SafetyAnalysis.java delete mode 100644 Robust/src/Analysis/TaskStateAnalysis/TEdge.java delete mode 100644 Robust/src/Analysis/TaskStateAnalysis/TagAnalysis.java delete mode 100644 Robust/src/Analysis/TaskStateAnalysis/TagBinding.java delete mode 100644 Robust/src/Analysis/TaskStateAnalysis/TagEdge.java delete mode 100644 Robust/src/Analysis/TaskStateAnalysis/TagState.java delete mode 100644 Robust/src/Analysis/TaskStateAnalysis/TagWrapper.java delete mode 100644 Robust/src/Analysis/TaskStateAnalysis/Task Analysis.pdf delete mode 100644 Robust/src/Analysis/TaskStateAnalysis/TaskAnalysis.java delete mode 100644 Robust/src/Analysis/TaskStateAnalysis/TaskAnalysisAlgorithm delete mode 100644 Robust/src/Analysis/TaskStateAnalysis/TaskBinding.java delete mode 100644 Robust/src/Analysis/TaskStateAnalysis/TaskEdges.java delete mode 100644 Robust/src/Analysis/TaskStateAnalysis/TaskGraph.java delete mode 100644 Robust/src/Analysis/TaskStateAnalysis/TaskIndex.java delete mode 100644 Robust/src/Analysis/TaskStateAnalysis/TaskNode.java delete mode 100644 Robust/src/Analysis/TaskStateAnalysis/TaskNodeNamer.java delete mode 100644 Robust/src/Analysis/TaskStateAnalysis/TaskQueue.java delete mode 100644 Robust/src/Analysis/TaskStateAnalysis/TaskQueueIterator.java delete mode 100644 Robust/src/Analysis/TaskStateAnalysis/TaskTagAnalysis.java delete mode 100644 Robust/src/Analysis/TaskStateAnalysis/Wrapper.java delete mode 100644 Robust/src/Benchmarks/BankApp/BankAccount.java delete mode 100644 Robust/src/Benchmarks/BankApp/BankApp.java delete mode 100644 Robust/src/Benchmarks/BankApp/BankAppRead.dat delete mode 100644 Robust/src/Benchmarks/BankApp/BankAppSocket.java delete mode 100644 Robust/src/Benchmarks/BankApp/BankAppWrite.dat delete mode 100644 Robust/src/Benchmarks/BankApp/BankDatabase.java delete mode 100644 Robust/src/Benchmarks/BankAppJava/BankAppClientTeller.java delete mode 100644 Robust/src/Benchmarks/BankAppJava/BankAppServer.java delete mode 100644 Robust/src/Benchmarks/BankAppJava/BankAppTestClient.java delete mode 100644 Robust/src/Benchmarks/BankAppJava/accts.txt delete mode 100644 Robust/src/Benchmarks/Chat/BRISTLECONE delete mode 100644 Robust/src/Benchmarks/Chat/ChatServer.java delete mode 100644 Robust/src/Benchmarks/Chat/ChatSocket.java delete mode 100644 Robust/src/Benchmarks/Chat/Message.java delete mode 100644 Robust/src/Benchmarks/Chat/NetsClient.java delete mode 100644 Robust/src/Benchmarks/Chat/Room.java delete mode 100644 Robust/src/Benchmarks/Chat/RoomObject.java delete mode 100644 Robust/src/Benchmarks/Chat/analyze.java delete mode 100755 Robust/src/Benchmarks/Chat/doall delete mode 100755 Robust/src/Benchmarks/Chat/runtest.sh delete mode 100644 Robust/src/Benchmarks/ChatJava/ChatServer.java delete mode 100644 Robust/src/Benchmarks/ChatJava/ChatThread.java delete mode 100644 Robust/src/Benchmarks/ChatJava/Room.java delete mode 100644 Robust/src/Benchmarks/ChatJava/RoomObject.java delete mode 100644 Robust/src/Benchmarks/ChatTag/ChatServer.java delete mode 100644 Robust/src/Benchmarks/ChatTag/ChatSocket.java delete mode 100644 Robust/src/Benchmarks/ChatTag/Message.java delete mode 100644 Robust/src/Benchmarks/ChatTag/Room.java delete mode 100644 Robust/src/Benchmarks/ChatTag/RoomObject.java delete mode 100644 Robust/src/Benchmarks/Conglomerator/Java/Google.java delete mode 100644 Robust/src/Benchmarks/Conglomerator/Java/Inventory.java delete mode 100644 Robust/src/Benchmarks/Conglomerator/Java/ItemInfo.java delete mode 100644 Robust/src/Benchmarks/Conglomerator/Java/Logger.java delete mode 100644 Robust/src/Benchmarks/Conglomerator/Java/Lookup.java delete mode 100644 Robust/src/Benchmarks/Conglomerator/Java/Stock.java delete mode 100644 Robust/src/Benchmarks/Conglomerator/Java/Weather.java delete mode 100644 Robust/src/Benchmarks/Conglomerator/Java/WebServerExample.java delete mode 100644 Robust/src/Benchmarks/Conglomerator/Java/WebServerSocket.java delete mode 100644 Robust/src/Benchmarks/Conglomerator/Tag/Google.java delete mode 100644 Robust/src/Benchmarks/Conglomerator/Tag/Inventory.java delete mode 100644 Robust/src/Benchmarks/Conglomerator/Tag/ItemInfo.java delete mode 100644 Robust/src/Benchmarks/Conglomerator/Tag/Logger.java delete mode 100644 Robust/src/Benchmarks/Conglomerator/Tag/Lookup.java delete mode 100644 Robust/src/Benchmarks/Conglomerator/Tag/MySocket.java delete mode 100644 Robust/src/Benchmarks/Conglomerator/Tag/Nrm/WebServerExample.java delete mode 100644 Robust/src/Benchmarks/Conglomerator/Tag/Opt/WebServerExampleOpt.java delete mode 100644 Robust/src/Benchmarks/Conglomerator/Tag/Stock.java delete mode 100644 Robust/src/Benchmarks/Conglomerator/Tag/Weather.java delete mode 100644 Robust/src/Benchmarks/Conglomerator/Tag/WebServerExampleBUGSTUDY.java delete mode 100644 Robust/src/Benchmarks/Conglomerator/Tag/WebServerSocket.java delete mode 100755 Robust/src/Benchmarks/Jhttpp2/BR/Jhttpp2ClientInputStream.java delete mode 100644 Robust/src/Benchmarks/Jhttpp2/BR/Jhttpp2HTTPSession.java delete mode 100755 Robust/src/Benchmarks/Jhttpp2/BR/Jhttpp2Server.java delete mode 100644 Robust/src/Benchmarks/Jhttpp2/BR/Jhttpp2Task.java delete mode 100755 Robust/src/Benchmarks/Jhttpp2/BR/Jhttpp2URLMatch.java delete mode 100644 Robust/src/Benchmarks/Jhttpp2/BR/MySocket.java delete mode 100755 Robust/src/Benchmarks/Jhttpp2/BR/OnURLAction.java delete mode 100644 Robust/src/Benchmarks/Jhttpp2/BR/Request.java delete mode 100755 Robust/src/Benchmarks/Jhttpp2/BR/WildcardDictionary.java delete mode 100755 Robust/src/Benchmarks/Jhttpp2/Java/Jhttpp2ClientInputStream.java delete mode 100644 Robust/src/Benchmarks/Jhttpp2/Java/Jhttpp2HTTPSession.java delete mode 100755 Robust/src/Benchmarks/Jhttpp2/Java/Jhttpp2Launcher.java delete mode 100755 Robust/src/Benchmarks/Jhttpp2/Java/Jhttpp2Read.java delete mode 100755 Robust/src/Benchmarks/Jhttpp2/Java/Jhttpp2Server.java delete mode 100755 Robust/src/Benchmarks/Jhttpp2/Java/Jhttpp2URLMatch.java delete mode 100755 Robust/src/Benchmarks/Jhttpp2/Java/OnURLAction.java delete mode 100755 Robust/src/Benchmarks/Jhttpp2/Java/WildcardDictionary.java delete mode 100644 Robust/src/Benchmarks/MapReduce/Java/Configuration.java delete mode 100644 Robust/src/Benchmarks/MapReduce/Java/Configured.java delete mode 100644 Robust/src/Benchmarks/MapReduce/Java/JobClient.java delete mode 100644 Robust/src/Benchmarks/MapReduce/Java/MapReduceBase.java delete mode 100644 Robust/src/Benchmarks/MapReduce/Java/MapWorker.java delete mode 100644 Robust/src/Benchmarks/MapReduce/Java/Master.java delete mode 100644 Robust/src/Benchmarks/MapReduce/Java/OutputCollector.java delete mode 100644 Robust/src/Benchmarks/MapReduce/Java/ReduceWorker.java delete mode 100644 Robust/src/Benchmarks/MapReduce/Java/Splitter.java delete mode 100644 Robust/src/Benchmarks/MapReduce/Java/Tool.java delete mode 100644 Robust/src/Benchmarks/MapReduce/Java/ToolRunner.java delete mode 100644 Robust/src/Benchmarks/MapReduce/Java/WordCounter.java delete mode 100644 Robust/src/Benchmarks/MapReduce/Nor/MapReduce.java delete mode 100644 Robust/src/Benchmarks/MapReduce/Nor/MapReduceBase.java delete mode 100644 Robust/src/Benchmarks/MapReduce/Nor/MapWorker.java delete mode 100644 Robust/src/Benchmarks/MapReduce/Nor/Master.java delete mode 100644 Robust/src/Benchmarks/MapReduce/Nor/OutputCollector.java delete mode 100644 Robust/src/Benchmarks/MapReduce/Nor/ReduceWorker.java delete mode 100644 Robust/src/Benchmarks/MapReduce/Nor/Splitter.java delete mode 100644 Robust/src/Benchmarks/MapReduce/Tag/MapReduce.java delete mode 100644 Robust/src/Benchmarks/MapReduce/Tag/MapReduceBase.java delete mode 100644 Robust/src/Benchmarks/MapReduce/Tag/MapWorker.java delete mode 100644 Robust/src/Benchmarks/MapReduce/Tag/Master.java delete mode 100644 Robust/src/Benchmarks/MapReduce/Tag/OutputCollector.java delete mode 100644 Robust/src/Benchmarks/MapReduce/Tag/ReduceWorker.java delete mode 100644 Robust/src/Benchmarks/MapReduce/Tag/Splitter.java delete mode 100644 Robust/src/Benchmarks/PERT/Java/Estimator.java delete mode 100644 Robust/src/Benchmarks/PERT/Java/PERT.java delete mode 100644 Robust/src/Benchmarks/PERT/Java/Stage.java delete mode 100644 Robust/src/Benchmarks/PERT/Tag/Estimator.java delete mode 100644 Robust/src/Benchmarks/PERT/Tag/PERT.java delete mode 100644 Robust/src/Benchmarks/PERT/Tag/Stage.java delete mode 100644 Robust/src/Benchmarks/Prefetch/Array/Array.java delete mode 100644 Robust/src/Benchmarks/Prefetch/Array/makefile delete mode 100644 Robust/src/Benchmarks/Prefetch/Chase/Chase.java delete mode 100644 Robust/src/Benchmarks/Prefetch/Chase/makefile delete mode 100644 Robust/src/Benchmarks/Prefetch/Crypt/dsm/JGFCryptBenchSizeA.java delete mode 100644 Robust/src/Benchmarks/Prefetch/Crypt/dsm/crypt/IDEATest.java delete mode 100644 Robust/src/Benchmarks/Prefetch/Crypt/dsm/crypt/JGFCryptBench.java delete mode 100644 Robust/src/Benchmarks/Prefetch/Crypt/dsm/jgfutil/JGFInstrumentor.java delete mode 100644 Robust/src/Benchmarks/Prefetch/Crypt/dsm/jgfutil/JGFTimer.java delete mode 100644 Robust/src/Benchmarks/Prefetch/Crypt/dsm/makefile delete mode 100644 Robust/src/Benchmarks/Prefetch/Crypt/java/JGFCryptBench.java delete mode 100644 Robust/src/Benchmarks/Prefetch/Crypt/java/JGFCryptBenchSizeA.java delete mode 100644 Robust/src/Benchmarks/Prefetch/Crypt/java/JGFInstrumentor.java delete mode 100644 Robust/src/Benchmarks/Prefetch/Crypt/java/JGFTimer.java delete mode 100644 Robust/src/Benchmarks/Prefetch/Crypt/java/makefile delete mode 100644 Robust/src/Benchmarks/Prefetch/Em3d/dsm/Barrier.java delete mode 100644 Robust/src/Benchmarks/Prefetch/Em3d/dsm/BiGraph.java delete mode 100644 Robust/src/Benchmarks/Prefetch/Em3d/dsm/BiGraph2.java delete mode 100644 Robust/src/Benchmarks/Prefetch/Em3d/dsm/BiGraphN.java delete mode 100644 Robust/src/Benchmarks/Prefetch/Em3d/dsm/BiGraphNold.java delete mode 100644 Robust/src/Benchmarks/Prefetch/Em3d/dsm/EVector.java delete mode 100644 Robust/src/Benchmarks/Prefetch/Em3d/dsm/Em3d.java delete mode 100644 Robust/src/Benchmarks/Prefetch/Em3d/dsm/Em3d2.java delete mode 100644 Robust/src/Benchmarks/Prefetch/Em3d/dsm/Em3dN.java delete mode 100644 Robust/src/Benchmarks/Prefetch/Em3d/dsm/Em3dNold.java delete mode 100644 Robust/src/Benchmarks/Prefetch/Em3d/dsm/Em3dWrap.java delete mode 100644 Robust/src/Benchmarks/Prefetch/Em3d/dsm/Node.java delete mode 100644 Robust/src/Benchmarks/Prefetch/Em3d/dsm/Node2.java delete mode 100644 Robust/src/Benchmarks/Prefetch/Em3d/dsm/README delete mode 100644 Robust/src/Benchmarks/Prefetch/Em3d/dsm/makefile delete mode 100644 Robust/src/Benchmarks/Prefetch/Em3d/java/Barrier.java delete mode 100644 Robust/src/Benchmarks/Prefetch/Em3d/java/BiGraph.java delete mode 100644 Robust/src/Benchmarks/Prefetch/Em3d/java/Em3d.java delete mode 100644 Robust/src/Benchmarks/Prefetch/Em3d/java/Node.java delete mode 100644 Robust/src/Benchmarks/Prefetch/Em3d/java/makefile delete mode 100644 Robust/src/Benchmarks/Prefetch/LUFact/dsm/Barrier.java delete mode 100644 Robust/src/Benchmarks/Prefetch/LUFact/dsm/JGFInstrumentor.java delete mode 100644 Robust/src/Benchmarks/Prefetch/LUFact/dsm/JGFLUFactBench.java delete mode 100644 Robust/src/Benchmarks/Prefetch/LUFact/dsm/JGFLUFactBenchSizeA.java delete mode 100644 Robust/src/Benchmarks/Prefetch/LUFact/dsm/JGFTimer.java delete mode 100644 Robust/src/Benchmarks/Prefetch/LUFact/dsm/Linpack.java delete mode 100644 Robust/src/Benchmarks/Prefetch/LUFact/dsm/LinpackRunner.java delete mode 100755 Robust/src/Benchmarks/Prefetch/LUFact/dsm/TournamentBarrier.java delete mode 100644 Robust/src/Benchmarks/Prefetch/LUFact/dsm/makefile delete mode 100644 Robust/src/Benchmarks/Prefetch/LUFact/java/JGFInstrumentor.java delete mode 100644 Robust/src/Benchmarks/Prefetch/LUFact/java/JGFLUFactBench.java delete mode 100644 Robust/src/Benchmarks/Prefetch/LUFact/java/JGFLUFactBenchSizeA.java delete mode 100644 Robust/src/Benchmarks/Prefetch/LUFact/java/JGFTimer.java delete mode 100644 Robust/src/Benchmarks/Prefetch/LUFact/java/Linpack.java delete mode 100644 Robust/src/Benchmarks/Prefetch/LUFact/java/LinpackRunner.java delete mode 100755 Robust/src/Benchmarks/Prefetch/LUFact/java/TournamentBarrier.java delete mode 100644 Robust/src/Benchmarks/Prefetch/LUFact/java/makefile delete mode 100644 Robust/src/Benchmarks/Prefetch/MatrixMultiply/MatrixMultiply.java delete mode 100644 Robust/src/Benchmarks/Prefetch/MatrixMultiply/MatrixMultiplyN.java delete mode 100644 Robust/src/Benchmarks/Prefetch/MatrixMultiply/MatrixMultiplyNrun.java delete mode 100644 Robust/src/Benchmarks/Prefetch/MatrixMultiply/java/MatrixMultiply.java delete mode 100644 Robust/src/Benchmarks/Prefetch/MatrixMultiply/java/makefile delete mode 100644 Robust/src/Benchmarks/Prefetch/MatrixMultiply/makefile delete mode 100644 Robust/src/Benchmarks/Prefetch/Moldyn/dsm/Barrier.java delete mode 100644 Robust/src/Benchmarks/Prefetch/Moldyn/dsm/DebugBarrier.java delete mode 100644 Robust/src/Benchmarks/Prefetch/Moldyn/dsm/JGFInstrumentor.java delete mode 100644 Robust/src/Benchmarks/Prefetch/Moldyn/dsm/JGFMolDynBench.java delete mode 100644 Robust/src/Benchmarks/Prefetch/Moldyn/dsm/JGFMolDynBenchSizeA.java delete mode 100644 Robust/src/Benchmarks/Prefetch/Moldyn/dsm/JGFTimer.java delete mode 100755 Robust/src/Benchmarks/Prefetch/Moldyn/dsm/TournamentBarrier.java delete mode 100644 Robust/src/Benchmarks/Prefetch/Moldyn/dsm/makefile delete mode 100644 Robust/src/Benchmarks/Prefetch/Moldyn/java/Barrier.java delete mode 100644 Robust/src/Benchmarks/Prefetch/Moldyn/java/JGFInstrumentor.java delete mode 100644 Robust/src/Benchmarks/Prefetch/Moldyn/java/JGFMolDynBench.java delete mode 100644 Robust/src/Benchmarks/Prefetch/Moldyn/java/JGFMolDynBenchSizeA.java delete mode 100644 Robust/src/Benchmarks/Prefetch/Moldyn/java/JGFTimer.java delete mode 100755 Robust/src/Benchmarks/Prefetch/Moldyn/java/TournamentBarrier.java delete mode 100644 Robust/src/Benchmarks/Prefetch/Moldyn/java/makefile delete mode 100644 Robust/src/Benchmarks/Prefetch/SOR/dsm/JGFInstrumentor.java delete mode 100644 Robust/src/Benchmarks/Prefetch/SOR/dsm/JGFSORBench.java delete mode 100644 Robust/src/Benchmarks/Prefetch/SOR/dsm/JGFSORBenchSizeA.java delete mode 100644 Robust/src/Benchmarks/Prefetch/SOR/dsm/JGFSORBenchSizeB.java delete mode 100644 Robust/src/Benchmarks/Prefetch/SOR/dsm/JGFSORBenchSizeC.java delete mode 100644 Robust/src/Benchmarks/Prefetch/SOR/dsm/JGFTimer.java delete mode 100644 Robust/src/Benchmarks/Prefetch/SOR/dsm/SORRunner.java delete mode 100644 Robust/src/Benchmarks/Prefetch/SOR/dsm/SORRunner2.java delete mode 100644 Robust/src/Benchmarks/Prefetch/SOR/dsm/SORWrap.java delete mode 100644 Robust/src/Benchmarks/Prefetch/SOR/dsm/makefile delete mode 100644 Robust/src/Benchmarks/Prefetch/SOR/java/JGFInstrumentor.java delete mode 100644 Robust/src/Benchmarks/Prefetch/SOR/java/JGFSORBench.java delete mode 100644 Robust/src/Benchmarks/Prefetch/SOR/java/JGFSORBenchSizeA.java delete mode 100644 Robust/src/Benchmarks/Prefetch/SOR/java/JGFSORBenchSizeB.java delete mode 100644 Robust/src/Benchmarks/Prefetch/SOR/java/JGFSORBenchSizeC.java delete mode 100644 Robust/src/Benchmarks/Prefetch/SOR/java/JGFTimer.java delete mode 100644 Robust/src/Benchmarks/Prefetch/SOR/java/SORRunner.java delete mode 100644 Robust/src/Benchmarks/Prefetch/SOR/java/makefile delete mode 100755 Robust/src/Benchmarks/Prefetch/avg.sh delete mode 100644 Robust/src/Benchmarks/Prefetch/bm.txt delete mode 100755 Robust/src/Benchmarks/Prefetch/run.sh delete mode 100644 Robust/src/Benchmarks/Scheduling/JGFSeries/JGFSeriesBench.java delete mode 100644 Robust/src/Benchmarks/Scheduling/JGFSeries/SeriesRunner.java delete mode 100644 Robust/src/Benchmarks/Scheduling/JGFSeries/c/JGFSeriesBench.c delete mode 100644 Robust/src/Benchmarks/Scheduling/JGFSeries/c/Makefile delete mode 100644 Robust/src/Benchmarks/Scheduling/MapReduce/MapReduce.java delete mode 100644 Robust/src/Benchmarks/Scheduling/MapReduce/MapReduceBase.java delete mode 100644 Robust/src/Benchmarks/Scheduling/MapReduce/MapWorker.java delete mode 100644 Robust/src/Benchmarks/Scheduling/MapReduce/Master.java delete mode 100644 Robust/src/Benchmarks/Scheduling/MapReduce/OutputCollector.java delete mode 100644 Robust/src/Benchmarks/Scheduling/MapReduce/ReduceWorker.java delete mode 100644 Robust/src/Benchmarks/Scheduling/MapReduce/Splitter.java delete mode 100644 Robust/src/Benchmarks/Spider/BR/Query.java delete mode 100644 Robust/src/Benchmarks/Spider/BR/QueryList.java delete mode 100644 Robust/src/Benchmarks/Spider/BR/Spider.java delete mode 100644 Robust/src/Benchmarks/Spider/BRTag/Query.java delete mode 100644 Robust/src/Benchmarks/Spider/BRTag/QueryList.java delete mode 100644 Robust/src/Benchmarks/Spider/BRTag/Spider.java delete mode 100644 Robust/src/Benchmarks/Spider/Java/Query.java delete mode 100644 Robust/src/Benchmarks/Spider/Java/QueryList.java delete mode 100644 Robust/src/Benchmarks/Spider/Java/QueryQueue.java delete mode 100644 Robust/src/Benchmarks/Spider/Java/QueryThread.java delete mode 100644 Robust/src/Benchmarks/Spider/Java/Spider.java delete mode 100755 Robust/src/Benchmarks/Spider/dotest delete mode 100644 Robust/src/Benchmarks/Spider/tests/generate.java delete mode 100755 Robust/src/Benchmarks/Spider/testscript delete mode 100644 Robust/src/Benchmarks/TTT/Board.java delete mode 100644 Robust/src/Benchmarks/TTT/TTTServer.java delete mode 100644 Robust/src/Benchmarks/TTT/TTTServerSocket.java delete mode 100644 Robust/src/Benchmarks/TTTJava/TTTServer.java delete mode 100644 Robust/src/Benchmarks/TTTTag/Board.java delete mode 100644 Robust/src/Benchmarks/TTTTag/TTTServer.java delete mode 100644 Robust/src/Benchmarks/TTTTag/TTTServerSocket.java delete mode 100644 Robust/src/Benchmarks/TileSearch/Java/SubProblem.java delete mode 100644 Robust/src/Benchmarks/TileSearch/Java/Tile.java delete mode 100644 Robust/src/Benchmarks/TileSearch/Java/TileGrid.java delete mode 100644 Robust/src/Benchmarks/TileSearch/Java/TileSearch.java delete mode 100644 Robust/src/Benchmarks/TileSearch/Tag/GlobalCounter.java delete mode 100644 Robust/src/Benchmarks/TileSearch/Tag/SubProblem.java delete mode 100644 Robust/src/Benchmarks/TileSearch/Tag/Tile.java delete mode 100644 Robust/src/Benchmarks/TileSearch/Tag/TileSearch.java delete mode 100644 Robust/src/Benchmarks/WebServer/Inventory.java delete mode 100644 Robust/src/Benchmarks/WebServer/ItemInfo.java delete mode 100644 Robust/src/Benchmarks/WebServer/Logger.java delete mode 100644 Robust/src/Benchmarks/WebServer/WebServerExample.java delete mode 100644 Robust/src/Benchmarks/WebServer/WebServerSocket.java delete mode 100755 Robust/src/Benchmarks/WebServer/Workload/batch/difference.sh delete mode 100644 Robust/src/Benchmarks/WebServer/Workload/batch/pure/trans_inventory.sorted delete mode 100644 Robust/src/Benchmarks/WebServer/Workload/batch/run.sh delete mode 100755 Robust/src/Benchmarks/WebServer/Workload/batch/run2.sh delete mode 100644 Robust/src/Benchmarks/WebServer/Workload/generate.java delete mode 100755 Robust/src/Benchmarks/WebServer/Workload/workload delete mode 100755 Robust/src/Benchmarks/WebServer/Workload/workloaderror delete mode 100755 Robust/src/Benchmarks/WebServer/Workload/workloadfile1000 delete mode 100755 Robust/src/Benchmarks/WebServer/Workload/workloadmix1000 delete mode 100755 Robust/src/Benchmarks/WebServer/Workload/workloadtrans delete mode 100755 Robust/src/Benchmarks/WebServer/Workload/workloadtrans1000 delete mode 100755 Robust/src/Benchmarks/WebServer/compileserver delete mode 100644 Robust/src/Benchmarks/WebServer/htmlfiles/index1.html delete mode 100644 Robust/src/Benchmarks/WebServer/htmlfiles/index2.html delete mode 100755 Robust/src/Benchmarks/WebServer/htmlfiles/request.log delete mode 100644 Robust/src/Benchmarks/WebServerJ/Inventory.java delete mode 100644 Robust/src/Benchmarks/WebServerJ/ItemInfo.java delete mode 100644 Robust/src/Benchmarks/WebServerJ/Logger.java delete mode 100644 Robust/src/Benchmarks/WebServerJ/WebServerExample.java delete mode 100644 Robust/src/Benchmarks/WebServerJ/WebServerThread.java delete mode 100644 Robust/src/Benchmarks/WebServerJava/Inventory.java delete mode 100644 Robust/src/Benchmarks/WebServerJava/ItemInfo.java delete mode 100644 Robust/src/Benchmarks/WebServerJava/Logger.java delete mode 100644 Robust/src/Benchmarks/WebServerJava/WebServerExampleJava.java delete mode 100644 Robust/src/Benchmarks/WebServerJava/WebServerThread.java delete mode 100644 Robust/src/Benchmarks/WebServerTag/Inventory.java delete mode 100644 Robust/src/Benchmarks/WebServerTag/ItemInfo.java delete mode 100644 Robust/src/Benchmarks/WebServerTag/Logger.java delete mode 100644 Robust/src/Benchmarks/WebServerTag/WebServerExample.java delete mode 100644 Robust/src/Benchmarks/WebServerTag/WebServerSocket.java delete mode 100644 Robust/src/ClassLibrary/Barrier.java delete mode 100644 Robust/src/ClassLibrary/BufferedInputStream.java delete mode 100644 Robust/src/ClassLibrary/BufferedOutputStream.java delete mode 100644 Robust/src/ClassLibrary/BufferedWriter.java delete mode 100644 Robust/src/ClassLibrary/Character.java delete mode 100644 Robust/src/ClassLibrary/Date.java delete mode 100644 Robust/src/ClassLibrary/Dictionary.java delete mode 100644 Robust/src/ClassLibrary/Enumeration.java delete mode 100644 Robust/src/ClassLibrary/File.java delete mode 100644 Robust/src/ClassLibrary/FileInputStream.java delete mode 100644 Robust/src/ClassLibrary/FileOutputStream.java delete mode 100644 Robust/src/ClassLibrary/FileWriter.java delete mode 100644 Robust/src/ClassLibrary/HashEntry.java delete mode 100644 Robust/src/ClassLibrary/HashMap.java delete mode 100644 Robust/src/ClassLibrary/HashMapIterator.java delete mode 100644 Robust/src/ClassLibrary/HashSet.java delete mode 100644 Robust/src/ClassLibrary/InetAddress.java delete mode 100644 Robust/src/ClassLibrary/InputStream.java delete mode 100644 Robust/src/ClassLibrary/Integer.java delete mode 100644 Robust/src/ClassLibrary/Math.java delete mode 100644 Robust/src/ClassLibrary/Object.java delete mode 100644 Robust/src/ClassLibrary/ObjectJava.java delete mode 100644 Robust/src/ClassLibrary/ObjectJavaDSM.java delete mode 100644 Robust/src/ClassLibrary/ObjectJavaNT.java delete mode 100644 Robust/src/ClassLibrary/OutputStream.java delete mode 100644 Robust/src/ClassLibrary/OutputStreamWriter.java delete mode 100644 Robust/src/ClassLibrary/ServerSocket.java delete mode 100644 Robust/src/ClassLibrary/ServerSocketJava.java delete mode 100644 Robust/src/ClassLibrary/Signal.java delete mode 100644 Robust/src/ClassLibrary/Socket.java delete mode 100644 Robust/src/ClassLibrary/SocketInputStream.java delete mode 100644 Robust/src/ClassLibrary/SocketJava.java delete mode 100644 Robust/src/ClassLibrary/SocketOutputStream.java delete mode 100644 Robust/src/ClassLibrary/StartupObject.java delete mode 100644 Robust/src/ClassLibrary/String.java delete mode 100644 Robust/src/ClassLibrary/StringBuffer.java delete mode 100644 Robust/src/ClassLibrary/System.java delete mode 100644 Robust/src/ClassLibrary/TagDescriptor.java delete mode 100644 Robust/src/ClassLibrary/Thread.java delete mode 100644 Robust/src/ClassLibrary/ThreadDSM.java delete mode 100644 Robust/src/ClassLibrary/Vector.java delete mode 100644 Robust/src/ClassLibrary/Writer.java delete mode 100644 Robust/src/ClassLibrary/gnu/Random.java delete mode 100644 Robust/src/IR/AssignOperation.java delete mode 100644 Robust/src/IR/ClassDescriptor.java delete mode 100644 Robust/src/IR/Descriptor.java delete mode 100644 Robust/src/IR/FieldDescriptor.java delete mode 100644 Robust/src/IR/FlagDescriptor.java delete mode 100644 Robust/src/IR/Flat/BuildCode.java delete mode 100644 Robust/src/IR/Flat/BuildCodeMultiCore.java delete mode 100644 Robust/src/IR/Flat/BuildFlat.java delete mode 100644 Robust/src/IR/Flat/FKind.java delete mode 100644 Robust/src/IR/Flat/FlatAtomicEnterNode.java delete mode 100644 Robust/src/IR/Flat/FlatAtomicExitNode.java delete mode 100644 Robust/src/IR/Flat/FlatBackEdge.java delete mode 100644 Robust/src/IR/Flat/FlatCall.java delete mode 100644 Robust/src/IR/Flat/FlatCastNode.java delete mode 100644 Robust/src/IR/Flat/FlatCheckNode.java delete mode 100644 Robust/src/IR/Flat/FlatCondBranch.java delete mode 100644 Robust/src/IR/Flat/FlatElementNode.java delete mode 100644 Robust/src/IR/Flat/FlatFieldNode.java delete mode 100644 Robust/src/IR/Flat/FlatFlagActionNode.java delete mode 100644 Robust/src/IR/Flat/FlatGlobalConvNode.java delete mode 100644 Robust/src/IR/Flat/FlatLiteralNode.java delete mode 100644 Robust/src/IR/Flat/FlatMethod.java delete mode 100644 Robust/src/IR/Flat/FlatNew.java delete mode 100644 Robust/src/IR/Flat/FlatNode.java delete mode 100644 Robust/src/IR/Flat/FlatNop.java delete mode 100644 Robust/src/IR/Flat/FlatOpNode.java delete mode 100644 Robust/src/IR/Flat/FlatPrefetchNode.java delete mode 100644 Robust/src/IR/Flat/FlatReturnNode.java delete mode 100644 Robust/src/IR/Flat/FlatSetElementNode.java delete mode 100644 Robust/src/IR/Flat/FlatSetFieldNode.java delete mode 100644 Robust/src/IR/Flat/FlatTagDeclaration.java delete mode 100644 Robust/src/IR/Flat/NodePair.java delete mode 100644 Robust/src/IR/Flat/ParamsObject.java delete mode 100644 Robust/src/IR/Flat/TempDescriptor.java delete mode 100644 Robust/src/IR/Flat/TempFlagPair.java delete mode 100644 Robust/src/IR/Flat/TempObject.java delete mode 100644 Robust/src/IR/Flat/TempTagPair.java delete mode 100644 Robust/src/IR/MethodDescriptor.java delete mode 100644 Robust/src/IR/NameDescriptor.java delete mode 100644 Robust/src/IR/Operation.java delete mode 100644 Robust/src/IR/State.java delete mode 100644 Robust/src/IR/SymbolTable.java delete mode 100644 Robust/src/IR/TagDescriptor.java delete mode 100644 Robust/src/IR/TagVarDescriptor.java delete mode 100644 Robust/src/IR/TaskDescriptor.java delete mode 100644 Robust/src/IR/Tree/ArrayAccessNode.java delete mode 100644 Robust/src/IR/Tree/AssignmentNode.java delete mode 100644 Robust/src/IR/Tree/AtomicNode.java delete mode 100644 Robust/src/IR/Tree/BlockExpressionNode.java delete mode 100644 Robust/src/IR/Tree/BlockNode.java delete mode 100644 Robust/src/IR/Tree/BlockStatementNode.java delete mode 100644 Robust/src/IR/Tree/BuildIR.java delete mode 100644 Robust/src/IR/Tree/CastNode.java delete mode 100644 Robust/src/IR/Tree/ConstraintCheck.java delete mode 100644 Robust/src/IR/Tree/CreateObjectNode.java delete mode 100644 Robust/src/IR/Tree/DNFFlag.java delete mode 100644 Robust/src/IR/Tree/DNFFlagAtom.java delete mode 100644 Robust/src/IR/Tree/DeclarationNode.java delete mode 100644 Robust/src/IR/Tree/ExpressionNode.java delete mode 100644 Robust/src/IR/Tree/FieldAccessNode.java delete mode 100644 Robust/src/IR/Tree/FlagEffect.java delete mode 100644 Robust/src/IR/Tree/FlagEffects.java delete mode 100644 Robust/src/IR/Tree/FlagExpressionNode.java delete mode 100644 Robust/src/IR/Tree/FlagNode.java delete mode 100644 Robust/src/IR/Tree/FlagOpNode.java delete mode 100644 Robust/src/IR/Tree/IfStatementNode.java delete mode 100644 Robust/src/IR/Tree/Kind.java delete mode 100644 Robust/src/IR/Tree/LiteralNode.java delete mode 100644 Robust/src/IR/Tree/LoopNode.java delete mode 100644 Robust/src/IR/Tree/MethodInvokeNode.java delete mode 100644 Robust/src/IR/Tree/Modifiers.java delete mode 100644 Robust/src/IR/Tree/NameNode.java delete mode 100644 Robust/src/IR/Tree/OpNode.java delete mode 100644 Robust/src/IR/Tree/ParseNode.java delete mode 100644 Robust/src/IR/Tree/ParseNodeDOTVisitor.java delete mode 100644 Robust/src/IR/Tree/ParseNodeVector.java delete mode 100644 Robust/src/IR/Tree/ReturnNode.java delete mode 100644 Robust/src/IR/Tree/SemanticCheck.java delete mode 100644 Robust/src/IR/Tree/SubBlockNode.java delete mode 100644 Robust/src/IR/Tree/TagDeclarationNode.java delete mode 100644 Robust/src/IR/Tree/TagEffect.java delete mode 100644 Robust/src/IR/Tree/TagExpressionList.java delete mode 100644 Robust/src/IR/Tree/TaskExitNode.java delete mode 100644 Robust/src/IR/Tree/TreeNode.java delete mode 100644 Robust/src/IR/Tree/Walkable.java delete mode 100644 Robust/src/IR/TypeDescriptor.java delete mode 100644 Robust/src/IR/TypeUtil.java delete mode 100644 Robust/src/IR/VarDescriptor.java delete mode 100644 Robust/src/IR/Virtual.java delete mode 100644 Robust/src/Interface/HTTPHeader.java delete mode 100644 Robust/src/Interface/HTTPResponse.java delete mode 100644 Robust/src/Interface/HTTPServices.java delete mode 100644 Robust/src/Interface/HashStrings.java delete mode 100644 Robust/src/Interface/IdentityRelation.java delete mode 100644 Robust/src/Interface/Imap.java delete mode 100644 Robust/src/Interface/JhttpServer.java delete mode 100644 Robust/src/Interface/JhttpWorker.java delete mode 100644 Robust/src/Interface/LogFile.java delete mode 100644 Robust/src/Interface/WebInterface.java delete mode 100644 Robust/src/Lex/BooleanLiteral.java delete mode 100644 Robust/src/Lex/CharacterLiteral.java delete mode 100644 Robust/src/Lex/Comment.java delete mode 100644 Robust/src/Lex/DocumentationComment.java delete mode 100644 Robust/src/Lex/DoubleLiteral.java delete mode 100644 Robust/src/Lex/EOF.java delete mode 100644 Robust/src/Lex/EndOfLineComment.java delete mode 100644 Robust/src/Lex/EscapedUnicodeReader.java delete mode 100644 Robust/src/Lex/FIFO.java delete mode 100644 Robust/src/Lex/FloatLiteral.java delete mode 100644 Robust/src/Lex/Identifier.java delete mode 100644 Robust/src/Lex/InputElement.java delete mode 100644 Robust/src/Lex/IntegerLiteral.java delete mode 100644 Robust/src/Lex/Keyword.java delete mode 100644 Robust/src/Lex/Lexer.java delete mode 100644 Robust/src/Lex/Literal.java delete mode 100644 Robust/src/Lex/LongLiteral.java delete mode 100644 Robust/src/Lex/NullLiteral.java delete mode 100644 Robust/src/Lex/NumericLiteral.java delete mode 100644 Robust/src/Lex/Operator.java delete mode 100644 Robust/src/Lex/Separator.java delete mode 100644 Robust/src/Lex/StringLiteral.java delete mode 100644 Robust/src/Lex/Token.java delete mode 100644 Robust/src/Lex/TraditionalComment.java delete mode 100644 Robust/src/Lex/WhiteSpace.java delete mode 100644 Robust/src/Main/Main.java delete mode 100644 Robust/src/Makefile delete mode 100644 Robust/src/Makefile.raw.1 delete mode 100644 Robust/src/Makefile.raw.2 delete mode 100644 Robust/src/Makefile.raw.4 delete mode 100644 Robust/src/Makefile.raw.i.1 delete mode 100644 Robust/src/Makefile.raw.i.2 delete mode 100644 Robust/src/Makefile.raw.i.4 delete mode 100644 Robust/src/Parse/java14.cup delete mode 100644 Robust/src/README delete mode 100644 Robust/src/RepairTest/TaskExample.java delete mode 100755 Robust/src/RepairTest/specs/Example/Example.constraints delete mode 100644 Robust/src/RepairTest/specs/Example/Example.label delete mode 100755 Robust/src/RepairTest/specs/Example/Example.model delete mode 100755 Robust/src/RepairTest/specs/Example/Example.space delete mode 100755 Robust/src/RepairTest/specs/Example2/Example2.constraints delete mode 100644 Robust/src/RepairTest/specs/Example2/Example2.label delete mode 100755 Robust/src/RepairTest/specs/Example2/Example2.model delete mode 100755 Robust/src/RepairTest/specs/Example2/Example2.space delete mode 100644 Robust/src/Runtime/DSTM/docs/commitnotes delete mode 100644 Robust/src/Runtime/DSTM/docs/messages delete mode 100644 Robust/src/Runtime/DSTM/docs/prefetch delete mode 100644 Robust/src/Runtime/DSTM/docs/prefetchnotes delete mode 100644 Robust/src/Runtime/DSTM/docs/readme.txt delete mode 100644 Robust/src/Runtime/DSTM/interface/ISSUESTOADDRESS delete mode 100644 Robust/src/Runtime/DSTM/interface/Makefile delete mode 100644 Robust/src/Runtime/DSTM/interface/addPrefetchEnhance.c delete mode 100644 Robust/src/Runtime/DSTM/interface/addPrefetchEnhance.h delete mode 100644 Robust/src/Runtime/DSTM/interface/addUdpEnhance.c delete mode 100644 Robust/src/Runtime/DSTM/interface/addUdpEnhance.h delete mode 100644 Robust/src/Runtime/DSTM/interface/clookup.c delete mode 100644 Robust/src/Runtime/DSTM/interface/clookup.h delete mode 100644 Robust/src/Runtime/DSTM/interface/dht.c delete mode 100644 Robust/src/Runtime/DSTM/interface/dht.h delete mode 100644 Robust/src/Runtime/DSTM/interface/dsmdebug.h delete mode 100644 Robust/src/Runtime/DSTM/interface/dstm.c delete mode 100644 Robust/src/Runtime/DSTM/interface/dstm.h delete mode 100644 Robust/src/Runtime/DSTM/interface/dstmserver.c delete mode 100644 Robust/src/Runtime/DSTM/interface/gCollect.c delete mode 100644 Robust/src/Runtime/DSTM/interface/gCollect.h delete mode 100644 Robust/src/Runtime/DSTM/interface/ip.c delete mode 100644 Robust/src/Runtime/DSTM/interface/ip.h delete mode 100644 Robust/src/Runtime/DSTM/interface/llookup.c delete mode 100644 Robust/src/Runtime/DSTM/interface/llookup.h delete mode 100644 Robust/src/Runtime/DSTM/interface/localobjects.c delete mode 100644 Robust/src/Runtime/DSTM/interface/localobjects.h delete mode 100644 Robust/src/Runtime/DSTM/interface/machinepile.c delete mode 100644 Robust/src/Runtime/DSTM/interface/machinepile.h delete mode 100644 Robust/src/Runtime/DSTM/interface/main.c delete mode 100644 Robust/src/Runtime/DSTM/interface/mcpileq.c delete mode 100644 Robust/src/Runtime/DSTM/interface/mcpileq.h delete mode 100644 Robust/src/Runtime/DSTM/interface/mlookup.c delete mode 100644 Robust/src/Runtime/DSTM/interface/mlookup.h delete mode 100644 Robust/src/Runtime/DSTM/interface/objstr.c delete mode 100644 Robust/src/Runtime/DSTM/interface/plookup.c delete mode 100644 Robust/src/Runtime/DSTM/interface/plookup.h delete mode 100644 Robust/src/Runtime/DSTM/interface/prelookup.c delete mode 100644 Robust/src/Runtime/DSTM/interface/prelookup.h delete mode 100644 Robust/src/Runtime/DSTM/interface/queue.c delete mode 100644 Robust/src/Runtime/DSTM/interface/queue.h delete mode 100644 Robust/src/Runtime/DSTM/interface/signal.c delete mode 100644 Robust/src/Runtime/DSTM/interface/sockpool.c delete mode 100644 Robust/src/Runtime/DSTM/interface/sockpool.h delete mode 100644 Robust/src/Runtime/DSTM/interface/tests/testclient.c delete mode 100644 Robust/src/Runtime/DSTM/interface/tests/testclookup.c delete mode 100644 Robust/src/Runtime/DSTM/interface/tests/testd-3.c delete mode 100644 Robust/src/Runtime/DSTM/interface/tests/testd-4.c delete mode 100644 Robust/src/Runtime/DSTM/interface/tests/testdht.c delete mode 100644 Robust/src/Runtime/DSTM/interface/tests/testllookup.c delete mode 100644 Robust/src/Runtime/DSTM/interface/tests/testmlookup.c delete mode 100644 Robust/src/Runtime/DSTM/interface/tests/testobjstr.c delete mode 100644 Robust/src/Runtime/DSTM/interface/tests/testserver.c delete mode 100644 Robust/src/Runtime/DSTM/interface/threadnotify.c delete mode 100644 Robust/src/Runtime/DSTM/interface/threadnotify.h delete mode 100644 Robust/src/Runtime/DSTM/interface/trans.c delete mode 100755 Robust/src/Runtime/GenericHashtable.c delete mode 100755 Robust/src/Runtime/GenericHashtable.h delete mode 100755 Robust/src/Runtime/ObjectHash.c delete mode 100755 Robust/src/Runtime/ObjectHash.h delete mode 100644 Robust/src/Runtime/Queue.c delete mode 100644 Robust/src/Runtime/Queue.h delete mode 100755 Robust/src/Runtime/SimpleHash.c delete mode 100755 Robust/src/Runtime/SimpleHash.h delete mode 100644 Robust/src/Runtime/callconventions delete mode 100644 Robust/src/Runtime/checkpoint.c delete mode 100644 Robust/src/Runtime/checkpoint.h delete mode 100644 Robust/src/Runtime/file.c delete mode 100644 Robust/src/Runtime/garbage.c delete mode 100644 Robust/src/Runtime/garbage.h delete mode 100644 Robust/src/Runtime/math.c delete mode 100644 Robust/src/Runtime/mem.c delete mode 100644 Robust/src/Runtime/mem.h delete mode 100644 Robust/src/Runtime/multicoreruntime.c delete mode 100644 Robust/src/Runtime/multicoretask.c delete mode 100644 Robust/src/Runtime/object.c delete mode 100644 Robust/src/Runtime/object.h delete mode 100644 Robust/src/Runtime/option.c delete mode 100644 Robust/src/Runtime/option.h delete mode 100644 Robust/src/Runtime/raw_dataCache.s delete mode 100644 Robust/src/Runtime/raw_interrupt.s delete mode 100644 Robust/src/Runtime/raw_interrupt2.s delete mode 100644 Robust/src/Runtime/raw_interrupt4.s delete mode 100644 Robust/src/Runtime/runtime.c delete mode 100644 Robust/src/Runtime/runtime.h delete mode 100644 Robust/src/Runtime/signal.c delete mode 100644 Robust/src/Runtime/socket.c delete mode 100644 Robust/src/Runtime/task.c delete mode 100644 Robust/src/Runtime/thread.c delete mode 100644 Robust/src/Runtime/thread.h delete mode 100644 Robust/src/TODO delete mode 100644 Robust/src/Tests/Array.java delete mode 100644 Robust/src/Tests/Array2.java delete mode 100644 Robust/src/Tests/Atomic.java delete mode 100644 Robust/src/Tests/Atomic2.java delete mode 100644 Robust/src/Tests/Atomic3.java delete mode 100644 Robust/src/Tests/Atomic4.java delete mode 100644 Robust/src/Tests/Atomic5.java delete mode 100644 Robust/src/Tests/BoundsFail.java delete mode 100644 Robust/src/Tests/BoundsFail2.java delete mode 100644 Robust/src/Tests/BoundsFail3.java delete mode 100644 Robust/src/Tests/BoundsFail4.java delete mode 100644 Robust/src/Tests/CallGraph/makefile delete mode 100755 Robust/src/Tests/CallGraph/reduceDotFile delete mode 100644 Robust/src/Tests/CallGraph/testCallGraph.java delete mode 100644 Robust/src/Tests/CommandLineTest.java delete mode 100755 Robust/src/Tests/DoTests delete mode 100644 Robust/src/Tests/FileLength.java delete mode 100644 Robust/src/Tests/IncTest.java delete mode 100644 Robust/src/Tests/IntegerTest.java delete mode 100644 Robust/src/Tests/OptionalArgsTest/TestRuntime/TestRuntime1/Object.java delete mode 100644 Robust/src/Tests/OptionalArgsTest/TestRuntime/TestRuntime1/Willy.java delete mode 100644 Robust/src/Tests/OptionalArgsTest/TestRuntime/TestRuntime2/Important delete mode 100644 Robust/src/Tests/OptionalArgsTest/TestRuntime/TestRuntime2/Object.java delete mode 100644 Robust/src/Tests/OptionalArgsTest/TestRuntime/TestRuntime2/Willy.java delete mode 100644 Robust/src/Tests/OptionalArgsTest/TestRuntime/TestRuntime3/Object.java delete mode 100644 Robust/src/Tests/OptionalArgsTest/TestRuntime/TestRuntime3/Willy.java delete mode 100644 Robust/src/Tests/OptionalArgsTest/TestStaticAnalysis/Test1/Object.java delete mode 100644 Robust/src/Tests/OptionalArgsTest/TestStaticAnalysis/Test1/Willy.java delete mode 100644 Robust/src/Tests/OptionalArgsTest/TestStaticAnalysis/Test10/Object.java delete mode 100644 Robust/src/Tests/OptionalArgsTest/TestStaticAnalysis/Test10/Willy.java delete mode 100644 Robust/src/Tests/OptionalArgsTest/TestStaticAnalysis/Test11/Object.java delete mode 100644 Robust/src/Tests/OptionalArgsTest/TestStaticAnalysis/Test11/Willy.java delete mode 100644 Robust/src/Tests/OptionalArgsTest/TestStaticAnalysis/Test12/Object.java delete mode 100644 Robust/src/Tests/OptionalArgsTest/TestStaticAnalysis/Test12/Willy.java delete mode 100644 Robust/src/Tests/OptionalArgsTest/TestStaticAnalysis/Test2/Object.java delete mode 100644 Robust/src/Tests/OptionalArgsTest/TestStaticAnalysis/Test2/Willy.java delete mode 100644 Robust/src/Tests/OptionalArgsTest/TestStaticAnalysis/Test3/Object.java delete mode 100644 Robust/src/Tests/OptionalArgsTest/TestStaticAnalysis/Test3/Willy.java delete mode 100644 Robust/src/Tests/OptionalArgsTest/TestStaticAnalysis/Test4/Object.java delete mode 100644 Robust/src/Tests/OptionalArgsTest/TestStaticAnalysis/Test4/Willy.java delete mode 100644 Robust/src/Tests/OptionalArgsTest/TestStaticAnalysis/Test5/Object.java delete mode 100644 Robust/src/Tests/OptionalArgsTest/TestStaticAnalysis/Test5/Willy.java delete mode 100644 Robust/src/Tests/OptionalArgsTest/TestStaticAnalysis/Test6/Object.java delete mode 100644 Robust/src/Tests/OptionalArgsTest/TestStaticAnalysis/Test6/Willy.java delete mode 100644 Robust/src/Tests/OptionalArgsTest/TestStaticAnalysis/Test7/Object.java delete mode 100644 Robust/src/Tests/OptionalArgsTest/TestStaticAnalysis/Test7/Willy.java delete mode 100644 Robust/src/Tests/OptionalArgsTest/TestStaticAnalysis/Test8/Object.java delete mode 100644 Robust/src/Tests/OptionalArgsTest/TestStaticAnalysis/Test8/Willy.java delete mode 100644 Robust/src/Tests/OptionalArgsTest/TestStaticAnalysis/Test9/Object.java delete mode 100644 Robust/src/Tests/OptionalArgsTest/TestStaticAnalysis/Test9/Willy.java delete mode 100644 Robust/src/Tests/OptionalArgsTest/TestStaticAnalysis/TestMultiple/Object.java delete mode 100644 Robust/src/Tests/OptionalArgsTest/TestStaticAnalysis/TestMultiple/Object2.java delete mode 100644 Robust/src/Tests/OptionalArgsTest/TestStaticAnalysis/TestMultiple/Willy.java delete mode 100644 Robust/src/Tests/OptionalArgsTest/TestStaticAnalysis/TestTag/Object.java delete mode 100644 Robust/src/Tests/OptionalArgsTest/TestStaticAnalysis/TestTag/Willy.java delete mode 100644 Robust/src/Tests/OwnershipAnalysisTest/README delete mode 100644 Robust/src/Tests/OwnershipAnalysisTest/test01/makefile delete mode 100644 Robust/src/Tests/OwnershipAnalysisTest/test01/test01.java delete mode 100644 Robust/src/Tests/OwnershipAnalysisTest/test02/makefile delete mode 100644 Robust/src/Tests/OwnershipAnalysisTest/test02/test02.java delete mode 100644 Robust/src/Tests/OwnershipAnalysisTest/test03/makefile delete mode 100644 Robust/src/Tests/OwnershipAnalysisTest/test03/test03.java delete mode 100644 Robust/src/Tests/OwnershipAnalysisTest/testGraphs/Main.java delete mode 100644 Robust/src/Tests/OwnershipAnalysisTest/testGraphs/makefile delete mode 100644 Robust/src/Tests/OwnershipAnalysisTest/testTokens/Main.java delete mode 100644 Robust/src/Tests/OwnershipAnalysisTest/testTokens/makefile delete mode 100644 Robust/src/Tests/Prefetch/ArrayTest.java delete mode 100644 Robust/src/Tests/Prefetch/FieldPointer.java delete mode 100644 Robust/src/Tests/Prefetch/QuickSort.java delete mode 100644 Robust/src/Tests/ReadFile.java delete mode 100644 Robust/src/Tests/ServerExample.java delete mode 100644 Robust/src/Tests/StringBufferTest.java delete mode 100644 Robust/src/Tests/StringTest.java delete mode 100644 Robust/src/Tests/TagTest/Object.java delete mode 100644 Robust/src/Tests/TagTest/Willy.java delete mode 100644 Robust/src/Tests/TaskExample.java delete mode 100644 Robust/src/Tests/Test.java delete mode 100644 Robust/src/Tests/ThreadTest.java delete mode 100644 Robust/src/Tests/ThreadTest2.java delete mode 100644 Robust/src/Tests/WriteFile.java delete mode 100755 Robust/src/Tests/dotest delete mode 100644 Robust/src/Tests/output/Array.output.goal delete mode 100644 Robust/src/Tests/output/Array2.output.goal delete mode 100644 Robust/src/Tests/output/BoundsFail.output.goal delete mode 100644 Robust/src/Tests/output/BoundsFail2.output.goal delete mode 100644 Robust/src/Tests/output/BoundsFail3.output.goal delete mode 100644 Robust/src/Tests/output/BoundsFail4.output.goal delete mode 100644 Robust/src/Tests/output/CommandLineTest.output.goal delete mode 100644 Robust/src/Tests/output/FileLength.output.goal delete mode 100644 Robust/src/Tests/output/IncTest.output.goal delete mode 100644 Robust/src/Tests/output/IntegerTest.output.goal delete mode 100644 Robust/src/Tests/output/ReadFile.output.goal delete mode 100644 Robust/src/Tests/output/StringBufferTest.output.goal delete mode 100644 Robust/src/Tests/output/StringTest.output.goal delete mode 100644 Robust/src/Tests/output/Test.output.goal delete mode 100644 Robust/src/Tests/output/WriteFile.output.goal delete mode 100644 Robust/src/Tests/output/virtualcalltest.output.goal delete mode 100644 Robust/src/Tests/remotethreadtest.java delete mode 100644 Robust/src/Tests/virtualcalltest.java delete mode 100644 Robust/src/Util/Edge.java delete mode 100755 Robust/src/Util/GraphNode.java delete mode 100644 Robust/src/Util/Namer.java delete mode 100644 Robust/src/Util/Relation.java delete mode 100755 Robust/src/buildscript delete mode 100755 Robust/src/buildscripttask delete mode 100755 Robust/src/buildscripttaskerror delete mode 100644 Robust/src/designnotes delete mode 100644 Robust/src/docs/schedulerdesign delete mode 100644 Robust/src/docs/tagimplementation diff --git a/CVSROOT/checkoutlist b/CVSROOT/checkoutlist deleted file mode 100644 index a3a6ff75..00000000 --- a/CVSROOT/checkoutlist +++ /dev/null @@ -1,17 +0,0 @@ -# The "checkoutlist" file is used to support additional version controlled -# administrative files in $CVSROOT/CVSROOT, such as template files. -# -# The first entry on a line is a filename which will be checked out from -# the corresponding RCS file in the $CVSROOT/CVSROOT directory. -# The remainder of the line is an error message to use if the file cannot -# be checked out. -# -# File format: -# -# [][] -# -# comment lines begin with '#' -cvslog -cvsprep - - diff --git a/CVSROOT/commitinfo b/CVSROOT/commitinfo deleted file mode 100644 index a2ad9714..00000000 --- a/CVSROOT/commitinfo +++ /dev/null @@ -1,26 +0,0 @@ -# The "commitinfo" file is used to control pre-commit checks. -# The filter on the right is invoked with the repository and a list -# of files to check. A non-zero exit of the filter program will -# cause the commit to be aborted. -# -# The first entry on a line is a regular expression which is tested -# against the directory that the change is being committed to, relative -# to the $CVSROOT. For the first match that is found, then the remainder -# of the line is the name of the filter to run. -# -# Format strings present in the filter will be replaced as follows: -# %p = path relative to repository -# %r = repository (path portion of $CVSROOT) -# %{s} = file name, file name, ... -# -# If no format strings are present in the filter string, a default of -# " %r %s" will be appended to the filter string, but this usage is -# deprecated. -# -# If the repository name does not match any of the regular expressions in this -# file, the "DEFAULT" line is used, if it is specified. -# -# If the name "ALL" appears as a regular expression it is always used -# in addition to the first matching regex or "DEFAULT". -#ALL $CVSROOT/CVSROOT/commit_prep -u -r -DEFAULT $CVSROOT/CVSROOT/cvsprep -- %r/%p \ No newline at end of file diff --git a/CVSROOT/config b/CVSROOT/config deleted file mode 100644 index 6843aa18..00000000 --- a/CVSROOT/config +++ /dev/null @@ -1,37 +0,0 @@ -# Set this to "no" if pserver shouldn't check system users/passwords -#SystemAuth=no - -# Put CVS lock files in this directory rather than directly in the repository. -LockDir=/var/lock - -# Set `TopLevelAdmin' to `yes' to create a CVS directory at the top -# level of the new working directory when using the `cvs checkout' -# command. -#TopLevelAdmin=no - -# Set `LogHistory' to `all' or `TOEFWUPCGMAR' to log all transactions to the -# history file, or a subset as needed (ie `TMAR' logs all write operations) -#LogHistory=TOEFWUPCGMAR - -# Set `RereadLogAfterVerify' to `always' (the default) to allow the verifymsg -# script to change the log message. Set it to `stat' to force CVS to verify -# that the file has changed before reading it (this can take up to an extra -# second per directory being committed, so it is not recommended for large -# repositories. Set it to `never' (the previous CVS behavior) to prevent -# verifymsg scripts from changing the log message. -#RereadLogAfterVerify=always - -# Set `UserAdminOptions' to the list of `cvs admin' commands (options) -# that users not in the `cvsadmin' group are allowed to run. This -# defaults to `k', or only allowing the changing of the default -# keyword expansion mode for files for users not in the `cvsadmin' group. -# This value is ignored if the `cvsadmin' group does not exist. -# -# The following string would enable all `cvs admin' commands for all -# users: -#UserAdminOptions=aAbceIklLmnNostuU - -# Set `UseNewInfoFmtStrings' to `no' if you must support a legacy system by -# enabling the deprecated old style info file command line format strings. -# Be warned that these strings could be disabled in any new version of CVS. -UseNewInfoFmtStrings=yes diff --git a/CVSROOT/cvslog b/CVSROOT/cvslog deleted file mode 100755 index 373f7cd9..00000000 --- a/CVSROOT/cvslog +++ /dev/null @@ -1,1417 +0,0 @@ -#!/usr/bin/perl -w -$ID = q(cvslog,v 1.51 2005/04/16 22:39:39 eagle Exp ); -# -# cvslog -- Mail CVS commit notifications. -# -# Written by Russ Allbery -# Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004 -# Board of Trustees, Leland Stanford Jr. University -# -# This program is free software; you can redistribute it and/or modify it -# under the same terms as Perl itself. - -############################################################################## -# Modules and declarations -############################################################################## - -# The path to the repository. If your platform or CVS implementation doesn't -# pass the full path to the cvslog script in $0 (or if your cvslog script -# isn't in the CVSROOT directory of your repository for some reason), you will -# need to explicitly set $REPOSITORY to the root directory of your repository -# (the same thing that you would set CVSROOT to). -($REPOSITORY) = ($0 =~ m%^(.*)/CVSROOT/cvslog$%); -$REPOSITORY ||= ''; - -require 5.004; - -use Getopt::Long qw(GetOptions); -use IPC::Open2 qw(open2); -use POSIX qw(SEEK_SET strftime); - -use strict; -use vars qw($DEBUG $ID $REPOSITORY); - -# Clean up $0 for errors. -$0 =~ s%^.*/%%; - -############################################################################## -# Utility functions -############################################################################## - -# Given a prefix and a reference to an array, return a list of all strings in -# that array with the common prefix stripped off. Also strip off any leading -# ./ if present. -sub simplify { - my ($prefix, $list) = @_; - my @stripped = @$list; - for (@stripped) { - s%^\Q$prefix\E/*%%; - s%^\./+%%; - } - return @stripped; -} - -# Return the next version for a CVS version, incrementing the last number. -sub next_version { - my $version = shift; - my @version = split (/\./, $version); - $version[-1]++; - return join ('.', @version); -} - -# Given a directory name, find the corresponding CVS module. We do this by -# looking in the modules file, finding the last "word" on each line, making -# sure it contains a / (and is therefore assumed to be a directory), and -# seeing if it's a prefix of the module path. -sub find_module { - my $module = shift; - if (open (MODULES, "$REPOSITORY/CVSROOT/modules")) { - local $_; - while () { - next if /^\s*\#/; - next if /^\s*$/; - my ($name, @rest) = split; - my $path = pop @rest; - next unless ($path =~ m%/%); - if ($module =~ s%^$path(\Z|/)%%) { - $module = '/' . $module if $module; - $module = "<$name>$module"; - last; - } - } - close MODULES; - } - return $module; -} - -############################################################################## -# Multidirectory commit I/O -############################################################################## - -# Recalculate the file prefix and module after having loaded a new set of -# data. We do this by starting with the prefix from the last set of data and -# then stripping off one directory at a time until we find something that is a -# common prefix of every affected file. -sub recalculate_prefix { - my $data = shift; - my $prefix = $$data{prefix}; - for (keys %{ $$data{files} }) { - while ($prefix && index ($_, $prefix) != 0) { - $prefix =~ s%/*([^/]+)$%%; - my $last = $1; - $$data{repository} =~ s%/*\Q$last\E$%%; - $$data{localpath} =~ s%/*\Q$last\E$%%; - } - } - $$data{prefix} = $prefix; - $$data{module} = find_module $prefix; -} - -# Build the directory in which we'll find our data. -sub build_tmpdir { - my $tmpdir = $ENV{TMPDIR} || '/tmp'; - $tmpdir .= '/cvs.' . $< . '.' . getpgrp; - return $tmpdir; -} - -# Delete all of the accumulated data for multidirectory commits. -sub cleanup_data { - my $tmpdir = build_tmpdir; - unless (opendir (D, $tmpdir)) { - warn "$0: can't open $tmpdir: $!\n"; - return; - } - for (grep { $_ ne '.' && $_ ne '..' } readdir D) { - unlink "$tmpdir/$_"; - } - closedir D; - rmdir $tmpdir or warn "$0: can't remove $tmpdir: $!\n"; -} - -# Read the file containing the last directory noticed by the commitinfo script -# and return that directory name. -sub read_lastdir { - my $tmpdir = build_tmpdir; - my $last; - if (!-l $tmpdir && -d _ && (lstat _)[4] == $<) { - if (open (LAST, $tmpdir . '/directory')) { - $last = ; - chomp $last; - close LAST; - } - } - return $last; -} - -# Read in a list of files with revisions, one per line, and fill in the -# provided hashes. The first one gets the file information put into its files -# key, and the second gets lists of added, removed, and modified files. -# Returns success or failure. -sub read_files { - my ($file, $data, $message) = @_; - unless (open (FILES, $file)) { - warn "$0: can't open $file: $!\n"; - return; - } - my (@added, @removed, @modified); - local $_; - while () { - chomp; - my ($name, $old, $new) = /^(.*),([^,]+),([^,]+)$/; - next unless $new; - $$data{files}{$name} = [ $old, $new ]; - if ($old eq 'NONE') { push (@added, $name) } - elsif ($new eq 'NONE') { push (@removed, $name) } - else { push (@modified, $name) } - } - close FILES; - $$message{added} = [ @added ]; - $$message{removed} = [ @removed ]; - $$message{modified} = [ @modified ]; - return 1; -} - -# Read in message text from a file and put it in the provided hash. -sub read_text { - my ($file, $message) = @_; - my @text; - if (open (TEXT, $file)) { - @text = ; - close TEXT; - } - $$message{text} = [ @text ]; -} - -# Given a list of message hashes and a new one, merge the new one into the -# list. This is done by checking its commit message against the existing ones -# and merging the list of affected files if a match is found. If a match -# isn't found, the new message is appended to the end of the list. -sub merge_message { - my ($list, $message) = @_; - my $done; - for (@$list) { - if ("@{ $$_{text} }" eq "@{ $$message{text} }") { - push (@{ $$_{added} }, @{ $$message{added} }); - push (@{ $$_{removed} }, @{ $$message{removed} }); - push (@{ $$_{modified} }, @{ $$message{modified} }); - $done = 1; - } - } - push (@$list, $message) unless $done; -} - -# Read in saved data from previous directories. This involves reading in its -# affected files and its commit message, merging this with the previous list -# of affected files and commit messages, and then recalculating the common -# prefix for all the files and deleting all the data we read in. -sub read_data { - my $data = shift; - my $tmpdir = build_tmpdir; - $$data{messages} = []; - for (my $i = 1; -f "$tmpdir/files.$i"; $i++) { - my %message; - read_files ("$tmpdir/files.$i", $data, \%message); - read_text ("$tmpdir/text.$i", \%message); - merge_message ($$data{messages}, \%message); - } - merge_message ($$data{messages}, $$data{message}); - recalculate_prefix ($data); - cleanup_data; -} - -# Save data for the files modified in this invocation to be picked up later. -sub save_data { - my $data = shift; - my $tmpdir = build_tmpdir; - if (-l $tmpdir || !-d _ || (lstat _)[4] != $<) { - warn "$0: invalid directory $tmpdir\n"; - return undef; - } - my $i = 1; - $i++ while -f "$tmpdir/files.$i"; - unless (open (FILES, "> $tmpdir/files.$i") - && open (TEXT, "> $tmpdir/text.$i")) { - warn "$0: can't save to $tmpdir/files: $!\n"; - return undef; - } - for (keys %{ $$data{files} }) { - my ($old, $new) = @{ $$data{files}{$_} }; - print FILES join (',', $_, $old, $new), "\n"; - } - print TEXT @{ $$data{message}{text} }; - unless (close (FILES) && close (TEXT)) { - warn "$0: can't save to $tmpdir/files: $!\n"; - return undef; - } -} - -############################################################################## -# Parsing functions -############################################################################## - -# Split apart the file names that are passed to cvslog. Unfortunately, CVS -# passes all the affected files as one string rather than as separate -# arguments, which means that file names that contain spaces and commas pose -# problems. Returns the path in the repository and then a list of files with -# attached version information; that list may be just a couple of special-case -# strings indicating a cvs add of a directory or a cvs import. -# -# The complexity here is purely the fault of CVS, which doesn't have a good -# interface to logging hooks. -sub split_files { - my ($files) = @_; - - # This ugly hack is here to deal with files at the top level of the - # repository; CVS reports those files without including a directory - # before the file list. Check to see if what would normally be the - # directory name looks more like a file with revisions. - my ($root, $rest) = split (' ', $files, 2); - if ($rest && $root !~ /(,(\d+(\.\d+)*|NONE)){2}$/) { - $files = $rest; - } else { - $root = '.'; - } - - # Special-case directory adds and imports. - if ($files =~ /^- New directory(,NONE,NONE)?$/) { - return ($root, 'directory'); - } elsif ($files =~ /^- Imported sources(,NONE,NONE)?$/) { - return ($root, 'import'); - } - - # Now, split apart $files, which contains just the files, at the spaces - # after version information. - my @files; - while ($files =~ s/^((?:.*?)(?:,(?:\d+(?:\.\d+)*|NONE)){2})( |\z)//) { - push (@files, $1); - } - push (@files, $files) if $files; - return ($root, 'commit', @files); -} - -# Given the summary line passed to the script, parse it into file names and -# version numbers (if available). Takes the log information hash and adds a -# key for the type of change (directory, import, or commit) and for commits a -# hash of file names with values being a list of the previous and the now- -# current version number. Also finds the module and stores that in the hash. -# -# The path in the repository (the first argument) is prepended to all of the -# file names; we'll pull off the common prefix later. -sub parse_files { - my ($data, @args) = @_; - my ($directory, $type, @files); - if (@args == 1) { - ($directory, $type, @files) = split_files ($args[0]); - if ($type eq 'commit') { - @files = map { [ /^(.*),([^,]+),([^,]+)$/ ] } @files; - } - } else { - $directory = shift @args; - if ($args[0] eq '- New directory') { - $type = 'directory'; - } elsif ($args[0] eq '- Imported sources') { - $type = 'import'; - } else { - $type = 'commit'; - while (@args) { - push (@files, [ splice (@args, 0, 3) ]); - } - } - } - die "$0: no module given by CVS (no \%{sVv}?)\n" unless $directory; - $$data{prefix} = $directory; - $$data{module} = find_module $directory; - $$data{message}{added} ||= []; - $$data{message}{modified} ||= []; - $$data{message}{removed} ||= []; - if ($type eq 'directory') { - $$data{type} = 'directory'; - $$data{root} = $directory; - } elsif ($type eq 'import') { - $$data{type} = 'import'; - $$data{root} = $directory; - } elsif (!@files) { - die "$0: no files given by CVS (no \%{sVv}?)\n"; - } else { - $$data{type} = 'commit'; - my $added = $$data{message}{added}; - my $modified = $$data{message}{modified}; - my $removed = $$data{message}{removed}; - for (@files) { - my ($name, $prev, $cur) = @$_; - warn "$0: no version numbers given by CVS (no \%{sVv}?)\n" - unless defined $cur; - $$data{files}{"$directory/$name"} = [ $prev, $cur ]; - if ($prev eq 'NONE') { push (@$added, "$directory/$name") } - elsif ($cur eq 'NONE') { push (@$removed, "$directory/$name") } - else { push (@$modified, "$directory/$name") } - } - } -} - -# Parse the header of the CVS log message (containing the path information) -# and puts the path information into the data hash. -sub parse_paths { - my $data = shift; - - # The first line of the log message will be "Update of ". - my $path = ; - print $path if $DEBUG; - $path =~ s/^Update of //; - $path =~ s/\s*$//; - $$data{repository} = $path; - - # Now comes the path to the local working directory. Grab it and clean it - # up, and then ignore the next blank line. - local $_ = ; - print if $DEBUG; - my ($local) = /directory (\S+)/; - $$data{localpath} = $local; - $_ = ; - print if $DEBUG; -} - -# Extract the tag. We assume that all files will be committed with the same -# tag; probably not the best assumption, but it seems workable. Note that we -# ignore all of the file lists, since we build those ourself from the version -# information (saving the hard challenge of parsing a whitespace-separated -# list that could contain filenames with whitespace). -sub parse_filelist { - my $data = shift; - my ($current, @added, @modified, @removed); - local $_; - while () { - print if $DEBUG; - last if /^Log Message/; - $$data{tag} = $1, next if /^\s*Tag: (\S+)\s*$/; - } -} - -# Extract the commit message, stripping leading and trailing whitespace. -sub parse_message { - my $data = shift; - my @message = ; - print @message if $DEBUG; - shift @message while (@message && $message[0] =~ /^\s*$/); - pop @message while (@message && $message[-1] =~ /^\s*$/); - $$data{message}{text} = [ @message ]; -} - -############################################################################## -# Formatting functions -############################################################################## - -# Determine the From header of the message. If CVSUSER is set, we're running -# from inside a CVS server, and the From header should reflect information -# from the CVS passwd file. Otherwise, pull the information from the system -# passwd file. -sub build_from { - my $cvsuser = $ENV{CVSUSER} || scalar (getpwuid $<); - my $name = ''; - my $address = ''; - if ($cvsuser) { - if (open (PASSWD, "$REPOSITORY/CVSROOT/passwd")) { - local $_; - while () { - chomp; - next unless /:/; - my @info = split ':'; - if ($info[0] eq $cvsuser) { - $name = $info[3]; - $address = $info[4]; - } - } - close PASSWD; - } - $name ||= (getpwnam $cvsuser)[6]; - } - $address ||= $cvsuser || 'cvs'; - $name =~ s/,.*//; - if ($name =~ /[^\w ]/) { - $name = '"' . $name . '"'; - } - return "From: " . ($name ? "$name <$address>" : $address) . "\n"; -} - -# Takes the data hash, a prefix to add to the subject header, and a flag -# saying whether to give a full list of files no matter how long it is. Form -# the subject line of our message. Try to keep the subject under 78 -# characters by just giving a count of files if there are a lot of them. -sub build_subject { - my ($data, $prefix, $long) = @_; - $prefix = "Subject: " . $prefix; - my $length = 78 - length ($prefix) - length ($$data{module}); - $length = 8 if $length < 8; - my $subject; - if ($$data{type} eq 'directory') { - $subject = "[new]"; - } elsif ($$data{type} eq 'import') { - $subject = "[import]"; - } else { - my @files = sort keys %{ $$data{files} }; - @files = simplify ($$data{prefix}, \@files); - my $files = join (' ', @files); - $files =~ s/[\n\r]/ /g; - if (!$long && length ($files) > $length) { - $subject = '(' . @files . (@files > 1 ? " files" : " file") . ')'; - } else { - $subject = "($files)"; - } - } - if ($$data{module}) { - $subject = "$$data{module} $subject"; - } - if ($$data{tag} && $$data{tag} =~ /[^\d.]/) { - $subject = "$$data{tag} $subject"; - } - return "$prefix$subject\n"; -} - -# Generate file lists, wrapped at 74 columns, with the right prefix for what -# type of file they are. -sub build_filelist { - my ($prefix, @files) = @_; - local $_ = join (' ', @files); - my $output = ''; - while (length > 64) { - if (s/^(.{0,64})\s+// || s/^(\S+)//) { - $output .= (' ' x 10) . $1 . "\n"; - } else { - last; - } - } - $output .= (' ' x 10) . $_; - $output =~ s/\s*$/\n/; - $prefix = (' ' x (8 - length ($prefix))) . $prefix; - $output =~ s/^ {10}/$prefix: /; - return $output; -} - -# Build the subheader of the report, listing the files changed and some other -# information about the change. Returns the header as a list. -sub build_header { - my ($data, $showdir, $showauthor) = @_; - my $user = $ENV{CVSUSER} || (getpwuid $<)[0] || $<; - my $date = strftime ('%A, %B %e, %Y @ %T', localtime time); - $date =~ s/ / /; - my @header = (" Date: $date\n"); - push (@header, " Author: $user\n") if $showauthor; - - # If the paths are too long, trim them by taking off a leading path - # component until the length is under 70 characters. - my $path = $$data{repository}; - my $local = $$data{localpath}; - while (length ($path) > 69) { - $path =~ s%^\.\.\.%%; - last unless $path =~ s%^/[^/]+%...%; - } - while (length ($local) > 69) { - $local =~ s%^([\w.-]+:)\.\.\.%$1%; - last unless $local =~ s%^([\w.-]+:)/[^/]+%$1...%; - } - - if ($showdir) { - push (@header, " Tag: $$data{tag}\n") if $$data{tag}; - push (@header, "\n", "Update of $path\n", - " from $local\n"); - } else { - push (@header, " Path: $path\n"); - push (@header, " Tag: $$data{tag}\n") if $$data{tag}; - } - return @header; -} - -# Build a report for a particular commit; this includes the list of affected -# files and the commit message. Returns the report as a list. Takes the -# data, the commit message, and a flag saying whether to add version numbers -# to the file names. -sub build_message { - my ($data, $message, $versions) = @_; - my @added = sort @{ $$message{added} }; - my @modified = sort @{ $$message{modified} }; - my @removed = sort @{ $$message{removed} }; - if ($versions) { - @added = map { "$_ ($$data{files}{$_}[1])" } @added; - @removed = map { "$_ ($$data{files}{$_}[0])" } @removed; - @modified = map { - print "$_\n"; - "$_ ($$data{files}{$_}[0] -> $$data{files}{$_}[1])" - } @modified; - } - @added = simplify ($$data{prefix}, \@added); - @modified = simplify ($$data{prefix}, \@modified); - @removed = simplify ($$data{prefix}, \@removed); - my @message; - push (@message, build_filelist ('Added', @added)) if @added; - push (@message, build_filelist ('Modified', @modified)) if @modified; - push (@message, build_filelist ('Removed', @removed)) if @removed; - if (@{ $$message{text} }) { - push (@message, "\n") if (@added || @modified || @removed); - push (@message, @{ $$message{text} }); - } - return @message; -} - -# Builds an array of -r flags to pass to CVS to get diffs between the -# appropriate versions, given a reference to the %data hash and the name of -# the file. -sub build_version_flags { - my ($data, $file) = @_; - my @versions = @{ $$data{files}{$file} }; - return unless $versions[1] && ($versions[0] ne $versions[1]); - if ($versions[0] eq 'NONE') { - @versions = ('-r', '0.0', '-r', $versions[1]); - } elsif ($versions[1] eq 'NONE') { - @versions = ('-r', $versions[0], '-r', next_version $versions[0]); - } else { - @versions = map { ('-r', $_) } @versions; - } - return @versions; -} - -# Build cvsweb diff URLs. Right now, this is very specific to cvsweb, but -# could probably be extended for other web interfaces to CVS. Takes the data -# hash and the base URL for cvsweb. -sub build_cvsweb { - my ($data, $cvsweb) = @_; - my $options = 'f=h'; - my @cvsweb = ("Diff URLs:\n"); - my $file; - for (sort keys %{ $$data{files} }) { - my @versions = @{ $$data{files}{$_} }; - next unless @versions; - my $file = $_; - for ($file, @versions) { - s{([^a-zA-Z0-9\$_.+!*\'(),/-])} {sprintf "%%%x", ord ($1)}ge; - } - my $url = "$cvsweb/$file.diff?$options&r1=$versions[0]" - . "&r2=$versions[1]\n"; - push (@cvsweb, $url); - } - return @cvsweb; -} - -# Run a cvs rdiff between the old and new versions and return the output. -# This is useful for small changes where you want to see the changes in -# e-mail, but probably creates too large of messages when the changes get -# bigger. Note that this stores the full diff output in memory. -sub build_diff { - my $data = shift; - my @difflines; - for my $file (sort keys %{ $$data{files} }) { - my @versions = build_version_flags ($data, $file); - next unless @versions; - my $pid = open (CVS, '-|'); - if (!defined $pid) { - die "$0: can't fork cvs: $!\n"; - } elsif ($pid == 0) { - open (STDERR, '>&STDOUT') or die "$0: can't reopen stderr: $!\n"; - exec ('cvs', '-fnQq', '-d', $REPOSITORY, 'rdiff', '-u', - @versions, $file) or die "$0: can't fork cvs: $!\n"; - } else { - my @diff = ; - close CVS; - if ($diff[1] =~ /failed to read diff file header/) { - @diff = ($diff[0], "<>\n"); - } - push (@difflines, @diff); - } - } - return @difflines; -} - -# Build a summary of the changes by building the patch it represents in /tmp -# and then running diffstat on it. This gives a basic idea of the order of -# magnitude of the changes. Takes the data hash and the path to diffstat as -# arguments. -sub build_summary { - my ($data, $diffstat) = @_; - $diffstat ||= 'diffstat'; - open2 (\*OUT, \*IN, $diffstat, '-w', '78') - or die "$0: can't fork $diffstat: $!\n"; - my @binary; - for my $file (sort keys %{ $$data{files} }) { - my @versions = build_version_flags ($data, $file); - next unless @versions; - my $pid = open (CVS, '-|'); - if (!defined $pid) { - die "$0: can't fork cvs: $!\n"; - } elsif ($pid == 0) { - open (STDERR, '>&STDOUT') or die "$0: can't reopen stderr: $!\n"; - exec ('cvs', '-fnQq', '-d', $REPOSITORY, 'rdiff', '-u', - @versions, $file) or die "$0: can't fork cvs: $!\n"; - } - local $_; - while () { - s%^(\*\*\*|---|\+\+\+) \Q$$data{prefix}\E/*%$1 %; - s%^Index: \Q$$data{prefix}\E/*%Index: %; - if (/^diff -c/) { s% \Q$$data{prefix}\E/*% %g } - if (/: failed to read diff file header/) { - my $short = $file; - $short =~ s%^\Q$$data{prefix}\E/*%%; - my $date = localtime; - print IN "Index: $short\n"; - print IN "--- $short\t$date\n+++ $short\t$date\n"; - print IN "@@ -1,1 +1,1 @@\n+<>\n"; - push (@binary, $short); - last; - } else { - print IN $_; - } - } - close CVS; - } - close IN; - my @stats = ; - close OUT; - my $offset = index ($stats[0], '|'); - for my $file (@binary) { - @stats = map { - s/^( +\Q$file\E +\| +).*/$1<\>/; - $_; - } @stats; - } - unshift (@stats, '-' x $offset, "+\n"); - return @stats; -} - -############################################################################## -# Configuration file handling -############################################################################## - -# Load defaults from a configuration file, if any. The syntax is keyword -# colon value, where value may be enclosed in quotes. Returns a list -# containing the address to which to send all commits (defaults to not sending -# any message), the base URL for cvsweb (defaults to not including cvsweb -# URLs), the full path to diffstat (defaults to just "diffstat", meaning the -# user's path will be searched), the subject prefix, a default host for -# unqualified e-mail addresses, additional headers to add to the mail message, -# and the full path to sendmail. -sub load_config { - my $file = $REPOSITORY . '/CVSROOT/cvslog.conf'; - my $address = ''; - my $cvsweb = ''; - my $diffstat = 'diffstat'; - my $headers = ''; - my $mailhost = ''; - my ($sendmail) = grep { -x $_ } qw(/usr/sbin/sendmail /usr/lib/sendmail); - $sendmail ||= '/usr/lib/sendmail'; - my $subject = 'CVS update of '; - if (open (CONFIG, $file)) { - local $_; - while () { - next if /^\s*\#/; - next if /^\s*$/; - chomp; - my ($key, $value) = /^\s*(\S+):\s+(.*)/; - unless ($value) { - warn "$0:$file:$.: invalid config syntax: $_\n"; - next; - } - $value =~ s/\s+$//; - $value =~ s/^\"(.*)\"$/$1/; - if (lc $key eq 'address') { $address = $value } - elsif (lc $key eq 'cvsweb') { $cvsweb = $value } - elsif (lc $key eq 'diffstat') { $diffstat = $value } - elsif (lc $key eq 'mailhost') { $mailhost = $value } - elsif (lc $key eq 'sendmail') { $sendmail = $value } - elsif (lc $key eq 'subject') { $subject = $value } - elsif (lc $key eq 'header') { $headers .= $value . "\n" } - else { warn "$0:$file:$.: unrecognized config line: $_\n" } - } - close CONFIG; - } - return ($address, $cvsweb, $diffstat, $subject, $mailhost, $headers, - $sendmail); -} - -############################################################################## -# Main routine -############################################################################## - -# Load the configuration file for defaults. -my ($address, $cvsweburl, $diffstat, $subject, $mailhost, $headers, $sendmail) - = load_config; - -# Parse command-line options. -my (@addresses, $cvsweb, $diff, $help, $longsubject, $merge, $omitauthor, - $showdir, $summary, $version, $versions); -Getopt::Long::config ('bundling', 'no_ignore_case', 'require_order'); -GetOptions ('address|a=s' => \@addresses, - 'cvsweb|c' => \$cvsweb, - 'debug|D' => \$DEBUG, - 'diff|d' => \$diff, - 'help|h' => \$help, - 'include-versions|i' => \$versions, - 'long-subject|l' => \$longsubject, - 'merge|m' => \$merge, - 'omit-author|o' => \$omitauthor, - 'show-directory|w' => \$showdir, - 'summary|s' => \$summary, - 'version|v' => \$version) or exit 1; -if ($help) { - print "Feeding myself to perldoc, please wait....\n"; - exec ('perldoc', '-t', $0); -} elsif ($version) { - my @version = split (' ', $ID); - shift @version if $ID =~ /^\$Id/; - my $version = join (' ', @version[0..2]); - $version =~ s/,v\b//; - $version =~ s/(\S+)$/($1)/; - $version =~ tr%/%-%; - print $version, "\n"; - exit; -} -die "$0: no addresses specified\n" unless ($address || @addresses); -die "$0: unable to determine the repository path\n" unless $REPOSITORY; -die "$0: no cvsweb URL specified in the configuration file\n" - if $cvsweb && !$cvsweburl; -my $showauthor = !$omitauthor; - -# Parse the input. -print "Options: ", join ('|', @ARGV), "\n" if $DEBUG; -print '-' x 78, "\n" if $DEBUG; -my %data; -parse_files (\%data, @ARGV); -parse_paths (\%data); -parse_filelist (\%data); -parse_message (\%data); -print '-' x 78, "\n" if $DEBUG; - -# Check to see if this is part of a multipart commit. If so, just save the -# data for later. Otherwise, read in any saved data and add it to our data. -if ($merge && $data{type} eq 'commit') { - my $lastdir = read_lastdir; - if ($lastdir && $data{repository} ne $lastdir) { - save_data (\%data) and exit 0; - # Fall through and send a notification if save_data fails. - } else { - read_data (\%data); - } -} -$data{messages} = [ $data{message} ] unless $data{messages}; - -# Exit if there are no addresses to send the message to. -exit 0 if (!$address && !@addresses); - -# Open our mail program. -open (MAIL, "| $sendmail -t -oi -oem") - or die "$0: can't fork $sendmail: $!\n"; -my $oldfh = select MAIL; -$| = 1; -select $oldfh; - -# Build the mail headers. -if ($mailhost) { - for ($address, @addresses) { - if ($_ && !/\@/) { - $_ .= '@' . $mailhost unless /\@/; - } - } -} -if (@addresses) { - print MAIL "To: ", join (', ', @addresses), "\n"; - print MAIL "Cc: $address\n" if $address; -} else { - print MAIL "To: $address\n"; -} -print MAIL build_from; -print MAIL $headers if $headers; -print MAIL build_subject (\%data, $subject, $longsubject), "\n"; - -# Build the message and write it out. -print MAIL build_header (\%data, $showdir, $showauthor); -for (@{ $data{messages} }) { - print MAIL "\n", build_message (\%data, $_, $versions); -} -if ($data{type} eq 'commit') { - print MAIL "\n\n", build_summary (\%data, $diffstat) if $summary; - print MAIL "\n\n", build_cvsweb (\%data, $cvsweburl) if $cvsweb; - print MAIL "\n\n", build_diff (\%data) if $diff; -} - -# Make sure sending mail succeeded. -close MAIL; -unless ($? == 0) { die "$0: sendmail exit status " . ($? >> 8) . "\n" } -exit 0; -__END__ - -############################################################################## -# Documentation -############################################################################## - -=head1 NAME - -cvslog - Mail CVS commit notifications - -=head1 SYNOPSIS - -B [B<-cDdhilmosvw>] [B<-a> I
...] %{sVv} - -=head1 REQUIREMENTS - -CVS 1.10 or later, Perl 5.004 or later, diffstat for the B<-s> option, and a -sendmail command that can accept formatted mail messages for delivery. - -=head1 DESCRIPTION - -B is intended to be run out of CVS's F administrative file. -It parses the (undocumented) format of CVS's commit notifications, cleans it -up and reformats it, and mails the notification to one or more e-mail -addresses. Optionally, a diffstat(1) summary of the changes can be added to -the notification, and a CVS commit spanning multiple directories can be -combined into a single notification (by default, CVS generates a separate -notification for each directory). - -To combine a commit spanning multiple directories into a single notification, -B needs the help of an additional program run from the F -administrative file that records the last directory affected by the commit. -See the description in L<"FILES"> for what files and directories must be -created. One such suitable program is B by the same author. - -For information on how to add B to your CVS repository, see -L<"INSTALLATION"> below. B also looks for a configuration file named -F; for details on the format of that file, see -L<"CONFIGURATION">. - -The From: header of the mail message sent by B is formed from the user -making the commit. The contents of the environment variable CVSUSER or the -name of the user doing the commit if CVSUSER isn't set is looked up in the -F file in the CVS repository, if present, and the fourth field is used -as the full name and the fifth as the user's e-mail address. If that user -isn't found in F, it's looked up in the system password file instead -to try to find a full name. Otherwise, that user is just used as an e-mail -address. - -=head1 OPTIONS - -=over 4 - -=item B<-a> I
, B<--address>=I
- -Send the commit notification to I
(possibly in addition to the -address defined in F). This option may occur more than once, -and all specified addresses will receive a copy of the notification. - -=item B<-c>, B<--cvsweb> - -Append the cvsweb URLs for all the diffs covered in the commit message to -the message. The base cvsweb URL must be set in the configuration file. -The file name will be added and the C and C parameters will be -appended with the appropriate values, along with C to request formatted -diff output. Currently, the cvsweb URLs are not further configurable. - -=item B<-D>, B<--debug> - -Prints out the information B got from CVS as it works. This option -is mostly useful for developing B and checking exactly what data CVS -provides. The first line of output will be the options passed to B, -separated by C<|>. - -=item B<-d>, B<--diff> - -Append the full diff output for each change to the notification message. -This is probably only useful if you know that all changes for which -B is run will be small. Note that the entire diff output is -temporarily stored in memory, so this could result in excessive memory usage -in B for very large changes. - -When this option is given, B needs to be able to find B in the -user's PATH. - -If one of the committed files is binary and this is detected by B, -B will suppress the diff and replace it with a note that the file is -binary. - -=item B<-h>, B<--help> - -Print out this documentation (which is done simply by feeding the script to -C). - -=item B<-i>, B<--include-versions> - -Include version numbers (in parentheses) after the file names in the lists -of added, removed, and changed files. By default, only the file names are -given. - -=item B<-l>, B<--long-subject> - -Normally, B will just list the number of changed files rather than the -complete list of them if the subject would otherwise be too long. This flag -disables that behavior and includes the full list of modified files in the -subject header of the mail, no matter how long it is. - -=item B<-m>, B<--merge> - -Merge multidirectory commits into a single notification. This requires that a -program be run from F to record the last directory affected by the -commit. Using this option will cause B to temporarily record -information about a commit in progress in TMPDIR or /tmp; see L<"FILES">. - -=item B<-o>, B<--omit-author> - -Omit the author information from the commit notification. This is useful -where all commits are done by the same person (so the author information is -just noise) or where the author information isn't actually available. - -=item B<-s>, B<--summary> - -Append to each commit notification a summary of the changes, produced by -generating diffs and feeding those diffs to diffstat(1). diffstat(1) must be -installed to use this option; see also the B configuration parameter -in L<"CONFIGURATION">. - -When this option is given, B needs to be able to find B in the -user's PATH. - -If one of the committed files is binary and this is detected by B, -B will replace the uninformative B line corresponding to -that file (B will indicate that nothing changed) with a note that -the file is binary. - -=item B<-v>, B<--version> - -Print out the version of B and exit. - -=item B<-w>, B<--show-directory> - -Show the working directory from which the commit was made. This is usually -not enlightening and when running CVS in server mode will always be some -uninteresting directory in /tmp, so the default is to not include this -information. - -=back - -=head1 CONFIGURATION - -B will look for a configuration file named F in the -CVSROOT directory of your repository. Absence of this file is not an error; -it just means that all of the defaults will be used. The syntax of this file -is one configuration parameter per line in the format: - - parameter: value - -The value may be enclosed in double-quotes and must be enclosed in -double-quotes if there is trailing whitespace that should be part of the -value. There is no way to continue a line; each parameter must be a single -line. Lines beginning with C<#> are comments. - -The following configuration parameters are supported: - -=over 4 - -=item address - -The address or comma-separated list of addresses to which all commit messages -should be sent. If this parameter is not given, the default is to send the -commit message only to those addresses specified with B<-a> options on the -command line, and there must be at least one B<-a> option on the command line. - -=item cvsweb - -The base URL for cvsweb diffs for this repository. Only used if the B<-c> -option is given; see the description of that option for more information -about how the full URL is constructed. - -=item diffstat - -The full path to the diffstat(1) program. If this parameter is not given, the -default is to look for diffstat(1) on the user's PATH. Only used if the B<-s> -option is given. - -=item header - -The value should be a valid mail header, such as "X-Ticket: cvs". This header -will be added to the mail message sent. This configuration parameter may -occur multiple times, and all of those headers will be added to the message. - -=item mailhost - -The hostname to append to unqualified addresses given on the command line with -B<-a>. If set, an C<@> and this value will be appended to any address given -with B<-a> that doesn't contain C<@>. This parameter exists solely to allow -for shorter lines in the F file. - -=item sendmail - -The full path to the sendmail binary. If not given, this setting defaults to -either C or C, whichever is found, -falling back on C. - -=item subject - -The subject prefix to use for the mailed notifications. Appended to this -prefix will be the module or path in the repository of the affected directory -and then either a list of files or a count of files depending on the available -space. The default is C<"CVS update of ">. - -=back - -=head1 INSTALLATION - -Follow these steps to add cvslog to your project: - -=over 4 - -=item 1. - -Check out CVSROOT for your repository (see the CVS manual if you're not sure -how to do this), copy this script into that directory, change the first line -to point to your installation of Perl if necessary, and cvs add and commit it. - -=item 2. - -Add a line like: - - cvslog Unable to check out CVS log notification script cvslog - -to F in CVSROOT and commit it. - -=item 3. - -If needed, create a F file as described above and cvs add and -commit it. Most installations will probably want to set B
, since the -most common CVS configuration is a single repository per project with all -commit notifications sent to the same address. If you don't set B
, -you'll need to add B<-a> options to every invocation of B in -F. - -=item 4. - -If you created a F file, add a line like: - - cvslog.conf Unable to check out cvslog configuration cvslog.conf - -to F in CVSROOT and commit it. - -=item 5. - -Set up your rules in F for those portions of the repository you want -to send CVS commit notifications for. A good starting rule is: - - DEFAULT $CVSROOT/CVSROOT/cvslog %{sVv} - -which will send notifications for every commit to your repository that doesn't -have a separate, more specific rule to the value of B
in -F. You must always invoke B as $CVSROOT/CVSROOT/cvslog; -B uses the path it was invoked as to find the root of the repository. -If you have different portions of your repository that should send -notifications to different places, you can use a series of rules like: - - ^foo/ $CVSROOT/CVSROOT/cvslog -a foo-commit %{sVv} - ^bar/ $CVSROOT/CVSROOT/cvslog -a bar-commit %{sVv} - -This will send notification of commits to anything in the C directory -tree in the repository to foo-commit (possibly qualified with B from -F) and everything in C to bar-commit. No commit -notifications will be sent for any other commits. The C<%{sVv}> string is -replaced by CVS with information about the committed files and should always -be present. - -If you are using CVS version 1.12.6 or later, the format strings for -F rules have changed. Instead of C<%{sVv}>, use C<-- %p %{sVv}>, -once you've set UseNewInfoFmtStrings=yes in F. For example: - - DEFAULT $CVSROOT/CVSROOT/cvslog -- %p %{sVv} - -Any options to B should go before C<-->. See the CVS documentation -for more details on the new F format. - -=item 6. - -If you want summaries of changes, obtain and compile diffstat and add B<-s> to -the appropriate lines in F. You may also need to set B in -F. - -diffstat is at L. - -=item 7. - -If you want merging of multidirectory commits, add B<-m> to the invocations of -B, copy B into your checked out copy of CVSROOT, change the -first line of the script if necessary to point to your installation of Perl, -and cvs add and cvs commit it. Then, a line like: - - cvsprep Unable to check out CVS log notification script cvsprep - -to F in CVSROOT and commit it. - -See L<"WARNINGS"> for some warnings about the security of multi-directory -commit merging. - -=item 8. - -If your operating system doesn't pass the full path to the B -executable to this script when it runs, you'll need to edit the beginning of -this script and set $REPOSITORY to the correct path to the root of your -repository. This should not normally be necessary. See the comments in this -script for additional explanation. - -=back - -=head1 EXAMPLES - -Send all commits under the baz directory to B
defined in -F: - - ^baz/ $CVSROOT/CVSROOT/cvslog -msw %{sVv} - -Multidirectory commits will be merged if B is also installed, a -diffstat(1) summary will be appended to the notification, and the working -directory from which the files were committed will also be included. This -line should be put in F. - -See L<"INSTALLATION"> for more examples. - -=head1 DIAGNOSTICS - -=over 4 - -=item can't fork %s: %s - -(Fatal) B was unable to run a program that it wanted to run. This may -result in no notification being sent or in information missing. Generally -this means that the program in question was missing or B couldn't find -it for some reason. - -=item can't open %s: %s - -(Warning) B was unable to open a file. For the modules file, this -means that B won't do any directory to module mapping. For files -related to multidirectory commits, this means that B can't gather -together information about such a commit and will instead send an individual -notification for the files affected in the current directory. (This means -that some information may have been lost.) - -=item can't remove %s: %s - -(Warning) B was unable to clean up after itself for some reason, and -the temporary files from a multidirectory commit have been left behind in -TMPDIR or F. - -=item can't save to %s: %s - -(Warning) B encountered an error saving information about a -multidirectory commit and will instead send an individual notification for the -files affected in the current directory. - -=item invalid directory %s - -(Warning) Something was strange about the given directory when B went -to use it to store information about a multidirectory commit, so instead a -separate notification for the affected files in the current directory will be -sent. This means that the directory was actually a symlink, wasn't a -directory, or wasn't owned by the right user. - -=item invalid config syntax: %s - -(Warning) The given line in F was syntactically invalid. See -L<"CONFIGURATION"> for the correct syntax. - -=item no %s given by CVS (no %{sVv}?) - -(Fatal) The arguments CVS passes to B should be the directory within -the repository that's being changed and a list of files being changed with -version information for each file. Something in that was missing. This error -generally means that the invocation of B in F doesn't have -the magic C<%{sVv}> variable at the end but instead has no variables or some -other variable like C<%s>, or means that you're using a version of CVS older -than 1.10. - -=item no addresses specified - -(Fatal) There was no B
parameter in F and no B<-a> -options on the command line. At least one recipient address must be specified -for the CVS commit notification. - -=item sendmail exit status %d - -(Fatal) sendmail exited with a non-zero status. This may mean that the -notification message wasn't sent. - -=item unable to determine the repository path - -(Fatal) B was unable to find the root of your CVS repository from the -path by which it was invoked. See L<"INSTALLATION"> for hints on how to fix -this. - -=item unrecognized config line: %s - -(Warning) The given configuration parameter isn't one of the ones that -B knows about. - -=back - -=head1 FILES - -All files relative to $CVSROOT will be found by looking at the full path -B was invoked as and pulling off the path before C. -If this doesn't work on your operating system, you'll need to edit this script -to set $REPOSITORY. - -=over 4 - -=item $CVSROOT/CVSROOT/cvslog.conf - -Read for configuration directives if it exists. See L<"CONFIGURATION">. - -=item $CVSROOT/CVSROOT/modules - -Read to find the module a given file is part of. Rather than always giving -the full path relative to $CVSROOT of the changed files, B tries to -find the module that that directory belongs to and replaces the path of that -module with the name of the module in angle brackets. Modules are found by -reading this file, looking at the last white-space-separated word on each -line, and if it contains a C, checking to see if it is a prefix of the path -to the files affected by a commit. If so, the first white-space-separated -word on that line of F is taken to be the affected module. The first -matching entry is used. - -=item $CVSROOT/CVSROOT/passwd - -Read to find the full name and e-mail address corresponding to a particular -user. The full name is expected to be the fourth field colon-separated field -and the e-mail address the fifth. Defaults derived from the system password -file are used if these are not provided. - -=item TMPDIR/cvs.%d.%d - -Information about multidirectory commits is read from and stored in this -directory. This script will never create this directory (the helper script -B that runs from F has to do that), but it will read and -store information in it and when the commit message is sent, it will delete -everything in this directory and remove the directory. - -The first %d is the numeric UID of the user running B. The second %d -is the process group B is part of. The process group is included in -the directory name so that if you're running a shell that calls setpgrp() (any -modern shell with job control should), multiple commits won't collide with -each other even when done from the same shell. - -If TMPDIR isn't set in the environment, F is used for TMPDIR. - -=item TMPDIR/cvs.%d.%d/directory - -B expects this file to contain the name of the final directory -affected by a multidirectory commit. Each B invocation will save the -data that it's given until B is invoked for this directory, and then -all of the saved data will be combined with the data for that directory and -sent out as a single notification. - -This file must be created by a script such as B run from -F. If it isn't present, B doesn't attempt to combine -multidirectory commits, even if B<-m> is used. - -=back - -=head1 ENVIRONMENT - -=over 4 - -=item PATH - -Used to find cvs and diffstat when the B<-s> option is in effect. If the -B configuration option is set, diffstat isn't searched for on the -user's PATH, but cvs must always be found on the user's PATH in order for -diffstat summaries to work. - -=item TMPDIR - -If set, specifies the temporary directory to use instead of F for -storing information about multidirectory commits. Setting this to some -private directory is recommended if you're doing CVS commits on a multiuser -machine with other untrusted users due to the standard troubles with safely -creating files in F. (Note that other programs besides B also -use TMPDIR.) - -=back - -=head1 WARNINGS - -Merging multidirectory commits requires creating predictably-named files to -communicate information between different processes. By default, those files -are created in F in a directory created for that purpose. While this -should be reasonably safe on systems that don't allow one to remove -directories owned by other people in F, since a directory is used rather -than an individual file and since various sanity checks are made on the -directory before using it, this is still inherently risky on a multiuser -machine with a world-writeable F directory if any of the other users -aren't trusted. - -For this reason, I highly recommend setting TMPDIR to some directory, perhaps -in your home directory, that only you have access to if you're in that -situation. Not only will this make B more secure, it may make some of -the other programs you run somewhat more secure (lots of programs will use the -value of TMPDIR if set). I really don't trust the security of creating any -predictably-named files or directories in F and neither should you. - -Multiple separate B invocations in F interact oddly with -merging of multidirectory commits. The commit notification will be sent to -the addresses and in the style configured for the last invocation of -B, even if some of the earlier directories had different notification -configurations. As a general rule, it's best not to merge multidirectory -commits that span separate portions of the repository with different -notification policies. - -B doesn't support using B (which comes with CVS) as a -F script to provide information about multidirectory commits -because it writes files directly in F rather than using a subdirectory. - -Some file names simply cannot be supported correctly in CVS versions prior -to 1.12.6 (with new-style info format strings turned on) because of -ambiguities in the output from CVS. For example, file names beginning with -spaces are unlikely to produce the correct output, and file names containing -newlines will likely result in odd-looking mail messages. - -=head1 BUGS - -There probably should be a way to specify the path to cvs for generating -summaries and diffs, to turn off the automatic module detection stuff, to -provide for transformations of the working directory (stripping the domain -off the hostname, shortening directory paths in AFS), and to configure the -maximum subject length. The cvsweb support could stand to be more -customizable. - -Many of the logging scripts out there are based on B, which comes -with CVS and uses a different output format for multidirectory commits. I -prefer the one in B, but it would be nice if B could support -either. - -File names containing spaces may be wrapped at the space in the lists of -files added, modified, or removed. The lists may also be wrapped in the -middle of the appended version information if B<-i> is used. - -Multi-directory commit merging may mishandle file names that contain -embedded newlines even with CVS version 1.12.6 or later due to the file -format that B uses to save the intermediate data. - -=head1 NOTES - -Some parts of this script are horrible hacks because the entirety of commit -notification handling in CVS is a horrible, undocumented hack. Better commit -notification support in CVS proper would be welcome, even if it would make -this script obsolete. - -=head1 SEE ALSO - -cvs(1), diffstat(1), cvsprep(1). - -diffstat is at L. - -Current versions of this program are available from its web site at -L. B is available -from this same location. - -=head1 AUTHOR - -Russ Allbery . - -=head1 COPYRIGHT AND LICENSE - -Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004 Board of Trustees, Leland -Stanford Jr. University. - -This program is free software; you can redistribute it and/or modify it -under the same terms as Perl itself. - -=cut diff --git a/CVSROOT/cvsprep b/CVSROOT/cvsprep deleted file mode 100755 index 753f16ab..00000000 --- a/CVSROOT/cvsprep +++ /dev/null @@ -1,185 +0,0 @@ -#!/usr/bin/perl -$ID = q(cvsprep,v 1.6 2004/06/12 02:07:09 eagle Exp ); -# -# cvsprep -- Prep a multi-directory commit. -# -# Written by Russ Allbery -# Copyright 2001, 2002, 2003, 2004 -# Board of Trustees, Leland Stanford Jr. University -# -# This program is free software; you can redistribute it and/or modify it -# under the same terms as Perl itself. - -use Getopt::Long qw(GetOptions); -use vars qw($ID); - -Getopt::Long::config ('require_order'); -GetOptions ('help|h' => \$help, 'version|v' => \$version) or exit 1; -if ($help) { - print "Feeding myself to perldoc, please wait....\n"; - exec ('perldoc', '-t', $0); -} elsif ($version) { - my @version = split (' ', $ID); - shift @version if $ID =~ /^\$Id/; - my $version = join (' ', @version[0..2]); - $version =~ s/,v\b//; - $version =~ s/(\S+)$/($1)/; - $version =~ tr%/%-%; - print $version, "\n"; - exit; -} - -my $directory = shift; -die "$0: CVS didn't provide a directory\n" unless $directory; -my $tmp = $ENV{TMPDIR} || '/tmp'; -$tmp .= '/cvs.' . $< . '.' . getpgrp; -if (!mkdir ($tmp, 0700)) { - if (-l $tmp || !-d _ || (lstat _)[4] != $<) { - die "$0: can't create $tmp: $!\n"; - } -} -open (LOG, "> $tmp/directory") or die "$0: can't create $tmp/directory: $!\n"; -print LOG "$directory\n"; -close LOG; -exit 0; -__END__ - -=head1 NAME - -cvsprep - Prep for a multi-directory CVS commit - -=head1 SYNOPSIS - -B - -=head1 DESCRIPTION - -This program is designed to run from CVS's F administrative file -and make a note of the last directorie involved in the commit. It is used to -support merging of multi-directory CVS commits into a single notification by -B (B knows to stop merging commits when it sees the -notification for the final directory recorded by B). - -It should be run from F with something like: - - DEFAULT $CVSROOT/CVSROOT/cvsprep - -If you are using CVS version 1.12.6 or later, the format strings for -F rules have changed. This line should instead be: - - DEFAULT $CVSROOT/CVSROOT/cvsprep -- %r/%p - -once you've set UseNewInfoFmtStrings=yes in F. - -The directory in which the commit is occurring is saved in a file named -F in a directory in TMPDIR named cvs.., where is -the UID of the committing user and is the process group of the commit -process. If TMPDIR is not used, F is used as the parent directory. - -For details on how to install this program as part of a B -installation, see cvslog(1). - -=head1 OPTIONS - -=over 4 - -=item B<-h>, B<--help> - -Print out this documentation (which is done simply by feeding the script to -C). - -=item B<-v>, B<--version> - -Print out the version of B and exit. - -=head1 DIAGNOSTICS - -=item can't create %s: %s - -(Fatal) B was unable to create either the directory or the file in -that directory needed to pass information to B, or the directory -already exists and is owned by someone other than the current user. The -directory for this commit won't be recorded, and B will therefore not -merge this multi-directory commit. - -=item CVS didn't provide a directory - -(Fatal) No directory was given on the B command line. If run out of -F as described above, CVS should pass the name of the directory in -which the commit is happening as the first argument to B. - -=back - -=head1 FILES - -=over 4 - -=item TMPDIR/cvs.%d.%d/directory - -B expects this file to contain the name of the final directory -affected by a multidirectory commit. B creates the parent directory -and stores its first argument in this file. - -The first %d is the numeric UID of the user running B. The second %d -is the process group B is part of. The process group is included in -the directory name so that if you're running a shell that calls setpgrp() (any -modern shell with job control should), multiple commits won't collide with -each other even when done from the same shell. - -If TMPDIR isn't set in the environment, F is used for TMPDIR. - -=back - -=head1 ENVIRONMENT - -=over 4 - -=item TMPDIR - -If set, specifies the temporary directory to use instead of F for -storing information about multidirectory commits. Setting this to some -private directory is recommended if you're doing CVS commits on a multiuser -machine with other untrusted users due to the standard troubles with safely -creating files in F. (Note that other programs besides B also -use TMPDIR.) - -=back - -=head1 WARNINGS - -B inherently creates directories in TMPDIR (F by default) with -very predictable names. It creates directories rather than files because this -should be less risky, but this is still something of a security risk. Because -of this, I highly recommend that you set TMPDIR to some other directory that -only you have write access to, such as a subdirectory of your home directory. - -For more warnings, see cvslog(1). - -=head1 NOTES - -This process of noting the final directory of a commit so that B knows -when to stop merging is a horrible hack. There's just no better way to do it -given how CVS handles commit notification, which is completely undocumented -and truly bizarre. - -=head1 SEE ALSO - -cvs(1), cvsprep(1). - -Current versions of this program are available from the cvslog web site at -L. B is available from -this same location. - -=head1 AUTHOR - -Russ Allbery . - -=head1 COPYRIGHT AND LICENSE - -Copyright 2001, 2002, 2003, 2004 Board of Trustees, Leland Stanford Jr. -University. - -This program is free software; you can redistribute it and/or modify it under -the same terms as Perl itself. - -=cut diff --git a/CVSROOT/cvswrappers b/CVSROOT/cvswrappers deleted file mode 100644 index e989b754..00000000 --- a/CVSROOT/cvswrappers +++ /dev/null @@ -1,19 +0,0 @@ -# This file affects handling of files based on their names. -# -# The -m option specifies whether CVS attempts to merge files. -# -# The -k option specifies keyword expansion (e.g. -kb for binary). -# -# Format of wrapper file ($CVSROOT/CVSROOT/cvswrappers or .cvswrappers) -# -# wildcard [option value][option value]... -# -# where option is one of -# -f from cvs filter value: path to filter -# -t to cvs filter value: path to filter -# -m update methodology value: MERGE or COPY -# -k expansion mode value: b, o, kkv, &c -# -# and value is a single-quote delimited value. -# For example: -#*.gif -k 'b' diff --git a/CVSROOT/loginfo b/CVSROOT/loginfo deleted file mode 100644 index 9df09fe8..00000000 --- a/CVSROOT/loginfo +++ /dev/null @@ -1,35 +0,0 @@ -# The "loginfo" file controls where "cvs commit" log information -# is sent. The first entry on a line is a regular expression which must match -# the directory that the change is being made to, relative to the -# $CVSROOT. If a match is found, then the remainder of the line is a filter -# program that should expect log information on its standard input. -# -# If the repository name does not match any of the regular expressions in this -# file, the "DEFAULT" line is used, if it is specified. -# -# If the name ALL appears as a regular expression it is always used -# in addition to the first matching regex or DEFAULT. -# -# If any format strings are present in the filter, they will be replaced as follows: -# %p = path relative to repository -# %r = repository (path portion of $CVSROOT) -# %{sVv} = attribute list = file name, old version number (pre-checkin), -# new version number (post-checkin). When either old or new revision is -# unknown, doesn't exist, or isn't applicable, the string "NONE" will be -# placed on the command line instead. -# -# Note that %{sVv} is a list operator and not all elements are necessary. Thus %{sv} is -# a legal format string, but will only be replaced with file name and new revision. -# it also generates multiple arguments for each file being operated upon. i.e. if two -# files, file1 & file2, are being commited from 1.1 to version 1.1.2.1 and from 1.1.2.2 -# to 1.1.2.3, respectively, %{sVv} will generate the following six arguments in this -# order: file1, 1.1, 1.1.2.1, file2, 1.1.2.2, 1.1.2.3. -# -# For example: -#DEFAULT (echo ""; id; echo %s; date; cat) >> $CVSROOT/CVSROOT/commitlog -# or -#DEFAULT (echo ""; id; echo %{sVv}; date; cat) >> $CVSROOT/CVSROOT/commitlog -#ALL $CVSROOT/CVSROOT/log_accum -u -s -d -m bdemsky %s -ALL ( chgrp -R -f cvs $CVSROOT/Robust/. ; chmod -R -f go+rX,o-w $CVSROOT/Robust/. ) -DEFAULT $CVSROOT/CVSROOT/cvslog -m -d -a bdemsky -a adash@uci.edu -a jjenista@uci.edu -a jzhou1@uci.edu -- %p %{sVv} - diff --git a/CVSROOT/modules b/CVSROOT/modules deleted file mode 100644 index cb9e9efc..00000000 --- a/CVSROOT/modules +++ /dev/null @@ -1,26 +0,0 @@ -# Three different line formats are valid: -# key -a aliases... -# key [options] directory -# key [options] directory files... -# -# Where "options" are composed of: -# -i prog Run "prog" on "cvs commit" from top-level of module. -# -o prog Run "prog" on "cvs checkout" of module. -# -e prog Run "prog" on "cvs export" of module. -# -t prog Run "prog" on "cvs rtag" of module. -# -u prog Run "prog" on "cvs update" of module. -# -d dir Place module in directory "dir" instead of module name. -# -l Top-level directory only -- do not recurse. -# -# NOTE: If you change any of the "Run" options above, you'll have to -# release and re-checkout any working directories of these modules. -# -# And "directory" is a path to a directory relative to $CVSROOT. -# -# The "-a" option specifies an alias. An alias is interpreted as if -# everything on the right of the "-a" had been typed on the command line. -# -# You can encode a module within a module by using the special '&' -# character to interpose another module into the current module. This -# can be useful for creating a module that consists of many directories -# spread out over the entire source repository. diff --git a/CVSROOT/notify b/CVSROOT/notify deleted file mode 100644 index 196c3ea2..00000000 --- a/CVSROOT/notify +++ /dev/null @@ -1,17 +0,0 @@ -# The "notify" file controls where notifications from watches set by -# "cvs watch add" or "cvs edit" are sent. The first entry on a line is -# a regular expression which is tested against the directory that the -# change is being made to, relative to the $CVSROOT. If it matches, -# then the remainder of the line is a filter program that should contain -# one occurrence of %s for the user to notify, and information on its -# standard input. -# -# "ALL" or "DEFAULT" can be used in place of the regular expression. -# -# format strings are replaceed as follows: -# %p = path relative to repository -# %r = repository (path portion of $CVSROOT) -# %s = user to notify -# -# For example: -#ALL (echo Committed to %r/%p; cat) |mail %s -s "CVS notification" diff --git a/CVSROOT/rcsinfo b/CVSROOT/rcsinfo deleted file mode 100644 index 49e59f4d..00000000 --- a/CVSROOT/rcsinfo +++ /dev/null @@ -1,13 +0,0 @@ -# The "rcsinfo" file is used to control templates with which the editor -# is invoked on commit and import. -# -# The first entry on a line is a regular expression which is tested -# against the directory that the change is being made to, relative to the -# $CVSROOT. For the first match that is found, then the remainder of the -# line is the name of the file that contains the template. -# -# If the repository name does not match any of the regular expressions in this -# file, the "DEFAULT" line is used, if it is specified. -# -# If the name "ALL" appears as a regular expression it is always used -# in addition to the first matching regex or "DEFAULT". diff --git a/CVSROOT/taginfo b/CVSROOT/taginfo deleted file mode 100644 index 025657c3..00000000 --- a/CVSROOT/taginfo +++ /dev/null @@ -1,40 +0,0 @@ -# The "taginfo" file is used to control pre-tag checks. -# The filter on the right is invoked with the following arguments if no format strings are present: -# -# $1 -- tagname -# $2 -- operation "add" for tag, "mov" for tag -F, and "del" for tag -d -# $3 -- tagtype "?" on delete, "T" for branch, "N" for static -# $4 -- repository -# $5-> file revision [file revision ...] -# -# If any format strings are present in the filter, they will be replaced as follows: -# %b = branch mode = "?" (delete ops - unknown) | "T" (branch) | "N" (not branch) -# %o = operation = "add" | "mov" | "del" -# %p = path relative to repository -# %r = repository (path portion of $CVSROOT) -# %t = tagname -# %{sVv} = attribute list = file name, old version tag will be deleted from, -# new version tag will be added to (or deleted from, but this feature is -# deprecated. When either old or new revision is unknown, doesn't exist, -# or isn't applicable, the string "NONE" will be placed on the command -# line. -# -# Note that %{sVv} is a list operator and not all elements are necessary. Thus %{sV} is -# a legal format string, but will only be replaced with file name and old revision. -# it also generates multiple arguments for each file being operated upon. i.e. if two -# files, file1 & file2, are having a tag moved from version 1.1 to versoin 1.1.2.9, %{sVv} -# will generate the following six arguments in this order: file1, 1.1, 1.1.2.9, file2, 1.1, -# 1.1.2.9. -# -# A non-zero exit of the filter program will cause the tag to be aborted. -# -# The first entry on a line is a regular expression which is tested -# against the directory that the change is being committed to, relative -# to the $CVSROOT. For the first match that is found, then the remainder -# of the line is the name of the filter to run. -# -# If the repository name does not match any of the regular expressions in this -# file, the "DEFAULT" line is used, if it is specified. -# -# If the name "ALL" appears as a regular expression it is always used -# in addition to the first matching regex or "DEFAULT". diff --git a/CVSROOT/verifymsg b/CVSROOT/verifymsg deleted file mode 100644 index 165d1cd6..00000000 --- a/CVSROOT/verifymsg +++ /dev/null @@ -1,29 +0,0 @@ -# The "verifymsg" file is used to allow verification of logging -# information. It works best when a template (as specified in the -# rcsinfo file) is provided for the logging procedure. Given a -# template with locations for, a bug-id number, a list of people who -# reviewed the code before it can be checked in, and an external -# process to catalog the differences that were code reviewed, the -# following test can be applied to the code: -# -# Making sure that the entered bug-id number is correct. -# Validating that the code that was reviewed is indeed the code being -# checked in (using the bug-id number or a seperate review -# number to identify this particular code set.). -# -# If any of the above test failed, then the commit would be aborted. -# -# Format strings present in the filter will be replaced as follows: -# %p = path relative to repository -# %r = repository (path portion of $CVSROOT) -# %l = name of log file to be verified. -# -# If no format strings are present in the filter, a default " %l" will -# be appended to the filter, but this usage is deprecated. -# -# Actions such as mailing a copy of the report to each reviewer are -# better handled by an entry in the loginfo file. -# -# One thing that should be noted is the the ALL keyword is not -# supported. There can be only one entry that matches a given -# repository. diff --git a/Robust/JavaGrammar/COPYING b/Robust/JavaGrammar/COPYING deleted file mode 100644 index a43ea212..00000000 --- a/Robust/JavaGrammar/COPYING +++ /dev/null @@ -1,339 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 675 Mass Ave, Cambridge, MA 02139, USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Library General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - Appendix: How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) 19yy - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) 19yy name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Library General -Public License instead of this License. diff --git a/Robust/JavaGrammar/Lex/BooleanLiteral.java b/Robust/JavaGrammar/Lex/BooleanLiteral.java deleted file mode 100644 index 9ff274f2..00000000 --- a/Robust/JavaGrammar/Lex/BooleanLiteral.java +++ /dev/null @@ -1,12 +0,0 @@ -package Lex; - -import java_cup.runtime.Symbol; - -class BooleanLiteral extends Literal { - Boolean val; - BooleanLiteral(boolean b) { this.val = new Boolean(b); } - - Symbol token() { return new Symbol(Sym.BOOLEAN_LITERAL, val); } - - public String toString() { return "BooleanLiteral <"+val.toString()+">"; } -} diff --git a/Robust/JavaGrammar/Lex/CharacterLiteral.java b/Robust/JavaGrammar/Lex/CharacterLiteral.java deleted file mode 100644 index d3d8d073..00000000 --- a/Robust/JavaGrammar/Lex/CharacterLiteral.java +++ /dev/null @@ -1,14 +0,0 @@ -package Lex; - -import java_cup.runtime.Symbol; - -class CharacterLiteral extends Literal { - Character val; - CharacterLiteral(char c) { this.val = new Character(c); } - - Symbol token() { return new Symbol(Sym.CHARACTER_LITERAL, val); } - - public String toString() { - return "CharacterLiteral <"+Token.escape(val.toString())+">"; - } -} diff --git a/Robust/JavaGrammar/Lex/Comment.java b/Robust/JavaGrammar/Lex/Comment.java deleted file mode 100644 index 6a0aae4b..00000000 --- a/Robust/JavaGrammar/Lex/Comment.java +++ /dev/null @@ -1,26 +0,0 @@ -package Lex; - -abstract class Comment extends InputElement { - private StringBuffer comment = new StringBuffer(); - - String getComment() { return comment.toString(); } - - void appendLine(String more) { // 'more' is '\n' terminated. - int i=0; - - // skip leading white space. - for (; i - * This program is released under the terms of the GPL; see the file - * COPYING for more details. There is NO WARRANTY on this code. - */ - -class FIFO { - java_cup.runtime.Symbol[] backing = new java_cup.runtime.Symbol[10]; - int start=0, end=0; - final Getter getter; - FIFO(Getter getter) { this.getter = getter; } - public boolean isEmpty() { return start==end; } - private boolean isFull() { - return start==end+1 || (start==0 && end==backing.length-1); - } - private int size() { - return ((end= size()) - put(getter.next()); - int index = start+i; - if (index >= backing.length) index -= backing.length; - ASSERT(0<= index && index < backing.length); - return backing[index]; - } - abstract static class Getter { - abstract java_cup.runtime.Symbol next() - throws java.io.IOException; - } - private static void ASSERT(boolean b) { - if (!b) throw new RuntimeException(); - } -} - - diff --git a/Robust/JavaGrammar/Lex/FloatLiteral.java b/Robust/JavaGrammar/Lex/FloatLiteral.java deleted file mode 100644 index 8d6adf20..00000000 --- a/Robust/JavaGrammar/Lex/FloatLiteral.java +++ /dev/null @@ -1,9 +0,0 @@ -package Lex; - -import java_cup.runtime.Symbol; - -class FloatLiteral extends NumericLiteral { - FloatLiteral(float f) { this.val = new Float(f); } - - Symbol token() { return new Symbol(Sym.FLOATING_POINT_LITERAL, val); } -} diff --git a/Robust/JavaGrammar/Lex/Identifier.java b/Robust/JavaGrammar/Lex/Identifier.java deleted file mode 100644 index 1d90994f..00000000 --- a/Robust/JavaGrammar/Lex/Identifier.java +++ /dev/null @@ -1,17 +0,0 @@ -package Lex; - -import java_cup.runtime.Symbol; - -public class Identifier extends Token { - String identifier; - public Identifier(String identifier) { this.identifier=identifier; } - - public String toString() { return "Identifier <"+identifier+">"; } - - /* Ben Walter correctly pointed out that - * the first released version of this grammar/lexer did not - * return the string value of the identifier in the parser token. - * Should be fixed now. ;-) - */ - Symbol token() { return new Symbol(Sym.IDENTIFIER, identifier); } -} diff --git a/Robust/JavaGrammar/Lex/InputElement.java b/Robust/JavaGrammar/Lex/InputElement.java deleted file mode 100644 index 11858266..00000000 --- a/Robust/JavaGrammar/Lex/InputElement.java +++ /dev/null @@ -1,3 +0,0 @@ -package Lex; - -abstract class InputElement {} diff --git a/Robust/JavaGrammar/Lex/IntegerLiteral.java b/Robust/JavaGrammar/Lex/IntegerLiteral.java deleted file mode 100644 index 8c217069..00000000 --- a/Robust/JavaGrammar/Lex/IntegerLiteral.java +++ /dev/null @@ -1,9 +0,0 @@ -package Lex; - -import java_cup.runtime.Symbol; - -class IntegerLiteral extends NumericLiteral { - IntegerLiteral(int i) { this.val = new Integer(i); } - - Symbol token() { return new Symbol(Sym.INTEGER_LITERAL, val); } -} diff --git a/Robust/JavaGrammar/Lex/Keyword.java b/Robust/JavaGrammar/Lex/Keyword.java deleted file mode 100644 index 94476708..00000000 --- a/Robust/JavaGrammar/Lex/Keyword.java +++ /dev/null @@ -1,69 +0,0 @@ -package Lex; - -import java.util.Hashtable; -import java_cup.runtime.Symbol; - -class Keyword extends Token { - String keyword; - Keyword(String s) { keyword = s; } - - Symbol token() { - Integer i = (Integer) key_table.get(keyword); - return new Symbol(i.intValue()); - } - public String toString() { return "Keyword <"+keyword+">"; } - - static private final Hashtable key_table = new Hashtable(); - static { - key_table.put("abstract", new Integer(Sym.ABSTRACT)); - key_table.put("assert", new Integer(Sym.ASSERT)); - key_table.put("boolean", new Integer(Sym.BOOLEAN)); - key_table.put("break", new Integer(Sym.BREAK)); - key_table.put("byte", new Integer(Sym.BYTE)); - key_table.put("case", new Integer(Sym.CASE)); - key_table.put("catch", new Integer(Sym.CATCH)); - key_table.put("char", new Integer(Sym.CHAR)); - key_table.put("class", new Integer(Sym.CLASS)); - key_table.put("const", new Integer(Sym.CONST)); - key_table.put("continue", new Integer(Sym.CONTINUE)); - key_table.put("default", new Integer(Sym.DEFAULT)); - key_table.put("do", new Integer(Sym.DO)); - key_table.put("double", new Integer(Sym.DOUBLE)); - key_table.put("else", new Integer(Sym.ELSE)); - key_table.put("enum", new Integer(Sym.ENUM)); - key_table.put("extends", new Integer(Sym.EXTENDS)); - key_table.put("final", new Integer(Sym.FINAL)); - key_table.put("finally", new Integer(Sym.FINALLY)); - key_table.put("float", new Integer(Sym.FLOAT)); - key_table.put("for", new Integer(Sym.FOR)); - key_table.put("goto", new Integer(Sym.GOTO)); - key_table.put("if", new Integer(Sym.IF)); - key_table.put("implements", new Integer(Sym.IMPLEMENTS)); - key_table.put("import", new Integer(Sym.IMPORT)); - key_table.put("instanceof", new Integer(Sym.INSTANCEOF)); - key_table.put("int", new Integer(Sym.INT)); - key_table.put("interface", new Integer(Sym.INTERFACE)); - key_table.put("long", new Integer(Sym.LONG)); - key_table.put("native", new Integer(Sym.NATIVE)); - key_table.put("new", new Integer(Sym.NEW)); - key_table.put("package", new Integer(Sym.PACKAGE)); - key_table.put("private", new Integer(Sym.PRIVATE)); - key_table.put("protected", new Integer(Sym.PROTECTED)); - key_table.put("public", new Integer(Sym.PUBLIC)); - key_table.put("return", new Integer(Sym.RETURN)); - key_table.put("short", new Integer(Sym.SHORT)); - key_table.put("static", new Integer(Sym.STATIC)); - key_table.put("strictfp", new Integer(Sym.STRICTFP)); - key_table.put("super", new Integer(Sym.SUPER)); - key_table.put("switch", new Integer(Sym.SWITCH)); - key_table.put("synchronized", new Integer(Sym.SYNCHRONIZED)); - key_table.put("this", new Integer(Sym.THIS)); - key_table.put("throw", new Integer(Sym.THROW)); - key_table.put("throws", new Integer(Sym.THROWS)); - key_table.put("transient", new Integer(Sym.TRANSIENT)); - key_table.put("try", new Integer(Sym.TRY)); - key_table.put("void", new Integer(Sym.VOID)); - key_table.put("volatile", new Integer(Sym.VOLATILE)); - key_table.put("while", new Integer(Sym.WHILE)); - } -} diff --git a/Robust/JavaGrammar/Lex/Lexer.java b/Robust/JavaGrammar/Lex/Lexer.java deleted file mode 100644 index 0be7f9cb..00000000 --- a/Robust/JavaGrammar/Lex/Lexer.java +++ /dev/null @@ -1,528 +0,0 @@ -package Lex; - -import java.io.Reader; -import java.io.LineNumberReader; - -/* Java lexer. - * Copyright (C) 2002 C. Scott Ananian - * This program is released under the terms of the GPL; see the file - * COPYING for more details. There is NO WARRANTY on this code. - */ - -public class Lexer implements Parse.Lexer { - LineNumberReader reader; - boolean isJava12; - boolean isJava14; - boolean isJava15; - String line = null; - int line_pos = 1; - int line_num = 0; - LineList lineL = new LineList(-line_pos, null); // sentinel for line #0 - - public Lexer(Reader reader) { - this(reader, 2); // by default, use a Java 1.2-compatible lexer. - } - public Lexer(Reader reader, int java_minor_version) { - this.reader = new LineNumberReader(new EscapedUnicodeReader(reader)); - this.isJava12 = java_minor_version >= 2; - this.isJava14 = java_minor_version >= 4; - this.isJava15 = java_minor_version >= 5; - } - - public java_cup.runtime.Symbol nextToken() throws java.io.IOException { - java_cup.runtime.Symbol sym = - lookahead==null ? _nextToken() : lookahead.get(); - /* Old "smart lexer" hack to parse JSR-14 syntax. New, better, grammar - * makes this unnecessary. (Credit to Eric Blake for its discovery.) - * - if (isJava15 && sym.sym==Sym.LT && shouldBePLT()) - sym.sym=Sym.PLT; - */ - last = sym; - return sym; - } - private boolean shouldBePLT() throws java.io.IOException { - // look ahead to see if this LT should be changed to a PLT - if (last==null || last.sym!=Sym.IDENTIFIER) - return false; - if (lookahead==null) lookahead = new FIFO(new FIFO.Getter() { - java_cup.runtime.Symbol next() throws java.io.IOException - { return _nextToken(); } - }); - int i=0; - // skip past IDENTIFIER (DOT IDENTIFIER)* - if (lookahead.peek(i++).sym != Sym.IDENTIFIER) - return false; - while (lookahead.peek(i).sym == Sym.DOT) { - i++; - if (lookahead.peek(i++).sym != Sym.IDENTIFIER) - return false; - } - // skip past (LBRACK RBRACK)* - while (lookahead.peek(i).sym == Sym.LBRACK) { - i++; - if (lookahead.peek(i++).sym != Sym.RBRACK) - return false; - } - // now the next sym has to be one of LT GT COMMA EXTENDS IMPLEMENTS - switch(lookahead.peek(i).sym) { - default: - return false; - case Sym.LT: - case Sym.GT: - case Sym.COMMA: - case Sym.EXTENDS: - case Sym.IMPLEMENTS: - return true; - } - } - private java_cup.runtime.Symbol last = null; - private FIFO lookahead = null; - public java_cup.runtime.Symbol _nextToken() throws java.io.IOException { - /* tokens are: - * Identifiers/Keywords/true/false/null (start with java letter) - * numeric literal (start with number) - * character literal (start with single quote) - * string (start with double quote) - * separator (parens, braces, brackets, semicolon, comma, period) - * operator (equals, plus, minus, etc) - * whitespace - * comment (start with slash) - */ - InputElement ie; - int startpos, endpos; - do { - startpos = lineL.head + line_pos; - ie = getInputElement(); - if (ie instanceof DocumentationComment) - comment = ((Comment)ie).getComment(); - } while (!(ie instanceof Token)); - endpos = lineL.head + line_pos - 1; - - //System.out.println(ie.toString()); // uncomment to debug lexer. - java_cup.runtime.Symbol sym = ((Token)ie).token(); - // fix up left/right positions. - sym.left = startpos; sym.right = endpos; - // return token. - return sym; - } - public boolean debug_lex() throws java.io.IOException { - InputElement ie = getInputElement(); - System.out.println(ie); - return !(ie instanceof EOF); - } - - String comment; - public String lastComment() { return comment; } - public void clearComment() { comment=""; } - - InputElement getInputElement() throws java.io.IOException { - if (line_num == 0) - nextLine(); - if (line==null) - return new EOF(); - if (line.length()<=line_pos) { // end of line. - nextLine(); - if (line==null) - return new EOF(); - } - - switch (line.charAt(line_pos)) { - - // White space: - case ' ': // ASCII SP - case '\t': // ASCII HT - case '\f': // ASCII FF - case '\n': // LineTerminator - return new WhiteSpace(consume()); - - // EOF character: - case '\020': // ASCII SUB - consume(); - return new EOF(); - - // Comment prefix: - case '/': - return getComment(); - - // else, a Token - default: - return getToken(); - } - } - // May get Token instead of Comment. - InputElement getComment() throws java.io.IOException { - String comment; - // line.charAt(line_pos+0) is '/' - switch (line.charAt(line_pos+1)) { - case '/': // EndOfLineComment - comment = line.substring(line_pos+2); - line_pos = line.length(); - return new EndOfLineComment(comment); - case '*': // TraditionalComment or DocumentationComment - line_pos += 2; - if (line.charAt(line_pos)=='*') { // DocumentationComment - return snarfComment(new DocumentationComment()); - } else { // TraditionalComment - return snarfComment(new TraditionalComment()); - } - default: // it's a token, not a comment. - return getToken(); - } - } - - Comment snarfComment(Comment c) throws java.io.IOException { - StringBuffer text=new StringBuffer(); - while(true) { // Grab CommentTail - while (line.charAt(line_pos)!='*') { // Add NotStar to comment. - int star_pos = line.indexOf('*', line_pos); - if (star_pos<0) { - text.append(line.substring(line_pos)); - c.appendLine(text.toString()); text.setLength(0); - line_pos = line.length(); - nextLine(); - if (line==null) - throw new Error("Unterminated comment at end of file."); - } else { - text.append(line.substring(line_pos, star_pos)); - line_pos=star_pos; - } - } - // At this point, line.charAt(line_pos)=='*' - // Grab CommentTailStar starting at line_pos+1. - if (line.charAt(line_pos+1)=='/') { // safe because line ends with '\n' - c.appendLine(text.toString()); line_pos+=2; return c; - } - text.append(line.charAt(line_pos++)); // add the '*' - } - } - - Token getToken() { - // Tokens are: Identifiers, Keywords, Literals, Separators, Operators. - switch (line.charAt(line_pos)) { - // Separators: (period is a special case) - case '(': - case ')': - case '{': - case '}': - case '[': - case ']': - case ';': - case ',': - return new Separator(consume()); - - // Operators: - case '=': - case '>': - case '<': - case '!': - case '~': - case '?': - case ':': - case '&': - case '|': - case '+': - case '-': - case '*': - case '/': - case '^': - case '%': - return getOperator(); - case '\'': - return getCharLiteral(); - case '\"': - return getStringLiteral(); - - // a period is a special case: - case '.': - if (Character.digit(line.charAt(line_pos+1),10)!=-1) - return getNumericLiteral(); - else if (isJava15 && - line.charAt(line_pos+1)=='.' && - line.charAt(line_pos+2)=='.') { - consume(); consume(); consume(); - return new Separator('\u2026'); // unicode ellipsis character. - } else return new Separator(consume()); - default: - break; - } - if (Character.isJavaIdentifierStart(line.charAt(line_pos))) - return getIdentifier(); - if (Character.isDigit(line.charAt(line_pos))) - return getNumericLiteral(); - throw new Error("Illegal character on line "+line_num); - } - - static final String[] keywords = new String[] { - "abstract", "assert", "boolean", "break", "byte", "case", "catch", "char", - "class", "const", "continue", "default", "do", "double", "else", "enum", - "extends", "final", "finally", "float", "for", "goto", "if", - "implements", "import", "instanceof", "int", "interface", "long", - "native", "new", "package", "private", "protected", "public", - "return", "short", "static", "strictfp", "super", "switch", - "synchronized", "this", "throw", "throws", "transient", "try", "void", - "volatile", "while" }; - Token getIdentifier() { - // Get id string. - StringBuffer sb = new StringBuffer().append(consume()); - - if (!Character.isJavaIdentifierStart(sb.charAt(0))) - throw new Error("Invalid Java Identifier on line "+line_num); - while (Character.isJavaIdentifierPart(line.charAt(line_pos))) - sb.append(consume()); - String s = sb.toString(); - // Now check against boolean literals and null literal. - if (s.equals("null")) return new NullLiteral(); - if (s.equals("true")) return new BooleanLiteral(true); - if (s.equals("false")) return new BooleanLiteral(false); - // Check against keywords. - // pre-java 1.5 compatibility: - if (!isJava15 && s.equals("enum")) return new Identifier(s); - // pre-java 1.4 compatibility: - if (!isJava14 && s.equals("assert")) return new Identifier(s); - // pre-java 1.2 compatibility: - if (!isJava12 && s.equals("strictfp")) return new Identifier(s); - // use binary search. - for (int l=0, r=keywords.length; r > l; ) { - int x = (l+r)/2, cmp = s.compareTo(keywords[x]); - if (cmp < 0) r=x; else l=x+1; - if (cmp== 0) return new Keyword(s); - } - // not a keyword. - return new Identifier(s); - } - NumericLiteral getNumericLiteral() { - int i; - // leading decimal indicates float. - if (line.charAt(line_pos)=='.') - return getFloatingPointLiteral(); - // 0x indicates Hex. - if (line.charAt(line_pos)=='0' && - (line.charAt(line_pos+1)=='x' || - line.charAt(line_pos+1)=='X')) { - line_pos+=2; return getIntegerLiteral(/*base*/16); - } - // otherwise scan to first non-numeric - for (i=line_pos; Character.digit(line.charAt(i),10)!=-1; ) - i++; - switch(line.charAt(i)) { // discriminate based on first non-numeric - case '.': - case 'f': - case 'F': - case 'd': - case 'D': - case 'e': - case 'E': - return getFloatingPointLiteral(); - case 'L': - case 'l': - default: - if (line.charAt(line_pos)=='0') - return getIntegerLiteral(/*base*/8); - return getIntegerLiteral(/*base*/10); - } - } - NumericLiteral getIntegerLiteral(int radix) { - long val=0; - while (Character.digit(line.charAt(line_pos),radix)!=-1) - val = (val*radix) + Character.digit(consume(),radix); - if (line.charAt(line_pos) == 'l' || - line.charAt(line_pos) == 'L') { - consume(); - return new LongLiteral(val); - } - // we compare MAX_VALUE against val/2 to allow constants like - // 0xFFFF0000 to get past the test. (unsigned long->signed int) - if ((val/2) > Integer.MAX_VALUE || - val < Integer.MIN_VALUE) - throw new Error("Constant does not fit in integer on line "+line_num); - return new IntegerLiteral((int)val); - } - NumericLiteral getFloatingPointLiteral() { - String rep = getDigits(); - if (line.charAt(line_pos)=='.') - rep+=consume() + getDigits(); - if (line.charAt(line_pos)=='e' || - line.charAt(line_pos)=='E') { - rep+=consume(); - if (line.charAt(line_pos)=='+' || - line.charAt(line_pos)=='-') - rep+=consume(); - rep+=getDigits(); - } - try { - switch (line.charAt(line_pos)) { - case 'f': - case 'F': - consume(); - return new FloatLiteral(Float.valueOf(rep).floatValue()); - case 'd': - case 'D': - consume(); - /* falls through */ - default: - return new DoubleLiteral(Double.valueOf(rep).doubleValue()); - } - } catch (NumberFormatException e) { - throw new Error("Illegal floating-point on line "+line_num+": "+e); - } - } - String getDigits() { - StringBuffer sb = new StringBuffer(); - while (Character.digit(line.charAt(line_pos),10)!=-1) - sb.append(consume()); - return sb.toString(); - } - - Operator getOperator() { - char first = consume(); - char second= line.charAt(line_pos); - - switch(first) { - // single-character operators. - case '~': - case '?': - case ':': - return new Operator(new String(new char[] {first})); - // doubled operators - case '+': - case '-': - case '&': - case '|': - if (first==second) - return new Operator(new String(new char[] {first, consume()})); - default: - break; - } - // Check for trailing '=' - if (second=='=') - return new Operator(new String(new char[] {first, consume()})); - - // Special-case '<<', '>>' and '>>>' - if ((first=='<' && second=='<') || // << - (first=='>' && second=='>')) { // >> - String op = new String(new char[] {first, consume()}); - if (first=='>' && line.charAt(line_pos)=='>') // >>> - op += consume(); - if (line.charAt(line_pos)=='=') // <<=, >>=, >>>= - op += consume(); - return new Operator(op); - } - - // Otherwise return single operator. - return new Operator(new String(new char[] {first})); - } - - CharacterLiteral getCharLiteral() { - char firstquote = consume(); - char val; - switch (line.charAt(line_pos)) { - case '\\': - val = getEscapeSequence(); - break; - case '\'': - throw new Error("Invalid character literal on line "+line_num); - case '\n': - throw new Error("Invalid character literal on line "+line_num); - default: - val = consume(); - break; - } - char secondquote = consume(); - if (firstquote != '\'' || secondquote != '\'') - throw new Error("Invalid character literal on line "+line_num); - return new CharacterLiteral(val); - } - StringLiteral getStringLiteral() { - char openquote = consume(); - StringBuffer val = new StringBuffer(); - while (line.charAt(line_pos)!='\"') { - switch(line.charAt(line_pos)) { - case '\\': - val.append(getEscapeSequence()); - break; - case '\n': - throw new Error("Invalid string literal on line " + line_num); - default: - val.append(consume()); - break; - } - } - char closequote = consume(); - if (openquote != '\"' || closequote != '\"') - throw new Error("Invalid string literal on line " + line_num); - - return new StringLiteral(val.toString().intern()); - } - - char getEscapeSequence() { - if (consume() != '\\') - throw new Error("Invalid escape sequence on line " + line_num); - switch(line.charAt(line_pos)) { - case 'b': - consume(); return '\b'; - case 't': - consume(); return '\t'; - case 'n': - consume(); return '\n'; - case 'f': - consume(); return '\f'; - case 'r': - consume(); return '\r'; - case '\"': - consume(); return '\"'; - case '\'': - consume(); return '\''; - case '\\': - consume(); return '\\'; - case '0': - case '1': - case '2': - case '3': - return (char) getOctal(3); - case '4': - case '5': - case '6': - case '7': - return (char) getOctal(2); - default: - throw new Error("Invalid escape sequence on line " + line_num); - } - } - int getOctal(int maxlength) { - int i, val=0; - for (i=0; i0xFF)) // impossible. - throw new Error("Invalid octal escape sequence in line " + line_num); - return val; - } - - char consume() { return line.charAt(line_pos++); } - void nextLine() throws java.io.IOException { - line=reader.readLine(); - if (line!=null) line=line+'\n'; - lineL = new LineList(lineL.head+line_pos, lineL); // for error reporting - line_pos=0; - line_num++; - } - - // Deal with error messages. - public void errorMsg(String msg, java_cup.runtime.Symbol info) { - int n=line_num, c=info.left-lineL.head; - for (LineList p = lineL; p!=null; p=p.tail, n--) - if (p.head<=info.left) { c=info.left-p.head; break; } - System.err.println(msg+" at line "+n); - num_errors++; - } - private int num_errors = 0; - public int numErrors() { return num_errors; } - - class LineList { - int head; - LineList tail; - LineList(int head, LineList tail) { this.head = head; this.tail = tail; } - } -} diff --git a/Robust/JavaGrammar/Lex/Literal.java b/Robust/JavaGrammar/Lex/Literal.java deleted file mode 100644 index e9a50cfe..00000000 --- a/Robust/JavaGrammar/Lex/Literal.java +++ /dev/null @@ -1,3 +0,0 @@ -package Lex; - -abstract class Literal extends Token { } diff --git a/Robust/JavaGrammar/Lex/LongLiteral.java b/Robust/JavaGrammar/Lex/LongLiteral.java deleted file mode 100644 index 4b01d826..00000000 --- a/Robust/JavaGrammar/Lex/LongLiteral.java +++ /dev/null @@ -1,9 +0,0 @@ -package Lex; - -import java_cup.runtime.Symbol; - -class LongLiteral extends NumericLiteral { - LongLiteral(long l) { this.val = new Long(l); } - - Symbol token() { return new Symbol(Sym.INTEGER_LITERAL, val); } -} diff --git a/Robust/JavaGrammar/Lex/NullLiteral.java b/Robust/JavaGrammar/Lex/NullLiteral.java deleted file mode 100644 index 2109bba3..00000000 --- a/Robust/JavaGrammar/Lex/NullLiteral.java +++ /dev/null @@ -1,11 +0,0 @@ -package Lex; - -import java_cup.runtime.Symbol; - -class NullLiteral extends Literal { - NullLiteral() { } - - Symbol token() { return new Symbol(Sym.NULL_LITERAL); } - - public String toString() { return "NullLiteral "; } -} diff --git a/Robust/JavaGrammar/Lex/NumericLiteral.java b/Robust/JavaGrammar/Lex/NumericLiteral.java deleted file mode 100644 index f67a135a..00000000 --- a/Robust/JavaGrammar/Lex/NumericLiteral.java +++ /dev/null @@ -1,7 +0,0 @@ -package Lex; - -abstract class NumericLiteral extends Literal { - Number val; - - public String toString() { return "NumericLiteral <"+val.toString()+">"; } -} diff --git a/Robust/JavaGrammar/Lex/Operator.java b/Robust/JavaGrammar/Lex/Operator.java deleted file mode 100644 index 3d97d6e3..00000000 --- a/Robust/JavaGrammar/Lex/Operator.java +++ /dev/null @@ -1,57 +0,0 @@ -package Lex; - -import java.util.Hashtable; -import java_cup.runtime.Symbol; - -class Operator extends Token { - String which; - Operator(String which) { this.which = which; } - - public String toString() { return "Operator <"+which+">"; } - - Symbol token() { - Integer i = (Integer) op_table.get(which); - return new Symbol(i.intValue()); - } - - static private final Hashtable op_table = new Hashtable(); - static { - op_table.put("=", new Integer(Sym.EQ)); - op_table.put(">", new Integer(Sym.GT)); - op_table.put("<", new Integer(Sym.LT)); - op_table.put("!", new Integer(Sym.NOT)); - op_table.put("~", new Integer(Sym.COMP)); - op_table.put("?", new Integer(Sym.QUESTION)); - op_table.put(":", new Integer(Sym.COLON)); - op_table.put("==", new Integer(Sym.EQEQ)); - op_table.put("<=", new Integer(Sym.LTEQ)); - op_table.put(">=", new Integer(Sym.GTEQ)); - op_table.put("!=", new Integer(Sym.NOTEQ)); - op_table.put("&&", new Integer(Sym.ANDAND)); - op_table.put("||", new Integer(Sym.OROR)); - op_table.put("++", new Integer(Sym.PLUSPLUS)); - op_table.put("--", new Integer(Sym.MINUSMINUS)); - op_table.put("+", new Integer(Sym.PLUS)); - op_table.put("-", new Integer(Sym.MINUS)); - op_table.put("*", new Integer(Sym.MULT)); - op_table.put("/", new Integer(Sym.DIV)); - op_table.put("&", new Integer(Sym.AND)); - op_table.put("|", new Integer(Sym.OR)); - op_table.put("^", new Integer(Sym.XOR)); - op_table.put("%", new Integer(Sym.MOD)); - op_table.put("<<", new Integer(Sym.LSHIFT)); - op_table.put(">>", new Integer(Sym.RSHIFT)); - op_table.put(">>>", new Integer(Sym.URSHIFT)); - op_table.put("+=", new Integer(Sym.PLUSEQ)); - op_table.put("-=", new Integer(Sym.MINUSEQ)); - op_table.put("*=", new Integer(Sym.MULTEQ)); - op_table.put("/=", new Integer(Sym.DIVEQ)); - op_table.put("&=", new Integer(Sym.ANDEQ)); - op_table.put("|=", new Integer(Sym.OREQ)); - op_table.put("^=", new Integer(Sym.XOREQ)); - op_table.put("%=", new Integer(Sym.MODEQ)); - op_table.put("<<=", new Integer(Sym.LSHIFTEQ)); - op_table.put(">>=", new Integer(Sym.RSHIFTEQ)); - op_table.put(">>>=", new Integer(Sym.URSHIFTEQ)); - } -} diff --git a/Robust/JavaGrammar/Lex/Separator.java b/Robust/JavaGrammar/Lex/Separator.java deleted file mode 100644 index b2b2ab2d..00000000 --- a/Robust/JavaGrammar/Lex/Separator.java +++ /dev/null @@ -1,29 +0,0 @@ -package Lex; - -import java_cup.runtime.Symbol; - -class Separator extends Token { - char which; - Separator(char which) { this.which = which; } - - Symbol token() { - switch(which) { - case '(': return new Symbol(Sym.LPAREN); - case ')': return new Symbol(Sym.RPAREN); - case '{': return new Symbol(Sym.LBRACE); - case '}': return new Symbol(Sym.RBRACE); - case '[': return new Symbol(Sym.LBRACK); - case ']': return new Symbol(Sym.RBRACK); - case ';': return new Symbol(Sym.SEMICOLON); - case ',': return new Symbol(Sym.COMMA); - case '.': return new Symbol(Sym.DOT); - case '\u2026': return new Symbol(Sym.ELLIPSIS); - default: - throw new Error("Invalid separator."); - } - } - - public String toString() { - return "Separator <"+which+">"; - } -} diff --git a/Robust/JavaGrammar/Lex/StringLiteral.java b/Robust/JavaGrammar/Lex/StringLiteral.java deleted file mode 100644 index cdf4e981..00000000 --- a/Robust/JavaGrammar/Lex/StringLiteral.java +++ /dev/null @@ -1,14 +0,0 @@ -package Lex; - -import java_cup.runtime.Symbol; - -class StringLiteral extends Literal { - String val; - StringLiteral(String s) { this.val = s; } - - Symbol token() { return new Symbol(Sym.STRING_LITERAL, val); } - - public String toString() { - return "StringLiteral <"+Token.escape(val)+">"; - } -} diff --git a/Robust/JavaGrammar/Lex/Token.java b/Robust/JavaGrammar/Lex/Token.java deleted file mode 100644 index ec3a578d..00000000 --- a/Robust/JavaGrammar/Lex/Token.java +++ /dev/null @@ -1,21 +0,0 @@ -package Lex; - -abstract class Token extends InputElement { - abstract java_cup.runtime.Symbol token(); - - protected static String escape(String s) { - StringBuffer sb = new StringBuffer(); - for (int i=0; i"; - } -} diff --git a/Robust/JavaGrammar/Main/Main.java b/Robust/JavaGrammar/Main/Main.java deleted file mode 100644 index d8233302..00000000 --- a/Robust/JavaGrammar/Main/Main.java +++ /dev/null @@ -1,39 +0,0 @@ -package Main; - -import java.io.Reader; -import java.io.BufferedReader; -import java.io.FileReader; - -/* Test skeleton for java parser/lexer. - * Copyright (C) 1998 C. Scott Ananian - * This is released under the terms of the GPL with NO WARRANTY. - * See the file COPYING for more details. - */ - -public class Main { - public static void main(String args[]) throws Exception { - Reader fr = new BufferedReader(new FileReader(args[0])); - // the integer in the next line specifies the java minor version. - // for example, for a java 1.0 lexer specify '0' - // for a java 1.1 lexer specify '1' - // etc. - // As far as the lexer's concerned, 'strictfp' was added in Java 1.2, - // 'assert' in Java 1.4, and we need a "lookahead <" token PLT - // to correctly parse Java 1.5. - int java_minor_version = 5; - if (args.length>1) java_minor_version = Integer.parseInt(args[1]); - Lex.Lexer l = new Lex.Lexer(fr, java_minor_version); - java_cup.runtime.lr_parser g; - switch (java_minor_version) { - default: - case 5: g = new Parse.Grm15(l); break; - case 4: g = new Parse.Grm14(l); break; - case 3: - case 2: g = new Parse.Grm12(l); break; - case 1: g = new Parse.Grm11(l); break; - case 0: g = new Parse.Grm10(l); break; - } - g./*debug_*/parse(); - System.exit(l.numErrors()); - } -} diff --git a/Robust/JavaGrammar/Makefile b/Robust/JavaGrammar/Makefile deleted file mode 100644 index 758243e1..00000000 --- a/Robust/JavaGrammar/Makefile +++ /dev/null @@ -1,89 +0,0 @@ -# Makefile to create simple test framework for the java parsers. -# Copyright (C) 1998 C. Scott Ananian -# Released under the terms of the GPL with NO WARRANTY. See COPYING. - -# java environment. -JAVA=java -JAVAC=javac -JFLAGS=-g -#CUPFLAGS=-dump_states - -# list the available java grammar versions -JAVA_GRAMMARS=10 11 12 14 15 - -all: $(foreach j,$(JAVA_GRAMMARS),Parse/Grm$(j).class) \ - Lex/Lex.class Main/Main.class - -# Feed the appropriate CUP specification to javaCUP. -Parse/Grm%.java Parse/Sym%.java: Parse/java%.cup - cd Parse && \ - ${JAVA} java_cup.Main ${CUPFLAGS} -parser Grm$* -symbols Sym$* \ - < java$*.cup 2>Grm$*.err && tail Grm$*.err - -# Compile the java source for the parser. -Parse/Grm%.class: Parse/Lexer.java Parse/Grm%.java Parse/Sym%.java - ${JAVAC} ${JFLAGS} $^ - -# Make the lexer symbols from the parser symbols. -Lex/Sym.java: $(foreach j,$(JAVA_GRAMMARS),Parse/Sym$(j).java) -# verify that these are all identical! - @if cat $^ | sed -e 's/Sym[0-9][0-9]/Sym/g' | sort | uniq -c | \ - egrep -v '^[ ]*[0-9]*[05] ' | grep -v "^[ ]*[0-9]*[ ]*//"\ - ; then \ - echo $^ "are not identical;" ;\ - echo "we won't be able to build a single lexer for all of these." ;\ - exit 1;\ - fi -# now make a generic version. - sed -e "s/package Parse/package Lex/" -e "s/Sym10/Sym/g" \ - < Parse/Sym10.java > $@ - -# Compile the java source for the (unified) lexer. -Lex/Lex.class: Lex/*.java Lex/Sym.java - ${JAVAC} ${JFLAGS} Lex/*.java - -# Compile the java source for the driver. -Main/Main.class: Main/Main.java - ${JAVAC} ${JFLAGS} Main/*.java - -# run some quick tests. -test: Parse/Lexer.java Parse/Grm14.java all phony - for n in 1 2 3 4 5; do \ - ( ${JAVA} Main.Main Parse/Lexer.java $$n && \ - ${JAVA} Main.Main Parse/Grm14.java $$n && \ - ${JAVA} Main.Main tests/Escape.java) || exit 1; \ - done - for n in 2 3 4 5; do \ - ${JAVA} Main.Main tests/Eric.java $$n || exit 1; \ - done - ${JAVA} Main.Main tests/TestJSR201.java 5 - ${JAVA} Main.Main tests/Test15.java 5 - ${JAVA} Main.Main tests/Eric15.java 5 -# always run the test. -phony: - -# target to make the distributed files. -dist: - -$(RM) -rf JavaGrammar javagrm.tar.gz javagrm.zip - cvs -d `cat CVS/Root` co -A -P JavaGrammar - find JavaGrammar -type d -name CVS | xargs $(RM) -rf - tar czvf javagrm.tar.gz JavaGrammar - zip -r javagrm.zip JavaGrammar - cp javagrm.tar.gz `date +javagrm-%d-%b-%Y.tar.gz` - cp README javagrm-README.txt - $(RM) -rf JavaGrammar -upload: dist - chmod a+r javagrm* - scp javagrm* shades.cs.princeton.edu:/u/appel/public_html/modern/java/CUP - -# clean up after ourselves. -clean: - $(RM) Lex/Sym.java \ - $(foreach j,$(JAVA_GRAMMARS),Parse/Grm$(j).err) \ - $(foreach j,$(JAVA_GRAMMARS),Parse/Grm$(j).java) \ - $(foreach j,$(JAVA_GRAMMARS),Parse/Sym$(j).java) \ - Parse/parser.java Parse/sym.java \ - */*.class - -veryclean: clean - $(RM) *~ */*~ javagrm* diff --git a/Robust/JavaGrammar/Parse/Lexer.java b/Robust/JavaGrammar/Parse/Lexer.java deleted file mode 100644 index 7fbcbd5f..00000000 --- a/Robust/JavaGrammar/Parse/Lexer.java +++ /dev/null @@ -1,13 +0,0 @@ -package Parse; - -/* Lexer.java. Copyright (C) 1998 C. Scott Ananian. - * This program is free software; see the file COPYING for more details. - */ - -public interface Lexer { - public java_cup.runtime.Symbol nextToken() throws java.io.IOException; - /** report an error */ - public void errorMsg(String msg, java_cup.runtime.Symbol info); - /** return the number of errors reported */ - public int numErrors(); -} diff --git a/Robust/JavaGrammar/Parse/java10.cup b/Robust/JavaGrammar/Parse/java10.cup deleted file mode 100644 index 879210e3..00000000 --- a/Robust/JavaGrammar/Parse/java10.cup +++ /dev/null @@ -1,825 +0,0 @@ -package Parse; - -import java_cup.runtime.*; - -/* Java 1.0 parser for CUP. - * Copyright (C) 1998 C. Scott Ananian - * This program is released under the terms of the GPL; see the file - * COPYING for more details. There is NO WARRANTY on this code. - */ - -parser code {: - Lexer lexer; - - public Grm10(Lexer l) { - this(); - lexer=l; - } - - public void syntax_error(java_cup.runtime.Symbol current) { - report_error("Syntax error (" + current.sym + ")", current); - } - public void report_error(String message, java_cup.runtime.Symbol info) { - lexer.errorMsg(message, info); - } -:}; - -scan with {: return lexer.nextToken(); :}; - -terminal BOOLEAN; // primitive_type -terminal BYTE, SHORT, INT, LONG, CHAR; // integral_type -terminal FLOAT, DOUBLE; // floating_point_type -terminal LBRACK, RBRACK; // array_type -terminal java.lang.String IDENTIFIER; // name -terminal DOT; // qualified_name -terminal SEMICOLON, MULT, COMMA, LBRACE, RBRACE, EQ, LPAREN, RPAREN, COLON; -terminal PACKAGE; // package_declaration -terminal IMPORT; // import_declaration -terminal PUBLIC, PROTECTED, PRIVATE; // modifier -terminal STATIC; // modifier -terminal ABSTRACT, FINAL, NATIVE, SYNCHRONIZED, TRANSIENT, VOLATILE; -terminal CLASS; // class_declaration -terminal EXTENDS; // super -terminal IMPLEMENTS; // interfaces -terminal VOID; // method_header -terminal THROWS; // throws -terminal THIS, SUPER; // explicit_constructor_invocation -terminal INTERFACE; // interface_declaration -terminal IF, ELSE; // if_then_statement, if_then_else_statement -terminal SWITCH; // switch_statement -terminal CASE, DEFAULT; // switch_label -terminal DO, WHILE; // while_statement, do_statement -terminal FOR; // for_statement -terminal BREAK; // break_statement -terminal CONTINUE; // continue_statement -terminal RETURN; // return_statement -terminal THROW; // throw_statement -terminal TRY; // try_statement -terminal CATCH; // catch_clause -terminal FINALLY; // finally -terminal NEW; // class_instance_creation_expression -terminal PLUSPLUS; // postincrement_expression -terminal MINUSMINUS; // postdecrement_expression -terminal PLUS, MINUS, COMP, NOT, DIV, MOD; -terminal LSHIFT, RSHIFT, URSHIFT; // shift_expression -terminal LT, GT, LTEQ, GTEQ, INSTANCEOF; // relational_expression -terminal EQEQ, NOTEQ; // equality_expression -terminal AND; // and_expression -terminal XOR; // exclusive_or_expression -terminal OR; // inclusive_or_expression -terminal ANDAND; // conditional_and_expression -terminal OROR; // conditional_or_expression -terminal QUESTION; // conditional_expression -terminal MULTEQ, DIVEQ, MODEQ, PLUSEQ, MINUSEQ; // assignment_operator -terminal LSHIFTEQ, RSHIFTEQ, URSHIFTEQ; // assignment_operator -terminal ANDEQ, XOREQ, OREQ; // assignment_operator - -terminal java.lang.Number INTEGER_LITERAL; -terminal java.lang.Number FLOATING_POINT_LITERAL; -terminal java.lang.Boolean BOOLEAN_LITERAL; -terminal java.lang.Character CHARACTER_LITERAL; -terminal java.lang.String STRING_LITERAL; -terminal NULL_LITERAL; - -// Reserved but unused: -terminal CONST, GOTO; -// lexer compatibility with Java 1.2: -terminal STRICTFP; -// lexer compatibility with Java 1.4 -terminal ASSERT; -// lexer compatibility with Java 1.5 -terminal ELLIPSIS; -terminal ENUM; - -// 19.2) The Syntactic Grammar -non terminal goal; -// 19.3) Lexical Structure -non terminal literal; -// 19.4) Types, Values, and Variables -non terminal type, primitive_type, numeric_type; -non terminal integral_type, floating_point_type; -non terminal reference_type; -non terminal class_or_interface_type; -non terminal class_type, interface_type; -non terminal array_type; -// 19.5) Names -non terminal name, simple_name, qualified_name; -// 19.6) Packages -non terminal compilation_unit; -non terminal package_declaration_opt, package_declaration; -non terminal import_declarations_opt, import_declarations; -non terminal type_declarations_opt, type_declarations; -non terminal import_declaration; -non terminal single_type_import_declaration; -non terminal type_import_on_demand_declaration; -non terminal type_declaration; -// 19.7) Productions used only in the LALR(1) grammar -non terminal modifiers_opt, modifiers, modifier; -// 19.8.1) Class Declaration -non terminal class_declaration, super, super_opt; -non terminal interfaces, interfaces_opt, interface_type_list; -non terminal class_body; -non terminal class_body_declarations, class_body_declarations_opt; -non terminal class_body_declaration, class_member_declaration; -// 19.8.2) Field Declarations -non terminal field_declaration, variable_declarators, variable_declarator; -non terminal variable_declarator_id, variable_initializer; -// 19.8.3) Method Declarations -non terminal method_declaration, method_header, method_declarator; -non terminal formal_parameter_list_opt, formal_parameter_list; -non terminal formal_parameter; -non terminal throws_opt, throws; -non terminal class_type_list, method_body; -// 19.8.4) Static Initializers -non terminal static_initializer; -// 19.8.5) Constructor Declarations -non terminal constructor_declaration, constructor_declarator; -non terminal constructor_body; -non terminal explicit_constructor_invocation; -// 19.9.1) Interface Declarations -non terminal interface_declaration; -non terminal extends_interfaces_opt, extends_interfaces; -non terminal interface_body; -non terminal interface_member_declarations_opt, interface_member_declarations; -non terminal interface_member_declaration, constant_declaration; -non terminal abstract_method_declaration; -// 19.10) Arrays -non terminal array_initializer; -non terminal variable_initializers; -// 19.11) Blocks and Statements -non terminal block; -non terminal block_statements_opt, block_statements, block_statement; -non terminal local_variable_declaration_statement, local_variable_declaration; -non terminal statement, statement_no_short_if; -non terminal statement_without_trailing_substatement; -non terminal empty_statement; -non terminal labeled_statement, labeled_statement_no_short_if; -non terminal expression_statement, statement_expression; -non terminal if_then_statement; -non terminal if_then_else_statement, if_then_else_statement_no_short_if; -non terminal switch_statement, switch_block; -non terminal switch_block_statement_groups; -non terminal switch_block_statement_group; -non terminal switch_labels, switch_label; -non terminal while_statement, while_statement_no_short_if; -non terminal do_statement; -non terminal for_statement, for_statement_no_short_if; -non terminal for_init_opt, for_init; -non terminal for_update_opt, for_update; -non terminal statement_expression_list; -non terminal identifier_opt; -non terminal break_statement, continue_statement; -non terminal return_statement, throw_statement; -non terminal synchronized_statement, try_statement; -non terminal catches_opt, catches, catch_clause; -non terminal finally; -// 19.12) Expressions -non terminal primary, primary_no_new_array; -non terminal class_instance_creation_expression; -non terminal argument_list_opt, argument_list; -non terminal array_creation_expression; -non terminal dim_exprs, dim_expr, dims_opt, dims; -non terminal field_access, method_invocation, array_access; -non terminal postfix_expression; -non terminal postincrement_expression, postdecrement_expression; -non terminal unary_expression, unary_expression_not_plus_minus; -non terminal preincrement_expression, predecrement_expression; -non terminal cast_expression; -non terminal multiplicative_expression, additive_expression; -non terminal shift_expression, relational_expression, equality_expression; -non terminal and_expression, exclusive_or_expression, inclusive_or_expression; -non terminal conditional_and_expression, conditional_or_expression; -non terminal conditional_expression, assignment_expression; -non terminal assignment; -non terminal left_hand_side; -non terminal assignment_operator; -non terminal expression_opt, expression; -non terminal constant_expression; - -start with goal; - -// 19.2) The Syntactic Grammar -goal ::= compilation_unit - ; - -// 19.3) Lexical Structure. -literal ::= INTEGER_LITERAL - | FLOATING_POINT_LITERAL - | BOOLEAN_LITERAL - | CHARACTER_LITERAL - | STRING_LITERAL - | NULL_LITERAL - ; - -// 19.4) Types, Values, and Variables -type ::= primitive_type - | reference_type - ; -primitive_type ::= - numeric_type - | BOOLEAN - ; -numeric_type::= integral_type - | floating_point_type - ; -integral_type ::= - BYTE - | SHORT - | INT - | LONG - | CHAR - ; -floating_point_type ::= - FLOAT - | DOUBLE - ; - -reference_type ::= - class_or_interface_type - | array_type - ; -class_or_interface_type ::= name; - -class_type ::= class_or_interface_type; -interface_type ::= class_or_interface_type; - -array_type ::= primitive_type LBRACK RBRACK - | name LBRACK RBRACK - | array_type LBRACK RBRACK - ; - -// 19.5) Names -name ::= simple_name - | qualified_name - ; -simple_name ::= IDENTIFIER - ; -qualified_name ::= - name DOT IDENTIFIER - ; - -// 19.6) Packages -compilation_unit ::= - package_declaration_opt - import_declarations_opt - type_declarations_opt - ; -package_declaration_opt ::= package_declaration | ; -import_declarations_opt ::= import_declarations | ; -type_declarations_opt ::= type_declarations | ; - -import_declarations ::= - import_declaration - | import_declarations import_declaration - ; -type_declarations ::= - type_declaration - | type_declarations type_declaration - ; -package_declaration ::= - PACKAGE name SEMICOLON - ; -import_declaration ::= - single_type_import_declaration - | type_import_on_demand_declaration - ; -single_type_import_declaration ::= - IMPORT name SEMICOLON - ; -type_import_on_demand_declaration ::= - IMPORT name DOT MULT SEMICOLON - ; -type_declaration ::= - class_declaration - | interface_declaration - | SEMICOLON - ; - -// 19.7) Productions used only in the LALR(1) grammar -modifiers_opt::= - | modifiers - ; -modifiers ::= modifier - | modifiers modifier - ; -modifier ::= PUBLIC | PROTECTED | PRIVATE - | STATIC - | ABSTRACT | FINAL | NATIVE | SYNCHRONIZED | TRANSIENT | VOLATILE - ; - -// 19.8) Classes - -// 19.8.1) Class Declaration: -class_declaration ::= - modifiers_opt CLASS IDENTIFIER super_opt interfaces_opt class_body - ; -super ::= EXTENDS class_type - ; -super_opt ::= - | super - ; -interfaces ::= IMPLEMENTS interface_type_list - ; -interfaces_opt::= - | interfaces - ; -interface_type_list ::= - interface_type - | interface_type_list COMMA interface_type - ; -class_body ::= LBRACE class_body_declarations_opt RBRACE - ; -class_body_declarations_opt ::= - | class_body_declarations ; -class_body_declarations ::= - class_body_declaration - | class_body_declarations class_body_declaration - ; -class_body_declaration ::= - class_member_declaration - | static_initializer - | constructor_declaration - ; -class_member_declaration ::= - field_declaration - | method_declaration - | SEMICOLON - ; - -// 19.8.2) Field Declarations -field_declaration ::= - modifiers_opt type variable_declarators SEMICOLON - ; -variable_declarators ::= - variable_declarator - | variable_declarators COMMA variable_declarator - ; -variable_declarator ::= - variable_declarator_id - | variable_declarator_id EQ variable_initializer - ; -variable_declarator_id ::= - IDENTIFIER - | variable_declarator_id LBRACK RBRACK - ; -variable_initializer ::= - expression - | array_initializer - ; - -// 19.8.3) Method Declarations -method_declaration ::= - method_header method_body - ; -method_header ::= - modifiers_opt type method_declarator throws_opt - | modifiers_opt VOID method_declarator throws_opt - ; -method_declarator ::= - IDENTIFIER LPAREN formal_parameter_list_opt RPAREN - | method_declarator LBRACK RBRACK - ; -formal_parameter_list_opt ::= - | formal_parameter_list - ; -formal_parameter_list ::= - formal_parameter - | formal_parameter_list COMMA formal_parameter - ; -formal_parameter ::= - type variable_declarator_id - ; -throws_opt ::= - | throws - ; -throws ::= THROWS class_type_list - ; -class_type_list ::= - class_type - | class_type_list COMMA class_type - ; -method_body ::= block - | SEMICOLON - ; - -// 19.8.4) Static Initializers -static_initializer ::= - STATIC block - ; - -// 19.8.5) Constructor Declarations -constructor_declaration ::= - modifiers_opt constructor_declarator throws_opt - constructor_body - ; -constructor_declarator ::= - simple_name LPAREN formal_parameter_list_opt RPAREN - ; -constructor_body ::= - LBRACE explicit_constructor_invocation - block_statements RBRACE - | LBRACE explicit_constructor_invocation RBRACE - | LBRACE block_statements RBRACE - | LBRACE RBRACE - ; -explicit_constructor_invocation ::= - THIS LPAREN argument_list_opt RPAREN SEMICOLON - | SUPER LPAREN argument_list_opt RPAREN SEMICOLON - ; - -// 19.9) Interfaces - -// 19.9.1) Interface Declarations -interface_declaration ::= - modifiers_opt INTERFACE IDENTIFIER extends_interfaces_opt - interface_body - ; -extends_interfaces_opt ::= - | extends_interfaces - ; -extends_interfaces ::= - EXTENDS interface_type - | extends_interfaces COMMA interface_type - ; -interface_body ::= - LBRACE interface_member_declarations_opt RBRACE - ; -interface_member_declarations_opt ::= - | interface_member_declarations - ; -interface_member_declarations ::= - interface_member_declaration - | interface_member_declarations interface_member_declaration - ; -interface_member_declaration ::= - constant_declaration - | abstract_method_declaration - | SEMICOLON - ; -constant_declaration ::= - field_declaration - ; -abstract_method_declaration ::= - method_header SEMICOLON - ; - -// 19.10) Arrays -array_initializer ::= - LBRACE variable_initializers COMMA RBRACE - | LBRACE variable_initializers RBRACE - | LBRACE COMMA RBRACE - | LBRACE RBRACE - ; -variable_initializers ::= - variable_initializer - | variable_initializers COMMA variable_initializer - ; - -// 19.11) Blocks and Statements -block ::= LBRACE block_statements_opt RBRACE - ; -block_statements_opt ::= - | block_statements - ; -block_statements ::= - block_statement - | block_statements block_statement - ; -block_statement ::= - local_variable_declaration_statement - | statement - ; -local_variable_declaration_statement ::= - local_variable_declaration SEMICOLON - ; -local_variable_declaration ::= - type variable_declarators - ; -statement ::= statement_without_trailing_substatement - | labeled_statement - | if_then_statement - | if_then_else_statement - | while_statement - | for_statement - ; -statement_no_short_if ::= - statement_without_trailing_substatement - | labeled_statement_no_short_if - | if_then_else_statement_no_short_if - | while_statement_no_short_if - | for_statement_no_short_if - ; -statement_without_trailing_substatement ::= - block - | empty_statement - | expression_statement - | switch_statement - | do_statement - | break_statement - | continue_statement - | return_statement - | synchronized_statement - | throw_statement - | try_statement - ; -empty_statement ::= - SEMICOLON - ; -labeled_statement ::= - IDENTIFIER COLON statement - ; -labeled_statement_no_short_if ::= - IDENTIFIER COLON statement_no_short_if - ; -expression_statement ::= - statement_expression SEMICOLON - ; -statement_expression ::= - assignment - | preincrement_expression - | predecrement_expression - | postincrement_expression - | postdecrement_expression - | method_invocation - | class_instance_creation_expression - ; -if_then_statement ::= - IF LPAREN expression RPAREN statement - ; -if_then_else_statement ::= - IF LPAREN expression RPAREN statement_no_short_if - ELSE statement - ; -if_then_else_statement_no_short_if ::= - IF LPAREN expression RPAREN statement_no_short_if - ELSE statement_no_short_if - ; -switch_statement ::= - SWITCH LPAREN expression RPAREN switch_block - ; -switch_block ::= - LBRACE switch_block_statement_groups switch_labels RBRACE - | LBRACE switch_block_statement_groups RBRACE - | LBRACE switch_labels RBRACE - | LBRACE RBRACE - ; -switch_block_statement_groups ::= - switch_block_statement_group - | switch_block_statement_groups switch_block_statement_group - ; -switch_block_statement_group ::= - switch_labels block_statements - ; -switch_labels ::= - switch_label - | switch_labels switch_label - ; -switch_label ::= - CASE constant_expression COLON - | DEFAULT COLON - ; - -while_statement ::= - WHILE LPAREN expression RPAREN statement - ; -while_statement_no_short_if ::= - WHILE LPAREN expression RPAREN statement_no_short_if - ; -do_statement ::= - DO statement WHILE LPAREN expression RPAREN SEMICOLON - ; -for_statement ::= - FOR LPAREN for_init_opt SEMICOLON expression_opt SEMICOLON - for_update_opt RPAREN statement - ; -for_statement_no_short_if ::= - FOR LPAREN for_init_opt SEMICOLON expression_opt SEMICOLON - for_update_opt RPAREN statement_no_short_if - ; -for_init_opt ::= - | for_init - ; -for_init ::= statement_expression_list - | local_variable_declaration - ; -for_update_opt ::= - | for_update - ; -for_update ::= statement_expression_list - ; -statement_expression_list ::= - statement_expression - | statement_expression_list COMMA statement_expression - ; - -identifier_opt ::= - | IDENTIFIER - ; - -break_statement ::= - BREAK identifier_opt SEMICOLON - ; - -continue_statement ::= - CONTINUE identifier_opt SEMICOLON - ; -return_statement ::= - RETURN expression_opt SEMICOLON - ; -throw_statement ::= - THROW expression SEMICOLON - ; -synchronized_statement ::= - SYNCHRONIZED LPAREN expression RPAREN block - ; -try_statement ::= - TRY block catches - | TRY block catches_opt finally - ; -catches_opt ::= - | catches - ; -catches ::= catch_clause - | catches catch_clause - ; -catch_clause ::= - CATCH LPAREN formal_parameter RPAREN block - ; -finally ::= FINALLY block - ; - -// 19.12) Expressions -primary ::= primary_no_new_array - | array_creation_expression - ; -primary_no_new_array ::= - literal - | THIS - | LPAREN expression RPAREN - | class_instance_creation_expression - | field_access - | method_invocation - | array_access - ; -class_instance_creation_expression ::= - NEW class_type LPAREN argument_list_opt RPAREN - ; -argument_list_opt ::= - | argument_list - ; -argument_list ::= - expression - | argument_list COMMA expression - ; -array_creation_expression ::= - NEW primitive_type dim_exprs dims_opt - | NEW class_or_interface_type dim_exprs dims_opt - ; -dim_exprs ::= dim_expr - | dim_exprs dim_expr - ; -dim_expr ::= LBRACK expression RBRACK - ; -dims_opt ::= - | dims - ; -dims ::= LBRACK RBRACK - | dims LBRACK RBRACK - ; -field_access ::= - primary DOT IDENTIFIER - | SUPER DOT IDENTIFIER - ; -method_invocation ::= - name LPAREN argument_list_opt RPAREN - | primary DOT IDENTIFIER LPAREN argument_list_opt RPAREN - | SUPER DOT IDENTIFIER LPAREN argument_list_opt RPAREN - ; -array_access ::= - name LBRACK expression RBRACK - | primary_no_new_array LBRACK expression RBRACK - ; -postfix_expression ::= - primary - | name - | postincrement_expression - | postdecrement_expression - ; -postincrement_expression ::= - postfix_expression PLUSPLUS - ; -postdecrement_expression ::= - postfix_expression MINUSMINUS - ; -unary_expression ::= - preincrement_expression - | predecrement_expression - | PLUS unary_expression - | MINUS unary_expression - | unary_expression_not_plus_minus - ; -preincrement_expression ::= - PLUSPLUS unary_expression - ; -predecrement_expression ::= - MINUSMINUS unary_expression - ; -unary_expression_not_plus_minus ::= - postfix_expression - | COMP unary_expression - | NOT unary_expression - | cast_expression - ; -cast_expression ::= - LPAREN primitive_type dims_opt RPAREN unary_expression - | LPAREN expression RPAREN unary_expression_not_plus_minus - | LPAREN name dims RPAREN unary_expression_not_plus_minus - ; -multiplicative_expression ::= - unary_expression - | multiplicative_expression MULT unary_expression - | multiplicative_expression DIV unary_expression - | multiplicative_expression MOD unary_expression - ; -additive_expression ::= - multiplicative_expression - | additive_expression PLUS multiplicative_expression - | additive_expression MINUS multiplicative_expression - ; -shift_expression ::= - additive_expression - | shift_expression LSHIFT additive_expression - | shift_expression RSHIFT additive_expression - | shift_expression URSHIFT additive_expression - ; -relational_expression ::= - shift_expression - | relational_expression LT shift_expression - | relational_expression GT shift_expression - | relational_expression LTEQ shift_expression - | relational_expression GTEQ shift_expression - | relational_expression INSTANCEOF reference_type - ; -equality_expression ::= - relational_expression - | equality_expression EQEQ relational_expression - | equality_expression NOTEQ relational_expression - ; -and_expression ::= - equality_expression - | and_expression AND equality_expression - ; -exclusive_or_expression ::= - and_expression - | exclusive_or_expression XOR and_expression - ; -inclusive_or_expression ::= - exclusive_or_expression - | inclusive_or_expression OR exclusive_or_expression - ; -conditional_and_expression ::= - inclusive_or_expression - | conditional_and_expression ANDAND inclusive_or_expression - ; -conditional_or_expression ::= - conditional_and_expression - | conditional_or_expression OROR conditional_and_expression - ; -conditional_expression ::= - conditional_or_expression - | conditional_or_expression QUESTION expression - COLON conditional_expression - ; -assignment_expression ::= - conditional_expression - | assignment - ; -assignment ::= left_hand_side assignment_operator assignment_expression - ; -left_hand_side ::= - name - | field_access - | array_access - ; -assignment_operator ::= - EQ - | MULTEQ - | DIVEQ - | MODEQ - | PLUSEQ - | MINUSEQ - | LSHIFTEQ - | RSHIFTEQ - | URSHIFTEQ - | ANDEQ - | XOREQ - | OREQ - ; -expression_opt ::= - | expression - ; -expression ::= assignment_expression - ; -constant_expression ::= - expression - ; diff --git a/Robust/JavaGrammar/Parse/java11.cup b/Robust/JavaGrammar/Parse/java11.cup deleted file mode 100644 index 5d62ab08..00000000 --- a/Robust/JavaGrammar/Parse/java11.cup +++ /dev/null @@ -1,862 +0,0 @@ -package Parse; - -import java_cup.runtime.*; - -/* Java 1.1 parser for CUP. - * Copyright (C) 1998-2003 C. Scott Ananian - * This program is released under the terms of the GPL; see the file - * COPYING for more details. There is NO WARRANTY on this code. - */ - -/* -JDK 1.1 Features added: - instance initializers - anonymous array expressions. - class literals. - blank finals; final local variables. - inner classes: - block ::= class/interface decl - primary_no_new_array ::= class_name DOT THIS - class_instance_creation_expresion ::= ... - explicit_constructor_invocation ::= ... -*/ -parser code {: - Lexer lexer; - - public Grm11(Lexer l) { - this(); - lexer=l; - } - - public void syntax_error(java_cup.runtime.Symbol current) { - report_error("Syntax error (" + current.sym + ")", current); - } - public void report_error(String message, java_cup.runtime.Symbol info) { - lexer.errorMsg(message, info); - } -:}; - -scan with {: return lexer.nextToken(); :}; - -terminal BOOLEAN; // primitive_type -terminal BYTE, SHORT, INT, LONG, CHAR; // integral_type -terminal FLOAT, DOUBLE; // floating_point_type -terminal LBRACK, RBRACK; // array_type -terminal java.lang.String IDENTIFIER; // name -terminal DOT; // qualified_name -terminal SEMICOLON, MULT, COMMA, LBRACE, RBRACE, EQ, LPAREN, RPAREN, COLON; -terminal PACKAGE; // package_declaration -terminal IMPORT; // import_declaration -terminal PUBLIC, PROTECTED, PRIVATE; // modifier -terminal STATIC; // modifier -terminal ABSTRACT, FINAL, NATIVE, SYNCHRONIZED, TRANSIENT, VOLATILE; -terminal CLASS; // class_declaration -terminal EXTENDS; // super -terminal IMPLEMENTS; // interfaces -terminal VOID; // method_header -terminal THROWS; // throws -terminal THIS, SUPER; // explicit_constructor_invocation -terminal INTERFACE; // interface_declaration -terminal IF, ELSE; // if_then_statement, if_then_else_statement -terminal SWITCH; // switch_statement -terminal CASE, DEFAULT; // switch_label -terminal DO, WHILE; // while_statement, do_statement -terminal FOR; // for_statement -terminal BREAK; // break_statement -terminal CONTINUE; // continue_statement -terminal RETURN; // return_statement -terminal THROW; // throw_statement -terminal TRY; // try_statement -terminal CATCH; // catch_clause -terminal FINALLY; // finally -terminal NEW; // class_instance_creation_expression -terminal PLUSPLUS; // postincrement_expression -terminal MINUSMINUS; // postdecrement_expression -terminal PLUS, MINUS, COMP, NOT, DIV, MOD; -terminal LSHIFT, RSHIFT, URSHIFT; // shift_expression -terminal LT, GT, LTEQ, GTEQ, INSTANCEOF; // relational_expression -terminal EQEQ, NOTEQ; // equality_expression -terminal AND; // and_expression -terminal XOR; // exclusive_or_expression -terminal OR; // inclusive_or_expression -terminal ANDAND; // conditional_and_expression -terminal OROR; // conditional_or_expression -terminal QUESTION; // conditional_expression -terminal MULTEQ, DIVEQ, MODEQ, PLUSEQ, MINUSEQ; // assignment_operator -terminal LSHIFTEQ, RSHIFTEQ, URSHIFTEQ; // assignment_operator -terminal ANDEQ, XOREQ, OREQ; // assignment_operator - -terminal java.lang.Number INTEGER_LITERAL; -terminal java.lang.Number FLOATING_POINT_LITERAL; -terminal java.lang.Boolean BOOLEAN_LITERAL; -terminal java.lang.Character CHARACTER_LITERAL; -terminal java.lang.String STRING_LITERAL; -terminal NULL_LITERAL; - -// Reserved but unused: -terminal CONST, GOTO; -// lexer compatibility with Java 1.2: -terminal STRICTFP; -// lexer compatibility with Java 1.4 -terminal ASSERT; -// lexer compatibility with Java 1.5 -terminal ELLIPSIS; -terminal ENUM; - -// 19.2) The Syntactic Grammar -non terminal goal; -// 19.3) Lexical Structure -non terminal literal; -// 19.4) Types, Values, and Variables -non terminal type, primitive_type, numeric_type; -non terminal integral_type, floating_point_type; -non terminal reference_type; -non terminal class_or_interface_type; -non terminal class_type, interface_type; -non terminal array_type; -// 19.5) Names -non terminal name, simple_name, qualified_name; -// 19.6) Packages -non terminal compilation_unit; -non terminal package_declaration_opt, package_declaration; -non terminal import_declarations_opt, import_declarations; -non terminal type_declarations_opt, type_declarations; -non terminal import_declaration; -non terminal single_type_import_declaration; -non terminal type_import_on_demand_declaration; -non terminal type_declaration; -// 19.7) Productions used only in the LALR(1) grammar -non terminal modifiers_opt, modifiers, modifier; -// 19.8.1) Class Declaration -non terminal class_declaration, super, super_opt; -non terminal interfaces, interfaces_opt, interface_type_list; -non terminal class_body; -non terminal class_body_declarations, class_body_declarations_opt; -non terminal class_body_declaration, class_member_declaration; -// 19.8.2) Field Declarations -non terminal field_declaration, variable_declarators, variable_declarator; -non terminal variable_declarator_id, variable_initializer; -// 19.8.3) Method Declarations -non terminal method_declaration, method_header, method_declarator; -non terminal formal_parameter_list_opt, formal_parameter_list; -non terminal formal_parameter; -non terminal throws_opt, throws; -non terminal class_type_list, method_body; -// 19.8.4) Static Initializers -non terminal static_initializer; -// 19.8.5) Constructor Declarations -non terminal constructor_declaration, constructor_declarator; -non terminal constructor_body; -non terminal explicit_constructor_invocation; -// 19.9.1) Interface Declarations -non terminal interface_declaration; -non terminal extends_interfaces_opt, extends_interfaces; -non terminal interface_body; -non terminal interface_member_declarations_opt, interface_member_declarations; -non terminal interface_member_declaration, constant_declaration; -non terminal abstract_method_declaration; -// 19.10) Arrays -non terminal array_initializer; -non terminal variable_initializers; -// 19.11) Blocks and Statements -non terminal block; -non terminal block_statements_opt, block_statements, block_statement; -non terminal local_variable_declaration_statement, local_variable_declaration; -non terminal statement, statement_no_short_if; -non terminal statement_without_trailing_substatement; -non terminal empty_statement; -non terminal labeled_statement, labeled_statement_no_short_if; -non terminal expression_statement, statement_expression; -non terminal if_then_statement; -non terminal if_then_else_statement, if_then_else_statement_no_short_if; -non terminal switch_statement, switch_block; -non terminal switch_block_statement_groups; -non terminal switch_block_statement_group; -non terminal switch_labels, switch_label; -non terminal while_statement, while_statement_no_short_if; -non terminal do_statement; -non terminal for_statement, for_statement_no_short_if; -non terminal for_init_opt, for_init; -non terminal for_update_opt, for_update; -non terminal statement_expression_list; -non terminal identifier_opt; -non terminal break_statement, continue_statement; -non terminal return_statement, throw_statement; -non terminal synchronized_statement, try_statement; -non terminal catches_opt, catches, catch_clause; -non terminal finally; -// 19.12) Expressions -non terminal primary, primary_no_new_array; -non terminal class_instance_creation_expression; -non terminal argument_list_opt, argument_list; -non terminal array_creation_expression; -non terminal dim_exprs, dim_expr, dims_opt, dims; -non terminal field_access, method_invocation, array_access; -non terminal postfix_expression; -non terminal postincrement_expression, postdecrement_expression; -non terminal unary_expression, unary_expression_not_plus_minus; -non terminal preincrement_expression, predecrement_expression; -non terminal cast_expression; -non terminal multiplicative_expression, additive_expression; -non terminal shift_expression, relational_expression, equality_expression; -non terminal and_expression, exclusive_or_expression, inclusive_or_expression; -non terminal conditional_and_expression, conditional_or_expression; -non terminal conditional_expression, assignment_expression; -non terminal assignment; -non terminal left_hand_side; -non terminal assignment_operator; -non terminal expression_opt, expression; -non terminal constant_expression; - -start with goal; - -// 19.2) The Syntactic Grammar -goal ::= compilation_unit - ; - -// 19.3) Lexical Structure. -literal ::= INTEGER_LITERAL - | FLOATING_POINT_LITERAL - | BOOLEAN_LITERAL - | CHARACTER_LITERAL - | STRING_LITERAL - | NULL_LITERAL - ; - -// 19.4) Types, Values, and Variables -type ::= primitive_type - | reference_type - ; -primitive_type ::= - numeric_type - | BOOLEAN - ; -numeric_type::= integral_type - | floating_point_type - ; -integral_type ::= - BYTE - | SHORT - | INT - | LONG - | CHAR - ; -floating_point_type ::= - FLOAT - | DOUBLE - ; - -reference_type ::= - class_or_interface_type - | array_type - ; -class_or_interface_type ::= name; - -class_type ::= class_or_interface_type; -interface_type ::= class_or_interface_type; - -array_type ::= primitive_type dims - | name dims - ; - -// 19.5) Names -name ::= simple_name - | qualified_name - ; -simple_name ::= IDENTIFIER - ; -qualified_name ::= - name DOT IDENTIFIER - ; - -// 19.6) Packages -compilation_unit ::= - package_declaration_opt - import_declarations_opt - type_declarations_opt - ; -package_declaration_opt ::= package_declaration | ; -import_declarations_opt ::= import_declarations | ; -type_declarations_opt ::= type_declarations | ; - -import_declarations ::= - import_declaration - | import_declarations import_declaration - ; -type_declarations ::= - type_declaration - | type_declarations type_declaration - ; -package_declaration ::= - PACKAGE name SEMICOLON - ; -import_declaration ::= - single_type_import_declaration - | type_import_on_demand_declaration - ; -single_type_import_declaration ::= - IMPORT name SEMICOLON - ; -type_import_on_demand_declaration ::= - IMPORT name DOT MULT SEMICOLON - ; -type_declaration ::= - class_declaration - | interface_declaration - | SEMICOLON - ; - -// 19.7) Productions used only in the LALR(1) grammar -modifiers_opt::= - | modifiers - ; -modifiers ::= modifier - | modifiers modifier - ; -modifier ::= PUBLIC | PROTECTED | PRIVATE - | STATIC - | ABSTRACT | FINAL | NATIVE | SYNCHRONIZED | TRANSIENT | VOLATILE - ; - -// 19.8) Classes - -// 19.8.1) Class Declaration: -class_declaration ::= - modifiers_opt CLASS IDENTIFIER super_opt interfaces_opt class_body - ; -super ::= EXTENDS class_type - ; -super_opt ::= - | super - ; -interfaces ::= IMPLEMENTS interface_type_list - ; -interfaces_opt::= - | interfaces - ; -interface_type_list ::= - interface_type - | interface_type_list COMMA interface_type - ; -class_body ::= LBRACE class_body_declarations_opt RBRACE - ; -class_body_declarations_opt ::= - | class_body_declarations ; -class_body_declarations ::= - class_body_declaration - | class_body_declarations class_body_declaration - ; -class_body_declaration ::= - class_member_declaration - | static_initializer - | constructor_declaration - | block - ; -class_member_declaration ::= - field_declaration - | method_declaration - /* repeat the prod for 'class_declaration' here: */ - | modifiers_opt CLASS IDENTIFIER super_opt interfaces_opt class_body - | interface_declaration - | SEMICOLON - ; - -// 19.8.2) Field Declarations -field_declaration ::= - modifiers_opt type variable_declarators SEMICOLON - ; -variable_declarators ::= - variable_declarator - | variable_declarators COMMA variable_declarator - ; -variable_declarator ::= - variable_declarator_id - | variable_declarator_id EQ variable_initializer - ; -variable_declarator_id ::= - IDENTIFIER - | variable_declarator_id LBRACK RBRACK - ; -variable_initializer ::= - expression - | array_initializer - ; - -// 19.8.3) Method Declarations -method_declaration ::= - method_header method_body - ; -method_header ::= - modifiers_opt type method_declarator throws_opt - | modifiers_opt VOID method_declarator throws_opt - ; -method_declarator ::= - IDENTIFIER LPAREN formal_parameter_list_opt RPAREN - | method_declarator LBRACK RBRACK - ; -formal_parameter_list_opt ::= - | formal_parameter_list - ; -formal_parameter_list ::= - formal_parameter - | formal_parameter_list COMMA formal_parameter - ; -formal_parameter ::= - type variable_declarator_id - | FINAL type variable_declarator_id - ; -throws_opt ::= - | throws - ; -throws ::= THROWS class_type_list - ; -class_type_list ::= - class_type - | class_type_list COMMA class_type - ; -method_body ::= block - | SEMICOLON - ; - -// 19.8.4) Static Initializers -static_initializer ::= - STATIC block - ; - -// 19.8.5) Constructor Declarations -constructor_declaration ::= - modifiers_opt constructor_declarator throws_opt - constructor_body - ; -constructor_declarator ::= - simple_name LPAREN formal_parameter_list_opt RPAREN - ; -constructor_body ::= - LBRACE explicit_constructor_invocation - block_statements RBRACE - | LBRACE explicit_constructor_invocation RBRACE - | LBRACE block_statements RBRACE - | LBRACE RBRACE - ; -explicit_constructor_invocation ::= - THIS LPAREN argument_list_opt RPAREN SEMICOLON - | SUPER LPAREN argument_list_opt RPAREN SEMICOLON - | primary DOT SUPER LPAREN argument_list_opt RPAREN SEMICOLON - ; - -// 19.9) Interfaces - -// 19.9.1) Interface Declarations -interface_declaration ::= - modifiers_opt INTERFACE IDENTIFIER extends_interfaces_opt - interface_body - ; -extends_interfaces_opt ::= - | extends_interfaces - ; -extends_interfaces ::= - EXTENDS interface_type - | extends_interfaces COMMA interface_type - ; -interface_body ::= - LBRACE interface_member_declarations_opt RBRACE - ; -interface_member_declarations_opt ::= - | interface_member_declarations - ; -interface_member_declarations ::= - interface_member_declaration - | interface_member_declarations interface_member_declaration - ; -interface_member_declaration ::= - constant_declaration - | abstract_method_declaration - | class_declaration - | interface_declaration - | SEMICOLON - ; -constant_declaration ::= - field_declaration - // need to semantically check that modifiers of field declaration - // include only PUBLIC, STATIC, or FINAL. Other modifiers are - // disallowed. - ; -abstract_method_declaration ::= - method_header SEMICOLON - ; - -// 19.10) Arrays -array_initializer ::= - LBRACE variable_initializers COMMA RBRACE - | LBRACE variable_initializers RBRACE - | LBRACE COMMA RBRACE - | LBRACE RBRACE - ; -variable_initializers ::= - variable_initializer - | variable_initializers COMMA variable_initializer - ; - -// 19.11) Blocks and Statements -block ::= LBRACE block_statements_opt RBRACE - ; -block_statements_opt ::= - | block_statements - ; -block_statements ::= - block_statement - | block_statements block_statement - ; -block_statement ::= - local_variable_declaration_statement - | statement - | class_declaration - | interface_declaration - ; -local_variable_declaration_statement ::= - local_variable_declaration SEMICOLON - ; -local_variable_declaration ::= - type variable_declarators - | FINAL type variable_declarators - ; -statement ::= statement_without_trailing_substatement - | labeled_statement - | if_then_statement - | if_then_else_statement - | while_statement - | for_statement - ; -statement_no_short_if ::= - statement_without_trailing_substatement - | labeled_statement_no_short_if - | if_then_else_statement_no_short_if - | while_statement_no_short_if - | for_statement_no_short_if - ; -statement_without_trailing_substatement ::= - block - | empty_statement - | expression_statement - | switch_statement - | do_statement - | break_statement - | continue_statement - | return_statement - | synchronized_statement - | throw_statement - | try_statement - ; -empty_statement ::= - SEMICOLON - ; -labeled_statement ::= - IDENTIFIER COLON statement - ; -labeled_statement_no_short_if ::= - IDENTIFIER COLON statement_no_short_if - ; -expression_statement ::= - statement_expression SEMICOLON - ; -statement_expression ::= - assignment - | preincrement_expression - | predecrement_expression - | postincrement_expression - | postdecrement_expression - | method_invocation - | class_instance_creation_expression - ; -if_then_statement ::= - IF LPAREN expression RPAREN statement - ; -if_then_else_statement ::= - IF LPAREN expression RPAREN statement_no_short_if - ELSE statement - ; -if_then_else_statement_no_short_if ::= - IF LPAREN expression RPAREN statement_no_short_if - ELSE statement_no_short_if - ; -switch_statement ::= - SWITCH LPAREN expression RPAREN switch_block - ; -switch_block ::= - LBRACE switch_block_statement_groups switch_labels RBRACE - | LBRACE switch_block_statement_groups RBRACE - | LBRACE switch_labels RBRACE - | LBRACE RBRACE - ; -switch_block_statement_groups ::= - switch_block_statement_group - | switch_block_statement_groups switch_block_statement_group - ; -switch_block_statement_group ::= - switch_labels block_statements - ; -switch_labels ::= - switch_label - | switch_labels switch_label - ; -switch_label ::= - CASE constant_expression COLON - | DEFAULT COLON - ; - -while_statement ::= - WHILE LPAREN expression RPAREN statement - ; -while_statement_no_short_if ::= - WHILE LPAREN expression RPAREN statement_no_short_if - ; -do_statement ::= - DO statement WHILE LPAREN expression RPAREN SEMICOLON - ; -for_statement ::= - FOR LPAREN for_init_opt SEMICOLON expression_opt SEMICOLON - for_update_opt RPAREN statement - ; -for_statement_no_short_if ::= - FOR LPAREN for_init_opt SEMICOLON expression_opt SEMICOLON - for_update_opt RPAREN statement_no_short_if - ; -for_init_opt ::= - | for_init - ; -for_init ::= statement_expression_list - | local_variable_declaration - ; -for_update_opt ::= - | for_update - ; -for_update ::= statement_expression_list - ; -statement_expression_list ::= - statement_expression - | statement_expression_list COMMA statement_expression - ; - -identifier_opt ::= - | IDENTIFIER - ; - -break_statement ::= - BREAK identifier_opt SEMICOLON - ; - -continue_statement ::= - CONTINUE identifier_opt SEMICOLON - ; -return_statement ::= - RETURN expression_opt SEMICOLON - ; -throw_statement ::= - THROW expression SEMICOLON - ; -synchronized_statement ::= - SYNCHRONIZED LPAREN expression RPAREN block - ; -try_statement ::= - TRY block catches - | TRY block catches_opt finally - ; -catches_opt ::= - | catches - ; -catches ::= catch_clause - | catches catch_clause - ; -catch_clause ::= - CATCH LPAREN formal_parameter RPAREN block - ; -finally ::= FINALLY block - ; - -// 19.12) Expressions -primary ::= primary_no_new_array - | array_creation_expression - ; -primary_no_new_array ::= - literal - | THIS - | LPAREN expression RPAREN - | class_instance_creation_expression - | field_access - | method_invocation - | array_access - | primitive_type DOT CLASS - | VOID DOT CLASS - | array_type DOT CLASS - | name DOT CLASS - | name DOT THIS - ; -class_instance_creation_expression ::= - NEW class_type LPAREN argument_list_opt RPAREN - | NEW class_type LPAREN argument_list_opt RPAREN class_body - | primary DOT NEW IDENTIFIER - LPAREN argument_list_opt RPAREN - | primary DOT NEW IDENTIFIER - LPAREN argument_list_opt RPAREN class_body - ; -argument_list_opt ::= - | argument_list - ; -argument_list ::= - expression - | argument_list COMMA expression - ; -array_creation_expression ::= - NEW primitive_type dim_exprs dims_opt - | NEW class_or_interface_type dim_exprs dims_opt - | NEW primitive_type dims array_initializer - | NEW class_or_interface_type dims array_initializer - ; -dim_exprs ::= dim_expr - | dim_exprs dim_expr - ; -dim_expr ::= LBRACK expression RBRACK - ; -dims_opt ::= - | dims - ; -dims ::= LBRACK RBRACK - | dims LBRACK RBRACK - ; -field_access ::= - primary DOT IDENTIFIER - | SUPER DOT IDENTIFIER - ; -method_invocation ::= - name LPAREN argument_list_opt RPAREN - | primary DOT IDENTIFIER LPAREN argument_list_opt RPAREN - | SUPER DOT IDENTIFIER LPAREN argument_list_opt RPAREN - ; -array_access ::= - name LBRACK expression RBRACK - | primary_no_new_array LBRACK expression RBRACK - ; -postfix_expression ::= - primary - | name - | postincrement_expression - | postdecrement_expression - ; -postincrement_expression ::= - postfix_expression PLUSPLUS - ; -postdecrement_expression ::= - postfix_expression MINUSMINUS - ; -unary_expression ::= - preincrement_expression - | predecrement_expression - | PLUS unary_expression - | MINUS unary_expression - | unary_expression_not_plus_minus - ; -preincrement_expression ::= - PLUSPLUS unary_expression - ; -predecrement_expression ::= - MINUSMINUS unary_expression - ; -unary_expression_not_plus_minus ::= - postfix_expression - | COMP unary_expression - | NOT unary_expression - | cast_expression - ; -cast_expression ::= - LPAREN primitive_type dims_opt RPAREN unary_expression - | LPAREN expression RPAREN unary_expression_not_plus_minus - | LPAREN name dims RPAREN unary_expression_not_plus_minus - ; -multiplicative_expression ::= - unary_expression - | multiplicative_expression MULT unary_expression - | multiplicative_expression DIV unary_expression - | multiplicative_expression MOD unary_expression - ; -additive_expression ::= - multiplicative_expression - | additive_expression PLUS multiplicative_expression - | additive_expression MINUS multiplicative_expression - ; -shift_expression ::= - additive_expression - | shift_expression LSHIFT additive_expression - | shift_expression RSHIFT additive_expression - | shift_expression URSHIFT additive_expression - ; -relational_expression ::= - shift_expression - | relational_expression LT shift_expression - | relational_expression GT shift_expression - | relational_expression LTEQ shift_expression - | relational_expression GTEQ shift_expression - | relational_expression INSTANCEOF reference_type - ; -equality_expression ::= - relational_expression - | equality_expression EQEQ relational_expression - | equality_expression NOTEQ relational_expression - ; -and_expression ::= - equality_expression - | and_expression AND equality_expression - ; -exclusive_or_expression ::= - and_expression - | exclusive_or_expression XOR and_expression - ; -inclusive_or_expression ::= - exclusive_or_expression - | inclusive_or_expression OR exclusive_or_expression - ; -conditional_and_expression ::= - inclusive_or_expression - | conditional_and_expression ANDAND inclusive_or_expression - ; -conditional_or_expression ::= - conditional_and_expression - | conditional_or_expression OROR conditional_and_expression - ; -conditional_expression ::= - conditional_or_expression - | conditional_or_expression QUESTION expression - COLON conditional_expression - ; -assignment_expression ::= - conditional_expression - | assignment - ; -assignment ::= left_hand_side assignment_operator assignment_expression - ; -left_hand_side ::= - name - | field_access - | array_access - ; -assignment_operator ::= - EQ - | MULTEQ - | DIVEQ - | MODEQ - | PLUSEQ - | MINUSEQ - | LSHIFTEQ - | RSHIFTEQ - | URSHIFTEQ - | ANDEQ - | XOREQ - | OREQ - ; -expression_opt ::= - | expression - ; -expression ::= assignment_expression - ; -constant_expression ::= - expression - ; diff --git a/Robust/JavaGrammar/Parse/java12.cup b/Robust/JavaGrammar/Parse/java12.cup deleted file mode 100644 index 3601be80..00000000 --- a/Robust/JavaGrammar/Parse/java12.cup +++ /dev/null @@ -1,874 +0,0 @@ -package Parse; - -import java_cup.runtime.*; - -/* Java 1.2 parser for CUP. - * Copyright (C) 1998-2003 C. Scott Ananian - * This program is released under the terms of the GPL; see the file - * COPYING for more details. There is NO WARRANTY on this code. - */ - -/* -JDK 1.2 Features added: - strictfp modifier. - explicit_constructor_invocation ::= ... - | primary DOT THIS LPAREN argument_list_opt RPAREN SEMICOLON ; - field_access ::= ... - | name DOT SUPER DOT IDENTIFIER ; - method_invocation ::= ... - | name DOT SUPER DOT IDENTIFIER LPAREN argument_list_opt RPAREN ; - parenthesized expression, plain identifiers qualifying instance - creation and explicit constructors, and array creation expression - fixes from JLS2 (thanks to Eric Blake for pointing these out) -*/ -parser code {: - Lexer lexer; - - public Grm12(Lexer l) { - this(); - lexer=l; - } - - public void syntax_error(java_cup.runtime.Symbol current) { - report_error("Syntax error (" + current.sym + ")", current); - } - public void report_error(String message, java_cup.runtime.Symbol info) { - lexer.errorMsg(message, info); - } -:}; - -scan with {: return lexer.nextToken(); :}; - -terminal BOOLEAN; // primitive_type -terminal BYTE, SHORT, INT, LONG, CHAR; // integral_type -terminal FLOAT, DOUBLE; // floating_point_type -terminal LBRACK, RBRACK; // array_type -terminal java.lang.String IDENTIFIER; // name -terminal DOT; // qualified_name -terminal SEMICOLON, MULT, COMMA, LBRACE, RBRACE, EQ, LPAREN, RPAREN, COLON; -terminal PACKAGE; // package_declaration -terminal IMPORT; // import_declaration -terminal PUBLIC, PROTECTED, PRIVATE; // modifier -terminal STATIC; // modifier -terminal ABSTRACT, FINAL, NATIVE, SYNCHRONIZED, TRANSIENT, VOLATILE; -terminal CLASS; // class_declaration -terminal EXTENDS; // super -terminal IMPLEMENTS; // interfaces -terminal VOID; // method_header -terminal THROWS; // throws -terminal THIS, SUPER; // explicit_constructor_invocation -terminal INTERFACE; // interface_declaration -terminal IF, ELSE; // if_then_statement, if_then_else_statement -terminal SWITCH; // switch_statement -terminal CASE, DEFAULT; // switch_label -terminal DO, WHILE; // while_statement, do_statement -terminal FOR; // for_statement -terminal BREAK; // break_statement -terminal CONTINUE; // continue_statement -terminal RETURN; // return_statement -terminal THROW; // throw_statement -terminal TRY; // try_statement -terminal CATCH; // catch_clause -terminal FINALLY; // finally -terminal NEW; // class_instance_creation_expression -terminal PLUSPLUS; // postincrement_expression -terminal MINUSMINUS; // postdecrement_expression -terminal PLUS, MINUS, COMP, NOT, DIV, MOD; -terminal LSHIFT, RSHIFT, URSHIFT; // shift_expression -terminal LT, GT, LTEQ, GTEQ, INSTANCEOF; // relational_expression -terminal EQEQ, NOTEQ; // equality_expression -terminal AND; // and_expression -terminal XOR; // exclusive_or_expression -terminal OR; // inclusive_or_expression -terminal ANDAND; // conditional_and_expression -terminal OROR; // conditional_or_expression -terminal QUESTION; // conditional_expression -terminal MULTEQ, DIVEQ, MODEQ, PLUSEQ, MINUSEQ; // assignment_operator -terminal LSHIFTEQ, RSHIFTEQ, URSHIFTEQ; // assignment_operator -terminal ANDEQ, XOREQ, OREQ; // assignment_operator - -terminal java.lang.Number INTEGER_LITERAL; -terminal java.lang.Number FLOATING_POINT_LITERAL; -terminal java.lang.Boolean BOOLEAN_LITERAL; -terminal java.lang.Character CHARACTER_LITERAL; -terminal java.lang.String STRING_LITERAL; -terminal NULL_LITERAL; - -// Reserved but unused: -terminal CONST, GOTO; -// strictfp keyword, new in Java 1.2 -terminal STRICTFP; -// lexer compatibility with Java 1.4 -terminal ASSERT; -// lexer compatibility with Java 1.5 -terminal ELLIPSIS; -terminal ENUM; - -// 19.2) The Syntactic Grammar -non terminal goal; -// 19.3) Lexical Structure -non terminal literal; -// 19.4) Types, Values, and Variables -non terminal type, primitive_type, numeric_type; -non terminal integral_type, floating_point_type; -non terminal reference_type; -non terminal class_or_interface_type; -non terminal class_type, interface_type; -non terminal array_type; -// 19.5) Names -non terminal name, simple_name, qualified_name; -// 19.6) Packages -non terminal compilation_unit; -non terminal package_declaration_opt, package_declaration; -non terminal import_declarations_opt, import_declarations; -non terminal type_declarations_opt, type_declarations; -non terminal import_declaration; -non terminal single_type_import_declaration; -non terminal type_import_on_demand_declaration; -non terminal type_declaration; -// 19.7) Productions used only in the LALR(1) grammar -non terminal modifiers_opt, modifiers, modifier; -// 19.8.1) Class Declaration -non terminal class_declaration, super, super_opt; -non terminal interfaces, interfaces_opt, interface_type_list; -non terminal class_body; -non terminal class_body_declarations, class_body_declarations_opt; -non terminal class_body_declaration, class_member_declaration; -// 19.8.2) Field Declarations -non terminal field_declaration, variable_declarators, variable_declarator; -non terminal variable_declarator_id, variable_initializer; -// 19.8.3) Method Declarations -non terminal method_declaration, method_header, method_declarator; -non terminal formal_parameter_list_opt, formal_parameter_list; -non terminal formal_parameter; -non terminal throws_opt, throws; -non terminal class_type_list, method_body; -// 19.8.4) Static Initializers -non terminal static_initializer; -// 19.8.5) Constructor Declarations -non terminal constructor_declaration, constructor_declarator; -non terminal constructor_body; -non terminal explicit_constructor_invocation; -// 19.9.1) Interface Declarations -non terminal interface_declaration; -non terminal extends_interfaces_opt, extends_interfaces; -non terminal interface_body; -non terminal interface_member_declarations_opt, interface_member_declarations; -non terminal interface_member_declaration, constant_declaration; -non terminal abstract_method_declaration; -// 19.10) Arrays -non terminal array_initializer; -non terminal variable_initializers; -// 19.11) Blocks and Statements -non terminal block; -non terminal block_statements_opt, block_statements, block_statement; -non terminal local_variable_declaration_statement, local_variable_declaration; -non terminal statement, statement_no_short_if; -non terminal statement_without_trailing_substatement; -non terminal empty_statement; -non terminal labeled_statement, labeled_statement_no_short_if; -non terminal expression_statement, statement_expression; -non terminal if_then_statement; -non terminal if_then_else_statement, if_then_else_statement_no_short_if; -non terminal switch_statement, switch_block; -non terminal switch_block_statement_groups; -non terminal switch_block_statement_group; -non terminal switch_labels, switch_label; -non terminal while_statement, while_statement_no_short_if; -non terminal do_statement; -non terminal for_statement, for_statement_no_short_if; -non terminal for_init_opt, for_init; -non terminal for_update_opt, for_update; -non terminal statement_expression_list; -non terminal identifier_opt; -non terminal break_statement, continue_statement; -non terminal return_statement, throw_statement; -non terminal synchronized_statement, try_statement; -non terminal catches_opt, catches, catch_clause; -non terminal finally; -// 19.12) Expressions -non terminal primary, primary_no_new_array; -non terminal class_instance_creation_expression; -non terminal argument_list_opt, argument_list; -non terminal array_creation_init, array_creation_uninit; -non terminal dim_exprs, dim_expr, dims_opt, dims; -non terminal field_access, method_invocation, array_access; -non terminal postfix_expression; -non terminal postincrement_expression, postdecrement_expression; -non terminal unary_expression, unary_expression_not_plus_minus; -non terminal preincrement_expression, predecrement_expression; -non terminal cast_expression; -non terminal multiplicative_expression, additive_expression; -non terminal shift_expression, relational_expression, equality_expression; -non terminal and_expression, exclusive_or_expression, inclusive_or_expression; -non terminal conditional_and_expression, conditional_or_expression; -non terminal conditional_expression, assignment_expression; -non terminal assignment; -non terminal assignment_operator; -non terminal expression_opt, expression; -non terminal constant_expression; - -start with goal; - -// 19.2) The Syntactic Grammar -goal ::= compilation_unit - ; - -// 19.3) Lexical Structure. -literal ::= INTEGER_LITERAL - | FLOATING_POINT_LITERAL - | BOOLEAN_LITERAL - | CHARACTER_LITERAL - | STRING_LITERAL - | NULL_LITERAL - ; - -// 19.4) Types, Values, and Variables -type ::= primitive_type - | reference_type - ; -primitive_type ::= - numeric_type - | BOOLEAN - ; -numeric_type::= integral_type - | floating_point_type - ; -integral_type ::= - BYTE - | SHORT - | INT - | LONG - | CHAR - ; -floating_point_type ::= - FLOAT - | DOUBLE - ; - -reference_type ::= - class_or_interface_type - | array_type - ; -class_or_interface_type ::= name; - -class_type ::= class_or_interface_type; -interface_type ::= class_or_interface_type; - -array_type ::= primitive_type dims - | name dims - ; - -// 19.5) Names -name ::= simple_name - | qualified_name - ; -simple_name ::= IDENTIFIER - ; -qualified_name ::= - name DOT IDENTIFIER - ; - -// 19.6) Packages -compilation_unit ::= - package_declaration_opt - import_declarations_opt - type_declarations_opt - ; -package_declaration_opt ::= package_declaration | ; -import_declarations_opt ::= import_declarations | ; -type_declarations_opt ::= type_declarations | ; - -import_declarations ::= - import_declaration - | import_declarations import_declaration - ; -type_declarations ::= - type_declaration - | type_declarations type_declaration - ; -package_declaration ::= - PACKAGE name SEMICOLON - ; -import_declaration ::= - single_type_import_declaration - | type_import_on_demand_declaration - ; -single_type_import_declaration ::= - IMPORT name SEMICOLON - ; -type_import_on_demand_declaration ::= - IMPORT name DOT MULT SEMICOLON - ; -type_declaration ::= - class_declaration - | interface_declaration - | SEMICOLON - ; - -// 19.7) Productions used only in the LALR(1) grammar -modifiers_opt::= - | modifiers - ; -modifiers ::= modifier - | modifiers modifier - ; -modifier ::= PUBLIC | PROTECTED | PRIVATE - | STATIC - | ABSTRACT | FINAL | NATIVE | SYNCHRONIZED | TRANSIENT | VOLATILE - | STRICTFP // note that semantic analysis must check that the - // context of the modifier allows strictfp. - ; - -// 19.8) Classes - -// 19.8.1) Class Declaration: -class_declaration ::= - modifiers_opt CLASS IDENTIFIER super_opt interfaces_opt class_body - ; -super ::= EXTENDS class_type - ; -super_opt ::= - | super - ; -interfaces ::= IMPLEMENTS interface_type_list - ; -interfaces_opt::= - | interfaces - ; -interface_type_list ::= - interface_type - | interface_type_list COMMA interface_type - ; -class_body ::= LBRACE class_body_declarations_opt RBRACE - ; -class_body_declarations_opt ::= - | class_body_declarations ; -class_body_declarations ::= - class_body_declaration - | class_body_declarations class_body_declaration - ; -class_body_declaration ::= - class_member_declaration - | static_initializer - | constructor_declaration - | block - ; -class_member_declaration ::= - field_declaration - | method_declaration - /* repeat the prod for 'class_declaration' here: */ - | modifiers_opt CLASS IDENTIFIER super_opt interfaces_opt class_body - | interface_declaration - | SEMICOLON - ; - -// 19.8.2) Field Declarations -field_declaration ::= - modifiers_opt type variable_declarators SEMICOLON - ; -variable_declarators ::= - variable_declarator - | variable_declarators COMMA variable_declarator - ; -variable_declarator ::= - variable_declarator_id - | variable_declarator_id EQ variable_initializer - ; -variable_declarator_id ::= - IDENTIFIER - | variable_declarator_id LBRACK RBRACK - ; -variable_initializer ::= - expression - | array_initializer - ; - -// 19.8.3) Method Declarations -method_declaration ::= - method_header method_body - ; -method_header ::= - modifiers_opt type method_declarator throws_opt - | modifiers_opt VOID method_declarator throws_opt - ; -method_declarator ::= - IDENTIFIER LPAREN formal_parameter_list_opt RPAREN - | method_declarator LBRACK RBRACK // deprecated - // be careful; the above production also allows 'void foo() []' - ; -formal_parameter_list_opt ::= - | formal_parameter_list - ; -formal_parameter_list ::= - formal_parameter - | formal_parameter_list COMMA formal_parameter - ; -formal_parameter ::= - type variable_declarator_id - | FINAL type variable_declarator_id - ; -throws_opt ::= - | throws - ; -throws ::= THROWS class_type_list - ; -class_type_list ::= - class_type - | class_type_list COMMA class_type - ; -method_body ::= block - | SEMICOLON - ; - -// 19.8.4) Static Initializers -static_initializer ::= - STATIC block - ; - -// 19.8.5) Constructor Declarations -constructor_declaration ::= - modifiers_opt constructor_declarator throws_opt - constructor_body - ; -constructor_declarator ::= - simple_name LPAREN formal_parameter_list_opt RPAREN - ; -constructor_body ::= - LBRACE explicit_constructor_invocation - block_statements RBRACE - | LBRACE explicit_constructor_invocation RBRACE - | LBRACE block_statements RBRACE - | LBRACE RBRACE - ; -explicit_constructor_invocation ::= - THIS LPAREN argument_list_opt RPAREN SEMICOLON - | SUPER LPAREN argument_list_opt RPAREN SEMICOLON - | primary DOT SUPER LPAREN argument_list_opt RPAREN SEMICOLON - | name DOT SUPER LPAREN argument_list_opt RPAREN SEMICOLON - ; - -// 19.9) Interfaces - -// 19.9.1) Interface Declarations -interface_declaration ::= - modifiers_opt INTERFACE IDENTIFIER extends_interfaces_opt - interface_body - ; -extends_interfaces_opt ::= - | extends_interfaces - ; -extends_interfaces ::= - EXTENDS interface_type - | extends_interfaces COMMA interface_type - ; -interface_body ::= - LBRACE interface_member_declarations_opt RBRACE - ; -interface_member_declarations_opt ::= - | interface_member_declarations - ; -interface_member_declarations ::= - interface_member_declaration - | interface_member_declarations interface_member_declaration - ; -interface_member_declaration ::= - constant_declaration - | abstract_method_declaration - | class_declaration - | interface_declaration - | SEMICOLON - ; -constant_declaration ::= - field_declaration - // need to semantically check that modifiers of field declaration - // include only PUBLIC, STATIC, or FINAL. Other modifiers are - // disallowed. - ; -abstract_method_declaration ::= - method_header SEMICOLON - ; - -// 19.10) Arrays -array_initializer ::= - LBRACE variable_initializers COMMA RBRACE - | LBRACE variable_initializers RBRACE - | LBRACE COMMA RBRACE - | LBRACE RBRACE - ; -variable_initializers ::= - variable_initializer - | variable_initializers COMMA variable_initializer - ; - -// 19.11) Blocks and Statements -block ::= LBRACE block_statements_opt RBRACE - ; -block_statements_opt ::= - | block_statements - ; -block_statements ::= - block_statement - | block_statements block_statement - ; -block_statement ::= - local_variable_declaration_statement - | statement - | class_declaration - | interface_declaration - ; -local_variable_declaration_statement ::= - local_variable_declaration SEMICOLON - ; -local_variable_declaration ::= - type variable_declarators - | FINAL type variable_declarators - ; -statement ::= statement_without_trailing_substatement - | labeled_statement - | if_then_statement - | if_then_else_statement - | while_statement - | for_statement - ; -statement_no_short_if ::= - statement_without_trailing_substatement - | labeled_statement_no_short_if - | if_then_else_statement_no_short_if - | while_statement_no_short_if - | for_statement_no_short_if - ; -statement_without_trailing_substatement ::= - block - | empty_statement - | expression_statement - | switch_statement - | do_statement - | break_statement - | continue_statement - | return_statement - | synchronized_statement - | throw_statement - | try_statement - ; -empty_statement ::= - SEMICOLON - ; -labeled_statement ::= - IDENTIFIER COLON statement - ; -labeled_statement_no_short_if ::= - IDENTIFIER COLON statement_no_short_if - ; -expression_statement ::= - statement_expression SEMICOLON - ; -statement_expression ::= - assignment - | preincrement_expression - | predecrement_expression - | postincrement_expression - | postdecrement_expression - | method_invocation - | class_instance_creation_expression - ; -if_then_statement ::= - IF LPAREN expression RPAREN statement - ; -if_then_else_statement ::= - IF LPAREN expression RPAREN statement_no_short_if - ELSE statement - ; -if_then_else_statement_no_short_if ::= - IF LPAREN expression RPAREN statement_no_short_if - ELSE statement_no_short_if - ; -switch_statement ::= - SWITCH LPAREN expression RPAREN switch_block - ; -switch_block ::= - LBRACE switch_block_statement_groups switch_labels RBRACE - | LBRACE switch_block_statement_groups RBRACE - | LBRACE switch_labels RBRACE - | LBRACE RBRACE - ; -switch_block_statement_groups ::= - switch_block_statement_group - | switch_block_statement_groups switch_block_statement_group - ; -switch_block_statement_group ::= - switch_labels block_statements - ; -switch_labels ::= - switch_label - | switch_labels switch_label - ; -switch_label ::= - CASE constant_expression COLON - | DEFAULT COLON - ; - -while_statement ::= - WHILE LPAREN expression RPAREN statement - ; -while_statement_no_short_if ::= - WHILE LPAREN expression RPAREN statement_no_short_if - ; -do_statement ::= - DO statement WHILE LPAREN expression RPAREN SEMICOLON - ; -for_statement ::= - FOR LPAREN for_init_opt SEMICOLON expression_opt SEMICOLON - for_update_opt RPAREN statement - ; -for_statement_no_short_if ::= - FOR LPAREN for_init_opt SEMICOLON expression_opt SEMICOLON - for_update_opt RPAREN statement_no_short_if - ; -for_init_opt ::= - | for_init - ; -for_init ::= statement_expression_list - | local_variable_declaration - ; -for_update_opt ::= - | for_update - ; -for_update ::= statement_expression_list - ; -statement_expression_list ::= - statement_expression - | statement_expression_list COMMA statement_expression - ; - -identifier_opt ::= - | IDENTIFIER - ; - -break_statement ::= - BREAK identifier_opt SEMICOLON - ; - -continue_statement ::= - CONTINUE identifier_opt SEMICOLON - ; -return_statement ::= - RETURN expression_opt SEMICOLON - ; -throw_statement ::= - THROW expression SEMICOLON - ; -synchronized_statement ::= - SYNCHRONIZED LPAREN expression RPAREN block - ; -try_statement ::= - TRY block catches - | TRY block catches_opt finally - ; -catches_opt ::= - | catches - ; -catches ::= catch_clause - | catches catch_clause - ; -catch_clause ::= - CATCH LPAREN formal_parameter RPAREN block - ; -finally ::= FINALLY block - ; - -// 19.12) Expressions -primary ::= primary_no_new_array - | array_creation_init - | array_creation_uninit - ; -primary_no_new_array ::= - literal - | THIS - | LPAREN expression RPAREN - | class_instance_creation_expression - | field_access - | method_invocation - | array_access - | primitive_type DOT CLASS - | VOID DOT CLASS - | array_type DOT CLASS - | name DOT CLASS - | name DOT THIS - ; -class_instance_creation_expression ::= - NEW class_or_interface_type LPAREN argument_list_opt RPAREN - | NEW class_or_interface_type LPAREN argument_list_opt RPAREN class_body - | primary DOT NEW IDENTIFIER - LPAREN argument_list_opt RPAREN - | primary DOT NEW IDENTIFIER - LPAREN argument_list_opt RPAREN class_body - | name DOT NEW IDENTIFIER - LPAREN argument_list_opt RPAREN - | name DOT NEW IDENTIFIER - LPAREN argument_list_opt RPAREN class_body - ; -argument_list_opt ::= - | argument_list - ; -argument_list ::= - expression - | argument_list COMMA expression - ; -array_creation_uninit ::= - NEW primitive_type dim_exprs dims_opt - | NEW class_or_interface_type dim_exprs dims_opt - ; -array_creation_init ::= - NEW primitive_type dims array_initializer - | NEW class_or_interface_type dims array_initializer - ; -dim_exprs ::= dim_expr - | dim_exprs dim_expr - ; -dim_expr ::= LBRACK expression RBRACK - ; -dims_opt ::= - | dims - ; -dims ::= LBRACK RBRACK - | dims LBRACK RBRACK - ; -field_access ::= - primary DOT IDENTIFIER - | SUPER DOT IDENTIFIER - | name DOT SUPER DOT IDENTIFIER - ; -method_invocation ::= - name LPAREN argument_list_opt RPAREN - | primary DOT IDENTIFIER LPAREN argument_list_opt RPAREN - | SUPER DOT IDENTIFIER LPAREN argument_list_opt RPAREN - | name DOT SUPER DOT IDENTIFIER LPAREN argument_list_opt RPAREN - ; -array_access ::= - name LBRACK expression RBRACK - | primary_no_new_array LBRACK expression RBRACK - | array_creation_init LBRACK expression RBRACK - ; -postfix_expression ::= - primary - | name - | postincrement_expression - | postdecrement_expression - ; -postincrement_expression ::= - postfix_expression PLUSPLUS - ; -postdecrement_expression ::= - postfix_expression MINUSMINUS - ; -unary_expression ::= - preincrement_expression - | predecrement_expression - | PLUS unary_expression - | MINUS unary_expression - | unary_expression_not_plus_minus - ; -preincrement_expression ::= - PLUSPLUS unary_expression - ; -predecrement_expression ::= - MINUSMINUS unary_expression - ; -unary_expression_not_plus_minus ::= - postfix_expression - | COMP unary_expression - | NOT unary_expression - | cast_expression - ; -cast_expression ::= - LPAREN primitive_type dims_opt RPAREN unary_expression - | LPAREN expression RPAREN unary_expression_not_plus_minus - | LPAREN name dims RPAREN unary_expression_not_plus_minus - ; -multiplicative_expression ::= - unary_expression - | multiplicative_expression MULT unary_expression - | multiplicative_expression DIV unary_expression - | multiplicative_expression MOD unary_expression - ; -additive_expression ::= - multiplicative_expression - | additive_expression PLUS multiplicative_expression - | additive_expression MINUS multiplicative_expression - ; -shift_expression ::= - additive_expression - | shift_expression LSHIFT additive_expression - | shift_expression RSHIFT additive_expression - | shift_expression URSHIFT additive_expression - ; -relational_expression ::= - shift_expression - | relational_expression LT shift_expression - | relational_expression GT shift_expression - | relational_expression LTEQ shift_expression - | relational_expression GTEQ shift_expression - | relational_expression INSTANCEOF reference_type - ; -equality_expression ::= - relational_expression - | equality_expression EQEQ relational_expression - | equality_expression NOTEQ relational_expression - ; -and_expression ::= - equality_expression - | and_expression AND equality_expression - ; -exclusive_or_expression ::= - and_expression - | exclusive_or_expression XOR and_expression - ; -inclusive_or_expression ::= - exclusive_or_expression - | inclusive_or_expression OR exclusive_or_expression - ; -conditional_and_expression ::= - inclusive_or_expression - | conditional_and_expression ANDAND inclusive_or_expression - ; -conditional_or_expression ::= - conditional_and_expression - | conditional_or_expression OROR conditional_and_expression - ; -conditional_expression ::= - conditional_or_expression - | conditional_or_expression QUESTION expression - COLON conditional_expression - ; -assignment_expression ::= - conditional_expression - | assignment - ; -// semantic check necessary here to ensure a valid left-hand side. -// allowing a parenthesized variable here on the lhs was introduced in -// JLS 2; thanks to Eric Blake for pointing this out. -assignment ::= postfix_expression assignment_operator assignment_expression - ; -assignment_operator ::= - EQ - | MULTEQ - | DIVEQ - | MODEQ - | PLUSEQ - | MINUSEQ - | LSHIFTEQ - | RSHIFTEQ - | URSHIFTEQ - | ANDEQ - | XOREQ - | OREQ - ; -expression_opt ::= - | expression - ; -expression ::= assignment_expression - ; -constant_expression ::= - expression - ; diff --git a/Robust/JavaGrammar/Parse/java14.cup b/Robust/JavaGrammar/Parse/java14.cup deleted file mode 100644 index c7fcfae0..00000000 --- a/Robust/JavaGrammar/Parse/java14.cup +++ /dev/null @@ -1,877 +0,0 @@ -package Parse; - -import java_cup.runtime.*; - -/* Java 1.4 parser for CUP. - * Copyright (C) 2002-2003 C. Scott Ananian - * This program is released under the terms of the GPL; see the file - * COPYING for more details. There is NO WARRANTY on this code. - */ - -/* -JDK 1.4 Features added: - assertion statement. - statement_without_trailing_substatement ::= ... - | assert_statement ; - assert_statement ::= - ASSERT expression SEMICOLON - | ASSERT expression COLON expression SEMICOLON - ; -*/ -parser code {: - Lexer lexer; - - public Grm14(Lexer l) { - this(); - lexer=l; - } - - public void syntax_error(java_cup.runtime.Symbol current) { - report_error("Syntax error (" + current.sym + ")", current); - } - public void report_error(String message, java_cup.runtime.Symbol info) { - lexer.errorMsg(message, info); - } -:}; - -scan with {: return lexer.nextToken(); :}; - -terminal BOOLEAN; // primitive_type -terminal BYTE, SHORT, INT, LONG, CHAR; // integral_type -terminal FLOAT, DOUBLE; // floating_point_type -terminal LBRACK, RBRACK; // array_type -terminal java.lang.String IDENTIFIER; // name -terminal DOT; // qualified_name -terminal SEMICOLON, MULT, COMMA, LBRACE, RBRACE, EQ, LPAREN, RPAREN, COLON; -terminal PACKAGE; // package_declaration -terminal IMPORT; // import_declaration -terminal PUBLIC, PROTECTED, PRIVATE; // modifier -terminal STATIC; // modifier -terminal ABSTRACT, FINAL, NATIVE, SYNCHRONIZED, TRANSIENT, VOLATILE; -terminal CLASS; // class_declaration -terminal EXTENDS; // super -terminal IMPLEMENTS; // interfaces -terminal VOID; // method_header -terminal THROWS; // throws -terminal THIS, SUPER; // explicit_constructor_invocation -terminal INTERFACE; // interface_declaration -terminal IF, ELSE; // if_then_statement, if_then_else_statement -terminal SWITCH; // switch_statement -terminal CASE, DEFAULT; // switch_label -terminal DO, WHILE; // while_statement, do_statement -terminal FOR; // for_statement -terminal BREAK; // break_statement -terminal CONTINUE; // continue_statement -terminal RETURN; // return_statement -terminal THROW; // throw_statement -terminal TRY; // try_statement -terminal CATCH; // catch_clause -terminal FINALLY; // finally -terminal NEW; // class_instance_creation_expression -terminal PLUSPLUS; // postincrement_expression -terminal MINUSMINUS; // postdecrement_expression -terminal PLUS, MINUS, COMP, NOT, DIV, MOD; -terminal LSHIFT, RSHIFT, URSHIFT; // shift_expression -terminal LT, GT, LTEQ, GTEQ, INSTANCEOF; // relational_expression -terminal EQEQ, NOTEQ; // equality_expression -terminal AND; // and_expression -terminal XOR; // exclusive_or_expression -terminal OR; // inclusive_or_expression -terminal ANDAND; // conditional_and_expression -terminal OROR; // conditional_or_expression -terminal QUESTION; // conditional_expression -terminal MULTEQ, DIVEQ, MODEQ, PLUSEQ, MINUSEQ; // assignment_operator -terminal LSHIFTEQ, RSHIFTEQ, URSHIFTEQ; // assignment_operator -terminal ANDEQ, XOREQ, OREQ; // assignment_operator - -terminal java.lang.Number INTEGER_LITERAL; -terminal java.lang.Number FLOATING_POINT_LITERAL; -terminal java.lang.Boolean BOOLEAN_LITERAL; -terminal java.lang.Character CHARACTER_LITERAL; -terminal java.lang.String STRING_LITERAL; -terminal NULL_LITERAL; - -// Reserved but unused: -terminal CONST, GOTO; -// strictfp keyword, new in Java 1.2 -terminal STRICTFP; -// assert keyword, new in Java 1.4 -terminal ASSERT; // assert_statement -// lexer compatibility with Java 1.5 -terminal ELLIPSIS; -terminal ENUM; - -// 19.2) The Syntactic Grammar -non terminal goal; -// 19.3) Lexical Structure -non terminal literal; -// 19.4) Types, Values, and Variables -non terminal type, primitive_type, numeric_type; -non terminal integral_type, floating_point_type; -non terminal reference_type; -non terminal class_or_interface_type; -non terminal class_type, interface_type; -non terminal array_type; -// 19.5) Names -non terminal name, simple_name, qualified_name; -// 19.6) Packages -non terminal compilation_unit; -non terminal package_declaration_opt, package_declaration; -non terminal import_declarations_opt, import_declarations; -non terminal type_declarations_opt, type_declarations; -non terminal import_declaration; -non terminal single_type_import_declaration; -non terminal type_import_on_demand_declaration; -non terminal type_declaration; -// 19.7) Productions used only in the LALR(1) grammar -non terminal modifiers_opt, modifiers, modifier; -// 19.8.1) Class Declaration -non terminal class_declaration, super, super_opt; -non terminal interfaces, interfaces_opt, interface_type_list; -non terminal class_body; -non terminal class_body_declarations, class_body_declarations_opt; -non terminal class_body_declaration, class_member_declaration; -// 19.8.2) Field Declarations -non terminal field_declaration, variable_declarators, variable_declarator; -non terminal variable_declarator_id, variable_initializer; -// 19.8.3) Method Declarations -non terminal method_declaration, method_header, method_declarator; -non terminal formal_parameter_list_opt, formal_parameter_list; -non terminal formal_parameter; -non terminal throws_opt, throws; -non terminal class_type_list, method_body; -// 19.8.4) Static Initializers -non terminal static_initializer; -// 19.8.5) Constructor Declarations -non terminal constructor_declaration, constructor_declarator; -non terminal constructor_body; -non terminal explicit_constructor_invocation; -// 19.9.1) Interface Declarations -non terminal interface_declaration; -non terminal extends_interfaces_opt, extends_interfaces; -non terminal interface_body; -non terminal interface_member_declarations_opt, interface_member_declarations; -non terminal interface_member_declaration, constant_declaration; -non terminal abstract_method_declaration; -// 19.10) Arrays -non terminal array_initializer; -non terminal variable_initializers; -// 19.11) Blocks and Statements -non terminal block; -non terminal block_statements_opt, block_statements, block_statement; -non terminal local_variable_declaration_statement, local_variable_declaration; -non terminal statement, statement_no_short_if; -non terminal statement_without_trailing_substatement; -non terminal empty_statement; -non terminal labeled_statement, labeled_statement_no_short_if; -non terminal expression_statement, statement_expression; -non terminal if_then_statement; -non terminal if_then_else_statement, if_then_else_statement_no_short_if; -non terminal switch_statement, switch_block; -non terminal switch_block_statement_groups; -non terminal switch_block_statement_group; -non terminal switch_labels, switch_label; -non terminal while_statement, while_statement_no_short_if; -non terminal do_statement; -non terminal for_statement, for_statement_no_short_if; -non terminal for_init_opt, for_init; -non terminal for_update_opt, for_update; -non terminal statement_expression_list; -non terminal identifier_opt; -non terminal break_statement, continue_statement; -non terminal return_statement, throw_statement; -non terminal synchronized_statement, try_statement; -non terminal catches_opt, catches, catch_clause; -non terminal finally; -non terminal assert_statement; -// 19.12) Expressions -non terminal primary, primary_no_new_array; -non terminal class_instance_creation_expression; -non terminal argument_list_opt, argument_list; -non terminal array_creation_init, array_creation_uninit; -non terminal dim_exprs, dim_expr, dims_opt, dims; -non terminal field_access, method_invocation, array_access; -non terminal postfix_expression; -non terminal postincrement_expression, postdecrement_expression; -non terminal unary_expression, unary_expression_not_plus_minus; -non terminal preincrement_expression, predecrement_expression; -non terminal cast_expression; -non terminal multiplicative_expression, additive_expression; -non terminal shift_expression, relational_expression, equality_expression; -non terminal and_expression, exclusive_or_expression, inclusive_or_expression; -non terminal conditional_and_expression, conditional_or_expression; -non terminal conditional_expression, assignment_expression; -non terminal assignment; -non terminal assignment_operator; -non terminal expression_opt, expression; -non terminal constant_expression; - -start with goal; - -// 19.2) The Syntactic Grammar -goal ::= compilation_unit - ; - -// 19.3) Lexical Structure. -literal ::= INTEGER_LITERAL - | FLOATING_POINT_LITERAL - | BOOLEAN_LITERAL - | CHARACTER_LITERAL - | STRING_LITERAL - | NULL_LITERAL - ; - -// 19.4) Types, Values, and Variables -type ::= primitive_type - | reference_type - ; -primitive_type ::= - numeric_type - | BOOLEAN - ; -numeric_type::= integral_type - | floating_point_type - ; -integral_type ::= - BYTE - | SHORT - | INT - | LONG - | CHAR - ; -floating_point_type ::= - FLOAT - | DOUBLE - ; - -reference_type ::= - class_or_interface_type - | array_type - ; -class_or_interface_type ::= name; - -class_type ::= class_or_interface_type; -interface_type ::= class_or_interface_type; - -array_type ::= primitive_type dims - | name dims - ; - -// 19.5) Names -name ::= simple_name - | qualified_name - ; -simple_name ::= IDENTIFIER - ; -qualified_name ::= - name DOT IDENTIFIER - ; - -// 19.6) Packages -compilation_unit ::= - package_declaration_opt - import_declarations_opt - type_declarations_opt - ; -package_declaration_opt ::= package_declaration | ; -import_declarations_opt ::= import_declarations | ; -type_declarations_opt ::= type_declarations | ; - -import_declarations ::= - import_declaration - | import_declarations import_declaration - ; -type_declarations ::= - type_declaration - | type_declarations type_declaration - ; -package_declaration ::= - PACKAGE name SEMICOLON - ; -import_declaration ::= - single_type_import_declaration - | type_import_on_demand_declaration - ; -single_type_import_declaration ::= - IMPORT name SEMICOLON - ; -type_import_on_demand_declaration ::= - IMPORT name DOT MULT SEMICOLON - ; -type_declaration ::= - class_declaration - | interface_declaration - | SEMICOLON - ; - -// 19.7) Productions used only in the LALR(1) grammar -modifiers_opt::= - | modifiers - ; -modifiers ::= modifier - | modifiers modifier - ; -modifier ::= PUBLIC | PROTECTED | PRIVATE - | STATIC - | ABSTRACT | FINAL | NATIVE | SYNCHRONIZED | TRANSIENT | VOLATILE - | STRICTFP // note that semantic analysis must check that the - // context of the modifier allows strictfp. - ; - -// 19.8) Classes - -// 19.8.1) Class Declaration: -class_declaration ::= - modifiers_opt CLASS IDENTIFIER super_opt interfaces_opt class_body - ; -super ::= EXTENDS class_type - ; -super_opt ::= - | super - ; -interfaces ::= IMPLEMENTS interface_type_list - ; -interfaces_opt::= - | interfaces - ; -interface_type_list ::= - interface_type - | interface_type_list COMMA interface_type - ; -class_body ::= LBRACE class_body_declarations_opt RBRACE - ; -class_body_declarations_opt ::= - | class_body_declarations ; -class_body_declarations ::= - class_body_declaration - | class_body_declarations class_body_declaration - ; -class_body_declaration ::= - class_member_declaration - | static_initializer - | constructor_declaration - | block - ; -class_member_declaration ::= - field_declaration - | method_declaration - /* repeat the prod for 'class_declaration' here: */ - | modifiers_opt CLASS IDENTIFIER super_opt interfaces_opt class_body - | interface_declaration - | SEMICOLON - ; - -// 19.8.2) Field Declarations -field_declaration ::= - modifiers_opt type variable_declarators SEMICOLON - ; -variable_declarators ::= - variable_declarator - | variable_declarators COMMA variable_declarator - ; -variable_declarator ::= - variable_declarator_id - | variable_declarator_id EQ variable_initializer - ; -variable_declarator_id ::= - IDENTIFIER - | variable_declarator_id LBRACK RBRACK - ; -variable_initializer ::= - expression - | array_initializer - ; - -// 19.8.3) Method Declarations -method_declaration ::= - method_header method_body - ; -method_header ::= - modifiers_opt type method_declarator throws_opt - | modifiers_opt VOID method_declarator throws_opt - ; -method_declarator ::= - IDENTIFIER LPAREN formal_parameter_list_opt RPAREN - | method_declarator LBRACK RBRACK // deprecated - // be careful; the above production also allows 'void foo() []' - ; -formal_parameter_list_opt ::= - | formal_parameter_list - ; -formal_parameter_list ::= - formal_parameter - | formal_parameter_list COMMA formal_parameter - ; -formal_parameter ::= - type variable_declarator_id - | FINAL type variable_declarator_id - ; -throws_opt ::= - | throws - ; -throws ::= THROWS class_type_list - ; -class_type_list ::= - class_type - | class_type_list COMMA class_type - ; -method_body ::= block - | SEMICOLON - ; - -// 19.8.4) Static Initializers -static_initializer ::= - STATIC block - ; - -// 19.8.5) Constructor Declarations -constructor_declaration ::= - modifiers_opt constructor_declarator throws_opt - constructor_body - ; -constructor_declarator ::= - simple_name LPAREN formal_parameter_list_opt RPAREN - ; -constructor_body ::= - LBRACE explicit_constructor_invocation - block_statements RBRACE - | LBRACE explicit_constructor_invocation RBRACE - | LBRACE block_statements RBRACE - | LBRACE RBRACE - ; -explicit_constructor_invocation ::= - THIS LPAREN argument_list_opt RPAREN SEMICOLON - | SUPER LPAREN argument_list_opt RPAREN SEMICOLON - | primary DOT THIS LPAREN argument_list_opt RPAREN SEMICOLON - | primary DOT SUPER LPAREN argument_list_opt RPAREN SEMICOLON - ; - -// 19.9) Interfaces - -// 19.9.1) Interface Declarations -interface_declaration ::= - modifiers_opt INTERFACE IDENTIFIER extends_interfaces_opt - interface_body - ; -extends_interfaces_opt ::= - | extends_interfaces - ; -extends_interfaces ::= - EXTENDS interface_type - | extends_interfaces COMMA interface_type - ; -interface_body ::= - LBRACE interface_member_declarations_opt RBRACE - ; -interface_member_declarations_opt ::= - | interface_member_declarations - ; -interface_member_declarations ::= - interface_member_declaration - | interface_member_declarations interface_member_declaration - ; -interface_member_declaration ::= - constant_declaration - | abstract_method_declaration - | class_declaration - | interface_declaration - | SEMICOLON - ; -constant_declaration ::= - field_declaration - // need to semantically check that modifiers of field declaration - // include only PUBLIC, STATIC, or FINAL. Other modifiers are - // disallowed. - ; -abstract_method_declaration ::= - method_header SEMICOLON - ; - -// 19.10) Arrays -array_initializer ::= - LBRACE variable_initializers COMMA RBRACE - | LBRACE variable_initializers RBRACE - | LBRACE COMMA RBRACE - | LBRACE RBRACE - ; -variable_initializers ::= - variable_initializer - | variable_initializers COMMA variable_initializer - ; - -// 19.11) Blocks and Statements -block ::= LBRACE block_statements_opt RBRACE - ; -block_statements_opt ::= - | block_statements - ; -block_statements ::= - block_statement - | block_statements block_statement - ; -block_statement ::= - local_variable_declaration_statement - | statement - | class_declaration - | interface_declaration - ; -local_variable_declaration_statement ::= - local_variable_declaration SEMICOLON - ; -local_variable_declaration ::= - type variable_declarators - | FINAL type variable_declarators - ; -statement ::= statement_without_trailing_substatement - | labeled_statement - | if_then_statement - | if_then_else_statement - | while_statement - | for_statement - ; -statement_no_short_if ::= - statement_without_trailing_substatement - | labeled_statement_no_short_if - | if_then_else_statement_no_short_if - | while_statement_no_short_if - | for_statement_no_short_if - ; -statement_without_trailing_substatement ::= - block - | empty_statement - | expression_statement - | switch_statement - | do_statement - | break_statement - | continue_statement - | return_statement - | synchronized_statement - | throw_statement - | try_statement - | assert_statement - ; -empty_statement ::= - SEMICOLON - ; -labeled_statement ::= - IDENTIFIER COLON statement - ; -labeled_statement_no_short_if ::= - IDENTIFIER COLON statement_no_short_if - ; -expression_statement ::= - statement_expression SEMICOLON - ; -statement_expression ::= - assignment - | preincrement_expression - | predecrement_expression - | postincrement_expression - | postdecrement_expression - | method_invocation - | class_instance_creation_expression - ; -if_then_statement ::= - IF LPAREN expression RPAREN statement - ; -if_then_else_statement ::= - IF LPAREN expression RPAREN statement_no_short_if - ELSE statement - ; -if_then_else_statement_no_short_if ::= - IF LPAREN expression RPAREN statement_no_short_if - ELSE statement_no_short_if - ; -switch_statement ::= - SWITCH LPAREN expression RPAREN switch_block - ; -switch_block ::= - LBRACE switch_block_statement_groups switch_labels RBRACE - | LBRACE switch_block_statement_groups RBRACE - | LBRACE switch_labels RBRACE - | LBRACE RBRACE - ; -switch_block_statement_groups ::= - switch_block_statement_group - | switch_block_statement_groups switch_block_statement_group - ; -switch_block_statement_group ::= - switch_labels block_statements - ; -switch_labels ::= - switch_label - | switch_labels switch_label - ; -switch_label ::= - CASE constant_expression COLON - | DEFAULT COLON - ; - -while_statement ::= - WHILE LPAREN expression RPAREN statement - ; -while_statement_no_short_if ::= - WHILE LPAREN expression RPAREN statement_no_short_if - ; -do_statement ::= - DO statement WHILE LPAREN expression RPAREN SEMICOLON - ; -for_statement ::= - FOR LPAREN for_init_opt SEMICOLON expression_opt SEMICOLON - for_update_opt RPAREN statement - ; -for_statement_no_short_if ::= - FOR LPAREN for_init_opt SEMICOLON expression_opt SEMICOLON - for_update_opt RPAREN statement_no_short_if - ; -for_init_opt ::= - | for_init - ; -for_init ::= statement_expression_list - | local_variable_declaration - ; -for_update_opt ::= - | for_update - ; -for_update ::= statement_expression_list - ; -statement_expression_list ::= - statement_expression - | statement_expression_list COMMA statement_expression - ; - -identifier_opt ::= - | IDENTIFIER - ; - -break_statement ::= - BREAK identifier_opt SEMICOLON - ; - -continue_statement ::= - CONTINUE identifier_opt SEMICOLON - ; -return_statement ::= - RETURN expression_opt SEMICOLON - ; -throw_statement ::= - THROW expression SEMICOLON - ; -synchronized_statement ::= - SYNCHRONIZED LPAREN expression RPAREN block - ; -try_statement ::= - TRY block catches - | TRY block catches_opt finally - ; -catches_opt ::= - | catches - ; -catches ::= catch_clause - | catches catch_clause - ; -catch_clause ::= - CATCH LPAREN formal_parameter RPAREN block - ; -finally ::= FINALLY block - ; -assert_statement ::= - ASSERT expression SEMICOLON - | ASSERT expression COLON expression SEMICOLON - ; - -// 19.12) Expressions -primary ::= primary_no_new_array - | array_creation_init - | array_creation_uninit - ; -primary_no_new_array ::= - literal - | THIS - | LPAREN expression RPAREN - | class_instance_creation_expression - | field_access - | method_invocation - | array_access - | primitive_type DOT CLASS - | VOID DOT CLASS - | array_type DOT CLASS - | name DOT CLASS - | name DOT THIS - ; -class_instance_creation_expression ::= - NEW class_or_interface_type LPAREN argument_list_opt RPAREN - | NEW class_or_interface_type LPAREN argument_list_opt RPAREN class_body - | primary DOT NEW IDENTIFIER - LPAREN argument_list_opt RPAREN - | primary DOT NEW IDENTIFIER - LPAREN argument_list_opt RPAREN class_body - | name DOT NEW IDENTIFIER - LPAREN argument_list_opt RPAREN - | name DOT NEW IDENTIFIER - LPAREN argument_list_opt RPAREN class_body - ; -argument_list_opt ::= - | argument_list - ; -argument_list ::= - expression - | argument_list COMMA expression - ; -array_creation_uninit ::= - NEW primitive_type dim_exprs dims_opt - | NEW class_or_interface_type dim_exprs dims_opt - ; -array_creation_init ::= - NEW primitive_type dims array_initializer - | NEW class_or_interface_type dims array_initializer - ; -dim_exprs ::= dim_expr - | dim_exprs dim_expr - ; -dim_expr ::= LBRACK expression RBRACK - ; -dims_opt ::= - | dims - ; -dims ::= LBRACK RBRACK - | dims LBRACK RBRACK - ; -field_access ::= - primary DOT IDENTIFIER - | SUPER DOT IDENTIFIER - | name DOT SUPER DOT IDENTIFIER - ; -method_invocation ::= - name LPAREN argument_list_opt RPAREN - | primary DOT IDENTIFIER LPAREN argument_list_opt RPAREN - | SUPER DOT IDENTIFIER LPAREN argument_list_opt RPAREN - | name DOT SUPER DOT IDENTIFIER LPAREN argument_list_opt RPAREN - ; -array_access ::= - name LBRACK expression RBRACK - | primary_no_new_array LBRACK expression RBRACK - | array_creation_init LBRACK expression RBRACK - ; -postfix_expression ::= - primary - | name - | postincrement_expression - | postdecrement_expression - ; -postincrement_expression ::= - postfix_expression PLUSPLUS - ; -postdecrement_expression ::= - postfix_expression MINUSMINUS - ; -unary_expression ::= - preincrement_expression - | predecrement_expression - | PLUS unary_expression - | MINUS unary_expression - | unary_expression_not_plus_minus - ; -preincrement_expression ::= - PLUSPLUS unary_expression - ; -predecrement_expression ::= - MINUSMINUS unary_expression - ; -unary_expression_not_plus_minus ::= - postfix_expression - | COMP unary_expression - | NOT unary_expression - | cast_expression - ; -cast_expression ::= - LPAREN primitive_type dims_opt RPAREN unary_expression - | LPAREN expression RPAREN unary_expression_not_plus_minus - | LPAREN name dims RPAREN unary_expression_not_plus_minus - ; -multiplicative_expression ::= - unary_expression - | multiplicative_expression MULT unary_expression - | multiplicative_expression DIV unary_expression - | multiplicative_expression MOD unary_expression - ; -additive_expression ::= - multiplicative_expression - | additive_expression PLUS multiplicative_expression - | additive_expression MINUS multiplicative_expression - ; -shift_expression ::= - additive_expression - | shift_expression LSHIFT additive_expression - | shift_expression RSHIFT additive_expression - | shift_expression URSHIFT additive_expression - ; -relational_expression ::= - shift_expression - | relational_expression LT shift_expression - | relational_expression GT shift_expression - | relational_expression LTEQ shift_expression - | relational_expression GTEQ shift_expression - | relational_expression INSTANCEOF reference_type - ; -equality_expression ::= - relational_expression - | equality_expression EQEQ relational_expression - | equality_expression NOTEQ relational_expression - ; -and_expression ::= - equality_expression - | and_expression AND equality_expression - ; -exclusive_or_expression ::= - and_expression - | exclusive_or_expression XOR and_expression - ; -inclusive_or_expression ::= - exclusive_or_expression - | inclusive_or_expression OR exclusive_or_expression - ; -conditional_and_expression ::= - inclusive_or_expression - | conditional_and_expression ANDAND inclusive_or_expression - ; -conditional_or_expression ::= - conditional_and_expression - | conditional_or_expression OROR conditional_and_expression - ; -conditional_expression ::= - conditional_or_expression - | conditional_or_expression QUESTION expression - COLON conditional_expression - ; -assignment_expression ::= - conditional_expression - | assignment - ; -// semantic check necessary here to ensure a valid left-hand side. -// allowing a parenthesized variable here on the lhs was introduced in -// JLS 2; thanks to Eric Blake for pointing this out. -assignment ::= postfix_expression assignment_operator assignment_expression - ; -assignment_operator ::= - EQ - | MULTEQ - | DIVEQ - | MODEQ - | PLUSEQ - | MINUSEQ - | LSHIFTEQ - | RSHIFTEQ - | URSHIFTEQ - | ANDEQ - | XOREQ - | OREQ - ; -expression_opt ::= - | expression - ; -expression ::= assignment_expression - ; -constant_expression ::= - expression - ; diff --git a/Robust/JavaGrammar/Parse/java15.cup b/Robust/JavaGrammar/Parse/java15.cup deleted file mode 100644 index d005d945..00000000 --- a/Robust/JavaGrammar/Parse/java15.cup +++ /dev/null @@ -1,1355 +0,0 @@ -package Parse; - -import java_cup.runtime.*; - -/* Java 1.5 (JSR-14 + JSR-201) parser for CUP. - * (Well, Java 1.5 as of 28 Jul 2003; it may change before official release) - * Copyright (C) 2003 C. Scott Ananian - * This program is released under the terms of the GPL; see the file - * COPYING for more details. There is NO WARRANTY on this code. - */ - -/* -JSR-14 Features added: -* parameterized types, including corrections from the spec released - with the 2.2 prototype of the JSR-14 compiler. Arrays of parameterized - types bounded by wildcards are slated to be added to Java 1.5 (although - they are not supported by the 2.2 prototype); this grammar supports them. - "Wildcard" types are supported as of the 28 jul 2003 release. - -JSR-201 Features added: -* no changes for autoboxing -* new-style for: - foreach_statement ::= - FOR LPAREN type variable_declarator_id COLON expression RPAREN - statement - // must check that first IDENTIFIER is 'each' and second IDENTIFIER - // is 'in' -- CSA extension; not (yet?) officially adopted - | FOR IDENTIFIER LPAREN type variable_declarator_id IDENTIFIER - expression RPAREN statement - ; - foreach_statement_no_short_if ::= - FOR LPAREN type variable_declarator_id COLON expression RPAREN - statement_no_short_if - // must check that first IDENTIFIER is 'each' and second IDENTIFIER - // is 'in' -- CSA extension; not (yet?) officially adopted - | FOR IDENTIFIER LPAREN type variable_declarator_id IDENTIFIER - expression RPAREN statement_no_short_if - ; - statement ::= ... - | foreach_statement ; - statement_no_short_if ::= ... - | foreach_statement_no_short_if ; - -* static import: - static_single_type_import_declaration ::= - IMPORT STATIC name SEMICOLON - ; - static_type_import_on_demand_declaration ::= - IMPORT STATIC name DOT MULT SEMICOLON - ; - import_declaration ::= ... - | static_single_type_import_declaration - | static_type_import_on_demand_declaration - ; -* varargs: - formal_parameter ::= ... - | type ELLIPSIS IDENTIFIER - | FINAL type ELLIPSIS IDENTIFIER - ; -* enum: - enum_declaration ::= - modifiers_opt ENUM IDENTIFIER interfaces_opt enum_body - ; - enum_body ::= - LBRACE enum_constants_opt enum_body_declarations_opt RBRACE - ; - enum_constants_opt ::= - | enum_constants - ; - enum_constants ::= - enum_constant - | enum_constants COMMA enum_constant - ; - enum_constant ::= - IDENTIFIER enum_arguments_opt - | IDENTIFIER enum_arguments_opt class_body - ; - enum_arguments_opt ::= - | LPAREN argument_list_opt RPAREN - ; - enum_body_declarations_opt ::= - | SEMICOLON class_body_declarations_opt - ; -*/ -parser code {: - Lexer lexer; - - public Grm15(Lexer l) { - this(); - lexer=l; - } - - public void syntax_error(java_cup.runtime.Symbol current) { - report_error("Syntax error (" + current.sym + ")", current); - } - public void report_error(String message, java_cup.runtime.Symbol info) { - lexer.errorMsg(message, info); - } -:}; - -scan with {: return lexer.nextToken(); :}; - -terminal BOOLEAN; // primitive_type -terminal BYTE, SHORT, INT, LONG, CHAR; // integral_type -terminal FLOAT, DOUBLE; // floating_point_type -terminal LBRACK, RBRACK; // array_type -terminal java.lang.String IDENTIFIER; // name -terminal DOT; // qualified_name -terminal SEMICOLON, MULT, COMMA, LBRACE, RBRACE, EQ, LPAREN, RPAREN, COLON; -terminal PACKAGE; // package_declaration -terminal IMPORT; // import_declaration -terminal PUBLIC, PROTECTED, PRIVATE; // modifier -terminal STATIC; // modifier -terminal ABSTRACT, FINAL, NATIVE, SYNCHRONIZED, TRANSIENT, VOLATILE; -terminal CLASS; // class_declaration -terminal EXTENDS; // super -terminal IMPLEMENTS; // interfaces -terminal VOID; // method_header -terminal THROWS; // throws -terminal THIS, SUPER; // explicit_constructor_invocation -terminal INTERFACE; // interface_declaration -terminal IF, ELSE; // if_then_statement, if_then_else_statement -terminal SWITCH; // switch_statement -terminal CASE, DEFAULT; // switch_label -terminal DO, WHILE; // while_statement, do_statement -terminal FOR; // for_statement -terminal BREAK; // break_statement -terminal CONTINUE; // continue_statement -terminal RETURN; // return_statement -terminal THROW; // throw_statement -terminal TRY; // try_statement -terminal CATCH; // catch_clause -terminal FINALLY; // finally -terminal NEW; // class_instance_creation_expression -terminal PLUSPLUS; // postincrement_expression -terminal MINUSMINUS; // postdecrement_expression -terminal PLUS, MINUS, COMP, NOT, DIV, MOD; -terminal LSHIFT, RSHIFT, URSHIFT; // shift_expression -terminal LT, GT, LTEQ, GTEQ, INSTANCEOF; // relational_expression -terminal EQEQ, NOTEQ; // equality_expression -terminal AND; // and_expression -terminal XOR; // exclusive_or_expression -terminal OR; // inclusive_or_expression -terminal ANDAND; // conditional_and_expression -terminal OROR; // conditional_or_expression -terminal QUESTION; // conditional_expression -terminal MULTEQ, DIVEQ, MODEQ, PLUSEQ, MINUSEQ; // assignment_operator -terminal LSHIFTEQ, RSHIFTEQ, URSHIFTEQ; // assignment_operator -terminal ANDEQ, XOREQ, OREQ; // assignment_operator - -terminal java.lang.Number INTEGER_LITERAL; -terminal java.lang.Number FLOATING_POINT_LITERAL; -terminal java.lang.Boolean BOOLEAN_LITERAL; -terminal java.lang.Character CHARACTER_LITERAL; -terminal java.lang.String STRING_LITERAL; -terminal NULL_LITERAL; - -// Reserved but unused: -terminal CONST, GOTO; -// strictfp keyword, new in Java 1.2 -terminal STRICTFP; -// assert keyword, new in Java 1.4 -terminal ASSERT; // assert_statement -// ellipsis token for varargs, new in Java 1.5 (JSR-201) -terminal ELLIPSIS; -// enum keyword, new in Java 1.5 (JSR-201) -terminal ENUM; - -// 19.2) The Syntactic Grammar -non terminal goal; -// 19.3) Lexical Structure -non terminal literal; -// 19.4) Types, Values, and Variables -non terminal type, primitive_type, numeric_type; -non terminal integral_type, floating_point_type; -non terminal reference_type; -non terminal class_or_interface_type; -non terminal class_type, interface_type; -non terminal array_type; -// 19.5) Names -non terminal name, simple_name, qualified_name; -// 19.6) Packages -non terminal compilation_unit; -non terminal package_declaration_opt, package_declaration; -non terminal import_declarations_opt, import_declarations; -non terminal type_declarations_opt, type_declarations; -non terminal import_declaration; -non terminal single_type_import_declaration; -non terminal type_import_on_demand_declaration; -non terminal static_single_type_import_declaration; -non terminal static_type_import_on_demand_declaration; -non terminal type_declaration; -// 19.7) Productions used only in the LALR(1) grammar -non terminal modifiers_opt, modifiers, modifier; -// 19.8.1) Class Declaration -non terminal class_declaration, super, super_opt; -non terminal interfaces, interfaces_opt, interface_type_list; -non terminal class_body, class_body_opt; -non terminal class_body_declarations, class_body_declarations_opt; -non terminal class_body_declaration, class_member_declaration; -// JSR-201) Enum Declaration -non terminal enum_declaration; -non terminal enum_body, enum_constants_opt, enum_constants, enum_constant; -non terminal enum_arguments_opt, enum_body_declarations_opt; -// 19.8.2) Field Declarations -non terminal field_declaration, variable_declarators, variable_declarator; -non terminal variable_declarator_id, variable_initializer; -// 19.8.3) Method Declarations -non terminal method_declaration, method_header, method_declarator; -non terminal formal_parameter_list_opt, formal_parameter_list; -non terminal formal_parameter; -non terminal throws_opt, throws; -non terminal class_type_list, method_body; -// 19.8.4) Static Initializers -non terminal static_initializer; -// 19.8.5) Constructor Declarations -non terminal constructor_declaration, constructor_declarator; -non terminal constructor_body; -non terminal explicit_constructor_invocation; -// 19.9.1) Interface Declarations -non terminal interface_declaration; -non terminal extends_interfaces_opt, extends_interfaces; -non terminal interface_body; -non terminal interface_member_declarations_opt, interface_member_declarations; -non terminal interface_member_declaration, constant_declaration; -non terminal abstract_method_declaration; -// 19.10) Arrays -non terminal array_initializer; -non terminal variable_initializers; -// 19.11) Blocks and Statements -non terminal block; -non terminal block_statements_opt, block_statements, block_statement; -non terminal local_variable_declaration_statement, local_variable_declaration; -non terminal statement, statement_no_short_if; -non terminal statement_without_trailing_substatement; -non terminal empty_statement; -non terminal labeled_statement, labeled_statement_no_short_if; -non terminal expression_statement, statement_expression; -non terminal if_then_statement; -non terminal if_then_else_statement, if_then_else_statement_no_short_if; -non terminal switch_statement, switch_block; -non terminal switch_block_statement_groups; -non terminal switch_block_statement_group; -non terminal switch_labels, switch_label; -non terminal while_statement, while_statement_no_short_if; -non terminal do_statement; -non terminal foreach_statement, foreach_statement_no_short_if; -non terminal for_statement, for_statement_no_short_if; -non terminal for_init_opt, for_init; -non terminal for_update_opt, for_update; -non terminal statement_expression_list; -non terminal identifier_opt; -non terminal break_statement, continue_statement; -non terminal return_statement, throw_statement; -non terminal synchronized_statement, try_statement; -non terminal catches_opt, catches, catch_clause; -non terminal finally; -non terminal assert_statement; -// 19.12) Expressions -non terminal primary, primary_no_new_array; -non terminal class_instance_creation_expression; -non terminal argument_list_opt, argument_list; -non terminal array_creation_init, array_creation_uninit; -non terminal dim_exprs, dim_expr, dims_opt, dims; -non terminal field_access, method_invocation, array_access; -non terminal postfix_expression; -non terminal postincrement_expression, postdecrement_expression; -non terminal unary_expression, unary_expression_not_plus_minus; -non terminal preincrement_expression, predecrement_expression; -non terminal cast_expression; -non terminal multiplicative_expression, additive_expression; -non terminal shift_expression, relational_expression, equality_expression; -non terminal and_expression, exclusive_or_expression, inclusive_or_expression; -non terminal conditional_and_expression, conditional_or_expression; -non terminal conditional_expression, assignment_expression; -non terminal assignment; -non terminal assignment_operator; -non terminal expression_opt, expression; -non terminal constant_expression; -// JSR-14 2.1) Type Syntax 2.3) Handling Consecutive Type Brackets -non terminal class_or_interface; -non terminal type_variable; -non terminal type_arguments, type_arguments_opt; -non terminal type_argument_list; -non terminal type_argument_list_1, reference_type_1; -non terminal type_argument_list_2, reference_type_2; -non terminal type_argument_list_3, reference_type_3; -// JSR-14 2.2) Parameterized Type Declarations 2.3) Handling Consecutive... -non terminal type_parameters, type_parameters_opt; -non terminal type_parameter, type_parameter_list; -non terminal type_parameter_1, type_parameter_list_1; -non terminal type_bound, type_bound_opt; -non terminal type_bound_1; -non terminal additional_bound_list, additional_bound_list_opt; -non terminal additional_bound_list_1; -non terminal additional_bound; -non terminal additional_bound_1; -non terminal wildcard, wildcard_1, wildcard_2, wildcard_3; -non terminal type_argument, type_argument_1, type_argument_2, type_argument_3; -// not mentioned in JSR-14: need to reduce the precedence of instanceof -// Alternatively, you can tweak the relational_expression production a little. -non terminal instanceof_expression; -//// expressions which are Not a Name -non terminal postfix_expression_nn; -non terminal unary_expression_nn; -non terminal unary_expression_not_plus_minus_nn; -non terminal multiplicative_expression_nn; -non terminal additive_expression_nn; -non terminal shift_expression_nn; -non terminal relational_expression_nn; -non terminal instanceof_expression_nn; -non terminal equality_expression_nn; -non terminal and_expression_nn; -non terminal exclusive_or_expression_nn; -non terminal inclusive_or_expression_nn; -non terminal conditional_and_expression_nn; -non terminal conditional_or_expression_nn; -non terminal conditional_expression_nn; -non terminal assignment_expression_nn; -non terminal expression_nn; - -start with goal; - -// 19.2) The Syntactic Grammar -goal ::= compilation_unit - ; - -// 19.3) Lexical Structure. -literal ::= INTEGER_LITERAL - | FLOATING_POINT_LITERAL - | BOOLEAN_LITERAL - | CHARACTER_LITERAL - | STRING_LITERAL - | NULL_LITERAL - ; - -// 19.4) Types, Values, and Variables -type ::= primitive_type - | reference_type - ; -primitive_type ::= - numeric_type - | BOOLEAN - ; -numeric_type::= integral_type - | floating_point_type - ; -integral_type ::= - BYTE - | SHORT - | INT - | LONG - | CHAR - ; -floating_point_type ::= - FLOAT - | DOUBLE - ; - -reference_type ::= - class_or_interface_type -/* note that the 'type_variable' production will come out of the grammar - * as a 'class_or_interface_type' with a 'simple_name'. The semantic - * checker will have to resolve whether this is a class name or a type - * variable */ - | array_type - ; -type_variable ::= - IDENTIFIER - ; -class_or_interface ::= - name - | class_or_interface LT type_argument_list_1 DOT name - ; -class_or_interface_type ::= - class_or_interface - | class_or_interface LT type_argument_list_1 - ; - -class_type ::= class_or_interface_type; -interface_type ::= class_or_interface_type; - -array_type ::= primitive_type dims - // we have class_or_interface_type here even though only unbounded - // wildcards are really allowed in the parameterization. - // we have to expand this to avoid lookahead problems. - | name dims - | class_or_interface LT type_argument_list_1 DOT name dims - | class_or_interface LT type_argument_list_1 dims - ; - -type_arguments_opt ::= type_arguments | ; - -type_arguments ::= - LT type_argument_list_1 - ; -wildcard ::= QUESTION - | QUESTION EXTENDS reference_type - | QUESTION SUPER reference_type - ; -wildcard_1 ::= QUESTION GT - | QUESTION EXTENDS reference_type_1 - | QUESTION SUPER reference_type_1 - ; -wildcard_2 ::= QUESTION RSHIFT - | QUESTION EXTENDS reference_type_2 - | QUESTION SUPER reference_type_2 - ; -wildcard_3 ::= QUESTION URSHIFT - | QUESTION EXTENDS reference_type_3 - | QUESTION SUPER reference_type_3 - ; -reference_type_1 ::= - reference_type GT - | class_or_interface LT type_argument_list_2 - ; -reference_type_2 ::= - reference_type RSHIFT - | class_or_interface LT type_argument_list_3 - ; -reference_type_3 ::= - reference_type URSHIFT - ; -type_argument_list ::= - type_argument - | type_argument_list COMMA type_argument - ; -type_argument_list_1 ::= - type_argument_1 - | type_argument_list COMMA type_argument_1 - ; -type_argument_list_2 ::= - type_argument_2 - | type_argument_list COMMA type_argument_2 - ; -type_argument_list_3 ::= - type_argument_3 - | type_argument_list COMMA type_argument_3 - ; -type_argument ::= - reference_type - | wildcard - ; -type_argument_1 ::= - reference_type_1 - | wildcard_1 - ; -type_argument_2 ::= - reference_type_2 - | wildcard_2 - ; -type_argument_3 ::= - reference_type_3 - | wildcard_3 - ; - -// 19.5) Names -name ::= simple_name - | qualified_name - ; -simple_name ::= IDENTIFIER - ; -qualified_name ::= - name DOT IDENTIFIER - ; - -// 19.6) Packages -compilation_unit ::= - package_declaration_opt - import_declarations_opt - type_declarations_opt - ; -package_declaration_opt ::= package_declaration | ; -import_declarations_opt ::= import_declarations | ; -type_declarations_opt ::= type_declarations | ; - -import_declarations ::= - import_declaration - | import_declarations import_declaration - ; -type_declarations ::= - type_declaration - | type_declarations type_declaration - ; -package_declaration ::= - PACKAGE name SEMICOLON - ; -import_declaration ::= - single_type_import_declaration - | type_import_on_demand_declaration - | static_single_type_import_declaration - | static_type_import_on_demand_declaration - ; -single_type_import_declaration ::= - IMPORT name SEMICOLON - ; -static_single_type_import_declaration ::= - IMPORT STATIC name SEMICOLON - ; -type_import_on_demand_declaration ::= - IMPORT name DOT MULT SEMICOLON - ; -static_type_import_on_demand_declaration ::= - IMPORT STATIC name DOT MULT SEMICOLON - ; -type_declaration ::= - class_declaration - | enum_declaration - | interface_declaration - | SEMICOLON - ; - -// 19.7) Productions used only in the LALR(1) grammar -modifiers_opt::= - | modifiers - ; -modifiers ::= modifier - | modifiers modifier - ; -modifier ::= PUBLIC | PROTECTED | PRIVATE - | STATIC - | ABSTRACT | FINAL | NATIVE | SYNCHRONIZED | TRANSIENT | VOLATILE - | STRICTFP // note that semantic analysis must check that the - // context of the modifier allows strictfp. - ; - -// 19.8) Classes - -// 19.8.1) Class Declaration: -class_declaration ::= - modifiers_opt CLASS IDENTIFIER type_parameters_opt - super_opt interfaces_opt class_body - ; -super ::= EXTENDS class_type - ; -super_opt ::= - | super - ; -interfaces ::= IMPLEMENTS interface_type_list - ; -interfaces_opt::= - | interfaces - ; -interface_type_list ::= - interface_type - | interface_type_list COMMA interface_type - ; -class_body ::= LBRACE class_body_declarations_opt RBRACE - ; -class_body_opt ::= - | class_body ; -class_body_declarations_opt ::= - | class_body_declarations ; -class_body_declarations ::= - class_body_declaration - | class_body_declarations class_body_declaration - ; -class_body_declaration ::= - class_member_declaration - | static_initializer - | constructor_declaration - | block - ; -class_member_declaration ::= - field_declaration - | method_declaration - /* repeat the prod for 'class_declaration' here: */ - | modifiers_opt CLASS IDENTIFIER type_parameters_opt super_opt interfaces_opt class_body - | enum_declaration - | interface_declaration - | SEMICOLON - ; - -// JSR-201) Enum Declaration -enum_declaration ::= - modifiers_opt ENUM IDENTIFIER interfaces_opt enum_body - ; -enum_body ::= - LBRACE enum_constants_opt enum_body_declarations_opt RBRACE - ; -enum_constants_opt ::= - | enum_constants - ; -enum_constants ::= - enum_constant - | enum_constants COMMA enum_constant - ; -enum_constant ::= - IDENTIFIER enum_arguments_opt - | IDENTIFIER enum_arguments_opt class_body - ; -enum_arguments_opt ::= - | LPAREN argument_list_opt RPAREN - ; -enum_body_declarations_opt ::= - | SEMICOLON class_body_declarations_opt - ; - -// 19.8.2) Field Declarations -field_declaration ::= - modifiers_opt type variable_declarators SEMICOLON - ; -variable_declarators ::= - variable_declarator - | variable_declarators COMMA variable_declarator - ; -variable_declarator ::= - variable_declarator_id - | variable_declarator_id EQ variable_initializer - ; -variable_declarator_id ::= - IDENTIFIER - | variable_declarator_id LBRACK RBRACK - ; -variable_initializer ::= - expression - | array_initializer - ; - -// 19.8.3) Method Declarations -method_declaration ::= - method_header method_body - ; -method_header ::= - // have to expand type_parameters_opt here so that we don't - // force an early decision of whether this is a field_declaration - // or a method_declaration (the type_parameters_opt would have to - // be reduced when we see the 'type' if this was a method declaration, - // but it might still turn out to be a field declaration). - modifiers_opt type method_declarator throws_opt - | modifiers_opt LT type_parameter_list_1 type method_declarator throws_opt - | modifiers_opt VOID method_declarator throws_opt - | modifiers_opt LT type_parameter_list_1 VOID method_declarator throws_opt - ; -method_declarator ::= - IDENTIFIER LPAREN formal_parameter_list_opt RPAREN - | method_declarator LBRACK RBRACK // deprecated - // be careful; the above production also allows 'void foo() []' - ; -formal_parameter_list_opt ::= - | formal_parameter_list - ; -formal_parameter_list ::= - formal_parameter - | formal_parameter_list COMMA formal_parameter - ; -formal_parameter ::= - type variable_declarator_id - | FINAL type variable_declarator_id - // careful, productions below allow varargs in non-final positions. - | type ELLIPSIS IDENTIFIER - | FINAL type ELLIPSIS IDENTIFIER - ; -throws_opt ::= - | throws - ; -throws ::= THROWS class_type_list - ; -class_type_list ::= - class_type - | class_type_list COMMA class_type - ; -method_body ::= block - | SEMICOLON - ; - -// 19.8.4) Static Initializers -static_initializer ::= - STATIC block - ; - -// 19.8.5) Constructor Declarations -constructor_declaration ::= - modifiers_opt constructor_declarator - throws_opt constructor_body - | modifiers_opt LT type_parameter_list_1 constructor_declarator - throws_opt constructor_body - ; -constructor_declarator ::= - simple_name LPAREN formal_parameter_list_opt RPAREN - ; -constructor_body ::= - LBRACE explicit_constructor_invocation - block_statements RBRACE - | LBRACE explicit_constructor_invocation RBRACE - | LBRACE block_statements RBRACE - | LBRACE RBRACE - ; -explicit_constructor_invocation ::= - THIS LPAREN argument_list_opt RPAREN SEMICOLON - | type_arguments THIS LPAREN argument_list_opt RPAREN SEMICOLON - | SUPER LPAREN argument_list_opt RPAREN SEMICOLON - | type_arguments SUPER LPAREN argument_list_opt RPAREN SEMICOLON - | primary DOT SUPER LPAREN argument_list_opt RPAREN SEMICOLON - | primary DOT type_arguments SUPER - LPAREN argument_list_opt RPAREN SEMICOLON - | name DOT SUPER LPAREN argument_list_opt RPAREN SEMICOLON - | name DOT type_arguments SUPER LPAREN argument_list_opt RPAREN SEMICOLON - ; - -// 19.9) Interfaces - -// 19.9.1) Interface Declarations -interface_declaration ::= - modifiers_opt INTERFACE IDENTIFIER type_parameters_opt - extends_interfaces_opt interface_body - ; -extends_interfaces_opt ::= - | extends_interfaces - ; -extends_interfaces ::= - EXTENDS interface_type - | extends_interfaces COMMA interface_type - ; -interface_body ::= - LBRACE interface_member_declarations_opt RBRACE - ; -interface_member_declarations_opt ::= - | interface_member_declarations - ; -interface_member_declarations ::= - interface_member_declaration - | interface_member_declarations interface_member_declaration - ; -interface_member_declaration ::= - constant_declaration - | abstract_method_declaration - | class_declaration - | enum_declaration - | interface_declaration - | SEMICOLON - ; -constant_declaration ::= - field_declaration - // need to semantically check that modifiers of field declaration - // include only PUBLIC, STATIC, or FINAL. Other modifiers are - // disallowed. - ; -abstract_method_declaration ::= - method_header SEMICOLON - ; - -// 19.10) Arrays -array_initializer ::= - LBRACE variable_initializers COMMA RBRACE - | LBRACE variable_initializers RBRACE - | LBRACE COMMA RBRACE - | LBRACE RBRACE - ; -variable_initializers ::= - variable_initializer - | variable_initializers COMMA variable_initializer - ; - -// 19.11) Blocks and Statements -block ::= LBRACE block_statements_opt RBRACE - ; -block_statements_opt ::= - | block_statements - ; -block_statements ::= - block_statement - | block_statements block_statement - ; -block_statement ::= - local_variable_declaration_statement - | statement - | class_declaration - | enum_declaration - | interface_declaration - ; -local_variable_declaration_statement ::= - local_variable_declaration SEMICOLON - ; -/* jikes expands 'type' in production for local_variable_declaration to - * avoid reduce-reduce conflict: given 'name [' the grammar can't decide - * whether this is going to be a type (starting the local_variable_declaration) - * or an array access expression. */ -local_variable_declaration ::= - type variable_declarators - // you may want to accept 'modifiers' here instead of just FINAL - // to produce better error messages. - | FINAL type variable_declarators - ; -statement ::= statement_without_trailing_substatement - | labeled_statement - | if_then_statement - | if_then_else_statement - | while_statement - | for_statement - | foreach_statement - ; -statement_no_short_if ::= - statement_without_trailing_substatement - | labeled_statement_no_short_if - | if_then_else_statement_no_short_if - | while_statement_no_short_if - | for_statement_no_short_if - | foreach_statement_no_short_if - ; -statement_without_trailing_substatement ::= - block - | empty_statement - | expression_statement - | switch_statement - | do_statement - | break_statement - | continue_statement - | return_statement - | synchronized_statement - | throw_statement - | try_statement - | assert_statement - ; -empty_statement ::= - SEMICOLON - ; -labeled_statement ::= - IDENTIFIER COLON statement - ; -labeled_statement_no_short_if ::= - IDENTIFIER COLON statement_no_short_if - ; -expression_statement ::= - statement_expression SEMICOLON - ; -statement_expression ::= - assignment - | preincrement_expression - | predecrement_expression - | postincrement_expression - | postdecrement_expression - | method_invocation - | class_instance_creation_expression - ; -if_then_statement ::= - IF LPAREN expression RPAREN statement - ; -if_then_else_statement ::= - IF LPAREN expression RPAREN statement_no_short_if - ELSE statement - ; -if_then_else_statement_no_short_if ::= - IF LPAREN expression RPAREN statement_no_short_if - ELSE statement_no_short_if - ; -switch_statement ::= - SWITCH LPAREN expression RPAREN switch_block - ; -switch_block ::= - LBRACE switch_block_statement_groups switch_labels RBRACE - | LBRACE switch_block_statement_groups RBRACE - | LBRACE switch_labels RBRACE - | LBRACE RBRACE - ; -switch_block_statement_groups ::= - switch_block_statement_group - | switch_block_statement_groups switch_block_statement_group - ; -switch_block_statement_group ::= - switch_labels block_statements - ; -switch_labels ::= - switch_label - | switch_labels switch_label - ; -switch_label ::= - CASE constant_expression COLON - | DEFAULT COLON - ; - -while_statement ::= - WHILE LPAREN expression RPAREN statement - ; -while_statement_no_short_if ::= - WHILE LPAREN expression RPAREN statement_no_short_if - ; -do_statement ::= - DO statement WHILE LPAREN expression RPAREN SEMICOLON - ; -foreach_statement ::= - FOR LPAREN type variable_declarator_id COLON expression RPAREN - statement - // must check that first IDENTIFIER is 'each' and second IDENTIFIER - // is 'in' - | FOR IDENTIFIER LPAREN type variable_declarator_id IDENTIFIER - expression RPAREN statement - ; -foreach_statement_no_short_if ::= - FOR LPAREN type variable_declarator_id COLON expression RPAREN - statement_no_short_if - // must check that first IDENTIFIER is 'each' and second IDENTIFIER - // is 'in' - | FOR IDENTIFIER LPAREN type variable_declarator_id IDENTIFIER - expression RPAREN statement_no_short_if - ; -for_statement ::= - FOR LPAREN for_init_opt SEMICOLON expression_opt SEMICOLON - for_update_opt RPAREN statement - ; -for_statement_no_short_if ::= - FOR LPAREN for_init_opt SEMICOLON expression_opt SEMICOLON - for_update_opt RPAREN statement_no_short_if - ; -for_init_opt ::= - | for_init - ; -for_init ::= statement_expression_list - | local_variable_declaration - ; -for_update_opt ::= - | for_update - ; -for_update ::= statement_expression_list - ; -statement_expression_list ::= - statement_expression - | statement_expression_list COMMA statement_expression - ; - -identifier_opt ::= - | IDENTIFIER - ; - -break_statement ::= - BREAK identifier_opt SEMICOLON - ; - -continue_statement ::= - CONTINUE identifier_opt SEMICOLON - ; -return_statement ::= - RETURN expression_opt SEMICOLON - ; -throw_statement ::= - THROW expression SEMICOLON - ; -synchronized_statement ::= - SYNCHRONIZED LPAREN expression RPAREN block - ; -try_statement ::= - TRY block catches - | TRY block catches_opt finally - ; -catches_opt ::= - | catches - ; -catches ::= catch_clause - | catches catch_clause - ; -catch_clause ::= - CATCH LPAREN formal_parameter RPAREN block - ; -finally ::= FINALLY block - ; -assert_statement ::= - ASSERT expression SEMICOLON - | ASSERT expression COLON expression SEMICOLON - ; - -// 19.12) Expressions -primary ::= primary_no_new_array - | array_creation_init - | array_creation_uninit - ; -primary_no_new_array ::= - literal - | THIS - | LPAREN name RPAREN - | LPAREN expression_nn RPAREN - | class_instance_creation_expression - | field_access - | method_invocation - | array_access - | name DOT THIS - | VOID DOT CLASS - // "Type DOT CLASS", but expanded - | primitive_type DOT CLASS - | primitive_type dims DOT CLASS - | name DOT CLASS - | name dims DOT CLASS -// the following two productions are part of the expansion of -// 'type DOT CLASS' but are not actually allowed, as they involve params. -// [see msg from Neal Gafter <3F219367.3070903@sun.com> 25-jul-2003] -// | class_or_interface type_arguments DOT name dims DOT CLASS -// | class_or_interface LT type_argument_list_1 dims DOT CLASS - ; -// grammar distributed with prototype 2.2 is in error; the following is correct -// [ Neal Gafter, <3F2577E0.3090008@sun.com> ] -class_instance_creation_expression ::= - NEW class_or_interface_type LPAREN argument_list_opt RPAREN class_body_opt - | NEW type_arguments class_or_interface_type LPAREN argument_list_opt RPAREN class_body_opt - | primary DOT NEW type_arguments_opt IDENTIFIER type_arguments_opt - LPAREN argument_list_opt RPAREN class_body_opt - | name DOT NEW type_arguments_opt IDENTIFIER type_arguments_opt - LPAREN argument_list_opt RPAREN class_body_opt - ; -argument_list_opt ::= - | argument_list - ; -argument_list ::= - expression - | argument_list COMMA expression - ; -array_creation_uninit ::= - NEW primitive_type dim_exprs dims_opt - | NEW class_or_interface_type dim_exprs dims_opt - ; -array_creation_init ::= - NEW primitive_type dims array_initializer - | NEW class_or_interface_type dims array_initializer - ; -dim_exprs ::= dim_expr - | dim_exprs dim_expr - ; -dim_expr ::= LBRACK expression RBRACK - ; -dims_opt ::= - | dims - ; -dims ::= LBRACK RBRACK - | dims LBRACK RBRACK - ; -field_access ::= - primary DOT IDENTIFIER - | SUPER DOT IDENTIFIER - | name DOT SUPER DOT IDENTIFIER - ; -method_invocation ::= - name LPAREN argument_list_opt RPAREN -// the following production appeared in the prototype 2.2 spec, but it -// introduces ambiguities in the grammar (consider the expression -// A((B)E()); -// which could be either an invocation on E or two boolean comparisons). -// Neal Gafter has assured me that this production should be removed -// from the grammar. <3F256C06.7000600@sun.com> -// | type_arguments name LPAREN argument_list_opt RPAREN - | primary DOT IDENTIFIER LPAREN argument_list_opt RPAREN - | primary DOT type_arguments IDENTIFIER LPAREN argument_list_opt RPAREN - | name DOT type_arguments IDENTIFIER LPAREN argument_list_opt RPAREN - | SUPER DOT IDENTIFIER LPAREN argument_list_opt RPAREN - | SUPER DOT type_arguments IDENTIFIER LPAREN argument_list_opt RPAREN - | name DOT SUPER DOT IDENTIFIER LPAREN argument_list_opt RPAREN - | name DOT SUPER DOT type_arguments IDENTIFIER LPAREN argument_list_opt RPAREN - ; -array_access ::= - name LBRACK expression RBRACK - | primary_no_new_array LBRACK expression RBRACK - | array_creation_init LBRACK expression RBRACK - ; -postfix_expression ::= - primary - | name - | postincrement_expression - | postdecrement_expression - ; -postincrement_expression ::= - postfix_expression PLUSPLUS - ; -postdecrement_expression ::= - postfix_expression MINUSMINUS - ; -unary_expression ::= - preincrement_expression - | predecrement_expression - | PLUS unary_expression - | MINUS unary_expression - | unary_expression_not_plus_minus - ; -preincrement_expression ::= - PLUSPLUS unary_expression - ; -predecrement_expression ::= - MINUSMINUS unary_expression - ; -unary_expression_not_plus_minus ::= - postfix_expression - | COMP unary_expression - | NOT unary_expression - | cast_expression - ; -// This parsing technique was discovered by Eric Blake -// We solving grammar ambiguities with between parenthesized less-than -// relational operations and type casts with a slightly-more-complicated -// cast_expression production. -// Illustrative example: LPAREN name LT name ... -// is this going to be a cast_expression or a relational_expression? -// canonically, this production is: -// cast_expression ::= LPAREN type RPAREN unary_expression_not_plus_minus -cast_expression ::= - LPAREN primitive_type dims_opt RPAREN unary_expression - | LPAREN name RPAREN unary_expression_not_plus_minus - | LPAREN name dims RPAREN unary_expression_not_plus_minus - | LPAREN name LT type_argument_list_1 dims_opt RPAREN - unary_expression_not_plus_minus - | LPAREN name LT type_argument_list_1 DOT - class_or_interface_type dims_opt RPAREN - unary_expression_not_plus_minus - ; -multiplicative_expression ::= - unary_expression - | multiplicative_expression MULT unary_expression - | multiplicative_expression DIV unary_expression - | multiplicative_expression MOD unary_expression - ; -additive_expression ::= - multiplicative_expression - | additive_expression PLUS multiplicative_expression - | additive_expression MINUS multiplicative_expression - ; -shift_expression ::= - additive_expression - | shift_expression LSHIFT additive_expression - | shift_expression RSHIFT additive_expression - | shift_expression URSHIFT additive_expression - ; -relational_expression ::= - shift_expression - | relational_expression LT shift_expression - | relational_expression GT shift_expression - | relational_expression LTEQ shift_expression - | relational_expression GTEQ shift_expression - ; -// we lower the precendence of instanceof to resolve a grammar ambiguity. -// semantics are unchanged, since relational expressions do not operate -// on boolean. Eric Blake had a different solution here, where he -// used the production 'shift_expression LT shift_expression' to solve -// the same problem. -instanceof_expression ::= - relational_expression - | instanceof_expression INSTANCEOF reference_type - ; -equality_expression ::= - instanceof_expression - | equality_expression EQEQ instanceof_expression - | equality_expression NOTEQ instanceof_expression - ; -and_expression ::= - equality_expression - | and_expression AND equality_expression - ; -exclusive_or_expression ::= - and_expression - | exclusive_or_expression XOR and_expression - ; -inclusive_or_expression ::= - exclusive_or_expression - | inclusive_or_expression OR exclusive_or_expression - ; -conditional_and_expression ::= - inclusive_or_expression - | conditional_and_expression ANDAND inclusive_or_expression - ; -conditional_or_expression ::= - conditional_and_expression - | conditional_or_expression OROR conditional_and_expression - ; -conditional_expression ::= - conditional_or_expression - | conditional_or_expression QUESTION expression - COLON conditional_expression - ; -assignment_expression ::= - conditional_expression - | assignment - ; -// semantic check necessary here to ensure a valid left-hand side. -// allowing a parenthesized variable here on the lhs was introduced in -// JLS 2; thanks to Eric Blake for pointing this out. -assignment ::= postfix_expression assignment_operator assignment_expression - ; -assignment_operator ::= - EQ - | MULTEQ - | DIVEQ - | MODEQ - | PLUSEQ - | MINUSEQ - | LSHIFTEQ - | RSHIFTEQ - | URSHIFTEQ - | ANDEQ - | XOREQ - | OREQ - ; -expression_opt ::= - | expression - ; -expression ::= assignment_expression - ; -// note that this constraint must be enforced during semantic checking -// 'constant_expression' should include enumerated constants. -constant_expression ::= - expression - ; - -// JLS-14 productions. -type_parameters_opt ::= type_parameters | ; -type_parameters ::= - LT type_parameter_list_1 - ; -type_parameter_list ::= - type_parameter_list COMMA type_parameter - | type_parameter - ; -type_parameter_list_1 ::= - type_parameter_1 - | type_parameter_list COMMA type_parameter_1 - ; -type_parameter ::= - type_variable type_bound_opt - ; -type_parameter_1 ::= - type_variable GT - | type_variable type_bound_1 - ; -type_bound_opt ::= type_bound | ; -type_bound ::= - EXTENDS reference_type additional_bound_list_opt - ; -type_bound_1 ::= - EXTENDS reference_type_1 - | EXTENDS reference_type additional_bound_list_1 - ; -additional_bound_list_opt ::= additional_bound_list | ; -additional_bound_list ::= - additional_bound additional_bound_list - | additional_bound - ; -additional_bound_list_1 ::= - additional_bound additional_bound_list_1 - | additional_bound_1 - ; -additional_bound ::= - AND interface_type - ; -additional_bound_1 ::= - AND reference_type_1 - ; -////////////////////////////////////////////// -// the following productions are copied from the standard ones, but -// 'name' all alone is not allowed. The '_nn' stands for 'not name'. -// we also expand the productions so that they recursively depend on the -// '_nn' forms of their left hand side, then adding a new production -// with 'name' explicit on the left-hand side. -// this allows us to postpone the decision whether '(x)' is an expression -// or a type-cast until we can see enough right context to make the proper -// choice. -postfix_expression_nn ::= - primary - // the 'name' production was removed here. - | postincrement_expression - | postdecrement_expression - ; -unary_expression_nn ::= - preincrement_expression - | predecrement_expression - | PLUS unary_expression - | MINUS unary_expression - | unary_expression_not_plus_minus_nn - ; -unary_expression_not_plus_minus_nn ::= - postfix_expression_nn - | COMP unary_expression - | NOT unary_expression - | cast_expression - ; -multiplicative_expression_nn ::= - unary_expression_nn - | name MULT unary_expression - | multiplicative_expression_nn MULT unary_expression - | name DIV unary_expression - | multiplicative_expression_nn DIV unary_expression - | name MOD unary_expression - | multiplicative_expression_nn MOD unary_expression - ; -additive_expression_nn ::= - multiplicative_expression_nn - | name PLUS multiplicative_expression - | additive_expression_nn PLUS multiplicative_expression - | name MINUS multiplicative_expression - | additive_expression_nn MINUS multiplicative_expression - ; -shift_expression_nn ::= - additive_expression_nn - | name LSHIFT additive_expression - | shift_expression_nn LSHIFT additive_expression - | name RSHIFT additive_expression - | shift_expression_nn RSHIFT additive_expression - | name URSHIFT additive_expression - | shift_expression_nn URSHIFT additive_expression - ; -relational_expression_nn ::= - shift_expression_nn - // note that we've tweaked the productions for LT/GT to disallow - // a 3-Apr-1998 - [revised 12-apr-2002] - [revised 28-jul-2003] - -UPDATE: Fixed a lexer bug: '5.2' is a double, not a float. Thanks to -Ben Walter for spotting this. - - -- C. Scott Ananian 14-Jul-1998 - -UPDATE: Fixed a couple of minor bugs. -1) Lex.EscapedUnicodeReader wasn't actually parsing unicode escape sequences - properly because we didn't implement read(char[], int, int). -2) Grammar fixes: int[].class, Object[].class and all array class - literals were not being parsed. Also special void.class literal - inadvertantly omitted from the grammar. -Both these problems have been fixed. - - -- C. Scott Ananian 11-Feb-1999 - -UPDATE: Fixed another lexer bug: Large integer constants such as -0xFFFF0000 were being incorrectly flagged as 'too large for an int'. -Also, by the Java Language Specification, "\477" is a valid string -literal (it is the same as "\0477": the character '\047' followed by -the character '7'). The lexer handles this case correctly now. - -Created java12.cup with grammar updated to Java 1.2. Features -added include the 'strictfp' keyword and the various new inner class -features at http://java.sun.com/docs/books/jls/nested-class-clarify.html. - -Also added slightly better position/error reporting to all parsers. - - -- C. Scott Ananian 11-Feb-1999 - -UPDATE: fixed some buglets with symbol/error position reporting. - - -- C. Scott Ananian 13-Sep-1999 - -UPDATE: multi-line comments were causing incorrect character position -reporting. If you were using the character-position-to-line-number -code in Lexer, you would never have noticed this problem. Thanks to -William Young for pointing this out. - - -- C. Scott Ananian 27-Oct-1999 - -UPDATE: extended grammar to handle the 'assert' statement added in -Java 1.4. Also fixed an oversight: a single SEMICOLON is a valid -ClassBodyDeclaration; this was added to allow trailing semicolons -uniformly on class declarations. This wasn't part of the original -JLS, but was revised in to conform with the actual behavior of the -javac compiler. I've added this to all the grammars from 1.0-1.4 -to conform to javac behavior; let me know if you've got a good -reason why this production shouldn't be in early grammars. - -Also futzed with the Makefile some to allow building a 'universal' -driver which will switch between java 1.0/1.1/1.2/1.4 on demand. -This helps me test the separate grammars; maybe you'll find a -use for this behavior too. - - -- C. Scott Ananian 10-Apr-2002 - -NEW: added a grammar for the JSR-14 "Adding Generics to the Java -Programming Language" Java variant. Calling this java15.cup, since -this JSR currently seems to be destined for inclusion in Java 1.5. -This grammar is very very tricky! I need to use a lexer trick to -handle type casts to parameterized types, which otherwise do not -seem to be LALR(1). - -- C. Scott Ananian 12-Apr-2002 - -UPDATE: various bug fixes to all grammars, in reponse to bugs reported -by Eric Blake and others. - a) TWEAK: added 'String' type to IDENTIFIER terminal to match Number types - given to numeric literals. (all grammars) - b) BUG FIX: added SEMICOLON production to interface_member_declaration to - allow optional trailing semicolons, in accordance with the JLS (for - java 1.2-and-later grammars) and Sun practice (for earlier grammars). - The 10-Apr-2002 release did not address this problem completely, due - to an oversight. (all grammars) - c) BUG FIX: '.this(...);' is not a legal production; - '.super(...);' and '.new (...' ought to be. - In particular, plain identifiers ought to be able to qualify instance - creation and explicit constructor invocation. - (fix due to Eric Blake; java 1.2 grammar and following) - d) BUG FIX: parenthesized variables on the left-hand-side of an assignment - ought to be legal, according to JLS2. For example, this code is - legal: - class Foo { void m(int i) { (i) = 1; } } - (fix due to Eric Blake; java 1.2 grammar and following) - e) BUG FIX: array access of anonymous arrays ought to be legal, according - to JLS2. For example, this is legal code: - class Foo { int i = new int[]{0}[0]; } - (fix due to Eric Blake; java 1.2 grammar and following) - f) BUG FIX: nested parameterized types ought to be legal, for example: - class A { class B { } A.B c; } - (bug found by Eric Blake; jsr-14 grammar only) - g) TWEAK: test cases were added for these issues. - -In addition, it should be clarified that the 'java15.cup' grammar is -really only for java 1.4 + jsr-14; recent developments at Sun indicate -that "Java 1.5" is likely to include several additional language changes -in addition to JSR-14 parameterized types; see JSR-201 for more details. -I will endeavor to add these features to 'java15.cup' as soon as their -syntax is nailed down. - -- C. Scott Ananian 13-Apr-2003 - -UPDATE: Updated the 'java15.cup' grammar to match the latest specifications -(and their corrections) for Java 1.5. This grammar matches the 2.2 -prototype of JSR-14 + JSR-201 capabilities, with some corrections for -mistakes in the released specification and expected future features of -Java 1.5 (in particular, arrays of parameterized types bounded by -wildcards). Reimplemented java15.cup to use a refactoring originally -due to Eric Blake which eliminates our previous need for "lexer lookahead" -(see release notes for 12-April-2002). Added new 'enum' and '...' tokens -to the lexer to accomodate Java 1.5. New test cases added for the -additional language features. - -- C. Scott Ananian 28-Jul-2003 diff --git a/Robust/JavaGrammar/tests/Eric.java b/Robust/JavaGrammar/tests/Eric.java deleted file mode 100644 index 04f074b6..00000000 --- a/Robust/JavaGrammar/tests/Eric.java +++ /dev/null @@ -1,45 +0,0 @@ -/** Some valid java code from Eric Blake. Some of these constructions - * broke previous versions of the grammars. These should all compile - * with any JLS2 javac, as well as parse correctly (no syntax errors) - * using the java12.cup/java14.cup/java15.cup grammars in this package. */ -class Eric { - // parenthesized variables on the left-hand-size of assignments - // are legal according to JLS 2. See comments on jikes bug 105 - // http://www-124.ibm.com/developerworks/bugs/?func=detailbug&bug_id=105&group_id=10 - // for more details. According to Eric Blake: - // The 2nd edition JLS is weak on this point - the grammar - // in 15.26 prohibits assignments to parenthesized - // variables, but earlier in 15.8.5 it states that a - // parenthesized variable is still a variable (in JLS1, a - // parenthesized variable was a value), and the intent of - // assignment is that a variable appear on the left hand - // side. Also, the grammar in chapter 18 (if you can call - // it such, because of its numerous typos and ambiguities) - // permits assignment to parenthesized variables. - void m(int i) { - (i) = 1; - } - // array access of an initialized array creation is legal; see Sun - // bugs 4091602, 4321177: - // http://developer.java.sun.com/developer/bugParade/bugs/4091602.html - // http://developer.java.sun.com/developer/bugParade/bugs/4321177.html - // Eric Blake says: - // Again, the body of the JLS prohibits this, but chapter 18 permits it. - int i = new int[]{0}[0]; - int j = new char[] { 'O', 'K' }.length; - - // plain identifiers can qualify instance creation and explicit - // constructors; see Sun bug 4750181: - // http://developer.java.sun.com/developer/bugParade/bugs/4750181.html - // Eric Blake says: - // Sun admits the grammars between the earlier chapters and - // chapter 18 are incompatible, so they are not sure whether - // things like "identifier.new name()" should be legal or - // not. Chapter 18 treats identifiers as primaries, and javac - // compiles them. - class B { }; - B b; - void foo(Eric e) { - e.b = e.new B(); - } -} diff --git a/Robust/JavaGrammar/tests/Eric15.java b/Robust/JavaGrammar/tests/Eric15.java deleted file mode 100644 index b7cb8e39..00000000 --- a/Robust/JavaGrammar/tests/Eric15.java +++ /dev/null @@ -1,7 +0,0 @@ -/** Some valid java code from Eric Blake. This should compile - * with any JSR-14 javac, as well as parse correctly (no syntax errors) - * using the java15.cup grammar in this package. */ -class Eric15 { - class B { } - Eric15.B c; -} diff --git a/Robust/JavaGrammar/tests/Escape.java b/Robust/JavaGrammar/tests/Escape.java deleted file mode 100644 index d84332e2..00000000 --- a/Robust/JavaGrammar/tests/Escape.java +++ /dev/null @@ -1,4 +0,0 @@ -class Escape { - String s = "\477"; // this literal is valid, but.. -// char c = '\477'; // this literal is invalid. -} diff --git a/Robust/JavaGrammar/tests/Test15.java b/Robust/JavaGrammar/tests/Test15.java deleted file mode 100644 index a12d240a..00000000 --- a/Robust/JavaGrammar/tests/Test15.java +++ /dev/null @@ -1,72 +0,0 @@ -/** A valid JSR-14 Java program, which illustrates some corner-cases in - * the 'smart lexer' lookahead implementation of the grammar. It should - * compile correctly using a JSR-14 javac, as well as parse correctly - * (no syntax errors) using the java15.cup grammar in this package. */ -public class Test15 { - Test15(T t) { } - int a = 1, b = 2; - C c1 = new C(), c2 = new C(), c3 = new C(); - C cc2 = c2; - C cc3 = c3; - boolean d = a < b, e = a < b; - int f[] = new int[5]; - boolean g = a < f[1]; - boolean h = ( a < f[1] ); - Object i0 = (A) cc3; - Object i = ( A < B[] > ) cc3; - Object j = ( A < B > ) cc2; - Object k = ( A < A < B[] > >) null; - Object kk= ( A < A < B[] >>) null; - Test15.H hh = null; - { - Test15.H hhh = null; - for (boolean l=a m = c1; - if (m instanceof C) - a=a; - for (boolean n = m instanceof C, - o = a; - cc3 instanceof C; - n = m instanceof C, - o = a) - b=b; - for (;m instanceof C;) - a=a; - if (a < b >> 1) - ; - Object o1 = new A>(), - o2 = new A>>(), - o3 = new A>>>(); - - // new, "explicit parameter" version of method invocation. - A aa = Test15.>foo(); - /* although the spec says this should work: - A aa_ = >foo(); - * Neal Gafter has assured me that this is a bug in the spec. - * Type arguments are only valid after a dot. */ - - // "explicit parameters" with constructor invocations. - new K("xh"); // prototype 2.2 chokes on this. - this.new K("xh"); - } - - static class A { T t; } - static class B { } - static class C extends A { } - static class D { } - static class E> { } - static interface F { } - // wildcard bounds. - static class G { A a; A> b; } - class H { } - static class I extends A { } - static class J extends A { } - class K { K(T t) { Test15.foo(); } } - - static T foo() { return null; } -} diff --git a/Robust/JavaGrammar/tests/TestJSR201.java b/Robust/JavaGrammar/tests/TestJSR201.java deleted file mode 100644 index 57368fba..00000000 --- a/Robust/JavaGrammar/tests/TestJSR201.java +++ /dev/null @@ -1,104 +0,0 @@ -import static java.lang.Math.*; // gratuitous test of static import -import static java.lang.System.out; // ditto -import java.util.*; -class TestJSR201 { - enum Color { red, green, blue ; }; - public static void main(String... args/* varargs */) { - /* for each on multi-dimensional array */ - int[][] iaa = new int[10][10]; - for (int ia[] : iaa) { - for (int i : ia) - out.print(i); // use static import. - out.println(); - } - /** alternate syntax: */ - for each (int ia[] in iaa) - for each (int i in ia) { - out.println(i); - } - /* */ - for (Color c : Color.VALUES) { - switch(c) { - case Color.red: out.print("R"); break; - case Color.green: out.print("G"); break; - case Color.blue: out.print("B"); break; - default: assert false; - } - } - out.println(); - } - // complex enum declaration, from JSR-201 - public static enum Coin { - penny(1), nickel(5), dime(10), quarter(25); - Coin(int value) { this.value = value; } - private final int value; - public int value() { return value; } - } - public static class Card implements Comparable, java.io.Serializable { - public enum Rank { deuce, three, four, five, six, seven, eight, nine, - ten, jack, queen, king, ace } - public enum Suit { clubs, diamonds, hearts, spades } - - private final Rank rank; - private final Suit suit; - - private Card(Rank rank, Suit suit) { - if (rank == null || suit == null) - throw new NullPointerException(rank + ", " + suit); - this.rank = rank; - this.suit = suit; - } - - public Rank rank() { return rank; } - public Suit suit() { return suit; } - - public String toString() { return rank + " of " + suit; } - - public int compareTo(Object o) { - Card c = (Card)o; - int rankCompare = rank.compareTo(c.rank); - return rankCompare != 0 ? rankCompare : suit.compareTo(c.suit); - } - - private static List sortedDeck = new ArrayList(52); - /* BROKEN IN PROTOTYPE 2.0 */ - static { - for (Rank rank : Rank.VALUES) - for (Suit suit : Suit.VALUES) - sortedDeck.add(new Card(rank, suit)); - } - /* */ - // Returns a shuffled deck - public static List newDeck() { - List result = new ArrayList(sortedDeck); - Collections.shuffle(result); - return result; - } - } - // sophisticated example: - public static abstract enum Operation { - plus { - double eval(double x, double y) { return x + y; } - }, - minus { - double eval(double x, double y) { return x - y; } - }, - times { - double eval(double x, double y) { return x * y; } - }, - divided_by { - double eval(double x, double y) { return x / y; } - }; - - // Perform arithmetic operation represented by this constant - abstract double eval(double x, double y); - - public static void main(String args[]) { - double x = Double.parseDouble(args[0]); - double y = Double.parseDouble(args[1]); - - for (Operation op : VALUES) - out.println(x + " " + op + " " + y + " = " + op.eval(x, y)); - } - } -} diff --git a/Robust/cup/CHANGELOG b/Robust/cup/CHANGELOG deleted file mode 100644 index 5365a357..00000000 --- a/Robust/cup/CHANGELOG +++ /dev/null @@ -1,313 +0,0 @@ -CUP version 0.10k is a maintenance release. - -CUP will now accept a filename on the command-line if it is the last -argument and does not start with "-". This allows better GUI -integration. Some unix-isms in end-of-line handling have been fixed, -too; thanks to Jean Vaucher for the tip. - -The java_cup.runtime.Scanner interface has been refined to allow -the scanner to return null to signal EOF. JLex and JFlex users will -like this, as it means they can use the default scanner EOF behavior. - -Bruce Hutton , Zerksis Umrigar , -and Vladimir Antonevich all sent bug -reports touching on erroneous error recovery in the parser runtime. -Dr. Hutton provided the fixes that I've adopted; Zerksis sent a very -helpful CUP-vs-bison test case. If you're in a position to notice -correct/incorrect error recovery and this release works better for you -than previous ones, thank them --- and send me email so I know whether -we've quashed this bug for good. - -Klaus Georg Barthelmann caught an -oversight in the constructors for java_cup.runtime.Symbol. I've also -taken an obsolete constructor allowing specification of a start state -for some symbol to package-scope; if this causes anyone backwards -compatibility problems, email me and I will consider changing it back. - -C. Scott Ananian -Laboratory for Computer Science -Massachusetts Institute of Technology -Jul-24-1999 [CSA] ------------------------------------------------------------------------- -CUP version 0.10j adds new features. - -A "-version" command-line option is now accepted, which prints out the -working version of CUP and halts. This allows automatic version-checking, -for those applications which require it. - -Broadened the CUP input grammar to allow CUP reserved words in package and -import statements, and in (non)terminal labels. In addition, semicolons -after 'action code', 'parser code', 'init code', and 'scan with' sections -have been made optional (if language noise annoys you). Also, these four -sections may now appear in any order, instead of the strict ordering -previously required. Finally, you can now spell 'non-terminal' as either -"non terminal" (old way) *or* "nonterminal" without upsetting CUP. -[Flexibility requested by Stefan Kahrs ] -[Package and import reserved word issues noted by Frank Rehberger, - Brandon Schendel, and Bernie Honeisen, among others.] - -Clarified the parse table dumps generated by the -dump* options. - -I have added code to lr_parser to detect illegal Symbol recycling by the -scanner and to throw an Error in this case. The scanner must return -a fresh Symbol object on each invocation, because these objects are -tagged with parse state and added to the parse stack. Object sharing -does evil things to the parser; don't do it (you won't get away with it). -[Symbol recycling problems reported by Ken Arnold ] - -Improved scanner interface, designed by David MacMahon . -The new java_cup.runtime.Scanner interface is used by the default -implementation of lr_parser.scan(). See the manual for more details. -Old parsers will work with the new runtime, but parsers generated with -0.10j will not work with the runtime from earlier versions unless you -specify the (new) "-noscanner" option. - -C. Scott Ananian -Laboratory for Computer Science -Massachusetts Institute of Technology -Jul-24-1999 [CSA] ------------------------------------------------------------------------- -CUP version 0.10i is a maintenance release. - -A one-off bug in the parser error-recovery code has been caught and corrected -by Chris Harris . - -The fields in the emitted symbol class have been made public, rather than -package scope, since the class already was public. - -The issues formerly addressed in Appendix D (accessing parser methods/fields -from the action class) have been partially addressed by adding a new -private final field named 'parser' to the action object that points to -the parser object. THIS INTRODUCES A POTENTIAL INCOMPATIBILITY if you had -previously defined a field named 'parser' in the 'action code {: ... :}' -portion of your grammar. The solution is to rename your field. - -Finally, incorporated Jako Andras' suggestions to make CUP more friendly -to makefiles. - -A reminder: please submit bug-fixes or feature-additions as *patches*, not -complete archives. Your patch will have a greater chance of integration -into the distribution if you package each feature or fix as a separate patch, -instead of lumping everything together and leaving it to me to figure out -what you've changed and why. - -C. Scott Ananian -Laboratory for Computer Science -Massachusetts Institute of Technology -Feb-18-1999 [CSA] ------------------------------------------------------------------------- -CUP version 0.10h is a maintenance release. - -Starting with this version, CUP encodes the various parser tables as strings -to get around java's 64k method-size limitation. This allows larger -parse tables and thus more complicated grammars. - -Furthermore, a long-standing buglet that would cause CUP to occasionally -generate "Attempt to construct a duplicate state" internal errors has been -fixed. - -Another contributed Microsoft-compatible makefile has also been added -to the distribution. - -C. Scott Ananian -Laboratory for Computer Science -Massachusetts Institute of Technology -Feb-10-1999 [CSA] ------------------------------------------------------------------------- -CUP version 0.10g contains bug fixes, added functionality, and -performance improvements. Thanks to Matthias Zenger, Peter Selinger, -Jaroslaw Kachinarz, Ian Davis and others for contributions. - -- New command line option '-interface' added. This causes JavaCUP to - emit an *interface* with the symbol constants, instead of a - *class*. Without the command-line flag, behavior is identical to - v0.10f and before: the symbols are emitted as a class. -- (minor) Added toString() method to java_cup.runtime.Symbol and - modified the debugging parser to use it. This allows you to - override toString() to allow a more intelligible debugging parse. -- The CUP grammar has been extended to allow one to declare array types - for javaCUP terminals and non-terminals. Matthias Zenger first - suggested this feature; Peter Selinger was the first to show the - right way to do it. -- The symbols prefixed with CUP$ now have the parser class file name - added to the prefix as well, to allow more than one parser object - per package. Thanks to Jaroslaw Kachniarz for pointing out this - problem. -- Fixed bug that prevented one from invoking the parser multiple times. - To quote Ian Davis, who found and diagnosed the bug: - Repeat invocations of the same instantiation of lr_parser.java to parse - distinct input statements fail for the simple reason that the stack is - not emptied at start of parsing, but the stack offset is reset to 0. - This has been fixed. -- Fixed bug with implicit start productions not receiving a RESULT. -- Fixed bug with RESULT assignments that are not right-most in the - production. -- Updated documentation. - -Known issues: -- All known bugs have been fixed. -- The java_cup.runtime.SymbolStack / java_cup.runtime.intStack - performance hack originally suggested by Matthias Zenger has been - postponed to the next release. By eliminating typecasts and - synchronized methods, a substantial performance improvement can be - obtained. Backwards-compatibility issues have forced the postponement - of the code merge. - -C. Scott Ananian -Laboratory for Computer Science -Massachusetts Institute of Technology -3/24/98 [CSA] ------------------------------------------------------------------------- -CUP version 0.10f is a maintenance release. The code has been cleaned up -for JDK 1.1 functionality. No major functionality has been added; any bugs -in 0.10e are still in 0.10f. - -- Removed trailing semicolons from class definitions which upset strict - compilers (not Sun's javac, for some reason). -- Changed 'PrintStream's to 'PrintWriter's to eliminate deprecation - warnings. - -As of this release, the javaCUP code is being maintained by -C. Scott Ananian. Suggestions and bug-fixes should be sent to -cananian@alumni.princeton.edu. - -Known issues: - -- Precedence bug: rules unmarked by precedence information are treated - as if they had existing, but very low, precedence. This can mask - parser conflicts. -- Efficiency hack: java.util.Stack will be replaced in the next - release with a special-purpose stack to eliminate - performance-robbing type-casts. -- It has been suggested that the symbol *class* should be an - *interface* instead. This will be a command-line option in the next - release. - -C. Scott Ananian -Laboratory for Computer Science -Massachusetts Institute of Technology -12/21/97 [CSA] ------------------------------------------------------------------------- -CUP version 0.10e contains a few bug fixes from 0.10a - -- %prec directive now works correctly - fixed by cananian@princeton.edu -- Shift reduce conflicts are now correctly reported - fixed by danwang@cs.princeton.edu -- Error with reporting the positon of the error token also fixed - fixed by cananian@princeton.edu -- INSTALL script now has a slightly more complex test. -- foo.java.diff included for changes from previous release -- Fixed more bugs with reporting of shift reduce conflicts. - fixed by danwang@cs.princeton.edu -- Fixed bug introduced by previous fix patches from - Added '\r' as a whitespace character for the lexer suggested by - (dladd@spyglass.com) -- Fixed botched relase -Daniel Wang -Department of Computer Science -Princeton University - -Last updated: 9/12/97 [DW] ------------------------------------------------------------------------- -Changes and Additions to CUP v0.9e - -CUP version 0.10a is a major overhaul of CUP. The changes are severe, -meaning no backwards compatibility to older versions. - -Here are the changes: - -1. CUP now interfaces with the lexer in a completely different -manner. In the previous releases, a new class was used for every -distinct type of terminal. This release, however, uses only one class: -The Symbol class. The Symbol class has three instance variables which -are significant to the parser when passing information from the lexer. -The first is the value instance variable. This variable contains the -value of that terminal. It is of the type declared as the terminal type -in the parser specification file. The second two are the instance -variables left and right. They should be filled with the int value of -where in the input file, character-wise, that terminal was found. - -2. Terminal and non-nonterminal declarations now can be declared in two -different ways to indicate the values of the terminals or non-terminals. -The previous declarations of the form - -terminal {classname} {terminal} [, terminal ...]; - -still works. The classname, however indicates the type of the value of -the terminal or non-terminal, and does not indicate the type of object -placed on the parse stack. - -A declaration, such as: - -terminal {terminal} [, terminal ...]; - -indicates the terminals in the list hold no value. - -3. CUP doesn't use the Symbol class for just terminals, but for all -non-terminals as well. When a production reduces to a non-terminal, a -new Symbol is created, and the value field is filled with the value of -that non-terminal. The user must know that the terminal and non terminal -declarations specify a type corresponding to the type of the value field -for the symbol representing that terminal or non-terminal. - -4. Label references do not refer to the object on the parse stack, as in -the old CUP, but rather to the value of the value instance variable of -the Symbol that represents that terminal or non-terminal. Hence, -references to terminal and non-terminal values is direct, as opposed to -the old CUP, where the labels referred to objects containing the value -of the terminal or non-terminal. - -5. The RESULT variable refers directly to the value of the non-terminal -to which a rule reduces, rather than to the object on the parse stack. -Hence, RESULT is of the same type the non-terminal to which it reduces, -as declared in the non terminal declaration. Again, the reference is -direct, rather than to something that will contain the data. - -6. For every label, two more variables are declared, which are the label -plus left or the label plus right. These correspond to the left and -right locations in the input stream to which that terminal or -non-terminal came from. These values are propagated from the input -terminals, so that the starting non-terminal should have a left value of -0 and a right value of the location of the last character read. - -7. A call to parse() or debug_parse() return a Symbol. This Symbol is -of the start non-terminal, so the value field contains the final RESULT -assignment. - -8. CUP now has precedenced terminals. a new declaration section, -occurring between the terminal and non-terminal declarations and the -grammar specifies the precedence and associativity of rules. The -declarations are of the form: - -precedence {left| right | nonassoc} terminal[, terminal ...]; -... - -The terminals are assigned a precedence, where terminals on the same -line have equal precedences, and the precedence declarations farther -down the list of precedence declarations have higher precedence. left, -right and nonassoc specify the associativity of these terminals. left -associativity corresponds to a reduce on conflict, right to a shift on -conflict, and nonassoc to an error on conflict. Hence, ambiguous -grammars may now be used. For a better explanation, see the manual. - -9. Finally the new CUP adds contextual precedence. A production may be -declare as followed: - -lhs ::= {right hand side list of terminals, non-terminals and actions} - %prec {terminal}; - -this production would then have a precedence equal to the terminal -specified after the "%prec". Hence, shift/reduce conflicts can be -contextually resolved. Note that the "%prec terminal" part comes after -all actions strings. It does not come before the last action string. - -For more information read the manual, found in manual.html - -Frank Flannery -Department of Computer Science -Princeton University - -Last updated: 7/3/96 [FF] - - diff --git a/Robust/cup/INSTALL b/Robust/cup/INSTALL deleted file mode 100755 index 49708521..00000000 --- a/Robust/cup/INSTALL +++ /dev/null @@ -1,107 +0,0 @@ -#!/bin/csh -f -# -# Cup install and test script -# Scott Hudson 8/31/95 -# -# Last revision 7/3/96 (for v0.10a) -# By Frank Flannery -# -# Last revision 11/16/96 (for v0.10b) -# By Daniel Wang -# -# Updated version number 7/24/99 for 0.10k -# By C. Scott Ananian -echo -echo "================================" -echo "Installing and testing Cup v0.10k" -echo "================================" -echo - -# check for this directory in CLASSPATH -# -set cwd = `pwd` -set c_path = `printenv CLASSPATH` -if ($c_path !~ "*$cwd*") then - echo " " - echo "WARNING:" - echo "WARNING: The current directory does not appear in your CLASSPATH" - echo "WARNING: it will be added for this install/test only" - echo "WARNING:" - echo " " - setenv CLASSPATH $cwd':'$c_path - echo "CLASSPATH now set to " - printenv CLASSPATH -endif - -# change to the demo directory -# -echo " " -echo "changing to simple_calc subdirectory..." -echo "cd java_cup/simple_calc" -cd java_cup/simple_calc - -# remove old copies of parser.java and sym.java -# -echo " " -echo "removing any old copies of parser.java and sym.java..." -echo "rm -f parser.java sym.java" -rm -f parser.java sym.java - -# compile java_cup and run it against the demo program -# the -cs (for "checksource") option here will force the -# java_cup and java_cup.runtime source to be compiled prior -# to running it. -# -echo " " -echo "compiling java_cup then generating demo program..." -echo "java -cs java_cup.Main < parser.cup" -java -cs java_cup.Main < parser.cup - -# make sure parser.java and sym.java now exist -# -if ( ! -e parser.java) then - echo " " - echo "ERROR: for some reason parser.java was not created" - echo "ERROR: install was not successful" - exit 1 -endif -if ( ! -e sym.java) then - echo " " - echo "ERROR: for some reason sym.java was not created" - echo "ERROR: install was not successful" - exit 1 -endif - -# run the demo -# again, the -cs option will cause compilation of all the parts -# of the demo program (including parser.java and sym.java that -# should have been generated in the previous step). -# -echo "removing old test results..." -echo "rm -f test_results" -rm -f test_results -echo " " -echo "executing the demo program..." -echo "echo '1*-2+2;' | java -cs java_cup.simple_calc.Main >& test_results" -echo '1*-2+2;' | java -cs java_cup.simple_calc.Main >& test_results - -# compare with standard results -# -set res = `tail -1 test_results` -if ("$res" !~ "= 0") then - echo "ERROR: test program produced the wrong results" - echo "ERROR: output was:" - cat test_results - echo "ERROR: install was not successful" - rm -f test_results - exit 2 -endif - -# all is well -# -rm -f test_results -echo " " -echo "==============================" -echo "Install and test was successful" -echo "==============================" -exit 0 diff --git a/Robust/cup/INSTALL.QUICK b/Robust/cup/INSTALL.QUICK deleted file mode 100644 index bf708b67..00000000 --- a/Robust/cup/INSTALL.QUICK +++ /dev/null @@ -1,17 +0,0 @@ -This is a quick installation guide for the CUP system. -For most people, the following steps will suffice: - - 1) extract the java_cup files somewhere, and ensure that - the extraction directory is in your classpath. - - This will ensure that java_cup.Main properly refers to the - Main class in the java_cup subdirectory of this release. - - 2) compile java_cup and its runtime system. - From the installation directory: - javac java_cup/*.java java_cup/runtime/*.java - -That's it! Read the manual now. - --Scott - -24-Mar-1998 diff --git a/Robust/cup/LICENSE b/Robust/cup/LICENSE deleted file mode 100644 index f3f0299f..00000000 --- a/Robust/cup/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -CUP PARSER GENERATOR COPYRIGHT NOTICE, LICENSE AND DISCLAIMER. - -Copyright 1996 by Scott Hudson, Frank Flannery, C. Scott Ananian - -Permission to use, copy, modify, and distribute this software and its -documentation for any purpose and without fee is hereby granted, -provided that the above copyright notice appear in all copies and that -both the copyright notice and this permission notice and warranty -disclaimer appear in supporting documentation, and that the names of -the authors or their employers not be used in advertising or publicity -pertaining to distribution of the software without specific, written -prior permission. - -The authors and their employers disclaim all warranties with regard to -this software, including all implied warranties of merchantability and -fitness. In no event shall the authors or their employers be liable -for any special, indirect or consequential damages or any damages -whatsoever resulting from loss of use, data or profits, whether in an -action of contract, negligence or other tortious action, arising out of -or in connection with the use or performance of this software. diff --git a/Robust/cup/README b/Robust/cup/README deleted file mode 100644 index 58bacd79..00000000 --- a/Robust/cup/README +++ /dev/null @@ -1,48 +0,0 @@ -This directory contains the CUP v0.10k release in source form. You should -find the following files and subdirectories in this release: - - README This file. - INSTALL.QUICK Quick installation instruction. - CHANGELOG A brief overview of the changes in v0.10k - java_cup A subdirectory containing CUP, runtime, and test sources. - cup_logo.gif A logo image used by the manual. - manual.html A user's manual in HTML format. (OLD) - INSTALL A shell script to install and test the system - -To get started quickly, read INSTALL.QUICK. If you are on a Windows -platform, you might want to look in the winnt subdirectory. -For complete installation information, keep reading. - -To install the release, copy the contents of this directory (if you -haven't done so already) into a "classes" directory accessible to the -java interpreter (i.e., a directory that is listed in the colon -separated list of directories in your CLASSPATH environment variable). -Note: if you have an older version of the system already accessible -from your CLASSPATH you will want to temporarily remove it to avoid -conflicts. - -Once files have been copied to an appropriate location, you should be able to -both compile and test the system by executing the INSTALL shell script -(sorry, but non Unix users are still on their own). Again, be sure that -you have placed these sources in a directory listed in your CLASSPATH -environment variable (or changed your CLASSPATH to include this directory). - -A manual page that explains the operation and use of the system can be found -in manual.html and from the CUP home page mentioned below. - -Bug reports regarding the installation -process or the system as a whole should be sent to - with "JavaCUP" in the subject. - -The CUP home page where the latest information regarding CUP can be found -(e.g., new releases) is: - - http://www.cs.princeton.edu/~appel/modern/java/CUP/ - -Enjoy, - -Scott Hudson -Graphics, Visualization, and Usability Center -Georgia Institute of Technology - -Last updated: 23-Jul-1999 [CSA] diff --git a/Robust/cup/cup_logo.gif b/Robust/cup/cup_logo.gif deleted file mode 100644 index 6d25eda453401e2eda28f173661fe1ea146cf621..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8054 zcmV-+ABo^cNk%w1VaNfP0J8u9|NsB)?(W^)-OS9)ySuxps;ZfpnTUvpcXxMYW@c4Y zRYXKYGcz+HA|eqH5dZ)HEC2ui0LTHD00RX7aL7rky*TU5yZ@jh2tgnag>fKBqP#6~ z7zJ^S<(aPStHd*cEkrCDkI1BQ$!t2G(5Q5SGYJMemJ61U8HSbW2&>ZifM4)*&2GEj z@VI==B;^LE70U-h(9{!lCU^yUTW5YXfOL$Fj*pO$l656kWITs3Gc^{1V_7|X37d

s;fnwS14tfFJ7D!u7t6Cv!txOzQ4f1a8-k_Ji0$JwSk_v$GTkyio(>@*4Nk~ z&Bh3OFAG1>%LBx(S>6iZExg(7?(gt%f|fha>3u=AmGmn1;K|a2#2ZMkpg|8KZV@mL zOIEZm%oH-j1dUdygBUYvtd_9S7;fnQxUlP(!(5q=;YeNF$g-u&Naajo$`s?zkeJT2 z(ClLKrO%&0<=`xEE)*AK0?FMXdeUe(q$`6;ok|r1PLNK~B)wX6re9)w_6=h>=P0%)@1So%KD+&ccBP4-!9Ez@Y%*#0V}BSfDsD zm;w(PP(a{7u>-pp5J#qvKrsV&Wf?SRpuo?yws=VZm`%GjZ4+|m1jg#M@b0dn{$5 z5W=wj9|-|w3&`z8OinX?SpxVl_NoHY4bV*m1}KoL zsV*b{UaMHRpebFu&SFFVH;CzZBN%kSpy>don)<^k@aZR3H+14D?zniiri=h}IcY>f zC*)y>D1#C@f)ItgduWjsbav$ijZQ!Shy#>{reuj>=71U^hDt$}10a@bV$&IbVPfiK zHbG}+5%Ab)2Xy8@#Sc`#8O4ZM_@bGL^@=IP9~?$aBw`ol zdLfHgnPL-^_H$>84uCNp8>b>;0L;!w?$lJvGOKCU1ekf~T!Nobw`SQCV5s5*96sBjuNj^# zLCG1wCINa5ATUJ#b9Na#UuP{m{&|M6E+8hu=qUh(h|E#&@dPJ7NhaWj4=}g`g`*;) z0B?a?_3yw(gYAk=aNQKV0cBvkz4(k{0f%i<=xGI@QoynX=wbNfLJj6lumjB{EkS1% zvVARLpfz_|-WP|g0ftE@$TMX#z>ERg8HhMU_G(~g7l(|IpO!|12hdTVIbzBihe8#p zTvZQeqFb27DiEfXt?xU!(@*ad0K5(YPg?zu+!3yj6G7cadGi?(yiSNEPG!Ic*kOP! zlt#cY@k|4cnb5=>zyOuGWibti9t3YlshZueG@-LqVzh&S(j={8hr`(GGN3&S$WKfV z0$j9awxS~c+U|x`ELvi^^RFnmZ~|du-1RP0L&IT^0{?O!61j7V-RXgY9?awKT2mLT zIe}hD!Uqd80LZ}z2Zyz@K%|CNnFhphLlxYBV!8u84>%E5d?TQ8#HXgVWhs$5^Nb9q z^GHlh3^Zj#PgDvP8l+7QlUTrxs%TgM42>psvBMT(z_&8u49s%}R16pZ_DZ-RaAq8u zB}_EvJ3TtHY9RFE5dgsrqZ|@J6{seuEJ8?D@(YxPi{1nCml!S~MwwJx&RP~SvGVwD zQ}AnFoi1>}CF8&W_~PqfcZI6h1jPowuu0}fEQ&~o_}4cg_l(vRykFcSzHU4kXw*iv9&}GG-p92Bi;oj z=A?fOOk->6%;hrVrwcSFellC)k3N)DrEU&pdqXDQ#5VxSSZAo{Y=nOFVA9HbYyr{# z=%aM|xChlZ)CJ=LS8a=Mlle4c3yS@kzeM2One^eYlD!+?@=4tG#Y#deDbr-Rc?*eb03FHMAlbc>$I6%OMfBJ zt-B&%upLY(Yh=*J-6E(TeN2Gq7|;a}cViUlvZ7L6@m<191Dl1a@lyga7dvHUltdX- z=He*AQu?Z|d~FR4-lCeg!j-gZDn;5l;93KSW@RwCayIqUmJ~FVZK^HA3v3wU=3wmr z6H`@bMiVK`c{c$jx^I+rjh72-SxS@IFppZ9kp>N)1rD9hz1o0&_oEq!!h{^ynr1#z zU5*-ZO^4ZF>%)1>p`Pk8tRvJ*q0N-ELbn?NJJ2}O;sCV>?ocBDH4oG+f@AN(EJE1% z!3L@Y+>NR|Q-4b?QjZRi4`na}%PCS10WaH)c8h|9QwM8dy(|_WPVhw})Q7$MH{klc zaX@72fIDK*3QSBQlDDB-2?e(Yzv}2H(4{OZ2v-Y6(F%9tLB~M2F{kPO4fJ?h+!ts1 z$$ay&2KWTvEtKvc&1cXC6^ugW#Zi&VZ{U$j*gF|F4Mf*#3ig6$!%IGiC(~aJfB>u@ zuT`VyxXUetLX=^p(Dk7P%2C3Kgq`oz^t;*DZVIs6)s=*AdfRh8^URR==t_`_LhS@+ zy(`Zn@BTU;|Bm^eXL|F4PkbcUw(2mQRrF18I^%)I&vY>&0KU3YY1qAYcgqANMjyH* z0*^eQqy7{HP;p>+^?NC(9_v-R=O`@y1^~p~Y7O8y2ZD5ar~IHWM%q2uuOIf}|AGK; z7IYNEvW0;|J_#OHOSTe9_aq!2#8WHhSP=buzb=6J@~2&i6{ws^=#HOt|8j{pD(H7@w)e<>75|G*P7#V#M%7a=${ z0w@g176sXp02H@LjPNRx16>ya4p2aW@JB97WLS-mA1iQD9motN_+k|i1f?(rfl`EN zkb=PwU`~J{bO&v8AcGB~P_{#bO)wj)_d8({9g+Yi6-ZD)m`y3*X(`cta8!oyHVSBX z5Z&T!G*A!%S9gE|!P_#&;WdU<0tH0t+|^-+*eZ0Xq#?92MaI0z&|Pfpv>5AkZ;8^BT=&_c))|ypfRiVF{=?71h7!)@G*{pK_bE$Wg};E7An3r zd=lb5bC^$Df`AnB5B9@2z8HKCf`#q}hLgvI$oPrb2mn7QE@85Wo2Z7>C{yyrh!hDR z!oiRrpn*D~BZW9ZGZJ&iXD$ztjMeZ?{?Zv5(oj?qM`I#>^aL3dfIezuPz@Dl?&DKs zf;qi{VQUjnDd0$>!UPm3bqhHOvyo6aNLwC2FB!T2a~p{k&o~j)hz7pb1^{qZ7ASp6 zFp@7eHPIB3!Qf4=q;c$_K71kb335a*bR36;FLBfi;uTzQ)k zi2)>)Zoe~bURVti=2K^tMYhz6GzCFal1nH9B25)a77}cy`DAOLg^?M5i$RujaC}qq zC|jqSi`ftLk(CI-o=kC=?|G4IaERlHC)v^ee$zJ_9%hWoDFZN84d^jT2xkEg^fSVk zPNPwvn}QxN0)w5>Hcps2uf}#v`8$ZwL&wPm?-zfIQ<%V6hBP1-F(#ixL82*YpZAG~ zI%u97kRMOi4JM^-!b1%emS+KlL6HKU9k4XTW@{ZHp>bs$0VYsZ5?sv}0D`HIVXsHo@9XbKa^(x8NApj~v>&B6C05AZwY%ZiGUpj3&DKl;I zP$5NH9)cM#!Z38{2KnKlvNT!cH9VKM7yP%!zJ0wAVi$}4EP1c~;j z)H`OTTC5P+Lx%d8&bNg+Sg45yh87s2!#bmws-In`H3z_?Wr~1*sS0#j zG%1xip6R0;U}PbZBH$5`o_V2=lOg^jlUf<8WqK!sxJ;0Vt7*op8UdLWNSGdQs}U=A z$T}bRNiJ4Go05R4WrK}HU@3~ENN0nIis`a%03UuzF66VXdf9fpqoK5AvOnRG7O1Nn z;BD$kuMI$A6#%q4h?}dhnQqYkKnBrvvih!6=Lp^MZ4oQ6$S8X7F)Cd-hW<&ZeszH; zsj)W8vA$rfZ%_c_a}Y}VrxI0cQKSJ@gAa#JL<`Tye_^fmye80vW+;1hnyO7VBf> z87re(qtF|@%V{nHM;$mj0J%GeLVE+VTc(fEXi<^9`nkJ=$D-~)vzc4Gn=2H_s|UnO zulLt0&nvz3TfgL@SazZR0{u3!Qc51o=X7sTruXCpLtC>FOTJ794^o@8?R2~!a2rwc zzVOR~^J~8re8C{}Qn)+15gU;gaeM-7yVnb*2JB-9oWSl7m|VEN9$Fh%a3c~t!9G;M z7hJ>jyLsdYyE=Hnwt$1R8^4d{kn^g!4vfN(z`x`Ps8b-LA#x)_Ts4ouxVW3XHeAJb zf;%z{k*3?#|wK@_E_=X%SyY`-jtfpE0R4_PPZ z1{%w(gWHR}_<776dVa1fu`bxm)=PF+4~?81?b9=-#Axxt?0f(;4Uy89AHGtoWSazI zP0Ua&4C~CiS^WejpisN^F?^KIA<)xYtw)cNa90qSL;AMjqMqbno0S^BUs=$qOx0~I z1r05+@CpY75UZAY*LeMhTfNtD7t=9XfAAyL-wcrALJgV5xXljS zwVCVxl;PbAJ&ilmT@B}r-c<7fi@3n-{Mf~-B8F|O{#?XH9ki>R-$r@goE;DU4dCRm zZb1kiUi>I84b281sD$j*YVF+$F5(bAQfAD<<_+BzekZMQfBflmovb)QecuRh&acdH zsW;0`UC}3=gj8& zwIUl0rh{C(Q*GrDjpb+Twnfh6>V`G!;=<}0En@xT`pGM2KBUGi zsXV@}an0s)pypw%<#8_OEap;|;lAH3)QEh)l!`P}>jcAVfkRH{kN`DJ{>TcP=!$Ot zra7WwIWE?oEiOKghzkw{<4QH6QRSL`1f34+$_477&a=?5B8IMzCjONW8?5~u>u*2+ zkxtgMj@-6>>*QI;CcS7$Dc5AKzQ-=?A5Z|}z2=#_kI^N)oH=s9&uW(E4g%{|1 zKJA5`?Ai{g8m(GuO*NGM=l!YJ+`l~}??W5yG%oZt4+TO{tkb>!@BGfp ze@Nnkxbdtm-?HiHM^6VIPV(q6=>Glin%(nxjpcX@^WPY&>D#kcF9~N+!eGDRP4D!1 z-Qk$d^?42AjjVFa!jjupZDmJpLN*x&G+|Q9rzva z)(VdJH;A7M?9b<#_{07M`8j)=-}P_5v~NoEC>{E7pU`*D`J*TEc>)fOua%JR(~=*f za{susKY^GZcSGvqtX~8vK=0UE=|n#I*xr%Fu7g_l1Ty+|P^|gCKMDUcp1}z6`aSy| zo%b^hzMIa3s ze>Jfm_X1GP5HO?!h+UlZ=G}iVdy-=^&r<-7%;I5TY_#MG+#G&E^rfh(jz~jH`BV>mCr}Ub-OX_x*psKq0Gw zHjSOaIKify9E691y&3=msk2MWGZ;xDfB~Kk2N*RaE>AndJQB{uR@Yb9Ks!6Pj06M& zD}&e~t^vCT2T~MD(9C0GjRr`p&O(<4MI=+4r=42WNZxJkZts()T;mI>E34*j3LKrb z2RNaC=j8e1;Nh*6agC7zI-CH10R;vaPykh`5X00DF}U=nD#!=}m*q8!9v_0Z=}pfq&t;Bc$NlZ&wE z{342Bln?>}^pT|M!QID6Qb8=BV$xtmXA;qQ0Q8R!&pu1nTmR(NxeaC^fjLFg#!}FUr(pr z$BM_L;T zLBN5&Vj@mR$HC%%1L9LG?xS1xCKJv47-y}B`i|FfkqYo05w7`9iV8<2II1*%a_E|t2 zTc80dh9xY+)ucm$);1d0Qc-Zj6?fc4(NuHO8dPAxgJl?m_FZ_FKB(=1dpY@

    Wl(*rGd@(bz|8Kj1N#4QHI#WgC`N5I&xR7Fy)krZtRAFuw#7%x@R< zF$PG5-Yp*&;F9`kp)K;)&@U17I!p!}WsLxV$~OCKw9{65ZMNHP`(a!!h$f&Xv9_CH z@JwcPfQOaz`)|Ml7kqHS3n%=85^rMpZpL~4=BwsVBcHOP#T&OA@6S$^eDhpk;PrCQ zv;HJ*&P%^Gnw>*eJyrt*pwV>LQG2iQ)oYLR2`?azefMMR`P_Ekp&g2J-ivRN^5Bz) z*BV-kcOH{v;P_p6>Lb;&`RB8DF&L|>_kL16Wz&BA4Rku|d-Np@abu3j&%Uhl)0f{( zq%v-lEBATN5HW4%_dh?Fjlo;wB47axct8Xu5L`_O#bKbfA7Le6dPzW*1PGu2B4Dr& z1xSFfc2S9Dz$F2!(BK3J(1HdefEV;iSn7hXfEXD-STm#oR8)vJTIo%PJLF*xeW=4v zKqE0sAOIW+5RnYtZ~za8Nev}%00s>Ip#To(g96M#8PK$00u&j51K0#b6Bxh&3IIX@ zN+^UWE};O_a!LP=a7Gm9;E1_6;-<9tzac5>RKd{#&`cN}2>^19wlRnUj%b1guqj~$ zF<~=~Sg1e(@;jVB(RXOzqZ6obje(>h0Um(J5*7dw6DU9w1BnGney0V8JY^tVc>*y` zP?F$j2X{1h{zsV_6Xw)EWa2rZt9LaM6kjKtT(JgUSX-fQxq=KmtZ7PYrrO7z424 z7$_4@1K>rU8{;Rn7(f|bV)6w4`y{0V`gza+oRb0Rq(upy$rUDc@H-0#Cl#OA03aB0 z0trCVI|>!B0W@F_(^6tFtCJFTL4ue@uz)*O3I>u+;FAH}q8ds$Mqy18Jn^jOC&38> z0(g;|TV!WJqNq|iL2{v-Fu(&Ou}K3ERZfBAXfv!DNCoU+L*JRGhDPZdHjo}HOyJ%ME_aTHGC&wIuFf66SjAfq%SxcN^pti#y z>Kb_($P^-glk%m733z#eF^q5mz>;TZn;KzGjFARTY=cKI{M-p!;j6zLfB_7(rp&4^ zX7@p^awVu!6WH^E@hz`wis1r3DuE|QRKPBxVGzZ(#0{H8YOO4((`IlH5>d3$Vox~2 zJv^bu2hA!5_j+IjPoS(`i~=d6Yr(!MI8DQOZzU|yMg(|L5+e1bNYE@wN3y8^3o!9h z-5jET{u6^JePY7uc*$8vRx8c9y%>~Zsi*diumoeRCmd_c7=Z9;15e39A%vA?3wCf9 z9E6V@dDZXjZLAV*0?LvL<&WpZ?7av(A;GcGqEZ)PA$VQwHYIV>PCIXN@{ EJI^I>4gdfE diff --git a/Robust/cup/gnuwin/README b/Robust/cup/gnuwin/README deleted file mode 100644 index 53a94987..00000000 --- a/Robust/cup/gnuwin/README +++ /dev/null @@ -1,30 +0,0 @@ -Date: Fri, 05 Feb 1999 17:11:08 -0600 -From: jon miner -To: cananian@alumni.princeton.edu -Subject: Makefile for NT/DOS - -I've made (hah) a Makefile for java_cup that will install and test java_cup -on NT/9x/DOS with GNU Make... - -You (should) find it attached. - -thanks, - -jon - -------------------------------------------------------------- -Date: Sun, 07 Feb 1999 17:30:33 -0600 -From: Jon Miner -To: C. Scott Ananian -Subject: Re: Makefile for NT/DOS - -The Makefile included is for Microsoft's (I think) Nmake... it doesn't -jive with just plain old GNU make (At least not on my machine..) Also, the -Makefile I wrote _should_ (I haven't tested it, though) work (with minor -changes) on Un*x and WinTel machines... - -thanks, - -jon - -[The makefile has been included in this directory. -- CSA 24-Mar-1998 ] diff --git a/Robust/cup/gnuwin/makefile b/Robust/cup/gnuwin/makefile deleted file mode 100644 index 30f00d21..00000000 --- a/Robust/cup/gnuwin/makefile +++ /dev/null @@ -1,26 +0,0 @@ -SIMPLEDIR=SIMPLE~1 -# SIMPLEDIR=simple_calc -RM=del -# RM=rm -JAVA=java -JAVAOPTS= -JAVAC=javac -JAVACOPTS=-verbose - - -test: java_cup\\Main.class java_cup\\$(SIMPLEDIR)\\Main.class - echo "1*-2+2;" | $(JAVA) $(JAVAOPTS) java_cup.simple_calc.Main - - echo 'If the line above says "= 0" everything is OK.' - - -java_cup\\Main.class: - $(JAVAC) $(JAVACOPTS) java_cup\\Main.java - -java_cup\\$(SIMPLEDIR)\\Main.class: - cd java_cup - cd $(SIMPLEDIR) - echo $(RM) parser.java - echo $(RM) sym.java - $(JAVA) $(JAVAOPTS) java_cup.Main < parser.cup - $(JAVAC) $(JAVACOPTS) Main.java diff --git a/Robust/cup/java_cup/CUP$parser$actions.class b/Robust/cup/java_cup/CUP$parser$actions.class deleted file mode 100644 index 79416853b16d91deed0d225981d03f5a84c3079c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 15583 zcmd5@34Bvk)<1WBFUd=qrb*MZX`3PllvPo{BFJKq9i*V*Rzn-0+NQNlS!7&r+}FW< zcT^NaK|pC$L_03vIDU>B-glP&J?GqW&r9kv zKR^5^031M$u|pZ$uE8C4ps+%H+-ZZwaF+%vby#Hw33sdUY8~!T*L&^I1J>xUR)hQO z;DUAPW4-#=pq|{Xcpgw68*R`A?K(VYhlk){HM7YMJ>d}@HtX=H29Mbx2pu~7#STkg zoqGPb22W`4q*Aj^gQpa?Ilo0c+^RmF*5I#pcn1DvgTC;r9Y6j@-94wn-|g@`yr9F2 zI=rOA%Q|e+;U7A@qQk2?yr#qJI&9bB4ISRp;bI+j=&(~s?$Tkm4sR)wZ|m@m9c{d; z!FzV7g!h&G50pPXR7l^~;UgVB*5DI6Oo6)<=chKb`I!!%tHJ*&d|znrr5&o^D>d`A z4&T^N@>?Cgv!TL&+TeTmL5F`Sbw8?)pA_%UcKC&WPKZvZPMA)(PJ~V*svw&B&{2-q zbYfRmhfWN2b?U^Wt~ok!t7|U0g?Q9mo=&`ImiTm%Zzq0Ipp$?`3N=zhK$|+|nCh7m zstAyY1f1gF}G&R6^`OB&`j)+4_! z{EP!|o?qkybOu!_Zo7@Mn` znjhYt=MtFEC*yIag~qXFE~W3UGZWzB8kOOk zDRt4vwAO~Xk>*)ybp-5{i)$iH%7HB!38M9AWKlJ`kO1q`_b38}LX&hpf#NP8DRy_b zsVNeztxmZf-5M9MxLvX4wl>vadv+1Sa*Fn088YYcy8Z5E)dD5s6F2eQ3tJDi*FeWyHh` zA12wW%=Eyx*sB^_n`y+CZaTNnqA{wNalpuywQpPjNOh|*2l8^y6kun3$f~5rV z6j$6ADbEuaH8F|_hS?LUY;JCBt_aOYg}WtGU)N9CuNiT!!PkI}q59w>b zMX=O>3t_27$_>(w^d~TQc2uQ`GLK;irNg3TF!Lje>sn%wXe^|*h}r=f8DNls3eX?n z9D@uZgH?bUTkC5>^Xd?Ek}rf?Ikad2`ZH7;si_aE4Vj@HGbH8Fq=-QdAO{lYKO>bJ z3DL01;EK?=aI|-bVeDKOw%To0TF=NoV_T$1ptS%$31 zqLCp6Ifxu=z{|>;H<6(RY*QG56YJ|E^D)Y;Es;>;yijultH44G?V`r!T8#`d$Z)t0 z_u#}SQ!0-bGX={H`ZwIt(unm#G}p~vfHj5JN9N(ho{j@PGpiClTT~ZYfR~nx^SK|ovrYB@_v+x=$5e7MgR1gRxoi#AAvVrk!5bA+3>k(QIZV83!nINHh_INUcFekVCP)O`m&mq$Xy-wQ4!Oq_RP1+bpCiOO#(m8e|kXOx=wpK#w~C z6Sh2aBgLV`HxgV8*BE4sa-%x&QAoe(-ENzjWys(xC+a0ypS(M zAY>dl90g`pR?VI=D>O2cdNRTwm2kdB#v9}aGJ!y^X^rXRo!8hLs!^U@9Bajhro&<2 zA-11ECgBI#o2-#32AQf%=1z>FxjM@R=oR`^Js}Ky-TY_+ZY?asRZF6=@ZxxRP$$`h zDz*30a4;}lEMm>EJ*Mrm68kdL!+;yrw!9v0Fvv7Gn?T9TNNsDh77yEy${AcxZ6wsE z<&?UnCftmD4KlqGmrAKUxn?M?P+C{KIPS@JWGB9OeD~y=NvaGoiwri%Y$YKgswf)7 ztKuYkR?QkSbCyPqGRV=&twWM-O=ydn#~b<;7Z$3E;y+AwRa#9{A@fwnEKVh5#?cYi zfM;JuMTnWmkHyUyTM(&^*J(_wJ{hM~$1P_4*M2SvGwNiDBgJxh=kD=j6xB)@LPe1E4*1IOfRF8Fu&5v}pANT)= zO#6u`>=RldF-xBy`b;z%h#a$`r%!eaQlvhjw$d2X@53%5!&51B1t>jn&j)5ll1i8Q z$YRyG*&}!;Co@3czHY^?AhW?tX_b*vu|TN)GBaYyWns4T&YVy5r5Pv^GYSQ3YDM_N zGx-yGGWe64_ncCZH)qYdn8-S%*I{OIbq#JA)IT(XDYIga=%Vj7z0NA9kH;9NO(ahl zm44=~HM?SG%9qNAm__k|n?9D4`O~RF>9ab(5$9CZy%jrh7yj~!C7*&me7N?Z_cYHh*2 zZ8Tx~8J-_Wyr>kWJd|uKQcWxJ)?&|Pwy;>DA%w4VOYj}Z0bbST0D(W?h{EZ>RX>RL zTs5BN75hT-ifx&B#dgNLVn<_M@!-TOsP@miVlRkSk7{=Cs-q@6Us3nvI64GJ>fNlk z{}!5>2B%=v)2(h+KI3HgIkNIme^5gZ>!K+0=Z$ zs`5E_;U`(t<%2+VcY~d*1}|9yC1fr1A@`*~Ni>9AO9IqP9H~_f^w_7OPDdLU*Msyp zr5zyPutXYl+@=pUR|h`YRK zBjhQ(UWM12*5Fe1$x9%}%aB91p)?-h3F$}h8S00{{kDQ@1Nc1oZQx%Cry#Zh1QftP zOzpoFdg7x5R8L_7tEVUl7zHYD1#H@Yzd-PM@D1pIAS%d1^0qd+x^SQM(C|rz2#Inv)@MO z(;4AMi10>mkXyhX0gs9Jp=XKw5)@ zJGA&nfZ&@*3jm6~LOKI!I#LLr@C&5Jk*-9lMJfjfypHr|q!~#000mo+aEBHgisS_F z??Ac_=`1AF?e77Qk9zZ;M8eIOKN<<+<$DAPar%ZM*#Nw#*Bb@M+l8C{d!&U(M7-cLO&fqTZe?YH4pCody!&D=xebGsTFA~QV!M(^clY!31#^>B*ehbZ)`QvA|%Ac za1LfS+sef!j|*m(+jSL~jF55geN;KZ8Cvo_;7p!*^Rc3)&j_eBoszR1Dd z7a7`pkzw5z8Qy)7L%J_g(S4B--4{8u`ywN|FEXmzBG!~2YTd{EhFW*tVI9z;!WOXo zSFP-Cg=iUBON(_k_p)$yRRye!-Sa{AR;=iHT8&yp)>T;^4d@=a-_?rhp#nB+qP9Sf zWb-r{yB{^@_Kb;lPgq}9!Z>7gc~wKu;b1C0b2lB zjyO85SM|vOdpk@}Q|6IWX!V3;^l!T?ZZw<43{jx1i%BEi1i{p@CT4;USm1V*jb`8M znH2An&4uTotjOv-OR=Yq?ygLk>^a#Z^Gr4)hwXt9$_|oMdsgXNt}+NS1noGj;+E0B zA9Jgn?ADX)czRo~bme6$V^$tWl~`pZyH@5mSiv`gDVVM8FtrV)neHyIYO##=aCZhS zb5ZGW{M<;7Att#FLm|1;Hl zS{uwR#}HA)*&Az#=cxFC%()G4v{_!JnL+d%lMG_joDHA^l4|dVV@*Y<%v@P8>y=p< zvr1cH7V?=}$dG_-E99#8?c?x$8>d&|D`)b!=rF(hsIUj@Tc9#vH{Yp8cJ@fXjxX75 zaD3u=LOYyT;pn8I4XRhdu#9)_lTxQoIGzn?yt88EYNZHWed)jBYK4AC0)0PaB*X7} z0grK52?d?_5X;`;lU*S)!&zjFl4WGwuqpQJw4~*PaW*@Bp1Ifw zm>7mzL0U(aS4DiJrH;J>hKz{{X|bMQNW(eIWYAL@;=NOP9IsO8alA^I7}dJc54zg_ z76@?*X#{Z#>2ZdIVJMhBq`P_pwlHSb|EavjcFO#It8$}RW@c`MUS{bmO_t7@)MiPS zPE{&Q2Mo1X?FydBZdlm6@>hyIolN^=x1J1Lu_KJM-o0flGNi-Njc_Rl>D1c?gmhf9 z3|B_9R9W1b?x!(%6a92LNGsu}@__w6eL|RlIoJ}%uEK6%%zBye_l2#HO2Wuq)|YC2 z`dW=xM%LnHd6Xp@wLj*iZ1u6Ku#Bv>Oh<(*3|-|ziajImEW%dp_$bY|w~}V+D@C^K z(y?5$!F*HZAgfjDsB_)@&tl+73`49|t)t%;1508!&}!8>vS2XXR%T(?XQUN-x&-Z$ zy`+2EyUFhBo_58a4*Wi`d%LGyv1g|p8PhJ@TNO70vtQQwutiS(E@Da^U;)05DwhS4 z9={pM;QufZ59*WYhR3SilG~kqGRVqn9a$vtQ5HV=?MMb%ZCghcBxW#`p){U-Caq%6 zE(`w)+O4m^`^2u;vs$$eqpBvZ1=+g(*wDvE4!5XO-4^vMo&o_ zJ=rws{(X(sE29l*qxGgy+wW^Ms*ETN2` zzRzU*|H6)_(|h7q4+~e;e%=60`1XW<#&GJFwL9gDHJ+1itP3otHPAfq5>78MXG(O4*+rBDo`o}Y772K-@{F{@7 z_#3kEI`Mxv9yv^(n)Lroy?}tDXf)FV~c4OTS{lKGwE!$iXP4Gp~the^aQqn zp2)V-lh_U#VY}%(_AZ^zU9^tp(kS=RMqWUh_!!#E52uUx5p*%1OqcK&UCI~Hv-oLr z89#%b%~#TM_-c9~UqdhA>*>Y(b$Tg(lU~7h(JT2o^eW+`*9bSgQRLB^grD9lM$=ox zIJ!cNr+11;^e)jtSBZsmjaWk0iqq+R;x4*g+)dlWy|i6CLLU^*(uc%O`mlJLZjuJw zEOY4N(nFt+J?NA2K>C!dq+8@fx>YvQzsgqnoLo$wm#5Pg5}14mQPh7dz5+H>jtjT^ZJJo(QYqqaqE%vo6W`Bh(w7<@l z+TUbsWoe|CJ$ZZkN$-SD$JjNWX8F^t`5Ok%5yW7s{$32co~ z!`2#Svj>dJSi8~A9x@(gj~bg6sXAtj|GlZAt4CDQCPT~V|YWR?x zdHmp<%lWXJEBK)~SMyOhkMhwuf8mumPx2#jw($u$@A64*7oXzJ7-xwu1fm-A)0*YQ8*-onqxeVAXE`zXIS_kDh8 z?nnHJ+)w#co_v0dC%|v?1o_RLN`9+n0$<^o%fF=3jfy=HGa);NN=hE!@u|5$N%MhmH*`3E~s~h;66=A zpItb7PT}+o6*;~`gx7bd$oEYZe%}cq;5$zg`7RV8-zB1lZ@K8{dsyu6+bsI|I`CwD zK@9Zm7K8Kc;=p{T7?$rAhvfUji2PAvWd0a2Hve#Oc>ZirnI92H7pDr5xGeyilTP*aS zAr||WiPQb(h%^0b#4`Unai0Hvae@C0agl$gxZMAiSYF@|R~ER$bp^TNhJp%lQ^81a zTft~?N5PR|ML}5HRdA75RdA_TQ}8FTuHZ(oq2NjJK*3h=P{A`|Q^9ueNWsVA(STQU z1pMNuK%sa#&`UfMm?oYL94TH1%n~mJBI4yhtN2IY7V&D}Ht}X)h1eCiPrMa)RlF0} zE|Hcf_AQzr2NqSy!9{Yl7QlB)CJK z9NaBW34S5#i-~L~_R7ZMLfKT@LpB%pma*dLa$)gIxwLq;JiYjId1moh@|@y7%JYiv zkrx!Nm6sN;mzNj6E|(X-DX%HsC9f;7$s0-xd230Iysc!oyrX1GChY`Qii<4=kS{299&3b*|q Dx=#Gp diff --git a/Robust/cup/java_cup/Main.class b/Robust/cup/java_cup/Main.class deleted file mode 100644 index fb7c76448ccae81ebe0dccac95424f79ba48e445..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 14758 zcmb7K34B!b@t>JZ*q6=Y3ilNrQRGZew4w=e7RqI925J^=Ok7^IAt<|>H+S)_?+fsYl+Lr%!e($~A%>uSfKJWdmnfc9celzo% z-@JY0-+P}XqT^&=h3aZGz!wI^lS*Ht1`kHaBT) zv(_%q*M-{rg2fkUT2IyDV-G^6n6==Es%$ zCxYA&*-7lZtg#ow~{Wo^Bpd-H7_{C1GP6QT?@7_aZ@>w6Zz8p8H`KSW>T*UI^I{(-)J z800s~(DNgGy{Thw=~91e@lUkzQ;Xl$P5oJjuIAT*{En7yS^RS?G5D^QztFjVY4Lm7 z_?0$(ZSilE%x^<<7r(DPAL#2ti~ldkABE_4Ua9Th1^M?Oy2EW8P*_ay2Q5F=;XhjZ zCx!j9HvXdY{%Y~xR6RdYn7?c79~OUV@jn&fUl#w{;)4*PkR^=W7qKK@NeNaWrIz%t zBnY(;3w&z3%#u(@%C%}+($kV&Agit3mh{1N(pO&?t8E?r1r8&`(YAtIlnWW{h zmK>+$WJ`|M@&rphr{#&3OtIvoQdlhh0`Gej3R!ZpUvILcR@Yo-$y7_GSu)*{Q!JTb z$xL1Msg}&r_0G0rjxKhtC8ue5dWeHEFC_D^jj}*{7V2wJNEXWyOO^)Z^Oh{LWVuRg zg(WM4az;>AG4*OoM&s%Fwq&9u8A+v>cnwqUL|eMPDbw0kpGt?*5%lJJ(&2`f_VmfY zv?Rl=t>L5xlvnYripB7ivYSY5pRw~8`H|+Jf^Z(vVKE2mQhZ6rZ%_MV-b;L zbGR`AlvJjzO&3$2Y7EEY5pWj5I+AH+3*$T=9RP?$Tk9inFj3YPPNpJWy>VTnalKo& zj0jwihDZ;<87IAeRDJhen%`kFT5c=1Q+{Si!x;9tpf~7~nmoM&r@+bf&=Aac3}<%t|z2lHLm;$i%XBw06VIenoo!c5+zkN%v%P++M_VkD49Ap{ zdE*Y{1=t2Wr}`yh*O(>w7NtxCRfSV&sPw?G^XDI)iqYDfQQD^IDJ57kO|vT?XH9L4 zd4dluPh^sfk-0|Y$`(P)HL7+tpU6{!vc{IP}0VWN|sS0wMzQ!qB1w_G1wAn{%OSSfSeO2jH zeP%(Wlz=ZDn`i0ZAcdU|QOY`rs=TIfY2`{)+*(J)riSL61#haFz1BHP(c|IP$l8$O zKn{-UB~wngSX6*>AhPb#a-z*nJYjfHB2F~rv_v;V;x(YQFwzo^Io?bVu5r(`7;v0w z`0e#z$uUUYOq(Gzx3?t%UyI|S$uXWN0-^~JaL#IqG>0>>G^UIjh7Bcn+@wdSfRgDo z=7UPoJczEu!BQG7oK(*$}>`hai3D|;83~_{HlkXQr5$9 zyuE{EqJzb)1Jmhs=nlIyU2d>2b9NaLh6Z{Z?NXm^C>@p~7u(%C=O`CDZrq)dXjbms zBhTC2NYkWnESA^^0q4YWtS66xLltDamZ!*0!)C|Z0@b{9!f8#U(y*e)`I!iW_N=n8;va$8> z>>fVAbNL0dT+y0&eOf+pf$Saca40}@J>X#xb%BL$GLNMTbpP_K`_n;jeU_m~8zL^& zh6vm{EXBuC2`hcSKN^QIw|Y(=W<6`=QqS8(ap5G(cSu1w&zALqqm`>|X%$2WB{lGv zwj{J(<-<9x87Tg`@CKEtaTeiZOQsb@VDl+F!`Y0o-V;^*A?i*o>Mp?ji97$$;bwq2kSvM(wwa(8gk>Mxkhlg zXo#u08_9-<)12^}3EV>%4x%yI3iDKV*P?5;s|$RJ%>$IdP~O6o+jv4#AI?=?5BR)xMD+UUwmL5lX3PBT%bWW3joPlIu}z?hH2fcZtUnzIh{T303F3vdzPC zoVmtp^Kk94sy!{TWs?RbAyu9Y$JQKo?0Tj_ekh{hPC+!S(GJvLvuK1{2(vhmo}0+T zn+gQ#(kKW(O%$P`>$5U$3>7{?!%3&gmJ8%U#9mbpdJ-bWDPzkQg!^C zU1D=J*Z6aowH2(`o)y;fz+Dsga+ia1LD$2RxW<-C5x7uqoh*MfNZN9lTyD!1ayiq{ z^Hk+=Dmsy5GLfuxR>oab$MPe7>~71Ix(!#!mx6M&E!W7kwp=G)M*Nkd>>sYSTrW4+ za-+V!A~)G`vzkM{RZvVEcD2q5?-15axJ4yCq6!CEO7%S!#>wY2;8=@CpeuT~HQ92j z;t$Bp0~0m(Qa#9_H#xeC3l4bQurZD^3m4mri4K8O?K9{U+!i%nl&@;MceDnBLke-s z71BvX(kTOVn?j9Ns9}zii%*Sp`Tp9#eNAq+Ws7XJ`B*;A=3^9NpyObh5!kmt*YeS< z7lG$DroQmbX7gk|{!oy@dz#HB@aH_`FjVpvL|g8VZ8ne5>BnJNe%P)0uF`PHG}A3xq%lt@MjgP(XKEDz$uW|`0{r!Upj?n#t%ywFq65*#l{ z#Gtm^C3oAhT~*>9xtEDxR4JRsD~BgkyMN|Daeacb)cAboG&hJLeZB0*e}h$)_*;=k!z&fUYc?<9#onOf zEY}PYE@9qZuHWd5-|Lu-F|C{lxMSVnldef)DA(^ei}PuvZvAsLxnw*;cX)7w;L~Ir zy1}n7htHw?-8jn4YxdGT5tLI~9#ji464CZ@lP^kXRR_P(ZP2qB_r7M!L)``)XQq2Y za4{b)8eEF-*7Z#w`$*BCi>bpHe6(nAnMtFW!5pKrH73rl0(m6N%EUmwKpsN{iWo>~ z#zsa%aRyA&zue)Fa!eawXW>CoW0$nUJ-a}Kp56mgfZZ@P7eH6yU4~pbI{Y|hT8r7A zkPch+NM}%n++(@z>;b~8sr%m>tRd_#+sW!^E@yKZ6n=>T-uU`^I-Z| zTMop8TAG?P2e#+_H5)l^NkME-Kw`PM{@}1~%p{YDtzm7EMS30~azlC#+1LF1n(;y# z$6kFwMmK<|ut{!?3^SQXCztQ+9ss%Ba5&~}6~k&omy|~?2=9<+9PDKQmH&b)swUcc z<(3?aY|=Qc+^iU>XB^7O`}KfF}0J7VG|ccV29Gl9MZ z^-3WK#@f0u?(>8Lu7?}xWBU;7L5;Cp^C06M;WmV~I3=nJ7wqF5!mSq{V-u`&!i9pe zk3DP>vu}QzG-5Tm-J$tD*U~{lGvH=Fh8$r~_o~$7aj~D~N}=YIf;fkHGn+`pO8`uA z-5ppg^`Js-hF)V;EFafc_ywP31beYbbC9snv=<@jw|Yr)QOAh+ch7g^^*?%H5>2iC&?$t^)Mb z8yf-$AGDud@-k_Bf5{&{&@{i-{jQ-wDKs9zC%&P$XSgmGtIe~N?*>yn&EZp@OFB<< zH^+@UbKbJf-T9(O66pP0baQvarxTc$roN{Y645Q}7QWUMuwn+?*v9=_VbrHjqxrI9 z`b_`|KCyR&UzUQd;b5`?T`Ra|)vYlZ`BG$lBAcN9Mn|9*=jD~J5W1M9!f^Yu`JGpQ znwOV5`|!hkJ;>Wu4>y6R8mt*B&tDgb9t!Dc2ZD1?L(1a`^HB~tCz!PDiNgCJRqig; zYxVI~qCuV4H6X75uFSpuzJ-hS`g*q{(ur6H!IG`QPfo=pq|V(YNig9{yj=Q^?6Gyp=#M%BAr5agk70Lfo=eYj9^U8)}G`4)Ba z0W@&wJOU5qXjdL{M^BzV@7OPkraVP2^3VRkat4jU=klKTqU@0Q5`&ug_+UzWwlF0= zOPCVL6;mRuVoKz7Oo;@PDe)n~l*lTX5}$cYi7bmLky|k(J_MN(-)T&V&n~9K2NhG| zYlkWE?ZlM0@R|}=T2tbpYD(M~O^G|8De(=(l(?sv5+8$1iL`_%k!3I?Zo8($rPY+U znWC&9(eG8nd=gqC2+^?j?W7*<6x>4P?POJybx^2_%2&6Oy@z`4rd|fLcOIY*06M9!>8@y}ep_ipez3n8 z9AE|q=DP=(?!l&e2ynJgD6pG`W(f^{;$a46cqff0aoMYEr;%HzM<+S$G|E(}+G(h% z9AzjSokt#RkdJAnFQpt+%ra!KdylmTz^?c)Z7BmAOX61hh)Jt#2r{o#-RHe@8t*y&oN*Vcdg8 zauAefLJ^G41U6C${z*2De|lZR3V zJLtGAP>{);bUfO->4dCI)`8FcS7;~tXj8KMsiK|qU!k4sqt#~lc}1%;XrYqbG&RfZ z+B41c)cpsxr@MqY>6G0xBg>l>SDcETESr_j$`PHN<+Vz5POfK6mKSKx++5FTSw2~N zPS5p>%JLZPnV0Jsn&ko7Ge6f8%yK|`7UX(HX6a+?S!jAHN>=Ztk$8sgrcqgXQ%4r% zU>9fU1?^dq>sgwm-P-ecw+HrAnx*a9vn&U*JWDrf&x%~n$}C-^J!hC6*zc-}Gd(@Z zQlpNzTV6MOSV_~}bV3)cUX9*8w5F5J%F@imU9@&JETW>mgU-bO-W6fII;cU#Nsd3> zm>+M-jbo3p|GIe>6#D>uLZ8x1sgg-Dna=jS);lx>eyT6bVE~1AFb&{gbUcrslh~o@ zJc?#=6)oh^_)*yyO7M96Mr;CYg7dtbC((8|%bk1zJp?EDD4$4s;q#t`FMO73={r1) zKIBvA0MDXNcrJa)v+18ahZ*0rOOW3hhz!?Qe44K11xVT~CkEzLhTF+h`l#fuG3T zPIvPbY}{6Qj<-Qz_~n3me9=7P4T(m#Q?D1P4DSv~wNu>G;~kW4r=+PTQO`U53UzgS zFG%g6!F(Sb%{z_LEdh(u(Tg8ccoVchFZFyJ(?uER_=W}Tv=pZzyza(TS>t^-p)6lm zvAL5jnDERl@MF<1s?4qS7%Ib5PmslXs26u))qCN8pQTFf!s?&F)cfcde$JoX_SG=pC;gEtiq-i*O^x}}qD-A!LLAh#8Rd<`I7bURdJ%Wm4*MR%aK zZ8zQ7Nnc+u-rKjKsF;1bYvF`;+S*QccF^6~gYOxN+lwjQV*%FAFH5kFr8EZ4QsW^tO{I?y53X&{1Z=a$LghnC?xr3U4?b4$jmOY*os3K3Y$}zt z_!VtE5b+};7g1V39*9zI1p5#I#4S{^OU3%I5o^wOJ_1!n(AYtbRy^ibJ874yce`m_ zr31U&syl!a?@$Vz^tb{(0YFqe3LR(}=skH0>ZDEue9{1RdVqTm3)rQA-!y<-9^g|x zpoW9K_kY@eJfqP24ma+u@G_r2*tSRQ*&{OGj#M@Ic&uJ#}%ygWdmal%vVg+9Btpufx}Jf9)HK|&|-6E_^x(*4;^{k zn~&(9Bt|_XPCccK21puqvKe-9Aw41&(VKEH{S6;VaJZ$w$aaFp1tO>D)UUeQQt|!nTJxG=-+)zi((Abu z6fE`!1_W2IK;%duKQtf+=Xw`|3@p2K3*lmvQy)i8WgzRLr`w=Pz-7zV{aK0IOH3OXSvNoF{p(oKQ<_E&^HyMZ1+$MY9Y!` z3<^B(ZN(@%JQRaki1Jf|0;jya7^TufIYeS_8x-7NhZLjyOi^%=&F#lK2J~k|JNxru zuy+mE&x^o*Q4ID=1NMs|u=k3=er3SkD+2p z)+@UUBX5Z2VlF%2y?0U{$8y-;jOWCC~CZvY&r1&r4rg(`kuTb`vc+CE^~k7#?4wm&rO zkF_1Fc(AryQKL@llrqnwD`l&qCQGFi4?=`P%JCW)?4UnZ{7Gx2Iw7dGqDLDC(D=x2 ze1t2&A1nS0IO9(TmU&|?sFFN}j4ssms+^X*HuW);Ty1>+- zI2Z4s(+UjWZ{T65dizhb(n){!;?<8`-a2T{u#$7FHWS}zBIF9|S7~1akVy8RN*RL48&w>46AJVq zE6|(z1^UvAKm{#EeN~`8wrc=21_sgkz+l=C7)tjBhS4t6_XbALzCb0t7#Kz03sljY zfurf|z-aCnIEDuW#&A_&EY}3a^9r=r1Sayifhuke)Nm{?sUUJI(_e(Urb7=v1@u-E z>7-|#qPrF#NM1O>3z7$+;s(i!#v}Q3|HS3E+!#?{C85AnB=VlQhpNX9n~Vr@C)s8Q z2}+Hl(AmKn{`6zmMaXEx>-oh`R(lPcM8QBE^$$#=%D{9Q9XN%?24>Q6fm5kAFq;+z z=FrN(TsjBsroidYUHpdKWBYh>uOJhFBZzgU(kPw_;s+CW29{7+U@27uK976fvK)b5 zdjz7$R0WZo8HHyko{@MK<5`MlHlC??#^9L&xKfnM@vJOEau!c-JQa8b;yD`65Ii^F zxe3p0c(&u&fu|DBL;1CzM?)d-rLewbxS+0pB+j5dbSCwuH8hyk(r`ML9BM!^w28*j zI+{r9=~!GwPe5|>B-%(*X*12B3y}i7h)$=AX(3$-YL|o3m7ww^WNWSgh3kNQJ*2f9 Ia|y5bf0)CiegFUf diff --git a/Robust/cup/java_cup/Main.java b/Robust/cup/java_cup/Main.java deleted file mode 100644 index 50811b53..00000000 --- a/Robust/cup/java_cup/Main.java +++ /dev/null @@ -1,854 +0,0 @@ - -package java_cup; - -import java.util.Enumeration; -import java.io.*; - -/** This class serves as the main driver for the JavaCup system. - * It accepts user options and coordinates overall control flow. - * The main flow of control includes the following activities: - *
      - *
    • Parse user supplied arguments and options. - *
    • Open output files. - *
    • Parse the specification from standard input. - *
    • Check for unused terminals, non-terminals, and productions. - *
    • Build the state machine, tables, etc. - *
    • Output the generated code. - *
    • Close output files. - *
    • Print a summary if requested. - *
    - * - * Options to the main program include:
    - *
    -package name - *
    specify package generated classes go in [default none] - *
    -parser name - *
    specify parser class name [default "parser"] - *
    -symbols name - *
    specify name for symbol constant class [default "sym"] - *
    -interface - *
    emit symbol constant interface, rather than class - *
    -nonterms - *
    put non terminals in symbol constant class - *
    -expect # - *
    number of conflicts expected/allowed [default 0] - *
    -compact_red - *
    compact tables by defaulting to most frequent reduce - *
    -nowarn - *
    don't warn about useless productions, etc. - *
    -nosummary - *
    don't print the usual summary of parse states, etc. - *
    -progress - *
    print messages to indicate progress of the system - *
    -time - *
    print time usage summary - *
    -dump_grammar - *
    produce a dump of the symbols and grammar - *
    -dump_states - *
    produce a dump of parse state machine - *
    -dump_tables - *
    produce a dump of the parse tables - *
    -dump - *
    produce a dump of all of the above - *
    -debug - *
    turn on debugging messages within JavaCup - *
    -nopositions - *
    don't generate the positions code - *
    -noscanner - *
    don't refer to java_cup.runtime.Scanner in the parser - * (for compatibility with old runtimes) - *
    -version - *
    print version information for JavaCUP and halt. - *
    - * - * @version last updated: 7/3/96 - * @author Frank Flannery - */ - -public class Main { - - /*-----------------------------------------------------------*/ - /*--- Constructor(s) ----------------------------------------*/ - /*-----------------------------------------------------------*/ - /** Only constructor is private, so we do not allocate any instances of this - class. */ - private Main() { } - - /*-------------------------*/ - /* Options set by the user */ - /*-------------------------*/ - /** User option -- do we print progress messages. */ - protected static boolean print_progress = true; - /** User option -- do we produce a dump of the state machine */ - protected static boolean opt_dump_states = false; - /** User option -- do we produce a dump of the parse tables */ - protected static boolean opt_dump_tables = false; - /** User option -- do we produce a dump of the grammar */ - protected static boolean opt_dump_grammar = false; - /** User option -- do we show timing information as a part of the summary */ - protected static boolean opt_show_timing = false; - /** User option -- do we run produce extra debugging messages */ - protected static boolean opt_do_debug = false; - /** User option -- do we compact tables by making most common reduce the - default action */ - protected static boolean opt_compact_red = false; - /** User option -- should we include non terminal symbol numbers in the - symbol constant class. */ - protected static boolean include_non_terms = false; - /** User option -- do not print a summary. */ - protected static boolean no_summary = false; - /** User option -- number of conflicts to expect */ - protected static int expect_conflicts = 0; - - /* frankf added this 6/18/96 */ - /** User option -- should generator generate code for left/right values? */ - protected static boolean lr_values = true; - - /** User option -- should symbols be put in a class or an interface? [CSA]*/ - protected static boolean sym_interface = false; - - /** User option -- should generator suppress references to - * java_cup.runtime.Scanner for compatibility with old runtimes? */ - protected static boolean suppress_scanner = false; - - /*----------------------------------------------------------------------*/ - /* Timing data (not all of these time intervals are mutually exclusive) */ - /*----------------------------------------------------------------------*/ - /** Timing data -- when did we start */ - protected static long start_time = 0; - /** Timing data -- when did we end preliminaries */ - protected static long prelim_end = 0; - /** Timing data -- when did we end parsing */ - protected static long parse_end = 0; - /** Timing data -- when did we end checking */ - protected static long check_end = 0; - /** Timing data -- when did we end dumping */ - protected static long dump_end = 0; - /** Timing data -- when did we end state and table building */ - protected static long build_end = 0; - /** Timing data -- when did we end nullability calculation */ - protected static long nullability_end = 0; - /** Timing data -- when did we end first set calculation */ - protected static long first_end = 0; - /** Timing data -- when did we end state machine construction */ - protected static long machine_end = 0; - /** Timing data -- when did we end table construction */ - protected static long table_end = 0; - /** Timing data -- when did we end checking for non-reduced productions */ - protected static long reduce_check_end = 0; - /** Timing data -- when did we finish emitting code */ - protected static long emit_end = 0; - /** Timing data -- when were we completely done */ - protected static long final_time = 0; - - /* Additional timing information is also collected in emit */ - - /*-----------------------------------------------------------*/ - /*--- Main Program ------------------------------------------*/ - /*-----------------------------------------------------------*/ - - /** The main driver for the system. - * @param argv an array of strings containing command line arguments. - */ - public static void main(String argv[]) - throws internal_error, java.io.IOException, java.lang.Exception - { - boolean did_output = false; - - start_time = System.currentTimeMillis(); - - /* process user options and arguments */ - parse_args(argv); - - /* frankf 6/18/96 - hackish, yes, but works */ - emit.set_lr_values(lr_values); - /* open output files */ - if (print_progress) System.err.println("Opening files..."); - /* use a buffered version of standard input */ - input_file = new BufferedInputStream(System.in); - - prelim_end = System.currentTimeMillis(); - - /* parse spec into internal data structures */ - if (print_progress) - System.err.println("Parsing specification from standard input..."); - parse_grammar_spec(); - - parse_end = System.currentTimeMillis(); - - /* don't proceed unless we are error free */ - if (lexer.error_count == 0) - { - /* check for unused bits */ - if (print_progress) System.err.println("Checking specification..."); - check_unused(); - - check_end = System.currentTimeMillis(); - - /* build the state machine and parse tables */ - if (print_progress) System.err.println("Building parse tables..."); - build_parser(); - - build_end = System.currentTimeMillis(); - - /* output the generated code, if # of conflicts permits */ - if (lexer.error_count != 0) { - // conflicts! don't emit code, don't dump tables. - opt_dump_tables = false; - } else { // everything's okay, emit parser. - if (print_progress) System.err.println("Writing parser..."); - open_files(); - emit_parser(); - did_output = true; - } - } - /* fix up the times to make the summary easier */ - emit_end = System.currentTimeMillis(); - - /* do requested dumps */ - if (opt_dump_grammar) dump_grammar(); - if (opt_dump_states) dump_machine(); - if (opt_dump_tables) dump_tables(); - - dump_end = System.currentTimeMillis(); - - /* close input/output files */ - if (print_progress) System.err.println("Closing files..."); - close_files(); - - /* produce a summary if desired */ - if (!no_summary) emit_summary(did_output); - - /* If there were errors during the run, - * exit with non-zero status (makefile-friendliness). --CSA */ - if (lexer.error_count != 0) - System.exit(100); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Print a "usage message" that described possible command line options, - * then exit. - * @param message a specific error message to preface the usage message by. - */ - protected static void usage(String message) - { - System.err.println(); - System.err.println(message); - System.err.println(); - System.err.println( -"Usage: " + version.program_name + " [options] [filename]\n" + -" and expects a specification file on standard input if no filename is given.\n" + -" Legal options include:\n" + -" -package name specify package generated classes go in [default none]\n" + -" -parser name specify parser class name [default \"parser\"]\n" + -" -symbols name specify name for symbol constant class [default \"sym\"]\n"+ -" -interface put symbols in an interface, rather than a class\n" + -" -nonterms put non terminals in symbol constant class\n" + -" -expect # number of conflicts expected/allowed [default 0]\n" + -" -compact_red compact tables by defaulting to most frequent reduce\n" + -" -nowarn don't warn about useless productions, etc.\n" + -" -nosummary don't print the usual summary of parse states, etc.\n" + -" -nopositions don't propagate the left and right token position values\n" + -" -noscanner don't refer to java_cup.runtime.Scanner\n" + -" -progress print messages to indicate progress of the system\n" + -" -time print time usage summary\n" + -" -dump_grammar produce a human readable dump of the symbols and grammar\n"+ -" -dump_states produce a dump of parse state machine\n"+ -" -dump_tables produce a dump of the parse tables\n"+ -" -dump produce a dump of all of the above\n"+ -" -version print the version information for CUP and exit\n" - ); - System.exit(1); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Parse command line options and arguments to set various user-option - * flags and variables. - * @param argv the command line arguments to be parsed. - */ - protected static void parse_args(String argv[]) - { - int len = argv.length; - int i; - - /* parse the options */ - for (i=0; i= len || argv[i].startsWith("-") || - argv[i].endsWith(".cup")) - usage("-package must have a name argument"); - - /* record the name */ - emit.package_name = argv[i]; - } - else if (argv[i].equals("-parser")) - { - /* must have an arg */ - if (++i >= len || argv[i].startsWith("-") || - argv[i].endsWith(".cup")) - usage("-parser must have a name argument"); - - /* record the name */ - emit.parser_class_name = argv[i]; - } - else if (argv[i].equals("-symbols")) - { - /* must have an arg */ - if (++i >= len || argv[i].startsWith("-") || - argv[i].endsWith(".cup")) - usage("-symbols must have a name argument"); - - /* record the name */ - emit.symbol_const_class_name = argv[i]; - } - else if (argv[i].equals("-nonterms")) - { - include_non_terms = true; - } - else if (argv[i].equals("-expect")) - { - /* must have an arg */ - if (++i >= len || argv[i].startsWith("-") || - argv[i].endsWith(".cup")) - usage("-expect must have a name argument"); - - /* record the number */ - try { - expect_conflicts = Integer.parseInt(argv[i]); - } catch (NumberFormatException e) { - usage("-expect must be followed by a decimal integer"); - } - } - else if (argv[i].equals("-compact_red")) opt_compact_red = true; - else if (argv[i].equals("-nosummary")) no_summary = true; - else if (argv[i].equals("-nowarn")) emit.nowarn = true; - else if (argv[i].equals("-dump_states")) opt_dump_states = true; - else if (argv[i].equals("-dump_tables")) opt_dump_tables = true; - else if (argv[i].equals("-progress")) print_progress = true; - else if (argv[i].equals("-dump_grammar")) opt_dump_grammar = true; - else if (argv[i].equals("-dump")) - opt_dump_states = opt_dump_tables = opt_dump_grammar = true; - else if (argv[i].equals("-time")) opt_show_timing = true; - else if (argv[i].equals("-debug")) opt_do_debug = true; - /* frankf 6/18/96 */ - else if (argv[i].equals("-nopositions")) lr_values = false; - /* CSA 12/21/97 */ - else if (argv[i].equals("-interface")) sym_interface = true; - /* CSA 23-Jul-1999 */ - else if (argv[i].equals("-noscanner")) suppress_scanner = true; - /* CSA 23-Jul-1999 */ - else if (argv[i].equals("-version")) { - System.out.println(version.title_str); - System.exit(1); - } - /* CSA 24-Jul-1999; suggestion by Jean Vaucher */ - else if (!argv[i].startsWith("-") && i==len-1) { - /* use input from file. */ - try { - System.setIn(new FileInputStream(argv[i])); - } catch (java.io.FileNotFoundException e) { - usage("Unable to open \"" + argv[i] +"\" for input"); - } - } - else - { - usage("Unrecognized option \"" + argv[i] + "\""); - } - } - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /*-------*/ - /* Files */ - /*-------*/ - - /** Input file. This is a buffered version of System.in. */ - protected static BufferedInputStream input_file; - - /** Output file for the parser class. */ - protected static PrintWriter parser_class_file; - - /** Output file for the symbol constant class. */ - protected static PrintWriter symbol_class_file; - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Open various files used by the system. */ - protected static void open_files() - { - File fil; - String out_name; - - /* open each of the output files */ - - /* parser class */ - out_name = emit.parser_class_name + ".java"; - fil = new File(out_name); - try { - parser_class_file = new PrintWriter( - new BufferedOutputStream(new FileOutputStream(fil), 4096)); - } catch(Exception e) { - System.err.println("Can't open \"" + out_name + "\" for output"); - System.exit(3); - } - - /* symbol constants class */ - out_name = emit.symbol_const_class_name + ".java"; - fil = new File(out_name); - try { - symbol_class_file = new PrintWriter( - new BufferedOutputStream(new FileOutputStream(fil), 4096)); - } catch(Exception e) { - System.err.println("Can't open \"" + out_name + "\" for output"); - System.exit(4); - } - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Close various files used by the system. */ - protected static void close_files() throws java.io.IOException - { - if (input_file != null) input_file.close(); - if (parser_class_file != null) parser_class_file.close(); - if (symbol_class_file != null) symbol_class_file.close(); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Parse the grammar specification from standard input. This produces - * sets of terminal, non-terminals, and productions which can be accessed - * via static variables of the respective classes, as well as the setting - * of various variables (mostly in the emit class) for small user supplied - * items such as the code to scan with. - */ - protected static void parse_grammar_spec() throws java.lang.Exception - { - parser parser_obj; - - /* create a parser and parse with it */ - parser_obj = new parser(); - try { - if (opt_do_debug) - parser_obj.debug_parse(); - else - parser_obj.parse(); - } catch (Exception e) - { - /* something threw an exception. catch it and emit a message so we - have a line number to work with, then re-throw it */ - lexer.emit_error("Internal error: Unexpected exception"); - throw e; - } - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Check for unused symbols. Unreduced productions get checked when - * tables are created. - */ - protected static void check_unused() - { - terminal term; - non_terminal nt; - - /* check for unused terminals */ - for (Enumeration t = terminal.all(); t.hasMoreElements(); ) - { - term = (terminal)t.nextElement(); - - /* don't issue a message for EOF */ - if (term == terminal.EOF) continue; - - /* or error */ - if (term == terminal.error) continue; - - /* is this one unused */ - if (term.use_count() == 0) - { - /* count it and warn if we are doing warnings */ - emit.unused_term++; - if (!emit.nowarn) - { - System.err.println("Warning: Terminal \"" + term.name() + - "\" was declared but never used"); - lexer.warning_count++; - } - } - } - - /* check for unused non terminals */ - for (Enumeration n = non_terminal.all(); n.hasMoreElements(); ) - { - nt = (non_terminal)n.nextElement(); - - /* is this one unused */ - if (nt.use_count() == 0) - { - /* count and warn if we are doing warnings */ - emit.unused_term++; - if (!emit.nowarn) - { - System.err.println("Warning: Non terminal \"" + nt.name() + - "\" was declared but never used"); - lexer.warning_count++; - } - } - } - - } - - /* . . . . . . . . . . . . . . . . . . . . . . . . .*/ - /* . . Internal Results of Generating the Parser . .*/ - /* . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Start state in the overall state machine. */ - protected static lalr_state start_state; - - /** Resulting parse action table. */ - protected static parse_action_table action_table; - - /** Resulting reduce-goto table. */ - protected static parse_reduce_table reduce_table; - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Build the (internal) parser from the previously parsed specification. - * This includes:
      - *
    • Computing nullability of non-terminals. - *
    • Computing first sets of non-terminals and productions. - *
    • Building the viable prefix recognizer machine. - *
    • Filling in the (internal) parse tables. - *
    • Checking for unreduced productions. - *
    - */ - protected static void build_parser() throws internal_error - { - /* compute nullability of all non terminals */ - if (opt_do_debug || print_progress) - System.err.println(" Computing non-terminal nullability..."); - non_terminal.compute_nullability(); - - nullability_end = System.currentTimeMillis(); - - /* compute first sets of all non terminals */ - if (opt_do_debug || print_progress) - System.err.println(" Computing first sets..."); - non_terminal.compute_first_sets(); - - first_end = System.currentTimeMillis(); - - /* build the LR viable prefix recognition machine */ - if (opt_do_debug || print_progress) - System.err.println(" Building state machine..."); - start_state = lalr_state.build_machine(emit.start_production); - - machine_end = System.currentTimeMillis(); - - /* build the LR parser action and reduce-goto tables */ - if (opt_do_debug || print_progress) - System.err.println(" Filling in tables..."); - action_table = new parse_action_table(); - reduce_table = new parse_reduce_table(); - for (Enumeration st = lalr_state.all(); st.hasMoreElements(); ) - { - lalr_state lst = (lalr_state)st.nextElement(); - lst.build_table_entries( - action_table, reduce_table); - } - - table_end = System.currentTimeMillis(); - - /* check and warn for non-reduced productions */ - if (opt_do_debug || print_progress) - System.err.println(" Checking for non-reduced productions..."); - action_table.check_reductions(); - - reduce_check_end = System.currentTimeMillis(); - - /* if we have more conflicts than we expected issue a message and die */ - if (emit.num_conflicts > expect_conflicts) - { - System.err.println("*** More conflicts encountered than expected " + - "-- parser generation aborted"); - lexer.error_count++; // indicate the problem. - // we'll die on return, after clean up. - } - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Call the emit routines necessary to write out the generated parser. */ - protected static void emit_parser() throws internal_error - { - emit.symbols(symbol_class_file, include_non_terms, sym_interface); - emit.parser(parser_class_file, action_table, reduce_table, - start_state.index(), emit.start_production, opt_compact_red, - suppress_scanner); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Helper routine to optionally return a plural or non-plural ending. - * @param val the numerical value determining plurality. - */ - protected static String plural(int val) - { - if (val == 1) - return ""; - else - return "s"; - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Emit a long summary message to standard error (System.err) which - * summarizes what was found in the specification, how many states were - * produced, how many conflicts were found, etc. A detailed timing - * summary is also produced if it was requested by the user. - * @param output_produced did the system get far enough to generate code. - */ - protected static void emit_summary(boolean output_produced) - { - final_time = System.currentTimeMillis(); - - if (no_summary) return; - - System.err.println("------- " + version.title_str + - " Parser Generation Summary -------"); - - /* error and warning count */ - System.err.println(" " + lexer.error_count + " error" + - plural(lexer.error_count) + " and " + lexer.warning_count + - " warning" + plural(lexer.warning_count)); - - /* basic stats */ - System.err.print(" " + terminal.number() + " terminal" + - plural(terminal.number()) + ", "); - System.err.print(non_terminal.number() + " non-terminal" + - plural(non_terminal.number()) + ", and "); - System.err.println(production.number() + " production" + - plural(production.number()) + " declared, "); - System.err.println(" producing " + lalr_state.number() + - " unique parse states."); - - /* unused symbols */ - System.err.println(" " + emit.unused_term + " terminal" + - plural(emit.unused_term) + " declared but not used."); - System.err.println(" " + emit.unused_non_term + " non-terminal" + - plural(emit.unused_term) + " declared but not used."); - - /* productions that didn't reduce */ - System.err.println(" " + emit.not_reduced + " production" + - plural(emit.not_reduced) + " never reduced."); - - /* conflicts */ - System.err.println(" " + emit.num_conflicts + " conflict" + - plural(emit.num_conflicts) + " detected" + - " (" + expect_conflicts + " expected)."); - - /* code location */ - if (output_produced) - System.err.println(" Code written to \"" + emit.parser_class_name + - ".java\", and \"" + emit.symbol_const_class_name + ".java\"."); - else - System.err.println(" No code produced."); - - if (opt_show_timing) show_times(); - - System.err.println( - "---------------------------------------------------- (" + - version.version_str + ")"); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Produce the optional timing summary as part of an overall summary. */ - protected static void show_times() - { - long total_time = final_time - start_time; - - System.err.println(". . . . . . . . . . . . . . . . . . . . . . . . . "); - System.err.println(" Timing Summary"); - System.err.println(" Total time " - + timestr(final_time-start_time, total_time)); - System.err.println(" Startup " - + timestr(prelim_end-start_time, total_time)); - System.err.println(" Parse " - + timestr(parse_end-prelim_end, total_time) ); - if (check_end != 0) - System.err.println(" Checking " - + timestr(check_end-parse_end, total_time)); - if (check_end != 0 && build_end != 0) - System.err.println(" Parser Build " - + timestr(build_end-check_end, total_time)); - if (nullability_end != 0 && check_end != 0) - System.err.println(" Nullability " - + timestr(nullability_end-check_end, total_time)); - if (first_end != 0 && nullability_end != 0) - System.err.println(" First sets " - + timestr(first_end-nullability_end, total_time)); - if (machine_end != 0 && first_end != 0) - System.err.println(" State build " - + timestr(machine_end-first_end, total_time)); - if (table_end != 0 && machine_end != 0) - System.err.println(" Table build " - + timestr(table_end-machine_end, total_time)); - if (reduce_check_end != 0 && table_end != 0) - System.err.println(" Checking " - + timestr(reduce_check_end-table_end, total_time)); - if (emit_end != 0 && build_end != 0) - System.err.println(" Code Output " - + timestr(emit_end-build_end, total_time)); - if (emit.symbols_time != 0) - System.err.println(" Symbols " - + timestr(emit.symbols_time, total_time)); - if (emit.parser_time != 0) - System.err.println(" Parser class " - + timestr(emit.parser_time, total_time)); - if (emit.action_code_time != 0) - System.err.println(" Actions " - + timestr(emit.action_code_time, total_time)); - if (emit.production_table_time != 0) - System.err.println(" Prod table " - + timestr(emit.production_table_time, total_time)); - if (emit.action_table_time != 0) - System.err.println(" Action tab " - + timestr(emit.action_table_time, total_time)); - if (emit.goto_table_time != 0) - System.err.println(" Reduce tab " - + timestr(emit.goto_table_time, total_time)); - - System.err.println(" Dump Output " - + timestr(dump_end-emit_end, total_time)); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Helper routine to format a decimal based display of seconds and - * percentage of total time given counts of milliseconds. Note: this - * is broken for use with some instances of negative time (since we don't - * use any negative time here, we let if be for now). - * @param time_val the value being formatted (in ms). - * @param total_time total time percentages are calculated against (in ms). - */ - protected static String timestr(long time_val, long total_time) - { - boolean neg; - long ms = 0; - long sec = 0; - long percent10; - String pad; - - /* work with positives only */ - neg = time_val < 0; - if (neg) time_val = -time_val; - - /* pull out seconds and ms */ - ms = time_val % 1000; - sec = time_val / 1000; - - /* construct a pad to blank fill seconds out to 4 places */ - if (sec < 10) - pad = " "; - else if (sec < 100) - pad = " "; - else if (sec < 1000) - pad = " "; - else - pad = ""; - - /* calculate 10 times the percentage of total */ - percent10 = (time_val*1000)/total_time; - - /* build and return the output string */ - return (neg ? "-" : "") + pad + sec + "." + - ((ms%1000)/100) + ((ms%100)/10) + (ms%10) + "sec" + - " (" + percent10/10 + "." + percent10%10 + "%)"; - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Produce a human readable dump of the grammar. */ - public static void dump_grammar() throws internal_error - { - System.err.println("===== Terminals ====="); - for (int tidx=0, cnt=0; tidx < terminal.number(); tidx++, cnt++) - { - System.err.print("["+tidx+"]"+terminal.find(tidx).name()+" "); - if ((cnt+1) % 5 == 0) System.err.println(); - } - System.err.println(); - System.err.println(); - - System.err.println("===== Non terminals ====="); - for (int nidx=0, cnt=0; nidx < non_terminal.number(); nidx++, cnt++) - { - System.err.print("["+nidx+"]"+non_terminal.find(nidx).name()+" "); - if ((cnt+1) % 5 == 0) System.err.println(); - } - System.err.println(); - System.err.println(); - - - System.err.println("===== Productions ====="); - for (int pidx=0; pidx < production.number(); pidx++) - { - production prod = production.find(pidx); - System.err.print("["+pidx+"] "+prod.lhs().the_symbol().name() + " ::= "); - for (int i=0; iN59bH8GT59tW%0trMUzEMW=!S{DbQ?PuwZGuG2Zwu z<{#M2E;La{G%=v(a}Q%id>5?;IL$jB3ZQ z_p7^ptj-{ATDIlhXULYuugfnO;#M&$QbNmH$m|Y#^b;I+kdaW@zJRyu1PA$>dW%$X=wAju`!b35^ZGH2n)=pZxS$ zvQrSq7LdRkt=c7mQ0GEmk^ULoCbZ9peLRJTey~KgaQeo4_=Xsv4{|G%JLi*gJq0>( z+F1M~!nsay8VXsSw-ItK>c3Fb^dW>JWc2~!8hryKjv&R45f`E?n?B1z$g&o)r1hT= zKOiBTX!;L`14w7Mpa~BlVH-(2A|!1^h_4ZztIcUc$o%Eskc49>fr#Y$GnSy%XOvC* p5~AxNdifiay&;WY2z7wT^c0zZVKO~U{s5_HgZGGHnYRg7{sAbB&MW`` diff --git a/Robust/cup/java_cup/action_part.java b/Robust/cup/java_cup/action_part.java deleted file mode 100644 index 69e98f59..00000000 --- a/Robust/cup/java_cup/action_part.java +++ /dev/null @@ -1,93 +0,0 @@ - -package java_cup; - -/** - * This class represents a part of a production which contains an - * action. These are eventually eliminated from productions and converted - * to trailing actions by factoring out with a production that derives the - * empty string (and ends with this action). - * - * @see java_cup.production - * @version last update: 11/25/95 - * @author Scott Hudson - */ - -public class action_part extends production_part { - - /*-----------------------------------------------------------*/ - /*--- Constructors ------------------------------------------*/ - /*-----------------------------------------------------------*/ - - /** Simple constructor. - * @param code_str string containing the actual user code. - */ - public action_part(String code_str) - { - super(/* never have a label on code */null); - _code_string = code_str; - } - - /*-----------------------------------------------------------*/ - /*--- (Access to) Instance Variables ------------------------*/ - /*-----------------------------------------------------------*/ - - /** String containing code for the action in question. */ - protected String _code_string; - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** String containing code for the action in question. */ - public String code_string() {return _code_string;} - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Set the code string. */ - public void set_code_string(String new_str) {_code_string = new_str;} - - /*-----------------------------------------------------------*/ - /*--- General Methods ---------------------------------------*/ - /*-----------------------------------------------------------*/ - - /** Override to report this object as an action. */ - public boolean is_action() { return true; } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Equality comparison for properly typed object. */ - public boolean equals(action_part other) - { - /* compare the strings */ - return other != null && super.equals(other) && - other.code_string().equals(code_string()); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Generic equality comparison. */ - public boolean equals(Object other) - { - if (!(other instanceof action_part)) - return false; - else - return equals((action_part)other); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Produce a hash code. */ - public int hashCode() - { - return super.hashCode() ^ - (code_string()==null ? 0 : code_string().hashCode()); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Convert to a string. */ - public String toString() - { - return super.toString() + "{" + code_string() + "}"; - } - - /*-----------------------------------------------------------*/ -} diff --git a/Robust/cup/java_cup/action_production.class b/Robust/cup/java_cup/action_production.class deleted file mode 100644 index 01329be9e7751318cb1193dcec03ea9c46c3cf5f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 604 zcmbtRO-sW-5Pcid#>Q%@wJnMjyhvL=s^^FoQ51@oiWiZvO_#Ez-Gpr-{wxJW@Zb;d zM~RalO`*Mc$n4CU*_U~5zkfcz0Gy&`!^C<4OW3ebwy?=i@_KwCyif=I*pFnO7%H71 zf8w4WhwTh@8S-aR$>^Nnv9WL>1682BNa(RteB?f4ct+=iTu1Ir+G>xu8nnBSmTKTO z?-|UCpf4Dlj#T0{9`}U462|L zsUCC-t>Mi^?8E>gWQ38gSF+jW?Ga(@g}fAIoiB=wk`5OL_!B@6XS^exGxif9VeWT$ qk2&q|KJ%c%L+<1Uk#QWe!+FaiB!Ge#Kv@J05eeW zyJD?qt%}-MrB;K+w5Y|Rw6#{NwVPWvYpw04-8Zd#|8w7)nU@9IeqZ>_efQma?zv|_ z=iV8f`{-*=5z#btv!69D_OX}G^zvDLvh0^y=`E4rvo$Z3mpXY_rg^#M6@EU4&y}WL z^GeOD{JfgiXg*K#TFvXcyxvbCUM#E5_hZ!t%^Nj0Xx^kbB4{>iZq(f5r|}#u;%07< zrq#3-f%5x&FEU*J16-z6h=OS8|* z_xM2by_)ZnNig_D&7GR>*Zd{T4`_Z+^M1`=*8Gs>ugH>z{rm`bX+9v&M}@V=G6I|254AH9w*GNzG4b{<`Kvn&)eNTJtwFAJ+Vg=4Uk@(fm!#-xAq;TaZ8J zIUh{V~zaWZyQ8xIV=9e_Ttoi!__==x@z(4fzk9>Ik*v~)VSAA$+liusnd&AFf z@=v||Ge6zIKlk%5xXsJI^wVAZmY08}`EAX=_R~IoN6h0ln%~v@Tg|`I{6B*JJwLzC zKlGvby`TRe82`Y3)chySf7bjL&3_f3ziIxv=6?ur|CHtfi|FW4%^%A1bociX zqGdKypgq#KHPRAoNJQGAOe4}e+cqcT4UNe}I@8b?kEGMi%&_)IDjiMr8Y_x4W@5<% zpqsF^C<|fUe6d6f80>z!F_MKEn$AR0nTGaMvZ=$YW(pa?8X7y=tMkL4tti&ko&;<> zmd-E@v&rws#Nr?yR0CpAqN7b{ZH~tpGiivU7W^iX+asw2Ue*CcBAIDOMX^=132z;V zj&!uCArnotF%5Cv65zld3E14H8!|Bw1~17oWseMXG3)?^@+3E8BAeq;XMC6g>K+@? zlFTG~LHQfvsfKNlct;e}7tRrxoyKI9maS&;EHuI!vNV>6F6(I998Ikh{7gRA8i0b$ zLFp*Ol*i;LT_+eUsGez3X@A9+^&f&QMBAV;#~_$SI_qM|>J_k-%$igTVwx?8y^f%m zMhy(K&g?(bAau!$Y0ALx16qLWAv$jB%NOt$hP>4voNH>Q$-k*!}}Zp6{J!q~FEKG~6K zj4qBD%M}GyNf-+7M4lAj30#bz(>E?H=!nIeqNxD;*dI`5sfogGk1RUI0h1Q&t5MpMm^MhLRNgfXvL7EsI83fM+<^_2g^AJeqz>hQ|e zXt+5Uk0-YyeugEyg||o2;g)D3nu=tiP2tTu!wXlf2ydHOHErrvxFFUr4K^H_&~*l& zgr{=?T+LGvm8;9k&5AqxfEXKfR>4%i^KTKw8qj^_Ik)B zhsX+tFNUGn=<1@G)?`z7do0rm_^1%v0lDV&?dHI2I60>Yo5-vv0DLSfhp&ULb01)Cdc^WHnSW0f*5^c=D#Zuu^G}Dnvgqu^z zHb==~%?|Rg!7CQrUnqsCC@cjf!>kV;`W7DBkI3jas{gu5a6b&VhqIxeUQBZvgl z`Qn0u^3!H>htBM1Ky6SP1FAu7@~TKcZI&fN!sjlkU$t~43^dUZkIxRMM)BY#h1hs} zj&?iBi25@D)huBdR_Oi%4JdWmBQ4@Q4o0IJrYbiaY_K_88ZIr(qVA)hGGWQs3#zLs z=%p>1$jr|`#1@PP;+=w^SXNeLs-o~%o9HlPKC1UF;VcnzMLkN;mVE4{zAREmphdNM zRV<*kh=3@dwyJmldM%fz+CMWT5!1J8yl z_sT5kRva9{u2Y6ximl(Uegm}SNVy{+6~to17yCGrE)A#zN(i3KbHt)R;siT{&u?su zrqhy#^3}eZkomcQZ8kRBJ12N(WR1 zm6Gb<5dpPL9Cy3g;Z-{W>Ouj`r`mLDtU2Q(gMhk7eZs56oU&e6?G$fzwg{+8)TK`4 zWy*l8k{Y6^R5FF^wknZ|HYQsVu?u_WSO_nK@a*W;rBYOMQhr^gE@v8Ti*1EukSX?# zZgHLT@p?1j>s6Z@olWYei({ZabpUPHMD*8$dt9_IPPFhzk^L23wJV@Lr9RD6YVSNp z%DvMZIm%IPPPG~NuUT`~(T26@eOdcYwi<{{H)glNxyOag@ltOMmZ)W$KHTCW#|g&; z_;j8Z;JGX((Q#79SmPvYpVE zr2$Uf2n?tpoERFGyAB)%Y?K2f6MH_K&TWv!4gsFYQv-Yo&kFFVj6giq-mumb{f*IZ zvN>Dn=1XCbiV=dnS-|a9ILuaciaegoMZ@fmr8LgL3B!%m2JtbD1ZCZ?{)~W5!ifGLEZ{K;-fXoyUf@1vYr7c6VF1Qw zHb)X}jKt&Sup+53e+IB^S<vkwF?Jk8rKwLI{1!9S&=nfmR*r9#g6fO6H1P~E6*Vk)zlwh@{{c5IYm zd!aPI{gCcaHwAd8oEyj4m{-ZkGv_5ZB#Q$gDcDpZMmSU&SCM0Cg8+ljW1ocrJWMu# z$%!oL5geq{PN*p`RANB(GdEZ>m$Q(6|_A-Fr?llbHSpD4lJgIkFS2;vYN zjs&u}I)9ZK;Nd7QcqA7Gc$D-?q#4a45QDS(RLk8BDo?Z2Tp}+wXEmJuBJJ%6zxm5O z_Z4&hn?~n$2S%zhNjv@EAX3^N5D?~URo(jr5}^fW_(Ud-JKm6UtJP~qTpPNmtlyc= zM8Wg0#*S19M~#&@K-b0MxKxHTO3Rk?A=_qZc7JN}WLt1yxpi}3j2IW8>XjQHSOmy6 zRhcbc*97F=8cEkBQ_)5CsRtAkiH4omzEW^Vf$r?f`2yn+hU!|>Sf#ZeN90i4G^deq zaUqS%3>*@$F5ZeAM>=$yvJciE*Zqim8IbKq9up_P5JcY}4j{&ITuZSCL8EbNLuO|? z&XfLBYq}vGO|)cMu^(O#sj_sMRrz?3-82|WH$-vnZfe5KydB@fq@3>tdQoc+W*6qq zuC8%NR2(wLb7AxXT(*FWUY3$oG79KI`?!MQ#~2k3kvW4m`Jh)F3I+jghe=T$s$lrI ziJDNzde@Dp`!W^RAdp<~z<4nUsWv9t+B-7Q2B(NXZRYfx%V^j@8fh8(+gr-59aMRY z9kUi_OWZ{Y&}@Yf!Sn3XLMDj}?$&cWf^=y30gn8|Mt&GfJGG?TXZ2Z~S1wljBB@kl zXJfK`CsVoGO&#Ia8fn>;WOk@lZo&I1z+JlzBxPrQU@7M(AyZp+**i(3T9^FtEP{4( zJ!+Fyi_>dM6eprVndI`uOeCI-SfQ+4yNhA0t#tEh0}mKYq-q9uVb)s;V+kY-L|8cX z!ht;7Sx}Too)z7ZrNWoHKoJw~6%lgb!$QJ@HuKh*z4OKP1t#;+SbVFh@k@Z=i7R;Xj*C?DM1nC-BuMi_9y3qmcJoBhZ=Ogk=85cLo=7m}i5z2|NHgY% zJ7Dufx-w5(1(+ue#^#BmnR(*uf~WcJ0M8-#x))z15c6cbjUikh;aO1rIPoLsFqfh& zG=niPg*zSxbhH^G@^q2f-v{z#ps(P{zDP$MAk`P?_W_FgWe0Q?DT6kAkgT1WEm`FUF1JP6U!ZB!6JjpFSr6Wo^BchjDzz; z4aQQUcfj#)sFZ#Sj;HZ-8!dmAJmiB&>PGJ+9URh01;L>;1wAzE6d`MHc`zvGg2zdl z-ST+sbC5#dWq3D@0Obb60Lqdc8kqwv257Oc8yuA;pJewZcT=fL9-T)ImF%VSY>vtd)^Zot z({orWYCJi#l|WVO=_a7I@ybh8U&K$A2djmDa1N;rFN_|bsd>>Ss05<_Ck>(xDM&|Y zI1F(#qjqGAPG=7-;sUDWLaJjQZQ&xii3iiIJd8TwFI_yG-r$k+GcKXGcnrM*8-I_- z(!X$0_u&hznfUtQRIbFyd38h)_PZz#U z>YFS^Bl?qfwNVX^7%5qz@G0jwNR$c7;tKlOf4R8${;+m*HrKBh1O3t@|^#q!qJ z{qtP7*1BQW+4JkW>HKcmfS2IL9H=$3FeHc?_R+hQA<(kvX^PxNg`M;R`}Gh-u&%~i z?0uRl%)}GL-a}OJC~Y=x56R+CVUwq6rp{SWBk&g^lr`n{$xTIN|7M5%7I|rPUSfC& zA@r37xAb4O6+_s`#Y0@ywn_7EuqATXb`^5x(c^$7d4wj&qnp}~&?xBzFX*P!Z7^?V z*ytj?m)^E!`mz?5`S{Hc@k)ao_GUF2cp7daf3dFdcG5g~gM<(vO|%dG8&uFkX>gl^ z%A1p&C^Bbc+wlUlwnTQwf}QRW5qfzQKl($>=bypF!b=hH8F1AW9B@x50ApUj(Z0~g_W_&MTYZjm1)@)q98?HuPD zxQ%Z??>+v4_FoaptXs=Y_;%1R)Qb4w(%p@gZ!umKk@Sv@mD=7`H*KF zANDlxvz{m)@qCJ(^W4YZ@qCG&_w45vJze}gPY=K3d5T~5Jj1VezQsTAyud&9yuz<} zUgg(4Z}OX-xA~_$1L?_w!eSp%2W}gks$e9>yqLLPQb!M6^(56pW3G5bBVF;T0=Buj zvcB`^TL3M1mabMc1t!?wbstq$gbJtE6&Ikj@+J+|G!ZiAEgTv(RRgju~Kw}vS_#R(Dlkodz7ZV%13vq0ClQC zkP@zA?F6gNp#mg!;%h<1DTNi?^w}rrmKu#P67tF0KCVIR{9MR4eHp4NKkA5EJ4sJb zkI~+ODQkM@w$>+nHGXSmku@_A3Yd|7)HUT%x;+$_UgME+dy9W+y<|OdkYdiGgbl=x^1rTDF6zh;LR8+9(315A&-;%fK zR;Z|lzG%9JV6|FyS9elzeoRK3jfdn%t<}4H-1*UAThEL6cM^O;J@eT}`98YC6qRGpJ6@qSb0PZB+B9 zMJ=S1I)koMi($&ObhBDYcdI&jKrN@o)CxKb#UD}U(u-;py{yiozheD|Y9oGM*}x&S zna8R|E>lf>I=(VLTTSG1)D~W)w(@!v=ZI?K7M0*OIDcBDc)LpT#rQJs3bl=|QQLdD zBd+`%cZ|c(ir|j#h@p94TKmP&3ay#mkXPRJ(TxSLv@eIe(_vN*iCKviS~LA2ziWIS zo#ebdN?!^2r`J^;p%M{3gdXz4sO&CW@=my2~QqrWaQcR*TrHnQ-3GngPFpc{0j%s3>MpuU-9xvidubom+^_DZ{pw59r5>Oj^&o!y zyPuv>U#92O!}J2qZm*~=dQ}~uH{qDSR^4!MeAnwpUPJPQ5(vwKj~QCK5s|F9)@ftP zE1nuU^un8Z=&`|XxjZsh01od_N zw*L^#Qcu$Y^$j{#9j3MF8H%ZAsa+jG0Q@#xr=FwFqJKMJ?pEJL;Clg5!IyuwRA?nm zv~r}JIy!jpUJ8~6pUBCklSY>eEi!{ox(2-^o=y9${E<3{1Vid23aOW=TzwzZYgHz(~JQxR0h+T0^IH)8RFpM}IGK z&t&Jk`)IIx&Kinx?eH25p)fwYMryxjA+M6#sGwkfiRW%ADj9m|JyhV?kDV^Nn*t@n zyx0(vg?XxHO1M`)Car!#L)5D@QoROie1lF_Z_=6Sr?AGK(;D>)YEZwTsCpYwsslV-Z;NH={GNj6treG35^qal>2-^S_O zbwH8Odh|tm$LB;h*#Q3?Ea`uqf8Gu9U4zwBmM_>DKxR!ge$fs0y*%7YIk-^aZB$_c zzkCef@8^JVeeeoA1v&o*<&{13!}8#d+-rUez}%trC;3%|lvf2Z_?l^J-K$=AuX-cD zDribcv-VB1>ZhjtnQ4D++FzLVm!>_-v~QXASJGxB__pB3Iolki-*MreYhZEU0A0Uv zuXq1LH^l#7qKn>h4t_2$L+<--(BB)-KXlXNJ{S$?AKjpTGN6AR5VVW_ za)c(?iu$W83jWQsMwFN|FCwun`uh=>oWcGNGx|@{+VXM0|Ly|+Ab+Fqff+W%d$Fg7 zK9r#EMbQ6OE_A_FR=`1UVP{$7vph7!Dxi?%rRkQYS(cCH;D2z;vj)*JYcO4a=XPrt zU1SC6a_czyf^|IIYlY|=Rxus1M$z+D3B7BLruVHe^e5{C`iFHQkFX|ii8YbOS(A9O zRmM}Sa;`(geU4SdYpiPCU`^#lYZ_l+P3PU#Nqns}llNGs@Lp>cD)dwNKC1@R`D|3= zbNF#`8z)E9b{VjIHPyOI=~7a3m*?Y1^5*DaMgv+ zzwp_O&&~Keh>t6MuO_+fZATLAz%Ap2G?*?$TH1vgeK#(~uA>ua4~?f=X)@hG({Kiv rL7j9e?Wei)2+gN%T0~D$EiU`&=rEz^qE+;5T1(F(Nt^+^iWmJaGGz~A diff --git a/Robust/cup/java_cup/emit.java b/Robust/cup/java_cup/emit.java deleted file mode 100644 index 9db9014a..00000000 --- a/Robust/cup/java_cup/emit.java +++ /dev/null @@ -1,897 +0,0 @@ -package java_cup; - -import java.io.PrintWriter; -import java.util.Stack; -import java.util.Enumeration; -import java.util.Date; - -/** - * This class handles emitting generated code for the resulting parser. - * The various parse tables must be constructed, etc. before calling any - * routines in this class.

    - * - * Three classes are produced by this code: - *

    - *
    symbol constant class - *
    this contains constant declarations for each terminal (and - * optionally each non-terminal). - *
    action class - *
    this non-public class contains code to invoke all the user actions - * that were embedded in the parser specification. - *
    parser class - *
    the specialized parser class consisting primarily of some user - * supplied general and initialization code, and the parse tables. - *

    - * - * Three parse tables are created as part of the parser class: - *

    - *
    production table - *
    lists the LHS non terminal number, and the length of the RHS of - * each production. - *
    action table - *
    for each state of the parse machine, gives the action to be taken - * (shift, reduce, or error) under each lookahead symbol.
    - *
    reduce-goto table - *
    when a reduce on a given production is taken, the parse stack is - * popped back a number of elements corresponding to the RHS of the - * production. This reveals a prior state, which we transition out - * of under the LHS non terminal symbol for the production (as if we - * had seen the LHS symbol rather than all the symbols matching the - * RHS). This table is indexed by non terminal numbers and indicates - * how to make these transitions. - *

    - * - * In addition to the method interface, this class maintains a series of - * public global variables and flags indicating how misc. parts of the code - * and other output is to be produced, and counting things such as number of - * conflicts detected (see the source code and public variables below for - * more details).

    - * - * This class is "static" (contains only static data and methods).

    - * - * @see java_cup.main - * @version last update: 11/25/95 - * @author Scott Hudson - */ - -/* Major externally callable routines here include: - symbols - emit the symbol constant class - parser - emit the parser class - - In addition the following major internal routines are provided: - emit_package - emit a package declaration - emit_action_code - emit the class containing the user's actions - emit_production_table - emit declaration and init for the production table - do_action_table - emit declaration and init for the action table - do_reduce_table - emit declaration and init for the reduce-goto table - - Finally, this class uses a number of public instance variables to communicate - optional parameters and flags used to control how code is generated, - as well as to report counts of various things (such as number of conflicts - detected). These include: - - prefix - a prefix string used to prefix names that would - otherwise "pollute" someone else's name space. - package_name - name of the package emitted code is placed in - (or null for an unnamed package. - symbol_const_class_name - name of the class containing symbol constants. - parser_class_name - name of the class for the resulting parser. - action_code - user supplied declarations and other code to be - placed in action class. - parser_code - user supplied declarations and other code to be - placed in parser class. - init_code - user supplied code to be executed as the parser - is being initialized. - scan_code - user supplied code to get the next Symbol. - start_production - the start production for the grammar. - import_list - list of imports for use with action class. - num_conflicts - number of conflicts detected. - nowarn - true if we are not to issue warning messages. - not_reduced - count of number of productions that never reduce. - unused_term - count of unused terminal symbols. - unused_non_term - count of unused non terminal symbols. - *_time - a series of symbols indicating how long various - sub-parts of code generation took (used to produce - optional time reports in main). -*/ - -public class emit { - - /*-----------------------------------------------------------*/ - /*--- Constructor(s) ----------------------------------------*/ - /*-----------------------------------------------------------*/ - - /** Only constructor is private so no instances can be created. */ - private emit() { } - - /*-----------------------------------------------------------*/ - /*--- Static (Class) Variables ------------------------------*/ - /*-----------------------------------------------------------*/ - - /** The prefix placed on names that pollute someone else's name space. */ - public static String prefix = "CUP$"; - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Package that the resulting code goes into (null is used for unnamed). */ - public static String package_name = null; - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Name of the generated class for symbol constants. */ - public static String symbol_const_class_name = "sym"; - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Name of the generated parser class. */ - public static String parser_class_name = "parser"; - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** User declarations for direct inclusion in user action class. */ - public static String action_code = null; - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** User declarations for direct inclusion in parser class. */ - public static String parser_code = null; - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** User code for user_init() which is called during parser initialization. */ - public static String init_code = null; - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** User code for scan() which is called to get the next Symbol. */ - public static String scan_code = null; - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** The start production of the grammar. */ - public static production start_production = null; - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** List of imports (Strings containing class names) to go with actions. */ - public static Stack import_list = new Stack(); - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Number of conflict found while building tables. */ - public static int num_conflicts = 0; - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Do we skip warnings? */ - public static boolean nowarn = false; - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Count of the number on non-reduced productions found. */ - public static int not_reduced = 0; - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Count of unused terminals. */ - public static int unused_term = 0; - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Count of unused non terminals. */ - public static int unused_non_term = 0; - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /* Timing values used to produce timing report in main.*/ - - /** Time to produce symbol constant class. */ - public static long symbols_time = 0; - - /** Time to produce parser class. */ - public static long parser_time = 0; - - /** Time to produce action code class. */ - public static long action_code_time = 0; - - /** Time to produce the production table. */ - public static long production_table_time = 0; - - /** Time to produce the action table. */ - public static long action_table_time = 0; - - /** Time to produce the reduce-goto table. */ - public static long goto_table_time = 0; - - /* frankf 6/18/96 */ - protected static boolean _lr_values; - - /** whether or not to emit code for left and right values */ - public static boolean lr_values() {return _lr_values;} - protected static void set_lr_values(boolean b) { _lr_values = b;} - - /*-----------------------------------------------------------*/ - /*--- General Methods ---------------------------------------*/ - /*-----------------------------------------------------------*/ - - /** Build a string with the standard prefix. - * @param str string to prefix. - */ - protected static String pre(String str) { - return prefix + parser_class_name + "$" + str; - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Emit a package spec if the user wants one. - * @param out stream to produce output on. - */ - protected static void emit_package(PrintWriter out) - { - /* generate a package spec if we have a name for one */ - if (package_name != null) { - out.println("package " + package_name + ";"); out.println(); - } - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Emit code for the symbol constant class, optionally including non terms, - * if they have been requested. - * @param out stream to produce output on. - * @param emit_non_terms do we emit constants for non terminals? - * @param sym_interface should we emit an interface, rather than a class? - */ - public static void symbols(PrintWriter out, - boolean emit_non_terms, boolean sym_interface) - { - terminal term; - non_terminal nt; - String class_or_interface = (sym_interface)?"interface":"class"; - - long start_time = System.currentTimeMillis(); - - /* top of file */ - out.println(); - out.println("//----------------------------------------------------"); - out.println("// The following code was generated by " + - version.title_str); - out.println("// " + new Date()); - out.println("//----------------------------------------------------"); - out.println(); - emit_package(out); - - /* class header */ - out.println("/** CUP generated " + class_or_interface + - " containing symbol constants. */"); - out.println("public " + class_or_interface + " " + - symbol_const_class_name + " {"); - - out.println(" /* terminals */"); - - /* walk over the terminals */ /* later might sort these */ - for (Enumeration e = terminal.all(); e.hasMoreElements(); ) - { - term = (terminal)e.nextElement(); - - /* output a constant decl for the terminal */ - out.println(" public static final int " + term.name() + " = " + - term.index() + ";"); - } - - /* do the non terminals if they want them (parser doesn't need them) */ - if (emit_non_terms) - { - out.println(); - out.println(" /* non terminals */"); - - /* walk over the non terminals */ /* later might sort these */ - for (Enumeration e = non_terminal.all(); e.hasMoreElements(); ) - { - nt = (non_terminal)e.nextElement(); - - /* output a constant decl for the terminal */ - out.println(" static final int " + nt.name() + " = " + - nt.index() + ";"); - } - } - - /* end of class */ - out.println("}"); - out.println(); - - symbols_time = System.currentTimeMillis() - start_time; - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Emit code for the non-public class holding the actual action code. - * @param out stream to produce output on. - * @param start_prod the start production of the grammar. - */ - protected static void emit_action_code(PrintWriter out, production start_prod) - throws internal_error - { - production prod; - - long start_time = System.currentTimeMillis(); - - /* class header */ - out.println(); - out.println( - "/** Cup generated class to encapsulate user supplied action code.*/" - ); - out.println("class " + pre("actions") + " {"); - - /* user supplied code */ - if (action_code != null) - { - out.println(); - out.println(action_code); - } - - /* field for parser object */ - out.println(" private final "+parser_class_name+" parser;"); - - /* constructor */ - out.println(); - out.println(" /** Constructor */"); - out.println(" " + pre("actions") + "("+parser_class_name+" parser) {"); - out.println(" this.parser = parser;"); - out.println(" }"); - - /* action method head */ - out.println(); - out.println(" /** Method with the actual generated action code. */"); - out.println(" public final java_cup.runtime.Symbol " + - pre("do_action") + "("); - out.println(" int " + pre("act_num,")); - out.println(" java_cup.runtime.lr_parser " + pre("parser,")); - out.println(" java.util.Stack " + pre("stack,")); - out.println(" int " + pre("top)")); - out.println(" throws java.lang.Exception"); - out.println(" {"); - - /* declaration of result symbol */ - /* New declaration!! now return Symbol - 6/13/96 frankf */ - out.println(" /* Symbol object for return from actions */"); - out.println(" java_cup.runtime.Symbol " + pre("result") + ";"); - out.println(); - - /* switch top */ - out.println(" /* select the action based on the action number */"); - out.println(" switch (" + pre("act_num") + ")"); - out.println(" {"); - - /* emit action code for each production as a separate case */ - for (Enumeration p = production.all(); p.hasMoreElements(); ) - { - prod = (production)p.nextElement(); - - /* case label */ - out.println(" /*. . . . . . . . . . . . . . . . . . . .*/"); - out.println(" case " + prod.index() + ": // " + - prod.to_simple_string()); - - /* give them their own block to work in */ - out.println(" {"); - - /* create the result symbol */ - /*make the variable RESULT which will point to the new Symbol (see below) - and be changed by action code - 6/13/96 frankf */ - out.println(" " + prod.lhs().the_symbol().stack_type() + - " RESULT = null;"); - - /* Add code to propagate RESULT assignments that occur in - * action code embedded in a production (ie, non-rightmost - * action code). 24-Mar-1998 CSA - */ - for (int i=0; ireduce_goto table. */"); - out.println(" protected static final short[][] _reduce_table = "); - out.print (" unpackFromStrings("); - do_table_as_string(out, reduce_goto_table); - out.println(");"); - - /* do the public accessor method */ - out.println(); - out.println(" /** Access to reduce_goto table. */"); - out.println(" public short[][] reduce_table() {return _reduce_table;}"); - out.println(); - - goto_table_time = System.currentTimeMillis() - start_time; - } - - // print a string array encoding the given short[][] array. - protected static void do_table_as_string(PrintWriter out, short[][] sa) { - out.println("new String[] {"); - out.print(" \""); - int nchar=0, nbytes=0; - nbytes+=do_escaped(out, (char)(sa.length>>16)); - nchar =do_newline(out, nchar, nbytes); - nbytes+=do_escaped(out, (char)(sa.length&0xFFFF)); - nchar =do_newline(out, nchar, nbytes); - for (int i=0; i>16)); - nchar =do_newline(out, nchar, nbytes); - nbytes+=do_escaped(out, (char)(sa[i].length&0xFFFF)); - nchar =do_newline(out, nchar, nbytes); - for (int j=0; j 65500) { out.println("\", "); out.print(" \""); } - else if (nchar > 11) { out.println("\" +"); out.print(" \""); } - else return nchar+1; - return 0; - } - // output an escape sequence for the given character code. - protected static int do_escaped(PrintWriter out, char c) { - StringBuffer escape = new StringBuffer(); - if (c <= 0xFF) { - escape.append(Integer.toOctalString(c)); - while(escape.length() < 3) escape.insert(0, '0'); - } else { - escape.append(Integer.toHexString(c)); - while(escape.length() < 4) escape.insert(0, '0'); - escape.insert(0, 'u'); - } - escape.insert(0, '\\'); - out.print(escape.toString()); - - // return number of bytes this takes up in UTF-8 encoding. - if (c == 0) return 2; - if (c >= 0x01 && c <= 0x7F) return 1; - if (c >= 0x80 && c <= 0x7FF) return 2; - return 3; - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Emit the parser subclass with embedded tables. - * @param out stream to produce output on. - * @param action_table internal representation of the action table. - * @param reduce_table internal representation of the reduce-goto table. - * @param start_st start state of the parse machine. - * @param start_prod start production of the grammar. - * @param compact_reduces do we use most frequent reduce as default? - * @param suppress_scanner should scanner be suppressed for compatibility? - */ - public static void parser( - PrintWriter out, - parse_action_table action_table, - parse_reduce_table reduce_table, - int start_st, - production start_prod, - boolean compact_reduces, - boolean suppress_scanner) - throws internal_error - { - long start_time = System.currentTimeMillis(); - - /* top of file */ - out.println(); - out.println("//----------------------------------------------------"); - out.println("// The following code was generated by " + - version.title_str); - out.println("// " + new Date()); - out.println("//----------------------------------------------------"); - out.println(); - emit_package(out); - - /* user supplied imports */ - for (int i = 0; i < import_list.size(); i++) - out.println("import " + import_list.elementAt(i) + ";"); - - /* class header */ - out.println(); - out.println("/** "+version.title_str+" generated parser."); - out.println(" * @version " + new Date()); - out.println(" */"); - out.println("public class " + parser_class_name + - " extends java_cup.runtime.lr_parser {"); - - /* constructors [CSA/davidm, 24-jul-99] */ - out.println(); - out.println(" /** Default constructor. */"); - out.println(" public " + parser_class_name + "() {super();}"); - if (!suppress_scanner) { - out.println(); - out.println(" /** Constructor which sets the default scanner. */"); - out.println(" public " + parser_class_name + - "(java_cup.runtime.Scanner s) {super(s);}"); - } - - /* emit the various tables */ - emit_production_table(out); - do_action_table(out, action_table, compact_reduces); - do_reduce_table(out, reduce_table); - - /* instance of the action encapsulation class */ - out.println(" /** Instance of action encapsulation class. */"); - out.println(" protected " + pre("actions") + " action_obj;"); - out.println(); - - /* action object initializer */ - out.println(" /** Action encapsulation object initializer. */"); - out.println(" protected void init_actions()"); - out.println(" {"); - out.println(" action_obj = new " + pre("actions") + "(this);"); - out.println(" }"); - out.println(); - - /* access to action code */ - out.println(" /** Invoke a user supplied parse action. */"); - out.println(" public java_cup.runtime.Symbol do_action("); - out.println(" int act_num,"); - out.println(" java_cup.runtime.lr_parser parser,"); - out.println(" java.util.Stack stack,"); - out.println(" int top)"); - out.println(" throws java.lang.Exception"); - out.println(" {"); - out.println(" /* call code in generated class */"); - out.println(" return action_obj." + pre("do_action(") + - "act_num, parser, stack, top);"); - out.println(" }"); - out.println(""); - - - /* method to tell the parser about the start state */ - out.println(" /** Indicates start state. */"); - out.println(" public int start_state() {return " + start_st + ";}"); - - /* method to indicate start production */ - out.println(" /** Indicates start production. */"); - out.println(" public int start_production() {return " + - start_production.index() + ";}"); - out.println(); - - /* methods to indicate EOF and error symbol indexes */ - out.println(" /** EOF Symbol index. */"); - out.println(" public int EOF_sym() {return " + terminal.EOF.index() + - ";}"); - out.println(); - out.println(" /** error Symbol index. */"); - out.println(" public int error_sym() {return " + terminal.error.index() + - ";}"); - out.println(); - - /* user supplied code for user_init() */ - if (init_code != null) - { - out.println(); - out.println(" /** User initialization code. */"); - out.println(" public void user_init() throws java.lang.Exception"); - out.println(" {"); - out.println(init_code); - out.println(" }"); - } - - /* user supplied code for scan */ - if (scan_code != null) - { - out.println(); - out.println(" /** Scan to get the next Symbol. */"); - out.println(" public java_cup.runtime.Symbol scan()"); - out.println(" throws java.lang.Exception"); - out.println(" {"); - out.println(scan_code); - out.println(" }"); - } - - /* user supplied code */ - if (parser_code != null) - { - out.println(); - out.println(parser_code); - } - - /* end of class */ - out.println("}"); - - /* put out the action code class */ - emit_action_code(out, start_prod); - - parser_time = System.currentTimeMillis() - start_time; - } - - /*-----------------------------------------------------------*/ -} diff --git a/Robust/cup/java_cup/internal_error.class b/Robust/cup/java_cup/internal_error.class deleted file mode 100644 index 77c69e14505a3fc2cc6a62aea0d9d92f59f0f33e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 580 zcmZWnT`vPc6g{*3*qScYZ{OB;OQP{y@lqrNkrb~o)})5*ZZn+sMtJXAH1+9AZf+5}ruO&m~NConw*S?baOkDYdBs?v;Hw>{#MB~k{r#-o^ zqEC4h7^wr{UrMb*y%`BR;7Hq;bufo{hLuCY8t13(zA(af4}J>Vy{N$5l}36-UfXaT zEFkS*5lar1k#VqsRfcjTdFk~!wZE;X_t3@OgC{#ig#p9(5N$qojcn7o>1<^C+qDX7 zr)1fXaVgsMUzxu!gWZWpJ_+)cG{>^r6)o~xs8s)79^Ki1-890xJJZ4=Vq88bL#c95 zy&zvHdZlPsAVH)lI<#A)y+t{>zVQO~L@S0-ihO`_BnHeeWPbRKK|L`23@aDwBTjj} ij|8nKC9PN3Ly;1d16gXFqnW2aqkt(CNot&M3)wGb@qC^D diff --git a/Robust/cup/java_cup/internal_error.java b/Robust/cup/java_cup/internal_error.java deleted file mode 100644 index 4d3e7c2c..00000000 --- a/Robust/cup/java_cup/internal_error.java +++ /dev/null @@ -1,22 +0,0 @@ - -package java_cup; - -/** Exception subclass for reporting internal errors in JavaCup. */ -public class internal_error extends Exception - { - /** Constructor with a message */ - public internal_error(String msg) - { - super(msg); - } - - /** Method called to do a forced error exit on an internal error - for cases when we can't actually throw the exception. */ - public void crash() - { - System.err.println("JavaCUP Fatal Internal Error Detected"); - System.err.println(getMessage()); - printStackTrace(); - System.exit(-1); - } - } diff --git a/Robust/cup/java_cup/lalr_item.class b/Robust/cup/java_cup/lalr_item.class deleted file mode 100644 index 275e77eeb7fbaa4f632192c2049f8bd8e3d751ae..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3745 zcmaJ@{c~JZ8GcT7H@msLO`0@q8k)!kOHFo@rcG&qgj5syDQQa$G=zf7&F)S1wwv8$ z_ikw^h}epN0)C*9C@S@%Rid^^H%PRN=lyuz&$I9T@2#rH24sgLqZl)<1!h zJ0ZK2TujT74k9CztSpZPkqaTOp&7QE3$mOPsmEk@DumM-9>*D3p3v|lJ{81M8g9m? zH9U>a1aVe)&js;W4V&62?uA>V6yE6$>p<%>In}-V16K3u{VwXY#I!6ZYhCW@u&g!`iE>bgyv1WWWu$UWNC(7nb46nr z1HHS+Bd{z$fqc@Mv=!ESkyg|y)W?lf+?!`_7OK_V(ACB=oY+Y#Z#fC@b#_T^%|{DH ziXd;`67}j%B-oizJ7=Y*7>T7wIzlBXD@+^B z6moHMuO$^wU-oi~6t0e8d_%`w7-VXM;K_pAeN)FSd{oEBFeJyj32eoB*YPU8rQ_Q; zs^b7YuH!p+O~*YL(QzKfbbJ@zQ)nuSmOUXkb(C5~g5m*oK+58{{t+z6FQqLkg?f|W{` zIUR4}7aSV|_z)gesOb*#bVkQpf_VYI)bT4^)p1QOmE1ka`E=<1k&*Do;luX~?cX!B zyQ70-URUz#Hd!p5$+2)+J^kbzL(+n*M6Uj9A)i#(yi(;lO;T0N3IR#!X-c!zKd4_> z_5Qr|I5E_jDRbIP+e2*Kb)5%FQ|3CYS|Ve|3_Hf+5GIddw;=>-y`3~=y12ts8qqVd zDi`dYpyIsjM)tyK>2VEM=yrZ2IowL7{yKn)57Fn4S8d$_*tsmWL#sR-j|KWpQMiqB{8B5NWlZoGYb_d53YOtH9-3}+v7KygaLq&S7peC{a-}pTIR}hGB zsl7}-g*{x?BfxbFYSD{T*vj)ZY(yXSlIkZTt9uh^KHh{PQD65wf)za)IY4|t zBCM9(@5)AKNqFihyMPek)UBXlFIHn;l?F~!Vi3>T`Q<2}4{xC65;r9mY8~Pct{k~s zuV)Qh&pJ*fPDPism#73+1GNUCMQCH!g{a$9!ks@@SR}Z$$LKB`D^hA8jfp1qk@9K+aIFF68YcFEWA{s@Yh^BKs zb>aQLR|33+=>ZC~cZx|ljdgeet$2!m($1m>&oE`ru_&I$5q`(;LRAQl;1e$1hnXO8 zb_cDjox$n_G>U@>; z^BT7Eo%3dX6!*DC|H1&)(&$;Q(TydeP8}R98Fd2EQbgN%jFQsAfVB7fTm40RXchyl z{zcqeM7TfD8YrTJq3&)CEaH|TK0MZa$=Poz;#P)wOz7Nio<*Shk`u^_-I4?H5k{$M zhOvhGB3+oL3k!_pRsJ7d#18z1CHyvv@ORAfyBNpsaSVTC?%zWme_{r%;tc+Zr}4Kc zckjnh*WG9Nm72J>%`#QqZl{q| z18UV8@{iH~Qb+ZvC$-HkZaQ>+fLFtEA7p@(s4V ziS6gnCp>LM+%|&_4<9dg6tR=cO}D!e=W5uIfAH`$-QnI`K#P}rr%U$I`dyl*iFToZ z#n=O%+J+X@haR;ZL+Uo{S3B{Lx*evv16g$^UgZ8|)sKs60I#b-TvNO7p4!J?eUe$M GLG1sVg?~T* diff --git a/Robust/cup/java_cup/lalr_item.java b/Robust/cup/java_cup/lalr_item.java deleted file mode 100644 index fe920544..00000000 --- a/Robust/cup/java_cup/lalr_item.java +++ /dev/null @@ -1,330 +0,0 @@ -package java_cup; - -import java.util.Stack; -import java.util.Enumeration; - -/** This class represents an LALR item. Each LALR item consists of - * a production, a "dot" at a position within that production, and - * a set of lookahead symbols (terminal). (The first two of these parts - * are provide by the super class). An item is designed to represent a - * configuration that the parser may be in. For example, an item of the - * form:

    - *    [A ::= B * C d E  , {a,b,c}]
    - *  
    - * indicates that the parser is in the middle of parsing the production
    - *    A ::= B C d E
    - *  
    - * that B has already been parsed, and that we will expect to see a lookahead - * of either a, b, or c once the complete RHS of this production has been - * found.

    - * - * Items may initially be missing some items from their lookahead sets. - * Links are maintained from each item to the set of items that would need - * to be updated if symbols are added to its lookahead set. During - * "lookahead propagation", we add symbols to various lookahead sets and - * propagate these changes across these dependency links as needed. - * - * @see java_cup.lalr_item_set - * @see java_cup.lalr_state - * @version last updated: 11/25/95 - * @author Scott Hudson - */ -public class lalr_item extends lr_item_core { - - /*-----------------------------------------------------------*/ - /*--- Constructor(s) ----------------------------------------*/ - /*-----------------------------------------------------------*/ - - /** Full constructor. - * @param prod the production for the item. - * @param pos the position of the "dot" within the production. - * @param look the set of lookahead symbols. - */ - public lalr_item(production prod, int pos, terminal_set look) - throws internal_error - { - super(prod, pos); - _lookahead = look; - _propagate_items = new Stack(); - needs_propagation = true; - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Constructor with default position (dot at start). - * @param prod the production for the item. - * @param look the set of lookahead symbols. - */ - public lalr_item(production prod, terminal_set look) throws internal_error - { - this(prod,0,look); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Constructor with default position and empty lookahead set. - * @param prod the production for the item. - */ - public lalr_item(production prod) throws internal_error - { - this(prod,0,new terminal_set()); - } - - /*-----------------------------------------------------------*/ - /*--- (Access to) Instance Variables ------------------------*/ - /*-----------------------------------------------------------*/ - - /** The lookahead symbols of the item. */ - protected terminal_set _lookahead; - - /** The lookahead symbols of the item. */ - public terminal_set lookahead() {return _lookahead;} - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Links to items that the lookahead needs to be propagated to. */ - protected Stack _propagate_items; - - /** Links to items that the lookahead needs to be propagated to */ - public Stack propagate_items() {return _propagate_items;} - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Flag to indicate that this item needs to propagate its lookahead - * (whether it has changed or not). - */ - protected boolean needs_propagation; - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Add a new item to the set of items we propagate to. */ - public void add_propagate(lalr_item prop_to) - { - _propagate_items.push(prop_to); - needs_propagation = true; - } - - /*-----------------------------------------------------------*/ - /*--- General Methods ---------------------------------------*/ - /*-----------------------------------------------------------*/ - - /** Propagate incoming lookaheads through this item to others need to - * be changed. - * @params incoming symbols to potentially be added to lookahead of this item. - */ - public void propagate_lookaheads(terminal_set incoming) throws internal_error - { - boolean change = false; - - /* if we don't need to propagate, then bail out now */ - if (!needs_propagation && (incoming == null || incoming.empty())) - return; - - /* if we have null incoming, treat as an empty set */ - if (incoming != null) - { - /* add the incoming to the lookahead of this item */ - change = lookahead().add(incoming); - } - - /* if we changed or need it anyway, propagate across our links */ - if (change || needs_propagation) - { - /* don't need to propagate again */ - needs_propagation = false; - - /* propagate our lookahead into each item we are linked to */ - for (int i = 0; i < propagate_items().size(); i++) - ((lalr_item)propagate_items().elementAt(i)) - .propagate_lookaheads(lookahead()); - } - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Produce the new lalr_item that results from shifting the dot one position - * to the right. - */ - public lalr_item shift() throws internal_error - { - lalr_item result; - - /* can't shift if we have dot already at the end */ - if (dot_at_end()) - throw new internal_error("Attempt to shift past end of an lalr_item"); - - /* create the new item w/ the dot shifted by one */ - result = new lalr_item(the_production(), dot_pos()+1, - new terminal_set(lookahead())); - - /* change in our lookahead needs to be propagated to this item */ - add_propagate(result); - - return result; - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Calculate lookahead representing symbols that could appear after the - * symbol that the dot is currently in front of. Note: this routine must - * not be invoked before first sets and nullability has been calculated - * for all non terminals. - */ - public terminal_set calc_lookahead(terminal_set lookahead_after) - throws internal_error - { - terminal_set result; - int pos; - production_part part; - symbol sym; - - /* sanity check */ - if (dot_at_end()) - throw new internal_error( - "Attempt to calculate a lookahead set with a completed item"); - - /* start with an empty result */ - result = new terminal_set(); - - /* consider all nullable symbols after the one to the right of the dot */ - for (pos = dot_pos()+1; pos < the_production().rhs_length(); pos++) - { - part = the_production().rhs(pos); - - /* consider what kind of production part it is -- skip actions */ - if (!part.is_action()) - { - sym = ((symbol_part)part).the_symbol(); - - /* if its a terminal add it in and we are done */ - if (!sym.is_non_term()) - { - result.add((terminal)sym); - return result; - } - else - { - /* otherwise add in first set of the non terminal */ - result.add(((non_terminal)sym).first_set()); - - /* if its nullable we continue adding, if not, we are done */ - if (!((non_terminal)sym).nullable()) - return result; - } - } - } - - /* if we get here everything past the dot was nullable - we add in the lookahead for after the production and we are done */ - result.add(lookahead_after); - return result; - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Determine if everything from the symbol one beyond the dot all the - * way to the end of the right hand side is nullable. This would indicate - * that the lookahead of this item must be included in the lookaheads of - * all items produced as a closure of this item. Note: this routine should - * not be invoked until after first sets and nullability have been - * calculated for all non terminals. - */ - public boolean lookahead_visible() throws internal_error - { - production_part part; - symbol sym; - - /* if the dot is at the end, we have a problem, but the cleanest thing - to do is just return true. */ - if (dot_at_end()) return true; - - /* walk down the rhs and bail if we get a non-nullable symbol */ - for (int pos = dot_pos() + 1; pos < the_production().rhs_length(); pos++) - { - part = the_production().rhs(pos); - - /* skip actions */ - if (!part.is_action()) - { - sym = ((symbol_part)part).the_symbol(); - - /* if its a terminal we fail */ - if (!sym.is_non_term()) return false; - - /* if its not nullable we fail */ - if (!((non_terminal)sym).nullable()) return false; - } - } - - /* if we get here its all nullable */ - return true; - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Equality comparison -- here we only require the cores to be equal since - * we need to do sets of items based only on core equality (ignoring - * lookahead sets). - */ - public boolean equals(lalr_item other) - { - if (other == null) return false; - return super.equals(other); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Generic equality comparison. */ - public boolean equals(Object other) - { - if (!(other instanceof lalr_item)) - return false; - else - return equals((lalr_item)other); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Return a hash code -- here we only hash the core since we only test core - * matching in LALR items. - */ - public int hashCode() - { - return super.hashCode(); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Convert to string. */ - public String toString() - { - String result = ""; - - // additional output for debugging: - // result += "(" + obj_hash() + ")"; - result += "["; - result += super.toString(); - result += ", "; - if (lookahead() != null) - { - result += "{"; - for (int t = 0; t < terminal.number(); t++) - if (lookahead().contains(t)) - result += terminal.find(t).name() + " "; - result += "}"; - } - else - result += "NULL LOOKAHEAD!!"; - result += "]"; - - // additional output for debugging: - // result += " -> "; - // for (int i = 0; iZjTP5tQcgFXHU9^-RoX0x+t@c1G3H#>7* zo_p_e?@a#ipAUWkU>k1u(T|f}=zdgSyb7&|i5eX5eyf`fi$!g3X zB_b_9XGNUxLqo=o4rE0&Cn7Ho&Wd=#i*r7l_oD?*dhwLpdRhd1x8j1Ben!MIB0lTK zMO^aYSudUwf1i_^&x?3L>|Yd<&&$u3ym;A<2*yQx!HZY?*n*Qjyej7xz4($J+vWF{ z<@}0>uln#cIbZYPby0fFi?1uVV|p^F&^UZbKdblVbBSc{K|MR2)5nuWze3G4f5g)h zMl7z!rwxUAOEIaZrh11`Ib+JmP_1%zB9+MPQE+v2AEVQKv{0xWPNa;{{LHwKd06}@ zw04>1v3P#AH>oExu|&?8iDivkznJ+4&&7?|Tq2#y(vyiR*wyVoHkiuK7#UqO7}T9j zJV~DnIi%o=r&BpSA(qXn1?lfTPK(JzYC<8ry22{Z7)48DW7+&TF~-u9|1$#ys4U<&`_+q8Ns?s2>zq# zd?s$}Pe?NZWgXli1k&(H>?KK7A(K4%hKAkvxQ0FWgoa}n({LGAG<*{WG#tc`hHv4x zhHv94or{a|5@^_u175tL;X8O!!*|8>K|G{k6o)i?58u~t7(dYP7Unb@!BzP=B3DOQ z_+@tqk~WjllQAQcNoN$=M_JKO+N@zHpEV{ziByQ~3#HjclWKzehwRI;i?Y1s=>r-b z#-}y>2ybh62lEEci+>{1Wrq3QHDdCz4&h)r3$uwdqhA2arN~dB) zC`4Ej*OT#>Bb}{xgj`x>MSF9}l0M7kv9pP6!d%KFB02-IjwQCTg?FwG)97^|DOvU3 z0fw147h{a7v-*^tBZoZk4EGR8!}&a>C-btp^x0WM_H~c5?#1Fc3h(4Q>$Lg*R5!W5 zQr~8svx!CbmOk3~3hw83LJ-7?--b4ih zlzgv4B`rH0zBdy7CUm0PoKU;}1ARSEtL&`7*LmP7|Y`++m@#Y9Yyu^xQ&SPXPheCQv~ASkE<+D`x(@ z*Dw|-<$pJP^l_eXo+fRcK_f1bo0kavMK<>(e(Akj7N74yJN_;keuEWX*l1U{ajZlg zivmf?EoDg4N&h4&^)*F;Y$BZ4)4?d4Ho8uGXH#K+Xa!vNCNHbjypgkbOL^8`J& zmj2ZvY$_nsSILX^d#i$;0`Bhf2EA5}OMjFrGs%1Ue2dVcLCTJ3uyO&N3)nas-dsRa zpS!W@GOBul+%TJh?#*v4{W>D|+0Gj!_z!ZC0sm%2mN;=0XjC4oQ$B=L6*`rMUR8^o zDuDf}0Y_9b48?z@R2$By4R}Jexb1s8eM@%&kzb+p ziskbrS_|kdO}5z}H2|;LhblElOMa5s_8GQK*7$&HH)qLno5L-0;M!B%KP|0}NeExs z{hUk9E&YSc5KSu)h%N48I iSE9THXA(X&P0A$DrcPr(B{8UGFs#x9@;CuhAogER1!(gC diff --git a/Robust/cup/java_cup/lalr_item_set.java b/Robust/cup/java_cup/lalr_item_set.java deleted file mode 100644 index 233a68f3..00000000 --- a/Robust/cup/java_cup/lalr_item_set.java +++ /dev/null @@ -1,371 +0,0 @@ - -package java_cup; - -import java.util.Hashtable; -import java.util.Enumeration; - -/** This class represents a set of LALR items. For purposes of building - * these sets, items are considered unique only if they have unique cores - * (i.e., ignoring differences in their lookahead sets).

    - * - * This class provides fairly conventional set oriented operations (union, - * sub/super-set tests, etc.), as well as an LALR "closure" operation (see - * compute_closure()). - * - * @see java_cup.lalr_item - * @see java_cup.lalr_state - * @version last updated: 3/6/96 - * @author Scott Hudson - */ - -public class lalr_item_set { - - /*-----------------------------------------------------------*/ - /*--- Constructor(s) ----------------------------------------*/ - /*-----------------------------------------------------------*/ - - /** Constructor for an empty set. */ - public lalr_item_set() { } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Constructor for cloning from another set. - * @param other indicates set we should copy from. - */ - public lalr_item_set(lalr_item_set other) - throws internal_error - { - not_null(other); - _all = (Hashtable)other._all.clone(); - } - - /*-----------------------------------------------------------*/ - /*--- (Access to) Instance Variables ------------------------*/ - /*-----------------------------------------------------------*/ - - /** A hash table to implement the set. We store the items using themselves - * as keys. - */ - protected Hashtable _all = new Hashtable(11); - - /** Access to all elements of the set. */ - public Enumeration all() {return _all.elements();} - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Cached hashcode for this set. */ - protected Integer hashcode_cache = null; - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Size of the set */ - public int size() {return _all.size();} - - /*-----------------------------------------------------------*/ - /*--- Set Operation Methods ---------------------------------*/ - /*-----------------------------------------------------------*/ - - /** Does the set contain a particular item? - * @param itm the item in question. - */ - public boolean contains(lalr_item itm) {return _all.containsKey(itm);} - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Return the item in the set matching a particular item (or null if not - * found) - * @param itm the item we are looking for. - */ - public lalr_item find(lalr_item itm) {return (lalr_item)_all.get(itm);} - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Is this set an (improper) subset of another? - * @param other the other set in question. - */ - public boolean is_subset_of(lalr_item_set other) throws internal_error - { - not_null(other); - - /* walk down our set and make sure every element is in the other */ - for (Enumeration e = all(); e.hasMoreElements(); ) - if (!other.contains((lalr_item)e.nextElement())) - return false; - - /* they were all there */ - return true; - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Is this set an (improper) superset of another? - * @param other the other set in question. - */ - public boolean is_superset_of(lalr_item_set other) throws internal_error - { - not_null(other); - return other.is_subset_of(this); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Add a singleton item, merging lookahead sets if the item is already - * part of the set. returns the element of the set that was added or - * merged into. - * @param itm the item being added. - */ - public lalr_item add(lalr_item itm) throws internal_error - { - lalr_item other; - - not_null(itm); - - /* see if an item with a matching core is already there */ - other = (lalr_item)_all.get(itm); - - /* if so, merge this lookahead into the original and leave it */ - if (other != null) - { - other.lookahead().add(itm.lookahead()); - return other; - } - /* otherwise we just go in the set */ - else - { - /* invalidate cached hashcode */ - hashcode_cache = null; - - _all.put(itm,itm); - return itm; - } - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Remove a single item if it is in the set. - * @param itm the item to remove. - */ - public void remove(lalr_item itm) throws internal_error - { - not_null(itm); - - /* invalidate cached hashcode */ - hashcode_cache = null; - - /* remove it from hash table implementing set */ - _all.remove(itm); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Add a complete set, merging lookaheads where items are already in - * the set - * @param other the set to be added. - */ - public void add(lalr_item_set other) throws internal_error - { - not_null(other); - - /* walk down the other set and do the adds individually */ - for (Enumeration e = other.all(); e.hasMoreElements(); ) - add((lalr_item)e.nextElement()); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Remove (set subtract) a complete set. - * @param other the set to remove. - */ - public void remove(lalr_item_set other) throws internal_error - { - not_null(other); - - /* walk down the other set and do the removes individually */ - for (Enumeration e = other.all(); e.hasMoreElements(); ) - remove((lalr_item)e.nextElement()); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Remove and return one item from the set (done in hash order). */ - public lalr_item get_one() throws internal_error - { - Enumeration the_set; - lalr_item result; - - the_set = all(); - if (the_set.hasMoreElements()) - { - result = (lalr_item)the_set.nextElement(); - remove(result); - return result; - } - else - return null; - } - - /*-----------------------------------------------------------*/ - /*--- General Methods ---------------------------------------*/ - /*-----------------------------------------------------------*/ - - /** Helper function for null test. Throws an interal_error exception if its - * parameter is null. - * @param obj the object we are testing. - */ - protected void not_null(Object obj) throws internal_error - { - if (obj == null) - throw new internal_error("Null object used in set operation"); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Compute the closure of the set using the LALR closure rules. Basically - * for every item of the form:

    -   *    [L ::= a *N alpha, l] 
    -   *  
    - * (where N is a a non terminal and alpha is a string of symbols) make - * sure there are also items of the form:
    -   *    [N ::= *beta, first(alpha l)] 
    -   *  
    - * corresponding to each production of N. Items with identical cores but - * differing lookahead sets are merged by creating a new item with the same - * core and the union of the lookahead sets (the LA in LALR stands for - * "lookahead merged" and this is where the merger is). This routine - * assumes that nullability and first sets have been computed for all - * productions before it is called. - */ - public void compute_closure() - throws internal_error - { - lalr_item_set consider; - lalr_item itm, new_itm, add_itm; - non_terminal nt; - terminal_set new_lookaheads; - Enumeration p; - production prod; - boolean need_prop; - - - - /* invalidate cached hashcode */ - hashcode_cache = null; - - /* each current element needs to be considered */ - consider = new lalr_item_set(this); - - /* repeat this until there is nothing else to consider */ - while (consider.size() > 0) - { - /* get one item to consider */ - itm = consider.get_one(); - - /* do we have a dot before a non terminal */ - nt = itm.dot_before_nt(); - if (nt != null) - { - /* create the lookahead set based on first after dot */ - new_lookaheads = itm.calc_lookahead(itm.lookahead()); - - /* are we going to need to propagate our lookahead to new item */ - need_prop = itm.lookahead_visible(); - - /* create items for each production of that non term */ - for (p = nt.productions(); p.hasMoreElements(); ) - { - prod = (production)p.nextElement(); - - /* create new item with dot at start and that lookahead */ - new_itm = new lalr_item(prod, - new terminal_set(new_lookaheads)); - - /* add/merge item into the set */ - add_itm = add(new_itm); - /* if propagation is needed link to that item */ - if (need_prop) - itm.add_propagate(add_itm); - - /* was this was a new item*/ - if (add_itm == new_itm) - { - /* that may need further closure, consider it also */ - consider.add(new_itm); - } - } - } - } - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Equality comparison. */ - public boolean equals(lalr_item_set other) - { - if (other == null || other.size() != size()) return false; - - /* once we know they are the same size, then improper subset does test */ - try { - return is_subset_of(other); - } catch (internal_error e) { - /* can't throw error from here (because superclass doesn't) so crash */ - e.crash(); - return false; - } - - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Generic equality comparison. */ - public boolean equals(Object other) - { - if (!(other instanceof lalr_item_set)) - return false; - else - return equals((lalr_item_set)other); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Return hash code. */ - public int hashCode() - { - int result = 0; - Enumeration e; - int cnt; - - /* only compute a new one if we don't have it cached */ - if (hashcode_cache == null) - { - /* hash together codes from at most first 5 elements */ - // CSA fix! we'd *like* to hash just a few elements, but - // that means equal sets will have inequal hashcodes, which - // we're not allowed (by contract) to do. So hash them all. - for (e = all(), cnt=0 ; e.hasMoreElements() /*&& cnt<5*/; cnt++) - result ^= ((lalr_item)e.nextElement()).hashCode(); - - hashcode_cache = new Integer(result); - } - - return hashcode_cache.intValue(); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Convert to string. */ - public String toString() - { - StringBuffer result = new StringBuffer(); - - result.append("{\n"); - for (Enumeration e=all(); e.hasMoreElements(); ) - { - result.append(" " + (lalr_item)e.nextElement() + "\n"); - } - result.append("}"); - - return result.toString(); - } - /*-----------------------------------------------------------*/ -} - diff --git a/Robust/cup/java_cup/lalr_state.class b/Robust/cup/java_cup/lalr_state.class deleted file mode 100644 index 79705a2547ca604441e5f1621e15be251f73520b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 9712 zcmb7J34B!5x&MFnPBN3pO$Z4AMnOjeBpWCS>aZvxC>Vk@3WDM|Boi_)nTazKKvC3+ zwJx-p}F0B^2T5GHAYwc$BRjsYBeXp-}bKd{E_fF;}LEn4)e%y2B zobP=5c22(Y!B?LFaGX3J#2t9K0yX%NA3qM@l^{&K8szVv1n^T`|2O^oOg}%@&uc+^ z2EWkHFZJ^){ruXG-&Ejr{5F6$f_M}E?#J(f7>AbwcuU8(72i8L`+WfK>i7p;`C||f zyjO|;z@PNct41l_*)Pw@b>`zp)3E?y?+Jpf&M521tI}4 z{9*>g$1N!fNO?f~O5idboGp0gnWNZ-UOD#8~ zPCw)HQ?DpEJ5k0{dYPcJiTVlo<**>mbZ{KbnM~53@A+jiRVqg))+6;3R-#nXiE@-8 zoT9U%73);}OjD5QemRD;X$P4h4HeQTO@3((;zBYBqD>=z8C+m+$5DA&5+Iy!$=F0+ITd3G5LXDh49CE5+J5_%!($8u7 zbFp7e4`Q>bYDqwr>iQXa>P($2)6a66Th0ndYd}`01Z@FX8IZFB@-d#LspOo1vwH$i;iOGtov6 z?da>Bm5e1b_Hr~E&)GO~nOG{D$R*M#LLN2(vb0H9;&YIf&rhThxrKtmXN-VXf;Q%c zRb+p0x-%{q)0#-d+xmLe$1~?D=j3$B){c0uOVYGu49#fpNVz1{*Avgg6hi6p7Y_@} z84VOG*hMy?*<36~RI@&ugAuIR2Z*iARmx#5#Y3v4vLraQGHDcOY1_u=s3q9h*V9{M zY~o199Qvx4iM^S0Z)^kkw+)y~r#HpAO-dtx2k)VrYBbC!fV`#Nm3I_fS7UsTVy5_4Y0>Kv@L>qXOy zW0@=kvav@U7cKGFYj0-aq#k!SmDjqi#MbDRM6Ns9n~8VCJL9Pia(tE-Yl-7!Bhk6E zGU+WIZ8(&it$7V=sgFb|8_(oi&ID(Av3q#_FdWM~ni__j0qCO6b|<=Wf;0Y~m_HnG zk!MF?f|^XcH%%Ej(y6Xwq9dn~>LHekXL=H;SaK-x#<}pW!i#8{JZFXyfk*Drnr$2x zi7j2Uh+~vrYdFnYrU%O7m-NLn6ODp#eV^8-cUWK^N^O|6a{b15N6xlVpqq)!$rpiK zx}E-&+8`KL%nCNRv&w)A%PsfW zDsY(Dlh~!x!WZ#~py|*!!kvA+v=<}YgUmud?y|5;KX>CE3wPpkmc*sYk_{NJq#F-g zl8}uIk0G8*g85~WB}wU_v~B0LwuZesDNEAQ>B{P;*wNW(ni4dFS|#xC1(x*6B^Dl4 zdcC6gbzOLyh414<3w!V-3lCzzFIh`+(r3wL*&?VN&XKBu$HIzhE0rOa%4L4pX36Dp zg(chNN=vT7i_E#nPRrQt(?nfv;P5jvskay{2U7R5}&QX44%*X?^N>DcgVy;!Hf7 zPHv8CFx%OZlMD@-OI|9Ny12M#L$Rkyr^4y3@cQ(IzHHdxD{J8yJZs5Q@>L7p!~qKj z@hwXRHRzfe8ymyt*mZ1{GnB}5rTbEy;Y7;K8Ar2K35VCmb6eu^6#e#V8VOv95lH_r zn!;h8ppQA$%tpf71V%G=CWJ}EmcmBZ72BN7D4VoRt~(y?N@TJ*`f9P7&kXX2Ze;1V zMDN}4%hQ%TgS-4fk)Fd{0*cTWZr7Uie-L5Ja30CQQ6IvaZCb|4%pl!TXt!_UI~KmD zb~D#SsDNJi27{KY+HO9gpJkD=qtsIvMpO$o{cEK$d;6FSPC7&_v3rE!)n)V&D@Z&U z?_nFmV&%&+%!zVCoG7Os0;N-?hv6K?Z2P5ICk>{RDYscqq-UMY8kQr|@mLRQmLv1< zWr4p}fs!c}&scA7JjLYQ;$@*Ivqy$u8J&nH&2T%ELnM4|+o9*^+S64tm9XHhNN3_p zh7`fxlLfj`ZxQa|$O7!vYvyyCZ8oa(Iks*^H>4AKJLS?wQGPphm6oaXWVhWfcv>M( zzUQ%^QgD{2Loaq`ks!WQtcL~+X1cS{WIVMY*G;{4rgPEWG;y0;7ECTGX#@v$Ss{*6 zVkvRwmYj-2b|}dN6>TiX2AGCg>=??Ejz_jqPTNyzTSruje{uhy9^V^?*jthRw0v;dv}nTBI9wqedln1Nj?|jAMuJp zy2I*0@y2BP)}azUj^dl&9ema-hkdc&%FV8Dn5rKJwbAgYe$clSx<3W_k zqbfiiW1d4ziAFV<0kUK(M;&h_IIl|X@yQ(Zc$tb_I^wYP32w11J_M*S67*&Q@m6*S z(29}#-$C;}hP{r_q?62*lY#fizqJ=*YiskUdyJDoj9arG^|j;km_U&x<`JqrjPpDW zCj?g}wKnB3IpPcXp288rd&yUHcBHWR4zEy5N98evV{;xy=P@;pX?aX{mTHgTXwEIG zFLO3$?8f=_ykQqA^(fI#(XINjJet~C@@U?PYTe*;$^fQu>hjm}9A*|#PpF+$WN^xk zG8riBCXQowmQX5&7x4)wvth># zV$PbTX8M+~A9LFpTNslie2!oK7S&|8j(H)+< zK9#dJRO`xluFhOJtIWA|^>v}DJkHMJW4kfOp4QjpaSr1yQmIHLg_z{pBUZ>dfHC%d z$Wn-NchoT`UKl7m6!KF9LY_D9!COyaRZ}UQyhwkCOhAPki7E+Wf=ngp>1dE+_*aky z%$H^?m04IWv(YZcW39|Zr<{zW%*SRq1y{ru{YtoK4 z&aJGk zd=eM!#+|yjpq^%q_M?0NSGVlL#r2g;Xt92baejo#+Xv9C2i8X{cR%7+50Clo!%TZp zejldU`19xp`Jcmud318R8%KL^OlY)0>ML6`EaN*-E{<GSCBNADmKYjkPjer$@AD|X#UIvm#y{kEBIANo1lVJTAC7_vP(>9Ej` z$wMGKK{gZ@1yyDSP#5y;Lyx^?lWf;-DiRzhbZa_D_p{s3NpH!x52Ara`##)nR2f&OYS$0^*EhRpUoVn6V3Np#J@F3jjgHl661c{tD~AO zb3Z1iz9u!=-`Sd9vhBV-L;Jf&@8`I$XZw7+K4PqMZP!VI*vv@S!gaeB z+^SW>W{W(I;!Ek8rIy7m%Es9!H`-BctioZ&YBU>bFwG{bYZoz0SP04 zO-2v0Mhe#&y|~Wk!!5>U++%FPea2;Y*tiONjjQp3aSaX_pB$!3zTP>yL^tc5*4dM& zo!I1EsAt8}(J6VC+KsHUQr7gSyI0oys4bek%d<{HaRmH;(T^JAF7kahrWp5Ns&Oy* zXZRVPA4Z=KmM;A;scXL&Xl!bxoh~b-X1ggg9vOCyubqcDN4t$Ww{O@vzL&b^{z_^A z(z}bXYuDHEP`R6uZqS*Nl2%YsCZyl7X)D4pmAG&Vb>_geHMcy7a^Kvt=9UKvzhSZC zp`X>4?JT^)`2r$YkjJ*2g@cXF{C)XA;TdzTzus@>v`|w$b5nFD+y7>rUBP$$fx?>u zg-j_-m!p;{eI9kjH*tjV9ZWO6j~T{Gm}k6}Ga5 z{p4yklDhJ7XN6)GSFYiTIoDV3vqe0WunX#GRZ2NimEq2(Ot#zG?X^4X_O{HYwDk-V z+O=HT;iD#=Q3~3!>i7w+5*Zuo4&u>aw>HSzYp>JxRy*G9wV$+Muh$FK^?PxHjyIH4 zd5(5<#``dgzf+a}z;xrEIM(4fK*26{{%wwqB`n4v?v$LT~)v6My*`VY%Kzw9*uQtYdQ0uEKXc%qaEzyT>W{odUOUF`c+L}ykI)HlB0nN;~ym=@5z5)0=xzWxC<{3Q4Kk2xqXS=6s zo4$^kew3Me8k^Wh=ke)MPPO}fb0z%d*{Cqj;Yq%@yXV6kh13I%_HQYja;ROvUH-Mt zg}#~8G*_)Jn$>$*yj4xiTWub<)!yzXzLi+JRx}^LZ1(_Vn?V1)jX~AwSsH@pUTVca z;U!OldYJl>xdAiGjX2Is;&iiz+TMtZ&0glQAF#!9^mwwZMZQrC;xjBipM4yaL$f6& b-yBMz;9P`O@s**AL2)?|yhNc4{P2GO*1r - * [A ::= B * C d E , {a,b,c}] - * - * this indicates that when the parser is in this state it is currently - * looking for an A of the given form, has already seen the B, and would - * expect to see an a, b, or c after this sequence is complete. Note that - * the parser is normally looking for several things at once (represented - * by several items). In our example above, the state would also include - * items such as:
    - *    [C ::= * X e Z, {d}]
    - *    [X ::= * f, {e}]
    - *  
    - * to indicate that it was currently looking for a C followed by a d (which - * would be reduced into a C, matching the first symbol in our production - * above), and the terminal f followed by e.

    - * - * At runtime, the parser uses a viable prefix recognition machine made up - * of these states to parse. The parser has two operations, shift and reduce. - * In a shift, it consumes one Symbol and makes a transition to a new state. - * This corresponds to "moving the dot past" a terminal in one or more items - * in the state (these new shifted items will then be found in the state at - * the end of the transition). For a reduce operation, the parser is - * signifying that it is recognizing the RHS of some production. To do this - * it first "backs up" by popping a stack of previously saved states. It - * pops off the same number of states as are found in the RHS of the - * production. This leaves the machine in the same state is was in when the - * parser first attempted to find the RHS. From this state it makes a - * transition based on the non-terminal on the LHS of the production. This - * corresponds to placing the parse in a configuration equivalent to having - * replaced all the symbols from the the input corresponding to the RHS with - * the symbol on the LHS. - * - * @see java_cup.lalr_item - * @see java_cup.lalr_item_set - * @see java_cup.lalr_transition - * @version last updated: 7/3/96 - * @author Frank Flannery - * - */ - -public class lalr_state { - /*-----------------------------------------------------------*/ - /*--- Constructor(s) ----------------------------------------*/ - /*-----------------------------------------------------------*/ - - /** Constructor for building a state from a set of items. - * @param itms the set of items that makes up this state. - */ - public lalr_state(lalr_item_set itms) throws internal_error - { - /* don't allow null or duplicate item sets */ - if (itms == null) - throw new internal_error( - "Attempt to construct an LALR state from a null item set"); - - if (find_state(itms) != null) - throw new internal_error( - "Attempt to construct a duplicate LALR state"); - - /* assign a unique index */ - _index = next_index++; - - /* store the items */ - _items = itms; - - /* add to the global collection, keyed with its item set */ - _all.put(_items,this); - } - - /*-----------------------------------------------------------*/ - /*--- (Access to) Static (Class) Variables ------------------*/ - /*-----------------------------------------------------------*/ - - /** Collection of all states. */ - protected static Hashtable _all = new Hashtable(); - - /** Collection of all states. */ - public static Enumeration all() {return _all.elements();} - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Indicate total number of states there are. */ - public static int number() {return _all.size();} - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Hash table to find states by their kernels (i.e, the original, - * unclosed, set of items -- which uniquely define the state). This table - * stores state objects using (a copy of) their kernel item sets as keys. - */ - protected static Hashtable _all_kernels = new Hashtable(); - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Find and return state with a given a kernel item set (or null if not - * found). The kernel item set is the subset of items that were used to - * originally create the state. These items are formed by "shifting the - * dot" within items of other states that have a transition to this one. - * The remaining elements of this state's item set are added during closure. - * @param itms the kernel set of the state we are looking for. - */ - public static lalr_state find_state(lalr_item_set itms) - { - if (itms == null) - return null; - else - return (lalr_state)_all.get(itms); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Static counter for assigning unique state indexes. */ - protected static int next_index = 0; - - /*-----------------------------------------------------------*/ - /*--- (Access to) Instance Variables ------------------------*/ - /*-----------------------------------------------------------*/ - - /** The item set for this state. */ - protected lalr_item_set _items; - - /** The item set for this state. */ - public lalr_item_set items() {return _items;} - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** List of transitions out of this state. */ - protected lalr_transition _transitions = null; - - /** List of transitions out of this state. */ - public lalr_transition transitions() {return _transitions;} - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Index of this state in the parse tables */ - protected int _index; - - /** Index of this state in the parse tables */ - public int index() {return _index;} - - /*-----------------------------------------------------------*/ - /*--- Static Methods ----------------------------------------*/ - /*-----------------------------------------------------------*/ - - /** Helper routine for debugging -- produces a dump of the given state - * onto System.out. - */ - protected static void dump_state(lalr_state st) throws internal_error - { - lalr_item_set itms; - lalr_item itm; - production_part part; - - if (st == null) - { - System.out.println("NULL lalr_state"); - return; - } - - System.out.println("lalr_state [" + st.index() + "] {"); - itms = st.items(); - for (Enumeration e = itms.all(); e.hasMoreElements(); ) - { - itm = (lalr_item)e.nextElement(); - System.out.print(" ["); - System.out.print(itm.the_production().lhs().the_symbol().name()); - System.out.print(" ::= "); - for (int i = 0; i - * [A ::= a b * X c, {d,e}] - * [B ::= a b * X d, {a,b}] - * - * in some state, then we would be making a transition under X to a new - * state. This new state would be formed by a "kernel" of items - * corresponding to moving the dot past the X. In this case:

    -   *    [A ::= a b X * c, {d,e}]
    -   *    [B ::= a b X * Y, {a,b}]
    -   *  
    - * The full state would then be formed by "closing" this kernel set of - * items so that it included items that represented productions of things - * the parser was now looking for. In this case we would items - * corresponding to productions of Y, since various forms of Y are expected - * next when in this state (see lalr_item_set.compute_closure() for details - * on closure).

    - * - * The process of building the viable prefix recognizer terminates when no - * new states can be added. However, in order to build a smaller number of - * states (i.e., corresponding to LALR rather than canonical LR) the state - * building process does not maintain full loookaheads in all items. - * Consequently, after the machine is built, we go back and propagate - * lookaheads through the constructed machine using a call to - * propagate_all_lookaheads(). This makes use of propagation links - * constructed during the closure and transition process. - * - * @param start_prod the start production of the grammar - * @see java_cup.lalr_item_set#compute_closure - * @see java_cup.lalr_state#propagate_all_lookaheads - */ - - public static lalr_state build_machine(production start_prod) - throws internal_error - { - lalr_state start_state; - lalr_item_set start_items; - lalr_item_set new_items; - lalr_item_set linked_items; - lalr_item_set kernel; - Stack work_stack = new Stack(); - lalr_state st, new_st; - symbol_set outgoing; - lalr_item itm, new_itm, existing, fix_itm; - symbol sym, sym2; - Enumeration i, s, fix; - - /* sanity check */ - if (start_prod == null) - throw new internal_error( - "Attempt to build viable prefix recognizer using a null production"); - - /* build item with dot at front of start production and EOF lookahead */ - start_items = new lalr_item_set(); - - itm = new lalr_item(start_prod); - itm.lookahead().add(terminal.EOF); - - start_items.add(itm); - - /* create copy the item set to form the kernel */ - kernel = new lalr_item_set(start_items); - - /* create the closure from that item set */ - start_items.compute_closure(); - - /* build a state out of that item set and put it in our work set */ - start_state = new lalr_state(start_items); - work_stack.push(start_state); - - /* enter the state using the kernel as the key */ - _all_kernels.put(kernel, start_state); - - /* continue looking at new states until we have no more work to do */ - while (!work_stack.empty()) - { - /* remove a state from the work set */ - st = (lalr_state)work_stack.pop(); - - /* gather up all the symbols that appear before dots */ - outgoing = new symbol_set(); - for (i = st.items().all(); i.hasMoreElements(); ) - { - itm = (lalr_item)i.nextElement(); - - /* add the symbol before the dot (if any) to our collection */ - sym = itm.symbol_after_dot(); - if (sym != null) outgoing.add(sym); - } - - /* now create a transition out for each individual symbol */ - for (s = outgoing.all(); s.hasMoreElements(); ) - { - sym = (symbol)s.nextElement(); - - /* will be keeping the set of items with propagate links */ - linked_items = new lalr_item_set(); - - /* gather up shifted versions of all the items that have this - symbol before the dot */ - new_items = new lalr_item_set(); - for (i = st.items().all(); i.hasMoreElements();) - { - itm = (lalr_item)i.nextElement(); - - /* if this is the symbol we are working on now, add to set */ - sym2 = itm.symbol_after_dot(); - if (sym.equals(sym2)) - { - /* add to the kernel of the new state */ - new_items.add(itm.shift()); - - /* remember that itm has propagate link to it */ - linked_items.add(itm); - } - } - - /* use new items as state kernel */ - kernel = new lalr_item_set(new_items); - - /* have we seen this one already? */ - new_st = (lalr_state)_all_kernels.get(kernel); - - /* if we haven't, build a new state out of the item set */ - if (new_st == null) - { - /* compute closure of the kernel for the full item set */ - new_items.compute_closure(); - - /* build the new state */ - new_st = new lalr_state(new_items); - - /* add the new state to our work set */ - work_stack.push(new_st); - - /* put it in our kernel table */ - _all_kernels.put(kernel, new_st); - } - /* otherwise relink propagation to items in existing state */ - else - { - /* walk through the items that have links to the new state */ - for (fix = linked_items.all(); fix.hasMoreElements(); ) - { - fix_itm = (lalr_item)fix.nextElement(); - - /* look at each propagate link out of that item */ - for (int l =0; l < fix_itm.propagate_items().size(); l++) - { - /* pull out item linked to in the new state */ - new_itm = - (lalr_item)fix_itm.propagate_items().elementAt(l); - - /* find corresponding item in the existing state */ - existing = new_st.items().find(new_itm); - - /* fix up the item so it points to the existing set */ - if (existing != null) - fix_itm.propagate_items().setElementAt(existing ,l); - } - } - } - - /* add a transition from current state to that state */ - st.add_transition(sym, new_st); - } - } - - /* all done building states */ - - /* propagate complete lookahead sets throughout the states */ - propagate_all_lookaheads(); - - return start_state; - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Propagate lookahead sets out of this state. This recursively - * propagates to all items that have propagation links from some item - * in this state. - */ - protected void propagate_lookaheads() throws internal_error - { - /* recursively propagate out from each item in the state */ - for (Enumeration itm = items().all(); itm.hasMoreElements(); ) - ((lalr_item)itm.nextElement()).propagate_lookaheads(null); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Fill in the parse table entries for this state. There are two - * parse tables that encode the viable prefix recognition machine, an - * action table and a reduce-goto table. The rows in each table - * correspond to states of the machine. The columns of the action table - * are indexed by terminal symbols and correspond to either transitions - * out of the state (shift entries) or reductions from the state to some - * previous state saved on the stack (reduce entries). All entries in the - * action table that are not shifts or reduces, represent errors. The - * reduce-goto table is indexed by non terminals and represents transitions - * out of a state on that non-terminal.

    - * Conflicts occur if more than one action needs to go in one entry of the - * action table (this cannot happen with the reduce-goto table). Conflicts - * are resolved by always shifting for shift/reduce conflicts and choosing - * the lowest numbered production (hence the one that appeared first in - * the specification) in reduce/reduce conflicts. All conflicts are - * reported and if more conflicts are detected than were declared by the - * user, code generation is aborted. - * - * @param act_table the action table to put entries in. - * @param reduce_table the reduce-goto table to put entries in. - */ - public void build_table_entries( - parse_action_table act_table, - parse_reduce_table reduce_table) - throws internal_error - { - parse_action_row our_act_row; - parse_reduce_row our_red_row; - lalr_item itm; - parse_action act, other_act; - symbol sym; - terminal_set conflict_set = new terminal_set(); - - /* pull out our rows from the tables */ - our_act_row = act_table.under_state[index()]; - our_red_row = reduce_table.under_state[index()]; - - /* consider each item in our state */ - for (Enumeration i = items().all(); i.hasMoreElements(); ) - { - itm = (lalr_item)i.nextElement(); - - - /* if its completed (dot at end) then reduce under the lookahead */ - if (itm.dot_at_end()) - { - act = new reduce_action(itm.the_production()); - - /* consider each lookahead symbol */ - for (int t = 0; t < terminal.number(); t++) - { - /* skip over the ones not in the lookahead */ - if (!itm.lookahead().contains(t)) continue; - - /* if we don't already have an action put this one in */ - if (our_act_row.under_term[t].kind() == - parse_action.ERROR) - { - our_act_row.under_term[t] = act; - } - else - { - /* we now have at least one conflict */ - terminal term = terminal.find(t); - other_act = our_act_row.under_term[t]; - - /* if the other act was not a shift */ - if ((other_act.kind() != parse_action.SHIFT) && - (other_act.kind() != parse_action.NONASSOC)) - { - /* if we have lower index hence priority, replace it*/ - if (itm.the_production().index() < - ((reduce_action)other_act).reduce_with().index()) - { - /* replace the action */ - our_act_row.under_term[t] = act; - } - } else { - /* Check precedences,see if problem is correctable */ - if(fix_with_precedence(itm.the_production(), - t, our_act_row, act)) { - term = null; - } - } - if(term!=null) { - - conflict_set.add(term); - } - } - } - } - } - - /* consider each outgoing transition */ - for (lalr_transition trans=transitions(); trans!=null; trans=trans.next()) - { - /* if its on an terminal add a shift entry */ - sym = trans.on_symbol(); - if (!sym.is_non_term()) - { - act = new shift_action(trans.to_state()); - - /* if we don't already have an action put this one in */ - if ( our_act_row.under_term[sym.index()].kind() == - parse_action.ERROR) - { - our_act_row.under_term[sym.index()] = act; - } - else - { - /* we now have at least one conflict */ - production p = ((reduce_action)our_act_row.under_term[sym.index()]).reduce_with(); - - /* shift always wins */ - if (!fix_with_precedence(p, sym.index(), our_act_row, act)) { - our_act_row.under_term[sym.index()] = act; - conflict_set.add(terminal.find(sym.index())); - } - } - } - else - { - /* for non terminals add an entry to the reduce-goto table */ - our_red_row.under_non_term[sym.index()] = trans.to_state(); - } - } - - /* if we end up with conflict(s), report them */ - if (!conflict_set.empty()) - report_conflicts(conflict_set); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - - /** Procedure that attempts to fix a shift/reduce error by using - * precedences. --frankf 6/26/96 - * - * if a production (also called rule) or the lookahead terminal - * has a precedence, then the table can be fixed. if the rule - * has greater precedence than the terminal, a reduce by that rule - * in inserted in the table. If the terminal has a higher precedence, - * it is shifted. if they have equal precedence, then the associativity - * of the precedence is used to determine what to put in the table: - * if the precedence is left associative, the action is to reduce. - * if the precedence is right associative, the action is to shift. - * if the precedence is non associative, then it is a syntax error. - * - * @param p the production - * @param term_index the index of the lokahead terminal - * @param parse_action_row a row of the action table - * @param act the rule in conflict with the table entry - */ - - protected boolean fix_with_precedence( - production p, - int term_index, - parse_action_row table_row, - parse_action act) - - throws internal_error { - - terminal term = terminal.find(term_index); - - /* if the production has a precedence number, it can be fixed */ - if (p.precedence_num() > assoc.no_prec) { - - /* if production precedes terminal, put reduce in table */ - if (p.precedence_num() > term.precedence_num()) { - table_row.under_term[term_index] = - insert_reduce(table_row.under_term[term_index],act); - return true; - } - - /* if terminal precedes rule, put shift in table */ - else if (p.precedence_num() < term.precedence_num()) { - table_row.under_term[term_index] = - insert_shift(table_row.under_term[term_index],act); - return true; - } - else { /* they are == precedence */ - - /* equal precedences have equal sides, so only need to - look at one: if it is right, put shift in table */ - if (term.precedence_side() == assoc.right) { - table_row.under_term[term_index] = - insert_shift(table_row.under_term[term_index],act); - return true; - } - - /* if it is left, put reduce in table */ - else if (term.precedence_side() == assoc.left) { - table_row.under_term[term_index] = - insert_reduce(table_row.under_term[term_index],act); - return true; - } - - /* if it is nonassoc, we're not allowed to have two nonassocs - of equal precedence in a row, so put in NONASSOC */ - else if (term.precedence_side() == assoc.nonassoc) { - table_row.under_term[term_index] = new nonassoc_action(); - return true; - } else { - /* something really went wrong */ - throw new internal_error("Unable to resolve conflict correctly"); - } - } - } - /* check if terminal has precedence, if so, shift, since - rule does not have precedence */ - else if (term.precedence_num() > assoc.no_prec) { - table_row.under_term[term_index] = - insert_shift(table_row.under_term[term_index],act); - return true; - } - - /* otherwise, neither the rule nor the terminal has a precedence, - so it can't be fixed. */ - return false; - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - - /* given two actions, and an action type, return the - action of that action type. give an error if they are of - the same action, because that should never have tried - to be fixed - - */ - protected parse_action insert_action( - parse_action a1, - parse_action a2, - int act_type) - throws internal_error - { - if ((a1.kind() == act_type) && (a2.kind() == act_type)) { - throw new internal_error("Conflict resolution of bogus actions"); - } else if (a1.kind() == act_type) { - return a1; - } else if (a2.kind() == act_type) { - return a2; - } else { - throw new internal_error("Conflict resolution of bogus actions"); - } - } - - /* find the shift in the two actions */ - protected parse_action insert_shift( - parse_action a1, - parse_action a2) - throws internal_error - { - return insert_action(a1, a2, parse_action.SHIFT); - } - - /* find the reduce in the two actions */ - protected parse_action insert_reduce( - parse_action a1, - parse_action a2) - throws internal_error - { - return insert_action(a1, a2, parse_action.REDUCE); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Produce warning messages for all conflicts found in this state. */ - protected void report_conflicts(terminal_set conflict_set) - throws internal_error - { - lalr_item itm, compare; - symbol shift_sym; - - boolean after_itm; - - /* consider each element */ - for (Enumeration itms = items().all(); itms.hasMoreElements(); ) - { - itm = (lalr_item)itms.nextElement(); - - /* clear the S/R conflict set for this item */ - - /* if it results in a reduce, it could be a conflict */ - if (itm.dot_at_end()) - { - /* not yet after itm */ - after_itm = false; - - /* compare this item against all others looking for conflicts */ - for (Enumeration comps = items().all(); comps.hasMoreElements(); ) - { - compare = (lalr_item)comps.nextElement(); - - /* if this is the item, next one is after it */ - if (itm == compare) after_itm = true; - - /* only look at it if its not the same item */ - if (itm != compare) - { - /* is it a reduce */ - if (compare.dot_at_end()) - { - /* only look at reduces after itm */ - if (after_itm) - /* does the comparison item conflict? */ - if (compare.lookahead().intersects(itm.lookahead())) - /* report a reduce/reduce conflict */ - report_reduce_reduce(itm, compare); - } - } - } - /* report S/R conflicts under all the symbols we conflict under */ - for (int t = 0; t < terminal.number(); t++) - if (conflict_set.contains(t)) - report_shift_reduce(itm,t); - } - } - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Produce a warning message for one reduce/reduce conflict. - * - * @param itm1 first item in conflict. - * @param itm2 second item in conflict. - */ - protected void report_reduce_reduce(lalr_item itm1, lalr_item itm2) - throws internal_error - { - boolean comma_flag = false; - - System.err.println("*** Reduce/Reduce conflict found in state #"+index()); - System.err.print (" between "); - System.err.println(itm1.to_simple_string()); - System.err.print (" and "); - System.err.println(itm2.to_simple_string()); - System.err.print(" under symbols: {" ); - for (int t = 0; t < terminal.number(); t++) - { - if (itm1.lookahead().contains(t) && itm2.lookahead().contains(t)) - { - if (comma_flag) System.err.print(", "); else comma_flag = true; - System.err.print(terminal.find(t).name()); - } - } - System.err.println("}"); - System.err.print(" Resolved in favor of "); - if (itm1.the_production().index() < itm2.the_production().index()) - System.err.println("the first production.\n"); - else - System.err.println("the second production.\n"); - - /* count the conflict */ - emit.num_conflicts++; - lexer.warning_count++; - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Produce a warning message for one shift/reduce conflict. - * - * @param red_itm the item with the reduce. - * @param conflict_sym the index of the symbol conflict occurs under. - */ - protected void report_shift_reduce( - lalr_item red_itm, - int conflict_sym) - throws internal_error - { - lalr_item itm; - symbol shift_sym; - - /* emit top part of message including the reduce item */ - System.err.println("*** Shift/Reduce conflict found in state #"+index()); - System.err.print (" between "); - System.err.println(red_itm.to_simple_string()); - - /* find and report on all items that shift under our conflict symbol */ - for (Enumeration itms = items().all(); itms.hasMoreElements(); ) - { - itm = (lalr_item)itms.nextElement(); - - /* only look if its not the same item and not a reduce */ - if (itm != red_itm && !itm.dot_at_end()) - { - /* is it a shift on our conflicting terminal */ - shift_sym = itm.symbol_after_dot(); - if (!shift_sym.is_non_term() && shift_sym.index() == conflict_sym) - { - /* yes, report on it */ - System.err.println(" and " + itm.to_simple_string()); - } - } - } - System.err.println(" under symbol "+ terminal.find(conflict_sym).name()); - System.err.println(" Resolved in favor of shifting.\n"); - - /* count the conflict */ - emit.num_conflicts++; - lexer.warning_count++; - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Equality comparison. */ - public boolean equals(lalr_state other) - { - /* we are equal if our item sets are equal */ - return other != null && items().equals(other.items()); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Generic equality comparison. */ - public boolean equals(Object other) - { - if (!(other instanceof lalr_state)) - return false; - else - return equals((lalr_state)other); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Produce a hash code. */ - public int hashCode() - { - /* just use the item set hash code */ - return items().hashCode(); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Convert to a string. */ - public String toString() - { - String result; - lalr_transition tr; - - /* dump the item set */ - result = "lalr_state [" + index() + "]: " + _items + "\n"; - - /* do the transitions */ - for (tr = transitions(); tr != null; tr = tr.next()) - { - result += tr; - result += "\n"; - } - - return result; - } - - /*-----------------------------------------------------------*/ -} diff --git a/Robust/cup/java_cup/lalr_transition.class b/Robust/cup/java_cup/lalr_transition.class deleted file mode 100644 index 4d33e8dd2c4afa700fdeccd96d247936894f2fa0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1508 zcma)6ZBNrs6n-unYgfvP<5e755OM1^2EL*o3J3~L{D5MJF-x~KSkkpi*BSg*n!uJw zq90BCQO0xEx|T_dU(UTf=Q+=L?fv=d>o)+4*p)DboPc=|c?msO5V07?C~k3an~OUV ziMs;sNsy2eai5<{T=_u4LoAC};hIMhR`HnMo`_fzur6SOK`Po-vHq!AvQ36dg(K~w zRxCGac~7;>5HGrRvF>WF&M+F-P0e&XHDP*-mVWFqOm^8_N3-gNYuFZnVk?GaxT_2s zsQ~7O2^1mTE@g-;z0VNcuq%|(V8O8T-A1*fJFm5pNg8SMxUAQB&^kliLe{gwtB) z`j}R$=~jgycM+hy0bw7%6dKN8Ckd~6eC%441~uF<1WQ3bh+$Rq<90UN49V2Cw_O); zW14>4G5Yl*i1G&0Ey{b`KB>)g#=v;5=`pxQUmw~?U_otxWqzRl3_S;lNDI;L**{;s z{7cQ8BBo|fA*i`ih+oK;K_NMZILS$hlY~gj3F00jZUr;AK?71Ti#*+?2^A%uo_72h zKmIJ~B4iQOOqR6}4|w@=1@aWIaL$)TP7FNvDLNUQz3K^KpXuTy#0vyHU5tXxk?e*F z-OzOc-9+jFsMrnNArLK=4|OO-p5*Qsq=Odv5^@v$Y7+xZ4ALzzM50OWqHoS{>j{J= j5={(u84@EtI1|K7P;-DcRKY%$@D>FeP~;5hdXW7M!RcE{ diff --git a/Robust/cup/java_cup/lalr_transition.java b/Robust/cup/java_cup/lalr_transition.java deleted file mode 100644 index 1c941bd9..00000000 --- a/Robust/cup/java_cup/lalr_transition.java +++ /dev/null @@ -1,93 +0,0 @@ -package java_cup; - -/** This class represents a transition in an LALR viable prefix recognition - * machine. Transitions can be under terminals for non-terminals. They are - * internally linked together into singly linked lists containing all the - * transitions out of a single state via the _next field. - * - * @see java_cup.lalr_state - * @version last updated: 11/25/95 - * @author Scott Hudson - * - */ -public class lalr_transition { - - /*-----------------------------------------------------------*/ - /*--- Constructor(s) ----------------------------------------*/ - /*-----------------------------------------------------------*/ - - /** Full constructor. - * @param on_sym symbol we are transitioning on. - * @param to_st state we transition to. - * @param nxt next transition in linked list. - */ - public lalr_transition(symbol on_sym, lalr_state to_st, lalr_transition nxt) - throws internal_error - { - /* sanity checks */ - if (on_sym == null) - throw new internal_error("Attempt to create transition on null symbol"); - if (to_st == null) - throw new internal_error("Attempt to create transition to null state"); - - /* initialize */ - _on_symbol = on_sym; - _to_state = to_st; - _next = nxt; - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Constructor with null next. - * @param on_sym symbol we are transitioning on. - * @param to_st state we transition to. - */ - public lalr_transition(symbol on_sym, lalr_state to_st) throws internal_error - { - this(on_sym, to_st, null); - } - - /*-----------------------------------------------------------*/ - /*--- (Access to) Instance Variables ------------------------*/ - /*-----------------------------------------------------------*/ - - /** The symbol we make the transition on. */ - protected symbol _on_symbol; - - /** The symbol we make the transition on. */ - public symbol on_symbol() {return _on_symbol;} - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** The state we transition to. */ - protected lalr_state _to_state; - - /** The state we transition to. */ - public lalr_state to_state() {return _to_state;} - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Next transition in linked list of transitions out of a state */ - protected lalr_transition _next; - - /** Next transition in linked list of transitions out of a state */ - public lalr_transition next() {return _next;} - - /*-----------------------------------------------------------*/ - /*--- General Methods ---------------------------------------*/ - /*-----------------------------------------------------------*/ - - /** Convert to a string. */ - public String toString() - { - String result; - - result = "transition on " + on_symbol().name() + " to state ["; - result += _to_state.index(); - result += "]"; - - return result; - } - - /*-----------------------------------------------------------*/ -} diff --git a/Robust/cup/java_cup/lexer.class b/Robust/cup/java_cup/lexer.class deleted file mode 100644 index e633ff282a6d27e856a76e888110dfa377d78340..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5298 zcma)A34D{~8UMd&+I$J24J}tg!6*WyP%0n_Euc_AJ4#_zz=B%SkBK+l zir2uSLDA~e4T>w(;(g8oPu$db%yZjs+i&~ra)+}2^CoG&)?>EKdpytkKKJpaFMRdz zqX4Gka~FPybDUU?a}E5+f%9CjW3vklIN!hp1}-#kk%5a1Tw>r-16vHV8o12B15b)nPZ@aH zz%v4R)`90ln9UA6@4znI8pcZPMQoHft2z!n8TD zsl6o{<}r7mBOW&+$>wk_K~+Qj^Ub^bOU7^YpU4N@0Lnr&uW&b{cyOL$qKAk-d< z#;J&1wBX(!NPDy(=8q>#MxK#0S}iYZi14JKC;_BP&e;9WO< zjdgCEjz;RVDjl8aJAUEOj))uY;e9tg5UD~4D3mwG%s{9$6!43Ye693=&x`~UzEC6) z3YtE@FB2GUoPl);l}r8M)@Z!l3}z8L=}QbCQd#K>wMC+FlVLIP>ngRjibhkv2V?Tj z24P8#PAxN;K23Z5Lovl~GN${62$jhANX~rhMpX3Qh@=~zh_y?``*eV&L%DpiZ{B=b z@>8)?3}-5gUCcZW`dG2z{)idvNcdtVgEW%#C8(YoaS6?Ykm~@0VDyRzBP7}u37sXz z$qMP4B-}q!uuY=3+>?Dd>$njXlcrT0Sh1LfqOev-rvq~;XMtrcXP5!9Oy3MetLm2Z z7ZV09Gn)k>FV?{$v#sSLeXqt+P%@Bof>-I3%76wiY}}Mcn(fpf#Kg#ySYaC>4@Ro# zZ)YXQNs|Lp8e$m-tck2Pc`RyH0?S!pas&$eu^3~IL1q;?oe4Eo5eFm(IhRpmi&BHp zMlzZPDGbllvb3rh(iYJz0!hUY@xoL&ug#<_CtAh&F3TCbru&mPqgI?T_5WPWiY&Q7 zg+`XwS@g-WBAs#NYijGhQQ6GRyr_6RkBx4S8M8zzbhAu#jj3VlUe4DJ;N~wYmR_-F z>6vv)&n#V>%dm>G!pU6Q(8Tks&>GM3r)SnQJ+r{+nbnT7Q%aMbS&uju@iq%QDFwM3 z%UN;Guh;y23M>Fa z01gYlDFDL)a0$R;y)#5Zte4yxV!bs~L&jL>6l#dm0x8lEmj&X{kRcYxFb#2AAjKLo z+yW`lkP#Nha19x0fsD|QQT>pSdSAo6UJMc9r+@x#l<)am*7fVircXTyKotv#O3VF zSKu>3zra<>g{xH=u2ZwHRW;yx)rK3?X56T@;U?9Mo7IchuHM8g>RsHbKEQ42W8AJj zN2mHdQtGeRq5h3K)K|FEX2VWfKJKy=;%?grblFOAkF5;%+9u!uv{6DkV}32uiY+=F z@%RU4Nsdcsof?|p+w3%(HlX3YW+Y!X%4p1Qu~0Y0+E3quvE3La^Ej`^)rnzV&(IV` zk)iC0x^al$4zUxTv*>9UMX7oz@k4OoVOq8iBd`ypc!UZ4D13Mf6Y)4I@dUq5J&9R( z3bXMv=HnSG!n3HubEwDjd>HNLL+BM|{Hxf+SJU};gZ?;Rv4&F~Ahdy$ij$G2twC*l zeK@pfFAggn--E*`V-F@2Pt?nCvYfX27dvVvIT(Q`8(xQ`MNRYA{0`gIVfW z%vQ(YSam!Wt0gd1Jzr=I2&+cE2v6cOZ-pfy_3JOA?9Do7fmMAtlHoXONlxhM6o!Z@ z=XRo8gypvQC`#Fd(uzJD-9#8IJ-Y{UR%s>nr?2**y2&$^vCH~BcUQmTr(p=yIi2bR zs7@=!sSqZpb*NBbRH_)}sWT~l9JQ(gb!z z%(M4ko(RKzFXnH<=&z%?4t^@K)wAI;EF?&lPJI^acGXQ&876yi%r31#*^~j|&u7zz zx`5(e47b|C;JJ*RxSVQSg-PlfdgEFgrLMyqwH0&KjaZ;=LOtv2a+II+H8 zoic{7{MdVOY|d2r<)H2xaA!mRorReiav1L{>BfR=9a$(9<3ZH2dZdd+MUJAb7ODq! zwHH3sYoV;aSfq{1N-y;rs*&dN_&UJ`RqAneO7+#Hv_xixE~A2>oXW)R0q%NnT#c8} zTtwT8_1GJa*(IkKL-Qntsu}PZoM)IIwUfM_c`1}|nMD=%n_nLi3KLRTpbwXNVkt}) zV)2wz#4#Q-g+tjMJb{!*AVkuC+JB>kRPiFlt59K%vOhDOwe&h?nR$!54(c{>c1qd= zrDVP8#qlCJE73ODoFE&9J|9ulO?heY(sjFz_8yQ1KPXQhA6kdx}S z_>uY}w$N4As=u+3{~deOKhdMUz(eX^*vCfwnEDU@WA!EWvsr(}X8k)`0sdff;lH*a z{2o-OhT4Xyv9{rAsjXBkw|On0V6cH@-?XRd_5xJ)p`ppcm)WvCu<145e_W4bH`N`L u^VmFgCVnh^V;mfe>g6n}t1+7YGALtV_3>43IBR}6zk4daSmX(Q_WuCZOb8 - * Symbols currently returned include:

    - *    Symbol        Constant Returned     Symbol        Constant Returned
    - *    ------        -----------------     ------        -----------------
    - *    "package"     PACKAGE               "import"      IMPORT 
    - *    "code"        CODE                  "action"      ACTION 
    - *    "parser"      PARSER                "terminal"    TERMINAL
    - *    "non"         NON                   "init"        INIT 
    - *    "scan"        SCAN                  "with"        WITH
    - *    "start"       START                 "precedence"  PRECEDENCE
    - *    "left"        LEFT		  "right"       RIGHT
    - *    "nonassoc"    NONASSOC		  "%prec        PRECENT_PREC  
    - *      [           LBRACK                  ]           RBRACK
    - *      ;           SEMI 
    - *      ,           COMMA                   *           STAR 
    - *      .           DOT                     :           COLON
    - *      ::=         COLON_COLON_EQUALS      |           BAR
    - *    identifier    ID                    {:...:}       CODE_STRING
    - *    "nonterminal" NONTERMINAL
    - *  
    - * All symbol constants are defined in sym.java which is generated by - * JavaCup from parser.cup.

    - * - * In addition to the scanner proper (called first via init() then with - * next_token() to get each Symbol) this class provides simple error and - * warning routines and keeps a count of errors and warnings that is - * publicly accessible.

    - * - * This class is "static" (i.e., it has only static members and methods). - * - * @version last updated: 7/3/96 - * @author Frank Flannery - */ -public class lexer { - - /*-----------------------------------------------------------*/ - /*--- Constructor(s) ----------------------------------------*/ - /*-----------------------------------------------------------*/ - - /** The only constructor is private, so no instances can be created. */ - private lexer() { } - - /*-----------------------------------------------------------*/ - /*--- Static (Class) Variables ------------------------------*/ - /*-----------------------------------------------------------*/ - - /** First character of lookahead. */ - protected static int next_char; - - /** Second character of lookahead. */ - protected static int next_char2; - - /** Second character of lookahead. */ - protected static int next_char3; - - /** Second character of lookahead. */ - protected static int next_char4; - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** EOF constant. */ - protected static final int EOF_CHAR = -1; - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Table of keywords. Keywords are initially treated as identifiers. - * Just before they are returned we look them up in this table to see if - * they match one of the keywords. The string of the name is the key here, - * which indexes Integer objects holding the symbol number. - */ - protected static Hashtable keywords = new Hashtable(23); - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Table of single character symbols. For ease of implementation, we - * store all unambiguous single character Symbols in this table of Integer - * objects keyed by Integer objects with the numerical value of the - * appropriate char (currently Character objects have a bug which precludes - * their use in tables). - */ - protected static Hashtable char_symbols = new Hashtable(11); - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Current line number for use in error messages. */ - protected static int current_line = 1; - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Character position in current line. */ - protected static int current_position = 1; - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Character position in current line. */ - protected static int absolute_position = 1; - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Count of total errors detected so far. */ - public static int error_count = 0; - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Count of warnings issued so far */ - public static int warning_count = 0; - - /*-----------------------------------------------------------*/ - /*--- Static Methods ----------------------------------------*/ - /*-----------------------------------------------------------*/ - - /** Initialize the scanner. This sets up the keywords and char_symbols - * tables and reads the first two characters of lookahead. - */ - public static void init() throws java.io.IOException - { - /* set up the keyword table */ - keywords.put("package", new Integer(sym.PACKAGE)); - keywords.put("import", new Integer(sym.IMPORT)); - keywords.put("code", new Integer(sym.CODE)); - keywords.put("action", new Integer(sym.ACTION)); - keywords.put("parser", new Integer(sym.PARSER)); - keywords.put("terminal", new Integer(sym.TERMINAL)); - keywords.put("non", new Integer(sym.NON)); - keywords.put("nonterminal",new Integer(sym.NONTERMINAL));// [CSA] - keywords.put("init", new Integer(sym.INIT)); - keywords.put("scan", new Integer(sym.SCAN)); - keywords.put("with", new Integer(sym.WITH)); - keywords.put("start", new Integer(sym.START)); - keywords.put("precedence", new Integer(sym.PRECEDENCE)); - keywords.put("left", new Integer(sym.LEFT)); - keywords.put("right", new Integer(sym.RIGHT)); - keywords.put("nonassoc", new Integer(sym.NONASSOC)); - - /* set up the table of single character symbols */ - char_symbols.put(new Integer(';'), new Integer(sym.SEMI)); - char_symbols.put(new Integer(','), new Integer(sym.COMMA)); - char_symbols.put(new Integer('*'), new Integer(sym.STAR)); - char_symbols.put(new Integer('.'), new Integer(sym.DOT)); - char_symbols.put(new Integer('|'), new Integer(sym.BAR)); - char_symbols.put(new Integer('['), new Integer(sym.LBRACK)); - char_symbols.put(new Integer(']'), new Integer(sym.RBRACK)); - - /* read two characters of lookahead */ - next_char = System.in.read(); - if (next_char == EOF_CHAR) { - next_char2 = EOF_CHAR; - next_char3 = EOF_CHAR; - next_char4 = EOF_CHAR; - } else { - next_char2 = System.in.read(); - if (next_char2 == EOF_CHAR) { - next_char3 = EOF_CHAR; - next_char4 = EOF_CHAR; - } else { - next_char3 = System.in.read(); - if (next_char3 == EOF_CHAR) { - next_char4 = EOF_CHAR; - } else { - next_char4 = System.in.read(); - } - } - } - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Advance the scanner one character in the input stream. This moves - * next_char2 to next_char and then reads a new next_char2. - */ - protected static void advance() throws java.io.IOException - { - int old_char; - - old_char = next_char; - next_char = next_char2; - if (next_char == EOF_CHAR) { - next_char2 = EOF_CHAR; - next_char3 = EOF_CHAR; - next_char4 = EOF_CHAR; - } else { - next_char2 = next_char3; - if (next_char2 == EOF_CHAR) { - next_char3 = EOF_CHAR; - next_char4 = EOF_CHAR; - } else { - next_char3 = next_char4; - if (next_char3 == EOF_CHAR) { - next_char4 = EOF_CHAR; - } else { - next_char4 = System.in.read(); - } - } - } - - /* count this */ - absolute_position++; - current_position++; - if (old_char == '\n' || (old_char == '\r' && next_char!='\n')) - { - current_line++; - current_position = 1; - } - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Emit an error message. The message will be marked with both the - * current line number and the position in the line. Error messages - * are printed on standard error (System.err). - * @param message the message to print. - */ - public static void emit_error(String message) - { - System.err.println("Error at " + current_line + "(" + current_position + - "): " + message); - error_count++; - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Emit a warning message. The message will be marked with both the - * current line number and the position in the line. Messages are - * printed on standard error (System.err). - * @param message the message to print. - */ - public static void emit_warn(String message) - { - System.err.println("Warning at " + current_line + "(" + current_position + - "): " + message); - warning_count++; - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Determine if a character is ok to start an id. - * @param ch the character in question. - */ - protected static boolean id_start_char(int ch) - { - /* allow for % in identifiers. a hack to allow my - %prec in. Should eventually make lex spec for this - frankf */ - return (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z') || - (ch == '_'); - - // later need to deal with non-8-bit chars here - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Determine if a character is ok for the middle of an id. - * @param ch the character in question. - */ - protected static boolean id_char(int ch) - { - return id_start_char(ch) || (ch >= '0' && ch <= '9'); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Try to look up a single character symbol, returns -1 for not found. - * @param ch the character in question. - */ - protected static int find_single_char(int ch) - { - Integer result; - - result = (Integer)char_symbols.get(new Integer((char)ch)); - if (result == null) - return -1; - else - return result.intValue(); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Handle swallowing up a comment. Both old style C and new style C++ - * comments are handled. - */ - protected static void swallow_comment() throws java.io.IOException - { - /* next_char == '/' at this point */ - - /* is it a traditional comment */ - if (next_char2 == '*') - { - /* swallow the opener */ - advance(); advance(); - - /* swallow the comment until end of comment or EOF */ - for (;;) - { - /* if its EOF we have an error */ - if (next_char == EOF_CHAR) - { - emit_error("Specification file ends inside a comment"); - return; - } - - /* if we can see the closer we are done */ - if (next_char == '*' && next_char2 == '/') - { - advance(); - advance(); - return; - } - - /* otherwise swallow char and move on */ - advance(); - } - } - - /* is its a new style comment */ - if (next_char2 == '/') - { - /* swallow the opener */ - advance(); advance(); - - /* swallow to '\n', '\r', '\f', or EOF */ - while (next_char != '\n' && next_char != '\r' && - next_char != '\f' && next_char!=EOF_CHAR) - advance(); - - return; - - } - - /* shouldn't get here, but... if we get here we have an error */ - emit_error("Malformed comment in specification -- ignored"); - advance(); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Swallow up a code string. Code strings begin with "{:" and include - all characters up to the first occurrence of ":}" (there is no way to - include ":}" inside a code string). The routine returns a String - object suitable for return by the scanner. - */ - protected static Symbol do_code_string() throws java.io.IOException - { - StringBuffer result = new StringBuffer(); - - /* at this point we have lookahead of "{:" -- swallow that */ - advance(); advance(); - - /* save chars until we see ":}" */ - while (!(next_char == ':' && next_char2 == '}')) - { - /* if we have run off the end issue a message and break out of loop */ - if (next_char == EOF_CHAR) - { - emit_error("Specification file ends inside a code string"); - break; - } - - /* otherwise record the char and move on */ - result.append(new Character((char)next_char)); - advance(); - } - - /* advance past the closer and build a return Symbol */ - advance(); advance(); - return new Symbol(sym.CODE_STRING, result.toString()); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Process an identifier. Identifiers begin with a letter, underscore, - * or dollar sign, which is followed by zero or more letters, numbers, - * underscores or dollar signs. This routine returns a String suitable - * for return by the scanner. - */ - protected static Symbol do_id() throws java.io.IOException - { - StringBuffer result = new StringBuffer(); - String result_str; - Integer keyword_num; - char buffer[] = new char[1]; - - /* next_char holds first character of id */ - buffer[0] = (char)next_char; - result.append(buffer,0,1); - advance(); - - /* collect up characters while they fit in id */ - while(id_char(next_char)) - { - buffer[0] = (char)next_char; - result.append(buffer,0,1); - advance(); - } - - /* extract a string and try to look it up as a keyword */ - result_str = result.toString(); - keyword_num = (Integer)keywords.get(result_str); - - /* if we found something, return that keyword */ - if (keyword_num != null) - return new Symbol(keyword_num.intValue()); - - /* otherwise build and return an id Symbol with an attached string */ - return new Symbol(sym.ID, result_str); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Return one Symbol. This is the main external interface to the scanner. - * It consumes sufficient characters to determine the next input Symbol - * and returns it. To help with debugging, this routine actually calls - * real_next_token() which does the work. If you need to debug the - * parser, this can be changed to call debug_next_token() which prints - * a debugging message before returning the Symbol. - */ - public static Symbol next_token() throws java.io.IOException - { - return real_next_token(); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Debugging version of next_token(). This routine calls the real scanning - * routine, prints a message on System.out indicating what the Symbol is, - * then returns it. - */ - public static Symbol debug_next_token() throws java.io.IOException - { - Symbol result = real_next_token(); - System.out.println("# next_Symbol() => " + result.sym); - return result; - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** The actual routine to return one Symbol. This is normally called from - * next_token(), but for debugging purposes can be called indirectly from - * debug_next_token(). - */ - protected static Symbol real_next_token() throws java.io.IOException - { - int sym_num; - - for (;;) - { - /* look for white space */ - if (next_char == ' ' || next_char == '\t' || next_char == '\n' || - next_char == '\f' || next_char == '\r') - { - /* advance past it and try the next character */ - advance(); - continue; - } - - /* look for a single character symbol */ - sym_num = find_single_char(next_char); - if (sym_num != -1) - { - /* found one -- advance past it and return a Symbol for it */ - advance(); - return new Symbol(sym_num); - } - - /* look for : or ::= */ - if (next_char == ':') - { - /* if we don't have a second ':' return COLON */ - if (next_char2 != ':') - { - advance(); - return new Symbol(sym.COLON); - } - - /* move forward and look for the '=' */ - advance(); - if (next_char2 == '=') - { - advance(); advance(); - return new Symbol(sym.COLON_COLON_EQUALS); - } - else - { - /* return just the colon (already consumed) */ - return new Symbol(sym.COLON); - } - } - - /* find a "%prec" string and return it. otherwise, a '%' was found, - which has no right being in the specification otherwise */ - if (next_char == '%') { - advance(); - if ((next_char == 'p') && (next_char2 == 'r') && (next_char3 == 'e') && - (next_char4 == 'c')) { - advance(); - advance(); - advance(); - advance(); - return new Symbol(sym.PERCENT_PREC); - } else { - emit_error("Found extraneous percent sign"); - } - } - - /* look for a comment */ - if (next_char == '/' && (next_char2 == '*' || next_char2 == '/')) - { - /* swallow then continue the scan */ - swallow_comment(); - continue; - } - - /* look for start of code string */ - if (next_char == '{' && next_char2 == ':') - return do_code_string(); - - /* look for an id or keyword */ - if (id_start_char(next_char)) return do_id(); - - /* look for EOF */ - if (next_char == EOF_CHAR) return new Symbol(sym.EOF); - - /* if we get here, we have an unrecognized character */ - emit_warn("Unrecognized character '" + - new Character((char)next_char) + "'(" + next_char + - ") -- ignored"); - - /* advance past it */ - advance(); - } - } - - /*-----------------------------------------------------------*/ -} - diff --git a/Robust/cup/java_cup/lr_item_core.class b/Robust/cup/java_cup/lr_item_core.class deleted file mode 100644 index e5988e7fe2a1abd5975bf4523a4001d325911ac4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3162 zcma)8TWl0%6#oA1c6Ym-UMQ4OY;mAf+TALm$faNrD`;hDRW4dohUs?NUEJ<0yHf@6 zeiwZ-8t?@#Nnd!tDBDC5ga>P4eDKi+O^h)lnix&I#u)WGv(w#aDT&$SzkcWZ=klF1 z``JGqod>WMuSU_0p&Bg3-C^7l!M#xguv_+fqS%Xl5!@%6`(-mMtNpTiAc_a^P#6cI zsD}~d@j)5PC`OPBV^lU)1Y=>03p^$JvwOf*b(GpJ{&2R-rj@$b7^!l9RbLmE+9{5o6SLjGSFi zPy-5$M$*n(M#?OtjHH=NSqh7c!qJHlJ7bt*j+GZU&nntVm(lFp``K84n<%B}CM zf$n_@!G3#`IvWz{tTi|}F=FNSm?IgUM7JMFS~;Qm%FyuudnP}oyd+@V-lP!1JLS6W$moN&`hMWW`==?7EU?y**9c#k9BCyttwRL#X%+TrOKBwmZ#n8|!s=0((lQFa7YlcP+SxINJ0P4zl zD@8aWDfE{1$RRhQ^w+VCLV6;Xv5bO~PiMy!mUy0&H12j!g%^%pTGOB1_GCV3?MO?W z7WqxPUO1((LXK)!gBuiD$|Or?84FgZbn@DtadO`Q6@3zTwX4J}Scp0xK zRO`LHx9A!YA{Ok5b?XW>v(mCYwyl59z|i0mTr1-4!cGmxag=Nk2mMTQ%Z5cbhlCzw zq&OFsBT~s9`IAo-jEt2XcT!ZqjY50Zz=Bn4NWjUyWeX^B?`UqiV3=N0i%K&nrHVbJ zEHisjOXzHBuG~~uJb{cDwaj1BJ_695VAh-<`9o$d=XQ_l{8cy`0JjY-kO#_FC-W>v ztYnw&<|ie{9|`TQ$VYc38{L_8#JLel7>6p{#NFp??A4qfk4;0x)LB%i!T6`BJBPq< zQ*av9AIIWn5o&u2^=+{a5h^15o_8B@Z`;nICe~P2x{IdT4xU9VH#Hvk9dyb{PKwZa zgRQ|L>Q15|)*8Hk`XUCKc5QdhwBalPkb2lrLH3CH4rX*5=zi@L|#5yFl+q8q4Ix#4N& ztSDM7PMqPQWM{}dyqn`DzI-{f=JY)10fJb(9<+z=iq<6(7SYV8zKw8j3c7e~vn2lT_G;-Q3V^9r)UM$h_j&>om@6QhNoTZ4i78T7i?4f zB9@*+b>MW2Az4~PYelYP{s%OlCZI^kI~GiIZAGNSiSvZ=6W~4NPuFG88OD8J0q8WA z&)50|^|5)0M_x6<9!wlAWE7zCRzV|BUlxn)REIP;JS(}~@sHuND#3wP0^>zi<;uQ+- zXG;aXX8ZYu{oq^H?{^r&CI0pP9;5gHNAM%R)<2QpKa=3U;9dNRDg1`>_#L0%4}66` zdHR=X!QU#5OKPoBYOAVJyH#*bIq>W0(M7tBFjHfttv-`ra=KWjQhPzxpfojUl5V}K VdQ__hgj6G - * A ::= B * C d E - * - * This represents a point in a parse where the parser is trying to match - * the given production, and has succeeded in matching everything before the - * "dot" (and hence is expecting to see the symbols after the dot next). See - * lalr_item, lalr_item_set, and lalr_start for full details on the meaning - * and use of items. - * - * @see java_cup.lalr_item - * @see java_cup.lalr_item_set - * @see java_cup.lalr_state - * @version last updated: 11/25/95 - * @author Scott Hudson -*/ - -public class lr_item_core { - - /*-----------------------------------------------------------*/ - /*--- Constructor(s) ----------------------------------------*/ - /*-----------------------------------------------------------*/ - - /** Full constructor. - * @param prod production this item uses. - * @param pos position of the "dot" within the item. - */ - public lr_item_core(production prod, int pos) throws internal_error - { - symbol after_dot = null; - production_part part; - - if (prod == null) - throw new internal_error( - "Attempt to create an lr_item_core with a null production"); - - _the_production = prod; - - if (pos < 0 || pos > _the_production.rhs_length()) - throw new internal_error( - "Attempt to create an lr_item_core with a bad dot position"); - - _dot_pos = pos; - - /* compute and cache hash code now */ - _core_hash_cache = 13*_the_production.hashCode() + pos; - - /* cache the symbol after the dot */ - if (_dot_pos < _the_production.rhs_length()) - { - part = _the_production.rhs(_dot_pos); - if (!part.is_action()) - _symbol_after_dot = ((symbol_part)part).the_symbol(); - } - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Constructor for dot at start of right hand side. - * @param prod production this item uses. - */ - public lr_item_core(production prod) throws internal_error - { - this(prod,0); - } - - /*-----------------------------------------------------------*/ - /*--- (Access to) Instance Variables ------------------------*/ - /*-----------------------------------------------------------*/ - - /** The production for the item. */ - protected production _the_production; - - /** The production for the item. */ - public production the_production() {return _the_production;} - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** The position of the "dot" -- this indicates the part of the production - * that the marker is before, so 0 indicates a dot at the beginning of - * the RHS. - */ - protected int _dot_pos; - - /** The position of the "dot" -- this indicates the part of the production - * that the marker is before, so 0 indicates a dot at the beginning of - * the RHS. - */ - public int dot_pos() {return _dot_pos;} - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Cache of the hash code. */ - protected int _core_hash_cache; - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Cache of symbol after the dot. */ - protected symbol _symbol_after_dot = null; - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Is the dot at the end of the production? */ - public boolean dot_at_end() - { - return _dot_pos >= _the_production.rhs_length(); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Return the symbol after the dot. If there is no symbol after the dot - * we return null. */ - public symbol symbol_after_dot() - { - /* use the cached symbol */ - return _symbol_after_dot; - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Determine if we have a dot before a non terminal, and if so which one - * (return null or the non terminal). - */ - public non_terminal dot_before_nt() - { - symbol sym; - - /* get the symbol after the dot */ - sym = symbol_after_dot(); - - /* if it exists and is a non terminal, return it */ - if (sym != null && sym.is_non_term()) - return (non_terminal)sym; - else - return null; - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Produce a new lr_item_core that results from shifting the dot one - * position to the right. - */ - public lr_item_core shift_core() throws internal_error - { - if (dot_at_end()) - throw new internal_error( - "Attempt to shift past end of an lr_item_core"); - - return new lr_item_core(_the_production, _dot_pos+1); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Equality comparison for the core only. This is separate out because we - * need separate access in a super class. - */ - public boolean core_equals(lr_item_core other) - { - return other != null && - _the_production.equals(other._the_production) && - _dot_pos == other._dot_pos; - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Equality comparison. */ - public boolean equals(lr_item_core other) {return core_equals(other);} - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Generic equality comparison. */ - public boolean equals(Object other) - { - if (!(other instanceof lr_item_core)) - return false; - else - return equals((lr_item_core)other); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Hash code for the core (separated so we keep non overridden version). */ - public int core_hashCode() - { - return _core_hash_cache; - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Hash code for the item. */ - public int hashCode() - { - return _core_hash_cache; - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Return the hash code that object would have provided for us so we have - * a (nearly) unique id for debugging. - */ - protected int obj_hash() - { - return super.hashCode(); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Convert to a string (separated out from toString() so we can call it - * from subclass that overrides toString()). - */ - public String to_simple_string() throws internal_error - { - String result; - production_part part; - - if (_the_production.lhs() != null && - _the_production.lhs().the_symbol() != null && - _the_production.lhs().the_symbol().name() != null) - result = _the_production.lhs().the_symbol().name(); - else - result = "$$NULL$$"; - - result += " ::= "; - - for (int i = 0; i<_the_production.rhs_length(); i++) - { - /* do we need the dot before this one? */ - if (i == _dot_pos) - result += "(*) "; - - /* print the name of the part */ - if (_the_production.rhs(i) == null) - { - result += "$$NULL$$ "; - } - else - { - part = _the_production.rhs(i); - if (part == null) - result += "$$NULL$$ "; - else if (part.is_action()) - result += "{ACTION} "; - else if (((symbol_part)part).the_symbol() != null && - ((symbol_part)part).the_symbol().name() != null) - result += ((symbol_part)part).the_symbol().name() + " "; - else - result += "$$NULL$$ "; - } - } - - /* put the dot after if needed */ - if (_dot_pos == _the_production.rhs_length()) - result += "(*) "; - - return result; - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Convert to a string */ - public String toString() - { - /* can't throw here since super class doesn't, so we crash instead */ - try { - return to_simple_string(); - } catch(internal_error e) { - e.crash(); - return null; - } - } - - /*-----------------------------------------------------------*/ - -} - diff --git a/Robust/cup/java_cup/non_terminal.class b/Robust/cup/java_cup/non_terminal.class deleted file mode 100644 index 88d8183d47aabd1996554613763d8ed4bf167b1c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3771 zcmaJ@ZE#dq8Ga7gWH*~jQZ@-BX=pa`(PWo2P$@-1p-|Em8v=#2F;LuYb}z|=&F*&h zE`{0;ty({-)oQf{tF=<3S}Zh>U1+o)jzdRBopHv|{^+mjIOFt>Gx|gS7@zlk?A|QV zo!N8lIp;mk`@Em`{`x;}ya`|fei6iNn5su7(tc!us6kd15BZS`q7Hdkm@*XP?6@Bf z`*9)&4fz00%KS(GpOX2}AR6$P43CTW6Eb{ShR^u%WDqNm4RSFhD4&(#bAEhY=BEPq zf{1-lK)xh01nI<=Wq7&)U%^*pct)0Ali}+k{A>^rJnhFfWd5cM&&k=h8N@cRM07{Ct#cu6SGlphM}X+K_8@WtY(ltSy!(fILrf59|T z{ddRnlV*H8r4J}9mE+j>$(WH&>L(O}Y5j!hF4S%XzqOGz6#@rFcI+RC$>RzOEtV)` z`_q|p%+zyJMmnA%UdYJD^r>+@nbec9c)~O?X$5sqL5pQ`nPkD*$t%>y(uGt?NKj|& zh>^>ivAn(z+J%(^Lf36I(uTQB;l>`@m{dGH(SN|q8R?0EYj=9@r}1}Wl2p(%WTf@s z0%_$&Y?ZBxK*)s}%USI`y&iWBrVCSgE-t2!h3^PGr4U^V;D36hqi45`xR}f8h)-rz z-qTBm2NO9xZtAhL{xBDVClY#ARMTfJt;Il^6Pc-OL9SVDHByFo(n6$BA@{88W`Z>= z2uBk+EDTU%Jela~qz%j#H-QuyQ<=;$Zj=)v zU}o&_DzvyE@dllmwG%Tg%I8fi*XT};pAG7P76((mEBvtXo>66m&F zg>1@5Fv?-_>~ocbdo;X)AJcukVLJ(u8YW?g;(Z!^BHDLgr-oN$xLueovn;W6?56q& zJ*VLu_G|blUh~@Fb%%!Y7-en@kF3^khd{l83mQIw5e@fZzaOt_m_b6rMO@M_E>9CO z>@K^mDhD*o%6Snb4WAU{m!WI8f;TkG$?!A$+>bXkyoI+FcJ44ueJX2)%}kgn7B^NP(a<8*RJ@IT-mln|H#cx{JKeUjNS0BdmBx0<_w+FOW-^}Nlga6WW%Uix z5_Z##lC}o?G?bFwS5Z#H_>x!7S4q(&hqoqlp;DV z@X=;aXC3UM@BxfC!W#%8;>#lMqE=nt71F-`ZFE+yHIe}6UGa4tJFZ;6&$+(dA=e^y zchKk|`hZ?qh+s3lk2gp8zn`NWmxWAMo~vSd7y)U7WGF!#q;g@}OQv<98}6AyryCnm zZkj=t6^E`O!d7&;D;C)LAA=u{V~h|!0yS9R2OaR07BuLB%lJs;qOI{M&!u`C!UN8w zS2;^s9r6uyOk-osz-6r3v+fF3D@@P-oeygi=*c1aW9_N=zj3;8dj5kb6RyWMaCZK^ z%jk8*(e8>zhWq-8pzONQv-5wcM0*>WsOlN2e2$KIp6pMd6)!M>Uc_3wgg%_c&3G9b zaR#^YrL>E0ongF2U!TW8Tv%Yj;j#&*iC0%PVbn5VDC(NP2it^UQtETL&VNwmy2aP- zE8?atwe7Wimk=nT|J3~Zz5#h|uPtIdP55oagiTmVRadC;9V-1LO?a0k{E8<0hV*}j z&G(PoX1a)DEr$b&0PUQke1U!7*}>Qqowu zSw4Mk(9z-sox9QL`44^PYAP_6Y3h13s+Cx&Za|mnUSJx(j|eKJ4G~&MY;@XZq=b#q zJa6GZ

    - * - * I addition to construction and manipulation operations, productions provide - * methods for factoring out actions (see remove_embedded_actions()), for - * computing the nullability of the production (i.e., can it derive the empty - * string, see check_nullable()), and operations for computing its first - * set (i.e., the set of terminals that could appear at the beginning of some - * string derived from the production, see check_first_set()). - * - * @see java_cup.production_part - * @see java_cup.symbol_part - * @see java_cup.action_part - * @version last updated: 7/3/96 - * @author Frank Flannery - */ - -public class production { - - /*-----------------------------------------------------------*/ - /*--- Constructor(s) ----------------------------------------*/ - /*-----------------------------------------------------------*/ - - /** Full constructor. This constructor accepts a LHS non terminal, - * an array of RHS parts (including terminals, non terminals, and - * actions), and a string for a final reduce action. It does several - * manipulations in the process of creating a production object. - * After some validity checking it translates labels that appear in - * actions into code for accessing objects on the runtime parse stack. - * It them merges adjacent actions if they appear and moves any trailing - * action into the final reduce actions string. Next it removes any - * embedded actions by factoring them out with new action productions. - * Finally it assigns a unique index to the production.

    - * - * Factoring out of actions is accomplished by creating new "hidden" - * non terminals. For example if the production was originally:

    -   *    A ::= B {action} C D
    -   *  
    - * then it is factored into two productions:
    -   *    A ::= B X C D
    -   *    X ::= {action}
    -   *  
    - * (where X is a unique new non terminal). This has the effect of placing - * all actions at the end where they can be handled as part of a reduce by - * the parser. - */ - public production( - non_terminal lhs_sym, - production_part rhs_parts[], - int rhs_l, - String action_str) - throws internal_error - { - int i; - action_part tail_action; - String declare_str; - int rightlen = rhs_l; - - /* remember the length */ - if (rhs_l >= 0) - _rhs_length = rhs_l; - else if (rhs_parts != null) - _rhs_length = rhs_parts.length; - else - _rhs_length = 0; - - /* make sure we have a valid left-hand-side */ - if (lhs_sym == null) - throw new internal_error( - "Attempt to construct a production with a null LHS"); - - /* I'm not translating labels anymore, I'm adding code to declare - labels as valid variables. This way, the users code string is - untouched - 6/96 frankf */ - - /* check if the last part of the right hand side is an action. If - it is, it won't be on the stack, so we don't want to count it - in the rightlen. Then when we search down the stack for a - Symbol, we don't try to search past action */ - - if (rhs_l > 0) { - if (rhs_parts[rhs_l - 1].is_action()) { - rightlen = rhs_l - 1; - } else { - rightlen = rhs_l; - } - } - - /* get the generated declaration code for the necessary labels. */ - declare_str = declare_labels( - rhs_parts, rightlen, action_str); - - if (action_str == null) - action_str = declare_str; - else - action_str = declare_str + action_str; - - /* count use of lhs */ - lhs_sym.note_use(); - - /* create the part for left-hand-side */ - _lhs = new symbol_part(lhs_sym); - - /* merge adjacent actions (if any) */ - _rhs_length = merge_adjacent_actions(rhs_parts, _rhs_length); - - /* strip off any trailing action */ - tail_action = strip_trailing_action(rhs_parts, _rhs_length); - if (tail_action != null) _rhs_length--; - - /* Why does this run through the right hand side happen - over and over? here a quick combination of two - prior runs plus one I wanted of my own - frankf 6/25/96 */ - /* allocate and copy over the right-hand-side */ - /* count use of each rhs symbol */ - _rhs = new production_part[_rhs_length]; - for (i=0; i<_rhs_length; i++) { - _rhs[i] = rhs_parts[i]; - if (!_rhs[i].is_action()) { - ((symbol_part)_rhs[i]).the_symbol().note_use(); - if (((symbol_part)_rhs[i]).the_symbol() instanceof terminal) { - _rhs_prec = - ((terminal)((symbol_part)_rhs[i]).the_symbol()).precedence_num(); - _rhs_assoc = - ((terminal)((symbol_part)_rhs[i]).the_symbol()).precedence_side(); - } - } - } - - /*now action string is really declaration string, so put it in front! - 6/14/96 frankf */ - if (action_str == null) action_str = ""; - if (tail_action != null && tail_action.code_string() != null) - action_str = action_str + "\t\t" + tail_action.code_string(); - - /* stash the action */ - _action = new action_part(action_str); - - /* rewrite production to remove any embedded actions */ - remove_embedded_actions(); - - /* assign an index */ - _index = next_index++; - - /* put us in the global collection of productions */ - _all.put(new Integer(_index),this); - - /* put us in the production list of the lhs non terminal */ - lhs_sym.add_production(this); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Constructor with no action string. */ - public production( - non_terminal lhs_sym, - production_part rhs_parts[], - int rhs_l) - throws internal_error - { - this(lhs_sym,rhs_parts,rhs_l,null); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /* Constructor with precedence and associativity of production - contextually define */ - public production( - non_terminal lhs_sym, - production_part rhs_parts[], - int rhs_l, - String action_str, - int prec_num, - int prec_side) - throws internal_error - { - this(lhs_sym,rhs_parts,rhs_l,action_str); - - /* set the precedence */ - set_precedence_num(prec_num); - set_precedence_side(prec_side); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /* Constructor w/ no action string and contextual precedence - defined */ - public production( - non_terminal lhs_sym, - production_part rhs_parts[], - int rhs_l, - int prec_num, - int prec_side) - throws internal_error - { - this(lhs_sym,rhs_parts,rhs_l,null); - /* set the precedence */ - set_precedence_num(prec_num); - set_precedence_side(prec_side); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /*-----------------------------------------------------------*/ - /*--- (Access to) Static (Class) Variables ------------------*/ - /*-----------------------------------------------------------*/ - - - /** Table of all productions. Elements are stored using their index as - * the key. - */ - protected static Hashtable _all = new Hashtable(); - - /** Access to all productions. */ - public static Enumeration all() {return _all.elements();} - - /** Lookup a production by index. */ - public static production find(int indx) { - return (production) _all.get(new Integer(indx)); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Total number of productions. */ - public static int number() {return _all.size();} - - /** Static counter for assigning unique index numbers. */ - protected static int next_index; - - /*-----------------------------------------------------------*/ - /*--- (Access to) Instance Variables ------------------------*/ - /*-----------------------------------------------------------*/ - - /** The left hand side non-terminal. */ - protected symbol_part _lhs; - - /** The left hand side non-terminal. */ - public symbol_part lhs() {return _lhs;} - - - /** The precedence of the rule */ - protected int _rhs_prec = -1; - protected int _rhs_assoc = -1; - - /** Access to the precedence of the rule */ - public int precedence_num() { return _rhs_prec; } - public int precedence_side() { return _rhs_assoc; } - - /** Setting the precedence of a rule */ - public void set_precedence_num(int prec_num) { - _rhs_prec = prec_num; - } - public void set_precedence_side(int prec_side) { - _rhs_assoc = prec_side; - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** A collection of parts for the right hand side. */ - protected production_part _rhs[]; - - /** Access to the collection of parts for the right hand side. */ - public production_part rhs(int indx) throws internal_error - { - if (indx >= 0 && indx < _rhs_length) - return _rhs[indx]; - else - throw new internal_error( - "Index out of range for right hand side of production"); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** How much of the right hand side array we are presently using. */ - protected int _rhs_length; - - /** How much of the right hand side array we are presently using. */ - public int rhs_length() {return _rhs_length;} - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** An action_part containing code for the action to be performed when we - * reduce with this production. - */ - protected action_part _action; - - /** An action_part containing code for the action to be performed when we - * reduce with this production. - */ - public action_part action() {return _action;} - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Index number of the production. */ - protected int _index; - - /** Index number of the production. */ - public int index() {return _index;} - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Count of number of reductions using this production. */ - protected int _num_reductions = 0; - - /** Count of number of reductions using this production. */ - public int num_reductions() {return _num_reductions;} - - /** Increment the count of reductions with this non-terminal */ - public void note_reduction_use() {_num_reductions++;} - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Is the nullability of the production known or unknown? */ - protected boolean _nullable_known = false; - - /** Is the nullability of the production known or unknown? */ - public boolean nullable_known() {return _nullable_known;} - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Nullability of the production (can it derive the empty string). */ - protected boolean _nullable = false; - - /** Nullability of the production (can it derive the empty string). */ - public boolean nullable() {return _nullable;} - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** First set of the production. This is the set of terminals that - * could appear at the front of some string derived from this production. - */ - protected terminal_set _first_set = new terminal_set(); - - /** First set of the production. This is the set of terminals that - * could appear at the front of some string derived from this production. - */ - public terminal_set first_set() {return _first_set;} - - /*-----------------------------------------------------------*/ - /*--- Static Methods ----------------------------------------*/ - /*-----------------------------------------------------------*/ - - /** Determine if a given character can be a label id starter. - * @param c the character in question. - */ - protected static boolean is_id_start(char c) - { - return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || (c == '_'); - - //later need to handle non-8-bit chars here - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Determine if a character can be in a label id. - * @param c the character in question. - */ - protected static boolean is_id_char(char c) - { - return is_id_start(c) || (c >= '0' && c <= '9'); - } - - /*-----------------------------------------------------------*/ - /*--- General Methods ---------------------------------------*/ - /*-----------------------------------------------------------*/ - - - /** Return label declaration code - * @param labelname the label name - * @param stack_type the stack type of label? - * @author frankf - */ - protected String make_declaration( - String labelname, - String stack_type, - int offset) - { - String ret; - - /* Put in the left/right value labels */ - if (emit.lr_values()) - ret = "\t\tint " + labelname + "left = ((java_cup.runtime.Symbol)" + - emit.pre("stack") + ".elementAt(" + emit.pre("top") + - "-" + offset + ")).left;\n" + - "\t\tint " + labelname + "right = ((java_cup.runtime.Symbol)" + - emit.pre("stack") + ".elementAt(" + emit.pre("top") + - "-" + offset + ")).right;\n"; - else ret = ""; - - /* otherwise, just declare label. */ - return ret + "\t\t" + stack_type + " " + labelname + " = (" + stack_type + - ")((" + "java_cup.runtime.Symbol) " + emit.pre("stack") + ".elementAt(" + emit.pre("top") - + "-" + offset + ")).value;\n"; - - } - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Declare label names as valid variables within the action string - * @param rhs array of RHS parts. - * @param rhs_len how much of rhs to consider valid. - * @param final_action the final action string of the production. - * @param lhs_type the object type associated with the LHS symbol. - */ - protected String declare_labels( - production_part rhs[], - int rhs_len, - String final_action) - { - String declaration = ""; - - symbol_part part; - action_part act_part; - int pos; - - /* walk down the parts and extract the labels */ - for (pos = 0; pos < rhs_len; pos++) - { - if (!rhs[pos].is_action()) - { - part = (symbol_part)rhs[pos]; - - /* if it has a label, make declaration! */ - if (part.label() != null) - { - declaration = declaration + - make_declaration(part.label(), part.the_symbol().stack_type(), - rhs_len-pos-1); - } - } - } - return declaration; - } - - - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Helper routine to merge adjacent actions in a set of RHS parts - * @param rhs_parts array of RHS parts. - * @param len amount of that array that is valid. - * @return remaining valid length. - */ - protected int merge_adjacent_actions(production_part rhs_parts[], int len) - { - int from_loc, to_loc, merge_cnt; - - /* bail out early if we have no work to do */ - if (rhs_parts == null || len == 0) return 0; - - merge_cnt = 0; - to_loc = -1; - for (from_loc=0; from_loc - * A ::= B {action1} C {action2} D - * - * then it will be factored into:
    -   *    A ::= B NT$1 C NT$2 D
    -   *    NT$1 ::= {action1}
    -   *    NT$2 ::= {action2}
    -   *  
    - * where NT$1 and NT$2 are new system created non terminals. - */ - - /* the declarations added to the parent production are also passed along, - as they should be perfectly valid in this code string, since it - was originally a code string in the parent, not on its own. - frank 6/20/96 */ - protected void remove_embedded_actions( - - ) throws internal_error - { - non_terminal new_nt; - production new_prod; - String declare_str; - - /* walk over the production and process each action */ - for (int act_loc = 0; act_loc < rhs_length(); act_loc++) - if (rhs(act_loc).is_action()) - { - - - declare_str = declare_labels( - _rhs, act_loc, ""); - /* create a new non terminal for the action production */ - new_nt = non_terminal.create_new(); - new_nt.is_embedded_action = true; /* 24-Mar-1998, CSA */ - - /* create a new production with just the action */ - new_prod = new action_production(this, new_nt, null, 0, - declare_str + ((action_part)rhs(act_loc)).code_string()); - - /* replace the action with the generated non terminal */ - _rhs[act_loc] = new symbol_part(new_nt); - } - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Check to see if the production (now) appears to be nullable. - * A production is nullable if its RHS could derive the empty string. - * This results when the RHS is empty or contains only non terminals - * which themselves are nullable. - */ - public boolean check_nullable() throws internal_error - { - production_part part; - symbol sym; - int pos; - - /* if we already know bail out early */ - if (nullable_known()) return nullable(); - - /* if we have a zero size RHS we are directly nullable */ - if (rhs_length() == 0) - { - /* stash and return the result */ - return set_nullable(true); - } - - /* otherwise we need to test all of our parts */ - for (pos=0; pospJlxou_2$g+Fxz2|=4`ObIx>-U#$0Pf(fiX!R-NVulba$Us@EXi2r zhnxJ+kkM43pw1UVfyv`71uHUE8S)+1>e?=YzIkB1w_2{{?X|X}(DC-#lzrrQPV|_e z(wIy)cNoNVzi%^?HXYC2ir;qa@Rikd=|;+E%Z=tFlA+)XI#w@oe2+nBG~ZAu`(13g z1BO~!s?&>uRuKCAIC<6ytT1ZxhyO`=**&m(>AkXV4fazx#Q2;+iTtz?26fwy!=An2 zaB1Z;tgF0n4KrwIC}CPd1yvchHC)6chIyVnPYlm5Xt<0T!`xZ#p2m*bw?mBvw8p?5 zYPf*I0iG!&&YjDUYBVtLZG!m$SMk$BLw-8;c65aWhLVia!03-d~&%Yk`b6s zZpoSq@**p>Y@R?8hQP@CT&jgTL6q^+z|^UtW24MNhiGQ3HVw=&D6P - * - * This is an abstract class. - * - * @see java_cup.production - * @version last updated: 11/25/95 - * @author Scott Hudson - */ -public abstract class production_part { - - /*-----------------------------------------------------------*/ - /*--- Constructor(s) ----------------------------------------*/ - /*-----------------------------------------------------------*/ - - /** Simple constructor. */ - public production_part(String lab) - { - _label = lab; - } - - /*-----------------------------------------------------------*/ - /*--- (Access to) Instance Variables ------------------------*/ - /*-----------------------------------------------------------*/ - - /** Optional label for referring to the part within an action (null for - * no label). - */ - protected String _label; - - /** Optional label for referring to the part within an action (null for - * no label). - */ - public String label() {return _label;} - - /*-----------------------------------------------------------*/ - /*--- General Methods ---------------------------------------*/ - /*-----------------------------------------------------------*/ - - /** Indicate if this is an action (rather than a symbol). Here in the - * base class, we don't this know yet, so its an abstract method. - */ - public abstract boolean is_action(); - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Equality comparison. */ - public boolean equals(production_part other) - { - if (other == null) return false; - - /* compare the labels */ - if (label() != null) - return label().equals(other.label()); - else - return other.label() == null; - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Generic equality comparison. */ - public boolean equals(Object other) - { - if (!(other instanceof production_part)) - return false; - else - return equals((production_part)other); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Produce a hash code. */ - public int hashCode() - { - return label()==null ? 0 : label().hashCode(); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Convert to a string. */ - public String toString() - { - if (label() != null) - return label() + ":"; - else - return " "; - } - - /*-----------------------------------------------------------*/ - -} diff --git a/Robust/cup/java_cup/reduce_action.class b/Robust/cup/java_cup/reduce_action.class deleted file mode 100644 index 14379c222a951b1d23c9b5a4390757d4a3c74655..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1218 zcmZuwTTj$L6#ix}w3KpNSa#(i^@e+KSwR#O5EU_!5J^N$@MTkWCr~VHEv@ob`~&*J zgC@Epl6ZO1#2;lm)7E8ovkyIU=Jb5$JM*2HKYzb|12BUX1u0BPxGE#3AclN5Boq`f zMG4o$T2e5LvV`jj6imsO5$mi7-VolLjGJP;C1IXHt+>4AS9#^F;q5V`H}>^6dZp?+ zWyiJYhiBNXYe!Y?h)RbH zJuQ5hT)tyHs`kpTY7FsQex2y~YhO1BJ=R1Y71F~V^Dn9U@Ne1Ft=;nG&OWbtiy|)X z>4$q^cd}=1d9GpYG7LxDVR{&)qbggr?^gLEL$sc1A(@0_ zYr6~!_dSmvIG*O&TGi#c$2DDRsiO(8DQNkosh#O8D&JNygkcq<7-JY|aJ0ZxoX4bu zJ1Q<015D$FAta0jO@afva=c{YEfKKpeDi*P%Vi^;{qj|Etii@~J+BLWw-96-$ zP}X1oG}{(sBdNs9ht5!q>q6tw9fynQm6`|g9~KO}L%*bbl4j127{+t!;l1dTMyHnO z4FGgWgjnQBXMQl42KSAPqq4)*KPXRVdb_7YXX{wWf zj4V|hBX1n%D4L*}G5Tl{WJTQxS{bd$!e=Bul0(mdY*!GRB0C8^F)v-;KPf9UxrC8H7$F3=gN>1ak%0;5SOx}07DfhU1{NTn703h8 NY(UHoWHT{v006ioHWvT@ diff --git a/Robust/cup/java_cup/runtime/Scanner.java b/Robust/cup/java_cup/runtime/Scanner.java deleted file mode 100644 index 32335516..00000000 --- a/Robust/cup/java_cup/runtime/Scanner.java +++ /dev/null @@ -1,25 +0,0 @@ -package java_cup.runtime; - -/** - * Defines the Scanner interface, which CUP uses in the default - * implementation of lr_parser.scan(). Integration - * of scanners implementing Scanner is facilitated. - * - * @version last updated 23-Jul-1999 - * @author David MacMahon - */ - -/* ************************************************* - Interface Scanner - - Declares the next_token() method that should be - implemented by scanners. This method is typically - called by lr_parser.scan(). End-of-file can be - indicated either by returning - new Symbol(lr_parser.EOF_sym()) or - null. - ***************************************************/ -public interface Scanner { - /** Return the next token, or null on end-of-file. */ - public Symbol next_token() throws java.lang.Exception; -} diff --git a/Robust/cup/java_cup/runtime/Symbol.class b/Robust/cup/java_cup/runtime/Symbol.class deleted file mode 100644 index 4831d12d43969acba163896662418f160f926ab8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1045 zcmZ`&+int36kTVy4Tqnq)@xhZhgO@AH2Q#PqAz5C5vSpnVWtUxrHPb8 z6F*;I%+tH0}wAnm~ML*dwzsaty~5NVp@j-Dr**UeuPD(zr4zU8CQryl-BbE$2`mT($a^b1bl|*J`!JiqZw?oetW> zPo7(S^PSskn)U~y*`-KU{|_U~VjflZOo)7Tqt2l2*jB$IkkLywy7^I>N39QByJenP ztRJtBd(A<&%yVlfU{k{~G8$GG?jz5!BEtiQeGOUUG~DCt5;6k0`NDpK6W8jtO+FJb z4sgg&)$kBov*Jd}9ae0&?^r#v;&&HF&1L+%(f^_II$>itH2ZCV9er_^#r0<0Y0Cng zWr6W8jSYGeX?jax2wsMM3Eqb+ctg*pJ9w5(;aR!{S!U2l2v^BFhJp~;tjtd#WMKkD z7AFYEmEZ)yZys-r^Ip{|;Tlw|BS{l1VbjxEpJ{DTHbAv8nOBtUDME9)N^O7=qL3bC z;|3+@Qwl|K3uTumdme>*`4a~`F`8JJA}kdinIIs=Efeq4z6bP`93q7(O?*Vn=q=2& zs-(mdXXF$S8JHj{^Ann%&Y;eR_jf-<5EqEy4H9@uH$Ni{dK5FI3MmOv%Kb$A;}lx@ e&NUM9J7U*JUL*CDQi4wBpC4$F_lP_NkN*NAa;|s) diff --git a/Robust/cup/java_cup/runtime/Symbol.java b/Robust/cup/java_cup/runtime/Symbol.java deleted file mode 100644 index eeb6a0b4..00000000 --- a/Robust/cup/java_cup/runtime/Symbol.java +++ /dev/null @@ -1,105 +0,0 @@ -package java_cup.runtime; - -/** - * Defines the Symbol class, which is used to represent all terminals - * and nonterminals while parsing. The lexer should pass CUP Symbols - * and CUP returns a Symbol. - * - * @version last updated: 7/3/96 - * @author Frank Flannery - */ - -/* **************************************************************** - Class Symbol - what the parser expects to receive from the lexer. - the token is identified as follows: - sym: the symbol type - parse_state: the parse state. - value: is the lexical value of type Object - left : is the left position in the original input file - right: is the right position in the original input file -******************************************************************/ - -public class Symbol { - -/******************************* - Constructor for l,r values - *******************************/ - - public Symbol(int id, int l, int r, Object o) { - this(id); - left = l; - right = r; - value = o; - } - -/******************************* - Constructor for no l,r values -********************************/ - - public Symbol(int id, Object o) { - this(id, -1, -1, o); - } - -/***************************** - Constructor for no value - ***************************/ - - public Symbol(int id, int l, int r) { - this(id, l, r, null); - } - -/*********************************** - Constructor for no value or l,r -***********************************/ - - public Symbol(int sym_num) { - this(sym_num, -1); - left = -1; - right = -1; - value = null; - } - -/*********************************** - Constructor to give a start state -***********************************/ - Symbol(int sym_num, int state) - { - sym = sym_num; - parse_state = state; - } - -/*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** The symbol number of the terminal or non terminal being represented */ - public int sym; - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** The parse state to be recorded on the parse stack with this symbol. - * This field is for the convenience of the parser and shouldn't be - * modified except by the parser. - */ - public int parse_state; - /** This allows us to catch some errors caused by scanners recycling - * symbols. For the use of the parser only. [CSA, 23-Jul-1999] */ - boolean used_by_parser = false; - -/******************************* - The data passed to parser - *******************************/ - - public int left, right; - public Object value; - - /***************************** - Printing this token out. (Override for pretty-print). - ****************************/ - public String toString() { return "#"+sym; } -} - - - - - - diff --git a/Robust/cup/java_cup/runtime/lr_parser.class b/Robust/cup/java_cup/runtime/lr_parser.class deleted file mode 100644 index 3edd49735aafb59b1ce16fb13c49de19104500b2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 9947 zcmbVR34B!5x&OX%&txu>AqfLPvw#vrmSF5Q_aW94-q* zIG>BXTw?MFAI+c>vJ#NVk@6WOTT10KS{BZb-kI_#lTW#PDon1Fc8tkmh2|`iEosM@ zJl^CglP8#bw#gGso@8>h$&*bEdb!5rS|2T^6DHT0JjLXx81Xcj`oQGrCeJW=rm#K7 zSBIz=dmz%u8Gh&uz5E#X8w($W=5c1PnILAZ{|NF}=A`?hqlC6(9|i8GZgy*jix z)Y6vjnwm_-E8S@3&rD+BvbhiXF6+OJS>(-YzlQmLSYcDAA&L?-S8}7 zOP6R>Fee(1rshJD>dC8_bW^As1@SCJo-cB)e)_R`m z#fv9PkjtdwW5j?Y82mas9BEB&Z0U@2cZW7&Tsnm8a+oii?(C9akj(Nsn=-r#aKK_A zDs<+%JEHBdXJ+K=aYyd4MNY)H^7p{n)$1lB(?{5QThj3`+~QgVag3Ew?a_D`;@b-M zw6rDS?NPu(Q4%TFlFcb7Bq)KM8Kf8y3U3a@k|Z=BEegAwTV= zyO6;$kr&2(`ZVqF(-)}EPxsRUemY2pynMBvH_>xUXZ#BQ^wR-)3~V{(r>BMYF*?dL z(&lZ4UpD-iCNzcOlTwyzRI42dSzXD<=4c|_ZQ0hZ?w%|nzU1XjKgT)Y=iF7RN2-p>hCaq9BY{BoTXgnRUZ0Gptc{=K+d+9TNx=%ij)93uuE4}^F z`@DRf6)QX=pCj~~pYEYg`MF1iPdJ9!=I8Bvt)K3uJND%#Ni>{uO&T#83D;V!>6B&XofYl2;^`RtdRz<^Y|Q&-t(0_j zIb0wd@)jHYd^0`9WI9STz#BXH7L0{H6=|?eVV1x3^gdFt%DU9PBCRdaR0kp^5w@xT zDc1Vss~VY9Ef^Zj>(J#ZZR%zL1j|lp3(?Ri)P+_mA$p}EG8&zWPbZ}oq}$sij)qmi zF01A@UECn@&T%&2)~vN~^WYqwD^c}PiK@&$fLN8a7+4++#iHB9S9Yv`8RnbP$z&v+ zvRr?{q*Z?UhB#nkZqY6>#N5Jrm!DpyS5R_fwN9pEFj^|n<;o9qthHht-L6PJt8Q*~ zrKrlfFp;lmMU^!_m5OxY27+XEl4TOG$4}p*S7D4QYoUZ)cHU|aMPuE5`aV5`oU5`{ zC3|Eu*xH&|HemVbM-ohX>9Z&nhUOqSiA&q|iPT={PGRGk0(SVJ@UN|Mf~n5tY9%(+ zS{oBW*DBG8GvkS5XDF6Qz#r33{PdKB*SIQc5inXvGcfI%ArY5O+a^EXD%tQI`Yw}& zV;l>DYio~%q7Oc`<6%n(UV-gDCUoPgtmTPQ8MY@7OxWVE1^S9_?3=-5;Sf|KvUoDn zSj3QopooS|j?r^Y5rliiPmc;5>=RgdU;fEIpzr$WNiiRSGk<5OO{$b`Aci>Q?7@r9&D-5zbpR7% z5ld=ns}bp7+Hu$@DK*@|^K6Pu5F3g7VukL|W!cG!9r4}wSBzGo9oUM`~PIe?Z zyJA4SFuY;g!Oyob-egKD=V1Xgj_?!|xh@r%`mB&8E*~6U1=}6h5#i2-ftIH@CM4M-c76-kY%Z zX0$*rcV9VLIbId)$JaTlz@FKySt=yx%~BuPElMQ2MKNTzz#_Xv6=}DCcAE=oN$?Q$ z#zQLMUl4>oDkqcAmiD*gp|`P)vel&@>*@g=4w0Fow`Jndph98m(vCqZygk8#WFD{& z7E?K-6%ZRm6bQbEIgPdif2izmfCyG*(?jJ`&uGYP&|2!jQ&^xbbXhdOu441C!G0R{ z4EdOr)_je;HGNccgbLSU)_<6W=LEBL<`p1ZnL7jAQI@(K&jCmA)hO&O3f9#2Q}Gch zSsNH}m;%Rafki>vpWFt=w1Zc45HA$);3x|2ba}0MnnofXM%BJRg?ngT?U$(VAeE{I zD2Rn4G#a6HM&QhTDsxx*sXS1DVLw&&)0jRQ4YI&kyIYv)=4>{Wys%*pd3hTZ@pdZX zYiS-|PZ#qI)XX?7@!S zJpD&W@$8=V9-MB%4tFCu##hW}@RoUxmWrJe_At~47wvHF5aA@y|3+DpTop58EPe`fL_ z@|PCq4fVQj;AM2My>H-!GLb=tXYDs~$+nzE!hrk9crdso=!O{!V1n5& zK^07(%k**bsQm_%@sw#;V0;<0+36W<0ZhRH9riIzB-&F+QLFf}_8d$q+RQ`3(X18eSGeNKZIKXG=Tr5RI31(jlrsQ;omLG7cW1 z8i?xYr&?(wi408F9i}P$G{ERbUc&G^`2QOmXBi+oHc3EMKYar`dCADzYAvr*SMXKpN)D;3IHopmLbc{4G|ThVjphl6W`SGN0kkov zfPspWS0zCE_3Y)d7Z4yjI>b81aW@7&(ogfA3I^t*G3K~FTCk6raOXNe*aYMgY9QbR zb_gMM$^#2eovp{L4UqG8GVihJ!5TD~^0;xMgT zYBWkpBJ5$(jnae6V#Vb(8S`F(bLtL~oD;az>D%Wwqi<`nYE5N9m*)X0$#Bx)y{L^4 z`Io`K_ED?lsGSOCzbhxDWAH~1;(c_6dX%cvW3)m&PHpOQvvZ$M zBLievr>}D*?x*#RxP1eg0dcSWA0W;qE!Bv?EB;?-mzCv8M;643i`EhqS7B06u{_X% zo_;>T7_` zi2X| z{ehlS@6wCv1R(Q|^b_?L`i1%{{X@M+1L}P?)CXLu{>kIjNuGii!TE;43k(l0F$#DU z`s)lI$BjaM$SC2*j1l~V5#YndNPfX60gfWiaHzx4kjkEcr zF;NXOs+Hde=E16#-x2|hQYZe-1<5-q_Rz3kASCe)v$ytAu`|<#8Dl?kAnc4IE=Btu zD(IudFyBUF25{L1< z97W=yNH(qxQo^nhvXNd|?*aF&URn$CiCGI><5(z5mV;x5SA%^c$>wZP;VdNg3_R@| z+-=)^NJZv?;)3j1sUgk^q%rBDSO(%YV`_{JXZ_{AY&uI(4<8+JhBz?v>Ko1yC({bY< zy=i=r{%AZy?;Fq3Ka3;nF`naM<0#yKpE})OZgX$BnF4%UpQpk@2u@t|7&tZAM!EEB znlrd)-`;OYP1%#XOYAp|@f|8OzE7pb59lo8hcpTOI^#8(VZ1&lituBe8%3Fyt`7&u z<<~PKSA;nc^K*!bpYUAzbKR(`5NGyC+1Vqz98pgVIr~;O-hu7j1rz-A>gu}*BdKs^ z>x`0T$nm%$>}E!@t>ABDAdKzloc2TN{Wl!)0i9|5jmF{$U8fbz(jIEi1%vd)&&Q4k z_zxa!zX4H$Z?kWq!?eA@6D&g%UyC!Zvn!1A8Y_FrW9+ZIpXQZ$DkYw-M>y7G!|?_Q z#|(9O;6@B>Di{5+w4-<6^Ll@!RO0<~Qx<4$M!@U+Q1EP7LOnh=+t;Yg?Z;lJ-bY0u z&`$eZ_a~e@J$v#kILf(jJ}RLuH_t9~Z27ZMU*;-=<=M9A1LLv`GSAXJ%?`9jdZu3M-S-v^bp#| zbrU_IFQC`;Mf8qdOege`L5{#r>W(ASVnC2Q#_!|hwqv2?;$YxbL844D+x1G;%BN)d z$DjvnH#GX-xpm=bsFL;V{nRPWgU0{`(v!Cg&M%ZayDn3m*xf*)r41MSi`(rfpHT(rf;DG zdKW#b@1!GoHyzV=(Hr_x^p@_W_w;?N^!;3{_wrf#L7uE1=IQzoo{j!|{WxEyKhNv* z6WpSo=6o+Fh8xU4IXH{uKHt`q}>i DFi@p{ diff --git a/Robust/cup/java_cup/runtime/lr_parser.java b/Robust/cup/java_cup/runtime/lr_parser.java deleted file mode 100644 index 3c8335cb..00000000 --- a/Robust/cup/java_cup/runtime/lr_parser.java +++ /dev/null @@ -1,1238 +0,0 @@ - -package java_cup.runtime; - -import java.util.Stack; - -/** This class implements a skeleton table driven LR parser. In general, - * LR parsers are a form of bottom up shift-reduce parsers. Shift-reduce - * parsers act by shifting input onto a parse stack until the Symbols - * matching the right hand side of a production appear on the top of the - * stack. Once this occurs, a reduce is performed. This involves removing - * the Symbols corresponding to the right hand side of the production - * (the so called "handle") and replacing them with the non-terminal from - * the left hand side of the production.

    - * - * To control the decision of whether to shift or reduce at any given point, - * the parser uses a state machine (the "viable prefix recognition machine" - * built by the parser generator). The current state of the machine is placed - * on top of the parse stack (stored as part of a Symbol object representing - * a terminal or non terminal). The parse action table is consulted - * (using the current state and the current lookahead Symbol as indexes) to - * determine whether to shift or to reduce. When the parser shifts, it - * changes to a new state by pushing a new Symbol (containing a new state) - * onto the stack. When the parser reduces, it pops the handle (right hand - * side of a production) off the stack. This leaves the parser in the state - * it was in before any of those Symbols were matched. Next the reduce-goto - * table is consulted (using the new state and current lookahead Symbol as - * indexes) to determine a new state to go to. The parser then shifts to - * this goto state by pushing the left hand side Symbol of the production - * (also containing the new state) onto the stack.

    - * - * This class actually provides four LR parsers. The methods parse() and - * debug_parse() provide two versions of the main parser (the only difference - * being that debug_parse() emits debugging trace messages as it parses). - * In addition to these main parsers, the error recovery mechanism uses two - * more. One of these is used to simulate "parsing ahead" in the input - * without carrying out actions (to verify that a potential error recovery - * has worked), and the other is used to parse through buffered "parse ahead" - * input in order to execute all actions and re-synchronize the actual parser - * configuration.

    - * - * This is an abstract class which is normally filled out by a subclass - * generated by the JavaCup parser generator. In addition to supplying - * the actual parse tables, generated code also supplies methods which - * invoke various pieces of user supplied code, provide access to certain - * special Symbols (e.g., EOF and error), etc. Specifically, the following - * abstract methods are normally supplied by generated code: - *

    - *
    short[][] production_table() - *
    Provides a reference to the production table (indicating the index of - * the left hand side non terminal and the length of the right hand side - * for each production in the grammar). - *
    short[][] action_table() - *
    Provides a reference to the parse action table. - *
    short[][] reduce_table() - *
    Provides a reference to the reduce-goto table. - *
    int start_state() - *
    Indicates the index of the start state. - *
    int start_production() - *
    Indicates the index of the starting production. - *
    int EOF_sym() - *
    Indicates the index of the EOF Symbol. - *
    int error_sym() - *
    Indicates the index of the error Symbol. - *
    Symbol do_action() - *
    Executes a piece of user supplied action code. This always comes at - * the point of a reduce in the parse, so this code also allocates and - * fills in the left hand side non terminal Symbol object that is to be - * pushed onto the stack for the reduce. - *
    void init_actions() - *
    Code to initialize a special object that encapsulates user supplied - * actions (this object is used by do_action() to actually carry out the - * actions). - *
    - * - * In addition to these routines that must be supplied by the - * generated subclass there are also a series of routines that may - * be supplied. These include: - *
    - *
    Symbol scan() - *
    Used to get the next input Symbol from the scanner. - *
    Scanner getScanner() - *
    Used to provide a scanner for the default implementation of - * scan(). - *
    int error_sync_size() - *
    This determines how many Symbols past the point of an error - * must be parsed without error in order to consider a recovery to - * be valid. This defaults to 3. Values less than 2 are not - * recommended. - *
    void report_error(String message, Object info) - *
    This method is called to report an error. The default implementation - * simply prints a message to System.err and where the error occurred. - * This method is often replaced in order to provide a more sophisticated - * error reporting mechanism. - *
    void report_fatal_error(String message, Object info) - *
    This method is called when a fatal error that cannot be recovered from - * is encountered. In the default implementation, it calls - * report_error() to emit a message, then throws an exception. - *
    void syntax_error(Symbol cur_token) - *
    This method is called as soon as syntax error is detected (but - * before recovery is attempted). In the default implementation it - * invokes: report_error("Syntax error", null); - *
    void unrecovered_syntax_error(Symbol cur_token) - *
    This method is called if syntax error recovery fails. In the default - * implementation it invokes:
    - * report_fatal_error("Couldn't repair and continue parse", null); - *
    - * - * @see java_cup.runtime.Symbol - * @see java_cup.runtime.Symbol - * @see java_cup.runtime.virtual_parse_stack - * @version last updated: 7/3/96 - * @author Frank Flannery - */ - -public abstract class lr_parser { - - /*-----------------------------------------------------------*/ - /*--- Constructor(s) ----------------------------------------*/ - /*-----------------------------------------------------------*/ - - /** Simple constructor. */ - public lr_parser() - { - /* nothing to do here */ - } - - /** Constructor that sets the default scanner. [CSA/davidm] */ - public lr_parser(Scanner s) { - this(); /* in case default constructor someday does something */ - setScanner(s); - } - - /*-----------------------------------------------------------*/ - /*--- (Access to) Static (Class) Variables ------------------*/ - /*-----------------------------------------------------------*/ - - /** The default number of Symbols after an error we much match to consider - * it recovered from. - */ - protected final static int _error_sync_size = 3; - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** The number of Symbols after an error we much match to consider it - * recovered from. - */ - protected int error_sync_size() {return _error_sync_size; } - - /*-----------------------------------------------------------*/ - /*--- (Access to) Instance Variables ------------------------*/ - /*-----------------------------------------------------------*/ - - /** Table of production information (supplied by generated subclass). - * This table contains one entry per production and is indexed by - * the negative-encoded values (reduce actions) in the action_table. - * Each entry has two parts, the index of the non-terminal on the - * left hand side of the production, and the number of Symbols - * on the right hand side. - */ - public abstract short[][] production_table(); - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** The action table (supplied by generated subclass). This table is - * indexed by state and terminal number indicating what action is to - * be taken when the parser is in the given state (i.e., the given state - * is on top of the stack) and the given terminal is next on the input. - * States are indexed using the first dimension, however, the entries for - * a given state are compacted and stored in adjacent index, value pairs - * which are searched for rather than accessed directly (see get_action()). - * The actions stored in the table will be either shifts, reduces, or - * errors. Shifts are encoded as positive values (one greater than the - * state shifted to). Reduces are encoded as negative values (one less - * than the production reduced by). Error entries are denoted by zero. - * - * @see java_cup.runtime.lr_parser#get_action - */ - public abstract short[][] action_table(); - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** The reduce-goto table (supplied by generated subclass). This - * table is indexed by state and non-terminal number and contains - * state numbers. States are indexed using the first dimension, however, - * the entries for a given state are compacted and stored in adjacent - * index, value pairs which are searched for rather than accessed - * directly (see get_reduce()). When a reduce occurs, the handle - * (corresponding to the RHS of the matched production) is popped off - * the stack. The new top of stack indicates a state. This table is - * then indexed by that state and the LHS of the reducing production to - * indicate where to "shift" to. - * - * @see java_cup.runtime.lr_parser#get_reduce - */ - public abstract short[][] reduce_table(); - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** The index of the start state (supplied by generated subclass). */ - public abstract int start_state(); - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** The index of the start production (supplied by generated subclass). */ - public abstract int start_production(); - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** The index of the end of file terminal Symbol (supplied by generated - * subclass). - */ - public abstract int EOF_sym(); - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** The index of the special error Symbol (supplied by generated subclass). */ - public abstract int error_sym(); - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Internal flag to indicate when parser should quit. */ - protected boolean _done_parsing = false; - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** This method is called to indicate that the parser should quit. This is - * normally called by an accept action, but can be used to cancel parsing - * early in other circumstances if desired. - */ - public void done_parsing() - { - _done_parsing = true; - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - /* Global parse state shared by parse(), error recovery, and - * debugging routines */ - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Indication of the index for top of stack (for use by actions). */ - protected int tos; - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** The current lookahead Symbol. */ - protected Symbol cur_token; - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** The parse stack itself. */ - protected Stack stack = new Stack(); - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Direct reference to the production table. */ - protected short[][] production_tab; - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Direct reference to the action table. */ - protected short[][] action_tab; - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Direct reference to the reduce-goto table. */ - protected short[][] reduce_tab; - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** This is the scanner object used by the default implementation - * of scan() to get Symbols. To avoid name conflicts with existing - * code, this field is private. [CSA/davidm] */ - private Scanner _scanner; - - /** - * Simple accessor method to set the default scanner. - */ - public void setScanner(Scanner s) { _scanner = s; } - - /** - * Simple accessor method to get the default scanner. - */ - public Scanner getScanner() { return _scanner; } - - /*-----------------------------------------------------------*/ - /*--- General Methods ---------------------------------------*/ - /*-----------------------------------------------------------*/ - - /** Perform a bit of user supplied action code (supplied by generated - * subclass). Actions are indexed by an internal action number assigned - * at parser generation time. - * - * @param act_num the internal index of the action to be performed. - * @param parser the parser object we are acting for. - * @param stack the parse stack of that object. - * @param top the index of the top element of the parse stack. - */ - public abstract Symbol do_action( - int act_num, - lr_parser parser, - Stack stack, - int top) - throws java.lang.Exception; - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** User code for initialization inside the parser. Typically this - * initializes the scanner. This is called before the parser requests - * the first Symbol. Here this is just a placeholder for subclasses that - * might need this and we perform no action. This method is normally - * overridden by the generated code using this contents of the "init with" - * clause as its body. - */ - public void user_init() throws java.lang.Exception { } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Initialize the action object. This is called before the parser does - * any parse actions. This is filled in by generated code to create - * an object that encapsulates all action code. - */ - protected abstract void init_actions() throws java.lang.Exception; - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Get the next Symbol from the input (supplied by generated subclass). - * Once end of file has been reached, all subsequent calls to scan - * should return an EOF Symbol (which is Symbol number 0). By default - * this method returns getScanner().next_token(); this implementation - * can be overriden by the generated parser using the code declared in - * the "scan with" clause. Do not recycle objects; every call to - * scan() should return a fresh object. - */ - public Symbol scan() throws java.lang.Exception { - Symbol sym = getScanner().next_token(); - return (sym!=null) ? sym : new Symbol(EOF_sym()); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Report a fatal error. This method takes a message string and an - * additional object (to be used by specializations implemented in - * subclasses). Here in the base class a very simple implementation - * is provided which reports the error then throws an exception. - * - * @param message an error message. - * @param info an extra object reserved for use by specialized subclasses. - */ - public void report_fatal_error( - String message, - Object info) - throws java.lang.Exception - { - /* stop parsing (not really necessary since we throw an exception, but) */ - done_parsing(); - - /* use the normal error message reporting to put out the message */ - report_error(message, info); - - /* throw an exception */ - throw new Exception("Can't recover from previous error(s)"); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Report a non fatal error (or warning). This method takes a message - * string and an additional object (to be used by specializations - * implemented in subclasses). Here in the base class a very simple - * implementation is provided which simply prints the message to - * System.err. - * - * @param message an error message. - * @param info an extra object reserved for use by specialized subclasses. - */ - public void report_error(String message, Object info) - { - System.err.print(message); - if (info instanceof Symbol) - if (((Symbol)info).left != -1) - System.err.println(" at character " + ((Symbol)info).left + - " of input"); - else System.err.println(""); - else System.err.println(""); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** This method is called when a syntax error has been detected and recovery - * is about to be invoked. Here in the base class we just emit a - * "Syntax error" error message. - * - * @param cur_token the current lookahead Symbol. - */ - public void syntax_error(Symbol cur_token) - { - report_error("Syntax error", cur_token); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** This method is called if it is determined that syntax error recovery - * has been unsuccessful. Here in the base class we report a fatal error. - * - * @param cur_token the current lookahead Symbol. - */ - public void unrecovered_syntax_error(Symbol cur_token) - throws java.lang.Exception - { - report_fatal_error("Couldn't repair and continue parse", cur_token); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Fetch an action from the action table. The table is broken up into - * rows, one per state (rows are indexed directly by state number). - * Within each row, a list of index, value pairs are given (as sequential - * entries in the table), and the list is terminated by a default entry - * (denoted with a Symbol index of -1). To find the proper entry in a row - * we do a linear or binary search (depending on the size of the row). - * - * @param state the state index of the action being accessed. - * @param sym the Symbol index of the action being accessed. - */ - protected final short get_action(int state, int sym) - { - short tag; - int first, last, probe; - short[] row = action_tab[state]; - - /* linear search if we are < 10 entries */ - if (row.length < 20) - for (probe = 0; probe < row.length; probe++) - { - /* is this entry labeled with our Symbol or the default? */ - tag = row[probe++]; - if (tag == sym || tag == -1) - { - /* return the next entry */ - return row[probe]; - } - } - /* otherwise binary search */ - else - { - first = 0; - last = (row.length-1)/2 - 1; /* leave out trailing default entry */ - while (first <= last) - { - probe = (first+last)/2; - if (sym == row[probe*2]) - return row[probe*2+1]; - else if (sym > row[probe*2]) - first = probe+1; - else - last = probe-1; - } - - /* not found, use the default at the end */ - return row[row.length-1]; - } - - /* shouldn't happened, but if we run off the end we return the - default (error == 0) */ - return 0; - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Fetch a state from the reduce-goto table. The table is broken up into - * rows, one per state (rows are indexed directly by state number). - * Within each row, a list of index, value pairs are given (as sequential - * entries in the table), and the list is terminated by a default entry - * (denoted with a Symbol index of -1). To find the proper entry in a row - * we do a linear search. - * - * @param state the state index of the entry being accessed. - * @param sym the Symbol index of the entry being accessed. - */ - protected final short get_reduce(int state, int sym) - { - short tag; - short[] row = reduce_tab[state]; - - /* if we have a null row we go with the default */ - if (row == null) - return -1; - - for (int probe = 0; probe < row.length; probe++) - { - /* is this entry labeled with our Symbol or the default? */ - tag = row[probe++]; - if (tag == sym || tag == -1) - { - /* return the next entry */ - return row[probe]; - } - } - /* if we run off the end we return the default (error == -1) */ - return -1; - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** This method provides the main parsing routine. It returns only when - * done_parsing() has been called (typically because the parser has - * accepted, or a fatal error has been reported). See the header - * documentation for the class regarding how shift/reduce parsers operate - * and how the various tables are used. - */ - public Symbol parse() throws java.lang.Exception - { - /* the current action code */ - int act; - - /* the Symbol/stack element returned by a reduce */ - Symbol lhs_sym = null; - - /* information about production being reduced with */ - short handle_size, lhs_sym_num; - - /* set up direct reference to tables to drive the parser */ - - production_tab = production_table(); - action_tab = action_table(); - reduce_tab = reduce_table(); - - /* initialize the action encapsulation object */ - init_actions(); - - /* do user initialization */ - user_init(); - - /* get the first token */ - cur_token = scan(); - - /* push dummy Symbol with start state to get us underway */ - stack.removeAllElements(); - stack.push(new Symbol(0, start_state())); - tos = 0; - - /* continue until we are told to stop */ - for (_done_parsing = false; !_done_parsing; ) - { - /* Check current token for freshness. */ - if (cur_token.used_by_parser) - throw new Error("Symbol recycling detected (fix your scanner)."); - - /* current state is always on the top of the stack */ - - /* look up action out of the current state with the current input */ - act = get_action(((Symbol)stack.peek()).parse_state, cur_token.sym); - - /* decode the action -- > 0 encodes shift */ - if (act > 0) - { - /* shift to the encoded state by pushing it on the stack */ - cur_token.parse_state = act-1; - cur_token.used_by_parser = true; - stack.push(cur_token); - tos++; - - /* advance to the next Symbol */ - cur_token = scan(); - } - /* if its less than zero, then it encodes a reduce action */ - else if (act < 0) - { - /* perform the action for the reduce */ - lhs_sym = do_action((-act)-1, this, stack, tos); - - /* look up information about the production */ - lhs_sym_num = production_tab[(-act)-1][0]; - handle_size = production_tab[(-act)-1][1]; - - /* pop the handle off the stack */ - for (int i = 0; i < handle_size; i++) - { - stack.pop(); - tos--; - } - - /* look up the state to go to from the one popped back to */ - act = get_reduce(((Symbol)stack.peek()).parse_state, lhs_sym_num); - - /* shift to that state */ - lhs_sym.parse_state = act; - lhs_sym.used_by_parser = true; - stack.push(lhs_sym); - tos++; - } - /* finally if the entry is zero, we have an error */ - else if (act == 0) - { - /* call user syntax error reporting routine */ - syntax_error(cur_token); - - /* try to error recover */ - if (!error_recovery(false)) - { - /* if that fails give up with a fatal syntax error */ - unrecovered_syntax_error(cur_token); - - /* just in case that wasn't fatal enough, end parse */ - done_parsing(); - } else { - lhs_sym = (Symbol)stack.peek(); - } - } - } - return lhs_sym; - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Write a debugging message to System.err for the debugging version - * of the parser. - * - * @param mess the text of the debugging message. - */ - public void debug_message(String mess) - { - System.err.println(mess); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Dump the parse stack for debugging purposes. */ - public void dump_stack() - { - if (stack == null) - { - debug_message("# Stack dump requested, but stack is null"); - return; - } - - debug_message("============ Parse Stack Dump ============"); - - /* dump the stack */ - for (int i=0; i"); - if ((i%3)==2 || (i==(stack.size()-1))) { - debug_message(sb.toString()); - sb = new StringBuffer(" "); - } - } - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Perform a parse with debugging output. This does exactly the - * same things as parse(), except that it calls debug_shift() and - * debug_reduce() when shift and reduce moves are taken by the parser - * and produces various other debugging messages. - */ - public Symbol debug_parse() - throws java.lang.Exception - { - /* the current action code */ - int act; - - /* the Symbol/stack element returned by a reduce */ - Symbol lhs_sym = null; - - /* information about production being reduced with */ - short handle_size, lhs_sym_num; - - /* set up direct reference to tables to drive the parser */ - production_tab = production_table(); - action_tab = action_table(); - reduce_tab = reduce_table(); - - debug_message("# Initializing parser"); - - /* initialize the action encapsulation object */ - init_actions(); - - /* do user initialization */ - user_init(); - - /* the current Symbol */ - cur_token = scan(); - - debug_message("# Current Symbol is #" + cur_token.sym); - - /* push dummy Symbol with start state to get us underway */ - stack.removeAllElements(); - stack.push(new Symbol(0, start_state())); - tos = 0; - - /* continue until we are told to stop */ - for (_done_parsing = false; !_done_parsing; ) - { - /* Check current token for freshness. */ - if (cur_token.used_by_parser) - throw new Error("Symbol recycling detected (fix your scanner)."); - - /* current state is always on the top of the stack */ - //debug_stack(); - - /* look up action out of the current state with the current input */ - act = get_action(((Symbol)stack.peek()).parse_state, cur_token.sym); - - /* decode the action -- > 0 encodes shift */ - if (act > 0) - { - /* shift to the encoded state by pushing it on the stack */ - cur_token.parse_state = act-1; - cur_token.used_by_parser = true; - debug_shift(cur_token); - stack.push(cur_token); - tos++; - - /* advance to the next Symbol */ - cur_token = scan(); - debug_message("# Current token is " + cur_token); - } - /* if its less than zero, then it encodes a reduce action */ - else if (act < 0) - { - /* perform the action for the reduce */ - lhs_sym = do_action((-act)-1, this, stack, tos); - - /* look up information about the production */ - lhs_sym_num = production_tab[(-act)-1][0]; - handle_size = production_tab[(-act)-1][1]; - - debug_reduce((-act)-1, lhs_sym_num, handle_size); - - /* pop the handle off the stack */ - for (int i = 0; i < handle_size; i++) - { - stack.pop(); - tos--; - } - - /* look up the state to go to from the one popped back to */ - act = get_reduce(((Symbol)stack.peek()).parse_state, lhs_sym_num); - debug_message("# Reduce rule: top state " + - ((Symbol)stack.peek()).parse_state + - ", lhs sym " + lhs_sym_num + " -> state " + act); - - /* shift to that state */ - lhs_sym.parse_state = act; - lhs_sym.used_by_parser = true; - stack.push(lhs_sym); - tos++; - - debug_message("# Goto state #" + act); - } - /* finally if the entry is zero, we have an error */ - else if (act == 0) - { - /* call user syntax error reporting routine */ - syntax_error(cur_token); - - /* try to error recover */ - if (!error_recovery(true)) - { - /* if that fails give up with a fatal syntax error */ - unrecovered_syntax_error(cur_token); - - /* just in case that wasn't fatal enough, end parse */ - done_parsing(); - } else { - lhs_sym = (Symbol)stack.peek(); - } - } - } - return lhs_sym; - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - /* Error recovery code */ - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Attempt to recover from a syntax error. This returns false if recovery - * fails, true if it succeeds. Recovery happens in 4 steps. First we - * pop the parse stack down to a point at which we have a shift out - * of the top-most state on the error Symbol. This represents the - * initial error recovery configuration. If no such configuration is - * found, then we fail. Next a small number of "lookahead" or "parse - * ahead" Symbols are read into a buffer. The size of this buffer is - * determined by error_sync_size() and determines how many Symbols beyond - * the error must be matched to consider the recovery a success. Next, - * we begin to discard Symbols in attempt to get past the point of error - * to a point where we can continue parsing. After each Symbol, we attempt - * to "parse ahead" though the buffered lookahead Symbols. The "parse ahead" - * process simulates that actual parse, but does not modify the real - * parser's configuration, nor execute any actions. If we can parse all - * the stored Symbols without error, then the recovery is considered a - * success. Once a successful recovery point is determined, we do an - * actual parse over the stored input -- modifying the real parse - * configuration and executing all actions. Finally, we return the the - * normal parser to continue with the overall parse. - * - * @param debug should we produce debugging messages as we parse. - */ - protected boolean error_recovery(boolean debug) - throws java.lang.Exception - { - if (debug) debug_message("# Attempting error recovery"); - - /* first pop the stack back into a state that can shift on error and - do that shift (if that fails, we fail) */ - if (!find_recovery_config(debug)) - { - if (debug) debug_message("# Error recovery fails"); - return false; - } - - /* read ahead to create lookahead we can parse multiple times */ - read_lookahead(); - - /* repeatedly try to parse forward until we make it the required dist */ - for (;;) - { - /* try to parse forward, if it makes it, bail out of loop */ - if (debug) debug_message("# Trying to parse ahead"); - if (try_parse_ahead(debug)) - { - break; - } - - /* if we are now at EOF, we have failed */ - if (lookahead[0].sym == EOF_sym()) - { - if (debug) debug_message("# Error recovery fails at EOF"); - return false; - } - - /* otherwise, we consume another Symbol and try again */ - // BUG FIX by Bruce Hutton - // Computer Science Department, University of Auckland, - // Auckland, New Zealand. - // It is the first token that is being consumed, not the one - // we were up to parsing - if (debug) - debug_message("# Consuming Symbol #" + lookahead[ 0 ].sym); - restart_lookahead(); - } - - /* we have consumed to a point where we can parse forward */ - if (debug) debug_message("# Parse-ahead ok, going back to normal parse"); - - /* do the real parse (including actions) across the lookahead */ - parse_lookahead(debug); - - /* we have success */ - return true; - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Determine if we can shift under the special error Symbol out of the - * state currently on the top of the (real) parse stack. - */ - protected boolean shift_under_error() - { - /* is there a shift under error Symbol */ - return get_action(((Symbol)stack.peek()).parse_state, error_sym()) > 0; - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Put the (real) parse stack into error recovery configuration by - * popping the stack down to a state that can shift on the special - * error Symbol, then doing the shift. If no suitable state exists on - * the stack we return false - * - * @param debug should we produce debugging messages as we parse. - */ - protected boolean find_recovery_config(boolean debug) - { - Symbol error_token; - int act; - - if (debug) debug_message("# Finding recovery state on stack"); - - /* Remember the right-position of the top symbol on the stack */ - int right_pos = ((Symbol)stack.peek()).right; - int left_pos = ((Symbol)stack.peek()).left; - - /* pop down until we can shift under error Symbol */ - while (!shift_under_error()) - { - /* pop the stack */ - if (debug) - debug_message("# Pop stack by one, state was # " + - ((Symbol)stack.peek()).parse_state); - left_pos = ((Symbol)stack.pop()).left; - tos--; - - /* if we have hit bottom, we fail */ - if (stack.empty()) - { - if (debug) debug_message("# No recovery state found on stack"); - return false; - } - } - - /* state on top of the stack can shift under error, find the shift */ - act = get_action(((Symbol)stack.peek()).parse_state, error_sym()); - if (debug) - { - debug_message("# Recover state found (#" + - ((Symbol)stack.peek()).parse_state + ")"); - debug_message("# Shifting on error to state #" + (act-1)); - } - - /* build and shift a special error Symbol */ - error_token = new Symbol(error_sym(), left_pos, right_pos); - error_token.parse_state = act-1; - error_token.used_by_parser = true; - stack.push(error_token); - tos++; - - return true; - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Lookahead Symbols used for attempting error recovery "parse aheads". */ - protected Symbol lookahead[]; - - /** Position in lookahead input buffer used for "parse ahead". */ - protected int lookahead_pos; - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Read from input to establish our buffer of "parse ahead" lookahead - * Symbols. - */ - protected void read_lookahead() throws java.lang.Exception - { - /* create the lookahead array */ - lookahead = new Symbol[error_sync_size()]; - - /* fill in the array */ - for (int i = 0; i < error_sync_size(); i++) - { - lookahead[i] = cur_token; - cur_token = scan(); - } - - /* start at the beginning */ - lookahead_pos = 0; - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Return the current lookahead in our error "parse ahead" buffer. */ - protected Symbol cur_err_token() { return lookahead[lookahead_pos]; } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Advance to next "parse ahead" input Symbol. Return true if we have - * input to advance to, false otherwise. - */ - protected boolean advance_lookahead() - { - /* advance the input location */ - lookahead_pos++; - - /* return true if we didn't go off the end */ - return lookahead_pos < error_sync_size(); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Reset the parse ahead input to one Symbol past where we started error - * recovery (this consumes one new Symbol from the real input). - */ - protected void restart_lookahead() throws java.lang.Exception - { - /* move all the existing input over */ - for (int i = 1; i < error_sync_size(); i++) - lookahead[i-1] = lookahead[i]; - - /* read a new Symbol into the last spot */ - // BUG Fix by Bruce Hutton - // Computer Science Department, University of Auckland, - // Auckland, New Zealand. [applied 5-sep-1999 by csa] - // The following two lines were out of order!! - lookahead[error_sync_size()-1] = cur_token; - cur_token = scan(); - - /* reset our internal position marker */ - lookahead_pos = 0; - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Do a simulated parse forward (a "parse ahead") from the current - * stack configuration using stored lookahead input and a virtual parse - * stack. Return true if we make it all the way through the stored - * lookahead input without error. This basically simulates the action of - * parse() using only our saved "parse ahead" input, and not executing any - * actions. - * - * @param debug should we produce debugging messages as we parse. - */ - protected boolean try_parse_ahead(boolean debug) - throws java.lang.Exception - { - int act; - short lhs, rhs_size; - - /* create a virtual stack from the real parse stack */ - virtual_parse_stack vstack = new virtual_parse_stack(stack); - - /* parse until we fail or get past the lookahead input */ - for (;;) - { - /* look up the action from the current state (on top of stack) */ - act = get_action(vstack.top(), cur_err_token().sym); - - /* if its an error, we fail */ - if (act == 0) return false; - - /* > 0 encodes a shift */ - if (act > 0) - { - /* push the new state on the stack */ - vstack.push(act-1); - - if (debug) debug_message("# Parse-ahead shifts Symbol #" + - cur_err_token().sym + " into state #" + (act-1)); - - /* advance simulated input, if we run off the end, we are done */ - if (!advance_lookahead()) return true; - } - /* < 0 encodes a reduce */ - else - { - /* if this is a reduce with the start production we are done */ - if ((-act)-1 == start_production()) - { - if (debug) debug_message("# Parse-ahead accepts"); - return true; - } - - /* get the lhs Symbol and the rhs size */ - lhs = production_tab[(-act)-1][0]; - rhs_size = production_tab[(-act)-1][1]; - - /* pop handle off the stack */ - for (int i = 0; i < rhs_size; i++) - vstack.pop(); - - if (debug) - debug_message("# Parse-ahead reduces: handle size = " + - rhs_size + " lhs = #" + lhs + " from state #" + vstack.top()); - - /* look up goto and push it onto the stack */ - vstack.push(get_reduce(vstack.top(), lhs)); - if (debug) - debug_message("# Goto state #" + vstack.top()); - } - } - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Parse forward using stored lookahead Symbols. In this case we have - * already verified that parsing will make it through the stored lookahead - * Symbols and we are now getting back to the point at which we can hand - * control back to the normal parser. Consequently, this version of the - * parser performs all actions and modifies the real parse configuration. - * This returns once we have consumed all the stored input or we accept. - * - * @param debug should we produce debugging messages as we parse. - */ - protected void parse_lookahead(boolean debug) - throws java.lang.Exception - { - /* the current action code */ - int act; - - /* the Symbol/stack element returned by a reduce */ - Symbol lhs_sym = null; - - /* information about production being reduced with */ - short handle_size, lhs_sym_num; - - /* restart the saved input at the beginning */ - lookahead_pos = 0; - - if (debug) - { - debug_message("# Reparsing saved input with actions"); - debug_message("# Current Symbol is #" + cur_err_token().sym); - debug_message("# Current state is #" + - ((Symbol)stack.peek()).parse_state); - } - - /* continue until we accept or have read all lookahead input */ - while(!_done_parsing) - { - /* current state is always on the top of the stack */ - - /* look up action out of the current state with the current input */ - act = - get_action(((Symbol)stack.peek()).parse_state, cur_err_token().sym); - - /* decode the action -- > 0 encodes shift */ - if (act > 0) - { - /* shift to the encoded state by pushing it on the stack */ - cur_err_token().parse_state = act-1; - cur_err_token().used_by_parser = true; - if (debug) debug_shift(cur_err_token()); - stack.push(cur_err_token()); - tos++; - - /* advance to the next Symbol, if there is none, we are done */ - if (!advance_lookahead()) - { - if (debug) debug_message("# Completed reparse"); - - /* scan next Symbol so we can continue parse */ - // BUGFIX by Chris Harris : - // correct a one-off error by commenting out - // this next line. - /*cur_token = scan();*/ - - /* go back to normal parser */ - return; - } - - if (debug) - debug_message("# Current Symbol is #" + cur_err_token().sym); - } - /* if its less than zero, then it encodes a reduce action */ - else if (act < 0) - { - /* perform the action for the reduce */ - lhs_sym = do_action((-act)-1, this, stack, tos); - - /* look up information about the production */ - lhs_sym_num = production_tab[(-act)-1][0]; - handle_size = production_tab[(-act)-1][1]; - - if (debug) debug_reduce((-act)-1, lhs_sym_num, handle_size); - - /* pop the handle off the stack */ - for (int i = 0; i < handle_size; i++) - { - stack.pop(); - tos--; - } - - /* look up the state to go to from the one popped back to */ - act = get_reduce(((Symbol)stack.peek()).parse_state, lhs_sym_num); - - /* shift to that state */ - lhs_sym.parse_state = act; - lhs_sym.used_by_parser = true; - stack.push(lhs_sym); - tos++; - - if (debug) debug_message("# Goto state #" + act); - - } - /* finally if the entry is zero, we have an error - (shouldn't happen here, but...)*/ - else if (act == 0) - { - report_fatal_error("Syntax error", lhs_sym); - return; - } - } - - - } - - /*-----------------------------------------------------------*/ - - /** Utility function: unpacks parse tables from strings */ - protected static short[][] unpackFromStrings(String[] sa) - { - // Concatanate initialization strings. - StringBuffer sb = new StringBuffer(sa[0]); - for (int i=1; i&T$Y#wix3brOH@-JdMZWHFY-cpjZNtD_5l@#Q%d=X1Eg=S9B0l*45< zu4FNh#iW29O52@pD7*T%K=0HOd&w?G%5lpxd^IkRj~zVuR0)WRKxQd%&YX2TN1YSs zFKh}c-WAX;`-@Vbd&=?TbW~rE;T?Oyr5k^g9 zdZ3=g);*HS4`Q9trvuitAZk3OqflXQea4T%s+@Efebnn<0~K5s7+}}=Y7~^i$Wu;TmS>*T7kuKNw_PHaRgJN&8qFXa?$iXGbVFm%{MV^;1-GkCw~D$Oq)EJt>Z0B z3mn|k!xrod^t2ngweUn%X_a;)OA`-bMum=78;`f9;rv5W%u83+rKc{&u9aeI!(!(a z0&V8D^$9DAIP@c6;lMy$l|<{)-r)Eqoav!|3Q1t zYGP`O{B5xb<1;#^tT{5Yhg`xka%6SPvPiyIbuS$ diff --git a/Robust/cup/java_cup/runtime/virtual_parse_stack.java b/Robust/cup/java_cup/runtime/virtual_parse_stack.java deleted file mode 100644 index a4386aad..00000000 --- a/Robust/cup/java_cup/runtime/virtual_parse_stack.java +++ /dev/null @@ -1,145 +0,0 @@ - -package java_cup.runtime; - -import java.util.Stack; - -/** This class implements a temporary or "virtual" parse stack that - * replaces the top portion of the actual parse stack (the part that - * has been changed by some set of operations) while maintaining its - * original contents. This data structure is used when the parse needs - * to "parse ahead" to determine if a given error recovery attempt will - * allow the parse to continue far enough to consider it successful. Once - * success or failure of parse ahead is determined the system then - * reverts to the original parse stack (which has not actually been - * modified). Since parse ahead does not execute actions, only parse - * state is maintained on the virtual stack, not full Symbol objects. - * - * @see java_cup.runtime.lr_parser - * @version last updated: 7/3/96 - * @author Frank Flannery - */ - -public class virtual_parse_stack { - /*-----------------------------------------------------------*/ - /*--- Constructor(s) ----------------------------------------*/ - /*-----------------------------------------------------------*/ - - /** Constructor to build a virtual stack out of a real stack. */ - public virtual_parse_stack(Stack shadowing_stack) throws java.lang.Exception - { - /* sanity check */ - if (shadowing_stack == null) - throw new Exception( - "Internal parser error: attempt to create null virtual stack"); - - /* set up our internals */ - real_stack = shadowing_stack; - vstack = new Stack(); - real_next = 0; - - /* get one element onto the virtual portion of the stack */ - get_from_real(); - } - - /*-----------------------------------------------------------*/ - /*--- (Access to) Instance Variables ------------------------*/ - /*-----------------------------------------------------------*/ - - /** The real stack that we shadow. This is accessed when we move off - * the bottom of the virtual portion of the stack, but is always left - * unmodified. - */ - protected Stack real_stack; - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Top of stack indicator for where we leave off in the real stack. - * This is measured from top of stack, so 0 would indicate that no - * elements have been "moved" from the real to virtual stack. - */ - protected int real_next; - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** The virtual top portion of the stack. This stack contains Integer - * objects with state numbers. This stack shadows the top portion - * of the real stack within the area that has been modified (via operations - * on the virtual stack). When this portion of the stack becomes empty we - * transfer elements from the underlying stack onto this stack. - */ - protected Stack vstack; - - /*-----------------------------------------------------------*/ - /*--- General Methods ---------------------------------------*/ - /*-----------------------------------------------------------*/ - - /** Transfer an element from the real to the virtual stack. This assumes - * that the virtual stack is currently empty. - */ - protected void get_from_real() - { - Symbol stack_sym; - - /* don't transfer if the real stack is empty */ - if (real_next >= real_stack.size()) return; - - /* get a copy of the first Symbol we have not transfered */ - stack_sym = (Symbol)real_stack.elementAt(real_stack.size()-1-real_next); - - /* record the transfer */ - real_next++; - - /* put the state number from the Symbol onto the virtual stack */ - vstack.push(new Integer(stack_sym.parse_state)); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Indicate whether the stack is empty. */ - public boolean empty() - { - /* if vstack is empty then we were unable to transfer onto it and - the whole thing is empty. */ - return vstack.empty(); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Return value on the top of the stack (without popping it). */ - public int top() throws java.lang.Exception - { - if (vstack.empty()) - throw new Exception( - "Internal parser error: top() called on empty virtual stack"); - - return ((Integer)vstack.peek()).intValue(); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Pop the stack. */ - public void pop() throws java.lang.Exception - { - if (vstack.empty()) - throw new Exception( - "Internal parser error: pop from empty virtual stack"); - - /* pop it */ - vstack.pop(); - - /* if we are now empty transfer an element (if there is one) */ - if (vstack.empty()) - get_from_real(); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Push a state number onto the stack. */ - public void push(int state_num) - { - vstack.push(new Integer(state_num)); - } - - /*-----------------------------------------------------------*/ - -} diff --git a/Robust/cup/java_cup/shift_action.class b/Robust/cup/java_cup/shift_action.class deleted file mode 100644 index db961ff119752747064ee7c4a8dbacf513b942a2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1199 zcmZuvTTj$b5dO|yXsLyTg=JSRQg67sb-9V60^%hSNC-YaOz>q>mLn8PyLQhS{)&G< zUwF_&mqZdTFPiwHjC0xwb+ZqhGiN&AH*>z3-+#V*1u%nU4OvVmxS^t`A%Rji6qGeG zrh=RDtZ10Tl!9pu8YWcC$a7W(Z%J=X#cg@sQ83TYU2W{!FGW>&47v3K>y1^dHS1H3 z<@nWxumoRV=vuU0TRdPW6gy^=o-?GLc)Oe-vu?Y5qj|W){Vi+9p@{bMsK)EU_S^=8 zdR{DFEOjI!s#mtV%aAOV)~Ggr-LxEn4##STELKgjE|gwS=iyIk+ufUbwsXL1B8aQ| zR%1WxOcmay@NIXGVK6EkriW2_rnc!d{Tg4fW!wGn8k15N9XZ@($e(FsyMp_!qM$h@i6(G;98V@)mm8{0^lB^*Dy>B_)7G(q{>M zSSBRxON5s^vPD&vY@xfo+A95}&4{w+11*5@Q)t^KxRBLb=n0X%Eo8ENbZw!(U6l=j KU!x)kT>lHxJofVd diff --git a/Robust/cup/java_cup/shift_action.java b/Robust/cup/java_cup/shift_action.java deleted file mode 100644 index 33fc17a6..00000000 --- a/Robust/cup/java_cup/shift_action.java +++ /dev/null @@ -1,82 +0,0 @@ - -package java_cup; - -/** This class represents a shift action within the parse table. - * The action simply stores the state that it shifts to and responds - * to queries about its type. - * - * @version last updated: 11/25/95 - * @author Scott Hudson - */ -public class shift_action extends parse_action { - - /*-----------------------------------------------------------*/ - /*--- Constructor(s) ----------------------------------------*/ - /*-----------------------------------------------------------*/ - - /** Simple constructor. - * @param shft_to the state that this action shifts to. - */ - public shift_action(lalr_state shft_to) throws internal_error - { - /* sanity check */ - if (shft_to == null) - throw new internal_error( - "Attempt to create a shift_action to a null state"); - - _shift_to = shft_to; - } - - /*-----------------------------------------------------------*/ - /*--- (Access to) Instance Variables ------------------------*/ - /*-----------------------------------------------------------*/ - - /** The state we shift to. */ - protected lalr_state _shift_to; - - /** The state we shift to. */ - public lalr_state shift_to() {return _shift_to;} - - /*-----------------------------------------------------------*/ - /*--- General Methods ---------------------------------------*/ - /*-----------------------------------------------------------*/ - - /** Quick access to type of action. */ - public int kind() {return SHIFT;} - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Equality test. */ - public boolean equals(shift_action other) - { - return other != null && other.shift_to() == shift_to(); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Generic equality test. */ - public boolean equals(Object other) - { - if (other instanceof shift_action) - return equals((shift_action)other); - else - return false; - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Compute a hash code. */ - public int hashCode() - { - /* use the hash code of the state we are shifting to */ - return shift_to().hashCode(); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Convert to a string. */ - public String toString() {return "SHIFT(to state " + shift_to().index() + ")";} - - /*-----------------------------------------------------------*/ - -} diff --git a/Robust/cup/java_cup/simple_calc/CUP$parser$actions.class b/Robust/cup/java_cup/simple_calc/CUP$parser$actions.class deleted file mode 100644 index 5758ef55c0b89f02bfa7a235f024ab20cdbd8279..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4656 zcmdT{eQ;b=760A$wb{+Kv}sdFzu1PP-K0%J1BMbPO21%B0);ebBaP{1^OA16dAn}j z1_~`WI(`f@4zW7UpeRg11gwr9G*LpeN@=lE>{tbLm{F`>DC1Nj)p1}LfA_t&``#L% zj`{~=a(C}N_nhB3_nhB7``(E+pZqRVG-0p6vR%p1WM8U~YaU4t=Q3trDw#<&uj|@e zmrLeH%zRxkWv8>&NC-k;mQ-%eB(0(5oBDT|DLVvJpsM{}#a9U|a)i@>T~O}V`1|>S zWv7SD=FUCC{n-rn7Ea&Gw*vy#2re$AiN3j6&i_~#K z?Iv-u`4ARGuow#kE-X>7Jme5!0wO{08FP?0m!LL`C8!h7^XZ|Tlq_{6%P1L5W(sB$ z4bY`dqrhzcfL<{}Si#E06A3q`Wf3=Yvlv&Wt+ahj6wO!}A;_f^-Lj#xt9=Xcd7eR= z0@HELxR?$#-oWT8SkP|Q`xR)7@LH{A$jnQ(L~4@)CPcS90ILXKNwih2G-R&w#EQ8} z%3F%^mXf@M4zmTGdLw2P^Xc&2WmyQCoy)^!@i z`_UtHZ{GU36@+bz;AuxX$VM|vsgq;zjF(hzV!lH-tK+L_%G0V9&vB7M?8i=JW{@Z5W zN@ikC3y9hBqE%qGG5Tk+yfZ8p+nl>597i}#ar~0w&m3>iqLSl6 zju^*Ejw`Sp_u@K?VJkj`A?(K;_%!aqXYdF(v~=kR;=CHz5s z4KHg8@h9zKoYiXa7p(=aYHKm2b>Xj?iPy9O&S{^(-?aPjckL+tp&iGY+6g|2yeNeB zicqxIg{oHyOqRyxm^+vr|YBY#t#?7M9=n~6~ZQ@enR?%X7L|krsOsobgq&&;2tj7+t z@Oi`Fycd_DmQN&G(Sgf3t6;U(;62<8vrZXL?;s!WT)n5zP^O9~Gci7VY|=?RRwdU`uXTs?g|Ql4IhuPIJd^`m^Vbnx^kdUI#z z_+pZhbu)Bq!ho!sQH?g3^cyy|6)o_H{zqiVDxJ@?_aa9<;mkfreksl@PkyP+Y=pZS zXJfFzKH|)Z7Go${jG<^T#;6?&zBUwy%V%o7A1V?Tk;Vz!*0}r-_Q+1wVE_OC diff --git a/Robust/cup/java_cup/simple_calc/Main.class b/Robust/cup/java_cup/simple_calc/Main.class deleted file mode 100644 index aa2cc953b3242ed80c8ad75a8df230db4c62f029..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1119 zcmZuw+fEZv6kUf-nNkKy3oVp#6TGxV7!|Kb@PTMzLg4{Jf<83UVN!=oXPW8M=%@Gv z;FCcUNhHyCKgzhyOj|BCCq4Vj-s|kW*V?Cl{{H-h7*_C1Ab(_hFsf#|skiJ#)3K_i z;h1{Guw4~GU`&Q}$8hWVZtci20~IlW%=UHn^Q+Fiz_;Bxo!JO!d;06$mmf{58Q7jn z|7__0uWr-uTb9rGT>p5>G+Z|X(#K1 zfOspQG{{vTS9}+>8s6&kU)mQ)_A;~t#zWp$*{DcM@*aiTH+LS+rV-s-Sc@PG_1`oI2;`5=_wz0K(*HcThf zi#7JVwr^UmY&oYP`P^3}B`i=71pvWPAD&_u!YESokMT=kB!dZ_z9No6+85`TJUB=G z;0&{8SlAYoZ&>_{;pHDFR*sRNU9OxUdyE{`<0sILF|u=l_{#5f<%@z-CQhS_W&R!0 zSmOdcS?+UCxu>`?j7;#C<=k?Z#}qah9cQ%6hEiDNO0Y3`(vjqS5OE*(XxU)z#79Du zY<`Va(8kMWSUcq*Dj8i(Fli!8uSFm{!b4&bc-%{n4kJtu`;JAKKuY$6`v9K)1GXFp Ar~m)} diff --git a/Robust/cup/java_cup/simple_calc/Main.java b/Robust/cup/java_cup/simple_calc/Main.java deleted file mode 100644 index 21ff5aa5..00000000 --- a/Robust/cup/java_cup/simple_calc/Main.java +++ /dev/null @@ -1,32 +0,0 @@ -// Driver for parser - -package java_cup.simple_calc; - -import java_cup.simple_calc.parser; -import java_cup.runtime.Symbol; - -class Main { - - static boolean do_debug_parse = false; - - static public void main(String[] args) throws java.io.IOException { - - /* create a parsing object */ - parser parser_obj = new parser(new scanner()); - - /* open input files, etc. here */ - Symbol parse_tree = null; - - try { - if (do_debug_parse) - parse_tree = parser_obj.debug_parse(); - else - parse_tree = parser_obj.parse(); - } catch (Exception e) { - /* do cleanup here -- possibly rethrow e */ - } finally { - /* do close out here */ - } - } -} - diff --git a/Robust/cup/java_cup/simple_calc/parser.class b/Robust/cup/java_cup/simple_calc/parser.class deleted file mode 100644 index 05da56abae021065d9961ff46f684cca0484316e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2711 zcmai0TUQ%Z6y9etlj{s5Tne2=glU~NByp0s>>F?X z0{?{%-V%}kg=Zi9EBphO-<~s>j7g}Ab#8lq``eeZ&xF7JX+Ng`Ez*~Qt~|;8kjv(4 z<#ff`FBi;gK3B-6%Q?GZ+948xE_(pGR;*h4X1ZW!JNkg2>CKA)%P{X(XY#pX(X^qQ z8lZf(zgsFmmvD6HTGc9~Gu2%FDP-ePR>&0}r`LYWo8_uiDng#>^7yk@{rbV2jC3xS zXJ`f35g$jUYFov}5Ki_9Z`U3@a$-zm%XVq6=GbSex!r;(D6q4W5oBZ~Ye#BiZ4*GV zbB?;|((V&M@qQL9nR0kWHcKe_R?fDV{VVB0T`ldw)9|KMH1E~+cTL+-=w#4PgcO<( zG&4ABnK6=5tKV4_LApOmorb0TG!*`Db&5;H%TQQFtLi2PfFm$Gg%fM@OgdbaWmJQ35jOE&MhDp#YV(nq*vUoE|S+$WUUV&un+ zyoIQcQ+Op`a0&}w-SlLmhv<%=J7)*R*?|&JF)2I+0+@mdCRM|vT{tmLV+&0S(>fka zaz_^5si6CoWJ@P%#WE_fZkP6@yrRcVuR$9Yd2b;MDJ zt2*MSBaS-as3VU0#b!MWZ7{UK&;~;r3~ey9!O&&~PPGL<3xE~?EdW{ov;b&z0LK6v z18^)egX*}WI)ds5sv}Qz)KN8|YC_cnZ451ou8h- z@C4O8L3K}9$bmM%*npw|#s(N0U~GV~A(Sv}3i?^zX&|I(T2KfOYg4=^-lPU6cpp^9 zJAg=6r;YJm)kb}y5h+T@CGKgul>fU6(>+1aOsQt)&2@`E-7)!Am-ubaEBM-|L>SZj zUBzyizmLv}&!MBiM+vJ=_~oEc%;PvMVHK?XohE<9s?a6OK}R-AW7spEc`wrxR{YEk zvYqL*y*1GGr9rl{y|xbr*s93zD!g;d%ZP?!GUktHZhQWal69K@4FVZ_6f4m-0{_NG zWOxZ&rv)Gufnl1oL-`YF_+!dHY5vN>;<(zNw|e6;9lCER0-#Rs(A!QFI=u^1cB#{Q z6vlreyn7#7zK@Pu-gPVt&%*F54A(-?2lSzv=K@yFQwjXSv+rgsUt)@v*o}Tmwb%0L zK+ENR%RZmQftD-%mVG|IA83i61vgKwBj>5%DsT4QV*+JN_y{yFUHn?O1UFF}zJTET z^+WokmthRoGv+W{k|>vf+x)iE>S0>-g1O;b8y<#wLTlTBkxw&C`uq=?bdO)ireduce_goto table. */ - protected static final short[][] _reduce_table = - unpackFromStrings(new String[] { - "\000\030\000\010\003\007\004\005\005\006\001\001\000" + - "\004\005\031\001\001\000\002\001\001\000\002\001\001" + - "\000\004\006\027\001\001\000\006\004\025\005\006\001" + - "\001\000\004\005\011\001\001\000\002\001\001\000\004" + - "\005\024\001\001\000\004\005\023\001\001\000\002\001" + - "\001\000\004\005\022\001\001\000\004\005\021\001\001" + - "\000\004\005\020\001\001\000\002\001\001\000\002\001" + - "\001\000\002\001\001\000\002\001\001\000\002\001\001" + - "\000\002\001\001\000\002\001\001\000\002\001\001\000" + - "\002\001\001\000\002\001\001" }); - - /** Access to reduce_goto table. */ - public short[][] reduce_table() {return _reduce_table;} - - /** Instance of action encapsulation class. */ - protected CUP$parser$actions action_obj; - - /** Action encapsulation object initializer. */ - protected void init_actions() - { - action_obj = new CUP$parser$actions(this); - } - - /** Invoke a user supplied parse action. */ - public java_cup.runtime.Symbol do_action( - int act_num, - java_cup.runtime.lr_parser parser, - java.util.Stack stack, - int top) - throws java.lang.Exception - { - /* call code in generated class */ - return action_obj.CUP$parser$do_action(act_num, parser, stack, top); - } - - /** Indicates start state. */ - public int start_state() {return 0;} - /** Indicates start production. */ - public int start_production() {return 1;} - - /** EOF Symbol index. */ - public int EOF_sym() {return 0;} - - /** error Symbol index. */ - public int error_sym() {return 1;} - -} - -/** Cup generated class to encapsulate user supplied action code.*/ -class CUP$parser$actions { - private final parser parser; - - /** Constructor */ - CUP$parser$actions(parser parser) { - this.parser = parser; - } - - /** Method with the actual generated action code. */ - public final java_cup.runtime.Symbol CUP$parser$do_action( - int CUP$parser$act_num, - java_cup.runtime.lr_parser CUP$parser$parser, - java.util.Stack CUP$parser$stack, - int CUP$parser$top) - throws java.lang.Exception - { - /* Symbol object for return from actions */ - java_cup.runtime.Symbol CUP$parser$result; - - /* select the action based on the action number */ - switch (CUP$parser$act_num) - { - /*. . . . . . . . . . . . . . . . . . . .*/ - case 12: // expr ::= LPAREN expr RPAREN - { - Integer RESULT = null; - int eleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left; - int eright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right; - Integer e = (Integer)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value; - RESULT = e; - CUP$parser$result = new java_cup.runtime.Symbol(3/*expr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); - } - return CUP$parser$result; - - /*. . . . . . . . . . . . . . . . . . . .*/ - case 11: // expr ::= MINUS expr - { - Integer RESULT = null; - int eleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; - int eright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; - Integer e = (Integer)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; - RESULT = new Integer(0 - e.intValue()); - CUP$parser$result = new java_cup.runtime.Symbol(3/*expr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); - } - return CUP$parser$result; - - /*. . . . . . . . . . . . . . . . . . . .*/ - case 10: // expr ::= NUMBER - { - Integer RESULT = null; - int nleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; - int nright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; - Integer n = (Integer)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; - RESULT = n; - CUP$parser$result = new java_cup.runtime.Symbol(3/*expr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); - } - return CUP$parser$result; - - /*. . . . . . . . . . . . . . . . . . . .*/ - case 9: // expr ::= expr MOD expr - { - Integer RESULT = null; - int e1left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left; - int e1right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right; - Integer e1 = (Integer)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; - int e2left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; - int e2right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; - Integer e2 = (Integer)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; - RESULT = new Integer(e1.intValue() % e2.intValue()); - CUP$parser$result = new java_cup.runtime.Symbol(3/*expr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); - } - return CUP$parser$result; - - /*. . . . . . . . . . . . . . . . . . . .*/ - case 8: // expr ::= expr DIVIDE expr - { - Integer RESULT = null; - int e1left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left; - int e1right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right; - Integer e1 = (Integer)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; - int e2left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; - int e2right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; - Integer e2 = (Integer)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; - RESULT = new Integer(e1.intValue() / e2.intValue()); - CUP$parser$result = new java_cup.runtime.Symbol(3/*expr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); - } - return CUP$parser$result; - - /*. . . . . . . . . . . . . . . . . . . .*/ - case 7: // expr ::= expr TIMES expr - { - Integer RESULT = null; - int e1left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left; - int e1right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right; - Integer e1 = (Integer)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; - int e2left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; - int e2right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; - Integer e2 = (Integer)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; - RESULT = new Integer(e1.intValue() * e2.intValue()); - CUP$parser$result = new java_cup.runtime.Symbol(3/*expr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); - } - return CUP$parser$result; - - /*. . . . . . . . . . . . . . . . . . . .*/ - case 6: // expr ::= expr MINUS expr - { - Integer RESULT = null; - int e1left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left; - int e1right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right; - Integer e1 = (Integer)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; - int e2left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; - int e2right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; - Integer e2 = (Integer)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; - RESULT = new Integer(e1.intValue() - e2.intValue()); - CUP$parser$result = new java_cup.runtime.Symbol(3/*expr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); - } - return CUP$parser$result; - - /*. . . . . . . . . . . . . . . . . . . .*/ - case 5: // expr ::= expr PLUS expr - { - Integer RESULT = null; - int e1left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left; - int e1right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right; - Integer e1 = (Integer)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; - int e2left = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; - int e2right = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; - Integer e2 = (Integer)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; - RESULT = new Integer(e1.intValue() + e2.intValue()); - CUP$parser$result = new java_cup.runtime.Symbol(3/*expr*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); - } - return CUP$parser$result; - - /*. . . . . . . . . . . . . . . . . . . .*/ - case 4: // expr_part ::= expr NT$0 SEMI - { - Object RESULT = null; - // propagate RESULT from NT$0 - if ( ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value != null ) - RESULT = (Object) ((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value; - int eleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left; - int eright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).right; - Integer e = (Integer)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-2)).value; - - CUP$parser$result = new java_cup.runtime.Symbol(2/*expr_part*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-2)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); - } - return CUP$parser$result; - - /*. . . . . . . . . . . . . . . . . . . .*/ - case 3: // NT$0 ::= - { - Object RESULT = null; - int eleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left; - int eright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right; - Integer e = (Integer)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-0)).value; - System.out.println("= " + e); - CUP$parser$result = new java_cup.runtime.Symbol(4/*NT$0*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); - } - return CUP$parser$result; - - /*. . . . . . . . . . . . . . . . . . . .*/ - case 2: // expr_list ::= expr_part - { - Object RESULT = null; - - CUP$parser$result = new java_cup.runtime.Symbol(1/*expr_list*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); - } - return CUP$parser$result; - - /*. . . . . . . . . . . . . . . . . . . .*/ - case 1: // $START ::= expr_list EOF - { - Object RESULT = null; - int start_valleft = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left; - int start_valright = ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).right; - Object start_val = (Object)((java_cup.runtime.Symbol) CUP$parser$stack.elementAt(CUP$parser$top-1)).value; - RESULT = start_val; - CUP$parser$result = new java_cup.runtime.Symbol(0/*$START*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); - } - /* ACCEPT */ - CUP$parser$parser.done_parsing(); - return CUP$parser$result; - - /*. . . . . . . . . . . . . . . . . . . .*/ - case 0: // expr_list ::= expr_list expr_part - { - Object RESULT = null; - - CUP$parser$result = new java_cup.runtime.Symbol(1/*expr_list*/, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-1)).left, ((java_cup.runtime.Symbol)CUP$parser$stack.elementAt(CUP$parser$top-0)).right, RESULT); - } - return CUP$parser$result; - - /* . . . . . .*/ - default: - throw new Exception( - "Invalid action number found in internal parse table"); - - } - } -} - diff --git a/Robust/cup/java_cup/simple_calc/scanner.class b/Robust/cup/java_cup/simple_calc/scanner.class deleted file mode 100644 index b24ff03b40a6b8a0c70e83e9f4b36fa4fab57391..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1922 zcmd5-OK%fb6#kAMOzaG0cm#q?X?T>_1~N%ZNP`V6rJ-1gnuSXwB&0BQMr5cxj_h$n zDs|OG7hQGHMK^t@NRcX43Kd|fkyx>)y5KkTmxO+I#@J)SqRU$PeD68;ydU=8dw)Jh z6c=$zaN>crX{}b<8)nO?Z`AD7s#U9+t*Yg^c2k203?*UKEcd>-TzOzuJq=O8cu%j{ zc0H$Vo8{L!alxUbVWol~LpppM3pAXDS#mepUfFBfR(+7ay!fzcZ+K3_CI9$a zjBV8`jT+y=-pgAp&sK&)-Ul+>Qjdp2@s?cAzHc|l9dX>2ABP~}+7G?e>blhwNJ*es zYnzr^wFS{kc14iv#nz%VKY5i(KV%JKDzFC2yJ9sRt5UN+S6_nIjm8>}151u;f7Y&7 z?56*q;{Xx~M3C}*&}WP#S<~?@PJ~_btEJ(+BqnfDhk=7i^R(b(zf1#J2fbpBF>l>r z$T7!tJROH{I7!7xCgdmVHNLQ2K{}J|+v)W#D7TJtfzo+F+*#eUYJy{L4u>zSVM=hY zKN{UqYnWyPnUX5xzM_icnvOhXlbFFJ!O=`9)Sh4l3)vMVaybbT^Ic&R3!KYLAUiZj zfjEVB{9gOpKg&g6j=W7AlWNc@Qy`Q1wI=HYc z&lUX}eE_oaiXUDIyl*S|e~7O_F@4MX4@8By)#cyro(-O{{|J?5AzDlu$#uUv(`)yN zs^S6h3md9xw(#iHKf5sR7^AzGxs&c-u7eMDl$_$mJGjy#_Js*8OpJsHV?fRr5Hu14 zl1W7=Khf9hZA7>C7TK*}yne(a?-Lx<3GC J)QaHKe*teUdcgny diff --git a/Robust/cup/java_cup/simple_calc/scanner.java b/Robust/cup/java_cup/simple_calc/scanner.java deleted file mode 100644 index f8f850ac..00000000 --- a/Robust/cup/java_cup/simple_calc/scanner.java +++ /dev/null @@ -1,63 +0,0 @@ -// Simple Example Scanner Class - -package java_cup.simple_calc; - -import java_cup.runtime.Symbol; - -public class scanner implements java_cup.runtime.Scanner { - final java.io.InputStream instream; - - public scanner(java.io.InputStream is) throws java.io.IOException { - instream = is; - } - public scanner() throws java.io.IOException { this(System.in); } - - /* single lookahead character */ - protected int next_char = -2; - - /* advance input by one character */ - protected void advance() - throws java.io.IOException - { next_char = instream.read(); } - - /* initialize the scanner */ - private void init() - throws java.io.IOException - { advance(); } - - /* recognize and return the next complete token */ - public Symbol next_token() - throws java.io.IOException - { - if (next_char==-2) init(); // set stuff up first time we are called. - for (;;) - switch (next_char) - { - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': - /* parse a decimal integer */ - int i_val = 0; - do { - i_val = i_val * 10 + (next_char - '0'); - advance(); - } while (next_char >= '0' && next_char <= '9'); - return new Symbol(sym.NUMBER, new Integer(i_val)); - - case ';': advance(); return new Symbol(sym.SEMI); - case '+': advance(); return new Symbol(sym.PLUS); - case '-': advance(); return new Symbol(sym.MINUS); - case '*': advance(); return new Symbol(sym.TIMES); - case '/': advance(); return new Symbol(sym.DIVIDE); - case '%': advance(); return new Symbol(sym.MOD); - case '(': advance(); return new Symbol(sym.LPAREN); - case ')': advance(); return new Symbol(sym.RPAREN); - - case -1: return new Symbol(sym.EOF); - - default: - /* in this simple scanner we just ignore everything else */ - advance(); - break; - } - } -}; diff --git a/Robust/cup/java_cup/simple_calc/sym.class b/Robust/cup/java_cup/simple_calc/sym.class deleted file mode 100644 index 46aed76971068c8e31c44e72874afa26a4bfb52a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 668 zcmZwD*-FDe6b9gbnl`PmYTfsx?hD!rFBL&;gh10uw_8bL&`6p{nhHLaSArKlfDa}9 zQ$+^xB4_5yIn2yCAD?gU&~S(Yfw>3g$+>a+kENd9eGI%C*9qKG@41_W5GcrODR9EO zQmymgxk(n9z(nQm?-PM^!?Y~{VQBzT0wb4E*h`!+X*)sR6VS}sl}tfEFI#P^Y)a`= zwPjzJb*W*2j2FjIEWzvbmTgsA4XGSczep2J%Qgp@4C^Y_=XJ9x>xQWMuMFO6*UB=H zQanx1D4wO~6wlKOiWli6#mn@H;#Iy}$dNFvvxDP-fz19ZwqFJ< bZ7>>aO~y38B6oR~u?V}^;VQ7ln8N-S#V}s$ diff --git a/Robust/cup/java_cup/simple_calc/sym.java b/Robust/cup/java_cup/simple_calc/sym.java deleted file mode 100644 index 2584f2f0..00000000 --- a/Robust/cup/java_cup/simple_calc/sym.java +++ /dev/null @@ -1,25 +0,0 @@ - -//---------------------------------------------------- -// The following code was generated by CUP v0.10k -// Sun Jul 25 13:36:02 EDT 1999 -//---------------------------------------------------- - -package java_cup.simple_calc; - -/** CUP generated class containing symbol constants. */ -public class sym { - /* terminals */ - public static final int SEMI = 2; - public static final int EOF = 0; - public static final int DIVIDE = 6; - public static final int NUMBER = 11; - public static final int error = 1; - public static final int UMINUS = 8; - public static final int MINUS = 4; - public static final int TIMES = 5; - public static final int LPAREN = 9; - public static final int RPAREN = 10; - public static final int MOD = 7; - public static final int PLUS = 3; -} - diff --git a/Robust/cup/java_cup/sym.class b/Robust/cup/java_cup/sym.class deleted file mode 100644 index 97397bd85e853aab6ac28150fabea7f344c4ad5e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1111 zcmYk)S#J_i6bJBg*~?NWUFoKEZL1dRzSQb4TwpBB;LKPb3E;%gP%sos{8&Dj_}~Zd zLmB^PNX&V;bAI=pbJzLv_t$SCI;OKUMX8Y_D@pGaMQz7cq%1`_b3D45c1P3m?r;`F zk(*MK!LYC0mSr1F?%Glm^L)eQIM1Isc}e(QkcQ;JjZ0OBdw`x zKF6zyl5N90GwNYgL{Z#ynvTt5OUV0V`3;UUiV{|YnFmR;vrc93u~7!9VUDB3?b#{tao=Ri@uIT!`@?6Mb3{BCcE zp0qcfP5MD?z(`$vzdX9=e(PqbLMFDyai>4~TE>8)0<%2qj=q$g-bK)#(jG;S#(lyajIy@4&ml z*Wl~Id+-h6oA52++wdLXyYRm70emQY556z_06r2f!w-dz;YY%c;U~gR;b+3n;TOU$ z;a9@1;S=FE@Tu@y_?@tUmsR{vpsn%`7Mdu2_>?XwW6j7`K;Ny1H~iyFhE)|Kx)v z!zDiWYT_Sd{N7s<2#_Y{oZf!V=X~$!-+#Y;1GtZl2@7{hFmbntdqr%?vLQp$WN>8F zl2yBa?E-cL@^0h}0)a~R*!$vj`d)O@*-M6Dbo5Zbaz}~he|D486G}`s9R;o*r%@sx zUJ4j)7##**Sv(4(FnKJn)mX$Vo;2SJ=uhKAGFQ4`6ue0Xy-BkZWeGwxWIk6L z%|#%+%^EGu_{=q$bXtt!B#`z6c);=biE}F)xltUsNiZC!ZwC}7akc?s_u_Qu2hT(4 z%o?2zdU1b8F3Ls)8#Y!@762Ep+dB^Y#D6Qz0QpGdE#2;lmXJ&wb#xyiqZ4}Hsf!1m`4wn6VTKf8{athQMdl@auFap88{+Gm2e^b)(1lm~z znkj0QJ;P3M*XGh)-`vr&u0FD@?QOf132j**Vi(+Mn50YKLXAW+T_{;u{gJ^{HMy;F z5)ECMFHsnObUf9V#XJ2jaeTNi!J zBS=4>QyHj0s3)lZj=)ANSV7HCMg5A0d_eKBSrh)KsC&IVdR)Wz0i~slOqA zLMV8ssJ|eWQForb!D;6cNLZ#WJ*7xmPcMFi;+buSQbClnpFj#8K;~;1^&ihs+*;G* zO^fSAzwn|b+5H&Z-_fv9K_g)`mC@{C#L8$nx@d^Cl9knG4RR^IB8so6l^KHXCtCo@ EKjXbBF8}}l diff --git a/Robust/cup/java_cup/symbol_part.java b/Robust/cup/java_cup/symbol_part.java deleted file mode 100644 index 9142b5fc..00000000 --- a/Robust/cup/java_cup/symbol_part.java +++ /dev/null @@ -1,100 +0,0 @@ -package java_cup; - -/** This class represents a part of a production which is a symbol (terminal - * or non terminal). This simply maintains a reference to the symbol in - * question. - * - * @see java_cup.production - * @version last updated: 11/25/95 - * @author Scott Hudson - */ -public class symbol_part extends production_part { - - /*-----------------------------------------------------------*/ - /*--- Constructor(s) ----------------------------------------*/ - /*-----------------------------------------------------------*/ - - /** Full constructor. - * @param sym the symbol that this part is made up of. - * @param lab an optional label string for the part. - */ - public symbol_part(symbol sym, String lab) throws internal_error - { - super(lab); - - if (sym == null) - throw new internal_error( - "Attempt to construct a symbol_part with a null symbol"); - _the_symbol = sym; - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Constructor with no label. - * @param sym the symbol that this part is made up of. - */ - public symbol_part(symbol sym) throws internal_error - { - this(sym,null); - } - - /*-----------------------------------------------------------*/ - /*--- (Access to) Instance Variables ------------------------*/ - /*-----------------------------------------------------------*/ - - /** The symbol that this part is made up of. */ - protected symbol _the_symbol; - - /** The symbol that this part is made up of. */ - public symbol the_symbol() {return _the_symbol;} - - /*-----------------------------------------------------------*/ - /*--- General Methods ---------------------------------------*/ - /*-----------------------------------------------------------*/ - - /** Respond that we are not an action part. */ - public boolean is_action() { return false; } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Equality comparison. */ - public boolean equals(symbol_part other) - { - return other != null && super.equals(other) && - the_symbol().equals(other.the_symbol()); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Generic equality comparison. */ - public boolean equals(Object other) - { - if (!(other instanceof symbol_part)) - return false; - else - return equals((symbol_part)other); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Produce a hash code. */ - public int hashCode() - { - return super.hashCode() ^ - (the_symbol()==null ? 0 : the_symbol().hashCode()); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Convert to a string. */ - public String toString() - { - if (the_symbol() != null) - return super.toString() + the_symbol(); - else - return super.toString() + "$$MISSING-SYMBOL$$"; - } - - /*-----------------------------------------------------------*/ - -} diff --git a/Robust/cup/java_cup/symbol_set.class b/Robust/cup/java_cup/symbol_set.class deleted file mode 100644 index f26071a1cd2d99d8926c85b0d4d61e61c3f3675f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2612 zcmZ`)-*XdX6g``yO`0xkNogsi)F1`gBs7YsEonu-B84WEAA&_NZqub~O?E@FVfdjh zj^j9^ydAA|?bw4fIgL7D^N^I2gI3Nz`)p#TmC(SoTU)*>kmQ^Ik&70=;_ zFh~73CQgnE^Sp34A1wK! zn^gi7`mxw0({*ABoafXB*(}C zO`jKNjtW*u_9+Dj9y3aXjCw#5y0+KE92Omtu^odFIvaFL{7aRw729Nv-cA{3F)!mB zhGoR@h=lbb#%hqJn`%KJn)urv*qit1cg)5DY?Y)}fTF9KVWv4A}? zUcs1*9T@f_D1WaM#P#wZFhM#R}DcFQPM>sU23G7=(Y zTyU1IIK1t)+ZydFY1uiIU?xfuJh8Bhr?7|4uSw{zgmKLX2WoIqjA2tIYv@)F-Ksl- z#1^SpHK*$4>MlBMv4&q)as+6t4BTP$5?fyDglmo|2V0&r3hG1^mJ`iUXw}t=rgO+C z&zDRIBMrvJz8|ha5)El@YY^Jdu_;sF402YLd|uT#)H~dfl`36X>$FZ_GdIcrmm2jH zBgVH5zH=C9hxoOV=MtZx$TFnJ4R~fcT9@Iy4&PT+RD`w-UfM2tZsVHkvf`uMVj@1t zQxBh8ABc}c%V>&3zlN`j=9}=;L3X2wK^q;&K6GOfY4#(=Q$eVOf1FiXktEEgAQ^~Q zX#OwxEQ67tJXk&f-J??a@0}a|10iq2MxFe_UPt2!lqc z#O^wZyedx80fGn^Sx{uk(0 zmJzzPa^Jh;tAW|t9ioCsbRvZ*qhQ%*vvi7Mf$Ng7JMjA!;q%t;>`7T5UJfCyj~F8>?d0}wFopCYZ>SEljINWb zRliK6E1bDk>ySpO#hoUOk4U?`<92yeF}1@{F&yDrMaAxG@b_JH2#+tW-0iEewgr8Y zSZ~3Pw>jbOa6I0v%Q=e5#2=)eP-LK*vD&xJh^uew7gz4r>Iqpq-(x-RvuPi&X&=_% zb9XwElydO%am5=^}-fK4IP4t$rv8IOI!|PO{OzdwM$(8QJpK$aZ_KuNNTgp3L5qnc# z;A8Y`bSd8V`q&#DX>sMA3)|+%Wq@1cc$@p=7FGC}==>#ca(v?Cm=A55Vq4uE-OCR4 z-a!A%G9IE9;m~H9G9I236p2 e50d4I7B9T< z)=Td?(;M~9iwZ(!WXADIXZ%r)&)Hod#Ec^|IcN90=i@ogIqwdC{r&52050Rp2u88k zj9z>g!4Q^0_$Y+C5d^Uu#>b*R3FA}ID-i^+D&n5F-xu*f#6uA&5syN696=PHMfkEN zVo{Pl5s?mIU35kYu7r`5f&mSJWJ3=AsEDq0$vW(?D?Z)g}Fb4wI5WX}51|yr$uK5~Qq*Z4^x+ z4?JbBjZ3*f^{w`dB^w_!F)y*R=-4>fZ!yYgvuLJ;CCBziL)b35TxjSz#8k_WhPL`a zw$~Wk8Mc*`T{BsdKj!inp2-zF`U!#EM^=gzE2kC=A+z;xToW>To$Gx?M+|WtoA_MA zX|X!J8YVqC*0eWM=Oj@B^Jc{;Y$!`o+-4(ll~TdTWo$KkSYdcfM*-}*d3-o$DIRU; zcpo1~#8n+8ZtJ)NIu%7+5HT*|BH|i4oz-;8C5a^O7Ai^XTROhLlnx7J&+o)=bl8~X z>Oa;|!K^@d&bKx0Y=dprF@c1RNhG*=N4=M~x3WcE5Pzv+YnZCts^#pa%GtF`>{-0s zau9naUW81kq-3!!)#mUnLT!X=@+g&?l(Tptnc(o+1-NgVWmpx|mNIR2?$0ZN8?8_d<3pfwd(-$m;l+G5>-J+#LL_t3F}&I3eKv0uvsJvg3--?E^Um|garz!62JSI+9$nbx QCHxxa@eK>y5n_@22WgqTQvd(} diff --git a/Robust/cup/java_cup/terminal.java b/Robust/cup/java_cup/terminal.java deleted file mode 100644 index e1a40aa3..00000000 --- a/Robust/cup/java_cup/terminal.java +++ /dev/null @@ -1,169 +0,0 @@ -package java_cup; - -import java_cup.assoc; -import java.util.Hashtable; -import java.util.Enumeration; - -/** This class represents a terminal symbol in the grammar. Each terminal - * has a textual name, an index, and a string which indicates the type of - * object it will be implemented with at runtime (i.e. the class of object - * that will be returned by the scanner and pushed on the parse stack to - * represent it). - * - * @version last updated: 7/3/96 - * @author Frank Flannery - */ -public class terminal extends symbol { - - /*-----------------------------------------------------------*/ - /*--- Constructor(s) ----------------------------------------*/ - /*-----------------------------------------------------------*/ - - /** Full constructor. - * @param nm the name of the terminal. - * @param tp the type of the terminal. - */ - public terminal(String nm, String tp, int precedence_side, int precedence_num) - { - /* superclass does most of the work */ - super(nm, tp); - - /* add to set of all terminals and check for duplicates */ - Object conflict = _all.put(nm,this); - if (conflict != null) - // can't throw an execption here because this is used in static - // initializers, so we do a crash instead - // was: - // throw new internal_error("Duplicate terminal (" + nm + ") created"); - (new internal_error("Duplicate terminal (" + nm + ") created")).crash(); - - /* assign a unique index */ - _index = next_index++; - - /* set the precedence */ - _precedence_num = precedence_num; - _precedence_side = precedence_side; - - /* add to by_index set */ - _all_by_index.put(new Integer(_index), this); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Constructor for non-precedented terminal - */ - - public terminal(String nm, String tp) - { - this(nm, tp, assoc.no_prec, -1); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Constructor with default type. - * @param nm the name of the terminal. - */ - public terminal(String nm) - { - this(nm, null); - } - - /*-----------------------------------------------------------*/ - /*------------------- Class Variables ---------------------*/ - /*-----------------------------------------------------------*/ - - private int _precedence_num; - private int _precedence_side; - - /*-----------------------------------------------------------*/ - /*--- (Access to) Static (Class) Variables ------------------*/ - /*-----------------------------------------------------------*/ - - /** Table of all terminals. Elements are stored using name strings as - * the key - */ - protected static Hashtable _all = new Hashtable(); - - /** Access to all terminals. */ - public static Enumeration all() {return _all.elements();} - - /** Lookup a terminal by name string. */ - public static terminal find(String with_name) - { - if (with_name == null) - return null; - else - return (terminal)_all.get(with_name); - } - - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Table of all terminals indexed by their index number. */ - protected static Hashtable _all_by_index = new Hashtable(); - - /** Lookup a terminal by index. */ - public static terminal find(int indx) - { - Integer the_indx = new Integer(indx); - - return (terminal)_all_by_index.get(the_indx); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Total number of terminals. */ - public static int number() {return _all.size();} - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Static counter to assign unique index. */ - protected static int next_index = 0; - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Special terminal for end of input. */ - public static final terminal EOF = new terminal("EOF"); - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** special terminal used for error recovery */ - public static final terminal error = new terminal("error"); - - /*-----------------------------------------------------------*/ - /*--- General Methods ---------------------------------------*/ - /*-----------------------------------------------------------*/ - - /** Report this symbol as not being a non-terminal. */ - public boolean is_non_term() - { - return false; - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Convert to a string. */ - public String toString() - { - return super.toString() + "[" + index() + "]"; - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** get the precedence of a terminal */ - public int precedence_num() { - return _precedence_num; - } - public int precedence_side() { - return _precedence_side; - } - - /** set the precedence of a terminal */ - public void set_precedence(int p, int new_prec) { - _precedence_side = p; - _precedence_num = new_prec; - } - - /*-----------------------------------------------------------*/ - -} diff --git a/Robust/cup/java_cup/terminal_set.class b/Robust/cup/java_cup/terminal_set.class deleted file mode 100644 index fd0453e1d1d309ea5638fb6c7df5465d1e9f9539..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2459 zcmaJ>TWnNS6kWIT?DW#dz|aB(rl8VJ3nNd(wuptItu0gwXz?*lr>Et%GxrYDI|MZT z`C($B@smdV@TW00QBkJGMy)Z?#1D<18vm6TjWIF)scYYRJC6d+$3Az?*?X_G*WTxR z^Uo)r0oad11aTY>;h_iya3X>_oUBI-gAtlj^7r8o9tmS8f-r{Vsmz1k-o)NwcN(aD*P&Bers-PnWQ$t-(Tt_eZ zbXdsixP(52y|`9()vQpWTTs{$)0sa)A_tI*@L~+lfIV!mSOO8;7s_Z2`n=>_u z-Ia4Qol|T}j4uxOIBby?@yjpG=h_TSW`%YS{~hGM#&u(28CqfmbrT=Mw+#Oc1U}%l zhECc>_-Lba-9#I65_B=OB$F(fttuC4^Q{SCd8JfgQ9vQBQKMB$nWg z5D3$9EWMmb;z`b??ys?71>uQk{W2n-uP4;Ypgxl8uS!Ebv5yIbTAWFwws7J)8cNWY z`0W-HboNiuCULI^x|gefwj`V)SOeD$B{WvT~aFMN?LmSK*E{Dp=_jp_y+~kQ8 zS}JMWQm!)1^EKgz%X$oZ+;*+kqrZItjl$2>C)!@gx|#WamuX)?3tr`@yv8oPUW0H1 z_j%Rt_Xw_6eB=5?zrloWvf8(55*;pAI_6RBDN}XFZ`5JwDk+~mB{VM}HEdl$>%=nJI09RuTWLzzHnNC-zrX5$k?kcg$T@w< zr!D?_qv|-i!#nAIpK$KQ+=m8!|IADA3#Gcr%l#`Ku-~v9zvB@8z!Ch(`*#!P@D~jH k&3B`}{FLn`arrf@AVzLGKSV=iklfqXNtk1Fsl$W+0oH%eJOBUy diff --git a/Robust/cup/java_cup/terminal_set.java b/Robust/cup/java_cup/terminal_set.java deleted file mode 100644 index e921cb59..00000000 --- a/Robust/cup/java_cup/terminal_set.java +++ /dev/null @@ -1,253 +0,0 @@ - -package java_cup; - -import java.util.BitSet; - -/** A set of terminals implemented as a bitset. - * @version last updated: 11/25/95 - * @author Scott Hudson - */ -public class terminal_set { - - /*-----------------------------------------------------------*/ - /*--- Constructor(s) ----------------------------------------*/ - /*-----------------------------------------------------------*/ - - /** Constructor for an empty set. */ - public terminal_set() - { - /* allocate the bitset at what is probably the right size */ - _elements = new BitSet(terminal.number()); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Constructor for cloning from another set. - * @param other the set we are cloning from. - */ - public terminal_set(terminal_set other) - throws internal_error - { - not_null(other); - _elements = (BitSet)other._elements.clone(); - } - - /*-----------------------------------------------------------*/ - /*--- (Access to) Static (Class) Variables ------------------*/ - /*-----------------------------------------------------------*/ - - /** Constant for the empty set. */ - public static final terminal_set EMPTY = new terminal_set(); - - /*-----------------------------------------------------------*/ - /*--- (Access to) Instance Variables ------------------------*/ - /*-----------------------------------------------------------*/ - - /** Bitset to implement the actual set. */ - protected BitSet _elements; - - /*-----------------------------------------------------------*/ - /*--- General Methods ----------------------------------------*/ - /*-----------------------------------------------------------*/ - - /** Helper function to test for a null object and throw an exception if - * one is found. - * @param obj the object we are testing. - */ - protected void not_null(Object obj) throws internal_error - { - if (obj == null) - throw new internal_error("Null object used in set operation"); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Determine if the set is empty. */ - public boolean empty() - { - return equals(EMPTY); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Determine if the set contains a particular terminal. - * @param sym the terminal symbol we are looking for. - */ - public boolean contains(terminal sym) - throws internal_error - { - not_null(sym); - return _elements.get(sym.index()); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Given its index determine if the set contains a particular terminal. - * @param indx the index of the terminal in question. - */ - public boolean contains(int indx) - { - return _elements.get(indx); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Determine if this set is an (improper) subset of another. - * @param other the set we are testing against. - */ - public boolean is_subset_of(terminal_set other) - throws internal_error - { - not_null(other); - - /* make a copy of the other set */ - BitSet copy_other = (BitSet)other._elements.clone(); - - /* and or in */ - copy_other.or(_elements); - - /* if it hasn't changed, we were a subset */ - return copy_other.equals(other._elements); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Determine if this set is an (improper) superset of another. - * @param other the set we are testing against. - */ - public boolean is_superset_of(terminal_set other) - throws internal_error - { - not_null(other); - return other.is_subset_of(this); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Add a single terminal to the set. - * @param sym the terminal being added. - * @return true if this changes the set. - */ - public boolean add(terminal sym) - throws internal_error - { - boolean result; - - not_null(sym); - - /* see if we already have this */ - result = _elements.get(sym.index()); - - /* if not we add it */ - if (!result) - _elements.set(sym.index()); - - return result; - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Remove a terminal if it is in the set. - * @param sym the terminal being removed. - */ - public void remove(terminal sym) - throws internal_error - { - not_null(sym); - _elements.clear(sym.index()); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Add (union) in a complete set. - * @param other the set being added. - * @return true if this changes the set. - */ - public boolean add(terminal_set other) - throws internal_error - { - not_null(other); - - /* make a copy */ - BitSet copy = (BitSet)_elements.clone(); - - /* or in the other set */ - _elements.or(other._elements); - - /* changed if we are not the same as the copy */ - return !_elements.equals(copy); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Determine if this set intersects another. - * @param other the other set in question. - */ - public boolean intersects(terminal_set other) - throws internal_error - { - not_null(other); - - /* make a copy of the other set */ - BitSet copy = (BitSet)other._elements.clone(); - - /* xor out our values */ - copy.xor(this._elements); - - /* see if its different */ - return !copy.equals(other._elements); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Equality comparison. */ - public boolean equals(terminal_set other) - { - if (other == null) - return false; - else - return _elements.equals(other._elements); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Generic equality comparison. */ - public boolean equals(Object other) - { - if (!(other instanceof terminal_set)) - return false; - else - return equals((terminal_set)other); - } - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Convert to string. */ - public String toString() - { - String result; - boolean comma_flag; - - result = "{"; - comma_flag = false; - for (int t = 0; t < terminal.number(); t++) - { - if (_elements.get(t)) - { - if (comma_flag) - result += ", "; - else - comma_flag = true; - - result += terminal.find(t).name(); - } - } - result += "}"; - - return result; - } - - /*-----------------------------------------------------------*/ - -} - diff --git a/Robust/cup/java_cup/version.class b/Robust/cup/java_cup/version.class deleted file mode 100644 index 336e0997176334ef550e9474e7d98897d114baae..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 549 zcmYk2-)>St5XQfOQVs|D$6B>oX}5Z#rU824mBz%JNNPf?2`#r|fekJ_XO}E{NPH}> zn)IR%;6oW_ff8wW-86N+4WAF@uvuCf0$33tK=%Q?D1+aQA5vm^H$@c#pA@u%}?LWE=QGOvJ{QuAMA8sT-B%-xmWB{Ldg2TPUN%t1OKhRU z>)d84EI8WW3g=@~*ZCUr4tCeP$GpG6PnZuj_$l+@20!CU3Jc)#h#l(-21+09Kz}$u QTmWu{_zdD#d>3&1AKbBM>i_@% diff --git a/Robust/cup/java_cup/version.java b/Robust/cup/java_cup/version.java deleted file mode 100644 index 06600b59..00000000 --- a/Robust/cup/java_cup/version.java +++ /dev/null @@ -1,55 +0,0 @@ - -package java_cup; - -/** This class contains version and authorship information. - * It contains only static data elements and basically just a central - * place to put this kind of information so it can be updated easily - * for each release. - * - * Version numbers used here are broken into 3 parts: major, minor, and - * update, and are written as v.. (e.g. v0.10a). - * Major numbers will change at the time of major reworking of some - * part of the system. Minor numbers for each public release or - * change big enough to cause incompatibilities. Finally update - * letter will be incremented for small bug fixes and changes that - * probably wouldn't be noticed by a user. - * - * @version last updated: 12/22/97 [CSA] - * @author Frank Flannery - */ - -public class version { - /** The major version number. */ - public static final int major = 0; - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** The minor version number. */ - public static final int minor = 10; - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** The update letter. */ - public static final char update = 'k'; - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** String for the current version. */ - public static final String version_str = "v" + major + "." + minor + update; - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Full title of the system */ - public static final String title_str = "CUP " + version_str; - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** Name of the author */ - public static final String author_str = - "Scott E. Hudson, Frank Flannery, and C. Scott Ananian"; - - /*. . . . . . . . . . . . . . . . . . . . . . . . . . . . . .*/ - - /** The command name normally used to invoke this program */ - public static final String program_name = "java_cup"; -} diff --git a/Robust/cup/manual.html b/Robust/cup/manual.html deleted file mode 100644 index 5d6f6a8b..00000000 --- a/Robust/cup/manual.html +++ /dev/null @@ -1,1452 +0,0 @@ - -CUP User's Manual - - - -
    -[CUP Logo Image] -
    -

    CUP User's Manual

    -

    -Scott E. Hudson
    - -Graphics Visualization and Usability Center
    - -Georgia Institute of Technology

    -Modified by Frank -Flannery, C. Scott Ananian, -Dan Wang with advice from -Andrew W. Appel
    -Last updated July 1999 (v0.10j) -
    - -

    Table of Contents

    -
    -
    i.
    About CUP Version 0.10 -
    1.
    Introduction and Example -
    2.
    Specification Syntax -
    3.
    Running CUP -
    4.
    Customizing the Parser -
    5.
    Scanner interface -
    6.
    Error Recovery -
    7.
    Conclusion -
    References -
    A.
    Grammar for CUP Specification Files -
    B.
    A Very Simple Example Scanner -
    C.
    Incompatibilites between CUP 0.9 and CUP 0.10 -
    D.
    Bugs -
    E.
    Change log -
    - - -

    i. About CUP Version 0.10

    -
    Version -0.10 of CUP adds many new changes and features over the previous releases -of version 0.9. These changes attempt to make CUP more like its -predecessor, YACC. As a result, the old 0.9 parser specifications for CUP are -not compatible and a reading of appendix C of the new -manual will be necessary to write new specifications. The new version, -however, gives the user more power and options, making parser specifications -easier to write. - - -

    1. Introduction and Example

    - -This manual describes the basic operation and use of the -Java(tm) -Based Constructor of Useful Parsers (CUP for short). -CUP is a system for generating LALR parsers from simple specifications. -It serves the same role as the widely used program YACC -[1] and in fact offers most of the features of YACC. -However, CUP is written in Java, uses specifications including embedded -Java code, and produces parsers which are implemented in Java.

    - -Although this manual covers all aspects of the CUP system, it is relatively -brief, and assumes you have at least a little bit of knowledge of LR -parsing. A working knowledge of YACC is also very helpful in -understanding how CUP specifications work. -A number of compiler construction textbooks (such as -[2,3]) cover this material, -and discuss the YACC system (which is quite similar to this one) as a -specific example. In addition, Andrew Appel's Modern Compiler -Implementation in Java textbook [4] uses -and describes CUP in the context of compiler construction. -

    - -Using CUP involves creating a simple specification based on the -grammar for which a parser is needed, along with construction of a -scanner capable of breaking characters up into meaningful tokens (such -as keywords, numbers, and special symbols).

    - -As a simple example, consider a -system for evaluating simple arithmetic expressions over integers. -This system would read expressions from standard input (each terminated -with a semicolon), evaluate them, and print the result on standard output. -A grammar for the input to such a system might look like:

    -  expr_list ::= expr_list expr_part | expr_part
    -  expr_part ::= expr ';'
    -  expr      ::= expr '+' expr | expr '-' expr | expr '*' expr 
    -	      | expr '/' expr | expr '%' expr | '(' expr ')'  
    -              | '-' expr | number 
    -
    -To specify a parser based on this grammar, our first step is to identify and -name the set of terminal symbols that will appear on input, and the set of -non-terminal symbols. In this case, the non-terminals are: - -
      expr_list, expr_part  and  expr .
    - -For terminal names we might choose: - -
      SEMI, PLUS, MINUS, TIMES, DIVIDE, MOD, NUMBER, LPAREN,
    -and RPAREN
    - -The experienced user will note a problem with the above grammar. It is -ambiguous. An ambiguous grammar is a grammar which, given a certain -input, can reduce the parts of the input in two different ways such as -to give two different answers. Take the above grammar, for -example. given the following input:
    -3 + 4 * 6
    -The grammar can either evaluate the 3 + 4 and then multiply -seven by six, or it can evaluate 4 * 6 and then add three. -Older versions of CUP forced the user to write unambiguous grammars, but -now there is a construct allowing the user to specify precedences and -associativities for terminals. This means that the above ambiguous -grammar can be used, after specifying precedences and associativities. -There is more explanation later. - -Based on these namings we can construct a small CUP specification -as follows:
    -
    -
    // CUP specification for a simple expression evaluator (no actions)
    -
    -import java_cup.runtime.*;
    -
    -/* Preliminaries to set up and use the scanner.  */
    -init with {: scanner.init();              :};
    -scan with {: return scanner.next_token(); :};
    -
    -/* Terminals (tokens returned by the scanner). */
    -terminal            SEMI, PLUS, MINUS, TIMES, DIVIDE, MOD;
    -terminal            UMINUS, LPAREN, RPAREN;
    -terminal Integer    NUMBER;
    -
    -/* Non terminals */
    -non terminal            expr_list, expr_part;
    -non terminal Integer    expr, term, factor;
    -
    -/* Precedences */
    -precedence left PLUS, MINUS;
    -precedence left TIMES, DIVIDE, MOD;
    -precedence left UMINUS;
    -
    -/* The grammar */
    -expr_list ::= expr_list expr_part | 
    -              expr_part;
    -expr_part ::= expr SEMI;
    -expr      ::= expr PLUS expr 
    -            | expr MINUS expr  
    -            | expr TIMES expr  
    -            | expr DIVIDE expr  
    -            | expr MOD expr 
    -	    | MINUS expr %prec UMINUS
    -            | LPAREN expr RPAREN
    -	    | NUMBER
    -	    ;
    -
    -

    -We will consider each part of the specification syntax in detail later. -However, here we can quickly see that the specification contains four -main parts. The first part provides preliminary and miscellaneous declarations -to specify how the parser is to be generated, and supply parts of the -runtime code. In this case we indicate that the java_cup.runtime -classes should be imported, then supply a small bit of initialization code, -and some code for invoking the scanner to retrieve the next input token. -The second part of the specification declares terminals and non-terminals, -and associates object classes with each. In this case, the terminals -are declared as either with no type, or of type -Integer. The specified type of the -terminal or non-terminal is the type of the value of those terminals or -non-terminals. If no type is specified, the terminal or non-terminal -carries no value. Here, no type indicates that these -terminals and non-terminals hold no value. -The third part specifies the precedence and -associativity of terminals. The last precedence declaration give its -terminals the highest precedence. The final -part of the specification contains the grammar.

    - - -To produce a parser from this specification we use the CUP generator. -If this specification were stored in a file parser.cup, then -(on a Unix system at least) we might invoke CUP using a command like: -

     java java_cup.Main < parser.cup 
    -or (starting with CUP 0.10k): -
     java java_cup.Main parser.cup 
    -The system will produce two Java source files containing -parts of the generated parser: sym.java and parser.java -(these names can be changed with command-line options; see -below). -As you might expect, these two files contain declarations for the classes -sym and parser. The sym class contains a series of -constant declarations, one for each terminal symbol. This is typically used -by the scanner to refer to symbols (e.g. with code such as -"return new Symbol(sym.SEMI);" ). The parser class -implements the parser itself.

    - -The specification above, while constructing a full parser, does not perform -any semantic actions &emdash; it will only indicate success or failure of a parse. -To calculate and print values of each expression, we must embed Java -code within the parser to carry out actions at various points. In CUP, -actions are contained in code strings which are surrounded by delimiters -of the form {: and :} (we can see examples of this in the -init with and scan with clauses above). In general, the -system records all characters within the delimiters, but does not try to check -that it contains valid Java code.

    - -A more complete CUP specification for our example system (with actions -embedded at various points in the grammar) is shown below:
    -


    -
    // CUP specification for a simple expression evaluator (w/ actions)
    -
    -import java_cup.runtime.*;
    -
    -/* Preliminaries to set up and use the scanner.  */
    -init with {: scanner.init();              :};
    -scan with {: return scanner.next_token(); :};
    -
    -/* Terminals (tokens returned by the scanner). */
    -terminal           SEMI, PLUS, MINUS, TIMES, DIVIDE, MOD;
    -terminal           UMINUS, LPAREN, RPAREN;
    -terminal Integer   NUMBER;
    -
    -/* Non-terminals */
    -non terminal            expr_list, expr_part;
    -non terminal Integer    expr;
    -
    -/* Precedences */
    -precedence left PLUS, MINUS;
    -precedence left TIMES, DIVIDE, MOD;
    -precedence left UMINUS;
    -
    -/* The grammar */
    -expr_list ::= expr_list expr_part 
    -	      | 
    -              expr_part;
    -
    -expr_part ::= expr:e 
    -	      {: System.out.println("= " + e); :} 
    -              SEMI              
    -	      ;
    -
    -expr      ::= expr:e1 PLUS expr:e2    
    -	      {: RESULT = new Integer(e1.intValue() + e2.intValue()); :} 
    -	      | 
    -              expr:e1 MINUS expr:e2    
    -              {: RESULT = new Integer(e1.intValue() - e2.intValue()); :} 
    -	      | 
    -              expr:e1 TIMES expr:e2 
    -	      {: RESULT = new Integer(e1.intValue() * e2.intValue()); :} 
    -	      | 
    -              expr:e1 DIVIDE expr:e2 
    -	      {: RESULT = new Integer(e1.intValue() / e2.intValue()); :} 
    -	      | 
    -              expr:e1 MOD expr:e2 
    -	      {: RESULT = new Integer(e1.intValue() % e2.intValue()); :} 
    -	      | 
    -              NUMBER:n                 
    -	      {: RESULT = n; :} 
    -	      | 
    -              MINUS expr:e             
    -	      {: RESULT = new Integer(0 - e.intValue()); :} 
    -	      %prec UMINUS
    -	      | 
    -              LPAREN expr:e RPAREN     
    -	      {: RESULT = e; :} 
    -	      ;
    -
    -

    -Here we can see several changes. Most importantly, code to be executed at -various points in the parse is included inside code strings delimited by -{: and :}. In addition, labels have been placed on various -symbols in the right hand side of productions. For example in:
    -
      expr:e1 PLUS expr:e2    
    -	{: RESULT = new Integer(e1.intValue() + e2.intValue()); :} 
    -
    - -the first non-terminal expr has been labeled with e1, and -the second with e2. The left hand side value -of each production is always implicitly labeled as RESULT.

    - -Each symbol appearing in a production is represented at runtime by an -object of type Symbol on the parse stack. The labels refer to -the instance variable value in those objects. In the -expression expr:e1 PLUS expr:e2, e1 and e2 -refer to objects of type Integer. These objects are in the value fields -of the objects of type Symbol representing those non-terminals -on the parse stack. RESULT is of type Integer as -well, since the resulting non-terminal expr was declared as of -type Integer. This object becomes the value instance -variable of a new Symbol object.

    - -For each label, two more variables accessible to the user are declared. -A left and right value labels are passed to the code string, so that the -user can find out where the left and right side of each terminal or -non-terminal is in the input stream. The name of these variables is the -label name, plus left or right. for example, given -the right hand side of a production expr:e1 PLUS expr:e2 the -user could not only access variables e1 and e2, but -also e1left, e1right, e2left and e2right. these -variables are of type int.

    - - - -The final step in creating a working parser is to create a scanner (also -known as a lexical analyzer or simply a lexer). This routine is -responsible for reading individual characters, removing things things like -white space and comments, recognizing which terminal symbols from the -grammar each group of characters represents, then returning Symbol objects -representing these symbols to the parser. -The terminals will be retrieved with a call to the -scanner function. In the example, the parser will call -scanner.next_token(). The scanner should return objects of -type java_cup.runtime.Symbol. This type is very different than -older versions of CUP's java_cup.runtime.symbol. These Symbol -objects contains the instance variable value of type Object, -which should be -set by the lexer. This variable refers to the value of that symbol, and -the type of object in value should be of the same type as declared in -the terminal and non terminal declarations. In the -above example, if the lexer wished to pass a NUMBER token, it should -create a Symbol with the value instance variable -filled with an object of type Integer. Symbol -objects corresponding to terminals and non-terminals with no value -have a null value field.

    - -The code contained in the init with clause of the specification -will be executed before any tokens are requested. Each token will be -requested using whatever code is found in the scan with clause. -Beyond this, the exact form the scanner takes is up to you; however -note that each call to the scanner function should return a new -instance of java_cup.runtime.Symbol (or a subclass). -These symbol objects are annotated with parser information and pushed -onto a stack; reusing objects will result in the parser annotations -being scrambled. As of CUP 0.10j, Symbol reuse should be -detected if it occurs; the parser will throw an Error -telling you to fix your scanner.

    - -In the next section a more detailed and formal -explanation of all parts of a CUP specification will be given. -Section 3 describes options for running the -CUP system. Section 4 discusses the details -of how to customize a CUP parser, while section 5 -discusses the scanner interface added in CUP 0.10j. Section - 6 considers error recovery. Finally, Section 7 -provides a conclusion. - - -

    2. Specification Syntax

    -Now that we have seen a small example, we present a complete description of all -parts of a CUP specification. A specification has four sections with -a total of eight specific parts (however, most of these are optional). -A specification consists of: - -Each of these parts must appear in the order presented here. (A complete -grammar for the specification language is given in -Appendix A.) The particulars of each part of -the specification are described in the subsections below.

    - -

    Package and Import Specifications
    - -A specification begins with optional package and import -declarations. These have the same syntax, and play the same -role, as the package and import declarations found in a normal Java program. -A package declaration is of the form: - -
        package name;
    - -where name name is a Java package identifier, possibly in -several parts separated by ".". In general, CUP employs Java lexical -conventions. So for example, both styles of Java comments are supported, -and identifiers are constructed beginning with a letter, dollar -sign ($), or underscore (_), which can then be followed by zero or more -letters, numbers, dollar signs, and underscores.

    - -After an optional package declaration, there can be zero or more -import declarations. As in a Java program these have the form: - -

        import package_name.class_name;
    -
    -or -
        import package_name.*;
    -
    - -The package declaration indicates what package the sym and -parser classes that are generated by the system will be in. -Any import declarations that appear in the specification will also appear -in the source file for the parser class allowing various names from -that package to be used directly in user supplied action code. - -
    User Code Components
    - -Following the optional package and import declarations -are a series of optional declarations that allow user code to be included -as part of the generated parser (see Section 4 for a -full description of how the parser uses this code). As a part of the parser -file, a separate non-public class to contain all embedded user actions is -produced. The first action code declaration section allows code to -be included in this class. Routines and variables for use by the code -embedded in the grammar would normally be placed in this section (a typical -example might be symbol table manipulation routines). This declaration takes -the form: - -
        action code {: ... :};
    -
    - -where {: ... :} is a code string whose contents will be placed -directly within the action class class declaration.

    - -After the action code declaration is an optional -parser code declaration. This declaration allows methods and -variable to be placed directly within the generated parser class. -Although this is less common, it can be helpful when customizing the -parser &emdash; it is possible for example, to include scanning methods inside -the parser and/or override the default error reporting routines. This -declaration is very similar to the action code declaration and -takes the form: - -

        parser code {: ... :};
    -
    - -Again, code from the code string is placed directly into the generated parser -class definition.

    - -Next in the specification is the optional init declaration -which has the form: - -

        init with {: ... :};
    - -This declaration provides code that will be executed by the parser -before it asks for the first token. Typically, this is used to initialize -the scanner as well as various tables and other data structures that might -be needed by semantic actions. In this case, the code given in the code -string forms the body of a void method inside the parser -class.

    - -The final (optional) user code section of the specification indicates how -the parser should ask for the next token from the scanner. This has the -form: - -

        scan with {: ... :};
    - -As with the init clause, the contents of the code string forms -the body of a method in the generated parser. However, in this case -the method returns an object of type java_cup.runtime.Symbol. -Consequently the code found in the scan with clause should -return such a value. See section 5 for -information on the default behavior if the scan with -section is omitted.

    - -As of CUP 0.10j the action code, parser code, init code, and scan with -sections may appear in any order. They must, however, precede the -symbol lists.

    - -

    Symbol Lists
    - -Following user supplied code comes the first required part of the -specification: the symbol lists. These declarations are responsible -for naming and supplying a type for each terminal and non-terminal -symbol that appears in the grammar. As indicated above, each terminal -and non-terminal symbol is represented at runtime with a Symbol -object. In -the case of terminals, these are returned by the scanner and placed on -the parse stack. The lexer should put the value of the terminal in the -value instance variable. -In the case of non-terminals these replace a series -of Symbol objects on the parse stack whenever the right hand side of -some production is recognized. In order to tell the parser which object -types should be used for which symbol, terminal and -non terminal declarations are used. These take the forms: - -
        terminal classname name1, name2, ...;
    -    non terminal classname name1, name2, ...;
    -    terminal name1, name2, ...;
    -
    - -and - -
        non terminal name1, name2, ...;
    -
    - -where classname can be a multiple part name separated with -"."s. The -classname specified represents the type of the value of -that terminal or non-terminal. When accessing these values through -labels, the users uses the type declared. the classname -can be of any type. If no classname is given, then the -terminal or non-terminal holds no value. a label referring to such a -symbol with have a null value. As of CUP 0.10j, you may specify -non-terminals the declaration "nonterminal" (note, no -space) as well as the original "non terminal" spelling.

    - -Names of terminals and non-terminals cannot be CUP reserved words; -these include "code", "action", "parser", "terminal", "non", -"nonterminal", "init", "scan", "with", "start", "precedence", "left", -"right", "nonassoc", "import", and "package".

    - -

    Precedence and Associativity declarations
    - -The third section, which is optional, specifies the precedences and -associativity of terminals. This is useful for parsing with ambiguous -grammars, as done in the example above. There are three type of -precedence/associativity declarations: -
    
    -	precedence left     terminal[, terminal...];
    -	precedence right    terminal[, terminal...];
    -	precedence nonassoc terminal[, terminal...];
    -
    - -The comma separated list indicates that those terminals should have the -associativity specified at that precedence level and the precedence of -that declaration. The order of precedence, from highest to lowest, is -bottom to top. Hence, this declares that multiplication and division have -higher precedence than addition and subtraction: -
    
    -	precedence left  ADD, SUBTRACT;
    -	precedence left  TIMES, DIVIDE;
    -
    -Precedence resolves shift reduce problems. For example, given the input -to the above example parser 3 + 4 * 8, the parser doesn't know -whether to reduce 3 + 4 or shift the '*' onto the stack. -However, since '*' has a higher precedence than '+', it will be shifted -and the multiplication will be performed before the addition.

    - -CUP assigns each one of its terminals a precedence according to these -declarations. Any terminals not in this declaration have lowest -precedence. CUP also assigns each of its productions a precedence. -That precedence is equal to the precedence of the last terminal in that -production. If the production has no terminals, then it has lowest -precedence. For example, expr ::= expr TIMES expr would have -the same precedence as TIMES. When there is a shift/reduce -conflict, the parser determines whether the terminal to be shifted has a -higher precedence, or if the production to reduce by does. If the -terminal has higher precedence, it it shifted, if the production has -higher precedence, a reduce is performed. If they have equal -precedence, associativity of the terminal determine what happens.

    - -An associativity is assigned to each terminal used in the -precedence/associativity declarations. The three associativities are -left, right and nonassoc Associativities are also -used to resolve shift/reduce conflicts, but only in the case of equal -precedences. If the associativity of the terminal that can be shifted -is left, then a reduce is performed. This means, if the input -is a string of additions, like 3 + 4 + 5 + 6 + 7, the parser -will always reduce them from left to right, in this case, -starting with 3 + 4. If the associativity of the terminal is -right, it is shifted onto the stack. hence, the reductions -will take place from right to left. So, if PLUS were declared with -associativity of right, the 6 + 7 would be reduced -first in the above string. If a terminal is declared as -nonassoc, then two consecutive occurrences of equal precedence -non-associative terminals generates an error. This is useful for -comparison operations. For example, if the input string is -6 == 7 == 8 == 9, the parser should generate an error. If '==' -is declared as nonassoc then an error will be generated.

    - -All terminals not used in the precedence/associativity declarations are -treated as lowest precedence. If a shift/reduce error results, -involving two such terminals, it cannot be resolved, as the above -conflicts are, so it will be reported.

    - -

    The Grammar
    - -The final section of a CUP declaration provides the grammar. This -section optionally starts with a declaration of the form: - -
        start with non-terminal;
    -
    - -This indicates which non-terminal is the start or goal -non-terminal for parsing. If a start non-terminal is not explicitly -declared, then the non-terminal on the left hand side of the first -production will be used. At the end of a successful parse, CUP returns -an object of type java_cup.runtime.Symbol. This -Symbol's value instance variable contains the final reduction -result.

    - -The grammar itself follows the optional start declaration. Each -production in the grammar has a left hand side non-terminal followed by -the symbol "::=", which is then followed by a series of zero or more -actions, terminal, or non-terminal -symbols, followed by an optional contextual precedence assignment, -and terminated with a semicolon (;).

    - - - -Each symbol on the right hand side can optionally be labeled with a name. -Label names appear after the symbol name separated by a colon (:). Label -names must be unique within the production, and can be used within action -code to refer to the value of the symbol. Along with the label, two -more variables are created, which are the label plus left and -the label plus right. These are int values that -contain the right and left locations of what the terminal or -non-terminal covers in the input file. These values must be properly -initialized in the terminals by the lexer. The left and right values -then propagate to non-terminals to which productions reduce.

    - -If there are several productions for the same non-terminal they may be -declared together. In this case the productions start with the non-terminal -and "::=". This is followed by multiple right hand sides each -separated by a bar (|). The full set of productions is then terminated by a -semicolon.

    - -Actions appear in the right hand side as code strings (e.g., Java code inside -{: ... :} delimiters). These are executed by the parser -at the point when the portion of the production to the left of the -action has been recognized. (Note that the scanner will have returned the -token one past the point of the action since the parser needs this extra -lookahead token for recognition.)

    - - - -Contextual precedence assignments follow all the symbols and actions of -the right hand side of the production whose precedence it is assigning. -Contextual precedence assignment allows a production to be assigned a -precedence not based on the last terminal in it. A good example is -shown in the above sample parser specification: - -

    
    -	precedence left PLUS, MINUS;
    -	precedence left TIMES, DIVIDE, MOD;
    -	precedence left UMINUS;
    -
    -	expr ::=  MINUS expr:e             
    -	          {: RESULT = new Integer(0 - e.intValue()); :} 
    -	          %prec UMINUS
    -
    - -Here, there production is declared as having the precedence of UMINUS. -Hence, the parser can give the MINUS sign two different precedences, -depending on whether it is a unary minus or a subtraction operation. - - -

    3. Running CUP

    - -As mentioned above, CUP is written in Java. To invoke it, one needs -to use the Java interpreter to invoke the static method -java_cup.Main(), passing an array of strings containing options. -Assuming a Unix machine, the simplest way to do this is typically to invoke it -directly from the command line with a command such as: - -
        java java_cup.Main options < inputfile
    - -Once running, CUP expects to find a specification file on standard input -and produces two Java source files as output. Starting with CUP 0.10k, -the final command-line argument may be a filename, in which case the -specification will be read from that file instead of from standard input.

    - -In addition to the specification file, CUP's behavior can also be changed -by passing various options to it. Legal options are documented in -Main.java and include: -

    -
    -package name -
    Specify that the parser and sym classes are to be - placed in the named package. By default, no package specification - is put in the generated code (hence the classes default to the special - "unnamed" package). - -
    -parser name -
    Output parser and action code into a file (and class) with the given - name instead of the default of "parser". - -
    -symbols name -
    Output the symbol constant code into a class with the given - name instead of the default of "sym". - -
    -interface -
    Outputs the symbol constant code as an interface - rather than as a class. - -
    -nonterms -
    Place constants for non-terminals into the symbol constant class. - The parser does not need these symbol constants, so they are not normally - output. However, it can be very helpful to refer to these constants - when debugging a generated parser. - -
    -expect number -
    During parser construction the system may detect that an ambiguous - situation would occur at runtime. This is called a conflict. - In general, the parser may be unable to decide whether to shift - (read another symbol) or reduce (replace the recognized right - hand side of a production with its left hand side). This is called a - shift/reduce conflict. Similarly, the parser may not be able - to decide between reduction with two different productions. This is - called a reduce/reduce conflict. Normally, if one or more of - these conflicts occur, parser generation is aborted. However, in - certain carefully considered cases it may be advantageous to - arbitrarily break such a conflict. In this case CUP uses YACC - convention and resolves shift/reduce conflicts by shifting, and - reduce/reduce conflicts using the "highest priority" production (the - one declared first in the specification). In order to enable automatic - breaking of conflicts the -expect option must be given - indicating exactly how many conflicts are expected. Conflicts - resolved by precedences and associativities are not reported. - -
    -compact_red -
    Including this option enables a table compaction optimization involving - reductions. In particular, it allows the most common reduce entry in - each row of the parse action table to be used as the default for that - row. This typically saves considerable room in the tables, which can - grow to be very large. This optimization has the effect of replacing - all error entries in a row with the default reduce entry. While this - may sound dangerous, if not down right incorrect, it turns out that this - does not affect the correctness of the parser. In particular, some - changes of this type are inherent in LALR parsers (when compared to - canonical LR parsers), and the resulting parsers will still never - read past the first token at which the error could be detected. - The parser can, however, make extra erroneous reduces before detecting - the error, so this can degrade the parser's ability to do - error recovery. - (Refer to reference [2] pp. 244-247 or reference [3] pp. 190-194 for a - complete explanation of this compaction technique.)

    - - This option is typically used to work-around the java bytecode - limitations on table initialization code sizes. However, CUP - 0.10h introduced a string-encoding for the parser tables which - is not subject to the standard method-size limitations. - Consequently, use of this option should no longer be required - for large grammars. - -
    -nowarn -
    This options causes all warning messages (as opposed to error messages) - produced by the system to be suppressed. - -
    -nosummary -
    Normally, the system prints a summary listing such things as the - number of terminals, non-terminals, parse states, etc. at the end of - its run. This option suppresses that summary. - -
    -progress -
    This option causes the system to print short messages indicating its - progress through various parts of the parser generation process. - -
    -dump_grammar -
    -dump_states -
    -dump_tables -
    -dump -
    These options cause the system to produce a human readable dump of - the grammar, the constructed parse states (often needed to resolve - parse conflicts), and the parse tables (rarely needed), respectively. - The -dump option can be used to produce all of these dumps. - -
    -time -
    This option adds detailed timing statistics to the normal summary of - results. This is normally of great interest only to maintainers of - the system itself. - -
    -debug -
    This option produces voluminous internal debugging information about - the system as it runs. This is normally of interest only to maintainers - of the system itself. - -
    -nopositions -
    This option keeps CUP from generating code to propagate the left - and right hand values of terminals to non-terminals, and then from - non-terminals to other terminals. If the left and right values aren't - going to be used by the parser, then it will save some runtime - computation to not generate these position propagations. This option - also keeps the left and right label variables from being generated, so - any reference to these will cause an error. - -
    -noscanner -
    CUP 0.10j introduced improved scanner - integration and a new interface, - java_cup.runtime.Scanner. By default, the - generated parser refers to this interface, which means you cannot - use these parsers with CUP runtimes older than 0.10j. If your - parser does not use the new scanner integration features, then you - may specify the -noscanner option to suppress the - java_cup.runtime.Scanner references and allow - compatibility with old runtimes. Not many people should have reason - to do this. - -
    -version -
    Invoking CUP with the -version flag will cause it - to print out the working version of CUP and halt. This allows - automated CUP version checking for Makefiles, install scripts and - other applications which may require it. -
    - - -

    4. Customizing the Parser

    - -Each generated parser consists of three generated classes. The -sym class (which can be renamed using the -symbols -option) simply contains a series of int constants, -one for each terminal. Non-terminals are also included if the -nonterms -option is given. The source file for the parser class (which can -be renamed using the -parser option) actually contains two -class definitions, the public parser class that implements the -actual parser, and another non-public class (called CUP$action) which -encapsulates all user actions contained in the grammar, as well as code from -the action code declaration. In addition to user supplied code, this -class contains one method: CUP$do_action which consists of a large -switch statement for selecting and executing various fragments of user -supplied action code. In general, all names beginning with the prefix of -CUP$ are reserved for internal uses by CUP generated code.

    - -The parser class contains the actual generated parser. It is -a subclass of java_cup.runtime.lr_parser which implements a -general table driven framework for an LR parser. The generated parser -class provides a series of tables for use by the general framework. -Three tables are provided: -

    -
    the production table -
    provides the symbol number of the left hand side non-terminal, along with - the length of the right hand side, for each production in the grammar, -
    the action table -
    indicates what action (shift, reduce, or error) is to be taken on each - lookahead symbol when encountered in each state, and -
    the reduce-goto table -
    indicates which state to shift to after reduces (under each non-terminal -from each state). -
    -(Note that the action and reduce-goto tables are not stored as simple arrays, -but use a compacted "list" structure to save a significant amount of space. -See comments the runtime system source code for details.)

    - -Beyond the parse tables, generated (or inherited) code provides a series -of methods that can be used to customize the generated parser. Some of these -methods are supplied by code found in part of the specification and can -be customized directly in that fashion. The others are provided by the -lr_parser base class and can be overridden with new versions (via -the parser code declaration) to customize the system. Methods -available for customization include: -

    -
    public void user_init() -
    This method is called by the parser prior to asking for the first token - from the scanner. The body of this method contains the code from the - init with clause of the the specification. -
    public java_cup.runtime.Symbol scan() -
    This method encapsulates the scanner and is called each time a new - terminal is needed by the parser. The body of this method is - supplied by the scan with clause of the specification, if - present; otherwise it returns getScanner().next_token(). -
    public java_cup.runtime.Scanner getScanner() -
    Returns the default scanner. See section 5. -
    public void setScanner(java_cup.runtime.Scanner s) -
    Sets the default scanner. See section 5. -
    public void report_error(String message, Object info) -
    This method should be called whenever an error message is to be issued. In - the default implementation of this method, the first parameter provides - the text of a message which is printed on System.err - and the second parameter is simply ignored. It is very typical to - override this method in order to provide a more sophisticated error - reporting mechanism. -
    public void report_fatal_error(String message, Object info) -
    This method should be called whenever a non-recoverable error occurs. It - responds by calling report_error(), then aborts parsing - by calling the parser method done_parsing(), and finally - throws an exception. (In general done_parsing() should be called - at any point that parsing needs to be terminated early). -
    public void syntax_error(Symbol cur_token) -
    This method is called by the parser as soon as a syntax error is detected - (but before error recovery is attempted). In the default implementation it - calls: report_error("Syntax error", null);. -
    public void unrecovered_syntax_error(Symbol cur_token) -
    This method is called by the parser if it is unable to recover from a - syntax error. In the default implementation it calls: - report_fatal_error("Couldn't repair and continue parse", null);. -
    protected int error_sync_size() -
    This method is called by the parser to determine how many tokens it must - successfully parse in order to consider an error recovery successful. - The default implementation returns 3. Values below 2 are not recommended. - See the section on error recovery for details. -
    - -Parsing itself is performed by the method public Symbol parse(). -This method starts by getting references to each of the parse tables, -then initializes a CUP$action object (by calling -protected void init_actions()). Next it calls user_init(), -then fetches the first lookahead token with a call to scan(). -Finally, it begins parsing. Parsing continues until done_parsing() -is called (this is done automatically, for example, when the parser -accepts). It then returns a Symbol with the value -instance variable containing the RESULT of the start production, or -null, if there is no value.

    - -In addition to the normal parser, the runtime system also provides a debugging -version of the parser. This operates in exactly the same way as the normal -parser, but prints debugging messages (by calling -public void debug_message(String mess) whose default implementation -prints a message to System.err).

    - -Based on these routines, invocation of a CUP parser is typically done -with code such as: -

    -      /* create a parsing object */
    -      parser parser_obj = new parser();
    -
    -      /* open input files, etc. here */
    -      Symbol parse_tree = null;
    -
    -      try {
    -        if (do_debug_parse)
    -          parse_tree = parser_obj.debug_parse();
    -        else
    -          parse_tree = parser_obj.parse();
    -      } catch (Exception e) {
    -        /* do cleanup here - - possibly rethrow e */
    -      } finally {
    -	/* do close out here */
    -      }
    -
    - - -

    5. Scanner Interface

    - -In CUP 0.10j scanner integration was improved according to -suggestions made by David MacMahon. -The changes make it easier to incorporate JLex and other -automatically-generated scanners into CUP parsers.

    - -To use the new code, your scanner should implement the -java_cup.runtime.Scanner interface, defined as: -

    -package java_cup.runtime;
    -
    -public interface Scanner {
    -    public Symbol next_token() throws java.lang.Exception;
    -}
    -

    - -In addition to the methods described in section -4, the java_cup.runtime.lr_parser class has two new -accessor methods, setScanner() and getScanner(). -The default implementation of scan() -is: -

    -  public Symbol scan() throws java.lang.Exception {
    -    Symbol sym = getScanner().next_token();
    -    return (sym!=null) ? sym : new Symbol(EOF_sym());
    -  }
    -

    -The generated parser also contains a constructor which takes a -Scanner and calls setScanner() with it. In -most cases, then, the init with and scan -with directives may be omitted. You can simply create the -parser with a reference to the desired scanner: -

    -      /* create a parsing object */
    -      parser parser_obj = new parser(new my_scanner());
    -
    -or set the scanner after the parser is created: -
    -      /* create a parsing object */
    -      parser parser_obj = new parser();
    -      /* set the default scanner */
    -      parser_obj.setScanner(new my_scanner());
    -

    -Note that because the parser uses look-ahead, resetting the scanner in -the middle of a parse is not recommended. If you attempt to use the -default implementation of scan() without first calling -setScanner(), a NullPointerException will be -thrown.

    -As an example of scanner integration, the following three lines in the -lexer-generator input are all that is required to use a -JLex -or JFlex -scanner with CUP: -

    -%implements java_cup.runtime.Scanner
    -%function next_token
    -%type java_cup.runtime.Symbol
    -
    -The JLex directive %cup -abbreviates the above three directive in JLex versions 1.2.5 and above. -Invoking the parser with the JLex scanner is then simply: -
    -parser parser_obj = new parser( new Yylex( some_InputStream_or_Reader));
    -

    - -Note CUP handles the JLex/JFlex convention of returning null on EOF -without a problem, so an %eofval directive is not -required in the JLex specification (this feature was added in CUP 0.10k). - -The simple_calc example in the CUP distribution illustrates the use of -the scanner integration features with a hand-coded scanner. -The CUP website has a minimal CUP/JLex integration example for study.

    - - -

    6. Error Recovery

    - -A final important aspect of building parsers with CUP is -support for syntactic error recovery. CUP uses the same -error recovery mechanisms as YACC. In particular, it supports -a special error symbol (denoted simply as error). -This symbol plays the role of a special non-terminal which, instead of -being defined by productions, instead matches an erroneous input -sequence.

    - -The error symbol only comes into play if a syntax error is -detected. If a syntax error is detected then the parser tries to replace -some portion of the input token stream with error and then -continue parsing. For example, we might have productions such as: - -

        stmt ::= expr SEMI | while_stmt SEMI | if_stmt SEMI | ... |
    -	     error SEMI
    -	     ;
    - -This indicates that if none of the normal productions for stmt can -be matched by the input, then a syntax error should be declared, and recovery -should be made by skipping erroneous tokens (equivalent to matching and -replacing them with error) up to a point at which the parse can -be continued with a semicolon (and additional context that legally follows a -statement). An error is considered to be recovered from if and only if a -sufficient number of tokens past the error symbol can be successfully -parsed. (The number of tokens required is determined by the -error_sync_size() method of the parser and defaults to 3).

    - -Specifically, the parser first looks for the closest state to the top -of the parse stack that has an outgoing transition under -error. This generally corresponds to working from -productions that represent more detailed constructs (such as a specific -kind of statement) up to productions that represent more general or -enclosing constructs (such as the general production for all -statements or a production representing a whole section of declarations) -until we get to a place where an error recovery production -has been provided for. Once the parser is placed into a configuration -that has an immediate error recovery (by popping the stack to the first -such state), the parser begins skipping tokens to find a point at -which the parse can be continued. After discarding each token, the -parser attempts to parse ahead in the input (without executing any -embedded semantic actions). If the parser can successfully parse past -the required number of tokens, then the input is backed up to the point -of recovery and the parse is resumed normally (executing all actions). -If the parse cannot be continued far enough, then another token is -discarded and the parser again tries to parse ahead. If the end of -input is reached without making a successful recovery (or there was no -suitable error recovery state found on the parse stack to begin with) -then error recovery fails. - - -

    7. Conclusion

    - -This manual has briefly described the CUP LALR parser generation system. -CUP is designed to fill the same role as the well known YACC parser -generator system, but is written in and operates entirely with Java code -rather than C or C++. Additional details on the operation of the system can -be found in the parser generator and runtime source code. See the CUP -home page below for access to the API documentation for the system and its -runtime.

    - -This document covers version 0.10j of the system. Check the CUP home -page: - -http://www.cs.princeton.edu/~appel/modern/java/CUP/ -for the latest release information, instructions for downloading the -system, and additional news about CUP. Bug reports and other -comments for the developers should be sent to the CUP maintainer, -C. Scott Ananian, at - -cananian@alumni.princeton.edu

    - -CUP was originally written by - -Scott Hudson, in August of 1995.

    - -It was extended to support precedence by - -Frank Flannery, in July of 1996.

    - -On-going improvements have been done by - -C. Scott Ananian, the CUP maintainer, from December of 1997 to the -present.

    - - -

    References

    -
    - -
    [1] -
    S. C. Johnson, -"YACC &emdash; Yet Another Compiler Compiler", -CS Technical Report #32, -Bell Telephone Laboratories, -Murray Hill, NJ, -1975. - -
    [2] -
    A. Aho, R. Sethi, and J. Ullman, -Compilers: Principles, Techniques, and Tools, -Addison-Wesley Publishing, -Reading, MA, -1986. - -
    [3] -
    C. Fischer, and R. LeBlanc, -Crafting a Compiler with C, -Benjamin/Cummings Publishing, -Redwood City, CA, -1991. - -
    [4] -
    Andrew W. Appel, -Modern Compiler Implementation in Java, -Cambridge University Press, -New York, NY, -1998. - -
    - -

    -Appendix A. Grammar for CUP Specification Files (0.10j)

    -

    -
    java_cup_spec      ::= package_spec import_list code_parts
    -		       symbol_list precedence_list start_spec 
    -		       production_list
    -package_spec       ::= PACKAGE multipart_id SEMI | empty
    -import_list        ::= import_list import_spec | empty
    -import_spec        ::= IMPORT import_id SEMI
    -code_part          ::= action_code_part | parser_code_part |
    -                       init_code | scan_code
    -code_parts         ::= code_parts code_part | empty
    -action_code_part   ::= ACTION CODE CODE_STRING opt_semi
    -parser_code_part   ::= PARSER CODE CODE_STRING opt_semi
    -init_code          ::= INIT WITH CODE_STRING opt_semi
    -scan_code          ::= SCAN WITH CODE_STRING opt_semi
    -symbol_list        ::= symbol_list symbol | symbol
    -symbol             ::= TERMINAL type_id declares_term |
    -                       NON TERMINAL type_id declares_non_term |
    -		       NONTERMINAL type_id declares_non_term |
    -		       TERMINAL declares_term |
    -		       NON TERMINAL declares_non_term |
    -		       NONTERMIANL declared_non_term
    -term_name_list     ::= term_name_list COMMA new_term_id | new_term_id
    -non_term_name_list ::= non_term_name_list COMMA new_non_term_id |
    -	               new_non_term_id
    -declares_term      ::= term_name_list SEMI
    -declares_non_term  ::= non_term_name_list SEMI
    -precedence_list    ::= precedence_l | empty
    -precedence_l       ::= precedence_l preced + preced;
    -preced             ::= PRECEDENCE LEFT terminal_list SEMI
    -	               | PRECEDENCE RIGHT terminal_list SEMI
    -	               | PRECEDENCE NONASSOC terminal_list SEMI
    -terminal_list      ::= terminal_list COMMA terminal_id | terminal_id 
    -start_spec         ::= START WITH nt_id SEMI | empty
    -production_list    ::= production_list production | production
    -production         ::= nt_id COLON_COLON_EQUALS rhs_list SEMI
    -rhs_list           ::= rhs_list BAR rhs | rhs
    -rhs                ::= prod_part_list PERCENT_PREC term_id |
    -                       prod_part_list
    -prod_part_list     ::= prod_part_list prod_part | empty
    -prod_part          ::= symbol_id opt_label | CODE_STRING
    -opt_label          ::= COLON label_id | empty
    -multipart_id       ::= multipart_id DOT ID | ID
    -import_id          ::= multipart_id DOT STAR | multipart_id
    -type_id            ::= multipart_id
    -terminal_id        ::= term_id
    -term_id            ::= symbol_id
    -new_term_id        ::= ID
    -new_non_term_id    ::= ID
    -nt_id              ::= ID
    -symbol_id          ::= ID
    -label_id           ::= ID
    -opt_semi	   ::= SEMI | empty
    -
    -
    -

    - -

    Appendix B. A Very Simple Example Scanner

    -

    -
    -// Simple Example Scanner Class
    -
    -import java_cup.runtime.*;
    -import sym;
    -
    -public class scanner {
    -  /* single lookahead character */
    -  protected static int next_char;
    -
    -  /* advance input by one character */
    -  protected static void advance()
    -    throws java.io.IOException
    -    { next_char = System.in.read(); }
    -
    -  /* initialize the scanner */
    -  public static void init()
    -    throws java.io.IOException
    -    { advance(); }
    -
    -  /* recognize and return the next complete token */
    -  public static Symbol next_token()
    -    throws java.io.IOException
    -    {
    -      for (;;)
    -        switch (next_char)
    -	  {
    -	    case '0': case '1': case '2': case '3': case '4': 
    -	    case '5': case '6': case '7': case '8': case '9': 
    -	      /* parse a decimal integer */
    -	      int i_val = 0;
    -	      do {
    -	        i_val = i_val * 10 + (next_char - '0');
    -	        advance();
    -	      } while (next_char >= '0' && next_char <= '9');
    -	    return new Symbol(sym.NUMBER, new Integer(i_val));
    -
    -	    case ';': advance(); return new Symbol(sym.SEMI);
    -	    case '+': advance(); return new Symbol(sym.PLUS);
    -	    case '-': advance(); return new Symbol(sym.MINUS);
    -	    case '*': advance(); return new Symbol(sym.TIMES);
    -	    case '/': advance(); return new Symbol(sym.DIVIDE);
    -	    case '%': advance(); return new Symbol(sym.MOD);
    -	    case '(': advance(); return new Symbol(sym.LPAREN);
    -	    case ')': advance(); return new Symbol(sym.RPAREN);
    -
    -	    case -1: return new Symbol(sym.EOF);
    -
    -	    default: 
    -	      /* in this simple scanner we just ignore everything else */
    -	      advance();
    -	    break;
    -	  }
    -    }
    -};
    -
    - - -
    -

    Appendix C: Incompatibilites between CUP 0.9 and CUP 0.10

    - -CUP version 0.10a is a major overhaul of CUP. The changes are severe, -meaning no backwards compatibility to older versions. - -The changes consist of: - - -
    Lexical Interface
    - -CUP now interfaces with the lexer in a completely different -manner. In the previous releases, a new class was used for every -distinct type of terminal. This release, however, uses only one class: -The Symbol class. The Symbol class has three instance -variables which -are significant to the parser when passing information from the lexer. -The first is the value instance variable. This variable -contains the -value of that terminal. It is of the type declared as the terminal type -in the parser specification file. The second two are the instance -variables left and right. They should be filled with -the int value of -where in the input file, character-wise, that terminal was found.

    - -For more information, refer to the manual on scanners. - -

    Terminal/Non-Terminal Declarations
    - -Terminal and non-terminal declarations now can be declared in two -different ways to indicate the values of the terminals or -non-terminals. The previous declarations of the form - -
    
    -terminal classname terminal [, terminal ...];
    -
    - -still works. The classname, however indicates the type of the value of -the terminal or non-terminal, and does not indicate the type of object -placed on the parse stack. - -A declaration, such as: - -
    
    -terminal terminal [, terminal ...];
    -
    - -indicates the terminals in the list hold no value.

    - -For more information, refer to the manual on declarations. - -

    Label References
    - -Label references do not refer to the object on the parse stack, as in -the old CUP, but rather to the value of the value -instance variable of -the Symbol that represents that terminal or non-terminal. Hence, -references to terminal and non-terminal values is direct, as opposed to -the old CUP, where the labels referred to objects containing the value -of the terminal or non-terminal.

    - -For more information, refer to the manual on labels. - -

    RESULT Value
    - -The RESULT variable refers directly to the value of the -non-terminal -to which a rule reduces, rather than to the object on the parse stack. -Hence, RESULT is of the same type the non-terminal to which -it reduces, -as declared in the non-terminal declaration. Again, the reference is -direct, rather than to something that will contain the data.

    - -For more information, refer to the manual on RESULT. - -

    Position Propagation
    - -For every label, two more variables are declared, which are the label -plus left or the label plus right. These correspond -to the left and -right locations in the input stream to which that terminal or -non-terminal came from. These values are propagated from the input -terminals, so that the starting non-terminal should have a left value of -0 and a right value of the location of the last character read.

    - -For more information, refer to the manual on positions. - -

    Return Value
    - -A call to parse() or debug_parse() returns a -Symbol. This Symbol is the start non-terminal, so the value -instance variable contains the final RESULT assignment. - -
    Precedence
    - -CUP now has precedenced terminals. a new declaration section, -occurring between the terminal and non-terminal declarations and the -grammar specifies the precedence and associativity of rules. The -declarations are of the form: - -
    
    -precedence {left| right | nonassoc} terminal[, terminal ...];
    -...
    -
    -
    - -The terminals are assigned a precedence, where terminals on the same -line have equal precedences, and the precedence declarations farther -down the list of precedence declarations have higher precedence. -left, right and nonassoc specify the associativity -of these terminals. left -associativity corresponds to a reduce on conflict, right to a shift on -conflict, and nonassoc to an error on conflict. Hence, ambiguous -grammars may now be used.

    - -For more information, refer to the manual on precedence. - -

    Contextual Precedence
    - -Finally the new CUP adds contextual precedence. A production may be -declare as followed: - -
    
    -lhs ::= {right hand side list of terminals, non-terminals and actions}
    -        %prec {terminal};
    -
    - -this production would then have a precedence equal to the terminal -specified after the %prec. Hence, shift/reduce conflicts can be -contextually resolved. Note that the %prec terminal -part comes after all actions strings. It does not come before the -last action string.

    - -For more information, refer to the manual on contextual -precedence. - -These changes implemented by: -

    -Frank Flannery
    -Department of Computer Science
    -Princeton University
    -

    - -

    Appendix D: Bugs

    -In this version of CUP it's difficult for the semantic action phrases (Java code attached -to productions) to access the report_error method and other similar methods and -objects defined in the parser code directive. -

    -This is because the parsing tables (and parsing engine) are in one object (belonging to -class parser or whatever name is specified by the -parser directive), -and the semantic actions are in another object (of class CUP$actions). -

    -However, there is a way to do it, though it's a bit inelegant. -The action object has a private final field named -parser that points to the parsing object. Thus, -methods and instance variables of the parser can be accessed within semantic actions as: -

    -    parser.report_error(message,info);
    -    x = parser.mydata;
    -
    -

    -Perhaps this will not be necessary in a future release, and that -such methods and variables as report_error and -mydata will be available -directly from the semantic actions; we will achieve this by combining the -"parser" object and the "actions" object together. - -

    -For a list of any other currently known bugs in CUP, see - -http://www.cs.princeton.edu/~appel/modern/java/CUP/bugs.html. - - -

    Appendix E: Change log

    - -
    -
    0.9e
    March 1996, Scott Hudson's original version. -
    0.10a
    August 1996, several major changes to -the interface. -
    0.10b
    November 1996, fixes a few minor bugs. -
    0.10c
    July 1997, fixes a bug related to precedence declarations. -
    0.10e
    September 1997, fixes a bug introduced in 0.10c relating -to nonassoc precedence. Thanks to -Tony Hosking -for reporting the bug and providing the fix. -Also recognizes carriage-return character as white space and fixes a -number of other small bugs. -
    0.10f
    December 1997, was a maintenance release. The CUP source -was cleaned up for JDK 1.1. -
    0.10g
    March 1998, adds new features and fixes old bugs. -The behavior of RESULT assignments was normalized, and a problem -with implicit start productions was fixed. The CUP grammar was -extended to allow array types for terminals and non-terminals, and -a command-line flag was added to allow the generation of a symbol -interface, rather than class. Bugs associated with multiple -invocations of a single parser object and multiple CUP classes in one -package have been stomped on. Documentation was updated, as well. -
    0.10h-0.10i
    February 1999, are maintenance releases. -
    0.10j
    July 1999, broadened the CUP input grammar to allow more -flexibility and improved scanner integration via the -java_cup.runtime.Scanner interface. -
    - - -
    - - -Java and HotJava are -trademarks of Sun Microsystems, Inc., -and refer to Sun's Java programming language and HotJava browser -technologies. -CUP is not sponsored by or affiliated with Sun Microsystems, Inc. - -
    - - - diff --git a/Robust/cup/winnt/README b/Robust/cup/winnt/README deleted file mode 100644 index 99a64716..00000000 --- a/Robust/cup/winnt/README +++ /dev/null @@ -1,17 +0,0 @@ -From toddk@MICROSOFT.com Tue Mar 24 22:07:19 1998 -Date: Fri, 30 Jan 1998 07:54:26 -0800 -From: Todd Knoblock -To: "'cananian@alumni.princeton.edu'" -Subject: Java cup under Windows NT. - -I wanted to try java cup under Windows NT. Rather than transliterating the -csh shell script, I put together a little makefile for it. I thought you -might want to include it in the distribution so that it is available for the -next person that wants to use java cup under Windows NT. - -Todd Knoblock - -To use, place this file in the root javacup directory (where the "java_cup" -directory lives), and type "nmake" from that directory. - -[The makefile has been included in this directory. -- CSA 24-Mar-1998 ] diff --git a/Robust/cup/winnt/makefile b/Robust/cup/winnt/makefile deleted file mode 100644 index 653f2075..00000000 --- a/Robust/cup/winnt/makefile +++ /dev/null @@ -1,51 +0,0 @@ -# -# Windows NT makefile for java_cup -# by Todd Knoblock, 28 January 1998. -# -# To run, type "nmake all" from the directory containing the make file. -# Tested under nmake version 1.62.7022 - -JVC=jvc -# -x means disable extensions -# -g means include debug information -# -w2 means warning level 2. -# Unfornately, anything above warning level 2 is noisy -JVCFLAGS= -x -g -w2 -JVIEW=jview - -.SUFFIXES: .java .class - -.java.class: - $(JVC) $(JVCFLAGS) $< - -all: runtime simple_calc java_cup test - -java_cup: java_cup\*.class - -runtime: java_cup\runtime\*.class - -simple_calc: java_cup\simple_calc\sym.java \ - java_cup\simple_calc\parser.java \ - java_cup\simple_calc\*.class - - -java_cup\simple_calc\sym.java: java_cup java_cup\simple_calc\parser.cup - $(JVIEW) java_cup.Main < java_cup\simple_calc\parser.cup - @del -f -q java_cup\simple_calc\sym.java >nul 2>nul - @del -f -q java_cup\simple_calc\parser.java >nul 2>nul - move sym.java java_cup\simple_calc\ - move parser.java java_cup\simple_calc\ - -java_cup\simple_calc\parser.java: java_cup\simple_calc\sym.java - -clean: - @del -f -q java_cup\simple_calc\sym.java >nul 2>nul - @del -f -q java_cup\simple_calc\parser.java >nul 2>nul - @for %d in (java_cup java_cup\runtime java_cup\simple_calc) do \ - @pushd %d \ - & del -f -q *.class >nul 2>nul \ - & popd - -test: simple_calc - @echo Executing the demo program. Answer should be 5050. - echo 101*100/2; | $(JVIEW) java_cup.simple_calc.Main diff --git a/Robust/rolebasedcomputation b/Robust/rolebasedcomputation deleted file mode 100644 index f917a9b0..00000000 --- a/Robust/rolebasedcomputation +++ /dev/null @@ -1,34 +0,0 @@ -Input: -trigger role specification for tasks: -role mutator operation: -role definition: - -Generate: -Role transition diagram - - -Initial features: -methods -structs -type system - -Language features: -Single Inheritance -Virtual methods -Objects - -object metastate: -1. flags: flag role1 -2. tags: tag tag1 - -tag operations: -tag tag1=new tag; -tag tag2=incrementtag(tag tag1); -tag tag3=no tag; - -metastate operations: - -task foo(type1 o1{role1||role2}, type2 o2{role3}) { - - exit(o1{role1'=false},o2{role3'=false},onew{role4=true}); -} \ No newline at end of file diff --git a/Robust/src/Analysis/CallGraph/CallGraph.java b/Robust/src/Analysis/CallGraph/CallGraph.java deleted file mode 100644 index b3e68e12..00000000 --- a/Robust/src/Analysis/CallGraph/CallGraph.java +++ /dev/null @@ -1,237 +0,0 @@ -package Analysis.CallGraph; -import IR.State; -import IR.Flat.FlatMethod; -import IR.Flat.FlatNode; -import IR.Flat.FlatCall; -import IR.Flat.FKind; -import IR.Descriptor; -import IR.ClassDescriptor; -import IR.MethodDescriptor; -import IR.TaskDescriptor; -import IR.TypeDescriptor; -import java.util.*; -import java.io.*; - -public class CallGraph { - private State state; - - // MethodDescriptor maps to HashSet - private Hashtable mapVirtual2ImplementationSet; - - // MethodDescriptor or TaskDescriptor maps to HashSet - private Hashtable mapCaller2CalleeSet; - - // MethodDescriptor maps to HashSet - private Hashtable mapCallee2CallerSet; - - public CallGraph(State state) { - this.state=state; - mapVirtual2ImplementationSet = new Hashtable(); - mapCaller2CalleeSet = new Hashtable(); - mapCallee2CallerSet = new Hashtable(); - buildVirtualMap(); - buildGraph(); - } - - // this method returns the set of Descriptors - // (MethodDescriptors and/or TaskDescriptors) - // that call the given method - public Set getCallerSet( MethodDescriptor md ) { - return (Set) mapCallee2CallerSet.get( md ); - } - - // this method returns the set of MethodDescriptors that - // are called by the given method or task - public Set getCalleeSet( Descriptor d ) { - assert (d instanceof MethodDescriptor) || - (d instanceof TaskDescriptor); - - return (Set) mapCaller2CalleeSet.get( d ); - } - - // build a mapping of virtual methods to all - // possible implementations of that method - private void buildVirtualMap() { - //Iterator through classes - Iterator it=state.getClassSymbolTable().getDescriptorsIterator(); - while(it.hasNext()) { - ClassDescriptor cn=(ClassDescriptor)it.next(); - Iterator methodit=cn.getMethods(); - //Iterator through methods - while(methodit.hasNext()) { - MethodDescriptor md=(MethodDescriptor)methodit.next(); - if (md.isStatic()||md.getReturnType()==null) - continue; - ClassDescriptor superdesc=cn.getSuperDesc(); - if (superdesc!=null) { - Set possiblematches=superdesc.getMethodTable().getSet(md.getSymbol()); - boolean foundmatch=false; - for(Iterator matchit=possiblematches.iterator();matchit.hasNext();) { - MethodDescriptor matchmd=(MethodDescriptor)matchit.next(); - if (md.matches(matchmd)) { - if (!mapVirtual2ImplementationSet.containsKey(matchmd)) - mapVirtual2ImplementationSet.put(matchmd,new HashSet()); - ((HashSet)mapVirtual2ImplementationSet.get(matchmd)).add(md); - break; - } - } - } - } - } - } - - public Set getMethods(MethodDescriptor md, TypeDescriptor type) { - return getMethods(md); - } - - /** Given a call to MethodDescriptor, lists the methods which - could actually be called due to virtual dispatch. */ - public Set getMethods(MethodDescriptor md) { - HashSet ns=new HashSet(); - ns.add(md); - Set s=(Set)mapVirtual2ImplementationSet.get(md); - if (s!=null) - for(Iterator it=s.iterator();it.hasNext();) { - MethodDescriptor md2=(MethodDescriptor)it.next(); - ns.addAll(getMethods(md2)); - } - return ns; - } - - /** Given a call to MethodDescriptor, lists the methods which - could actually be call by that method. */ - public Set getMethodCalls(MethodDescriptor md) { - HashSet ns=new HashSet(); - ns.add(md); - Set s=(Set)mapCaller2CalleeSet.get(md); - if (s!=null) - for(Iterator it=s.iterator();it.hasNext();) { - MethodDescriptor md2=(MethodDescriptor)it.next(); - ns.addAll(getMethodCalls(md2)); - } - return ns; - } - - private void buildGraph() { - Iterator it=state.getClassSymbolTable().getDescriptorsIterator(); - while(it.hasNext()) { - ClassDescriptor cn=(ClassDescriptor)it.next(); - Iterator methodit=cn.getMethods(); - //Iterator through methods - while(methodit.hasNext()) { - MethodDescriptor md=(MethodDescriptor)methodit.next(); - analyzeMethod( (Object)md, state.getMethodFlat(md) ); - } - } - it=state.getTaskSymbolTable().getDescriptorsIterator(); - while(it.hasNext()) { - TaskDescriptor td=(TaskDescriptor)it.next(); - analyzeMethod( (Object)td, state.getMethodFlat(td) ); - } - } - - private void analyzeMethod(Object caller, FlatMethod fm) { - HashSet toexplore=new HashSet(); - toexplore.add(fm); - HashSet explored=new HashSet(); - //look at all the nodes in the flat representation - while(!toexplore.isEmpty()) { - FlatNode fn=(FlatNode)(toexplore.iterator()).next(); - toexplore.remove(fn); - explored.add(fn); - for(int i=0;i callee maps - if( !mapCaller2CalleeSet.containsKey( caller ) ) { - mapCaller2CalleeSet.put( caller, new HashSet() ); - } - ((HashSet)mapCaller2CalleeSet.get( caller )).addAll( methodsthatcouldbecalled ); - - // add callee -> caller maps - Iterator calleeItr = methodsthatcouldbecalled.iterator(); - while( calleeItr.hasNext() ) { - MethodDescriptor callee = (MethodDescriptor) calleeItr.next(); - if( !mapCallee2CallerSet.containsKey( callee ) ) { - mapCallee2CallerSet.put( callee, new HashSet() ); - } - ((HashSet)mapCallee2CallerSet.get( callee )).add( caller ); - } - } - } - } - - public void writeToDot( String graphName ) throws java.io.IOException { - // each task or method only needs to be labeled once - // in a dot file - HashSet labeledInDot = new HashSet(); - - // write out the call graph using the callees mapping - BufferedWriter bw = new BufferedWriter( new FileWriter( graphName+"byCallees.dot" ) ); - bw.write( "digraph "+graphName+"byCallees {\n" ); - Iterator mapItr = mapCallee2CallerSet.entrySet().iterator(); - while( mapItr.hasNext() ) { - Map.Entry me = (Map.Entry) mapItr.next(); - MethodDescriptor callee = (MethodDescriptor) me.getKey(); - HashSet callerSet = (HashSet) me.getValue(); - - if( !labeledInDot.contains( callee ) ) { - labeledInDot.add( callee ); - bw.write( " " + callee.getNum() + "[label=\"" + callee + "\"];\n" ); - } - - Iterator callerItr = callerSet.iterator(); - while( callerItr.hasNext() ) { - Descriptor caller = (Descriptor) callerItr.next(); - - if( !labeledInDot.contains( caller ) ) { - labeledInDot.add( caller ); - bw.write( " " + caller.getNum() + "[label=\"" + caller + "\"];\n" ); - } - - bw.write( " " + callee.getNum() + "->" + caller.getNum() + ";\n" ); - } - } - bw.write( "}\n" ); - bw.close(); - - // write out the call graph (should be equivalent) by - // using the callers mapping - labeledInDot = new HashSet(); - bw = new BufferedWriter( new FileWriter( graphName+"byCallers.dot" ) ); - bw.write( "digraph "+graphName+"byCallers {\n" ); - mapItr = mapCaller2CalleeSet.entrySet().iterator(); - while( mapItr.hasNext() ) { - Map.Entry me = (Map.Entry) mapItr.next(); - Descriptor caller = (Descriptor) me.getKey(); - HashSet calleeSet = (HashSet) me.getValue(); - - if( !labeledInDot.contains( caller ) ) { - labeledInDot.add( caller ); - bw.write( " " + caller.getNum() + "[label=\"" + caller + "\"];\n" ); - } - - Iterator calleeItr = calleeSet.iterator(); - while( calleeItr.hasNext() ) { - MethodDescriptor callee = (MethodDescriptor) calleeItr.next(); - - if( !labeledInDot.contains( callee ) ) { - labeledInDot.add( callee ); - bw.write( " " + callee.getNum() + "[label=\"" + callee + "\"];\n" ); - } - - bw.write( " " + callee.getNum() + "->" + caller.getNum() + ";\n" ); - } - } - bw.write( "}\n" ); - bw.close(); - } -} diff --git a/Robust/src/Analysis/FlatIRGraph/FlatIRGraph.java b/Robust/src/Analysis/FlatIRGraph/FlatIRGraph.java deleted file mode 100644 index ac816503..00000000 --- a/Robust/src/Analysis/FlatIRGraph/FlatIRGraph.java +++ /dev/null @@ -1,117 +0,0 @@ -package Analysis.FlatIRGraph; - -import IR.*; -import IR.Flat.*; -import java.util.*; -import java.io.*; - -public class FlatIRGraph { - - private State state; - - private BufferedWriter flatbw; - - private HashSet visited; - private HashSet toVisit; - - private int labelindex; - private Hashtable flatnodetolabel; - - public FlatIRGraph(State state, boolean tasks, boolean usermethods, boolean libmethods) throws java.io.IOException { - this.state=state; - - if( tasks ) - graphTasks(); - - if( usermethods || libmethods ) - graphMethods(); - } - - private void graphTasks() throws java.io.IOException { - for(Iterator it_tasks=state.getTaskSymbolTable().getDescriptorsIterator();it_tasks.hasNext();) { - TaskDescriptor td = (TaskDescriptor)it_tasks.next(); - FlatMethod fm = state.getMethodFlat(td); - writeFlatIRGraph(fm,"task"+td.getSymbol()); - } - } - - private void graphMethods() throws java.io.IOException { - for(Iterator it_classes=state.getClassSymbolTable().getDescriptorsIterator();it_classes.hasNext();) { - ClassDescriptor cd = (ClassDescriptor)it_classes.next(); - for(Iterator it_methods=cd.getMethods();it_methods.hasNext();) { - MethodDescriptor md = (MethodDescriptor)it_methods.next(); - FlatMethod fm = state.getMethodFlat(md); - writeFlatIRGraph(fm,cd.getSymbol()+"."+md.getSymbol()); - } - } - } - - private void writeFlatIRGraph( FlatMethod fm, String graphname ) throws java.io.IOException { - // give every node in the flat IR graph a unique label - // so a human being can inspect the graph and verify - // correctness - flatnodetolabel=new Hashtable(); - visited=new HashSet(); - labelindex=0; - labelFlatNodes( fm ); - - // take symbols out of graphname that cause dot to fail - graphname = graphname.replaceAll( "[\\W]", "" ); - - flatbw=new BufferedWriter( new FileWriter( graphname+"_flatIRGraph.dot" ) ); - flatbw.write("digraph "+graphname+" {\n"); - - visited=new HashSet(); - toVisit=new HashSet(); - toVisit.add(fm); - - while( !toVisit.isEmpty() ) { - FlatNode fn=(FlatNode)toVisit.iterator().next(); - toVisit.remove(fn); - visited.add(fn); - - if( fn.kind() == FKind.FlatMethod ) { - // FlatMethod does not have toString - flatbw.write( makeDotNodeDec( graphname, flatnodetolabel.get(fn), fn.getClass().getName(), "FlatMethod" ) ); - } else { - flatbw.write( makeDotNodeDec( graphname, flatnodetolabel.get(fn), fn.getClass().getName(), fn.toString() ) ); - } - - for(int i=0;i node"+flatnodetolabel.get(nn)+";\n" ); - - if( !visited.contains( nn ) ) { - toVisit.add( nn ); - } - } - } - - flatbw.write( "}\n" ); - flatbw.close(); - } - - private void labelFlatNodes(FlatNode fn) { - visited.add(fn); - flatnodetolabel.put(fn,new Integer(labelindex++)); - for(int i=0;i bindings=locality.getLocalityBindings(); - Iterator bindit=bindings.iterator(); - while(bindit.hasNext()) { - LocalityBinding lb=bindit.next(); - //Don't need to do conversion if it is already atomic - if (lb.isAtomic()) - continue; - converttoPtr(lb); - converttoOid(lb); - } - } - - /* At the end of an atomic block, we need to convert any global - * references that will be used again into OID's. */ - - private void converttoOid(LocalityBinding lb) { - Hashtable atomictab=locality.getAtomic(lb); - Hashtable> temptab=locality.getNodeTempInfo(lb); - MethodDescriptor md=lb.getMethod(); - FlatMethod fm=state.getMethodFlat(md); - Hashtable> nodetotnpair=new Hashtable>(); - Hashtable> nodetoconvs=new Hashtable>(); - - Set toprocess=fm.getNodeSet(); - - while(!toprocess.isEmpty()) { - FlatNode fn=toprocess.iterator().next(); - toprocess.remove(fn); - boolean isatomic=atomictab.get(fn).intValue()>0; - Hashtable nodetemptab=temptab.get(fn); - - List reads=Arrays.asList(fn.readsTemps()); - List writes=Arrays.asList(fn.writesTemps()); - - if (!isatomic&&fn.kind()==FKind.FlatAtomicExitNode - &&!nodetoconvs.containsKey(fn)) - nodetoconvs.put(fn, new HashSet()); - - HashSet tempset=new HashSet(); - - for(int i=0;i prevset=nodetotnpair.get(fnprev); - for(Iterator it=prevset.iterator();it.hasNext();) { - TempNodePair tnp=it.next(); - if (fn.kind()==FKind.FlatGlobalConvNode&& - ((FlatGlobalConvNode)fn).getLocality()!=lb) { - //ignore this node - tempset.add(tnp); - continue; - } - if (reads.contains(tnp.getTemp())&&tnp.getNode()!=null) { - //Value actually is read... - nodetoconvs.get(tnp.getNode()).add(tnp.getTemp()); - } - if (writes.contains(tnp.getTemp())) //value overwritten - continue; - if (!isatomic&&fn.kind()==FKind.FlatAtomicExitNode) { - //Create new node and tag it with this exit - if (tnp.getNode()==null) { - TempNodePair tnp2=new TempNodePair(tnp.getTemp()); - tnp2.setNode(fn); - tempset.add(tnp2); - } else - tempset.add(tnp); - } else - tempset.add(tnp); - } - } - if (isatomic) { - /* If this is in an atomic block, record temps that - * are written to.*/ - - /* NOTE: If this compiler is changed to maintain - * OID/Ptr's in variables, then we need to use all - * global temps that could be read and not just the - * ones converted by globalconvnode*/ - - if (fn.kind()!=FKind.FlatGlobalConvNode|| - ((FlatGlobalConvNode)fn).getLocality()==lb) { - /*If globalconvnode, make sure we have the right - * locality. */ - for(Iterator writeit=writes.iterator();writeit.hasNext();) { - TempDescriptor wrtmp=writeit.next(); - if (nodetemptab.get(wrtmp)==LocalityAnalysis.GLOBAL) { - TempNodePair tnp=new TempNodePair(wrtmp); - tempset.add(tnp); - } - } - } - } - if (!nodetotnpair.containsKey(fn)||!nodetotnpair.get(fn).equals(tempset)) { - //changes to set, so enqueue next nodes - nodetotnpair.put(fn, tempset); //update set - for(int i=0;i it=toprocess.iterator();it.hasNext();) { - FlatNode fn=it.next(); - if (atomictab.get(fn).intValue()==0&&fn.numPrev()>0&& - atomictab.get(fn.getPrev(0)).intValue()>0) { - //sanity check - assert(fn.kind()==FKind.FlatAtomicExitNode); - //insert calls here... - Set tempset=nodetoconvs.get(fn); - for(Iterator tempit=tempset.iterator();tempit.hasNext();) { - FlatGlobalConvNode fgcn=new FlatGlobalConvNode(tempit.next(), lb, false); - atomictab.put(fgcn, atomictab.get(fn)); - temptab.put(fgcn, (Hashtable) temptab.get(fn).clone()); - - for(int i=0;i> nodetotranstemps=new Hashtable>(); - Hashtable atomictab=locality.getAtomic(lb); - Hashtable> temptab=locality.getNodeTempInfo(lb); - MethodDescriptor md=lb.getMethod(); - FlatMethod fm=state.getMethodFlat(md); - Set toprocess=fm.getNodeSet(); - - while(!toprocess.isEmpty()) { - FlatNode fn=toprocess.iterator().next(); - toprocess.remove(fn); - - if (atomictab.get(fn).intValue()>0) { - //build set of transaction temps use by next nodes - HashSet transtemps=new HashSet(); - for(int i=0;i pretemptab=locality.getNodePreTempInfo(lb, fn); - TempDescriptor []readtemps=fn.readsTemps(); - for(int i=0;i it=toprocess.iterator();it.hasNext();) { - FlatNode fn=it.next(); - if (atomictab.get(fn).intValue()>0&& - atomictab.get(fn.getPrev(0)).intValue()==0) { - //sanity check - assert(fn.kind()==FKind.FlatAtomicEnterNode); - - //insert calls here... - Set tempset=nodetotranstemps.get(fn); - for(Iterator tempit=tempset.iterator();tempit.hasNext();) { - FlatGlobalConvNode fgcn=new FlatGlobalConvNode(tempit.next(), lb, true); - atomictab.put(fgcn, atomictab.get(fn)); - temptab.put(fgcn, (Hashtable) temptab.get(fn).clone()); - fgcn.addNext(fn.getNext(0)); - fn.setNext(0, fgcn); - } - } - } - } -} diff --git a/Robust/src/Analysis/Locality/LocalityAnalysis.java b/Robust/src/Analysis/Locality/LocalityAnalysis.java deleted file mode 100644 index adac83f8..00000000 --- a/Robust/src/Analysis/Locality/LocalityAnalysis.java +++ /dev/null @@ -1,727 +0,0 @@ -package Analysis.Locality; - -import java.util.*; -import Analysis.CallGraph.CallGraph; -import IR.SymbolTable; -import IR.State; -import IR.TypeUtil; -import IR.MethodDescriptor; -import IR.Flat.*; -import IR.ClassDescriptor; - -public class LocalityAnalysis { - State state; - Stack lbtovisit; - Hashtable discovered; - Hashtable> dependence; - Hashtable> calldep; - Hashtable>> temptab; - Hashtable> atomictab; - Hashtable>> tempstosave; - Hashtable> classtolb; - Hashtable> methodtolb; - private LocalityBinding lbmain; - private LocalityBinding lbrun; - - CallGraph callgraph; - TypeUtil typeutil; - public static final Integer LOCAL=new Integer(0); - public static final Integer GLOBAL=new Integer(1); - public static final Integer EITHER=new Integer(2); - public static final Integer CONFLICT=new Integer(3); - - public LocalityAnalysis(State state, CallGraph callgraph, TypeUtil typeutil) { - this.typeutil=typeutil; - this.state=state; - this.discovered=new Hashtable(); - this.dependence=new Hashtable>(); - this.calldep=new Hashtable>(); - this.temptab=new Hashtable>>(); - this.atomictab=new Hashtable>(); - this.lbtovisit=new Stack(); - this.callgraph=callgraph; - this.tempstosave=new Hashtable>>(); - this.classtolb=new Hashtable>(); - this.methodtolb=new Hashtable>(); - doAnalysis(); - } - - public LocalityBinding getMain() { - return lbmain; - } - - /** This method returns the set of LocalityBindings that a given - * flatcall could invoke */ - - public LocalityBinding getBinding(LocalityBinding currlb, FlatCall fc) { - boolean isatomic=getAtomic(currlb).get(fc).intValue()>0; - Hashtable currtable=getNodePreTempInfo(currlb,fc); - MethodDescriptor md=fc.getMethod(); - - boolean isnative=md.getModifiers().isNative(); - - LocalityBinding lb=new LocalityBinding(md, isatomic); - - for(int i=0;i getClassBindings(ClassDescriptor cd) { - return classtolb.get(cd); - } - - /** This method returns a set of LocalityBindings for the parameter method. */ - - public Set getMethodBindings(MethodDescriptor md) { - return methodtolb.get(md); - } - - public Set getMethods() { - return methodtolb.keySet(); - } - - /** This method returns a set of LocalityBindings. A - * LocalityBinding specifies a context a method can be invoked in. - * It specifies whether the method is in a transaction and whether - * its parameter objects are locals or globals. */ - - public Set getLocalityBindings() { - return discovered.keySet(); - } - - /** This method returns a hashtable for a given LocalityBinding - * that tells the current local/global status of temps at the each - * node in the flat representation. */ - - public Hashtable> getNodeTempInfo(LocalityBinding lb) { - return temptab.get(lb); - } - - /** This method returns a hashtable for a given LocalityBinding - * that tells the current local/global status of temps at the - * beginning of each node in the flat representation. */ - - public Hashtable getNodePreTempInfo(LocalityBinding lb, FlatNode fn) { - Hashtable currtable=new Hashtable(); - Hashtable> temptable=getNodeTempInfo(lb); - - for(int i=0;i prevtable=temptable.get(prevnode); - for(Iterator tempit=prevtable.keySet().iterator();tempit.hasNext();) { - TempDescriptor temp=tempit.next(); - Integer tmpint=prevtable.get(temp); - Integer oldint=currtable.containsKey(temp)?currtable.get(temp):EITHER; - Integer newint=merge(tmpint, oldint); - currtable.put(temp, newint); - } - } - return currtable; - } - - /** This method returns an hashtable for a given LocalitBinding - * that tells whether a node in the flat represenation is in a - * transaction or not. Integer values greater than 0 indicate - * that the node is in a transaction and give the nesting depth. - * The outermost AtomicEnterNode will have a value of 1 and the - * outermost AtomicExitNode will have a value of 0. */ - - public Hashtable getAtomic(LocalityBinding lb) { - return atomictab.get(lb); - } - - /** This methods returns a hashtable for a given LocalityBinding - * that tells which temps needs to be saved for each - * AtomicEnterNode. */ - - public Hashtable> getTemps(LocalityBinding lb) { - return tempstosave.get(lb); - } - - public Set getTempSet(LocalityBinding lb) { - HashSet set=new HashSet(); - Hashtable> table=getTemps(lb); - if (table!=null) - for(Iterator faenit=table.keySet().iterator();faenit.hasNext();) { - FlatAtomicEnterNode faen=faenit.next(); - set.addAll(table.get(faen)); - } - return set; - } - - private void doAnalysis() { - computeLocalityBindings(); - computeTempstoSave(); - cleanSets(); - } - - private void cleanSets() { - HashSet lbset=new HashSet(); - Stack lbstack=new Stack(); - lbstack.add(lbmain); - lbstack.add(lbrun); - lbset.add(lbmain); - lbset.add(lbrun); - while(!lbstack.isEmpty()) { - LocalityBinding lb=lbstack.pop(); - if (calldep.containsKey(lb)) { - Set set=new HashSet(); - set.addAll(calldep.get(lb)); - set.removeAll(lbset); - lbstack.addAll(set); - lbset.addAll(set); - } - } - for(Iterator lbit=discovered.keySet().iterator();lbit.hasNext();) { - LocalityBinding lb=lbit.next(); - if (!lbset.contains(lb)) { - lbit.remove(); - classtolb.get(lb.getMethod().getClassDesc()).remove(lb); - methodtolb.get(lb.getMethod()).remove(lb); - } - } - } - - private void computeLocalityBindings() { - lbmain=new LocalityBinding(typeutil.getMain(), false); - lbmain.setGlobalReturn(EITHER); - lbmain.setGlobal(0, LOCAL); - lbtovisit.add(lbmain); - discovered.put(lbmain, lbmain); - if (!classtolb.containsKey(lbmain.getMethod().getClassDesc())) - classtolb.put(lbmain.getMethod().getClassDesc(), new HashSet()); - classtolb.get(lbmain.getMethod().getClassDesc()).add(lbmain); - - if (!methodtolb.containsKey(lbmain.getMethod())) - methodtolb.put(lbmain.getMethod(), new HashSet()); - methodtolb.get(lbmain.getMethod()).add(lbmain); - - //Do this to force a virtual table number for the run method - lbrun=new LocalityBinding(typeutil.getRun(), false); - lbrun.setGlobalReturn(EITHER); - lbrun.setGlobalThis(GLOBAL); - lbtovisit.add(lbrun); - discovered.put(lbrun, lbrun); - if (!classtolb.containsKey(lbrun.getMethod().getClassDesc())) - classtolb.put(lbrun.getMethod().getClassDesc(), new HashSet()); - classtolb.get(lbrun.getMethod().getClassDesc()).add(lbrun); - - if (!methodtolb.containsKey(lbrun.getMethod())) - methodtolb.put(lbrun.getMethod(), new HashSet()); - methodtolb.get(lbrun.getMethod()).add(lbrun); - - while(!lbtovisit.empty()) { - LocalityBinding lb=(LocalityBinding) lbtovisit.pop(); - Integer returnglobal=lb.getGlobalReturn(); - MethodDescriptor md=lb.getMethod(); - Hashtable> temptable=new Hashtable>(); - Hashtable atomictable=new Hashtable(); - calldep.remove(lb); - try { - computeCallsFlags(md, lb, temptable, atomictable); - } catch (Error e) { - System.out.println("Error in "+md+" context "+lb); - e.printStackTrace(); - System.exit(-1); - } - atomictab.put(lb, atomictable); - temptab.put(lb, temptable); - - if (md.getReturnType()!=null&&!returnglobal.equals(lb.getGlobalReturn())) { - //return type is more precise now - //rerun everything that call us - lbtovisit.addAll(dependence.get(lb)); - } - } - } - - public void computeCallsFlags(MethodDescriptor md, LocalityBinding lb, Hashtable> temptable, Hashtable atomictable) { - FlatMethod fm=state.getMethodFlat(md); - HashSet tovisit=new HashSet(); - tovisit.add(fm.getNext(0)); - { - // Build table for initial node - Hashtable table=new Hashtable(); - temptable.put(fm, table); - atomictable.put(fm, lb.isAtomic()?1:0); - int offset=md.isStatic()?0:1; - if (!md.isStatic()) { - table.put(fm.getParameter(0), lb.getGlobalThis()); - } - for(int i=offset;i currtable=new Hashtable(); - int atomicstate=0; - for(int i=0;i prevtable=temptable.get(prevnode); - for(Iterator tempit=prevtable.keySet().iterator();tempit.hasNext();) { - TempDescriptor temp=tempit.next(); - Integer tmpint=prevtable.get(temp); - Integer oldint=currtable.containsKey(temp)?currtable.get(temp):EITHER; - Integer newint=merge(tmpint, oldint); - currtable.put(temp, newint); - } - } - atomictable.put(fn, atomicstate); - // Process this node - switch(fn.kind()) { - case FKind.FlatAtomicEnterNode: - processAtomicEnterNode((FlatAtomicEnterNode)fn, atomictable); - if (!lb.isAtomic()) - lb.setHasAtomic(); - break; - case FKind.FlatAtomicExitNode: - processAtomicExitNode((FlatAtomicExitNode)fn, atomictable); - break; - case FKind.FlatCall: - processCallNode(lb, (FlatCall)fn, currtable, isAtomic(atomictable, fn)); - break; - case FKind.FlatFieldNode: - processFieldNode(lb, (FlatFieldNode)fn, isAtomic(atomictable, fn), currtable); - break; - case FKind.FlatSetFieldNode: - processSetFieldNode(lb, (FlatSetFieldNode)fn, isAtomic(atomictable,fn), currtable); - break; - case FKind.FlatNew: - processNew(lb, (FlatNew)fn, isAtomic(atomictable, fn), currtable); - break; - case FKind.FlatOpNode: - processOpNode((FlatOpNode)fn, currtable); - break; - case FKind.FlatCastNode: - processCastNode((FlatCastNode)fn, currtable); - break; - case FKind.FlatLiteralNode: - processLiteralNode((FlatLiteralNode)fn, currtable); - break; - case FKind.FlatReturnNode: - processReturnNode(lb, (FlatReturnNode)fn, currtable); - break; - case FKind.FlatSetElementNode: - processSetElementNode(lb, (FlatSetElementNode)fn, currtable, isAtomic(atomictable, fn)); - break; - case FKind.FlatElementNode: - processElementNode(lb, (FlatElementNode)fn, currtable, isAtomic(atomictable, fn)); - break; - case FKind.FlatCondBranch: - case FKind.FlatBackEdge: - case FKind.FlatNop: - case FKind.FlatPrefetchNode: - //No action needed for these - break; - case FKind.FlatFlagActionNode: - case FKind.FlatCheckNode: - case FKind.FlatTagDeclaration: - throw new Error("Incompatible with tasks!"); - case FKind.FlatMethod: - default: - throw new Error(); - } - Hashtable oldtable=temptable.get(fn); - if (oldtable==null||!oldtable.equals(currtable)) { - // Update table for this node - temptable.put(fn, currtable); - for(int i=0;i atomictable, FlatNode fn) { - return atomictable.get(fn).intValue()>0; - } - - private static Integer merge(Integer a, Integer b) { - if (a==null||a.equals(EITHER)) - return b; - if (b==null||b.equals(EITHER)) - return a; - if (a.equals(b)) - return a; - return CONFLICT; - } - - void processCallNode(LocalityBinding currlb, FlatCall fc, Hashtable currtable, boolean isatomic) { - MethodDescriptor nodemd=fc.getMethod(); - Set methodset=null; - Set runmethodset=null; - - if (nodemd.isStatic()||nodemd.getReturnType()==null) { - methodset=new HashSet(); - methodset.add(nodemd); - } else { - methodset=callgraph.getMethods(nodemd, fc.getThis().getType()); - // Build start -> run link - if (nodemd.getClassDesc().getSymbol().equals(TypeUtil.ThreadClass)&& - nodemd.getSymbol().equals("start")&&!nodemd.getModifiers().isStatic()&& - nodemd.numParameters()==1&&nodemd.getParamType(0).isInt()) { - assert(nodemd.getModifiers().isNative()); - - MethodDescriptor runmd=null; - for(Iterator methodit=nodemd.getClassDesc().getMethodTable().getSet("run").iterator();methodit.hasNext();) { - MethodDescriptor md=(MethodDescriptor) methodit.next(); - if (md.numParameters()!=0||md.getModifiers().isStatic()) - continue; - runmd=md; - break; - } - if (runmd!=null) { - runmethodset=callgraph.getMethods(runmd,fc.getThis().getType()); - methodset.addAll(runmethodset); - } else throw new Error("Can't find run method"); - } - } - - Integer currreturnval=EITHER; //Start off with the either value - for(Iterator methodit=methodset.iterator();methodit.hasNext();) { - MethodDescriptor md=(MethodDescriptor) methodit.next(); - - boolean isnative=md.getModifiers().isNative(); - boolean isjoin = md.getClassDesc().getSymbol().equals(TypeUtil.ThreadClass)&&!nodemd.getModifiers().isStatic()&&nodemd.numParameters()==0&&md.getSymbol().equals("join"); - - LocalityBinding lb=new LocalityBinding(md, isatomic); - if (isnative&&isatomic) { - System.out.println("Don't call native methods in atomic blocks!"+currlb.getMethod()); - } - if (runmethodset==null||!runmethodset.contains(md)) { - //Skip this part if it is a run method - for(int i=0;i()); - classtolb.get(lb.getMethod().getClassDesc()).add(lb); - if (!methodtolb.containsKey(lb.getMethod())) - methodtolb.put(lb.getMethod(), new HashSet()); - methodtolb.get(lb.getMethod()).add(lb); - } else - lb=discovered.get(lb); - Integer returnval=lb.getGlobalReturn(); - currreturnval=merge(returnval, currreturnval); - if (!dependence.containsKey(lb)) - dependence.put(lb, new HashSet()); - dependence.get(lb).add(currlb); - - if (!calldep.containsKey(currlb)) - calldep.put(currlb, new HashSet()); - calldep.get(currlb).add(lb); - } - if (fc.getReturnTemp()!=null) { - currtable.put(fc.getReturnTemp(), currreturnval); - } - } - - void processFieldNode(LocalityBinding lb, FlatFieldNode ffn, boolean transaction, Hashtable currtable) { - Integer type=currtable.get(ffn.getSrc()); - TempDescriptor dst=ffn.getDst(); - if (type.equals(LOCAL)) { - if (ffn.getField().isGlobal()) - currtable.put(dst,GLOBAL); - else - currtable.put(dst,LOCAL); - } else if (type.equals(GLOBAL)) { - if (!transaction) - throw new Error("Global access outside of a transaction in context:\n"+lb.getExplanation()); - if (ffn.getField().getType().isPrimitive()&&!ffn.getField().getType().isArray()) - currtable.put(dst, LOCAL); // primitives are local - else - currtable.put(dst, GLOBAL); - } else if (type.equals(EITHER)) { - if (ffn.getField().getType().isPrimitive()&&!ffn.getField().getType().isArray()) - currtable.put(dst, LOCAL); // primitives are local - else if (ffn.getField().isGlobal()) - currtable.put(dst, GLOBAL); - else - currtable.put(dst, EITHER); - } else if (type.equals(CONFLICT)) { - throw new Error("Access to object that could be either global or local in context:\n"+lb.getExplanation()); - } - } - - //need to handle primitives - void processSetFieldNode(LocalityBinding lb, FlatSetFieldNode fsfn, boolean transaction, Hashtable currtable) { - Integer srctype=currtable.get(fsfn.getSrc()); - Integer dsttype=currtable.get(fsfn.getDst()); - - if (dsttype.equals(LOCAL)) { - if (fsfn.getField().isGlobal()) { - if (!(srctype.equals(GLOBAL)||srctype.equals(EITHER))) - throw new Error("Writing possible local reference to global field in context: \n"+lb.getExplanation()); - } else { - if (!(srctype.equals(LOCAL)||srctype.equals(EITHER))) - throw new Error("Writing possible global reference to local object in context: \n"+lb.getExplanation()); - } - } else if (dsttype.equals(GLOBAL)) { - if (!transaction) - throw new Error("Global access outside of a transaction in context:\n"+lb.getExplanation()); - //okay to store primitives in global object - if (srctype.equals(LOCAL) && fsfn.getField().getType().isPrimitive() && ! fsfn.getField().getType().isArray()) - return; - if (!(srctype.equals(GLOBAL)||srctype.equals(EITHER))) - throw new Error("Writing possible local reference to global object in context:\n"+lb.getExplanation()+" for FlatFieldNode "+fsfn); - } else if (dsttype.equals(EITHER)) { - if (srctype.equals(CONFLICT)) - throw new Error("Using reference that could be local or global in context:\n"+lb.getExplanation()); - } else if (dsttype.equals(CONFLICT)) { - throw new Error("Access to object that could be either global or local in context:\n"+lb.getExplanation()); - } - } - - void processNew(LocalityBinding lb, FlatNew fn, boolean transaction, Hashtable currtable) { - if (fn.isGlobal()&&!transaction) { - throw new Error("Allocating global object outside of transaction in context:"+lb.getExplanation()); - } - if (fn.isGlobal()) - currtable.put(fn.getDst(), GLOBAL); - else - currtable.put(fn.getDst(), LOCAL); - } - - void processOpNode(FlatOpNode fon, Hashtable currtable) { - /* Just propagate value */ - Integer srcvalue=currtable.get(fon.getLeft()); - - if (srcvalue==null) { - if (!fon.getLeft().getType().isPtr()) { - srcvalue=LOCAL; - } else - throw new Error(fon.getLeft()+" is undefined!"); - } - currtable.put(fon.getDest(), srcvalue); - } - - void processCastNode(FlatCastNode fcn, Hashtable currtable) { - currtable.put(fcn.getDst(), currtable.get(fcn.getSrc())); - } - - void processLiteralNode(FlatLiteralNode fln, Hashtable currtable) { - //null is either - if (fln.getValue()==null) - currtable.put(fln.getDst(), EITHER); - else - currtable.put(fln.getDst(), LOCAL); - } - - void processReturnNode(LocalityBinding lb, FlatReturnNode frn, Hashtable currtable) { - if(frn.getReturnTemp()!=null) { - Integer returntype=currtable.get(frn.getReturnTemp()); - lb.setGlobalReturn(merge(returntype, lb.getGlobalReturn())); - } - } - - void processSetElementNode(LocalityBinding lb, FlatSetElementNode fsen, Hashtable currtable, boolean isatomic) { - Integer srctype=currtable.get(fsen.getSrc()); - Integer dsttype=currtable.get(fsen.getDst()); - - if (dsttype.equals(LOCAL)) { - if (!(srctype.equals(LOCAL)||srctype.equals(EITHER))) - throw new Error("Writing possible global reference to local object in context:\n"+lb.getExplanation()+fsen); - } else if (dsttype.equals(GLOBAL)) { - if (srctype.equals(LOCAL) && fsen.getDst().getType().dereference().isPrimitive() && ! fsen.getDst().getType().dereference().isArray()) - return; - if (!(srctype.equals(GLOBAL)||srctype.equals(EITHER))) - throw new Error("Writing possible local reference to global object in context:\n"+lb.getExplanation()); - if (!isatomic) - throw new Error("Global access outside of a transaction in context:\n"+lb.getExplanation()); - } else if (dsttype.equals(EITHER)) { - if (srctype.equals(CONFLICT)) - throw new Error("Using reference that could be local or global in context:\n"+lb.getExplanation()); - } else if (dsttype.equals(CONFLICT)) { - throw new Error("Access to object that could be either global or local in context:\n"+lb.getExplanation()); - } - } - - void processElementNode(LocalityBinding lb, FlatElementNode fen, Hashtable currtable, boolean isatomic) { - Integer type=currtable.get(fen.getSrc()); - TempDescriptor dst=fen.getDst(); - if (type.equals(LOCAL)) { - currtable.put(dst,LOCAL); - } else if (type.equals(GLOBAL)) { - if (!isatomic) - throw new Error("Global access outside of a transaction in context:\n"+lb.getExplanation()); - if(fen.getSrc().getType().dereference().isPrimitive()&& - !fen.getSrc().getType().dereference().isArray()) - currtable.put(dst, LOCAL); - else - currtable.put(dst, GLOBAL); - } else if (type.equals(EITHER)) { - if(fen.getSrc().getType().dereference().isPrimitive()&& - !fen.getSrc().getType().dereference().isArray()) - currtable.put(dst, LOCAL); - else - currtable.put(dst, EITHER); - } else if (type.equals(CONFLICT)) { - throw new Error("Access to object that could be either global or local in context:\n"+lb.getExplanation()); - } - } - - void processAtomicEnterNode(FlatAtomicEnterNode fen, Hashtable atomictable) { - int atomic=atomictable.get(fen).intValue(); - atomictable.put(fen, new Integer(atomic+1)); - } - - void processAtomicExitNode(FlatAtomicExitNode fen, Hashtable atomictable) { - int atomic=atomictable.get(fen).intValue(); - atomictable.put(fen, new Integer(atomic-1)); - } - - private Hashtable> computeLiveTemps(FlatMethod fm) { - Hashtable> nodetotemps=new Hashtable>(); - - Set toprocess=fm.getNodeSet(); - - while(!toprocess.isEmpty()) { - FlatNode fn=toprocess.iterator().next(); - toprocess.remove(fn); - - List reads=Arrays.asList(fn.readsTemps()); - List writes=Arrays.asList(fn.writesTemps()); - - HashSet tempset=new HashSet(); - for(int i=0;i lbit=getLocalityBindings().iterator();lbit.hasNext();) { - LocalityBinding lb=lbit.next(); - computeTempstoSave(lb); - } - } - - /* Need to checkpoint all temps that could be read from along any - * path that are either: - 1) Written to by any assignment inside the transaction - 2) Read from a global temp. - - Generate tempstosave map from - localitybinding->flatatomicenternode->Set - */ - - private void computeTempstoSave(LocalityBinding lb) { - if (lb.isAtomic()) - return; - Hashtable atomictab=getAtomic(lb); - Hashtable> temptab=getNodeTempInfo(lb); - MethodDescriptor md=lb.getMethod(); - FlatMethod fm=state.getMethodFlat(md); - Hashtable> nodetotemps=computeLiveTemps(fm); - Hashtable> nodetosavetemps=new Hashtable>(); - tempstosave.put(lb, nodetosavetemps); - Hashtable nodemap=new Hashtable(); - HashSet toprocess=new HashSet(); - HashSet discovered=new HashSet(); - toprocess.add(fm); - discovered.add(fm); - while(!toprocess.isEmpty()) { - FlatNode fn=toprocess.iterator().next(); - toprocess.remove(fn); - boolean isatomic=atomictab.get(fn).intValue()>0; - if (isatomic&& - atomictab.get(fn.getPrev(0)).intValue()==0) { - assert(fn.getPrev(0).kind()==FKind.FlatAtomicEnterNode); - nodemap.put(fn, (FlatAtomicEnterNode)fn); - nodetosavetemps.put((FlatAtomicEnterNode)fn, new HashSet()); - } else if (isatomic) { - FlatAtomicEnterNode atomicnode=nodemap.get(fn); - Set livetemps=nodetotemps.get(fn); - List reads=Arrays.asList(fn.readsTemps()); - List writes=Arrays.asList(fn.readsTemps()); - - for(Iterator tempit=livetemps.iterator();tempit.hasNext();) { - TempDescriptor tmp=tempit.next(); - if (writes.contains(tmp)) { - nodetosavetemps.get(atomicnode).add(tmp); - } else if (reads.contains(tmp)&&temptab.get(fn).get(tmp)==GLOBAL) { - nodetosavetemps.get(atomicnode).add(tmp); - } - } - } - for(int i=0;i"; - else - return "<"+getNode()+","+getTemp()+">"; - } -} diff --git a/Robust/src/Analysis/Prefetch/IndexDescriptor.java b/Robust/src/Analysis/Prefetch/IndexDescriptor.java deleted file mode 100644 index b322183e..00000000 --- a/Robust/src/Analysis/Prefetch/IndexDescriptor.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * IndexDescriptor.java - * Author: Alokika Dash adash@uci.edu - * Date: 11-02-2007 - */ - -package Analysis.Prefetch; -import IR.Flat.*; -import java.util.*; -import IR.*; - -/** - * Descriptor - * - * This class is used to represent the index and index offset of Arrays in - * a prefetch pair - * for eg: for a prefetch pair a[i+z], an instance of this class stores var i and var z - */ - -public class IndexDescriptor extends Descriptor { - public ArrayList tddesc; - public Integer offset; - - public IndexDescriptor(Integer offset) { - super(offset.toString()); - this.offset = offset; - this.tddesc=new ArrayList(); - } - - public IndexDescriptor(TempDescriptor tdesc, Integer offset) { - super(tdesc.toString()); - tddesc = new ArrayList(); - tddesc.add(tdesc); - this.offset = offset; - } - - public IndexDescriptor() { - super("Empty"); - tddesc = new ArrayList(); - offset = 0; - } - - public IndexDescriptor(ArrayList tdesc, Integer offset) { - super(tdesc.toString()); - tddesc = new ArrayList(); - tddesc.addAll(tdesc); - this.offset = offset; - } - - public ArrayList getTempDesc() { - return tddesc; - } - - public TempDescriptor getTempDescAt(int index) { - return ((TempDescriptor) (tddesc.get(index))); - } - - public int getOffset() { - return offset.intValue(); - } - - public String toString() { - String label="["; - if(getTempDesc() == null) { - label += offset.toString(); - return label; - } else { - ListIterator lit = getTempDesc().listIterator(); - for(;lit.hasNext();) { - TempDescriptor td = (TempDescriptor) lit.next(); - label += td.toString()+"+"; - } - label +=offset.toString(); - } - label += "]"; - return label; - } - - public int hashCode() { - int hashcode = (Integer) offset.hashCode(); - hashcode^=tddesc.hashCode(); - return hashcode; - } - - public boolean equals(Object o) { - if(o instanceof IndexDescriptor) { - IndexDescriptor idesc = (IndexDescriptor) o; - return offset==idesc.offset&& - tddesc.equals(idesc.tddesc); - } - return false; - } -} diff --git a/Robust/src/Analysis/Prefetch/LoopExit.java b/Robust/src/Analysis/Prefetch/LoopExit.java deleted file mode 100644 index 2b1099b6..00000000 --- a/Robust/src/Analysis/Prefetch/LoopExit.java +++ /dev/null @@ -1,90 +0,0 @@ -package Analysis.Prefetch; - -import java.util.*; -import IR.SymbolTable; -import IR.State; -import IR.TypeUtil; -import IR.MethodDescriptor; -import IR.Flat.*; -import IR.*; -import IR.ClassDescriptor; - - -public class LoopExit { - State state; - Hashtable> results; - - public LoopExit(State state) { - this.state=state; - this.results=new Hashtable>(); - } - - public Set getLoopBranches(MethodDescriptor md) { - if (!results.containsKey(md)) - doAnalysis(md); - return results.get(md); - } - - public boolean isLoopingBranch(MethodDescriptor md, FlatCondBranch fcb) { - return getLoopBranches(md).contains(fcb); - } - - private void doAnalysis(MethodDescriptor md) { - FlatMethod fm=state.getMethodFlat(md); - HashSet nodeset=new HashSet(); - nodeset.addAll(fm.getNodeSet()); - Hashtable> table=new Hashtable>(); - - HashSet loopbranchset=new HashSet(); - HashSet exitset=new HashSet(); - - while(!nodeset.isEmpty()) { - FlatNode fn=nodeset.iterator().next(); - nodeset.remove(fn); - if (fn.kind()==FKind.FlatCondBranch&&((FlatCondBranch)fn).isLoopBranch()) { - FlatCondBranch fcb=(FlatCondBranch)fn; - loopbranchset.add(fcb); - //True edge - propagateset(nodeset, table, fcb, fcb.getNext(0), fcb); - //False edge - propagateset(nodeset, table, fcb, fcb.getNext(1), null); - loopbranchset.add(fcb); - } else if (fn.kind()==FKind.FlatReturnNode) { - if (table.containsKey(fn)) - exitset.addAll(table.get(fn)); - } else { - for(int i=0;i tovisit, Hashtable> table, FlatNode fn, FlatNode fnnext, FlatCondBranch fcb) { - boolean enqueuechange=false; - if (table.containsKey(fn)) { - if (!table.containsKey(fnnext)) - table.put(fnnext, new HashSet()); - HashSet toadd=new HashSet(); - toadd.addAll(table.get(fn)); - if (toadd.contains(fnnext)) //can't propagate back to node - toadd.remove(fnnext); - if(!table.get(fnnext).containsAll(toadd)) { - table.get(fnnext).addAll(toadd); - enqueuechange=true; - } - } - if (fcb!=null) { - if (!table.containsKey(fnnext)) - table.put(fnnext, new HashSet()); - if (!table.get(fnnext).contains(fcb)) { - table.get(fnnext).add(fcb); - enqueuechange=true; - } - } - if (enqueuechange) - tovisit.add(fnnext); - } - -} diff --git a/Robust/src/Analysis/Prefetch/PairMap.java b/Robust/src/Analysis/Prefetch/PairMap.java deleted file mode 100644 index e8f47fa7..00000000 --- a/Robust/src/Analysis/Prefetch/PairMap.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * PairMap.java - * Author: Alokika Dash adash@uci.edu - * Date: 11-24-2007 - */ - -package Analysis.Prefetch; -import IR.Flat.*; -import java.util.*; -import IR.*; - -/** - * Descriptor - * This class is used to represent mappings between Prefetch sets of a parent and - * child flatnode m(PSchildnode --> PSparentnode) Such analysis is used to insert - * prefetches during static analysis - */ - -public class PairMap { - public HashMap mappair; - - public PairMap() { - mappair = new HashMap(); - } - - public void addPair(PrefetchPair ppKey, PrefetchPair ppValue) { - mappair.put(ppKey, ppValue); - } - - public void removePair(PrefetchPair ppKey) { - mappair.remove(ppKey); - } - - public PrefetchPair getPair(PrefetchPair ppKey) { - if(mappair != null) - return mappair.get(ppKey); - return null; - } - - public int hashCode() { - return mappair.hashCode(); - } - - public int size() { - return mappair.size(); - } - - public boolean contains(PrefetchPair ppKey) { - if(mappair.containsKey(ppKey)) - return true; - return false; - } - - public String toString() { - String label = null; - Set mapping = mappair.entrySet(); - Iterator it = mapping.iterator(); - label = "Mappings are: "; - for(;it.hasNext();) { - Object o = it.next(); - label += o.toString() + " , "; - } - return label; - } - - public boolean equals(Object o) { - if(o instanceof PairMap) { - PairMap pm = (PairMap) o; - return mappair.equals(pm.mappair); - } - return false; - } - - public boolean isEmpty() { - return mappair.isEmpty(); - } -} diff --git a/Robust/src/Analysis/Prefetch/PrefetchAnalysis.java b/Robust/src/Analysis/Prefetch/PrefetchAnalysis.java deleted file mode 100644 index abab858f..00000000 --- a/Robust/src/Analysis/Prefetch/PrefetchAnalysis.java +++ /dev/null @@ -1,1003 +0,0 @@ -package Analysis.Prefetch; - -import java.util.*; -import Analysis.CallGraph.CallGraph; -import Analysis.Locality.LocalityAnalysis; -import Analysis.Prefetch.PrefetchPair; -import Analysis.Prefetch.PairMap; -import Analysis.Prefetch.IndexDescriptor; -import IR.SymbolTable; -import IR.State; -import IR.TypeUtil; -import IR.MethodDescriptor; -import IR.Flat.*; -import IR.*; -import IR.ClassDescriptor; - -public class PrefetchAnalysis { - State state; - CallGraph callgraph; - TypeUtil typeutil; - LoopExit loop; - - Set tovisit; - public Hashtable> prefetch_hash;//holds all flatnodes and corresponding prefetch set - public Hashtable> pmap_hash;//holds all flatnodes and mappings between child prefetch pair and parent prefetch pair - public static final double PROB_DIFF = 0.05; //threshold for difference in probabilities during first phase of analysis - public static final double ANALYSIS_THRESHOLD_PROB = 0.10; //threshold for prefetches to stop propagating during first phase of analysis - public static final double PREFETCH_THRESHOLD_PROB = 0.30;//threshold for prefetches to stop propagating while applying prefetch rules during second phase of analysis - public static int prefetchsiteid = 1; //initialized to one because there is a prefetch siteid 0 for starting remote thread - LocalityAnalysis locality; - - public PrefetchAnalysis(State state, CallGraph callgraph, TypeUtil typeutil, LocalityAnalysis locality) { - this.typeutil=typeutil; - this.state=state; - this.callgraph=callgraph; - this.locality=locality; - prefetch_hash = new Hashtable>(); - pmap_hash = new Hashtable>(); - this.loop=new LoopExit(state); - DoPrefetch(); - } - - - /** This function starts the prefetch analysis */ - private void DoPrefetch() { - for (Iterator methodit=locality.getMethods().iterator();methodit.hasNext();) { - MethodDescriptor md=(MethodDescriptor)methodit.next(); - if (state.excprefetch.contains(md.getClassMethodName())) - continue; //Skip this method - Hashtable> newprefetchset = new Hashtable>(); - FlatMethod fm=state.getMethodFlat(md); - doFlatNodeAnalysis(fm); - doInsPrefetchAnalysis(fm, newprefetchset); - if(newprefetchset.size() > 0) { - addFlatPrefetchNode(newprefetchset); - } - newprefetchset = null; - } - } - - /** This function calls analysis for every node in a method */ - private void doFlatNodeAnalysis(FlatMethod fm) { - tovisit = fm.getNodeSet(); - Hashtable nodehash = new Hashtable(); - /* Create Empty Prefetch Sets for all flat nodes in the global hashtable */ - while(!tovisit.isEmpty()) { - FlatNode fn = (FlatNode)tovisit.iterator().next(); - prefetch_hash.put(fn, nodehash); - tovisit.remove(fn); - } - - /* Visit and process nodes */ - tovisit = fm.getNodeSet(); - while(!tovisit.isEmpty()) { - FlatNode fn = (FlatNode)tovisit.iterator().next(); - doChildNodeAnalysis(fm.getMethod(),fn); - tovisit.remove(fn); - } - } - - /** - * This function generates the prefetch sets for a given Flatnode considering the kind of node - * It calls severals functions based on the kind of the node and - * returns true: if the prefetch set has changed since last time the node was analysed - * returns false : otherwise - */ - private void doChildNodeAnalysis(MethodDescriptor md, FlatNode curr) { - if (curr.kind()==FKind.FlatCondBranch) { - processFlatCondBranch((FlatCondBranch)curr, md); - } else { - Hashtable child_prefetch_set_copy = new Hashtable(); - if(curr.numNext() != 0) { - FlatNode child_node = curr.getNext(0); - if(prefetch_hash.containsKey(child_node)) { - child_prefetch_set_copy = (Hashtable) prefetch_hash.get(child_node).clone(); - } - - } - switch(curr.kind()) { - case FKind.FlatCall: - processCall((FlatCall)curr,child_prefetch_set_copy); - break; - - case FKind.FlatBackEdge: - case FKind.FlatCheckNode: - case FKind.FlatReturnNode: - case FKind.FlatAtomicEnterNode: - case FKind.FlatAtomicExitNode: - case FKind.FlatFlagActionNode: - case FKind.FlatGlobalConvNode: - case FKind.FlatNop: - case FKind.FlatNew: - case FKind.FlatCastNode: - case FKind.FlatTagDeclaration: - processDefaultCase(curr,child_prefetch_set_copy); - break; - case FKind.FlatMethod: - //TODO change it to take care of FlatMethod, Flatcalls - processFlatMethod(curr, child_prefetch_set_copy); - break; - case FKind.FlatFieldNode: - processFlatFieldNode(curr, child_prefetch_set_copy); - break; - case FKind.FlatElementNode: - processFlatElementNode(curr, child_prefetch_set_copy); - break; - case FKind.FlatOpNode: - processFlatOpNode(curr, child_prefetch_set_copy); - break; - case FKind.FlatLiteralNode: - processFlatLiteralNode(curr, child_prefetch_set_copy); - break; - case FKind.FlatSetElementNode: - processFlatSetElementNode(curr, child_prefetch_set_copy); - break; - case FKind.FlatSetFieldNode: - processFlatSetFieldNode(curr, child_prefetch_set_copy); - break; - default: - throw new Error("No such Flatnode kind"); - } - } - } - - /**This function compares all the prefetch pairs in a Prefetch set hashtable and - * returns: true if something has changed in the new Prefetch set else - * returns: false - */ - private boolean comparePrefetchSets(Hashtable oldPrefetchSet, Hashtable newPrefetchSet) { - if (oldPrefetchSet.size()!=newPrefetchSet.size()) - return true; - - for(Enumeration e = newPrefetchSet.keys();e.hasMoreElements();) { - PrefetchPair pp = (PrefetchPair) e.nextElement(); - double newprob = newPrefetchSet.get(pp).doubleValue(); - if (!oldPrefetchSet.containsKey(pp)) - return true; - double oldprob = oldPrefetchSet.get(pp).doubleValue(); - - if((newprob - oldprob) > PROB_DIFF) { - return true; - } - if (newprob >= PREFETCH_THRESHOLD_PROB && oldprob < PREFETCH_THRESHOLD_PROB) { - return true; - } - if (oldprob>newprob) { - System.out.println("ERROR:" + pp); - System.out.println(oldprob + " -> "+ newprob); - } - } - return false; - } - - private void updatePairMap(FlatNode curr, PairMap pm, int index) { - if (index>=curr.numNext()) - return; - if (!pmap_hash.containsKey(curr.getNext(index))) { - pmap_hash.put(curr.getNext(index), new Hashtable()); - } - pmap_hash.get(curr.getNext(index)).put(curr, pm); - } - - private void updatePrefetchSet(FlatNode curr, Hashtable newset) { - Hashtableoldset=prefetch_hash.get(curr); - if (comparePrefetchSets(oldset, newset)) { - for(int i=0;i child_prefetch_set_copy) { - Hashtable currcopy = new Hashtable(); - Hashtable tocompare = new Hashtable(); - FlatFieldNode currffn = (FlatFieldNode) curr; - PairMap pm = new PairMap(); - - /* Do Self analysis of the current node*/ - FieldDescriptor currffn_field = currffn.getField(); - TempDescriptor currffn_src = currffn.getSrc(); - if (currffn_field.getType().isPtr()) { - PrefetchPair pp = new PrefetchPair(currffn_src, (Descriptor) currffn_field); - Double prob = new Double(1.0); - tocompare.put(pp, prob); - } - - /* Get each prefetch pair of the child and match it with the destination temp descriptor of curr FlatFieldNode */ - - for (Enumeration ecld = child_prefetch_set_copy.keys();ecld.hasMoreElements();) { - PrefetchPair childpp = (PrefetchPair) ecld.nextElement(); - if (childpp.base == currffn.getDst() && (childpp.getDesc()!= null)) { - if (currffn.getField().getType().isPtr()) { - ArrayList newdesc = new ArrayList(); - newdesc.add(currffn.getField()); - newdesc.addAll(childpp.desc); - PrefetchPair newpp = new PrefetchPair(currffn.getSrc(), newdesc); - Double newprob = child_prefetch_set_copy.get(childpp).doubleValue(); - if (tocompare.containsKey(newpp)) { - Double oldprob=tocompare.get(newpp); - newprob=1.0-(1.0-oldprob)*(1.0-newprob); - } - tocompare.put(newpp, newprob); - pm.addPair(childpp, newpp); - } - //drop if not ptr - } else if(childpp.base == currffn.getDst() && (childpp.getDesc() == null)) { - //covered by current prefetch - child_prefetch_set_copy.remove(childpp); - } else if(childpp.containsTemp(currffn.getDst())) { - child_prefetch_set_copy.remove(childpp); - } else { - Double newprob = child_prefetch_set_copy.get(childpp).doubleValue(); - if (tocompare.containsKey(childpp)) { - Double oldprob=tocompare.get(childpp); - newprob=1.0-(1.0-oldprob)*(1.0-newprob); - } - tocompare.put(childpp, newprob); - pm.addPair(childpp, childpp); - } - } - - for(Iterator it=tocompare.keySet().iterator();it.hasNext();) { - PrefetchPair pp=it.next(); - if (tocompare.get(pp) child_prefetch_set_copy) { - - Hashtable currcopy = new Hashtable(); - Hashtable tocompare = new Hashtable(); - FlatElementNode currfen = (FlatElementNode) curr; - PairMap pm = new PairMap(); - - - /* Do Self analysis of the current node*/ - TempDescriptor currfen_index = currfen.getIndex(); - IndexDescriptor idesc = new IndexDescriptor(currfen_index, 0); - TempDescriptor currfen_src = currfen.getSrc(); - if(currfen.getDst().getType().isPtr()) { - PrefetchPair pp = new PrefetchPair(currfen_src, (Descriptor) idesc); - Double prob = new Double(1.0); - currcopy.put(pp, prob); - } - - /* Get each prefetch pair of the child and match it with the destination temp descriptor of curr FlatFieldNode */ - PrefetchPair currpp = null; - for (Enumeration ecld = child_prefetch_set_copy.keys();ecld.hasMoreElements();) { - PrefetchPair childpp = (PrefetchPair) ecld.nextElement(); - if (childpp.base == currfen.getDst() && (childpp.getDesc()!= null)) { - if (currfen.getDst().getType().isPtr()) { - ArrayList newdesc = new ArrayList(); - newdesc.add((Descriptor)idesc); - newdesc.addAll(childpp.desc); - PrefetchPair newpp = new PrefetchPair(currfen.getSrc(), newdesc); - Double newprob = child_prefetch_set_copy.get(childpp).doubleValue(); - tocompare.put(newpp, newprob); - pm.addPair(childpp, newpp); - child_prefetch_set_copy.remove(childpp); - /* Check for independence of prefetch pairs to compute new probability */ - if(child_prefetch_set_copy.containsKey(newpp)) { - newprob = (1.0 - ((1.0 - child_prefetch_set_copy.get(newpp).doubleValue()) * (1.0 - tocompare.get(newpp).doubleValue()))); - if(newprob < ANALYSIS_THRESHOLD_PROB) { - tocompare.remove(newpp); - } else { - tocompare.put(newpp, newprob); - pm.addPair(newpp, newpp); - } - child_prefetch_set_copy.remove(newpp); - } - } - } else if(childpp.base == currfen.getDst() && (childpp.getDesc() == null)) { - child_prefetch_set_copy.remove(childpp); - } else if(childpp.containsTemp(currfen.getDst())) { - child_prefetch_set_copy.remove(childpp); - } else { - continue; - } - } - /* Check if curr prefetch set and the child prefetch set have same prefetch pairs - * if so calculate the new probability */ - for(Enumeration ecld = child_prefetch_set_copy.keys();ecld.hasMoreElements();) { - PrefetchPair childpp = (PrefetchPair) ecld.nextElement(); - for(Enumeration e = currcopy.keys(); e.hasMoreElements();) { - currpp = (PrefetchPair) e.nextElement(); - if(currpp.equals(childpp)) { - pm.addPair(childpp, currpp); - child_prefetch_set_copy.remove(childpp); - break; - } - } - } - - /* Merge child prefetch pairs */ - for (Enumeration ecld = child_prefetch_set_copy.keys();ecld.hasMoreElements();) { - PrefetchPair childpp = (PrefetchPair) ecld.nextElement(); - tocompare.put(childpp, child_prefetch_set_copy.get(childpp).doubleValue()); - pm.addPair(childpp, childpp); - child_prefetch_set_copy.remove(childpp); - } - - /* Merge curr prefetch pairs */ - for (Enumeration e = currcopy.keys();e.hasMoreElements();) { - currpp = (PrefetchPair) e.nextElement(); - tocompare.put(currpp, currcopy.get(currpp).doubleValue()); - currcopy.remove(currpp); - } - - updatePairMap(curr, pm, 0); - updatePrefetchSet(curr, tocompare); - } - - /** This function processes the prefetch set of a FlatSetFieldNode - * It generates a new prefetch set after comparision with its children - * It compares the old prefetch set with this new prefetch set and enqueues the parents - * of the current node if change occurs and then updates the global flatnode hash table - * */ - private void processFlatSetFieldNode(FlatNode curr, Hashtable child_prefetch_set_copy) { - Hashtable tocompare = new Hashtable(); - FlatSetFieldNode currfsfn = (FlatSetFieldNode) curr; - PairMap pm = new PairMap(); - - for (Enumeration ecld = child_prefetch_set_copy.keys();ecld.hasMoreElements();) { - PrefetchPair childpp = (PrefetchPair) ecld.nextElement(); - if(childpp.base == currfsfn.getDst()) { - int size = childpp.desc.size(); - if(size >=2) { /*e.g. x.f = g (with child prefetches x.f.g, x.f[0].j) */ - if((childpp.getDescAt(0) instanceof FieldDescriptor) && (childpp.getDescAt(0) == currfsfn.getField())) { - ArrayList newdesc = new ArrayList(); - for(int i = 0;i<(childpp.desc.size()-1); i++) { - newdesc.add(i,childpp.desc.get(i+1)); - } - PrefetchPair newpp = new PrefetchPair(currfsfn.getSrc(), newdesc); - Double newprob = child_prefetch_set_copy.get(childpp).doubleValue(); - tocompare.put(newpp, newprob); - pm.addPair(childpp, newpp); - child_prefetch_set_copy.remove(childpp); - /* Check for independence of prefetch pairs in newly generated prefetch pair - * to compute new probability */ - if(child_prefetch_set_copy.containsKey(newpp)) { - newprob = (1.0 - ((1.0 - child_prefetch_set_copy.get(newpp).doubleValue()) * (1.0 - tocompare.get(newpp).doubleValue()))); - if(newprob < ANALYSIS_THRESHOLD_PROB) { - tocompare.remove(newpp); - } else { - tocompare.put(newpp, newprob); - pm.addPair(newpp, newpp); - } - child_prefetch_set_copy.remove(newpp); - } - } - } else if(size==1) { /* e.g x.f = g (with child prefetch x.f) */ - if((childpp.getDescAt(0) instanceof FieldDescriptor) && (childpp.getDescAt(0) == currfsfn.getField())) { - child_prefetch_set_copy.remove(childpp); - } - } else { - continue; - } - } - } - - /* Merge child prefetch pairs */ - for (Enumeration ecld = child_prefetch_set_copy.keys();ecld.hasMoreElements();) { - PrefetchPair childpp = (PrefetchPair) ecld.nextElement(); - tocompare.put(childpp, child_prefetch_set_copy.get(childpp).doubleValue()); - pm.addPair(childpp, childpp); - child_prefetch_set_copy.remove(childpp); - } - - updatePairMap(curr, pm, 0); - updatePrefetchSet(curr, tocompare); - } - - /** This function processes the prefetch set of a FlatSetElementNode - * It generates a new prefetch set after comparision with its children - * It compares the old prefetch set with this new prefetch set and enqueues the parents - * of the current node if change occurs and then updates the global flatnode hash table - * */ - private void processFlatSetElementNode(FlatNode curr, Hashtable child_prefetch_set_copy) { - Hashtable tocompare = new Hashtable(); - FlatSetElementNode currfsen = (FlatSetElementNode) curr; - PairMap pm = new PairMap(); - - for (Enumeration ecld = child_prefetch_set_copy.keys();ecld.hasMoreElements();) { - PrefetchPair childpp = (PrefetchPair) ecld.nextElement(); - if (childpp.base == currfsen.getDst()){ - int sizedesc = childpp.desc.size(); - if((childpp.getDescAt(0) instanceof IndexDescriptor)) { - int sizetempdesc = ((IndexDescriptor)(childpp.getDescAt(0))).tddesc.size(); - if(sizetempdesc == 1) { - if((((IndexDescriptor)childpp.getDescAt(0)).tddesc.get(0) == currfsen.getIndex()) && (sizedesc>=2)) { - /* For e.g. a[i] = g with child prefetch set a[i].r or a[i].r.f */ - ArrayList newdesc = new ArrayList(); - for(int i = 0;i<(childpp.desc.size()-1); i++) { - newdesc.add(i,childpp.desc.get(i+1)); - } - PrefetchPair newpp = new PrefetchPair(currfsen.getSrc(), newdesc); - Double newprob = child_prefetch_set_copy.get(childpp).doubleValue(); - tocompare.put(newpp, newprob); - pm.addPair(childpp, newpp); - child_prefetch_set_copy.remove(childpp); - /* Check for independence of prefetch pairs to compute new probability */ - if(child_prefetch_set_copy.containsKey(newpp)) { - newprob = (1.0 - ((1.0 - child_prefetch_set_copy.get(newpp).doubleValue()) * (1.0 - tocompare.get(newpp).doubleValue()))); - if(newprob < ANALYSIS_THRESHOLD_PROB) { - tocompare.remove(newpp); - } else { - tocompare.put(newpp, newprob); - pm.addPair(newpp, newpp); - } - child_prefetch_set_copy.remove(newpp); - } - } else if((((IndexDescriptor)childpp.getDescAt(0)).tddesc.get(0) == currfsen.getIndex()) && (sizedesc==1)) - /* For e.g. a[i] = g with child prefetch set a[i] */ - child_prefetch_set_copy.remove(childpp); - } else { - continue; - } - } - } - } - /* Merge child prefetch pairs */ - for (Enumeration ecld = child_prefetch_set_copy.keys();ecld.hasMoreElements();) { - PrefetchPair childpp = (PrefetchPair) ecld.nextElement(); - tocompare.put(childpp, child_prefetch_set_copy.get(childpp).doubleValue()); - pm.addPair(childpp, childpp); - child_prefetch_set_copy.remove(childpp); - } - - updatePairMap(curr, pm, 0); - updatePrefetchSet(curr, tocompare); - } - - /** This function applies rules and does analysis for a FlatOpNode - * And updates the global prefetch hashtable - * */ - private void processFlatOpNode(FlatNode curr, Hashtable child_prefetch_set_copy) { - int index; - Hashtable tocompare = new Hashtable(); - FlatOpNode currfopn = (FlatOpNode) curr; - PairMap pm = new PairMap(); - - if(currfopn.getOp().getOp() == Operation.ASSIGN) { - for (Enumeration ecld = child_prefetch_set_copy.keys();ecld.hasMoreElements();) { - PrefetchPair childpp = (PrefetchPair) ecld.nextElement(); - PrefetchPair copyofchildpp = (PrefetchPair) childpp.clone(); - - /* For cases like x=y with child prefetch set x[i].z,x.g*/ - if(childpp.base == currfopn.getDest()) { - ArrayList newdesc = new ArrayList(); - newdesc.addAll(childpp.desc); - PrefetchPair newpp = new PrefetchPair(currfopn.getLeft(), newdesc); - Double newprob = child_prefetch_set_copy.get(childpp).doubleValue(); - tocompare.put(newpp, newprob); - pm.addPair(childpp, newpp); - child_prefetch_set_copy.remove(childpp); - /* Check for independence of prefetch pairs to compute new probability */ - if(child_prefetch_set_copy.containsKey(newpp)) { - newprob = (1.0 - ((1.0 - child_prefetch_set_copy.get(newpp).doubleValue()) * (1.0 - tocompare.get(newpp).doubleValue()))); - if(newprob < ANALYSIS_THRESHOLD_PROB) { - tocompare.remove(newpp); - } else { - tocompare.put(newpp, newprob); - pm.addPair(newpp, newpp); - } - child_prefetch_set_copy.remove(newpp); - } - /* For cases like x=y with child prefetch set r[x].p, r[p+x].q where x is a tempdescriptor*/ - } else if(copyofchildpp.containsTemp(currfopn.getDest())) { - PrefetchPair newpp=copyofchildpp.replaceTemp(currfopn.getDest(), new TempDescriptor[] {currfopn.getLeft()}); - Double newprob = child_prefetch_set_copy.get(childpp).doubleValue(); - tocompare.put(newpp, newprob); - pm.addPair(childpp, newpp); - child_prefetch_set_copy.remove(childpp); - /* Check for independence of prefetch pairs to compute new probability*/ - if(child_prefetch_set_copy.containsKey(newpp)) { - newprob = (1.0 - ((1.0 - child_prefetch_set_copy.get(newpp).doubleValue()) * (1.0 - tocompare.get(newpp).doubleValue()))); - if(newprob < ANALYSIS_THRESHOLD_PROB) { - tocompare.remove(newpp); - } else { - tocompare.put(newpp, newprob); - pm.addPair(newpp, newpp); - } - child_prefetch_set_copy.remove(newpp); - } - newpp = null; - } else { - continue; - } - } - //case i = i+z with child prefetch set a[i].x - } else if(currfopn.getRight()!=null && (currfopn.getOp().getOp() == Operation.ADD)) { - for (Enumeration ecld = child_prefetch_set_copy.keys();ecld.hasMoreElements();) { - PrefetchPair childpp = (PrefetchPair) ecld.nextElement(); - PrefetchPair copyofchildpp = (PrefetchPair) childpp.clone(); - - if(copyofchildpp.containsTemp(currfopn.getDest())) { - PrefetchPair newpp=copyofchildpp.replaceTemp(currfopn.getDest(), new TempDescriptor[] {currfopn.getLeft(), currfopn.getRight()}); - Double newprob = child_prefetch_set_copy.get(childpp).doubleValue(); - tocompare.put(newpp, newprob); - pm.addPair(childpp, newpp); - child_prefetch_set_copy.remove(childpp); - /* Check for independence of prefetch pairs to compute new probability*/ - if(child_prefetch_set_copy.containsKey(newpp)) { - newprob = (1.0 - ((1.0 - child_prefetch_set_copy.get(newpp).doubleValue()) * (1.0 - tocompare.get(newpp).doubleValue()))); - if(newprob < ANALYSIS_THRESHOLD_PROB) { - tocompare.remove(newpp); - } else { - tocompare.put(newpp, newprob); - pm.addPair(newpp, newpp); - } - child_prefetch_set_copy.remove(newpp); - } - } else { - continue; - } - } - } else if(currfopn.getRight()!=null && (currfopn.getOp().getOp() == Operation.SUB)) { - for(Enumeration ecld = child_prefetch_set_copy.keys();ecld.hasMoreElements();) { - PrefetchPair childpp = (PrefetchPair) ecld.nextElement(); - if(childpp.containsTemp(currfopn.getDest())) { - child_prefetch_set_copy.remove(childpp); - } - } - } else { - //FIXME Is not taken care of for cases like x = -y followed by a[x].i - } - - /* Merge child prefetch pairs */ - for (Enumeration ecld = child_prefetch_set_copy.keys();ecld.hasMoreElements();) { - PrefetchPair childpp = (PrefetchPair) ecld.nextElement(); - tocompare.put(childpp, child_prefetch_set_copy.get(childpp).doubleValue()); - pm.addPair(childpp, childpp); - child_prefetch_set_copy.remove(childpp); - } - - updatePairMap(curr, pm, 0); - updatePrefetchSet(curr, tocompare); - } - - /** This function processes a FlatLiteralNode where cases such as - * for e.g. i = 0 with child prefetch sets a[i].r, a[j+i].r or a[j].b[i].r - * are handled */ - private void processFlatLiteralNode(FlatNode curr, Hashtable child_prefetch_set_copy) { - Hashtable tocompare = new Hashtable(); - FlatLiteralNode currfln = (FlatLiteralNode) curr; - PairMap pm = new PairMap(); - - if(currfln.getType().isIntegerType()) { - for (Enumeration ecld = child_prefetch_set_copy.keys();ecld.hasMoreElements();) { - PrefetchPair childpp = (PrefetchPair) ecld.nextElement(); - PrefetchPair copyofchildpp = (PrefetchPair) childpp.clone(); - if(copyofchildpp.containsTemp(currfln.getDst())) { - ArrayList copychilddesc = (ArrayList) copyofchildpp.getDesc(); - int sizetempdesc = copychilddesc.size(); - for(ListIterator it = copychilddesc.listIterator();it.hasNext();) { - Object o = it.next(); - if(o instanceof IndexDescriptor) { - ArrayList td = (ArrayList)((IndexDescriptor)o).tddesc; - int sizetddesc = td.size(); - if(td.contains(currfln.getDst())) { - int index = td.indexOf(currfln.getDst()); - td.remove(index); - ((IndexDescriptor)o).offset += (Integer)currfln.getValue(); - } - } - } - ArrayList newdesc = new ArrayList(); - newdesc.addAll(copychilddesc); - PrefetchPair newpp = new PrefetchPair(childpp.base, newdesc); - Double newprob = (child_prefetch_set_copy.get(childpp)).doubleValue(); - tocompare.put(newpp, newprob); - pm.addPair(childpp, newpp); - child_prefetch_set_copy.remove(childpp); - /* Check for independence of prefetch pairs to compute new probability */ - if(child_prefetch_set_copy.containsKey(newpp)) { - newprob = (1.0 - ((1.0 - child_prefetch_set_copy.get(newpp).doubleValue()) * (1.0 - tocompare.get(newpp).doubleValue()))); - if(newprob < ANALYSIS_THRESHOLD_PROB) { - tocompare.remove(newpp); - } else { - tocompare.put(newpp, newprob); - pm.addPair(newpp, newpp); - } - child_prefetch_set_copy.remove(newpp); - } - } - } - } - - /* Merge child prefetch pairs */ - for (Enumeration ecld = child_prefetch_set_copy.keys();ecld.hasMoreElements();) { - PrefetchPair childpp = (PrefetchPair) ecld.nextElement(); - tocompare.put(childpp, child_prefetch_set_copy.get(childpp).doubleValue()); - pm.addPair(childpp, childpp); - child_prefetch_set_copy.remove(childpp); - } - - updatePairMap(curr, pm, 0); - updatePrefetchSet(curr, tocompare); - } - - /** This function processes a FlatMethod where the method propagates - * the entire prefetch set of its child node */ - private void processFlatMethod(FlatNode curr, Hashtable child_prefetch_set_copy) { - Hashtable tocompare = new Hashtable(); - FlatMethod currfm = (FlatMethod) curr; - PairMap pm = new PairMap(); - - /* Merge child prefetch pairs */ - for (Enumeration ecld = child_prefetch_set_copy.keys();ecld.hasMoreElements();) { - PrefetchPair childpp = (PrefetchPair) ecld.nextElement(); - tocompare.put(childpp, child_prefetch_set_copy.get(childpp).doubleValue()); - pm.addPair(childpp, childpp); - } - - updatePairMap(curr, pm, 0); - updatePrefetchSet(curr, tocompare); - } - - /** This function handles the processes the FlatNode of type FlatCondBranch - * It combines prefetches of both child elements and create a new hash table called - * branch_prefetch_set to contains the entries of both its children - */ - private void processFlatCondBranch(FlatCondBranch fcb, MethodDescriptor md) { - Hashtable tocompare = new Hashtable();//temporary hash table - PairMap truepm = new PairMap(); - PairMap falsepm = new PairMap(); - Hashtable truechild=prefetch_hash.get(fcb.getNext(0)); - Hashtable falsechild=prefetch_hash.get(fcb.getNext(1)); - - HashSet allpp=new HashSet(); - allpp.addAll(truechild.keySet()); - allpp.addAll(falsechild.keySet()); - - for(Iterator ppit=allpp.iterator();ppit.hasNext();) { - PrefetchPair pp=ppit.next(); - double trueprob=0,falseprob=0; - if (truechild.containsKey(pp)) - trueprob=truechild.get(pp).doubleValue(); - if (falsechild.containsKey(pp)) - falseprob=falsechild.get(pp).doubleValue(); - - double newprob=trueprob*fcb.getTrueProb()+falseprob*fcb.getFalseProb(); - if (loop.isLoopingBranch(md,fcb)&& - newprob child_prefetch_set_copy) { - PairMap pm = new PairMap(); - Hashtable tocompare = new Hashtable(); - - /* Propagate all child nodes */ - nexttemp: - for(Enumeration e = child_prefetch_set_copy.keys(); e.hasMoreElements();) { - PrefetchPair childpp = (PrefetchPair) e.nextElement(); - TempDescriptor[] writearray=curr.writesTemps(); - for(int i=0;i child_prefetch_set_copy) { - PairMap pm = new PairMap(); - Hashtable tocompare = new Hashtable(); - - /* Don't propagate prefetches across cache clear */ - if (!(curr.getMethod().getClassMethodName().equals("System.clearPrefetchCache")|| - curr.getMethod().getClassMethodName().equals("Barrier.enterBarrier"))) { - /* Propagate all child nodes */ - nexttemp: - for(Enumeration e = child_prefetch_set_copy.keys(); e.hasMoreElements();) { - PrefetchPair childpp = (PrefetchPair) e.nextElement(); - TempDescriptor[] writearray=curr.writesTemps(); - for(int i=0;i currhash = (Hashtable) prefetch_hash.get(fn); - for(Enumeration pphash= currhash.keys(); pphash.hasMoreElements();) { - PrefetchPair pp = (PrefetchPair) pphash.nextElement(); - System.out.print(pp.toString() + ", "); - } - System.out.println(")"); - } else { - System.out.println("Flatnode is currently not present in the global hash: Prefetch Set is Empty"); - } - } - - private void doInsPrefetchAnalysis(FlatMethod fm, Hashtable> newprefetchset) { - Hashtable> pset1_hash = new Hashtable>(); - HashSet pset1_init = new HashSet(); - LinkedList newtovisit = new LinkedList(); - LinkedList newvisited = new LinkedList(); - - newtovisit.addLast((FlatNode)fm); - while(!newtovisit.isEmpty()) { - FlatNode fn = (FlatNode) newtovisit.iterator().next(); - newtovisit.remove(0); - pset1_hash.put(fn, pset1_init); //Initialize pset1_hash - newvisited.addLast(fn); - for(int i=0; i> newprefetchset) { - for (Enumeration e = newprefetchset.keys();e.hasMoreElements();) { - FlatNode fn = (FlatNode) e.nextElement(); - Set ppairs = newprefetchset.get(fn); - Set toremove=new HashSet(); - - for(Iterator it1=ppairs.iterator();it1.hasNext();) { - PrefetchPair pp1=it1.next(); - if (toremove.contains(pp1)) - continue; - int l1=pp1.desc.size()+1; - for(Iterator it2=ppairs.iterator();it2.hasNext();) { - PrefetchPair pp2=it2.next(); - int l2=pp2.desc.size()+1; - - if (l1l1&&isSubSet(pp2,pp1)) - toremove.add(pp2); - } - } - - ppairs.removeAll(toremove); - } - } - - /** This function returns: true if the shorter prefetch pair is a subset of the longer prefetch - * pair else it returns: false */ - private boolean isSubSet(PrefetchPair shrt, PrefetchPair lng) { - if (shrt.base != lng.base) { - return false; - } - for (int j = 0; j < shrt.desc.size(); j++) { - if(shrt.getDescAt(j) instanceof IndexDescriptor) { - IndexDescriptor shrtid = (IndexDescriptor) shrt.getDescAt(j); - if(lng.getDescAt(j) instanceof IndexDescriptor){ - IndexDescriptor lngid = (IndexDescriptor) lng.getDescAt(j); - if(shrtid.equals(lngid)) { - continue; - } else { - return false; - } - } else { - return false; - } - } else { - if ((Descriptor)shrt.getDescAt(j) != (Descriptor)lng.getDescAt(j)){ - return false; - } - } - } - return true; - } - - /**This function compares all the prefetch pairs in a Prefetch set hashtable and - * returns: true if something has changed in the new Prefetch set else - * returns: false - */ - private boolean comparePSet1(HashSet oldPSet, HashSetnewPSet) { - if(oldPSet.size() != newPSet.size()) { - return true; - } else { - for(Iterator it = newPSet.iterator();it.hasNext();) { - if(!oldPSet.contains((PrefetchPair)it.next())) { - return true; - } - } - } - return false; - } - - /** This function creates a set called pset1 that contains prefetch pairs that have already - * been prefetched. While traversing the graph of a flat representation in a top down fashion, - * this function creates pset1 such that it contains prefetch pairs that have been prefetched at - * the previous nodes */ - - private void applyPrefetchInsertRules(FlatNode fn, LinkedList newvisited, Hashtable> pset1_hash, Hashtable> newprefetchset) { - if(fn.kind() == FKind.FlatMethod) { - HashSet pset1 = new HashSet(); - Hashtable prefetchset = prefetch_hash.get(fn); - for(Enumeration e = prefetchset.keys();e.hasMoreElements();) { - PrefetchPair pp = (PrefetchPair) e.nextElement(); - /* Apply initial rule */ - if(prefetchset.get(pp).doubleValue() >= PREFETCH_THRESHOLD_PROB) { - pset1.add(pp); - } - } - /* Enqueue child node if Pset1 has changed */ - if (comparePSet1(pset1_hash.get(fn), pset1)) { - for(int j=0; j pset2 = new HashSet(); - HashSet newpset = new HashSet(); - Hashtable prefetchset = prefetch_hash.get(fn); - Hashtable ppairmaphash = pmap_hash.get(fn); - for(Enumeration epset = prefetchset.keys(); epset.hasMoreElements();) { - PrefetchPair pp = (PrefetchPair) epset.nextElement(); - boolean pprobIsGreater = (prefetchset.get(pp).doubleValue() >= PREFETCH_THRESHOLD_PROB); - boolean mapprobIsLess=false; - boolean mapIsPresent=true; - for(int i=0;i pset1 = new HashSet(); - pset1.addAll(pset2); - pset1.addAll(newpset); - /* Enqueue child node if Pset1 has changed */ - if (comparePSet1(pset1_hash.get(fn), pset1)) { - for(int i=0; i s = new HashSet(); - s.addAll(newpset); - s.removeAll(pset2); - newprefetchset.put(fn, s); - } - } - - private void addFlatPrefetchNode(Hashtable> newprefetchset) { - boolean isFNPresent = false; /* Detects presence of FlatNew node */ - /* This modifies the Flat representation graph */ - for(Enumeration e = newprefetchset.keys();e.hasMoreElements();) { - FlatNode fn = (FlatNode) e.nextElement(); - FlatPrefetchNode fpn = new FlatPrefetchNode(); - if(newprefetchset.get(fn).size() > 0) { - fpn.insAllpp((HashSet)newprefetchset.get(fn)); - if(fn.kind() == FKind.FlatMethod) { - FlatNode nn = fn.getNext(0); - fn.setNext(0, fpn); - fpn.addNext(nn); - fpn.siteid = prefetchsiteid++; - } else { - /* Check if previous node of this FlatNode is a NEW node - * If yes, delete this flatnode and its prefetch set from hash table - * This eliminates prefetches for NULL ptrs*/ - for(int i = 0; i< fn.numPrev(); i++) { - FlatNode nn = fn.getPrev(i); - if(nn.kind() == FKind.FlatNew) { - isFNPresent = true; - } - } - if(!isFNPresent) { - while(fn.numPrev() > 0) { - FlatNode nn = fn.getPrev(0); - for(int j = 0; j desc; - - public PrefetchPair(){ - base = new TempDescriptor(""); - desc = new ArrayList(); - } - - public PrefetchPair(TempDescriptor t, Descriptor f) { - base = t; - desc = new ArrayList(); - desc.add(f); - } - - public PrefetchPair(TempDescriptor t, ArrayList descriptor) { - base = t; - desc = new ArrayList(); - desc.addAll(descriptor); - } - - public TempDescriptor getBase() { - return base; - } - - public Descriptor getDescAt(int index) { - return desc.get(index); - } - - public ArrayList getDesc() { - return desc; - } - - public FieldDescriptor getFieldDesc(int index) { - return (FieldDescriptor) desc.get(index); - } - - public IndexDescriptor getIndexDesc(int index) { - return (IndexDescriptor) desc.get(index); - } - - public int hashCode() { - int hashcode = base.toString().hashCode(); - if(desc != null) { - hashcode^=desc.hashCode(); - } - return hashcode; - } - - public String toString() { - String label= getBase().toString(); - if(getDesc() == null) - return label; - ListIterator it=getDesc().listIterator(); - for(;it.hasNext();) { - Object o = it.next(); - if(o instanceof FieldDescriptor) { - FieldDescriptor fd = (FieldDescriptor) o; - label+="."+ fd.toString(); - } else { - IndexDescriptor id = (IndexDescriptor) o; - label+= id.toString(); - } - } - return label; - } - - public boolean equals(Object o) { - if(o instanceof PrefetchPair) { - PrefetchPair pp = (PrefetchPair) o; - return base == pp.base && desc.equals(pp.desc); - } - return false; - } - - public Object clone() { - PrefetchPair newpp = new PrefetchPair(); - newpp.base = this.base; - for(int i = 0; i < this.desc.size(); i++) { - Object o = desc.get(i); - if(o instanceof FieldDescriptor) { - newpp.desc.add((FieldDescriptor) o); - } else { - ArrayList td = new ArrayList(); - for(int j = 0; j < ((IndexDescriptor)o).tddesc.size(); j++) { - td.add(((IndexDescriptor)o).getTempDescAt(j)); - } - IndexDescriptor idesc = new IndexDescriptor(); - idesc.tddesc = td; - idesc.offset = ((IndexDescriptor)o).offset; - newpp.desc.add(idesc); - } - } - return newpp; - } - - /** This function returns true if a tempdescriptor object is found in the array of descriptors - * for a given prefetch pair else returns false*/ - public boolean containsTemp(TempDescriptor td) { - ArrayList desc = (ArrayList) getDesc(); - for(ListIterator it = desc.listIterator();it.hasNext();) { - Object o = it.next(); - if(o instanceof IndexDescriptor) { - ArrayList tdarray = (ArrayList)((IndexDescriptor)o).tddesc; - if(tdarray.contains(td)) { - return true; - } - } - } - return false; - } - - /** This function creates a new Arraylist of Descriptors by replacing old tempdescriptors with new - * tempdescriptors when there is a match */ - public PrefetchPair replaceTemp(TempDescriptor td, TempDescriptor[] newtd) { - PrefetchPair npp=(PrefetchPair)clone(); - ArrayList desc = (ArrayList) npp.getDesc(); - for(ListIterator it = desc.listIterator();it.hasNext();) { - Object currdesc = it.next(); - if(currdesc instanceof IndexDescriptor) { - ArrayList tdarray = (ArrayList)((IndexDescriptor)currdesc).tddesc; - if (tdarray.contains(td)) { - int index = tdarray.indexOf(td); - tdarray.set(index, newtd[0]); - for(int i=1;i flagStates; - private boolean sorted = false; - private boolean clone = false; - - private int transTime; - - /** Class constructor - * @param cd ClassDescriptor - * @param fStates - */ - public ClassNode(ClassDescriptor cd, Vector fStates) { - this.cd=cd; - this.flagStates = fStates; - this.sn = null; - this.uid=ClassNode.nodeID++; - this.transTime = 0; - } - - public int getTransTime() { - return this.transTime; - } - - public void setTransTime(int transTime) { - this.transTime = transTime; - } - - public int getuid() { - return uid; - } - - public ScheduleNode getScheduleNode() { - return this.sn; - } - - public void setScheduleNode(ScheduleNode sn) { - this.sn = sn; - } - - public boolean isSorted() { - return sorted; - } - - public void setSorted(boolean sorted) { - this.sorted = sorted; - } - - public Vector getFlagStates() { - return flagStates; - } - - public boolean isclone() { - return clone; - } - - public String toString() { - return cd.toString()+getTextLabel(); - } - - /** @return Iterator over the flags in the flagstate. - */ - - public Iterator getFlags() { - return flagStates.iterator(); - } - - public int numFlags(){ - return flagStates.size(); - } - - /** Accessor method - * @return returns the classdescriptor of the flagstate. - */ - - public ClassDescriptor getClassDescriptor(){ - return cd; - } - - /** Tests for equality of two flagstate objects. - */ - - public boolean equals(Object o) { - if (o instanceof ClassNode) { - ClassNode fs=(ClassNode)o; - if ((fs.getClassDescriptor()!= cd) || - (fs.isSorted() != sorted) || - (fs.clone != this.clone) || - (fs.transTime != this.transTime)) { - return false; - } - return (fs.getFlagStates().equals(flagStates)); - } - return false; - } - - public int hashCode() { - return cd.hashCode()^Boolean.toString(sorted).hashCode()^Boolean.toString(clone).hashCode()^ - transTime^flagStates.hashCode(); - } - - public String getLabel() { - return "N_"+uid; - } - - public String getClusterLabel() { - return "cluster_"+uid; - } - - public String getTextLabel() { - String label=null; - label = "Class " + this.cd.getSymbol(); - - if (label==null) - return " "; - return label; - } - - public Object clone() { - ClassNode o = null; - try { - o = (ClassNode)super.clone(); - } catch(CloneNotSupportedException e){ - e.printStackTrace(); - } - o.uid = ClassNode.nodeID++; - o.clone = true; - return o; - } - - public void calExeTime() { - for(int i = 0; i < this.flagStates.size(); i++) { - this.flagStates.elementAt(i).getExeTime(); - } - } -} diff --git a/Robust/src/Analysis/Scheduling/CombinationUtil.java b/Robust/src/Analysis/Scheduling/CombinationUtil.java deleted file mode 100644 index 6c180a70..00000000 --- a/Robust/src/Analysis/Scheduling/CombinationUtil.java +++ /dev/null @@ -1,547 +0,0 @@ -package Analysis.Scheduling; - -import java.util.Vector; - -public class CombinationUtil { - static CombinationUtil cu; - - public CombinationUtil() { - } - - public static CombinationUtil allocateCombinationUtil() { - if(cu == null) { - cu = new CombinationUtil(); - } - return cu; - } - - public static RootsGenerator allocateRootsGenerator(Vector> snodevecs, int rootNum) { - return CombinationUtil.allocateCombinationUtil().new RootsGenerator(snodevecs, rootNum); - } - - public static CombineGenerator allocateCombineGenerator(Vector> rootnodes, Vector> node2combine) { - return CombinationUtil.allocateCombinationUtil().new CombineGenerator(rootnodes, node2combine); - } - - public class RootsGenerator { - Vector> sNodeVecs; - Vector> node2Combine; - Vector> rootNodes; - int rootNum; - - public RootsGenerator(Vector> snodevecs, int rootNum) { - this.sNodeVecs = snodevecs; - this.rootNum = rootNum; - this.node2Combine = null; - this.rootNodes = null; - } - - public boolean nextGen() { - boolean trial = false; - if(this.rootNodes == null) { - int num2choose = this.rootNum; - this.rootNodes = new Vector>(); - this.rootNodes.add(new Vector()); - Vector toadd = this.sNodeVecs.elementAt(0); - for(int i = 0; i < toadd.size(); i++) { - // should be only one element: startup object - this.rootNodes.elementAt(0).add(toadd.elementAt(i)); - num2choose--; - } - int next = 1; - trial = trial(num2choose, next); - } else { - if(this.rootNodes.size() == 1) { - return false; - } - int next = this.rootNodes.lastElement().elementAt(0).getCid() + 1; - int num2choose = 0; - while(next == this.sNodeVecs.size()) { - // backtrack - num2choose = this.rootNodes.lastElement().size(); - this.rootNodes.removeElementAt(this.rootNodes.size() - 1); - if(this.rootNodes.size() == 1) { - // only startup object left, no more choices - return false; - } - next = this.rootNodes.lastElement().elementAt(0).getCid() + 1; - } - num2choose++; - // reduce one from the last one - this.rootNodes.lastElement().removeElementAt(this.rootNodes.lastElement().size() - 1); - if(this.rootNodes.lastElement().size() == 0) { - this.rootNodes.removeElementAt(this.rootNodes.size() - 1); - } - - trial = trial(num2choose, next); - } - if(trial) { - // left nodes are all to be combined - this.node2Combine = new Vector>(); - int next = 1; - int index = 0; - for(int i = 1; i < this.rootNodes.size(); i++) { - int tmp = this.rootNodes.elementAt(i).elementAt(0).getCid(); - while(next < tmp) { - Vector toadd = this.sNodeVecs.elementAt(next); - if(toadd != null) { - this.node2Combine.add(new Vector()); - for(index = 0; index < toadd.size(); index++) { - this.node2Combine.lastElement().add(toadd.elementAt(index)); - } - } else { - this.node2Combine.add(null); - } - next++; - } - Vector toadd = this.sNodeVecs.elementAt(tmp); - if(toadd.size() > this.rootNodes.elementAt(i).size()) { - this.node2Combine.add(new Vector()); - for(index = this.rootNodes.elementAt(i).size(); index < toadd.size(); index++) { - this.node2Combine.lastElement().add(toadd.elementAt(index)); - } - } - next++; - } - while(next < this.sNodeVecs.size()) { - Vector toadd = this.sNodeVecs.elementAt(next); - if(toadd != null) { - this.node2Combine.add(new Vector()); - for(index = 0; index < toadd.size(); index++) { - this.node2Combine.lastElement().add(toadd.elementAt(index)); - } - } else { - this.node2Combine.add(null); - } - next++; - } - } - return trial; - } - - private boolean trial(int num2choose, int next) { - int index = 0; - boolean first = true; - while(num2choose > 0) { - if(first) { - if(next == this.sNodeVecs.size()) { - // no more nodes available to add - return false; - } - } - if(this.sNodeVecs.elementAt(next) != null) { - if(first) { - this.rootNodes.add(new Vector()); - first = false; - } - this.rootNodes.lastElement().add(this.sNodeVecs.elementAt(next).elementAt(index)); - num2choose--; - index++; - if(index == this.sNodeVecs.elementAt(next).size()) { - index = 0; - next++; - first = true; - } - } else { - next++; - first = true; - } - } - return true; - } - - public Vector> getNode2Combine() { - return node2Combine; - } - - public Vector> getRootNodes() { - return rootNodes; - } - } - - public class Combine { - public ScheduleNode node; - public int root; - public int index; - - public Combine(ScheduleNode n) { - this.node = n; - this.root = -1; - this.index = -1; - } - } - - public class CombineGenerator { - Vector> rootNodes; - Vector> rootNStates; - Vector> node2Combine; - Vector> combine; - int[] lastchoices; - boolean first4choice; - - public CombineGenerator(Vector> rootnodes, Vector> node2combine) { - this.rootNodes = rootnodes; - this.node2Combine = node2combine; - this.rootNStates = new Vector>(); - for(int i = 0; i < this.rootNodes.size(); i++) { - this.rootNStates.add(new Vector()); - for(int j = 0; j < this.rootNodes.elementAt(i).size(); j++) { - this.rootNStates.elementAt(i).add(new int[this.node2Combine.size()]); - for(int k = 0; k < this.node2Combine.size(); k++) { - this.rootNStates.elementAt(i).elementAt(j)[k] = 0; - } - } - } - this.combine = new Vector>(); - for(int i = 0; i < this.node2Combine.size(); i++) { - if(this.node2Combine.elementAt(i) == null) { - this.combine.add(null); - } else { - this.combine.add(new Vector()); - for(int j = 0; j < this.node2Combine.elementAt(i).size(); j++) { - this.combine.elementAt(i).add(new Combine(this.node2Combine.elementAt(i).elementAt(j))); - } - } - } - this.lastchoices = null; - this.first4choice = false; - } - - public Vector> getCombine() { - return combine; - } - - public boolean nextGen() { - boolean trial = false; - if(this.lastchoices == null) { - // first time - this.lastchoices = new int[this.node2Combine.size()]; - for(int i = 0; i < this.lastchoices.length; i++) { - this.lastchoices[i] = 0; - } - this.first4choice = true; - trial = trial(); - } else { - trial = trial(); - while(!trial) { - // no more available combination under this choice - // choose another choice - int next = this.node2Combine.size() - 1; - boolean iter = false; - do{ - if(this.node2Combine.elementAt(next) != null) { - this.lastchoices[next]++; - if((this.lastchoices[next] == this.rootNodes.size() || - (this.rootNodes.elementAt(this.lastchoices[next]).elementAt(0).getCid() > - this.node2Combine.elementAt(next).elementAt(0).getCid()))){ - // break the rule that a node can only be combined to nodes with smaller colorid. - // or no more buckets - // backtrack - next--; - iter = true; - } else { - iter = false; - } - } else { - next--; - iter = true; - } - }while(iter && !(next < 0)); - if(next < 0) { - return false; - } - for(next += 1; next < this.node2Combine.size(); next++) { - this.lastchoices[next] = 0; - } - this.first4choice = true; - trial = trial(); - } - } - return trial; - } - - private boolean trial() { - boolean suc = false; - if(this.first4choice) { - // first time for each choice - // put all the objects of one color into the first bucket indicated by the choice - int next = 0; - suc = firstexpand(next, this.first4choice); - this.first4choice = false; - } else { - int next = this.node2Combine.size() - 1; - int layer = 0; - suc = innertrial(next, layer); - } - return suc; - } - - private boolean firstexpand(int next, boolean first) { - for(int i = next; i < this.node2Combine.size(); i++) { - if(this.node2Combine.elementAt(i) != null) { - int choice = this.lastchoices[i]; - for(int j = 0; j < this.node2Combine.elementAt(i).size(); j++) { - Combine tmp = this.combine.elementAt(i).elementAt(j); - if(!first) { - this.rootNStates.elementAt(tmp.root).elementAt(tmp.index)[next]--; - } - tmp.root = choice; - tmp.index = 0; - if(!first) { - this.rootNStates.elementAt(tmp.root).elementAt(tmp.index)[next]++; - } - } - if(first) { - this.rootNStates.elementAt(choice).elementAt(0)[i] = this.node2Combine.elementAt(i).size(); - for(int j = 1; j < this.rootNodes.elementAt(choice).size(); j++) { - this.rootNStates.elementAt(choice).elementAt(j)[i] = 0; - } - } - } - } - return true; - } - - private boolean innertrial(int next, int layer) { - if((this.combine.elementAt(next) == null) || - (this.combine.elementAt(next).size() < 2)) { - // skip over empty buckets and bucket with only one obj ( make sure - // at least one obj is existing in the chosen bucket) - if(next - 1 < 0) { - return false; - } else { - return innertrial(next - 1, ++layer); - } - } - Combine tmp = this.combine.elementAt(next).lastElement(); - // try to move it backward - int root = tmp.root; - int index = tmp.index; - index++; - if(index == this.rootNodes.elementAt(root).size()) { - // no more place in this color bucket - index = 0; - root++; - }else if(this.rootNStates.elementAt(root).elementAt(index - 1)[next] < - this.rootNStates.elementAt(root).elementAt(index)[next] + 2) { - // break the law of non-increase order inside one color bucket - // try next bucket of another color - index = 0; - root++; - } - if(root == this.rootNodes.size()) { - // no more bucket - // backtrack - root = tmp.root; - index = tmp.index; - int t = this.combine.elementAt(next).size() - 2; - while(true) { - while(!(t < 0)) { - tmp = this.combine.elementAt(next).elementAt(t); - if ((tmp.root != root) || (tmp.index != index)) { - break; - } - t--; - } - if(t < 0) { - // try the bucket in node2combine before - if(next - 1 < 0) { - return false; - } else { - return innertrial(next - 1, ++layer); - } - } else if(tmp.root != root) { - if((tmp.root == this.lastchoices[next]) && - (this.rootNStates.elementAt(this.lastchoices[next]).elementAt(0)[next] == 1)) { - // only 1 obj left in the chosen bucket - // can not move this one - // try the bucket in node2combine before - if(next - 1 < 0) { - return false; - } else { - return innertrial(next - 1, ++layer); - } - } - this.rootNStates.elementAt(tmp.root).elementAt(tmp.index)[next]--; - //tmp.root = root; - int newroot = tmp.root + 1; - tmp.root = newroot; - tmp.index = 0; - this.rootNStates.elementAt(tmp.root).elementAt(tmp.index)[next]++; - // make all left things in this color bucket reset - for(t++; t < this.combine.elementAt(next).size(); t++) { - tmp = this.combine.elementAt(next).elementAt(t); - this.rootNStates.elementAt(tmp.root).elementAt(tmp.index)[next]--; - tmp.root = newroot; - tmp.index = 0; - this.rootNStates.elementAt(tmp.root).elementAt(tmp.index)[next]++; - } - if(layer != 0) { - return firstexpand(next+1, this.first4choice); - } - return true; - } else if(tmp.index != index) { - if(this.rootNStates.elementAt(root).elementAt(tmp.index)[next] == - this.rootNStates.elementAt(root).elementAt(index)[next]) { - // break the law of non-increase order inside one color bucket - // go on search forward - index = tmp.index; - } else if(this.rootNStates.elementAt(root).elementAt(tmp.index)[next] < - this.rootNStates.elementAt(root).elementAt(index)[next] + 2) { - // break the law of non-increase order inside one color bucket - // and now they only differ by 1 - // propagate this difference to see if it can fix - boolean suc = propagateOne(next, root, index, t, tmp); - if(suc) { - return suc; - } else { - // go on search forward - index = tmp.index; - } - } else { - this.rootNStates.elementAt(tmp.root).elementAt(tmp.index)[next]--; - int tmproot = tmp.root; - int tmpindex = tmp.index; - tmp.root = root; - tmp.index = index; - this.rootNStates.elementAt(tmp.root).elementAt(tmp.index)[next]++; - int desroot = tmp.root; - int desindex = tmp.index; - // make all left things in this color bucket reset - t++; - boolean first = true; - while(t < this.combine.elementAt(next).size()) { - int k = 0; - if(first) { - k = 1; - first = false; - } - for(; (k < this.rootNStates.elementAt(tmproot).elementAt(tmpindex)[next]) && (t < this.combine.elementAt(next).size()); t++) { - tmp = this.combine.elementAt(next).elementAt(t); - this.rootNStates.elementAt(tmp.root).elementAt(tmp.index)[next]--; - tmp.root = desroot; - tmp.index = desindex; - this.rootNStates.elementAt(tmp.root).elementAt(tmp.index)[next]++; - } - if(k == this.rootNStates.elementAt(tmproot).elementAt(tmpindex)[next]) { - desindex++; - } - } - if(layer != 0) { - return firstexpand(next+1, this.first4choice); - } - return true; - } - } - } - } else { - if((tmp.root != this.lastchoices[next]) || - (this.rootNStates.elementAt(this.lastchoices[next]).elementAt(0)[next] > 1)) { - this.rootNStates.elementAt(tmp.root).elementAt(tmp.index)[next]--; - tmp.root = root; - tmp.index = index; - this.rootNStates.elementAt(tmp.root).elementAt(tmp.index)[next]++; - if(layer != 0) { - return firstexpand(next+1, this.first4choice); - } - return true; - } else { - // only 1 obj with the color next exist on the chosen bucket this time, - // can not move it, try objs in forward color bucket - if(next - 1 < 0) { - return false; - } else { - return innertrial(next - 1, ++layer); - } - } - } - } - - private boolean propagateOne(int next, int rooti, int indexi, int ti, Combine tmp) { - int root = rooti; - int index = indexi; - int t = ti; - int rootbk = tmp.root; - int indexbk = tmp.index; - this.rootNStates.elementAt(tmp.root).elementAt(tmp.index)[next]--; - tmp.root = root; - tmp.index = index; - this.rootNStates.elementAt(tmp.root).elementAt(tmp.index)[next]++; - t += 2; - Combine tmpt = null; - if(this.rootNStates.elementAt(root).elementAt(index - 1)[next] < - this.rootNStates.elementAt(root).elementAt(index)[next]) { - // need to continue propagate - while(t < this.combine.elementAt(next).size()) { - tmpt = this.combine.elementAt(next).elementAt(t); - if ((tmpt.root != root) || (tmpt.index != index)) { - break; - } - t++; - } - if(t == this.combine.elementAt(next).size()) { - // last element of this color bucket - if(index + 1 < this.rootNodes.elementAt(root).size()) { - // there is available place inside the same color bucket - Combine tmpbk = this.combine.elementAt(next).elementAt(t - 1); - boolean suc = propagateOne(next, root, index + 1, t - 1, tmpbk); - /*if(!suc) { - // fail, roll back - this.rootNStates.elementAt(tmp.root).elementAt(tmp.index)[next]--; - tmp.root = rootbk; - tmp.index = indexbk; - this.rootNStates.elementAt(tmp.root).elementAt(tmp.index)[next]++; - }*/ - return suc; - } else if(root+1 < this.rootNodes.size()) { // check if there are another bucket - // yes - this.rootNStates.elementAt(tmpt.root).elementAt(tmpt.index)[next]--; - tmpt.root = root + 1; - tmpt.index = 0; - this.rootNStates.elementAt(tmpt.root).elementAt(tmpt.index)[next]++; - return firstexpand(next+1, this.first4choice); - } else { - // no, roll back - this.rootNStates.elementAt(tmp.root).elementAt(tmp.index)[next]--; - tmp.root = rootbk; - tmp.index = indexbk; - this.rootNStates.elementAt(tmp.root).elementAt(tmp.index)[next]++; - return false; - } - } else if(tmpt.root != root) { - Combine tmpbk = this.combine.elementAt(next).elementAt(t - 1); - this.rootNStates.elementAt(tmpbk.root).elementAt(tmpbk.index)[next]--; - tmpbk.root = tmpt.root; - tmpbk.index = 0; - this.rootNStates.elementAt(tmpbk.root).elementAt(tmpbk.index)[next]++; - root = tmpt.root; - index = tmpt.index; - // make all left things in this color bucket reset - for(t += 1; t < this.combine.elementAt(next).size(); t++) { - tmpt = this.combine.elementAt(next).elementAt(t); - this.rootNStates.elementAt(tmpt.root).elementAt(tmpt.index)[next]--; - tmpt.root = root; - tmpt.index = 0; - this.rootNStates.elementAt(tmpt.root).elementAt(tmpt.index)[next]++; - } - return firstexpand(next+1, this.first4choice); - } else if(tmpt.index != index) { - Combine tmpbk = this.combine.elementAt(next).elementAt(t - 1); - boolean suc = propagateOne(next, root, tmpt.index, t - 1, tmpbk); - if(!suc) { - // fail, roll back - this.rootNStates.elementAt(tmp.root).elementAt(tmp.index)[next]--; - tmp.root = rootbk; - tmp.index = indexbk; - this.rootNStates.elementAt(tmp.root).elementAt(tmp.index)[next]++; - } - return suc; - } - // won't reach here, only to avoid compiler's complain - return true; - } else { - return true; - } - } - } -} \ No newline at end of file diff --git a/Robust/src/Analysis/Scheduling/CoreSimulator.java b/Robust/src/Analysis/Scheduling/CoreSimulator.java deleted file mode 100644 index cc1763e4..00000000 --- a/Robust/src/Analysis/Scheduling/CoreSimulator.java +++ /dev/null @@ -1,188 +0,0 @@ -package Analysis.Scheduling; - -import java.util.Hashtable; -import java.util.Queue; -import java.util.Vector; - -import Analysis.TaskStateAnalysis.FlagState; -import IR.TaskDescriptor; - -public class CoreSimulator { - Vector tasks; - RuntimeSchedule rSchedule; - TaskSimulator rtask; - Hashtable> targetCSimulator; - Hashtable> allyCSimulator; - Hashtable targetFState; - int coreNum; - int activeTime; - - public CoreSimulator(RuntimeSchedule schedule, int coreNum) { - super(); - reset(); - this.rSchedule = schedule; - this.coreNum = coreNum; - } - - public CoreSimulator(int coreNum) { - super(); - reset(); - this.coreNum = coreNum; - } - - public void reset() { - this.activeTime = 0; - this.tasks = null; - this.targetCSimulator = null; - this.targetFState = null; - this.rSchedule = null; - this.rtask = null; - } - - public void deployTasks(Vector tasks) { - if(tasks == null) { - return; - } - - if(this.tasks == null) { - this.tasks = new Vector(); - } else { - this.tasks.clear(); - } - - for(int i = 0; i < tasks.size(); i++) { - TaskDescriptor td = tasks.elementAt(i); - this.tasks.add(new TaskSimulator(td, this)); - } - } - - public Queue getTargetCores(FlagState fstate) { - if(targetCSimulator == null) { - return null; - } - return targetCSimulator.get(fstate); - } - - public void setTargetCSimulator(Hashtable> targetCSimulator) { - this.targetCSimulator = targetCSimulator; - } - - public Vector getAllyCores(FlagState fstate) { - if(allyCSimulator == null) { - return null; - } - return allyCSimulator.get(fstate); - } - - public void setAllyCSimulator(Hashtable> allyCSimulator) { - this.allyCSimulator = allyCSimulator; - } - - public FlagState getTargetFState(FlagState fstate) { - if(targetFState == null) { - return fstate; - } - return targetFState.get(fstate); - } - - public void setTargetFState(Hashtable targetFState) { - this.targetFState = targetFState; - } - - public int getActiveTime() { - return activeTime; - } - - public int getCoreNum() { - return coreNum; - } - - public Vector getTasks() { - return tasks; - } - - public RuntimeSchedule getRSchedule() { - return rSchedule; - } - - public void setRSchedule(RuntimeSchedule schedule) { - rSchedule = schedule; - } - - public TaskSimulator getRtask() { - return rtask; - } - - public void addObject(ObjectSimulator newObj) { - if(this.tasks == null) { - return; - } - for(int i = 0; i < this.tasks.size(); i++) { - this.tasks.elementAt(i).enquePara(newObj, null, 0, true); - } - } - - public void addObject(ObjectSimulator newObj, FlagState fs, int version) { - if(this.tasks == null) { - return; - } - for(int i = 0; i < this.tasks.size(); i++) { - this.tasks.elementAt(i).enquePara(newObj, fs, version, false); - } - } - - public Vector finishTask() { - assert(this.rtask != null); - - Vector transObjs = null; - Vector> paraQueues = this.rtask.getParaQueues(); - for(int i = 0; i < paraQueues.size(); i++) { - ObjectSimulator obj = paraQueues.elementAt(i).poll(); - obj.setHold(false); - boolean remove = false; - if((this.targetFState != null) && (this.targetFState.containsKey(obj.getCurrentFS()))) { - if(transObjs == null) { - transObjs = new Vector(); - } - if(!transObjs.contains(obj)) { - transObjs.add(obj); - } - remove = true; - } - // check if this object becoming shared or not - Vector allycores = this.getAllyCores(obj.getCurrentFS()); - if(allycores != null) { - obj.setShared(true); - for(int k = 0; k < allycores.size(); ++k) { - Integer allyCore = allycores.elementAt(k); - if(transObjs == null) { - transObjs = new Vector(); - } - if(!transObjs.contains(obj)) { - transObjs.add(obj); - } - remove = false; - } - } - for(int j = 0; j < this.tasks.size(); j++) { - this.tasks.elementAt(j).refreshPara(obj, remove); - } - } - this.activeTime += this.rtask.getCurrentRun().getFinishTime(); - this.rtask.finish(); - this.rtask = null; - return transObjs; - } - - public void updateTask(int time) { - this.activeTime += time; - this.rtask.updateFinishTime(time); - } - - public TaskSimulator process() { - TaskSimulator next = rSchedule.schedule(tasks); - this.rtask = next; - return next; - } - -} \ No newline at end of file diff --git a/Robust/src/Analysis/Scheduling/FIFORSchedule.java b/Robust/src/Analysis/Scheduling/FIFORSchedule.java deleted file mode 100644 index c64cc84d..00000000 --- a/Robust/src/Analysis/Scheduling/FIFORSchedule.java +++ /dev/null @@ -1,49 +0,0 @@ -package Analysis.Scheduling; - -import java.util.Queue; -import java.util.Vector; - -public class FIFORSchedule extends RuntimeSchedule { - static FIFORSchedule rschedule; - - public static FIFORSchedule getFIFORSchedule() { - if(rschedule == null) { - rschedule = new FIFORSchedule(); - } - return rschedule; - } - - public FIFORSchedule() { - super("FIFO Algorithm"); - } - - public TaskSimulator schedule(Vector tasks) { - if(tasks == null) { - return null; - } - TaskSimulator next = null; - int i = 0; - for(; i < tasks.size(); i++) { - next = tasks.elementAt(i); - int paraNum = next.getTd().numParameters(); - Vector> pqueues = next.getParaQueues(); - if((pqueues == null) || (pqueues.size() < paraNum)) { - continue; - } - int j = 0; - for(; j < pqueues.size(); j++) { - Queue objs = pqueues.elementAt(j); - if((objs == null) || (objs.size() == 0)) { - break; - } - } - if(j == pqueues.size()) { - return next; - } - } - if(i == tasks.size()) { - return null; - } - return next; - } -} \ No newline at end of file diff --git a/Robust/src/Analysis/Scheduling/ObjectInfo.java b/Robust/src/Analysis/Scheduling/ObjectInfo.java deleted file mode 100644 index d4a4a2ca..00000000 --- a/Robust/src/Analysis/Scheduling/ObjectInfo.java +++ /dev/null @@ -1,32 +0,0 @@ -package Analysis.Scheduling; - -import Analysis.TaskStateAnalysis.FlagState; - -public class ObjectInfo { - public ObjectSimulator obj; - public FlagState fs; - public int version; - - public ObjectInfo(ObjectSimulator obj) { - this.obj = obj; - this.fs = obj.getCurrentFS(); - this.version = obj.getVersion(); - } - - public boolean equals(Object o) { - if (o instanceof ObjectInfo) { - ObjectInfo oi=(ObjectInfo)o; - if ((oi.obj != obj) || - (oi.fs != fs) || - (oi.version != version)) { - return false; - } - return true; - } - return false; - } - - public int hashCode() { - return obj.hashCode()^fs.hashCode()^version; - } -} \ No newline at end of file diff --git a/Robust/src/Analysis/Scheduling/ObjectSimulator.java b/Robust/src/Analysis/Scheduling/ObjectSimulator.java deleted file mode 100644 index 4c92e296..00000000 --- a/Robust/src/Analysis/Scheduling/ObjectSimulator.java +++ /dev/null @@ -1,74 +0,0 @@ -package Analysis.Scheduling; - -import Analysis.TaskStateAnalysis.FEdge; -import Analysis.TaskStateAnalysis.FlagState; -import IR.ClassDescriptor; - -public class ObjectSimulator { - ClassDescriptor cd; - FlagState currentFS; - boolean changed; - boolean shared; - boolean hold; - int version; - - public ObjectSimulator(ClassDescriptor cd, FlagState currentFS) { - super(); - this.cd = cd; - this.currentFS = currentFS; - this.changed = true; - this.shared = false; - this.hold = false; - this.version = 0; - } - - public void applyEdge(FEdge fedge) { - if(!currentFS.equals((FlagState)fedge.getTarget())) { - this.changed = true; - currentFS = (FlagState)fedge.getTarget(); - } else { - this.changed = false; - } - } - - public ClassDescriptor getCd() { - return cd; - } - - public FlagState getCurrentFS() { - return currentFS; - } - - public boolean isChanged() { - return changed; - } - - public void setCurrentFS(FlagState currentFS) { - changed = true; - this.currentFS = currentFS; - } - - public boolean isHold() { - return hold; - } - - public void setHold(boolean hold) { - this.hold = hold; - } - - public boolean isShared() { - return shared; - } - - public void setShared(boolean shared) { - this.shared = shared; - } - - public int getVersion() { - return version; - } - - public void increaseVersion() { - this.version++; - } -} \ No newline at end of file diff --git a/Robust/src/Analysis/Scheduling/RuntimeSchedule.java b/Robust/src/Analysis/Scheduling/RuntimeSchedule.java deleted file mode 100644 index 8f38551e..00000000 --- a/Robust/src/Analysis/Scheduling/RuntimeSchedule.java +++ /dev/null @@ -1,19 +0,0 @@ -package Analysis.Scheduling; - -import java.util.Vector; -import java.lang.String; - -public abstract class RuntimeSchedule { - String rsAlgorithm; - - public RuntimeSchedule(String rsAlgorithm) { - super(); - this.rsAlgorithm = rsAlgorithm; - } - - public abstract TaskSimulator schedule(Vector tasks); - - public String algorithm() { - return rsAlgorithm; - } -} \ No newline at end of file diff --git a/Robust/src/Analysis/Scheduling/Schedule.java b/Robust/src/Analysis/Scheduling/Schedule.java deleted file mode 100644 index a04c629b..00000000 --- a/Robust/src/Analysis/Scheduling/Schedule.java +++ /dev/null @@ -1,141 +0,0 @@ -package Analysis.Scheduling; - -import java.util.Hashtable; -import java.util.LinkedList; -import java.util.Queue; -import java.util.Vector; - -import Analysis.TaskStateAnalysis.FlagState; -import IR.TaskDescriptor; - -/** This class holds flag transition diagram(s) can be put on one core. - */ -public class Schedule { - private int coreNum; - private Vector tasks; - private Hashtable> targetCores; - private Hashtable targetFState; // only affected by transimit edges - private Hashtable> allyCores; - private Hashtable> td2fs; - - public Schedule(int coreNum) { - super(); - this.coreNum = coreNum; - this.tasks = null; - this.targetCores = null; - this.targetFState = null; - this.allyCores = null; - this.td2fs = null; - } - - public int getCoreNum() { - return coreNum; - } - - public Hashtable> getTargetCoreTable() { - return targetCores; - } - - public Queue getTargetCores(FlagState fstate) { - if(targetCores == null) { - return null; - } - return targetCores.get(fstate); - } - - public Hashtable getTargetFStateTable() { - return targetFState; - } - - public FlagState getTargetFState(FlagState fstate) { - if(targetFState == null) { - return null; - } - return targetFState.get(fstate); - } - - public Hashtable> getAllyCoreTable() { - return this.allyCores; - } - - public Vector getAllyCores(FlagState fstate) { - if(this.allyCores == null) { - return null; - } - return this.allyCores.get(fstate); - } - - public Hashtable> getTd2FsTable() { - return this.td2fs; - } - - public Vector getFStates4TD(TaskDescriptor td) { - if(this.td2fs == null) { - return null; - } - return this.td2fs.get(td); - } - - public void addTargetCore(FlagState fstate, Integer targetCore) { - if(this.targetCores == null) { - this.targetCores = new Hashtable>(); - } - if(!this.targetCores.containsKey(fstate)) { - this.targetCores.put(fstate, new LinkedList()); - } - this.targetCores.get(fstate).add(targetCore); // there may have some duplicate items, - // which reflects probabilities. - } - - public void addTargetCore(FlagState fstate, Integer targetCore, FlagState tfstate) { - if(this.targetCores == null) { - this.targetCores = new Hashtable>(); - } - if(!this.targetCores.containsKey(fstate)) { - this.targetCores.put(fstate, new LinkedList()); - } - this.targetCores.get(fstate).add(targetCore); - if(this.targetFState == null) { - this.targetFState = new Hashtable(); - } - this.targetFState.put(fstate, tfstate); - } - - public void addAllyCore(FlagState fstate, Integer targetCore) { - if(this.allyCores == null) { - this.allyCores = new Hashtable>(); - } - if(!this.allyCores.containsKey(fstate)) { - this.allyCores.put(fstate, new Vector()); - } - if((this.coreNum != targetCore.intValue()) && (!this.allyCores.get(fstate).contains(targetCore))) { - this.allyCores.get(fstate).add(targetCore); // there may have some duplicate items, - // which reflects probabilities. - } - } - - public void addFState4TD(TaskDescriptor td, FlagState fstate) { - if(this.td2fs == null) { - this.td2fs = new Hashtable>(); - } - if(!this.td2fs.containsKey(td)) { - this.td2fs.put(td, new Vector()); - } - if(!this.td2fs.get(td).contains(fstate)) { - this.td2fs.get(td).add(fstate); - } - } - - public Vector getTasks() { - return tasks; - } - - public void addTask(TaskDescriptor task) { - if(this.tasks == null) { - this.tasks = new Vector(); - } - if(!this.tasks.contains(task)) { - this.tasks.add(task); - } - } -} \ No newline at end of file diff --git a/Robust/src/Analysis/Scheduling/ScheduleAnalysis.java b/Robust/src/Analysis/Scheduling/ScheduleAnalysis.java deleted file mode 100644 index f65c08fe..00000000 --- a/Robust/src/Analysis/Scheduling/ScheduleAnalysis.java +++ /dev/null @@ -1,1036 +0,0 @@ -package Analysis.Scheduling; - -import Analysis.TaskStateAnalysis.*; -import IR.*; - -import java.util.*; - -/** This class holds flag transition diagram(s) can be put on one core. - */ -public class ScheduleAnalysis { - - State state; - TaskAnalysis taskanalysis; - Vector scheduleNodes; - Vector classNodes; - Vector scheduleEdges; - Hashtable cd2ClassNode; - boolean sorted = false; - - int transThreshold; - - int coreNum; - Vector> scheduleGraphs; - Vector> schedulings; - - public ScheduleAnalysis(State state, TaskAnalysis taskanalysis) { - this.state = state; - this.taskanalysis = taskanalysis; - this.scheduleNodes = new Vector(); - this.classNodes = new Vector(); - this.scheduleEdges = new Vector(); - this.cd2ClassNode = new Hashtable(); - this.transThreshold = 45; - this.coreNum = -1; - this.scheduleGraphs = null; - this.schedulings = null; - } - - public void setTransThreshold(int tt) { - this.transThreshold = tt; - } - - public int getCoreNum() { - return coreNum; - } - - public void setCoreNum(int coreNum) { - this.coreNum = coreNum; - } - - public Iterator getScheduleGraphs() { - return this.scheduleGraphs.iterator(); - } - - public Iterator getSchedulingsIter() { - return this.schedulings.iterator(); - } - - public Vector> getSchedulings() { - return this.schedulings; - } - - // for test - public Vector getSEdges4Test() { - return scheduleEdges; - } - - public void preSchedule() { - Hashtable cdToCNodes = new Hashtable(); - // Build the combined flag transition diagram - // First, for each class create a ClassNode - for(Iterator it_classes = state.getClassSymbolTable().getDescriptorsIterator(); it_classes.hasNext(); ) { - ClassDescriptor cd = (ClassDescriptor) it_classes.next(); - Set fStates = taskanalysis.getFlagStates(cd); - - //Sort flagState nodes inside this ClassNode - Vector sFStates = FlagState.DFS.topology(fStates, null); - - Vector rootnodes = taskanalysis.getRootNodes(cd); - if(((rootnodes != null) && (rootnodes.size() > 0)) || (cd.getSymbol().equals(TypeUtil.StartupClass))) { - ClassNode cNode = new ClassNode(cd, sFStates); - cNode.setSorted(true); - classNodes.add(cNode); - cd2ClassNode.put(cd, cNode); - cdToCNodes.put(cd, cNode); - cNode.calExeTime(); - - // for test - if(cd.getSymbol().equals("C")) { - cNode.setTransTime(45); - } - } - fStates = null; - sFStates = null; - } - - ScheduleNode startupNode = null; - // For each ClassNode create a ScheduleNode containing it - int i = 0; - for(i = 0; i < classNodes.size(); i++) { - ClassNode cn = classNodes.elementAt(i); - ScheduleNode sn = new ScheduleNode(cn, 0); - if(cn.getClassDescriptor().getSymbol().equals(TypeUtil.StartupClass)) { - startupNode = sn; - } - cn.setScheduleNode(sn); - scheduleNodes.add(sn); - try { - sn.calExeTime(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - // Create 'new' edges between the ScheduleNodes. - Vector toBreakDown = new Vector(); - for(i = 0; i < classNodes.size(); i++) { - ClassNode cNode = classNodes.elementAt(i); - ClassDescriptor cd = cNode.getClassDescriptor(); - Vector rootnodes = taskanalysis.getRootNodes(cd); - if(rootnodes != null) { - for(int h = 0; h < rootnodes.size(); h++){ - FlagState root=(FlagState)rootnodes.elementAt(h); - Vector allocatingTasks = root.getAllocatingTasks(); - if(allocatingTasks != null) { - for(int k = 0; k < allocatingTasks.size(); k++) { - TaskDescriptor td = (TaskDescriptor)allocatingTasks.elementAt(k); - Vector fev = (Vector)taskanalysis.getFEdgesFromTD(td); - int numEdges = fev.size(); - ScheduleNode sNode = cNode.getScheduleNode(); - for(int j = 0; j < numEdges; j++) { - FEdge pfe = fev.elementAt(j); - FEdge.NewObjInfo noi = pfe.getNewObjInfo(cd); - if ((noi == null) || (noi.getNewRate() == 0) || (noi.getProbability() == 0)) { - // fake creating edge, do not need to create corresponding 'new' edge - continue; - } - if(noi.getRoot() == null) { - // set root FlagState - noi.setRoot(root); - } - FlagState pfs = (FlagState)pfe.getTarget(); - ClassDescriptor pcd = pfs.getClassDescriptor(); - ClassNode pcNode = cdToCNodes.get(pcd); - - ScheduleEdge sEdge = new ScheduleEdge(sNode, "new", root, ScheduleEdge.NEWEDGE, 0); - sEdge.setFEdge(pfe); - sEdge.setSourceCNode(pcNode); - sEdge.setTargetCNode(cNode); - sEdge.setTargetFState(root); - sEdge.setNewRate(noi.getNewRate()); - sEdge.setProbability(noi.getProbability()); - pcNode.getScheduleNode().addEdge(sEdge); - scheduleEdges.add(sEdge); - if((j !=0 ) || (k != 0) || (h != 0)) { - toBreakDown.add(sEdge); - } - } - fev = null; - } - allocatingTasks = null; - } - } - rootnodes = null; - } - } - cdToCNodes = null; - - // Break down the 'cycle's - try { - for(i = 0; i < toBreakDown.size(); i++ ) { - cloneSNodeList(toBreakDown.elementAt(i), false); - } - toBreakDown = null; - } catch (Exception e) { - e.printStackTrace(); - System.exit(-1); - } - - // Remove fake 'new' edges - for(i = 0; i < scheduleEdges.size(); i++) { - ScheduleEdge se = (ScheduleEdge)scheduleEdges.elementAt(i); - if((0 == se.getNewRate()) || (0 == se.getProbability())) { - scheduleEdges.removeElement(se); - scheduleNodes.removeElement(se.getTarget()); - } - } - - // Do topology sort of the ClassNodes and ScheduleEdges. - Vector ssev = new Vector(); - Vector tempSNodes = ClassNode.DFS.topology(scheduleNodes, ssev); - scheduleNodes.removeAllElements(); - scheduleNodes = tempSNodes; - tempSNodes = null; - scheduleEdges.removeAllElements(); - scheduleEdges = ssev; - ssev = null; - sorted = true; - - // Set the cid of these ScheduleNode - Queue toVisit = new LinkedList(); - toVisit.add(startupNode); - while(!toVisit.isEmpty()) { - ScheduleNode sn = toVisit.poll(); - if(sn.getCid() == -1) { - // not visited before - sn.setCid(ScheduleNode.colorID++); - Iterator it_edge = sn.edges(); - while(it_edge.hasNext()) { - toVisit.add((ScheduleNode)((ScheduleEdge)it_edge.next()).getTarget()); - } - } - } - - SchedulingUtil.printScheduleGraph("scheduling_ori.dot", this.scheduleNodes); - } - - public void scheduleAnalysis() { - // First iteration - int i = 0; - //Access the ScheduleEdges in reverse topology order - Hashtable> fe2ses = new Hashtable>(); - Hashtable> sn2fes = new Hashtable>(); - ScheduleNode preSNode = null; - for(i = scheduleEdges.size(); i > 0; i--) { - ScheduleEdge se = (ScheduleEdge)scheduleEdges.elementAt(i-1); - if(ScheduleEdge.NEWEDGE == se.getType()) { - if(preSNode == null) { - preSNode = (ScheduleNode)se.getSource(); - } - - boolean split = false; - FEdge fe = se.getFEdge(); - if(fe.getSource() == fe.getTarget()) { - // back edge - try { - int repeat = (int)Math.ceil(se.getNewRate() * se.getProbability() / 100); - int rate = 0; - if(repeat > 1){ - for(int j = 1; j< repeat; j++ ) { - cloneSNodeList(se, true); - } - se.setNewRate(1); - se.setProbability(100); - } - try { - rate = (int)Math.ceil(se.getListExeTime()/ calInExeTime(se.getSourceFState())); - } catch (Exception e) { - e.printStackTrace(); - } - for(int j = rate - 1; j > 0; j--) { - for(int k = repeat; k > 0; k--) { - cloneSNodeList(se, true); - } - } - } catch (Exception e) { - e.printStackTrace(); - System.exit(-1); - } - } else { - // if preSNode is not the same as se's source ScheduleNode - // handle any ScheduleEdges previously put into fe2ses whose source ScheduleNode is preSNode - boolean same = (preSNode == se.getSource()); - if(!same) { - // check the topology sort, only process those after se.getSource() - if(preSNode.getFinishingTime() < se.getSource().getFinishingTime()) { - if(sn2fes.containsKey(preSNode)) { - Vector fes = sn2fes.remove(preSNode); - for(int j = 0; j < fes.size(); j++) { - FEdge tempfe = fes.elementAt(j); - Vector ses = fe2ses.get(tempfe); - ScheduleEdge tempse = ses.elementAt(0); - int temptime = tempse.getListExeTime(); - // find out the ScheduleEdge with least exeTime - for(int k = 1; k < ses.size(); k++) { - int ttemp = ses.elementAt(k).getListExeTime(); - if(ttemp < temptime) { - tempse = ses.elementAt(k); - temptime = ttemp; - } - } - // handle the tempse - handleScheduleEdge(tempse, true); - ses.removeElement(tempse); - // handle other ScheduleEdges - for(int k = 0; k < ses.size(); k++) { - handleScheduleEdge(ses.elementAt(k), false); - } - ses = null; - fe2ses.remove(tempfe); - } - fes = null; - } - } - preSNode = (ScheduleNode)se.getSource(); - } - - // if fe is the last task inside this ClassNode, delay the expanding and merging until we find all such 'new' edges - // associated with a last task inside this ClassNode - if(!fe.getTarget().edges().hasNext()) { - if(fe2ses.get(fe) == null) { - fe2ses.put(fe, new Vector()); - } - if(sn2fes.get((ScheduleNode)se.getSource()) == null) { - sn2fes.put((ScheduleNode)se.getSource(), new Vector()); - } - if(!fe2ses.get(fe).contains(se)) { - fe2ses.get(fe).add(se); - } - if(!sn2fes.get((ScheduleNode)se.getSource()).contains(fe)) { - sn2fes.get((ScheduleNode)se.getSource()).add(fe); - } - } else { - // As this is not a last task, first handle available ScheduleEdges previously put into fe2ses - if((same) && (sn2fes.containsKey(preSNode))) { - Vector fes = sn2fes.remove(preSNode); - for(int j = 0; j < fes.size(); j++) { - FEdge tempfe = fes.elementAt(j); - Vector ses = fe2ses.get(tempfe); - ScheduleEdge tempse = ses.elementAt(0); - int temptime = tempse.getListExeTime(); - // find out the ScheduleEdge with least exeTime - for(int k = 1; k < ses.size(); k++) { - int ttemp = ses.elementAt(k).getListExeTime(); - if(ttemp < temptime) { - tempse = ses.elementAt(k); - temptime = ttemp; - } - } - // handle the tempse - handleScheduleEdge(tempse, true); - ses.removeElement(tempse); - // handle other ScheduleEdges - for(int k = 0; k < ses.size(); k++) { - handleScheduleEdge(ses.elementAt(k), false); - } - ses = null; - fe2ses.remove(tempfe); - } - fes = null; - } - - if((!(se.getTransTime() < this.transThreshold)) && (se.getSourceCNode().getTransTime() < se.getTransTime())) { - split = true; - splitSNode(se, true); - } else { - // handle this ScheduleEdge - handleScheduleEdge(se, true); - } - } - } - } - } - if(!fe2ses.isEmpty()) { - Set keys = fe2ses.keySet(); - Iterator it_keys = keys.iterator(); - while(it_keys.hasNext()) { - FEdge tempfe = (FEdge)it_keys.next(); - Vector ses = fe2ses.get(tempfe); - ScheduleEdge tempse = ses.elementAt(0); - int temptime = tempse.getListExeTime(); - // find out the ScheduleEdge with least exeTime - for(int k = 1; k < ses.size(); k++) { - int ttemp = ses.elementAt(k).getListExeTime(); - if(ttemp < temptime) { - tempse = ses.elementAt(k); - temptime = ttemp; - } - } - // handle the tempse - handleScheduleEdge(tempse, true); - ses.removeElement(tempse); - // handle other ScheduleEdges - for(int k = 0; k < ses.size(); k++) { - handleScheduleEdge(ses.elementAt(k), false); - } - ses = null; - } - keys = null; - fe2ses.clear(); - sn2fes.clear(); - } - fe2ses = null; - sn2fes = null; - - SchedulingUtil.printScheduleGraph("scheduling_extend.dot", this.scheduleNodes); - } - - private void handleScheduleEdge(ScheduleEdge se, boolean merge) { - try { - int rate = 0; - int repeat = (int)Math.ceil(se.getNewRate() * se.getProbability() / 100); - if(merge) { - try { - if(se.getListExeTime() == 0) { - rate = repeat; - } else { - rate = (int)Math.ceil((se.getTransTime() - calInExeTime(se.getSourceFState()))/ se.getListExeTime()); - } - if(rate < 0 ) { - rate = 0; - } - } catch (Exception e) { - e.printStackTrace(); - } - if(0 == rate) { - // clone the whole ScheduleNode lists starting with se's target - for(int j = 1; j < repeat; j++ ) { - cloneSNodeList(se, true); - } - se.setNewRate(1); - se.setProbability(100); - } else { - repeat -= rate; - if(repeat > 0){ - // clone the whole ScheduleNode lists starting with se's target - for(int j = 0; j < repeat; j++ ) { - cloneSNodeList(se, true); - } - se.setNewRate(rate); - se.setProbability(100); - } - } - // merge the original ScheduleNode to the source ScheduleNode - ((ScheduleNode)se.getSource()).mergeSEdge(se); - scheduleNodes.remove(se.getTarget()); - scheduleEdges.remove(se); - // As se has been changed into an internal edge inside a ScheduleNode, - // change the source and target of se from original ScheduleNodes into ClassNodes. - if(se.getType() == ScheduleEdge.NEWEDGE) { - se.setTarget(se.getTargetCNode()); - se.setSource(se.getSourceCNode()); - se.getTargetCNode().addEdge(se); - } - } else { - // clone the whole ScheduleNode lists starting with se's target - for(int j = 1; j < repeat; j++ ) { - cloneSNodeList(se, true); - } - se.setNewRate(1); - se.setProbability(100); - } - } catch (Exception e) { - e.printStackTrace(); - System.exit(-1); - } - } - - private void cloneSNodeList(ScheduleEdge sEdge, boolean copyIE) throws Exception { - Hashtable cn2cn = new Hashtable(); // hashtable from classnode in orignal se's targe to cloned one - ScheduleNode csNode = (ScheduleNode)((ScheduleNode)sEdge.getTarget()).clone(cn2cn, 0); - scheduleNodes.add(csNode); - - // Clone all the external in ScheduleEdges - int i; - if(copyIE) { - Vector inedges = sEdge.getTarget().getInedgeVector(); - for(i = 0; i < inedges.size(); i++) { - ScheduleEdge tse = (ScheduleEdge)inedges.elementAt(i); - ScheduleEdge se; - switch(tse.getType()) { - case ScheduleEdge.NEWEDGE: { - se = new ScheduleEdge(csNode, "new", tse.getFstate(), tse.getType(), 0); - se.setProbability(100); - se.setNewRate(1); - break; - } - case ScheduleEdge.TRANSEDGE: { - se = new ScheduleEdge(csNode, "transmit", tse.getFstate(), tse.getType(), 0); - se.setProbability(tse.getProbability()); - se.setNewRate(tse.getNewRate()); - break; - } - default: { - throw new Exception("Error: not valid ScheduleEdge here"); - } - } - se.setSourceCNode(tse.getSourceCNode()); - se.setTargetCNode(cn2cn.get(tse.getTargetCNode())); - se.setFEdge(tse.getFEdge()); - se.setTargetFState(tse.getTargetFState()); - se.setIsclone(true); - tse.getSource().addEdge(se); - scheduleEdges.add(se); - } - inedges = null; - } else { - sEdge.getTarget().removeInedge(sEdge); - sEdge.setTarget(csNode); - csNode.getInedgeVector().add(sEdge); - sEdge.setTargetCNode(cn2cn.get(sEdge.getTargetCNode())); - sEdge.setIsclone(true); - } - - Queue toClone = new LinkedList(); // all nodes to be cloned - Queue clone = new LinkedList(); //clone nodes - Queue qcn2cn = new LinkedList(); // queue of the mappings of classnodes inside cloned ScheduleNode - Vector origins = new Vector(); // queue of source ScheduleNode cloned - Hashtable sn2sn = new Hashtable(); // mapping from cloned ScheduleNode to clone ScheduleNode - clone.add(csNode); - toClone.add((ScheduleNode)sEdge.getTarget()); - origins.addElement((ScheduleNode)sEdge.getTarget()); - sn2sn.put((ScheduleNode)sEdge.getTarget(), csNode); - qcn2cn.add(cn2cn); - while(!toClone.isEmpty()) { - Hashtable tocn2cn = new Hashtable(); - csNode = clone.poll(); - ScheduleNode osNode = toClone.poll(); - cn2cn = qcn2cn.poll(); - // Clone all the external ScheduleEdges and the following ScheduleNodes - Vector edges = osNode.getEdgeVector(); - for(i = 0; i < edges.size(); i++) { - ScheduleEdge tse = (ScheduleEdge)edges.elementAt(i); - ScheduleNode tSNode = (ScheduleNode)((ScheduleNode)tse.getTarget()).clone(tocn2cn, 0); - scheduleNodes.add(tSNode); - clone.add(tSNode); - toClone.add((ScheduleNode)tse.getTarget()); - origins.addElement((ScheduleNode)tse.getTarget()); - sn2sn.put((ScheduleNode)tse.getTarget(), tSNode); - qcn2cn.add(tocn2cn); - ScheduleEdge se = null; - switch(tse.getType()) { - case ScheduleEdge.NEWEDGE: { - se = new ScheduleEdge(tSNode, "new", tse.getFstate(), tse.getType(), 0); - break; - } - case ScheduleEdge.TRANSEDGE: { - se = new ScheduleEdge(tSNode, "transmit", tse.getFstate(), tse.getType(), 0); - break; - } - default: { - throw new Exception("Error: not valid ScheduleEdge here"); - } - } - se.setSourceCNode(cn2cn.get(tse.getSourceCNode())); - se.setTargetCNode(tocn2cn.get(tse.getTargetCNode())); - se.setFEdge(tse.getFEdge()); - se.setTargetFState(tse.getTargetFState()); - se.setProbability(tse.getProbability()); - se.setNewRate(tse.getNewRate()); - se.setIsclone(true); - csNode.addEdge(se); - scheduleEdges.add(se); - } - tocn2cn = null; - edges = null; - } - - toClone = null; - clone = null; - qcn2cn = null; - cn2cn = null; - } - - private int calInExeTime(FlagState fs) throws Exception { - int exeTime = 0; - ClassDescriptor cd = fs.getClassDescriptor(); - ClassNode cNode = cd2ClassNode.get(cd); - exeTime = cNode.getFlagStates().elementAt(0).getExeTime() - fs.getExeTime(); - while(true) { - Vector inedges = cNode.getInedgeVector(); - // Now that there are associate ScheduleEdges, there may be multiple inedges of a ClassNode - if(inedges.size() > 1) { - throw new Exception("Error: ClassNode's inedges more than one!"); - } - if(inedges.size() > 0) { - ScheduleEdge sEdge = (ScheduleEdge)inedges.elementAt(0); - cNode = (ClassNode)sEdge.getSource(); - exeTime += cNode.getFlagStates().elementAt(0).getExeTime(); - }else { - break; - } - inedges = null; - } - exeTime = cNode.getScheduleNode().getExeTime() - exeTime; - return exeTime; - } - - private ScheduleNode splitSNode(ScheduleEdge se, boolean copy) { - assert(ScheduleEdge.NEWEDGE == se.getType()); - - FEdge fe = se.getFEdge(); - FlagState fs = (FlagState)fe.getTarget(); - FlagState nfs = (FlagState)fs.clone(); - fs.getEdgeVector().removeAllElements(); - nfs.getInedgeVector().removeAllElements(); - ClassNode sCNode = se.getSourceCNode(); - - // split the subtree whose root is nfs from the whole flag transition tree - Vector sfss = sCNode.getFlagStates(); - Vector fStates = new Vector(); - Queue toiterate = new LinkedList(); - toiterate.add(nfs); - fStates.add(nfs); - while(!toiterate.isEmpty()){ - FlagState tfs = toiterate.poll(); - Iterator it_edges = tfs.edges(); - while(it_edges.hasNext()) { - FlagState temp = (FlagState)((FEdge)it_edges.next()).getTarget(); - if(!fStates.contains(temp)) { - fStates.add(temp); - toiterate.add(temp); - sfss.removeElement(temp); - } - } - } - sfss = null; - Vector sFStates = FlagState.DFS.topology(fStates, null); - fStates = null; - // create a ClassNode and ScheduleNode for this subtree - ClassNode cNode = new ClassNode(sCNode.getClassDescriptor(), sFStates); - ScheduleNode sNode = new ScheduleNode(cNode, 0); - cNode.setScheduleNode(sNode); - cNode.setSorted(true); - cNode.setTransTime(sCNode.getTransTime()); - classNodes.add(cNode); - scheduleNodes.add(sNode); - try { - sNode.calExeTime(); - } catch (Exception e) { - e.printStackTrace(); - } - // flush the exeTime of fs and its ancestors - fs.setExeTime(0); - toiterate.add(fs); - while(!toiterate.isEmpty()) { - FlagState tfs = toiterate.poll(); - int ttime = tfs.getExeTime(); - Iterator it_inedges = tfs.inedges(); - while(it_inedges.hasNext()) { - FEdge fEdge = (FEdge)it_inedges.next(); - FlagState temp = (FlagState)fEdge.getSource(); - int time = fEdge.getExeTime() + ttime; - if(temp.getExeTime() > time) { - temp.setExeTime(time); - toiterate.add(temp); - } - } - } - toiterate = null; - - // create a 'trans' ScheudleEdge between this new ScheduleNode and se's source ScheduleNode - ScheduleEdge sEdge = new ScheduleEdge(sNode, "transmit", fs, ScheduleEdge.TRANSEDGE, 0);//new ScheduleEdge(sNode, "transmit", cNode.getClassDescriptor(), false, 0); - sEdge.setFEdge(fe); - sEdge.setSourceCNode(sCNode); - sEdge.setTargetCNode(cNode); - sEdge.setTargetFState(nfs); - // TODO - // Add calculation codes for calculating transmit time of an object - sEdge.setTransTime(cNode.getTransTime()); - se.getSource().addEdge(sEdge); - scheduleEdges.add(sEdge); - // remove the ClassNodes and internal ScheduleEdges out of this subtree to the new ScheduleNode - ScheduleNode oldSNode = (ScheduleNode)se.getSource(); - Iterator it_isEdges = oldSNode.getScheduleEdgesIterator(); - Vector toremove = new Vector(); - Vector rCNodes = new Vector(); - rCNodes.addElement(sCNode); - if(it_isEdges != null){ - while(it_isEdges.hasNext()) { - ScheduleEdge tse = (ScheduleEdge)it_isEdges.next(); - if(rCNodes.contains(tse.getSourceCNode())) { - if(sCNode == tse.getSourceCNode()) { - if ((tse.getSourceFState() != fs) && (sFStates.contains(tse.getSourceFState()))) { - tse.setSource(cNode); - tse.setSourceCNode(cNode); - } else { - continue; - } - } - sNode.getScheduleEdges().addElement(tse); - sNode.getClassNodes().addElement(tse.getTargetCNode()); - rCNodes.addElement(tse.getTargetCNode()); - oldSNode.getClassNodes().removeElement(tse.getTargetCNode()); - toremove.addElement(tse); - } - } - } - oldSNode.getScheduleEdges().removeAll(toremove); - toremove.clear(); - // redirect ScheudleEdges out of this subtree to the new ScheduleNode - Iterator it_sEdges = se.getSource().edges(); - while(it_sEdges.hasNext()) { - ScheduleEdge tse = (ScheduleEdge)it_sEdges.next(); - if((tse != se) && (tse != sEdge) && (tse.getSourceCNode() == sCNode)) { - if((tse.getSourceFState() != fs) && (sFStates.contains(tse.getSourceFState()))) { - tse.setSource(sNode); - tse.setSourceCNode(cNode); - sNode.getEdgeVector().addElement(tse); - toremove.add(tse); - } - } - } - se.getSource().getEdgeVector().removeAll(toremove); - toremove = null; - sFStates = null; - - try { - if(!copy) { - //merge se into its source ScheduleNode - ((ScheduleNode)se.getSource()).mergeSEdge(se); - scheduleNodes.remove(se.getTarget()); - scheduleEdges.removeElement(se); - // As se has been changed into an internal edge inside a ScheduleNode, - // change the source and target of se from original ScheduleNodes into ClassNodes. - if(se.getType() == ScheduleEdge.NEWEDGE) { - se.setTarget(se.getTargetCNode()); - se.setSource(se.getSourceCNode()); - se.getTargetCNode().addEdge(se); - } - } else { - handleScheduleEdge(se, true); - } - } catch (Exception e) { - e.printStackTrace(); - System.exit(-1); - } - - return sNode; - } - - public void schedule() throws Exception { - if(this.coreNum == -1) { - throw new Exception("Error: un-initialized coreNum when doing scheduling."); - } - - if(this.scheduleGraphs == null) { - this.scheduleGraphs = new Vector>(); - } - - int reduceNum = this.scheduleNodes.size() - this.coreNum; - - // Combine some ScheduleNode if necessary - // May generate multiple graphs suggesting candidate schedulings - if(!(reduceNum > 0)) { - // Enough cores, no need to combine any ScheduleNode - this.scheduleGraphs.addElement(this.scheduleNodes); - int gid = 1; - String path = "scheduling_" + gid + ".dot"; - SchedulingUtil.printScheduleGraph(path, this.scheduleNodes); - } else { - // Go through all the Scheudle Nodes, organize them in order of their cid - Vector> sNodeVecs = new Vector>(); - for(int i = 0; i < this.scheduleNodes.size(); i++) { - ScheduleNode tmpn = this.scheduleNodes.elementAt(i); - int index = tmpn.getCid(); - while(sNodeVecs.size() <= index) { - sNodeVecs.add(null); - } - if(sNodeVecs.elementAt(index) == null) { - sNodeVecs.setElementAt(new Vector(), index); - } - sNodeVecs.elementAt(index).add(tmpn); - } - - CombinationUtil.RootsGenerator rGen = CombinationUtil.allocateRootsGenerator(sNodeVecs, this.coreNum); - - int gid = 1; - while(rGen.nextGen()) { - // first get the chosen rootNodes - Vector> rootNodes = rGen.getRootNodes(); - Vector> nodes2combine = rGen.getNode2Combine(); - - CombinationUtil.CombineGenerator cGen = CombinationUtil.allocateCombineGenerator(rootNodes, nodes2combine); - while (cGen.nextGen()) { - Vector> combine = cGen.getCombine(); - Vector sNodes = generateScheduling(rootNodes, combine, gid++); - this.scheduleGraphs.add(sNodes); - combine = null; - sNodes = null; - } - rootNodes = null; - nodes2combine = null; - } - sNodeVecs = null; - } - - // Generate schedulings according to result schedule graph - if(this.schedulings == null) { - this.schedulings = new Vector>(); - } - - Vector multiparamtds = new Vector(); - Iterator it_tasks = state.getTaskSymbolTable().getDescriptorsIterator(); - while(it_tasks.hasNext()) { - TaskDescriptor td = (TaskDescriptor)it_tasks.next(); - if(td.numParameters() > 1) { - multiparamtds.addElement(td); - } - } - - for(int i = 0; i < this.scheduleGraphs.size(); i++) { - Hashtable> td2cores = new Hashtable>(); // multiparam tasks reside on which cores - Vector scheduleGraph = this.scheduleGraphs.elementAt(i); - Vector scheduling = new Vector(scheduleGraph.size()); - // for each ScheduleNode create a schedule node representing a core - Hashtable sn2coreNum = new Hashtable(); - int j = 0; - for(j = 0; j < scheduleGraph.size(); j++) { - sn2coreNum.put(scheduleGraph.elementAt(j), j); - } - int startupcore = 0; - boolean setstartupcore = false; - Schedule startup = null; - for(j = 0; j < scheduleGraph.size(); j++) { - Schedule tmpSchedule = new Schedule(j); - ScheduleNode sn = scheduleGraph.elementAt(j); - - Vector cNodes = sn.getClassNodes(); - for(int k = 0; k < cNodes.size(); k++) { - Iterator it_flags = cNodes.elementAt(k).getFlags(); - while(it_flags.hasNext()) { - FlagState fs = (FlagState)it_flags.next(); - Iterator it_edges = fs.edges(); - while(it_edges.hasNext()) { - TaskDescriptor td = ((FEdge)it_edges.next()).getTask(); - tmpSchedule.addTask(td); - if(!td2cores.containsKey(td)) { - td2cores.put(td, new Vector()); - } - Vector tmpcores = td2cores.get(td); - if(!tmpcores.contains(tmpSchedule)) { - tmpcores.add(tmpSchedule); - } - // if the FlagState can be fed to some multi-param tasks, - // need to record corresponding ally cores later - if(td.numParameters() > 1) { - tmpSchedule.addFState4TD(td, fs); - } - if(td.getParamType(0).getClassDesc().getSymbol().equals(TypeUtil.StartupClass)) { - assert(!setstartupcore); - startupcore = j; - startup = tmpSchedule; - setstartupcore = true; - } - } - } - } - - // For each of the ScheduleEdge out of this ScheduleNode, add the target ScheduleNode into the queue inside sn - Iterator it_edges = sn.edges(); - while(it_edges.hasNext()) { - ScheduleEdge se = (ScheduleEdge)it_edges.next(); - ScheduleNode target = (ScheduleNode)se.getTarget(); - Integer targetcore = sn2coreNum.get(target); - switch(se.getType()) { - case ScheduleEdge.NEWEDGE: { - for(int k = 0; k < se.getNewRate(); k++) { - tmpSchedule.addTargetCore(se.getFstate(), targetcore); - } - break; - } - case ScheduleEdge.TRANSEDGE: { - // 'transmit' edge - tmpSchedule.addTargetCore(se.getFstate(), targetcore, se.getTargetFState()); - // check if missed some FlagState associated with some multi-parameter - // task, which has been cloned when splitting a ClassNode - FlagState fs = se.getSourceFState(); - FlagState tfs = se.getTargetFState(); - Iterator it = tfs.edges(); - while(it.hasNext()) { - TaskDescriptor td = ((FEdge)it.next()).getTask(); - if(td.numParameters() > 1) { - if(tmpSchedule.getTasks().contains(td)) { - tmpSchedule.addFState4TD(td, fs); - } - } - } - break; - } - } - } - it_edges = sn.getScheduleEdgesIterator(); - while(it_edges.hasNext()) { - ScheduleEdge se = (ScheduleEdge)it_edges.next(); - switch(se.getType()) { - case ScheduleEdge.NEWEDGE: { - for(int k = 0; k < se.getNewRate(); k++) { - tmpSchedule.addTargetCore(se.getFstate(), j); - } - break; - } - case ScheduleEdge.TRANSEDGE: { - // 'transmit' edge - tmpSchedule.addTargetCore(se.getFstate(), j, se.getTargetFState()); - break; - } - } - } - scheduling.add(tmpSchedule); - } - - int number = this.coreNum; - if(scheduling.size() < number) { - number = scheduling.size(); - } - - // set up all the associate ally cores - if(multiparamtds.size() > 0) { - for(j = 0; j < multiparamtds.size(); ++j) { - TaskDescriptor td = multiparamtds.elementAt(j); - Vector fes = (Vector)this.taskanalysis.getFEdgesFromTD(td); - Vector cores = td2cores.get(td); - for(int k = 0; k < cores.size(); ++k) { - Schedule tmpSchedule = cores.elementAt(k); - - for(int h = 0; h < fes.size(); ++h) { - FEdge tmpfe = fes.elementAt(h); - FlagState tmpfs = (FlagState)tmpfe.getTarget(); - Vector tmptds = new Vector(); - if((tmpSchedule.getTargetCoreTable() == null) || (!tmpSchedule.getTargetCoreTable().contains(tmpfs))) { - // add up all possible cores' info - Iterator it_edges = tmpfs.edges(); - while(it_edges.hasNext()) { - TaskDescriptor tmptd = ((FEdge)it_edges.next()).getTask(); - if(!tmptds.contains(tmptd)) { - tmptds.add(tmptd); - Vector tmpcores = td2cores.get(tmptd); - for(int m = 0; m < tmpcores.size(); ++m) { - if(m != tmpSchedule.getCoreNum()) { - // if the FlagState can be fed to some multi-param tasks, - // need to record corresponding ally cores later - if(tmptd.numParameters() > 1) { - tmpSchedule.addAllyCore(tmpfs, tmpcores.elementAt(m).getCoreNum()); - } else { - tmpSchedule.addTargetCore(tmpfs, tmpcores.elementAt(m).getCoreNum()); - } - } - } - } - } - } - } - - if(cores.size() > 1) { - Vector tmpfss = tmpSchedule.getFStates4TD(td); - for(int h = 0; h < tmpfss.size(); ++h) { - for(int l = 0; l < cores.size(); ++l) { - if(l != k) { - tmpSchedule.addAllyCore(tmpfss.elementAt(h), cores.elementAt(l).getCoreNum()); - } - } - } - } - } - } - } - - this.schedulings.add(scheduling); - } - } - - public Vector generateScheduling(Vector> rootnodes, Vector> combine, int gid) { - Vector result = new Vector(); - - // clone the ScheduleNodes - Hashtable> sn2hash = new Hashtable>(); - Hashtable sn2sn = new Hashtable(); - for(int i = 0; i < this.scheduleNodes.size(); i++) { - Hashtable cn2cn = new Hashtable(); - ScheduleNode tocopy = this.scheduleNodes.elementAt(i); - ScheduleNode temp = (ScheduleNode)tocopy.clone(cn2cn, gid); - result.add(i, temp); - sn2hash.put(temp, cn2cn); - sn2sn.put(tocopy, temp); - cn2cn = null; - } - // clone the ScheduleEdges - for(int i = 0; i < this.scheduleEdges.size(); i++) { - ScheduleEdge sse = this.scheduleEdges.elementAt(i); - ScheduleNode csource = sn2sn.get(sse.getSource()); - ScheduleNode ctarget = sn2sn.get(sse.getTarget()); - Hashtable sourcecn2cn = sn2hash.get(csource); - Hashtable targetcn2cn = sn2hash.get(ctarget); - ScheduleEdge se = null; - switch(sse.getType()) { - case ScheduleEdge.NEWEDGE: { - se = new ScheduleEdge(ctarget, "new", sse.getFstate(), sse.getType(), gid);//new ScheduleEdge(ctarget, "new", sse.getClassDescriptor(), sse.getIsNew(), gid); - se.setProbability(sse.getProbability()); - se.setNewRate(sse.getNewRate()); - break; - } - case ScheduleEdge.TRANSEDGE: { - se = new ScheduleEdge(ctarget, "transmit", sse.getFstate(), sse.getType(), gid);//new ScheduleEdge(ctarget, "transmit", sse.getClassDescriptor(), false, gid); - break; - } - } - se.setSourceCNode(sourcecn2cn.get(sse.getSourceCNode())); - se.setTargetCNode(targetcn2cn.get(sse.getTargetCNode())); - se.setFEdge(sse.getFEdge()); - se.setTargetFState(sse.getTargetFState()); - se.setIsclone(true); - csource.addEdge(se); - sourcecn2cn = null; - targetcn2cn = null; - } - - // combine those nodes in combine with corresponding rootnodes - for(int i = 0; i < combine.size(); i++) { - if(combine.elementAt(i) != null) { - for(int j = 0; j < combine.elementAt(i).size(); j++) { - CombinationUtil.Combine tmpcombine = combine.elementAt(i).elementAt(j); - ScheduleNode tocombine = sn2sn.get(tmpcombine.node); - ScheduleNode root = sn2sn.get(rootnodes.elementAt(tmpcombine.root).elementAt(tmpcombine.index)); - ScheduleEdge se = (ScheduleEdge)tocombine.inedges().next(); - try{ - if(root.equals(((ScheduleNode)se.getSource()))) { - root.mergeSEdge(se); - if(ScheduleEdge.NEWEDGE == se.getType()) { - // As se has been changed into an internal edge inside a ScheduleNode, - // change the source and target of se from original ScheduleNodes into ClassNodes. - se.setTarget(se.getTargetCNode()); - se.setSource(se.getSourceCNode()); - se.getTargetCNode().addEdge(se); - } - } else { - root.mergeSNode(tocombine); - } - } catch(Exception e) { - e.printStackTrace(); - System.exit(-1); - } - result.removeElement(tocombine); - } - } - } - - sn2hash = null; - sn2sn = null; - - String path = "scheduling_" + gid + ".dot"; - SchedulingUtil.printScheduleGraph(path, result); - - return result; - } -} diff --git a/Robust/src/Analysis/Scheduling/ScheduleEdge.java b/Robust/src/Analysis/Scheduling/ScheduleEdge.java deleted file mode 100644 index 1c4a52b3..00000000 --- a/Robust/src/Analysis/Scheduling/ScheduleEdge.java +++ /dev/null @@ -1,223 +0,0 @@ -package Analysis.Scheduling; - -import java.util.Iterator; - -import Analysis.TaskStateAnalysis.*; -import Util.Edge; -import Util.GraphNode; - -/* Edge *****************/ -public class ScheduleEdge extends Edge { - - public final static int NEWEDGE = 0; - public final static int TRANSEDGE = 1; - - protected int uid; - protected int gid; - protected static int nodeID=0; - - protected String label; - protected final FlagState fstate; - protected int type; // 0--new edge: indicate creating new objects - // 1--transmit edge: indicate transimitting an existing object - - protected FlagState targetFState; - - private ClassNode sourceCNode; - private ClassNode targetCNode; - - private int probability; - private int transTime; - private int listExeTime; - - private FEdge fedge; - private int newRate; - - private boolean isclone; - - /** Class Constructor - * - */ - public ScheduleEdge(ScheduleNode target, String label, FlagState fstate, int type, int gid) { - super(target); - this.uid = ScheduleEdge.nodeID++; - this.gid = gid; - this.fedge = null; - this.targetFState = null; - this.sourceCNode = null; - this.targetCNode = null; - this.label = label; - this.fstate = fstate; - this.newRate = -1; - this.probability = 100; - this.transTime = -1; - this.listExeTime = -1; - this.isclone = false; - this.type = type; - } - - public boolean isclone() { - return isclone; - } - - public void setIsclone(boolean isclone) { - this.isclone = isclone; - } - - public void setTarget(GraphNode sn) { - this.target = sn; - } - - public int getType() { - return type; - } - - public String getLabel() { - String completeLabel = label; - if(ScheduleEdge.NEWEDGE == this.type) { - completeLabel += ":" + Integer.toString(this.newRate); - } - completeLabel += ":(" + Integer.toString(this.probability) + "%)" + ":[" + Integer.toString(this.transTime) + "]"; - return completeLabel; - } - - public FlagState getFstate() { - return fstate; - } - - public FEdge getFEdge() { - return this.fedge; - } - - public void setFEdge(FEdge fEdge) { - this.fedge = fEdge; - } - - public FlagState getSourceFState() { - if(this.fedge == null) { - return null; - } - return (FlagState)this.fedge.getTarget(); - } - - public void setTargetFState(FlagState targetFState) { - this.targetFState = targetFState; - } - - public FlagState getTargetFState() { - return this.targetFState; - } - - public int getProbability() { - return this.probability; - } - - public int getNewRate() { - return this.newRate; - } - - public ClassNode getSourceCNode() { - return this.sourceCNode; - } - - public void setSourceCNode(ClassNode sourceCNode) { - this.sourceCNode = sourceCNode; - } - - public ClassNode getTargetCNode() { - return this.targetCNode; - } - - public void setTargetCNode(ClassNode targetCNode) { - this.targetCNode = targetCNode; - this.transTime = targetCNode.getTransTime(); - } - - public boolean equals(Object o) { - if (o instanceof ScheduleEdge) { - ScheduleEdge e=(ScheduleEdge)o; - if(e.gid == this.gid) { - if(e.uid != this.uid) { - return false; - } - } - if ((e.label.equals(label))&& - (e.target.equals(target))&& - (e.source.equals(source)) && - (e.fstate.equals(fstate)) && - (e.sourceCNode.equals(sourceCNode)) && - (e.targetCNode.equals(targetCNode)) && - (e.newRate == newRate) && - (e.probability == probability) && - (e.type == type) && - (e.transTime == transTime) && - (e.listExeTime == listExeTime)) - if(e.targetFState != null) { - if(!e.targetFState.equals(targetFState)) { - return false; - } - } else if(this.targetFState != null) { - return false; - } - if(e.fedge != null) { - return e.fedge.equals(fedge); - } else if(this.fedge == null) { - return true; - } - } - return false; - } - - public int hashCode(){ - int hashcode = gid^uid^label.hashCode()^target.hashCode()^source.hashCode()^fstate.hashCode()^ - sourceCNode.hashCode()^targetCNode.hashCode()^newRate^probability^ - type^transTime^listExeTime; - if(targetFState != null) { - hashcode ^= targetFState.hashCode(); - } - if(fedge != null) { - hashcode ^= fedge.hashCode(); - } - return hashcode; - } - - public void setProbability(int prob) { - this.probability = prob; - } - - public void setNewRate(int nr) { - this.newRate = nr; - } - - public int getTransTime() { - return this.transTime; - } - - public void setTransTime(int transTime) { - this.transTime = transTime; - } - - public int getListExeTime() { - if(listExeTime == -1) { - // calculate the lisExeTime - listExeTime = ((ScheduleNode)this.getTarget()).getExeTime() + this.getTransTime() * this.getNewRate(); - Iterator it_edges = this.getTarget().edges(); - int temp = 0; - if(it_edges.hasNext()) { - temp = ((ScheduleEdge)it_edges.next()).getListExeTime(); - } - while(it_edges.hasNext()) { - int tetime = ((ScheduleEdge)it_edges.next()).getListExeTime(); - if(temp < tetime) { - temp = tetime; - } - } - listExeTime += temp; - } - return this.listExeTime; - } - - public void resetListExeTime() { - this.listExeTime = -1; - } -} diff --git a/Robust/src/Analysis/Scheduling/ScheduleNode.java b/Robust/src/Analysis/Scheduling/ScheduleNode.java deleted file mode 100644 index 063515f9..00000000 --- a/Robust/src/Analysis/Scheduling/ScheduleNode.java +++ /dev/null @@ -1,382 +0,0 @@ -package Analysis.Scheduling; - -import java.util.*; - -import Analysis.TaskStateAnalysis.FEdge; -import Analysis.TaskStateAnalysis.FlagState; -import Util.GraphNode; - -/** This class holds flag transition diagram(s) can be put on one core. - */ -public class ScheduleNode extends GraphNode implements Cloneable{ - - private int uid; - private int gid; - private int cid; - private static int nodeID=0; - public static int colorID = 0; - - private Vector classNodes; - Vector scheduleEdges; - - private int executionTime; - - /** Class constructor - * @param cd ClassDescriptor - * @param fStates - */ - public ScheduleNode(int gid) { - this.uid = ScheduleNode.nodeID++; - this.gid = gid; - this.cid = -1; - this.executionTime = -1; - this.classNodes = null; - this.scheduleEdges = null; - } - - public ScheduleNode(ClassNode cn, int gid) { - this.uid = ScheduleNode.nodeID++; - this.gid = gid; - this.cid = -1; - this.classNodes = new Vector(); - this.scheduleEdges = new Vector(); - this.classNodes.add(cn); - this.addEdge(cn.getEdgeVector()); - this.executionTime = -1; - } - - public int getuid() { - return uid; - } - - public int getCid() { - return cid; - } - - public void setCid(int cid) { - this.cid = cid; - } - - public String toString() { - String temp = new String(""); - for(int i = 0; i < classNodes.size(); i++) { - temp += classNodes.elementAt(i).getClassDescriptor().toString() + ", "; - } - temp += getTextLabel(); - return temp; - } - - public Vector getClassNodes() { - return classNodes; - } - - public Iterator getClassNodesIterator() { - if(classNodes == null) { - return null; - } - return classNodes.iterator(); - } - - public void resetClassNodes() { - classNodes = null; - } - - public Vector getScheduleEdges() { - return scheduleEdges; - } - - public Iterator getScheduleEdgesIterator() { - if(scheduleEdges == null) { - return null; - } - return scheduleEdges.iterator(); - } - - public void resetScheduleEdges() { - scheduleEdges = null; - } - - public int getExeTime() { - if(this.executionTime == -1) { - try { - calExeTime(); - } catch (Exception e) { - e.printStackTrace(); - } - } - return this.executionTime; - } - - public void calExeTime() throws Exception { - if(this.classNodes.size() != 1) { - throw new Exception("Error: there are multiple ClassNodes inside the ScheduleNode when calculating executionTime"); - } - ClassNode cn = this.classNodes.elementAt(0); - if(!cn.isSorted()) { - throw new Error("Error: Non-sorted ClassNode!"); - } - this.executionTime = cn.getFlagStates().elementAt(0).getExeTime(); - } - - /** Tests for equality of two flagstate objects. - */ - - public boolean equals(Object o) { - if (o instanceof ScheduleNode) { - ScheduleNode fs=(ScheduleNode)o; - if(fs.gid == this.gid) { - if(fs.uid != this.uid) { - return false; - } - if(fs.cid != this.cid) { - return false; - } - } - if ((fs.executionTime != this.executionTime)){ - return false; - } - if(fs.classNodes != null) { - if(!fs.classNodes.equals(classNodes)) { - return false; - } - } else if(classNodes != null) { - return false; - } - return true; - } - return false; - } - - public int hashCode() { - int hashcode = gid^uid^cid^executionTime; - if(this.classNodes != null) { - hashcode ^= classNodes.hashCode(); - } - return hashcode; - } - - public String getLabel() { - return "cluster" + uid; - } - - public String getTextLabel() { - String label=null; - - if (label==null) - return " "; - return label; - } - - public Object clone(Hashtable cn2cn, int gid) { - ScheduleNode o = null; - try { - o = (ScheduleNode)super.clone(); - } catch(CloneNotSupportedException e){ - e.printStackTrace(); - } - o.uid = ScheduleNode.nodeID++; - o.gid = gid; - o.cid = this.cid; - // Clone all the internal ClassNodes and ScheduleEdges - Vector tcns = new Vector(); - Vector tses = new Vector(); - int i = 0; - for(i = 0; i < this.classNodes.size(); i++) { - ClassNode tcn = this.classNodes.elementAt(i); - ClassNode cn = (ClassNode)tcn.clone(); - cn.setScheduleNode(o); - tcns.add(cn); - cn2cn.put(tcn, cn); - } - for(i = 0; i < this.scheduleEdges.size(); i++) { - ScheduleEdge temp = this.scheduleEdges.elementAt(i); - ScheduleEdge se = null; - switch(temp.getType()) { - case ScheduleEdge.NEWEDGE: { - se = new ScheduleEdge(o, "new", temp.getFstate(), ScheduleEdge.NEWEDGE, gid); - se.setProbability(temp.getProbability()); - se.setNewRate(temp.getNewRate()); - break; - } - case ScheduleEdge.TRANSEDGE: { - se = new ScheduleEdge(o, "transmit", temp.getFstate(), ScheduleEdge.TRANSEDGE, gid); - se.setProbability(temp.getProbability()); - se.setNewRate(temp.getNewRate()); - break; - } - } - se.setSourceCNode(cn2cn.get(temp.getSourceCNode())); - se.setTargetCNode(cn2cn.get(temp.getTargetCNode())); - se.setTransTime(temp.getTransTime()); - se.setFEdge(temp.getFEdge()); - se.setTargetFState(temp.getTargetFState()); - se.setIsclone(true); - tses.add(se); - } - o.classNodes = tcns; - o.scheduleEdges = tses; - tcns = null; - tses = null; - - o.inedges = new Vector(); - o.edges = new Vector(); - return o; - } - - public void mergeSEdge(ScheduleEdge se) throws Exception { - ScheduleNode sn = (ScheduleNode)se.getTarget(); - Vector targetCNodes = (Vector)sn.getClassNodes(); - Vector targetSEdges = (Vector)sn.getScheduleEdges(); - - for(int i = 0; i < targetCNodes.size(); i++) { - targetCNodes.elementAt(i).setScheduleNode(this); - } - - if(classNodes == null) { - classNodes = targetCNodes; - scheduleEdges = targetSEdges; - } else { - if(targetCNodes.size() != 0) { - classNodes.addAll(targetCNodes); - } - if(targetSEdges.size() != 0) { - scheduleEdges.addAll(targetSEdges); - } - } - targetCNodes = null; - - if(ScheduleEdge.TRANSEDGE == se.getType()) { - sn.removeInedge(se); - this.removeEdge(se); - - // merge the split ClassNode of same class - FlagState sfs = se.getFstate(); - FlagState tfs = se.getTargetFState(); - ClassNode scn = se.getSourceCNode(); - ClassNode tcn = se.getTargetCNode(); - sfs.getEdgeVector().addAll(tfs.getEdgeVector()); - // merge the subtree whose root is nfs from the whole flag transition tree - Vector sfss = scn.getFlagStates(); - sfss.addAll(tcn.getFlagStates()); - sfss.removeElement(tfs); - classNodes.removeElement(tcn); - - // flush the exeTime of fs and its ancestors - sfs.setExeTime(0); - Queue toiterate = new LinkedList(); - toiterate.add(sfs); - while(!toiterate.isEmpty()) { - FlagState tmpfs = toiterate.poll(); - int ttime = tmpfs.getExeTime(); - Iterator it_inedges = tmpfs.inedges(); - while(it_inedges.hasNext()) { - FEdge fEdge = (FEdge)it_inedges.next(); - FlagState temp = (FlagState)fEdge.getSource(); - int time = fEdge.getExeTime() + ttime; - if(temp.getExeTime() > time) { - temp.setExeTime(time); - toiterate.add(temp); - } - } - } - toiterate = null; - - // redirct internal ScheduleEdge from tcn to scn - for(int i = 0; i < targetSEdges.size(); ++i) { - ScheduleEdge tmpse = targetSEdges.elementAt(i); - if(tmpse.getSourceCNode().equals(tcn)) { - tmpse.setSourceCNode(scn); - } - } - - // redirect external ScheduleEdges to this ScheduleNode - // and scn if it is originally from tcn - Iterator it_edges = sn.edges(); - while(it_edges.hasNext()) { - ScheduleEdge tse = (ScheduleEdge)it_edges.next(); - tse.setSource(this); - if(tse.getSourceCNode().equals(tcn)) { - tse.setSourceCNode(scn); - } - this.edges.addElement(tse); - } - - targetSEdges = null; - - // As all tasks inside one ScheduleNode are executed sequentially, - // simply add the execution time of all the ClassNodes inside one ScheduleNode. - if(this.executionTime == -1) { - throw new Exception("Error: ScheduleNode without initiate execution time when analysising."); - } - if(this.executionTime < sn.getExeTime()) { - this.executionTime = sn.getExeTime(); - } - } else if(ScheduleEdge.NEWEDGE == se.getType()) { - targetSEdges = null; - - scheduleEdges.add(se); - se.resetListExeTime(); - sn.removeInedge(se); - this.removeEdge(se); - Iterator it_edges = sn.edges(); - while(it_edges.hasNext()) { - ScheduleEdge tse = (ScheduleEdge)it_edges.next(); - tse.setSource(this); - this.edges.addElement(tse); - } - - // As all tasks inside one ScheduleNode are executed sequentially, - // simply add the execution time of all the ClassNodes inside one ScheduleNode. - if(this.executionTime == -1) { - this.executionTime = 0; - } - this.executionTime += ((ScheduleNode)se.getTarget()).getExeTime(); - } - } - - public void mergeSNode(ScheduleNode sn) throws Exception { - Vector targetCNodes = (Vector)sn.getClassNodes(); - Vector targetSEdges = (Vector)sn.getScheduleEdges(); - - for(int i = 0; i < targetCNodes.size(); i++) { - targetCNodes.elementAt(i).setScheduleNode(this); - } - - if(classNodes == null) { - classNodes = targetCNodes; - scheduleEdges = targetSEdges; - } else { - if(targetCNodes.size() != 0) { - classNodes.addAll(targetCNodes); - } - if(targetSEdges.size() != 0) { - scheduleEdges.addAll(targetSEdges); - } - } - targetCNodes = null; - targetSEdges = null; - - // redirect external ScheduleEdges to this ScheduleNode - Iterator it_edges = sn.edges(); - while(it_edges.hasNext()) { - ScheduleEdge tse = (ScheduleEdge)it_edges.next(); - tse.setSource(this); - this.edges.addElement(tse); - } - - it_edges = sn.inedges(); - while(it_edges.hasNext()) { - ScheduleEdge tse = (ScheduleEdge)it_edges.next(); - tse.setTarget(this); - this.inedges.addElement(tse); - } - - // As all tasks inside one ScheduleNode are executed sequentially, - // simply add the execution time of all the ClassNodes inside one ScheduleNode. - if(this.executionTime == -1) { - this.executionTime = 0; - } - this.executionTime += sn.getExeTime(); - - } -} diff --git a/Robust/src/Analysis/Scheduling/ScheduleSimulator.java b/Robust/src/Analysis/Scheduling/ScheduleSimulator.java deleted file mode 100644 index 5e899b29..00000000 --- a/Robust/src/Analysis/Scheduling/ScheduleSimulator.java +++ /dev/null @@ -1,477 +0,0 @@ -package Analysis.Scheduling; - -import java.util.Hashtable; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.Queue; -import java.util.Vector; -import java.util.Map.Entry; - -import Analysis.TaskStateAnalysis.FlagState; -import Analysis.TaskStateAnalysis.TaskAnalysis; -import IR.ClassDescriptor; -import IR.State; -import IR.TaskDescriptor; -import IR.TypeUtil; - -public class ScheduleSimulator { - private int coreNum; - private Vector scheduling; - private Vector cores; - private Vector tasks; - private Vector checkpoints; - private int processTime; - private int invoketime; - - State state; - TaskAnalysis taskanalysis; - - public ScheduleSimulator(int coreNum, State state, TaskAnalysis taskanalysis) { - super(); - this.coreNum = coreNum; - this.scheduling = null; - this.cores = null; - this.tasks = null; - this.checkpoints = null; - this.processTime = 0; - this.invoketime = 0; - this.state = state; - this.taskanalysis = taskanalysis; - } - - public ScheduleSimulator(int coreNum, Vector scheduling, State state, TaskAnalysis taskanalysis) { - super(); - this.coreNum = coreNum; - this.scheduling = scheduling; - this.cores = new Vector(this.coreNum); - for(int i = 0; i < this.coreNum; i++) { - this.cores.add(new CoreSimulator(FIFORSchedule.getFIFORSchedule(), i)); - } - this.tasks = new Vector(); - this.checkpoints = null; - this.processTime = 0; - this.invoketime = 0; - this.state = state; - this.taskanalysis = taskanalysis; - applyScheduling(); - } - - public Vector getCheckpoints() { - return checkpoints; - } - - public int getCoreNum() { - return coreNum; - } - - public void setCoreNum(int coreNum) { - this.coreNum = coreNum; - if(this.cores != null) { - this.cores.clear(); - } - this.cores = new Vector(this.coreNum); - for(int i = 0; i < this.coreNum; i++) { - this.cores.add(new CoreSimulator(FIFORSchedule.getFIFORSchedule(), i)); - } - if(this.scheduling != null) { - applyScheduling(); - } - } - - public int getUtility(int index) { - return (this.cores.elementAt(index).getActiveTime() * 100) / this.processTime; - } - - public Vector getScheduling() { - return scheduling; - } - - public void setScheduling(Vector scheduling) { - this.scheduling = scheduling; - if(this.tasks == null) { - this.tasks = new Vector(); - } else { - this.tasks.clear(); - } - if(this.cores != null) { - for(int i = 0; i < this.coreNum; i++) { - CoreSimulator core = this.cores.elementAt(i); - core.reset(); - core.setRSchedule(FIFORSchedule.getFIFORSchedule()); - } - } else { - this.cores = new Vector(this.coreNum); - for(int i = 0; i < this.coreNum; i++) { - this.cores.add(new CoreSimulator(FIFORSchedule.getFIFORSchedule(), i)); - } - } - - applyScheduling(); - } - - public void applyScheduling() { - assert(this.state != null); - - for(int i = 0; i < this.scheduling.size(); i++) { - Schedule temp = this.scheduling.elementAt(i); - CoreSimulator cs = this.cores.elementAt(temp.getCoreNum()); - cs.deployTasks(temp.getTasks()); - cs.setTargetCSimulator(temp.getTargetCoreTable()); - cs.setAllyCSimulator(temp.getAllyCoreTable()); - cs.setTargetFState(temp.getTargetFStateTable()); - } - // inject a Startup Object to each core - for(int i = 0; i < this.coreNum; i++) { - ClassDescriptor startupobject=(ClassDescriptor)state.getClassSymbolTable().get(TypeUtil.StartupClass); - FlagState fsstartup = (FlagState)taskanalysis.getRootNodes(startupobject).elementAt(0); - ObjectSimulator newObj = new ObjectSimulator(startupobject, fsstartup); - this.cores.elementAt(i).addObject(newObj); - } - } - - public Vector getTasks() { - return tasks; - } - - public int process() { - assert(this.scheduling != null); - - this.invoketime++; - - if(this.checkpoints == null) { - this.checkpoints = new Vector(); - } else { - this.checkpoints.clear(); - } - - this.processTime = 0; - - // first decide next task to execute on each core - int i = 0; - for(i = 0; i < this.cores.size(); i++) { - CoreSimulator cs = this.cores.elementAt(i); - TaskSimulator task = cs.process(); - if(task != null) { - this.tasks.add(task); - } - } - - // add STARTTASK checkpoint for all the initial tasks - CheckPoint cp = new CheckPoint(this.processTime); - for(i = 0; i < this.tasks.size(); i++) { - TaskSimulator task = this.tasks.elementAt(i); - Action action = new Action(task.getCs().getCoreNum(), Action.TASKSTART); - action.setTd(task.getTd()); - cp.addAction(action); - } - this.checkpoints.add(cp); - - while(true) { - // if no more tasks on each core, simulation finish - if(this.tasks.size() == 0) { - break; - } - - // for each task in todo queue, decide the execution path of this time - // according to statistic information - //int index = 0; // indicate the task to finish first - int finishTime = Integer.MAX_VALUE; - Vector finishTasks = new Vector(); - for(i = 0; i < this.tasks.size(); i++) { - TaskSimulator task = this.tasks.elementAt(i); - task.process(); - int tempTime = task.getCurrentRun().getFinishTime(); - if(tempTime < finishTime) { - finishTime = tempTime; - finishTasks.clear(); - finishTasks.add(task); - } else if (tempTime == finishTime) { - finishTasks.add(task); - } - } - for(i = 0; i < this.tasks.size(); i++) { - TaskSimulator task = this.tasks.elementAt(i); - if(!finishTasks.contains(task)) { - task.getCs().updateTask(finishTime); - } - } - this.processTime += finishTime; - cp = new CheckPoint(this.processTime); - Action action = null; - for(i = 0; i < finishTasks.size(); i++) { - TaskSimulator task = finishTasks.elementAt(i); - this.tasks.removeElement(task); - if(task instanceof TransTaskSimulator) { - TransTaskSimulator tmptask = (TransTaskSimulator)task; - // add ADDOBJ task to targetCore - int targetCoreNum = tmptask.getTargetCoreNum(); - ObjectInfo objinfo = tmptask.refreshTask(); - ObjectSimulator nobj = objinfo.obj; - FlagState fs = objinfo.fs; - int version = objinfo.version; - this.cores.elementAt(targetCoreNum).addObject(nobj, fs, version); - action = new Action(targetCoreNum, Action.ADDOBJ, 1, nobj.getCd()); - cp.addAction(action); - if(!tmptask.isFinished()) { - // still have some objects to be transpotted - this.tasks.add(task); - } - if(this.cores.elementAt(targetCoreNum).getRtask() == null) { - TaskSimulator newTask = this.cores.elementAt(targetCoreNum).process(); - if(newTask != null) { - this.tasks.add(newTask); - // add a TASKSTART action into this checkpoint - action = new Action(targetCoreNum, Action.TASKSTART); - action.setTd(newTask.getTd()); - cp.addAction(action); - } - } - } else { - CoreSimulator cs = task.getCs(); - int coreNum = cs.getCoreNum(); - if(task.getCurrentRun().getExetype() == 0) { - Hashtable> transObjQueues = new Hashtable>(); - if(task.getCurrentRun().getNewObjs() == null) { - action = new Action(coreNum, Action.TASKFINISH); - action.setTd(cs.getRtask().getTd()); - } else { - action = new Action(coreNum, Action.TFWITHOBJ); - action.setTd(cs.getRtask().getTd()); - Vector nobjs = task.getCurrentRun().getNewObjs(); - for(int j = 0; j < nobjs.size(); j++) { - ObjectSimulator nobj = nobjs.elementAt(j); - action.addNewObj(nobj.getCd(), Integer.valueOf(1)); - // send the new object to target core according to pre-decide scheduling - Queue cores = cs.getTargetCores(nobj.getCurrentFS()); - if(cores == null) { - // this obj will reside on this core - cs.addObject(nobj); - } else { - Integer targetCore = cores.poll(); - if(targetCore == coreNum) { - // this obj will reside on this core - cs.addObject(nobj); - } else { - if(!transObjQueues.containsKey(targetCore)) { - transObjQueues.put(targetCore, new LinkedList()); - } - Queue tmpqueue = transObjQueues.get(targetCore); - tmpqueue.add(new ObjectInfo(nobj)); - } - // enqueue this core again - cores.add(targetCore); - } - // check if this object becoming shared or not - Vector allycores = cs.getAllyCores(nobj.getCurrentFS()); - if(allycores != null) { - nobj.setShared(true); - for(int k = 0; k < allycores.size(); ++k) { - Integer allyCore = allycores.elementAt(k); - if(allyCore == coreNum) { - cs.addObject(nobj); - } else { - if(!transObjQueues.containsKey(allyCore)) { - transObjQueues.put(allyCore, new LinkedList()); - } - Queue tmpqueue = transObjQueues.get(allyCore); - ObjectInfo nobjinfo = new ObjectInfo(nobj); - if(!tmpqueue.contains(nobjinfo)) { - tmpqueue.add(nobjinfo); - } - } - } - } - } - } - cp.addAction(action); - Vector transObjs = cs.finishTask(); - if(transObjs != null) { - for(int j = 0; j < transObjs.size(); j++) { - ObjectSimulator tobj = transObjs.elementAt(j); - // send the object to target core according to pre-decide scheduling - Queue cores = cs.getTargetCores(tobj.getCurrentFS()); - tobj.setCurrentFS(cs.getTargetFState(tobj.getCurrentFS())); - if(cores == null) { - // this obj will reside on this core - cs.addObject(tobj); - } else { - Integer targetCore = cores.peek(); - if(targetCore == coreNum) { - // this obj will reside on this core - cs.addObject(tobj); - } else { - if(!transObjQueues.containsKey(targetCore)) { - transObjQueues.put(targetCore, new LinkedList()); - } - Queue tmpqueue = transObjQueues.get(targetCore); - tmpqueue.add(new ObjectInfo(tobj)); - } - } - // check if this object becoming shared or not - Vector allycores = cs.getAllyCores(tobj.getCurrentFS()); - if(allycores != null) { - tobj.setShared(true); - for(int k = 0; k < allycores.size(); ++k) { - Integer allyCore = allycores.elementAt(k); - if(allyCore == coreNum) { - cs.addObject(tobj); - } else { - if(!transObjQueues.containsKey(allyCore)) { - transObjQueues.put(allyCore, new LinkedList()); - } - Queue tmpqueue = transObjQueues.get(allyCore); - ObjectInfo nobjinfo = new ObjectInfo(tobj); - if(!tmpqueue.contains(nobjinfo)) { - tmpqueue.add(nobjinfo); - } - } - } - } - } - } - // add 'transport' tasks - Iterator it_entries = transObjQueues.entrySet().iterator(); - while(it_entries.hasNext()) { - Entry> tmpentry = (Entry>)it_entries.next(); - Integer tmpCoreNum = tmpentry.getKey(); - Queue nobjs = tmpentry.getValue(); - TransTaskSimulator tmptask = new TransTaskSimulator(cs, tmpCoreNum, nobjs); - this.tasks.add(tmptask); - } - // Choose a new task for this core - TaskSimulator newTask = cs.process(); - if(newTask != null) { - this.tasks.add(newTask); - // add a TASKSTART action into this checkpoint - action = new Action(coreNum, Action.TASKSTART); - action.setTd(cs.getRtask().getTd()); - cp.addAction(action); - } - } else if (task.getCurrentRun().getExetype() == 1) { - action = new Action(coreNum, Action.TASKABORT); - action.setTd(cs.getRtask().getTd()); - cp.addAction(action); - } else if (task.getCurrentRun().getExetype() == 2) { - action = new Action(coreNum, Action.TASKREMOVE); - action.setTd(cs.getRtask().getTd()); - cp.addAction(action); - } - } - } - this.checkpoints.add(cp); - } - - SchedulingUtil.printSimulationResult("SimulatorResult_" + this.invoketime + ".dot", this.processTime, - this.coreNum, this.checkpoints); - System.out.println("Simulate scheduling #" + this.invoketime + ": "); - System.out.println("\tTotal execution time is: " + this.processTime); - System.out.println("\tUtility of cores: "); - for(int j = 0; j < this.cores.size(); j++) { - System.out.println("\t\tcore" + j + ": " + getUtility(j) + "%"); - } - return this.processTime; - } - - public class CheckPoint { - private int timepoint; - private Vector actions; - - public CheckPoint(int timepoint) { - super(); - this.timepoint = timepoint; - this.actions = new Vector(); - } - - public Vector getActions() { - return actions; - } - - public void addAction(Action action) { - this.actions.add(action); - } - - public int getTimepoint() { - return timepoint; - } - } - - public class Action { - public static final int ADDOBJ = 0; - public static final int TASKFINISH = 1; - public static final int TFWITHOBJ = 2; - public static final int TASKSTART = 3; - public static final int TASKABORT = 4; - public static final int TASKREMOVE = 5; - - private int coreNum; - private int type; - private TaskDescriptor td; - private Hashtable nObjs; - private int nObjNum; - private ClassDescriptor transObj; - - public Action(int coreNum, int type) { - super(); - this.coreNum = coreNum; - this.type = type; - this.td = null; - if(this.type == TFWITHOBJ) { - this.nObjs = new Hashtable(); - } else { - this.nObjs = null; - } - this.nObjNum = -1; - this.transObj = null; - } - - public Action(int coreNum, int type, int objNum, ClassDescriptor transObj) { - super(); - assert(type == ADDOBJ); - this.coreNum = coreNum; - this.type = type; - this.td = null; - this.nObjNum = objNum; - this.transObj = transObj; - } - - public void addNewObj(ClassDescriptor cd, Integer num) { - assert(this.type == TFWITHOBJ); - - if(this.nObjs.containsKey(cd)) { - Integer sum = this.nObjs.get(cd) + num; - this.nObjs.put(cd, sum); - } else { - this.nObjs.put(cd, num); - } - } - - public int getCoreNum() { - return coreNum; - } - - public int getType() { - return type; - } - - public int getNObjNum() { - return nObjNum; - } - - public ClassDescriptor getTransObj() { - return transObj; - } - - public TaskDescriptor getTd() { - return td; - } - - public void setTd(TaskDescriptor td) { - this.td = td; - } - - public Hashtable getNObjs() { - return nObjs; - } - } - -} \ No newline at end of file diff --git a/Robust/src/Analysis/Scheduling/SchedulingUtil.java b/Robust/src/Analysis/Scheduling/SchedulingUtil.java deleted file mode 100644 index 37ff1981..00000000 --- a/Robust/src/Analysis/Scheduling/SchedulingUtil.java +++ /dev/null @@ -1,519 +0,0 @@ -package Analysis.Scheduling; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.PrintWriter; -import java.util.Collection; -import java.util.Enumeration; -import java.util.HashSet; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.Set; -import java.util.Vector; -import java.util.Map.Entry; - -import Analysis.Scheduling.ScheduleSimulator.Action; -import Analysis.Scheduling.ScheduleSimulator.CheckPoint; -import Analysis.TaskStateAnalysis.Allocations; -import Analysis.TaskStateAnalysis.FEdge; -import Analysis.TaskStateAnalysis.FlagState; -import Analysis.TaskStateAnalysis.FEdge.NewObjInfo; -import IR.ClassDescriptor; -import IR.Operation; -import IR.Tree.FlagExpressionNode; -import IR.Tree.FlagNode; -import IR.Tree.FlagOpNode; -import Util.Edge; -import Util.GraphNode; -import Util.Namer; - -public class SchedulingUtil { - - /*public static int maxDivisor(int l, int r) { - int a = l; - int b = r; - int c = 0; - - while(true) { - if(a == 0) { - return b << c; - } else if(b == 0) { - return a << c; - } - - if(((a&1)==0) && ((b&1)==0)) { - // a and b are both even - a >>= 1; - b >>= 1; - ++c; - } else if(((a&1)==0) && ((b&1)!=0)) { - // a is even, b is odd - a >>= 1; - } else if (((a&1)!=0) && ((b&1)==0)) { - // a is odd, b is even - b >>= 1; - } else if (((a&1)!=0) && ((b&1)!=0)) { - // a and b are both odd - int tmp = a>b? b:a; - a = a>b ? (a-b):(b-a); - b = tmp; - } - } - }*/ - - public static boolean isTaskTrigger_flag(FlagExpressionNode fen,FlagState fs) { - if (fen==null) - return true; - else if (fen instanceof FlagNode) - return fs.get(((FlagNode)fen).getFlag()); - else - switch (((FlagOpNode)fen).getOp().getOp()) { - case Operation.LOGIC_AND: - return ((isTaskTrigger_flag(((FlagOpNode)fen).getLeft(),fs)) && (isTaskTrigger_flag(((FlagOpNode)fen).getRight(),fs))); - case Operation.LOGIC_OR: - return ((isTaskTrigger_flag(((FlagOpNode)fen).getLeft(),fs)) || (isTaskTrigger_flag(((FlagOpNode)fen).getRight(),fs))); - case Operation.LOGIC_NOT: - return !(isTaskTrigger_flag(((FlagOpNode)fen).getLeft(),fs)); - default: - return false; - } - } - - public static void printScheduleGraph(String path, Vector sNodes) { - try { - File file=new File(path); - FileOutputStream dotstream=new FileOutputStream(file,false); - PrintWriter output = new java.io.PrintWriter(dotstream, true); - output.println("digraph G {"); - output.println("\tcompound=true;\n"); - traverseSNodes(output, sNodes); - output.println("}\n"); - output.close(); - } catch (Exception e) { - e.printStackTrace(); - System.exit(-1); - } - } - - private static void traverseSNodes(PrintWriter output, Vector sNodes){ - //Draw clusters representing ScheduleNodes - Iterator it = sNodes.iterator(); - while (it.hasNext()) { - ScheduleNode gn = (ScheduleNode) it.next(); - Iterator edges = gn.edges(); - output.println("\tsubgraph " + gn.getLabel() + "{"); - output.println("\t\tlabel=\"" + gn.getTextLabel() + "\";"); - Iterator it_cnodes = gn.getClassNodesIterator(); - traverseCNodes(output, it_cnodes); - //Draw the internal 'new' edges - Iterator it_edges =gn.getScheduleEdgesIterator(); - while(it_edges.hasNext()) { - ScheduleEdge se = (ScheduleEdge)it_edges.next(); - output.print("\t"); - if(se.getSourceCNode().isclone()) { - output.print(se.getSourceCNode().getLabel()); - } else { - if(se.getSourceFState() == null) { - output.print(se.getSourceCNode().getClusterLabel()); - } else { - output.print(se.getSourceFState().getLabel()); - } - } - - output.print(" -> "); - if(se.isclone()) { - if(se.getTargetCNode().isclone()) { - output.print(se.getTargetCNode().getLabel()); - } else { - output.print(se.getTargetCNode().getClusterLabel()); - } - output.println(" [label=\"" + se.getLabel() + "\", color=red];"); - } else { - output.print(se.getTargetFState().getLabel() + " [label=\"" + se.getLabel() + "\", color=red, ltail="); - if(se.getSourceCNode().isclone()) { - output.println(se.getSourceCNode().getLabel() + "];"); - } else { - output.println(se.getSourceCNode().getClusterLabel() + "];"); - } - } - } - output.println("\t}\n"); - //Draw 'new' edges of this ScheduleNode - while(edges.hasNext()) { - ScheduleEdge se = (ScheduleEdge)edges.next(); - output.print("\t"); - if(se.getSourceCNode().isclone()) { - output.print(se.getSourceCNode().getLabel()); - } else { - if(se.getSourceFState() == null) { - output.print(se.getSourceCNode().getClusterLabel()); - } else { - output.print(se.getSourceFState().getLabel()); - } - } - - output.print(" -> "); - if(se.isclone()) { - if(se.getTargetCNode().isclone()) { - output.print(se.getTargetCNode().getLabel()); - } else { - output.print(se.getTargetCNode().getClusterLabel()); - } - output.println(" [label=\"" + se.getLabel() + "\", color=red, style=dashed];"); - } else { - output.println(se.getTargetFState().getLabel() + " [label=\"" + se.getLabel() + "\", color=red, style=dashed];"); - } - } - } - } - - private static void traverseCNodes(PrintWriter output, Iterator it){ - //Draw clusters representing ClassNodes - while (it.hasNext()) { - ClassNode gn = (ClassNode) it.next(); - if(gn.isclone()) { - output.println("\t\t" + gn.getLabel() + " [style=dashed, label=\"" + gn.getTextLabel() + "\", shape=box];"); - } else { - output.println("\tsubgraph " + gn.getClusterLabel() + "{"); - output.println("\t\tstyle=dashed;"); - output.println("\t\tlabel=\"" + gn.getTextLabel() + "\";"); - traverseFlagStates(output, gn.getFlagStates()); - output.println("\t}\n"); - } - } - } - - private static void traverseFlagStates(PrintWriter output, Collection nodes) { - Set cycleset=GraphNode.findcycles(nodes); - Vector namers=new Vector(); - namers.add(new Namer()); - namers.add(new Allocations()); - - Iterator it = nodes.iterator(); - while (it.hasNext()) { - GraphNode gn = (GraphNode) it.next(); - Iterator edges = gn.edges(); - String label = ""; - String dotnodeparams=""; - - for(int i=0;i hashtable = ((FEdge)edge).getNewObjInfoHashtable(); - if(hashtable != null) { - Set keys = hashtable.keySet(); - Iterator it_keys = keys.iterator(); - while(it_keys.hasNext()) { - ClassDescriptor cd = (ClassDescriptor)it_keys.next(); - NewObjInfo noi = hashtable.get(cd); - edgelabel += ":{ class " + cd.getSymbol() + " | " + noi.getNewRate() + " | (" + noi.getProbability() + "%) }"; - } - } - output.println("\t" + gn.getLabel() + " -> " + node2.getLabel() + " [" + "label=\"" + edgelabel + "\"" + edgedotnodeparams + "];"); - } - } - } - } - } - - private static Set nonmerge(GraphNode gn, Collection nodes) { - HashSet newset=new HashSet(); - HashSet toprocess=new HashSet(); - toprocess.add(gn); - while(!toprocess.isEmpty()) { - GraphNode gn2=(GraphNode)toprocess.iterator().next(); - toprocess.remove(gn2); - if (!gn2.merge) - newset.add(gn2); - else { - Iterator edges = gn2.edges(); - while (edges.hasNext()) { - Edge edge = (Edge) edges.next(); - GraphNode node = edge.getTarget(); - if (!newset.contains(node)&&nodes.contains(node)) - toprocess.add(node); - } - } - } - return newset; - } - - public static void printSimulationResult(String path, int time, int coreNum, Vector checkpoints) { - try { - File file=new File(path); - FileOutputStream dotstream=new FileOutputStream(file,false); - PrintWriter output = new java.io.PrintWriter(dotstream, true); - output.println("digraph simulation{"); - output.print("\t"); - output.println("node [shape=plaintext];"); - output.print("\t"); - output.println("edge [dir=none];"); - output.print("\t"); - output.println("ranksep=.05;"); - output.println(); - output.print("\t"); - int j = 0; - - // the capital line - output.print("{rank=source; \"Time\"; "); - for(j = 0; j < coreNum; j++) { - output.print("\"core " + j + "\"; "); - } - output.println("}"); - // time coordinate nodes - Vector timeNodes = new Vector(); - String[] lastTaskNodes = new String[coreNum]; - String[] lastTasks = new String[coreNum]; - boolean[] isTaskFinish = new boolean[coreNum]; - for(j = 0; j < coreNum; j++) { - lastTaskNodes[j] = "first"; - isTaskFinish[j] = true; - lastTasks[j] = ""; - } - timeNodes.add("0"); - for(j = 0; j < checkpoints.size(); j++) { - CheckPoint tcp = checkpoints.elementAt(j); - Hashtable tmplastTasks = new Hashtable(); - Vector tmpisTaskFinish = new Vector(); - Vector tmpisset = new Vector(); - String tnode = String.valueOf(tcp.getTimepoint()); - if(!timeNodes.contains(tnode)) { - timeNodes.add(tnode); - } - Vector actions = tcp.getActions(); - Hashtable tmpTaskNodes = new Hashtable(); - for(int i = 0; i < actions.size(); i++) { - Action taction = actions.elementAt(i); - int cNum = taction.getCoreNum(); - if(!tmplastTasks.contains(cNum)) { - tmplastTasks.put(cNum, lastTasks[cNum]); - } - if(!(tmpisset.contains(cNum)) && (isTaskFinish[cNum]) && !(tmpisTaskFinish.contains(cNum))) { - tmpisTaskFinish.add(cNum); // records those with task finished the first time visit it - } - String tmpTaskNode = "\"" + tnode + "core" + cNum + "\""; - StringBuffer tmpLabel = null; - boolean isfirst = false; - if(!tmpTaskNodes.containsKey(tmpTaskNode)) { - tmpTaskNodes.put(tmpTaskNode, new StringBuffer(tnode + ":")); - isfirst = true; - } - tmpLabel = tmpTaskNodes.get(tmpTaskNode); - switch(taction.getType()){ - case Action.ADDOBJ: { - if(!isfirst) { - tmpLabel.append("\\n"); - } - tmpLabel.append("(" + taction.getTransObj().getSymbol() + ")arrives;"); - if(!(lastTaskNodes[cNum].equals(tmpTaskNode))) { - output.print("\t"); - if(lastTaskNodes[cNum].equals("first")) { - output.print("\"core " + cNum + "\"->" + tmpTaskNode); - } else { - output.print(lastTaskNodes[cNum] + "->" + tmpTaskNode); - } - if(tmpisTaskFinish.contains(cNum)) { - output.print(" [style=invis]"); - } - output.println(";"); - lastTaskNodes[cNum] = tmpTaskNode; - } - break; - } - case Action.TASKFINISH: { - if(!isfirst) { - tmpLabel.append("\\n"); - } - tmpLabel.append("<" + taction.getTd().getSymbol() + ">finishes;"); - if(!(lastTaskNodes[cNum].equals("first"))) { - if(!(lastTaskNodes[cNum].equals(tmpTaskNode))) { - output.print("\t"); - output.println(lastTaskNodes[cNum] + "->" + tmpTaskNode + ";"); - lastTaskNodes[cNum] = tmpTaskNode; - } - if(tmpisset.contains(cNum)) { - isTaskFinish[cNum] &= true; - } else { - isTaskFinish[cNum] = true; - tmpisset.add(cNum); - } - lastTasks[cNum] = ""; - } else { - throw new Exception("Error: unexpected task finish"); - } - break; - } - case Action.TFWITHOBJ: { - if(!isfirst) { - tmpLabel.append("\\n"); - } - tmpLabel.append("<" + taction.getTd().getSymbol() + ">finishes; "); - Iterator> it_entry = (Iterator>)taction.getNObjs().entrySet().iterator(); - while(it_entry.hasNext()) { - Entry entry = it_entry.next(); - tmpLabel.append(entry.getValue() + "(" + entry.getKey().getSymbol() + ")"); - if(it_entry.hasNext()) { - tmpLabel.append(","); - } else { - tmpLabel.append(";"); - } - } - if(!(lastTaskNodes[cNum].equals("first"))) { - if (!(lastTaskNodes[cNum].equals(tmpTaskNode))) { - output.print("\t"); - output.println(lastTaskNodes[cNum] + "->" + tmpTaskNode + ";"); - lastTaskNodes[cNum] = tmpTaskNode; - } - if(tmpisset.contains(cNum)) { - isTaskFinish[cNum] &= true; - } else { - isTaskFinish[cNum] = true; - tmpisset.add(cNum); - } - lastTasks[cNum] = ""; - } else { - throw new Exception("Error: unexpected task finish"); - } - break; - } - case Action.TASKSTART: { - if(!isfirst) { - tmpLabel.append("\\n"); - } - tmpLabel.append("<" + taction.getTd().getSymbol() + ">starts;"); - lastTasks[cNum] = taction.getTd().getSymbol(); - - if (!(lastTaskNodes[cNum].equals(tmpTaskNode))) { - output.print("\t"); - if(lastTaskNodes[cNum].equals("first")) { - output.print("\"core " + cNum + "\"->" + tmpTaskNode); - } else { - output.print(lastTaskNodes[cNum] + "->" + tmpTaskNode); - } - if(tmpisTaskFinish.contains(cNum)) { - output.print(" [style=invis]"); - } - output.println(";"); - lastTaskNodes[cNum] = tmpTaskNode; - } - isTaskFinish[cNum] &= false; - break; - } - case Action.TASKABORT: { - if(!isfirst) { - tmpLabel.append("\\n"); - } - tmpLabel.append("<" + taction.getTd().getSymbol() + ">aborts;"); - if(!(lastTaskNodes[cNum].equals("first")) && - (tmplastTasks.get(cNum).equals(taction.getTd().getSymbol()))) { - if(!(lastTaskNodes[cNum].equals(tmpTaskNode))) { - output.print("\t"); - output.println(lastTaskNodes[cNum] + "->" + tmpTaskNode + ";"); - lastTaskNodes[cNum] = tmpTaskNode; - } - if(tmpisset.contains(cNum)) { - isTaskFinish[cNum] &= true; - } else { - isTaskFinish[cNum] = true; - tmpisset.add(cNum); - } - lastTasks[cNum] = ""; - } else { - throw new Exception("Error: unexpected task aborts"); - } - break; - } - case Action.TASKREMOVE: { - if(!isfirst) { - tmpLabel.append("\\n"); - } - tmpLabel.append("<" + taction.getTd().getSymbol() + ">removes;"); - if(!(lastTaskNodes[cNum].equals("first")) && - (tmplastTasks.get(cNum).equals(taction.getTd().getSymbol()))) { - if(!(lastTaskNodes[cNum].equals(tmpTaskNode))) { - output.print("\t"); - output.println(lastTaskNodes[cNum] + "->" + tmpTaskNode + ";"); - lastTaskNodes[cNum] = tmpTaskNode; - } - if(tmpisset.contains(cNum)) { - isTaskFinish[cNum] &= true; - } else { - isTaskFinish[cNum] = true; - tmpisset.add(cNum); - } - lastTasks[cNum] = ""; - } else { - throw new Exception("Error: unexpected task remove"); - } - break; - } - } - } - Enumeration keys = tmpTaskNodes.keys(); - while(keys.hasMoreElements()) { - String tmpTaskNode = keys.nextElement(); - output.print("\t"); - output.println(tmpTaskNode + "[label=\"" + tmpTaskNodes.get(tmpTaskNode).toString() + "\"]"); - } - output.print("\t"); - output.print("{rank=same; rankdir=LR; " + tnode + "; "); - keys = tmpTaskNodes.keys(); - while(keys.hasMoreElements()) { - String tmpTaskNode = keys.nextElement(); - output.print(tmpTaskNode); - output.print("; "); - } - output.println("}"); - output.print("\t"); - } - output.print("\t"); - output.print("\t"); - output.println("\"Time\"->" + timeNodes.elementAt(0) + "[style=invis];"); - for(j = 0; j < time; j++) { - output.print(j + "->"); - } - output.println(timeNodes.lastElement() + ";"); - output.println("}"); - output.close(); - } catch (Exception e) { - e.printStackTrace(); - System.exit(-1); - } - } -} \ No newline at end of file diff --git a/Robust/src/Analysis/Scheduling/TaskSimulator.java b/Robust/src/Analysis/Scheduling/TaskSimulator.java deleted file mode 100644 index 626d42ec..00000000 --- a/Robust/src/Analysis/Scheduling/TaskSimulator.java +++ /dev/null @@ -1,285 +0,0 @@ -package Analysis.Scheduling; - -import java.util.Hashtable; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.Queue; -import java.util.Vector; - -import Analysis.TaskStateAnalysis.FEdge; -import Analysis.TaskStateAnalysis.FlagState; -import Analysis.TaskStateAnalysis.FEdge.NewObjInfo; -import IR.ClassDescriptor; -import IR.TaskDescriptor; -import IR.VarDescriptor; -import IR.Tree.FlagExpressionNode; - -public class TaskSimulator { - TaskDescriptor td; - Vector> paraQueues; - Hashtable objVersionTbl; - ExeResult currentRun; - CoreSimulator cs; - boolean finish; - - public class ExeResult { - int finishTime; - Vector newObjs; - int exetype; // 0--normal executing - // 1--abort due to fail on grabbing locks - // 2--out of date task - - public ExeResult() { - finishTime = 0; - newObjs = null; - } - - public int getFinishTime() { - return finishTime; - } - - public void setFinishTime(int finishTime) { - this.finishTime = finishTime; - } - - public Vector getNewObjs() { - return newObjs; - } - - public void addNewObj(ObjectSimulator newObj) { - if(this.newObjs == null) { - this.newObjs = new Vector(); - } - - this.newObjs.add(newObj); - } - - public int getExetype() { - return exetype; - } - - public void setExetype(int exetype) { - this.exetype = exetype; - } - } - - public TaskSimulator(TaskDescriptor td, CoreSimulator cs) { - super(); - this.td = td; - this.paraQueues = null; - this.objVersionTbl = null; - this.currentRun = null; - this.cs = cs; - this.finish = true; - } - - public CoreSimulator getCs() { - return cs; - } - - public TaskDescriptor getTd() { - return td; - } - - public ExeResult getCurrentRun() { - return currentRun; - } - - public Vector> getParaQueues() { - return paraQueues; - } - - public Hashtable getObjVersionTbl() { - return objVersionTbl; - } - - public int getObjVersion(ObjectSimulator os) { - return this.objVersionTbl.get(os).intValue(); - } - - public void enquePara(ObjectSimulator obj, FlagState fs, int version, boolean inherent) { - ClassDescriptor cd = obj.getCd(); - int paraNum = td.numParameters(); - for(int i = 0; i < paraNum; i++) { - VarDescriptor para = td.getParameter(i); - if(cd.equals(para.getType().getClassDesc())) { - // check if the status is right - FlagExpressionNode fen = td.getFlag(para); - FlagState cfs = fs; - if(inherent) { - cfs = obj.getCurrentFS(); - } - if(SchedulingUtil.isTaskTrigger_flag(fen, cfs)) { - if(this.paraQueues == null) { - this.paraQueues = new Vector>(); - for(int j = 0; j < paraNum; j++) { - this.paraQueues.add(null); - } - } - if(this.paraQueues.elementAt(i) == null) { - this.paraQueues.setElementAt(new LinkedList(), i); - } - if(this.objVersionTbl == null) { - this.objVersionTbl = new Hashtable(); - } - if(!this.paraQueues.elementAt(i).contains(obj)) { - this.paraQueues.elementAt(i).add(obj); - if(inherent) { - this.objVersionTbl.put(obj, obj.getVersion()); - } else { - this.objVersionTbl.put(obj, version); - } - } - } - } - } - } - - public void refreshPara(ObjectSimulator obj, boolean remove) { - ClassDescriptor cd = obj.getCd(); - int paraNum = td.numParameters(); - for(int i = 0; i < paraNum; i++) { - VarDescriptor para = td.getParameter(i); - if(cd.equals(para.getType().getClassDesc())) { - if(remove) { - if((this.paraQueues != null) && - (this.paraQueues.elementAt(i) != null) && - (this.paraQueues.elementAt(i).contains(obj))) { - this.paraQueues.elementAt(i).remove(obj); - this.objVersionTbl.remove(obj); - } - } else { - // check if the status is right - FlagExpressionNode fen = td.getFlag(para); - if(SchedulingUtil.isTaskTrigger_flag(fen, obj.getCurrentFS())) { - if(this.paraQueues == null) { - this.paraQueues = new Vector>(); - for(int j = 0; j < paraNum; j++) { - this.paraQueues.add(null); - } - } - if(this.paraQueues.elementAt(i) == null) { - this.paraQueues.setElementAt(new LinkedList(), i); - } - this.paraQueues.elementAt(i).add(obj); - if(this.objVersionTbl == null) { - this.objVersionTbl = new Hashtable(); - } - this.objVersionTbl.put(obj, obj.getVersion()); - } else { - if((this.paraQueues != null) && - (this.paraQueues.elementAt(i) != null) && - (this.paraQueues.elementAt(i).contains(obj))){ - this.paraQueues.elementAt(i).remove(obj); - this.objVersionTbl.remove(obj); - } - } - } - } - } - } - - public void process() { - if(!finish) { - return; - } else { - finish = false; - } - - if(this.currentRun == null) { - this.currentRun = new ExeResult(); - } - - int finishTime = 0; - // According to runtime statistic information, decide the execution path of this task this time. - // Mainly following things: - // 1.the result, i.e. the result FlagState reached by each parameter. - // 2.the finish time - // 3.any new objects - - // First check if all the parameters are still available. - // For shared objects, need to first grab the lock and also check if the version is right - for(int i = 0; i < paraQueues.size(); i++) { - ObjectSimulator tpara = paraQueues.elementAt(i).peek(); - if(tpara.isShared()) { - if(tpara.isHold()) { - // shared object held by other tasks - finishTime = 1; // TODO currenly assume the effort on requesting locks are only 1 - this.currentRun.setFinishTime(finishTime); - this.currentRun.setExetype(1); - paraQueues.elementAt(i).poll(); - paraQueues.elementAt(i).add(tpara); - for(int j = 0; j < i; ++j) { - tpara = this.paraQueues.elementAt(j).poll(); - if(tpara.isShared() && tpara.isHold()) { - tpara.setHold(false); - } - this.paraQueues.elementAt(j).add(tpara); - } - return; - } else if (tpara.getVersion() != this.objVersionTbl.get(tpara)) { - // shared object has been updated and no longer fitted to this task - finishTime = 1; // TODO currenly assume the effort on requesting locks are only 1 - this.currentRun.setFinishTime(finishTime); - this.currentRun.setExetype(2); - paraQueues.elementAt(i).poll(); - // remove this object from the remaining parameter queues - for(int j = i + 1; j < paraQueues.size(); j++) { - paraQueues.elementAt(j).remove(tpara); - } - for(int j = 0; j < i; ++j) { - tpara = this.paraQueues.elementAt(j).poll(); - if(tpara.isShared() && tpara.isHold()) { - tpara.setHold(false); - } - this.paraQueues.elementAt(j).add(tpara); - } - return; - } else { - tpara.setHold(true); - } - } - // remove this object from the remaining parameter queues - for(int j = i + 1; j < paraQueues.size(); j++) { - paraQueues.elementAt(j).remove(tpara); - } - } - for(int i = 0; i < paraQueues.size(); i++) { - ObjectSimulator tpara = paraQueues.elementAt(i).peek(); - - FlagState tfstate = tpara.getCurrentFS(); - FEdge toexecute = tfstate.process(td); - finishTime += toexecute.getExeTime(); - if((toexecute.getNewObjInfoHashtable() != null) && (toexecute.getNewObjInfoHashtable().size() > 0)) { - // have new objects - Iterator it = toexecute.getNewObjInfoHashtable().keySet().iterator(); - int invokeNum = toexecute.getInvokeNum(); - while(it.hasNext()) { - ClassDescriptor cd = (ClassDescriptor)it.next(); - NewObjInfo noi = toexecute.getNewObjInfo(cd); - if(noi.getInvokeNum() < ((int)Math.round(((noi.getProbability() / 100) * noi.getNewRate() * invokeNum)))) { - for(int j = 0; j < noi.getNewRate(); j++) { - ObjectSimulator tmpObj = new ObjectSimulator(cd, noi.getRoot()); - this.currentRun.addNewObj(tmpObj); - noi.incInvokeNum(); - } - } - } - } - tpara.applyEdge(toexecute); - tpara.increaseVersion(); - } - finishTime /= paraQueues.size(); - this.currentRun.setFinishTime(finishTime); - this.currentRun.setExetype(0); - } - - public void updateFinishTime(int time) { - this.currentRun.setFinishTime(this.currentRun.finishTime - time); - finish = false; - } - - public void finish() { - this.finish = true; - } -} \ No newline at end of file diff --git a/Robust/src/Analysis/Scheduling/TransTaskSimulator.java b/Robust/src/Analysis/Scheduling/TransTaskSimulator.java deleted file mode 100644 index 19bf74cb..00000000 --- a/Robust/src/Analysis/Scheduling/TransTaskSimulator.java +++ /dev/null @@ -1,38 +0,0 @@ -package Analysis.Scheduling; - -import java.util.Queue; - -public class TransTaskSimulator extends TaskSimulator { - private int targetCoreNum; - private Queue newObjs; - - public TransTaskSimulator(CoreSimulator cs, int targetCoreNum, Queue nobjs) { - super(null, cs); - this.targetCoreNum = targetCoreNum; - this.newObjs = nobjs; - } - - public void process() { - if(this.currentRun == null) { - this.currentRun = new ExeResult(); - } - - this.currentRun.finishTime = 1 * sizeof(this.newObjs.peek().obj.getCd()); - } - - public ObjectInfo refreshTask() { - return this.newObjs.poll(); - } - - private int sizeof(Object obj) { - return 1; - } - - public boolean isFinished() { - return this.newObjs.isEmpty(); - } - - public int getTargetCoreNum() { - return targetCoreNum; - } -} \ No newline at end of file diff --git a/Robust/src/Analysis/TaskStateAnalysis/Allocations.java b/Robust/src/Analysis/TaskStateAnalysis/Allocations.java deleted file mode 100644 index 0146dafc..00000000 --- a/Robust/src/Analysis/TaskStateAnalysis/Allocations.java +++ /dev/null @@ -1,26 +0,0 @@ -package Analysis.TaskStateAnalysis; -import Util.*; - -public class Allocations extends Namer { - public Allocations() {} - - public String nodeLabel(GraphNode gn) { - return ""; - } - - public String nodeOption(GraphNode gn) { - FlagState fs=(FlagState)gn; - if (fs.isSourceNode()) - return "peripheries=2, URL=\"" + fs.getClassDescriptor().toString() + "_" + fs.getLabel() + ".html\""; - else - return ""; - } - - public String edgeLabel(Edge e) { - return ""; - } - - public String edgeOption(Edge e) { - return ""; - } -} diff --git a/Robust/src/Analysis/TaskStateAnalysis/EGEdge.java b/Robust/src/Analysis/TaskStateAnalysis/EGEdge.java deleted file mode 100644 index 12254037..00000000 --- a/Robust/src/Analysis/TaskStateAnalysis/EGEdge.java +++ /dev/null @@ -1,20 +0,0 @@ -package Analysis.TaskStateAnalysis; -import java.util.*; -import Util.Edge; - - -public class EGEdge extends Edge{ - FlagState fs; - public EGEdge(FlagState fs, EGTaskNode target){ - super(target); - this.fs=fs; - } - - public FlagState getFS() { - return fs; - } - - public EGTaskNode getTarget(){ - return (EGTaskNode) target; - } -} diff --git a/Robust/src/Analysis/TaskStateAnalysis/EGTaskNode.java b/Robust/src/Analysis/TaskStateAnalysis/EGTaskNode.java deleted file mode 100644 index 169e52a4..00000000 --- a/Robust/src/Analysis/TaskStateAnalysis/EGTaskNode.java +++ /dev/null @@ -1,96 +0,0 @@ -package Analysis.TaskStateAnalysis; -import Analysis.TaskStateAnalysis.*; -import IR.*; -import IR.Tree.*; -import IR.Flat.*; -import java.util.*; -import Util.GraphNode; - -public class EGTaskNode extends GraphNode { - private boolean source=false; - private FlagState fs; - private FlagState postfs; - private TaskDescriptor td; - private int index; - private String name; - private int uid; - private static int nodeid; - - public EGTaskNode(String name, TaskDescriptor td, FlagState postfs){ - this(name, null, td, -1, postfs); - } - - public EGTaskNode(String name, FlagState fs, TaskDescriptor td, int index, FlagState postfs){ - this.name=name; - this.uid=nodeid++; - this.fs = fs; - this.td = td; - this.index=index; - this.postfs=postfs; - } - - public String getTextLabel() { - return "Task "+getName()+"["+fs+"]->["+postfs+"]"; - } - - public String getName() { - return name; - } - - public String getLabel() { - return "N"+uid; - } - - public int getIndex() { - return index; - } - - public String toString() { - return getTextLabel(); - } - - public FlagState getPostFS() { - return postfs; - } - - public boolean isRuntime() { - return td==null&&getName().equals("Runtime"); - } - - - public boolean isOptional() { - return (!isSource()&&td!=null&&td.isOptional(td.getParameter(index))); - } - - - public TaskDescriptor getTD(){ - return td; - } - - public void setSource(){ - source = true; - } - - public boolean isSource(){ - return source; - } - - public int getuid(){ - return uid; - } - - public boolean isMultipleParams(){ - return getTD()!=null&&getTD().numParameters()>1; - } - - public String getFSName(){ - if(fs == null) - return "no flag"; - else - return fs.getTextLabel(); - } - - public FlagState getFS(){ - return fs; - } -} diff --git a/Robust/src/Analysis/TaskStateAnalysis/ExecutionGraph.java b/Robust/src/Analysis/TaskStateAnalysis/ExecutionGraph.java deleted file mode 100644 index 9046e2d7..00000000 --- a/Robust/src/Analysis/TaskStateAnalysis/ExecutionGraph.java +++ /dev/null @@ -1,142 +0,0 @@ -package Analysis.TaskStateAnalysis; -import java.util.*; -import IR.State; -import IR.SymbolTable; -import IR.ClassDescriptor; -import IR.TaskDescriptor; -import java.io.File; -import java.io.FileWriter; -import java.io.FileOutputStream; -import Util.Edge; - -public class ExecutionGraph { - private TaskAnalysis taskanalysis; - private State state; - private Hashtable executiongraph; - private HashSet marked; - private HashSet processed; - - public ExecutionGraph(State state, TaskAnalysis ta){ - this.taskanalysis=ta; - this.state=state; - this.executiongraph = new Hashtable(); - this.marked=new HashSet(); - this.processed=new HashSet(); - } - - public Hashtable getExecutionGraph(){ - return executiongraph; - } - - public void createExecutionGraph() throws java.io.IOException { - //Cycle through classes - Enumeration e=taskanalysis.flagstates.keys(); - - while (e.hasMoreElements()) { - ClassDescriptor cdtemp=(ClassDescriptor)e.nextElement(); - HashSet graph=exploreGraph(cdtemp); - adapt(cdtemp,graph); - } - printDOTFile(); - } - - private HashSet exploreGraph(ClassDescriptor cd) { - LinkedList fifo = new LinkedList(); - HashSet nodes=new HashSet(); - Hashtable map=new Hashtable(); - - // Go through nodes - Iterator it = taskanalysis.getFlagStates(cd).iterator(); - while (it.hasNext()) { - FlagState fs = it.next(); - if(fs.isSourceNode()) { - for (Iterator allocit = ((Vector)fs.getAllocatingTasks()).iterator(); allocit.hasNext();) { - TaskDescriptor alloctask=(TaskDescriptor)allocit.next(); - EGTaskNode srcnode=new EGTaskNode(alloctask.getSymbol(),alloctask, fs); - nodes.add(srcnode); - srcnode.setSource(); - for (Iterator edges = fs.edges(); edges.hasNext();){ - FEdge edge = (FEdge)edges.next(); - EGTaskNode targetnode=getNode(edge, map, nodes); - EGEdge newedge=new EGEdge(fs, targetnode); - srcnode.addEdge(newedge); - } - } - } - for(Iterator init=fs.inedges();init.hasNext();) { - FEdge inedge=(FEdge)init.next(); - EGTaskNode srcnode=getNode(inedge, map, nodes); - for(Iterator outit=fs.edges();outit.hasNext();) { - FEdge outedge=(FEdge)outit.next(); - EGTaskNode dstnode=getNode(outedge, map, nodes); - EGEdge newedge=new EGEdge(fs,dstnode); - srcnode.addEdge(newedge); - } - } - - } - return nodes; - } - - private EGTaskNode getNode(FEdge fedge, Hashtable map, HashSet nodes) { - if (map.containsKey(fedge)) - return map.get(fedge); - EGTaskNode egnode=new EGTaskNode(fedge.getLabel(), (FlagState) fedge.getSource(), fedge.getTask(), fedge.getIndex(), (FlagState) fedge.getTarget()); - map.put(fedge, egnode); - nodes.add(egnode); - return egnode; - } - - //put the graph into executiongraph - private void adapt(ClassDescriptor cd, HashSet nodes) { - HashSet tasknodes = new HashSet(); - tasknodes.addAll(nodes); - executiongraph.put(cd,tasknodes); - } - - //print the contain of graph - private void test(Hashtable graph) { - System.out.println("\nGraph contains :"); - Collection c = graph.values(); - for ( Iterator it = c.iterator(); it.hasNext();){ - EGTaskNode tn = (EGTaskNode)it.next(); - System.out.println(tn.getTextLabel()+" ID "+tn.getLabel()+" FS "+tn.getFSName()); - } - } - - //create dot files execution_classname_.dot - private void printDOTFile()throws java.io.IOException { - Enumeration e = executiongraph.keys(); - while (e.hasMoreElements()){ - createDOTFile((ClassDescriptor)e.nextElement()); - } - } - - private void createDOTFile(ClassDescriptor cd) throws java.io.IOException { - Set s = (Set)executiongraph.get(cd); - java.io.PrintWriter output; - File dotfile_flagstates= new File("execution"+cd.getSymbol()+".dot"); - FileOutputStream dotstream=new FileOutputStream(dotfile_flagstates,false); - output = new java.io.PrintWriter(dotstream, true); - output.println("digraph dotvisitor {"); - output.println("\tnode [fontsize=10,height=\"0.1\", width=\"0.1\"];"); - output.println("\tedge [fontsize=6];"); - traverse(output, s); - output.println("}\n"); - } - - private void traverse(java.io.PrintWriter output, Set v) { - EGTaskNode tn; - - for(Iterator it1 = v.iterator(); it1.hasNext();){ - tn = (EGTaskNode)it1.next(); - output.println("\t"+tn.getLabel()+" [label=\""+tn.getTextLabel()+"\""); - if (tn.isMultipleParams()) output.println(", color=blue"); - output.println("];"); - - for(Iterator it2 = tn.edges();it2.hasNext();){ - output.println("\t"+tn.getLabel()+" -> "+((EGTaskNode)((EGEdge)it2.next()).getTarget()).getLabel()+";"); - } - } - } -} diff --git a/Robust/src/Analysis/TaskStateAnalysis/FEdge.java b/Robust/src/Analysis/TaskStateAnalysis/FEdge.java deleted file mode 100644 index d91f921a..00000000 --- a/Robust/src/Analysis/TaskStateAnalysis/FEdge.java +++ /dev/null @@ -1,197 +0,0 @@ -package Analysis.TaskStateAnalysis; -import IR.*; -import Analysis.TaskStateAnalysis.*; -import IR.Tree.*; -import IR.Flat.*; -import java.util.*; -import Util.Edge; - -/* Edge *****************/ - -public class FEdge extends Edge { - - private String label; - private TaskDescriptor td; - private int parameterindex; - - // jzhou - private int executeTime; - private Hashtable newObjInfos; - private int probability; - private int invokeNum; - private int expInvokeNum; - - public class NewObjInfo { - int newRate; - int probability; - FlagState root; - int invokeNum; - - public NewObjInfo() { - newRate = 0; - probability = 0; - root = null; - invokeNum = 0; - } - - public NewObjInfo(int newRate, int probability) { - this.newRate = newRate; - this.probability = probability; - } - - public int getNewRate() { - return this.newRate; - } - - public void setNewRate(int newRate) { - this.newRate = newRate; - } - - public int getProbability() { - return this.probability; - } - - public void setProbability(int probability) { - this.probability = probability; - } - - public FlagState getRoot() { - return root; - } - - public void setRoot(FlagState root) { - this.root = root; - } - - public int getInvokeNum() { - return invokeNum; - } - - public void incInvokeNum() { - this.invokeNum++; - } - - public boolean equals(Object o) { - if (o instanceof NewObjInfo) { - NewObjInfo e=(NewObjInfo)o; - if (e.newRate == this.newRate && - e.probability == this.probability && - e.invokeNum == this.invokeNum && - e.root.equals(this.root)) { - return true; - } - } - return false; - } - } - - /** Class Constructor - * - */ - public FEdge(FlagState target, String label, TaskDescriptor td, int parameterindex) { - super(target); - this.label = label; - this.td=td; - this.parameterindex=parameterindex; - this.executeTime = -1; - this.newObjInfos = null; - this.probability = -1; - this.invokeNum = 0; - this.expInvokeNum = 0; - } - - public int getProbability() { - return probability; - } - - public void setProbability(int probability) { - this.probability = probability; - } - - public String getLabel() { - return label; - } - - public int hashCode(){ - int hashcode = label.hashCode()^target.hashCode()^source.hashCode()^parameterindex^executeTime; - if (td!=null) - hashcode^=td.hashCode(); - if(newObjInfos != null) { - hashcode ^= newObjInfos.hashCode(); - } - return hashcode; - } - - public TaskDescriptor getTask() { - return td; - } - - public int getIndex() { - return parameterindex; - } - - public boolean equals(Object o) { - if (o instanceof FEdge) { - FEdge e=(FEdge)o; - if (e.label.equals(label)&& - e.target.equals(target)&& - e.source.equals(source) && - e.td==td&& - e.parameterindex==parameterindex && - e.executeTime == executeTime) { - if(this.newObjInfos != null) { - if(e.newObjInfos == null) { - return false; - } else { - return e.newObjInfos.equals(this.newObjInfos); - } - } - return true; - } - } - return false; - } - - public int getExeTime() { - return this.executeTime; - } - - public void setExeTime(int eTime) { - this.executeTime = eTime; - } - - public Hashtable getNewObjInfoHashtable() { - return this.newObjInfos; - } - - public NewObjInfo getNewObjInfo(ClassDescriptor cd) { - if(this.newObjInfos == null) { - return null; - } - return this.newObjInfos.get(cd); - } - - public void addNewObjInfo(ClassDescriptor cd, int newRate, int probability) { - if(this.newObjInfos == null) { - this.newObjInfos = new Hashtable(); - } - this.newObjInfos.put(cd, new NewObjInfo(newRate, probability)); - } - - public void process() { - this.invokeNum++; - } - - public int getInvokeNum() { - return invokeNum; - } - - public int getInvokeNumGap() { - return expInvokeNum - invokeNum; - } - - public void setExpInvokeNum(int expInvokeNum) { - this.expInvokeNum = expInvokeNum; - } - -} diff --git a/Robust/src/Analysis/TaskStateAnalysis/FlagComparator.java b/Robust/src/Analysis/TaskStateAnalysis/FlagComparator.java deleted file mode 100644 index 1519d975..00000000 --- a/Robust/src/Analysis/TaskStateAnalysis/FlagComparator.java +++ /dev/null @@ -1,30 +0,0 @@ -package Analysis.TaskStateAnalysis; -import java.util.Hashtable; -import java.util.Comparator; -import java.util.Iterator; -import IR.FlagDescriptor; - -/**Note: this comparator imposes orderings that are inconsistent with equals.*/ - -public class FlagComparator implements Comparator { - Hashtable flaginfo; - public FlagComparator(Hashtable flaginfo) { - this.flaginfo=flaginfo; - } - - public int compare(Object o1, Object o2) { - int fs1=getFlagInt((FlagState)o1); - int fs2=getFlagInt((FlagState)o2); - return fs1-fs2; - } - - public int getFlagInt(FlagState fs) { - int flagid=0; - for(Iterator flags = fs.getFlags(); flags.hasNext();){ - FlagDescriptor flagd = (FlagDescriptor)flags.next(); - int id=1<<((Integer)flaginfo.get(flagd)).intValue(); - flagid|=id; - } - return flagid; - } -} diff --git a/Robust/src/Analysis/TaskStateAnalysis/FlagInfo.java b/Robust/src/Analysis/TaskStateAnalysis/FlagInfo.java deleted file mode 100644 index ecdb162f..00000000 --- a/Robust/src/Analysis/TaskStateAnalysis/FlagInfo.java +++ /dev/null @@ -1,52 +0,0 @@ -package Analysis.TaskStateAnalysis; -import IR.*; -import IR.Tree.*; -import IR.Flat.*; -import java.util.*; -import java.io.File; -import java.io.FileWriter; -import java.io.FileOutputStream; - - -public class FlagInfo { - private Hashtable flags; - private State state; - - public FlagInfo(State state) { - this.state=state; - flags=new Hashtable(); - getFlagsfromClasses(); - } - - public FlagDescriptor[] getFlags(ClassDescriptor cd) { - return flags.get(cd); - } - - /** Builds a table of flags for each class in the Bristlecone - * program. It creates one hashtables: one which holds the - * ClassDescriptors and arrays of * FlagDescriptors as key-value - * pairs. */ - - private void getFlagsfromClasses() { - for(Iterator it_classes=state.getClassSymbolTable().getDescriptorsIterator();it_classes.hasNext();) { - ClassDescriptor cd = (ClassDescriptor)it_classes.next(); - Vector vFlags=new Vector(); - FlagDescriptor flag[]; - int ctr=0; - - /* Adding the flags of the super class */ - ClassDescriptor tmp=cd; - while(tmp!=null) { - for(Iterator it_cflags=tmp.getFlags();it_cflags.hasNext();) { - FlagDescriptor fd = (FlagDescriptor)it_cflags.next(); - vFlags.add(fd); - } - tmp=tmp.getSuperDesc(); - } - - flag=new FlagDescriptor[vFlags.size()]; - - flags.put(cd,flag); - } - } -} \ No newline at end of file diff --git a/Robust/src/Analysis/TaskStateAnalysis/FlagState.java b/Robust/src/Analysis/TaskStateAnalysis/FlagState.java deleted file mode 100644 index 4572dd50..00000000 --- a/Robust/src/Analysis/TaskStateAnalysis/FlagState.java +++ /dev/null @@ -1,472 +0,0 @@ -package Analysis.TaskStateAnalysis; - -import Analysis.Scheduling.ScheduleEdge; -import Analysis.TaskStateAnalysis.*; -import IR.*; -import IR.Tree.*; -import IR.Flat.*; -import java.util.*; -import java.io.*; -import Util.GraphNode; - -/** This class is used to hold the flag states that a class in the Bristlecone - * program can exist in, during runtime. - */ -public class FlagState extends GraphNode implements Cloneable { - public static final int ONETAG=1; - public static final int NOTAGS=0; - public static final int MULTITAGS=-1; - public static final int MAXTIME=10; - - private int uid; - private static int nodeid=0; - - private final HashSet flagstate; - private final ClassDescriptor cd; - private final Hashtable tags; - private boolean issourcenode; - private Vector tasks; - public static final int KLIMIT=2; - - // jzhou - // for static scheduling - private int executeTime; - private int visited4time; - private int invokeNum; - // for building multicore codes - private int andmask; - private int checkmask; - private boolean setmask; - private int iuid; - //private boolean isolate; - //private Vector allys; - - /** Class constructor - * Creates a new flagstate with all flags set to false. - * @param cd ClassDescriptor - */ - public FlagState(ClassDescriptor cd) { - this.flagstate=new HashSet(); - this.cd=cd; - this.tags=new Hashtable(); - this.uid=FlagState.nodeid++; - this.issourcenode=false; - this.executeTime = -1; - this.visited4time = -1; - this.invokeNum = 0; - this.andmask = 0; - this.checkmask = 0; - this.setmask = false; - this.iuid = 0; - //this.isolate = true; - //this.allys = null; - } - - /** Class constructor - * Creates a new flagstate with flags set according to the HashSet. - * If the flag exists in the hashset, it's set to true else set to false. - * @param cd ClassDescriptor - * @param flagstate a HashSet containing FlagDescriptors - */ - private FlagState(HashSet flagstate, ClassDescriptor cd,Hashtable tags) { - this.flagstate=flagstate; - this.cd=cd; - this.tags=tags; - this.uid=FlagState.nodeid++; - this.issourcenode=false; - this.executeTime = -1; - this.visited4time = -1; - this.invokeNum = 0; - } - - public int getuid() { - return uid; - } - - public int getiuid() { - return iuid++; - } - - public boolean isSetmask() { - return setmask; - } - - public void setSetmask(boolean setmask) { - this.setmask = setmask; - } - - /** Accessor method - * @param fd FlagDescriptor - * @return true if the flagstate contains fd else false. - */ - public boolean get(FlagDescriptor fd) { - return flagstate.contains(fd); - } - - /** Checks if the flagstate is a source node. - * @return true if the flagstate is a sourcenode(i.e. Is the product of an allocation site). - */ - - public boolean isSourceNode(){ - return issourcenode; - } - - /** Sets the flagstate as a source node. - */ - public void setAsSourceNode(){ - if(!issourcenode){ - issourcenode=true; - this.tasks=new Vector(); - } - } - - public void addAllocatingTask(TaskDescriptor task){ - tasks.add(task); - } - - public Vector getAllocatingTasks(){ - return tasks; - } - - - public String toString() { - return cd.toString()+getTextLabel(); - } - - /** @return Iterator over the flags in the flagstate. - */ - - public Iterator getFlags() { - return flagstate.iterator(); - } - - public int numFlags(){ - return flagstate.size(); - } - - public FlagState[] setTag(TagDescriptor tag, boolean set){ - HashSet newset1=(HashSet)flagstate.clone(); - Hashtable newtags1=(Hashtable)tags.clone(); - - if (set) { - int count=0; - if (tags.containsKey(tag)) - count=tags.get(tag).intValue(); - if (count newtags1=(Hashtable)tags.clone(); - - if (tags.containsKey(tag)){ - //Code could try to remove flag that doesn't exist - - switch (tags.get(tag).intValue()){ - case ONETAG: - newtags1.put(tag,new Integer(MULTITAGS)); - return new FlagState[] {this, new FlagState(newset1, cd, newtags1)}; - case MULTITAGS: - return new FlagState[] {this}; - default: - throw new Error(); - } - } else { - newtags1.put(tag,new Integer(ONETAG)); - return new FlagState[] {new FlagState(newset1,cd,newtags1)}; - } - } - - public int getTagCount(TagDescriptor tag) { - if (tags.containsKey(tag)) - return tags.get(tag).intValue(); - else return 0; - } - - public int getTagCount(String tagtype){ - return getTagCount(new TagDescriptor(tagtype)); - } - - public FlagState[] clearTag(TagDescriptor tag){ - if (tags.containsKey(tag)){ - switch(tags.get(tag).intValue()){ - case ONETAG: - HashSet newset=(HashSet)flagstate.clone(); - Hashtable newtags=(Hashtable)tags.clone(); - newtags.remove(tag); - return new FlagState[]{new FlagState(newset,cd,newtags)}; - - case MULTITAGS: - //two possibilities - count remains 2 or becomes 1 - //2 case - HashSet newset1=(HashSet)flagstate.clone(); - Hashtable newtags1=(Hashtable)tags.clone(); - - //1 case - HashSet newset2=(HashSet)flagstate.clone(); - Hashtable newtags2=(Hashtable)tags.clone(); - newtags1.put(tag,new Integer(ONETAG)); - return new FlagState[] {new FlagState(newset1, cd, newtags2), - new FlagState(newset2, cd, newtags2)}; - default: - throw new Error(); - } - } else { - throw new Error("Invalid Operation: Can not clear a tag that doesn't exist."); - } - } - - /** Creates a string description of the flagstate - * e.g. a flagstate with five flags could look like 01001 - * @param flags an array of flagdescriptors. - * @return string representation of the flagstate. - */ - public String toString(FlagDescriptor[] flags) - { - StringBuffer sb = new StringBuffer(flagstate.size()); - for(int i=0;i < flags.length; i++) - { - if (get(flags[i])) - sb.append(1); - else - sb.append(0); - } - - return new String(sb); - } - - /** Accessor method - * @return returns the classdescriptor of the flagstate. - */ - - public ClassDescriptor getClassDescriptor(){ - return cd; - } - - /** Sets the status of a specific flag in a flagstate after cloning it. - * @param fd FlagDescriptor of the flag whose status is being set. - * @param status boolean value - * @return the new flagstate with fd set to status. - */ - - public FlagState setFlag(FlagDescriptor fd, boolean status) { - HashSet newset=(HashSet) flagstate.clone(); - Hashtable newtags=(Hashtable)tags.clone(); - if (status) - newset.add(fd); - else if (newset.contains(fd)){ - newset.remove(fd); - } - - return new FlagState(newset, cd, newtags); - } - - /** Tests for equality of two flagstate objects. - */ - - public boolean equals(Object o) { - if (o instanceof FlagState) { - FlagState fs=(FlagState)o; - if (fs.cd!=cd) - return false; - return (fs.flagstate.equals(flagstate) & fs.tags.equals(tags)); - } - return false; - } - - public int hashCode() { - return cd.hashCode()^flagstate.hashCode()^tags.hashCode(); - } - - public String getLabel() { - return "N"+uid; - } - - public String getTextLabel() { - String label=null; - for(Iterator it=getFlags();it.hasNext();) { - FlagDescriptor fd=(FlagDescriptor) it.next(); - if (label==null) - label=fd.toString(); - else - label+=", "+fd.toString(); - } - for (Enumeration en_tags=getTags();en_tags.hasMoreElements();){ - TagDescriptor td=(TagDescriptor)en_tags.nextElement(); - switch (tags.get(td).intValue()){ - case ONETAG: - if (label==null) - label=td.toString()+"(1)"; - else - label+=", "+td.toString()+"(1)"; - break; - case MULTITAGS: - if (label==null) - label=td.toString()+"(n)"; - else - label+=", "+td.toString()+"(n)"; - break; - default: - break; - } - } - if (label==null) - return " "; - return label; - } - - public Enumeration getTags(){ - return tags.keys(); - } - - public int getExeTime() { - try { - if(this.executeTime == -1) { - if(this.visited4time == -1) { - this.visited4time = 0; - calExeTime(); - } else { - // visited, this node is in a loop - // TODO - // currently set 10 as the largest time - this.executeTime = FlagState.MAXTIME; - } - } - } catch (Exception e) { - e.printStackTrace(); - System.exit(0); - } - return this.executeTime; - } - - public void setExeTime(int exeTime) { - this.executeTime = exeTime; - } - - public int getAndmask() { - return andmask; - } - - public void setAndmask(int andmask) { - this.andmask = andmask; - } - - public int getCheckmask() { - return checkmask; - } - - public void setCheckmask(int checkmask) { - this.checkmask = checkmask; - } - - public void calExeTime() throws Exception { - Iterator it = this.edges(); - if(it.hasNext()) { - FEdge fe = (FEdge)it.next(); - while((fe != null) && (fe.getTarget().equals(this))) { - if(it.hasNext()) { - fe = (FEdge)it.next(); - } else { - fe = null; - } - } - if(fe == null) { - this.executeTime = 0; - } else { - if(fe.getExeTime() == -1) { - throw new Exception("Error: Uninitiate FEdge!"); - } - this.executeTime = fe.getExeTime() + ((FlagState)fe.getTarget()).getExeTime(); - } - } else { - this.executeTime = 0; - } - while(it.hasNext()) { - FEdge fe = (FEdge)it.next(); - int temp = fe.getExeTime() + ((FlagState)fe.getTarget()).getExeTime(); - if(temp < this.executeTime) { - this.executeTime = temp; - } - } - } - - public Object clone() { - FlagState o = null; - try { - o = (FlagState)super.clone(); - } catch(CloneNotSupportedException e){ - e.printStackTrace(); - } - o.uid = FlagState.nodeid++; - o.edges = new Vector(); - for(int i = 0; i < this.edges.size(); i++) { - o.edges.addElement(this.edges.elementAt(i)); - } - o.inedges = new Vector(); - for(int i = 0; i < this.inedges.size(); i++) { - o.inedges.addElement(this.inedges.elementAt(i)); - } - return o; - } - - public void init4Simulate() { - this.invokeNum = 0; - } - - public FEdge process(TaskDescriptor td) { - FEdge next = null; - this.invokeNum++; - // refresh all the expInvokeNum of each edge - for(int i = 0; i < this.edges.size(); i++) { - next = (FEdge)this.edges.elementAt(i); - next.setExpInvokeNum((int)Math.round(this.invokeNum * (next.getProbability() / 100))); - } - - // find the one with the biggest gap between its actual invoke time and the expected invoke time - // and associated with task td - int index = 0; - int gap = 0; - for(int i = 0; i < this.edges.size(); i++) { - int temp = ((FEdge)this.edges.elementAt(index)).getInvokeNumGap(); - if((temp > gap) && (next.getTask().equals(td))){ - index = i; - gap = temp; - } - } - next = (FEdge)this.edges.elementAt(index); - next.process(); - - return next; - } - - /*public Vector getAllys() { - return allys; - } - - public void addAlly(ScheduleEdge se) { - if(this.allys == null) { - assert(this.isolate == true); - this.isolate = false; - this.allys = new Vector(); - } - this.allys.addElement(se); - } - - public boolean isIsolate() { - return isolate; - }*/ - -} diff --git a/Robust/src/Analysis/TaskStateAnalysis/FlagTagState.java b/Robust/src/Analysis/TaskStateAnalysis/FlagTagState.java deleted file mode 100644 index ee4ffee5..00000000 --- a/Robust/src/Analysis/TaskStateAnalysis/FlagTagState.java +++ /dev/null @@ -1,27 +0,0 @@ -package Analysis.TaskStateAnalysis; -import IR.*; -import IR.Tree.*; -import IR.Flat.*; -import java.util.*; - -public class FlagTagState { - TagState ts; - FlagState fs; - - public FlagTagState(TagState ts, FlagState fs) { - this.ts=ts; - this.fs=fs; - } - - public boolean equals(Object o) { - if (o instanceof FlagTagState) { - FlagTagState fts=(FlagTagState) o; - return ts.equals(fts.ts)&&fs.equals(fts.fs); - } - return false; - } - - public int hashCode() { - return ts.hashCode()^fs.hashCode(); - } -} diff --git a/Robust/src/Analysis/TaskStateAnalysis/GarbageAnalysis.java b/Robust/src/Analysis/TaskStateAnalysis/GarbageAnalysis.java deleted file mode 100644 index 46cdfb94..00000000 --- a/Robust/src/Analysis/TaskStateAnalysis/GarbageAnalysis.java +++ /dev/null @@ -1,81 +0,0 @@ -package Analysis.TaskStateAnalysis; -import IR.*; -import Util.Namer; -import java.util.*; -import Util.GraphNode; -import Util.Edge; - -public class GarbageAnalysis extends Namer { - State state; - TaskAnalysis taskanalysis; - HashSet garbagestates; - HashSet possiblegarbagestates; - - - public GarbageAnalysis(State state, TaskAnalysis taskanalysis) { - this.state=state; - this.taskanalysis=taskanalysis; - this.garbagestates=new HashSet(); - this.possiblegarbagestates=new HashSet(); - doAnalysis(); - } - - public void doAnalysis() { - for(Iterator it=state.getClassSymbolTable().getDescriptorsIterator();it.hasNext();) { - ClassDescriptor cd=(ClassDescriptor) it.next(); - if (taskanalysis.getFlagStates(cd)==null) - continue; - analyzeClass(cd); - } - } - - public void analyzeClass(ClassDescriptor cd) { - Set flagstatenodes=taskanalysis.getFlagStates(cd); - HashSet garbage=new HashSet(); - HashSet possiblegarbage=new HashSet(); - - for(Iterator fsit=flagstatenodes.iterator();fsit.hasNext();) { - FlagState fs=(FlagState)fsit.next(); - if (fs.numedges()==0) - garbage.add(fs); - } - - Stack tovisit=new Stack(); - tovisit.addAll(garbage); - possiblegarbage.addAll(garbage); - while(!tovisit.isEmpty()) { - FlagState fs=(FlagState)tovisit.pop(); - for(int i=0;i fs; - HashSet tags; - - public ObjWrapper(FlagState fs) { - this.initfs=fs; - this.fs=new HashSet(); - tags=new HashSet(); - } - - public ObjWrapper() { - this.fs=new HashSet(); - this.tags=new HashSet(); - } - - -} diff --git a/Robust/src/Analysis/TaskStateAnalysis/OptionalTaskDescriptor.java b/Robust/src/Analysis/TaskStateAnalysis/OptionalTaskDescriptor.java deleted file mode 100644 index dcf54601..00000000 --- a/Robust/src/Analysis/TaskStateAnalysis/OptionalTaskDescriptor.java +++ /dev/null @@ -1,57 +0,0 @@ -package Analysis.TaskStateAnalysis; -import java.util.*; -import IR.*; -import IR.Tree.*; -import IR.Flat.*; -import java.io.*; -import Util.Edge; - -public class OptionalTaskDescriptor { - public TaskDescriptor td; - public HashSet enterflagstates; - public HashSet exitfses; - public Predicate predicate; - private static int nodeid=0; - private int index; - private int uid; - - protected OptionalTaskDescriptor(TaskDescriptor td, int index, HashSet enterflagstates, Predicate predicate) { - this.td = td; - this.enterflagstates = enterflagstates; - this.exitfses = new HashSet(); - this.predicate = predicate; - this.index=index; - } - - public int hashCode() { - return td.hashCode()^enterflagstates.hashCode()^predicate.hashCode()^index; - } - - public boolean equals(Object o) { - if (o instanceof OptionalTaskDescriptor) { - OptionalTaskDescriptor otd=(OptionalTaskDescriptor) o; - if (otd.td==td&& - otd.enterflagstates.equals(enterflagstates)&& - otd.predicate.equals(predicate)&& - otd.index==index) - return true; - } - return false; - } - - public int getIndex() { - return index; - } - - public String tostring() { - return "Optional task "+td.getSymbol(); - } - - public void setuid() { - uid=nodeid++; - } - - public int getuid() { - return uid; - } -} diff --git a/Robust/src/Analysis/TaskStateAnalysis/Predicate.java b/Robust/src/Analysis/TaskStateAnalysis/Predicate.java deleted file mode 100644 index 7fefe6ec..00000000 --- a/Robust/src/Analysis/TaskStateAnalysis/Predicate.java +++ /dev/null @@ -1,33 +0,0 @@ -package Analysis.TaskStateAnalysis; -import java.util.*; -import IR.*; -import IR.Tree.*; -import IR.Flat.*; -import Util.Edge; - -public class Predicate { - public HashSet vardescriptors; - public Hashtable> flags; - public Hashtable tags; - //if there is a tag change, we stop the analysis - - public Predicate(){ - this.vardescriptors = new HashSet(); - this.flags = new Hashtable>(); - this.tags = new Hashtable(); - } - - public boolean equals(Object o) { - if (o instanceof Predicate) { - Predicate p=(Predicate)o; - if (vardescriptors.equals(p.vardescriptors)&& - flags.equals(p.flags)&& - tags.equals(p.tags)) - return true; - } - return false; - } - public int hashCode() { - return vardescriptors.hashCode(); - } -} diff --git a/Robust/src/Analysis/TaskStateAnalysis/SafetyAnalysis.java b/Robust/src/Analysis/TaskStateAnalysis/SafetyAnalysis.java deleted file mode 100644 index 93961377..00000000 --- a/Robust/src/Analysis/TaskStateAnalysis/SafetyAnalysis.java +++ /dev/null @@ -1,569 +0,0 @@ -package Analysis.TaskStateAnalysis; -import java.util.*; -import IR.*; -import IR.Tree.*; -import IR.Flat.*; -import java.io.*; -import java.io.File; -import java.io.FileWriter; -import java.io.FileOutputStream; -import Util.Edge; - -public class SafetyAnalysis { - private Hashtable executiongraph; - private Hashtable>> safeexecution; //to use to build code - private State state; - private TaskAnalysis taskanalysis; - private Hashtable> optionaltaskdescriptors; - private Hashtable>> fstotimap; - - private ClassDescriptor processedclass; - - public Hashtable>> getResult() { - return safeexecution; - } - - public Hashtable> getOptionalTaskDescriptors() { - return optionaltaskdescriptors; - } - - /* Structure that stores a possible optional task which would be - safe to execute and the possible flagstates the object could be - in before executing the task during an execution without - failure*/ - - /*Constructor*/ - public SafetyAnalysis(Hashtable executiongraph, State state, TaskAnalysis taskanalysis) { - this.executiongraph = executiongraph; - this.safeexecution = new Hashtable(); - this.state = state; - this.taskanalysis = taskanalysis; - this.optionaltaskdescriptors = new Hashtable(); - this.fstotimap=new Hashtable>>(); - } - - /* Builds map of fs -> EGTasknodes that can fire on fs for class cd */ - - private Hashtable> buildMap(ClassDescriptor cd) { - Hashtable> table=new Hashtable>(); - for(Iterator it=((Set)executiongraph.get(cd)).iterator();it.hasNext();) { - EGTaskNode node=(EGTaskNode)it.next(); - if (node.getFS()!=null) { - if (!table.containsKey(node.getFS())) - table.put(node.getFS(), new HashSet()); - table.get(node.getFS()).add(node); - } - } - return table; - } - - - public Set getOptions(FlagState fs, TaskDescriptor td, int index) { - return fstotimap.get(fs).get(new TaskIndex(td, index)); - } - - public Set getOptions(FlagState fs, TaskIndex ti) { - return fstotimap.get(fs).get(ti); - } - - public Set getTaskIndex(FlagState fs) { - return fstotimap.get(fs).keySet(); - } - - - /* Builds map of fs -> set of fs that depend on this fs */ - - private Hashtable> buildUseMap(ClassDescriptor cd) { - Hashtable> table=new Hashtable>(); - for(Iterator it=((Set)executiongraph.get(cd)).iterator();it.hasNext();) { - EGTaskNode node=(EGTaskNode)it.next(); - if (node.getFS()!=null) { - if (!table.containsKey(node.getPostFS())) - table.put(node.getPostFS(), new HashSet()); - table.get(node.getPostFS()).add(node.getFS()); - } - } - return table; - } - - public void doAnalysis() { - Enumeration classit=taskanalysis.flagstates.keys(); - - while (classit.hasMoreElements()) { - ClassDescriptor cd=(ClassDescriptor)classit.nextElement(); - if (!executiongraph.containsKey(cd)) - continue; - Hashtable> fstootd=new Hashtable>(); - safeexecution.put(cd, fstootd); - - optionaltaskdescriptors.put(cd, new Hashtable()); - - Hashtable> fstoegmap=buildMap(cd); - Hashtable> fsusemap=buildUseMap(cd); - - HashSet tovisit=new HashSet(); - tovisit.addAll(taskanalysis.getFlagStates(cd)); - - while(!tovisit.isEmpty()) { - FlagState fs=tovisit.iterator().next(); - tovisit.remove(fs); - if (!fstoegmap.containsKey(fs)) - continue;//This FS has no task that can trigger on it - Set nodeset=fstoegmap.get(fs); - analyzeFS(fs, nodeset, fstootd, fsusemap, tovisit); - } - } - printTEST(); - } - - public void analyzeFS(FlagState fs, Set egset, Hashtable> fstootd, Hashtable> fsusemap, HashSet tovisit) { - Hashtable> timap=new Hashtable>(); - Set tiselfloops=new HashSet(); - - for(Iterator egit=egset.iterator();egit.hasNext();) { - EGTaskNode egnode=egit.next(); - Set setotd; - if (egnode.isOptional()) { - setotd=new HashSet(); - HashSet enterfsset=new HashSet(); - enterfsset.add(fs); - ClassDescriptor cd=fs.getClassDescriptor(); - OptionalTaskDescriptor newotd=new OptionalTaskDescriptor(egnode.getTD(), egnode.getIndex(), enterfsset, new Predicate()); - if(optionaltaskdescriptors.get(cd).containsKey(newotd)) { - newotd = optionaltaskdescriptors.get(cd).get(newotd); - } else { - newotd.setuid(); - resultingFS(newotd); - optionaltaskdescriptors.get(cd).put(newotd, newotd); - } - setotd.add(newotd); - } else if (tagChange(egnode)) { - //Conservatively handle tag changes - setotd=new HashSet(); - } else if(egnode.isMultipleParams()) { - if( goodMultiple(egnode)){ - Predicate p=returnPredicate(egnode); - Set oldsetotd; - if (fstootd.containsKey(egnode.getPostFS())) - oldsetotd=fstootd.get(egnode.getPostFS()); - else - oldsetotd=new HashSet(); - setotd=new HashSet(); - for(Iterator otdit=oldsetotd.iterator();otdit.hasNext();) { - OptionalTaskDescriptor oldotd=otdit.next(); - Predicate newp=combinePredicates(oldotd.predicate, p); - OptionalTaskDescriptor newotd=new OptionalTaskDescriptor(oldotd.td, oldotd.getIndex(), oldotd.enterflagstates, newp); - ClassDescriptor cd=fs.getClassDescriptor(); - if(optionaltaskdescriptors.get(cd).containsKey(newotd)) { - newotd = optionaltaskdescriptors.get(cd).get(newotd); - } else { - newotd.setuid(); - resultingFS(newotd); - optionaltaskdescriptors.get(cd).put(newotd, newotd); - } - setotd.add(newotd); - } - } else { - //Can't propagate anything - setotd=new HashSet(); - } - } else { - if (fstootd.containsKey(egnode.getPostFS())) - setotd=fstootd.get(egnode.getPostFS()); - else - setotd=new HashSet(); - } - TaskIndex ti=egnode.isRuntime()?new TaskIndex():new TaskIndex(egnode.getTD(), egnode.getIndex()); - if (!ti.runtime) { - //runtime edges don't do anything...don't have to take - //them, can't predict when we can. - if (state.selfloops.contains(egnode.getTD().getSymbol())) { - System.out.println("Self loop for: "+egnode.getTD()+" "+egnode.getIndex()); - if (timap.containsKey(ti)) { - if (egnode.getPostFS()!=fs) { - if (tiselfloops.contains(ti)) { - //dump old self loop - timap.put(ti, setotd); - tiselfloops.remove(ti); - } else { - //standard and case - timap.put(ti, createIntersection(timap.get(ti), setotd, fs.getClassDescriptor())); - } - } - } else { - //mark as self loop - timap.put(ti, setotd); - if (egnode.getPostFS()==fs) { - tiselfloops.add(ti); - } - } - } else if (timap.containsKey(ti)) { - //AND case - timap.put(ti, createIntersection(timap.get(ti), setotd, fs.getClassDescriptor())); - } else { - timap.put(ti, setotd); - } - } - } - - //Combine all options - HashSet set=new HashSet(); - for(Iterator> it=timap.values().iterator();it.hasNext();) { - Set otdset=it.next(); - set.addAll(otdset); - } - - if (!fstootd.containsKey(fs)|| - !fstootd.get(fs).equals(set)) { - fstootd.put(fs, set); - //Requeue all flagstates that may use our updated results - if (fsusemap.containsKey(fs)) { - tovisit.addAll(fsusemap.get(fs)); - } - } - fstotimap.put(fs, timap); - } - - private HashSet createIntersection(Set A, Set B, ClassDescriptor cd){ - HashSet result = new HashSet(); - for(Iterator b_it = B.iterator(); b_it.hasNext();){ - OptionalTaskDescriptor otd_b = (OptionalTaskDescriptor)b_it.next(); - for(Iterator a_it = A.iterator(); a_it.hasNext();){ - OptionalTaskDescriptor otd_a = (OptionalTaskDescriptor)a_it.next(); - if(otd_a.td==otd_b.td&& - otd_a.getIndex()==otd_b.getIndex()) { - HashSet newfs = new HashSet(); - newfs.addAll(otd_a.enterflagstates); - newfs.addAll(otd_b.enterflagstates); - OptionalTaskDescriptor newotd = new OptionalTaskDescriptor(otd_b.td, otd_b.getIndex(), newfs, combinePredicates(otd_a.predicate, otd_b.predicate)); - if(optionaltaskdescriptors.get(cd).get(newotd)!=null){ - newotd = optionaltaskdescriptors.get(cd).get(newotd); - } else { - newotd.setuid(); - resultingFS(newotd); - optionaltaskdescriptors.get(cd).put(newotd, newotd); - } - result.add(newotd); - } - } - } - return result; - } - - // This method returns true if the only parameter whose flag is - // modified is the tracked one - - private boolean goodMultiple(EGTaskNode tn){ - TaskDescriptor td = tn.getTD(); - FlatMethod fm = state.getMethodFlat(td); - TempDescriptor tmp=fm.getParameter(tn.getIndex()); - - Set nodeset=fm.getNodeSet(); - - for(Iterator nodeit=nodeset.iterator();nodeit.hasNext();) { - FlatNode fn=nodeit.next(); - if (fn.kind()==FKind.FlatFlagActionNode) { - FlatFlagActionNode ffan=(FlatFlagActionNode)fn; - if (ffan.getTaskType() == FlatFlagActionNode.TASKEXIT) { - for(Iterator it_tfp=ffan.getTempFlagPairs();it_tfp.hasNext();) { - TempFlagPair tfp=(TempFlagPair)it_tfp.next(); - TempDescriptor tempd = tfp.getTemp(); - if(tempd!=tmp) - return false; //return false if a taskexit modifies one of the other parameters - } - } - } - } - return true; - } - - private Predicate returnPredicate(EGTaskNode tn){ - Predicate result = new Predicate(); - TaskDescriptor td = tn.getTD(); - for(int i=0; i flaglist = new HashSet(); - flaglist.add(td.getFlag(vd)); - result.flags.put(vd, flaglist); - if (td.getTag(vd)!=null) - result.tags.put(vd, td.getTag(vd)); - } - } - return result; - } - - private Predicate combinePredicates(Predicate A, Predicate B){ - Predicate result = new Predicate(); - result.vardescriptors.addAll(A.vardescriptors); - result.flags.putAll(A.flags); - result.tags.putAll(A.tags); - Collection c = B.vardescriptors; - for(Iterator varit = c.iterator(); varit.hasNext();){//maybe change that - VarDescriptor vd = (VarDescriptor)varit.next(); - if(result.vardescriptors.contains(vd)) - System.out.println("Already in "); - else { - result.vardescriptors.add(vd); - } - } - Collection vardesc = result.vardescriptors; - for(Iterator varit = vardesc.iterator(); varit.hasNext();){ - VarDescriptor vd = (VarDescriptor)varit.next(); - HashSet bflags = B.flags.get(vd); - if( bflags == null ){ - continue; - } else { - if (result.flags.containsKey(vd)) - ((HashSet)result.flags.get(vd)).addAll(bflags); - else - result.flags.put(vd, bflags); - } - TagExpressionList btags = B.tags.get(vd); - if( btags != null ){ - if (result.tags.containsKey(vd)) - System.out.println("Tag found but there should be nothing to do because same tag"); - else - result.tags.put(vd, btags); - } - } - return result; - } - - //////////////////// - /* returns a set of the possible sets of flagstates - resulting from the execution of the optional task. - To do it with have to look for TaskExit FlatNodes - in the IR. - */ - private void resultingFS(OptionalTaskDescriptor otd){ - Stack stack = new Stack(); - HashSet result = new HashSet(); - FlatMethod fm = state.getMethodFlat((TaskDescriptor)otd.td); - FlatNode fn = (FlatNode)fm; - - Stack nodestack=new Stack(); - HashSet discovered=new HashSet(); - nodestack.push(fm); - discovered.add(fm); - TempDescriptor temp=fm.getParameter(otd.getIndex()); - - //Iterating through the nodes - while(!nodestack.isEmpty()) { - FlatNode fn1 = (FlatNode) nodestack.pop(); - if (fn1.kind()==FKind.FlatFlagActionNode) { - FlatFlagActionNode ffan=(FlatFlagActionNode)fn1; - if (ffan.getTaskType() == FlatFlagActionNode.TASKEXIT) { - HashSet tempset = new HashSet(); - for(Iterator it_fs = otd.enterflagstates.iterator(); it_fs.hasNext();){ - FlagState fstemp = (FlagState)it_fs.next(); - Vector processed=new Vector(); - - for(Iterator it_tfp=ffan.getTempFlagPairs();it_tfp.hasNext();) { - TempFlagPair tfp=(TempFlagPair)it_tfp.next(); - if (tfp.getTemp()==temp) - fstemp=fstemp.setFlag(tfp.getFlag(),ffan.getFlagChange(tfp)); - } - - processed.add(fstemp); - //Process clears first - - for(Iterator it_ttp=ffan.getTempTagPairs();it_ttp.hasNext();) { - TempTagPair ttp=(TempTagPair)it_ttp.next(); - - if (temp==ttp.getTemp()) { - Vector oldprocess=processed; - processed=new Vector(); - - for (Enumeration en=oldprocess.elements();en.hasMoreElements();){ - FlagState fsworking=(FlagState)en.nextElement(); - if (!ffan.getTagChange(ttp)){ - processed.addAll(Arrays.asList(fsworking.clearTag(ttp.getTag()))); - } else processed.add(fsworking); - } - } - } - //Process sets next - for(Iterator it_ttp=ffan.getTempTagPairs();it_ttp.hasNext();) { - TempTagPair ttp=(TempTagPair)it_ttp.next(); - - if (temp==ttp.getTemp()) { - Vector oldprocess=processed; - processed=new Vector(); - - for (Enumeration en=oldprocess.elements();en.hasMoreElements();){ - FlagState fsworking=(FlagState)en.nextElement(); - if (ffan.getTagChange(ttp)){ - processed.addAll(Arrays.asList(fsworking.setTag(ttp.getTag()))); - } else processed.add(fsworking); - } - } - } - //Add to exit states - tempset.addAll(processed); - } - result.add(tempset); - continue; // avoid queueing the return node if reachable - } - } else if (fn1.kind()==FKind.FlatReturnNode) { - result.add(otd.enterflagstates); - } - - /* Queue other nodes past this one */ - for(int i=0;i "+tn2.getLabel()+";"); - } - } - } -} diff --git a/Robust/src/Analysis/TaskStateAnalysis/TEdge.java b/Robust/src/Analysis/TaskStateAnalysis/TEdge.java deleted file mode 100644 index bd54738b..00000000 --- a/Robust/src/Analysis/TaskStateAnalysis/TEdge.java +++ /dev/null @@ -1,30 +0,0 @@ -package Analysis.TaskStateAnalysis; -import IR.*; -import Analysis.TaskStateAnalysis.*; -import IR.Tree.*; -import IR.Flat.*; -import java.util.*; -import Util.Edge; - - -public class TEdge extends Edge{ - - public TEdge(TaskNode target){ - super(target); - } - - public int hashCode(){ - return target.hashCode(); - } - - - public boolean equals(Object o) { - if (o instanceof TEdge) { - TEdge e=(TEdge)o; - return e.target.equals(target); - } - return false; - } - - -} diff --git a/Robust/src/Analysis/TaskStateAnalysis/TagAnalysis.java b/Robust/src/Analysis/TaskStateAnalysis/TagAnalysis.java deleted file mode 100644 index e1f0613b..00000000 --- a/Robust/src/Analysis/TaskStateAnalysis/TagAnalysis.java +++ /dev/null @@ -1,229 +0,0 @@ -package Analysis.TaskStateAnalysis; - -import java.util.Hashtable; -import java.util.Stack; -import java.util.Set; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Arrays; -import java.util.Vector; - -import Util.Edge; -import Analysis.CallGraph.CallGraph; -import IR.SymbolTable; -import IR.State; -import IR.TagDescriptor; -import IR.TaskDescriptor; -import IR.MethodDescriptor; -import IR.Flat.*; - -public class TagAnalysis { - State state; - Hashtable flagmap; - Stack tovisit; - Hashtable discovered; - Hashtable tasktotagbindings; - Hashtable tasktoflagstates; - CallGraph callgraph; - - public TagAnalysis(State state, CallGraph callgraph) { - this.state=state; - this.flagmap=new Hashtable(); - this.discovered=new Hashtable(); - this.tovisit=new Stack(); - this.tasktoflagstates=new Hashtable(); - this.tasktotagbindings=new Hashtable(); - this.callgraph=callgraph; - doAnalysis(); - } - - public Set getFlagStates(TaskDescriptor task) { - return (Set)tasktoflagstates.get(task); - } - - private void doAnalysis() { - Set rootset=computeRootSet(); - computeTagBindings(rootset); - TagBinding.SCC scc=TagBinding.DFS.computeSCC(discovered.keySet()); - for(int i=0;i targetFStates = ffan.getTargetFStates4NewObj(ffantemp.getType().getClassDesc()); - FlagState fs=new FlagState(ffantemp.getType().getClassDesc()); - for(Iterator it=ffan.getTempFlagPairs();it.hasNext();) { - TempFlagPair tfp=(TempFlagPair)it.next(); - if (ffan.getFlagChange(tfp)) - fs=fs.setFlag(tfp.getFlag(), true); - else - fs=fs.setFlag(tfp.getFlag(), false); - } - - HashSet fsset=new HashSet(); - fsset.add(fs); - - for(Iterator it=ffan.getTempTagPairs();it.hasNext();) { - HashSet oldfsset=fsset; - fsset=new HashSet(); - - TempTagPair ttp=(TempTagPair)it.next(); - if (ffan.getTagChange(ttp)) { - TagDescriptor tag=ttp.getTag(); - if (tag==null&¶mmap!=null&¶mmap.containsKey(ttp.getTagTemp())) { - tag=(TagDescriptor)parammap.get(ttp.getTagTemp()); - } - for(Iterator setit=oldfsset.iterator();setit.hasNext();) { - FlagState fs2=(FlagState)setit.next(); - fsset.addAll(Arrays.asList(fs2.setTag(tag))); - } - } else - throw new Error("Don't clear tag in new object allocation"); - } - - for(Iterator setit=fsset.iterator();setit.hasNext();) { - FlagState fs2=(FlagState)setit.next(); - if (!flagmap.containsKey(fs2)) - flagmap.put(fs2,fs2); - else - fs2=(FlagState) flagmap.get(fs2); - newflags.add(fs2); - if(!targetFStates.contains(fs2)) { - targetFStates.addElement(fs2); - } - } - } - } - } -} - - private void computeTagBindings(Set roots) { - tovisit.addAll(roots); - - for(Iterator it=roots.iterator();it.hasNext();) { - TagBinding tb=(TagBinding)it.next(); - discovered.put(tb,tb); - } - - while(!tovisit.empty()) { - TagBinding tb=(TagBinding) tovisit.pop(); - MethodDescriptor md=tb.getMethod(); - FlatMethod fm=state.getMethodFlat(md); - /* Build map from temps -> tagdescriptors */ - Hashtable parammap=new Hashtable(); - int offset=md.isStatic()?0:1; - - - for(int i=0;i=0) { - TagDescriptor tag=tb.getBinding(offsetindex); - - if (tag!=null) { - parammap.put(temp,tag); - } - } - } - - HashSet newtags=new HashSet(); - - computeCallsFlags(fm, parammap, newtags, tb.getAllocations()); - - for(Iterator tagit=newtags.iterator();tagit.hasNext();) { - TagBinding newtag=(TagBinding)tagit.next(); - Edge e=new Edge(newtag); - tb.addEdge(e); - } - } - } -} diff --git a/Robust/src/Analysis/TaskStateAnalysis/TagBinding.java b/Robust/src/Analysis/TaskStateAnalysis/TagBinding.java deleted file mode 100644 index e7360b96..00000000 --- a/Robust/src/Analysis/TaskStateAnalysis/TagBinding.java +++ /dev/null @@ -1,66 +0,0 @@ -package Analysis.TaskStateAnalysis; -import IR.MethodDescriptor; -import IR.TagDescriptor; -import Util.GraphNode; -import java.util.HashSet; -import java.util.Set; - -public class TagBinding extends GraphNode { - private MethodDescriptor md; - private TagDescriptor[] tdarray; - private HashSet allocations; - - public TagBinding(MethodDescriptor md) { - this.md=md; - tdarray=new TagDescriptor[md.numParameters()]; - allocations=new HashSet(); - } - - public String toString() { - String st=md.toString(); - for(int i=0;i flags; - public static final int KLIMIT=2; - public HashSet sourceset; - - public TagState(ClassDescriptor cd) { - this.flags=new Hashtable(); - this.sourceset=new HashSet(); - this.cd=cd; - } - - public void addSource(TaskDescriptor td) { - sourceset.add(td); - } - - public TagState(TagDescriptor tag) { - this.tag=tag; - this.flags=new Hashtable(); - this.sourceset=new HashSet(); - } - - public TagDescriptor getTag() { - return tag; - } - - public ClassDescriptor getClassDesc() { - return cd; - } - - public TagState[] clearFS(FlagState fs) { - int num=0; - if (flags.containsKey(fs)) - num=flags.get(fs).intValue(); - if (num>0) - num--; - - TagState ts=new TagState(tag); - ts.flags.putAll(flags); - ts.flags.put(fs, new Integer(num)); - - if ((num+1)==KLIMIT) - return new TagState[] {ts, this}; - else - return new TagState[] {ts}; - } - - public TagState[] addnewFS(FlagState fs) { - int num=0; - if (flags.containsKey(fs)) - num=flags.get(fs).intValue(); - if (num getFS() { - return flags.keySet(); - } - - public int hashCode() { - int hashcode=flags.hashCode(); - if (tag!=null) - hashcode^=tag.hashCode(); - return hashcode; - } - - public boolean equals(Object o) { - if (o instanceof TagState) { - TagState t=(TagState)o; - if ((tag==null&&t.tag==null)|| - (tag!=null&&t.tag!=null&&tag.equals(t.tag))) { - return flags.equals(t.flags); - } - } - return false; - } -} diff --git a/Robust/src/Analysis/TaskStateAnalysis/TagWrapper.java b/Robust/src/Analysis/TaskStateAnalysis/TagWrapper.java deleted file mode 100644 index 2a6b96f8..00000000 --- a/Robust/src/Analysis/TaskStateAnalysis/TagWrapper.java +++ /dev/null @@ -1,31 +0,0 @@ -package Analysis.TaskStateAnalysis; -import IR.*; -import IR.Tree.*; -import IR.Flat.*; -import java.util.*; - -public class TagWrapper implements Wrapper { - TagState initts; - HashSet ts; - - public TagWrapper(TagState ts) { - this.initts=ts; - this.ts=new HashSet(); - this.ts.add(ts); - } - - private TagWrapper() { - } - - public TagState getState() { - assert(ts.size()==1); - return ts.iterator().next(); - } - - public TagWrapper clone() { - TagWrapper tw=new TagWrapper(); - tw.initts=initts; - tw.ts=(HashSet)ts.clone(); - return tw; - } -} diff --git a/Robust/src/Analysis/TaskStateAnalysis/Task Analysis.pdf b/Robust/src/Analysis/TaskStateAnalysis/Task Analysis.pdf deleted file mode 100644 index 2c1ba9934f63e23981f21027d380536db007b4a6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12095 zcmeG?cU%)$x1cT}5EMZXK^YMglrWQ?V2BF=1SQgoB1*~tfi#mKK@k-jiUq`qtVpq< zAfJjI8Cq_=0!ew%I3^SJ5=v06TsR*UKm^zeA`lS<1@?yMG}sLyQ)mQuI)Dd2 z1cXGU!yZs5L?KWi0+kWQV&PDU0HXr+y>NOeIU1qvi9o>VAsrWJsxCp2E*PCc{uV|c z5NUm2BywLoI+@-FkHP5EmW&V?-{O&pG-4kZnbD^Ygo-H(yL#}9sh|s{lyik5RF2aF z%Jc_%gcwxVM~=?JR7Rq~A%19tzfueVI5cR5w?eyBpn^Ok^<$G&Y?`ClDwEva_2jnMQYUW4I96Zf-O-8xTiW zm__syO0Ha~(LI9Gv$1jWcE{;K5KfQL)8?ooQW*u&7%&^6Ghlb2NQuf}cM(^Kx}tok z0EImv0s$KiG!pC&k?1UzLMcbNVqn&4UU+zTWO(@FD_R3i+ZgO!JScg_2>Qs>OZT(4 zE;+wtN$4T*+Nqne*RSsHbt1$(VEeEkBqE|a(mCqxkmK4S1B2+5P>w;ZRzCx+8+p26 zI6W|iI%s!{Cd>w1gHyvOk@!6xgF^`rxWj-d1*j^N2GQtYu!eshu3W4D_Fzjzv0{k= zB4HL02>D8>9E@-lOJgWtk$`v^sy0zC33)t0I1tm~QXY4)R)4K@JFVB>VN`9%j#AM7JU`DjO54I-GW z7#*%c$&m_#5kgd8>*`2E5E?=z&=Cd+p^)uZ;DUX)k*ET~^aaR(vKKdA8mol8C8$Pl z*dKJsR|d#YR6X>-%mA2bnc08=ku(zYB8jy9@>R=CYq}O*D^Sbd?!W1{qaz+FQb1q^ zL4Muq03D;>p%AuQDsz#lLJ5{O`|5yL=JIVw?hFs$KC1HzQVmP(YMRsk`vHhy5T zD8YEdvNiOC4qsmYiC>9Pt zRmw2fO{JXTkI@IsruZWegQUR)*lP7)+Uy}1MzljP|5%<98#DpHm}*q4b5~TsmkVXs z@L~|u3}Dt{M{&V$BU9mEp+Fg>2qjW5$$H)-5(&b77!0e$%AHsgu;l!^pBkS=hlt?U zO^-$-LR2bE{Zp3-1c*Yx)))^aMYT+#oADfRT|V9HCgJ`xyI!gp54?lsM0RbDVh@sK*?Oha&;N38vdIXQXO>1N}L zCrxj#UaL~fU+fmbW2f6Y2R5C3>!8&S!a4rkXtI1xl7*_Q^4SZ=NNY<@w#gPc z_j~`Qrafh_pt=5@_}Auy<_Tr}hHiM3IK0()$N`Vyu_<3(tXgK2Ftl#+_QeO1j-K`O zY(`Es5wD$1|FC-V`h=23y)PNpzg}lmI7pG=-%Xp_`WaY+UtMhPGI`d9SG?zG@y++r zrBGHmk-*c7HfeZN2@Q&0ll$KcjPeSsz?#o8J2! z!SlF(t{dE6O5Q|~#>z3tOdcV$`U;4{3@=8<7 z#FU)mGOHUNbG@UQbO+7Uv3YZiUmZ^C<)l2bW91HJ zX>qPNZrQzz8*z(@!XiIftZ;PRoBHA2!WE+i;M2~UOj((3ESp(65kYSaJ5oAX`E*zs zc}a`$`U@AGtjA}@=H+Ki8FqVHMC|Ldwq=<#T)x~R&?BLUkTO@x*Wr5G{wcmYEZ%ch zEwX%I)Y^Qdysc^ccvXz4YDv}s(L3IF)ppCJ|=i0wTBgB2R}UbCHt9C(c%|-*xJUAmJIJF&x=X< zJbFf@T;C#hP^*7Z|63ed{nUVGliJO63RW0ePn5)&#S_WPMk2_(=6Qbrt&fz^b#4BHGCjW z$1=s{+=hbXU;F1AKpD2-JH}oPewb)-we8ZC+Cq+H&W=so9J$BKy|*?s|%xdTZtyUTSkXEh=DRYyQ=G<0}0c*4P72uWbJP(fs!0w2GL^ z69d{SmT?TsO2_z3_G*MSLTlT`a=+%}C1Xu!0??lvP|XClRio=9)r4UC=gan+m1HW#m=X*g@C>4bHGc~z8`sZoYEgGDoS zZS9j%IYI^ATwA(L(0Vd3e*fQ7UN|HjH|3i!pWz%X?<#M-P@ZwM$b49g*Y;UQ2n#n^ zeeGABX?XHrge;Hg68vPPL8bA_0(bw``$$3g;pb^7?78a)GZTzf&OEY>!Wtbm?6Udg zrMcSsP}~Xpfip!_1Ie+!ZyHx1-9ITv*DyoJf%e{&@GDL@G0n(n(uzj;%-PKS0{t^9 z~anaIeo$Ut!T9q z8y2j)INH_Mn@}$LGdR#ZK52BI)3E^qcgtq&MV{w{te`wrphkFS-Y{n_I?tSuRR&)-|r% zL%n&b|G{QC)4p)Ph4qAUoZ(B$F8i0dB8rz`HN|Uav77WQqMsZa;4xfVXYbR57xi~- zxua(UhYoJ{(z3ueL>Im-&M`eVX=Ykk0zCZuoq0!8<5Io8u6It}T~mHohbtU;!eYW_ zG2A47X9(q+P^vQQ5(1{Ch9%i7WdAw7dZxnJ@KMT$L02Nz^rMPS*Wp{>+-(t8ADCB! zX1iD1K7TZ5R0HuHsqz^jwoO_(a<{9j`d=J}+U3IR*R(5T!DF6=WUbp|mcliTOD1jq zbeyQYs$ZJV_QP|wSC;vTjwj|9A3eRM?&yGik9`ZQ4f0Oqx?Qq|E)wv($@MeFBm~TF z(a|~d=g~ucA$7qsZqCnv!cT9AUf>uaS(O}UBuH%uDK}VC9Ar?_7>xIx^`>gaG3yy+ zpYl%3*oy?&{qf6Z58FpRw^A=Gnt9jwCg%)&>+yy)RSREO&tbm)wBzinH3tv5-3`UJ z&MBEaVc%Or@j{oOiys#iFF(t_Xz=D*tIZep$fJ%)rmQ*#Khuln_Xp=PPLPIA*ob~^ zEfUrbUpV~W=ro7eiFJv!7ecm(f`g&g6%7K5&$76JM>Vmn<}J1>Goqi!;u2Aumz6Sw zl3ALv5qdDqjrdZ3L6qZmvn>x^P1e@YV&j5OekaUOJCvPHh!PbCL39uf0Z(T-R}9?H zzTOU~0=_k>q{a?Lg^^Lf_eKyb&;wx!i41}z1s`+B@k9bujpTy4*?0<- z4&g}%4FWL-0>W5?76viC{Oq|(0Q7J`fpjjl0=H!m9G zCc6DZRrQfA9B*^aAuC$;G|p{F^;#6S-o(wy+GF#mB;?j;A48pS2abk^UOc4tHLY00?zd3u83#Wz*%3V%zwjG;!F?|?oW_IS@ zqejIuMhs?dPt)cHFbvn_x~X2b7I>gO zxUG8Z4?~e(hA(v<%Fm8j_NQU`z~DbpO*m^)4%NkP)YZGBN^W_=rnoKloICqBe09W~ zup^wMyoZbCR)4DBU7qf9r|n}w+sXSrV>Xmss@%Qrd04yZw@(%K8VVdsLYYi!OE;F~ zgUh<3J1hdR$oj zBqc>UrPb;3ThD)ah})!x6JKr5zPP8Uu>QmQv-QfF$MBo|hwIDgBaXfqdHP(IvF)J+ zA4^UOt7~5FoUS`*-}LHB3)7JW*?iT!I%TEqk!zkCA1oU_AGTH9E5CK4K)5^s_79&D zR~DLAg|9C7sPp#@+gE2FqQ_>{B!<``#hDd*An6+q4g^Z=bMTZ`B>6 z5A`pny$vcobTD~I;YZw@&*mi&*W)JG&&sS|9nRlkxNbzT!QTT2zj#2&c5EwWk+z?) z>y|OA1#tzx`g)2eNnrsag@2oa4{MWKEtCqri zvZqCWcCP1B#E+C=ZMf@NrS;qq`$lqxw)4o=MV4tH>7^wBv<&O!u|s1v+}~2~o?gn@ zNLXRryz3X#gE!f#$TM(OhKxP*p^;crA~Eo7*uLlVgX`mt+c%nXYiji$&2t~u#yY>< z>+!hvE;lAp3Xh!jds)AE%`5JimxrIEwtcEQ_}9(U2XL1C>GqAE=*Z*nsfiZy0DfYo z*GBL+#n$tR!;bai9p;@pH%g-UDjCYR}+#h!B zUX6RCF4@vpu(N{HIhHI^C+gs7LV+Swoh0+?L90hzwllXB!tv@{!$}M(Lqnr8ZP>k9 zGbgJ+mN5oZLOe85C~>lSd+MweBosJV1yeW(N5)2@gdX$dsQ>)w0sQ$fe1^bkGE0xC za#V?BVvvM{RAP}t;iz)5;(|Or>Iljh7`B4cD9RWoD`%_%3gP%bY^fZD$PNgePXgI* zGTDJhAu)&qd&oal0(tY55JJGVQSfbm=13qrk{DJjkavcdazTWnpR0REU*OHjDoUx8 zIl^#UT%1E3$w4ZQgb54=14f82k%$KvctyNK$yMPcim@6Zopd_)R-se^VRX4XknVJ{ zvcfv*x->$`dUPaFIH(15;7i3YsDKF$B)E$*XvhRWN022H#PU%&%b72i^0-RKRj5!3 zMIf~g(H+313)zBhDX06sc^9}7!x;}J5R zKo39|jwHm9g5VLFBZ4sDZ!o*f&Frd?$^)cQQJ3vNrkBHw(U=a30BPA^sa(*5PzU-q zl+@~r|2N!_dvenQ^IIAn+5I1)(i8Xpz!)6Pe>R6$+{Ypuj-#uTA1el7fu}1gHdZKb z6rePM0OgYKG&-M;Co@PSJTHQe;86+#z!_XVnaoqGws+g!dI5Ew67X?K0={*0(53Pa z5=x*F@DVf~4^O6(_;@;ri{K-8L<$3?kZA%ErIT)twteU-VtLUhU)ed`Gz)=x()puv zdqX>Cqe#eNXyz*@brZy@)w8&F!%il?>F6Ju@B)69nPjnYk$OcG@L^PhVrEc)nM3Gp zCjs9PjA=1f$>PdnAb{d3!HS42N=&%Bs#`230P?YkCY669EVeTBmbHiWfNH!WB7}VO zf1;`Hc7-vZ6e>mNce-~LePg+98)18fqX>MUaBYtO4XA;FEemXwaMxbhn{$np{`voIoBi{&yD0wbq)Qb)QuwK^AJI}5 z&QEo9sp3ZpKh^akTI$02sjeF?wYu+tVD z`B-&q0~|9f68QE24;I>tN09M$uyd?3N-DS2cv>LCtnt%qJA=^g1~PWokrs8Z+J*OR zusW+VTAgKQ2ZLzkdrV*vjfRQd(PIy0HPNFT_{;#jH{0H>7dV5|nT75+a0bySUFZ6+ zPX|;Ag+zhCF+lZUIRraS*nMtJ1EVkihPv2&zK#NN9(`fh5gqL6#-jp?-@w4f3haAH zZ#?zeH@y6Wsg=~nMnCoPQ!g3~^qs#y$HvdG@&99N^f|Llr-03@=izArf!cL^`o91H Cq#ri` diff --git a/Robust/src/Analysis/TaskStateAnalysis/TaskAnalysis.java b/Robust/src/Analysis/TaskStateAnalysis/TaskAnalysis.java deleted file mode 100644 index bba02a6e..00000000 --- a/Robust/src/Analysis/TaskStateAnalysis/TaskAnalysis.java +++ /dev/null @@ -1,444 +0,0 @@ -package Analysis.TaskStateAnalysis; -import IR.*; -import IR.Tree.*; -import IR.Flat.*; -import java.util.*; -import java.io.File; -import java.io.FileWriter; -import java.io.FileOutputStream; - -public class TaskAnalysis { - State state; - Hashtable flagstates; - Hashtable flags; - Hashtable extern_flags; - Queue toprocess; - TagAnalysis taganalysis; - Hashtable cdtorootnodes; - Hashtable tdToFEdges; - - TypeUtil typeutil; - - /** - * Class Constructor - * - * @param state a flattened State object - * @see State - */ - public TaskAnalysis(State state, TagAnalysis taganalysis) { - this.state=state; - this.typeutil=new TypeUtil(state); - this.taganalysis=taganalysis; - } - - /** Builds a table of flags for each class in the Bristlecone - * program. It creates two hashtables: one which holds the - * ClassDescriptors and arrays of * FlagDescriptors as key-value - * pairs; the other holds the ClassDescriptor and the * number of - * external flags for that specific class. - */ - - private void getFlagsfromClasses() { - flags=new Hashtable(); - extern_flags = new Hashtable(); - - /** Iterate through the classes used in the program to build - * the table of flags - */ - for(Iterator it_classes=state.getClassSymbolTable().getDescriptorsIterator();it_classes.hasNext();) { - - ClassDescriptor cd = (ClassDescriptor)it_classes.next(); - Vector vFlags=new Vector(); - FlagDescriptor flag[]; - int ctr=0; - - - /* Adding the flags of the super class */ - ClassDescriptor tmp=cd; - while(tmp!=null) { - for(Iterator it_cflags=tmp.getFlags();it_cflags.hasNext();) { - FlagDescriptor fd = (FlagDescriptor)it_cflags.next(); - vFlags.add(fd); - } - tmp=tmp.getSuperDesc(); - } - - - if (vFlags.size()!=0) { - flag=new FlagDescriptor[vFlags.size()]; - - for(int i=0;i < vFlags.size() ; i++) { - if (((FlagDescriptor)vFlags.get(i)).getExternal()) { - flag[ctr]=(FlagDescriptor)vFlags.get(i); - vFlags.remove(flag[ctr]); - ctr++; - } - } - for(int i=0;i < vFlags.size() ; i++) { - flag[i+ctr]=(FlagDescriptor)vFlags.get(i); - } - extern_flags.put(cd,new Integer(ctr)); - flags.put(cd,flag); - - } - } - } - /** Method which starts up the analysis - */ - - public void taskAnalysis() throws java.io.IOException { - flagstates=new Hashtable(); - Hashtable sourcenodes; - cdtorootnodes=new Hashtable(); - tdToFEdges=new Hashtable(); - - getFlagsfromClasses(); - - int externs; - toprocess=new LinkedList(); - - for(Iterator it_classes=(Iterator)flags.keys();it_classes.hasNext();) { - ClassDescriptor cd=(ClassDescriptor)it_classes.next(); - externs=((Integer)extern_flags.get(cd)).intValue(); - FlagDescriptor[] fd=(FlagDescriptor[])flags.get(cd); - flagstates.put(cd,new Hashtable()); - cdtorootnodes.put(cd,new Vector()); - } - - - ClassDescriptor startupobject=typeutil.getClass(TypeUtil.StartupClass); - - sourcenodes=(Hashtable)flagstates.get(startupobject); - FlagState fsstartup=new FlagState(startupobject); - - - FlagDescriptor[] fd=(FlagDescriptor[])flags.get(startupobject); - - fsstartup=fsstartup.setFlag(fd[0],true); - fsstartup.setAsSourceNode(); - ((Vector)cdtorootnodes.get(startupobject)).add(fsstartup); - - sourcenodes.put(fsstartup,fsstartup); - toprocess.add(fsstartup); - - /** Looping through the flagstates in the toprocess queue to - * perform the state analysis */ - while (!toprocess.isEmpty()) { - FlagState trigger=toprocess.poll(); - createPossibleRuntimeStates(trigger); - - analyseTasks(trigger); - } - - /** Creating DOT files */ - Enumeration e=flagstates.keys(); - - while (e.hasMoreElements()) { - ClassDescriptor cdtemp=(ClassDescriptor)e.nextElement(); - createDOTfile(cdtemp); - } - } - - - /** Analyses the set of tasks based on the given flagstate, checking - * to see which tasks are triggered and what new flagstates are created - * from the base flagstate. - * @param fs A FlagState object which is used to analyse the task - * @see FlagState - */ - -private void analyseTasks(FlagState fs) { - ClassDescriptor cd=fs.getClassDescriptor(); - Hashtable sourcenodes=(Hashtable)flagstates.get(cd); - - for(Iterator it_tasks=state.getTaskSymbolTable().getDescriptorsIterator();it_tasks.hasNext();) { - TaskDescriptor td = (TaskDescriptor)it_tasks.next(); - String taskname=td.getSymbol(); - - if(!tdToFEdges.containsKey(td)) { - tdToFEdges.put(td, new Vector()); - } - - /** counter to keep track of the number of parameters (of the - * task being analyzed) that are satisfied by the flagstate. - */ - int trigger_ctr=0; - TempDescriptor temp=null; - FlatMethod fm = state.getMethodFlat(td); - int parameterindex=0; - - for(int i=0; i < td.numParameters(); i++) { - FlagExpressionNode fen=td.getFlag(td.getParameter(i)); - TagExpressionList tel=td.getTag(td.getParameter(i)); - - /** Checking to see if the parameter is of the same - * type/class as the flagstate's and also if the - * flagstate fs triggers the given task*/ - - if (typeutil.isSuperorType(td.getParamType(i).getClassDesc(),cd) - && isTaskTrigger_flag(fen,fs) - && isTaskTrigger_tag(tel,fs)) { - temp=fm.getParameter(i); - parameterindex=i; - trigger_ctr++; - } - } - - if (trigger_ctr==0) //Look at next task - continue; - - if (trigger_ctr>1) - System.out.println("Illegal Operation: A single flagstate cannot satisfy more than one parameter of a task:"+fs + " in "+td); - - - Set newstates=taganalysis.getFlagStates(td); - for(Iterator fsit=newstates.iterator();fsit.hasNext();) { - FlagState fsnew=(FlagState) fsit.next(); - System.out.println("SOURCE:"+fsnew); - - if (! ((Hashtable)flagstates.get(fsnew.getClassDescriptor())).containsKey(fsnew)) { - ((Hashtable)flagstates.get(fsnew.getClassDescriptor())).put(fsnew, fsnew); - toprocess.add(fsnew); - } else { - fsnew=((Hashtable)flagstates.get(fsnew.getClassDescriptor())).get(fsnew); - } - fsnew.setAsSourceNode(); - fsnew.addAllocatingTask(td); - - if(!((Vector)cdtorootnodes.get(fsnew.getClassDescriptor())).contains(fsnew)) { - ((Vector)cdtorootnodes.get(fsnew.getClassDescriptor())).add(fsnew); - } - } - - Stack nodestack=new Stack(); - HashSet discovered=new HashSet(); - nodestack.push(fm); - discovered.add(fm); - //Iterating through the nodes - - while(!nodestack.isEmpty()) { - FlatNode fn1 = (FlatNode) nodestack.pop(); - - if (fn1.kind()==FKind.FlatReturnNode) { - /* Self edge */ - FEdge newedge=new FEdge(fs, taskname, td, parameterindex); - ((Vector)tdToFEdges.get(td)).add(newedge); - fs.addEdge(newedge); - continue; - } else if (fn1.kind()==FKind.FlatFlagActionNode) { - FlatFlagActionNode ffan=(FlatFlagActionNode)fn1; - if (ffan.getTaskType() == FlatFlagActionNode.PRE) { - if (ffan.getTempFlagPairs().hasNext()||ffan.getTempTagPairs().hasNext()) - throw new Error("PRE FlagActions not supported"); - - } else if (ffan.getTaskType() == FlatFlagActionNode.TASKEXIT) { - Vector fsv_taskexit=evalTaskExitNode(ffan,cd,fs,temp); - Vector initFStates = ffan.getInitFStates(temp.getType().getClassDesc()); - if(!initFStates.contains(fs)) { - initFStates.addElement(fs); - } - Vector targetFStates = ffan.getTargetFStates(fs); - for(Enumeration en=fsv_taskexit.elements();en.hasMoreElements();){ - FlagState fs_taskexit=(FlagState)en.nextElement(); - if (!sourcenodes.containsKey(fs_taskexit)) { - toprocess.add(fs_taskexit); - } - //seen this node already - fs_taskexit=canonicalizeFlagState(sourcenodes,fs_taskexit); - FEdge newedge=new FEdge(fs_taskexit,taskname, td, parameterindex); - ((Vector)tdToFEdges.get(td)).add(newedge); - fs.addEdge(newedge); - - if(!targetFStates.contains(fs_taskexit)) { - targetFStates.addElement(fs_taskexit); - } - } - continue; - } - } - /* Queue other nodes past this one */ - for(int i=0;itrue if fs satisfies the boolean expression - denoted by fen else false. - */ - - -public static boolean isTaskTrigger_flag(FlagExpressionNode fen,FlagState fs) { - if (fen==null) - return true; - else if (fen instanceof FlagNode) - return fs.get(((FlagNode)fen).getFlag()); - else - switch (((FlagOpNode)fen).getOp().getOp()) { - case Operation.LOGIC_AND: - return ((isTaskTrigger_flag(((FlagOpNode)fen).getLeft(),fs)) && (isTaskTrigger_flag(((FlagOpNode)fen).getRight(),fs))); - case Operation.LOGIC_OR: - return ((isTaskTrigger_flag(((FlagOpNode)fen).getLeft(),fs)) || (isTaskTrigger_flag(((FlagOpNode)fen).getRight(),fs))); - case Operation.LOGIC_NOT: - return !(isTaskTrigger_flag(((FlagOpNode)fen).getLeft(),fs)); - default: - return false; - } -} - -private boolean isTaskTrigger_tag(TagExpressionList tel, FlagState fs){ - - if (tel!=null){ - for (int i=0;i evalTaskExitNode(FlatFlagActionNode ffan,ClassDescriptor cd,FlagState fs, TempDescriptor temp){ - FlagState fstemp=fs; - Vector processed=new Vector(); - - //Process the flag changes - - for(Iterator it_tfp=ffan.getTempFlagPairs();it_tfp.hasNext();) { - TempFlagPair tfp=(TempFlagPair)it_tfp.next(); - if (temp==tfp.getTemp()) - fstemp=fstemp.setFlag(tfp.getFlag(),ffan.getFlagChange(tfp)); - } - - //Process the tag changes - - processed.add(fstemp); - - //Process clears first - for(Iterator it_ttp=ffan.getTempTagPairs();it_ttp.hasNext();) { - TempTagPair ttp=(TempTagPair)it_ttp.next(); - - if (temp==ttp.getTemp()) { - Vector oldprocess=processed; - processed=new Vector(); - - for (Enumeration en=oldprocess.elements();en.hasMoreElements();){ - FlagState fsworking=(FlagState)en.nextElement(); - if (!ffan.getTagChange(ttp)){ - processed.addAll(Arrays.asList(fsworking.clearTag(ttp.getTag()))); - } else processed.add(fsworking); - } - } - } - //Process sets next - for(Iterator it_ttp=ffan.getTempTagPairs();it_ttp.hasNext();) { - TempTagPair ttp=(TempTagPair)it_ttp.next(); - - if (temp==ttp.getTemp()) { - Vector oldprocess=processed; - processed=new Vector(); - - for (Enumeration en=oldprocess.elements();en.hasMoreElements();){ - FlagState fsworking=(FlagState)en.nextElement(); - if (ffan.getTagChange(ttp)){ - processed.addAll(Arrays.asList(fsworking.setTag(ttp.getTag()))); - } else processed.add(fsworking); - } - } - } - return processed; - } - - - private FlagState canonicalizeFlagState(Hashtable sourcenodes, FlagState fs){ - if (sourcenodes.containsKey(fs)) - return (FlagState)sourcenodes.get(fs); - else{ - sourcenodes.put(fs,fs); - return fs; - } - } - - /** Creates a DOT file using the flagstates for a given class - * @param cd ClassDescriptor of the class - * @throws java.io.IOException - * @see ClassDescriptor - */ - - public void createDOTfile(ClassDescriptor cd) throws java.io.IOException { - File dotfile_flagstates= new File("graph"+cd.getSymbol()+".dot"); - FileOutputStream dotstream=new FileOutputStream(dotfile_flagstates,false); - FlagState.DOTVisitor.visit(dotstream,((Hashtable)flagstates.get(cd)).values()); - } - - /** Returns the flag states for the class descriptor. */ - public Set getFlagStates(ClassDescriptor cd) { - if (flagstates.containsKey(cd)) - return ((Hashtable)flagstates.get(cd)).keySet(); - else - return new HashSet(); - } - - - private void createPossibleRuntimeStates(FlagState fs) { - ClassDescriptor cd = fs.getClassDescriptor(); - Hashtable sourcenodes=(Hashtable)flagstates.get(cd); - FlagDescriptor[] fd=(FlagDescriptor[])flags.get(cd); - int externs=((Integer)extern_flags.get(cd)).intValue(); - - if(externs==0) - return; - - int noOfIterations=(1< decisions; - Hashtable temptotag; - ObjWrapper[] parameterbindings; - boolean increment; - - public TaskBinding(TaskQueueIterator tqi) { - this.tqi=tqi; - this.decisions=new Vector(); - int numobjs=tqi.ftsarray.length; - int numtags=tqi.tq.tags.size(); - this.parameterbindings=new ObjWrapper[numobjs]; - for(int i=0;i<(numtags+numobjs);i++) { - decisions.add(new Integer(0)); - } - } - - public ObjWrapper getParameter(int i) { - return parameterbindings[i]; - } - - public TagWrapper getTag(TempDescriptor tmp) { - return temptotag.get(tmp); - } - - public void next() { - increment=true; - } - - public boolean hasNext() { - Vector tagv=tqi.tq.tags; - int numtags=tagv.size(); - int numobjs=tqi.ftsarray.length; - int incrementlevel=numtags+numobjs; - if (increment) { - //actually do increment - incrementlevel--; - increment=false; - } - - mainloop: - while(true) { - Hashtable> ttable=new Hashtable>(); - temptotag=new Hashtable(); - //build current state - for(int i=0;i<(numtags+numobjs);i++) { - TagState tag=null; - TagWrapper tw=null; - if (i>=numtags) { - int objindex=i-numtags; - tag=tqi.ftsarray[objindex].ts; - } else { - TempDescriptor tmp=tagv.get(i); - tag=tqi.getTS(tmp); - } - int index=decisions.get(i).intValue(); - int currentsize=ttable.get(tag).size(); - if (i==incrementlevel) { - if (index==currentsize) { - if (incrementlevel==0) - return false; - incrementlevel--; - continue mainloop; - } else { - index++; - decisions.set(i, new Integer(index)); - } - } else if (i>incrementlevel) { - index=0; - decisions.set(i, new Integer(index)); - } - if (index>currentsize) { - tw=new TagWrapper(tag); - if (!ttable.containsKey(tag)) { - ttable.put(tag, new Vector()); - } - ttable.get(tag).add(tw); - } else { - //use old instance - tw=ttable.get(tag).get(index); - } - if (i>=numtags) { - int objindex=i-numtags; - FlagTagState fts=tqi.ftsarray[objindex]; - ObjWrapper ow=new ObjWrapper(fts.fs); - Hashtable > ctable=new Hashtable>(); - ctable.put(tw.getState(), new HashSet()); - ctable.get(tw.getState()).add(tw); - ow.tags.add(tw); - TagExpressionList tel=tqi.tq.task.getTag(tqi.tq.task.getParameter(i)); - for(int j=0;j()); - ctable.get(twtmp.getState()).add(twtmp); - ow.tags.add(twtmp); - int tagcount=ctable.get(twtmp.ts).size(); - int fstagcount=fts.fs.getTagCount(twtmp.getState().getTag()); - if (fstagcount>=0&&(tagcount>fstagcount)) { - //Too many unique tags of this type bound to object wrapper - incrementlevel=i; - continue mainloop; - } - } - parameterbindings[objindex]=ow; - } else { - TempDescriptor tmp=tagv.get(i); - temptotag.put(tmp, tw); - } - } - return true; - } - } -} diff --git a/Robust/src/Analysis/TaskStateAnalysis/TaskEdges.java b/Robust/src/Analysis/TaskStateAnalysis/TaskEdges.java deleted file mode 100644 index 2c20ca9d..00000000 --- a/Robust/src/Analysis/TaskStateAnalysis/TaskEdges.java +++ /dev/null @@ -1,25 +0,0 @@ -package Analysis.TaskStateAnalysis; -import Util.*; - -public class TaskEdges extends Namer{ - public TaskEdges(){} - - public String nodeLabel(GraphNode gn) { - return ""; - } - - public String nodeOption(GraphNode gn) { - return ""; - } - - - public String edgeLabel(Edge edge){ - return ""; - } - - - public String edgeOption(Edge edge){ - return "URL=\""+edge.getLabel()+".html\""; - } - -} diff --git a/Robust/src/Analysis/TaskStateAnalysis/TaskGraph.java b/Robust/src/Analysis/TaskStateAnalysis/TaskGraph.java deleted file mode 100644 index 7f05d280..00000000 --- a/Robust/src/Analysis/TaskStateAnalysis/TaskGraph.java +++ /dev/null @@ -1,231 +0,0 @@ -package Analysis.TaskStateAnalysis; -import java.util.*; -import IR.State; -import IR.SymbolTable; -import IR.ClassDescriptor; -import IR.TaskDescriptor; -import java.io.File; -import java.io.FileWriter; -import java.io.FileOutputStream; - -public class TaskGraph { - TaskAnalysis taskanalysis; - State state; - Hashtable cdtonodes; - Hashtable nodes; - Hashtable alltasknodes; - - //Colors - String colors[]={"red","blue","green","brown","orange","pink","black","grey","olivedrab","yellow"}; - - public TaskGraph(State state, TaskAnalysis taskanalysis) { - this.state=state; - this.taskanalysis=taskanalysis; - this.cdtonodes=new Hashtable(); - this.alltasknodes=new Hashtable(); - - for(Iterator classit=state.getClassSymbolTable().getDescriptorsIterator();classit.hasNext();) { - ClassDescriptor cd=(ClassDescriptor) classit.next(); - if (cd.hasFlags()) - produceTaskNodes(cd); - } - produceAllTaskNodes(); - } - - - public void createDOTfiles() { - for(Iterator it_classes=(Iterator)cdtonodes.keys();it_classes.hasNext();) { - ClassDescriptor cd=(ClassDescriptor) it_classes.next(); - Set tasknodes=getTaskNodes(cd); - if (tasknodes!=null) { - try { - File dotfile_tasknodes=new File("graph"+cd.getSymbol()+"_task.dot"); - FileOutputStream dotstream=new FileOutputStream(dotfile_tasknodes,true); - TaskNode.DOTVisitor.visit(dotstream,tasknodes); - } catch(Exception e) { - e.printStackTrace(); - throw new Error(); - } - } - } - } - - /** Returns the set of TaskNodes for the class descriptor cd */ - - public Set getTaskNodes(ClassDescriptor cd) { - if (cdtonodes.containsKey(cd)) - return ((Hashtable)cdtonodes.get(cd)).keySet(); - else - return null; - } - - private TaskNode canonicalizeTaskNode(Hashtable nodes, TaskNode node){ - if (nodes.containsKey(node)) - return (TaskNode)nodes.get(node); - else{ - nodes.put(node,node); - return (TaskNode)node; - } - } - - private void produceTaskNodes(ClassDescriptor cd) { - Set fsnodes=taskanalysis.getFlagStates(cd); - if (fsnodes==null) - return; - - Hashtable tasknodes=new Hashtable(); - cdtonodes.put(cd, tasknodes); - - for(Iterator it=fsnodes.iterator();it.hasNext();) { - FlagState fs=(FlagState)it.next(); - Iterator it_inedges=fs.inedges(); - TaskNode tn,sn; - - if (fs.isSourceNode()) { - Vector src=fs.getAllocatingTasks(); - for(Iterator it2=src.iterator();it2.hasNext();) { - TaskDescriptor td=(TaskDescriptor)it2.next(); - sn=new TaskNode(td.getSymbol()); - if(fs.edges().hasNext()){ - addEdges(fs,sn,tasknodes); - } - } - } - - while(it_inedges.hasNext()){ - - FEdge inedge=(FEdge)it_inedges.next(); - tn=new TaskNode(inedge.getLabel()); - if(fs.edges().hasNext()){ - addEdges(fs,tn,tasknodes); - } - } - } - } - - private void produceAllTaskNodes(){ - alltasknodes=new Hashtable(); - - for(Iterator it_tasks=state.getTaskSymbolTable().getDescriptorsIterator();it_tasks.hasNext();){ - TaskDescriptor td=(TaskDescriptor)it_tasks.next(); - TaskNode tn=new TaskNode(td.getSymbol()); - alltasknodes.put(tn,tn); - } - TaskNode tn_runtime=new TaskNode("Runtime"); - alltasknodes.put(tn_runtime,tn_runtime); - - int ColorID=0; - for(Iterator classit=state.getClassSymbolTable().getDescriptorsIterator();classit.hasNext()&&ColorID<10;) { - ClassDescriptor cd=(ClassDescriptor) classit.next(); - Set fsnodes; - - if (cd.hasFlags()&&((fsnodes=taskanalysis.getFlagStates(cd))!=null)){ - // - System.out.println("\nWorking on fses of Class: "+cd.getSymbol()); - // - for(Iterator it=fsnodes.iterator();it.hasNext();) { - FlagState fs=(FlagState)it.next(); - // - System.out.println("Evaluating fs: "+fs.getTextLabel()); - // - Iterator it_inedges=fs.inedges(); - TaskNode tn,sn; - - - if (fs.isSourceNode()){ - // - System.out.println("A sourcenode"); - // - if(fs.edges().hasNext()){ - Vector allocatingtasks=fs.getAllocatingTasks(); - // - if (allocatingtasks.iterator().hasNext()) - System.out.println("has been allocated by "+allocatingtasks.size()+" tasks"); - // - for(Iterator it_at=allocatingtasks.iterator();it_at.hasNext();){ - TaskDescriptor allocatingtd=(TaskDescriptor)it_at.next(); - // - System.out.println(allocatingtd.getSymbol()); - // - tn=new TaskNode(allocatingtd.getSymbol()); - - addEdges(fs,tn,alltasknodes,ColorID); - } - } - } - - while(it_inedges.hasNext()){ - FEdge inedge=(FEdge)it_inedges.next(); - tn=new TaskNode(inedge.getLabel()); - if(fs.edges().hasNext()){ - addEdges(fs,tn,alltasknodes,ColorID); - } - } - } - ColorID++; - } - - } - } - - public Set getAllTaskNodes(){ - return alltasknodes.keySet(); - } - - - - - - - - - /* private void mergeAllNodes(){ - Hashtable alltasks=new Hashtable(); - for(Iterator classit=state.getClassSymbolTable().getDescriptorsIterator();classit.hasNext();) { - ClassDescriptor cd=(ClassDescriptor) classit.next(); - Set tnodes=((Hashtable)cdtonodes.get(cd)).keyset(); - while (it_tnodes=tnodes.iterator();it_nodes.hasNext()){ - TaskNode tn=it_nodes.next(); - if (alltasks.containsKey(tn)){ - while(tn. - } - } - - - - - } - - */ - - private void addEdges(FlagState fs, TaskNode tn,Hashtable tasknodes){ - - // Hashtable tasknodes=(Hashtable)cdtonodes.get(fs.getClassDescriptor()); - tn=(TaskNode)canonicalizeTaskNode(tasknodes, tn); - for (Iterator it_edges=fs.edges();it_edges.hasNext();){ - TaskNode target=new TaskNode(((FEdge)it_edges.next()).getLabel()); - target=(TaskNode)canonicalizeTaskNode(tasknodes,target); - - TEdge newedge=new TEdge(target); - if (! tn.edgeExists(newedge)) - tn.addEdge(newedge); - } - - } - - private void addEdges(FlagState fs, TaskNode tn,Hashtable tasknodes,int ColorID){ - - tn=(TaskNode)canonicalizeTaskNode(tasknodes, tn); - for (Iterator it_edges=fs.edges();it_edges.hasNext();){ - TaskNode target=new TaskNode(((FEdge)it_edges.next()).getLabel()); - target=(TaskNode)canonicalizeTaskNode(tasknodes,target); - - TEdge newedge=new TEdge(target); - newedge.setDotNodeParameters("style=bold, color = "+colors[ColorID]); - if (! tn.edgeExists(newedge)) - tn.addEdge(newedge); - } - - } - -} diff --git a/Robust/src/Analysis/TaskStateAnalysis/TaskIndex.java b/Robust/src/Analysis/TaskStateAnalysis/TaskIndex.java deleted file mode 100644 index 84f21d0d..00000000 --- a/Robust/src/Analysis/TaskStateAnalysis/TaskIndex.java +++ /dev/null @@ -1,46 +0,0 @@ -package Analysis.TaskStateAnalysis; -import IR.TaskDescriptor; - -public class TaskIndex { - TaskDescriptor td; - int index; - boolean runtime; - public TaskIndex(TaskDescriptor td, int index) { - this.td=td; - this.index=index; - runtime=false; - } - - public TaskIndex() { - runtime=true; - } - - public boolean isRuntime() { - return runtime; - } - - public int hashCode() { - if (runtime) - return 71; - return td.hashCode()^index; - } - - public boolean equals(Object o) { - if (o instanceof TaskIndex) { - TaskIndex ti=(TaskIndex) o; - if (ti.runtime==runtime) - return true; - - if (ti.index==index && ti.td==td) - return true; - } - return false; - } - - public TaskDescriptor getTask() { - return td; - } - public int getIndex() { - return index; - } -} diff --git a/Robust/src/Analysis/TaskStateAnalysis/TaskNode.java b/Robust/src/Analysis/TaskStateAnalysis/TaskNode.java deleted file mode 100644 index 7ee1c36f..00000000 --- a/Robust/src/Analysis/TaskStateAnalysis/TaskNode.java +++ /dev/null @@ -1,76 +0,0 @@ -package Analysis.TaskStateAnalysis; -import Analysis.TaskStateAnalysis.*; -import IR.*; -import IR.Tree.*; -import IR.Flat.*; -import java.util.*; -import java.io.*; -import Util.GraphNode; - -public class TaskNode extends GraphNode { - - private final String name; - protected int uid; - private static int nodeid=0; - // private int loopmarker=0; - //private boolean multipleparams=false; - /**Class Constructor - * Creates a new TaskNode using the TaskDescriptor. - * @param tasknode TaskDescriptor - */ - public TaskNode(String name){ - this.name=name; - this.uid=TaskNode.nodeid++; - } - - /**Returns the string representation of the node - * @return string representation of the tasknode (e.g "Task foo") - */ - public String getTextLabel() { - return "Task "+name; - } - - public String getLabel() { - return "N"+uid; - } - - public String getName(){ - return name; - } - - // public int getuid(){ - //return uid; - //} - - - /**toString method. - * @return string representation of the tasknode (e.g "Task foo") - */ - public String toString(){ - return getTextLabel(); - } - - public int hashCode(){ - return name.hashCode(); - - } - - public boolean equals(Object o) { - if (o instanceof TaskNode) { - TaskNode tn=(TaskNode)o; - return (tn.name.equals(name)); - } - return false; - } - - public boolean edgeExists(TEdge newedge){ - if(edges.isEmpty()) - return false; - else - return edges.contains(newedge); - } - -} - - - diff --git a/Robust/src/Analysis/TaskStateAnalysis/TaskNodeNamer.java b/Robust/src/Analysis/TaskStateAnalysis/TaskNodeNamer.java deleted file mode 100644 index 4b6bf769..00000000 --- a/Robust/src/Analysis/TaskStateAnalysis/TaskNodeNamer.java +++ /dev/null @@ -1,15 +0,0 @@ -package Analysis.TaskStateAnalysis; -import Util.*; - -public class TaskNodeNamer extends Namer{ - public TaskNodeNamer(){} - - public String nodeLabel(GraphNode gn){ - return ""; - } - - public String nodeOption(GraphNode gn){ - return "URL=\""+gn.getName()+".html\""; - } - -} diff --git a/Robust/src/Analysis/TaskStateAnalysis/TaskQueue.java b/Robust/src/Analysis/TaskStateAnalysis/TaskQueue.java deleted file mode 100644 index 52294802..00000000 --- a/Robust/src/Analysis/TaskStateAnalysis/TaskQueue.java +++ /dev/null @@ -1,46 +0,0 @@ -package Analysis.TaskStateAnalysis; -import IR.*; -import IR.Tree.*; -import IR.Flat.*; -import java.util.*; - -public class TaskQueue { - protected TaskDescriptor task; - protected HashSet []parameterset; - protected Vector tags; - protected Hashtable > map; - - public int numParameters() { - return parameterset.length; - } - - public TaskDescriptor getTask() { - return task; - } - - public TaskQueue(TaskDescriptor td) { - this.task=td; - this.parameterset=(HashSet[])new HashSet[task.numParameters()]; - this.map=new Hashtable>(); - this.tags=new Vector(); - for(int i=0;i(); - TagExpressionList tel=td.getTag(td.getParameter(i)); - if (tel!=null) - for(int j=0;j()); - } - map.get(fts.fs).add(fts); - return new TaskQueueIterator(this, index, fts); - } -} diff --git a/Robust/src/Analysis/TaskStateAnalysis/TaskQueueIterator.java b/Robust/src/Analysis/TaskStateAnalysis/TaskQueueIterator.java deleted file mode 100644 index 7e6898aa..00000000 --- a/Robust/src/Analysis/TaskStateAnalysis/TaskQueueIterator.java +++ /dev/null @@ -1,154 +0,0 @@ -package Analysis.TaskStateAnalysis; -import IR.*; -import IR.Tree.*; -import IR.Flat.*; -import java.util.*; - -public class TaskQueueIterator { - TaskQueue tq; - int index; - FlagTagState fts; - FlagTagState ftsarray[]; - Hashtable tsarray; - Hashtable tsindexarray; - Iterator itarray[]; - boolean needit; - boolean needinit; - - public TaskQueueIterator(TaskQueue tq, int index, FlagTagState fts) { - this.tq=tq; - this.index=index; - this.fts=fts; - this.ftsarray=new FlagTagState[tq.numParameters()]; - this.ftsarray[index]=fts; - this.tsarray=new Hashtable(); - this.tsindexarray=new Hashtable(); - this.itarray=(Iterator[]) new Iterator[tq.numParameters()]; - needit=false; - needinit=true; - init(); - } - - private void init() { - for(int i=ftsarray.length-1;i>=0;i--) { - if (i!=index) - itarray[i]=tq.parameterset[i].iterator(); - VarDescriptor vd=tq.task.getParameter(i); - TagExpressionList tel=tq.task.getTag(vd); - if (tel!=null) - for(int j=0;j0?tel.numTags()-1:0; - needinit=false; - } else - j=0; - tagloop: - for(;tel!=null&&j possts=tq.map.get(currfs); - int index=0; - if (currtag!=null) - index=possts.indexOf(new FlagTagState(currtag,currfs)); - if (needit) { - index++; - needit=false; - } - for(int k=index;k toprocess; - HashSet discovered; - Hashtable tasktable; - Hashtable> tsresults; - Hashtable> fsresults; - - - /** - * Class Constructor - * - */ - public TaskTagAnalysis(State state, TagAnalysis taganalysis) { - this.state=state; - this.typeutil=new TypeUtil(state); - this.taganalysis=taganalysis; - this.flaginfo=new FlagInfo(state); - this.toprocess=new HashSet(); - this.discovered=new HashSet(); - this.tasktable=new Hashtable(); - this.tsresults=new Hashtable>(); - this.fsresults=new Hashtable>(); - - - for(Iterator taskit=state.getTaskSymbolTable().getDescriptorsIterator();taskit.hasNext();) { - TaskDescriptor td=(TaskDescriptor)taskit.next(); - tasktable.put(td, new TaskQueue(td)); - } - doAnalysis(); - doOutput(); - } - - private void doOutput() { - try { - for(Iterator tagit=tsresults.keySet().iterator();tagit.hasNext();) { - TagDescriptor tag=tagit.next(); - Set set=tsresults.get(tag); - File dotfile_flagstates= new File("tag"+tag.getSymbol()+".dot"); - FileOutputStream dotstream=new FileOutputStream(dotfile_flagstates,false); - TagState.DOTVisitor.visit(dotstream,set); - } - for(Iterator cdit=fsresults.keySet().iterator();cdit.hasNext();) { - ClassDescriptor cd=cdit.next(); - Set set=fsresults.get(cd); - File dotfile_flagstates= new File("class"+cd.getSymbol()+".dot"); - FileOutputStream dotstream=new FileOutputStream(dotfile_flagstates,false); - TagState.DOTVisitor.visit(dotstream,set); - } - } catch (Exception e) { - e.printStackTrace(); - } - } - - private void doAnalysis() { - toprocess.add(createInitialState()); - while(!toprocess.isEmpty()) { - TagState ts=toprocess.iterator().next(); - toprocess.remove(ts); - //Loop through each task - for(Iterator taskit=state.getTaskSymbolTable().getDescriptorsIterator();taskit.hasNext();) { - TaskDescriptor td=(TaskDescriptor)taskit.next(); - TaskQueue tq=tasktable.get(td); - processTask(td, tq, ts); - } - } - } - - private void processTask(TaskDescriptor td, TaskQueue tq, TagState ts) { - Set flagset=ts.getFS(); - for(Iterator fsit=flagset.iterator();fsit.hasNext();) { - FlagState fs=fsit.next(); - FlagTagState fts=new FlagTagState(ts, fs); - for(int i=0;i computeInitialState(Hashtable> maintable, FlatNode fn) { - Hashtable table=new Hashtable(); - Hashtable tagtable=new Hashtable(); - for(int i=0;i prevtable=maintable.get(fn); - - //Iterator through the Tags - for(Iterator tmpit=prevtable.keySet().iterator();tmpit.hasNext();) { - TempDescriptor tmp=tmpit.next(); - Wrapper prevtag=prevtable.get(tmp); - if (prevtag instanceof ObjWrapper) - continue; - if (table.containsKey(tmp)) { - //merge tag states - TagWrapper currtag=(TagWrapper) table.get(tmp); - tagtable.put((TagWrapper)prevtag, currtag); - assert(currtag.initts.equals(((TagWrapper)prevtag).initts)); - for(Iterator tagit=((TagWrapper)prevtag).ts.iterator();tagit.hasNext();) { - TagState tag=tagit.next(); - if (!currtag.ts.contains(tag)) { - currtag.ts.add(tag); - } - } - } else { - TagWrapper clonetag=((TagWrapper)prevtag).clone(); - tagtable.put((TagWrapper)prevtag, clonetag); - table.put(tmp, clonetag); - } - } - - //Iterator through the Objects - for(Iterator tmpit=prevtable.keySet().iterator();tmpit.hasNext();) { - TempDescriptor tmp=tmpit.next(); - Wrapper obj=prevtable.get(tmp); - if (obj instanceof TagWrapper) - continue; - ObjWrapper prevobj=(ObjWrapper)obj; - if (!table.containsKey(tmp)) { - //merge tag states - ObjWrapper newobj=new ObjWrapper(); - newobj.initfs=prevobj.initfs; - table.put(tmp, newobj); - } - ObjWrapper currobj=(ObjWrapper) table.get(tmp); - assert(currobj.initfs.equals(prevobj.initfs)); - for(Iterator tagit=prevobj.tags.iterator();tagit.hasNext();) { - TagWrapper tprev=tagit.next(); - TagWrapper t=tagtable.get(tprev); - currobj.tags.add(t); - } - for(Iterator flagit=prevobj.fs.iterator();flagit.hasNext();) { - FlagState fs=flagit.next(); - currobj.fs.add(fs); - } - } - } - return table; - } - - private void processFlatFlag(FlatFlagActionNode fn, Hashtable table, TaskDescriptor td) { - if (fn.getTaskType()==FlatFlagActionNode.PRE) { - throw new Error("Unsupported"); - } else if (fn.getTaskType()==FlatFlagActionNode.TASKEXIT) { - evalTaskExitNode(fn, table); - } else if (fn.getTaskType()==FlatFlagActionNode.NEWOBJECT) { - evalNewNode(fn, table, td); - } - } - - private void setFlag(ObjWrapper ow, FlagDescriptor fd, boolean value) { - HashSet newstate=new HashSet(); - Hashtable flagmap=new Hashtable(); - for(Iterator flagit=ow.fs.iterator();flagit.hasNext();) { - FlagState fs=flagit.next(); - FlagState fsnew=canonical(fs.setFlag(fd, value)); - newstate.add(fsnew); - flagmap.put(fs, fsnew); - } - - for(Iterator tagit=ow.tags.iterator();tagit.hasNext();) { - TagWrapper tw=tagit.next(); - HashSet newstates=new HashSet(); - for(Iterator tgit=tw.ts.iterator();tgit.hasNext();) { - TagState ts=tgit.next(); - for(Iterator flagit=ts.getFS().iterator();flagit.hasNext();) { - FlagState fs=flagit.next(); - if (flagmap.containsKey(fs)) { - if (flagmap.get(fs).equals(fs)) { - newstates.add(ts); - } else { - TagState tsarray[]=ts.clearFS(fs); - //Can do strong update here because these - //must be parameter objects...therefore - //all possible aliasing relationships are - //explored - for(int i=0;i newfsstates=new HashSet(); - Hashtable flagmap=new Hashtable(); - //Change the flag states - for(Iterator fsit=ow.fs.iterator();fsit.hasNext();) { - FlagState fs=fsit.next(); - FlagState[] fsnew=canonical(fs.setTag(tag, value)); - flagmap.put(fs, fsnew); - newfsstates.addAll(Arrays.asList(fsnew)); - } - for(Iterator tagit=ow.tags.iterator();tagit.hasNext();) { - TagWrapper tw=tagit.next(); - HashSet newstates=new HashSet(); - for(Iterator tgit=tw.ts.iterator();tgit.hasNext();) { - TagState ts=tgit.next(); - for(Iterator flagit=ts.getFS().iterator();flagit.hasNext();) { - FlagState fs=flagit.next(); - if (flagmap.containsKey(fs)) { - FlagState[] fmap=flagmap.get(fs); - for(int i=0;i newstates=new HashSet(); - for(Iterator tgit=twnew.ts.iterator();tgit.hasNext();) { - TagState ts=tgit.next(); - for(Iterator flagit=newfsstates.iterator();flagit.hasNext();) { - FlagState fsnew=flagit.next(); - //Can do strong update here because these must - //be parameter objects...therefore all - //possible aliasing relationships are explored - TagState tsarray2[]; - if (value) - tsarray2=ts.addnewFS(fsnew); - else - tsarray2=ts.clearFS(fsnew); - for(int j=0;j table) { - //Process clears first - for(Iterator it_ttp=fn.getTempTagPairs();it_ttp.hasNext();) { - TempTagPair ttp=it_ttp.next(); - TempDescriptor tmp=ttp.getTemp(); - TagDescriptor tag=ttp.getTag(); - TempDescriptor tagtmp=ttp.getTagTemp(); - TagWrapper tagw=(TagWrapper)table.get(tagtmp); - boolean newtagstate=fn.getTagChange(ttp); - ObjWrapper ow=(ObjWrapper)table.get(tmp); - if (!newtagstate) - setTag(ow, tagw, tag, newtagstate); - } - - //Do the flags next - for(Iterator it_tfp=fn.getTempFlagPairs();it_tfp.hasNext();) { - TempFlagPair tfp=it_tfp.next(); - TempDescriptor tmp=tfp.getTemp(); - FlagDescriptor fd=tfp.getFlag(); - boolean newflagstate=fn.getFlagChange(tfp); - ObjWrapper ow=(ObjWrapper)table.get(tmp); - setFlag(ow, fd, newflagstate); - } - - //Process sets last - for(Iterator it_ttp=fn.getTempTagPairs();it_ttp.hasNext();) { - TempTagPair ttp=(TempTagPair)it_ttp.next(); - TempDescriptor tmp=ttp.getTemp(); - TagDescriptor tag=ttp.getTag(); - TempDescriptor tagtmp=ttp.getTagTemp(); - TagWrapper tagw=(TagWrapper)table.get(tagtmp); - boolean newtagstate=fn.getTagChange(ttp); - ObjWrapper ow=(ObjWrapper)table.get(tmp); - if (newtagstate) - setTag(ow, tagw, tag, newtagstate); - } - } - - private void evalNewNode(FlatFlagActionNode fn, Hashtable table, TaskDescriptor td) { - TempDescriptor fntemp=null; - { - /* Compute type */ - Iterator it=fn.getTempFlagPairs(); - if (it.hasNext()) { - TempFlagPair tfp=(TempFlagPair)it.next(); - fntemp=tfp.getTemp(); - } else { - it=fn.getTempTagPairs(); - if (!it.hasNext()) - throw new Error(); - TempTagPair ttp=(TempTagPair)it.next(); - fntemp=ttp.getTemp(); - } - } - FlagState fs=canonical(new FlagState(fntemp.getType().getClassDesc())); - ObjWrapper ow=new ObjWrapper(); - ow.fs.add(fs); - table.put(fntemp, ow); - //Do the flags first - for(Iterator it_tfp=fn.getTempFlagPairs();it_tfp.hasNext();) { - TempFlagPair tfp=it_tfp.next(); - TempDescriptor tmp=tfp.getTemp(); - FlagDescriptor fd=tfp.getFlag(); - boolean newflagstate=fn.getFlagChange(tfp); - assert(ow==table.get(tmp)); - setFlag(ow, fd, newflagstate); - } - //Process sets next - for(Iterator it_ttp=fn.getTempTagPairs();it_ttp.hasNext();) { - TempTagPair ttp=(TempTagPair)it_ttp.next(); - TempDescriptor tmp=ttp.getTemp(); - TagDescriptor tag=ttp.getTag(); - TempDescriptor tagtmp=ttp.getTagTemp(); - TagWrapper tagw=(TagWrapper)table.get(tagtmp); - boolean newtagstate=fn.getTagChange(ttp); - assert(ow==table.get(tmp)); - if (newtagstate) - setTag(ow, tagw, tag, newtagstate); - else - throw new Error("Can't clear tag in newly allocated object"); - } - for(Iterator fsit=ow.fs.iterator();fsit.hasNext();) { - FlagState fs2=fsit.next(); - fs2.addAllocatingTask(td); - TagState ts2=new TagState(fs2.getClassDescriptor()); - ts2.addFS(fs2); - ts2=canonical(ts2); - ts2.addSource(td); - addresult(fs2.getClassDescriptor(), ts2); - if (!discovered.contains(ts2)) { - discovered.add(ts2); - toprocess.add(ts2); - } - } - } - - private void processFlatTag(FlatTagDeclaration fn, Hashtable table, TaskDescriptor td) { - TempDescriptor tmp=fn.getDst(); - if (table.containsKey(tmp)) { - recordtagchange((TagWrapper)table.get(tmp), td); - } - TagDescriptor tag=fn.getType(); - TagState ts=canonical(new TagState(tag)); - TagWrapper tw=new TagWrapper(ts); - tw.initts=null; - table.put(tmp, tw); - } - - private void addresult(TagDescriptor td, TagState ts) { - if (!tsresults.containsKey(td)) - tsresults.put(td, new HashSet()); - tsresults.get(td).add(ts); - } - - private void addresult(ClassDescriptor cd, TagState ts) { - if (!fsresults.containsKey(cd)) - fsresults.put(cd, new HashSet()); - fsresults.get(cd).add(ts); - } - - public void recordtagchange(TagWrapper tw, TaskDescriptor td) { - TagState init=tw.initts; - for(Iterator tsit=tw.ts.iterator(); tsit.hasNext();) { - TagState ts=tsit.next(); - if (init==null) { - ts.addSource(td); - } else { - TagEdge te=new TagEdge(ts, td); - if (!init.containsEdge(te)) { - init.addEdge(te); - } - } - if (ts.getTag()!=null) - addresult(ts.getTag(), ts); - else - addresult(ts.getClassDesc(), ts); - if (!discovered.contains(ts)) { - discovered.add(ts); - toprocess.add(ts); - } - } - } - - private void recordobj(ObjWrapper ow, TaskDescriptor td) { - for(Iterator twit=ow.tags.iterator();twit.hasNext();) { - TagWrapper tw=twit.next(); - recordtagchange(tw, td); - } - } - - private void processFlatCall(FlatCall fc, Hashtable table) { - //Do nothing for now - } - - private void processFlatReturnNode(FlatReturnNode fr, Hashtable table, TaskDescriptor td) { - for(Iterator tmpit=table.keySet().iterator();tmpit.hasNext();) { - TempDescriptor tmp=tmpit.next(); - Wrapper w=table.get(tmp); - if (w instanceof TagWrapper) { - TagWrapper tw=(TagWrapper)w; - recordtagchange(tw, td); - } else { - ObjWrapper ow=(ObjWrapper)w; - recordobj(ow, td); - } - } - } - - private boolean equivalent(Hashtable table1, Hashtable table2) { - Hashtable emap=new Hashtable(); - - if (table1.keySet().size()!=table2.keySet().size()) - return false; - - for(Iterator tmpit=table1.keySet().iterator();tmpit.hasNext();) { - TempDescriptor tmp=tmpit.next(); - if (table2.containsKey(tmp)) { - emap.put(table1.get(tmp), table2.get(tmp)); - } else return false; - } - - for(Iterator tmpit=table1.keySet().iterator();tmpit.hasNext();) { - TempDescriptor tmp=tmpit.next(); - Wrapper w1=table1.get(tmp); - Wrapper w2=table2.get(tmp); - if (w1 instanceof TagWrapper) { - TagWrapper t1=(TagWrapper)w1; - TagWrapper t2=(TagWrapper)w2; - if (!t1.ts.equals(t2.ts)) - return false; - - } else { - ObjWrapper t1=(ObjWrapper)w1; - ObjWrapper t2=(ObjWrapper)w2; - if (!t1.fs.equals(t2.fs)) - return false; - if (t1.tags.size()!=t2.tags.size()) - return false; - for(Iterator twit=t1.tags.iterator();twit.hasNext();) { - TagWrapper tw1=twit.next(); - if (!t2.tags.contains(emap.get(tw1))) - return false; - } - } - } - return true; - } - - private void doAnalysis(TaskBinding tb) { - TaskDescriptor td=tb.tqi.tq.getTask(); - FlatMethod fm=state.getMethodFlat(td); - Hashtable> wtable=new Hashtable>(); - wtable.put(fm, buildinittable(tb, fm)); - HashSet visited=new HashSet(); - HashSet tovisit=new HashSet(); - tovisit.add(fm.getNext(0)); - while(!tovisit.isEmpty()) { - FlatNode fn=tovisit.iterator().next(); - tovisit.remove(fn); - visited.add(fn); - Hashtable table=computeInitialState(wtable, fn); - switch(fn.kind()) { - case FKind.FlatFlagActionNode: - processFlatFlag((FlatFlagActionNode)fn, table, td); - break; - case FKind.FlatTagDeclaration: - processFlatTag((FlatTagDeclaration)fn, table, td); - break; - case FKind.FlatCall: - processFlatCall((FlatCall)fn, table); - break; - case FKind.FlatReturnNode: - processFlatReturnNode((FlatReturnNode)fn, table, td); - break; - default: - } - - if (!equivalent(table, wtable.get(fn))) { - wtable.put(fn, table); - for(int i=0;i buildinittable(TaskBinding tb, FlatMethod fm) { - Hashtable table=new Hashtable(); - Vector tagtmps=tb.tqi.tq.tags; - for(int i=0;i= 0) - { - StringBuffer difBuffer = new StringBuffer(difference.toString()); - - int padding = 10 - difBuffer.length(); - - for(int i = 0; i < padding; i++) - { - difBuffer.append("@"); - } - - //assumes no overflow - Bank.database[id].Balance = difBuffer.toString(); - - bas.send("Withdraw OK"); - //System.printString("Withdraw OK"); - } - else - { - bas.send("Overdraw Error"); - //System.printString("Overdraw Error"); - } - } - else - { - bas.send("Withdraw Error"); - //System.printString("Withdraw Error"); - } - } - //check balance - else if(message.startsWith("9")) - { - String account = message.subString(1, 10); - - int id = -1; - for(int i = 0; i < Bank.numOfAccounts; i++) - { - if(Bank.database[i].AccountNumber.equals(account)) - id = i; - } - - if(id != -1) - { - bas.send(Bank.database[id].Balance); - //System.printString(Bank.database[id].Balance); - } - else - { - bas.send("Check Balance Error"); - //System.printString("Check Balance Error"); - } - } - else - { - bas.send("Message Error"); - //System.printString("Message Error"); - } -} diff --git a/Robust/src/Benchmarks/BankApp/BankAppRead.dat b/Robust/src/Benchmarks/BankApp/BankAppRead.dat deleted file mode 100644 index 57754948..00000000 --- a/Robust/src/Benchmarks/BankApp/BankAppRead.dat +++ /dev/null @@ -1 +0,0 @@ -101010101Tony@@@@@@Stone@@@@@Smith@@@@@2123456@@@@8888 \ No newline at end of file diff --git a/Robust/src/Benchmarks/BankApp/BankAppSocket.java b/Robust/src/Benchmarks/BankApp/BankAppSocket.java deleted file mode 100644 index cca10826..00000000 --- a/Robust/src/Benchmarks/BankApp/BankAppSocket.java +++ /dev/null @@ -1,26 +0,0 @@ -public class BankAppSocket extends Socket -{ - flag BASocketInit; - - public BankAppSocket() - { - - } - - public void send(String message) - { - write(message.getBytes()); - } - - public String receive() - { - byte buffer[] = new byte[64]; - - int numbytes = read(buffer); - - //it's subString() not substring() like in Java - String message = (new String(buffer)).subString(0, numbytes); - - return message; - } -} diff --git a/Robust/src/Benchmarks/BankApp/BankAppWrite.dat b/Robust/src/Benchmarks/BankApp/BankAppWrite.dat deleted file mode 100644 index 57754948..00000000 --- a/Robust/src/Benchmarks/BankApp/BankAppWrite.dat +++ /dev/null @@ -1 +0,0 @@ -101010101Tony@@@@@@Stone@@@@@Smith@@@@@2123456@@@@8888 \ No newline at end of file diff --git a/Robust/src/Benchmarks/BankApp/BankDatabase.java b/Robust/src/Benchmarks/BankApp/BankDatabase.java deleted file mode 100644 index 9b4ff94d..00000000 --- a/Robust/src/Benchmarks/BankApp/BankDatabase.java +++ /dev/null @@ -1,107 +0,0 @@ -public class BankDatabase -{ - flag DatabaseInit; - - BankAccount[] database; - int numOfAccounts; - - public BankDatabase() - { - //6 pre-created accounts - numOfAccounts = 6; - - //10 account limit - database = new BankAccount[10]; - - for(int i = 0; i < 10; i++) - { - database[i] = new BankAccount(); - } - - //some hardcoded values - database[0].modifyAccount("123456789", "John@@@@@@", "Q@@@@@@@@@", "Public@@@@", "1", "256000001@", "2007"); - database[1].modifyAccount("987654321", "Nancy@@@@@", "H@@@@@@@@@", "Private@@@", "2", "166@@@@@@@", "1234"); - database[2].modifyAccount("000111000", "Paul@@@@@@", "Wellington", "Franks@@@@", "1", "454225@@@@", "0000"); - database[3].modifyAccount("211411911", "Felix@@@@@", "the@@@@@@@", "Cat@@@@@@@", "3", "0@@@@@@@@@", "9999"); - database[4].modifyAccount("111000111", "Paul@@@@@@", "Wellington", "Franks@@@@", "2", "1128989@@@", "0000"); - //empty - database[5].modifyAccount("@@@@@@@@@", "@@@@@@@@@@", "@@@@@@@@@@", "@@@@@@@@@@", "@", "@@@@@@@@@@", "@@@@"); - database[6].modifyAccount("@@@@@@@@@", "@@@@@@@@@@", "@@@@@@@@@@", "@@@@@@@@@@", "@", "@@@@@@@@@@", "@@@@"); - database[7].modifyAccount("@@@@@@@@@", "@@@@@@@@@@", "@@@@@@@@@@", "@@@@@@@@@@", "@", "@@@@@@@@@@", "@@@@"); - database[8].modifyAccount("@@@@@@@@@", "@@@@@@@@@@", "@@@@@@@@@@", "@@@@@@@@@@", "@", "@@@@@@@@@@", "@@@@"); - database[9].modifyAccount("@@@@@@@@@", "@@@@@@@@@@", "@@@@@@@@@@", "@@@@@@@@@@", "@", "@@@@@@@@@@", "@@@@"); - - //test read into database[5] - ReadFile(5); - - //test write from database[5] - WriteFile(database[5].AccountNumber, database[5].FirstName, database[5].MiddleName, database[5].LastName, database[5].AccountType, database[5].Balance, database[5].PIN); - } - - /* what, no destructor? - public ~BankDatabase() - { - //test write from database[5] - }*/ - - public void ReadFile(int index) - { - //need to check if read/write works the way I think it does - String filename="BankAppRead.dat"; - FileInputStream fis = new FileInputStream(filename); - - byte account[] = new byte[9]; - byte first[] = new byte[10]; - byte middle[] = new byte[10]; - byte last[] = new byte[10]; - byte type[] = new byte[1]; - byte balance[] = new byte[10]; - byte pin[] = new byte[4]; - - //read one account for now - fis.read(account); - fis.read(first); - fis.read(middle); - fis.read(last); - fis.read(type); - fis.read(balance); - fis.read(pin); - - fis.close(); - - String S1 = new String(account); - //System.printString(S1); - String S2 = new String(first); - //System.printString(S2); - String S3 = new String(middle); - //System.printString(S3); - String S4 = new String(last); - //System.printString(S4); - String S5 = new String(type); - //System.printString(S5); - String S6 = new String(balance); - //System.printString(S6); - String S7 = new String(pin); - //System.printString(S7); - - //read into one account for now - database[index].modifyAccount(S1, S2, S3, S4, S5, S6, S7); - } - - public void WriteFile(String account, String first, String middle, String last, String type, String balance, String pin) - { - String filename="BankAppWrite.dat"; - FileOutputStream fos = new FileOutputStream(filename); - - //write one account for now - fos.write(account.getBytes()); - fos.write(first.getBytes()); - fos.write(middle.getBytes()); - fos.write(last.getBytes()); - fos.write(type.getBytes()); - fos.write(balance.getBytes()); - fos.write(pin.getBytes()); - - fos.close(); - } -} diff --git a/Robust/src/Benchmarks/BankAppJava/BankAppClientTeller.java b/Robust/src/Benchmarks/BankAppJava/BankAppClientTeller.java deleted file mode 100644 index a74c0b3b..00000000 --- a/Robust/src/Benchmarks/BankAppJava/BankAppClientTeller.java +++ /dev/null @@ -1,374 +0,0 @@ -// Bank App in Java - -// Author: Danish Lakhani - -// BankAppServer - Bank Application Server that services one client at a time - -import java.io.*; -import java.net.*; -import java.util.*; - -class BankAppClientTeller -{ - static int SUCCESS = 0; - static int ERROR = 1; - - static int LOGIN_ACCOUNT = 1; - static int LOGIN_PIN = 2; - - static int ACCOUNT_SAVINGS = 1; - static int ACCOUNT_CHECKING = 2; - static int ACCOUNT_TELLER = 3; - - private Socket mySocket = null; - private PrintWriter out = null; - private BufferedReader in = null; - private static int serverPort = 44444; - - public BankAppClientTeller() - { - } - - private void establishConnection() - throws IOException - { - System.out.println("Connecting to server..."); - mySocket = new Socket("localhost", serverPort); - out = new PrintWriter(mySocket.getOutputStream(), true); - in = new BufferedReader(new InputStreamReader(mySocket.getInputStream())); - System.out.println("Connection Established!"); - } - - private void closeConnection() - throws IOException - { - if (out != null) - out.close(); - if (in != null) - in.close(); - if (mySocket != null) - mySocket.close(); - } - - private void displayMenu() - { - System.out.println("\nBankAppClientTeller"); - System.out.println("----------------"); - System.out.println("1. Login"); - System.out.println("2. Logout"); - System.out.println("3. Deposit"); - System.out.println("4. Withdraw"); - System.out.println("5. Check Balance"); - System.out.println("6. Open Account"); - System.out.println("7. Close Account"); - System.out.println("8. Modify Account"); - System.out.println("9. Check Account Info"); - System.out.println("0. Exit\n"); - System.out.print("Enter Choice: "); - return; - } - - private void startClient() - throws IOException - { - int clientQuit = 0; - int status = SUCCESS; - int isConnected = 0; - boolean loggedIn = false; - BufferedReader local_in = new BufferedReader(new InputStreamReader(System.in)); - while (clientQuit == 0) - { - if (!loggedIn) - establishConnection(); - isConnected = 1; - while (isConnected == 1) - { - displayMenu(); - String input = local_in.readLine(); - int selection = Integer.parseInt(input); - String response; - switch (selection) - { - case 0: - System.out.println("Exitting..."); - out.println("EXIT"); - System.exit(0); - break; - case 1: - System.out.println("Login"); - out.println("LOGIN"); - response = in.readLine(); - if (response.equals("OK")) - { - System.out.print("Enter account number: "); - String accountNumber = local_in.readLine(); - System.out.print("Enter PIN: "); - String pinNumber = local_in.readLine(); - out.println(accountNumber); - out.println(pinNumber); - response = in.readLine(); - if (response.equals(accountNumber)) - { - System.out.println("Login Successful! Account: " + response); - loggedIn = true; - } - else - { - System.out.println(response); - } - } - else - { - System.out.println(response); - } - break; - case 2: - System.out.println("Logout"); - out.println("LOGOUT"); - response = in.readLine(); - if (response.equals("OK")) - { - response = in.readLine(); - System.out.println("Logout Successful! Account: " + response); - } - else - { - System.out.println(response); - } - break; - case 3: - System.out.println("Deposit"); - out.println("TELLERDEPOSIT"); - response = in.readLine(); - if (response.equals("OK")) - { - System.out.print("Enter Account Number: "); - String accNum = local_in.readLine(); - out.println(accNum); - response = in.readLine(); - if (!response.equals("OK")) - { - System.out.println(response); - break; - } - System.out.print("Enter Deposit Amount: "); - String depAmount = local_in.readLine(); - out.println(depAmount); - response = in.readLine(); - if (response.equals("OK")) - { - response = in.readLine(); - } - } - System.out.println(response); - break; - case 4: - System.out.println("Withdraw"); - out.println("TELLERWITHDRAW"); - response = in.readLine(); - if (response.equals("OK")) - { - System.out.print("Enter Account Number: "); - String accNum = local_in.readLine(); - out.println(accNum); - response = in.readLine(); - if (!response.equals("OK")) - { - System.out.println(response); - break; - } - System.out.print("Enter Withdrawal Amount: "); - String wdAmount = local_in.readLine(); - out.println(wdAmount); - response = in.readLine(); - if (response.equals("OK")) - { - response = in.readLine(); - } - } - System.out.println(response); - break; - case 5: - System.out.println("Check Balance"); - out.println("TELLERCHECK"); - response = in.readLine(); - if (response.equals("OK")) - { - System.out.print("Enter Account Number: "); - String accNum = local_in.readLine(); - out.println(accNum); - response = in.readLine(); - if (!response.equals("OK")) - { - System.out.println(response); - break; - } - response = in.readLine(); - } - System.out.println(response); - break; - case 6: - System.out.println("Account Open"); - out.println("TELLEROPEN"); - response = in.readLine(); - if (!response.equals("OK")) - { - System.out.println(response); - break; - } - System.out.print("Enter Account Number: "); - out.println(local_in.readLine()); - System.out.print("Enter First Name: "); - out.println(local_in.readLine()); - System.out.print("Enter Middle Name: "); - out.println(local_in.readLine()); - System.out.print("Enter Last Name: "); - out.println(local_in.readLine()); - System.out.print("Enter Account Type: "); - out.println(local_in.readLine()); - System.out.print("Enter Initial Balance: "); - out.println(local_in.readLine()); - System.out.print("Enter PIN: "); - out.println(local_in.readLine()); - response = in.readLine(); - if (response.equals("OK")) - response = in.readLine(); - System.out.println(response); - break; - case 7: - System.out.println("Account Close"); - out.println("TELLERCLOSE"); - response = in.readLine(); - if (!response.equals("OK")) - { - System.out.println(response); - break; - } - System.out.print("Enter Account Number: "); - out.println(local_in.readLine()); - response = in.readLine(); - if (response.equals("OK")) - response = in.readLine(); - System.out.println(response); - break; - case 8: - System.out.println("Modify Account"); - out.println("TELLERMODIFY"); - response = in.readLine(); - if (!response.equals("OK")) - { - System.out.println(response); - break; - } - System.out.print("Enter Account Number: "); - String accNum = local_in.readLine(); - out.println(accNum); - response = in.readLine(); - if (!response.equals("OK")) - { - System.out.println(response); - break; - } - int done = 0; - while (done == 0) - { - System.out.println("1. Change Name"); - System.out.println("2. Change Type"); - System.out.println("3. Change PIN"); - System.out.println("4. Change Balance"); - System.out.println("5. Done\n"); - System.out.print("Enter Choice: "); - int choice = Integer.parseInt(local_in.readLine()); - switch (choice) - { - case 1: - out.println("CHANGENAME"); - System.out.print("Enter New First Name: "); - out.println(local_in.readLine()); - System.out.print("Enter New Middle Name: "); - out.println(local_in.readLine()); - System.out.print("Enter New Last Name: "); - out.println(local_in.readLine()); - response = in.readLine(); - if (!response.equals("OK")) - { - System.out.println(response); - } - break; - case 2: - out.println("CHANGETYPE"); - System.out.print("Enter New Account Type: "); - out.println(local_in.readLine()); - response = in.readLine(); - if (!response.equals("OK")) - { - System.out.println(response); - } - break; - case 3: - out.println("CHANGEPIN"); - System.out.print("Enter New PIN: "); - out.println(local_in.readLine()); - response = in.readLine(); - if (!response.equals("OK")) - { - System.out.println(response); - } - break; - case 4: - out.println("CHANGEBALANCE"); - System.out.print("Enter New Balance: "); - out.println(local_in.readLine()); - response = in.readLine(); - if (!response.equals("OK")) - { - System.out.println(response); - } - break; - case 5: - done = 1; - out.println("DONE"); - break; - default: - System.out.println("Invalid selection"); - break; - } - } - response = in.readLine(); - System.out.println(response); - break; - case 9: - System.out.println("View Account"); - out.println("TELLERVIEW"); - response = in.readLine(); - if (!response.equals("OK")) - { - System.out.println(response); - break; - } - System.out.print("Enter Account Number: "); - String accNumber = local_in.readLine(); - out.println(accNumber); - response = in.readLine(); - if (response.equals("OK")) - response = in.readLine(); - System.out.println(response); - break; - default: - System.out.println("Invalid Selection"); - break; - } - System.out.println("Press Enter to Continue..."); - local_in.readLine(); - } - } - } - - public static void main(String [] args) - throws IOException - { - System.out.println("BankAppClientTeller in Java"); - BankAppClientTeller client = new BankAppClientTeller(); - client.startClient(); - } -} diff --git a/Robust/src/Benchmarks/BankAppJava/BankAppServer.java b/Robust/src/Benchmarks/BankAppJava/BankAppServer.java deleted file mode 100644 index 0ebf40b1..00000000 --- a/Robust/src/Benchmarks/BankAppJava/BankAppServer.java +++ /dev/null @@ -1,697 +0,0 @@ -// Bank App in Java - -// Author: Danish Lakhani - -// BankAppServer - Bank Application Server that services one client at a time - -import java.io.*; -import java.net.*; -import java.util.*; - -class BankAppServer -{ - static int SUCCESS = 0; - static int ERROR = 1; - - static int LOGIN_ACCOUNT = 1; - static int LOGIN_PIN = 2; - - static int ACCOUNT_SAVINGS = 1; - static int ACCOUNT_CHECKING = 2; - static int ACCOUNT_TELLER = 3; - - private ServerSocket serverSocket = null; - private Socket clientSocket = null; - private PrintWriter out = null; - private BufferedReader in = null; - private static int serverPort = 44444; - private AccountDatabase accounts = null; - - private boolean isLoggedIn = false; - private Integer activeAccount = 0; - private Integer tellerCode = 0; - - public BankAppServer() - { -// initializeServer(); - } - - private void initializeServer() - { - //Initialize Database - accounts = new AccountDatabase(); - - //Initialize Server Socket - System.out.print("Creating Server Socket..."); - try { - serverSocket = new ServerSocket(serverPort); - } catch (IOException e) { - System.out.println("Cannot listen on port " + serverPort); - System.exit(-1); - } - System.out.println("Done"); - } - - private void establishConnection() - throws IOException - { - System.out.print("Waiting for connection..."); - try { - clientSocket = serverSocket.accept(); - } catch (IOException e) { - System.out.println("Accept failed"); - System.exit(-1); - } - out = new PrintWriter(clientSocket.getOutputStream(), true); - in = new BufferedReader(new InputStreamReader(clientSocket.getInputStream())); - System.out.println("Connection Established!"); - } - - private int authenticateUser(Integer accountNumber, Integer pin) - { - if (!accounts.accountExists(accountNumber)) - return LOGIN_ACCOUNT; - if (accounts.getPin(accountNumber) != pin) - return LOGIN_PIN; - return SUCCESS; - } - - private int login() - throws IOException - { - out.println("OK"); - Integer accountNumber = new Integer(in.readLine()); - System.out.println("Account number: " + accountNumber); - Integer pin = new Integer(in.readLine()); - System.out.println("PIN: " + pin); - System.out.println("Authenticating..."); - int status = authenticateUser(accountNumber, pin); - if (status == SUCCESS) - { - out.println(accountNumber); - isLoggedIn = true; - tellerCode = 0; - activeAccount = 0; - if (accounts.isTeller(accountNumber)) - tellerCode = accountNumber; - else - activeAccount = accountNumber; - System.out.println("Logged Success"); - return SUCCESS; - } - else { - if (status == LOGIN_ACCOUNT) - out.println("ERROR: login failed: Account " + accountNumber + " does not exist."); - else - out.println("ERROR: login failed: Incorrect pin."); - } - System.out.println("Login Failed"); - return ERROR; - } - - private void closeConnection() - throws IOException - { - out.close(); - in.close(); - clientSocket.close(); -// serverSocket.close(); - } - - private void processDeposit(Integer accountNumber) throws IOException - { - String inVal; - if (!accounts.accountExists(accountNumber)) - { - out.println("ERROR: Account " + accountNumber + " not found."); - return; - } - - out.println("OK"); - - //Get Deposit Amount - inVal = in.readLine(); - Double depAmount = new Double(inVal); - if (depAmount <= 0) - { - out.println("ERROR: Negative or zero deposit amount"); - return; - } - - accounts.deposit(accountNumber, depAmount); - out.println("OK"); - out.println("$" + depAmount + " deposited successfully! Account: " + accountNumber + " New Balance: " + accounts.getBalance(accountNumber)); - return; - } - - private void processWithdrawal(Integer accountNumber) throws IOException - { - String inVal; - if (!accounts.accountExists(accountNumber)) - { - out.println("ERROR: Account " + accountNumber + " not found."); - return; - } - - out.println("OK"); - - //Get withdrawal amount - inVal = in.readLine(); - Double wdAmount = new Double(inVal); - if (wdAmount <= 0) - { - out.println("ERROR: Negative or zero withdrawal amount"); - return; - } -// else if (wdAmount > accounts.getBalance(accountNumber)) -// { -// out.println("ERROR: Insufficient funds. Balance = " + accounts.getBalance(accountNumber)); -// return; -// } - - accounts.withdraw(accountNumber, wdAmount); - out.println("OK"); - out.println("$" + wdAmount + " withdrawn successfully! Account: " + accountNumber + " New Balance: " + accounts.getBalance(accountNumber)); - return; - } - - private void processBalanceCheck(Integer accountNumber) - { - out.println("OK"); - out.println("Account: " + accountNumber + " Balance: " + accounts.getBalance(accountNumber)); - return; - } - - private void startServer() - throws IOException - { - int serverQuit = 0; - int status = SUCCESS; - int isConnected = 0; - initializeServer(); - while (serverQuit == 0) - { - establishConnection(); - isConnected = 1; - accounts.loadDatabase(); - while (isConnected == 1) - { - System.out.println("Waiting for request..."); - // Wait for requests - String request = in.readLine(); - if (request == null) - continue; - - System.out.println("Request: " + request); - - // Service requests - if (request.equals("EXIT")) - { - accounts.storeDatabase(); - isLoggedIn = false; - activeAccount = 0; - tellerCode = 0; - closeConnection(); - isConnected = 0; - continue; - } - - if (request.equals("LOGIN")) - { - if (isLoggedIn) - { - out.println("ERROR: Already logged in. Please logout."); - continue; - } - status = login(); - if (status == ERROR) - { -// isConnected = 0; - continue; - } - } - - if (!isLoggedIn) - { - out.println("ERROR: Not logged in"); - continue; - } - - if (request.equals("LOGOUT")) - { - out.println("OK"); - if (tellerCode == 0) - out.println(activeAccount); - else - out.println(tellerCode); - accounts.storeDatabase(); - isLoggedIn = false; - activeAccount = 0; - tellerCode = 0; -// closeConnection(); -// isConnected = 0; - } - - if (request.equals("DEPOSIT")) - { - processDeposit(activeAccount); - } - - if (request.equals("WITHDRAW")) - { - processWithdrawal(activeAccount); - } - - if (request.equals("CHECK")) - { - processBalanceCheck(activeAccount); - } - - if (request.equals("TELLERDEPOSIT")) - { - if (tellerCode == 0) - { - out.println("ERROR: Teller not logged in"); - continue; - } - out.println("OK"); - Integer acc = new Integer(in.readLine()); - processDeposit(acc); - } - - if (request.equals("TELLERWITHDRAW")) - { - if (tellerCode == 0) - { - out.println("ERROR: Teller not logged in"); - continue; - } - out.println("OK"); - Integer acc = new Integer(in.readLine()); - processWithdrawal(acc); - } - - if (request.equals("TELLERCHECK")) - { - if (tellerCode == 0) - { - out.println("ERROR: Teller not logged in"); - continue; - } - out.println("OK"); - Integer acc = new Integer(in.readLine()); - processBalanceCheck(acc); - } - - if (request.equals("TELLEROPEN")) - { - if (tellerCode == 0) - { - out.println("ERROR: Teller not logged in"); - continue; - } - out.println("OK"); - Integer accNum = new Integer(in.readLine()); - String fName = in.readLine(); - String mName = in.readLine(); - String lName = in.readLine(); - Integer accType = new Integer(in.readLine()); - Double bal = new Double(in.readLine()); - Integer pNum = new Integer(in.readLine()); - status = accounts.openAccount(accNum, fName, mName, lName, accType, bal, pNum); - if (status == ERROR) - { - out.println("ERROR: Account " + accNum + " already exists."); - continue; - } - out.println("OK"); - out.println("Account Number: " + accNum + " " + - "Customer Name: " + fName + " " + mName + " " + lName + " " + - "Account Type: " + ((accType == ACCOUNT_SAVINGS)?"SAVINGS":(accType == ACCOUNT_CHECKING)?"CHECKING":"TELLER") + " " + - "Balance: $" + bal + " " + - "PIN: " + pNum + " "); - } - - if (request.equals("TELLERCLOSE")) - { - if (tellerCode == 0) - { - out.println("ERROR: Teller not logged in"); - continue; - } - out.println("OK"); - Integer accNum = new Integer(in.readLine()); - status = accounts.closeAccount(accNum); - if (status == ERROR) - { - out.println("ERROR: Account " + accNum + " does not exist."); - continue; - } - out.println("OK"); - out.println("Account " + accNum + " closed successfully"); - } - - if (request.equals("TELLERMODIFY")) - { - if (tellerCode == 0) - { - out.println("ERROR: Teller not logged in"); - continue; - } - out.println("OK"); - Integer accNum = new Integer(in.readLine()); - if (!accounts.accountExists(accNum)) - { - out.println("ERROR: Account " + accNum + " does not exist."); - continue; - } - out.println("OK"); - String inVal; - while (!(inVal = in.readLine()).equals("DONE")) - { - if (inVal.equals("CHANGENAME")) - { - String fName = in.readLine(); - String mName = in.readLine(); - String lName = in.readLine(); - accounts.modifyName(accNum, fName, mName, lName); - out.println("OK"); - } - else if (inVal.equals("CHANGETYPE")) - { - Integer newType = new Integer(in.readLine()); - if (newType.intValue() < 1 || newType.intValue() > 3) - { - out.println("ERROR: Invalid account type: " + newType + ". Must be 1-3."); - continue; - } - accounts.modifyType(accNum, newType); - out.println("OK"); - } - else if (inVal.equals("CHANGEPIN")) - { - Integer newPin = new Integer(in.readLine()); - if ((newPin < 0) || (newPin > 9999)) - { - out.println("ERROR: Invalid pin " + newPin + ". Must be 0000-9999."); - continue; - } - accounts.modifyPin(accNum, newPin); - out.println("OK"); - } - else if (inVal.equals("CHANGEBALANCE")) - { - Double newBal = new Double(in.readLine()); - accounts.modifyBalance(accNum, newBal); - out.println("OK"); - } - } - out.println("Account Number: " + accNum + " " + - "Customer Name: " + accounts.nameString(accNum) + " " + - "Account Type: " + accounts.typeString(accNum) + " " + - "Balance: $" + accounts.getBalance(accNum) + " " + - "PIN: " + accounts.getPin(accNum) + " "); - } - - if (request.equals("TELLERVIEW")) - { - if (tellerCode == 0) - { - out.println("ERROR: Teller not logged in"); - continue; - } - out.println("OK"); - Integer accNum = new Integer(in.readLine()); - if (!accounts.accountExists(accNum)) - { - out.println("ERROR: Account " + accNum + " does not exist."); - continue; - } - out.println("OK"); - out.println("Account Number: " + accNum + " " + - "Customer Name: " + accounts.nameString(accNum) + " " + - "Account Type: " + accounts.typeString(accNum) + " " + - "Balance: $" + accounts.getBalance(accNum) + " " + - "PIN: " + accounts.getPin(accNum) + " "); - } - } - } - } - - public static void main(String [] args) - throws IOException - { - System.out.println("BankAppServer in Java"); - BankAppServer server = new BankAppServer(); - server.startServer(); - } -} - -class AccountEntry -{ - Integer accountNumber; - String firstName; - String middleName; - String lastName; - Integer accountType; - Double balance; - Integer pin; - - public AccountEntry(Integer accNum, String fName, String mName, String lName, Integer accType, Double bal, Integer pNum) - { - accountNumber = accNum; - firstName = fName; - middleName = mName; - lastName = lName; - accountType = accType; - balance = bal; - pin = pNum; - } -} - - -class AccountDatabase -{ - static int ACCOUNT_SAVINGS = 1; - static int ACCOUNT_CHECKING = 2; - static int ACCOUNT_TELLER = 3; - static int SUCCESS = 0; - static int ERROR = 1; - - static String dbfilename = "accts.txt"; - - Vector entries = null; - - public AccountDatabase() - { - entries = new Vector(); - } - - public void loadDatabase() - { - entries.removeAllElements(); - try { - BufferedReader fin = new BufferedReader(new FileReader(dbfilename)); - String str; - while ((str = fin.readLine()) != null) - { - Integer accNum = new Integer(str); - String fName = fin.readLine(); - String mName = fin.readLine(); - String lName = fin.readLine(); - Integer accType = new Integer(fin.readLine()); - Double bal = new Double(fin.readLine()); - Integer pNum = new Integer(fin.readLine()); - AccountEntry newEntry = new AccountEntry(accNum, fName, mName, lName, accType, bal, pNum); - entries.add(newEntry); - } - fin.close(); - } catch (IOException e) { - System.out.println("Cannot open database file"); - System.exit(-1); - } - printAccounts(); - } - - public void storeDatabase() - { - try { - BufferedWriter fout = new BufferedWriter(new FileWriter(dbfilename)); - for (int i = 0; i < entries.size(); i++) - { - AccountEntry acc = (AccountEntry)entries.elementAt(i); - fout.write(acc.accountNumber.toString()); - fout.newLine(); - fout.write(acc.firstName); - fout.newLine(); - fout.write(acc.middleName); - fout.newLine(); - fout.write(acc.lastName); - fout.newLine(); - fout.write(acc.accountType.toString()); - fout.newLine(); - fout.write(acc.balance.toString()); - fout.newLine(); - fout.write(acc.pin.toString()); - fout.newLine(); - } - fout.close(); - } catch (IOException e) { - System.out.println("Cannot write to database file"); - System.exit(-1); - } - } - - public AccountEntry getAccount(Integer accNum) - { - for (int i = 0; i < entries.size(); i++) - { - AccountEntry acc = (AccountEntry)entries.elementAt(i); - if (acc.accountNumber.equals(accNum)) - return acc; - } - return null; - } - - public void deposit(Integer accNum, Double amount) - { - AccountEntry acc = getAccount(accNum); - acc.balance += amount; - } - - public void withdraw(Integer accNum, Double amount) - { - AccountEntry acc = getAccount(accNum); - acc.balance -= amount; - } - - public Double getBalance(Integer accNum) - { - AccountEntry acc = getAccount(accNum); - return acc.balance; - } - - public int getPin(Integer accNum) - { - AccountEntry acc = getAccount(accNum); - if (acc != null) - return acc.pin.intValue(); - return -1; - } - - public boolean accountExists(Integer accNum) - { - AccountEntry acc = getAccount(accNum); - if (acc != null) - return true; - return false; - } - - public boolean isTeller(Integer accNum) - { - AccountEntry acc = getAccount(accNum); - if (acc.accountType.equals(ACCOUNT_TELLER)) - return true; - return false; - } - - public Integer openAccount(Integer accNum, String fName, String mName, String lName, Integer accType, Double bal, Integer pNum) - { - if (accountExists(accNum)) - return ERROR; - AccountEntry acc = new AccountEntry(accNum, fName, mName, lName, accType, bal, pNum); - entries.add(acc); - return SUCCESS; - } - - public Integer closeAccount(Integer accNum) - { - if (accountExists(accNum)) - { - AccountEntry acc = getAccount(accNum); - entries.remove(acc); - return SUCCESS; - } - else - return ERROR; - } - - public String nameString(Integer accNum) - { - AccountEntry acc = getAccount(accNum); - if (acc != null) - { - return (acc.firstName + " " + acc.middleName + " " + acc.lastName); - } - return ""; - } - - public String typeString(Integer accNum) - { - AccountEntry acc = getAccount(accNum); - if (acc != null) - { - return ((acc.accountType == ACCOUNT_SAVINGS)?"SAVINGS":(acc.accountType == ACCOUNT_CHECKING)?"CHECKING":"TELLER"); - } - return ""; - } - - public void modifyName(Integer accNum, String fName, String mName, String lName) - { - AccountEntry acc = getAccount(accNum); - if (acc != null) - { - acc.firstName = fName; - acc.middleName = mName; - acc.lastName = lName; - } - return; - } - - public void modifyType(Integer accNum, Integer newType) - { - AccountEntry acc = getAccount(accNum); - if (acc != null) - { - acc.accountType = newType; - } - return; - } - - public void modifyPin(Integer accNum, Integer newPin) - { - AccountEntry acc = getAccount(accNum); - if (acc != null) - { - acc.pin = newPin; - } - return; - } - - public void modifyBalance(Integer accNum, Double newBal) - { - AccountEntry acc = getAccount(accNum); - if (acc != null) - { - acc.balance = newBal; - } - return; - } - - public void printAccounts() - { - System.out.println("entries.size = " + entries.size()); - for (int i = 0; i < entries.size(); i++) - { - System.out.println("Entry " + i); - AccountEntry acc = entries.elementAt(i); - System.out.println("1 " + acc.accountNumber.toString()); - System.out.println("2 " + acc.firstName); - System.out.println("3 " + acc.middleName); - System.out.println("4 " + acc.lastName); - System.out.println("5 " + acc.accountType.toString()); - System.out.println("6 " + acc.balance.toString()); - System.out.println("7 " + acc.pin.toString()); - } - } -} diff --git a/Robust/src/Benchmarks/BankAppJava/BankAppTestClient.java b/Robust/src/Benchmarks/BankAppJava/BankAppTestClient.java deleted file mode 100644 index a2cc7f1b..00000000 --- a/Robust/src/Benchmarks/BankAppJava/BankAppTestClient.java +++ /dev/null @@ -1,48 +0,0 @@ -// Bank App in Java - -// Author: Danish Lakhani - -import java.io.*; -import java.net.*; - -class BankAppTestClient -{ - public static void main(String [] args) - throws IOException - { - BufferedReader local_in = new BufferedReader(new InputStreamReader(System.in)); - String sendline; - - System.out.println("Client"); - - sendline = local_in.readLine(); -if (sendline == null) - sendline = "localhost"; - System.out.println("Connecting to server..."); - Socket mySocket = new Socket(sendline, 8000); - - System.out.println("Connected!!"); - - PrintWriter out = new PrintWriter(mySocket.getOutputStream(), true); - BufferedReader in = new BufferedReader(new InputStreamReader(mySocket.getInputStream())); - - - - while (true) - { - System.out.print("Send: "); - sendline = local_in.readLine(); - - if (!sendline.equals("no")) - { - out.println(sendline); - } - else - { - System.out.print("Reading: "); - String inString = in.readLine(); - System.out.println(inString); - } - } - } -} diff --git a/Robust/src/Benchmarks/BankAppJava/accts.txt b/Robust/src/Benchmarks/BankAppJava/accts.txt deleted file mode 100644 index b75b5be0..00000000 --- a/Robust/src/Benchmarks/BankAppJava/accts.txt +++ /dev/null @@ -1,14 +0,0 @@ -1111 -Danish -Salim -Lakhani -1 -2000.0 -1234 -1000 -Danish -Teller -Lakhani -3 -0.0 -2000 diff --git a/Robust/src/Benchmarks/Chat/BRISTLECONE b/Robust/src/Benchmarks/Chat/BRISTLECONE deleted file mode 100644 index 4e3d652a..00000000 --- a/Robust/src/Benchmarks/Chat/BRISTLECONE +++ /dev/null @@ -1 +0,0 @@ --initializerandom -injectinstructionfailures 45 0.0001667 10 -debugtask diff --git a/Robust/src/Benchmarks/Chat/ChatServer.java b/Robust/src/Benchmarks/Chat/ChatServer.java deleted file mode 100644 index 773a1340..00000000 --- a/Robust/src/Benchmarks/Chat/ChatServer.java +++ /dev/null @@ -1,35 +0,0 @@ -task Startup(StartupObject s{initialstate}) { - System.printString("Chat Server Benchmark"); - RoomObject ro=new RoomObject() {Initialized}; - ServerSocket ss=new ServerSocket(8000); - taskexit(s{!initialstate}); -} - -task AcceptConnection(ServerSocket ss{SocketPending}) { - ChatSocket cs=new ChatSocket() {Initialized}; - ss.accept(cs); - cs.write("Please choose a chatroom".getBytes()); -} - -task ReadRequest(ChatSocket cs{Initialized && IOPending}) { - if (cs.processRead()) { - taskexit(cs{!Initialized, ProcessRoom}); - } -} - -task ProcessRoom(ChatSocket cs{ProcessRoom}, RoomObject ro{Initialized}) { - cs.processRoom(ro); - taskexit(cs{!ProcessRoom, InRoom}); -} - -task Message(ChatSocket cs{InRoom && IOPending}) { - byte buffer[]=new byte[1024]; - int length=cs.read(buffer); - Message m=new Message(buffer, length, cs){}; -} - -task SendMessage(Message m{!Sent}) { - String st=(new String(m.buffer)).subString(0, m.length); - m.cs.room.sendToRoom(m.cs,st.getBytes()); - taskexit(m {Sent}); -} diff --git a/Robust/src/Benchmarks/Chat/ChatSocket.java b/Robust/src/Benchmarks/Chat/ChatSocket.java deleted file mode 100644 index e7252f3b..00000000 --- a/Robust/src/Benchmarks/Chat/ChatSocket.java +++ /dev/null @@ -1,30 +0,0 @@ -public class ChatSocket extends Socket { - flag Initialized; - flag ProcessRoom; - flag InRoom; - Room room; - String roomrequest; - - public ChatSocket() { - } - - public boolean processRead() { - byte buffer[]=new byte[1024]; - int length=read(buffer); - String st=new String(buffer); - String curr=st.subString(0, length); - if (roomrequest!=null) { - StringBuffer sb=new StringBuffer(roomrequest); - sb.append(curr); - curr=sb.toString(); - } - roomrequest=curr; - if (roomrequest.indexOf("\n")>=0) { - return true; - } - return false; - } - public void processRoom(RoomObject ro) { - ro.getChatRoom(roomrequest).addParticipant(this); - } -} diff --git a/Robust/src/Benchmarks/Chat/Message.java b/Robust/src/Benchmarks/Chat/Message.java deleted file mode 100644 index 92db626d..00000000 --- a/Robust/src/Benchmarks/Chat/Message.java +++ /dev/null @@ -1,12 +0,0 @@ -public class Message { - flag Sent; - ChatSocket cs; - byte buffer[]; - int length; - - public Message(byte[] b, int l, ChatSocket cs) { - this.cs=cs; - this.buffer=b; - this.length=l; - } -} diff --git a/Robust/src/Benchmarks/Chat/NetsClient.java b/Robust/src/Benchmarks/Chat/NetsClient.java deleted file mode 100644 index 8fcb8192..00000000 --- a/Robust/src/Benchmarks/Chat/NetsClient.java +++ /dev/null @@ -1,148 +0,0 @@ -import java.awt.*; -import java.io.*; -import java.net.*; -import java.util.*; - -public class NetsClient extends Thread { - - static boolean debug; - - public static void main(String argv[]) { - - String host=null; - int numberofclients=0; - int numberofmessages=0; - int groups=0; - int port=4321; - - NetsClient.debug=false; - try { - host=argv[0]; - port=Integer.parseInt(argv[1]); - numberofclients=Integer.parseInt(argv[2]); - numberofmessages=Integer.parseInt(argv[3]); - groups=Integer.parseInt(argv[4]); - } - catch (Exception e) { - System.out.println("NetsClient host port numberofclients numberofmessages debugflag"); - } - try { - NetsClient.debug=(Integer.parseInt(argv[5])==1); - } catch (Exception e) {} - - NetsClient[][] tarray=new NetsClient[groups][numberofclients]; - for (int g=0;g0) { - int nchar=in.read(); - if (nchar==10) - lines++; - } - } - pout.flush(); - long time=System.currentTimeMillis(); - while((System.currentTimeMillis()-time)<8*1000) { - if(in.available()>0) { - int nchar=in.read(); - time=System.currentTimeMillis(); - if (nchar==10) - lines++; - } else try {Thread.sleep(2);} catch (Exception e) {} - } - } - - catch (UnknownHostException e ) {System.out.println("can't find host"); } - catch ( IOException e ) {System.out.println("Error connecting to host");} - - } - -} // end of client class diff --git a/Robust/src/Benchmarks/Chat/Room.java b/Robust/src/Benchmarks/Chat/Room.java deleted file mode 100644 index 938137c2..00000000 --- a/Robust/src/Benchmarks/Chat/Room.java +++ /dev/null @@ -1,22 +0,0 @@ -public class Room { - String name; - HashSet participants; - public Room(String n) { - name=n; - participants=new HashSet(); - } - - void addParticipant(ChatSocket cs) { - participants.add(cs); - cs.room=this; - } - - void sendToRoom(ChatSocket caller, byte [] message) { - HashMapIterator hmi=participants.iterator(); - while(hmi.hasNext()) { - ChatSocket cs=(ChatSocket) hmi.next(); - if (cs!=caller) - cs.write(message); - } - } -} diff --git a/Robust/src/Benchmarks/Chat/RoomObject.java b/Robust/src/Benchmarks/Chat/RoomObject.java deleted file mode 100644 index dd002813..00000000 --- a/Robust/src/Benchmarks/Chat/RoomObject.java +++ /dev/null @@ -1,15 +0,0 @@ -public class RoomObject { - flag Initialized; - HashMap rooms; - public RoomObject() { - rooms=new HashMap(); - } - - Room getChatRoom(String name) { - if (rooms.containsKey(name)) - return (Room) rooms.get(name); - Room r=new Room(name); - rooms.put(name, r); - return r; - } -} diff --git a/Robust/src/Benchmarks/Chat/analyze.java b/Robust/src/Benchmarks/Chat/analyze.java deleted file mode 100644 index fb376c1e..00000000 --- a/Robust/src/Benchmarks/Chat/analyze.java +++ /dev/null @@ -1,21 +0,0 @@ -import java.io.*; -public class analyze { - public static void main(String[] q) { - int sum=0; - int count=0; - try { - BufferedReader br=new BufferedReader(new InputStreamReader(System.in)); - while(true) { - String s=br.readLine(); - String x=s.substring(6,s.indexOf(' ',6)); - - sum+=(new Integer(x)).intValue(); - count++; - System.out.println(sum+" "+(((double)sum)/count)); - } - } catch(Exception e) {} - } - - - -} diff --git a/Robust/src/Benchmarks/Chat/doall b/Robust/src/Benchmarks/Chat/doall deleted file mode 100755 index c2f94651..00000000 --- a/Robust/src/Benchmarks/Chat/doall +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -./runtest.sh taskchat.bin &> tasklog -mkdir task -mv *.log task -./runtest.sh threadchat.bin &> threadlog -mkdir thread -mv *.log thread \ No newline at end of file diff --git a/Robust/src/Benchmarks/Chat/runtest.sh b/Robust/src/Benchmarks/Chat/runtest.sh deleted file mode 100755 index 81be1579..00000000 --- a/Robust/src/Benchmarks/Chat/runtest.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -let i=0 -while [ $i -le 100 ]; -do -./$1 &> $i.log & -sleep 1 -java NetsClient 127.0.0.1 8000 2 50 8 1 -killall -SIGUSR2 $1 -sleep 1 -killall -9 $1 -let "i+=1" -done \ No newline at end of file diff --git a/Robust/src/Benchmarks/ChatJava/ChatServer.java b/Robust/src/Benchmarks/ChatJava/ChatServer.java deleted file mode 100644 index 3c724215..00000000 --- a/Robust/src/Benchmarks/ChatJava/ChatServer.java +++ /dev/null @@ -1,17 +0,0 @@ -public class ChatServer { - - public static int main(String arg[]) { - System.printString("Chat Server Benchmark"); - RoomObject ro=new RoomObject(); - ServerSocket ss=new ServerSocket(8000); - acceptConnection(ss,ro); - } - - public static void acceptConnection(ServerSocket ss, RoomObject ro) { - while(true) { - Socket s=ss.accept(); - ChatThread cs=new ChatThread(s, ro); - cs.start(); - } - } -} diff --git a/Robust/src/Benchmarks/ChatJava/ChatThread.java b/Robust/src/Benchmarks/ChatJava/ChatThread.java deleted file mode 100644 index af0d5ade..00000000 --- a/Robust/src/Benchmarks/ChatJava/ChatThread.java +++ /dev/null @@ -1,57 +0,0 @@ -public class ChatThread extends Thread { - Room room; - String roomrequest; - Socket sock; - RoomObject ro; - - public ChatThread(Socket sock, RoomObject ro) { - this.sock=sock; - this.ro=ro; - } - - public void run() { - sock.write("Please choose a chatroom".getBytes()); - ReadRequest(); - ProcessRoom(); - while(true) - Message(); - } - - public void ReadRequest() { - while (!processRead()) - ; - } - - private void ProcessRoom() { - processRoom(ro); - } - - public void Message() { - byte buffer[]=new byte[1024]; - int length=sock.read(buffer); - if (length>0) { - String st=(new String(buffer)).subString(0, length); - room.sendToRoom(this, st.getBytes()); - } - } - - public boolean processRead() { - byte buffer[]=new byte[1024]; - int length=sock.read(buffer); - String st=new String(buffer); - String curr=st.subString(0, length); - if (roomrequest!=null) { - StringBuffer sb=new StringBuffer(roomrequest); - sb.append(curr); - curr=sb.toString(); - } - roomrequest=curr; - if (roomrequest.indexOf("\n")>=0) { - return true; - } - return false; - } - public void processRoom(RoomObject ro) { - ro.getChatRoom(roomrequest).addParticipant(this); - } -} diff --git a/Robust/src/Benchmarks/ChatJava/Room.java b/Robust/src/Benchmarks/ChatJava/Room.java deleted file mode 100644 index d43d83c2..00000000 --- a/Robust/src/Benchmarks/ChatJava/Room.java +++ /dev/null @@ -1,22 +0,0 @@ -public class Room { - String name; - HashSet participants; - public Room(String n) { - name=n; - participants=new HashSet(); - } - - synchronized void addParticipant(ChatThread cs) { - participants.add(cs); - cs.room=this; - } - - synchronized void sendToRoom(ChatThread caller, byte [] message) { - HashMapIterator hmi=participants.iterator(); - while(hmi.hasNext()) { - ChatThread cs=(ChatThread) hmi.next(); - if (cs!=caller) - cs.sock.write(message); - } - } -} diff --git a/Robust/src/Benchmarks/ChatJava/RoomObject.java b/Robust/src/Benchmarks/ChatJava/RoomObject.java deleted file mode 100644 index 015a402a..00000000 --- a/Robust/src/Benchmarks/ChatJava/RoomObject.java +++ /dev/null @@ -1,14 +0,0 @@ -public class RoomObject { - HashMap rooms; - public RoomObject() { - rooms=new HashMap(); - } - - synchronized Room getChatRoom(String name) { - if (rooms.containsKey(name)) - return (Room) rooms.get(name); - Room r=new Room(name); - rooms.put(name, r); - return r; - } -} diff --git a/Robust/src/Benchmarks/ChatTag/ChatServer.java b/Robust/src/Benchmarks/ChatTag/ChatServer.java deleted file mode 100644 index 184d75bb..00000000 --- a/Robust/src/Benchmarks/ChatTag/ChatServer.java +++ /dev/null @@ -1,36 +0,0 @@ -task Startup(StartupObject s{initialstate}) { - System.printString("Chat Server Benchmark"); - RoomObject ro=new RoomObject() {Initialized}; - ServerSocket ss=new ServerSocket(8000); - taskexit(s{!initialstate}); -} - -task AcceptConnection(ServerSocket ss{SocketPending}) { - tag t=new tag(link); - ChatSocket cs=new ChatSocket() {Initialized}{t}; - cs.sock=ss.accept(t); - cs.sock.write("Please choose a chatroom".getBytes()); -} - -task ReadRequest(ChatSocket cs{Initialized}{link l}, Socket s{IOPending}{link l}) { - if (cs.processRead(s)) { - taskexit(cs{!Initialized, ProcessRoom}); - } -} - -task ProcessRoom(ChatSocket cs{ProcessRoom}, RoomObject ro{Initialized}) { - cs.processRoom(ro); - taskexit(cs{!ProcessRoom, InRoom}); -} - -task Message(ChatSocket cs{InRoom}{link l}, Socket s{IOPending}{link l}) { - byte buffer[]=new byte[1024]; - int length=s.read(buffer); - Message m=new Message(buffer, length, cs){}; -} - -task SendMessage(Message m{!Sent}) { - String st=(new String(m.buffer)).subString(0, m.length); - m.cs.room.sendToRoom(m.cs,st.getBytes()); - taskexit(m {Sent}); -} diff --git a/Robust/src/Benchmarks/ChatTag/ChatSocket.java b/Robust/src/Benchmarks/ChatTag/ChatSocket.java deleted file mode 100644 index 9923f91d..00000000 --- a/Robust/src/Benchmarks/ChatTag/ChatSocket.java +++ /dev/null @@ -1,31 +0,0 @@ -public class ChatSocket { - flag Initialized; - flag ProcessRoom; - flag InRoom; - Room room; - String roomrequest; - Socket sock; - - public ChatSocket() { - } - - public boolean processRead(Socket s) { - byte buffer[]=new byte[1024]; - int length=s.read(buffer); - String st=new String(buffer); - String curr=st.subString(0, length); - if (roomrequest!=null) { - StringBuffer sb=new StringBuffer(roomrequest); - sb.append(curr); - curr=sb.toString(); - } - roomrequest=curr; - if (roomrequest.indexOf("\n")>=0) { - return true; - } - return false; - } - public void processRoom(RoomObject ro) { - ro.getChatRoom(roomrequest).addParticipant(this); - } -} diff --git a/Robust/src/Benchmarks/ChatTag/Message.java b/Robust/src/Benchmarks/ChatTag/Message.java deleted file mode 100644 index 92db626d..00000000 --- a/Robust/src/Benchmarks/ChatTag/Message.java +++ /dev/null @@ -1,12 +0,0 @@ -public class Message { - flag Sent; - ChatSocket cs; - byte buffer[]; - int length; - - public Message(byte[] b, int l, ChatSocket cs) { - this.cs=cs; - this.buffer=b; - this.length=l; - } -} diff --git a/Robust/src/Benchmarks/ChatTag/Room.java b/Robust/src/Benchmarks/ChatTag/Room.java deleted file mode 100644 index 470680a8..00000000 --- a/Robust/src/Benchmarks/ChatTag/Room.java +++ /dev/null @@ -1,22 +0,0 @@ -public class Room { - String name; - HashSet participants; - public Room(String n) { - name=n; - participants=new HashSet(); - } - - void addParticipant(ChatSocket cs) { - participants.add(cs); - cs.room=this; - } - - void sendToRoom(ChatSocket caller, byte [] message) { - HashMapIterator hmi=participants.iterator(); - while(hmi.hasNext()) { - ChatSocket cs=(ChatSocket) hmi.next(); - if (cs!=caller) - cs.sock.write(message); - } - } -} diff --git a/Robust/src/Benchmarks/ChatTag/RoomObject.java b/Robust/src/Benchmarks/ChatTag/RoomObject.java deleted file mode 100644 index dd002813..00000000 --- a/Robust/src/Benchmarks/ChatTag/RoomObject.java +++ /dev/null @@ -1,15 +0,0 @@ -public class RoomObject { - flag Initialized; - HashMap rooms; - public RoomObject() { - rooms=new HashMap(); - } - - Room getChatRoom(String name) { - if (rooms.containsKey(name)) - return (Room) rooms.get(name); - Room r=new Room(name); - rooms.put(name, r); - return r; - } -} diff --git a/Robust/src/Benchmarks/Conglomerator/Java/Google.java b/Robust/src/Benchmarks/Conglomerator/Java/Google.java deleted file mode 100644 index 496017ad..00000000 --- a/Robust/src/Benchmarks/Conglomerator/Java/Google.java +++ /dev/null @@ -1,10 +0,0 @@ -public class Google extends Lookup{ - public Google() { - url=""; - hostname="www.google.com"; - start=""; - end=""; - exclusive=true; - } - -} diff --git a/Robust/src/Benchmarks/Conglomerator/Java/Inventory.java b/Robust/src/Benchmarks/Conglomerator/Java/Inventory.java deleted file mode 100644 index 4cfcdf45..00000000 --- a/Robust/src/Benchmarks/Conglomerator/Java/Inventory.java +++ /dev/null @@ -1,88 +0,0 @@ -public class Inventory { - // Transaction variables - int numitems; - HashMap map; - int balance; - - // Constructor - public Inventory(){ - map = new HashMap(); - balance=100000; - } - - public Inventory(int howmany) { - numitems = howmany;// howmany keeps track of the number of items - // in the inventory - map = new HashMap(); - } - - // Add item to a list of inventory - public int additem(String name, int quantity, int price){ - ItemInfo newitem = new ItemInfo(quantity, price); - balance-=quantity*price; - - // Get the item from hash - if (map.containsKey(name) == false) { - map.put(name, newitem); - } else { - ItemInfo i = (ItemInfo) map.get(name); - i.quantity += quantity; - i.price = price; - map.put(name, i); - } - return 0; - } - - // Buy item from a given list of inventory - public int buyitem(String name, int quantity){ - if (map.containsKey(name) == false) { - // System.printString("Error - Item does not exist"); - return -1; - } else { - ItemInfo i = (ItemInfo) map.get(name); - if (i.quantity == 0) { - // System.printString("Error - Item unavailable"); - return -1; - } - if ((i.quantity-quantity) < 0 ) { - // System.printString("Error - Available qty is less: Cannot Buy\n"); - return -1; - } else { - i.quantity -= quantity; - map.put(name, i); - balance+=quantity*i.price; - return i.price; - } - } - return 0; - } - - //Display the inventory list - //Display the inventory list - public synchronized void inventory(Socket s){ - HashMapIterator i = new HashMapIterator(map, 0);// Gets key from the hashmap= name of item - HashMapIterator j = new HashMapIterator(map, 1);//Gets the value from hashmap - int totalvalue=balance; - while (i.hasNext() == true) { - StringBuffer sb = new StringBuffer(""); - Object o = i.next(); - String name = o.toString(); - ItemInfo oo = (ItemInfo) j.next(); - sb.append(name); - sb.append(" "); - Integer q = new Integer(oo.quantity); - sb.append(q.toString()); - sb.append(" "); - Integer p = new Integer(oo.price); - sb.append(p.toString()); - sb.append("\n"); - totalvalue+=oo.quantity*oo.price; - s.write(sb.toString().getBytes()); - } - StringBuffer sb=new StringBuffer(""); - sb.append("Total value: "); - sb.append((new Integer(totalvalue)).toString()); - sb.append("\n"); - s.write(sb.toString().getBytes()); - } -} diff --git a/Robust/src/Benchmarks/Conglomerator/Java/ItemInfo.java b/Robust/src/Benchmarks/Conglomerator/Java/ItemInfo.java deleted file mode 100644 index 18a61a59..00000000 --- a/Robust/src/Benchmarks/Conglomerator/Java/ItemInfo.java +++ /dev/null @@ -1,8 +0,0 @@ -class ItemInfo { - int quantity; - int price; - ItemInfo(int x, int y) { - quantity = x; - price = y; - } -} diff --git a/Robust/src/Benchmarks/Conglomerator/Java/Logger.java b/Robust/src/Benchmarks/Conglomerator/Java/Logger.java deleted file mode 100644 index 4d8b739d..00000000 --- a/Robust/src/Benchmarks/Conglomerator/Java/Logger.java +++ /dev/null @@ -1,27 +0,0 @@ -public class Logger { - FileOutputStream fos; - - - //Constructor - public Logger(){ - fos=new FileOutputStream("request.log");//Open request.log file - } - - //Logs filename as per client requests - public void logrequest(String filename){ - String request = new String("\nNew Request received: "); - fos.write(request.getBytes()); - fos.write(filename.getBytes()); - fos.flush(); - } - - public void logrequest(){ - String request = new String("\nNew Request received: "); - fos.write(request.getBytes()); - fos.flush(); - } - - public void closerequest() { - fos.close(); - } -} diff --git a/Robust/src/Benchmarks/Conglomerator/Java/Lookup.java b/Robust/src/Benchmarks/Conglomerator/Java/Lookup.java deleted file mode 100644 index 75640db6..00000000 --- a/Robust/src/Benchmarks/Conglomerator/Java/Lookup.java +++ /dev/null @@ -1,37 +0,0 @@ -public class Lookup { - boolean exclusive; - String url; - String hostname; - String data; - String start; - String end; - Socket s; - - public void fix() { - int istart=data.indexOf(start); - int iend=data.indexOf(end); - if (exclusive) - data=data.substring(istart+start.length(), iend); - else - data=data.substring(istart, iend+end.length()); - String m1="src=\"/"; - String m2="src=\'/"; - String m3="href=\"/"; - boolean cnt=true; - while(cnt) { - if (data.indexOf(m1)!=-1) { - int index=data.indexOf(m1)-1; - data=data.substring(0,index+m1.length())+"http://"+hostname+data.substring(index+m1.length(),data.length()); - } else if (data.indexOf(m2)!=-1) { - int index=data.indexOf(m2)-1; - data=data.substring(0,index+m2.length())+"http://"+hostname+data.substring(index+m2.length(),data.length()); - } else if (data.indexOf(m3)!=-1) { - int index=data.indexOf(m3)-1; - data=data.substring(0,index+m3.length())+"http://"+hostname+data.substring(index+m3.length(),data.length()); - } else cnt=false; - } - - } - - -} diff --git a/Robust/src/Benchmarks/Conglomerator/Java/Stock.java b/Robust/src/Benchmarks/Conglomerator/Java/Stock.java deleted file mode 100644 index f9f6ac8e..00000000 --- a/Robust/src/Benchmarks/Conglomerator/Java/Stock.java +++ /dev/null @@ -1,10 +0,0 @@ -public class Stock extends Lookup { - public Stock() { - url="q?s=%5EDJI"; - hostname="finance.yahoo.com"; - start=""; - end=""; - exclusive=true; - } - -} diff --git a/Robust/src/Benchmarks/Conglomerator/Java/Weather.java b/Robust/src/Benchmarks/Conglomerator/Java/Weather.java deleted file mode 100644 index ea4d7850..00000000 --- a/Robust/src/Benchmarks/Conglomerator/Java/Weather.java +++ /dev/null @@ -1,9 +0,0 @@ -public class Weather extends Lookup{ - public Weather() { - url="warnings.php?wfo=sgx&zone=CAZ042&pil=XXXHWOSGX&productType=Hazardous+Weather+Outlook"; - hostname="www.wrh.noaa.gov"; - start="Hazardous Weather Outlook"; - end="$$"; - } - -} diff --git a/Robust/src/Benchmarks/Conglomerator/Java/WebServerExample.java b/Robust/src/Benchmarks/Conglomerator/Java/WebServerExample.java deleted file mode 100644 index f18f198e..00000000 --- a/Robust/src/Benchmarks/Conglomerator/Java/WebServerExample.java +++ /dev/null @@ -1,93 +0,0 @@ -public class WebServerExample extends Thread { -/* Startup object is generated with the initialstate flag set by the - * system to start the computation up */ - Logger log; - WebServerSocket web; - Socket s; - - public WebServerExample(WebServerSocket web, Socket s, Logger log) { - this.web=web; - this.s=s; - this.log=log; - } - - public static void main(String x[]) { - ServerSocket ss = new ServerSocket(9000); - Logger log = new Logger(); - while(true) { - Socket s=ss.accept(); - WebServerSocket web = new WebServerSocket(); - WebServerExample wse=new WebServerExample(web, s, log); - wse.start(); - } - } - - public void doLookup(Lookup l) { - String query="GET /"+l.url+" HTTP/1.1\r\nConnection: close\r\nHost:"+l.hostname+"\r\n\r\n"; - l.s=new Socket(l.hostname, 80); - l.s.write(query.getBytes()); - } - - public void ReceiveQuery(Lookup l) { - byte[] buffer=new byte[1024]; - boolean cnt=true; - - while(cnt) { - int numchars=l.s.read(buffer); - if (numchars<=0) { - l.fix(); - l.s.close(); - return; - } - String str=new String(buffer, 0, numchars); - if (l.data==null) { - l.data=str; - } else - l.data=l.data+str; - } - } - - public void run() { - ProcessRequest(); - } - - public void ProcessRequest() { - if (web.clientrequest(s)) { - if(web.checktrans()==false) { - LogRequest(); - SendFile(); - } else { - Weather w=new Weather(); - Google g=new Google(); - Stock st=new Stock(); - doLookup(w); - ReceiveQuery(w); - doLookup(g); - ReceiveQuery(g); - doLookup(st); - ReceiveQuery(st); - LogRequest(); - Transaction(w, g, st); - } - } - } - - public void SendFile() { - web.sendfile(s); - s.close(); - } - - public void LogRequest() { - log.logrequest(web.filename); - } - - public void Transaction(Weather weather, Google g, Stock st){ - web.httpresponse(s); - s.write(("").getBytes()); - s.write(weather.data.getBytes()); - s.write(g.data.getBytes()); - s.write(st.data.getBytes()); - s.write(("").getBytes()); - s.close(); - } -} diff --git a/Robust/src/Benchmarks/Conglomerator/Java/WebServerSocket.java b/Robust/src/Benchmarks/Conglomerator/Java/WebServerSocket.java deleted file mode 100644 index 354b48dc..00000000 --- a/Robust/src/Benchmarks/Conglomerator/Java/WebServerSocket.java +++ /dev/null @@ -1,135 +0,0 @@ -public class WebServerSocket { - //Filename requested by the client - String filename; - String[] parsed; - String prefix; - - //Constructor - public WebServerSocket(){ - parsed = new String[4]; - } - - //Send the http header for web browser display - public void httpresponse(Socket s){ - StringBuffer header = new StringBuffer("HTTP/1.0 200 OK\n"); - header.append("Content-type: text/html\n"); - header.append("\n\n"); - String temp_str = new String(header); - s.write(temp_str.getBytes()); - return; - - } - - // Send the html file , read from file one byte at a time - public void sendfile(Socket s) { - StringBuffer req_file = new StringBuffer("./htmlfiles/"); - req_file.append(filename); - String filepath = new String(req_file); - FileInputStream def_file = new FileInputStream(filepath); - int status = def_file.getfd();//Checks if the file is present in - //current directory - httpresponse(s); - if (status == -1){ - StringBuffer response = new StringBuffer("404: not found: ");//Send 404 error if - // file not found - response.append(filename); - String buffer = new String(response); - s.write(buffer.getBytes()); - def_file.close(); - return; - } - byte buf[] = new byte[16]; - int ret; - - while ((ret = def_file.read(buf)) > 0) {// Read from file and write - // one byte at a time into the socket - byte tosend[] = new byte[ret]; - for (int i = 0; i < ret; i++) { - tosend[i] = buf[i]; - } - s.write(tosend); - //String str = new String(tosend); - } - def_file.close(); - } - - //Read the client request and extract the filename from it - public boolean clientrequest(Socket s){ - byte b1[] = new byte[1024]; - int numbytes=s.read(b1);//Read client request from web server socket - String curr=(new String(b1)).subString(0, numbytes); - if (prefix!=null) { - StringBuffer sb=new StringBuffer(prefix); - sb.append(curr); - curr=sb.toString(); - } - prefix=curr; - if(prefix.indexOf("\r\n\r\n")>=0) { - - int index = prefix.indexOf('/');//Parse the GET client request to find filename - int end = prefix.indexOf('H'); - filename = prefix.subString((index+1), (end-1)); - return true; - } - return false; - } - - // Parse for the prefix in the client request - // This is helpful to find if the prefix is a special transaction - public boolean checktrans(){ - if (filename.startsWith("portal") == true) { - return true; - } else { - return false; - } - } - - //Parse for the substrings in the filename and use it to obtain the - //kind of operation, name of item, quantity of item, price of item - //e.g. trans_add_car_2_10000 is the filename - //store in the parsed[] string , add,car,2,1000 - public int parseTransaction(){ - int start = filename.indexOf('_'); - String s = filename.subString(start+1); - - if (s.startsWith("add")==true){ - // System.printString("DEBUG > ADD\n"); - int i1 = s.indexOf('_'); - parsed[0] = new String(s.subString(0,i1)); - - int i2 = s.indexOf('_',i1+1); - parsed[1] = new String(s.subString(i1+1,i2)); - - int i3 = s.indexOf('_',i2+1); - parsed[2] = new String(s.subString(i2+1,i3)); - - String s3 = s.subString(i3+1); - parsed[3] = s3; - - return 0; - - } - if (s.startsWith("buy")==true){ - // System.printString("DEBUG > BUY\n"); - int i1 = s.indexOf('_'); - parsed[0] = s.subString(0,i1); - - int i2 = s.indexOf('_', i1+1); - parsed[1] = s.subString(i1+1,i2); - - String s2 = s.subString(i2+1); - parsed[2] = s2; - - parsed[3] = ""; - - return 1; - } - if (s.startsWith("inventory")==true){ - // System.printString("DEBUG > INVENTORY\n"); - return 2; - - } - // Error transaction - return -1; - } -} diff --git a/Robust/src/Benchmarks/Conglomerator/Tag/Google.java b/Robust/src/Benchmarks/Conglomerator/Tag/Google.java deleted file mode 100644 index 496017ad..00000000 --- a/Robust/src/Benchmarks/Conglomerator/Tag/Google.java +++ /dev/null @@ -1,10 +0,0 @@ -public class Google extends Lookup{ - public Google() { - url=""; - hostname="www.google.com"; - start=""; - end=""; - exclusive=true; - } - -} diff --git a/Robust/src/Benchmarks/Conglomerator/Tag/Inventory.java b/Robust/src/Benchmarks/Conglomerator/Tag/Inventory.java deleted file mode 100644 index 40581a00..00000000 --- a/Robust/src/Benchmarks/Conglomerator/Tag/Inventory.java +++ /dev/null @@ -1,89 +0,0 @@ -public class Inventory { - flag TransInitialize; - // Transaction variables - int numitems; - HashMap map; - int balance; - - // Constructor - public Inventory(){ - map = new HashMap(); - balance=100000; - } - - public Inventory(int howmany) { - numitems = howmany;// howmany keeps track of the number of items - // in the inventory - map = new HashMap(); - } - - // Add item to a list of inventory - public int additem(String name, int quantity, int price){ - ItemInfo newitem = new ItemInfo(quantity, price); - balance-=quantity*price; - - // Get the item from hash - if (map.containsKey(name) == false) { - map.put(name, newitem); - } else { - ItemInfo i = (ItemInfo) map.get(name); - i.quantity += quantity; - i.price = price; - map.put(name, i); - } - return 0; - } - - // Buy item from a given list of inventory - public int buyitem(String name, int quantity){ - if (map.containsKey(name) == false) { - // System.printString("Error - Item does not exist"); - return -1; - } else { - ItemInfo i = (ItemInfo) map.get(name); - if (i.quantity == 0) { - // System.printString("Error - Item unavailable"); - return -1; - } - if ((i.quantity-quantity) < 0 ) { - // System.printString("Error - Available qty is less: Cannot Buy\n"); - return -1; - } else { - i.quantity -= quantity; - map.put(name, i); - balance+=quantity*i.price; - return i.price; - } - } - return 0; - } - - //Display the inventory list - //Display the inventory list - public synchronized void inventory(Socket s){ - HashMapIterator i = new HashMapIterator(map, 0);// Gets key from the hashmap= name of item - HashMapIterator j = new HashMapIterator(map, 1);//Gets the value from hashmap - int totalvalue=balance; - while (i.hasNext() == true) { - StringBuffer sb = new StringBuffer(""); - Object o = i.next(); - String name = o.toString(); - ItemInfo oo = (ItemInfo) j.next(); - sb.append(name); - sb.append(" "); - Integer q = new Integer(oo.quantity); - sb.append(q.toString()); - sb.append(" "); - Integer p = new Integer(oo.price); - sb.append(p.toString()); - sb.append("\n"); - totalvalue+=oo.quantity*oo.price; - s.write(sb.toString().getBytes()); - } - StringBuffer sb=new StringBuffer(""); - sb.append("Total value: "); - sb.append((new Integer(totalvalue)).toString()); - sb.append("\n"); - s.write(sb.toString().getBytes()); - } -} diff --git a/Robust/src/Benchmarks/Conglomerator/Tag/ItemInfo.java b/Robust/src/Benchmarks/Conglomerator/Tag/ItemInfo.java deleted file mode 100644 index 18a61a59..00000000 --- a/Robust/src/Benchmarks/Conglomerator/Tag/ItemInfo.java +++ /dev/null @@ -1,8 +0,0 @@ -class ItemInfo { - int quantity; - int price; - ItemInfo(int x, int y) { - quantity = x; - price = y; - } -} diff --git a/Robust/src/Benchmarks/Conglomerator/Tag/Logger.java b/Robust/src/Benchmarks/Conglomerator/Tag/Logger.java deleted file mode 100644 index c5aa2111..00000000 --- a/Robust/src/Benchmarks/Conglomerator/Tag/Logger.java +++ /dev/null @@ -1,28 +0,0 @@ -public class Logger { - flag Initialize; - FileOutputStream fos; - - - //Constructor - public Logger(){ - fos=new FileOutputStream("request.log");//Open request.log file - } - - //Logs filename as per client requests - public void logrequest(String filename){ - String request = new String("\nNew Request received: "); - fos.write(request.getBytes()); - fos.write(filename.getBytes()); - fos.flush(); - } - - public void logrequest(){ - String request = new String("\nNew Request received: "); - fos.write(request.getBytes()); - fos.flush(); - } - - public void closerequest() { - fos.close(); - } -} diff --git a/Robust/src/Benchmarks/Conglomerator/Tag/Lookup.java b/Robust/src/Benchmarks/Conglomerator/Tag/Lookup.java deleted file mode 100644 index 468276ca..00000000 --- a/Robust/src/Benchmarks/Conglomerator/Tag/Lookup.java +++ /dev/null @@ -1,62 +0,0 @@ -public class Lookup extends Socket { - flag query; - flag initialstate; - flag done; - - boolean exclusive; - String url; - String hostname; - String data; - String start; - String end; - - public void doLookup() { - String query="GET /"+url+" HTTP/1.1\r\nConnection: close\r\nHost:"+hostname+"\r\n\r\n"; - connect(hostname, 80); - write(query.getBytes()); - } - - public boolean Receive() { - byte[] buffer=new byte[1024]; - int numchars=read(buffer); - if (numchars<=0) { - fix(); - close(); - return true; - } - String str=new String(buffer, 0, numchars); - if (data==null) { - data=str; - } else - data=data+str; - return false; - } - - public void fix() { - int istart=data.indexOf(start); - int iend=data.indexOf(end); - if (exclusive) - data=data.substring(istart+start.length(), iend); - else - data=data.substring(istart, iend+end.length()); - String m1="src=\"/"; - String m2="src=\'/"; - String m3="href=\"/"; - boolean cnt=true; - while(cnt) { - if (data.indexOf(m1)!=-1) { - int index=data.indexOf(m1)-1; - data=data.substring(0,index+m1.length())+"http://"+hostname+data.substring(index+m1.length(),data.length()); - } else if (data.indexOf(m2)!=-1) { - int index=data.indexOf(m2)-1; - data=data.substring(0,index+m2.length())+"http://"+hostname+data.substring(index+m2.length(),data.length()); - } else if (data.indexOf(m3)!=-1) { - int index=data.indexOf(m3)-1; - data=data.substring(0,index+m3.length())+"http://"+hostname+data.substring(index+m3.length(),data.length()); - } else cnt=false; - } - - } - - -} diff --git a/Robust/src/Benchmarks/Conglomerator/Tag/MySocket.java b/Robust/src/Benchmarks/Conglomerator/Tag/MySocket.java deleted file mode 100644 index 0cd3befa..00000000 --- a/Robust/src/Benchmarks/Conglomerator/Tag/MySocket.java +++ /dev/null @@ -1,6 +0,0 @@ -public class MySocket extends Socket { - public MySocket() { - } - - -} diff --git a/Robust/src/Benchmarks/Conglomerator/Tag/Nrm/WebServerExample.java b/Robust/src/Benchmarks/Conglomerator/Tag/Nrm/WebServerExample.java deleted file mode 100644 index d28b3554..00000000 --- a/Robust/src/Benchmarks/Conglomerator/Tag/Nrm/WebServerExample.java +++ /dev/null @@ -1,136 +0,0 @@ -/* Startup object is generated with the initialstate flag set by the - * system to start the computation up */ - -// Create New ServerSocket -task Startup(StartupObject s {initialstate}) { - ServerSocket ss = new ServerSocket(9000); - Logger log = new Logger() {Initialize}; - Inventory inventorylist = new Inventory(){TransInitialize}; - taskexit(s {!initialstate}); /* Turns initial state flag off, so this task won't refire */ -} - -task LookupS(Stock l{initialstate}) { - String query="GET /"+l.url+" HTTP/1.1\r\nConnection: close\r\nHost:"+l.hostname+"\r\n\r\n"; - l.connect(l.hostname, 80); - l.write(query.getBytes()); - taskexit(l{!initialstate, query}); -} - -task ReceiveQueryS(Stock l{query&&IOPending}) { - byte[] buffer=new byte[1024]; - int numchars=l.read(buffer); - if (numchars<=0) { - l.fix(); - l.close(); - taskexit(l{!query,done}{}); - } - String str=new String(buffer, 0, numchars); - if (l.data==null) { - l.data=str; - } else - l.data=l.data+str; - taskexit; -} - -task LookupG(Google l{initialstate}) { - String query="GET /"+l.url+" HTTP/1.1\r\nConnection: close\r\nHost:"+l.hostname+"\r\n\r\n"; - l.connect(l.hostname, 80); - l.write(query.getBytes()); - taskexit(l{!initialstate, query}); -} - -task ReceiveQueryG(Google l{query&&IOPending}) { - byte[] buffer=new byte[1024]; - int numchars=l.read(buffer); - if (numchars<=0) { - l.fix(); - l.close(); - taskexit(l{!query,done}{}); - } - String str=new String(buffer, 0, numchars); - if (l.data==null) { - l.data=str; - } else - l.data=l.data+str; - - taskexit; -} - -task LookupW(Weather l{initialstate}) { - String query="GET /"+l.url+" HTTP/1.1\r\nConnection: close\r\nHost:"+l.hostname+"\r\n\r\n"; - l.connect(l.hostname, 80); - l.write(query.getBytes()); - taskexit(l{!initialstate, query}); -} - -task ReceiveQueryW(Weather l{query&&IOPending}) { - byte[] buffer=new byte[1024]; - int numchars=l.read(buffer); - if (numchars<=0) { - l.fix(); - l.close(); - taskexit(l{!query,done}{}); - } - String str=new String(buffer, 0, numchars); - if (l.data==null) { - l.data=str; - } else - l.data=l.data+str; - taskexit; -} - - - -//Listen for a request and accept request -task AcceptConnection(ServerSocket ss{SocketPending}) { - // System.printString("W> Waiting for connection...\n"); - tag t=new tag(link); - WebServerSocket web = new WebServerSocket() {!WritePending, !TransPending, WebInitialize}{t}; - MySocket ms=new MySocket(){}{t}; - ss.accept(ms); -// System.printString("W> Connected... \n"); -} - -// Process the incoming http request -task ProcessRequest(WebServerSocket web{WebInitialize}{link l}, MySocket s{IOPending}{link l}) { - if (web.clientrequest(s)) { - if(web.checktrans()==false) - // Not special transaction , do normal filesending - taskexit(web {WritePending, LogPending,!WebInitialize}); //Sets the WritePending and LogPending flag true - else { - Weather w=new Weather(){initialstate}{l}; - Google g=new Google(){initialstate}{l}; - Stock st=new Stock(){initialstate}{l}; - taskexit(web {TransPending, LogPending,!WebInitialize}); - } - } -} - -//Do the WriteIO on server socket and send the requested file to Client -task SendFile(WebServerSocket web{WritePending}{link l}, MySocket s{}{link l}) { -// System.printString("W> Inside SendFile ... \n"); - web.sendfile(s); - s.close(); - taskexit(web {!WritePending}); -} - -// Log the Client request -task LogRequest(WebServerSocket web{LogPending}, Logger log{Initialize}) { -//Task fired when both -// LogPending and Initialize flags are true -// System.printString("L > Inside logrequest\n"); - log.logrequest(web.filename); - taskexit(web {!LogPending}); -} - -//Transaction on Inventory -task Transaction(WebServerSocket web{TransPending}{link l}, Weather weather{done}{link l}, Google g{done}{link l}, MySocket s{}{link l}, Stock st{done}{link l}){ //Task for WebServerTransactions - web.httpresponse(s); - s.write(("").getBytes()); - s.write(weather.data.getBytes()); - s.write(g.data.getBytes()); - s.write(st.data.getBytes()); - s.write(("").getBytes()); - s.close(); - taskexit(web {!TransPending}); -} diff --git a/Robust/src/Benchmarks/Conglomerator/Tag/Opt/WebServerExampleOpt.java b/Robust/src/Benchmarks/Conglomerator/Tag/Opt/WebServerExampleOpt.java deleted file mode 100644 index df43e906..00000000 --- a/Robust/src/Benchmarks/Conglomerator/Tag/Opt/WebServerExampleOpt.java +++ /dev/null @@ -1,82 +0,0 @@ -/* Startup object is generated with the initialstate flag set by the - * system to start the computation up */ - -task Startup(StartupObject s {initialstate}) { - ServerSocket ss = new ServerSocket(9000); - Logger log = new Logger() {Initialize}; - Inventory inventorylist = new Inventory(){TransInitialize}; - taskexit(s {!initialstate}); /* Turns initial state flag off, so this task won't refire */ -} - -task LookupS(Stock l{initialstate}) { - l.doLookup(); - taskexit(l{!initialstate, query}); -} - -task ReceiveQueryS(Stock l{query&&IOPending}) { - if (l.Receive()) taskexit(l{!query,done}{}); else taskexit; -} - -task LookupW(Weather l{initialstate}) { - l.doLookup(); - taskexit(l{!initialstate, query}); -} - -task ReceiveQueryW(Weather l{query&&IOPending}) { - if (l.Receive()) taskexit(l{!query,done}{}); else taskexit; -} - -task LookupG(Google l{initialstate}) { - l.doLookup(); - taskexit(l{!initialstate, query}); -} - -task ReceiveQueryG(Google l{query&&IOPending}) { - if (l.Receive()) taskexit(l{!query,done}{}); else taskexit; -} - -task AcceptConnection(ServerSocket ss{SocketPending}) { - tag t=new tag(link); - WebServerSocket web = new WebServerSocket() {!WritePending, !TransPending, WebInitialize}{t}; - MySocket ms=new MySocket(){}{t}; - ss.accept(ms); -} - -task ProcessRequest(WebServerSocket web{WebInitialize}{link l}, MySocket s{IOPending}{link l}) { - if (web.clientrequest(s)) { - if(web.checktrans()==false) - taskexit(web {WritePending, LogPending,!WebInitialize}); - else { - Weather w=new Weather(){initialstate}{l}; - Google g=new Google(){initialstate}{l}; - Stock st=new Stock(){initialstate}{l}; - taskexit(web {TransPending, LogPending,!WebInitialize}); - } - } -} - -task SendFile(WebServerSocket web{WritePending}{link l}, MySocket s{}{link l}) { - web.sendfile(s); - s.close(); - taskexit(web {!WritePending}); -} - -task LogRequest(WebServerSocket web{LogPending}, Logger log{Initialize}) { - log.logrequest(web.filename); - taskexit(web {!LogPending}); -} - -task Transaction(WebServerSocket web{TransPending}{link l}, optional Weather weather{done}{link l}, optional Google g{done}{link l}, MySocket s{}{link l}, optional Stock st{done}{link l}){ - web.httpresponse(s); - s.write(("").getBytes()); - if (isavailable(weather)) - s.write(weather.data.getBytes()); - if (isavailable(g)) - s.write(g.data.getBytes()); - if (isavailable(st)) { - s.write(st.data.getBytes()); - } - s.write(("").getBytes()); - s.close(); - taskexit(web {!TransPending}); -} diff --git a/Robust/src/Benchmarks/Conglomerator/Tag/Stock.java b/Robust/src/Benchmarks/Conglomerator/Tag/Stock.java deleted file mode 100644 index 9c9a7279..00000000 --- a/Robust/src/Benchmarks/Conglomerator/Tag/Stock.java +++ /dev/null @@ -1,11 +0,0 @@ -public class Stock extends Lookup { - public Stock() { - url="q?s=%5EDJI"; - //url=""; - hostname="finance.yahoo.com"; - start=""; - end=""; - exclusive=true; - } - -} diff --git a/Robust/src/Benchmarks/Conglomerator/Tag/Weather.java b/Robust/src/Benchmarks/Conglomerator/Tag/Weather.java deleted file mode 100644 index ea4d7850..00000000 --- a/Robust/src/Benchmarks/Conglomerator/Tag/Weather.java +++ /dev/null @@ -1,9 +0,0 @@ -public class Weather extends Lookup{ - public Weather() { - url="warnings.php?wfo=sgx&zone=CAZ042&pil=XXXHWOSGX&productType=Hazardous+Weather+Outlook"; - hostname="www.wrh.noaa.gov"; - start="Hazardous Weather Outlook"; - end="$$"; - } - -} diff --git a/Robust/src/Benchmarks/Conglomerator/Tag/WebServerExampleBUGSTUDY.java b/Robust/src/Benchmarks/Conglomerator/Tag/WebServerExampleBUGSTUDY.java deleted file mode 100644 index d0052e3b..00000000 --- a/Robust/src/Benchmarks/Conglomerator/Tag/WebServerExampleBUGSTUDY.java +++ /dev/null @@ -1,136 +0,0 @@ -/* Startup object is generated with the initialstate flag set by the - * system to start the computation up */ - -// Create New ServerSocket -task Startup(StartupObject s {initialstate}) { - ServerSocket ss = new ServerSocket(9000); - Logger log = new Logger() {Initialize}; - Inventory inventorylist = new Inventory(){TransInitialize}; - taskexit(s {!initialstate}); /* Turns initial state flag off, so this task won't refire */ -} - -task LookupS(Stock l{initialstate}) { - String query="GET /"+l.url+" HTTP/1.1\r\nConnection: close\r\nHost:"+l.hostname+"\r\n\r\n"; - l.connect(l.hostname, 80); - l.write(query.getBytes()); - taskexit(l{initialstate, query}); -} - -task ReceiveQueryS(Stock l{query&&IOPending}) { - byte[] buffer=new byte[1024]; - int numchars=l.read(buffer); - if (numchars<=0) { - l.fix(); - l.close(); - System.printString("Before exiting ReceiveQueryS...\n"); - taskexit(l{!query,done}{}); - } - String str=new String(buffer, 0, numchars); - if (l.data==null) { - l.data=str; - } else - l.data=l.data+str; - taskexit; -} - -task LookupG(Google l{initialstate}) { - String query="GET /"+l.url+" HTTP/1.1\r\nConnection: close\r\nHost:"+l.hostname+"\r\n\r\n"; - l.connect(l.hostname, 80); - l.write(query.getBytes()); - taskexit(l{!initialstate, query}); -} - -task ReceiveQueryG(Google l{query&&IOPending}) { - byte[] buffer=new byte[1024]; - int numchars=l.read(buffer); - if (numchars<=0) { - l.fix(); - l.close(); - taskexit(l{!query,done}{}); - } - String str=new String(buffer, 0, numchars); - if (l.data==null) { - l.data=str; - } else - l.data=l.data+str; - - taskexit; -} - -task LookupW(Weather l{initialstate}) { - String query="GET /"+l.url+" HTTP/1.1\r\nConnection: close\r\nHost:"+l.hostname+"\r\n\r\n"; - l.connect(l.hostname, 80); - l.write(query.getBytes()); - taskexit(l{!initialstate, query}); -} - -task ReceiveQueryW(Weather l{query&&IOPending}) { - byte[] buffer=new byte[1024]; - int numchars=l.read(buffer); - if (numchars<=0) { - l.fix(); - l.close(); - taskexit(l{!query,done}{}); - } - String str=new String(buffer, 0, numchars); - if (l.data==null) { - l.data=str; - } else - l.data=l.data+str; - taskexit; -} - - - -//Listen for a request and accept request -task AcceptConnection(ServerSocket ss{SocketPending}) { - // System.printString("W> Waiting for connection...\n"); - tag t=new tag(link); - WebServerSocket web = new WebServerSocket() {!WritePending, !TransPending, WebInitialize}{t}; - MySocket ms=new MySocket(){}{t}; - ss.accept(ms); -// System.printString("W> Connected... \n"); -} - -// Process the incoming http request -task ProcessRequest(WebServerSocket web{WebInitialize}{link l}, MySocket s{IOPending}{link l}) { - if (web.clientrequest(s)) { - if(web.checktrans()==false) - // Not special transaction , do normal filesending - taskexit(web {WritePending, LogPending,!WebInitialize}); //Sets the WritePending and LogPending flag true - else { - Weather w=new Weather(){initialstate}{l}; - Google g=new Google(){initialstate}{l}; - Stock st=new Stock(){initialstate}{l}; - taskexit(web {TransPending, LogPending,!WebInitialize}); - } - } -} - -//Do the WriteIO on server socket and send the requested file to Client -task SendFile(WebServerSocket web{WritePending}{link l}, MySocket s{}{link l}) { - web.sendfile(s); - s.close(); - taskexit(web {!WritePending}); -} - -// Log the Client request -task LogRequest(WebServerSocket web{LogPending}, Logger log{Initialize}) { -//Task fired when both -// LogPending and Initialize flags are true -// System.printString("L > Inside logrequest\n"); - log.logrequest(web.filename); - taskexit(web {!LogPending}); -} - -//Transaction on Inventory -task Transaction(WebServerSocket web{TransPending}{link l}, Weather weather{done}{link l}, Google g{done}{link l}, MySocket s{}{link l}, Stock st{done}{link l}){ //Task for WebServerTransactions - web.httpresponse(s); - s.write(("").getBytes()); - s.write(weather.data.getBytes()); - s.write(g.data.getBytes()); - s.write(st.data.getBytes()); - s.write(("").getBytes()); - s.close(); - taskexit(web {!TransPending}); -} diff --git a/Robust/src/Benchmarks/Conglomerator/Tag/WebServerSocket.java b/Robust/src/Benchmarks/Conglomerator/Tag/WebServerSocket.java deleted file mode 100644 index d83dd334..00000000 --- a/Robust/src/Benchmarks/Conglomerator/Tag/WebServerSocket.java +++ /dev/null @@ -1,139 +0,0 @@ -public class WebServerSocket { - flag LogPending; - flag WritePending; - flag TransPending; - flag WebInitialize; - //Filename requested by the client - String filename; - String[] parsed; - String prefix; - - //Constructor - public WebServerSocket(){ - parsed = new String[4]; - } - - //Send the http header for web browser display - public void httpresponse(Socket s){ - StringBuffer header = new StringBuffer("HTTP/1.0 200 OK\n"); - header.append("Content-type: text/html\n"); - header.append("\n\n"); - String temp_str = new String(header); - s.write(temp_str.getBytes()); - return; - - } - - // Send the html file , read from file one byte at a time - public void sendfile(Socket s) { - StringBuffer req_file = new StringBuffer("./htmlfiles/"); - req_file.append(filename); - String filepath = new String(req_file); - FileInputStream def_file = new FileInputStream(filepath); - int status = def_file.getfd();//Checks if the file is present in - //current directory - httpresponse(s); - if (status == -1){ - StringBuffer response = new StringBuffer("404: not found: ");//Send 404 error if - // file not found - response.append(filename); - String buffer = new String(response); - s.write(buffer.getBytes()); - def_file.close(); - return; - } - byte buf[] = new byte[16]; - int ret; - - while ((ret = def_file.read(buf)) > 0) {// Read from file and write - // one byte at a time into the socket - byte tosend[] = new byte[ret]; - for (int i = 0; i < ret; i++) { - tosend[i] = buf[i]; - } - s.write(tosend); - //String str = new String(tosend); - } - def_file.close(); - } - - //Read the client request and extract the filename from it - public boolean clientrequest(Socket s){ - byte b1[] = new byte[1024]; - int numbytes=s.read(b1);//Read client request from web server socket - String curr=(new String(b1)).subString(0, numbytes); - if (prefix!=null) { - StringBuffer sb=new StringBuffer(prefix); - sb.append(curr); - curr=sb.toString(); - } - prefix=curr; - if(prefix.indexOf("\r\n\r\n")>=0) { - - int index = prefix.indexOf('/');//Parse the GET client request to find filename - int end = prefix.indexOf('H'); - filename = prefix.subString((index+1), (end-1)); - return true; - } - return false; - } - - // Parse for the prefix in the client request - // This is helpful to find if the prefix is a special transaction - public boolean checktrans(){ - if (filename.startsWith("portal") == true) { - return true; - } else { - return false; - } - } - - //Parse for the substrings in the filename and use it to obtain the - //kind of operation, name of item, quantity of item, price of item - //e.g. trans_add_car_2_10000 is the filename - //store in the parsed[] string , add,car,2,1000 - public int parseTransaction(){ - int start = filename.indexOf('_'); - String s = filename.subString(start+1); - - if (s.startsWith("add")==true){ - // System.printString("DEBUG > ADD\n"); - int i1 = s.indexOf('_'); - parsed[0] = new String(s.subString(0,i1)); - - int i2 = s.indexOf('_',i1+1); - parsed[1] = new String(s.subString(i1+1,i2)); - - int i3 = s.indexOf('_',i2+1); - parsed[2] = new String(s.subString(i2+1,i3)); - - String s3 = s.subString(i3+1); - parsed[3] = s3; - - return 0; - - } - if (s.startsWith("buy")==true){ - // System.printString("DEBUG > BUY\n"); - int i1 = s.indexOf('_'); - parsed[0] = s.subString(0,i1); - - int i2 = s.indexOf('_', i1+1); - parsed[1] = s.subString(i1+1,i2); - - String s2 = s.subString(i2+1); - parsed[2] = s2; - - parsed[3] = ""; - - return 1; - } - if (s.startsWith("inventory")==true){ - // System.printString("DEBUG > INVENTORY\n"); - return 2; - - } - // Error transaction - return -1; - } -} diff --git a/Robust/src/Benchmarks/Jhttpp2/BR/Jhttpp2ClientInputStream.java b/Robust/src/Benchmarks/Jhttpp2/BR/Jhttpp2ClientInputStream.java deleted file mode 100755 index ed259f9c..00000000 --- a/Robust/src/Benchmarks/Jhttpp2/BR/Jhttpp2ClientInputStream.java +++ /dev/null @@ -1,134 +0,0 @@ -/* Written and copyright 2001-2003 Benjamin Kohl. - * Distributed under the GNU General Public License; see the README file. - * This code comes with NO WARRANTY. - */ - -import java.io.IOException; -import java.io.InputStream; -import java.io.BufferedInputStream; -import java.net.InetAddress; -import java.net.UnknownHostException; - - -/** - File: Jhttpp2BufferedFilterStream.java - @author Benjamin Kohl -*/ -public class Jhttpp2ClientInputStream { - private boolean filter; - /** - * This is set to true with requests with bodies, like "POST" - */ - - public boolean ssl; - flag foo; - - private void init() { - ssl = false; - } - - public Jhttpp2ClientInputStream() { - init(); - } - - - public Request read(String str, Jhttpp2HTTPSession connection, tag ct, tag tc) { - //can check for ssl first - String s=readstr(str, connection); - if (s!=null) { - return new Request(s){}{ct, tc}; - } else - return null; - } - - public Request readfirst(String str, Jhttpp2HTTPSession connection, tag ct, tag tc) { - String s=readstr(str, connection); - if (s!=null) { - return new Request(s){first}{ct, tc}; - } else - return null; - } - - public String readstr(String str, Jhttpp2HTTPSession connection) { - String rq=""; - int content_len=0; - boolean tempssl=false; - - if (ssl) - return str; - - String buf = getLine(str); // reads the first line - str = updateBuffer(str, buf); - if (buf==null) - return null; - rq += buf; - if (buf.startsWith("CONNECT")) - tempssl=true; - boolean cnt=true; - while(cnt) { - buf = getLine(str); // reads the first line - str = updateBuffer(str, buf); - if (buf==null) - return null; - rq += buf; - - if (buf.length()<=2) { - cnt=false; - } else { - if (buf.toUpperCase().startsWith("CONTENT-LENGTH")) { - String clen=buf.substring(16); - if (clen.indexOf("\r")!=-1) - clen=clen.substring(0,clen.indexOf("\r")); - else - if(clen.indexOf("\n")!=-1) clen=clen.substring(0,clen.indexOf("\n")); - content_len=Integer.parseInt(clen); - } - } - } - if (!tempssl) { - buf=getAdditional(str, content_len); - str = updateBuffer(str, buf); - if (buf==null) - return null; - rq+=buf; - } - ssl=tempssl; - return rq; - } - - - /** - * reads a line - * @exception IOException - */ - public static String getLine(String str) { - int l=str.indexOf('\n'); - if (l!=-1) - return str.substring(0, l+1); - else - return null; - } - - public static String getAdditional(String str, int content_len) { - if (content_len>str.length()) - return null; - else - return str.substring(0, content_len); - - } - - public static String updateBuffer(String buf, String str) { - if (str!=null) { - return buf.substring(str.length(), buf.length()); - } else - return buf; - } - - /** - * @return boolean whether the actual connection was established with the CONNECT method. - * @since 0.2.21 - */ - public boolean isTunnel() { - return ssl; - } -} diff --git a/Robust/src/Benchmarks/Jhttpp2/BR/Jhttpp2HTTPSession.java b/Robust/src/Benchmarks/Jhttpp2/BR/Jhttpp2HTTPSession.java deleted file mode 100644 index f902e809..00000000 --- a/Robust/src/Benchmarks/Jhttpp2/BR/Jhttpp2HTTPSession.java +++ /dev/null @@ -1,31 +0,0 @@ -/* Written and copyright 2001-2003 Benjamin Kohl. - * Distributed under the GNU General Public License; see the README file. - * This code comes with NO WARRANTY. - */ - -import java.net.Socket; -import java.net.InetAddress; -import java.net.UnknownHostException; - -import java.io.BufferedOutputStream; -import java.io.BufferedInputStream; -import java.io.DataInputStream; -import java.io.IOException; -import java.io.File; -import java.io.FileInputStream; - - -/** - One HTTP connection - @file Jhttpp2HTTPSession.java - @author Benjamin Kohl -*/ -public class Jhttpp2HTTPSession { - String request; - flag more; - flag first; - - public Jhttpp2HTTPSession() { - } -} - diff --git a/Robust/src/Benchmarks/Jhttpp2/BR/Jhttpp2Server.java b/Robust/src/Benchmarks/Jhttpp2/BR/Jhttpp2Server.java deleted file mode 100755 index c6fa5c09..00000000 --- a/Robust/src/Benchmarks/Jhttpp2/BR/Jhttpp2Server.java +++ /dev/null @@ -1,310 +0,0 @@ -/* Written and copyright 2001-2003 Benjamin Kohl. - * Distributed under the GNU General Public License; see the README file. - * This code comes with NO WARRANTY. - * More Information and documentation: HTTP://jhttp2.sourceforge.net/ - */ - -import java.net.ServerSocket; -import java.net.Socket; -import java.net.UnknownHostException; -import java.net.InetAddress; -import java.net.BindException; - -import java.io.*; - -import java.util.Vector; -import java.util.Date; - -public class Jhttpp2Server -{ - private static final String CRLF; - private final String VERSION; - private final String V_SPECIAL; - private final String HTTP_VERSION; - private final String MAIN_LOGFILE; - - private final String DATA_FILE; - private final String SERVER_PROPERTIES_FILE; - - private String http_useragent; - private ServerSocket listen; - private BufferedWriter logfile; - private BufferedWriter access_logfile; - private long bytesread; - private long byteswritten; - private int numconnections; - - private boolean enable_cookies_by_default; - private WildcardDictionary dic; - private Vector urlactions; - - public final int DEFAULT_SERVER_PORT; - public final String WEB_CONFIG_FILE; - - public int port; - public InetAddress proxy; - public int proxy_port; - - public long config_auth; - public long config_session_id; - public String config_user; - public String config_password; - - public static boolean error; - public static String error_msg; - - public boolean use_proxy; - public boolean block_urls; - public boolean filter_http; - public boolean debug; - public boolean log_access; - public String log_access_filename; - public boolean webconfig; - public boolean www_server; - - - public initvars() { - CRLF="\r\n"; - VERSION = "0.4.62"; - V_SPECIAL = " 2003-05-20"; - HTTP_VERSION = "HTTP/1.1"; - MAIN_LOGFILE = "server.log"; - DATA_FILE = "server.data"; - SERVER_PROPERTIES_FILE = "server.properties"; - http_useragent = "Mozilla/4.0 (compatible; MSIE 4.0; WindowsNT 5.0)"; - enable_cookies_by_default=true; - dic = new WildcardDictionary(); - urlactions = new Vector(); - DEFAULT_SERVER_PORT = 8088; - WEB_CONFIG_FILE = "admin/jp2-config"; - port = DEFAULT_SERVER_PORT; - proxy_port = 0; - config_auth = 0; - config_session_id = 0; - config_user = "root"; - config_password = "geheim"; - use_proxy=false; - block_urls=false; - filter_http=false; - debug=false; - log_access = true; - log_access_filename="paccess.log"; - webconfig = true; - www_server = true; -} - - void init() - { - if(log_access) { - access_logfile=new BufferedWriter(new FileWriter(log_access_filename,true)); - } - - logfile=new BufferedWriter(new FileWriter(MAIN_LOGFILE,true)); - writeLog("server startup..."); - - listen = new ServerSocket(port); - - if (error) { - writeLog(error_msg); - return; - } - } - public Jhttpp2Server() { - initvars(); - init(); - } - public Jhttpp2Server(boolean b) - { - initvars(); - System.printString("jHTTPp2 HTTP Proxy Server Release " + getServerVersion() + "\r\n" - +"Copyright (c) 2001-2003 Benjamin Kohl \r\n" - +"This software comes with ABSOLUTELY NO WARRANTY OF ANY KIND.\r\n" - +"http://jhttp2.sourceforge.net/\n"); - init(); - } - /** calls init(), sets up the serverport and starts for each connection - * new Jhttpp2Connection - */ - public void setErrorMsg(String a) - { - error=true; - error_msg=a; - } - /** - * Tests what method is used with the reqest - * @return -1 if the server doesn't support the method - */ - public static int getHttpMethod(String d) - { - if (startsWith(d,"GET") || startsWith(d,"HEAD")) return 0; - if (startsWith(d,"POST") || startsWith(d,"PUT")) return 1; - if (startsWith(d,"CONNECT")) return 2; - if (startsWith(d,"OPTIONS")) return 3; - - return -1;/* No match... - - Following methods are not implemented: - || startsWith(d,"TRACE") */ - } - public static boolean startsWith(String a,String what) - { - int l=what.length(); - int l2=a.length(); - if (l2>l) - return a.substring(0,l).equals(what); - else - return false; - } - /** - *@return the Server response-header field - */ - public String getServerIdentification() - { - return "jHTTPp2/" + getServerVersion(); - } - public String getServerVersion() - { - return VERSION + V_SPECIAL; - } - /** - * saves all settings with a ObjectOutputStream into a file - * @since 0.2.10 - */ - /** restores all Jhttpp2 options from "settings.dat" - * @since 0.2.10 - */ - /** - * @return the HTTP version used by jHTTPp2 - */ - public String getHttpVersion() - { - return HTTP_VERSION; - } - /** the User-Agent header field - * @since 0.2.17 - * @return User-Agent String - */ - public String getUserAgent() - { - return http_useragent; - } - public void setUserAgent(String ua) - { - http_useragent=ua; - } - /** - * writes into the server log file and adds a new line - * @since 0.2.21 - */ - public void writeLog(String s) - { - writeLog(s,true); - } - /** writes to the server log file - * @since 0.2.21 - */ - public void writeLog(String s,boolean b) - { - s=new Date().toString() + " " + s; - logfile.write(s,0,s.length()); - if (b) logfile.newLine(); - logfile.flush(); - if (debug)System.printString(s); - } - - public void closeLog() - { - writeLog("Server shutdown."); - logfile.flush(); - logfile.close(); - access_logfile.close(); - } - - public void addBytesRead(long read) - { - bytesread+=read; - } - /** - * Functions for the jHTTPp2 statistics: - * How many connections - * Bytes read/written - * @since 0.3.0 - */ - public void addBytesWritten(int written) - { - byteswritten+=written; - } - public int getServerConnections() - { - return numconnections; - } - public long getBytesRead() - { - return bytesread; - } - public long getBytesWritten() - { - return byteswritten; - } - public void increaseNumConnections() - { - numconnections++; - } - public void decreaseNumConnections() - { - numconnections--; - } - public void AuthenticateUser(String u,String p) { - if (config_user.equals(u) && config_password.equals(p)) { - config_auth = 1; - } else config_auth = 0; - } - public String getGMTString() - { - return new Date().toString(); - } - public Jhttpp2URLMatch findMatch(String url) - { - return (Jhttpp2URLMatch)dic.get(url); - } - public WildcardDictionary getWildcardDictionary() - { - return dic; - } - public Vector getURLActions() - { - return urlactions; - } - public boolean enableCookiesByDefault() - { - return this.enable_cookies_by_default; - } - public void enableCookiesByDefault(boolean a) - { - enable_cookies_by_default=a; - } - public void resetStat() - { - bytesread=0; - byteswritten=0; - } - /** - * @since 0.4.10a - */ - /** - * @since 0.4.10a - */ - /** - * @since 0.4.10a - */ - public void logAccess(String s) - { - access_logfile.write("[" + new Date().toString() + "] " + s + "\r\n"); - access_logfile.flush(); - } - public void shutdownServer() { - closeLog(); - System.exit(0); - } - -} diff --git a/Robust/src/Benchmarks/Jhttpp2/BR/Jhttpp2Task.java b/Robust/src/Benchmarks/Jhttpp2/BR/Jhttpp2Task.java deleted file mode 100644 index 37b2f7bb..00000000 --- a/Robust/src/Benchmarks/Jhttpp2/BR/Jhttpp2Task.java +++ /dev/null @@ -1,184 +0,0 @@ -task start(StartupObject s{initialstate}) { - Jhttpp2Server js=new Jhttpp2Server(true); - taskexit(s{!initialstate}); -} - -task acceptconnection(ServerSocket ss{SocketPending}) { - tag t=new tag(connection); - MySocket ms=new MySocket(){}{t}; - ss.accept(ms); - Jhttpp2HTTPSession js=new Jhttpp2HTTPSession() {first}{t}; - Jhttpp2ClientInputStream jcis=new Jhttpp2ClientInputStream() {}{t}; -} - -task requestfirst(Jhttpp2HTTPSession session {first}{connection tc}, Jhttpp2ClientInputStream jcis {}{connection tc}, MySocket socket {IOPending}{connection tc}) { - byte[] buf=new byte[10000]; - int length=socket.read(buf); - String str=new String(buf, 0, length); - if (session.request!=null) { - str=session.request.concat(str); - } - tag ct=new tag(chained); - Request r=jcis.readfirst(str, session, ct, tc); - if (r==null) { - session.request=str; - taskexit; - } else { - session.request=str.substring(r.length(), str.length()); - if (session.request.length()>0) - taskexit(session{more, !first}); - else - taskexit(session{!first}); - } -} - -task request(Jhttpp2HTTPSession session {!first}{connection tc}, Jhttpp2ClientInputStream jcis {}{connection tc}, MySocket socket {IOPending}{connection tc}, optional Request rold{!chained}{connection tc}) { - byte[] buf=new byte[10000]; - int length=socket.read(buf); - if (session.request!=null) - System.printString(session.request+"\n"); - if (length==0) { - socket.close(); - taskexit; - } else if (length < 0 ) { - System.printString("ERROR\n"); - taskexit; - } - String str=new String(buf, 0, length); - - if (session.request!=null) { - str=session.request.concat(str); - } - //pull off the next request - tag ct=new tag(chained); - Request r=jcis.read(str, session, ct, tc); - if (r==null) { - session.request=str; - taskexit; - } else { - session.request=str.substring(r.length(), str.length()); - if (session.request.length()>0) - taskexit(session{more}, rold{chained}{ct}); - else - taskexit(rold{chained}{ct}); - } -} - -task requestmore(Jhttpp2HTTPSession session {more}{connection tc}, Jhttpp2ClientInputStream jcis {}{connection tc}, optional Request rold{!chained}{connection tc}) { - String str=session.request; - //pull off the next request - tag ct=new tag(chained); - Request r=jcis.read(str, session, ct, tc); - if (r==null) { - session.request=str; - taskexit; - } else { - session.request=str.substring(r.length(), str.length()); - if (session.request.length()>0) - taskexit(rold{chained}{ct}); - else - taskexit(session{!more}, rold{chained}{ct}); - } -} - -task sendfirst(Request r{first&&!processed}{connection tc}) { - r.parseRequest(); - r.connect(); - r.sendRequest(); - taskexit(r{processed}); -} - -task sendnext(optional Request rprev{received&&!done}{chained ct}, Request r{!processed&&!first}{chained ct}) { - r.parseRequest(); - if (isavailable(rprev)&&rprev.remote_host_name!=null&& - rprev.remote_host_name.equals(r.remote_host_name)&&rprev.port==r.port) { - r.fd=rprev.fd; - r.nativeBindFD(r.fd); - } else - r.connect(); - r.sendRequest(); - taskexit(r{processed}, rprev{done}); -} - -task recvreq(Request r{processed&&!received&&IOPending}) { - byte[] buf=new byte[10000]; - int length=r.read(buf); - if (length==0) { - //Done - taskexit(r{received}); - } else if (length<0) { - r.close(); - taskexit(r{received}); - } - String str=new String(buf, 0, length); - if (r.response!=null) { - str=r.response.concat(str); - } - boolean cnt=true; - int lastindex=0; - int bytes=0; - while(cnt) { - int nextindex=str.indexOf('\n',lastindex)+1; - if (nextindex==-1) { - r.response=str; - taskexit; - } - if (nextindex-lastindex<=2) { - cnt=false; - } else if (str.substring(lastindex, nextindex+1).toUpperCase().startsWith("CONTENT-LENGTH")) { - String clen=str.substring(lastindex+16, nextindex+1); - if (clen.indexOf("\r")!=-1) - clen=clen.substring(0,clen.indexOf("\r")); - else - if(clen.indexOf("\n")!=-1) - clen=clen.substring(0,clen.indexOf("\n")); - bytes=Integer.parseInt(clen); - } - lastindex=nextindex; - } - if (bytes>0) { - if ((lastindex+bytes)<=str.length()) { - r.response=str; - taskexit(r{received}); - } else { - r.response=str; - taskexit; - } - } else { - //read until 0 - r.response=str; - taskexit; - } -} - -task sendfirstresp(optional Request r{first && !sent && received}{connection tc}, MySocket sock{}{connection tc}) { - if (isavailable(r)&&r.response!=null) { - sock.write(r.response.getBytes()); - taskexit(r{sent}); - } else { - String msg=" 503 Service Unavailable \rRequest Failed\r\n"; - String resp="HTTP/1.1 503 Service Unavailable\r\n"+ - "Cache-Control: nocache, must-revalidate\r\n"+ - "Connection: close\r\n"+ - "Content-Length: "+msg.length()+"\r\n"+ - "Content-Type: text/html; charset=iso-8859-1\r\n\r\n"+msg; - sock.write(resp.getBytes()); - taskexit(r{sent}); - } -} - -task sendresp(optional Request rprev {sent}{chained ct}, optional Request r{!sent && received && !first}{chained ct, connection tc}, MySocket sock{}{connection tc}) { - if (isavailable(r)&&r.response!=null) { - sock.write(r.response.getBytes()); - taskexit(r{sent}); - } else { - String msg=" 503 Service Unavailable \rRequest Failed\r\n"; - String resp="HTTP/1.1 503 Service Unavailable\r\n"+ - "Cache-Control: nocache, must-revalidate\r\n"+ - "Connection: close\r\n"+ - "Content-Length: "+msg.length()+"\r\n"+ - "Content-Type: text/html; charset=iso-8859-1\r\n\r\n"+msg; - sock.write(resp.getBytes()); - taskexit(r{sent}); - } -} diff --git a/Robust/src/Benchmarks/Jhttpp2/BR/Jhttpp2URLMatch.java b/Robust/src/Benchmarks/Jhttpp2/BR/Jhttpp2URLMatch.java deleted file mode 100755 index e37533c4..00000000 --- a/Robust/src/Benchmarks/Jhttpp2/BR/Jhttpp2URLMatch.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Title: jHTTPp2: Java HTTP Filter Proxy - * Copyright: Copyright (c) 2001-2003 Benjamin Kohl - * @author Benjamin Kohl - * @version 0.2.8 - */ - -public class Jhttpp2URLMatch { - String match; - String desc; - boolean cookies_enabled; - int actionindex; - - public Jhttpp2URLMatch(String match,boolean cookies_enabled,int actionindex,String description) - { - this.match=match; - this.cookies_enabled=cookies_enabled; - this.actionindex=actionindex; - this.desc=description; - } - public String getMatch() - { - return match; - } - public boolean getCookiesEnabled() - { - return cookies_enabled; - } - public int getActionIndex() - { - return actionindex; - } - public String getDescription() - { - return desc; - } - public String toString() - { - return "\"" + match + "\" " + desc; - } -} diff --git a/Robust/src/Benchmarks/Jhttpp2/BR/MySocket.java b/Robust/src/Benchmarks/Jhttpp2/BR/MySocket.java deleted file mode 100644 index fad34188..00000000 --- a/Robust/src/Benchmarks/Jhttpp2/BR/MySocket.java +++ /dev/null @@ -1,7 +0,0 @@ -public class MySocket extends Socket { - flag foo; - public MySocket() { - super(); - } - -} diff --git a/Robust/src/Benchmarks/Jhttpp2/BR/OnURLAction.java b/Robust/src/Benchmarks/Jhttpp2/BR/OnURLAction.java deleted file mode 100755 index 01915587..00000000 --- a/Robust/src/Benchmarks/Jhttpp2/BR/OnURLAction.java +++ /dev/null @@ -1,81 +0,0 @@ -/* Written and copyright 2001 Benjamin Kohl. - * Distributed under the GNU General Public License; see the README file. - * This code comes with NO WARRANTY. - * - * Title: jHTTPp2: Java HTTP Filter Proxy - * Description: An OpenSource HTTP Proxy - * Copyright: Copyright (c) 2001 Benjamin Kohl - * @author Benjamin Kohl - */ - -public class OnURLAction { - - private String customerrortext, desc, httppath, newlocation; - private boolean log,block,customtext,http_rq,anotherlocation; - public OnURLAction(String desc) - { - this.desc=desc; - } - public void denyAccess(String customerrortext) - { - this.block=true; - this.customtext=true; - this.customerrortext=customerrortext; - } - public void denyAccess() - { - block=true; - } - public void logAccess() - { - log=true; - } - public void anotherLocation(String newlocation) - { - this.anotherlocation=true; - this.newlocation=newlocation; - } - - public boolean onAccesssDeny() - { - return block; - } - public boolean onAccessLog() - { - return log; - } - public boolean onAccessDenyWithCustomText() - { - return customtext; - } - public boolean onAccessSendHTTPRequest() - { - return http_rq; - } - public boolean onAccessRedirect() - { - return this.anotherlocation; - } - public String newLocation() - { - return this.newlocation; - } - public void setHTTPAction(boolean http_rq, String httppath) - { - this.http_rq=http_rq; - this.httppath=httppath; - } - public String getCustomErrorText() - { - return customerrortext; - } - public String getDescription() - { - return desc; - } - public String toString() - { - return desc; - } - -} diff --git a/Robust/src/Benchmarks/Jhttpp2/BR/Request.java b/Robust/src/Benchmarks/Jhttpp2/BR/Request.java deleted file mode 100644 index be9391ad..00000000 --- a/Robust/src/Benchmarks/Jhttpp2/BR/Request.java +++ /dev/null @@ -1,129 +0,0 @@ -public class Request extends Socket { - flag first; - flag chained; - flag done; - flag sent; - flag received; - flag processed; - - String response; - String request; - int port; - String remote_host_name; - InetAddress address; - int statuscode; - String url; - String method; - boolean ssl; - String errordescription; - - public final int SC_OK; - public final int SC_CONNECTING_TO_HOST; - public final int SC_HOST_NOT_FOUND; - public final int SC_URL_BLOCKED; - public final int SC_CLIENT_ERROR; - public final int SC_INTERNAL_SERVER_ERROR; - public final int SC_NOT_SUPPORTED; - public final int SC_REMOTE_DEBUG_MODE; - public final int SC_CONNECTION_CLOSED; - public final int SC_HTTP_OPTIONS_THIS; - public final int SC_FILE_REQUEST; - public final int SC_MOVED_PERMANENTLY; - public final int SC_CONFIG_RQ; - - public int length() { - return request.length(); - } - - void init() { - SC_OK=0; - SC_CONNECTING_TO_HOST=1; - SC_HOST_NOT_FOUND=2; - SC_URL_BLOCKED=3; - SC_CLIENT_ERROR=4; - SC_INTERNAL_SERVER_ERROR=5; - SC_NOT_SUPPORTED=6; - SC_REMOTE_DEBUG_MODE=7; - SC_CONNECTION_CLOSED=8; - SC_HTTP_OPTIONS_THIS=9; - SC_FILE_REQUEST=10; - SC_MOVED_PERMANENTLY=11; - SC_CONFIG_RQ = 12; - } - - public Request(String request) { - init(); - this.request=request; - } - - /** - * Parser for the first (!) line from the HTTP request
    - * Sets up the URL, method and remote hostname. - * @return an InetAddress for the hostname, null on errors with a statuscode!=SC_OK - */ - public void parseRequest() { - String a=request.substring(0,request.indexOf('\n')); - String f; - int pos; - int method_index=Jhttpp2Server.getHttpMethod(a); - - if (ssl) { - url=""; - f = a.substring(8); - } else { - method = a.substring(0,a.indexOf(" ")); //first word in the line - pos = a.indexOf(":"); // locate first : - if (pos == -1) { // occours with "GET / HTTP/1.1" - url = a.substring(a.indexOf(" ")+1,a.lastIndexOf(" ")); - if (method_index == 0) { // method_index==0 --> GET - statuscode = SC_FILE_REQUEST; - } else { - statuscode = SC_INTERNAL_SERVER_ERROR; - errordescription="This WWW proxy supports only the \"GET\" method while acting as webserver."; - } - return; - } - f = a.substring(pos+3); //removes "http://" - } - pos=f.indexOf(" "); // locate space, should be the space before "HTTP/1.1" - if (pos==-1) { // buggy request - statuscode = SC_CLIENT_ERROR; - errordescription="Your browser sent an invalid request: \""+ a + "\""; - return; - } - f = f.substring(0,pos); //removes all after space - // if the url contains a space... it's not our mistake...(url's must never contain a space character) - pos=f.indexOf("/"); // locate the first slash - if (pos!=-1) { - url=f.substring(pos); // saves path without hostname - f=f.substring(0,pos); // reduce string to the hostname - } - else url="/"; // occurs with this request: "GET http://localhost HTTP/1.1" - pos = f.indexOf(":"); // check for the portnumber - if (pos!=-1) { - String l_port =f.substring(pos+1); - if (l_port.indexOf(" ")!=-1) - l_port=l_port.substring(0,l_port.indexOf(" ")); - int i_port=80; - i_port = Integer.parseInt(l_port); - f = f.substring(0,pos); - port=i_port; - } else - port=80; - remote_host_name = f; - address = InetAddress.getByName(f); - } - - public void connect() { - connect(address, port); - } - - public String getRequest() { - return method + " "+url+" "+"HTTP/1.1"+"\r\n"; - } - - public void sendRequest() { - write(getRequest().getBytes()); - write(request.substring(request.indexOf('\n')+1,request.length()).getBytes()); - } -} diff --git a/Robust/src/Benchmarks/Jhttpp2/BR/WildcardDictionary.java b/Robust/src/Benchmarks/Jhttpp2/BR/WildcardDictionary.java deleted file mode 100755 index 9d8bab67..00000000 --- a/Robust/src/Benchmarks/Jhttpp2/BR/WildcardDictionary.java +++ /dev/null @@ -1,182 +0,0 @@ -// WildcardDictionary - a dictionary with wildcard lookups -// -// Copyright (C) 1996 by Jef Poskanzer . All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -// SUCH DAMAGE. -// -// Visit the ACME Labs Java page for up-to-date versions of this and other -// fine Java utilities: http://www.acme.com/java/ - -// package Acme; - -import java.util.*; - -/// A dictionary with wildcard lookups. -//

    -// The keys in this dictionary are wildcard patterns. When you do a get(), -// the string you pass in is matched against all the patterns, and the -// first match is returned. -//

    -// The wildcard matcher is fairly simple, it implements * meaning any -// string, ? meaning any single character, and | separating multiple -// patterns. All other characters must match literally. -//

    -// Fetch the software.
    -// Fetch the entire Acme package. -//

    -// @see Acme.Utils#match - -public class WildcardDictionary extends Dictionary { - - private Vector keys; - private Vector elements; - - /// Constructor. - public WildcardDictionary() { - keys = new Vector(); - elements = new Vector(); - } - - /// Returns the number of elements contained within the dictionary. - public int size() { - return elements.size(); - } - - /// Returns true if the dictionary contains no elements. - public boolean isEmpty() { - return size() == 0; - } - - /// Returns an enumeration of the dictionary's keys. - public Enumeration keys() { - return keys.elements(); - } - - /// Returns an enumeration of the elements. Use the Enumeration methods - // on the returned object to fetch the elements sequentially. - public Enumeration elements() { - return elements.elements(); - } - - /// Gets the object associated with the specified key in the dictionary. - // The key is assumed to be a String, which is matched against - // the wildcard-pattern keys in the dictionary. - // @param key the string to match - // @returns the element for the key, or null if there's no match - // @see Acme.Utils#match - public synchronized Object get( Object key ) - { - String sKey = (String) key; - for ( int i = 0; i < keys.size(); ++i ) - { - String thisKey = (String) keys.elementAt( i ); - if ( match( thisKey, sKey ) ) - return elements.elementAt( i ); - } - return null; - } - - /// Puts the specified element into the Dictionary, using the specified - // key. The element may be retrieved by doing a get() with the same - // key. The key and the element cannot be null. - // @param key the specified wildcard-pattern key - // @param value the specified element - // @return the old value of the key, or null if it did not have one. - // @exception NullPointerException If the value of the specified - // element is null. - public synchronized Object put( Object key, Object element ) - { - int i = keys.indexOf( key ); - if ( i != -1 ) - { - Object oldElement = elements.elementAt( i ); - elements.setElementAt( element, i ); - return oldElement; - } - else - { - keys.addElement( key ); - elements.addElement( element ); - return null; - } - } - - /// Removes the element corresponding to the key. Does nothing if the - // key is not present. - // @param key the key that needs to be removed - // @return the value of key, or null if the key was not found. - public synchronized Object remove( Object key ) - { - int i = keys.indexOf( key ); - if ( i != -1 ) - { - Object oldElement = elements.elementAt( i ); - keys.removeElementAt( i ); - elements.removeElementAt( i ); - return oldElement; - } - else - return null; - } - - /** Checks whether a string matches a given wildcard pattern. - * Only does ? and *, and multiple patterns separated by |. - */ - public static boolean match( String pattern, String string ) { - for ( int p = 0; true; ++p ) { - boolean cnt=true; - for ( int s = 0; cnt; ++p, ++s ) { - boolean sEnd = ( s >= string.length() ); - boolean pEnd = ( p >= pattern.length() || - pattern.charAt( p ) == '|' ); - if ( sEnd && pEnd ) - return true; - if ( sEnd || pEnd ) - cnt=false; - else if ( pattern.charAt( p ) != '?' ) { - if ( pattern.charAt( p ) == '*' ) { - int i; - ++p; - for ( i = string.length(); i >= s; --i ) - if ( match( - pattern.substring( p ), - string.substring( i ) ) ) /* not quite right */ - return true; - cnt=false; - } - if ( pattern.charAt( p ) != string.charAt( s ) ) - cnt=false; - } - } - p = pattern.indexOf( '|', p ); - if ( p == -1 ) - return false; - } - } - /** - * Deletes all elements and keys. - */ - public void removeAllElements() { - elements.clear(); - keys.clear(); - } -} diff --git a/Robust/src/Benchmarks/Jhttpp2/Java/Jhttpp2ClientInputStream.java b/Robust/src/Benchmarks/Jhttpp2/Java/Jhttpp2ClientInputStream.java deleted file mode 100755 index 39b229bd..00000000 --- a/Robust/src/Benchmarks/Jhttpp2/Java/Jhttpp2ClientInputStream.java +++ /dev/null @@ -1,342 +0,0 @@ -/* Written and copyright 2001-2003 Benjamin Kohl. - * Distributed under the GNU General Public License; see the README file. - * This code comes with NO WARRANTY. - */ - -import java.io.IOException; -import java.io.InputStream; -import java.io.BufferedInputStream; -import java.net.InetAddress; -import java.net.UnknownHostException; - - -/** - File: Jhttpp2BufferedFilterStream.java - @author Benjamin Kohl -*/ -public class Jhttpp2ClientInputStream extends BufferedInputStream { - private boolean filter; - private String buf; - private int lread; - /** - * The length of the header (with body, if one) - */ - private int header_length; - /** - * The length of the (optional) body of the actual request - */ - private int content_len; - /** - * This is set to true with requests with bodies, like "POST" - */ - private boolean body; - private static Jhttpp2Server server; - private Jhttpp2HTTPSession connection; - private InetAddress remote_host; - private String remote_host_name; - private String errordescription; - private int statuscode; - - public String url; - public String method; - public int remote_port; - public int post_data_len; - public boolean ssl; - - public int getHeaderLength() { - return header_length; - } - - public InetAddress getRemoteHost() { return remote_host; } - public String getRemoteHostName() { return remote_host_name; } - - private void init() { - lread = 0; - header_length = 0; - content_len = 0; - ssl = false; - body = false; - remote_port = 0; - post_data_len = 0; - } - - public Jhttpp2ClientInputStream(Jhttpp2Server server,Jhttpp2HTTPSession connection,InputStream a) { - super(a); - init(); - this.server = server; - this.connection=connection; - } - /** - * Handler for the actual HTTP request - * @exception IOException - */ - public int read(byte[] a) { - statuscode = connection.SC_OK; - if (ssl) return super.read(a); - boolean cookies_enabled=server.enableCookiesByDefault(); - String rq=""; - header_length=0; - post_data_len = 0; - content_len = 0; - boolean start_line=true; - buf = getLine(); // reads the first line - if (buf==null) - return -2; - boolean cnt=true; - while (lread>2&&cnt) { - if (start_line) { - start_line = false; - int methodID = server.getHttpMethod(buf); - if (methodID==-1) { - statuscode = connection.SC_NOT_SUPPORTED; - } else { - if (methodID==2) { - ssl = true; - } - InetAddress host = parseRequest(buf,methodID); - - if (statuscode == connection.SC_OK) { - if (!server.use_proxy && !ssl) { - /* creates a new request without the hostname */ - buf = method + " " + url + " " + server.getHttpVersion() + "\r\n"; - lread = buf.length(); - } - if ((server.use_proxy && connection.notConnected()) || !host.equals(remote_host)) { - if (server.debug) server.writeLog("read_f: STATE_CONNECT_TO_NEW_HOST"); - statuscode = connection.SC_CONNECTING_TO_HOST; - remote_host = host; - } - /* ------------------------- - * url blocking (only "GET" method) - * -------------------------*/ - if (server.block_urls && methodID==0 && statuscode!=connection.SC_FILE_REQUEST) { - if (server.debug) System.printString("Searching match..."); - Jhttpp2URLMatch match=server.findMatch(this.remote_host_name+url); - if (match!=null){ - if (server.debug) System.printString("Match found!"); - cookies_enabled=match.getCookiesEnabled(); - if (match.getActionIndex()==-1) cnt=false; else { - OnURLAction action=(OnURLAction)server.getURLActions().elementAt(match.getActionIndex()); - if (action.onAccesssDeny()) { - statuscode=connection.SC_URL_BLOCKED; - if (action.onAccessDenyWithCustomText()) errordescription=action.getCustomErrorText(); - } else if (action.onAccessRedirect()) { - statuscode=connection.SC_MOVED_PERMANENTLY; - errordescription=action.newLocation(); - } - } - }//end if match!=null) - } //end if (server.block... - } - } - } else { // end if(startline) - /*----------------------------------------------- - * Content-Length parsing - *-----------------------------------------------*/ - if(server.startsWith(buf.toUpperCase(),"CONTENT-LENGTH")) { - String clen=buf.substring(16); - if (clen.indexOf("\r")!=-1) clen=clen.substring(0,clen.indexOf("\r")); - else if(clen.indexOf("\n")!=-1) clen=clen.substring(0,clen.indexOf("\n")); - content_len=Integer.parseInt(clen); - if (server.debug) server.writeLog("read_f: content_len: " + content_len); - if (!ssl) body=true; // Note: in HTTP/1.1 any method can have a body, not only "POST" - } - else if (server.startsWith(buf,"Proxy-Connection:")) { - if (!server.use_proxy) buf=null; - else { - buf="Proxy-Connection: Keep-Alive\r\n"; - lread=buf.length(); - } - } - /*----------------------------------------------- - * cookie crunch section - *-----------------------------------------------*/ - else if(server.startsWith(buf,"Cookie:")) { - if (!cookies_enabled) buf=null; - } - /*------------------------------------------------ - * Http-Header filtering section - *------------------------------------------------*/ - else if (server.filter_http) { - if(server.startsWith(buf,"Referer:")) {// removes "Referer" - buf=null; - } else if(server.startsWith(buf,"User-Agent")) // changes User-Agent - { - buf="User-Agent: " + server.getUserAgent() + "\r\n"; - lread=buf.length(); - } - } - } - if (buf!=null) { - rq+=buf; - if (server.debug) server.writeLog(buf); - header_length+=lread; - } - buf=getLine(); - if (buf==null) - return -2; - } - rq+=buf; //adds last line (should be an empty line) to the header String - header_length+=lread; - - if (header_length==0) { - if (server.debug) server.writeLog("header_length=0, setting status to SC_CONNECTION_CLOSED (buggy request)"); - statuscode=connection.SC_CONNECTION_CLOSED; - } - - for (int i=0;i - * Sets up the URL, method and remote hostname. - * @return an InetAddress for the hostname, null on errors with a statuscode!=SC_OK - */ - public InetAddress parseRequest(String a,int method_index) { - if (server.debug) - server.writeLog(a); - String f; - int pos; - url=""; - if (ssl) { - f = a.substring(8); - } else { - method = a.substring(0,a.indexOf(" ")); //first word in the line - pos = a.indexOf(":"); // locate first : - if (pos == -1) { // occours with "GET / HTTP/1.1" - url = a.substring(a.indexOf(" ")+1,a.lastIndexOf(" ")); - if (method_index == 0) { // method_index==0 --> GET - if (url.indexOf(server.WEB_CONFIG_FILE) != -1) { - statuscode = connection.SC_CONFIG_RQ; - } else { - statuscode = connection.SC_FILE_REQUEST; - } - } else { - if (method_index == 1 && url.indexOf(server.WEB_CONFIG_FILE) != -1) { // allow "POST" for admin log in - statuscode = connection.SC_CONFIG_RQ; - } else { - statuscode=connection.SC_INTERNAL_SERVER_ERROR; - errordescription="This WWW proxy supports only the \"GET\" method while acting as webserver."; - } - } - return null; - } - f = a.substring(pos+3); //removes "http://" - } - pos=f.indexOf(" "); // locate space, should be the space before "HTTP/1.1" - if (pos==-1) { // buggy request - statuscode=connection.SC_CLIENT_ERROR; - errordescription="Your browser sent an invalid request: \""+ a + "\""; - return null; - } - f = f.substring(0,pos); //removes all after space - // if the url contains a space... it's not our mistake...(url's must never contain a space character) - pos=f.indexOf("/"); // locate the first slash - if (pos!=-1) { - url=f.substring(pos); // saves path without hostname - f=f.substring(0,pos); // reduce string to the hostname - } - else url="/"; // occurs with this request: "GET http://localhost HTTP/1.1" - pos = f.indexOf(":"); // check for the portnumber - if (pos!=-1) { - String l_port =f.substring(pos+1); - if (l_port.indexOf(" ")!=-1) - l_port=l_port.substring(0,l_port.indexOf(" ")); - int i_port=80; - //BCD - i_port = Integer.parseInt(l_port); - f = f.substring(0,pos); - remote_port=i_port; - } else - remote_port = 80; - remote_host_name = f; - InetAddress address = null; - if (server.log_access) - server.logAccess(method + " " + getFullURL()); - - address = InetAddress.getByName(f); - - if (remote_port == server.port && address.equals(InetAddress.getLocalHost())) { - if (url.indexOf(server.WEB_CONFIG_FILE) != -1 && (method_index == 0 || method_index == 1)) - statuscode = connection.SC_CONFIG_RQ; - else if (method_index > 0 ) { - statuscode=connection.SC_INTERNAL_SERVER_ERROR; - errordescription="This WWW proxy supports only the \"GET\" method while acting as webserver."; - } else - statuscode = connection.SC_FILE_REQUEST; - } - return address; - } - /** - * @return boolean whether the actual connection was established with the CONNECT method. - * @since 0.2.21 - */ - public boolean isTunnel() { - return ssl; - } - /** - * @return the full qualified URL of the actual request. - * @since 0.4.0 - */ - public String getFullURL() { - String sh=""; - if (ssl) - sh="s"; - if (remote_port!=80) - return "http" + sh + "://" + getRemoteHostName() - + ":" + remote_port + url; - else - return "http" + sh + "://" + getRemoteHostName() - + url; - } - /** - * @return status-code for the actual request - * @since 0.3.5 - */ - public int getStatusCode() - { - return statuscode; - } - /** - * @return the (optional) error-description for this request - */ - public String getErrorDescription() - { - return errordescription; - } -} diff --git a/Robust/src/Benchmarks/Jhttpp2/Java/Jhttpp2HTTPSession.java b/Robust/src/Benchmarks/Jhttpp2/Java/Jhttpp2HTTPSession.java deleted file mode 100644 index cbcdd781..00000000 --- a/Robust/src/Benchmarks/Jhttpp2/Java/Jhttpp2HTTPSession.java +++ /dev/null @@ -1,353 +0,0 @@ -/* Written and copyright 2001-2003 Benjamin Kohl. - * Distributed under the GNU General Public License; see the README file. - * This code comes with NO WARRANTY. - */ - -import java.net.Socket; -import java.net.InetAddress; -import java.net.UnknownHostException; - -import java.io.BufferedOutputStream; -import java.io.BufferedInputStream; -import java.io.DataInputStream; -import java.io.IOException; -import java.io.File; -import java.io.FileInputStream; - - -/** - One HTTP connection - @file Jhttpp2HTTPSession.java - @author Benjamin Kohl -*/ -public class Jhttpp2HTTPSession extends Thread { - - public final int SC_OK; - public final int SC_CONNECTING_TO_HOST; - public final int SC_HOST_NOT_FOUND; - public final int SC_URL_BLOCKED; - public final int SC_CLIENT_ERROR; - public final int SC_INTERNAL_SERVER_ERROR; - public final int SC_NOT_SUPPORTED; - public final int SC_REMOTE_DEBUG_MODE; - public final int SC_CONNECTION_CLOSED; - public final int SC_HTTP_OPTIONS_THIS; - public final int SC_FILE_REQUEST; - public final int SC_MOVED_PERMANENTLY; - public final int SC_CONFIG_RQ; - - - void init() { - SC_OK=0; - SC_CONNECTING_TO_HOST=1; - SC_HOST_NOT_FOUND=2; - SC_URL_BLOCKED=3; - SC_CLIENT_ERROR=4; - SC_INTERNAL_SERVER_ERROR=5; - SC_NOT_SUPPORTED=6; - SC_REMOTE_DEBUG_MODE=7; - SC_CONNECTION_CLOSED=8; - SC_HTTP_OPTIONS_THIS=9; - SC_FILE_REQUEST=10; - SC_MOVED_PERMANENTLY=11; - SC_CONFIG_RQ = 12; - } - - private Jhttpp2Server server; - - /** downstream connections */ - private Socket client; - private BufferedOutputStream out; - private Jhttpp2ClientInputStream in; - - /** upstream connections */ - private Socket HTTP_Socket; - private BufferedOutputStream HTTP_out; - private BufferedInputStream HTTP_in; - - public Jhttpp2HTTPSession(Jhttpp2Server server,Socket client) { - init(); - in = new Jhttpp2ClientInputStream(server,this,client.getInputStream());//,true); - out = new BufferedOutputStream(client.getOutputStream()); - this.server=server; - this.client=client; - start(); - } - public Socket getLocalSocket() { - return client; - } - public Socket getRemoteSocket() { - return HTTP_Socket; - } - public boolean isTunnel() { - return in.isTunnel(); - } - public boolean notConnected() { - return HTTP_Socket==null; - } - public void sendHeader(int a,boolean b) { - sendHeader(a); - endHeader(); - out.flush(); - } - public void sendHeader(int status, String content_type, long content_length) { - sendHeader(status); - sendLine("Content-Length", String.valueOf(content_length)); - sendLine("Content-Type", content_type ); - } - public void sendLine(String s) { - write(out,s + "\r\n"); - } - public void sendLine(String header, String s) { - write(out,header + ": " + s + "\r\n"); - } - public void endHeader() { - write(out,"\r\n"); - } - public void run() { - if (server.debug)server.writeLog("begin http session"); - server.increaseNumConnections(); - handleRequest(); - in.close(); // since 0.4.10b - out.close(); - client.close(); - // close upstream connections (webserver or other proxy) - if (!notConnected()) { - HTTP_Socket.close(); - HTTP_out.close(); - HTTP_in.close(); - } - server.decreaseNumConnections(); - if (server.debug)server.writeLog("end http session"); - } - /** sends a message to the user */ - public void sendErrorMSG(int a,String info) { - String statuscode = sendHeader(a); - String localhost = "localhost"+":"+server.port; - String msg = "\r" - + "\r" - + "" + statuscode + "\r" - + "\r" // use css style sheet in htdocs - + "\r" - + "

    HTTP " + statuscode + "

    \r" - + "
    \r" - + "

    Your request for the following URL failed:

    " - + "

    " + in.getFullURL() + "

    \r" - + "

    Reason: " + info + "

    " - + "
    \r" - + "

    jHTTPp2 HTTP Proxy, Version " + server.getServerVersion() + " at " + localhost - + "
    Copyright © 2001-2003 Benjamin Kohl

    \r" - + "

    jHTTPp2 local website Configuration

    " - + ""; - sendLine("Content-Length",String.valueOf(msg.length())); - sendLine("Content-Type","text/html; charset=iso-8859-1"); - endHeader(); - write(out,msg); - out.flush(); - } - - public String sendHeader(int a) { - String stat; - if (a==200) - stat="200 OK"; - else if (a==202) - stat="202 Accepted"; - else if (a==300) - stat="300 Ambiguous"; - else if (a==301) - stat="301 Moved Permanently"; - else if (a==400) - stat="400 Bad Request"; - else if (a==401) - stat="401 Denied"; - else if (a==403) - stat="403 Forbidden"; - else if (a==404) - stat="404 Not Found"; - else if (a==405) - stat="405 Bad Method"; - else if (a==413) - stat="413 Request Entity Too Large"; - else if (a==415) - stat="415 Unsupported Media"; - else if (a==501) - stat="501 Not Implemented"; - else if (a==502) - stat="502 Bad Gateway"; - else if (a==504) - stat="504 Gateway Timeout"; - else if (a==505) - stat="505 HTTP Version Not Supported"; - else - stat="500 Internal Server Error"; - sendLine(server.getHttpVersion() + " " + stat); - sendLine("Server",server.getServerIdentification()); - if (a==501) - sendLine("Allow","GET, HEAD, POST, PUT, DELETE, CONNECT"); - sendLine("Cache-Control", "no-cache, must-revalidate"); - sendLine("Connection","close"); - return stat; - } - - /** the main routine, where it all happens */ - public int handleRequest() { - InetAddress remote_host; - Jhttpp2Read remote_in=null; - int remote_port; - byte[] b=new byte[65536]; - int numread=in.read(b); - if (numread==-2) - return -1; - boolean cnt=true; - while(cnt) { // with this loop we support persistent connections - if (numread==-1) { // -1 signals an error - if (in.getStatusCode()!=SC_CONNECTING_TO_HOST) { - int code=in.getStatusCode(); - if (code==SC_CONNECTION_CLOSED) { - } else if (code==SC_CLIENT_ERROR) { - sendErrorMSG(400,"Your client sent a request that this proxy could not understand. (" + in.getErrorDescription() + ")"); - } else if (code==SC_HOST_NOT_FOUND) - sendErrorMSG(504,"Host not found.
    jHTTPp2 was unable to resolve the hostname of this request.
    Perhaps the hostname was misspelled, the server is down or you have no connection to the internet."); - else if (code==SC_INTERNAL_SERVER_ERROR) - sendErrorMSG(500,"Server Error! (" + in.getErrorDescription() + ")"); - else if (code==SC_NOT_SUPPORTED) - sendErrorMSG(501,"Your client used a HTTP method that this proxy doesn't support: (" + in.getErrorDescription() + ")"); - else if (code==SC_URL_BLOCKED) { - if (in.getErrorDescription()!=null && in.getErrorDescription().length()>0) - sendErrorMSG(403,in.getErrorDescription()); - else - sendErrorMSG(403,"The request for this URL was denied by the jHTTPp2 URL-Filter."); - } else if (code==SC_HTTP_OPTIONS_THIS) { - sendHeader(200); endHeader(); - } else if (code==SC_FILE_REQUEST) - file_handler(); - else if (code==SC_CONFIG_RQ) - admin_handler(b); - //case SC_HTTP_TRACE: - else if (code==SC_MOVED_PERMANENTLY) { - sendHeader(301); - write(out,"Location: " + in.getErrorDescription() + "\r\n"); - endHeader(); - out.flush(); - } - cnt=false;// return from main loop. - } else { // also an error because we are not connected (or to the wrong host) - // Creates a new connection to a remote host. - if (!notConnected()) { - HTTP_Socket.close(); - } - numread=in.getHeaderLength(); // get the header length - if (!server.use_proxy) {// sets up hostname and port - remote_host=in.getRemoteHost(); - remote_port=in.remote_port; - } else { - remote_host=server.proxy; - remote_port=server.proxy_port; - } - connect(remote_host,remote_port); - if (!in.isTunnel() || (in.isTunnel() && server.use_proxy)) - { // no SSL-Tunnel or SSL-Tunnel with another remote proxy: simply forward the request - HTTP_out.write(b, 0, numread); - HTTP_out.flush(); - } - else - { // SSL-Tunnel with "CONNECT": creates a tunnel connection with the server - sendLine(server.getHttpVersion() + " 200 Connection established"); - sendLine("Proxy-Agent",server.getServerIdentification()); - endHeader(); out.flush(); - } - remote_in = new Jhttpp2Read(server,this, HTTP_in, out); // reads data from the remote server - server.addBytesWritten(numread); - } - } - if (cnt) { - while(cnt) { // reads data from the client - numread=in.read(b); - if (numread==-2) - return -1; - if (numread!=-1) { - HTTP_out.write(b, 0, numread); - HTTP_out.flush(); - server.addBytesWritten(numread); - } else cnt=false; - } // end of inner loop - cnt=true; - } - }// end of main loop - out.flush(); - if (!notConnected() && remote_in != null) - remote_in.close(); // close Jhttpp2Read thread - return 0; - } - /** connects to the given host and port */ - public void connect(InetAddress host,int port) { - HTTP_Socket = new Socket(host,port); - HTTP_in = new BufferedInputStream(HTTP_Socket.getInputStream()); - HTTP_out = new BufferedOutputStream(HTTP_Socket.getOutputStream()); - } - /** converts an String into a Byte-Array to write it with the OutputStream */ - public void write(BufferedOutputStream o,String p) { - o.write(p.getBytes(),0,p.length()); - } - - /** - * Small webserver for local files in {app}/htdocs - * @since 0.4.04 - */ - public void file_handler() { - if (!server.www_server) { - sendErrorMSG(500, "The jHTTPp2 built-in WWW server module is disabled."); - return; - } - String filename=in.url; - if (filename.equals("/")) filename="index.html"; // convert / to index.html - else if (filename.startsWith("/")) filename=filename.substring(1); - if (filename.endsWith("/")) filename+="index.html"; // add index.html, if ending with / - File file = new File("htdocs/" + filename); // access only files in "htdocs" - if (true// !file.exists() || !file.canRead() // be sure that we can read the file - || filename.indexOf("..")!=-1 // don't allow ".." !!! - // || file.isDirectory() -) { // dont't read if it's a directory - sendErrorMSG(404,"The requested file /" + filename + " was not found or the path is invalid."); - return; - } - int pos = filename.lastIndexOf("."); // MIME type of the specified file - String content_type="text/plain"; // all unknown content types will be marked as text/plain - if (pos != -1) { - String extension = filename.substring(pos+1); - if (extension.equalsIgnoreCase("htm") || (extension.equalsIgnoreCase("html"))) content_type="text/html; charset=iso-8859-1"; - else if (extension.equalsIgnoreCase("jpg") || (extension.equalsIgnoreCase("jpeg"))) content_type="image/jpeg"; - else if (extension.equalsIgnoreCase("gif")) content_type = "image/gif"; - else if (extension.equalsIgnoreCase("png")) content_type = "image/png"; - else if (extension.equalsIgnoreCase("css")) content_type = "text/css"; - else if (extension.equalsIgnoreCase("pdf")) content_type = "application/pdf"; - else if (extension.equalsIgnoreCase("ps") || extension.equalsIgnoreCase("eps")) content_type = "application/postscript"; - else if (extension.equalsIgnoreCase("xml")) content_type = "text/xml"; - } - sendHeader(200,content_type, file.length() ); - endHeader(); - BufferedInputStream file_in = new BufferedInputStream(new FileInputStream(file)); - byte[] buffer=new byte[4096]; - int a=file_in.read(buffer); - while (a!=-1) { // read until EOF - out.write(buffer,0,a); - a = file_in.read(buffer); - } - out.flush(); - file_in.close(); // finished! - } - /** - * @since 0.4.10b - */ - public int getStatus() - { - return in.getStatusCode(); - } - /** - * @since 0.4.20a - * admin webpage - */ - public void admin_handler(byte[] b) { - } -} - diff --git a/Robust/src/Benchmarks/Jhttpp2/Java/Jhttpp2Launcher.java b/Robust/src/Benchmarks/Jhttpp2/Java/Jhttpp2Launcher.java deleted file mode 100755 index 9d468596..00000000 --- a/Robust/src/Benchmarks/Jhttpp2/Java/Jhttpp2Launcher.java +++ /dev/null @@ -1,31 +0,0 @@ -/* Written and copyright 2001-2003 Benjamin Kohl. - * Distributed under the GNU General Public License; see the README file. - * This code comes with NO WARRANTY. - */ - -//import java.awt.Dimension; -//import java.awt.Toolkit; -//import javax.swing.UIManager; - -//import Jhttpp2MainFrame; -/** - * Title: jHTTPp2: Java HTTP Filter Proxy - * Description: starts thwe Swing GUI or the console-mode only proxy - * Copyright: Copyright (c) 2001-2003 - * - * @author Benjamin Kohl - */ - -public class Jhttpp2Launcher { - - public static void main(String[] args) { - Jhttpp2Server server = new Jhttpp2Server(true); - if (server.error) { - System.printString("Error: " + server.error_msg); - } - else { - server.start(); - System.printString("Running on port " + server.port+"\n"); - } - } -} diff --git a/Robust/src/Benchmarks/Jhttpp2/Java/Jhttpp2Read.java b/Robust/src/Benchmarks/Jhttpp2/Java/Jhttpp2Read.java deleted file mode 100755 index 567c53f4..00000000 --- a/Robust/src/Benchmarks/Jhttpp2/Java/Jhttpp2Read.java +++ /dev/null @@ -1,58 +0,0 @@ -/* Written and copyright 2001-2003 Benjamin Kohl. - * Distributed under the GNU General Public License; see the README file. - * This code comes with NO WARRANTY. - */ - -import java.io.BufferedInputStream; -import java.io.BufferedOutputStream; -import java.io.IOException; -/** - File: Jhttpp2Read.java - reads from a Jhttpp2ClientInputStream and writes to the BufferedOutputStream - - @author Benjamin Kohl -*/ -public class Jhttpp2Read extends Thread -{ - private final int BUFFER_SIZE; - private BufferedInputStream in; - private BufferedOutputStream out; - private Jhttpp2HTTPSession connection; - private Jhttpp2Server server; - - public Jhttpp2Read(Jhttpp2Server server,Jhttpp2HTTPSession connection,BufferedInputStream l_in, BufferedOutputStream l_out) { - BUFFER_SIZE=96000; - in=l_in; - out=l_out; - this.connection=connection; - this.server=server; - start(); - } - public void run() { - read(); - } - private void read() { - int bytes_read=0; - byte[] buf=new byte[BUFFER_SIZE]; - boolean cnt=true; - while(cnt) { - bytes_read=in.read(buf); - if (bytes_read!=-1) { - out.write(buf,0,bytes_read); - out.flush(); - server.addBytesRead(bytes_read); - } else cnt=false; - } - if (connection.getStatus()!=connection.SC_CONNECTING_TO_HOST) // *uaaahhh*: fixes a very strange bug - connection.getLocalSocket().close(); - // why? If we are connecting to a new host (and this thread is already running!) , the upstream - // socket will be closed. So we get here and close our own downstream socket..... and the browser - // displays an empty page because jhttpp2 - // closes the connection..... so close the downstream socket only when NOT connecting to a new host.... - } - public void close() { - in.close(); - } -} - - diff --git a/Robust/src/Benchmarks/Jhttpp2/Java/Jhttpp2Server.java b/Robust/src/Benchmarks/Jhttpp2/Java/Jhttpp2Server.java deleted file mode 100755 index 40b3566f..00000000 --- a/Robust/src/Benchmarks/Jhttpp2/Java/Jhttpp2Server.java +++ /dev/null @@ -1,323 +0,0 @@ -/* Written and copyright 2001-2003 Benjamin Kohl. - * Distributed under the GNU General Public License; see the README file. - * This code comes with NO WARRANTY. - * More Information and documentation: HTTP://jhttp2.sourceforge.net/ - */ - -import java.net.ServerSocket; -import java.net.Socket; -import java.net.UnknownHostException; -import java.net.InetAddress; -import java.net.BindException; - -import java.io.*; - -import java.util.Vector; -import java.util.Date; - -public class Jhttpp2Server extends Thread -{ - private static final String CRLF; - private final String VERSION; - private final String V_SPECIAL; - private final String HTTP_VERSION; - private final String MAIN_LOGFILE; - - private final String DATA_FILE; - private final String SERVER_PROPERTIES_FILE; - - private String http_useragent; - private ServerSocket listen; - private BufferedWriter logfile; - private BufferedWriter access_logfile; - private long bytesread; - private long byteswritten; - private int numconnections; - - private boolean enable_cookies_by_default; - private WildcardDictionary dic; - private Vector urlactions; - - public final int DEFAULT_SERVER_PORT; - public final String WEB_CONFIG_FILE; - - public int port; - public InetAddress proxy; - public int proxy_port; - - public long config_auth; - public long config_session_id; - public String config_user; - public String config_password; - - public static boolean error; - public static String error_msg; - - public boolean use_proxy; - public boolean block_urls; - public boolean filter_http; - public boolean debug; - public boolean log_access; - public String log_access_filename; - public boolean webconfig; - public boolean www_server; - - - public initvars() { - CRLF="\r\n"; - VERSION = "0.4.62"; - V_SPECIAL = " 2003-05-20"; - HTTP_VERSION = "HTTP/1.1"; - MAIN_LOGFILE = "server.log"; - DATA_FILE = "server.data"; - SERVER_PROPERTIES_FILE = "server.properties"; - http_useragent = "Mozilla/4.0 (compatible; MSIE 4.0; WindowsNT 5.0)"; - enable_cookies_by_default=true; - dic = new WildcardDictionary(); - urlactions = new Vector(); - DEFAULT_SERVER_PORT = 8088; - WEB_CONFIG_FILE = "admin/jp2-config"; - port = DEFAULT_SERVER_PORT; - proxy_port = 0; - config_auth = 0; - config_session_id = 0; - config_user = "root"; - config_password = "geheim"; - use_proxy=false; - block_urls=false; - filter_http=false; - debug=false; - log_access = true; - log_access_filename="paccess.log"; - webconfig = true; - www_server = true; -} - - void init() - { - if(log_access) { - access_logfile=new BufferedWriter(new FileWriter(log_access_filename,true)); - } - - logfile=new BufferedWriter(new FileWriter(MAIN_LOGFILE,true)); - writeLog("server startup..."); - - listen = new ServerSocket(port); - - if (error) { - writeLog(error_msg); - return; - } - } - public Jhttpp2Server() { - initvars(); - init(); - } - public Jhttpp2Server(boolean b) - { - initvars(); - System.printString("jHTTPp2 HTTP Proxy Server Release " + getServerVersion() + "\r\n" - +"Copyright (c) 2001-2003 Benjamin Kohl \r\n" - +"This software comes with ABSOLUTELY NO WARRANTY OF ANY KIND.\r\n" - +"http://jhttp2.sourceforge.net/\n"); - init(); - } - /** calls init(), sets up the serverport and starts for each connection - * new Jhttpp2Connection - */ - void serve() - { - writeLog("Server running."); - while(true) - { - Socket client = listen.accept(); - new Jhttpp2HTTPSession(this,client); - } - } - public void run() - { - serve(); - } - public void setErrorMsg(String a) - { - error=true; - error_msg=a; - } - /** - * Tests what method is used with the reqest - * @return -1 if the server doesn't support the method - */ - public int getHttpMethod(String d) - { - if (startsWith(d,"GET") || startsWith(d,"HEAD")) return 0; - if (startsWith(d,"POST") || startsWith(d,"PUT")) return 1; - if (startsWith(d,"CONNECT")) return 2; - if (startsWith(d,"OPTIONS")) return 3; - - return -1;/* No match... - - Following methods are not implemented: - || startsWith(d,"TRACE") */ - } - public boolean startsWith(String a,String what) - { - int l=what.length(); - int l2=a.length(); - if (l2>l) - return a.substring(0,l).equals(what); - else - return false; - } - /** - *@return the Server response-header field - */ - public String getServerIdentification() - { - return "jHTTPp2/" + getServerVersion(); - } - public String getServerVersion() - { - return VERSION + V_SPECIAL; - } - /** - * saves all settings with a ObjectOutputStream into a file - * @since 0.2.10 - */ - /** restores all Jhttpp2 options from "settings.dat" - * @since 0.2.10 - */ - /** - * @return the HTTP version used by jHTTPp2 - */ - public String getHttpVersion() - { - return HTTP_VERSION; - } - /** the User-Agent header field - * @since 0.2.17 - * @return User-Agent String - */ - public String getUserAgent() - { - return http_useragent; - } - public void setUserAgent(String ua) - { - http_useragent=ua; - } - /** - * writes into the server log file and adds a new line - * @since 0.2.21 - */ - public void writeLog(String s) - { - writeLog(s,true); - } - /** writes to the server log file - * @since 0.2.21 - */ - public void writeLog(String s,boolean b) - { - s=new Date().toString() + " " + s; - logfile.write(s,0,s.length()); - if (b) logfile.newLine(); - logfile.flush(); - if (debug)System.printString(s); - } - - public void closeLog() - { - writeLog("Server shutdown."); - logfile.flush(); - logfile.close(); - access_logfile.close(); - } - - public void addBytesRead(long read) - { - bytesread+=read; - } - /** - * Functions for the jHTTPp2 statistics: - * How many connections - * Bytes read/written - * @since 0.3.0 - */ - public void addBytesWritten(int written) - { - byteswritten+=written; - } - public int getServerConnections() - { - return numconnections; - } - public long getBytesRead() - { - return bytesread; - } - public long getBytesWritten() - { - return byteswritten; - } - public void increaseNumConnections() - { - numconnections++; - } - public void decreaseNumConnections() - { - numconnections--; - } - public void AuthenticateUser(String u,String p) { - if (config_user.equals(u) && config_password.equals(p)) { - config_auth = 1; - } else config_auth = 0; - } - public String getGMTString() - { - return new Date().toString(); - } - public Jhttpp2URLMatch findMatch(String url) - { - return (Jhttpp2URLMatch)dic.get(url); - } - public WildcardDictionary getWildcardDictionary() - { - return dic; - } - public Vector getURLActions() - { - return urlactions; - } - public boolean enableCookiesByDefault() - { - return this.enable_cookies_by_default; - } - public void enableCookiesByDefault(boolean a) - { - enable_cookies_by_default=a; - } - public void resetStat() - { - bytesread=0; - byteswritten=0; - } - /** - * @since 0.4.10a - */ - /** - * @since 0.4.10a - */ - /** - * @since 0.4.10a - */ - public void logAccess(String s) - { - access_logfile.write("[" + new Date().toString() + "] " + s + "\r\n"); - access_logfile.flush(); - } - public void shutdownServer() { - closeLog(); - System.exit(0); - } - -} diff --git a/Robust/src/Benchmarks/Jhttpp2/Java/Jhttpp2URLMatch.java b/Robust/src/Benchmarks/Jhttpp2/Java/Jhttpp2URLMatch.java deleted file mode 100755 index e37533c4..00000000 --- a/Robust/src/Benchmarks/Jhttpp2/Java/Jhttpp2URLMatch.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Title: jHTTPp2: Java HTTP Filter Proxy - * Copyright: Copyright (c) 2001-2003 Benjamin Kohl - * @author Benjamin Kohl - * @version 0.2.8 - */ - -public class Jhttpp2URLMatch { - String match; - String desc; - boolean cookies_enabled; - int actionindex; - - public Jhttpp2URLMatch(String match,boolean cookies_enabled,int actionindex,String description) - { - this.match=match; - this.cookies_enabled=cookies_enabled; - this.actionindex=actionindex; - this.desc=description; - } - public String getMatch() - { - return match; - } - public boolean getCookiesEnabled() - { - return cookies_enabled; - } - public int getActionIndex() - { - return actionindex; - } - public String getDescription() - { - return desc; - } - public String toString() - { - return "\"" + match + "\" " + desc; - } -} diff --git a/Robust/src/Benchmarks/Jhttpp2/Java/OnURLAction.java b/Robust/src/Benchmarks/Jhttpp2/Java/OnURLAction.java deleted file mode 100755 index 01915587..00000000 --- a/Robust/src/Benchmarks/Jhttpp2/Java/OnURLAction.java +++ /dev/null @@ -1,81 +0,0 @@ -/* Written and copyright 2001 Benjamin Kohl. - * Distributed under the GNU General Public License; see the README file. - * This code comes with NO WARRANTY. - * - * Title: jHTTPp2: Java HTTP Filter Proxy - * Description: An OpenSource HTTP Proxy - * Copyright: Copyright (c) 2001 Benjamin Kohl - * @author Benjamin Kohl - */ - -public class OnURLAction { - - private String customerrortext, desc, httppath, newlocation; - private boolean log,block,customtext,http_rq,anotherlocation; - public OnURLAction(String desc) - { - this.desc=desc; - } - public void denyAccess(String customerrortext) - { - this.block=true; - this.customtext=true; - this.customerrortext=customerrortext; - } - public void denyAccess() - { - block=true; - } - public void logAccess() - { - log=true; - } - public void anotherLocation(String newlocation) - { - this.anotherlocation=true; - this.newlocation=newlocation; - } - - public boolean onAccesssDeny() - { - return block; - } - public boolean onAccessLog() - { - return log; - } - public boolean onAccessDenyWithCustomText() - { - return customtext; - } - public boolean onAccessSendHTTPRequest() - { - return http_rq; - } - public boolean onAccessRedirect() - { - return this.anotherlocation; - } - public String newLocation() - { - return this.newlocation; - } - public void setHTTPAction(boolean http_rq, String httppath) - { - this.http_rq=http_rq; - this.httppath=httppath; - } - public String getCustomErrorText() - { - return customerrortext; - } - public String getDescription() - { - return desc; - } - public String toString() - { - return desc; - } - -} diff --git a/Robust/src/Benchmarks/Jhttpp2/Java/WildcardDictionary.java b/Robust/src/Benchmarks/Jhttpp2/Java/WildcardDictionary.java deleted file mode 100755 index 9d8bab67..00000000 --- a/Robust/src/Benchmarks/Jhttpp2/Java/WildcardDictionary.java +++ /dev/null @@ -1,182 +0,0 @@ -// WildcardDictionary - a dictionary with wildcard lookups -// -// Copyright (C) 1996 by Jef Poskanzer . All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions -// are met: -// 1. Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// 2. Redistributions in binary form must reproduce the above copyright -// notice, this list of conditions and the following disclaimer in the -// documentation and/or other materials provided with the distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE -// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS -// OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) -// HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT -// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY -// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -// SUCH DAMAGE. -// -// Visit the ACME Labs Java page for up-to-date versions of this and other -// fine Java utilities: http://www.acme.com/java/ - -// package Acme; - -import java.util.*; - -/// A dictionary with wildcard lookups. -//

    -// The keys in this dictionary are wildcard patterns. When you do a get(), -// the string you pass in is matched against all the patterns, and the -// first match is returned. -//

    -// The wildcard matcher is fairly simple, it implements * meaning any -// string, ? meaning any single character, and | separating multiple -// patterns. All other characters must match literally. -//

    -// Fetch the software.
    -// Fetch the entire Acme package. -//

    -// @see Acme.Utils#match - -public class WildcardDictionary extends Dictionary { - - private Vector keys; - private Vector elements; - - /// Constructor. - public WildcardDictionary() { - keys = new Vector(); - elements = new Vector(); - } - - /// Returns the number of elements contained within the dictionary. - public int size() { - return elements.size(); - } - - /// Returns true if the dictionary contains no elements. - public boolean isEmpty() { - return size() == 0; - } - - /// Returns an enumeration of the dictionary's keys. - public Enumeration keys() { - return keys.elements(); - } - - /// Returns an enumeration of the elements. Use the Enumeration methods - // on the returned object to fetch the elements sequentially. - public Enumeration elements() { - return elements.elements(); - } - - /// Gets the object associated with the specified key in the dictionary. - // The key is assumed to be a String, which is matched against - // the wildcard-pattern keys in the dictionary. - // @param key the string to match - // @returns the element for the key, or null if there's no match - // @see Acme.Utils#match - public synchronized Object get( Object key ) - { - String sKey = (String) key; - for ( int i = 0; i < keys.size(); ++i ) - { - String thisKey = (String) keys.elementAt( i ); - if ( match( thisKey, sKey ) ) - return elements.elementAt( i ); - } - return null; - } - - /// Puts the specified element into the Dictionary, using the specified - // key. The element may be retrieved by doing a get() with the same - // key. The key and the element cannot be null. - // @param key the specified wildcard-pattern key - // @param value the specified element - // @return the old value of the key, or null if it did not have one. - // @exception NullPointerException If the value of the specified - // element is null. - public synchronized Object put( Object key, Object element ) - { - int i = keys.indexOf( key ); - if ( i != -1 ) - { - Object oldElement = elements.elementAt( i ); - elements.setElementAt( element, i ); - return oldElement; - } - else - { - keys.addElement( key ); - elements.addElement( element ); - return null; - } - } - - /// Removes the element corresponding to the key. Does nothing if the - // key is not present. - // @param key the key that needs to be removed - // @return the value of key, or null if the key was not found. - public synchronized Object remove( Object key ) - { - int i = keys.indexOf( key ); - if ( i != -1 ) - { - Object oldElement = elements.elementAt( i ); - keys.removeElementAt( i ); - elements.removeElementAt( i ); - return oldElement; - } - else - return null; - } - - /** Checks whether a string matches a given wildcard pattern. - * Only does ? and *, and multiple patterns separated by |. - */ - public static boolean match( String pattern, String string ) { - for ( int p = 0; true; ++p ) { - boolean cnt=true; - for ( int s = 0; cnt; ++p, ++s ) { - boolean sEnd = ( s >= string.length() ); - boolean pEnd = ( p >= pattern.length() || - pattern.charAt( p ) == '|' ); - if ( sEnd && pEnd ) - return true; - if ( sEnd || pEnd ) - cnt=false; - else if ( pattern.charAt( p ) != '?' ) { - if ( pattern.charAt( p ) == '*' ) { - int i; - ++p; - for ( i = string.length(); i >= s; --i ) - if ( match( - pattern.substring( p ), - string.substring( i ) ) ) /* not quite right */ - return true; - cnt=false; - } - if ( pattern.charAt( p ) != string.charAt( s ) ) - cnt=false; - } - } - p = pattern.indexOf( '|', p ); - if ( p == -1 ) - return false; - } - } - /** - * Deletes all elements and keys. - */ - public void removeAllElements() { - elements.clear(); - keys.clear(); - } -} diff --git a/Robust/src/Benchmarks/MapReduce/Java/Configuration.java b/Robust/src/Benchmarks/MapReduce/Java/Configuration.java deleted file mode 100644 index 9a245f51..00000000 --- a/Robust/src/Benchmarks/MapReduce/Java/Configuration.java +++ /dev/null @@ -1,55 +0,0 @@ -//package mapreduce; - -public class Configuration { - - MapReduceBase mapreducer; - - int m; - int r; - char seperator; - String inputfile; - - public Configuration() { - this.mapreducer = null; - } - - public MapReduceBase getMapReduce() { - return this.mapreducer; - } - - public void setMapReduceClass(MapReduceBase mapreducer) { - this.mapreducer = mapreducer; - } - - public int getM() { - return m; - } - - public void setM(int m) { - this.m = m; - } - - public int getR() { - return r; - } - - public void setR(int r) { - this.r = r; - } - - public char getSeperator() { - return seperator; - } - - public void setSeperator(char seperator) { - this.seperator = seperator; - } - - public String getInputfile() { - return inputfile; - } - - public void setInputfile(String inputfile) { - this.inputfile = inputfile; - } -} diff --git a/Robust/src/Benchmarks/MapReduce/Java/Configured.java b/Robust/src/Benchmarks/MapReduce/Java/Configured.java deleted file mode 100644 index 5cce432b..00000000 --- a/Robust/src/Benchmarks/MapReduce/Java/Configured.java +++ /dev/null @@ -1,22 +0,0 @@ -//package mapreduce; - -public class Configured { - - Configuration conf; - - public Configured() { - this.conf = null; - } - - public Configured(Configuration conf) { - this.conf = conf; - } - - public Configuration getConf() { - return this.conf; - } - - public void setConf(Configuration conf) { - this.conf = conf; - } -} diff --git a/Robust/src/Benchmarks/MapReduce/Java/JobClient.java b/Robust/src/Benchmarks/MapReduce/Java/JobClient.java deleted file mode 100644 index cab79af5..00000000 --- a/Robust/src/Benchmarks/MapReduce/Java/JobClient.java +++ /dev/null @@ -1,59 +0,0 @@ -//package mapreduce; - -public class JobClient{ - - public JobClient() {} - - public static void runJob(Configuration conf) { - Splitter splitter = new Splitter(conf.getInputfile(), conf.getM(), conf.getSeperator()); - Master master = new Master(conf.getM(), conf.getR(), splitter); - - // split input file - //System.printString("Split\n"); - master.split(); - - // do 'map' - //System.printString("Map\n"); - MapWorker[] mworkers = master.assignMap(); - for(int i = 0; i < mworkers.length; ++i) { - MapWorker mworker = mworkers[i]; - mworker.setMapreducer(conf.getMapReduce()); - mworker.map(); - mworker.partition(); - } - - // register intermediate output from map workers to master - //System.printString("Mapoutput\n"); - for(int i = 0; i < mworkers.length; ++i) { - for(int j = 0; j < conf.getR(); ++j) { - String temp = mworkers[i].outputFile(j); - if(temp != null) { - master.addInterOutput(temp); - } - } - master.setMapFinish(mworkers[i].getID()); - } - //assert(master.isMapFinish()); - - // do 'reduce' - //System.printString("Reduce\n"); - ReduceWorker[] rworkers = master.assignReduce(); - for(int i = 0; i < rworkers.length; ++i) { - ReduceWorker rworker = rworkers[i]; - rworker.setMapreducer(conf.getMapReduce()); - rworker.sortgroup(); - rworker.reduce(); - } - - // merge all the intermediate output from reduce workers to master - //System.printString("Merge\n"); - for(int i = 0; i < rworkers.length; ++i) { - master.collectROutput(rworkers[i].getOutputFile()); - master.setReduceFinish(rworkers[i].getID()); - } - //assert(master.isReduceFinish()); - - System./*out.println*/printString("Finish! Results are in the output file: " + master.getOutputFile() + "\n"); - } - -} diff --git a/Robust/src/Benchmarks/MapReduce/Java/MapReduceBase.java b/Robust/src/Benchmarks/MapReduce/Java/MapReduceBase.java deleted file mode 100644 index 21b806e6..00000000 --- a/Robust/src/Benchmarks/MapReduce/Java/MapReduceBase.java +++ /dev/null @@ -1,13 +0,0 @@ -//package mapreduce; - -//import java.util.Vector; - -public /*abstract*/ class MapReduceBase { - - public MapReduceBase() {} - - public /*abstract*/ void map(String key, String value, OutputCollector output); - - public /*abstract*/ void reduce(String key, Vector values, OutputCollector output); -} - diff --git a/Robust/src/Benchmarks/MapReduce/Java/MapWorker.java b/Robust/src/Benchmarks/MapReduce/Java/MapWorker.java deleted file mode 100644 index f5b59117..00000000 --- a/Robust/src/Benchmarks/MapReduce/Java/MapWorker.java +++ /dev/null @@ -1,119 +0,0 @@ -//package mapreduce; - -//import java.io.FileOutputStream; - -public class MapWorker { - - int ID; - MapReduceBase mapreducer; - - int r; - String key; - String value; - OutputCollector output; - - String[] locations; - FileOutputStream[] outputs; - - public MapWorker(String key, String value, int r, int id) { - this.ID = id; - this.mapreducer = null; - - this.r = r; - this.key = key; - this.value = value; - this.output = new OutputCollector(); - - locations = new String[r]; - for(int i = 0; i < r; ++i) { - StringBuffer temp = new StringBuffer("/scratch/mapreduce_java/output-intermediate-map-"); - temp.append(String.valueOf(ID)); - temp.append("-of-"); - temp.append(String.valueOf(r)); - temp.append("_"); - temp.append(String.valueOf(i)); - temp.append(".dat"); - locations[i] = new String(temp); - } - - outputs = new FileOutputStream[r]; - for(int i = 0; i < r; ++i) { - outputs[i] = null; - } - } - - public MapReduceBase getMapreducer() { - return mapreducer; - } - - public void setMapreducer(MapReduceBase mapreducer) { - this.mapreducer = mapreducer; - } - - public void map() { - /*if(ID % 2 == 1) { - String temp = locations[locations.length]; - }*/ - - this.mapreducer.map(key, value, output); - } - - public void partition() { - /*if(ID % 2 == 1) { - String temp = locations[locations.length]; - }*/ - - //try{ - int size = this.output.size(); - for(int i = 0; i < size; ++i) { - String key = this.output.getKey(i); - String value = this.output.getValue(i); - // use the hashcode of key to decide which intermediate output - // this pair should be in - //int hash = key.hashCode(); - int index = (int)Math.abs(key.hashCode()) % this.r; - FileOutputStream oStream = outputs[index]; - if(oStream == null) { - // open the file - String filepath = locations[index]; - oStream = new FileOutputStream(filepath, true); // append - outputs[index] = oStream; - } - // format: key value\n - oStream.write(key.getBytes()); - oStream.write(' '); - oStream.write(value.getBytes()); - oStream.write('\n'); - oStream.flush(); - } - - // close the output files - for(int i = 0; i < this.outputs.length; ++i) { - FileOutputStream temp = this.outputs[i]; - if(temp != null) { - temp.close(); - } - } - /*} catch(Exception e) { - e.printStackTrace(); - System.exit(-1); - }*/ - } - - public String outputFile(int i) { - if(outputs[i] != null) { - return locations[i]; - } else { - return null; - } - } - - public int getID() { - return this.ID; - } - - public int getR() { - return this.r; - } - -} diff --git a/Robust/src/Benchmarks/MapReduce/Java/Master.java b/Robust/src/Benchmarks/MapReduce/Java/Master.java deleted file mode 100644 index 39ac5cc4..00000000 --- a/Robust/src/Benchmarks/MapReduce/Java/Master.java +++ /dev/null @@ -1,158 +0,0 @@ -//package mapreduce; - -/*import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.util.Vector;*/ - -public class Master { - - int m; - int r; - int[] mworkerStates; // array of map worker's state - // 0: idle 1: process 2: finished 3: fail - int[] rworkerStates; // array of reduce worker's state - Vector[] interoutputs; // array of string vector containing - // paths of intermediate outputs from - // map worker - - Splitter splitter; - - String outputfile; // path of final output file - - boolean partial; - - public Master(int m, int r, Splitter splitter) { - this.m = m; - this.r = r; - - mworkerStates = new int[m]; - rworkerStates = new int[r]; - for(int i = 0; i < m; ++i) { - mworkerStates[i] = 0; - } - for(int i = 0; i < r; ++i) { - rworkerStates[i] = 0; - } - - interoutputs = new Vector[r]; - for(int i = 0; i < r; ++i) { - interoutputs[i] = null; - } - - this.splitter = splitter; - this.outputfile = new String("/scratch/mapreduce_java/output.dat"); - - this.partial = false; - } - - public int getR() { - return this.r; - } - - public String getOutputFile() { - return this.outputfile; - } - - public boolean isPartial() { - return this.partial; - } - - public void setPartial(boolean partial) { - this.partial = partial || this.partial; - } - - public void split() { - splitter.split(); - } - - public MapWorker[] assignMap() { - String[] contentsplits = splitter.getSlices(); - MapWorker[] mworkers = new MapWorker[contentsplits.length]; - for(int i = 0; i < contentsplits.length; ++i) { - //System.printString("*************************\n"); - //System.printString(contentsplits[i] + "\n"); - //System.printString("*************************\n"); - MapWorker mworker = new MapWorker(splitter.getFilename(), contentsplits[i], r, i); - mworkerStates[i] = 1; - mworkers[i] = mworker; - } - return mworkers; - } - - public void setMapFinish(int i) { - mworkerStates[i] = 2; - } - - public void setMapFail(int i) { - mworkerStates[i] = 3; - } - - public boolean isMapFinish() { - for(int i = 0; i < mworkerStates.length; ++i) { - if(mworkerStates[i] == 1) { - return false; - } - } - - return true; - } - - public void addInterOutput(String interoutput) { - int start = interoutput.lastindexOf('_'); - int end = interoutput.indexOf('.'); - int index = Integer.parseInt(interoutput.subString(start + 1, end)); - //System.printString(interoutput.subString(start + 1, end) + "\n"); - if(interoutputs[index] == null) { - interoutputs[index] = new Vector(); - } - interoutputs[index].addElement(interoutput); - } - - public ReduceWorker[] assignReduce() { - ReduceWorker[] rworkers = new ReduceWorker[interoutputs.length]; - for(int i = 0; i < interoutputs.length; ++i) { - ReduceWorker rworker = new ReduceWorker(interoutputs[i], i); - rworkerStates[i] = 1; - rworkers[i] = rworker; - } - return rworkers; - } - - public void setReduceFinish(int i) { - rworkerStates[i] = 2; - } - - public void setReduceFail(int i) { - rworkerStates[i] = 3; - } - - public boolean isReduceFinish() { - for(int i = 0; i < rworkerStates.length; ++i) { - if(rworkerStates[i] == 1) { - return false; - } - } - - return true; - } - - public void collectROutput(String file) { - //try{ - FileInputStream iStream = new FileInputStream(file); - FileOutputStream oStream = new FileOutputStream(outputfile, true); - byte[] b = new byte[1024 * 10]; - int length = iStream.read(b); - if(length < 0) { - System./*out.println*/printString("Error! Can not read from intermediate output file from reduce worker: " + file + "\n"); - System.exit(-1); - } - //System.printString(new String(b, 0, length) + "\n"); - oStream.write(b, 0, length); - iStream.close(); - oStream.close(); - /*} catch(Exception e) { - e.printStackTrace(); - System.exit(-1); - }*/ - } -} diff --git a/Robust/src/Benchmarks/MapReduce/Java/OutputCollector.java b/Robust/src/Benchmarks/MapReduce/Java/OutputCollector.java deleted file mode 100644 index e66a6758..00000000 --- a/Robust/src/Benchmarks/MapReduce/Java/OutputCollector.java +++ /dev/null @@ -1,31 +0,0 @@ -//package mapreduce; - -//import java.util.Vector; - -public class OutputCollector { - - Vector keys; - Vector values; - - public OutputCollector() { - this.keys = new Vector(); - this.values = new Vector(); - } - - public void emit(String key, String value) { - this.keys.addElement(key); - this.values.addElement(value); - } - - public int size() { - return this.keys.size(); - } - - public String getKey(int i) { - return (String)this.keys.elementAt(i); - } - - public String getValue(int i) { - return (String)this.values.elementAt(i); - } -} diff --git a/Robust/src/Benchmarks/MapReduce/Java/ReduceWorker.java b/Robust/src/Benchmarks/MapReduce/Java/ReduceWorker.java deleted file mode 100644 index 4559882b..00000000 --- a/Robust/src/Benchmarks/MapReduce/Java/ReduceWorker.java +++ /dev/null @@ -1,167 +0,0 @@ -//package mapreduce; - -/*import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.util.HashMap; -import java.util.Vector;*/ - -import mapreduce.MapReduceBase; - -public class ReduceWorker { - - int ID; - MapReduceBase mapreducer; - - Vector interoutputs; // string vector containing paths - // of intermediate outputs from map worker - Vector keys; - HashMap values; // hashmap map key to vector of string vector - int[] sorts; // array record the sort of keys - OutputCollector output; - String outputfile; // path of the intermediate output file - - public ReduceWorker(Vector interoutputs, int id) { - this.ID = id; - this.mapreducer = null; - - this.interoutputs = interoutputs; - - this.keys = new Vector(); - this.values = new HashMap(); - //this.sorts = null; - - this.output = new OutputCollector(); - this.outputfile = "/scratch/mapreduce_java/output-intermediate-reduce-" + String.valueOf(id) + ".dat"; - } - - public MapReduceBase getMapreducer() { - return mapreducer; - } - - public void setMapreducer(MapReduceBase mapreducer) { - this.mapreducer = mapreducer; - } - - public void sortgroup() { - /*if(ID % 2 == 1) { - int a[] = new int[1]; - int temp = a[1]; - }*/ - - // group values associated to the same key - //System.printString("================================\n"); - if(interoutputs == null) { - return; - } - //try{ - for(int i = 0; i < interoutputs.size(); ++i) { - FileInputStream iStream = new FileInputStream((String)interoutputs.elementAt(i)); - byte[] b = new byte[1024 * 10]; - int length = iStream.read(b); - if(length < 0) { - System./*out.println*/printString("Error! Can not read from intermediate ouput file of map worker: " + (String)interoutputs.elementAt(i) + "\n"); - System.exit(-1); - } - String content = new String(b, 0, length); - //System.printString(content + "\n"); - int index = content.indexOf('\n'); - while(index != -1) { - String line = content.substring(0, index); - content = content.substring(index + 1); - //System.printString(line + "\n"); - int tmpindex = line.indexOf(' '); - String key = line.substring(0, tmpindex); - String value = line.substring(tmpindex + 1); - //System.printString(key + "; " + value + "\n"); - if(!this.values.containsKey(key)) { - this.values.put(key, new Vector()); - this.keys.addElement(key); - } - ((Vector)this.values.get(key)).addElement(value); - index = content.indexOf('\n'); - } - iStream.close(); - } - //System.printString("================================\n"); - - /*for(int i = 0; i < this.keys.size(); ++i) { - System.printString((String)this.keys.elementAt(i) + ", " + ((String)this.keys.elementAt(i)).hashCode() + "; "); - } - System.printString("\n");*/ - - // sort all the keys inside interoutputs - this.sorts = new int[this.keys.size()]; - // insert sorting - this.sorts[0] = 0; - int tosort = 1; - for(; tosort < this.keys.size(); ++tosort) { - int tosortkey = ((String)this.keys.elementAt(tosort)).hashCode(); - int index = tosort; - for(int i = tosort; i > 0; --i) { - if(((String)this.keys.elementAt(this.sorts[i - 1])).hashCode() > tosortkey) { - this.sorts[i] = this.sorts[i-1]; - index = i - 1; - } else { - //System.printString(i + "; " + tosort + "\n"); - index = i; - i = 0; - } - } - this.sorts[index] = tosort; - } - /*for(int i = 0; i < this.sorts.length; ++i) { - System.printString(this.sorts[i] + "; "); - } - System.printString("\n");*/ - /*} catch(IOException e) { - e.printStackTrace(); - System.exit(-1); - }*/ - } - - public void reduce() { - /*if(ID % 2 == 1) { - int a[] = new int[1]; - int temp = a[1]; - }*/ - - if(this.interoutputs != null) { - //return; - //} - for(int i = 0; i < this.sorts.length; ++i) { - String key = (String)this.keys.elementAt(this.sorts[i]); - Vector values = (Vector)this.values.get(key); - this.mapreducer.reduce(key, values, output); - } - } - - //try{ - // output all the result into some local file - int size = this.output.size(); - FileOutputStream oStream = new FileOutputStream(outputfile, true); // append - for(int i = 0; i < size; ++i) { - String key = this.output.getKey(i); - String value = this.output.getValue(i); - // format: key value\n - oStream.write(key.getBytes()); - oStream.write(' '); - oStream.write(value.getBytes()); - oStream.write('\n'); - oStream.flush(); - } - oStream.close(); - /*} catch(Exception e) { - e.printStackTrace(); - System.exit(-1); - }*/ - } - - public String getOutputFile() { - return this.outputfile; - } - - public int getID() { - return this.ID; - } -} diff --git a/Robust/src/Benchmarks/MapReduce/Java/Splitter.java b/Robust/src/Benchmarks/MapReduce/Java/Splitter.java deleted file mode 100644 index 53cae4df..00000000 --- a/Robust/src/Benchmarks/MapReduce/Java/Splitter.java +++ /dev/null @@ -1,83 +0,0 @@ -//package mapreduce; - -//import java.io.FileInputStream; -//import java.io.IOException; - -public class Splitter { - String filename; - String content; - int length; - int[] splits; - String[] slices; - - public Splitter(String path, int splitNum, char seperator) { - //try{ - //System.printString("Top of Splitter's constructor\n"); - filename = path; - FileInputStream iStream = new FileInputStream(filename); - byte[] b = new byte[1024 * 1024]; - length = iStream.read(b); - if(length < 0) { - System./*out.println*/printString("Error! Can not read from input file: " + filename + "\n"); - System.exit(-1); - } - content = new String(b, 0, length); - //System.printString(content + "\n"); - iStream.close(); - - if(splitNum == 1) { - slices = new String[1]; - slices[0] = content; - } else { - splits = new int[splitNum - 1]; - int index = 0; - int span = length / splitNum; - int temp = 0; - for(int i = 0; i < splitNum - 1; ++i) { - temp += span; - if(temp > index) { - index = temp; - while((content.charAt(index) != seperator) && (index != length - 1)) { - ++index; - } - } - splits[i] = index; - } - - this.slices = new String[splits.length + 1]; - for(int i = 0; i < this.slices.length; ++i) { - this.slices[i] = null; - } - } - /*} catch(IOException e) { - e.printStackTrace(); - System.exit(-1); - }*/ - } - - public void split() { - if(slices.length == 1) { - return; - } - int start = 0; - int end = 0; - for(int i = 0; i < splits.length; ++i) { - end = splits[i]; - if(end < start) { - slices[i] = null; - } else { - slices[i] = content.substring(start, end); - } - start = end + 1; - } - slices[slices.length - 1] = content.substring(start); - } - - public String getFilename() { - return filename; - } - - public String[] getSlices() { - return this.slices; - } -} diff --git a/Robust/src/Benchmarks/MapReduce/Java/Tool.java b/Robust/src/Benchmarks/MapReduce/Java/Tool.java deleted file mode 100644 index 5dbeb6e7..00000000 --- a/Robust/src/Benchmarks/MapReduce/Java/Tool.java +++ /dev/null @@ -1,5 +0,0 @@ -//package mapreduce; - -public /*interface*/ class Tool { - public int run(String[] args); -} diff --git a/Robust/src/Benchmarks/MapReduce/Java/ToolRunner.java b/Robust/src/Benchmarks/MapReduce/Java/ToolRunner.java deleted file mode 100644 index 82a8c5a4..00000000 --- a/Robust/src/Benchmarks/MapReduce/Java/ToolRunner.java +++ /dev/null @@ -1,9 +0,0 @@ -//package mapreduce; - -public class ToolRunner { - - public static int run(Tool tool, String[] args) { - return tool.run(args); - } - -} diff --git a/Robust/src/Benchmarks/MapReduce/Java/WordCounter.java b/Robust/src/Benchmarks/MapReduce/Java/WordCounter.java deleted file mode 100644 index c67a291b..00000000 --- a/Robust/src/Benchmarks/MapReduce/Java/WordCounter.java +++ /dev/null @@ -1,138 +0,0 @@ - -//import java.io.FileInputStream; -//import java.util.Vector; - -/*import mapreduce.Configuration; -import mapreduce.Configured; -import mapreduce.JobClient; -import mapreduce.MapReduceBase; -import mapreduce.OutputCollector; -import mapreduce.Tool; -import mapreduce.ToolRunner;*/ - -/** - * Counts the words in each line. - * For each line of input, break the line into words and emit them as - * (word, 1). - */ - public class MapReduceClass extends MapReduceBase { - - public MapReduceClass() {} - - public void map(String key, String value, OutputCollector output) { - int n = value.length(); - for (int i = 0; i < n; ) { - // Skip past leading whitespace - while ((i < n) && isspace(value.charAt(i))) { - ++i; - } - - // Find word end - int start = i; - while ((i < n) && !isspace(value.charAt(i))) { - i++; - } - - if (start < i) { - output.emit(value.substring(start, i), "1"); - } - } - } - - public void reduce(String key, Vector values, OutputCollector output) { - // Iterate over all entries with the - // // same key and add the values - int value = 0; - for(int i = 0; i < values.size(); ++i) { - value += Integer.parseInt((String)values.elementAt(i)); - } - - // Emit sum for input->key() - output.emit(key, String.valueOf(value)); - } - - boolean isspace(char c) { - if((c == ' ') || - (c == ',') || - (c == '.') || - (c == '!') || - (c == '?') || - (c == '"') || - (c == '(') || - (c == ')') || - (c == '[') || - (c == ']') || - (c == '{') || - (c == '}') || - (c == '\n')) { - return true; - } - return false; - } - } - -public class WordCounter /*implements*/extends Tool { - - public WordCounter() {} - - static int printUsage() { - System./*out.println*/printString("\n"); - return -1; - } - - /** - * The main driver for word count map/reduce program. - * Invoke this method to submit the map/reduce job. - * @throws IOException When there is communication problems with the - * job tracker. - */ - public int run(String[] args) { - //try { - MapReduceClass mapreducer = new MapReduceClass(); - - FileInputStream iStream = new FileInputStream(args[0]); - byte[] b = new byte[1024]; - int length = iStream.read(b); - if(length < 0 ) { - System./*out.println*/printString("Error! Can not read from configure file: " + args[0] + "\n"); - System.exit(-1); - } - String content = new String(b, 0, length); - //System.out.println(content); - int index = content.indexOf('\n'); - String inputfile = content.substring(0, index); - content = content.substring(index + 1); - index = content.indexOf('\n'); - int m = Integer.parseInt(content.substring(0, index)); - content = content.substring(index + 1); - index = content.indexOf('\n'); - int r = Integer.parseInt(content.substring(0, index)); - content = content.substring(index + 1); - index = content.indexOf('\n'); - String temp = content.substring(0, index); - char seperator = temp.charAt(0); - //System.out.println(inputfile + "; " + String.valueOf(m) + "; " + String.valueOf(r)); - - Configuration conf = new Configuration(); - conf.setMapReduceClass(mapreducer); - conf.setInputfile(inputfile); - conf.setM(m); - conf.setR(r); - conf.setSeperator(seperator); - - JobClient.runJob(conf); - /*} catch (Exception e) { - e.printStackTrace(); - System.exit(-1); - }*/ - - return 0; - } - - - public static void main(String[] args) /*throws Exception*/ { - int res = ToolRunner.run(new WordCounter(), args); - System.exit(res); - } - -} diff --git a/Robust/src/Benchmarks/MapReduce/Nor/MapReduce.java b/Robust/src/Benchmarks/MapReduce/Nor/MapReduce.java deleted file mode 100644 index 1a81bb61..00000000 --- a/Robust/src/Benchmarks/MapReduce/Nor/MapReduce.java +++ /dev/null @@ -1,140 +0,0 @@ -task startup(StartupObject s{initialstate}) { - // read in configuration parameters - // System.printString("Top of task startup\n"); - String path = new String("/scratch/mapreduce_nor/conf.txt"); - FileInputStream iStream = new FileInputStream(path); - byte[] b = new byte[1024]; - int length = iStream.read(b); - if(length < 0 ) { - System.printString("Error! Can not read from configure file: " + path + "\n"); - System.exit(-1); - } - String content = new String(b, 0, length); - //System.printString(content + "\n"); - int index = content.indexOf('\n'); - String inputfile = content.subString(0, index); - content = content.subString(index + 1); - index = content.indexOf('\n'); - int m = Integer.parseInt(content.subString(0, index)); - content = content.subString(index + 1); - index = content.indexOf('\n'); - int r = Integer.parseInt(content.subString(0, index)); - content = content.subString(index + 1); - index = content.indexOf('\n'); - String temp = content.subString(0, index); - char seperator = temp.charAt(0); - //System.printString(inputfile + "; " + String.valueOf(m) + "; " + String.valueOf(r) + "\n"); - Splitter splitter = new Splitter(inputfile, m, seperator); - Master master = new Master(m, r, splitter){split}; - - taskexit(s{!initialstate}); -} - -//Split the input file into M pieces -task split(Master master{split}) { - //System.printString("Top of task split\n"); - master.split(); - - taskexit(master{!split, assignMap}); -} - -//Select a map worker to handle one of the pieces of input file -task assignMap(Master master{assignMap}) { - //System.printString("Top of task assignMap\n"); - master.assignMap(); - - taskexit(master{!assignMap, mapoutput}); -} - -//MapWorker do 'map' function on a input file piece -task map(MapWorker mworker{map}) { - //System.printString("Top of task map\n"); - mworker.map(); - - taskexit(mworker{!map, partition}); -} - -//Partition the intermediate key/value pair generated -//into R intermediate local files -task partition(MapWorker mworker{partition}) { - //System.printString("Top of task partition\n"); - mworker.partition(); - - taskexit(mworker{!partition, mapoutput}); -} - -//Register the intermediate ouput from map worker to master -task mapOutput(Master master{mapoutput}, /*optional*/ MapWorker mworker{mapoutput}) { - //System.printString("Top of task mapOutput\n"); - //if(isavailable(mworker)) { - int total = master.getR(); - for(int i = 0; i < total; ++i) { - String temp = mworker.outputFile(i); - if(temp != null) { - master.addInterOutput(temp); - } - } - master.setMapFinish(mworker.getID()); - /*} else { - master.setMapFail(mworker.getID()); - master.setPartial(true); - }*/ - if(master.isMapFinish()) { - taskexit(master{!mapoutput, mapfinished, assignReduce}, mworker{!mapoutput}); - } - - taskexit(mworker{!mapoutput}); -} - -//Assign the list of intermediate output associated to one key to -//a reduce worker -task assignReduce(Master master{assignReduce}) { - //System.printString("Top of task assignReduce\n"); - master.assignReduce(); - - taskexit(master{!assignReduce, reduceoutput}); -} - -//First do sort and group on the intermediate key/value pairs assigned -//to reduce worker -task sortgroup(ReduceWorker rworker{sortgroup}) { - //System.printString("Top of task sortgroup\n"); - rworker.sortgroup(); - - taskexit(rworker{!sortgroup, reduce}); -} - -//Do 'reduce' function -task reduce(ReduceWorker rworker{reduce}) { - //System.printString("Top of task reduce\n"); - rworker.reduce(); - - taskexit(rworker{!reduce, reduceoutput}); -} - -//Collect the output into master -task reduceOutput(Master master{reduceoutput}, /*optional*/ ReduceWorker rworker{reduceoutput}) { - //System.printString("Top of task reduceOutput\n"); - //if(isavailable(rworker)) { - master.collectROutput(rworker.getOutputFile()); - master.setReduceFinish(rworker.getID()); - /* } else { - master.setReduceFail(rworker.getID()); - master.setPartial(true); - }*/ - if(master.isReduceFinish()) { - //System.printString("reduce finish\n"); - taskexit(master{!reduceoutput, reducefinished, output}, rworker{!reduceoutput}); - } - - taskexit(rworker{!reduceoutput}); -} - -task output(Master master{output}) { - //System.printString("Top of task output\n"); - if(master.isPartial()) { - System.printString("Partial! The result may not be right due to some failure!\n"); - } - System.printString("Finish! Results are in the output file: " + master.getOutputFile() + "\n"); - taskexit(master{!output}); -} diff --git a/Robust/src/Benchmarks/MapReduce/Nor/MapReduceBase.java b/Robust/src/Benchmarks/MapReduce/Nor/MapReduceBase.java deleted file mode 100644 index 3ff539d9..00000000 --- a/Robust/src/Benchmarks/MapReduce/Nor/MapReduceBase.java +++ /dev/null @@ -1,55 +0,0 @@ -public class MapReduceBase { - - public static void map(String key, String value, OutputCollector output) { - int n = value.length(); - for (int i = 0; i < n; ) { - // Skip past leading whitespace - while ((i < n) && isspace(value.charAt(i))) { - ++i; - } - - // Find word end - int start = i; - while ((i < n) && !isspace(value.charAt(i))) { - i++; - } - - if (start < i) { - output.emit(value.subString(start, i), "1"); - //System.printString(value.subString(start,i) + "\n"); - } - } - } - - public static void reduce(String key, Vector values, OutputCollector output) { - // Iterate over all entries with the - // // same key and add the values - int value = 0; - for(int i = 0; i < values.size(); ++i) { - value += Integer.parseInt((String)values.elementAt(i)); - } - - // Emit sum for input->key() - output.emit(key, String.valueOf(value)); - } - - static boolean isspace(char c) { - if((c == ' ') || - (c == ',') || - (c == '.') || - (c == '!') || - (c == '?') || - (c == '"') || - (c == '(') || - (c == ')') || - (c == '[') || - (c == ']') || - (c == '{') || - (c == '}') || - (c == '\n')) { - return true; - } - return false; - } -} - diff --git a/Robust/src/Benchmarks/MapReduce/Nor/MapWorker.java b/Robust/src/Benchmarks/MapReduce/Nor/MapWorker.java deleted file mode 100644 index 0ab23fa7..00000000 --- a/Robust/src/Benchmarks/MapReduce/Nor/MapWorker.java +++ /dev/null @@ -1,102 +0,0 @@ -public class MapWorker { - flag map; - flag partition; - flag mapoutput; - - int ID; - - int r; - String key; - String value; - OutputCollector output; - - String[] locations; - FileOutputStream[] outputs; - - public MapWorker(String key, String value, int r, int id) { - this.ID = id; - this.r = r; - - this.key = key; - this.value = value; - this.output = new OutputCollector(); - - locations = new String[r]; - for(int i = 0; i < r; ++i) { - StringBuffer temp = new StringBuffer("/scratch/mapreduce_nor/output-intermediate-map-"); - temp.append(String.valueOf(ID)); - temp.append("-of-"); - temp.append(String.valueOf(r)); - temp.append("_"); - temp.append(String.valueOf(i)); - temp.append(".dat"); - locations[i] = new String(temp); - } - - outputs = new FileOutputStream[r]; - for(int i = 0; i < r; ++i) { - outputs[i] = null; - } - } - - public void map() { - /*if(ID % 2 == 1) { - String temp = locations[locations.length]; - }*/ - - MapReduceBase.map(key, value, output); - } - - public void partition() { - /*if(ID % 2 == 1) { - String temp = locations[locations.length]; - }*/ - - int size = this.output.size(); - for(int i = 0; i < size; ++i) { - String key = this.output.getKey(i); - String value = this.output.getValue(i); - // use the hashcode of key to decide which intermediate output - // this pair should be in - int index = (int)Math.abs(key.hashCode()) % this.r; - FileOutputStream oStream = outputs[index]; - if(oStream == null) { - // open the file - String filepath = locations[index]; - oStream = new FileOutputStream(filepath, true); // append - outputs[index] = oStream; - } - // format: key value\n - oStream.write(key.getBytes()); - oStream.write(' '); - oStream.write(value.getBytes()); - oStream.write('\n'); - oStream.flush(); - } - - // close the output files - for(int i = 0; i < this.outputs.length; ++i) { - FileOutputStream temp = this.outputs[i]; - if(temp != null) { - temp.close(); - } - } - } - - public String outputFile(int i) { - if(outputs[i] != null) { - return locations[i]; - } else { - return null; - } - } - - public int getID() { - return this.ID; - } - - public int getR() { - return this.r; - } - -} diff --git a/Robust/src/Benchmarks/MapReduce/Nor/Master.java b/Robust/src/Benchmarks/MapReduce/Nor/Master.java deleted file mode 100644 index 4e21b9c3..00000000 --- a/Robust/src/Benchmarks/MapReduce/Nor/Master.java +++ /dev/null @@ -1,149 +0,0 @@ -public class Master { - flag split; - flag assignMap; - flag mapoutput; - flag mapfinished; - flag assignReduce; - flag reduceoutput; - flag reducefinished; - flag output; - - int m; - int r; - int[] mworkerStates; // array of map worker's state - // 0: idle 1: process 2: finished 3: fail - int[] rworkerStates; // array of reduce worker's state - Vector[] interoutputs; // array of string vector containing - // paths of intermediate outputs from - // map worker - - Splitter splitter; - - String outputfile; // path of final output file - - boolean partial; - - public Master(int m, int r, Splitter splitter) { - this.m = m; - this.r = r; - - mworkerStates = new int[m]; - rworkerStates = new int[r]; - for(int i = 0; i < m; ++i) { - mworkerStates[i] = 0; - } - for(int i = 0; i < r; ++i) { - rworkerStates[i] = 0; - } - - interoutputs = new Vector[r]; - for(int i = 0; i < r; ++i) { - interoutputs[i] = null; - } - - this.splitter = splitter; - this.outputfile = new String("/scratch/mapreduce_nor/output.dat"); - - this.partial = false; - } - - public int getR() { - return this.r; - } - - public String getOutputFile() { - return this.outputfile; - } - - public boolean isPartial() { - return this.partial; - } - - public void setPartial(boolean partial) { - this.partial = partial || this.partial; - } - - public void split() { - splitter.split(); - } - - public void assignMap() { - String[] contentsplits = splitter.getSlices(); - for(int i = 0; i < contentsplits.length; ++i) { - //System.printString("*************************\n"); - //System.printString(contentsplits[i] + "\n"); - //System.printString("*************************\n"); - MapWorker mworker = new MapWorker(splitter.getFilename(), contentsplits[i], r, i){map}; - mworkerStates[i] = 1; - } - } - - public void setMapFinish(int i) { - mworkerStates[i] = 2; - } - - public void setMapFail(int i) { - mworkerStates[i] = 3; - } - - public boolean isMapFinish() { - for(int i = 0; i < mworkerStates.length; ++i) { - if(mworkerStates[i] == 1) { - return false; - } - } - - return true; - } - - public void addInterOutput(String interoutput) { - int start = interoutput.lastindexOf('_'); - int end = interoutput.indexOf('.'); - int index = Integer.parseInt(interoutput.subString(start + 1, end)); - //System.printString(interoutput.subString(start + 1, end) + "\n"); - if(interoutputs[index] == null) { - interoutputs[index] = new Vector(); - } - interoutputs[index].addElement(interoutput); - } - - public void assignReduce() { - for(int i = 0; i < interoutputs.length; ++i) { - ReduceWorker rworker = new ReduceWorker(interoutputs[i], i){sortgroup}; - rworkerStates[i] = 1; - } - } - - public void setReduceFinish(int i) { - rworkerStates[i] = 2; - } - - public void setReduceFail(int i) { - rworkerStates[i] = 3; - } - - public boolean isReduceFinish() { - for(int i = 0; i < rworkerStates.length; ++i) { - if(rworkerStates[i] == 1) { - return false; - } - } - - return true; - } - - public void collectROutput(String file) { - FileInputStream iStream = new FileInputStream(file); - FileOutputStream oStream = new FileOutputStream(outputfile, true); - byte[] b = new byte[1024 * 10]; - int length = iStream.read(b); - if(length < 0) { - System.printString("Error! Can not read from intermediate output file from reduce worker: " + file + "\n"); - System.exit(-1); - } - //System.printString(new String(b, 0, length) + "\n"); - oStream.write(b, 0, length); - iStream.close(); - oStream.close(); - } -} diff --git a/Robust/src/Benchmarks/MapReduce/Nor/OutputCollector.java b/Robust/src/Benchmarks/MapReduce/Nor/OutputCollector.java deleted file mode 100644 index 3c6d852c..00000000 --- a/Robust/src/Benchmarks/MapReduce/Nor/OutputCollector.java +++ /dev/null @@ -1,27 +0,0 @@ -public class OutputCollector { - - Vector keys; - Vector values; - - public OutputCollector() { - this.keys = new Vector(); - this.values = new Vector(); - } - - public void emit(String key, String value) { - this.keys.addElement(key); - this.values.addElement(value); - } - - public int size() { - return this.keys.size(); - } - - public String getKey(int i) { - return (String)this.keys.elementAt(i); - } - - public String getValue(int i) { - return (String)this.values.elementAt(i); - } -} diff --git a/Robust/src/Benchmarks/MapReduce/Nor/ReduceWorker.java b/Robust/src/Benchmarks/MapReduce/Nor/ReduceWorker.java deleted file mode 100644 index a0e39ffa..00000000 --- a/Robust/src/Benchmarks/MapReduce/Nor/ReduceWorker.java +++ /dev/null @@ -1,138 +0,0 @@ -public class ReduceWorker { - flag sortgroup; - flag reduce; - flag reduceoutput; - - int ID; - Vector interoutputs; // string vector containing paths - // of intermediate outputs from map worker - Vector keys; - HashMap values; // hashmap map key to vector of string vector - int[] sorts; // array record the sort of keys - OutputCollector output; - String outputfile; // path of the intermediate output file - - public ReduceWorker(Vector interoutputs, int id) { - this.ID = id; - this.interoutputs = interoutputs; - - this.keys = new Vector(); - this.values = new HashMap(); - //this.sorts = null; - - this.output = new OutputCollector(); - this.outputfile = "/scratch/mapreduce_nor/output-intermediate-reduce-" + String.valueOf(id) + ".dat"; - } - - public void sortgroup() { - /*if(ID % 2 == 1) { - int a[] = new int[1]; - int temp = a[1]; - }*/ - - // group values associated to the same key - //System.printString("================================\n"); - if(interoutputs == null) { - return; - } - for(int i = 0; i < interoutputs.size(); ++i) { - FileInputStream iStream = new FileInputStream((String)interoutputs.elementAt(i)); - byte[] b = new byte[1024 * 10]; - int length = iStream.read(b); - if(length < 0) { - System.printString("Error! Can not read from intermediate ouput file of map worker: " + (String)interoutputs.elementAt(i) + "\n"); - System.exit(-1); - } - String content = new String(b, 0, length); - //System.printString(content + "\n"); - int index = content.indexOf('\n'); - while(index != -1) { - String line = content.subString(0, index); - content = content.subString(index + 1); - //System.printString(line + "\n"); - int tmpindex = line.indexOf(' '); - String key = line.subString(0, tmpindex); - String value = line.subString(tmpindex + 1); - //System.printString(key + "; " + value + "\n"); - if(!this.values.containsKey(key)) { - this.values.put(key, new Vector()); - this.keys.addElement(key); - } - ((Vector)this.values.get(key)).addElement(value); - index = content.indexOf('\n'); - } - iStream.close(); - } - //System.printString("================================\n"); - - /*for(int i = 0; i < this.keys.size(); ++i) { - System.printString((String)this.keys.elementAt(i) + ", " + ((String)this.keys.elementAt(i)).hashCode() + "; "); - } - System.printString("\n");*/ - - // sort all the keys inside interoutputs - this.sorts = new int[this.keys.size()]; - // insert sorting - this.sorts[0] = 0; - int tosort = 1; - for(; tosort < this.keys.size(); ++tosort) { - int tosortkey = ((String)this.keys.elementAt(tosort)).hashCode(); - int index = tosort; - for(int i = tosort; i > 0; --i) { - if(((String)this.keys.elementAt(this.sorts[i - 1])).hashCode() > tosortkey) { - this.sorts[i] = this.sorts[i-1]; - index = i - 1; - } else { - //System.printString(i + "; " + tosort + "\n"); - index = i; - i = 0; - } - } - this.sorts[index] = tosort; - } - /*for(int i = 0; i < this.sorts.length; ++i) { - System.printString(this.sorts[i] + "; "); - } - System.printString("\n");*/ - } - - public void reduce() { - /*if(ID % 2 == 1) { - int a[] = new int[1]; - int temp = a[1]; - }*/ - - if(this.interoutputs != null) { - // return; - //} - for(int i = 0; i < this.sorts.length; ++i) { - String key = (String)this.keys.elementAt(this.sorts[i]); - Vector values = (Vector)this.values.get(key); - MapReduceBase.reduce(key, values, output); - } - } - - // output all the result into some local file - int size = this.output.size(); - FileOutputStream oStream = new FileOutputStream(outputfile, true); // append - for(int i = 0; i < size; ++i) { - String key = this.output.getKey(i); - String value = this.output.getValue(i); - // format: key value\n - oStream.write(key.getBytes()); - oStream.write(' '); - oStream.write(value.getBytes()); - oStream.write('\n'); - oStream.flush(); - } - oStream.close(); - } - - public String getOutputFile() { - return this.outputfile; - } - - public int getID() { - return this.ID; - } -} diff --git a/Robust/src/Benchmarks/MapReduce/Nor/Splitter.java b/Robust/src/Benchmarks/MapReduce/Nor/Splitter.java deleted file mode 100644 index d61bf023..00000000 --- a/Robust/src/Benchmarks/MapReduce/Nor/Splitter.java +++ /dev/null @@ -1,73 +0,0 @@ -public class Splitter { - String filename; - String content; - int length; - int[] splits; - String[] slices; - - public Splitter(String path, int splitNum, char seperator) { - //System.printString("Top of Splitter's constructor\n"); - filename = path; - FileInputStream iStream = new FileInputStream(filename); - byte[] b = new byte[1024 * 1024]; - length = iStream.read(b); - if(length < 0) { - System.printString("Error! Can not read from input file: " + filename + "\n"); - System.exit(-1); - } - content = new String(b, 0, length); - //System.printString(content + "\n"); - iStream.close(); - - if(splitNum == 1) { - slices = new String[1]; - slices[0] = content; - } else { - splits = new int[splitNum - 1]; - int index = 0; - int span = length / splitNum; - int temp = 0; - for(int i = 0; i < splitNum - 1; ++i) { - temp += span; - if(temp > index) { - index = temp; - while((content.charAt(index) != seperator) && (index != length - 1)) { - ++index; - } - } - splits[i] = index; - } - - this.slices = new String[splits.length + 1]; - for(int i = 0; i < this.slices.length; ++i) { - this.slices[i] = null; - } - } - } - - public void split() { - if(slices.length == 1) { - return; - } - int start = 0; - int end = 0; - for(int i = 0; i < splits.length; ++i) { - end = splits[i]; - if(end < start) { - slices[i] = null; - } else { - slices[i] = content.subString(start, end); - } - start = end + 1; - } - slices[slices.length - 1] = content.subString(start); - } - - public String getFilename() { - return filename; - } - - public String[] getSlices() { - return this.slices; - } -} diff --git a/Robust/src/Benchmarks/MapReduce/Tag/MapReduce.java b/Robust/src/Benchmarks/MapReduce/Tag/MapReduce.java deleted file mode 100644 index a411a165..00000000 --- a/Robust/src/Benchmarks/MapReduce/Tag/MapReduce.java +++ /dev/null @@ -1,140 +0,0 @@ -task startup(StartupObject s{initialstate}) { - // read in configuration parameters - // System.printString("Top of task startup\n"); - String path = new String("/scratch/mapreduce_opt/conf.txt"); - FileInputStream iStream = new FileInputStream(path); - byte[] b = new byte[1024]; - int length = iStream.read(b); - if(length < 0 ) { - System.printString("Error! Can not read from configure file: " + path + "\n"); - System.exit(-1); - } - String content = new String(b, 0, length); - //System.printString(content + "\n"); - int index = content.indexOf('\n'); - String inputfile = content.subString(0, index); - content = content.subString(index + 1); - index = content.indexOf('\n'); - int m = Integer.parseInt(content.subString(0, index)); - content = content.subString(index + 1); - index = content.indexOf('\n'); - int r = Integer.parseInt(content.subString(0, index)); - content = content.subString(index + 1); - index = content.indexOf('\n'); - String temp = content.subString(0, index); - char seperator = temp.charAt(0); - //System.printString(inputfile + "; " + String.valueOf(m) + "; " + String.valueOf(r) + "\n"); - Splitter splitter = new Splitter(inputfile, m, seperator); - Master master = new Master(m, r, splitter){split}; - - taskexit(s{!initialstate}); -} - -//Split the input file into M pieces -task split(Master master{split}) { - //System.printString("Top of task split\n"); - master.split(); - - taskexit(master{!split, assignMap}); -} - -//Select a map worker to handle one of the pieces of input file -task assignMap(Master master{assignMap}) { - //System.printString("Top of task assignMap\n"); - master.assignMap(); - - taskexit(master{!assignMap, mapoutput}); -} - -//MapWorker do 'map' function on a input file piece -task map(MapWorker mworker{map}) { - //System.printString("Top of task map\n"); - mworker.map(); - - taskexit(mworker{!map, partition}); -} - -//Partition the intermediate key/value pair generated -//into R intermediate local files -task partition(MapWorker mworker{partition}) { - //System.printString("Top of task partition\n"); - mworker.partition(); - - taskexit(mworker{!partition, mapoutput}); -} - -//Register the intermediate ouput from map worker to master -task mapOutput(Master master{mapoutput}, optional MapWorker mworker{mapoutput}) { - //System.printString("Top of task mapOutput\n"); - if(isavailable(mworker)) { - int total = master.getR(); - for(int i = 0; i < total; ++i) { - String temp = mworker.outputFile(i); - if(temp != null) { - master.addInterOutput(temp); - } - } - master.setMapFinish(mworker.getID()); - } else { - master.setMapFail(mworker.getID()); - master.setPartial(true); - } - if(master.isMapFinish()) { - taskexit(master{!mapoutput, mapfinished, assignReduce}, mworker{!mapoutput}); - } - - taskexit(mworker{!mapoutput}); -} - -//Assign the list of intermediate output associated to one key to -//a reduce worker -task assignReduce(Master master{assignReduce}) { - //System.printString("Top of task assignReduce\n"); - master.assignReduce(); - - taskexit(master{!assignReduce, reduceoutput}); -} - -//First do sort and group on the intermediate key/value pairs assigned -//to reduce worker -task sortgroup(ReduceWorker rworker{sortgroup}) { - //System.printString("Top of task sortgroup\n"); - rworker.sortgroup(); - - taskexit(rworker{!sortgroup, reduce}); -} - -//Do 'reduce' function -task reduce(ReduceWorker rworker{reduce}) { - //System.printString("Top of task reduce\n"); - rworker.reduce(); - - taskexit(rworker{!reduce, reduceoutput}); -} - -//Collect the output into master -task reduceOutput(Master master{reduceoutput}, optional ReduceWorker rworker{reduceoutput}) { - //System.printString("Top of task reduceOutput\n"); - if(isavailable(rworker)) { - master.collectROutput(rworker.getOutputFile()); - master.setReduceFinish(rworker.getID()); - } else { - master.setReduceFail(rworker.getID()); - master.setPartial(true); - } - if(master.isReduceFinish()) { - //System.printString("reduce finish\n"); - taskexit(master{!reduceoutput, reducefinished, output}, rworker{!reduceoutput}); - } - - taskexit(rworker{!reduceoutput}); -} - -task output(Master master{output}) { - //System.printString("Top of task output\n"); - if(master.isPartial()) { - System.printString("Partial! The result may not be right due to some failure!\n"); - } - System.printString("Finish! Results are in the output file: " + master.getOutputFile() + "\n"); - taskexit(master{!output}); -} diff --git a/Robust/src/Benchmarks/MapReduce/Tag/MapReduceBase.java b/Robust/src/Benchmarks/MapReduce/Tag/MapReduceBase.java deleted file mode 100644 index 3ff539d9..00000000 --- a/Robust/src/Benchmarks/MapReduce/Tag/MapReduceBase.java +++ /dev/null @@ -1,55 +0,0 @@ -public class MapReduceBase { - - public static void map(String key, String value, OutputCollector output) { - int n = value.length(); - for (int i = 0; i < n; ) { - // Skip past leading whitespace - while ((i < n) && isspace(value.charAt(i))) { - ++i; - } - - // Find word end - int start = i; - while ((i < n) && !isspace(value.charAt(i))) { - i++; - } - - if (start < i) { - output.emit(value.subString(start, i), "1"); - //System.printString(value.subString(start,i) + "\n"); - } - } - } - - public static void reduce(String key, Vector values, OutputCollector output) { - // Iterate over all entries with the - // // same key and add the values - int value = 0; - for(int i = 0; i < values.size(); ++i) { - value += Integer.parseInt((String)values.elementAt(i)); - } - - // Emit sum for input->key() - output.emit(key, String.valueOf(value)); - } - - static boolean isspace(char c) { - if((c == ' ') || - (c == ',') || - (c == '.') || - (c == '!') || - (c == '?') || - (c == '"') || - (c == '(') || - (c == ')') || - (c == '[') || - (c == ']') || - (c == '{') || - (c == '}') || - (c == '\n')) { - return true; - } - return false; - } -} - diff --git a/Robust/src/Benchmarks/MapReduce/Tag/MapWorker.java b/Robust/src/Benchmarks/MapReduce/Tag/MapWorker.java deleted file mode 100644 index 60407fb3..00000000 --- a/Robust/src/Benchmarks/MapReduce/Tag/MapWorker.java +++ /dev/null @@ -1,102 +0,0 @@ -public class MapWorker { - flag map; - flag partition; - flag mapoutput; - - int ID; - - int r; - String key; - String value; - OutputCollector output; - - String[] locations; - FileOutputStream[] outputs; - - public MapWorker(String key, String value, int r, int id) { - this.ID = id; - this.r = r; - - this.key = key; - this.value = value; - this.output = new OutputCollector(); - - locations = new String[r]; - for(int i = 0; i < r; ++i) { - StringBuffer temp = new StringBuffer("/scratch/mapreduce_opt/output-intermediate-map-"); - temp.append(String.valueOf(ID)); - temp.append("-of-"); - temp.append(String.valueOf(r)); - temp.append("_"); - temp.append(String.valueOf(i)); - temp.append(".dat"); - locations[i] = new String(temp); - } - - outputs = new FileOutputStream[r]; - for(int i = 0; i < r; ++i) { - outputs[i] = null; - } - } - - public void map() { - /*if(ID % 2 == 1) { - String temp = locations[locations.length]; - }*/ - - MapReduceBase.map(key, value, output); - } - - public void partition() { - /*if(ID % 2 == 1) { - String temp = locations[locations.length]; - }*/ - - int size = this.output.size(); - for(int i = 0; i < size; ++i) { - String key = this.output.getKey(i); - String value = this.output.getValue(i); - // use the hashcode of key to decide which intermediate output - // this pair should be in - int index = (int)Math.abs(key.hashCode()) % this.r; - FileOutputStream oStream = outputs[index]; - if(oStream == null) { - // open the file - String filepath = locations[index]; - oStream = new FileOutputStream(filepath, true); // append - outputs[index] = oStream; - } - // format: key value\n - oStream.write(key.getBytes()); - oStream.write(' '); - oStream.write(value.getBytes()); - oStream.write('\n'); - oStream.flush(); - } - - // close the output files - for(int i = 0; i < this.outputs.length; ++i) { - FileOutputStream temp = this.outputs[i]; - if(temp != null) { - temp.close(); - } - } - } - - public String outputFile(int i) { - if(outputs[i] != null) { - return locations[i]; - } else { - return null; - } - } - - public int getID() { - return this.ID; - } - - public int getR() { - return this.r; - } - -} diff --git a/Robust/src/Benchmarks/MapReduce/Tag/Master.java b/Robust/src/Benchmarks/MapReduce/Tag/Master.java deleted file mode 100644 index c547fd83..00000000 --- a/Robust/src/Benchmarks/MapReduce/Tag/Master.java +++ /dev/null @@ -1,149 +0,0 @@ -public class Master { - flag split; - flag assignMap; - flag mapoutput; - flag mapfinished; - flag assignReduce; - flag reduceoutput; - flag reducefinished; - flag output; - - int m; - int r; - int[] mworkerStates; // array of map worker's state - // 0: idle 1: process 2: finished 3: fail - int[] rworkerStates; // array of reduce worker's state - Vector[] interoutputs; // array of string vector containing - // paths of intermediate outputs from - // map worker - - Splitter splitter; - - String outputfile; // path of final output file - - boolean partial; - - public Master(int m, int r, Splitter splitter) { - this.m = m; - this.r = r; - - mworkerStates = new int[m]; - rworkerStates = new int[r]; - for(int i = 0; i < m; ++i) { - mworkerStates[i] = 0; - } - for(int i = 0; i < r; ++i) { - rworkerStates[i] = 0; - } - - interoutputs = new Vector[r]; - for(int i = 0; i < r; ++i) { - interoutputs[i] = null; - } - - this.splitter = splitter; - this.outputfile = new String("/scratch/mapreduce_opt/output.dat"); - - this.partial = false; - } - - public int getR() { - return this.r; - } - - public String getOutputFile() { - return this.outputfile; - } - - public boolean isPartial() { - return this.partial; - } - - public void setPartial(boolean partial) { - this.partial = partial || this.partial; - } - - public void split() { - splitter.split(); - } - - public void assignMap() { - String[] contentsplits = splitter.getSlices(); - for(int i = 0; i < contentsplits.length; ++i) { - //System.printString("*************************\n"); - //System.printString(contentsplits[i] + "\n"); - //System.printString("*************************\n"); - MapWorker mworker = new MapWorker(splitter.getFilename(), contentsplits[i], r, i){map}; - mworkerStates[i] = 1; - } - } - - public void setMapFinish(int i) { - mworkerStates[i] = 2; - } - - public void setMapFail(int i) { - mworkerStates[i] = 3; - } - - public boolean isMapFinish() { - for(int i = 0; i < mworkerStates.length; ++i) { - if(mworkerStates[i] == 1) { - return false; - } - } - - return true; - } - - public void addInterOutput(String interoutput) { - int start = interoutput.lastindexOf('_'); - int end = interoutput.indexOf('.'); - int index = Integer.parseInt(interoutput.subString(start + 1, end)); - //System.printString(interoutput.subString(start + 1, end) + "\n"); - if(interoutputs[index] == null) { - interoutputs[index] = new Vector(); - } - interoutputs[index].addElement(interoutput); - } - - public void assignReduce() { - for(int i = 0; i < interoutputs.length; ++i) { - ReduceWorker rworker = new ReduceWorker(interoutputs[i], i){sortgroup}; - rworkerStates[i] = 1; - } - } - - public void setReduceFinish(int i) { - rworkerStates[i] = 2; - } - - public void setReduceFail(int i) { - rworkerStates[i] = 3; - } - - public boolean isReduceFinish() { - for(int i = 0; i < rworkerStates.length; ++i) { - if(rworkerStates[i] == 1) { - return false; - } - } - - return true; - } - - public void collectROutput(String file) { - FileInputStream iStream = new FileInputStream(file); - FileOutputStream oStream = new FileOutputStream(outputfile, true); - byte[] b = new byte[1024 * 10]; - int length = iStream.read(b); - if(length < 0) { - System.printString("Error! Can not read from intermediate output file from reduce worker: " + file + "\n"); - System.exit(-1); - } - //System.printString(new String(b, 0, length) + "\n"); - oStream.write(b, 0, length); - iStream.close(); - oStream.close(); - } -} diff --git a/Robust/src/Benchmarks/MapReduce/Tag/OutputCollector.java b/Robust/src/Benchmarks/MapReduce/Tag/OutputCollector.java deleted file mode 100644 index 3c6d852c..00000000 --- a/Robust/src/Benchmarks/MapReduce/Tag/OutputCollector.java +++ /dev/null @@ -1,27 +0,0 @@ -public class OutputCollector { - - Vector keys; - Vector values; - - public OutputCollector() { - this.keys = new Vector(); - this.values = new Vector(); - } - - public void emit(String key, String value) { - this.keys.addElement(key); - this.values.addElement(value); - } - - public int size() { - return this.keys.size(); - } - - public String getKey(int i) { - return (String)this.keys.elementAt(i); - } - - public String getValue(int i) { - return (String)this.values.elementAt(i); - } -} diff --git a/Robust/src/Benchmarks/MapReduce/Tag/ReduceWorker.java b/Robust/src/Benchmarks/MapReduce/Tag/ReduceWorker.java deleted file mode 100644 index 7f2cbdb4..00000000 --- a/Robust/src/Benchmarks/MapReduce/Tag/ReduceWorker.java +++ /dev/null @@ -1,138 +0,0 @@ -public class ReduceWorker { - flag sortgroup; - flag reduce; - flag reduceoutput; - - int ID; - Vector interoutputs; // string vector containing paths - // of intermediate outputs from map worker - Vector keys; - HashMap values; // hashmap map key to vector of string vector - int[] sorts; // array record the sort of keys - OutputCollector output; - String outputfile; // path of the intermediate output file - - public ReduceWorker(Vector interoutputs, int id) { - this.ID = id; - this.interoutputs = interoutputs; - - this.keys = new Vector(); - this.values = new HashMap(); - //this.sorts = null; - - this.output = new OutputCollector(); - this.outputfile = "/scratch/mapreduce_opt/output-intermediate-reduce-" + String.valueOf(id) + ".dat"; - } - - public void sortgroup() { - /*if(ID % 2 == 1) { - int a[] = new int[1]; - int temp = a[1]; - }*/ - - // group values associated to the same key - //System.printString("================================\n"); - if(interoutputs == null) { - return; - } - for(int i = 0; i < interoutputs.size(); ++i) { - FileInputStream iStream = new FileInputStream((String)interoutputs.elementAt(i)); - byte[] b = new byte[1024 * 10]; - int length = iStream.read(b); - if(length < 0) { - System.printString("Error! Can not read from intermediate ouput file of map worker: " + (String)interoutputs.elementAt(i) + "\n"); - System.exit(-1); - } - String content = new String(b, 0, length); - //System.printString(content + "\n"); - int index = content.indexOf('\n'); - while(index != -1) { - String line = content.subString(0, index); - content = content.subString(index + 1); - //System.printString(line + "\n"); - int tmpindex = line.indexOf(' '); - String key = line.subString(0, tmpindex); - String value = line.subString(tmpindex + 1); - //System.printString(key + "; " + value + "\n"); - if(!this.values.containsKey(key)) { - this.values.put(key, new Vector()); - this.keys.addElement(key); - } - ((Vector)this.values.get(key)).addElement(value); - index = content.indexOf('\n'); - } - iStream.close(); - } - //System.printString("================================\n"); - - /*for(int i = 0; i < this.keys.size(); ++i) { - System.printString((String)this.keys.elementAt(i) + ", " + ((String)this.keys.elementAt(i)).hashCode() + "; "); - } - System.printString("\n");*/ - - // sort all the keys inside interoutputs - this.sorts = new int[this.keys.size()]; - // insert sorting - this.sorts[0] = 0; - int tosort = 1; - for(; tosort < this.keys.size(); ++tosort) { - int tosortkey = ((String)this.keys.elementAt(tosort)).hashCode(); - int index = tosort; - for(int i = tosort; i > 0; --i) { - if(((String)this.keys.elementAt(this.sorts[i - 1])).hashCode() > tosortkey) { - this.sorts[i] = this.sorts[i-1]; - index = i - 1; - } else { - //System.printString(i + "; " + tosort + "\n"); - index = i; - i = 0; - } - } - this.sorts[index] = tosort; - } - /*for(int i = 0; i < this.sorts.length; ++i) { - System.printString(this.sorts[i] + "; "); - } - System.printString("\n");*/ - } - - public void reduce() { - /*if(ID % 2 == 1) { - int a[] = new int[1]; - int temp = a[1]; - }*/ - - if(this.interoutputs != null) { - // return; - //} - for(int i = 0; i < this.sorts.length; ++i) { - String key = (String)this.keys.elementAt(this.sorts[i]); - Vector values = (Vector)this.values.get(key); - MapReduceBase.reduce(key, values, output); - } - } - - // output all the result into some local file - int size = this.output.size(); - FileOutputStream oStream = new FileOutputStream(outputfile, true); // append - for(int i = 0; i < size; ++i) { - String key = this.output.getKey(i); - String value = this.output.getValue(i); - // format: key value\n - oStream.write(key.getBytes()); - oStream.write(' '); - oStream.write(value.getBytes()); - oStream.write('\n'); - oStream.flush(); - } - oStream.close(); - } - - public String getOutputFile() { - return this.outputfile; - } - - public int getID() { - return this.ID; - } -} diff --git a/Robust/src/Benchmarks/MapReduce/Tag/Splitter.java b/Robust/src/Benchmarks/MapReduce/Tag/Splitter.java deleted file mode 100644 index d61bf023..00000000 --- a/Robust/src/Benchmarks/MapReduce/Tag/Splitter.java +++ /dev/null @@ -1,73 +0,0 @@ -public class Splitter { - String filename; - String content; - int length; - int[] splits; - String[] slices; - - public Splitter(String path, int splitNum, char seperator) { - //System.printString("Top of Splitter's constructor\n"); - filename = path; - FileInputStream iStream = new FileInputStream(filename); - byte[] b = new byte[1024 * 1024]; - length = iStream.read(b); - if(length < 0) { - System.printString("Error! Can not read from input file: " + filename + "\n"); - System.exit(-1); - } - content = new String(b, 0, length); - //System.printString(content + "\n"); - iStream.close(); - - if(splitNum == 1) { - slices = new String[1]; - slices[0] = content; - } else { - splits = new int[splitNum - 1]; - int index = 0; - int span = length / splitNum; - int temp = 0; - for(int i = 0; i < splitNum - 1; ++i) { - temp += span; - if(temp > index) { - index = temp; - while((content.charAt(index) != seperator) && (index != length - 1)) { - ++index; - } - } - splits[i] = index; - } - - this.slices = new String[splits.length + 1]; - for(int i = 0; i < this.slices.length; ++i) { - this.slices[i] = null; - } - } - } - - public void split() { - if(slices.length == 1) { - return; - } - int start = 0; - int end = 0; - for(int i = 0; i < splits.length; ++i) { - end = splits[i]; - if(end < start) { - slices[i] = null; - } else { - slices[i] = content.subString(start, end); - } - start = end + 1; - } - slices[slices.length - 1] = content.subString(start); - } - - public String getFilename() { - return filename; - } - - public String[] getSlices() { - return this.slices; - } -} diff --git a/Robust/src/Benchmarks/PERT/Java/Estimator.java b/Robust/src/Benchmarks/PERT/Java/Estimator.java deleted file mode 100644 index 38820a6c..00000000 --- a/Robust/src/Benchmarks/PERT/Java/Estimator.java +++ /dev/null @@ -1,108 +0,0 @@ -public class Estimator { - int stages; - int time; - double variance; - double[] probtable; - - boolean partial; - - public Estimator(int stages) { - this.stages = stages; - this.time = 0; - this.variance = 0; - - this.probtable = new double[31]; - int i = 0; - this.probtable[i++] = 0.5000; - this.probtable[i++] = 0.5398; - this.probtable[i++] = 0.5793; - this.probtable[i++] = 0.6179; - this.probtable[i++] = 0.6554; - this.probtable[i++] = 0.6915; - this.probtable[i++] = 0.7257; - this.probtable[i++] = 0.7580; - this.probtable[i++] = 0.7881; - this.probtable[i++] = 0.8159; - this.probtable[i++] = 0.8413; - this.probtable[i++] = 0.8643; - this.probtable[i++] = 0.8849; - this.probtable[i++] = 0.9032; - this.probtable[i++] = 0.9192; - this.probtable[i++] = 0.9332; - this.probtable[i++] = 0.9452; - this.probtable[i++] = 0.9554; - this.probtable[i++] = 0.9641; - this.probtable[i++] = 0.9713; - this.probtable[i++] = 0.9772; - this.probtable[i++] = 0.9821; - this.probtable[i++] = 0.9861; - this.probtable[i++] = 0.9893; - this.probtable[i++] = 0.9918; - this.probtable[i++] = 0.9938; - this.probtable[i++] = 0.9953; - this.probtable[i++] = 0.9965; - this.probtable[i++] = 0.9974; - this.probtable[i++] = 0.9981; - this.probtable[i++] = 0.9987; - - this.partial = false; - } - - public boolean estimate(int time, double variance2, boolean fake) { - if(!fake) { - this.time += time; - this.variance += variance2; - } else { - this.partial = true; - } - --this.stages; - if(this.stages == 0) { - //System.out.print("variance2: " + (int)(this.variance*100) + "(/100); "); - this.variance = Math.sqrt(this.variance); - //System.out.println("variance: " + (int)(this.variance*100) + "(/100)"); - return true; - } - return false; - } - - public double getProbability(int x, int y) { - int l = x; - int r = y; - if(x > y) { - l = y; - r = x; - } - - double prob = prob(r) - prob(l); - return prob; - } - - private double prob(int s) { - int tmp = (int)((s - this.time) * 10 / this.variance); - //System.out.println(tmp); - int abs = (int)Math.abs(tmp); - double prob = 0; - if(abs > this.probtable.length - 1) { - prob = 1; - } else { - prob = this.probtable[abs]; - } - if(tmp < 0) { - return 1.0 - prob; - } else { - return prob; - } - } - - public int getTime() { - return this.time; - } - - public double getVariance() { - return this.variance; - } - - public boolean isPartial() { - return this.partial; - } -} diff --git a/Robust/src/Benchmarks/PERT/Java/PERT.java b/Robust/src/Benchmarks/PERT/Java/PERT.java deleted file mode 100644 index d002ff38..00000000 --- a/Robust/src/Benchmarks/PERT/Java/PERT.java +++ /dev/null @@ -1,104 +0,0 @@ -import java.io.FileInputStream; - -public class PERT { - - int stageNum; - Stage[] stages; - Estimator estimator; - - - public PERT() { - this.stageNum = -1; - //this.stages = null; - //this.estimator = null; - } - - public Estimator getEstimator() { - return estimator; - } - - public void setEstimator(Estimator estimator) { - this.estimator = estimator; - } - - public void setStageNum(int stageNum) { - this.stageNum = stageNum; - } - - public void createStages() { - this.stages = new Stage[this.stageNum]; - for(int i = 0; i < stageNum; ++i) { - this.stages[i] = new Stage(i); - } - } - - public void sampling() { - for(int i = 0; i < this.stageNum; ++i) { - this.stages[i].sampling(); - } - } - - public void estimate() { - for(int i = 0; i < this.stageNum; ++i) { - this.stages[i].estimate(); - } - } - - public void merge() { - for(int i = 0; i < this.stageNum; ++i) { - Stage tmp = this.stages[i]; - this.estimator.estimate(tmp.getAntTime(), tmp.getAntVariance2(), false); - } - } - - public static void main(String args[]) { -// try{ - PERT pert = new PERT(); - - String path = new String("/home/jzhou/pert/conf.txt"); - FileInputStream iStream = new FileInputStream(path); - byte[] b = new byte[1024]; - int length = iStream.read(b); - if(length < 0) { - System./*out.println*/printString("Error! Can not read from configure file: " + path + "\n"); - System.exit(-1); - } - iStream.close(); - String content = new String(b, 0, length); - int index = content.indexOf('\n'); - int stage = Integer.parseInt(content.substring(0, index)); - Estimator estimator = new Estimator(stage); - pert.setStageNum(stage); - pert.setEstimator(estimator); - pert.createStages(); - pert.sampling(); - pert.estimate(); - pert.merge(); - path = new String("/home/jzhou/pert/prob.txt"); - iStream = new FileInputStream(path); - byte c[] = new byte[1024]; - length = iStream.read(c); - if(length < 0) { - System./*out.println*/printString("Error! Can not read from input file: " + path + "\n"); - System.exit(-1); - } - iStream.close(); - content = new String(c, 0, length); - index = content.indexOf('\n'); - int x = Integer.parseInt(content.substring(0, index)); - content = content.substring(index + 1); - index = content.indexOf('\n'); - int y = Integer.parseInt(content.substring(0, index)); - //System.out.println("x: " + x + "; y: " + y); - System./*out.println*/printString("The anticipate days need to finish this project is: " + pert.getEstimator().getTime() + "\n"); - System./*out.println*/printString("And the anticipate variance is: " + (int)(pert.getEstimator().getVariance()*100) + "(/100)\n"); - double prob = pert.getEstimator().getProbability(x, y); - - System./*out.println*/printString("The probability of this project to be finished in " + x + " to " + y + " days is: " + (int)(prob*100) + "(/100)\n"); -/* } catch(Exception e) { - e.printStackTrace(); - System.exit(-1); - }*/ - } - -} diff --git a/Robust/src/Benchmarks/PERT/Java/Stage.java b/Robust/src/Benchmarks/PERT/Java/Stage.java deleted file mode 100644 index e78f79cc..00000000 --- a/Robust/src/Benchmarks/PERT/Java/Stage.java +++ /dev/null @@ -1,85 +0,0 @@ -import java.util.Random; - -public class Stage { - int ID; - - int[] samplings; - int optime; - int nortime; - int petime; - int time; - double variance2; - - public Stage(int id) { - this.ID = id; - - this.samplings = new int[10]; - for(int i = 0; i < this.samplings.length; ++i) { - this.samplings[i] = 0; - } - - this.optime = 0; - this.nortime = 0; - this.petime = 0; - this.time = 0; - this.variance2 = 0; - } - - public void sampling() { - /*if(ID % 2 == 1) { - int tmp = samplings[samplings.length]; - }*/ - - Random r = new Random(ID); - int tint = 0; - for(int i = 0; i < this.samplings.length; ++i) { - do { - tint = r.nextInt()%50; - } while(tint <= 0); - this.samplings[i] = tint; - //System./*out.print*/printString(tint + "; "); - } - //int tint = ID * 3; - //for(int i = 0; i < this.samplings.length; ++i) { - // this.samplings[i] = tint + i; - //System.printString(tint + "; "); - //} - //System.printString("\n");//out.println(); - } - - public void estimate() { - /*if(ID % 2 == 1) { - int tmp = samplings[samplings.length]; - }*/ - - int highest = this.samplings[0]; - int lowest = this.samplings[0]; - int sum = this.samplings[0]; - for(int i = 1; i < this.samplings.length; ++i) { - int temp = this.samplings[i]; - if(temp > highest) { - highest = temp; - } else if(temp < lowest) { - lowest = temp; - } - sum += temp; - } - sum = sum - highest - lowest; - int ordinary = sum / (this.samplings.length - 2); - this.optime = lowest;; - this.petime = highest; - this.nortime = ordinary; - this.time = (this.optime + 4 * this.nortime + this.petime) / 6; - this.variance2 = (double)(this.optime - this.petime) * (double)(this.optime - this.petime) / 36.0; - //System.out.println("Op time: " + this.optime + "; Nor time: " + this.nortime + "; Pe time: " + this.petime + "; variance2: " + (int)(this.variance2*100) + "(/100)"); - } - - public int getAntTime() { - return this.time; - } - - public double getAntVariance2() { - return this.variance2; - } - -} diff --git a/Robust/src/Benchmarks/PERT/Tag/Estimator.java b/Robust/src/Benchmarks/PERT/Tag/Estimator.java deleted file mode 100644 index 7822c4e4..00000000 --- a/Robust/src/Benchmarks/PERT/Tag/Estimator.java +++ /dev/null @@ -1,111 +0,0 @@ -public class Estimator { - flag estimate; - flag prob; - - int stages; - int time; - double variance; - double[] probtable; - - boolean partial; - - public Estimator(int stages) { - this.stages = stages; - this.time = 0; - this.variance = 0; - - this.probtable = new double[31]; - int i = 0; - this.probtable[i++] = 0.5000; - this.probtable[i++] = 0.5398; - this.probtable[i++] = 0.5793; - this.probtable[i++] = 0.6179; - this.probtable[i++] = 0.6554; - this.probtable[i++] = 0.6915; - this.probtable[i++] = 0.7257; - this.probtable[i++] = 0.7580; - this.probtable[i++] = 0.7881; - this.probtable[i++] = 0.8159; - this.probtable[i++] = 0.8413; - this.probtable[i++] = 0.8643; - this.probtable[i++] = 0.8849; - this.probtable[i++] = 0.9032; - this.probtable[i++] = 0.9192; - this.probtable[i++] = 0.9332; - this.probtable[i++] = 0.9452; - this.probtable[i++] = 0.9554; - this.probtable[i++] = 0.9641; - this.probtable[i++] = 0.9713; - this.probtable[i++] = 0.9772; - this.probtable[i++] = 0.9821; - this.probtable[i++] = 0.9861; - this.probtable[i++] = 0.9893; - this.probtable[i++] = 0.9918; - this.probtable[i++] = 0.9938; - this.probtable[i++] = 0.9953; - this.probtable[i++] = 0.9965; - this.probtable[i++] = 0.9974; - this.probtable[i++] = 0.9981; - this.probtable[i++] = 0.9987; - - this.partial = false; - } - - public boolean estimate(int time, double variance2, boolean fake) { - if(!fake) { - this.time += time; - this.variance += variance2; - } else { - this.partial = true; - } - --this.stages; - if(this.stages == 0) { - //System.printString("variance2: " + (int)(this.variance*100) + "(/100); "); - this.variance = Math.sqrt(this.variance); - //System.printString("variance: " + (int)(this.variance*100) + "(/100)\n"); - return true; - } - return false; - } - - public double getProbability(int x, int y) { - int l = x; - int r = y; - if(x > y) { - l = y; - r = x; - } - - double prob = prob(r) - prob(l); - return prob; - } - - private double prob(int s) { - int tmp = (int)((s - this.time) * 10 / this.variance); - //System.printString(tmp + "\n"); - int abs = (int)Math.abs(tmp); - double prob = 0; - if(abs > this.probtable.length - 1) { - prob = 1; - } else { - prob = this.probtable[abs]; - } - if(tmp < 0) { - return 1.0 - prob; - } else { - return prob; - } - } - - public int getTime() { - return this.time; - } - - public double getVariance() { - return this.variance; - } - - public boolean isPartial() { - return this.partial; - } -} diff --git a/Robust/src/Benchmarks/PERT/Tag/PERT.java b/Robust/src/Benchmarks/PERT/Tag/PERT.java deleted file mode 100644 index 951312a3..00000000 --- a/Robust/src/Benchmarks/PERT/Tag/PERT.java +++ /dev/null @@ -1,86 +0,0 @@ -task startup(StartupObject s{initialstate}) { - - // read in configuration parameters - //System.printString("Top of task startup\n"); - String path = new String("/home/jzhou/pert/conf.txt"); - FileInputStream iStream = new FileInputStream(path); - byte[] b = new byte[1024]; - int length = iStream.read(b); - if(length < 0) { - System.printString("Error! Can not read from configure file: " + path + "\n"); - System.exit(-1); - } - iStream.close(); - String content = new String(b, 0, length); - int index = content.indexOf('\n'); - int stages = Integer.parseInt(content.subString(0, index)); - Estimator estimator = new Estimator(stages){estimate}; - for(int i = 0; i < stages; ++i) { - Stage stage = new Stage(i){sampling}; - } - - taskexit(s{!initialstate}); -} - -task sampling(Stage s{sampling}) { - //System.printString("Top of task sampling\n"); - - s.sampling(); - - taskexit(s{!sampling, estimate}); -} - -task estimateStage(Stage s{estimate}) { - //System.printString("Top of task estimateStage\n"); - - s.estimate(); - - taskexit(s{!estimate, merge}); -} - -task estimate(Estimator e{estimate}, optional Stage s{merge}) { - //System.printString("Top of task estimate\n"); - - boolean fake = false; - if(!isavailable(s)) { - fake = true; - } - boolean finish = e.estimate(s.getAntTime(), s.getAntVariance2(), fake); - - if(finish) { - taskexit(e{!estimate, prob}, s{!merge}); - } else { - taskexit(s{!merge}); - } -} - -task prob(Estimator e{prob}) { - //System.printString("Top of task prob\n"); - - if(e.isPartial()) { - System.printString("There are some sampling data unavailable. The anticipate probability may be greater than it should be!\n"); - } - - String path = new String("/home/jzhou/pert/prob.txt"); - FileInputStream iStream = new FileInputStream(path); - byte b[] = new byte[1024]; - int length = iStream.read(b); - if(length < 0) { - System.printString("Error! Can not read from input file: " + path + "\n"); - System.exit(-1); - } - iStream.close(); - String content = new String(b, 0, length); - int index = content.indexOf('\n'); - int x = Integer.parseInt(content.subString(0, index)); - content = content.subString(index + 1); - index = content.indexOf('\n'); - int y = Integer.parseInt(content.subString(0, index)); - //System.printString("x: " + x + "; y: " + y + "\n"); - System.printString("The anticipate days need to finish this project is: " + e.getTime() + "\n"); - System.printString("And the anticipate variance is: " + (int)(e.getVariance()*100) + "(/100)\n"); - double prob = e.getProbability(x, y); - - System.printString("The probability of this project to be finished in " + x + " to " + y + " days is: " + (int)(prob*100) + "%\n"); - taskexit(e{!prob}); -} diff --git a/Robust/src/Benchmarks/PERT/Tag/Stage.java b/Robust/src/Benchmarks/PERT/Tag/Stage.java deleted file mode 100644 index 19f45a19..00000000 --- a/Robust/src/Benchmarks/PERT/Tag/Stage.java +++ /dev/null @@ -1,87 +0,0 @@ -public class Stage { - flag sampling; - flag estimate; - flag merge; - - int ID; - - int[] samplings; - int optime; - int nortime; - int petime; - int time; - double variance2; - - public Stage(int id) { - this.ID = id; - - this.samplings = new int[10]; - for(int i = 0; i < this.samplings.length; ++i) { - this.samplings[i] = 0; - } - - this.optime = 0; - this.nortime = 0; - this.petime = 0; - this.time = 0; - this.variance2 = 0; - } - - public void sampling() { - /*if(ID % 2 == 1) { - int tmp = samplings[samplings.length]; - }*/ - - Random r = new Random(ID); - int tint = 0; - for(int i = 0; i < this.samplings.length; ++i) { - do { - tint = r.nextInt()%50; - } while(tint <= 0); - this.samplings[i] = tint; - //System.printString(tint + "; "); - } - //int tint = ID * 3; - //for(int i = 0; i < this.samplings.length; ++i) { - //this.samplings[i] = tint + i; - //System.printString(tint + "; "); - //} - //System.printString("\n"); - } - - public void estimate() { - /*if(ID % 2 == 1) { - int tmp = samplings[samplings.length]; - }*/ - - int highest = this.samplings[0]; - int lowest = this.samplings[0]; - int sum = this.samplings[0]; - for(int i = 1; i < this.samplings.length; ++i) { - int temp = this.samplings[i]; - if(temp > highest) { - highest = temp; - } else if(temp < lowest) { - lowest = temp; - } - sum += temp; - } - sum = sum - highest - lowest; - int ordinary = sum / (this.samplings.length - 2); - this.optime = lowest;; - this.petime = highest; - this.nortime = ordinary; - this.time = (this.optime + 4 * this.nortime + this.petime) / 6; - this.variance2 = (double)(this.optime - this.petime) * (double)(this.optime - this.petime) / 36.0; - //System.printString("Op time: " + this.optime + "; Nor time: " + this.nortime + "; Pe time: " + this.petime + "; variance2: " + (int)(this.variance2*100) + "(/100)\n"); - } - - public int getAntTime() { - return this.time; - } - - public double getAntVariance2() { - return this.variance2; - } - -} diff --git a/Robust/src/Benchmarks/Prefetch/Array/Array.java b/Robust/src/Benchmarks/Prefetch/Array/Array.java deleted file mode 100644 index 9d9e262c..00000000 --- a/Robust/src/Benchmarks/Prefetch/Array/Array.java +++ /dev/null @@ -1,37 +0,0 @@ -public class Array extends Thread { - int [][] array; - - public Array() { - int xmax=10000; - int ymax=10; - array=global new int[xmax][ymax]; - for(int i=0;i text1.length) iupper = text1.length; - } - - int i1 = ilow; // Index into first text array. - int i2 = ilow; // Index into second text array. - int ik; // Index into key array. - int x1, x2, x3, x4, t1, t2; // Four "16-bit" blocks, two temps. - int r; // Eight rounds of processing. - - for (int i =ilow ; i >> 8); - text2[i2++] = (byte) x3; // x3 and x2 are switched - text2[i2++] = (byte) (x3 >>> 8); // only in name. - text2[i2++] = (byte) x2; - text2[i2++] = (byte) (x2 >>> 8); - text2[i2++] = (byte) x4; - text2[i2++] = (byte) (x4 >>> 8); - } //End of atomic - - } // End for loop. - - } // End routine. - - public static void main(String argv[]){ - int nthreads; - if(argv.length != 0 ) { - nthreads = Integer.parseInt(argv[0]); - } else { - System.printString("The no of threads has not been specified, defaulting to 1"); - System.printString(" "); - nthreads = 1; - } - - /* Instruments output messages */ - JGFInstrumentor instr = new JGFInstrumentor(); - instr.printHeader(2,0,nthreads); - - JGFCryptBench cb; - int size = 0; - instr.addTimer("Section2:Crypt:Kernel", "Kbyte",size); - atomic { - cb = global new JGFCryptBench(); - cb.JGFsetsize(size); - cb.JGFinitialise(); - } - - - /* Start computation */ - int mid = (128<<24)|(195<<16)|(175<<8)|73; - - JGFCryptBenchSizeA[] th; - atomic { - th = global new JGFCryptBenchSizeA [nthreads]; - } - - // Start the stopwatch. - instr.startTimer("Section2:Crypt:Kernel"); - - // Encrypt plain1. - JGFCryptBenchSizeA tmp; - for(int i=1;i>>9) | (Z[i-6]<<7)) // Shift and combine. - & 0xFFFF; // Just 16 bits. - //continue; // Next iteration. - flag1 = 1; - } - - if(flag1 == 0) { - int flag2 = 0; - - if (j == 6) // Wrap to beginning for second chunk. - { - Z[i] = ((Z[i -7]>>>9) | (Z[i-14]<<7)) - & 0xFFFF; - //continue; - flag2 = 1; - } - - if(flag2 == 0) { - // j == 7 so wrap to beginning for both chunks. - Z[i] = ((Z[i -15]>>>9) | (Z[i-14]<<7)) - & 0xFFFF; - } - } - } - } - - // - //calcDecryptKey - // - //Builds the 52 16-bit encryption subkeys DK[] from the encryption- - //subkeys Z[]. DK[] is a 32-bit int array holding 16-bit values as - //unsigned. - // - - private void calcDecryptKey() - { - int j, k; // Index counters. - int t1, t2, t3; // Temps to hold decrypt subkeys. - - t1 = inv(Z[0]); // Multiplicative inverse (mod x10001). - t2 = - Z[1] & 0xffff; // Additive inverse, 2nd encrypt subkey. - t3 = - Z[2] & 0xffff; // Additive inverse, 3rd encrypt subkey. - - DK[51] = inv(Z[3]); // Multiplicative inverse (mod x10001). - DK[50] = t3; - DK[49] = t2; - DK[48] = t1; - - j = 47; // Indices into temp and encrypt arrays. - k = 4; - for (int i = 0; i < 7; i++) - { - t1 = Z[k++]; - DK[j--] = Z[k++]; - DK[j--] = t1; - t1 = inv(Z[k++]); - t2 = -Z[k++] & 0xffff; - t3 = -Z[k++] & 0xffff; - DK[j--] = inv(Z[k++]); - DK[j--] = t2; - DK[j--] = t3; - DK[j--] = t1; - } - - t1 = Z[k++]; - DK[j--] = Z[k++]; - DK[j--] = t1; - t1 = inv(Z[k++]); - t2 = -Z[k++] & 0xffff; - t3 = -Z[k++] & 0xffff; - DK[j--] = inv(Z[k++]); - DK[j--] = t3; - DK[j--] = t2; - DK[j--] = t1; - } - - - - - - // - //mul - // - // Performs multiplication, modulo (2**16)+1. This code is structured - // on the assumption that untaken branches are cheaper than taken - // branches, and that the compiler doesn't schedule branches. - // Java: Must work with 32-bit int and one 64-bit long to keep - // 16-bit values and their products "unsigned." The routine assumes - // that both a and b could fit in 16 bits even though they come in - // as 32-bit ints. Lots of "& 0xFFFF" masks here to keep things 16-bit. - // Also, because the routine stores mod (2**16)+1 results in a 2**16 - // space, the result is truncated to zero whenever the result would - // zero, be 2**16. And if one of the multiplicands is 0, the result - // is not zero, but (2**16) + 1 minus the other multiplicand (sort - // of an additive inverse mod 0x10001). - - // NOTE: The java conversion of this routine works correctly, but - // is half the speed of using Java's modulus division function (%) - // on the multiplication with a 16-bit masking of the result--running - // in the Symantec Caje IDE. So it's not called for now; the test - // uses Java % instead. - // - - private int mul(int a, int b) - { - int ret; - long p; // Large enough to catch 16-bit multiply - // without hitting sign bit. - if (a != 0) - { - if(b != 0) - { - p = (long) a * b; - b = (int) p & 0xFFFF; // Lower 16 bits. - a = (int) p >>> 16; // Upper 16 bits. - if (b < a) - return (b - a + 1) & 0xFFFF; - else - return (b - a) & 0xFFFF; - } - else - return ((1 - a) & 0xFFFF); // If b = 0, then same as - // 0x10001 - a. - } - else // If a = 0, then return - return((1 - b) & 0xFFFF); // same as 0x10001 - b. - } - - // - // inv - // - // Compute multiplicative inverse of x, modulo (2**16)+1 using - // extended Euclid's GCD (greatest common divisor) algorithm. - // It is unrolled twice to avoid swapping the meaning of - // the registers. And some subtracts are changed to adds. - // Java: Though it uses signed 32-bit ints, the interpretation - // of the bits within is strictly unsigned 16-bit. - // - - private int inv(int x) - { - int t0, t1; - int q, y; - - if (x <= 1) // Assumes positive x. - return(x); // 0 and 1 are self-inverse. - - t1 = 0x10001 / x; // (2**16+1)/x; x is >= 2, so fits 16 bits. - y = 0x10001 % x; - if (y == 1) - return((1 - t1) & 0xFFFF); - - t0 = 1; - do { - q = x / y; - x = x % y; - t0 += q * t1; - if (x == 1) return(t0); - q = y / x; - y = y % x; - t1 += q * t0; - } while (y != 1); - - return((1 - t1) & 0xFFFF); - } - - // - // freeTestData - // - // Nulls arrays and forces garbage collection to free up memory. - // - - void freeTestData(int array_rows) - { - for(int i = 0; i text1.length) iupper = text1.length; - - int i1 = ilow; // Index into first text array. - int i2 = ilow; // Index into second text array. - int ik; // Index into key array. - int x1, x2, x3, x4, t1, t2; // Four "16-bit" blocks, two temps. - int r; // Eight rounds of processing. - - for (int i =ilow ; i >> 8); - text2[i2++] = (byte) x3; // x3 and x2 are switched - text2[i2++] = (byte) (x3 >>> 8); // only in name. - text2[i2++] = (byte) x2; - text2[i2++] = (byte) (x2 >>> 8); - text2[i2++] = (byte) x4; - text2[i2++] = (byte) (x4 >>> 8); - - } // End for loop. - - } // End routine. -} // End of class diff --git a/Robust/src/Benchmarks/Prefetch/Crypt/dsm/crypt/JGFCryptBench.java b/Robust/src/Benchmarks/Prefetch/Crypt/dsm/crypt/JGFCryptBench.java deleted file mode 100644 index d51a7bed..00000000 --- a/Robust/src/Benchmarks/Prefetch/Crypt/dsm/crypt/JGFCryptBench.java +++ /dev/null @@ -1,387 +0,0 @@ -/************************************************************************** - * * - * Java Grande Forum Benchmark Suite - Thread Version 1.0 * - * * - * produced by * - * * - * Java Grande Benchmarking Project * - * * - * at * - * * - * Edinburgh Parallel Computing Centre * - * * - * email: epcc-javagrande@epcc.ed.ac.uk * - * * - * * - * This version copyright (c) The University of Edinburgh, 2001. * - * All rights reserved. * - * * - **************************************************************************/ -/************************************************************************** - * Ported for DSTM Benchmark * - **************************************************************************/ - -public class JGFCryptBench { - - private int size; - private int datasizes[]; - int array_rows; - - byte [] plain1; // Buffer for plaintext data. - byte [] crypt1; // Buffer for encrypted data. - byte [] plain2; // Buffer for decrypted data. - - short [] userkey; // Key for encryption/decryption. - int [] Z; // Encryption subkey (userkey derived). - int [] DK; // Decryption subkey (userkey derived). - - - // - // buildTestData - //Builds the data used for the test -- each time the test is run. - void buildTestData() - { - - - // Create three byte arrays that will be used (and reused) for - // encryption/decryption operations. - - - plain1 = global new byte [array_rows]; - crypt1 = global new byte [array_rows]; - plain2 = global new byte [array_rows]; - - - Random rndnum = global new Random(136506717L); // Create random number generator. - - - // Allocate three arrays to hold keys: userkey is the 128-bit key. - // Z is the set of 16-bit encryption subkeys derived from userkey, - // while DK is the set of 16-bit decryption subkeys also derived - // from userkey. NOTE: The 16-bit values are stored here in - // 32-bit int arrays so that the values may be used in calculations - // as if they are unsigned. Each 64-bit block of plaintext goes - // through eight processing rounds involving six of the subkeys - // then a final output transform with four of the keys; (8 * 6) - // + 4 = 52 subkeys. - - userkey = global new short [8]; // User key has 8 16-bit shorts. - Z = global new int [52]; // Encryption subkey (user key derived). - DK = global new int [52]; // Decryption subkey (user key derived). - - // Generate user key randomly; eight 16-bit values in an array. - - for (int i = 0; i < 8; i++) - { - // Again, the random number function returns int. Converting - // to a short type preserves the bit pattern in the lower 16 - // bits of the int and discards the rest. - - userkey[i] = (short) rndnum.nextInt(); - } - - // Compute encryption and decryption subkeys. - - calcEncryptKey(); - calcDecryptKey(); - - // Fill plain1 with "text." - for (int i = 0; i < array_rows; i++) - { - plain1[i] = (byte) i; - - // Converting to a byte - // type preserves the bit pattern in the lower 8 bits of the - // int and discards the rest. - } - } - - - // calcEncryptKey - - // Builds the 52 16-bit encryption subkeys Z[] from the user key and - //stores in 32-bit int array. The routing corrects an error in the - //source code in the Schnier book. Basically, the sense of the 7- - //and 9-bit shifts are reversed. It still works reversed, but would - //encrypted code would not decrypt with someone else's IDEA code. - // - - private void calcEncryptKey() - { - int j; // Utility variable. - - for (int i = 0; i < 52; i++) // Zero out the 52-int Z array. - Z[i] = 0; - - for (int i = 0; i < 8; i++) // First 8 subkeys are userkey itself. - { - Z[i] = userkey[i] & 0xffff; // Convert "unsigned" - // short to int. - } - - // Each set of 8 subkeys thereafter is derived from left rotating - // the whole 128-bit key 25 bits to left (once between each set of - // eight keys and then before the last four). Instead of actually - // rotating the whole key, this routine just grabs the 16 bits - // that are 25 bits to the right of the corresponding subkey - // eight positions below the current subkey. That 16-bit extent - // straddles two array members, so bits are shifted left in one - // member and right (with zero fill) in the other. For the last - // two subkeys in any group of eight, those 16 bits start to - // wrap around to the first two members of the previous eight. - - for (int i = 8; i < 52; i++) - { - int flag1 = 0; - j = i % 8; - if (j < 6) - { - Z[i] = ((Z[i -7]>>>9) | (Z[i-6]<<7)) // Shift and combine. - & 0xFFFF; // Just 16 bits. - //continue; // Next iteration. - flag1 = 1; - } - - if(flag1 == 0) { - int flag2 = 0; - - if (j == 6) // Wrap to beginning for second chunk. - { - Z[i] = ((Z[i -7]>>>9) | (Z[i-14]<<7)) - & 0xFFFF; - //continue; - flag2 = 1; - } - - if(flag2 == 0) { - // j == 7 so wrap to beginning for both chunks. - Z[i] = ((Z[i -15]>>>9) | (Z[i-14]<<7)) - & 0xFFFF; - } - } - } - } - - // - //calcDecryptKey - // - //Builds the 52 16-bit encryption subkeys DK[] from the encryption- - //subkeys Z[]. DK[] is a 32-bit int array holding 16-bit values as - //unsigned. - // - - private void calcDecryptKey() - { - int j, k; // Index counters. - int t1, t2, t3; // Temps to hold decrypt subkeys. - - t1 = inv(Z[0]); // Multiplicative inverse (mod x10001). - t2 = - Z[1] & 0xffff; // Additive inverse, 2nd encrypt subkey. - t3 = - Z[2] & 0xffff; // Additive inverse, 3rd encrypt subkey. - - DK[51] = inv(Z[3]); // Multiplicative inverse (mod x10001). - DK[50] = t3; - DK[49] = t2; - DK[48] = t1; - - j = 47; // Indices into temp and encrypt arrays. - k = 4; - for (int i = 0; i < 7; i++) - { - t1 = Z[k++]; - DK[j--] = Z[k++]; - DK[j--] = t1; - t1 = inv(Z[k++]); - t2 = -Z[k++] & 0xffff; - t3 = -Z[k++] & 0xffff; - DK[j--] = inv(Z[k++]); - DK[j--] = t2; - DK[j--] = t3; - DK[j--] = t1; - } - - t1 = Z[k++]; - DK[j--] = Z[k++]; - DK[j--] = t1; - t1 = inv(Z[k++]); - t2 = -Z[k++] & 0xffff; - t3 = -Z[k++] & 0xffff; - DK[j--] = inv(Z[k++]); - DK[j--] = t3; - DK[j--] = t2; - DK[j--] = t1; - } - - - // - //mul - // - // Performs multiplication, modulo (2**16)+1. This code is structured - // on the assumption that untaken branches are cheaper than taken - // branches, and that the compiler doesn't schedule branches. - // Java: Must work with 32-bit int and one 64-bit long to keep - // 16-bit values and their products "unsigned." The routine assumes - // that both a and b could fit in 16 bits even though they come in - // as 32-bit ints. Lots of "& 0xFFFF" masks here to keep things 16-bit. - // Also, because the routine stores mod (2**16)+1 results in a 2**16 - // space, the result is truncated to zero whenever the result would - // zero, be 2**16. And if one of the multiplicands is 0, the result - // is not zero, but (2**16) + 1 minus the other multiplicand (sort - // of an additive inverse mod 0x10001). - - // NOTE: The java conversion of this routine works correctly, but - // is half the speed of using Java's modulus division function (%) - // on the multiplication with a 16-bit masking of the result--running - // in the Symantec Caje IDE. So it's not called for now; the test - // uses Java % instead. - // - - private int mul(int a, int b) - { - int ret; - long p; // Large enough to catch 16-bit multiply - // without hitting sign bit. - if (a != 0) - { - if(b != 0) - { - p = (long) a * b; - b = (int) p & 0xFFFF; // Lower 16 bits. - a = (int) p >>> 16; // Upper 16 bits. - if (b < a) - return (b - a + 1) & 0xFFFF; - else - return (b - a) & 0xFFFF; - } - else - return ((1 - a) & 0xFFFF); // If b = 0, then same as - // 0x10001 - a. - } - else // If a = 0, then return - return((1 - b) & 0xFFFF); // same as 0x10001 - b. - } - - // - // inv - // - // Compute multiplicative inverse of x, modulo (2**16)+1 using - // extended Euclid's GCD (greatest common divisor) algorithm. - // It is unrolled twice to avoid swapping the meaning of - // the registers. And some subtracts are changed to adds. - // Java: Though it uses signed 32-bit ints, the interpretation - // of the bits within is strictly unsigned 16-bit. - // - - private int inv(int x) - { - int t0, t1; - int q, y; - - if (x <= 1) // Assumes positive x. - return(x); // 0 and 1 are self-inverse. - - t1 = 0x10001 / x; // (2**16+1)/x; x is >= 2, so fits 16 bits. - y = 0x10001 % x; - if (y == 1) - return((1 - t1) & 0xFFFF); - - t0 = 1; - do { - q = x / y; - x = x % y; - t0 += q * t1; - if (x == 1) return(t0); - q = y / x; - y = y % x; - t1 += q * t0; - } while (y != 1); - - return((1 - t1) & 0xFFFF); - } - - // - // freeTestData - // - // Nulls arrays and forces garbage collection to free up memory. - // - - void freeTestData(int array_rows) - { - for(int i = 0; i>>9) | (Z[i-6]<<7)) // Shift and combine. - & 0xFFFF; // Just 16 bits. - //continue; // Next iteration. - flag1 = 1; - } - - if(flag1 == 0) { - int flag2 = 0; - - if (j == 6) // Wrap to beginning for second chunk. - { - Z[i] = ((Z[i -7]>>>9) | (Z[i-14]<<7)) - & 0xFFFF; - //continue; - flag2 = 1; - } - - if(flag2 == 0) { - // j == 7 so wrap to beginning for both chunks. - Z[i] = ((Z[i -15]>>>9) | (Z[i-14]<<7)) - & 0xFFFF; - } - } - } - } - - // - //calcDecryptKey - // - //Builds the 52 16-bit encryption subkeys DK[] from the encryption- - //subkeys Z[]. DK[] is a 32-bit int array holding 16-bit values as - //unsigned. - // - - private void calcDecryptKey() - { - int j, k; // Index counters. - int t1, t2, t3; // Temps to hold decrypt subkeys. - - t1 = inv(Z[0]); // Multiplicative inverse (mod x10001). - t2 = - Z[1] & 0xffff; // Additive inverse, 2nd encrypt subkey. - t3 = - Z[2] & 0xffff; // Additive inverse, 3rd encrypt subkey. - - DK[51] = inv(Z[3]); // Multiplicative inverse (mod x10001). - DK[50] = t3; - DK[49] = t2; - DK[48] = t1; - - j = 47; // Indices into temp and encrypt arrays. - k = 4; - for (int i = 0; i < 7; i++) - { - t1 = Z[k++]; - DK[j--] = Z[k++]; - DK[j--] = t1; - t1 = inv(Z[k++]); - t2 = -Z[k++] & 0xffff; - t3 = -Z[k++] & 0xffff; - DK[j--] = inv(Z[k++]); - DK[j--] = t2; - DK[j--] = t3; - DK[j--] = t1; - } - - t1 = Z[k++]; - DK[j--] = Z[k++]; - DK[j--] = t1; - t1 = inv(Z[k++]); - t2 = -Z[k++] & 0xffff; - t3 = -Z[k++] & 0xffff; - DK[j--] = inv(Z[k++]); - DK[j--] = t3; - DK[j--] = t2; - DK[j--] = t1; - } - - - // - //mul - // - // Performs multiplication, modulo (2**16)+1. This code is structured - // on the assumption that untaken branches are cheaper than taken - // branches, and that the compiler doesn't schedule branches. - // Java: Must work with 32-bit int and one 64-bit long to keep - // 16-bit values and their products "unsigned." The routine assumes - // that both a and b could fit in 16 bits even though they come in - // as 32-bit ints. Lots of "& 0xFFFF" masks here to keep things 16-bit. - // Also, because the routine stores mod (2**16)+1 results in a 2**16 - // space, the result is truncated to zero whenever the result would - // zero, be 2**16. And if one of the multiplicands is 0, the result - // is not zero, but (2**16) + 1 minus the other multiplicand (sort - // of an additive inverse mod 0x10001). - - // NOTE: The java conversion of this routine works correctly, but - // is half the speed of using Java's modulus division function (%) - // on the multiplication with a 16-bit masking of the result--running - // in the Symantec Caje IDE. So it's not called for now; the test - // uses Java % instead. - // - - private int mul(int a, int b) - { - int ret; - long p; // Large enough to catch 16-bit multiply - // without hitting sign bit. - if (a != 0) - { - if(b != 0) - { - p = (long) a * b; - b = (int) p & 0xFFFF; // Lower 16 bits. - a = (int) p >>> 16; // Upper 16 bits. - if (b < a) - return (b - a + 1) & 0xFFFF; - else - return (b - a) & 0xFFFF; - } - else - return ((1 - a) & 0xFFFF); // If b = 0, then same as - // 0x10001 - a. - } - else // If a = 0, then return - return((1 - b) & 0xFFFF); // same as 0x10001 - b. - } - - // - // inv - // - // Compute multiplicative inverse of x, modulo (2**16)+1 using - // extended Euclid's GCD (greatest common divisor) algorithm. - // It is unrolled twice to avoid swapping the meaning of - // the registers. And some subtracts are changed to adds. - // Java: Though it uses signed 32-bit ints, the interpretation - // of the bits within is strictly unsigned 16-bit. - // - - private int inv(int x) - { - int t0, t1; - int q, y; - - if (x <= 1) // Assumes positive x. - return(x); // 0 and 1 are self-inverse. - - t1 = 0x10001 / x; // (2**16+1)/x; x is >= 2, so fits 16 bits. - y = 0x10001 % x; - if (y == 1) - return((1 - t1) & 0xFFFF); - - t0 = 1; - do { - q = x / y; - x = x % y; - t0 += q * t1; - if (x == 1) return(t0); - q = y / x; - y = y % x; - t1 += q * t0; - } while (y != 1); - - return((1 - t1) & 0xFFFF); - } - - // - // freeTestData - // - // Nulls arrays and forces garbage collection to free up memory. - // - - void freeTestData(int array_rows) - { - for(int i = 0; i text1.length) iupper = text1.length; - - int i1 = ilow; // Index into first text array. - int i2 = ilow; // Index into second text array. - int ik; // Index into key array. - int x1, x2, x3, x4, t1, t2; // Four "16-bit" blocks, two temps. - int r; // Eight rounds of processing. - - for (int i =ilow ; i >> 8); - text2[i2++] = (byte) x3; // x3 and x2 are switched - text2[i2++] = (byte) (x3 >>> 8); // only in name. - text2[i2++] = (byte) x2; - text2[i2++] = (byte) (x2 >>> 8); - text2[i2++] = (byte) x4; - text2[i2++] = (byte) (x4 >>> 8); - - } // End for loop. - - } // End routine. - - public static void main(String argv[]){ - int nthreads; - if(argv.length != 0 ) { - nthreads = Integer.parseInt(argv[0]); - } else { - System.out.println("The no of threads has not been specified, defaulting to 1"); - System.out.println(" "); - nthreads = 1; - } - - /* Instruments output messages */ - JGFInstrumentor instr = new JGFInstrumentor(); - instr.printHeader(2,0,nthreads); - - JGFCryptBench cb; - int size = 0; - instr.addTimer("Section2:Crypt:Kernel", "Kbyte",size); - cb = new JGFCryptBench(nthreads); - cb.JGFsetsize(size); - cb.JGFinitialise(); - - /* Start computation */ - JGFCryptBenchSizeA[] th; - th = new JGFCryptBenchSizeA [nthreads]; - - // Start the stopwatch. - instr.startTimer("Section2:Crypt:Kernel"); - - // Encrypt plain1. - JGFCryptBenchSizeA tmp; - for(int i=1;i 1) - b.cleared=true; - b.entercount--; - ret1 = true; - } - retry=false; - } - } - } while(retry); - if (ret1) { - return; - } - while(ret2) { - atomic { - if (b.cleared) { - b.entercount--; - int count = b.entercount; - if (count==0) - b.cleared=false; - ret2=false; - } - } - } - } -} diff --git a/Robust/src/Benchmarks/Prefetch/Em3d/dsm/BiGraph.java b/Robust/src/Benchmarks/Prefetch/Em3d/dsm/BiGraph.java deleted file mode 100644 index 81ff95c0..00000000 --- a/Robust/src/Benchmarks/Prefetch/Em3d/dsm/BiGraph.java +++ /dev/null @@ -1,107 +0,0 @@ -/** - * A class that represents the irregular bipartite graph used in - * EM3D. The graph contains two linked structures that represent the - * E nodes and the N nodes in the application. - **/ -public class BiGraph -{ - public BiGraph() { - } - /** - * Nodes that represent the electrical field. - **/ - Node eNodes; - /** - * Nodes that representhe the magnetic field. - **/ - Node hNodes; - - /** - * Construct the bipartite graph. - * @param e the nodes representing the electric fields - * @param h the nodes representing the magnetic fields - **/ - BiGraph(Node e, Node h) - { - eNodes = e; - hNodes = h; - } - - /** - * Create the bi graph that contains the linked list of - * e and h nodes. - * @param numNodes the number of nodes to create - * @param numDegree the out-degree of each node - * @param verbose should we print out runtime messages - * @return the bi graph that we've created. - **/ - - static BiGraph create(int numNodes, int numDegree, boolean verbose, Random r) - { - - // making nodes (we create a table) - //if (verbose) System.printString("making nodes (tables in orig. version)"); - Node [] eTable=Node.fillTable(numNodes, numDegree, r); - Node [] hTable=Node.fillTable(numNodes, numDegree, r); - - // making neighbors - //if (verbose) System.printString("updating from and coeffs"); - for(int i = 0; i< numNodes; i++) { - Node n = hTable[i]; - n.makeUniqueNeighbors(eTable, r); - } - - for (int i = 0; i < numNodes; i++) { - Node n = eTable[i]; - n.makeUniqueNeighbors(hTable, r); - } - - // Create the fromNodes and coeff field - //if (verbose) System.printString("filling from fields"); - for(int i = 0; i< numNodes; i++) { - Node n = hTable[i]; - n.makeFromNodes(); - } - - for (int i = 0; i < numNodes; i++) { - Node n = eTable[i]; - n.makeFromNodes(); - } - - // Update the fromNodes - for (int i = 0; i < numNodes; i++) { - Node n = hTable[i]; - n.updateFromNodes(r); - } - for (int i = 0; i < numNodes; i++) { - Node n = eTable[i]; - n.updateFromNodes(r); - } - - BiGraph g = global new BiGraph(eTable[0], hTable[0]); - return g; - } - - /** - * Override the toString method to print out the values of the e and h nodes. - * @return a string contain the values of the e and h nodes. - **/ - public String toString() - { - StringBuffer retval = new StringBuffer(); - Node tmp = eNodes; - while(tmp!=null) { - Node n = tmp; - retval.append("E: " + n + "\n"); - tmp = tmp.next; - } - tmp = hNodes; - while(tmp!=null) { - Node n = tmp; - retval.append("H: " + n + "\n"); - tmp = tmp.next; - } - return retval.toString(); - } - -} diff --git a/Robust/src/Benchmarks/Prefetch/Em3d/dsm/BiGraph2.java b/Robust/src/Benchmarks/Prefetch/Em3d/dsm/BiGraph2.java deleted file mode 100644 index d183880d..00000000 --- a/Robust/src/Benchmarks/Prefetch/Em3d/dsm/BiGraph2.java +++ /dev/null @@ -1,104 +0,0 @@ -/** - * A class that represents the irregular bipartite graph used in - * EM3D. The graph contains two linked structures that represent the - * E nodes and the N nodes in the application. - **/ -public class BiGraph { - public BiGraph() { - } - /** - * Nodes that represent the electrical field. - **/ - Node[] eNodes; - /** - * Nodes that representhe the magnetic field. - **/ - Node[] hNodes; - - EVector [][] reversetable; - int numNodes; - - /** - * Construct the bipartite graph. - * @param e the nodes representing the electric fields - * @param h the nodes representing the magnetic fields - **/ - BiGraph(Node[] e, Node[] h) { - eNodes = e; - hNodes = h; - } - - /** - * Create the bi graph that contains the linked list of - * e and h nodes. - * @param numNodes the number of nodes to create - * @param numDegree the out-degree of each node - * @param verbose should we print out runtime messages - * @return the bi graph that we've created. - **/ - - static BiGraph create(int numNodes, int degree, int numThreads) { - // making nodes (we create a table) - Node [] eTable = global new Node[numNodes]; - Node [] hTable = global new Node[numNodes]; - BiGraph g = global new BiGraph(eTable, hTable); - g.numNodes=numNodes; - g.reversetable=global new EVector[numThreads][]; - return g; - } - - - /** - * - * - * @return - **/ - public void allocateNodes( int indexBegin, int indexEnd, int threadIndex) { - for(int i = indexBegin; i < indexEnd; i++ ) { - eNodes[i]=global new Node(); - hNodes[i]=global new Node(); - } - reversetable[threadIndex]=global new EVector[numNodes]; - } - - public void initializeNodes(Node[] fromnodes, Node[] tonodes, int begin, int end, int degree, Random r, int threadIndex) { - for(int i = begin; i < end; i++ ) { - Node n=fromnodes[i]; - n.init(degree, r.nextDouble()); - n.makeUniqueNeighbors(reversetable[threadIndex], tonodes, r, begin, end); - } - } - - /** - * - * - * @return - **/ - - public void makeFromNodes(Node[] nodes, int indexBegin, int indexEnd, Random r) { - // Create the fromNodes and coeff field - int numthreads=reversetable.length; - for(int i = indexBegin; i < indexEnd; i++) { - Node n = nodes[i]; - int count=0; - for(int j=0;j=size) { - System.printString("Illegal Vector.elementAt"); - return null; - } - return array[index]; - } - - public void setElementAt(Object obj, int index) { - if (index>=0 && index array.length) { - int newsize; - if (capacityIncrement<=0) - newsize=array.length*2; - else - newsize=array.length+capacityIncrement; - if (newsize=size) - System.printString("Illegal remove"); - for(int i=index;i<(size-1);i++) { - array[i]=array[i+1]; - } - size--; - } -} diff --git a/Robust/src/Benchmarks/Prefetch/Em3d/dsm/Em3d.java b/Robust/src/Benchmarks/Prefetch/Em3d/dsm/Em3d.java deleted file mode 100644 index f094074c..00000000 --- a/Robust/src/Benchmarks/Prefetch/Em3d/dsm/Em3d.java +++ /dev/null @@ -1,243 +0,0 @@ -/** - * - * - * Java implementation of the em3d Olden benchmark. This Olden - * benchmark models the propagation of electromagnetic waves through - * objects in 3 dimensions. It is a simple computation on an irregular - * bipartite graph containing nodes representing electric and magnetic - * field values. - * - *

    - * D. Culler, A. Dusseau, S. Goldstein, A. Krishnamurthy, S. Lumetta, T. von - * Eicken and K. Yelick. "Parallel Programming in Split-C". Supercomputing - * 1993, pages 262-273. - * - **/ -public class Em3d extends Thread -{ - - /** - * The number of nodes (E and H) - **/ - private int numNodes; - /** - * The out-degree of each node. - **/ - private int numDegree; - /** - * The number of compute iterations - **/ - private int numIter; - /** - * Should we print the results and other runtime messages - **/ - private boolean printResult; - /** - * Print information messages? - **/ - private boolean printMsgs; - - BiGraph bg; - int upperlimit; - int lowerlimit; - Barrier mybarr; - - public Em3d() { - numNodes = 0; - numDegree = 0; - numIter = 1; - printResult = false; - printMsgs = false; - } - - public Em3d(BiGraph bg, int lowerlimit, int upperlimit, int numIter, Barrier mybarr) { - this.bg = bg; - this.lowerlimit = lowerlimit; - this.upperlimit = upperlimit; - this.numIter = numIter; - this.mybarr = mybarr; - } - - public void run() { - int iteration; - Barrier barr; - Node enodebase; - Node hnodebase; - - atomic { - iteration = numIter; - barr=mybarr; - } - atomic { - enodebase=bg.eNodes; - hnodebase=bg.hNodes; - for(int j = 0; j numThreads = " + numThreads+"\n"); - Barrier mybarr; - atomic { - mybarr = global new Barrier(numThreads); - } - BiGraph graph; - Random rand = new Random(783); - atomic { - graph = BiGraph.create(em.numNodes, em.numDegree, em.printResult, rand); - } - - long end0 = System.currentTimeMillis(); - - // compute a single iteration of electro-magnetic propagation - if (em.printMsgs) - System.printString("Propagating field values for " + em.numIter + - " iteration(s)...\n"); - long start1 = System.currentTimeMillis(); - Em3d[] em3d; - atomic { - em3d = global new Em3d[numThreads]; - em3d[0] = global new Em3d(graph, 0, em.numNodes/4, em.numIter, mybarr); - em3d[1] = global new Em3d(graph, (em.numNodes/4) + 1, em.numNodes/2, em.numIter, mybarr); - em3d[2] = global new Em3d(graph, (em.numNodes/2) + 1, (3*em.numNodes)/4, em.numIter, mybarr); - em3d[3] = global new Em3d(graph, (3*em.numNodes)/4 + 1, em.numNodes, em.numIter, mybarr); - } - - Em3d tmp; - for(int i = 0; i -d [-p] [-m] [-h]\n"); - System.printString(" -n the number of nodes\n"); - System.printString(" -d the out-degree of each node\n"); - System.printString(" -i the number of iterations\n"); - System.printString(" -p (print detailed results\n)"); - System.printString(" -m (print informative messages)\n"); - System.printString(" -h (this message)\n"); - } - -} diff --git a/Robust/src/Benchmarks/Prefetch/Em3d/dsm/Em3d2.java b/Robust/src/Benchmarks/Prefetch/Em3d/dsm/Em3d2.java deleted file mode 100644 index 3d73a5d0..00000000 --- a/Robust/src/Benchmarks/Prefetch/Em3d/dsm/Em3d2.java +++ /dev/null @@ -1,259 +0,0 @@ -/** - * - * - * Java implementation of the em3d Olden benchmark. This Olden - * benchmark models the propagation of electromagnetic waves through - * objects in 3 dimensions. It is a simple computation on an irregular - * bipartite graph containing nodes representing electric and magnetic - * field values. - * - *

    - * D. Culler, A. Dusseau, S. Goldstein, A. Krishnamurthy, S. Lumetta, T. von - * Eicken and K. Yelick. "Parallel Programming in Split-C". Supercomputing - * 1993, pages 262-273. - * - **/ -public class Em3d extends Thread { - - /** - * The number of nodes (E and H) - **/ - private int numNodes; - /** - * The out-degree of each node. - **/ - private int numDegree; - /** - * The number of compute iterations - **/ - private int numIter; - /** - * Should we print the results and other runtime messages - **/ - private boolean printResult; - /** - * Print information messages? - **/ - private boolean printMsgs; - - int threadindex; - int numThreads; - - BiGraph bg; - int upperlimit; - int lowerlimit; - public Em3d() { - } - - public Em3d(BiGraph bg, int lowerlimit, int upperlimit, int numIter, int numDegree, int threadindex) { - this.bg = bg; - this.lowerlimit = lowerlimit; - this.upperlimit = upperlimit; - this.numIter = numIter; - this.numDegree = numDegree; - this.threadindex=threadindex; - } - - public void run() { - int iteration; - Barrier barr; - int degree; - Random random; - String hname; - - barr = new Barrier("128.195.175.79"); - atomic { - iteration = numIter; - degree = numDegree; - random = new Random(lowerlimit); - } - - atomic { - //This is going to conflict badly...Minimize work here - bg.allocateNodes ( lowerlimit, upperlimit, threadindex); - } - Barrier.enterBarrier(barr); - System.clearPrefetchCache(); - - atomic { - //initialize the eNodes - bg.initializeNodes(bg.eNodes, bg.hNodes, lowerlimit, upperlimit, degree, random, threadindex); - } - Barrier.enterBarrier(barr); - - atomic { - //initialize the hNodes - bg.initializeNodes(bg.hNodes, bg.eNodes, lowerlimit, upperlimit, degree, random, threadindex); - } - Barrier.enterBarrier(barr); - - atomic { - bg.makeFromNodes(bg.hNodes, lowerlimit, upperlimit, random); - } - Barrier.enterBarrier(barr); - - atomic { - bg.makeFromNodes(bg.eNodes, lowerlimit, upperlimit, random); - } - Barrier.enterBarrier(barr); - - //Do the computation - for (int i = 0; i < iteration; i++) { - /* for eNodes */ - atomic { - for(int j = lowerlimit; j numThreads = " + numThreads+"\n"); - BarrierServer mybarr; - BiGraph graph; - - - // initialization step 1: allocate BiGraph - // System.printString( "Allocating BiGraph.\n" ); - - atomic { - mybarr = global new BarrierServer(numThreads); - graph = BiGraph.create(em.numNodes, em.numDegree, numThreads); - } - mybarr.start(mid[0]); - - - Em3dWrap[] em3d=new Em3dWrap[numThreads]; - int increment = em.numNodes/numThreads; - - - // initialization step 2: divide work of allocating nodes - // System.printString( "Launching distributed allocation of nodes.\n" ); - - atomic { - int base=0; - for(int i=0;i -N -d [-p] [-m] [-h]\n"); - System.printString(" -N the number of nodes\n"); - System.printString(" -T the number of threads\n"); - System.printString(" -d the out-degree of each node\n"); - System.printString(" -i the number of iterations\n"); - System.printString(" -p (print detailed results\n)"); - System.printString(" -m (print informative messages)\n"); - System.printString(" -h (this message)\n"); - } - -} diff --git a/Robust/src/Benchmarks/Prefetch/Em3d/dsm/Em3dN.java b/Robust/src/Benchmarks/Prefetch/Em3d/dsm/Em3dN.java deleted file mode 100644 index 49113568..00000000 --- a/Robust/src/Benchmarks/Prefetch/Em3d/dsm/Em3dN.java +++ /dev/null @@ -1,441 +0,0 @@ -/** - * - * - * Java implementation of the em3d Olden benchmark. This Olden - * benchmark models the propagation of electromagnetic waves through - * objects in 3 dimensions. It is a simple computation on an irregular - * bipartite graph containing nodes representing electric and magnetic - * field values. - * - *

    - * D. Culler, A. Dusseau, S. Goldstein, A. Krishnamurthy, S. Lumetta, T. von - * Eicken and K. Yelick. "Parallel Programming in Split-C". Supercomputing - * 1993, pages 262-273. - * - **/ -public class Em3d extends Thread -{ - - /** - * The number of nodes (E and H) - **/ - private int numNodes; - /** - * The out-degree of each node. - **/ - private int numDegree; - /** - * The number of compute iterations - **/ - private int numIter; - /** - * Should we print the results and other runtime messages - **/ - private boolean printResult; - /** - * Print information messages? - **/ - private boolean printMsgs; - - int numThreads; - - BiGraph bg; - int upperlimit; - int lowerlimit; - Barrier mybarr; - - Random r; - - // yipes! static members are not supported so - // using the following constants: - // runMode == 1 is RUNMODE_ALLOC - // runMode == 2 is RUNMODE_NEIGHBORS - // runMode == 3 is RUNMODE_MAKEFROM - // runMode == 4 is RUNMODE_FROMLINKS - // runMode == 5 is RUNMODE_WORK - int runMode; - - - public Em3d() { - numNodes = 0; - numDegree = 0; - numIter = 1; - printResult = false; - printMsgs = false; - runMode = 0; - } - - public Em3d(BiGraph bg, int lowerlimit, int upperlimit, int numIter, Barrier mybarr, int numDegree, Random r, int runMode) { - this.bg = bg; - this.lowerlimit = lowerlimit; - this.upperlimit = upperlimit; - this.numIter = numIter; - this.mybarr = mybarr; - this.runMode = runMode; - this.numDegree = numDegree; - this.r = r; - } - - public void run() { - int iteration; - Barrier barr; - int degree; - Random random; - int mode; - - atomic { - iteration = numIter; - barr=mybarr; - degree = numDegree; - random = r; - mode = runMode; - } - - if( mode == 1 ) { - atomic { - bg.allocate( lowerlimit, upperlimit, degree, r ); - } - Barrier.enterBarrier(barr); - System.clearPrefetchCache(); - - } else if( mode == 2 ) { - atomic { - bg.makeNeighbors( lowerlimit, upperlimit, r ); - } - Barrier.enterBarrier(barr); - System.clearPrefetchCache(); - - } else if( mode == 3 ) { - atomic { - bg.makeFromNodes( lowerlimit, upperlimit ); - } - Barrier.enterBarrier(barr); - System.clearPrefetchCache(); - - } else if( mode == 4 ) { - atomic { - bg.makeFromLinks( lowerlimit, upperlimit, r ); - } - Barrier.enterBarrier(barr); - System.clearPrefetchCache(); - - } else if( mode == 5 ) { - - for (int i = 0; i < iteration; i++) { - /* for eNodes */ - atomic { - for(int j = lowerlimit; j numThreads = " + numThreads+"\n"); - Barrier mybarr; - BiGraph graph; - Random rand; - - - // initialization step 1: allocate BiGraph - // System.printString( "Allocating BiGraph.\n" ); - - atomic { - mybarr = global new Barrier(numThreads); - rand = global new Random(783); - graph = BiGraph.create(em.numNodes, em.numDegree, em.printResult, rand); - } - - Em3d[] em3d; - Em3d tmp; - int base; - int increment; - - - increment = em.numNodes/numThreads; - - - // initialization step 2: divide work of allocating nodes - // System.printString( "Launching distributed allocation of nodes.\n" ); - - atomic { - em3d = global new Em3d[numThreads]; - base=0; - for(int i=0;i -N -d [-p] [-m] [-h]\n"); - System.printString(" -N the number of nodes\n"); - System.printString(" -T the number of threads\n"); - System.printString(" -d the out-degree of each node\n"); - System.printString(" -i the number of iterations\n"); - System.printString(" -p (print detailed results\n)"); - System.printString(" -m (print informative messages)\n"); - System.printString(" -h (this message)\n"); - } - -} diff --git a/Robust/src/Benchmarks/Prefetch/Em3d/dsm/Em3dNold.java b/Robust/src/Benchmarks/Prefetch/Em3d/dsm/Em3dNold.java deleted file mode 100644 index d2769e7e..00000000 --- a/Robust/src/Benchmarks/Prefetch/Em3d/dsm/Em3dNold.java +++ /dev/null @@ -1,242 +0,0 @@ -/** - * - * - * Java implementation of the em3d Olden benchmark. This Olden - * benchmark models the propagation of electromagnetic waves through - * objects in 3 dimensions. It is a simple computation on an irregular - * bipartite graph containing nodes representing electric and magnetic - * field values. - * - *

    - * D. Culler, A. Dusseau, S. Goldstein, A. Krishnamurthy, S. Lumetta, T. von - * Eicken and K. Yelick. "Parallel Programming in Split-C". Supercomputing - * 1993, pages 262-273. - * - **/ -public class Em3d extends Thread -{ - - /** - * The number of nodes (E and H) - **/ - private int numNodes; - /** - * The out-degree of each node. - **/ - private int numDegree; - /** - * The number of compute iterations - **/ - private int numIter; - /** - * Should we print the results and other runtime messages - **/ - private boolean printResult; - /** - * Print information messages? - **/ - private boolean printMsgs; - - int numThreads; - - BiGraph bg; - int upperlimit; - int lowerlimit; - Barrier mybarr; - - public Em3d() { - numNodes = 0; - numDegree = 0; - numIter = 1; - printResult = false; - printMsgs = false; - } - - public Em3d(BiGraph bg, int lowerlimit, int upperlimit, int numIter, Barrier mybarr) { - this.bg = bg; - this.lowerlimit = lowerlimit; - this.upperlimit = upperlimit; - this.numIter = numIter; - this.mybarr = mybarr; - } - - public void run() { - int iteration; - Barrier barr; - - atomic { - iteration = numIter; - barr=mybarr; - } - - for (int i = 0; i < iteration; i++) { - /* for eNodes */ - atomic { - for(int j = lowerlimit; j numThreads = " + numThreads+"\n"); - Barrier mybarr; - BiGraph graph; - Random rand = new Random(783); - - atomic { - mybarr = global new Barrier(numThreads); - graph = BiGraph.create(em.numNodes, em.numDegree, em.printResult, rand); - } - - long end0 = System.currentTimeMillis(); - - // compute a single iteration of electro-magnetic propagation - if (em.printMsgs) - System.printString("Propagating field values for " + em.numIter + - " iteration(s)...\n"); - long start1 = System.currentTimeMillis(); - Em3d[] em3d; - - atomic { - em3d = global new Em3d[numThreads]; - int increment=em.numNodes/numThreads; - int base=0; - for(int i=0;i -N -d [-p] [-m] [-h]\n"); - System.printString(" -N the number of nodes\n"); - System.printString(" -T the number of threads\n"); - System.printString(" -d the out-degree of each node\n"); - System.printString(" -i the number of iterations\n"); - System.printString(" -p (print detailed results\n)"); - System.printString(" -m (print informative messages)\n"); - System.printString(" -h (this message)\n"); - } - -} diff --git a/Robust/src/Benchmarks/Prefetch/Em3d/dsm/Em3dWrap.java b/Robust/src/Benchmarks/Prefetch/Em3d/dsm/Em3dWrap.java deleted file mode 100644 index e6cf62a1..00000000 --- a/Robust/src/Benchmarks/Prefetch/Em3d/dsm/Em3dWrap.java +++ /dev/null @@ -1,9 +0,0 @@ -public class Em3dWrap { - public global Em3d em3d; - public Em3dWrap() { - } - - public Em3dWrap(Em3d e) { - em3d=e; - } -} \ No newline at end of file diff --git a/Robust/src/Benchmarks/Prefetch/Em3d/dsm/Node.java b/Robust/src/Benchmarks/Prefetch/Em3d/dsm/Node.java deleted file mode 100644 index 5e3aca6c..00000000 --- a/Robust/src/Benchmarks/Prefetch/Em3d/dsm/Node.java +++ /dev/null @@ -1,144 +0,0 @@ -/** - * This class implements nodes (both E- and H-nodes) of the EM graph. Sets - * up random neighbors and propagates field values among neighbors. - */ -public class Node { - /** - * The value of the node. - **/ - double value; - /** - * The next node in the list. - **/ - protected Node next; - /** - * Array of nodes to which we send our value. - **/ - Node[] toNodes; - /** - * Array of nodes from which we receive values. - **/ - Node[] fromNodes; - /** - * Coefficients on the fromNodes edges - **/ - double[] coeffs; - /** - * The number of fromNodes edges - **/ - int fromCount; - /** - * Used to create the fromEdges - keeps track of the number of edges that have - * been added - **/ - int fromLength; - - /** - * Constructor for a node with given `degree'. The value of the - * node is initialized to a random value. - **/ - public Node(int degree, Random r) - { - value = r.nextDouble(); - // create empty array for holding toNodes - toNodes = global new Node[degree]; - } - - /** - * Create the linked list of E or H nodes. We create a table which is used - * later to create links among the nodes. - * @param size the no. of nodes to create - * @param degree the out degree of each node - * @return a table containing all the nodes. - **/ - public static Node[] fillTable(int size, int degree, Random r) - { - Node[] table; - Node prevNode; - table = global new Node[size]; - prevNode = global new Node(degree, r); - table[0] = prevNode; - for (int i = 1; i < size; i++) { - Node curNode = global new Node(degree, r); - table[i] = curNode; - prevNode.next = curNode; - prevNode = curNode; - } - return table; - } - - /** - * Create unique `degree' neighbors from the nodes given in nodeTable. - * We do this by selecting a random node from the give nodeTable to - * be neighbor. If this neighbor has been previously selected, then - * a different random neighbor is chosen. - * @param nodeTable the list of nodes to choose from. - **/ - public void makeUniqueNeighbors(Node[] nodeTable, Random rand) - { - for (int filled = 0; filled < toNodes.length; filled++) { - int k; - Node otherNode; - - do { - boolean isBreak = false; - // generate a random number in the correct range - int index = rand.nextInt(); - if (index < 0) index = -index; - index = index % nodeTable.length; - - // find a node with the random index in the given table - otherNode = nodeTable[index]; - - for (k = 0; (k < filled) && (isBreak==false); k++) { - if (otherNode == toNodes[filled]) - isBreak = true; - } - } while (k < filled); - - // other node is definitely unique among "filled" toNodes - toNodes[filled] = otherNode; - - // update fromCount for the other node - otherNode.fromCount++; - } - } - - /** - * Allocate the right number of FromNodes for this node. This - * step can only happen once we know the right number of from nodes - * to allocate. Can be done after unique neighbors are created and known. - * - * It also initializes random coefficients on the edges. - **/ - public void makeFromNodes() - { - fromNodes = global new Node[fromCount]; // nodes fill be filled in later - coeffs = global new double[fromCount]; - } - - /** - * Fill in the fromNode field in "other" nodes which are pointed to - * by this node. - **/ - public void updateFromNodes(Random rand) - { - for (int i = 0; i < toNodes.length; i++) { - Node otherNode = toNodes[i]; - int count = otherNode.fromLength++; - otherNode.fromNodes[count] = this; - otherNode.coeffs[count] = rand.nextDouble(); - } - } - - /** - * Override the toString method to return the value of the node. - * @return the value of the node. - **/ - public String toString() - { - String returnString; - returnString = "value " + (long)value + ", from_count " + fromCount; - } - -} diff --git a/Robust/src/Benchmarks/Prefetch/Em3d/dsm/Node2.java b/Robust/src/Benchmarks/Prefetch/Em3d/dsm/Node2.java deleted file mode 100644 index b8616b84..00000000 --- a/Robust/src/Benchmarks/Prefetch/Em3d/dsm/Node2.java +++ /dev/null @@ -1,121 +0,0 @@ -/** - * This class implements nodes (both E- and H-nodes) of the EM graph. Sets - * up random neighbors and propagates field values among neighbors. - */ -public class Node { - /** - * The value of the node. - **/ - double value; - /** - * Array of nodes to which we send our value. - **/ - Node[] toNodes; - /** - * Array of nodes from which we receive values. - **/ - Node[] fromNodes; - /** - * Coefficients on the fromNodes edges - **/ - double[] coeffs; - /** - * The number of fromNodes edges - **/ - int fromCount; - /** - * Used to create the fromEdges - keeps track of the number of edges that have - * been added - **/ - int fromLength; - - /** - * Constructor for a node with given `degree'. The value of the - * node is initialized to a random value. - **/ - public Node() { - } - - public void init(int degree, double val) { - this.value=val; - // create empty array for holding toNodes - toNodes = global new Node[degree]; - } - - /** - * Create unique `degree' neighbors from the nodes given in nodeTable. - * We do this by selecting a random node from the give nodeTable to - * be neighbor. If this neighbor has been previously selected, then - * a different random neighbor is chosen. - * @param nodeTable the list of nodes to choose from. - **/ - public void makeUniqueNeighbors(EVector[] reversetable,Node[] nodeTable, Random rand, int begin, int end) { - for (int filled = 0; filled < toNodes.length; filled++) { - int k; - Node otherNode; - int index; - do { - boolean isBreak = false; - // generate a random number in the correct range - index = rand.nextInt(); - if (index < 0) index = -index; - //local vs remote from em3d benchmark - if ((rand.nextInt()%2)==0) - index=index%nodeTable.length; - else - index=begin+(index%(end-begin)); - - // find a node with the random index in the given table - otherNode = nodeTable[index]; - - for (k = 0; (k < filled) && (isBreak==false); k++) { - if (otherNode == toNodes[k]) - isBreak = true; - } - } while (k < filled); - - // other node is definitely unique among "filled" toNodes - toNodes[filled] = otherNode; - - // update fromCount for the other node - if (reversetable[index]==null) - reversetable[index]=global new EVector(); - reversetable[index].addElement(this); - } - } - - /** - * Allocate the right number of FromNodes for this node. This - * step can only happen once we know the right number of from nodes - * to allocate. Can be done after unique neighbors are created and known. - * - * It also initializes random coefficients on the edges. - **/ - - public void makeFromNodes() { - fromNodes = global new Node[fromCount]; // nodes fill be filled in later - coeffs = global new double[fromCount]; - } - - /** - * Fill in the fromNode field in "other" nodes which are pointed to - * by this node. - **/ - public void updateFromNodes(Random rand) { - for (int i = 0; i < toNodes.length; i++) { - Node otherNode = toNodes[i]; - int count = otherNode.fromLength++; - otherNode.fromNodes[count] = this; - otherNode.coeffs[count] = rand.nextDouble(); - } - } - - /** - * Override the toString method to return the value of the node. - * @return the value of the node. - **/ - public String toString() { - String returnString; - returnString = "value " + (long)value + ", from_count " + fromCount; - } -} diff --git a/Robust/src/Benchmarks/Prefetch/Em3d/dsm/README b/Robust/src/Benchmarks/Prefetch/Em3d/dsm/README deleted file mode 100644 index 05de81ff..00000000 --- a/Robust/src/Benchmarks/Prefetch/Em3d/dsm/README +++ /dev/null @@ -1,6 +0,0 @@ -Create the dstm.conf file -To compile: - make -To run the Em3dNP.bin on single machine - ./Em3dNP.bin master -T -N -d -p - diff --git a/Robust/src/Benchmarks/Prefetch/Em3d/dsm/makefile b/Robust/src/Benchmarks/Prefetch/Em3d/dsm/makefile deleted file mode 100644 index ca304c77..00000000 --- a/Robust/src/Benchmarks/Prefetch/Em3d/dsm/makefile +++ /dev/null @@ -1,36 +0,0 @@ -MAINCLASS=Em3d -SRC=${MAINCLASS}.java \ - BiGraph.java \ - Node.java \ - Barrier.java -SRC1=${MAINCLASS}Nold.java \ - BiGraphNold.java \ - Node.java \ - Barrier.java -SRC3=${MAINCLASS}2.java \ - ${MAINCLASS}Wrap.java \ - BiGraph2.java \ - Node2.java \ - EVector.java - -FLAGS=-dsm -prefetch -optimize -excprefetch Em3d.main -excprefetch BiGraph.create -excprefetch Node.Node -excprefetch Node.fillTable -excprefetch Node.makeUniqueNeighbors -excprefetch Node.makeFromNodes -excprefetch Node.updateFromNodes -debug -mainclass ${MAINCLASS} -trueprob 0.91 -FLAGS1=-dsm -prefetch -optimize -excprefetch Node.makeUniqueNeighbors -excprefetch EVector.ensureCapacity -excprefetch EVector.addElement -excprefetch BiGraph.makeFromNodes -excprefetch EVector.elementAt -excprefetch BiGraph.initializeNodes -excprefetch BiGraph.allocateNodes -mainclass ${MAINCLASS} -trueprob 0.91 -FLAGS2=-dsm -optimize -mainclass ${MAINCLASS} - -default: -# ../../../../buildscript ${FLAGS2} -o ${MAINCLASS}NP ${SRC} -# ../../../../buildscript ${FLAGS} -o ${MAINCLASS} ${SRC} - ../../../../buildscript ${FLAGS2} -o ${MAINCLASS}NNP ${SRC3} - ../../../../buildscript ${FLAGS1} -o ${MAINCLASS}N ${SRC3} - cp ${MAINCLASS}NNP.bin ${MAINCLASS}1NP.bin - cp ${MAINCLASS}N.bin ${MAINCLASS}1.bin - cp ${MAINCLASS}NNP.bin ${MAINCLASS}2NP.bin - cp ${MAINCLASS}N.bin ${MAINCLASS}2.bin - cp ${MAINCLASS}NNP.bin ${MAINCLASS}3NP.bin - cp ${MAINCLASS}N.bin ${MAINCLASS}3.bin - cp ${MAINCLASS}NNP.bin ${MAINCLASS}4NP.bin - cp ${MAINCLASS}N.bin ${MAINCLASS}4.bin - -clean: - rm -rf tmpbuilddirectory - rm *.bin diff --git a/Robust/src/Benchmarks/Prefetch/Em3d/java/Barrier.java b/Robust/src/Benchmarks/Prefetch/Em3d/java/Barrier.java deleted file mode 100644 index 590b3a66..00000000 --- a/Robust/src/Benchmarks/Prefetch/Em3d/java/Barrier.java +++ /dev/null @@ -1,48 +0,0 @@ -public class Barrier { - int numthreads; - int entercount; - boolean cleared; - - public Barrier(int n) { - numthreads=n; - cleared = false; - } - - public Barrier() { - - } - - public void reset() { - cleared = false; - entercount = 0; - } - - public static void enterBarrier(Barrier b) { - int tmp; - boolean retry=true; - - do { - if (!b.cleared) { - b.entercount++; - tmp = b.entercount; - if (tmp==b.numthreads) { - if(b.numthreads > 1) - b.cleared=true; - b.entercount--; - return; - } - retry=false; - } - } while(retry); - - while(true) { - if (b.cleared) { - b.entercount--; - int count = b.entercount; - if (count==0) - b.cleared=false; - return; - } - } - } -} diff --git a/Robust/src/Benchmarks/Prefetch/Em3d/java/BiGraph.java b/Robust/src/Benchmarks/Prefetch/Em3d/java/BiGraph.java deleted file mode 100644 index 20ba94a3..00000000 --- a/Robust/src/Benchmarks/Prefetch/Em3d/java/BiGraph.java +++ /dev/null @@ -1,130 +0,0 @@ -import java.util.Random; -/** - * A class that represents the irregular bipartite graph used in - * EM3D. The graph contains two linked structures that represent the - * E nodes and the N nodes in the application. - **/ -public class BiGraph -{ - public BiGraph() { - } - /** - * Nodes that represent the electrical field. - **/ - Node eNodes; - /** - * Nodes that representhe the magnetic field. - **/ - Node hNodes; - - /** - * Construct the bipartite graph. - * @param e the nodes representing the electric fields - * @param h the nodes representing the magnetic fields - **/ - BiGraph(Node e, Node h) - { - eNodes = e; - hNodes = h; - } - - /** - * Create the bi graph that contains the linked list of - * e and h nodes. - * @param numNodes the number of nodes to create - * @param numDegree the out-degree of each node - * @param verbose should we print out runtime messages - * @return the bi graph that we've created. - **/ - - BiGraph create(int numNodes, int numDegree, boolean verbose, Random r) - { - // making nodes (we create a table) - if (verbose) System.out.println("making nodes (tables in orig. version)"); - Node[] hTable = Node.fillTable(numNodes, numDegree, r); - Node[] eTable = Node.fillTable(numNodes, numDegree, r); - - // making neighbors - if (verbose) System.out.println("updating from and coeffs"); - for(int i = 0; i< numNodes; i++) { - Node n = hTable[i]; - n.makeUniqueNeighbors(eTable, r); - } - - for (int i = 0; i < numNodes; i++) { - Node n = eTable[i]; - n.makeUniqueNeighbors(hTable, r); - } - - // Create the fromNodes and coeff field - if (verbose) System.out.println("filling from fields"); - for(int i = 0; i< numNodes; i++) { - Node n = hTable[i]; - n.makeFromNodes(); - } - - for (int i = 0; i < numNodes; i++) { - Node n = eTable[i]; - n.makeFromNodes(); - } - - // Update the fromNodes - for (int i = 0; i < numNodes; i++) { - Node n = hTable[i]; - n.updateFromNodes(r); - } - for (int i = 0; i < numNodes; i++) { - Node n = eTable[i]; - n.updateFromNodes(r); - } - - BiGraph g = new BiGraph(eTable[0], hTable[0]); - return g; - } - - /** - * Update the field values of e-nodes based on the values of - * neighboring h-nodes and vice-versa. - **/ - /* - void compute() - { - Node tmp = eNodes; - while(tmp!= null) { - Node n = tmp; - n.computeNewValue(); - tmp = tmp.next; - } - tmp = hNodes; - while(tmp!=null) { - Node n = tmp; - n.computeNewValue(); - tmp = tmp.next; - } - } - */ - - /** - * Override the toString method to print out the values of the e and h nodes. - * @return a string contain the values of the e and h nodes. - **/ - public String toString() - { - StringBuffer retval = new StringBuffer(); - Node tmp = eNodes; - while(tmp!=null) { - Node n = tmp; - retval.append("E: " + n + "\n"); - tmp = tmp.next; - } - tmp = hNodes; - while(tmp!=null) { - Node n = tmp; - retval.append("H: " + n + "\n"); - tmp = tmp.next; - } - return retval.toString(); - } - -} - diff --git a/Robust/src/Benchmarks/Prefetch/Em3d/java/Em3d.java b/Robust/src/Benchmarks/Prefetch/Em3d/java/Em3d.java deleted file mode 100644 index 8021a830..00000000 --- a/Robust/src/Benchmarks/Prefetch/Em3d/java/Em3d.java +++ /dev/null @@ -1,207 +0,0 @@ -import java.io.*; -import java.util.Random; - -/** - * - * - * Java implementation of the em3d Olden benchmark. This Olden - * benchmark models the propagation of electromagnetic waves through - * objects in 3 dimensions. It is a simple computation on an irregular - * bipartite graph containing nodes representing electric and magnetic - * field values. - * - *

    - * D. Culler, A. Dusseau, S. Goldstein, A. Krishnamurthy, S. Lumetta, T. von - * Eicken and K. Yelick. "Parallel Programming in Split-C". Supercomputing - * 1993, pages 262-273. - * - **/ -public class Em3d extends Thread -{ - - BiGraph bg; - int upperlimit; - int lowerlimit; - Random rand; - Barrier mybarr; - - public Em3d() { - numNodes = 0; - numDegree = 0; - numIter = 1; - printResult = false; - printMsgs = false; - } - - public Em3d(BiGraph bg, int lowerlimit, int upperlimit, int numIter, Barrier mybarr) { - this.bg = bg; - this.lowerlimit = lowerlimit; - this.upperlimit = upperlimit; - this.numIter = numIter; - this.mybarr = mybarr; - } - - public void run() { - for (int i = 0; i < numIter; i++) { - /* for eNodes */ - Node prev = bg.eNodes; - Node curr = null; - for(int j = 0; j -d [-p] [-m] [-h]"); - System.out.println(" -n the number of nodes"); - System.out.println(" -d the out-degree of each node"); - System.out.println(" -i the number of iterations"); - System.out.println(" -p (print detailed results)"); - System.out.println(" -m (print informative messages)"); - System.out.println(" -h (this message)"); - } - -} diff --git a/Robust/src/Benchmarks/Prefetch/Em3d/java/Node.java b/Robust/src/Benchmarks/Prefetch/Em3d/java/Node.java deleted file mode 100644 index abf7e5e1..00000000 --- a/Robust/src/Benchmarks/Prefetch/Em3d/java/Node.java +++ /dev/null @@ -1,210 +0,0 @@ -import java.util.Random; -/** - * This class implements nodes (both E- and H-nodes) of the EM graph. Sets - * up random neighbors and propagates field values among neighbors. - */ -public class Node { - /** - * The value of the node. - **/ - double value; - /** - * The next node in the list. - **/ - protected Node next; - /** - * Array of nodes to which we send our value. - **/ - Node[] toNodes; - /** - * Array of nodes from which we receive values. - **/ - Node[] fromNodes; - /** - * Coefficients on the fromNodes edges - **/ - double[] coeffs; - /** - * The number of fromNodes edges - **/ - int fromCount; - /** - * Used to create the fromEdges - keeps track of the number of edges that have - * been added - **/ - int fromLength; - - public Node() { - - } - - /** - * Constructor for a node with given `degree'. The value of the - * node is initialized to a random value. - **/ - public Node(int degree, Random r) - { - value = r.nextDouble(); - // create empty array for holding toNodes - toNodes = new Node[degree]; - - next = null; - for (int i = 0; i 1) - b.cleared=true; - b.entercount--; - ret1 = true; - } - retry=false; - } - } - } while(retry); - if (ret1) return; - while(ret2) { - atomic { - if (b.cleared) { - b.entercount--; - int count = b.entercount; - if (count==0) - b.cleared=false; - ret2=false; - } - } - } - } -} diff --git a/Robust/src/Benchmarks/Prefetch/LUFact/dsm/JGFInstrumentor.java b/Robust/src/Benchmarks/Prefetch/LUFact/dsm/JGFInstrumentor.java deleted file mode 100644 index 5e89ddb9..00000000 --- a/Robust/src/Benchmarks/Prefetch/LUFact/dsm/JGFInstrumentor.java +++ /dev/null @@ -1,199 +0,0 @@ -/************************************************************************** - * * - * Java Grande Forum Benchmark Suite - Thread Version 1.0 * - * * - * produced by * - * * - * Java Grande Benchmarking Project * - * * - * at * - * * - * Edinburgh Parallel Computing Centre * - * * - * email: epcc-javagrande@epcc.ed.ac.uk * - * * - * * - * This version copyright (c) The University of Edinburgh, 1999. * - * All rights reserved. * - * * - **************************************************************************/ -public class JGFInstrumentor{ - - protected HashMap timers; - protected HashMap data; - - public JGFInstrumentor() { - timers = new HashMap(); - data = new HashMap(); - } - - public static void addTimer (String name, HashMap timers){ - - if (timers.containsKey(name)) { - System.printString("JGFInstrumentor.addTimer: warning - timer " + name + - " already exists\n"); - } - else { - timers.put(name, new JGFTimer(name)); - } - } - - public static void addTimer (String name, String opname, HashMap timers){ - - if (timers.containsKey(name)) { - System.printString("JGFInstrumentor.addTimer: warning - timer " + name + - " already exists\n"); - } - else { - timers.put(name, new JGFTimer(name,opname)); - } - - } - - public static void addTimer (String name, String opname, int size, HashMap timers){ - - if (timers.containsKey(name)) { - System.printString("JGFInstrumentor.addTimer: warning - timer " + name + - " already exists\n"); - } - else { - timers.put(name, new JGFTimer(name,opname,size)); - } - - } - - public static void startTimer(String name, HashMap timers){ - if (timers.containsKey(name)) { - ((JGFTimer) timers.get(name)).start(); - } - else { - System.printString("JGFInstrumentor.startTimer: failed - timer " + name + - " does not exist\n"); - } - - } - - public static void stopTimer(String name, HashMap timers){ - if (timers.containsKey(name)) { - ((JGFTimer) timers.get(name)).stop(); - } - else { - System.printString("JGFInstrumentor.stopTimer: failed - timer " + name + - " does not exist\n"); - } - } - - public static void addOpsToTimer(String name, double count, HashMap timers){ - if (timers.containsKey(name)) { - ((JGFTimer) timers.get(name)).addops(count); - } - else { - System.printString("JGFInstrumentor.addOpsToTimer: failed - timer " + name + - " does not exist\n"); - } - } - - public static void addTimeToTimer(String name, double added_time, HashMap timers){ - if (timers.containsKey(name)) { - ((JGFTimer) timers.get(name)).addtime(added_time); - } - else { - System.printString("JGFInstrumentor.addTimeToTimer: failed - timer " + name + - " does not exist\n"); - } - - - - } - - public static double readTimer(String name, HashMap timers){ - double time; - if (timers.containsKey(name)) { - time = ((JGFTimer) timers.get(name)).time; - } - else { - System.printString("JGFInstrumentor.readTimer: failed - timer " + name + - " does not exist\n"); - time = 0.0; - } - return time; - } - - public static void resetTimer(String name, HashMap timers){ - if (timers.containsKey(name)) { - ((JGFTimer) timers.get(name)).reset(); - } - else { - System.printString("JGFInstrumentor.resetTimer: failed - timer " + name + - " does not exist\n"); - } - } - - public static void printTimer(String name, HashMap timers){ - if (timers.containsKey(name)) { - ((JGFTimer) timers.get(name)).print(); - } - else { - System.printString("JGFInstrumentor.printTimer: failed - timer " + name + - " does not exist\n"); - } - } - - public static void printperfTimer(String name, HashMap timers){ - if (timers.containsKey(name)) { - ((JGFTimer) timers.get(name)).printperf(); - } - else { - System.printString("JGFInstrumentor.printTimer: failed - timer " + name + - " does not exist\n"); - } - } - - public static void storeData(String name, Object obj, HashMap data){ - data.put(name,obj); - } - - public static void retrieveData(String name, Object obj, HashMap data){ - obj = data.get(name); - } - - public static void printHeader(int section, int size,int nthreads) { - - String header, base; - - header = ""; - base = "Java Grande Forum Thread Benchmark Suite - Version 1.0 - Section "; - - if (section == 1) - { - header = base + "1"; - } - else if (section == 2) - { - if (size == 0) - header = base + "2 - Size A"; - else if (size == 1) - header = base + "2 - Size B"; - else if (size == 2) - header = base + "2 - Size C"; - } - else if (section == 3) - { - if (size == 0) - header = base + "3 - Size A"; - else if (size == 1) - header = base + "3 - Size B"; - } - - System.printString(header+"\n"); - - if (nthreads == 1) { - System.printString("Executing on " + nthreads + " thread\n"); - } - else { - System.printString("Executing on " + nthreads + " threads\n"); - } - - System.printString("\n"); - } -} diff --git a/Robust/src/Benchmarks/Prefetch/LUFact/dsm/JGFLUFactBench.java b/Robust/src/Benchmarks/Prefetch/LUFact/dsm/JGFLUFactBench.java deleted file mode 100644 index 328c7a5d..00000000 --- a/Robust/src/Benchmarks/Prefetch/LUFact/dsm/JGFLUFactBench.java +++ /dev/null @@ -1,416 +0,0 @@ -/************************************************************************** - * * - * Java Grande Forum Benchmark Suite - Thread Version 1.0 * - * * - * produced by * - * * - * Java Grande Benchmarking Project * - * * - * at * - * * - * Edinburgh Parallel Computing Centre * - * * - * email: epcc-javagrande@epcc.ed.ac.uk * - * * - * * - * This version copyright (c) The University of Edinburgh, 2001. * - * All rights reserved. * - * * - **************************************************************************/ -public class JGFLUFactBench { - public int nthreads; - private int size; - private int[] datasizes; - public int cachelinesize; - double a[][]; - double b[]; - double x[]; - double ops,total,norma,normx; - double resid,time; - double kf; - int n,i,ntimes,info,lda,ldaa,kflops; - int ipvt[]; - - public JGFLUFactBench(int nthreads) { - this.nthreads=nthreads; - datasizes = global new int[3]; - datasizes[0] = 500; - datasizes[1] = 1000; - datasizes[2] = 2000; - cachelinesize = 128; - } - - public void JGFsetsize(int size) { - this.size = size; - } - - public void JGFinitialise() { - n = datasizes[size]; - ldaa = n; - lda = ldaa + 1; - - a = global new double[ldaa][lda]; - b = global new double [ldaa]; - x = global new double [ldaa]; - ipvt = global new int [ldaa]; - - long nl = (long) n; //avoid integer overflow - ops = (2.0*(nl*nl*nl))/3.0 + 2.0*(nl*nl); - norma = matgen(a,lda,n,b); - } - - public static void JGFkernel(JGFLUFactBench lub) { - int numthreads; - atomic { - numthreads = lub.nthreads; - } - - /* spawn threads */ - LinpackRunner[] thobjects; - Barrier br; - atomic { - thobjects = global new LinpackRunner[numthreads]; - br = global new Barrier(numthreads); - } - - //JGFInstrumentor.startTimer("Section2:LUFact:Kernel", instr.timers); - LinpackRunner tmp; - int[] mid = new int[4]; - mid[0] = (128<<24)|(195<<16)|(175<<8)|73; - mid[1] = (128<<24)|(195<<16)|(175<<8)|69; - mid[2] = (128<<24)|(195<<16)|(175<<8)|78; - mid[3] = (128<<24)|(195<<16)|(175<<8)|79; - for(int i=1;i abs(b[i])) ? resid : abs(b[i]); - //normx = (normx > abs(x[i])) ? normx : abs(x[i]); - if (resid <= abs(b[i])) resid = abs(b[i]); - if (normx <= abs(x[i])) normx = abs(x[i]); - } - eps = epslon((double)1.0); - residn = resid/( n*norma*normx*eps ); - - /*******************Compare longs ***********/ - long lresidn, lref; - lresidn = (long) residn * 1000000; - lref = (long) ref[size] * 1000000; - - if (lresidn > lref) { - //System.printString("Validation failed"); - //System.printString("Computed Norm Res = " + (long) residn * 1000000); - //System.printString("Reference Norm Res = " + (long) ref[size] * 1000000); - return 1; - } else { - return 0; - } - } - - double abs (double d) { - if (d >= 0) return d; - else return -d; - } - - double matgen (double a[][], int lda, int n, double b[]) - { - double norma; - int init, i, j; - - init = 1325; - norma = 0.0; - /* Next two for() statements switched. Solver wants - matrix in column order. --dmd 3/3/97 - */ - for (i = 0; i < n; i++) { - for (j = 0; j < n; j++) { - init = 3125*init % 65536; - a[j][i] = (init - 32768.0)/16384.0; - if (a[j][i] > norma) { - norma = a[j][i]; - } - } - } - for (i = 0; i < n; i++) { - b[i] = 0.0; - } - for (j = 0; j < n; j++) { - for (i = 0; i < n; i++) { - b[i] += a[j][i]; - } - } - return norma; - } - - void dgesl( double a[][], int lda, int n, int ipvt[], double b[], int job) - { - double t; - int k,kb,l,nm1,kp1; - - nm1 = n - 1; - if (job == 0) { - // job = 0 , solve a * x = b. first solve l*y = b - if (nm1 >= 1) { - for (k = 0; k < nm1; k++) { - l = ipvt[k]; - t = b[l]; - if (l != k){ - b[l] = b[k]; - b[k] = t; - } - kp1 = k + 1; - daxpy(n-(kp1),t,a[k],kp1,1,b,kp1,1); - } - } - // now solve u*x = y - for (kb = 0; kb < n; kb++) { - k = n - (kb + 1); - b[k] /= a[k][k]; - t = -b[k]; - daxpy(k,t,a[k],0,1,b,0,1); - } - } else { - // job = nonzero, solve trans(a) * x = b. first solve trans(u)*y = b - for (k = 0; k < n; k++) { - t = ddot(k,a[k],0,1,b,0,1); - b[k] = (b[k] - t)/a[k][k]; - } - // now solve trans(l)*x = y - if (nm1 >= 1) { - for (kb = 1; kb < nm1; kb++) { - k = n - (kb+1); - kp1 = k + 1; - b[k] += ddot(n-(kp1),a[k],kp1,1,b,kp1,1); - l = ipvt[k]; - if (l != k) { - t = b[l]; - b[l] = b[k]; - b[k] = t; - } - } - } - } - } - - /* - constant times a vector plus a vector. - jack dongarra, linpack, 3/11/78. - */ - void daxpy( int n, double da, double dx[], int dx_off, int incx, - double dy[], int dy_off, int incy) - { - int i,ix,iy; - - if ((n > 0) && (da != 0)) { - if (incx != 1 || incy != 1) { - // code for unequal increments or equal increments not equal to 1 - ix = 0; - iy = 0; - if (incx < 0) ix = (-n+1)*incx; - if (incy < 0) iy = (-n+1)*incy; - for (i = 0;i < n; i++) { - dy[iy +dy_off] += da*dx[ix +dx_off]; - ix += incx; - iy += incy; - } - return; - } else { - // code for both increments equal to 1 - for (i=0; i < n; i++) - dy[i +dy_off] += da*dx[i +dx_off]; - } - } - } - - /* - forms the dot product of two vectors. - jack dongarra, linpack, 3/11/78. - */ - double ddot( int n, double dx[], int dx_off, int incx, double dy[], - int dy_off, int incy) - { - double dtemp; - int i,ix,iy; - dtemp = 0; - if (n > 0) { - if (incx != 1 || incy != 1) { - // code for unequal increments or equal increments not equal to 1 - ix = 0; - iy = 0; - if (incx < 0) ix = (-n+1)*incx; - if (incy < 0) iy = (-n+1)*incy; - for (i = 0;i < n; i++) { - dtemp += dx[ix +dx_off]*dy[iy +dy_off]; - ix += incx; - iy += incy; - } - } else { - // code for both increments equal to 1 - for (i=0;i < n; i++) - dtemp += dx[i +dx_off]*dy[i +dy_off]; - } - } - return(dtemp); - } - - /* - scales a vector by a constant. - jack dongarra, linpack, 3/11/78. - */ - void dscal( int n, double da, double dx[], int dx_off, int incx) - { - int i,nincx; - if (n > 0) { - if (incx != 1) { - // code for increment not equal to 1 - nincx = n*incx; - for (i = 0; i < nincx; i += incx) - dx[i +dx_off] *= da; - } else { - // code for increment equal to 1 - for (i = 0; i < n; i++) - dx[i +dx_off] *= da; - } - } - } - - /* - finds the index of element having max. absolute value. - jack dongarra, linpack, 3/11/78. - */ - int idamax( int n, double dx[], int dx_off, int incx) - { - double dmax, dtemp; - int i, ix, itemp=0; - - if (n < 1) { - itemp = -1; - } else if (n ==1) { - itemp = 0; - } else if (incx != 1) { - // code for increment not equal to 1 - dmax = abs(dx[0 +dx_off]); - ix = 1 + incx; - for (i = 1; i < n; i++) { - dtemp = abs(dx[ix + dx_off]); - if (dtemp > dmax) { - itemp = i; - dmax = dtemp; - } - ix += incx; - } - } else { - // code for increment equal to 1 - itemp = 0; - dmax = abs(dx[0 +dx_off]); - for (i = 1; i < n; i++) { - dtemp = abs(dx[i + dx_off]); - if (dtemp > dmax) { - itemp = i; - dmax = dtemp; - } - } - } - return (itemp); - } - - /* - estimate unit roundoff in quantities of size x. - this program should function properly on all systems - satisfying the following two assumptions, - 1. the base used in representing dfloating point - numbers is not a power of three. - 2. the quantity a in statement 10 is represented to - the accuracy used in dfloating point variables - that are stored in memory. - the statement number 10 and the go to 10 are intended to - force optimizing compilers to generate code satisfying - assumption 2. - under these assumptions, it should be true that, - a is not exactly equal to four-thirds, - b has a zero for its last bit or digit, - c is not exactly equal to one, - eps measures the separation of 1.0 from - the next larger dfloating point number. - the developers of eispack would appreciate being informed - about any systems where these assumptions do not hold. - - ***************************************************************** - this routine is one of the auxiliary routines used by eispack iii - to avoid machine dependencies. - ***************************************************************** - - this version dated 4/6/83. - */ - double epslon (double x) - { - double a,b,c,eps; - - a = 4.0e0/3.0e0; - eps = 0; - while (eps == 0) { - b = a - 1.0; - c = b + b + b; - eps = abs(c-1.0); - } - return(eps*abs(x)); - } - - void dmxpy ( int n1, double y[], int n2, int ldm, double x[], double m[][]) - { - int j,i; - // cleanup odd vector - for (j = 0; j < n2; j++) { - for (i = 0; i < n1; i++) { - y[i] += x[j]*m[j][i]; - } - } - } -} diff --git a/Robust/src/Benchmarks/Prefetch/LUFact/dsm/JGFLUFactBenchSizeA.java b/Robust/src/Benchmarks/Prefetch/LUFact/dsm/JGFLUFactBenchSizeA.java deleted file mode 100644 index be556243..00000000 --- a/Robust/src/Benchmarks/Prefetch/LUFact/dsm/JGFLUFactBenchSizeA.java +++ /dev/null @@ -1,62 +0,0 @@ -/************************************************************************** - * * - * Java Grande Forum Benchmark Suite - Thread Version 1.0 * - * * - * produced by * - * * - * Java Grande Benchmarking Project * - * * - * at * - * * - * Edinburgh Parallel Computing Centre * - * * - * email: epcc-javagrande@epcc.ed.ac.uk * - * * - * * - * This version copyright (c) The University of Edinburgh, 2001. * - * All rights reserved. * - * * - **************************************************************************/ -public class JGFLUFactBenchSizeA { - - public static void main(String argv[]){ - int nthreads; - if(argv.length != 0 ) { - nthreads = Integer.parseInt(argv[0]); - } else { - System.printString("The no of threads has not been specified, defaulting to 1\n"); - System.printString(" \n"); - nthreads = 1; - } - - JGFInstrumentor instr = new JGFInstrumentor(); - JGFInstrumentor.printHeader(2,0,nthreads); - JGFLUFactBench lub; - atomic { - lub = global new JGFLUFactBench(nthreads); - } - - int size = 0; - JGFInstrumentor.addTimer("Section2:LUFact:Kernel", "Mflops", size, instr.timers); - atomic { - lub.JGFsetsize(size); - lub.JGFinitialise(); - } - JGFLUFactBench.JGFkernel(lub); - int retval; - atomic { - retval = lub.JGFvalidate(); - } - if(retval == 1) { - System.printString("Validation failed\n"); - } - - double ops; - atomic { - ops = lub.ops; - } - JGFInstrumentor.addOpsToTimer("Section2:LUFact:Kernel", ((long)ops)/1.0e06, instr.timers); - JGFInstrumentor.printTimer("Section2:LUFact:Kernel", instr.timers); - } -} - diff --git a/Robust/src/Benchmarks/Prefetch/LUFact/dsm/JGFTimer.java b/Robust/src/Benchmarks/Prefetch/LUFact/dsm/JGFTimer.java deleted file mode 100644 index 4e1d168f..00000000 --- a/Robust/src/Benchmarks/Prefetch/LUFact/dsm/JGFTimer.java +++ /dev/null @@ -1,123 +0,0 @@ -/************************************************************************** - * * - * Java Grande Forum Benchmark Suite - Thread Version 1.0 * - * * - * produced by * - * * - * Java Grande Benchmarking Project * - * * - * at * - * * - * Edinburgh Parallel Computing Centre * - * * - * email: epcc-javagrande@epcc.ed.ac.uk * - * * - * * - * This version copyright (c) The University of Edinburgh, 1999. * - * All rights reserved. * - * * - **************************************************************************/ - -public class JGFTimer { - - public String name; - public String opname; - public double time; - public double opcount; - public long calls; - public int size; - - private long start_time; - private boolean on; - - public JGFTimer(String name, String opname){ - this.size = -1; - this.name = name; - this.opname = opname; - reset(); - } - - public JGFTimer(String name, String opname, int size){ - this.name = name; - this.opname = opname; - this.size = size; - reset(); - } - - public JGFTimer(String name){ - this.name = name; - this.opname = ""; - reset(); - } - - - - public void start(){ - if (on) System.printString("Warning timer " + " was already turned on\n"); - on = true; - start_time = System.currentTimeMillis(); - } - - - public void stop(){ - time += (double) (System.currentTimeMillis()-start_time) / 1000.; - if (!on) System.printString("Warning timer " + " wasn't turned on\n"); - calls++; - on = false; - } - - public void addops(double count){ - opcount += count; - } - - public void addtime(double added_time){ - time += added_time; - } - - public void reset(){ - time = 0.0; - calls = 0; - opcount = 0; - on = false; - } - - public double perf(){ - return opcount / time; - } - - public void longprint(){ - System.printString("Timer Calls Time(s) Performance("+opname+"/s)\n"); - System.printString(name + " " + calls + " " + (long)time + " " + (long)this.perf() + "\n"); - } - - public void print(){ - if (opname.equals("")) { - System.printString(name + " " + (long)time + " (s)\n"); - } - else { - if(size == 0) { - System.printString(name + ":SizeA" + "\t" + (long)time + " (s) \t " + (long)this.perf() + "\t" + " ("+opname+"/s)\n"); - } else if (size == 1) { - System.printString(name + ":SizeB" + "\t" + (long)time + " (s) \t " + (long)this.perf() + "\t" + " ("+opname+"/s)\n"); - } else if (size == 2) { - System.printString(name + ":SizeC" + "\t" + (long)time + " (s) \t " + (long)this.perf() + "\t" + " ("+opname+"/s)\n"); - } else{ - System.printString(name + "\t" + (long)time + " (s) \t " + (long)this.perf() + "\t" + " ("+opname+"/s)\n"); - } - } - } - - - public void printperf(){ - - String name; - name = this.name; - - // pad name to 40 characters - while ( name.length() < 40 ) name = name + " "; - - System.printString(name + "\t" + (long)this.perf() + "\t" - + " ("+opname+"/s)\n"); - } - -} diff --git a/Robust/src/Benchmarks/Prefetch/LUFact/dsm/Linpack.java b/Robust/src/Benchmarks/Prefetch/LUFact/dsm/Linpack.java deleted file mode 100644 index 1c21cb08..00000000 --- a/Robust/src/Benchmarks/Prefetch/LUFact/dsm/Linpack.java +++ /dev/null @@ -1,327 +0,0 @@ -/************************************************************************** - * * - * Java Grande Forum Benchmark Suite - Thread Version 1.0 * - * * - * produced by * - * * - * Java Grande Benchmarking Project * - * * - * at * - * * - * Edinburgh Parallel Computing Centre * - * * - * email: epcc-javagrande@epcc.ed.ac.uk * - * * - * See below for the previous history of this code * - * * - * This version copyright (c) The University of Edinburgh, 2001. * - * All rights reserved. * - * * - **************************************************************************/ - -/* - - Modified 3/3/97 by David M. Doolin (dmd) doolin@cs.utk.edu - Fixed error in matgen() method. Added some comments. - - Modified 1/22/97 by Paul McMahan mcmahan@cs.utk.edu - Added more MacOS options to form. - - Optimized by Jonathan Hardwick (jch@cs.cmu.edu), 3/28/96 - Compare to Linkpack.java. - Optimizations performed: - - added "final" modifier to performance-critical methods. - - changed lines of the form "a[i] = a[i] + x" to "a[i] += x". - - minimized array references using common subexpression elimination. - - eliminated unused variables. - - undid an unrolled loop. - - added temporary 1D arrays to hold frequently-used columns of 2D arrays. - - wrote my own abs() method - See http://www.cs.cmu.edu/~jch/java/linpack.html for more details. - - - Ported to Java by Reed Wade (wade@cs.utk.edu) 2/96 - built using JDK 1.0 on solaris - using "javac -O Linpack.java" - - - Translated to C by Bonnie Toy 5/88 - (modified on 2/25/94 to fix a problem with daxpy for - unequal increments or equal increments not equal to 1. - Jack Dongarra) - -*/ - -public class Linpack { - double a[][]; - double b[]; - double x[]; - double ops,total,norma,normx; - double resid,time; - double kf; - int n,i,ntimes,info,lda,ldaa,kflops; - int ipvt[]; - - double abs (double d) { - if (d >= 0) return d; - else return -d; - //return (d >= 0) ? d : -d; - } - - double matgen (double a[][], int lda, int n, double b[]) - { - double norma; - int init, i, j; - - init = 1325; - norma = 0.0; - /* Next two for() statements switched. Solver wants - matrix in column order. --dmd 3/3/97 - */ - for (i = 0; i < n; i++) { - for (j = 0; j < n; j++) { - init = 3125*init % 65536; - a[j][i] = (init - 32768.0)/16384.0; - //norma = (a[j][i] > norma) ? a[j][i] : norma; - if (a[j][i] > norma) { - norma = a[j][i]; - } - } - } - for (i = 0; i < n; i++) { - b[i] = 0.0; - } - for (j = 0; j < n; j++) { - for (i = 0; i < n; i++) { - b[i] += a[j][i]; - } - } - return norma; - } - - void dgesl( double a[][], int lda, int n, int ipvt[], double b[], int job) - { - double t; - int k,kb,l,nm1,kp1; - - nm1 = n - 1; - if (job == 0) { - // job = 0 , solve a * x = b. first solve l*y = b - if (nm1 >= 1) { - for (k = 0; k < nm1; k++) { - l = ipvt[k]; - t = b[l]; - if (l != k){ - b[l] = b[k]; - b[k] = t; - } - kp1 = k + 1; - daxpy(n-(kp1),t,a[k],kp1,1,b,kp1,1); - } - } - // now solve u*x = y - for (kb = 0; kb < n; kb++) { - k = n - (kb + 1); - b[k] /= a[k][k]; - t = -b[k]; - daxpy(k,t,a[k],0,1,b,0,1); - } - } else { - // job = nonzero, solve trans(a) * x = b. first solve trans(u)*y = b - for (k = 0; k < n; k++) { - t = ddot(k,a[k],0,1,b,0,1); - b[k] = (b[k] - t)/a[k][k]; - } - // now solve trans(l)*x = y - if (nm1 >= 1) { - for (kb = 1; kb < nm1; kb++) { - k = n - (kb+1); - kp1 = k + 1; - b[k] += ddot(n-(kp1),a[k],kp1,1,b,kp1,1); - l = ipvt[k]; - if (l != k) { - t = b[l]; - b[l] = b[k]; - b[k] = t; - } - } - } - } - } - - /* - constant times a vector plus a vector. - jack dongarra, linpack, 3/11/78. - */ - void daxpy( int n, double da, double dx[], int dx_off, int incx, - double dy[], int dy_off, int incy) - { - int i,ix,iy; - - if ((n > 0) && (da != 0)) { - if (incx != 1 || incy != 1) { - // code for unequal increments or equal increments not equal to 1 - ix = 0; - iy = 0; - if (incx < 0) ix = (-n+1)*incx; - if (incy < 0) iy = (-n+1)*incy; - for (i = 0;i < n; i++) { - dy[iy +dy_off] += da*dx[ix +dx_off]; - ix += incx; - iy += incy; - } - return; - } else { - // code for both increments equal to 1 - for (i=0; i < n; i++) - dy[i +dy_off] += da*dx[i +dx_off]; - } - } - } - - /* - forms the dot product of two vectors. - jack dongarra, linpack, 3/11/78. - */ - double ddot( int n, double dx[], int dx_off, int incx, double dy[], - int dy_off, int incy) - { - double dtemp; - int i,ix,iy; - dtemp = 0; - if (n > 0) { - if (incx != 1 || incy != 1) { - // code for unequal increments or equal increments not equal to 1 - ix = 0; - iy = 0; - if (incx < 0) ix = (-n+1)*incx; - if (incy < 0) iy = (-n+1)*incy; - for (i = 0;i < n; i++) { - dtemp += dx[ix +dx_off]*dy[iy +dy_off]; - ix += incx; - iy += incy; - } - } else { - // code for both increments equal to 1 - for (i=0;i < n; i++) - dtemp += dx[i +dx_off]*dy[i +dy_off]; - } - } - return(dtemp); - } - - /* - scales a vector by a constant. - jack dongarra, linpack, 3/11/78. - */ - void dscal( int n, double da, double dx[], int dx_off, int incx) - { - int i,nincx; - if (n > 0) { - if (incx != 1) { - // code for increment not equal to 1 - nincx = n*incx; - for (i = 0; i < nincx; i += incx) - dx[i +dx_off] *= da; - } else { - // code for increment equal to 1 - for (i = 0; i < n; i++) - dx[i +dx_off] *= da; - } - } - } - - /* - finds the index of element having max. absolute value. - jack dongarra, linpack, 3/11/78. - */ - int idamax( int n, double dx[], int dx_off, int incx) - { - double dmax, dtemp; - int i, ix, itemp=0; - - if (n < 1) { - itemp = -1; - } else if (n ==1) { - itemp = 0; - } else if (incx != 1) { - // code for increment not equal to 1 - dmax = abs(dx[0 +dx_off]); - ix = 1 + incx; - for (i = 1; i < n; i++) { - dtemp = abs(dx[ix + dx_off]); - if (dtemp > dmax) { - itemp = i; - dmax = dtemp; - } - ix += incx; - } - } else { - // code for increment equal to 1 - itemp = 0; - dmax = abs(dx[0 +dx_off]); - for (i = 1; i < n; i++) { - dtemp = abs(dx[i + dx_off]); - if (dtemp > dmax) { - itemp = i; - dmax = dtemp; - } - } - } - return (itemp); - } - - /* - estimate unit roundoff in quantities of size x. - this program should function properly on all systems - satisfying the following two assumptions, - 1. the base used in representing dfloating point - numbers is not a power of three. - 2. the quantity a in statement 10 is represented to - the accuracy used in dfloating point variables - that are stored in memory. - the statement number 10 and the go to 10 are intended to - force optimizing compilers to generate code satisfying - assumption 2. - under these assumptions, it should be true that, - a is not exactly equal to four-thirds, - b has a zero for its last bit or digit, - c is not exactly equal to one, - eps measures the separation of 1.0 from - the next larger dfloating point number. - the developers of eispack would appreciate being informed - about any systems where these assumptions do not hold. - - ***************************************************************** - this routine is one of the auxiliary routines used by eispack iii - to avoid machine dependencies. - ***************************************************************** - - this version dated 4/6/83. - */ - double epslon (double x) - { - double a,b,c,eps; - - a = 4.0e0/3.0e0; - eps = 0; - while (eps == 0) { - b = a - 1.0; - c = b + b + b; - eps = abs(c-1.0); - } - return(eps*abs(x)); - } - - void dmxpy ( int n1, double y[], int n2, int ldm, double x[], double m[][]) - { - int j,i; - // cleanup odd vector - for (j = 0; j < n2; j++) { - for (i = 0; i < n1; i++) { - y[i] += x[j]*m[j][i]; - } - } - } -} - diff --git a/Robust/src/Benchmarks/Prefetch/LUFact/dsm/LinpackRunner.java b/Robust/src/Benchmarks/Prefetch/LUFact/dsm/LinpackRunner.java deleted file mode 100644 index 6e499d1c..00000000 --- a/Robust/src/Benchmarks/Prefetch/LUFact/dsm/LinpackRunner.java +++ /dev/null @@ -1,233 +0,0 @@ -/************************************************************************** -* * -* Java Grande Forum Benchmark Suite - Thread Version 1.0 * -* * -* produced by * -* * -* Java Grande Benchmarking Project * -* * -* at * -* * -* Edinburgh Parallel Computing Centre * -* * -* email: epcc-javagrande@epcc.ed.ac.uk * -* * -* * -* This version copyright (c) The University of Edinburgh, 2001. * -* All rights reserved. * -* * -**************************************************************************/ - -class LinpackRunner extends Thread { - int id,lda,n,info,ipvt[]; - double a[][]; - Barrier br; - int nthreads; - - public LinpackRunner(int id, double a[][], int lda, int n, int ipvt[],Barrier br, int nthreads) { - this.id = id; - this.a=a; - this.lda=lda; - this.n=n; - this.ipvt=ipvt; - this.br=br; - this.nthreads = nthreads; - } - - double abs (double d) { - if (d >= 0) return d; - else return -d; - } - - public void run() { - double[] col_k, col_j; - double t; - int j,k,kp1,l,nm1; - int info; - int slice,ilow,iupper; - // gaussian elimination with partial pivoting - info = 0; - int nlocal; - Barrier tmpbr; - int lid; - atomic { - nlocal=n; - tmpbr=br; - lid=id; - } - - nm1 = nlocal - 1; - if (nm1 >= 0) { - for (k = 0; k < nm1; k++) { - atomic { - col_k = a[k]; - kp1 = k + 1; - // find l = pivot index - l = idamax(nlocal-k,col_k,k,1) + k; - if(lid==0) { - ipvt[k] = l; - } - } - // synchronise threads - Barrier.enterBarrier(tmpbr); - System.clearPrefetchCache(); - - // zero pivot implies this column already triangularized - boolean b; - atomic { - b=col_k[l]!=0; - } - if (b) { - Barrier.enterBarrier(tmpbr); - System.clearPrefetchCache(); - // interchange if necessary - atomic { - if(lid == 0 ) { - if (l != k) { - t = col_k[l]; - col_k[l] = col_k[k]; - col_k[k] = t; - } - } - } - // synchronise threads - Barrier.enterBarrier(tmpbr); - System.clearPrefetchCache(); - // compute multipliers - atomic { - t = -1.0/col_k[k]; - if(lid == 0) { - dscal(nlocal-(kp1),t,col_k,kp1,1); - } - } - // synchronise threads - Barrier.enterBarrier(tmpbr); - System.clearPrefetchCache(); - // row elimination with column indexing - atomic { - slice = ((nlocal-kp1) + nthreads-1)/nthreads; - ilow = (lid*slice)+kp1; - iupper = ((lid+1)*slice)+kp1; - if (iupper > nlocal ) iupper=nlocal; - if (ilow > nlocal ) ilow=nlocal; - for (j = ilow; j < iupper; j++) { - col_j = a[j]; - t = col_j[l]; - if (l != k) { - col_j[l] = col_j[k]; - col_j[k] = t; - } - daxpy(nlocal-(kp1),t,col_k,kp1,1, - col_j,kp1,1); - } - } - // synchronise threads - Barrier.enterBarrier(tmpbr); - System.clearPrefetchCache(); - } else { - info = k; - } - Barrier.enterBarrier(tmpbr); - System.clearPrefetchCache(); - } - } - - atomic { - if(lid==0) { - ipvt[nlocal-1] = nlocal-1; - } - if (a[(nlocal-1)][(nlocal-1)] == 0) info = nlocal-1; - } - } - - /* - finds the index of element having max. absolute value. - jack dongarra, linpack, 3/11/78. - */ - int idamax( int n, double dx[], int dx_off, int incx) - { - double dmax, dtemp; - int i, ix, itemp=0; - - if (n < 1) { - itemp = -1; - } else if (n ==1) { - itemp = 0; - } else if (incx != 1) { - // code for increment not equal to 1 - dmax = abs(dx[0 +dx_off]); - ix = 1 + incx; - for (i = 1; i < n; i++) { - dtemp = abs(dx[ix + dx_off]); - if (dtemp > dmax) { - itemp = i; - dmax = dtemp; - } - ix += incx; - } - } else { - // code for increment equal to 1 - itemp = 0; - dmax = abs(dx[0 +dx_off]); - for (i = 1; i < n; i++) { - dtemp = abs(dx[i + dx_off]); - if (dtemp > dmax) { - itemp = i; - dmax = dtemp; - } - } - } - return (itemp); - } - - /* - scales a vector by a constant. - jack dongarra, linpack, 3/11/78. - */ - void dscal( int n, double da, double dx[], int dx_off, int incx) - { - int i,nincx; - if (n > 0) { - if (incx != 1) { - // code for increment not equal to 1 - nincx = n*incx; - for (i = 0; i < nincx; i += incx) - dx[i +dx_off] *= da; - } else { - // code for increment equal to 1 - for (i = 0; i < n; i++) - dx[i +dx_off] *= da; - } - } - } - - /* - constant times a vector plus a vector. - jack dongarra, linpack, 3/11/78. - */ - void daxpy( int n, double da, double dx[], int dx_off, int incx, - double dy[], int dy_off, int incy) - { - int i,ix,iy; - if ((n > 0) && (da != 0)) { - if (incx != 1 || incy != 1) { - // code for unequal increments or equal increments not equal to 1 - ix = 0; - iy = 0; - if (incx < 0) ix = (-n+1)*incx; - if (incy < 0) iy = (-n+1)*incy; - for (i = 0;i < n; i++) { - dy[iy +dy_off] += da*dx[ix +dx_off]; - ix += incx; - iy += incy; - } - return; - } else { - // code for both increments equal to 1 - for (i=0; i < n; i++) - dy[i +dy_off] += da*dx[i +dx_off]; - } - } - } -} - diff --git a/Robust/src/Benchmarks/Prefetch/LUFact/dsm/TournamentBarrier.java b/Robust/src/Benchmarks/Prefetch/LUFact/dsm/TournamentBarrier.java deleted file mode 100755 index 56259b45..00000000 --- a/Robust/src/Benchmarks/Prefetch/LUFact/dsm/TournamentBarrier.java +++ /dev/null @@ -1,94 +0,0 @@ -/************************************************************************** - * * - * Java Grande Forum Benchmark Suite - Thread Version 1.0 * - * * - * produced by * - * * - * Java Grande Benchmarking Project * - * * - * at * - * * - * Edinburgh Parallel Computing Centre * - * * - * email: epcc-javagrande@epcc.ed.ac.uk * - * * - * * - * This version copyright (c) The University of Edinburgh, 2001. * - * All rights reserved. * - * * - **************************************************************************/ - -// This implements a simple tournament-based barrier, using entirely its -// own synchronisation. At present Yield() is called to stop busy-waiting -// processes hogging the processor(s)! - -public class TournamentBarrier { - // Array of flags indicating whether the given process and all those - // for which it is responsible have finished. The "sense" of this - // array alternates with each barrier, to prevent having to - // reinitialise. - boolean[] IsDone; - public int maxBusyIter; - int numThreads; - - public TournamentBarrier(int n) { - numThreads = n; - maxBusyIter = 1; - // Superclass constructor should record the number of threads - // and thread manager. - //super(n); - - // Initialise the IsDone array. The choice of initial value is - // arbitrary, but must be consistent! - IsDone = global new boolean[numThreads]; - for(int i = 0; i < n; i++) { - IsDone[i] = false; - } - } - - // Uses the manager's debug function, so this can only be used after - // construction! - public void debug(String s) { - // System.err.println("Debug message"); - } - - public void setMaxBusyIter(int b) { - maxBusyIter = b; - } - - public void DoBarrier(int myid) { - int b; - // debug("Thread " + myid + " checking in"); - - int roundmask = 3; - boolean donevalue = !IsDone[myid]; - - while(((myid & roundmask) == 0) && (roundmask<(numThreads<<2))) { - int spacing = (roundmask+1) >> 2; - for(int i=1; i<=3 && myid+i*spacing < numThreads; i++) { - // debug("Thread " + myid + " waiting for thread " + (myid+i*spacing)); - b = maxBusyIter; - while(IsDone[myid+i*spacing] != donevalue) { - b--; - if(b==0) { - //Thread.yield(); - b = maxBusyIter; - } - } - } - roundmask = (roundmask << 2) + 3; - } - // debug("Thread " + myid + " reporting done"); - IsDone[myid] = donevalue; - b = maxBusyIter; - while(IsDone[0] != donevalue) { - b--; - if(b==0) { - //Thread.yield(); - b = maxBusyIter; - } - } - //debug("Thread " + myid + " checking out"); - - } -} diff --git a/Robust/src/Benchmarks/Prefetch/LUFact/dsm/makefile b/Robust/src/Benchmarks/Prefetch/LUFact/dsm/makefile deleted file mode 100644 index 3ad1cc01..00000000 --- a/Robust/src/Benchmarks/Prefetch/LUFact/dsm/makefile +++ /dev/null @@ -1,25 +0,0 @@ -MAINCLASS=JGFLUFactBenchSizeA -SRC=${MAINCLASS}.java \ -JGFLUFactBench.java \ -JGFInstrumentor.java \ -JGFTimer.java \ -Barrier.java \ -LinpackRunner.java -FLAGS=-dsm -prefetch -nooptimize -debug -profile -excprefetch JGFLUFactBench.JGFkernel -excprefetch JGFLUFactBench.dmxpy -excprefetch JGFLUFactBench.JGFvalidate -excprefetch JGFLUFactBench.JGFinitialise -excprefetch JGFLUFactBench.matgen -excprefetch JGFLUFactBench.dgesl -mainclass ${MAINCLASS} -trueprob 0.95 -FLAGS2=-dsm -nooptimize -debug -profile -mainclass ${MAINCLASS} - -default: -#../../../../buildscript ${FLAGS2} ${SRC} -# ../../../../buildscript ${FLAGS} ${SRC} - ../../../../buildscript ${FLAGS2} -o ${MAINCLASS}1NP ${SRC} - ../../../../buildscript ${FLAGS} -o ${MAINCLASS}1 ${SRC} - cp ${MAINCLASS}1NP.bin ${MAINCLASS}2NP.bin - cp ${MAINCLASS}1.bin ${MAINCLASS}2.bin - cp ${MAINCLASS}1NP.bin ${MAINCLASS}3NP.bin - cp ${MAINCLASS}1.bin ${MAINCLASS}3.bin - cp ${MAINCLASS}1NP.bin ${MAINCLASS}4NP.bin - cp ${MAINCLASS}1.bin ${MAINCLASS}4.bin - -clean: - rm -rf tmpbuilddirectory - rm *.bin diff --git a/Robust/src/Benchmarks/Prefetch/LUFact/java/JGFInstrumentor.java b/Robust/src/Benchmarks/Prefetch/LUFact/java/JGFInstrumentor.java deleted file mode 100644 index 69baf77f..00000000 --- a/Robust/src/Benchmarks/Prefetch/LUFact/java/JGFInstrumentor.java +++ /dev/null @@ -1,200 +0,0 @@ -/************************************************************************** - * * - * Java Grande Forum Benchmark Suite - Thread Version 1.0 * - * * - * produced by * - * * - * Java Grande Benchmarking Project * - * * - * at * - * * - * Edinburgh Parallel Computing Centre * - * * - * email: epcc-javagrande@epcc.ed.ac.uk * - * * - * * - * This version copyright (c) The University of Edinburgh, 1999. * - * All rights reserved. * - * * - **************************************************************************/ -import java.util.*; -public class JGFInstrumentor{ - - protected HashMap timers; - protected HashMap data; - - public JGFInstrumentor() { - timers = new HashMap(); - data = new HashMap(); - } - - public static void addTimer (String name, HashMap timers){ - - if (timers.containsKey(name)) { - System.out.println("JGFInstrumentor.addTimer: warning - timer " + name + - " already exists"); - } - else { - timers.put(name, new JGFTimer(name)); - } - } - - public static void addTimer (String name, String opname, HashMap timers){ - - if (timers.containsKey(name)) { - System.out.println("JGFInstrumentor.addTimer: warning - timer " + name + - " already exists"); - } - else { - timers.put(name, new JGFTimer(name,opname)); - } - - } - - public static void addTimer (String name, String opname, int size, HashMap timers){ - - if (timers.containsKey(name)) { - System.out.println("JGFInstrumentor.addTimer: warning - timer " + name + - " already exists"); - } - else { - timers.put(name, new JGFTimer(name,opname,size)); - } - - } - - public static void startTimer(String name, HashMap timers){ - if (timers.containsKey(name)) { - ((JGFTimer) timers.get(name)).start(); - } - else { - System.out.println("JGFInstrumentor.startTimer: failed - timer " + name + - " does not exist"); - } - - } - - public static void stopTimer(String name, HashMap timers){ - if (timers.containsKey(name)) { - ((JGFTimer) timers.get(name)).stop(); - } - else { - System.out.println("JGFInstrumentor.stopTimer: failed - timer " + name + - " does not exist"); - } - } - - public static void addOpsToTimer(String name, double count, HashMap timers){ - if (timers.containsKey(name)) { - ((JGFTimer) timers.get(name)).addops(count); - } - else { - System.out.println("JGFInstrumentor.addOpsToTimer: failed - timer " + name + - " does not exist"); - } - } - - public static void addTimeToTimer(String name, double added_time, HashMap timers){ - if (timers.containsKey(name)) { - ((JGFTimer) timers.get(name)).addtime(added_time); - } - else { - System.out.println("JGFInstrumentor.addTimeToTimer: failed - timer " + name + - " does not exist"); - } - - - - } - - public static double readTimer(String name, HashMap timers){ - double time; - if (timers.containsKey(name)) { - time = ((JGFTimer) timers.get(name)).time; - } - else { - System.out.println("JGFInstrumentor.readTimer: failed - timer " + name + - " does not exist"); - time = 0.0; - } - return time; - } - - public static void resetTimer(String name, HashMap timers){ - if (timers.containsKey(name)) { - ((JGFTimer) timers.get(name)).reset(); - } - else { - System.out.println("JGFInstrumentor.resetTimer: failed - timer " + name + - " does not exist"); - } - } - - public static void printTimer(String name, HashMap timers){ - if (timers.containsKey(name)) { - ((JGFTimer) timers.get(name)).print(); - } - else { - System.out.println("JGFInstrumentor.printTimer: failed - timer " + name + - " does not exist"); - } - } - - public static void printperfTimer(String name, HashMap timers){ - if (timers.containsKey(name)) { - ((JGFTimer) timers.get(name)).printperf(); - } - else { - System.out.println("JGFInstrumentor.printTimer: failed - timer " + name + - " does not exist"); - } - } - - public static void storeData(String name, Object obj, HashMap data){ - data.put(name,obj); - } - - public static void retrieveData(String name, Object obj, HashMap data){ - obj = data.get(name); - } - - public static void printHeader(int section, int size,int nthreads) { - - String header, base; - - header = ""; - base = "Java Grande Forum Thread Benchmark Suite - Version 1.0 - Section "; - - if (section == 1) - { - header = base + "1"; - } - else if (section == 2) - { - if (size == 0) - header = base + "2 - Size A"; - else if (size == 1) - header = base + "2 - Size B"; - else if (size == 2) - header = base + "2 - Size C"; - } - else if (section == 3) - { - if (size == 0) - header = base + "3 - Size A"; - else if (size == 1) - header = base + "3 - Size B"; - } - - System.out.println(header); - - if (nthreads == 1) { - System.out.println("Executing on " + nthreads + " thread"); - } - else { - System.out.println("Executing on " + nthreads + " threads"); - } - - System.out.println(""); - } -} diff --git a/Robust/src/Benchmarks/Prefetch/LUFact/java/JGFLUFactBench.java b/Robust/src/Benchmarks/Prefetch/LUFact/java/JGFLUFactBench.java deleted file mode 100644 index 4cc54a6c..00000000 --- a/Robust/src/Benchmarks/Prefetch/LUFact/java/JGFLUFactBench.java +++ /dev/null @@ -1,441 +0,0 @@ -/************************************************************************** - * * - * Java Grande Forum Benchmark Suite - Thread Version 1.0 * - * * - * produced by * - * * - * Java Grande Benchmarking Project * - * * - * at * - * * - * Edinburgh Parallel Computing Centre * - * * - * email: epcc-javagrande@epcc.ed.ac.uk * - * * - * * - * This version copyright (c) The University of Edinburgh, 2001. * - * All rights reserved. * - * * - **************************************************************************/ -public class JGFLUFactBench { - public int nthreads; - private int size; - private int[] datasizes; - public int cachelinesize; - public JGFInstrumentor instr; - double a[][]; - double b[]; - double x[]; - double ops,total,norma,normx; - double resid,time; - double kf; - int n,i,ntimes,info,lda,ldaa,kflops; - int ipvt[]; - - public JGFLUFactBench(int nthreads, JGFInstrumentor instr) { - this.nthreads=nthreads; - this.instr = instr; - datasizes = new int[3]; - datasizes[0] = 500; - datasizes[1] = 1000; - datasizes[2] = 2000; - cachelinesize = 128; - } - - public void JGFsetsize(int size) { - this.size = size; - } - - public void JGFinitialise() { - n = datasizes[size]; - ldaa = n; - lda = ldaa + 1; - - a = new double[ldaa][lda]; - b = new double [ldaa]; - x = new double [ldaa]; - ipvt = new int [ldaa]; - - long nl = (long) n; //avoid integer overflow - ops = (2.0*(nl*nl*nl))/3.0 + 2.0*(nl*nl); - norma = matgen(a,lda,n,b); - } - - public static void JGFkernel(JGFLUFactBench lub, JGFInstrumentor instr) { - int numthreads; - numthreads = lub.nthreads; - - /* spawn threads */ - LinpackRunner[] thobjects; - TournamentBarrier br; - thobjects = new LinpackRunner[numthreads]; - br = new TournamentBarrier(numthreads); - - instr.startTimer("Section2:LUFact:Kernel", instr.timers); - - LinpackRunner tmp; - int mid = (128<<24)|(195<<16)|(175<<8)|73; - for(int i=1;i abs(b[i])) ? resid : abs(b[i]); - //normx = (normx > abs(x[i])) ? normx : abs(x[i]); - if (resid <= abs(b[i])) resid = abs(b[i]); - if (normx <= abs(x[i])) normx = abs(x[i]); - } - eps = epslon((double)1.0); - residn = resid/( n*norma*normx*eps ); - - if (residn > ref[size]) { - System.out.println("Validation failed"); - System.out.println("Computed Norm Res = " + (long) residn * 1000000); - System.out.println("Reference Norm Res = " + (long) ref[size] * 1000000); - } - } - - double abs (double d) { - if (d >= 0) return d; - else return -d; - //return (d >= 0) ? d : -d; - } - - double matgen (double a[][], int lda, int n, double b[]) - { - double norma; - int init, i, j; - - init = 1325; - norma = 0.0; - /* Next two for() statements switched. Solver wants - matrix in column order. --dmd 3/3/97 - */ - for (i = 0; i < n; i++) { - for (j = 0; j < n; j++) { - init = 3125*init % 65536; - a[j][i] = (init - 32768.0)/16384.0; - //norma = (a[j][i] > norma) ? a[j][i] : norma; - if (a[j][i] > norma) { - norma = a[j][i]; - } - } - } - for (i = 0; i < n; i++) { - b[i] = 0.0; - } - for (j = 0; j < n; j++) { - for (i = 0; i < n; i++) { - b[i] += a[j][i]; - } - } - return norma; - } - - void dgesl( double a[][], int lda, int n, int ipvt[], double b[], int job) - { - double t; - int k,kb,l,nm1,kp1; - - nm1 = n - 1; - if (job == 0) { - // job = 0 , solve a * x = b. first solve l*y = b - if (nm1 >= 1) { - for (k = 0; k < nm1; k++) { - l = ipvt[k]; - t = b[l]; - if (l != k){ - b[l] = b[k]; - b[k] = t; - } - kp1 = k + 1; - daxpy(n-(kp1),t,a[k],kp1,1,b,kp1,1); - } - } - // now solve u*x = y - for (kb = 0; kb < n; kb++) { - k = n - (kb + 1); - b[k] /= a[k][k]; - t = -b[k]; - daxpy(k,t,a[k],0,1,b,0,1); - } - } else { - // job = nonzero, solve trans(a) * x = b. first solve trans(u)*y = b - for (k = 0; k < n; k++) { - t = ddot(k,a[k],0,1,b,0,1); - b[k] = (b[k] - t)/a[k][k]; - } - // now solve trans(l)*x = y - if (nm1 >= 1) { - for (kb = 1; kb < nm1; kb++) { - k = n - (kb+1); - kp1 = k + 1; - b[k] += ddot(n-(kp1),a[k],kp1,1,b,kp1,1); - l = ipvt[k]; - if (l != k) { - t = b[l]; - b[l] = b[k]; - b[k] = t; - } - } - } - } - } - - /* - constant times a vector plus a vector. - jack dongarra, linpack, 3/11/78. - */ - void daxpy( int n, double da, double dx[], int dx_off, int incx, - double dy[], int dy_off, int incy) - { - int i,ix,iy; - - if ((n > 0) && (da != 0)) { - if (incx != 1 || incy != 1) { - // code for unequal increments or equal increments not equal to 1 - ix = 0; - iy = 0; - if (incx < 0) ix = (-n+1)*incx; - if (incy < 0) iy = (-n+1)*incy; - for (i = 0;i < n; i++) { - dy[iy +dy_off] += da*dx[ix +dx_off]; - ix += incx; - iy += incy; - } - return; - } else { - // code for both increments equal to 1 - for (i=0; i < n; i++) - dy[i +dy_off] += da*dx[i +dx_off]; - } - } - } - - /* - forms the dot product of two vectors. - jack dongarra, linpack, 3/11/78. - */ - double ddot( int n, double dx[], int dx_off, int incx, double dy[], - int dy_off, int incy) - { - double dtemp; - int i,ix,iy; - dtemp = 0; - if (n > 0) { - if (incx != 1 || incy != 1) { - // code for unequal increments or equal increments not equal to 1 - ix = 0; - iy = 0; - if (incx < 0) ix = (-n+1)*incx; - if (incy < 0) iy = (-n+1)*incy; - for (i = 0;i < n; i++) { - dtemp += dx[ix +dx_off]*dy[iy +dy_off]; - ix += incx; - iy += incy; - } - } else { - // code for both increments equal to 1 - for (i=0;i < n; i++) - dtemp += dx[i +dx_off]*dy[i +dy_off]; - } - } - return(dtemp); - } - - /* - scales a vector by a constant. - jack dongarra, linpack, 3/11/78. - */ - void dscal( int n, double da, double dx[], int dx_off, int incx) - { - int i,nincx; - if (n > 0) { - if (incx != 1) { - // code for increment not equal to 1 - nincx = n*incx; - for (i = 0; i < nincx; i += incx) - dx[i +dx_off] *= da; - } else { - // code for increment equal to 1 - for (i = 0; i < n; i++) - dx[i +dx_off] *= da; - } - } - } - - /* - finds the index of element having max. absolute value. - jack dongarra, linpack, 3/11/78. - */ - int idamax( int n, double dx[], int dx_off, int incx) - { - double dmax, dtemp; - int i, ix, itemp=0; - - if (n < 1) { - itemp = -1; - } else if (n ==1) { - itemp = 0; - } else if (incx != 1) { - // code for increment not equal to 1 - dmax = abs(dx[0 +dx_off]); - ix = 1 + incx; - for (i = 1; i < n; i++) { - dtemp = abs(dx[ix + dx_off]); - if (dtemp > dmax) { - itemp = i; - dmax = dtemp; - } - ix += incx; - } - } else { - // code for increment equal to 1 - itemp = 0; - dmax = abs(dx[0 +dx_off]); - for (i = 1; i < n; i++) { - dtemp = abs(dx[i + dx_off]); - if (dtemp > dmax) { - itemp = i; - dmax = dtemp; - } - } - } - return (itemp); - } - - /* - estimate unit roundoff in quantities of size x. - this program should function properly on all systems - satisfying the following two assumptions, - 1. the base used in representing dfloating point - numbers is not a power of three. - 2. the quantity a in statement 10 is represented to - the accuracy used in dfloating point variables - that are stored in memory. - the statement number 10 and the go to 10 are intended to - force optimizing compilers to generate code satisfying - assumption 2. - under these assumptions, it should be true that, - a is not exactly equal to four-thirds, - b has a zero for its last bit or digit, - c is not exactly equal to one, - eps measures the separation of 1.0 from - the next larger dfloating point number. - the developers of eispack would appreciate being informed - about any systems where these assumptions do not hold. - - ***************************************************************** - this routine is one of the auxiliary routines used by eispack iii - to avoid machine dependencies. - ***************************************************************** - - this version dated 4/6/83. - */ - double epslon (double x) - { - double a,b,c,eps; - - a = 4.0e0/3.0e0; - eps = 0; - while (eps == 0) { - b = a - 1.0; - c = b + b + b; - eps = abs(c-1.0); - } - return(eps*abs(x)); - } - - void dmxpy ( int n1, double y[], int n2, int ldm, double x[], double m[][]) - { - int j,i; - // cleanup odd vector - for (j = 0; j < n2; j++) { - for (i = 0; i < n1; i++) { - y[i] += x[j]*m[j][i]; - } - } - } - /* - public static void JGFvalidate(JGFLUFactBench lub) { - int i; - double eps,residn; - double[] ref; - - ref = new double[3]; - ref[0] = 6.0; - ref[1] = 12.0; - ref[2] = 20.0; - - atomic { - for (i = 0; i < lub.n; i++) { - lub.x[i] = lub.b[i]; - } - lub.norma = lub.matgen(lub.a,lub.lda,lub.n,lub.b); - for (i = 0; i < lub.n; i++) { - lub.b[i] = -(lub.b[i]); - } - - lub.dmxpy(lub.n,lub.b,lub.n,lub.lda,lub.x,lub.a); - lub.resid = 0.0; - lub.normx = 0.0; - for (i = 0; i < lub.n; i++) { -//resid = (resid > abs(b[i])) ? resid : abs(b[i]); -//normx = (normx > abs(x[i])) ? normx : abs(x[i]); -if (lub.resid <= abs(lub.b[i])) lub.resid = lub.abs(lub.b[i]); -if (lub.normx <= abs(lub.x[i])) lub.normx = lub.abs(lub.x[i]); -} -eps = lub.epslon((double)1.0); -residn = lub.resid/( lub.n*lub.norma*lub.normx*eps ); -} - -if (residn > ref[size]) { -System.out.println("Validation failed"); -System.out.println("Computed Norm Res = " + (long) residn); -System.out.println("Reference Norm Res = " + (long) ref[size]); -} -} -*/ - -} diff --git a/Robust/src/Benchmarks/Prefetch/LUFact/java/JGFLUFactBenchSizeA.java b/Robust/src/Benchmarks/Prefetch/LUFact/java/JGFLUFactBenchSizeA.java deleted file mode 100644 index 766a147c..00000000 --- a/Robust/src/Benchmarks/Prefetch/LUFact/java/JGFLUFactBenchSizeA.java +++ /dev/null @@ -1,50 +0,0 @@ -/************************************************************************** - * * - * Java Grande Forum Benchmark Suite - Thread Version 1.0 * - * * - * produced by * - * * - * Java Grande Benchmarking Project * - * * - * at * - * * - * Edinburgh Parallel Computing Centre * - * * - * email: epcc-javagrande@epcc.ed.ac.uk * - * * - * * - * This version copyright (c) The University of Edinburgh, 2001. * - * All rights reserved. * - * * - **************************************************************************/ -public class JGFLUFactBenchSizeA { - - public static void main(String argv[]){ - int nthreads; - if(argv.length != 0 ) { - nthreads = Integer.parseInt(argv[0]); - } else { - System.out.println("The no of threads has not been specified, defaulting to 1"); - System.out.println(" "); - nthreads = 1; - } - - JGFInstrumentor instr = new JGFInstrumentor(); - JGFInstrumentor.printHeader(2,0,nthreads); - JGFLUFactBench lub; - lub = new JGFLUFactBench(nthreads, instr); - //lub = new JGFLUFactBench(nthreads); - - int size = 0; - JGFInstrumentor.addTimer("Section2:LUFact:Kernel", "Mflops", size, instr.timers); - lub.JGFsetsize(size); - lub.JGFinitialise(); - JGFLUFactBench.JGFkernel(lub,instr); - lub.JGFvalidate(); - double ops; - ops = lub.ops; - JGFInstrumentor.addOpsToTimer("Section2:LUFact:Kernel", ((long)ops)/1.0e06, instr.timers); - JGFInstrumentor.printTimer("Section2:LUFact:Kernel", instr.timers); - } -} - diff --git a/Robust/src/Benchmarks/Prefetch/LUFact/java/JGFTimer.java b/Robust/src/Benchmarks/Prefetch/LUFact/java/JGFTimer.java deleted file mode 100644 index cf4daf57..00000000 --- a/Robust/src/Benchmarks/Prefetch/LUFact/java/JGFTimer.java +++ /dev/null @@ -1,124 +0,0 @@ -/************************************************************************** - * * - * Java Grande Forum Benchmark Suite - Thread Version 1.0 * - * * - * produced by * - * * - * Java Grande Benchmarking Project * - * * - * at * - * * - * Edinburgh Parallel Computing Centre * - * * - * email: epcc-javagrande@epcc.ed.ac.uk * - * * - * * - * This version copyright (c) The University of Edinburgh, 1999. * - * All rights reserved. * - * * - **************************************************************************/ -import java.util.*; - -public class JGFTimer { - - public String name; - public String opname; - public double time; - public double opcount; - public long calls; - public int size; - - private long start_time; - private boolean on; - - public JGFTimer(String name, String opname){ - this.size = -1; - this.name = name; - this.opname = opname; - reset(); - } - - public JGFTimer(String name, String opname, int size){ - this.name = name; - this.opname = opname; - this.size = size; - reset(); - } - - public JGFTimer(String name){ - this.name = name; - this.opname = ""; - reset(); - } - - - - public void start(){ - if (on) System.out.println("Warning timer " + " was already turned on"); - on = true; - start_time = System.currentTimeMillis(); - } - - - public void stop(){ - time += (double) (System.currentTimeMillis()-start_time) / 1000.; - if (!on) System.out.println("Warning timer " + " wasn't turned on"); - calls++; - on = false; - } - - public void addops(double count){ - opcount += count; - } - - public void addtime(double added_time){ - time += added_time; - } - - public void reset(){ - time = 0.0; - calls = 0; - opcount = 0; - on = false; - } - - public double perf(){ - return opcount / time; - } - - public void longprint(){ - System.out.println("Timer Calls Time(s) Performance("+opname+"/s)"); - System.out.println(name + " " + calls + " " + time + " " + this.perf()); - } - - public void print(){ - if (opname.equals("")) { - System.out.println(name + " " + time + " (s)"); - } - else { - if(size == 0) { - System.out.println(name + ":SizeA" + "\t" + time + " (s) \t " + this.perf() + "\t" + " ("+opname+"/s)"); - } else if (size == 1) { - System.out.println(name + ":SizeB" + "\t" + time + " (s) \t " + this.perf() + "\t" + " ("+opname+"/s)"); - } else if (size == 2) { - System.out.println(name + ":SizeC" + "\t" + time + " (s) \t " + this.perf() + "\t" + " ("+opname+"/s)"); - } else{ - System.out.println(name + "\t" + time + " (s) \t " + this.perf() + "\t" + " ("+opname+"/s)"); - } - } - } - - - public void printperf(){ - - String name; - name = this.name; - - // pad name to 40 characters - while ( name.length() < 40 ) name = name + " "; - - System.out.println(name + "\t" + this.perf() + "\t" - + " ("+opname+"/s)"); - } - -} diff --git a/Robust/src/Benchmarks/Prefetch/LUFact/java/Linpack.java b/Robust/src/Benchmarks/Prefetch/LUFact/java/Linpack.java deleted file mode 100644 index 1c21cb08..00000000 --- a/Robust/src/Benchmarks/Prefetch/LUFact/java/Linpack.java +++ /dev/null @@ -1,327 +0,0 @@ -/************************************************************************** - * * - * Java Grande Forum Benchmark Suite - Thread Version 1.0 * - * * - * produced by * - * * - * Java Grande Benchmarking Project * - * * - * at * - * * - * Edinburgh Parallel Computing Centre * - * * - * email: epcc-javagrande@epcc.ed.ac.uk * - * * - * See below for the previous history of this code * - * * - * This version copyright (c) The University of Edinburgh, 2001. * - * All rights reserved. * - * * - **************************************************************************/ - -/* - - Modified 3/3/97 by David M. Doolin (dmd) doolin@cs.utk.edu - Fixed error in matgen() method. Added some comments. - - Modified 1/22/97 by Paul McMahan mcmahan@cs.utk.edu - Added more MacOS options to form. - - Optimized by Jonathan Hardwick (jch@cs.cmu.edu), 3/28/96 - Compare to Linkpack.java. - Optimizations performed: - - added "final" modifier to performance-critical methods. - - changed lines of the form "a[i] = a[i] + x" to "a[i] += x". - - minimized array references using common subexpression elimination. - - eliminated unused variables. - - undid an unrolled loop. - - added temporary 1D arrays to hold frequently-used columns of 2D arrays. - - wrote my own abs() method - See http://www.cs.cmu.edu/~jch/java/linpack.html for more details. - - - Ported to Java by Reed Wade (wade@cs.utk.edu) 2/96 - built using JDK 1.0 on solaris - using "javac -O Linpack.java" - - - Translated to C by Bonnie Toy 5/88 - (modified on 2/25/94 to fix a problem with daxpy for - unequal increments or equal increments not equal to 1. - Jack Dongarra) - -*/ - -public class Linpack { - double a[][]; - double b[]; - double x[]; - double ops,total,norma,normx; - double resid,time; - double kf; - int n,i,ntimes,info,lda,ldaa,kflops; - int ipvt[]; - - double abs (double d) { - if (d >= 0) return d; - else return -d; - //return (d >= 0) ? d : -d; - } - - double matgen (double a[][], int lda, int n, double b[]) - { - double norma; - int init, i, j; - - init = 1325; - norma = 0.0; - /* Next two for() statements switched. Solver wants - matrix in column order. --dmd 3/3/97 - */ - for (i = 0; i < n; i++) { - for (j = 0; j < n; j++) { - init = 3125*init % 65536; - a[j][i] = (init - 32768.0)/16384.0; - //norma = (a[j][i] > norma) ? a[j][i] : norma; - if (a[j][i] > norma) { - norma = a[j][i]; - } - } - } - for (i = 0; i < n; i++) { - b[i] = 0.0; - } - for (j = 0; j < n; j++) { - for (i = 0; i < n; i++) { - b[i] += a[j][i]; - } - } - return norma; - } - - void dgesl( double a[][], int lda, int n, int ipvt[], double b[], int job) - { - double t; - int k,kb,l,nm1,kp1; - - nm1 = n - 1; - if (job == 0) { - // job = 0 , solve a * x = b. first solve l*y = b - if (nm1 >= 1) { - for (k = 0; k < nm1; k++) { - l = ipvt[k]; - t = b[l]; - if (l != k){ - b[l] = b[k]; - b[k] = t; - } - kp1 = k + 1; - daxpy(n-(kp1),t,a[k],kp1,1,b,kp1,1); - } - } - // now solve u*x = y - for (kb = 0; kb < n; kb++) { - k = n - (kb + 1); - b[k] /= a[k][k]; - t = -b[k]; - daxpy(k,t,a[k],0,1,b,0,1); - } - } else { - // job = nonzero, solve trans(a) * x = b. first solve trans(u)*y = b - for (k = 0; k < n; k++) { - t = ddot(k,a[k],0,1,b,0,1); - b[k] = (b[k] - t)/a[k][k]; - } - // now solve trans(l)*x = y - if (nm1 >= 1) { - for (kb = 1; kb < nm1; kb++) { - k = n - (kb+1); - kp1 = k + 1; - b[k] += ddot(n-(kp1),a[k],kp1,1,b,kp1,1); - l = ipvt[k]; - if (l != k) { - t = b[l]; - b[l] = b[k]; - b[k] = t; - } - } - } - } - } - - /* - constant times a vector plus a vector. - jack dongarra, linpack, 3/11/78. - */ - void daxpy( int n, double da, double dx[], int dx_off, int incx, - double dy[], int dy_off, int incy) - { - int i,ix,iy; - - if ((n > 0) && (da != 0)) { - if (incx != 1 || incy != 1) { - // code for unequal increments or equal increments not equal to 1 - ix = 0; - iy = 0; - if (incx < 0) ix = (-n+1)*incx; - if (incy < 0) iy = (-n+1)*incy; - for (i = 0;i < n; i++) { - dy[iy +dy_off] += da*dx[ix +dx_off]; - ix += incx; - iy += incy; - } - return; - } else { - // code for both increments equal to 1 - for (i=0; i < n; i++) - dy[i +dy_off] += da*dx[i +dx_off]; - } - } - } - - /* - forms the dot product of two vectors. - jack dongarra, linpack, 3/11/78. - */ - double ddot( int n, double dx[], int dx_off, int incx, double dy[], - int dy_off, int incy) - { - double dtemp; - int i,ix,iy; - dtemp = 0; - if (n > 0) { - if (incx != 1 || incy != 1) { - // code for unequal increments or equal increments not equal to 1 - ix = 0; - iy = 0; - if (incx < 0) ix = (-n+1)*incx; - if (incy < 0) iy = (-n+1)*incy; - for (i = 0;i < n; i++) { - dtemp += dx[ix +dx_off]*dy[iy +dy_off]; - ix += incx; - iy += incy; - } - } else { - // code for both increments equal to 1 - for (i=0;i < n; i++) - dtemp += dx[i +dx_off]*dy[i +dy_off]; - } - } - return(dtemp); - } - - /* - scales a vector by a constant. - jack dongarra, linpack, 3/11/78. - */ - void dscal( int n, double da, double dx[], int dx_off, int incx) - { - int i,nincx; - if (n > 0) { - if (incx != 1) { - // code for increment not equal to 1 - nincx = n*incx; - for (i = 0; i < nincx; i += incx) - dx[i +dx_off] *= da; - } else { - // code for increment equal to 1 - for (i = 0; i < n; i++) - dx[i +dx_off] *= da; - } - } - } - - /* - finds the index of element having max. absolute value. - jack dongarra, linpack, 3/11/78. - */ - int idamax( int n, double dx[], int dx_off, int incx) - { - double dmax, dtemp; - int i, ix, itemp=0; - - if (n < 1) { - itemp = -1; - } else if (n ==1) { - itemp = 0; - } else if (incx != 1) { - // code for increment not equal to 1 - dmax = abs(dx[0 +dx_off]); - ix = 1 + incx; - for (i = 1; i < n; i++) { - dtemp = abs(dx[ix + dx_off]); - if (dtemp > dmax) { - itemp = i; - dmax = dtemp; - } - ix += incx; - } - } else { - // code for increment equal to 1 - itemp = 0; - dmax = abs(dx[0 +dx_off]); - for (i = 1; i < n; i++) { - dtemp = abs(dx[i + dx_off]); - if (dtemp > dmax) { - itemp = i; - dmax = dtemp; - } - } - } - return (itemp); - } - - /* - estimate unit roundoff in quantities of size x. - this program should function properly on all systems - satisfying the following two assumptions, - 1. the base used in representing dfloating point - numbers is not a power of three. - 2. the quantity a in statement 10 is represented to - the accuracy used in dfloating point variables - that are stored in memory. - the statement number 10 and the go to 10 are intended to - force optimizing compilers to generate code satisfying - assumption 2. - under these assumptions, it should be true that, - a is not exactly equal to four-thirds, - b has a zero for its last bit or digit, - c is not exactly equal to one, - eps measures the separation of 1.0 from - the next larger dfloating point number. - the developers of eispack would appreciate being informed - about any systems where these assumptions do not hold. - - ***************************************************************** - this routine is one of the auxiliary routines used by eispack iii - to avoid machine dependencies. - ***************************************************************** - - this version dated 4/6/83. - */ - double epslon (double x) - { - double a,b,c,eps; - - a = 4.0e0/3.0e0; - eps = 0; - while (eps == 0) { - b = a - 1.0; - c = b + b + b; - eps = abs(c-1.0); - } - return(eps*abs(x)); - } - - void dmxpy ( int n1, double y[], int n2, int ldm, double x[], double m[][]) - { - int j,i; - // cleanup odd vector - for (j = 0; j < n2; j++) { - for (i = 0; i < n1; i++) { - y[i] += x[j]*m[j][i]; - } - } - } -} - diff --git a/Robust/src/Benchmarks/Prefetch/LUFact/java/LinpackRunner.java b/Robust/src/Benchmarks/Prefetch/LUFact/java/LinpackRunner.java deleted file mode 100644 index a9764f50..00000000 --- a/Robust/src/Benchmarks/Prefetch/LUFact/java/LinpackRunner.java +++ /dev/null @@ -1,205 +0,0 @@ -/************************************************************************** -* * -* Java Grande Forum Benchmark Suite - Thread Version 1.0 * -* * -* produced by * -* * -* Java Grande Benchmarking Project * -* * -* at * -* * -* Edinburgh Parallel Computing Centre * -* * -* email: epcc-javagrande@epcc.ed.ac.uk * -* * -* * -* This version copyright (c) The University of Edinburgh, 2001. * -* All rights reserved. * -* * -**************************************************************************/ - -class LinpackRunner extends Thread { - int id,lda,n,info,ipvt[]; - double a[][]; - TournamentBarrier br; - int nthreads; - - public LinpackRunner(int id, double a[][], int lda, int n, int ipvt[],TournamentBarrier br, int nthreads) { - this.id = id; - this.a=a; - this.lda=lda; - this.n=n; - this.ipvt=ipvt; - this.br=br; - //this.instr = instr; - this.nthreads = nthreads; - } - - double abs (double d) { - //return (d >= 0) ? d : -d; - if (d >= 0) return d; - else return -d; - } - - public void run() { - double[] col_k, col_j; - double t; - int j,k,kp1,l,nm1; - int info; - int slice,ilow,iupper; - // gaussian elimination with partial pivoting - info = 0; - nm1 = n - 1; - if (nm1 >= 0) { - for (k = 0; k < nm1; k++) { - col_k = a[k]; - kp1 = k + 1; - // find l = pivot index - l = idamax(n-k,col_k,k,1) + k; - if(id==0) { - ipvt[k] = l; - } - // synchronise threads - br.DoBarrier(id); - // zero pivot implies this column already triangularized - if (col_k[l] != 0) { - br.DoBarrier(id); - // interchange if necessary - if(id == 0 ) { - if (l != k) { - t = col_k[l]; - col_k[l] = col_k[k]; - col_k[k] = t; - } - } - // synchronise threads - br.DoBarrier(id); - // compute multipliers - t = -1.0/col_k[k]; - if(id == 0) { - dscal(n-(kp1),t,col_k,kp1,1); - } - // synchronise threads - br.DoBarrier(id); - // row elimination with column indexing - slice = ((n-kp1) + nthreads-1)/nthreads; - ilow = (id*slice)+kp1; - iupper = ((id+1)*slice)+kp1; - if (iupper > n ) iupper=n; - if (ilow > n ) ilow=n; - for (j = ilow; j < iupper; j++) { - col_j = a[j]; - t = col_j[l]; - if (l != k) { - col_j[l] = col_j[k]; - col_j[k] = t; - } - daxpy(n-(kp1),t,col_k,kp1,1, - col_j,kp1,1); - } - // synchronise threads - br.DoBarrier(id); - } else { - info = k; - } - br.DoBarrier(id); - } - } - - if(id==0) { - ipvt[n-1] = n-1; - } - if (a[(n-1)][(n-1)] == 0) info = n-1; - } - - /* - finds the index of element having max. absolute value. - jack dongarra, linpack, 3/11/78. - */ - int idamax( int n, double dx[], int dx_off, int incx) - { - double dmax, dtemp; - int i, ix, itemp=0; - - if (n < 1) { - itemp = -1; - } else if (n ==1) { - itemp = 0; - } else if (incx != 1) { - // code for increment not equal to 1 - dmax = abs(dx[0 +dx_off]); - ix = 1 + incx; - for (i = 1; i < n; i++) { - dtemp = abs(dx[ix + dx_off]); - if (dtemp > dmax) { - itemp = i; - dmax = dtemp; - } - ix += incx; - } - } else { - // code for increment equal to 1 - itemp = 0; - dmax = abs(dx[0 +dx_off]); - for (i = 1; i < n; i++) { - dtemp = abs(dx[i + dx_off]); - if (dtemp > dmax) { - itemp = i; - dmax = dtemp; - } - } - } - return (itemp); - } - - /* - scales a vector by a constant. - jack dongarra, linpack, 3/11/78. - */ - void dscal( int n, double da, double dx[], int dx_off, int incx) - { - int i,nincx; - if (n > 0) { - if (incx != 1) { - // code for increment not equal to 1 - nincx = n*incx; - for (i = 0; i < nincx; i += incx) - dx[i +dx_off] *= da; - } else { - // code for increment equal to 1 - for (i = 0; i < n; i++) - dx[i +dx_off] *= da; - } - } - } - - /* - constant times a vector plus a vector. - jack dongarra, linpack, 3/11/78. - */ - void daxpy( int n, double da, double dx[], int dx_off, int incx, - double dy[], int dy_off, int incy) - { - int i,ix,iy; - if ((n > 0) && (da != 0)) { - if (incx != 1 || incy != 1) { - // code for unequal increments or equal increments not equal to 1 - ix = 0; - iy = 0; - if (incx < 0) ix = (-n+1)*incx; - if (incy < 0) iy = (-n+1)*incy; - for (i = 0;i < n; i++) { - dy[iy +dy_off] += da*dx[ix +dx_off]; - ix += incx; - iy += incy; - } - return; - } else { - // code for both increments equal to 1 - for (i=0; i < n; i++) - dy[i +dy_off] += da*dx[i +dx_off]; - } - } - } -} - diff --git a/Robust/src/Benchmarks/Prefetch/LUFact/java/TournamentBarrier.java b/Robust/src/Benchmarks/Prefetch/LUFact/java/TournamentBarrier.java deleted file mode 100755 index 99ff768a..00000000 --- a/Robust/src/Benchmarks/Prefetch/LUFact/java/TournamentBarrier.java +++ /dev/null @@ -1,96 +0,0 @@ -/************************************************************************** - * * - * Java Grande Forum Benchmark Suite - Thread Version 1.0 * - * * - * produced by * - * * - * Java Grande Benchmarking Project * - * * - * at * - * * - * Edinburgh Parallel Computing Centre * - * * - * email: epcc-javagrande@epcc.ed.ac.uk * - * * - * * - * This version copyright (c) The University of Edinburgh, 2001. * - * All rights reserved. * - * * - **************************************************************************/ - -// This implements a simple tournament-based barrier, using entirely its -// own synchronisation. At present Yield() is called to stop busy-waiting -// processes hogging the processor(s)! - -import java.util.*; - -public class TournamentBarrier { - // Array of flags indicating whether the given process and all those - // for which it is responsible have finished. The "sense" of this - // array alternates with each barrier, to prevent having to - // reinitialise. - boolean[] IsDone; - public int maxBusyIter; - int numThreads; - - public TournamentBarrier(int n) { - numThreads = n; - maxBusyIter = 1; - // Superclass constructor should record the number of threads - // and thread manager. - //super(n); - - // Initialise the IsDone array. The choice of initial value is - // arbitrary, but must be consistent! - IsDone = new boolean[numThreads]; - for(int i = 0; i < n; i++) { - IsDone[i] = false; - } - } - - // Uses the manager's debug function, so this can only be used after - // construction! - public void debug(String s) { - // System.err.println("Debug message"); - } - - public void setMaxBusyIter(int b) { - maxBusyIter = b; - } - - public void DoBarrier(int myid) { - int b; - // debug("Thread " + myid + " checking in"); - - int roundmask = 3; - boolean donevalue = !IsDone[myid]; - - while(((myid & roundmask) == 0) && (roundmask<(numThreads<<2))) { - int spacing = (roundmask+1) >> 2; - for(int i=1; i<=3 && myid+i*spacing < numThreads; i++) { - // debug("Thread " + myid + " waiting for thread " + (myid+i*spacing)); - b = maxBusyIter; - while(IsDone[myid+i*spacing] != donevalue) { - b--; - if(b==0) { - //Thread.yield(); - b = maxBusyIter; - } - } - } - roundmask = (roundmask << 2) + 3; - } - // debug("Thread " + myid + " reporting done"); - IsDone[myid] = donevalue; - b = maxBusyIter; - while(IsDone[0] != donevalue) { - b--; - if(b==0) { - //Thread.yield(); - b = maxBusyIter; - } - } - //debug("Thread " + myid + " checking out"); - - } -} diff --git a/Robust/src/Benchmarks/Prefetch/LUFact/java/makefile b/Robust/src/Benchmarks/Prefetch/LUFact/java/makefile deleted file mode 100644 index 1103d192..00000000 --- a/Robust/src/Benchmarks/Prefetch/LUFact/java/makefile +++ /dev/null @@ -1,8 +0,0 @@ -SRC = JGFLUFactBenchSizeA -default: - javac ${SRC}.java -run: - java ${SRC} 2 - -clean: - rm *.class diff --git a/Robust/src/Benchmarks/Prefetch/MatrixMultiply/MatrixMultiply.java b/Robust/src/Benchmarks/Prefetch/MatrixMultiply/MatrixMultiply.java deleted file mode 100644 index e56a6faa..00000000 --- a/Robust/src/Benchmarks/Prefetch/MatrixMultiply/MatrixMultiply.java +++ /dev/null @@ -1,192 +0,0 @@ -public class MatrixMultiply extends Thread{ - MMul mmul; - public int x0, y0, x1, y1; - - public MatrixMultiply(MMul mmul, int x0, int y0, int x1, int y1) { - this.mmul = mmul; - this.x0 = x0; - this.y0 = y0; - this.x1 = x1; - this.y1 = y1; - } - - public void run() { - double localresults[][]; - - atomic { - //compute the results - localresults=new double[1+x1-x0][1+y1-y0]; - double la[][]=mmul.a; - double lbtranspose[][]=mmul.b; - double lc[][]=mmul.c; - int M=mmul.M; - - //Use b transpose for cache performance - for(int i = x0; i<= x1; i++){ - double a[]=la[i]; - for (int j = y0; j <= y1; j++) { - double innerProduct=0; - double b[] = lbtranspose[j]; - for(int k = 0; k < M; k++) { - innerProduct += a[k] *b[k]; - } - localresults[i-x0][j-y0]=innerProduct; - } - } - } - - atomic { - //write the results - for(int i=x0;i<=x1;i++) { - double c[]=mmul.c[i]; - for(int j=y0;j<=y1;j++) { - c[j]=localresults[i-x0][j-y0]; - } - } - } - } - - public static void main(String[] args) { -<<<<<<< MatrixMultiply.java - int mid1 = (128<<24)|(195<<16)|(175<<8)|69; - int mid2 = (128<<24)|(195<<16)|(175<<8)|69; - int mid3 = (128<<24)|(195<<16)|(175<<8)|71; - int NUM_THREADS = 1; -======= - int NUM_THREADS = 4; - int[] mid = new int[NUM_THREADS]; - mid[0] = (128<<24)|(195<<16)|(175<<8)|69; - mid[1] = (128<<24)|(195<<16)|(175<<8)|73; - mid[2] = (128<<24)|(195<<16)|(175<<8)|78; - mid[3] = (128<<24)|(195<<16)|(175<<8)|79; - //int mid1 = (128<<24)|(195<<16)|(175<<8)|69; - //int mid2 = (128<<24)|(195<<16)|(175<<8)|73; ->>>>>>> 1.19 - int p, q, r; - MatrixMultiply[] mm; - MatrixMultiply tmp; - MMul matrix; - - atomic { - matrix = global new MMul(400, 400, 400); - matrix.setValues(); - matrix.transpose(); - } - - atomic{ - mm = global new MatrixMultiply[NUM_THREADS]; - } - - atomic { - mm[0] = global new MatrixMultiply(matrix,0,0,200,200); - mm[1] = global new MatrixMultiply(matrix,0,201,200,399); - mm[2] = global new MatrixMultiply(matrix,201,0,399,200); - mm[3] = global new MatrixMultiply(matrix,201,201,399,399); - } - - atomic { - p = matrix.L; - q = matrix.M; - r = matrix.N; - } - - // print out the matrices to be multiplied - System.printString("\n"); - System.printString("MatrixMultiply: L="); - System.printInt(p); - System.printString("\t"); - System.printString("M="); - System.printInt(q); - System.printString("\t"); - System.printString("N="); - System.printInt(r); - System.printString("\n"); - - // start a thread to compute each c[l,n] - for (int i = 0; i < NUM_THREADS; i++) { - atomic { - tmp = mm[i]; - } - tmp.start(mid[i]); - } - - // wait for them to finish - for (int i = 0; i < NUM_THREADS; i++) { - atomic { - tmp = mm[i]; - } - tmp.join(); - } - - // print out the result of the matrix multiply - System.printString("Starting\n"); - System.printString("Matrix Product c =\n"); - double val; - atomic { - for (int i = 0; i < p; i++) { - double c[]=matrix.c[i]; - for (int j = 0; j < r; j++) { - val = c[j]; - } - } - } - System.printString("Finished\n"); - } -} - -public class MMul{ - - public int L, M, N; - public double[][] a; - public double[][] b; - public double[][] c; - public double[][] btranspose; - - public MMul(int L, int M, int N) { - this.L = L; - this.M = M; - this.N = N; - a = global new double[L][M]; - b = global new double[M][N]; - c = global new double[L][N]; - btranspose = global new double[N][M]; - } - - public void setValues() { - for(int i = 0; i < L; i++) { - double ai[] = a[i]; - for(int j = 0; j < M; j++) { - ai[j] = j+1; - } - } - - for(int i = 0; i < M; i++) { - double bi[] = b[i]; - for(int j = 0; j < N; j++) { - bi[j] = j+1; - } - } - - for(int i = 0; i < L; i++) { - double ci[] = c[i]; - for(int j = 0; j < N; j++) { - ci[j] = 0; - } - } - for(int i = 0; i < N; i++) { - double btransposei[] = btranspose[i]; - for(int j = 0; j < M; j++) { - btransposei[j] = 0; - } - } - } - - public void transpose() { - for(int row = 0; row < M; row++) { - double brow[] = b[row]; - for(int col = 0; col < N; col++) { - btranspose[col][row] = brow[col]; - } - } - } -} diff --git a/Robust/src/Benchmarks/Prefetch/MatrixMultiply/MatrixMultiplyN.java b/Robust/src/Benchmarks/Prefetch/MatrixMultiply/MatrixMultiplyN.java deleted file mode 100644 index 93a00316..00000000 --- a/Robust/src/Benchmarks/Prefetch/MatrixMultiply/MatrixMultiplyN.java +++ /dev/null @@ -1,163 +0,0 @@ -public class MatrixMultiply extends Thread{ - MMul mmul; - public int x0, y0, x1, y1; - - public MatrixMultiply(MMul mmul, int x0, int x1, int y0, int y1) { - this.mmul = mmul; - this.x0 = x0; - this.y0 = y0; - this.x1 = x1; - this.y1 = y1; - } - - public void run() { - atomic { - double la[][]=mmul.a; - double lc[][]=mmul.c; - double lb[][]=mmul.btranspose; - int M=mmul.M; - - //Use btranspose for cache performance - for(int i = x0; i< x1; i++){ - double a[]=la[i]; - double c[]=lc[i]; - for (int j = y0; j < y1; j++) { - double innerProduct=0; - double b[] = lb[j]; - for(int k = 0; k < M; k++) { - innerProduct += a[k] *b[k]; - } - c[j]=innerProduct; - } - } - } - } - - public static void main(String[] args) { - int NUM_THREADS = 4; - int SIZE=600; - if (args.length>0) { - NUM_THREADS=Integer.parseInt(args[0]); - if (args.length>1) - SIZE=Integer.parseInt(args[1]); - } - - int[] mid = new int[4]; - mid[0] = (128<<24)|(195<<16)|(175<<8)|69; - mid[1] = (128<<24)|(195<<16)|(175<<8)|70; - mid[2] = (128<<24)|(195<<16)|(175<<8)|71; - mid[3] = (128<<24)|(195<<16)|(175<<8)|79; - int p, q, r; - MatrixMultiply[] mm; - MatrixMultiply tmp; - MMul matrix; - - atomic { - matrix = global new MMul(SIZE, SIZE, SIZE); - matrix.setValues(); - matrix.transpose(); - mm = global new MatrixMultiply[NUM_THREADS]; - int increment=SIZE/NUM_THREADS; - int base=0; - for(int i=0;i0) { - NUM_THREADS=Integer.parseInt(args[0]); - if (args.length>1) { - SIZE=Integer.parseInt(args[1]); - if (args.length>2) - NUM_MATRIX=Integer.parseInt(args[2]); - } - } - - int[] mid = new int[4]; - mid[0] = (128<<24)|(195<<16)|(175<<8)|79; - mid[1] = (128<<24)|(195<<16)|(175<<8)|80; - mid[2] = (128<<24)|(195<<16)|(175<<8)|69; - mid[3] = (128<<24)|(195<<16)|(175<<8)|70; - int p, q, r; - MatrixMultiply[] mm; - MatrixMultiply tmp; - MMul matrix; - - atomic { - matrix = global new MMul(NUM_MATRIX, SIZE, SIZE, SIZE); - matrix.setValues(); - matrix.transpose(); - mm = global new MatrixMultiply[NUM_THREADS]; - int increment=SIZE/NUM_THREADS; - int base=0; - for(int i=0;i 1) - b.cleared=true; - b.entercount--; - //return; - ret1 = true; - } - retry=false; - } - } - } while(retry); - if (ret1) return; - while(ret2) { - atomic { - if (b.cleared) { - b.entercount--; - int count = b.entercount; - if (count==0) - b.cleared=false; - //return; - ret2=false; - } - } - } - } -} diff --git a/Robust/src/Benchmarks/Prefetch/Moldyn/dsm/DebugBarrier.java b/Robust/src/Benchmarks/Prefetch/Moldyn/dsm/DebugBarrier.java deleted file mode 100644 index 8dca6d7a..00000000 --- a/Robust/src/Benchmarks/Prefetch/Moldyn/dsm/DebugBarrier.java +++ /dev/null @@ -1,56 +0,0 @@ -public class Barrier { - int numthreads; - int entercount; - boolean cleared; - - public Barrier(int n) { - //System.printString("Initializing barrier for "+n+" threads.\n"); - numthreads=n; - cleared = false; - entercount = 0; - } - - public Barrier() { - } - - public void reset() { - cleared = false; - entercount = 0; - } - - public static void enterBarrier(Barrier b) { - int tmp; - boolean retry=true; - - do { - atomic { - //System.printString("Entering barrier with ec="+b.entercount+" cl="+b.cleared+"\n"); - if (!b.cleared) { - b.entercount++; - tmp = b.entercount; - if (tmp==b.numthreads) { - if(b.numthreads > 1) - b.cleared=true; - b.entercount--; - //System.printString("Exiting Barrier #1\n"); - return; - } - retry=false; - } - } - } while(retry); - //System.printString("Waiting for last thread to enter\n"); - while(true) { - atomic { - if (b.cleared) { - b.entercount--; - int count = b.entercount; - if (count==0) - b.cleared=false; - //System.printString("Exiting Barrier #2\n"); - return; - } - } - } - } -} diff --git a/Robust/src/Benchmarks/Prefetch/Moldyn/dsm/JGFInstrumentor.java b/Robust/src/Benchmarks/Prefetch/Moldyn/dsm/JGFInstrumentor.java deleted file mode 100644 index 3f9f580c..00000000 --- a/Robust/src/Benchmarks/Prefetch/Moldyn/dsm/JGFInstrumentor.java +++ /dev/null @@ -1,199 +0,0 @@ -/************************************************************************** - * * - * Java Grande Forum Benchmark Suite - Thread Version 1.0 * - * * - * produced by * - * * - * Java Grande Benchmarking Project * - * * - * at * - * * - * Edinburgh Parallel Computing Centre * - * * - * email: epcc-javagrande@epcc.ed.ac.uk * - * * - * * - * This version copyright (c) The University of Edinburgh, 1999. * - * All rights reserved. * - * * - **************************************************************************/ -public class JGFInstrumentor{ - - protected HashMap timers; - protected HashMap data; - - public JGFInstrumentor() { - timers = new HashMap(); - data = new HashMap(); - } - - public static void addTimer (String name, HashMap timers){ - - if (timers.containsKey(name)) { - System.printString("JGFInstrumentor.addTimer: warning - timer " + name + - " already exists\n"); - } - else { - timers.put(name, new JGFTimer(name)); - } - } - - public static void addTimer (String name, String opname, HashMap timers){ - - if (timers.containsKey(name)) { - System.printString("JGFInstrumentor.addTimer: warning - timer " + name + - " already exists\n"); - } - else { - timers.put(name, new JGFTimer(name,opname)); - } - - } - - public static void addTimer (String name, String opname, int size, HashMap timers){ - - if (timers.containsKey(name)) { - System.printString("JGFInstrumentor.addTimer: warning - timer " + name + - " already exists\n"); - } - else { - timers.put(name, new JGFTimer(name,opname,size)); - } - - } - - public static void startTimer(String name, HashMap timers){ - if (timers.containsKey(name)) { - ((JGFTimer) timers.get(name)).start(); - } - else { - System.printString("JGFInstrumentor.startTimer: failed - timer " + name + - " does not exist\n"); - } - - } - - public static void stopTimer(String name, HashMap timers){ - if (timers.containsKey(name)) { - ((JGFTimer) timers.get(name)).stop(); - } - else { - System.printString("JGFInstrumentor.stopTimer: failed - timer " + name + - " does not exist\n"); - } - } - - public static void addOpsToTimer(String name, double count, HashMap timers){ - if (timers.containsKey(name)) { - ((JGFTimer) timers.get(name)).addops(count); - } - else { - System.printString("JGFInstrumentor.addOpsToTimer: failed - timer " + name + - " does not exist\n"); - } - } - - public static void addTimeToTimer(String name, double added_time, HashMap timers){ - if (timers.containsKey(name)) { - ((JGFTimer) timers.get(name)).addtime(added_time); - } - else { - System.printString("JGFInstrumentor.addTimeToTimer: failed - timer " + name + - " does not exist\n"); - } - - - - } - - public static double readTimer(String name, HashMap timers){ - double time; - if (timers.containsKey(name)) { - time = ((JGFTimer) timers.get(name)).time; - } - else { - System.printString("JGFInstrumentor.readTimer: failed - timer " + name + - " does not exist\n"); - time = 0.0; - } - return time; - } - - public static void resetTimer(String name, HashMap timers){ - if (timers.containsKey(name)) { - ((JGFTimer) timers.get(name)).reset(); - } - else { - System.printString("JGFInstrumentor.resetTimer: failed - timer " + name + - " does not exist\n"); - } - } - - public static void printTimer(String name, HashMap timers){ - if (timers.containsKey(name)) { - ((JGFTimer) timers.get(name)).print(); - } - else { - System.printString("JGFInstrumentor.printTimer: failed - timer " + name + - " does not exist\n"); - } - } - - public static void printperfTimer(String name, HashMap timers){ - if (timers.containsKey(name)) { - ((JGFTimer) timers.get(name)).printperf(); - } - else { - System.printString("JGFInstrumentor.printTimer: failed - timer " + name + - " does not exist\n"); - } - } - - public static void storeData(String name, Object obj, HashMap data){ - data.put(name,obj); - } - - public static void retrieveData(String name, Object obj, HashMap data){ - obj = data.get(name); - } - - public static void printHeader(int section, int size,int nthreads) { - - String header, base; - - header = ""; - base = "Java Grande Forum Thread Benchmark Suite - Version 1.0 - Section "; - - if (section == 1) - { - header = base + "1"; - } - else if (section == 2) - { - if (size == 0) - header = base + "2 - Size A"; - else if (size == 1) - header = base + "2 - Size B"; - else if (size == 2) - header = base + "2 - Size C"; - } - else if (section == 3) - { - if (size == 0) - header = base + "3 - Size A"; - else if (size == 1) - header = base + "3 - Size B"; - } - - System.printString(header + "\n"); - - if (nthreads == 1) { - System.printString("Executing on " + nthreads + " thread\n"); - } - else { - System.printString("Executing on " + nthreads + " threads\n"); - } - - System.printString(" \n"); - } -} diff --git a/Robust/src/Benchmarks/Prefetch/Moldyn/dsm/JGFMolDynBench.java b/Robust/src/Benchmarks/Prefetch/Moldyn/dsm/JGFMolDynBench.java deleted file mode 100644 index 3fa7505b..00000000 --- a/Robust/src/Benchmarks/Prefetch/Moldyn/dsm/JGFMolDynBench.java +++ /dev/null @@ -1,696 +0,0 @@ -/************************************************************************** - * * - * Java Grande Forum Benchmark Suite - Thread Version 1.0 * - * * - * produced by * - * * - * Java Grande Benchmarking Project * - * * - * at * - * * - * Edinburgh Parallel Computing Centre * - * * - * email: epcc-javagrande@epcc.ed.ac.uk * - * * - * * - * This version copyright (c) The University of Edinburgh, 2001. * - * All rights reserved. * - * * - **************************************************************************/ -public class JGFMolDynBench { - public int ITERS; - public double LENGTH; - public double m; - public double mu; - public double kb; - public double TSIM; - public double deltat; - - public int PARTSIZE; - - public double[] epot; - public double[] vir; - public double[] ek; - - int size,mm; - int[] datasizes; - - public int interactions; - public int[] interacts; - - public int nthreads; - public JGFInstrumentor instr; - - public JGFMolDynBench(int nthreads) { - this.nthreads=nthreads; - } - - public void JGFsetsize(int size){ - this.size = size; - } - - public void JGFinitialise(){ - interactions = 0; - datasizes = global new int[2]; - datasizes[0] = 8; - datasizes[1] = 13; - - mm = datasizes[size]; - PARTSIZE = mm*mm*mm*4; - ITERS = 100; - LENGTH = 50e-10; - m = 4.0026; - mu = 1.66056e-27; - kb = 1.38066e-23; - TSIM = 50; - deltat = 5e-16; - } - - public static void JGFapplication(JGFMolDynBench mold) { - // Create new arrays - atomic { - mold.epot = global new double [mold.nthreads]; - mold.vir = global new double [mold.nthreads]; - mold.ek = global new double [mold.nthreads]; - mold.interacts = global new int [mold.nthreads]; - } - - int partsize, numthreads; - atomic { - partsize = mold.PARTSIZE; - numthreads = mold.nthreads; - } - - double sh_force [][]; - double sh_force2 [][][]; - atomic { - sh_force = global new double[3][partsize]; - sh_force2 = global new double[3][numthreads][partsize]; - } - - // spawn threads - mdRunner[] thobjects; - Barrier br; - atomic { - thobjects = global new mdRunner[numthreads]; - br= global new Barrier(numthreads); - } - - int[] mid = new int[4]; - mid[0] = (128<<24)|(195<<16)|(175<<8)|73; - mid[1] = (128<<24)|(195<<16)|(175<<8)|69; - mid[2] = (128<<24)|(195<<16)|(175<<8)|79; - mid[3] = (128<<24)|(195<<16)|(175<<8)|78; - mdRunner tmp; - - for(int i=1;i 1.0e-10 ){ - //System.printString("Validation failed\n"); - //System.printString("Kinetic Energy = " + (long)ek[0] + " " + (long)dev + " " + size + "\n"); - } - } -} - -class mdRunner extends Thread { - - double count; - int id,i,j,k,lg,mdsize,mm; - double l,rcoff,rcoffs,side,sideh,hsq,hsq2,vel,velt; - double a,r,sum,tscale,sc,ekin,ts,sp; - double den; - double tref; - double h; - double vaver,vaverh,rand; - double etot,temp,pres,rp; - double u1,u2,v1,v2,s, xx, yy, zz; - double xvelocity, yvelocity, zvelocity; - - double [][] sh_force; - double [][][] sh_force2; - - int ijk,npartm,iseed,tint; - int irep; - int istop; - int iprint; - - Barrier br; - random randnum; - JGFMolDynBench mymd; - int nthreads; - - particle[] one; - - public mdRunner(int id, int mm, double [][] sh_force, double [][][] sh_force2,Barrier br, - int nthreads, JGFMolDynBench mymd) { - this.id=id; - this.mm=mm; - this.sh_force=sh_force; - this.sh_force2=sh_force2; - this.br=br; - this.nthreads = nthreads; - this.mymd = mymd; - count = 0.0; - den = 0.83134; - tref = 0.722; - h = 0.064; - irep = 10; - istop = 19; - iprint = 10; - } - - public void run() { - - /* Parameter determination */ - - int tmpmdsize; - double tmpden; - int movemx=50; - Barrier tmpbr; - - atomic { - tmpbr=br; - mdsize = mymd.PARTSIZE; - one = global new particle[mdsize]; - l = mymd.LENGTH; - tmpmdsize = mdsize; - tmpden = den; - side = Math.pow((tmpmdsize/tmpden),0.3333333); - rcoff = mm/4.0; - - a = side/mm; - sideh = side*0.5; - hsq = h*h; - hsq2 = hsq*0.5; - npartm = tmpmdsize - 1; - rcoffs = rcoff * rcoff; - tscale = 16.0 / (1.0 * tmpmdsize - 1.0); - vaver = 1.13 * Math.sqrt(tref / 24.0); - vaverh = vaver * h; - - /* Particle Generation */ - - xvelocity = 0.0; - yvelocity = 0.0; - zvelocity = 0.0; - ijk = 0; - - for (lg=0; lg<=1; lg++) { - for (i=0; i vaverh) { count = count + 1.0; } - vel = vel + velt; - } - - vel = vel / h; - - /* temperature scale if required */ - - if((move < istop) && (((move+1) % irep) == 0)) { - sc = Math.sqrt(tref / (tscale*ekin)); - for (i=0;i side) { xcoord = xcoord - side; } - if(ycoord < 0) { ycoord = ycoord + side; } - if(ycoord > side) { ycoord = ycoord - side; } - if(zcoord < 0) { zcoord = zcoord + side; } - if(zcoord > side) { zcoord = zcoord - side; } - - xvelocity = xvelocity + sh_force[0][part_id]; - yvelocity = yvelocity + sh_force[1][part_id]; - zvelocity = zvelocity + sh_force[2][part_id]; - - } - - public void force(double side, double rcoff,int mdsize,int x, double xx, double yy, double zz, JGFMolDynBench mymd) { - - double sideh; - double rcoffs; - - double fxi,fyi,fzi; - double rd,rrd,rrd2,rrd3,rrd4,rrd6,rrd7,r148; - double forcex,forcey,forcez; - - sideh = 0.5*side; - rcoffs = rcoff*rcoff; - - fxi = 0.0; - fyi = 0.0; - fzi = 0.0; - - for (int i=x+1;i (sideh)) { xx = xx - side; } - if(yy < (-sideh)) { yy = yy + side; } - if(yy > (sideh)) { yy = yy - side; } - if(zz < (-sideh)) { zz = zz + side; } - if(zz > (sideh)) { zz = zz - side; } - - - rd = xx*xx + yy*yy + zz*zz; - - if(rd <= rcoffs) { - rrd = 1.0/rd; - rrd2 = rrd*rrd; - rrd3 = rrd2*rrd; - rrd4 = rrd2*rrd2; - rrd6 = rrd2*rrd4; - rrd7 = rrd6*rrd; - mymd.epot[id] = mymd.epot[id] + (rrd6 - rrd3); - r148 = rrd7 - 0.5*rrd4; - mymd.vir[id] = mymd.vir[id] - rd*r148; - forcex = xx * r148; - fxi = fxi + forcex; - - sh_force2[0][id][i] = sh_force2[0][id][i] - forcex; - - forcey = yy * r148; - fyi = fyi + forcey; - - sh_force2[1][id][i] = sh_force2[1][id][i] - forcey; - - forcez = zz * r148; - fzi = fzi + forcez; - - sh_force2[2][id][i] = sh_force2[2][id][i] - forcez; - - mymd.interacts[id]++; - } - - } - - sh_force2[0][id][x] = sh_force2[0][id][x] + fxi; - sh_force2[1][id][x] = sh_force2[1][id][x] + fyi; - sh_force2[2][id][x] = sh_force2[2][id][x] + fzi; - - } - - public double mkekin(double hsq2,int part_id) { - - double sumt = 0.0; - - xvelocity = xvelocity + sh_force[0][part_id]; - yvelocity = yvelocity + sh_force[1][part_id]; - zvelocity = zvelocity + sh_force[2][part_id]; - - sumt = (xvelocity*xvelocity)+(yvelocity*yvelocity)+(zvelocity*zvelocity); - return sumt; - } - - public double velavg(double vaverh,double h) { - - double velt; - double sq; - - sq = Math.sqrt(xvelocity*xvelocity + yvelocity*yvelocity + - zvelocity*zvelocity); - - velt = sq; - return velt; - } - - public void dscal(double sc,int incx) { - - xvelocity = xvelocity * sc; - yvelocity = yvelocity * sc; - zvelocity = zvelocity * sc; - - - - } - -} - -class random { - - public int iseed; - public double v1,v2; - - public random(int iseed,double v1,double v2) { - this.iseed = iseed; - this.v1 = v1; - this.v2 = v2; - } - - public double update() { - - double rand; - double scale= 4.656612875e-10; - - int is1,is2,iss2; - int imult=16807; - int imod = 2147483647; - - if (iseed<=0) { iseed = 1; } - - is2 = iseed % 32768; - is1 = (iseed-is2)/32768; - iss2 = is2 * imult; - is2 = iss2 % 32768; - is1 = (is1*imult+(iss2-is2)/32768) % (65536); - - iseed = (is1*32768+is2) % imod; - - rand = scale * iseed; - - return rand; - - } - - public double seed() { - - double s,u1,u2,r; - s = 1.0; - do { - u1 = update(); - u2 = update(); - - v1 = 2.0 * u1 - 1.0; - v2 = 2.0 * u2 - 1.0; - s = v1*v1 + v2*v2; - - } while (s >= 1.0); - - r = Math.sqrt(-2.0*Math.log(s)/s); - - return r; - - } -} - - diff --git a/Robust/src/Benchmarks/Prefetch/Moldyn/dsm/JGFMolDynBenchSizeA.java b/Robust/src/Benchmarks/Prefetch/Moldyn/dsm/JGFMolDynBenchSizeA.java deleted file mode 100644 index ca92207f..00000000 --- a/Robust/src/Benchmarks/Prefetch/Moldyn/dsm/JGFMolDynBenchSizeA.java +++ /dev/null @@ -1,84 +0,0 @@ -/************************************************************************** - * * - * Java Grande Forum Benchmark Suite - Thread Version 1.0 * - * * - * produced by * - * * - * Java Grande Benchmarking Project * - * * - * at * - * * - * Edinburgh Parallel Computing Centre * - * * - * email: epcc-javagrande@epcc.ed.ac.uk * - * * - * * - * This version copyright (c) The University of Edinburgh, 2001. * - * All rights reserved. * - * * - **************************************************************************/ -public class JGFMolDynBenchSizeA { - - public static void main(String argv[]){ - int nthreads; - if(argv.length != 0 ) { - nthreads = Integer.parseInt(argv[0]); - } else { - System.printString("The no of threads has not been specified, defaulting to 1\n"); - System.printString(" " + "\n"); - nthreads = 1; - } - - JGFInstrumentor instr = new JGFInstrumentor(); - JGFInstrumentor.printHeader(3,0,nthreads); - - JGFMolDynBench mold; - atomic { - mold = global new JGFMolDynBench(nthreads); - } - int size = 0; - JGFInstrumentor.addTimer("Section3:MolDyn:Total", "Solutions",size, instr.timers); - JGFInstrumentor.addTimer("Section3:MolDyn:Run", "Interactions",size, instr.timers); - - atomic { - mold.JGFsetsize(size); - } - - JGFInstrumentor.startTimer("Section3:MolDyn:Total", instr.timers); - - JGFMolDynBench tmp; - atomic { - mold.JGFinitialise(); - } - JGFMolDynBench.JGFapplication(mold); - - /* Validate data */ - double[] refval = new double[2]; - refval[0] = 1731.4306625334357; - refval[1] = 7397.392307839352; - double dval; - atomic { - dval = mold.ek[0]; - } - double dev = Math.fabs(dval - refval[size]); - long l = (long) refval[size] *1000000; - long r = (long) dval * 1000000; - if (l != r ){ - System.printString("Validation failed\n"); - System.printString("Kinetic Energy = " + (long)dval + " " + (long)dev + " " + size + "\n"); - } - - JGFInstrumentor.stopTimer("Section3:MolDyn:Total", instr.timers); - double interactions; - atomic { - interactions = mold.interactions; - } - - JGFInstrumentor.addOpsToTimer("Section3:MolDyn:Run", (double) interactions, instr.timers); - JGFInstrumentor.addOpsToTimer("Section3:MolDyn:Total", 1, instr.timers); - - JGFInstrumentor.printTimer("Section3:MolDyn:Run", instr.timers); - JGFInstrumentor.printTimer("Section3:MolDyn:Total", instr.timers); - } -} - diff --git a/Robust/src/Benchmarks/Prefetch/Moldyn/dsm/JGFTimer.java b/Robust/src/Benchmarks/Prefetch/Moldyn/dsm/JGFTimer.java deleted file mode 100644 index 4e1d168f..00000000 --- a/Robust/src/Benchmarks/Prefetch/Moldyn/dsm/JGFTimer.java +++ /dev/null @@ -1,123 +0,0 @@ -/************************************************************************** - * * - * Java Grande Forum Benchmark Suite - Thread Version 1.0 * - * * - * produced by * - * * - * Java Grande Benchmarking Project * - * * - * at * - * * - * Edinburgh Parallel Computing Centre * - * * - * email: epcc-javagrande@epcc.ed.ac.uk * - * * - * * - * This version copyright (c) The University of Edinburgh, 1999. * - * All rights reserved. * - * * - **************************************************************************/ - -public class JGFTimer { - - public String name; - public String opname; - public double time; - public double opcount; - public long calls; - public int size; - - private long start_time; - private boolean on; - - public JGFTimer(String name, String opname){ - this.size = -1; - this.name = name; - this.opname = opname; - reset(); - } - - public JGFTimer(String name, String opname, int size){ - this.name = name; - this.opname = opname; - this.size = size; - reset(); - } - - public JGFTimer(String name){ - this.name = name; - this.opname = ""; - reset(); - } - - - - public void start(){ - if (on) System.printString("Warning timer " + " was already turned on\n"); - on = true; - start_time = System.currentTimeMillis(); - } - - - public void stop(){ - time += (double) (System.currentTimeMillis()-start_time) / 1000.; - if (!on) System.printString("Warning timer " + " wasn't turned on\n"); - calls++; - on = false; - } - - public void addops(double count){ - opcount += count; - } - - public void addtime(double added_time){ - time += added_time; - } - - public void reset(){ - time = 0.0; - calls = 0; - opcount = 0; - on = false; - } - - public double perf(){ - return opcount / time; - } - - public void longprint(){ - System.printString("Timer Calls Time(s) Performance("+opname+"/s)\n"); - System.printString(name + " " + calls + " " + (long)time + " " + (long)this.perf() + "\n"); - } - - public void print(){ - if (opname.equals("")) { - System.printString(name + " " + (long)time + " (s)\n"); - } - else { - if(size == 0) { - System.printString(name + ":SizeA" + "\t" + (long)time + " (s) \t " + (long)this.perf() + "\t" + " ("+opname+"/s)\n"); - } else if (size == 1) { - System.printString(name + ":SizeB" + "\t" + (long)time + " (s) \t " + (long)this.perf() + "\t" + " ("+opname+"/s)\n"); - } else if (size == 2) { - System.printString(name + ":SizeC" + "\t" + (long)time + " (s) \t " + (long)this.perf() + "\t" + " ("+opname+"/s)\n"); - } else{ - System.printString(name + "\t" + (long)time + " (s) \t " + (long)this.perf() + "\t" + " ("+opname+"/s)\n"); - } - } - } - - - public void printperf(){ - - String name; - name = this.name; - - // pad name to 40 characters - while ( name.length() < 40 ) name = name + " "; - - System.printString(name + "\t" + (long)this.perf() + "\t" - + " ("+opname+"/s)\n"); - } - -} diff --git a/Robust/src/Benchmarks/Prefetch/Moldyn/dsm/TournamentBarrier.java b/Robust/src/Benchmarks/Prefetch/Moldyn/dsm/TournamentBarrier.java deleted file mode 100755 index 56259b45..00000000 --- a/Robust/src/Benchmarks/Prefetch/Moldyn/dsm/TournamentBarrier.java +++ /dev/null @@ -1,94 +0,0 @@ -/************************************************************************** - * * - * Java Grande Forum Benchmark Suite - Thread Version 1.0 * - * * - * produced by * - * * - * Java Grande Benchmarking Project * - * * - * at * - * * - * Edinburgh Parallel Computing Centre * - * * - * email: epcc-javagrande@epcc.ed.ac.uk * - * * - * * - * This version copyright (c) The University of Edinburgh, 2001. * - * All rights reserved. * - * * - **************************************************************************/ - -// This implements a simple tournament-based barrier, using entirely its -// own synchronisation. At present Yield() is called to stop busy-waiting -// processes hogging the processor(s)! - -public class TournamentBarrier { - // Array of flags indicating whether the given process and all those - // for which it is responsible have finished. The "sense" of this - // array alternates with each barrier, to prevent having to - // reinitialise. - boolean[] IsDone; - public int maxBusyIter; - int numThreads; - - public TournamentBarrier(int n) { - numThreads = n; - maxBusyIter = 1; - // Superclass constructor should record the number of threads - // and thread manager. - //super(n); - - // Initialise the IsDone array. The choice of initial value is - // arbitrary, but must be consistent! - IsDone = global new boolean[numThreads]; - for(int i = 0; i < n; i++) { - IsDone[i] = false; - } - } - - // Uses the manager's debug function, so this can only be used after - // construction! - public void debug(String s) { - // System.err.println("Debug message"); - } - - public void setMaxBusyIter(int b) { - maxBusyIter = b; - } - - public void DoBarrier(int myid) { - int b; - // debug("Thread " + myid + " checking in"); - - int roundmask = 3; - boolean donevalue = !IsDone[myid]; - - while(((myid & roundmask) == 0) && (roundmask<(numThreads<<2))) { - int spacing = (roundmask+1) >> 2; - for(int i=1; i<=3 && myid+i*spacing < numThreads; i++) { - // debug("Thread " + myid + " waiting for thread " + (myid+i*spacing)); - b = maxBusyIter; - while(IsDone[myid+i*spacing] != donevalue) { - b--; - if(b==0) { - //Thread.yield(); - b = maxBusyIter; - } - } - } - roundmask = (roundmask << 2) + 3; - } - // debug("Thread " + myid + " reporting done"); - IsDone[myid] = donevalue; - b = maxBusyIter; - while(IsDone[0] != donevalue) { - b--; - if(b==0) { - //Thread.yield(); - b = maxBusyIter; - } - } - //debug("Thread " + myid + " checking out"); - - } -} diff --git a/Robust/src/Benchmarks/Prefetch/Moldyn/dsm/makefile b/Robust/src/Benchmarks/Prefetch/Moldyn/dsm/makefile deleted file mode 100644 index f50cb0f8..00000000 --- a/Robust/src/Benchmarks/Prefetch/Moldyn/dsm/makefile +++ /dev/null @@ -1,16 +0,0 @@ -MAINCLASS=JGFMolDynBenchSizeA -SRC=${MAINCLASS}.java \ -JGFInstrumentor.java \ -JGFTimer.java \ -JGFMolDynBench.java \ -Barrier.java -FLAGS=-dsm -prefetch -excprefetch particle.force -excprefetch particle.domove -excprefetch particle.mkekin -excprefetch TournamentBarrier.DoBarrier -excprefetch JGFMolDynBench.JGFvalidate -excprefetch JGFMolDynBench.JGFapplication -optimize -debug -profile -mainclass ${MAINCLASS} -o ${MAINCLASS} -trueprob 0.8 -FLAGS2=-dsm -optimize -debug -profile -mainclass ${MAINCLASS} -o ${MAINCLASS}NP - -default: - ../../../../buildscript ${FLAGS2} ${SRC} - ../../../../buildscript ${FLAGS} ${SRC} - -clean: - rm -rf tmpbuilddirectory/ - rm *.bin diff --git a/Robust/src/Benchmarks/Prefetch/Moldyn/java/Barrier.java b/Robust/src/Benchmarks/Prefetch/Moldyn/java/Barrier.java deleted file mode 100644 index 590b3a66..00000000 --- a/Robust/src/Benchmarks/Prefetch/Moldyn/java/Barrier.java +++ /dev/null @@ -1,48 +0,0 @@ -public class Barrier { - int numthreads; - int entercount; - boolean cleared; - - public Barrier(int n) { - numthreads=n; - cleared = false; - } - - public Barrier() { - - } - - public void reset() { - cleared = false; - entercount = 0; - } - - public static void enterBarrier(Barrier b) { - int tmp; - boolean retry=true; - - do { - if (!b.cleared) { - b.entercount++; - tmp = b.entercount; - if (tmp==b.numthreads) { - if(b.numthreads > 1) - b.cleared=true; - b.entercount--; - return; - } - retry=false; - } - } while(retry); - - while(true) { - if (b.cleared) { - b.entercount--; - int count = b.entercount; - if (count==0) - b.cleared=false; - return; - } - } - } -} diff --git a/Robust/src/Benchmarks/Prefetch/Moldyn/java/JGFInstrumentor.java b/Robust/src/Benchmarks/Prefetch/Moldyn/java/JGFInstrumentor.java deleted file mode 100644 index 3f9f580c..00000000 --- a/Robust/src/Benchmarks/Prefetch/Moldyn/java/JGFInstrumentor.java +++ /dev/null @@ -1,199 +0,0 @@ -/************************************************************************** - * * - * Java Grande Forum Benchmark Suite - Thread Version 1.0 * - * * - * produced by * - * * - * Java Grande Benchmarking Project * - * * - * at * - * * - * Edinburgh Parallel Computing Centre * - * * - * email: epcc-javagrande@epcc.ed.ac.uk * - * * - * * - * This version copyright (c) The University of Edinburgh, 1999. * - * All rights reserved. * - * * - **************************************************************************/ -public class JGFInstrumentor{ - - protected HashMap timers; - protected HashMap data; - - public JGFInstrumentor() { - timers = new HashMap(); - data = new HashMap(); - } - - public static void addTimer (String name, HashMap timers){ - - if (timers.containsKey(name)) { - System.printString("JGFInstrumentor.addTimer: warning - timer " + name + - " already exists\n"); - } - else { - timers.put(name, new JGFTimer(name)); - } - } - - public static void addTimer (String name, String opname, HashMap timers){ - - if (timers.containsKey(name)) { - System.printString("JGFInstrumentor.addTimer: warning - timer " + name + - " already exists\n"); - } - else { - timers.put(name, new JGFTimer(name,opname)); - } - - } - - public static void addTimer (String name, String opname, int size, HashMap timers){ - - if (timers.containsKey(name)) { - System.printString("JGFInstrumentor.addTimer: warning - timer " + name + - " already exists\n"); - } - else { - timers.put(name, new JGFTimer(name,opname,size)); - } - - } - - public static void startTimer(String name, HashMap timers){ - if (timers.containsKey(name)) { - ((JGFTimer) timers.get(name)).start(); - } - else { - System.printString("JGFInstrumentor.startTimer: failed - timer " + name + - " does not exist\n"); - } - - } - - public static void stopTimer(String name, HashMap timers){ - if (timers.containsKey(name)) { - ((JGFTimer) timers.get(name)).stop(); - } - else { - System.printString("JGFInstrumentor.stopTimer: failed - timer " + name + - " does not exist\n"); - } - } - - public static void addOpsToTimer(String name, double count, HashMap timers){ - if (timers.containsKey(name)) { - ((JGFTimer) timers.get(name)).addops(count); - } - else { - System.printString("JGFInstrumentor.addOpsToTimer: failed - timer " + name + - " does not exist\n"); - } - } - - public static void addTimeToTimer(String name, double added_time, HashMap timers){ - if (timers.containsKey(name)) { - ((JGFTimer) timers.get(name)).addtime(added_time); - } - else { - System.printString("JGFInstrumentor.addTimeToTimer: failed - timer " + name + - " does not exist\n"); - } - - - - } - - public static double readTimer(String name, HashMap timers){ - double time; - if (timers.containsKey(name)) { - time = ((JGFTimer) timers.get(name)).time; - } - else { - System.printString("JGFInstrumentor.readTimer: failed - timer " + name + - " does not exist\n"); - time = 0.0; - } - return time; - } - - public static void resetTimer(String name, HashMap timers){ - if (timers.containsKey(name)) { - ((JGFTimer) timers.get(name)).reset(); - } - else { - System.printString("JGFInstrumentor.resetTimer: failed - timer " + name + - " does not exist\n"); - } - } - - public static void printTimer(String name, HashMap timers){ - if (timers.containsKey(name)) { - ((JGFTimer) timers.get(name)).print(); - } - else { - System.printString("JGFInstrumentor.printTimer: failed - timer " + name + - " does not exist\n"); - } - } - - public static void printperfTimer(String name, HashMap timers){ - if (timers.containsKey(name)) { - ((JGFTimer) timers.get(name)).printperf(); - } - else { - System.printString("JGFInstrumentor.printTimer: failed - timer " + name + - " does not exist\n"); - } - } - - public static void storeData(String name, Object obj, HashMap data){ - data.put(name,obj); - } - - public static void retrieveData(String name, Object obj, HashMap data){ - obj = data.get(name); - } - - public static void printHeader(int section, int size,int nthreads) { - - String header, base; - - header = ""; - base = "Java Grande Forum Thread Benchmark Suite - Version 1.0 - Section "; - - if (section == 1) - { - header = base + "1"; - } - else if (section == 2) - { - if (size == 0) - header = base + "2 - Size A"; - else if (size == 1) - header = base + "2 - Size B"; - else if (size == 2) - header = base + "2 - Size C"; - } - else if (section == 3) - { - if (size == 0) - header = base + "3 - Size A"; - else if (size == 1) - header = base + "3 - Size B"; - } - - System.printString(header + "\n"); - - if (nthreads == 1) { - System.printString("Executing on " + nthreads + " thread\n"); - } - else { - System.printString("Executing on " + nthreads + " threads\n"); - } - - System.printString(" \n"); - } -} diff --git a/Robust/src/Benchmarks/Prefetch/Moldyn/java/JGFMolDynBench.java b/Robust/src/Benchmarks/Prefetch/Moldyn/java/JGFMolDynBench.java deleted file mode 100644 index 0f7b8a77..00000000 --- a/Robust/src/Benchmarks/Prefetch/Moldyn/java/JGFMolDynBench.java +++ /dev/null @@ -1,697 +0,0 @@ -/************************************************************************** - * * - * Java Grande Forum Benchmark Suite - Thread Version 1.0 * - * * - * produced by * - * * - * Java Grande Benchmarking Project * - * * - * at * - * * - * Edinburgh Parallel Computing Centre * - * * - * email: epcc-javagrande@epcc.ed.ac.uk * - * * - * * - * This version copyright (c) The University of Edinburgh, 2001. * - * All rights reserved. * - * * - **************************************************************************/ -public class JGFMolDynBench { - public int ITERS; - public double LENGTH; - public double m; - public double mu; - public double kb; - public double TSIM; - public double deltat; - - public int PARTSIZE; - - public double[] epot; - public double[] vir; - public double[] ek; - - int size,mm; - int[] datasizes; - - public int interactions; - public int[] interacts; - - public int nthreads; - public JGFInstrumentor instr; - - public JGFMolDynBench(int nthreads) { - this.nthreads=nthreads; - } - - public void JGFsetsize(int size){ - this.size = size; - } - - public void JGFinitialise(){ - interactions = 0; - datasizes = new int[2]; - datasizes[0] = 8; - datasizes[1] = 13; - - mm = datasizes[size]; - PARTSIZE = mm*mm*mm*4; - ITERS = 100; - LENGTH = 50e-10; - m = 4.0026; - mu = 1.66056e-27; - kb = 1.38066e-23; - TSIM = 50; - deltat = 5e-16; - } - - public static void JGFapplication(JGFMolDynBench mold) { - // Create new arrays - mold.epot = new double [mold.nthreads]; - mold.vir = new double [mold.nthreads]; - mold.ek = new double [mold.nthreads]; - mold.interacts = new int [mold.nthreads]; - - int partsize, numthreads; - partsize = mold.PARTSIZE; - numthreads = mold.nthreads; - - double sh_force [][]; - double sh_force2 [][][]; - sh_force = new double[3][partsize]; - sh_force2 = new double[3][numthreads][partsize]; - - // spawn threads - mdRunner[] thobjects; - Barrier br; - thobjects = new mdRunner[numthreads]; - br= new Barrier(numthreads); - - int[] mid = new int[2]; - mid[0] = (128<<24)|(195<<16)|(175<<8)|73; - mid[1] = (128<<24)|(195<<16)|(175<<8)|69; - mdRunner tmp; - - for(int i=1;i 1.0e-10 ){ - //System.printString("Validation failed\n"); - //System.printString("Kinetic Energy = " + (long)ek[0] + " " + (long)dev + " " + size + "\n"); - } - } -} - -class mdRunner extends Thread { - - double count; - int id,i,j,k,lg,mdsize,mm; - double l,rcoff,rcoffs,side,sideh,hsq,hsq2,vel,velt; - double a,r,sum,tscale,sc,ekin,ts,sp; - double den; - double tref; - double h; - double vaver,vaverh,rand; - double etot,temp,pres,rp; - double u1,u2,v1,v2,s, xx, yy, zz; - double xvelocity, yvelocity, zvelocity; - - double [][] sh_force; - double [][][] sh_force2; - - int ijk,npartm,iseed,tint; - int irep; - int istop; - int iprint; - - Barrier br; - random randnum; - JGFMolDynBench mymd; - int nthreads; - - particle[] one; - - public mdRunner(int id, int mm, double [][] sh_force, double [][][] sh_force2,Barrier br, - int nthreads, JGFMolDynBench mymd) { - this.id=id; - this.mm=mm; - this.sh_force=sh_force; - this.sh_force2=sh_force2; - this.br=br; - this.nthreads = nthreads; - this.mymd = mymd; - count = 0.0; - den = 0.83134; - tref = 0.722; - h = 0.064; - irep = 10; - istop = 19; - iprint = 10; - } - - public void run() { - - //System.printString("Start run method\n"); - - /* Parameter determination */ - - int tmpmdsize; - double tmpden; - int movemx=50; - Barrier tmpbr; - - tmpbr=br; - mdsize = mymd.PARTSIZE; - one = new particle[mdsize]; - l = mymd.LENGTH; - tmpmdsize = mdsize; - tmpden = den; - side = Math.pow((tmpmdsize/tmpden),0.3333333); - rcoff = mm/4.0; - - a = side/mm; - sideh = side*0.5; - hsq = h*h; - hsq2 = hsq*0.5; - npartm = tmpmdsize - 1; - rcoffs = rcoff * rcoff; - tscale = 16.0 / (1.0 * tmpmdsize - 1.0); - vaver = 1.13 * Math.sqrt(tref / 24.0); - vaverh = vaver * h; - - /* Particle Generation */ - - xvelocity = 0.0; - yvelocity = 0.0; - zvelocity = 0.0; - ijk = 0; - - for (lg=0; lg<=1; lg++) { - for (i=0; i vaverh) { count = count + 1.0; } - vel = vel + velt; - } - - vel = vel / h; - - /* temperature scale if required */ - - if((move < istop) && (((move+1) % irep) == 0)) { - sc = Math.sqrt(tref / (tscale*ekin)); - for (i=0;i side) { xcoord = xcoord - side; } - if(ycoord < 0) { ycoord = ycoord + side; } - if(ycoord > side) { ycoord = ycoord - side; } - if(zcoord < 0) { zcoord = zcoord + side; } - if(zcoord > side) { zcoord = zcoord - side; } - - xvelocity = xvelocity + sh_force[0][part_id]; - yvelocity = yvelocity + sh_force[1][part_id]; - zvelocity = zvelocity + sh_force[2][part_id]; - - } - - public void force(double side, double rcoff,int mdsize,int x, double xx, double yy, double zz, JGFMolDynBench mymd) { - - double sideh; - double rcoffs; - - double fxi,fyi,fzi; - double rd,rrd,rrd2,rrd3,rrd4,rrd6,rrd7,r148; - double forcex,forcey,forcez; - - sideh = 0.5*side; - rcoffs = rcoff*rcoff; - - fxi = 0.0; - fyi = 0.0; - fzi = 0.0; - - for (int i=x+1;i (sideh)) { xx = xx - side; } - if(yy < (-sideh)) { yy = yy + side; } - if(yy > (sideh)) { yy = yy - side; } - if(zz < (-sideh)) { zz = zz + side; } - if(zz > (sideh)) { zz = zz - side; } - - - rd = xx*xx + yy*yy + zz*zz; - - if(rd <= rcoffs) { - rrd = 1.0/rd; - rrd2 = rrd*rrd; - rrd3 = rrd2*rrd; - rrd4 = rrd2*rrd2; - rrd6 = rrd2*rrd4; - rrd7 = rrd6*rrd; - mymd.epot[id] = mymd.epot[id] + (rrd6 - rrd3); - r148 = rrd7 - 0.5*rrd4; - mymd.vir[id] = mymd.vir[id] - rd*r148; - forcex = xx * r148; - fxi = fxi + forcex; - - sh_force2[0][id][i] = sh_force2[0][id][i] - forcex; - - forcey = yy * r148; - fyi = fyi + forcey; - - sh_force2[1][id][i] = sh_force2[1][id][i] - forcey; - - forcez = zz * r148; - fzi = fzi + forcez; - - sh_force2[2][id][i] = sh_force2[2][id][i] - forcez; - - mymd.interacts[id]++; - } - - } - - sh_force2[0][id][x] = sh_force2[0][id][x] + fxi; - sh_force2[1][id][x] = sh_force2[1][id][x] + fyi; - sh_force2[2][id][x] = sh_force2[2][id][x] + fzi; - - } - - public double mkekin(double hsq2,int part_id) { - - double sumt = 0.0; - - xvelocity = xvelocity + sh_force[0][part_id]; - yvelocity = yvelocity + sh_force[1][part_id]; - zvelocity = zvelocity + sh_force[2][part_id]; - - sumt = (xvelocity*xvelocity)+(yvelocity*yvelocity)+(zvelocity*zvelocity); - return sumt; - } - - public double velavg(double vaverh,double h) { - - double velt; - double sq; - - sq = Math.sqrt(xvelocity*xvelocity + yvelocity*yvelocity + - zvelocity*zvelocity); - - velt = sq; - return velt; - } - - public void dscal(double sc,int incx) { - - xvelocity = xvelocity * sc; - yvelocity = yvelocity * sc; - zvelocity = zvelocity * sc; - - - - } - -} - -class random { - - public int iseed; - public double v1,v2; - - public random(int iseed,double v1,double v2) { - this.iseed = iseed; - this.v1 = v1; - this.v2 = v2; - } - - public double update() { - - double rand; - double scale= 4.656612875e-10; - - int is1,is2,iss2; - int imult=16807; - int imod = 2147483647; - - if (iseed<=0) { iseed = 1; } - - is2 = iseed % 32768; - is1 = (iseed-is2)/32768; - iss2 = is2 * imult; - is2 = iss2 % 32768; - is1 = (is1*imult+(iss2-is2)/32768) % (65536); - - iseed = (is1*32768+is2) % imod; - - rand = scale * iseed; - - return rand; - - } - - public double seed() { - - double s,u1,u2,r; - s = 1.0; - do { - u1 = update(); - u2 = update(); - - v1 = 2.0 * u1 - 1.0; - v2 = 2.0 * u2 - 1.0; - s = v1*v1 + v2*v2; - - } while (s >= 1.0); - - r = Math.sqrt(-2.0*Math.log(s)/s); - - return r; - - } -} - - diff --git a/Robust/src/Benchmarks/Prefetch/Moldyn/java/JGFMolDynBenchSizeA.java b/Robust/src/Benchmarks/Prefetch/Moldyn/java/JGFMolDynBenchSizeA.java deleted file mode 100644 index 51b52f24..00000000 --- a/Robust/src/Benchmarks/Prefetch/Moldyn/java/JGFMolDynBenchSizeA.java +++ /dev/null @@ -1,81 +0,0 @@ -/************************************************************************** - * * - * Java Grande Forum Benchmark Suite - Thread Version 1.0 * - * * - * produced by * - * * - * Java Grande Benchmarking Project * - * * - * at * - * * - * Edinburgh Parallel Computing Centre * - * * - * email: epcc-javagrande@epcc.ed.ac.uk * - * * - * * - * This version copyright (c) The University of Edinburgh, 2001. * - * All rights reserved. * - * * - **************************************************************************/ -public class JGFMolDynBenchSizeA { - - public static void main(String argv[]){ - int nthreads; - if(argv.length != 0 ) { - nthreads = Integer.parseInt(argv[0]); - } else { - System.printString("The no of threads has not been specified, defaulting to 1\n"); - System.printString(" " + "\n"); - nthreads = 1; - } - - JGFInstrumentor instr = new JGFInstrumentor(); - JGFInstrumentor.printHeader(3,0,nthreads); - - JGFMolDynBench mold; - mold = new JGFMolDynBench(nthreads); - int size = 0; - JGFInstrumentor.addTimer("Section3:MolDyn:Total", "Solutions",size, instr.timers); - JGFInstrumentor.addTimer("Section3:MolDyn:Run", "Interactions",size, instr.timers); - - mold.JGFsetsize(size); - - JGFInstrumentor.startTimer("Section3:MolDyn:Total", instr.timers); - - JGFMolDynBench tmp; - mold.JGFinitialise(); - JGFMolDynBench.JGFapplication(mold); - /* Validate data */ - double[] refval = new double[2]; - refval[0] = 1731.4306625334357; - refval[1] = 7397.392307839352; - double dval; - //System.printString("Here #1\n"); - dval = mold.ek[0]; - //System.printString("Here #2\n"); - double dev = Math.fabs(dval - refval[size]); - //long ldev = (long)dev * 1000000; - //System.printString("ldev= "+ldev); - //long ltmp = (long)1.0e-10 * 1000000; - //System.printString("ltmp= "+ltmp); - if (dev > 1.0e-10 ){ - //if (ldev > ltmp ){ - System.printString("Validation failed\n"); - System.printString("Kinetic Energy = " + (long)dval + " " + (long)dev + " " + size + "\n"); - } - System.printString("End of JGFvalidate\n"); - - JGFInstrumentor.stopTimer("Section3:MolDyn:Total", instr.timers); - double interactions; - System.printString("Here #3\n"); - interactions = mold.interactions; - System.printString("Here #4\n"); - - JGFInstrumentor.addOpsToTimer("Section3:MolDyn:Run", (double) interactions, instr.timers); - JGFInstrumentor.addOpsToTimer("Section3:MolDyn:Total", 1, instr.timers); - - JGFInstrumentor.printTimer("Section3:MolDyn:Run", instr.timers); - JGFInstrumentor.printTimer("Section3:MolDyn:Total", instr.timers); - } -} - diff --git a/Robust/src/Benchmarks/Prefetch/Moldyn/java/JGFTimer.java b/Robust/src/Benchmarks/Prefetch/Moldyn/java/JGFTimer.java deleted file mode 100644 index 4e1d168f..00000000 --- a/Robust/src/Benchmarks/Prefetch/Moldyn/java/JGFTimer.java +++ /dev/null @@ -1,123 +0,0 @@ -/************************************************************************** - * * - * Java Grande Forum Benchmark Suite - Thread Version 1.0 * - * * - * produced by * - * * - * Java Grande Benchmarking Project * - * * - * at * - * * - * Edinburgh Parallel Computing Centre * - * * - * email: epcc-javagrande@epcc.ed.ac.uk * - * * - * * - * This version copyright (c) The University of Edinburgh, 1999. * - * All rights reserved. * - * * - **************************************************************************/ - -public class JGFTimer { - - public String name; - public String opname; - public double time; - public double opcount; - public long calls; - public int size; - - private long start_time; - private boolean on; - - public JGFTimer(String name, String opname){ - this.size = -1; - this.name = name; - this.opname = opname; - reset(); - } - - public JGFTimer(String name, String opname, int size){ - this.name = name; - this.opname = opname; - this.size = size; - reset(); - } - - public JGFTimer(String name){ - this.name = name; - this.opname = ""; - reset(); - } - - - - public void start(){ - if (on) System.printString("Warning timer " + " was already turned on\n"); - on = true; - start_time = System.currentTimeMillis(); - } - - - public void stop(){ - time += (double) (System.currentTimeMillis()-start_time) / 1000.; - if (!on) System.printString("Warning timer " + " wasn't turned on\n"); - calls++; - on = false; - } - - public void addops(double count){ - opcount += count; - } - - public void addtime(double added_time){ - time += added_time; - } - - public void reset(){ - time = 0.0; - calls = 0; - opcount = 0; - on = false; - } - - public double perf(){ - return opcount / time; - } - - public void longprint(){ - System.printString("Timer Calls Time(s) Performance("+opname+"/s)\n"); - System.printString(name + " " + calls + " " + (long)time + " " + (long)this.perf() + "\n"); - } - - public void print(){ - if (opname.equals("")) { - System.printString(name + " " + (long)time + " (s)\n"); - } - else { - if(size == 0) { - System.printString(name + ":SizeA" + "\t" + (long)time + " (s) \t " + (long)this.perf() + "\t" + " ("+opname+"/s)\n"); - } else if (size == 1) { - System.printString(name + ":SizeB" + "\t" + (long)time + " (s) \t " + (long)this.perf() + "\t" + " ("+opname+"/s)\n"); - } else if (size == 2) { - System.printString(name + ":SizeC" + "\t" + (long)time + " (s) \t " + (long)this.perf() + "\t" + " ("+opname+"/s)\n"); - } else{ - System.printString(name + "\t" + (long)time + " (s) \t " + (long)this.perf() + "\t" + " ("+opname+"/s)\n"); - } - } - } - - - public void printperf(){ - - String name; - name = this.name; - - // pad name to 40 characters - while ( name.length() < 40 ) name = name + " "; - - System.printString(name + "\t" + (long)this.perf() + "\t" - + " ("+opname+"/s)\n"); - } - -} diff --git a/Robust/src/Benchmarks/Prefetch/Moldyn/java/TournamentBarrier.java b/Robust/src/Benchmarks/Prefetch/Moldyn/java/TournamentBarrier.java deleted file mode 100755 index 96bf4f51..00000000 --- a/Robust/src/Benchmarks/Prefetch/Moldyn/java/TournamentBarrier.java +++ /dev/null @@ -1,96 +0,0 @@ -/************************************************************************** - * * - * Java Grande Forum Benchmark Suite - Thread Version 1.0 * - * * - * produced by * - * * - * Java Grande Benchmarking Project * - * * - * at * - * * - * Edinburgh Parallel Computing Centre * - * * - * email: epcc-javagrande@epcc.ed.ac.uk * - * * - * * - * This version copyright (c) The University of Edinburgh, 2001. * - * All rights reserved. * - * * - **************************************************************************/ - -// This implements a simple tournament-based barrier, using entirely its -// own synchronisation. At present Yield() is called to stop busy-waiting -// processes hogging the processor(s)! - -public class TournamentBarrier { - // Array of flags indicating whether the given process and all those - // for which it is responsible have finished. The "sense" of this - // array alternates with each barrier, to prevent having to - // reinitialise. - boolean[] IsDone; - public int maxBusyIter; - int numThreads; - - public TournamentBarrier(int n) { - numThreads = n; - maxBusyIter = 1; - // Superclass constructor should record the number of threads - // and thread manager. - //super(n); - - // Initialise the IsDone array. The choice of initial value is - // arbitrary, but must be consistent! - IsDone = new boolean[numThreads]; - for(int i = 0; i < n; i++) { - IsDone[i] = false; - } - } - - // Uses the manager's debug function, so this can only be used after - // construction! - public void debug(String s) { - //System.err.println("Debug message" + s); - } - - /* - public void setMaxBusyIter(int b) { - maxBusyIter = b; - } - */ - - public void DoBarrier(int myid) { - int b; - //debug("Thread " + myid + " checking in"); - - int roundmask = 3; - boolean donevalue = !IsDone[myid]; - - while(((myid & roundmask) == 0) && (roundmask<(numThreads<<2))) { - int spacing = (roundmask+1) >> 2; - for(int i=1; i<=3 && myid+i*spacing < numThreads; i++) { - //debug("Thread " + myid + " waiting for thread " + (myid+i*spacing)); - b = maxBusyIter; - while(IsDone[myid+i*spacing] != donevalue) { - b--; - if(b==0) { - //Thread.yield(); - b = maxBusyIter; - } - } - } - roundmask = (roundmask << 2) + 3; - } - //debug("Thread " + myid + " reporting done"); - IsDone[myid] = donevalue; - b = maxBusyIter; - while(IsDone[0] != donevalue) { - b--; - if(b==0) { - //Thread.yield(); - b = maxBusyIter; - } - } - //debug("Thread " + myid + " checking out"); - - } -} diff --git a/Robust/src/Benchmarks/Prefetch/Moldyn/java/makefile b/Robust/src/Benchmarks/Prefetch/Moldyn/java/makefile deleted file mode 100644 index 7589d000..00000000 --- a/Robust/src/Benchmarks/Prefetch/Moldyn/java/makefile +++ /dev/null @@ -1,26 +0,0 @@ - -#SRC = JGFMolDynBenchSizeA -#default: -# javac ${SRC}.java -#run: -# java ${SRC} 2 -# -#clean: -# rm *.class - -MAINCLASS=JGFMolDynBenchSizeA -SRC=${MAINCLASS}.java \ -JGFInstrumentor.java \ -JGFTimer.java \ -JGFMolDynBench.java \ -Barrier.java -#FLAGS=-dsm -prefetch -excprefetch particle.force -excprefetch particle.domove -excprefetch particle.mkekin -excprefetch TournamentBarrier.DoBarrier -excprefetch JGFMolDynBench.JGFvalidate -excprefetch JGFMolDynBench.JGFapplication -optimize -debug -profile -mainclass ${MAINCLASS} -o ${MAINCLASS} -trueprob 0.8 -FLAGS2= -thread -mainclass ${MAINCLASS} -o ${MAINCLASS}NP - -default: - ../../../../buildscript ${FLAGS2} ${SRC} -# ../../../../buildscript ${FLAGS} ${SRC} - -clean: - rm -rf tmpbuilddirectory/ - rm *.bin diff --git a/Robust/src/Benchmarks/Prefetch/SOR/dsm/JGFInstrumentor.java b/Robust/src/Benchmarks/Prefetch/SOR/dsm/JGFInstrumentor.java deleted file mode 100644 index 5e89ddb9..00000000 --- a/Robust/src/Benchmarks/Prefetch/SOR/dsm/JGFInstrumentor.java +++ /dev/null @@ -1,199 +0,0 @@ -/************************************************************************** - * * - * Java Grande Forum Benchmark Suite - Thread Version 1.0 * - * * - * produced by * - * * - * Java Grande Benchmarking Project * - * * - * at * - * * - * Edinburgh Parallel Computing Centre * - * * - * email: epcc-javagrande@epcc.ed.ac.uk * - * * - * * - * This version copyright (c) The University of Edinburgh, 1999. * - * All rights reserved. * - * * - **************************************************************************/ -public class JGFInstrumentor{ - - protected HashMap timers; - protected HashMap data; - - public JGFInstrumentor() { - timers = new HashMap(); - data = new HashMap(); - } - - public static void addTimer (String name, HashMap timers){ - - if (timers.containsKey(name)) { - System.printString("JGFInstrumentor.addTimer: warning - timer " + name + - " already exists\n"); - } - else { - timers.put(name, new JGFTimer(name)); - } - } - - public static void addTimer (String name, String opname, HashMap timers){ - - if (timers.containsKey(name)) { - System.printString("JGFInstrumentor.addTimer: warning - timer " + name + - " already exists\n"); - } - else { - timers.put(name, new JGFTimer(name,opname)); - } - - } - - public static void addTimer (String name, String opname, int size, HashMap timers){ - - if (timers.containsKey(name)) { - System.printString("JGFInstrumentor.addTimer: warning - timer " + name + - " already exists\n"); - } - else { - timers.put(name, new JGFTimer(name,opname,size)); - } - - } - - public static void startTimer(String name, HashMap timers){ - if (timers.containsKey(name)) { - ((JGFTimer) timers.get(name)).start(); - } - else { - System.printString("JGFInstrumentor.startTimer: failed - timer " + name + - " does not exist\n"); - } - - } - - public static void stopTimer(String name, HashMap timers){ - if (timers.containsKey(name)) { - ((JGFTimer) timers.get(name)).stop(); - } - else { - System.printString("JGFInstrumentor.stopTimer: failed - timer " + name + - " does not exist\n"); - } - } - - public static void addOpsToTimer(String name, double count, HashMap timers){ - if (timers.containsKey(name)) { - ((JGFTimer) timers.get(name)).addops(count); - } - else { - System.printString("JGFInstrumentor.addOpsToTimer: failed - timer " + name + - " does not exist\n"); - } - } - - public static void addTimeToTimer(String name, double added_time, HashMap timers){ - if (timers.containsKey(name)) { - ((JGFTimer) timers.get(name)).addtime(added_time); - } - else { - System.printString("JGFInstrumentor.addTimeToTimer: failed - timer " + name + - " does not exist\n"); - } - - - - } - - public static double readTimer(String name, HashMap timers){ - double time; - if (timers.containsKey(name)) { - time = ((JGFTimer) timers.get(name)).time; - } - else { - System.printString("JGFInstrumentor.readTimer: failed - timer " + name + - " does not exist\n"); - time = 0.0; - } - return time; - } - - public static void resetTimer(String name, HashMap timers){ - if (timers.containsKey(name)) { - ((JGFTimer) timers.get(name)).reset(); - } - else { - System.printString("JGFInstrumentor.resetTimer: failed - timer " + name + - " does not exist\n"); - } - } - - public static void printTimer(String name, HashMap timers){ - if (timers.containsKey(name)) { - ((JGFTimer) timers.get(name)).print(); - } - else { - System.printString("JGFInstrumentor.printTimer: failed - timer " + name + - " does not exist\n"); - } - } - - public static void printperfTimer(String name, HashMap timers){ - if (timers.containsKey(name)) { - ((JGFTimer) timers.get(name)).printperf(); - } - else { - System.printString("JGFInstrumentor.printTimer: failed - timer " + name + - " does not exist\n"); - } - } - - public static void storeData(String name, Object obj, HashMap data){ - data.put(name,obj); - } - - public static void retrieveData(String name, Object obj, HashMap data){ - obj = data.get(name); - } - - public static void printHeader(int section, int size,int nthreads) { - - String header, base; - - header = ""; - base = "Java Grande Forum Thread Benchmark Suite - Version 1.0 - Section "; - - if (section == 1) - { - header = base + "1"; - } - else if (section == 2) - { - if (size == 0) - header = base + "2 - Size A"; - else if (size == 1) - header = base + "2 - Size B"; - else if (size == 2) - header = base + "2 - Size C"; - } - else if (section == 3) - { - if (size == 0) - header = base + "3 - Size A"; - else if (size == 1) - header = base + "3 - Size B"; - } - - System.printString(header+"\n"); - - if (nthreads == 1) { - System.printString("Executing on " + nthreads + " thread\n"); - } - else { - System.printString("Executing on " + nthreads + " threads\n"); - } - - System.printString("\n"); - } -} diff --git a/Robust/src/Benchmarks/Prefetch/SOR/dsm/JGFSORBench.java b/Robust/src/Benchmarks/Prefetch/SOR/dsm/JGFSORBench.java deleted file mode 100644 index c4cae028..00000000 --- a/Robust/src/Benchmarks/Prefetch/SOR/dsm/JGFSORBench.java +++ /dev/null @@ -1,124 +0,0 @@ -/************************************************************************** - * * - * Java Grande Forum Benchmark Suite - Thread Version 1.0 * - * * - * produced by * - * * - * Java Grande Benchmarking Project * - * * - * at * - * * - * Edinburgh Parallel Computing Centre * - * * - * email: epcc-javagrande@epcc.ed.ac.uk * - * * - * * - * This version copyright (c) The University of Edinburgh, 2001. * - * All rights reserved. * - * * - **************************************************************************/ -public class JGFSORBench { - - int size; - int[] datasizes; - int JACOBI_NUM_ITER; - long RANDOM_SEED; - public int nthreads; - public double Gtotal; - - public JGFSORBench(int nthreads){ - this.nthreads = nthreads; - datasizes = global new int[3]; - datasizes[0] = 1000; - datasizes[1] = 1500; - datasizes[2] = 2000; - JACOBI_NUM_ITER = 100; - RANDOM_SEED = 10101010; - Gtotal = 0.0; - } - - public void JGFsetsize(int size){ - this.size = size; - } - - public static void JGFkernel(JGFSORBench sor) { - int numthreads, datasize; - BarrierServer mybarr; - - int[] mid = new int[4]; - mid[0] = (128<<24)|(195<<16)|(175<<8)|79; - mid[1] = (128<<24)|(195<<16)|(175<<8)|73; - mid[2] = (128<<24)|(195<<16)|(175<<8)|78; - mid[3] = (128<<24)|(195<<16)|(175<<8)|69; - - double[][] G; - int num_iterations; - - atomic { - numthreads = sor.nthreads; - datasize = sor.datasizes[sor.size]; - mybarr = global new BarrierServer(numthreads); - G = global new double[datasize][]; - num_iterations = sor.JACOBI_NUM_ITER; - } - mybarr.start(mid[0]); - - double omega = 1.25; - double omega_over_four = omega * 0.25; - double one_minus_omega = 1.0 - omega; - - // update interior points - // - //spawn threads - - SORWrap[] thobjects = new SORWrap[numthreads]; - - atomic { - for(int i=0;i Mm1) iupper = Mm1+1; - if (tmpid == (numthreads-1)) iupper = Mm1+1; - G[0]=global new double[N]; - for(int i=ilow;i Mm1) iupper = Mm1+1; - if (tmpid == (numthreads-1)) iupper = Mm1+1; - - for (int p=-2; p<2*numiterations; p++) { - if (p<0) { - int l=ilow; - if (l==1) - l=0; - if (p==-2) { - atomic { - S=global new double[iupper-l][N]; - for (int i=l; i 1.0e-12 ){ - System.out.println("Validation failed"); - System.out.println("Gtotal = " + Gtotal + " " + dev + " " + size); - } - } - - /* - public void JGFtidyup(){ - System.gc(); - } - - public void JGFrun(int size){ - - - JGFInstrumentor.addTimer("Section2:SOR:Kernel", "Iterations",size); - - JGFsetsize(size); - JGFinitialise(); - JGFkernel(); - JGFvalidate(); - JGFtidyup(); - - - JGFInstrumentor.addOpsToTimer("Section2:SOR:Kernel", (double) (JACOBI_NUM_ITER)); - - JGFInstrumentor.printTimer("Section2:SOR:Kernel"); - } - */ - - public double[][] RandomMatrix(int M, int N, Random R) - { - double A[][] = new double[M][N]; - - for (int i=0; i Mm1) iupper = Mm1+1; - if (id == (nthreads-1)) iupper = Mm1+1; - - for (int p=0; p<2*num_iterations; p++) { - for (int i=ilow+(p%2); i 0) { - while (sync[id-1][0] < sync[id][0]) ; - } - if (id < nthreads -1) { - while (sync[id+1][0] < sync[id][0]) ; - } - } - - } -} diff --git a/Robust/src/Benchmarks/Prefetch/SOR/java/makefile b/Robust/src/Benchmarks/Prefetch/SOR/java/makefile deleted file mode 100644 index ce11392a..00000000 --- a/Robust/src/Benchmarks/Prefetch/SOR/java/makefile +++ /dev/null @@ -1,8 +0,0 @@ -SRC = JGFSORBenchSizeA -default: - javac ${SRC}.java -run: - java ${SRC} 2 - -clean: - rm *.class diff --git a/Robust/src/Benchmarks/Prefetch/avg.sh b/Robust/src/Benchmarks/Prefetch/avg.sh deleted file mode 100755 index 0ad9d4e1..00000000 --- a/Robust/src/Benchmarks/Prefetch/avg.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/sh - -for file in `ls runlog/*.txt` -do - echo -n $file - cat $file | awk '{sum += $1} END {print " "sum/NR}' -done diff --git a/Robust/src/Benchmarks/Prefetch/bm.txt b/Robust/src/Benchmarks/Prefetch/bm.txt deleted file mode 100644 index 31331325..00000000 --- a/Robust/src/Benchmarks/Prefetch/bm.txt +++ /dev/null @@ -1,7 +0,0 @@ -JGFSORBenchSizeA:SOR/dsm::2:3:4:sorverA -JGFLUFactBenchSizeA:LUFact/dsm::2:4:lufactverA -MatrixMultiply:MatrixMultiply:1 200 30:2 200 30:3 200 30:4 200 30:mmver200 -MatrixMultiply:MatrixMultiply:1 600:2 600:3 600:4 600:mmver600 -Em3d:Em3d/dsm:-T 1 -N 4000 -d 130 -p -i 3:-T 2 -N 4000 -d 130 -p -i 3:-T 3 -N 4000 -d 130 -p -i 3:-T 4 -N 4000 -d 130 -p -i 3:em3dver40001303 -Chase:Chase:::::chase -Array:Array:::::array diff --git a/Robust/src/Benchmarks/Prefetch/run.sh b/Robust/src/Benchmarks/Prefetch/run.sh deleted file mode 100755 index f0bf7635..00000000 --- a/Robust/src/Benchmarks/Prefetch/run.sh +++ /dev/null @@ -1,154 +0,0 @@ -#!/bin/sh - -MACHINES2='dw-9.eecs.uci.edu' -MACHINES3='dw-9.eecs.uci.edu dw-5.eecs.uci.edu' -MACHINES4='dw-9.eecs.uci.edu dw-5.eecs.uci.edu dw-7.eecs.uci.edu' -LOGDIR=/home/adash/research/Robust/src/Benchmarks/Prefetch/runlog -TOPDIR=`pwd` - -function run { - i=0; - DIR=`pwd` - while [ $i -lt $1 ]; do - echo "$DIR" > ~/.tmpdir - echo "bin=$3" > ~/.tmpvars - if [ $2 -eq 2 ]; then - arg=$ARGS2 - MACHINES=$MACHINES2 - fi - if [ $2 -eq 3 ]; then - arg=$ARGS3 - MACHINES=$MACHINES3 - fi - if [ $2 -eq 4 ]; then - arg=$ARGS4 - MACHINES=$MACHINES4 - fi - chmod +x ~/.tmpvars - for machine in `echo $MACHINES` - do - ssh ${machine} 'cd `cat ~/.tmpdir`; source ~/.tmpvars; ./$bin' & - echo "" - done - sleep 5 - /usr/bin/time -f "%e" ./$3 master $arg 2>> ${LOGDIR}/${3}_${EXTENSION}.txt - echo "Terminating ... " - for machine in `echo $MACHINES` - do - ssh ${machine} 'source ~/.tmpvars; killall $bin' - done - sleep 2 - i=`expr $i + 1` - done -} - -function oneremote { - i=0; - DIR=`pwd` - while [ $i -lt $1 ]; do - echo "$DIR" > ~/.tmpdir - echo "bin=$3" > ~/.tmpvars - echo "arg='$ARGS1'" > ~/.tmpargs - echo "logd=$LOGDIR" > ~/.tmplogdir - echo "ext=$EXTENSION" > ~/.tmpext - ./$3 & - ssh $MACHINES2 'cd `cat ~/.tmpdir`; source ~/.tmpvars; source ~/.tmpargs; source ~/.tmplogdir; source ~/.tmpext; /usr/bin/time -f "%e" ./$bin master $arg 2>> ${logd}/${bin}_remote_${ext}.txt' - echo "Terminating ... " - killall $3 - sleep 2 - i=`expr $i + 1` - done -} - -function localrun { - i=0; - while [ $i -lt $1 ]; do - /usr/bin/time -f "%e" ./${NONPREFETCH} master $ARGS1 2>> ${LOGDIR}/${NONPREFETCH}_local_${EXTENSION}.txt - sleep 4 - i=`expr $i + 1` - done -} - -function callrun { - PREFETCH=${BENCHMARK}1.bin - NONPREFETCH=${BENCHMARK}1NP.bin - PREFETCH2=${BENCHMARK}2.bin - NONPREFETCH2=${BENCHMARK}2NP.bin - PREFETCH3=${BENCHMARK}3.bin - NONPREFETCH3=${BENCHMARK}3NP.bin - PREFETCH4=${BENCHMARK}4.bin - NONPREFETCH4=${BENCHMARK}4NP.bin - cd $BMDIR - - echo "---------- Running local $BMDIR non-prefetch on 1 machine ---------- " - localrun 10 - - echo "---------- Running single thread remote $BMDIR non-prefetch on 2 machines ---------- " - oneremote 10 1 $NONPREFETCH - echo "---------- Running single thread remote $BMDIR prefetch on 2 machines ---------- " - oneremote 10 1 $PREFETCH - - echo "---------- Running two threads $BMDIR non-prefetch on 2 machines ---------- " - run 10 2 $NONPREFETCH2 - echo "---------- Running two threads $BMDIR prefetch on 2 machines ---------- " - run 10 2 $PREFETCH2 - - echo "---------- Running three threads $BMDIR non-prefetch on 3 machines ---------- " - run 10 3 $NONPREFETCH3 - echo "---------- Running three threads $BMDIR prefetch on 3 machines ---------- " - run 10 3 $PREFETCH3 - - echo "---------- Running four threads $BMDIR non-prefetch on 4 machines ---------- " - run 10 4 $NONPREFETCH4 - echo "---------- Running four threads $BMDIR prefetch on 4 machines ---------- " - run 10 4 $PREFETCH4 - - cd $TOPDIR -} - -function callmicrorun { - PREFETCH=${BENCHMARK}1.bin - NONPREFETCH=${BENCHMARK}1NP.bin - cd $BMDIR - echo "---------- Running local $BMDIR non-prefetch on 1 machine ---------- " - localrun 10 - echo "---------- Running single thread remote $BMDIR non-prefetch on 2 machines ---------- " - oneremote 10 1 $NONPREFETCH - echo "---------- Running single thread remote $BMDIR prefetch on 2 machines ---------- " - oneremote 10 1 $PREFETCH - cd $TOPDIR -} - -benchmarks='array chase mmver200 mmver600 em3dver40001303 sorverA' - -echo "---------- Clean old files ---------- " -rm runlog/* -for b in `echo $benchmarks` -do - bm=`grep $b bm.txt` - BENCHMARK=`echo $bm | cut -f1 -d":"` - BMDIR=`echo $bm | cut -f2 -d":"` - ARGS1=`echo $bm | cut -f3 -d":"` - ARGS2=`echo $bm | cut -f4 -d":"` - ARGS3=`echo $bm | cut -f5 -d":"` - ARGS4=`echo $bm | cut -f6 -d":"` - EXTENSION=`echo $bm | cut -f7 -d":"` - name1='array' - name2='chase' - if [ $b == $name1 ] || [ $b == $name2 ]; then - callmicrorun - else - callrun - fi -done - -#----------Calulates the averages ----------- -for file in `ls runlog/*.txt` -do - echo -n $file >> average.txt - cat $file | awk '{sum += $1} END {print " "sum/NR}' >> average.txt -done -echo "===========" >> average.txt -echo "" >> average.txt - -echo "done" diff --git a/Robust/src/Benchmarks/Scheduling/JGFSeries/JGFSeriesBench.java b/Robust/src/Benchmarks/Scheduling/JGFSeries/JGFSeriesBench.java deleted file mode 100644 index adb5e0ce..00000000 --- a/Robust/src/Benchmarks/Scheduling/JGFSeries/JGFSeriesBench.java +++ /dev/null @@ -1,38 +0,0 @@ -/** Banboo Version **/ - -/************************************************************************** -* * -* Java Grande Forum Benchmark Suite - Thread Version 1.0 * -* * -* produced by * -* * -* Java Grande Benchmarking Project * -* * -* at * -* * -* Edinburgh Parallel Computing Centre * -* * -* email: epcc-javagrande@epcc.ed.ac.uk * -* * -* * -* This version copyright (c) The University of Edinburgh, 2001. * -* All rights reserved. * -* * -**************************************************************************/ - -task t1(StartupObject s{initialstate}) { - //System.printString("task t1\n"); - - int datasize = 16; - for(int i = 0; i < datasize; ++i) { - SeriesRunner sr = new SeriesRunner(i){!finish}; - } - - taskexit(s{!initialstate}); -} - -task t2(SeriesRunner sr{!finish}) { - //System.printString("task t2\n"); - sr.run(); - taskexit(sr{finish}); -} diff --git a/Robust/src/Benchmarks/Scheduling/JGFSeries/SeriesRunner.java b/Robust/src/Benchmarks/Scheduling/JGFSeries/SeriesRunner.java deleted file mode 100644 index 25ac2ba6..00000000 --- a/Robust/src/Benchmarks/Scheduling/JGFSeries/SeriesRunner.java +++ /dev/null @@ -1,235 +0,0 @@ -/** Bristlecone Version **/ - -/************************************************************************** - * * - * Java Grande Forum Benchmark Suite - Thread Version 1.0 * - * * - * produced by * - * * - * Java Grande Benchmarking Project * - * * - * at * - * * - * Edinburgh Parallel Computing Centre * - * * - * email: epcc-javagrande@epcc.ed.ac.uk * - * * - * Original version of this code by * - * Gabriel Zachmann (zach@igd.fhg.de) * - * * - * This version copyright (c) The University of Edinburgh, 2001. * - * All rights reserved. * - * * - **************************************************************************/ - -/** - * Class SeriesRunner - * - * Performs the transcendental/trigonometric portion of the - * benchmark. This test calculates the nth fourier - * coefficients of the function (x+1)^x defined on the interval - * 0,2 (where n is an arbitrary number set in the constructor). - * - * The first four pairs of coefficients calculated shoud be: - * (2.83777, 0), (1.04578, -1.8791), (0.2741, -1.15884), and - * (0.0824148, -0.805759). - */ -public class SeriesRunner { - flag finish; - - int id; - - public SeriesRunner(int id){ - this.id=id; - } - - public void run() { - //System.printI(0xa0); - float pair[] = new float[2]; - // Calculate the fourier series. Begin by calculating A[0]. - if (id==0) { - pair[0] = TrapezoidIntegrate((float)0.0, //Lower bound. - (float)2.0, // Upper bound. - 1000, // # of steps. - (float)0.0, // No omega*n needed. - 0) / (float)2.0; // 0 = term A[0]. - //System.printI(0xa1); - pair[1] = 0; - } else { - // Calculate the fundamental frequency. - // ( 2 * pi ) / period...and since the period - // is 2, omega is simply pi. - //float omega = (float) 3.1415926535897932; // Fundamental frequency. - float omega = (float) 3.1415926535897932; // Fundamental frequency. - - // Calculate A[i] terms. Note, once again, that we - // can ignore the 2/period term outside the integral - // since the period is 2 and the term cancels itself - // out. - pair[0] = TrapezoidIntegrate((float)0.0, - (float)2.0, - 1000, - omega * (float)id, - 1); // 1 = cosine term. - //System.printI(0xa2); - // Calculate the B[i] terms. - pair[1] = TrapezoidIntegrate((float)0.0, - (float)2.0, - 1000, - omega * (float)id, - 2); // 2 = sine term. - } - //System.printI(0xa3); - //System.printString("coefficient NO."); - //System.printI(id); - //System.printI((int)(pair[0]*10000)); - //System.printI((int)(pair[1]*10000)); - - // validate - if(id < 4) { - //System.printI(0xa4); - float ref[][] = new float[4][2]; - ref[0][0] = (float)2.87290112; - ref[0][1] = (float)0.0; - ref[1][0] = (float)1.11594856; - ref[1][1] = (float)-1.88199680; - ref[2][0] = (float)0.34412988; - ref[2][1] = (float)-1.16458096; - ref[3][0] = (float)0.15222694; - ref[3][1] = (float)-0.81435320; - //System.printI(0xa5); - for (int j = 0; j < 2; j++){ - //System.printI(0xa6); - float error = Math.abs(pair[j] - ref[id][j]); - if (error > 1.0e-7 ){ - //System.printI(0xa7); - //System.printString("Validation failed for coefficient " + j + "," + id + "\n"); - //System.printString("Computed value = " + (int)(pair[j]*100000000) + "\n"); - //System.printString("Reference value = " + (int)(ref[id][j]*100000000) + "\n"); - //System.printI((int)(pair[j]*10000)); - //System.printI((int)(ref[id][j]*10000)); - } - } - } - //System.printI(0xa8); - } - - /* - * TrapezoidIntegrate - * - * Perform a simple trapezoid integration on the function (x+1)**x. - * x0,x1 set the lower and upper bounds of the integration. - * nsteps indicates # of trapezoidal sections. - * omegan is the fundamental frequency times the series member #. - * select = 0 for the A[0] term, 1 for cosine terms, and 2 for - * sine terms. Returns the value. - */ - - private float TrapezoidIntegrate (float x0, // Lower bound. - float x1, // Upper bound. - int nsteps, // # of steps. - float omegan, // omega * n. - int select) // Term type. - { - float x; // Independent variable. - float dx; // Step size. - float rvalue; // Return value. - - //System.printI(0xb0); - // Initialize independent variable. - - x = x0; - - // Calculate stepsize. - - dx = (x1 - x0) / (float)nsteps; - //System.printI((int)(dx * 1000000)); - //System.printI(0xb1); - - // Initialize the return value. - - rvalue = thefunction(x0, omegan, select) / (float)2.0; - //System.printI((int)(rvalue * 1000000)); - //System.printI(0xb2); - - // Compute the other terms of the integral. - - if (nsteps != 1) - { - //System.printI(0xb3); - --nsteps; // Already done 1 step. - while (--nsteps > 0) - { - //System.printI(0xb4); - //System.printI(nsteps); - x += dx; - rvalue += thefunction(x, omegan, select); - //System.printI((int)(rvalue * 1000000)); - //System.printI(0xb5); - } - } - - // Finish computation. - - //System.printI(0xb6); - rvalue=(float)(rvalue + thefunction(x1,omegan,select) / (float)2.0) * dx; - //System.printI((int)(rvalue * 1000000)); - //System.printString("rvalue: " + (int)(rvalue * 10000) + "\n"); - //System.printI(0xb7); - return(rvalue); - } - - /* - * thefunction - * - * This routine selects the function to be used in the Trapezoid - * integration. x is the independent variable, omegan is omega * n, - * and select chooses which of the sine/cosine functions - * are used. Note the special case for select=0. - */ - - private float thefunction(float x, // Independent variable. - float omegan, // Omega * term. - int select) // Choose type. - { - - // Use select to pick which function we call. - //System.printI(0xc0); - float result = (float)0.0; - if(0 == select) { - //System.printI(0xc1); - result = Math.powf(x+(float)1.0,x); - //System.printI((int)(result * 1000000)); - } else if (1 == select) { - //System.printI(0xc2); - return(Math.powf(x+(float)1.0,x) * Math.cosf(omegan*x)); - } else if (2 == select) { - //System.printI(0xc3); - return(Math.powf(x+(float)1.0,x) * Math.sinf(omegan*x)); - } - - //System.printI(0xc4); - // We should never reach this point, but the following - // keeps compilers from issuing a warning message. - return result; - } -} - - - - - - - - - - - - - - - - - - - diff --git a/Robust/src/Benchmarks/Scheduling/JGFSeries/c/JGFSeriesBench.c b/Robust/src/Benchmarks/Scheduling/JGFSeries/c/JGFSeriesBench.c deleted file mode 100644 index 94659c44..00000000 --- a/Robust/src/Benchmarks/Scheduling/JGFSeries/c/JGFSeriesBench.c +++ /dev/null @@ -1,196 +0,0 @@ -/** Single thread C Version **/ - -/************************************************************************** -* * -* Java Grande Forum Benchmark Suite - Thread Version 1.0 * -* * -* produced by * -* * -* Java Grande Benchmarking Project * -* * -* at * -* * -* Edinburgh Parallel Computing Centre * -* * -* email: epcc-javagrande@epcc.ed.ac.uk * -* * -* * -* This version copyright (c) The University of Edinburgh, 2001. * -* All rights reserved. * -* * -**************************************************************************/ - -#ifdef RAW -#include -#else -#include -#include -#include -#include -#endif -#include - -void begin(void); -void run(int id); -float TrapezoidIntegrate(float x0, float x1, int nsteps, float omegan, int select); -float thefunction(float x, float omegan, int select); - -#ifndef RAW -int main(int argc, char **argv) { - begin(); - return 0; -} -#endif - -void begin(void) { - int datasize = 16; - int i = 0; - /* Main loop: */ - for(i = 0; i < datasize; ++i) { - run(i); - } -#ifdef RAW - raw_test_pass(raw_get_cycle()); - raw_test_done(1); -#endif -} - -void run(int id) { - float pair[2]; - // Calculate the fourier series. Begin by calculating A[0]. - if (id==0) { - pair[0] = TrapezoidIntegrate((float)0.0, //Lower bound. - (float)2.0, // Upper bound. - 1000, // # of steps. - (float)0.0, // No omega*n needed. - 0) / (float)2.0; // 0 = term A[0]. - pair[1] = 0; - } else { - // Calculate the fundamental frequency. - // ( 2 * pi ) / period...and since the period - // is 2, omega is simply pi. - float omega = (float) 3.1415926535897932; // Fundamental frequency. - - // Calculate A[i] terms. Note, once again, that we - // can ignore the 2/period term outside the integral - // since the period is 2 and the term cancels itself - // out. - pair[0] = TrapezoidIntegrate((float)0.0, - (float)2.0, - 1000, - omega * (float)id, - 1); // 1 = cosine term. - //System.printI(0xa2); - // Calculate the B[i] terms. - pair[1] = TrapezoidIntegrate((float)0.0, - (float)2.0, - 1000, - omega * (float)id, - 2); // 2 = sine term. - } - -#ifdef RAW - //raw_test_pass_reg(id); - //raw_test_pass((int)(pair[0]*10000)); - //raw_test_pass((int)(pair[1]*10000)); -#else - printf("coefficient NO. %d: %f; %f \n", id, pair[0], pair[1]); -#endif - - // validate - if(id < 4) { - int j = 0; - float ref[4][2]; - ref[0][0] = 2.8729524964837996; - ref[0][1] = 0.0; - ref[1][0] = 1.1161046676147888; - ref[1][1] = -1.8819691893398025; - ref[2][0] = 0.34429060398168704; - ref[2][1] = -1.1645642623320958; - ref[3][0] = 0.15238898702519288; - ref[3][1] = -0.8143461113044298; - for (j = 0; j < 2; j++){ - float error = abs(pair[j] - ref[id][j]); - if (error > 1.0e-12 ){ -#ifdef RAW - //raw_test_pass(0xeeee); -#else - printf("Validation failed for coefficient %d:%d \n", j, id); - printf("Computed value = %f \n", pair[j]); - printf("Reference value = %f \n", ref[id][j]); -#endif - } - } - } -} - -/* - * TrapezoidIntegrate - * - * Perform a simple trapezoid integration on the function (x+1)**x. - * x0,x1 set the lower and upper bounds of the integration. - * nsteps indicates # of trapezoidal sections. - * omegan is the fundamental frequency times the series member #. - * select = 0 for the A[0] term, 1 for cosine terms, and 2 for - * sine terms. Returns the value. - */ - -float TrapezoidIntegrate (float x0, // Lower bound. - float x1, // Upper bound. - int nsteps, // # of steps. - float omegan, // omega * n. - int select) { // Term type. - float x; // Independent variable. - float dx; // Step size. - float rvalue; // Return value. - - // Initialize independent variable. - x = x0; - - // Calculate stepsize. - dx = (x1 - x0) / (float)nsteps; - - // Initialize the return value. - rvalue = thefunction(x0, omegan, select) / (float)2.0; - - // Compute the other terms of the integral. - if (nsteps != 1) { - --nsteps; // Already done 1 step. - while (--nsteps > 0) { - x += dx; - rvalue += thefunction(x, omegan, select); - } - } - - // Finish computation. - rvalue=(rvalue + thefunction(x1,omegan,select) / (float)2.0) * dx; - return(rvalue); -} - -/* - * thefunction - * - * This routine selects the function to be used in the Trapezoid - * integration. x is the independent variable, omegan is omega * n, - * and select chooses which of the sine/cosine functions - * are used. Note the special case for select=0. - */ - -float thefunction(float x, // Independent variable. - float omegan, // Omega * term. - int select) { // Choose type. - - // Use select to pick which function we call. - float result = 0.0; - if(0 == select) { - result = powf(x+(float)1.0,x); - } else if (1 == select) { - return(powf(x+(float)1.0,x) * cosf(omegan*x)); - } else if (2 == select) { - return(powf(x+(float)1.0,x) * sinf(omegan*x)); - } - - // We should never reach this point, but the following - // keeps compilers from issuing a warning message. - return result; -} diff --git a/Robust/src/Benchmarks/Scheduling/JGFSeries/c/Makefile b/Robust/src/Benchmarks/Scheduling/JGFSeries/c/Makefile deleted file mode 100644 index c1b34334..00000000 --- a/Robust/src/Benchmarks/Scheduling/JGFSeries/c/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -TOPDIR=/home/jzhou/starsearch -include $(TOPDIR)/Makefile.include - -RGCCFLAGS += -O2 -RGCCFLAGS += -DRAW - -SIM-CYCLES = 10000 - -ATTRIBUTES += HWIC - -TILES = 00 - -OBJECT_FILES_00 = JGFSeriesBench.o -#OBJECT_FILES = JGFSeriesBench.o - -# this is for a multi-tile test -include $(COMMONDIR)/Makefile.all -#include $(COMMONDIR)/Makefile.single diff --git a/Robust/src/Benchmarks/Scheduling/MapReduce/MapReduce.java b/Robust/src/Benchmarks/Scheduling/MapReduce/MapReduce.java deleted file mode 100644 index 6f6bbbc3..00000000 --- a/Robust/src/Benchmarks/Scheduling/MapReduce/MapReduce.java +++ /dev/null @@ -1,134 +0,0 @@ -task t1(StartupObject s{initialstate}) { - System.printString("task t1\n"); - - String inputfile = "Manila International Airport Authority spokesman Octavio Lina said there were no injuries, but some of the 345 passengers vomited after disembarking, AP reported. Video of the incident shows passengers applauding as the plane landed safely."; - int m = 6; - int r = 3; - char seperator = '\n'; - Splitter splitter = new Splitter(inputfile, m, seperator); - Master master = new Master(m, r, splitter){split}; - - taskexit(s{!initialstate}); -} - -//Split the input file into M pieces -task t2(Master master{split}) { - System.printString("task t2\n"); - - master.split(); - - taskexit(master{!split, assignMap}); -} - -//Select a map worker to handle one of the pieces of input file -task t3(Master master{assignMap}) { - System.printString("task t3\n"); - - //master.assignMap(); - Splitter splitter = master.getSplitter(); - String[] contentsplits = splitter.getSlices(); - for(int i = 0; i < contentsplits.length; ++i) { - MapWorker mworker = new MapWorker(splitter.getFilename(), contentsplits[i], master.getR(), i){map}; - master.setMapInit(i); - } - - taskexit(master{!assignMap, mapoutput}); -} - -//MapWorker do 'map' function on a input file piece -task t4(MapWorker mworker{map}) { - System.printString("task t4\n"); - - mworker.map(); - - taskexit(mworker{!map, partition}); -} - -//Partition the intermediate key/value pair generated -//into R intermediate local files -task t5(MapWorker mworker{partition}) { - System.printString("task t5\n"); - - mworker.partition(); - - taskexit(mworker{!partition, mapoutput}); -} - -//Register the intermediate ouput from map worker to master -task t6(Master master{mapoutput}, MapWorker mworker{mapoutput}) { - System.printString("task t6\n"); - - int total = master.getR(); - for(int i = 0; i < total; ++i) { - OutputCollector temp = mworker.outputFile(i); - if(temp != null) { - master.addInterOutput(temp, i); - } - } - master.setMapFinish(mworker.getID()); - - if(master.isMapFinish()) { - taskexit(master{!mapoutput, mapfinished, assignReduce}, mworker{!mapoutput}); - } - - taskexit(mworker{!mapoutput}); -} - -//Assign the list of intermediate output associated to one key to -//a reduce worker -task t7(Master master{assignReduce}) { - System.printString("task t7\n"); - - //master.assignReduce(); - Vector[] interoutputs = master.getInteroutputs(); - for(int i = 0; i < interoutputs.length; ++i) { - ReduceWorker rworker = new ReduceWorker(interoutputs[i], i){sortgroup}; - master.setReduceInit(i); - } - - taskexit(master{!assignReduce, reduceoutput}); -} - -//First do sort and group on the intermediate key/value pairs assigned -//to reduce worker -task t8(ReduceWorker rworker{sortgroup}) { - System.printString("task t8\n"); - - rworker.sortgroup(); - - taskexit(rworker{!sortgroup, reduce}); -} - -//Do 'reduce' function -task t9(ReduceWorker rworker{reduce}) { - System.printString("task t9\n"); - - rworker.reduce(); - - taskexit(rworker{!reduce, reduceoutput}); -} - -//Collect the output into master -task t10(Master master{reduceoutput}, ReduceWorker rworker{reduceoutput}) { - System.printString("task t10\n"); - - master.collectROutput(rworker.getOutput()); - master.setReduceFinish(rworker.getID()); - - if(master.isReduceFinish()) { - taskexit(master{!reduceoutput, reducefinished, output}, rworker{!reduceoutput}); - } - - taskexit(rworker{!reduceoutput}); -} - -task t11(Master master{output}) { - System.printString("task t11\n"); - - /*if(master.isPartial()) { - System.printString("Partial! The result may not be right due to some failure!\n"); - }*/ - System.printString("Finish!\n");// Results are in the output file: " + master.getOutputFile() + "\n"); - System.printI(0xdddd); - taskexit(master{!output}); -} diff --git a/Robust/src/Benchmarks/Scheduling/MapReduce/MapReduceBase.java b/Robust/src/Benchmarks/Scheduling/MapReduce/MapReduceBase.java deleted file mode 100644 index 3ff539d9..00000000 --- a/Robust/src/Benchmarks/Scheduling/MapReduce/MapReduceBase.java +++ /dev/null @@ -1,55 +0,0 @@ -public class MapReduceBase { - - public static void map(String key, String value, OutputCollector output) { - int n = value.length(); - for (int i = 0; i < n; ) { - // Skip past leading whitespace - while ((i < n) && isspace(value.charAt(i))) { - ++i; - } - - // Find word end - int start = i; - while ((i < n) && !isspace(value.charAt(i))) { - i++; - } - - if (start < i) { - output.emit(value.subString(start, i), "1"); - //System.printString(value.subString(start,i) + "\n"); - } - } - } - - public static void reduce(String key, Vector values, OutputCollector output) { - // Iterate over all entries with the - // // same key and add the values - int value = 0; - for(int i = 0; i < values.size(); ++i) { - value += Integer.parseInt((String)values.elementAt(i)); - } - - // Emit sum for input->key() - output.emit(key, String.valueOf(value)); - } - - static boolean isspace(char c) { - if((c == ' ') || - (c == ',') || - (c == '.') || - (c == '!') || - (c == '?') || - (c == '"') || - (c == '(') || - (c == ')') || - (c == '[') || - (c == ']') || - (c == '{') || - (c == '}') || - (c == '\n')) { - return true; - } - return false; - } -} - diff --git a/Robust/src/Benchmarks/Scheduling/MapReduce/MapWorker.java b/Robust/src/Benchmarks/Scheduling/MapReduce/MapWorker.java deleted file mode 100644 index e7efa7c7..00000000 --- a/Robust/src/Benchmarks/Scheduling/MapReduce/MapWorker.java +++ /dev/null @@ -1,76 +0,0 @@ -public class MapWorker { - flag map; - flag partition; - flag mapoutput; - - int ID; - - int r; - String key; - String value; - OutputCollector output; - - //String[] locations; - OutputCollector[] outputs; - - public MapWorker(String key, String value, int r, int id) { - this.ID = id; - this.r = r; - - this.key = key; - this.value = value; - this.output = new OutputCollector(); - - /*locations = new String[r]; - for(int i = 0; i < r; ++i) { - StringBuffer temp = new StringBuffer("/scratch/mapreduce_nor/output-intermediate-map-"); - temp.append(String.valueOf(ID)); - temp.append("-of-"); - temp.append(String.valueOf(r)); - temp.append("_"); - temp.append(String.valueOf(i)); - temp.append(".dat"); - locations[i] = new String(temp); - }*/ - - outputs = new OutputCollector[r]; - for(int i = 0; i < r; ++i) { - outputs[i] = null; - } - } - - public void map() { - MapReduceBase.map(key, value, output); - } - - public void partition() { - int size = this.output.size(); - for(int i = 0; i < size; ++i) { - String key = this.output.getKey(i); - String value = this.output.getValue(i); - // use the hashcode of key to decide which intermediate output - // this pair should be in - int index = (int)Math.abs(key.hashCode()) % this.r; - OutputCollector oStream = outputs[index]; - if(oStream == null) { - // open the file - oStream = new OutputCollector(); // append - outputs[index] = oStream; - } - oStream.emit(key, "1"); - } - } - - public OutputCollector outputFile(int i) { - return outputs[i]; - } - - public int getID() { - return this.ID; - } - - public int getR() { - return this.r; - } - -} diff --git a/Robust/src/Benchmarks/Scheduling/MapReduce/Master.java b/Robust/src/Benchmarks/Scheduling/MapReduce/Master.java deleted file mode 100644 index 9fadc23e..00000000 --- a/Robust/src/Benchmarks/Scheduling/MapReduce/Master.java +++ /dev/null @@ -1,171 +0,0 @@ -public class Master { - flag split; - flag assignMap; - flag mapoutput; - flag mapfinished; - flag assignReduce; - flag reduceoutput; - flag reducefinished; - flag output; - - int m; - int r; - int[] mworkerStates; // array of map worker's state - // 0: idle 1: process 2: finished 3: fail - int finishmworker; - int[] rworkerStates; // array of reduce worker's state - int finishrworker; - Vector[] interoutputs; // array of OutputCollector vector containing - // paths of intermediate outputs from - // map worker - - Splitter splitter; - - //String outputfile; // path of final output file - OutputCollector output; - - //boolean partial; - - public Master(int m, int r, Splitter splitter) { - this.m = m; - this.r = r; - - mworkerStates = new int[m]; - rworkerStates = new int[r]; - for(int i = 0; i < m; ++i) { - mworkerStates[i] = 0; - } - for(int i = 0; i < r; ++i) { - rworkerStates[i] = 0; - } - - interoutputs = new Vector[r]; - for(int i = 0; i < r; ++i) { - interoutputs[i] = null; - } - - this.splitter = splitter; - //this.outputfile = new String("/scratch/mapreduce_nor/output.dat"); - this.output = new OutputCollector(); - - //this.partial = false; - this.finishmworker = 0; - this.finishrworker = 0; - } - - public int getR() { - return this.r; - } - - /*public String getOutputFile() { - return this.outputfile; - }*/ - - /*public boolean isPartial() { - return this.partial; - } - - public void setPartial(boolean partial) { - this.partial = partial || this.partial; - }*/ - - public void split() { - splitter.split(); - } - - /*public void assignMap() { - String[] contentsplits = splitter.getSlices(); - for(int i = 0; i < contentsplits.length; ++i) { - //System.printString("*************************\n"); - //System.printString(contentsplits[i] + "\n"); - //System.printString("*************************\n"); - MapWorker mworker = new MapWorker(splitter.getFilename(), contentsplits[i], r, i){map}; - mworkerStates[i] = 1; - } - }*/ - - public void setMapInit(int i) { - mworkerStates[i] = 1; - } - - public void setMapFinish(int i) { - finishmworker++; - mworkerStates[i] = 2; - } - - public void setMapFail(int i) { - mworkerStates[i] = 3; - } - - public boolean isMapFinish() { - /* - //System.printString("check map finish\n"); - for(int i = 0; i < mworkerStates.length; ++i) { - if(mworkerStates[i] == 1) { - return false; - } - } - - return true;*/ - return this.finishmworker == this.m; - } - - public void addInterOutput(OutputCollector interoutput, int index) { - if(interoutputs[index] == null) { - interoutputs[index] = new Vector(); - } - interoutputs[index].addElement(interoutput); - } - - /*public void assignReduce() { - for(int i = 0; i < interoutputs.length; ++i) { - ReduceWorker rworker = new ReduceWorker(interoutputs[i], i){sortgroup}; - rworkerStates[i] = 1; - } - }*/ - - public void setReduceInit(int i) { - rworkerStates[i] = 1; - } - - public void setReduceFinish(int i) { - finishrworker++; - rworkerStates[i] = 2; - } - - public void setReduceFail(int i) { - rworkerStates[i] = 3; - } - - public boolean isReduceFinish() { - //System.printI(0xa0); - /* - for(int i = 0; i < rworkerStates.length; ++i) { - if(rworkerStates[i] == 1) { - //System.printI(0); - return false; - } - } - - //System.printI(1); - return true;*/ - return this.finishrworker == this.r; - } - - public void collectROutput(OutputCollector file) { - int size = file.size(); - for(int i = 0; i < size; ++i) { - String key = file.getKey(i); - String value = file.getValue(i); - this.output.emit(key, value); - } - } - - public Vector[] getInteroutputs() { - return this.interoutputs; - } - - public Splitter getSplitter() { - return this.splitter; - } -} diff --git a/Robust/src/Benchmarks/Scheduling/MapReduce/OutputCollector.java b/Robust/src/Benchmarks/Scheduling/MapReduce/OutputCollector.java deleted file mode 100644 index 3c6d852c..00000000 --- a/Robust/src/Benchmarks/Scheduling/MapReduce/OutputCollector.java +++ /dev/null @@ -1,27 +0,0 @@ -public class OutputCollector { - - Vector keys; - Vector values; - - public OutputCollector() { - this.keys = new Vector(); - this.values = new Vector(); - } - - public void emit(String key, String value) { - this.keys.addElement(key); - this.values.addElement(value); - } - - public int size() { - return this.keys.size(); - } - - public String getKey(int i) { - return (String)this.keys.elementAt(i); - } - - public String getValue(int i) { - return (String)this.values.elementAt(i); - } -} diff --git a/Robust/src/Benchmarks/Scheduling/MapReduce/ReduceWorker.java b/Robust/src/Benchmarks/Scheduling/MapReduce/ReduceWorker.java deleted file mode 100644 index 6584f8b3..00000000 --- a/Robust/src/Benchmarks/Scheduling/MapReduce/ReduceWorker.java +++ /dev/null @@ -1,106 +0,0 @@ -public class ReduceWorker { - flag sortgroup; - flag reduce; - flag reduceoutput; - - int ID; - Vector interoutputs; // string vector containing paths - // of intermediate outputs from map worker - Vector keys; - HashMap values; // hashmap map key to vector of string vector - int[] sorts; // array record the sort of keys - OutputCollector output; - //String outputfile; // path of the intermediate output file - - public ReduceWorker(Vector interoutputs, int id) { - this.ID = id; - this.interoutputs = interoutputs; - - this.keys = new Vector(); - this.values = new HashMap(); - //this.sorts = null; - - this.output = new OutputCollector(); - //this.outputfile = "/scratch/mapreduce_nor/output-intermediate-reduce-" + String.valueOf(id) + ".dat"; - } - - public void sortgroup() { - // group values associated to the same key - //System.printString("================================\n"); - if(interoutputs == null) { - return; - } - for(int i = 0; i < interoutputs.size(); ++i) { - OutputCollector tmpout = (OutputCollector)interoutputs.elementAt(i); - int size = tmpout.size(); - for(int j= 0; j < size; ++j) { - String key = tmpout.getKey(j); - String value = tmpout.getValue(j); - if(!this.values.containsKey(key)) { - this.values.put(key, new Vector()); - this.keys.addElement(key); - } - ((Vector)this.values.get(key)).addElement(value); - } - } - //System.printString("================================\n"); - - // sort all the keys inside interoutputs - this.sorts = new int[this.keys.size()]; - // insert sorting - this.sorts[0] = 0; - int tosort = 1; - for(; tosort < this.keys.size(); ++tosort) { - int tosortkey = ((String)this.keys.elementAt(tosort)).hashCode(); - int index = tosort; - for(int i = tosort; i > 0; --i) { - if(((String)this.keys.elementAt(this.sorts[i - 1])).hashCode() > tosortkey) { - this.sorts[i] = this.sorts[i-1]; - index = i - 1; - } else { - //System.printString(i + "; " + tosort + "\n"); - index = i; - i = 0; - } - } - this.sorts[index] = tosort; - } - } - - public void reduce() { - if(this.interoutputs != null) { - for(int i = 0; i < this.sorts.length; ++i) { - String key = (String)this.keys.elementAt(this.sorts[i]); - Vector values = (Vector)this.values.get(key); - MapReduceBase.reduce(key, values, this.output); - } - } - - // output all the result into some local file - /*int size = this.output.size(); - FileOutputStream oStream = new FileOutputStream(outputfile, true); // append - for(int i = 0; i < size; ++i) { - String key = this.output.getKey(i); - String value = this.output.getValue(i); - // format: key value\n - oStream.write(key.getBytes()); - oStream.write(' '); - oStream.write(value.getBytes()); - oStream.write('\n'); - oStream.flush(); - } - oStream.close();*/ - } - - /*public String getOutputFile() { - return this.outputfile; - }*/ - - public OutputCollector getOutput() { - return this.output; - } - - public int getID() { - return this.ID; - } -} diff --git a/Robust/src/Benchmarks/Scheduling/MapReduce/Splitter.java b/Robust/src/Benchmarks/Scheduling/MapReduce/Splitter.java deleted file mode 100644 index 28d7669b..00000000 --- a/Robust/src/Benchmarks/Scheduling/MapReduce/Splitter.java +++ /dev/null @@ -1,33 +0,0 @@ -public class Splitter { - String filename; - String content; - int length; - String[] slices; - - public Splitter(String inputfile, int splitNum, char seperator) { - //System.printString("Top of Splitter's constructor\n"); - filename = new String("tmp"); - content = inputfile; - //System.printString(content + "\n"); - - this.slices = new String[splitNum]; - this.slices[0] = content; - } - - public void split() { - if(slices.length == 1) { - return; - } - for(int i = 1; i < this.slices.length; ++i) { - slices[i] = new String(content.toCharArray()); - } - } - - public String getFilename() { - return filename; - } - - public String[] getSlices() { - return this.slices; - } -} diff --git a/Robust/src/Benchmarks/Spider/BR/Query.java b/Robust/src/Benchmarks/Spider/BR/Query.java deleted file mode 100644 index 82b031fa..00000000 --- a/Robust/src/Benchmarks/Spider/BR/Query.java +++ /dev/null @@ -1,84 +0,0 @@ -public class Query extends Socket { - flag requested; - flag processed; - flag received; - public int state; - - private String hostname; - private String path; - - private StringBuffer response; - - public Query(String hostname, String path) { - this.hostname=hostname; - this.path=path; - response=new StringBuffer(); - state=0; - } - - public void makeConnection() { - InetAddress address=InetAddress.getByName(hostname); - int port=80; - fd=nativeBind(address.getAddress(), port); - nativeConnect(fd, address.getAddress(), port); - } - - public String getHostName() { - return hostname; - } - - public String getPath() { - return path; - } - - public void outputFile() { - StringBuffer sb=new StringBuffer(hostname); - sb.append(path); - FileOutputStream fos=new FileOutputStream(sb.toString().replace('/','#')); - fos.write(response.toString().getBytes()); - fos.close(); - } - - public String makewebcanonical(String page) { - StringBuffer b=new StringBuffer(getHostName(page)); - b.append("/"); - b.append(getPathName(page)); - return b.toString(); - } - - public String getHostName(String page) { - String http=new String("http://"); - if (page.indexOf(http)==-1) { - return getHostName(); - } else { - int beginindex=page.indexOf(http)+http.length(); - int endindex=page.indexOf('/',beginindex+1); - if ((beginindex==-1)) { - System.printString("ERROR"); - } - if (endindex==-1) - endindex=page.length(); - return page.subString(beginindex, endindex); - } - } - - public String getPathName(String page) { - String http=new String("http://"); - if (page.indexOf(http)==-1) { - String path=getPath(); - int lastindex=path.lastindexOf('/'); - if (lastindex==-1) - return page; - - StringBuffer sb=new StringBuffer(path.subString(0,lastindex+1)); - sb.append(page); - return sb.toString(); - } else { - int beginindex=page.indexOf(http)+http.length(); - int nextindex=page.indexOf('/',beginindex+1); - if ((beginindex==-1)||(nextindex==-1)) - return new String("index.html"); - return page.subString(nextindex+1, page.length()-1); - } - } -} diff --git a/Robust/src/Benchmarks/Spider/BR/QueryList.java b/Robust/src/Benchmarks/Spider/BR/QueryList.java deleted file mode 100644 index 90dc9dfe..00000000 --- a/Robust/src/Benchmarks/Spider/BR/QueryList.java +++ /dev/null @@ -1,14 +0,0 @@ -public class QueryList { - flag initialized; - HashSet queries; - - public QueryList() { - queries=new HashSet(); - } - public boolean checkQuery(String x) { - return queries.contains(x); - } - public void addQuery(String x) { - queries.add(x); - } -} diff --git a/Robust/src/Benchmarks/Spider/BR/Spider.java b/Robust/src/Benchmarks/Spider/BR/Spider.java deleted file mode 100644 index e0b6eddb..00000000 --- a/Robust/src/Benchmarks/Spider/BR/Spider.java +++ /dev/null @@ -1,103 +0,0 @@ -task Startup(StartupObject s {initialstate}) { - String firstmachine=s.parameters[0]; - String firstpage=s.parameters[1]; - QueryList ql=new QueryList() {initialized}; - Query firstquery=new Query(firstmachine, firstpage){}; - taskexit(s{!initialstate}); -} - -task requestQuery(Query q{!requested}) { - String hostname=q.getHostName(); - q.makeConnection(); - StringBuffer req=new StringBuffer("GET "); - req.append("/"); - req.append(q.getPath()); - req.append(" HTTP/1.1\r\nHost:"); - req.append(q.getHostName()); - req.append("\r\n\r\n"); - q.write(req.toString().getBytes()); - taskexit(q{requested}); -} - -task readResponse(Query q{requested && ! received && IOPending}) { - // state 0 - nothing - // state 1 - \r - // state 2 - \r\n - // state 3 - \r\n\r - // state 4 - \r\n\r\n - if (q.state<4) { - if (q.state==0) { - byte[] b=new byte[1]; - int numchars=q.read(b); - if ((numchars==1) && (b[0]=='\r')) - q.state++; - } else if (q.state==1) { - byte[] b=new byte[1]; - int numchars=q.read(b); - if (numchars==1) { - if (b[0]=='\n') - q.state++; - else - q.state=0; - } - } else if (q.state==2) { - byte[] b=new byte[1]; - int numchars=q.read(b); - if (numchars==1) { - if (b[0]=='\r') - q.state++; - else - q.state=0; - } - } else if (q.state==3) { - byte[] b=new byte[1]; - int numchars=q.read(b); - if (numchars==1) { - if (b[0]=='\n') - q.state++; - else - q.state=0; - } - } - } else { - byte[] buffer=new byte[1024]; - int numchars=q.read(buffer); - if (numchars==0) { - q.close(); - taskexit(q{received}); - } else { - String curr=(new String(buffer)).subString(0,numchars); - q.response.append(curr); - } - } -} - -task processPage(Query q{received&&!processed}, QueryList ql{initialized}) { - int index=0; - String href=new String("href=\""); - String searchstr=q.response.toString(); - boolean cont=true; - q.outputFile(); - - while(cont) { - int mindex=searchstr.indexOf(href,index); - if (mindex!=-1) { - - int endquote=searchstr.indexOf('"', mindex+href.length()); - if (endquote!=-1) { - String match=searchstr.subString(mindex+href.length(), endquote); - String match2=q.makewebcanonical(match); - if (match2!=null&&!ql.checkQuery(match2)) { - ql.addQuery(match2); - System.printString(q.getHostName(match)); - System.printString(" "); - System.printString(q.getPathName(match)); - System.printString("\n"); - Query newq=new Query(q.getHostName(match), q.getPathName(match)){}; - } - index=endquote; - } else cont=false; - } else cont=false; - } - taskexit(q{processed}); -} diff --git a/Robust/src/Benchmarks/Spider/BRTag/Query.java b/Robust/src/Benchmarks/Spider/BRTag/Query.java deleted file mode 100644 index 338f7d92..00000000 --- a/Robust/src/Benchmarks/Spider/BRTag/Query.java +++ /dev/null @@ -1,84 +0,0 @@ -public class Query { - flag requested; - flag processed; - flag received; - public int state; - - private String hostname; - private String path; - - private StringBuffer response; - - public Query(String hostname, String path) { - this.hostname=hostname; - this.path=path; - response=new StringBuffer(); - state=0; - } - - public void makeConnection(Socket s) { - InetAddress address=InetAddress.getByName(hostname); - int port=80; - s.fd=Socket.nativeBind(address.getAddress(), port); - s.nativeConnect(s.fd, address.getAddress(), port); - } - - public String getHostName() { - return hostname; - } - - public String getPath() { - return path; - } - - public void outputFile() { - StringBuffer sb=new StringBuffer(hostname); - sb.append(path); - FileOutputStream fos=new FileOutputStream(sb.toString().replace('/','#')); - fos.write(response.toString().getBytes()); - fos.close(); - } - - public String makewebcanonical(String page) { - StringBuffer b=new StringBuffer(getHostName(page)); - b.append("/"); - b.append(getPathName(page)); - return b.toString(); - } - - public String getHostName(String page) { - String http=new String("http://"); - if (page.indexOf(http)==-1) { - return getHostName(); - } else { - int beginindex=page.indexOf(http)+http.length(); - int endindex=page.indexOf('/',beginindex+1); - if ((beginindex==-1)) { - System.printString("ERROR"); - } - if (endindex==-1) - endindex=page.length(); - return page.subString(beginindex, endindex); - } - } - - public String getPathName(String page) { - String http=new String("http://"); - if (page.indexOf(http)==-1) { - String path=getPath(); - int lastindex=path.lastindexOf('/'); - if (lastindex==-1) - return page; - - StringBuffer sb=new StringBuffer(path.subString(0,lastindex+1)); - sb.append(page); - return sb.toString(); - } else { - int beginindex=page.indexOf(http)+http.length(); - int nextindex=page.indexOf('/',beginindex+1); - if ((beginindex==-1)||(nextindex==-1)) - return new String("index.html"); - return page.subString(nextindex+1, page.length()-1); - } - } -} diff --git a/Robust/src/Benchmarks/Spider/BRTag/QueryList.java b/Robust/src/Benchmarks/Spider/BRTag/QueryList.java deleted file mode 100644 index 90dc9dfe..00000000 --- a/Robust/src/Benchmarks/Spider/BRTag/QueryList.java +++ /dev/null @@ -1,14 +0,0 @@ -public class QueryList { - flag initialized; - HashSet queries; - - public QueryList() { - queries=new HashSet(); - } - public boolean checkQuery(String x) { - return queries.contains(x); - } - public void addQuery(String x) { - queries.add(x); - } -} diff --git a/Robust/src/Benchmarks/Spider/BRTag/Spider.java b/Robust/src/Benchmarks/Spider/BRTag/Spider.java deleted file mode 100644 index e3fd3679..00000000 --- a/Robust/src/Benchmarks/Spider/BRTag/Spider.java +++ /dev/null @@ -1,107 +0,0 @@ -task Startup(StartupObject s {initialstate}) { - String firstmachine=s.parameters[0]; - String firstpage=s.parameters[1]; - QueryList ql=new QueryList() {initialized}; - tag t=new tag(connect); - Socket sock=new Socket(){}{t}; - Query firstquery=new Query(firstmachine, firstpage){}{t}; - taskexit(s{!initialstate}); -} - -task requestQuery(Query q{!requested}{connect t}, Socket s{}{connect t}) { - String hostname=q.getHostName(); - q.makeConnection(s); - StringBuffer req=new StringBuffer("GET "); - req.append("/"); - req.append(q.getPath()); - req.append(" HTTP/1.1\r\nHost:"); - req.append(q.getHostName()); - req.append("\r\n\r\n"); - s.write(req.toString().getBytes()); - taskexit(q{requested}); -} - -task readResponse(Query q{requested && ! received}{connect t},Socket s{IOPending}{connect t}) { - // state 0 - nothing - // state 1 - \r - // state 2 - \r\n - // state 3 - \r\n\r - // state 4 - \r\n\r\n - if (q.state<4) { - if (q.state==0) { - byte[] b=new byte[1]; - int numchars=s.read(b); - if ((numchars==1) && (b[0]=='\r')) - q.state++; - } else if (q.state==1) { - byte[] b=new byte[1]; - int numchars=s.read(b); - if (numchars==1) { - if (b[0]=='\n') - q.state++; - else - q.state=0; - } - } else if (q.state==2) { - byte[] b=new byte[1]; - int numchars=s.read(b); - if (numchars==1) { - if (b[0]=='\r') - q.state++; - else - q.state=0; - } - } else if (q.state==3) { - byte[] b=new byte[1]; - int numchars=s.read(b); - if (numchars==1) { - if (b[0]=='\n') - q.state++; - else - q.state=0; - } - } - } else { - byte[] buffer=new byte[1024]; - int numchars=s.read(buffer); - if (numchars==0) { - s.close(); - taskexit(q{received}); - } else { - String curr=(new String(buffer)).subString(0,numchars); - q.response.append(curr); - } - } -} - -task processPage(Query q{received&&!processed}, QueryList ql{initialized}) { - int index=0; - String href=new String("href=\""); - String searchstr=q.response.toString(); - boolean cont=true; - q.outputFile(); - - while(cont) { - int mindex=searchstr.indexOf(href,index); - if (mindex!=-1) { - - int endquote=searchstr.indexOf('"', mindex+href.length()); - if (endquote!=-1) { - String match=searchstr.subString(mindex+href.length(), endquote); - String match2=q.makewebcanonical(match); - if (match2!=null&&!ql.checkQuery(match2)) { - ql.addQuery(match2); - System.printString(q.getHostName(match)); - System.printString(" "); - System.printString(q.getPathName(match)); - System.printString("\n"); - tag t=new tag(connect); - Socket s=new Socket(){}{t}; - Query newq=new Query(q.getHostName(match), q.getPathName(match)){}{t}; - } - index=endquote; - } else cont=false; - } else cont=false; - } - taskexit(q{processed}); -} diff --git a/Robust/src/Benchmarks/Spider/Java/Query.java b/Robust/src/Benchmarks/Spider/Java/Query.java deleted file mode 100644 index 3fba0a39..00000000 --- a/Robust/src/Benchmarks/Spider/Java/Query.java +++ /dev/null @@ -1,71 +0,0 @@ -public class Query { - private String hostname; - private String path; - - private StringBuffer response; - - public Query(String hostname, String path) { - this.hostname=hostname; - this.path=path; - response=new StringBuffer(); - } - - public String getHostName() { - return hostname; - } - - public String getPath() { - return path; - } - - public void outputFile() { - StringBuffer sb=new StringBuffer(hostname); - sb.append(path); - FileOutputStream fos=new FileOutputStream(sb.toString().replace('/','#')); - fos.write(response.toString().getBytes()); - fos.close(); - } - - public String makewebcanonical(String page) { - StringBuffer b=new StringBuffer(getHostName(page)); - b.append("/"); - b.append(getPathName(page)); - return b.toString(); - } - - public String getHostName(String page) { - String http=new String("http://"); - if (page.indexOf(http)==-1) { - return getHostName(); - } else { - int beginindex=page.indexOf(http)+http.length(); - int endindex=page.indexOf('/',beginindex+1); - if ((beginindex==-1)) { - System.printString("ERROR"); - } - if (endindex==-1) - endindex=page.length(); - return page.subString(beginindex, endindex); - } - } - - public String getPathName(String page) { - String http=new String("http://"); - if (page.indexOf(http)==-1) { - String path=getPath(); - int lastindex=path.lastindexOf('/'); - if (lastindex==-1) - return page; - - StringBuffer sb=new StringBuffer(path.subString(0,lastindex+1)); - sb.append(page); - return sb.toString(); - } else { - int beginindex=page.indexOf(http)+http.length(); - int nextindex=page.indexOf('/',beginindex+1); - if ((beginindex==-1)||(nextindex==-1)) - return new String("index.html"); - return page.subString(nextindex+1, page.length()); - } - } -} diff --git a/Robust/src/Benchmarks/Spider/Java/QueryList.java b/Robust/src/Benchmarks/Spider/Java/QueryList.java deleted file mode 100644 index 00d66e3a..00000000 --- a/Robust/src/Benchmarks/Spider/Java/QueryList.java +++ /dev/null @@ -1,13 +0,0 @@ -public class QueryList { - HashSet queries; - - public QueryList() { - queries=new HashSet(); - } - public boolean checkQuery(String x) { - return queries.contains(x); - } - public void addQuery(String x) { - queries.add(x); - } -} diff --git a/Robust/src/Benchmarks/Spider/Java/QueryQueue.java b/Robust/src/Benchmarks/Spider/Java/QueryQueue.java deleted file mode 100644 index f379e1dd..00000000 --- a/Robust/src/Benchmarks/Spider/Java/QueryQueue.java +++ /dev/null @@ -1,17 +0,0 @@ -public class QueryQueue { - HashSet queries; - - public QueryQueue() { - queries=new HashSet(); - } - public synchronized Query getQuery() { - if (queries.isEmpty()) - return null; - Query q=(Query) queries.iterator().next(); - queries.remove(q); - return q; - } - public synchronized void addQuery(Query x) { - queries.add(x); - } -} diff --git a/Robust/src/Benchmarks/Spider/Java/QueryThread.java b/Robust/src/Benchmarks/Spider/Java/QueryThread.java deleted file mode 100644 index 6bf2d085..00000000 --- a/Robust/src/Benchmarks/Spider/Java/QueryThread.java +++ /dev/null @@ -1,129 +0,0 @@ -public class QueryThread extends Thread { - QueryQueue toprocess; - QueryList ql; - public QueryThread(QueryQueue qq, QueryList ql) { - toprocess=qq; - this.ql=ql; - } - - public void run() { - while(true) { - Query q=null; - while(q==null) { - q=toprocess.getQuery(); - if (q==null) - Thread.sleep(2); - } - String hostname=q.getHostName(); - System.printString("Processing "); - System.printString(hostname); - System.printString(" "); - System.printString(q.getPath()); - System.printString("\n"); - Socket s=new Socket(hostname, 80); - requestQuery(q, s); - readResponse(q, s); - q.outputFile(); - processPage(q, ql); - s.close(); - } - } - - void requestQuery(Query q, Socket sock) { - StringBuffer req=new StringBuffer("GET "); - req.append("/"); - req.append(q.getPath()); - req.append(" HTTP/1.1\r\nHost:"); - req.append(q.getHostName()); - req.append("\r\n\r\n"); - sock.write(req.toString().getBytes()); - } - - void readResponse(Query q, Socket sock) { - // state 0 - nothing - // state 1 - \r - // state 2 - \r\n - // state 3 - \r\n\r - // state 4 - \r\n\r\n - int state=0; - while(true) { - if (state<4) { - if (state==0) { - byte[] b=new byte[1]; - int numchars=sock.read(b); - if ((numchars==1)) { - if (b[0]=='\r') { - state++; - } - } else - return; - } else if (state==1) { - byte[] b=new byte[1]; - int numchars=sock.read(b); - if (numchars==1) { - if (b[0]=='\n') - state++; - else - state=0; - } else return; - } else if (state==2) { - byte[] b=new byte[1]; - int numchars=sock.read(b); - if (numchars==1) { - if (b[0]=='\r') - state++; - else - state=0; - } else return; - } else if (state==3) { - byte[] b=new byte[1]; - int numchars=sock.read(b); - if (numchars==1) { - if (b[0]=='\n') - state++; - else - state=0; - } else return; - } - } else { - byte[] buffer=new byte[1024]; - int numchars=sock.read(buffer); - if (numchars==0) - return; - else { - String curr=(new String(buffer)).subString(0,numchars); - q.response.append(curr); - } - } - } - } - - void processPage(Query q, QueryList ql) { - int index=0; - String href=new String("href=\""); - String searchstr=q.response.toString(); - boolean cont=true; - while(cont) { - int mindex=searchstr.indexOf(href,index); - if (mindex!=-1) { - - int endquote=searchstr.indexOf('"', mindex+href.length()); - if (endquote!=-1) { - String match=searchstr.subString(mindex+href.length(), endquote); - String match2=q.makewebcanonical(match); - if (match2!=null&&!ql.checkQuery(match2)) { - ql.addQuery(match2); - System.printString(q.getHostName(match)); - System.printString(" "); - System.printString(q.getPathName(match)); - System.printString("\n"); - Query newq=new Query(q.getHostName(match), q.getPathName(match)); - toprocess.addQuery(newq); - } - index=endquote; - } else cont=false; - } else cont=false; - } - } - -} diff --git a/Robust/src/Benchmarks/Spider/Java/Spider.java b/Robust/src/Benchmarks/Spider/Java/Spider.java deleted file mode 100644 index fbe6648e..00000000 --- a/Robust/src/Benchmarks/Spider/Java/Spider.java +++ /dev/null @@ -1,23 +0,0 @@ -public class Spider { - - - - public static void main(String[] parameters) { - String firstmachine=parameters[0]; - String firstpage=parameters[1]; - QueryList ql=new QueryList(); - QueryQueue toprocess=new QueryQueue(); - Query firstquery=new Query(firstmachine, firstpage); - toprocess.addQuery(firstquery); - QueryThread qt1=new QueryThread(toprocess, ql); - qt1.start(); - QueryThread qt2=new QueryThread(toprocess, ql); - qt2.start(); - QueryThread qt3=new QueryThread(toprocess, ql); - qt3.start(); - while(true) - Thread.sleep(1000000); - } - - -} diff --git a/Robust/src/Benchmarks/Spider/dotest b/Robust/src/Benchmarks/Spider/dotest deleted file mode 100755 index 18d006cc..00000000 --- a/Robust/src/Benchmarks/Spider/dotest +++ /dev/null @@ -1,25 +0,0 @@ -#!/bin/bash -mkdir $1 -cd $1 -../$2 127.0.0.1 test/0.html &> log & -fcount=`ls -al 127*` -let "count=0" -while true -do -sleep 60 -fnewcount=`ls -al 127*` -if [ "$fnewcount" != "$fcount" ] - then - let "count=0" - fcount="$fnewcount" -fi -let "count+=1" -if [ $count = "3" ] -then -break -fi -done -killall -SIGUSR2 $2 -sleep 1 -killall -9 $2 -cd .. \ No newline at end of file diff --git a/Robust/src/Benchmarks/Spider/tests/generate.java b/Robust/src/Benchmarks/Spider/tests/generate.java deleted file mode 100644 index 0710a702..00000000 --- a/Robust/src/Benchmarks/Spider/tests/generate.java +++ /dev/null @@ -1,29 +0,0 @@ -import java.io.*; - -public class generate { - public static void main(String x[]) { - int MAX=100; - int current=0; - int currentref=1; - while(current2) - break; - int cc=currentref%MAX; - String reffile=cc+".html"; - ps.println(""+reffile+""); - currentref++; - } - current++; - fos.close(); - } catch (Exception e) {e.printStackTrace();} - } - } - - -} diff --git a/Robust/src/Benchmarks/Spider/testscript b/Robust/src/Benchmarks/Spider/testscript deleted file mode 100755 index f5683509..00000000 --- a/Robust/src/Benchmarks/Spider/testscript +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash -let i=62 -while [ $i -le 100 ] -do -./dotest THREAD$i threadspider.bin -./dotest TASK$i taskspider.bin -let "i+=1" -done \ No newline at end of file diff --git a/Robust/src/Benchmarks/TTT/Board.java b/Robust/src/Benchmarks/TTT/Board.java deleted file mode 100644 index 8f4a3d88..00000000 --- a/Robust/src/Benchmarks/TTT/Board.java +++ /dev/null @@ -1,93 +0,0 @@ -public class Board { - // TicTacToe Board flags - flag init; - - int[][] board; - - int winningplayer; - - public Board() { - winningplayer = -1; - board = new int[3][3]; - for (int i = 0; i < 3; i++) - for (int j = 0; j < 3; j++) - board[i][j] = 0; - } - - public int makeMove(int row, int col) { - if (boardFull() == 1) { - winningplayer = 0; - return 2; - } - if (board[row][col] != 0) { // Space taken - return -1; - } - else { - board[row][col] = 1; - if (checkForWin(1) == 1) { // Check if player won - winningplayer = 1; - return 2; - } - // Computer makes move - if (computerMakeMove() == 1) { // If made move successful - if (checkForWin(2) == 1) { // Check if computer won - winningplayer = 2; - return 2; - } - } - else { // Board full, no winner - winningplayer = 0; - return 2; - } - } - return 1; - } - - public int boardFull() { - for (int i = 0; i < 3; i++) - for (int j = 0; j < 3; j++) - if (board[i][j] == 0) - return 0; - return 1; - } - - public int computerMakeMove() { - for (int i = 0; i < 3; i++) - for (int j = 0; j < 3; j++) - if (board[i][j] == 0) { - board[i][j] = 2; - return 1; - } - return 0; - } - - public int checkForWin(int p) { - // Add logic for checking if player p wins - // Horiz - - if ((board[0][0] == p) && (board[0][1] == p) && (board[0][2] == p) || - (board[1][0] == p) && (board[1][1] == p) && (board[1][2] == p) || - (board[2][0] == p) && (board[2][1] == p) && (board[2][2] == p)) { - return 1; - } - - // Vert - if ((board[0][0] == p) && (board[1][0] == p) && (board[2][0] == p) || - (board[0][1] == p) && (board[1][1] == p) && (board[2][1] == p) || - (board[0][2] == p) && (board[1][2] == p) && (board[2][2] == p)) { - return 1; - } - - //Diag - if ((board[0][0] == p) && (board[1][1] == p) && (board[2][2] == p) || - (board[0][2] == p) && (board[1][1] == p) && (board[2][0] == p)) { - return 1; - } - - return 0; - } - - public int winner() { - return winningplayer; - } -} diff --git a/Robust/src/Benchmarks/TTT/TTTServer.java b/Robust/src/Benchmarks/TTT/TTTServer.java deleted file mode 100644 index 30bb7064..00000000 --- a/Robust/src/Benchmarks/TTT/TTTServer.java +++ /dev/null @@ -1,58 +0,0 @@ -/* Startup object is generated with the initialstate flag set by the - * system to start the computation up */ - -// Create ServerSocket -task Startup(StartupObject s {initialstate}) { - System.printString("TTT Server Starting...\n"); - ServerSocket ss = new ServerSocket(8000); - System.printString("Creating ServerSocket\n"); - Board tttBoard = new Board() {init}; - taskexit(s {!initialstate}); // Turn off initial state flag -} - -//Listen for a request and accept request -task AcceptConnection(ServerSocket ss{SocketPending}) { - System.printString("Waiting for connection...\n"); - TTTServerSocket ttts = new TTTServerSocket() {TTTSInitialize}; - System.printString("Calling accept...\n"); - ss.accept(ttts); - System.printString("Connected...\n"); -} - -// Process incoming requests -task ProcessRequest(TTTServerSocket ttts{IOPending && TTTSInitialize}) { - System.printString("Request received..."); - int action = ttts.receive(); - if (action == 1) { // Make move - taskexit(ttts {MakeMove}); - } - else { // Send Error - taskexit(ttts {SendError}); - } -} - -task ProcessMove(TTTServerSocket ttts{MakeMove}, Board tttBoard{init}) { - System.printString("Processing player's move..."); - int result = tttBoard.makeMove(ttts.getRow(), ttts.getCol()); - if (result == 1) { //Move made, send board display - taskexit(ttts {!MakeMove, SendBoard}); - } - else if (result == 2) { //Move made, game over - taskexit(ttts {!MakeMove, SendDone}); - } - else {// Error - taskexit(ttts {!MakeMove, SendError}); - } -} - -task SendBoardDisplay(TTTServerSocket ttts{SendBoard}, Board tttBoard{init}) { - ttts.sendBoardDisplay(tttBoard); -} - -task GameOver(TTTServerSocket ttts{SendDone}, Board tttBoard{init}) { - ttts.sendDone(tttBoard.winner()); -} - -task SendErrorMessage(TTTServerSocket ttts{SendError}, Board tttBoard{init}) { - ttts.sendError(); -} diff --git a/Robust/src/Benchmarks/TTT/TTTServerSocket.java b/Robust/src/Benchmarks/TTT/TTTServerSocket.java deleted file mode 100644 index 577a248a..00000000 --- a/Robust/src/Benchmarks/TTT/TTTServerSocket.java +++ /dev/null @@ -1,101 +0,0 @@ -public class TTTServerSocket extends Socket { - // TTTServerSocket flags - flag TTTSInitialize; - - flag MakeMove; - flag SendError; - flag SendBoard; - flag SendDone; - - String request; - int row, col; - - //Constructor - public TTTServerSocket(){ - System.printString("Constructing TTTServerSocket....\n"); - } - - public int receive() - { - byte b1[] = new byte[1024]; - read(b1); - request = new String(b1); - System.printString("request: "); - System.printString(request); - if (parseTransaction() == 1) { - return 1; - } - return 0; - } - - // Parse request - public int parseTransaction(){ - int start = request.indexOf('_'); - String s = request.subString(start+1); -//_move:3:3 - if (s.startsWith("move")==true){ - //Get row - int i1 = s.indexOf(':'); - String rowStr = new String(s.subString(i1+1, i1+2)); - row = Integer.parseInt(rowStr); - - //Get col - String s2 = new String(s.subString(i1+2)); - int i2 = s2.indexOf(':'); - String colStr = new String(s.subString(i2+1, i2+2)); - col = Integer.parseInt(colStr); - return 1; - - } - // Error transaction - return -1; - } - - public int getRow(){ - return row; - } - public int getCol(){ - return col; - } - - public void sendBoardDisplay(Board theBoard) { - StringBuffer line1 = new String ("display_"); - - for (int i = 0; i < 3; i++) { - for (int j = 0; j < 3; j++) { - if (theBoard.board[i][j] == 1) - line1.append("X"); - else if (theBoard.board[i][j] == 2) - line1.append("O"); - else - line1.append("-"); - } - line1.append("_"); - } - String towrite = new String(line1); - write(towrite.getBytes()); - return; - } - - public void sendDone(int winner) { - StringBuffer line1 = new String ("done_"); - if (winner == 0) - line1.append("tie"); - else if (winner == 1) - line1.append("player"); - else - line1.append("computer"); - - String towrite = new String(line1); - write(towrite.getBytes()); - return; - } - - public void sendError() { - StringBuffer line1 = new String ("error_wrongmove"); - - String towrite = new String(line1); - write(towrite.getBytes()); - return; - } -} diff --git a/Robust/src/Benchmarks/TTTJava/TTTServer.java b/Robust/src/Benchmarks/TTTJava/TTTServer.java deleted file mode 100644 index 8806080e..00000000 --- a/Robust/src/Benchmarks/TTTJava/TTTServer.java +++ /dev/null @@ -1,293 +0,0 @@ -import java.net.*; -import java.io.*; - -public class TTTServer -{ - //the tictactoe game board - //2d 3x3 char array - private static char[][] board; - //keeps track of how many turns have past - private static int numOfTurns; - //ints used to store the location of the cell the user will input - private static int row; - private static int col; - private static boolean notDone; - - private static void resetGame() - { - numOfTurns = 0; - row = 0; - col = 0; - - for(int i = 0; i < 3; i++) - { - for(int j = 0; j < 3; j++) - { - board[i][j] = ' '; - } - } - } - - private static void displayBoard() - { - System.out.println("--------------------"); - System.out.println("[R,C][ 1 ][ 2 ][ 3 ]"); - System.out.println("--------------------"); - System.out.println("[ 1 ]| " + board[0][0] + " | " + board[0][1] + - " | " + board[0][2] + " | "); - System.out.println("--------------------"); - System.out.println("[ 2 ]| " + board[1][0] + " | " + board[1][1] + - " | " + board[1][2] + " | "); - System.out.println("--------------------"); - System.out.println("[ 3 ]| " + board[2][0] + " | " + board[2][1] + - " | " + board[2][2] + " | "); - System.out.println("--------------------"); - } - - //put the move on the board and update numOfTurns - private static void markMove(char xo) - { - board[row - 1][col - 1] = xo; - numOfTurns++; - } - - //check for a winner or a tie - //true == winner or tie - private static boolean checkWinner(char xo) - { - //horizontal win - if(board[0][0] == xo && board[0][0] == board[0][1] && - board[0][1] == board[0][2]) - { - System.out.println(xo + " is the winner!"); - return true; - } - //horizontal win - else if(board[1][0] == xo && board[1][0] == board[1][1] && - board[1][1] == board[1][2]) - { - System.out.println(xo + " is the winner!"); - return true; - } - //horizontal win - else if(board[2][0] == xo && board[2][0] == board[2][1] && - board[2][1] == board[2][2]) - { - System.out.println(xo + " is the winner!"); - return true; - } - //vertial win - else if(board[0][0] == xo && board[0][0] == board[1][0] && - board[1][0] == board[2][0]) - { - System.out.println(xo + " is the winner!"); - return true; - } - //vertial win - else if(board[0][1] == xo && board[0][1] == board[1][1] && - board[1][1] == board[2][1]) - { - System.out.println(xo + " is the winner!"); - return true; - } - //vertial win - else if(board[0][2] == xo && board[0][2] == board[1][2] && - board[1][2] == board[2][2]) - { - System.out.println(xo + " is the winner!"); - return true; - } - //diagonal win - else if(board[0][0] == xo && board[0][0] == board[1][1] && - board[1][1] == board[2][2]) - { - System.out.println(xo + " is the winner!"); - return true; - } - //diagonal win - else if(board[0][2] == xo && board[0][2] == board[1][1] && - board[1][1] == board[2][0]) - { - System.out.println(xo + " is the winner!"); - return true; - } - //tie game - //board is full - else if(numOfTurns == 9) - { - System.out.println("Tie Game!"); - return true; - } - //no winner yet - else - return false; - } - - //the logic that happens for each turn for X or O - public static void turnLogic(char xo, int r, int c) - { - if(xo == 'X') - { - System.out.println("\n" + xo + "'s turn."); - System.out.println("Please enter your move as two separate integers: "); - //-1 -1 to quit - row = readInt(); - col = readInt(); - System.out.println("\nYou entered (" + row + "," + col + ")\n"); - } - else if(xo == 'O') - { - System.out.println("\n" + xo + "'s turn."); - row = r; - col = c; - } - - markMove(xo); - displayBoard(); - - //check for a winner and quit cond. - if(checkWinner(xo) || (row == -1 && col == -1)) - notDone = false; - } - - public static void main(String[] args) - { - //the sockets to be used - ServerSocket mySocket = null; - Socket myConnection= null; - //string that will hold the message to be received and sent - String myString = null; - //input buffer - BufferedReader myInput = null; - //output buffer - PrintStream myOutput = null; - //loop variable - notDone = true; - - board = new char[3][3]; - resetGame(); - - //start server - try - { - //create new socket - mySocket = new ServerSocket(8080); - System.out.println("Server Port: " + mySocket.getLocalPort()); - - displayBoard(); - - //accept incoming tcp connection - myConnection = mySocket.accept(); - - //create and read the message from the client to the input buffer - myInput = new BufferedReader(new InputStreamReader(myConnection.getInputStream())); - - //create and print the message to the output buffer - myOutput = new PrintStream(myConnection.getOutputStream()); - - //loop for nine times at most - while(numOfTurns != 9 && notDone == true) - { - switch(numOfTurns % 2) - { - //even case - case 0: - turnLogic('X', 0, 0); - myOutput.println(row + " " + col); - break; - - //odd case - case 1: - myString = myInput.readLine(); - - //was "quit" received? - if(myString.equals("quit")) - { - notDone = false; - } - else - { - int r = Integer.parseInt(myString.substring(0, 1)); - int c = Integer.parseInt(myString.substring(2, 3)); - turnLogic('O', r, c); - } - break; - - //should not happen - default: - System.out.println("Program Error!"); - break; - } - } - - //close buffers - myInput.close(); - myOutput.close(); - - //close socket - myConnection.close(); - } - catch(IOException e) - { - System.err.println(e); - System.exit(1); - } - } - - //some good stuff to read user ints, maybe too much? - public static int readInt() throws NumberFormatException - { - String inputString = null; - inputString = readWord(); - - return Integer.parseInt(inputString); - } - - //read a lot - public static String readWord() - { - String result = ""; - char next; - - next = readChar(); - while (Character.isWhitespace(next)) - next = readChar(); - - while(!(Character.isWhitespace(next))) - { - result = result + next; - next = readChar(); - } - - if (next == '\r') - { - next = readChar(); - - if (next != '\n') - { - System.err.println("Error."); - System.exit(1); - } - } - - return result; - } - - //read one - public static char readChar() - { - int charAsInt = -1; - - try - { - charAsInt = System.in.read(); - } - catch(IOException e) - { - System.err.println(e); - System.exit(1); - } - - return (char)charAsInt; - } -} diff --git a/Robust/src/Benchmarks/TTTTag/Board.java b/Robust/src/Benchmarks/TTTTag/Board.java deleted file mode 100644 index 8f4a3d88..00000000 --- a/Robust/src/Benchmarks/TTTTag/Board.java +++ /dev/null @@ -1,93 +0,0 @@ -public class Board { - // TicTacToe Board flags - flag init; - - int[][] board; - - int winningplayer; - - public Board() { - winningplayer = -1; - board = new int[3][3]; - for (int i = 0; i < 3; i++) - for (int j = 0; j < 3; j++) - board[i][j] = 0; - } - - public int makeMove(int row, int col) { - if (boardFull() == 1) { - winningplayer = 0; - return 2; - } - if (board[row][col] != 0) { // Space taken - return -1; - } - else { - board[row][col] = 1; - if (checkForWin(1) == 1) { // Check if player won - winningplayer = 1; - return 2; - } - // Computer makes move - if (computerMakeMove() == 1) { // If made move successful - if (checkForWin(2) == 1) { // Check if computer won - winningplayer = 2; - return 2; - } - } - else { // Board full, no winner - winningplayer = 0; - return 2; - } - } - return 1; - } - - public int boardFull() { - for (int i = 0; i < 3; i++) - for (int j = 0; j < 3; j++) - if (board[i][j] == 0) - return 0; - return 1; - } - - public int computerMakeMove() { - for (int i = 0; i < 3; i++) - for (int j = 0; j < 3; j++) - if (board[i][j] == 0) { - board[i][j] = 2; - return 1; - } - return 0; - } - - public int checkForWin(int p) { - // Add logic for checking if player p wins - // Horiz - - if ((board[0][0] == p) && (board[0][1] == p) && (board[0][2] == p) || - (board[1][0] == p) && (board[1][1] == p) && (board[1][2] == p) || - (board[2][0] == p) && (board[2][1] == p) && (board[2][2] == p)) { - return 1; - } - - // Vert - if ((board[0][0] == p) && (board[1][0] == p) && (board[2][0] == p) || - (board[0][1] == p) && (board[1][1] == p) && (board[2][1] == p) || - (board[0][2] == p) && (board[1][2] == p) && (board[2][2] == p)) { - return 1; - } - - //Diag - if ((board[0][0] == p) && (board[1][1] == p) && (board[2][2] == p) || - (board[0][2] == p) && (board[1][1] == p) && (board[2][0] == p)) { - return 1; - } - - return 0; - } - - public int winner() { - return winningplayer; - } -} diff --git a/Robust/src/Benchmarks/TTTTag/TTTServer.java b/Robust/src/Benchmarks/TTTTag/TTTServer.java deleted file mode 100644 index e7288a0d..00000000 --- a/Robust/src/Benchmarks/TTTTag/TTTServer.java +++ /dev/null @@ -1,66 +0,0 @@ -/* Startup object is generated with the initialstate flag set by the - * system to start the computation up */ - -// Create ServerSocket -task Startup(StartupObject s {initialstate}) { - System.printString("TTT Server Starting...\n"); - ServerSocket ss = new ServerSocket(8000); - System.printString("Creating ServerSocket\n"); - Board tttBoard = new Board() {init}; - taskexit(s {!initialstate}); // Turn off initial state flag -} - -//Listen for a request and accept request -task AcceptConnection(ServerSocket ss{SocketPending}) { - System.printString("Waiting for connection...\n"); - tag t=new tag(connect); - TTTServerSocket ttts = new TTTServerSocket() {ReceiveRequest}{t}; - System.printString("Calling accept...\n"); - ss.accept(t); - System.printString("Connected...\n"); -} - -// Process incoming requests -task ProcessRequest(TTTServerSocket ttts{ReceiveRequest}{connect l}, Socket s{IOPending}{connect l}) { - System.printString("Request received..."); - int action = ttts.receive(s); - if (action == 1) { // Make move - taskexit(ttts {!ReceiveRequest,MakeMove}); - } - else { // Send Error - taskexit(ttts {!ReceiveRequest,SendError}); - } -} - -task ProcessMove(TTTServerSocket ttts{MakeMove}, Board tttBoard{init}) { - System.printString("Processing player's move..."); - int result = tttBoard.makeMove(ttts.getRow(), ttts.getCol()); - if (result == 1) { //Move made, send board display - taskexit(ttts {!MakeMove, SendBoard}); - } - else if (result == 2) { //Move made, game over - taskexit(ttts {!MakeMove, SendDone}); - } - else {// Error - taskexit(ttts {!MakeMove, SendError}); - } -} - -task SendBoardDisplay(TTTServerSocket ttts{SendBoard}{connect l}, Board tttBoard{init}, Socket s{}{connect l}) { - ttts.sendBoardDisplay(tttBoard, s); - taskexit(ttts {/*!SendBoard,*/ ReceiveRequest}); - -} - -task GameOver(TTTServerSocket ttts{SendDone}{connect l}, Board tttBoard{init}, Socket s{}{connect l}) { - ttts.sendDone(tttBoard.winner(), s); -// taskexit(ttts {!SendDone},tttBoard{!init}); - -} - -task SendErrorMessage(TTTServerSocket ttts{SendError}{connect l}, Board tttBoard{init}, Socket s{}{connect l}) { - //System.printString("Error\n"); - ttts.sendError(s); - taskexit(ttts {/*!SendError,*/ ReceiveRequest}); - -} diff --git a/Robust/src/Benchmarks/TTTTag/TTTServerSocket.java b/Robust/src/Benchmarks/TTTTag/TTTServerSocket.java deleted file mode 100644 index d0bc5bd9..00000000 --- a/Robust/src/Benchmarks/TTTTag/TTTServerSocket.java +++ /dev/null @@ -1,109 +0,0 @@ -public class TTTServerSocket { - // TTTServerSocket flags - flag ReceiveRequest; - - flag MakeMove; - flag SendError; - flag SendBoard; - flag SendDone; - - String request; - int row, col; - - //Constructor - public TTTServerSocket(){ - System.printString("Constructing TTTServerSocket....\n"); - } - - public int receive(Socket s) - { - byte b1[] = new byte[1024]; - s.read(b1); - request = new String(b1); - System.printString("request: "); - System.printString(request); - if (parseTransaction() == 1) { - System.printString(request); - return 1; - } - System.printString("Error receiving...\n"); - return 0; - } - - // Parse request - public int parseTransaction(){ - int start = request.indexOf('_'); - //System.printString("start parse"); - String s = request.subString(start+1); - //System.printString("before checking the string"); -//_move:3:3 - if (s.startsWith("move")==true){ - //Get row - int i1 = s.indexOf(':'); - String rowStr = new String(s.subString(i1+1, i1+2)); - row = Integer.parseInt(rowStr); - - //System.printString("row"); - - //Get col - String s2 = new String(s.subString(i1+2)); - int i2 = s2.indexOf(':'); - String colStr = new String(s2.subString(i2+1, i2+2)); - col = Integer.parseInt(colStr); - return 1; - - - - } - // Error transaction - return -1; - } - - public int getRow(){ - return row; - } - public int getCol(){ - return col; - } - - public void sendBoardDisplay(Board theBoard, Socket s) { - StringBuffer line1 = new StringBuffer("\n\n"); - - for (int i = 0; i < 3; i++) { - for (int j = 0; j < 3; j++) { - if (theBoard.board[i][j] == 1) - line1.append("X"); - else if (theBoard.board[i][j] == 2) - line1.append("O"); - else - line1.append("-"); - } - line1.append("\n"); - } - String towrite = new String(line1); - s.write(towrite.getBytes()); - return; - } - - public void sendDone(int winner, Socket s) { - StringBuffer line1 = new StringBuffer ("done_"); - if (winner == 0) - line1.append("tie"); - else if (winner == 1) - line1.append("player"); - else - line1.append("computer"); - - String towrite = new String(line1); - s.write(towrite.getBytes()); - return; - } - - public void sendError(Socket s) { - StringBuffer line1 = new StringBuffer ("error_wrongmove"); - - String towrite = new String(line1); - s.write(towrite.getBytes()); - return; - } -} diff --git a/Robust/src/Benchmarks/TileSearch/Java/SubProblem.java b/Robust/src/Benchmarks/TileSearch/Java/SubProblem.java deleted file mode 100644 index a8080acd..00000000 --- a/Robust/src/Benchmarks/TileSearch/Java/SubProblem.java +++ /dev/null @@ -1,223 +0,0 @@ -public class SubProblem { - - public SubProblem(){ - partial = false; - } - - public Tile[] tilesToFit; - public Tile[] tilesFitted; - public TileGrid workingGrid; - - // these indices are into the respective - // tile arrays - public int indexToFit; - public int indexFitted; - - // this score represents the evaluation - // of every arrangement of this sub-problem's - // bestArrangements list - public int highScore; - - public boolean partial; - - public void incrementIndices() { - ++indexFitted; - if( indexFitted == tilesFitted.length ) { - indexFitted = 0; - ++indexToFit; - } - } - - public void initializeSubProblem( SubProblem nsp, int checkingFits ) { - nsp.tilesToFit = new Tile[tilesToFit.length - 1]; - nsp.indexToFit = 0; - - int j = 0; - for( int i = 0; i < tilesToFit.length; ++i ) { - // copy everything but the tile that - // is being moved to the fitted list - if( i != indexToFit ) { - nsp.tilesToFit[j] = tilesToFit[i].copy(); - ++j; - } - } - - nsp.tilesFitted = new Tile[tilesFitted.length + 1]; - nsp.tilesFitted[nsp.tilesFitted.length - 1] = tilesToFit[indexToFit].copy(); - nsp.indexFitted = 0; - for( int i = 0; i < tilesFitted.length; ++i ) { - nsp.tilesFitted[i] = tilesFitted[i].copy(); - // if((checkingFits == 1) || - // (checkingFits == 3)) { - nsp.tilesFitted[i].x = tilesFitted[i].x; - nsp.tilesFitted[i].y = tilesFitted[i].y; - // } - } - - // set fitted tiles position according to fit type - if( checkingFits == 1 ) { - nsp.tilesFitted[nsp.tilesFitted.length - 1].x = - tilesFitted[indexFitted].x; - nsp.tilesFitted[nsp.tilesFitted.length - 1].y = - tilesFitted[indexFitted].y - 1; - } else if( checkingFits == 2 ) { - nsp.tilesFitted[nsp.tilesFitted.length - 1].x = - tilesFitted[indexFitted].x; - nsp.tilesFitted[nsp.tilesFitted.length - 1].y = - tilesFitted[indexFitted].y + 1; - } else if( checkingFits == 3 ) { - nsp.tilesFitted[nsp.tilesFitted.length - 1].x = - tilesFitted[indexFitted].x + 1; - nsp.tilesFitted[nsp.tilesFitted.length - 1].y = - tilesFitted[indexFitted].y; - } else { // ( checkingFits == 4 ) - nsp.tilesFitted[nsp.tilesFitted.length - 1].x = - tilesFitted[indexFitted].x - 1; - nsp.tilesFitted[nsp.tilesFitted.length - 1].y = - tilesFitted[indexFitted].y; - } - - // copy grid and place newly fitted tile in sub-problem's - // version of the grid - nsp.workingGrid = workingGrid.copy(); - nsp.workingGrid.grid[nsp.tilesFitted[nsp.tilesFitted.length - 1].x] - [nsp.tilesFitted[nsp.tilesFitted.length - 1].y] = - nsp.tilesFitted.length - 1; - - nsp.highScore = highScore; - - /* - System.printString( "-----------new sub-problem------------\n" ); - //System.printString( "raw grid\n" ); - //nsp.workingGrid.printGridRaw(); - System.printString( "tiles fitted:\n" ); - nsp.printTileArray( nsp.tilesFitted ); - System.printString( "tiles to fit:\n" ); - nsp.printTileArray( nsp.tilesToFit ); - //System.printString( "the nice grid:\n" ); - //nsp.workingGrid.printGrid( nsp.tilesFitted ); - System.printString( "nsp.indexToFit: " ); - System.printInt( nsp.indexToFit ); - System.printString( "\n" ); - System.printString( "nsp.indexFitted: " ); - System.printInt( nsp.indexFitted ); - System.printString( "\n" ); - System.printString( "-----------end sub-problem------------\n" ); - */ - } - - public void scoreWorkingGrid() { - highScore = 0; - for( int i = 0; i < tilesFitted.length; ++i ) { - Tile tileToScore = tilesFitted[i]; - // add those face values that are not adjacent to other face - // N - if(this.workingGrid.grid[tileToScore.x][tileToScore.y-1] == -1) { - highScore += tileToScore.n; - } - // S - if(this.workingGrid.grid[tileToScore.x][tileToScore.y+1] == -1) { - highScore += tileToScore.s; - } - // E - if(this.workingGrid.grid[tileToScore.x+1][tileToScore.y] == -1) { - highScore += tileToScore.e; - } - // W - if(this.workingGrid.grid[tileToScore.x-1][tileToScore.y] == -1) { - highScore += tileToScore.w; - } - } - } - - public int highestScore() { - int score = 0; - - if( this.tilesToFit.length == 0 ){ - scoreWorkingGrid(); - score = this.highScore; - } else { - while(indexToFit != tilesToFit.length) { - if( workingGrid.validFitNorth(tilesToFit [indexToFit], tilesFitted[indexFitted], tilesFitted ) ) { - //System.printString( "North: \n" ); - SubProblem newSP = new SubProblem(); - initializeSubProblem( newSP, 1 ); - int temp = newSP.highestScore(); - if(score < temp) { - score = temp; - } - //System.printString( "match! new a SubProblem\n" ); - } - - if( workingGrid.validFitSouth(tilesToFit [indexToFit], tilesFitted[indexFitted], tilesFitted ) ) { - //System.printString( "South: \n" ); - SubProblem newSP = new SubProblem(); - initializeSubProblem( newSP, 2 ); - int temp = newSP.highestScore(); - if(score < temp) { - score = temp; - } - //System.printString( "match! new a SubProblem\n" ); - } - - if( workingGrid.validFitEast(tilesToFit [indexToFit], tilesFitted[indexFitted], tilesFitted ) ) { - //System.printString( "East: \n" ); - SubProblem newSP = new SubProblem(); - initializeSubProblem( newSP, 3 ); - int temp = newSP.highestScore(); - if(score < temp) { - score = temp; - } - //System.printString( "match! new a SubProblem\n" ); - } - - if( workingGrid.validFitWest(tilesToFit [indexToFit], tilesFitted[indexFitted], tilesFitted ) ) { - //System.printString( "West: \n" ); - SubProblem newSP = new SubProblem(); - initializeSubProblem( newSP, 4 ); - int temp = newSP.highestScore(); - if(score < temp) { - score = temp; - } - //System.printString( "match! new a SubProblem\nSpawn finished! Go on find new fits.\n" ); - } - - incrementIndices(); - } - } - - return score; - } - - public void printTileArray( Tile tiles[] ) { - for( int i = 0; i < tiles.length; ++i ) { - tiles[i].printRow0(); - System.printString( " " ); - } - System.printString("\n"); - - for( int i = 0; i < tiles.length; ++i ) { - tiles[i].printRow1(); - System.printString( " " ); - } - System.printString("\n"); - - for( int i = 0; i < tiles.length; ++i ) { - tiles[i].printRow2(); - System.printString( " " ); - } - System.printString("\n"); - - for( int i = 0; i < tiles.length; ++i ) { - tiles[i].printRow3(); - System.printString( " " ); - } - System.printString("\n"); - - for( int i = 0; i < tiles.length; ++i ) { - tiles[i].printRow4(); - System.printString( ", " ); - } - System.printString("\n"); - } -} diff --git a/Robust/src/Benchmarks/TileSearch/Java/Tile.java b/Robust/src/Benchmarks/TileSearch/Java/Tile.java deleted file mode 100644 index c2346d8f..00000000 --- a/Robust/src/Benchmarks/TileSearch/Java/Tile.java +++ /dev/null @@ -1,56 +0,0 @@ -public class Tile { - public Tile( int n, int s, int e, int w ) { - this.n = n; - this.s = s; - this.e = e; - this.w = w; - } - - // value of tile faces - int n, s, e, w; - - public Tile copy() { - Tile t = new Tile( n, s, e, w ); - return t; - } - - public void printTile() { - printRow0(); System.printString("\n"); - printRow1(); System.printString("\n"); - printRow2(); System.printString("\n"); - printRow3(); System.printString("\n"); - printRow4(); System.printString("\n"); - } - - public void printRow0(){ System.printString( "+-------+" ); } - public void printRow1(){ if( n < 0 ) { - System.printString( "| " ); - } else { - System.printString( "| " ); } - System.printInt( n ); - System.printString( " |" ); } - public void printRow2(){ if( w < 0 ) { - System.printString( "|" ); - } else { - System.printString( "| " ); } - System.printInt( w ); - if( e < 0 ) { - System.printString( " " ); - } else { - System.printString( " " ); } - System.printInt( e ); - System.printString( " |" ); } - public void printRow3(){ if( s < 0 ) { - System.printString( "| " ); - } else { - System.printString( "| " ); } - System.printInt( s ); - System.printString( " |" ); } - public void printRow4(){ System.printString( "+-------+" ); } - - // position in the grid - // this information is also represented by - // the indices into a TileGrid, but it is - // convenient to duplicate it - int x, y; -} diff --git a/Robust/src/Benchmarks/TileSearch/Java/TileGrid.java b/Robust/src/Benchmarks/TileSearch/Java/TileGrid.java deleted file mode 100644 index e28628d2..00000000 --- a/Robust/src/Benchmarks/TileSearch/Java/TileGrid.java +++ /dev/null @@ -1,407 +0,0 @@ -public class TileGrid { - public TileGrid( int gridSize ) { - // make the grid size big enough - // such that starting with a tile - // in the middle and placing tiles - // in one direction, that the grid - // is big enough without requiring - // bound-checking - this.gridSize = gridSize; - - grid = new int[gridSize][]; - for( int i = 0; i < gridSize; ++i ) { - grid[i] = new int[gridSize]; - for( int j = 0; j < gridSize; ++j ) { - // use -1 to indicate no tile - grid[i][j] = -1; - } - } - } - - public int gridSize; - - // each element of this grid is an integer - // index into a tilesFitted array -- not - // very good object-oriented style! - public int grid[][]; - - - public TileGrid copy() { - TileGrid tg = new TileGrid( gridSize ); - - for( int i = 0; i < gridSize; ++i ) { - for( int j = 0; j < gridSize; ++j ) { - tg.grid[i][j] = grid[i][j]; - } - } - - return tg; - } - - public boolean anyValidFit( Tile tileToFit, - Tile tileFitted, - Tile[] tilesFitted ) { - //System.printString( "top fo anyValidFit\n" ); - return validFitNorth( tileToFit, tileFitted, tilesFitted ) || - validFitSouth( tileToFit, tileFitted, tilesFitted ) || - validFitEast ( tileToFit, tileFitted, tilesFitted ) || - validFitWest ( tileToFit, tileFitted, tilesFitted ); - } - - public boolean validFitNorth( Tile tileToFit, - Tile tileFitted, - Tile[] tilesFitted ) { - //System.printString( "top of validFitNorth\n" ); - //System.printString( "tileToFit.s:" + tileToFit.s + "\n" ); - //System.printString( "tileFitted.n:" + tileFitted.n + "\n" ); - - // when the tileToFit's S matches fitted N... - if( tileToFit.s == tileFitted.n ) { - tileToFit.x = tileFitted.x; - tileToFit.y = tileFitted.y - 1; - - /* - System.printString( "Check if can put it here\n" ); - System.printString( "x: " + tileToFit.x + "; y: " + tileToFit.y + "\n" ); - System.printInt( grid[tileToFit.x][tileToFit.y] ); - System.printString( "\n" ); - System.printInt( grid[tileToFit.x][tileToFit.y-1] ); - if(grid[tileToFit.x][tileToFit.y-1] != -1) { - System.printString( " s:" + tilesFitted[grid[tileToFit.x][tileToFit.y-1]].s ); - } - System.printString( "\n" ); - System.printInt( grid[tileToFit.x+1][tileToFit.y] ); - if(grid[tileToFit.x+1][tileToFit.y] != -1) { - System.printString( " w:" + tilesFitted[grid[tileToFit.x+1][tileToFit.y]].w ); - } - System.printString( "\n" ); - System.printInt( grid[tileToFit.x-1][tileToFit.y] ); - if(grid[tileToFit.x-1][tileToFit.y] != -1) { - System.printString( " e:" + tilesFitted[grid[tileToFit.x-1][tileToFit.y]].e ); - } - System.printString( "\n" ); - */ - - // check that the place to fit is empty AND - // (place to fit + N is empty or matches) AND - // (place to fit + E is empty or matches) AND - // (place to fit + W is empty or matches) - if( grid[tileToFit.x][tileToFit.y] == -1 && - - (grid[tileToFit.x][tileToFit.y-1] == -1 || - tilesFitted[grid[tileToFit.x][tileToFit.y-1]].s == tileToFit.n) && - - (grid[tileToFit.x+1][tileToFit.y] == -1 || - tilesFitted[grid[tileToFit.x+1][tileToFit.y]].w == tileToFit.e) && - - (grid[tileToFit.x-1][tileToFit.y] == -1 || - tilesFitted[grid[tileToFit.x-1][tileToFit.y]].e == tileToFit.w) ) { - return true; - } - } - - return false; - } - - public boolean validFitSouth( Tile tileToFit, - Tile tileFitted, - Tile[] tilesFitted ) { - //System.printString( "top of validFitSouth\n" ); - - // when the tileToFit's N matches fitted S... - if( tileToFit.n == tileFitted.s ) { - tileToFit.x = tileFitted.x; - tileToFit.y = tileFitted.y + 1; - - // check that the place to fit is empty AND - // (place to fit + S is empty or matches) AND - // (place to fit + E is empty or matches) AND - // (place to fit + W is empty or matches) - if( grid[tileToFit.x][tileToFit.y] == -1 && - - (grid[tileToFit.x][tileToFit.y+1] == -1 || - tilesFitted[grid[tileToFit.x][tileToFit.y+1]].n == tileToFit.s) && - - (grid[tileToFit.x+1][tileToFit.y] == -1 || - tilesFitted[grid[tileToFit.x+1][tileToFit.y]].w == tileToFit.e) && - - (grid[tileToFit.x-1][tileToFit.y] == -1 || - tilesFitted[grid[tileToFit.x-1][tileToFit.y]].e == tileToFit.w) ) { - return true; - } - } - - return false; - } - - public boolean validFitEast( Tile tileToFit, - Tile tileFitted, - Tile[] tilesFitted ) { - //System.printString( "top of validFitEast\n" ); - - // when the tileToFit's W matches fitted E... - if( tileToFit.w == tileFitted.e ) { - tileToFit.x = tileFitted.x + 1; - tileToFit.y = tileFitted.y; - - /* - System.printString( "raw grid:\n" ); - printGridRaw(); - - System.printString( "x: " ); - System.printInt( tileToFit.x ); - System.printString( "\n" ); - - System.printString( "y: " ); - System.printInt( tileToFit.y ); - System.printString( "\n" ); - - System.printString( "tile index 1: " ); - System.printInt( grid[tileToFit.x][tileToFit.y-1] ); - System.printString( "\n" ); - - System.printString( "tile index 2: " ); - System.printInt( grid[tileToFit.x][tileToFit.y+1] ); - System.printString( "\n" ); - - System.printString( "tile index 3: " ); - System.printInt( grid[tileToFit.x+1][tileToFit.y] ); - System.printString( "\n" ); - */ - - // check that the place to fit is empty AND - // (place to fit + N is empty or matches) AND - // (place to fit + S is empty or matches) AND - // (place to fit + E is empty or matches) - if( grid[tileToFit.x][tileToFit.y] == -1 && - - ( grid[tileToFit.x][tileToFit.y-1] == -1 || - tilesFitted[grid[tileToFit.x][tileToFit.y-1]].s == tileToFit.n) && - - ( grid[tileToFit.x][tileToFit.y+1] == -1 || - tilesFitted[grid[tileToFit.x][tileToFit.y+1]].n == tileToFit.s) && - - ( grid[tileToFit.x+1][tileToFit.y] == -1 || - tilesFitted[grid[tileToFit.x+1][tileToFit.y]].w == tileToFit.e) ) { - return true; - } - } - - return false; - } - - public boolean validFitWest( Tile tileToFit, - Tile tileFitted, - Tile[] tilesFitted ) { - //System.printString( "top of validFitWest\n" ); - - // when the tileToFit's E matches fitted W... - if( tileToFit.e == tileFitted.w ) { - tileToFit.x = tileFitted.x - 1; - tileToFit.y = tileFitted.y; - - // check that the place to fit is empty AND - // (place to fit + N is empty or matches) AND - // (place to fit + S is empty or matches) AND - // (place to fit + W is empty or matches) - if( grid[tileToFit.x][tileToFit.y] == -1 && - - (grid[tileToFit.x][tileToFit.y-1] == -1 || - tilesFitted[grid[tileToFit.x][tileToFit.y-1]].s == tileToFit.n) && - - (grid[tileToFit.x][tileToFit.y+1] == -1 || - tilesFitted[grid[tileToFit.x][tileToFit.y+1]].n == tileToFit.s) && - - (grid[tileToFit.x-1][tileToFit.y] == -1 || - tilesFitted[grid[tileToFit.x-1][tileToFit.y]].e == tileToFit.w) ) { - return true; - } - } - - return false; - } - - - // indices to represent the bounding - // box of tiles placed in the grid - public int x0, y0, x1, y1; - - public void printGridRaw() { - for( int j = 0; j < gridSize; ++j ) { - for( int i = 0; i < gridSize; ++i ) { - System.printInt( grid[i][j] ); - - if( grid[i][j] < 0 ) { - System.printString( " " ); - } else { - System.printString( " " ); - } - } - System.printString("\n"); - } - } - - public void printGrid( Tile[] tilesFitted ) { -/* - System.printString( "Printing a grid...\n" ); - printGridRaw(); - - computeBoundingBox(); - - for( int j = y0; j <= y1; ++j ) - { - for( int i = x0; i <= x1; ++i ) - { - System.printString( "i=" ); - System.printInt( i ); - System.printString( ", j=" ); - System.printInt( j ); - //System.printString( "\n" ); - - if( grid[i][j] == -1 ) { - printEmptyTileRow(); - } else { - tilesFitted[grid[i][j]].printRow0(); - } - } - System.printString( "\n" ); - - for( int i = x0; i <= x1; ++i ) - { - System.printString( "i=" ); - System.printInt( i ); - System.printString( ", j=" ); - System.printInt( j ); - //System.printString( "\n" ); - - if( grid[i][j] == -1 ) { - printEmptyTileRow(); - } else { - tilesFitted[grid[i][j]].printRow1(); - } - } - System.printString( "\n" ); - - for( int i = x0; i <= x1; ++i ) - { - System.printString( "i=" ); - System.printInt( i ); - System.printString( ", j=" ); - System.printInt( j ); - //System.printString( "\n" ); - - iString( "\n" )f( grid[i][j] == -1 ) { - printEmptyTileRow(); - } else { - tilesFitted[grid[i][j]].printRow2(); - } - } - System.printString( "\n" ); - - for( int i = x0; i <= x1; ++i ) - { - System.printString( "i=" ); - System.printInt( i ); - System.printString( ", j=" ); - System.printInt( j ); - //System.printString( "\n" ); - - if( grid[i][j] == -1 ) { - printEmptyTileRow(); - } else { - tilesFitted[grid[i][j]].printRow3(); - } - } - System.printString( "\n" ); - - for( int i = x0; i <= x1; ++i ) - { - System.printString( "i=" ); - System.printInt( i ); - System.printString( ", j=" ); - System.printInt( j ); - //System.printString( "\n" ); - - if( grid[i][j] == -1 ) { - printEmptyTileRow(); - } else { - tilesFitted[grid[i][j]].printRow4(); - } - } - System.out.println(); - } -*/ - } - - public void printEmptyTileRow() { - System.printString( " \n" ); - } - - public void computeBoundingBox() { - System.printString( "Starting computeBoundingBox\n" ); - - int i = 0; - while( i < gridSize*gridSize ) { - int a = i % gridSize; - int b = i / gridSize; - - if( grid[b][a] != -1 ) { - x0 = b; - - // this statement is like "break" - i = gridSize*gridSize; - } - - ++i; - } - - i = 0; - while( i < gridSize*gridSize ) { - int a = i % gridSize; - int b = i / gridSize; - - if( grid[a][b] != -1 ) { - y0 = b; - - // this statement is like "break" - i = gridSize*gridSize; - } - - ++i; - } - - i = 0; - while( i < gridSize*gridSize ) { - int a = i % gridSize; - int b = i / gridSize; - int c = gridSize - 1 - b; - - if( grid[c][a] != -1 ) { - x1 = c; - - // this statement is like "break" - i = gridSize*gridSize; - } - - ++i; - } - - i = 0; - while( i < gridSize*gridSize ) { - int a = i % gridSize; - int b = i / gridSize; - int c = gridSize - 1 - b; - - if( grid[a][c] != -1 ) { - y1 = c; - - // this statement is like "break" - i = gridSize*gridSize; - } - - ++i; - } - - System.printString( "Ending computeBoundingBox\n" ); - } -} diff --git a/Robust/src/Benchmarks/TileSearch/Java/TileSearch.java b/Robust/src/Benchmarks/TileSearch/Java/TileSearch.java deleted file mode 100644 index fa8b8388..00000000 --- a/Robust/src/Benchmarks/TileSearch/Java/TileSearch.java +++ /dev/null @@ -1,95 +0,0 @@ -////////////////////////////////////////////// -// -// tileSearch is a program to solve the -// following problem: -// -// Find all arrangements of N square tiles -// that evaluate to the highest possible score. -// -// Each tile has an integer on its north, south -// east and west faces. Tiles faces may only -// be adjacent to other tile faces with the -// same number. -// -// Tiles may not be rotated. -// -// All tiles in the final arrangement must -// be adjacent to at least one other tile. -// -// The score of an arrangement is the sum of -// all tile face values that are not adjacent -// to another face. -// -// Example input: -// -// +-----+ +-----+ +-----+ +-----+ -// | 3 | | 4 | | 9 | | 3 | -// |2 1| |5 5| |1 1| |5 2| -// | 4 | | 3 | | 4 | | 9 | -// +-----+, +-----+, +-----+, +-----+ -// -// A valid arrangement could be: -// -// +-----++-----+ -// | 3 || 9 | -// |2 1||1 1| -// | 4 || 4 | -// +-----++-----+ -// +-----++-----+ -// | 4 || 3 | -// |5 5||5 2| -// | 3 || 9 | -// +-----++-----+ -// -// Which scores: -// -// 3 + 9 + 1 + 3 + 2 + 9 + 3 + 5 + 4 + 2 = 41 -// -// -// What is the highest possible score for a -// given tile input? -// -////////////////////////////////////////////// - -public class TileSearch { - - public static void main(String args[]) { - SubProblem top = new SubProblem(); - /* - top.tilesToFit = new Tile[2]; - top.tilesToFit[0] = new Tile( 3, 2, 3, 1 ); - top.tilesToFit[1] = new Tile( 2, -4, -4, -4 ); - - top.tilesFitted = new Tile[1]; - top.tilesFitted[0] = new Tile( -1, -1, 1, -1 ); - */ - - - top.tilesToFit = new Tile[3]; - top.tilesToFit[0] = new Tile( 2, 1, -1, 0 ); - top.tilesToFit[1] = new Tile( 1, 3, 0, -1 ); - top.tilesToFit[2] = new Tile( -1, 1, -1, 0 ); - //top.tilesToFit[3] = new Tile( 1, 2, 2, -1 ); - //top.tilesToFit[4] = new Tile( 2, 2, 1, 2 ); - //top.tilesToFit[5] = new Tile( -1, 1, 0, 1 ); - - top.tilesFitted = new Tile[1]; - top.tilesFitted[0] = new Tile( 1, -1, 0, 2 ); - - top.indexToFit = 0; - top.indexFitted = 0; - top.workingGrid = new TileGrid( (top.tilesToFit.length+5)*2 + 4 ); //new TileGrid( (top.tilesToFit.length+1)*2 + 1 ); - - // put first fitted tile in the middle of the grid - top.tilesFitted[0].x = top.workingGrid.gridSize/2; - top.tilesFitted[0].y = top.workingGrid.gridSize/2; - top.workingGrid.grid[top.tilesFitted[0].x] - [top.tilesFitted[0].y] = 0; - - top.highScore = 0; - - int score = top.highestScore(); - System.printString("Highest score: " + score + "\n"); - } - -} diff --git a/Robust/src/Benchmarks/TileSearch/Tag/GlobalCounter.java b/Robust/src/Benchmarks/TileSearch/Tag/GlobalCounter.java deleted file mode 100644 index 68f853e6..00000000 --- a/Robust/src/Benchmarks/TileSearch/Tag/GlobalCounter.java +++ /dev/null @@ -1,10 +0,0 @@ -public class GlobalCounter { - flag Init; - public int counter; - public boolean partial; - - public GlobalCounter() { - counter = 0; - partial = false; - } -} diff --git a/Robust/src/Benchmarks/TileSearch/Tag/SubProblem.java b/Robust/src/Benchmarks/TileSearch/Tag/SubProblem.java deleted file mode 100644 index 25795677..00000000 --- a/Robust/src/Benchmarks/TileSearch/Tag/SubProblem.java +++ /dev/null @@ -1,168 +0,0 @@ -public class SubProblem { - flag findingNewFits; - flag scored; - flag main; - flag leaf; - - public SubProblem(){ - partial = false; - } - - public Tile[] tilesToFit; - public Tile[] tilesFitted; - public TileGrid workingGrid; - - // these indices are into the respective - // tile arrays - public int indexToFit; - public int indexFitted; - - // this score represents the evaluation - // of every arrangement of this sub-problem's - // bestArrangements list - public int highScore; - - public boolean partial; - - public void incrementIndices() { - ++indexFitted; - if( indexFitted == tilesFitted.length ) { - indexFitted = 0; - ++indexToFit; - } - } - - public void initializeSubProblem( SubProblem nsp, int checkingFits ) { - nsp.tilesToFit = new Tile[tilesToFit.length - 1]; - nsp.indexToFit = 0; - - int j = 0; - for( int i = 0; i < tilesToFit.length; ++i ) { - // copy everything but the tile that - // is being moved to the fitted list - if( i != indexToFit ) { - nsp.tilesToFit[j] = tilesToFit[i].copy(); - ++j; - } - } - - nsp.tilesFitted = new Tile[tilesFitted.length + 1]; - nsp.tilesFitted[nsp.tilesFitted.length - 1] = tilesToFit[indexToFit].copy(); - nsp.indexFitted = 0; - for( int i = 0; i < tilesFitted.length; ++i ) { - nsp.tilesFitted[i] = tilesFitted[i].copy(); - // if((checkingFits == 1) || - // (checkingFits == 3)) { - nsp.tilesFitted[i].x = tilesFitted[i].x; - nsp.tilesFitted[i].y = tilesFitted[i].y; - // } - } - - // set fitted tiles position according to fit type - if( checkingFits == 1 ) { - nsp.tilesFitted[nsp.tilesFitted.length - 1].x = - tilesFitted[indexFitted].x; - nsp.tilesFitted[nsp.tilesFitted.length - 1].y = - tilesFitted[indexFitted].y - 1; - } else if( checkingFits == 2 ) { - nsp.tilesFitted[nsp.tilesFitted.length - 1].x = - tilesFitted[indexFitted].x; - nsp.tilesFitted[nsp.tilesFitted.length - 1].y = - tilesFitted[indexFitted].y + 1; - } else if( checkingFits == 3 ) { - nsp.tilesFitted[nsp.tilesFitted.length - 1].x = - tilesFitted[indexFitted].x + 1; - nsp.tilesFitted[nsp.tilesFitted.length - 1].y = - tilesFitted[indexFitted].y; - } else { // ( checkingFits == 4 ) - nsp.tilesFitted[nsp.tilesFitted.length - 1].x = - tilesFitted[indexFitted].x - 1; - nsp.tilesFitted[nsp.tilesFitted.length - 1].y = - tilesFitted[indexFitted].y; - } - - // copy grid and place newly fitted tile in sub-problem's - // version of the grid - nsp.workingGrid = workingGrid.copy(); - nsp.workingGrid.grid[nsp.tilesFitted[nsp.tilesFitted.length - 1].x] - [nsp.tilesFitted[nsp.tilesFitted.length - 1].y] = - nsp.tilesFitted.length - 1; - - nsp.highScore = highScore; - - /* - System.printString( "-----------new sub-problem------------\n" ); - //System.printString( "raw grid\n" ); - //nsp.workingGrid.printGridRaw(); - System.printString( "tiles fitted:\n" ); - nsp.printTileArray( nsp.tilesFitted ); - System.printString( "tiles to fit:\n" ); - nsp.printTileArray( nsp.tilesToFit ); - //System.printString( "the nice grid:\n" ); - //nsp.workingGrid.printGrid( nsp.tilesFitted ); - System.printString( "nsp.indexToFit: " ); - System.printInt( nsp.indexToFit ); - System.printString( "\n" ); - System.printString( "nsp.indexFitted: " ); - System.printInt( nsp.indexFitted ); - System.printString( "\n" ); - System.printString( "-----------end sub-problem------------\n" ); - */ - } - - public void scoreWorkingGrid() { - highScore = 0; - for( int i = 0; i < tilesFitted.length; ++i ) { - Tile tileToScore = tilesFitted[i]; - // add those face values that are not adjacent to other face - // N - if(this.workingGrid.grid[tileToScore.x][tileToScore.y-1] == -1) { - highScore += tileToScore.n; - } - // S - if(this.workingGrid.grid[tileToScore.x][tileToScore.y+1] == -1) { - highScore += tileToScore.s; - } - // E - if(this.workingGrid.grid[tileToScore.x+1][tileToScore.y] == -1) { - highScore += tileToScore.e; - } - // W - if(this.workingGrid.grid[tileToScore.x-1][tileToScore.y] == -1) { - highScore += tileToScore.w; - } - } - } - - public printTileArray( Tile tiles[] ) { - for( int i = 0; i < tiles.length; ++i ) { - tiles[i].printRow0(); - System.printString( " " ); - } - System.printString( "\n" ); - - for( int i = 0; i < tiles.length; ++i ) { - tiles[i].printRow1(); - System.printString( " " ); - } - System.printString( "\n" ); - - for( int i = 0; i < tiles.length; ++i ) { - tiles[i].printRow2(); - System.printString( " " ); - } - System.printString( "\n" ); - - for( int i = 0; i < tiles.length; ++i ) { - tiles[i].printRow3(); - System.printString( " " ); - } - System.printString( "\n" ); - - for( int i = 0; i < tiles.length; ++i ) { - tiles[i].printRow4(); - System.printString( ", " ); - } - System.printString( "\n" ); - } -} diff --git a/Robust/src/Benchmarks/TileSearch/Tag/Tile.java b/Robust/src/Benchmarks/TileSearch/Tag/Tile.java deleted file mode 100644 index 211c229d..00000000 --- a/Robust/src/Benchmarks/TileSearch/Tag/Tile.java +++ /dev/null @@ -1,481 +0,0 @@ -public class Tile { - public Tile( int n, int s, int e, int w ) { - this.n = n; - this.s = s; - this.e = e; - this.w = w; - } - - // value of tile faces - int n, s, e, w; - - public Tile copy() { - Tile t = new Tile( n, s, e, w ); - return t; - } - - public void printTile() { - printRow0(); System.printString( "\n" ); - printRow1(); System.printString( "\n" ); - printRow2(); System.printString( "\n" ); - printRow3(); System.printString( "\n" ); - printRow4(); System.printString( "\n" ); - } - - public void printRow0() { - System.printString ( "+-------+" ); - } - - public printRow1() { - if( n < 0 ) { - System.printString( "| " ); - } else { - System.printString( "| " ); - } - System.printInt( n ); - System.printString( " |" ); - } - - public void printRow2() { - if( w < 0 ) { - System.printString( "|" ); - } else { - System.printString( "| " ); - } - System.printInt ( w ); - if( e < 0 ) { - System.printString( " " ); - } else { - System.printString( " " ); - } - System.printInt ( e ); - System.printString ( " |" ); - } - - public void printRow3() { - if( s < 0 ) { - System.printString( "| " ); - } else { - System.printString( "| " ); - } - System.printInt ( s ); - System.printString ( " |" ); - } - - public void printRow4() { - System.printString ( "+-------+" ); - } - - // position in the grid - // this information is also represented by - // the indices into a TileGrid, but it is - // convenient to duplicate it - int x, y; -} - -public class TileGrid { - public TileGrid( int gridSize ) { - // make the grid size big enough - // such that starting with a tile - // in the middle and placing tiles - // in one direction, that the grid - // is big enough without requiring - // bound-checking - this.gridSize = gridSize; - - grid = new int[gridSize][]; - for( int i = 0; i < gridSize; ++i ) { - grid[i] = new int[gridSize]; - for( int j = 0; j < gridSize; ++j ) { - // use -1 to indicate no tile - grid[i][j] = -1; - } - } - } - - public int gridSize; - - // each element of this grid is an integer - // index into a tilesFitted array -- not - // very good object-oriented style! - public int grid[][]; - - public TileGrid copy() { - TileGrid tg = new TileGrid( gridSize ); - - for( int i = 0; i < gridSize; ++i ) { - for( int j = 0; j < gridSize; ++j ) { - tg.grid[i][j] = grid[i][j]; - } - } - - return tg; - } - - public boolean anyValidFit( Tile tileToFit, - Tile tileFitted, - Tile[] tilesFitted ) { - //System.printString( "top fo anyValidFit\n" ); - return validFitNorth( tileToFit, tileFitted, tilesFitted ) || - validFitSouth( tileToFit, tileFitted, tilesFitted ) || - validFitEast ( tileToFit, tileFitted, tilesFitted ) || - validFitWest ( tileToFit, tileFitted, tilesFitted ); - } - - public boolean validFitNorth( Tile tileToFit, - Tile tileFitted, - Tile[] tilesFitted ) { - //System.printString( "top of validFitNorth\n" ); - //System.printString( "tileToFit.s:" + tileToFit.s + "\n" ); - //System.printString( "tileFitted.n:" + tileFitted.n + "\n" ); - - // when the tileToFit's S matches fitted N... - if( tileToFit.s == tileFitted.n ) { - tileToFit.x = tileFitted.x; - tileToFit.y = tileFitted.y - 1; - - /* - System.printString( "Check if can put it here\n" ); - System.printString( "x: " + tileToFit.x + "; y: " + tileToFit.y + "\n" ); - System.printInt( grid[tileToFit.x][tileToFit.y] ); - System.printString( "\n" ); - System.printInt( grid[tileToFit.x][tileToFit.y-1] ); - if(grid[tileToFit.x][tileToFit.y-1] != -1) { - System.printString( " s:" + tilesFitted[grid[tileToFit.x][tileToFit.y-1]].s ); - } - System.printString( "\n" ); - System.printInt( grid[tileToFit.x+1][tileToFit.y] ); - if(grid[tileToFit.x+1][tileToFit.y] != -1) { - System.printString( " w:" + tilesFitted[grid[tileToFit.x+1][tileToFit.y]].w ); - } - System.printString( "\n" ); - System.printInt( grid[tileToFit.x-1][tileToFit.y] ); - if(grid[tileToFit.x-1][tileToFit.y] != -1) { - System.printString( " e:" + tilesFitted[grid[tileToFit.x-1][tileToFit.y]].e ); - } - System.printString( "\n" ); - */ - // check that the place to fit is empty AND - // (place to fit + N is empty or matches) AND - // (place to fit + E is empty or matches) AND - // (place to fit + W is empty or matches) - if( grid[tileToFit.x][tileToFit.y] == -1 && - - (grid[tileToFit.x][tileToFit.y-1] == -1 || - tilesFitted[grid[tileToFit.x][tileToFit.y-1]].s == tileToFit.n) && - - (grid[tileToFit.x+1][tileToFit.y] == -1 || - tilesFitted[grid[tileToFit.x+1][tileToFit.y]].w == tileToFit.e) && - - (grid[tileToFit.x-1][tileToFit.y] == -1 || - tilesFitted[grid[tileToFit.x-1][tileToFit.y]].e == tileToFit.w) ) { - return true; - } - } - - return false; - } - - public boolean validFitSouth( Tile tileToFit, - Tile tileFitted, - Tile[] tilesFitted ) { - //System.printString( "top of validFitSouth\n" ); - - // when the tileToFit's N matches fitted S... - if( tileToFit.n == tileFitted.s ) { - tileToFit.x = tileFitted.x; - tileToFit.y = tileFitted.y + 1; - - // check that the place to fit is empty AND - // (place to fit + S is empty or matches) AND - // (place to fit + E is empty or matches) AND - // (place to fit + W is empty or matches) - if( grid[tileToFit.x][tileToFit.y] == -1 && - - (grid[tileToFit.x][tileToFit.y+1] == -1 || - tilesFitted[grid[tileToFit.x][tileToFit.y+1]].n == tileToFit.s) && - - (grid[tileToFit.x+1][tileToFit.y] == -1 || - tilesFitted[grid[tileToFit.x+1][tileToFit.y]].w == tileToFit.e) && - - (grid[tileToFit.x-1][tileToFit.y] == -1 || - tilesFitted[grid[tileToFit.x-1][tileToFit.y]].e == tileToFit.w) ) { - return true; - } - } - - return false; - } - - public boolean validFitEast( Tile tileToFit, - Tile tileFitted, - Tile[] tilesFitted ) { - //System.printString( "top of validFitEast\n" ); - - // when the tileToFit's W matches fitted E... - if( tileToFit.w == tileFitted.e ) { - tileToFit.x = tileFitted.x + 1; - tileToFit.y = tileFitted.y; - - /* - System.printString( "raw grid:\n" ); - printGridRaw(); - - System.printString( "x: " ); - System.printInt( tileToFit.x ); - System.printString( "\n" ); - - System.printString( "y: " ); - System.printInt( tileToFit.y ); - System.printString( "\n" ); - - System.printString( "tile index 1: " ); - System.printInt( grid[tileToFit.x][tileToFit.y-1] ); - System.printString( "\n" ); - - System.printString( "tile index 2: " ); - System.printInt( grid[tileToFit.x][tileToFit.y+1] ); - System.printString( "\n" ); - - System.printString( "tile index 3: " ); - System.printInt( grid[tileToFit.x+1][tileToFit.y] ); - System.printString( "\n" ); - */ - - // check that the place to fit is empty AND - // (place to fit + N is empty or matches) AND - // (place to fit + S is empty or matches) AND - // (place to fit + E is empty or matches) - if( grid[tileToFit.x][tileToFit.y] == -1 && - - ( grid[tileToFit.x][tileToFit.y-1] == -1 || - tilesFitted[grid[tileToFit.x][tileToFit.y-1]].s == tileToFit.n) && - - ( grid[tileToFit.x][tileToFit.y+1] == -1 || - tilesFitted[grid[tileToFit.x][tileToFit.y+1]].n == tileToFit.s) && - - ( grid[tileToFit.x+1][tileToFit.y] == -1 || - tilesFitted[grid[tileToFit.x+1][tileToFit.y]].w == tileToFit.e) ) { - return true; - } - } - - return false; - } - - public boolean validFitWest( Tile tileToFit, - Tile tileFitted, - Tile[] tilesFitted ) { - //System.printString( "top of validFitWest\n" ); - - // when the tileToFit's E matches fitted W... - if( tileToFit.e == tileFitted.w ) { - tileToFit.x = tileFitted.x - 1; - tileToFit.y = tileFitted.y; - - // check that the place to fit is empty AND - // (place to fit + N is empty or matches) AND - // (place to fit + S is empty or matches) AND - // (place to fit + W is empty or matches) - if( grid[tileToFit.x][tileToFit.y] == -1 && - - (grid[tileToFit.x][tileToFit.y-1] == -1 || - tilesFitted[grid[tileToFit.x][tileToFit.y-1]].s == tileToFit.n) && - - (grid[tileToFit.x][tileToFit.y+1] == -1 || - tilesFitted[grid[tileToFit.x][tileToFit.y+1]].n == tileToFit.s) && - - (grid[tileToFit.x-1][tileToFit.y] == -1 || - tilesFitted[grid[tileToFit.x-1][tileToFit.y]].e == tileToFit.w) ) { - return true; - } - } - - return false; - } - - - // indices to represent the bounding - // box of tiles placed in the grid - public int x0, y0, x1, y1; - - public void printGridRaw() { - for( int j = 0; j < gridSize; ++j ) { - for( int i = 0; i < gridSize; ++i ) { - System.printInt( grid[i][j] ); - - if( grid[i][j] < 0 ) { - System.printString( " " ); - } - else { - System.printString( " " ); - } - } - System.printString( "\n" ); - } - } - - public void printGrid( Tile[] tilesFitted ) { - /* - System.printString( "Printing a grid...\n" ); - printGridRaw(); - - computeBoundingBox(); - - for( int j = y0; j <= y1; ++j ) - { - for( int i = x0; i <= x1; ++i ) - { - System.printString( "i=" ); - System.printInt( i ); - System.printString( ", j=" ); - System.printInt( j ); - //System.printString( "\n" ); - - if( grid[i][j] == -1 ) { - printEmptyTileRow(); - } else { - tilesFitted[grid[i][j]].printRow0(); - } - } - System.printString( "\n" ); - - for( int i = x0; i <= x1; ++i ) - { - System.printString( "i=" ); - System.printInt( i ); - System.printString( ", j=" ); - System.printInt( j ); - //System.printString( "\n" ); - - if( grid[i][j] == -1 ) { - printEmptyTileRow(); - } else { - tilesFitted[grid[i][j]].printRow1(); - } - } - System.printString( "\n" ); - - for( int i = x0; i <= x1; ++i ) - { - System.printString( "i=" ); - System.printInt( i ); - System.printString( ", j=" ); - System.printInt( j ); - //System.printString( "\n" ); - - if( grid[i][j] == -1 ) { - printEmptyTileRow(); - } else { - tilesFitted[grid[i][j]].printRow2(); - } - } - System.printString( "\n" ); - - for( int i = x0; i <= x1; ++i ) - { - System.printString( "i=" ); - System.printInt( i ); - System.printString( ", j=" ); - System.printInt( j ); - //System.printString( "\n" ); - - if( grid[i][j] == -1 ) { - printEmptyTileRow(); - } else { - tilesFitted[grid[i][j]].printRow3(); - } - } - System.printString( "\n" ); - - for( int i = x0; i <= x1; ++i ) - { - System.printString( "i=" ); - System.printInt( i ); - System.printString( ", j=" ); - System.printInt( j ); - //System.printString( "\n" ); - - if( grid[i][j] == -1 ) { - printEmptyTileRow(); - } else { - tilesFitted[grid[i][j]].printRow4(); - } - } - System.printString( "\n" ); - } - */ - } - - public void printEmptyTileRow() { - System.printString( " " ); - } - - public void computeBoundingBox() { - System.printString( "Starting computeBoundingBox\n" ); - - int i = 0; - while( i < gridSize*gridSize ) { - int a = i % gridSize; - int b = i / gridSize; - - if( grid[b][a] != -1 ) { - x0 = b; - - // this statement is like "break" - i = gridSize*gridSize; - } - - ++i; - } - - i = 0; - while( i < gridSize*gridSize ) { - int a = i % gridSize; - int b = i / gridSize; - - if( grid[a][b] != -1 ) { - y0 = b; - - // this statement is like "break" - i = gridSize*gridSize; - } - - ++i; - } - - i = 0; - while( i < gridSize*gridSize ) { - int a = i % gridSize; - int b = i / gridSize; - int c = gridSize - 1 - b; - - if( grid[c][a] != -1 ) { - x1 = c; - - // this statement is like "break" - i = gridSize*gridSize; - } - - ++i; - } - - i = 0; - while( i < gridSize*gridSize ) { - int a = i % gridSize; - int b = i / gridSize; - int c = gridSize - 1 - b; - - if( grid[a][c] != -1 ) { - y1 = c; - - // this statement is like "break" - i = gridSize*gridSize; - } - - ++i; - } - - System.printString( "Ending computeBoundingBox\n" ); - } -} diff --git a/Robust/src/Benchmarks/TileSearch/Tag/TileSearch.java b/Robust/src/Benchmarks/TileSearch/Tag/TileSearch.java deleted file mode 100644 index d7bd5a7f..00000000 --- a/Robust/src/Benchmarks/TileSearch/Tag/TileSearch.java +++ /dev/null @@ -1,239 +0,0 @@ -////////////////////////////////////////////// -// -// tileSearch is a program to solve the -// following problem: -// -// Find all arrangements of N square tiles -// that evaluate to the highest possible score. -// -// Each tile has an integer on its north, south -// east and west faces. Tiles faces may only -// be adjacent to other tile faces with the -// same number. -// -// Tiles may not be rotated. -// -// All tiles in the final arrangement must -// be adjacent to at least one other tile. -// -// The score of an arrangement is the sum of -// all tile face values that are not adjacent -// to another face. -// -// Example input: -// -// +-----+ +-----+ +-----+ +-----+ -// | 3 | | 4 | | 9 | | 3 | -// |2 1| |5 5| |1 1| |5 2| -// | 4 | | 3 | | 4 | | 9 | -// +-----+, +-----+, +-----+, +-----+ -// -// A valid arrangement could be: -// -// +-----++-----+ -// | 3 || 9 | -// |2 1||1 1| -// | 4 || 4 | -// +-----++-----+ -// +-----++-----+ -// | 4 || 3 | -// |5 5||5 2| -// | 3 || 9 | -// +-----++-----+ -// -// Which scores: -// -// 3 + 9 + 1 + 3 + 2 + 9 + 3 + 5 + 4 + 2 = 41 -// -// -// What is the highest possible score for a -// given tile input? -// -////////////////////////////////////////////// - -task Startup( StartupObject s{ initialstate } ) -{ - //System.printString("Top of task Startup\n"); - SubProblem top = new SubProblem(){ findingNewFits, main }; - - /* - top.tilesToFit = new Tile[2]; - top.tilesToFit[0] = new Tile( 3, 2, 3, 1 ); - top.tilesToFit[1] = new Tile( 2, -4, -4, -4 ); - - top.tilesFitted = new Tile[1]; - top.tilesFitted[0] = new Tile( -1, -1, 1, -1 ); - */ - - - top.tilesToFit = new Tile[3]; - top.tilesToFit[0] = new Tile( 2, 1, -1, 0 ); - top.tilesToFit[1] = new Tile( 1, 3, 0, -1 ); - top.tilesToFit[2] = new Tile( -1, 1, -1, 0 ); - //top.tilesToFit[3] = new Tile( 1, 2, 2, -1 ); - //top.tilesToFit[4] = new Tile( 2, 2, 1, 2 ); - //top.tilesToFit[5] = new Tile( -1, 1, 0, 1 ); - - top.tilesFitted = new Tile[1]; - top.tilesFitted[0] = new Tile( 1, -1, 0, 2 ); - - - top.indexToFit = 0; - top.indexFitted = 0; - top.workingGrid = -// new TileGrid( (top.tilesToFit.length+1)*2 + 1 ); - new TileGrid( (top.tilesToFit.length+5)*2 + 4 ); - - // put first fitted tile in the middle of the grid - top.tilesFitted[0].x = top.workingGrid.gridSize/2; - top.tilesFitted[0].y = top.workingGrid.gridSize/2; - top.workingGrid.grid[top.tilesFitted[0].x] - [top.tilesFitted[0].y] = 0; - - top.highScore = 0; - GlobalCounter counter = new GlobalCounter() {Init}; - taskexit( s{ !initialstate } ); -} - -task findNewFits(optional SubProblem sp{ findingNewFits }, GlobalCounter counter{ Init }) -{ - if(!isavailable(sp)) { - counter.partial = true; - taskexit( sp{ !findingNewFits } ); - } - //System.printString("Top of task findNewFits\n"); - // if we have run out of iterations of the - // findNewFits task, mark waitingForSubProblems - if( sp.indexToFit == sp.tilesToFit.length ) - { - //System.printString( "****************************************\nFinish iterating intermediate subproblem\n*********************************\n"); - taskexit( sp{ !findingNewFits } ); - } - - //System.printString( "###################################\n" ); - //sp.workingGrid.printGrid( sp.tilesFitted ); - //System.printString( "Want to add this tile:\n" ); - //sp.tilesToFit[sp.indexToFit].printTile(); - //System.printString( "to this tile:\n" ); - //sp.tilesFitted[sp.indexFitted].printTile(); - - //System.printString( "+++++++++++++++++++++++++++++++++++\nchecking if there is a fit:\n" ); - - if( sp.workingGrid.validFitNorth( - sp.tilesToFit [sp.indexToFit], - sp.tilesFitted[sp.indexFitted], - sp.tilesFitted ) ) - { - //System.printString( "North: \n" ); - SubProblem newSP = null; - if(sp.tilesToFit.length == 1 ) { - newSP = new SubProblem() { !scored, leaf }; - ++counter.counter; - } else { - newSP = new SubProblem() { findingNewFits }; - } - sp.initializeSubProblem( newSP, 1 ); - //System.printString( "match! new a SubProblem\n" ); - } - - if( sp.workingGrid.validFitSouth( - sp.tilesToFit [sp.indexToFit], - sp.tilesFitted[sp.indexFitted], - sp.tilesFitted ) ) - { - //System.printString( "South: \n" ); - SubProblem newSP = null; - if(sp.tilesToFit.length == 1) { - newSP = new SubProblem() { !scored, leaf }; - ++counter.counter; - } else { - newSP = new SubProblem() { findingNewFits }; - } - sp.initializeSubProblem( newSP, 2 ); - //System.printString( "match! new a SubProblem\n" ); - } - - if( sp.workingGrid.validFitEast( - sp.tilesToFit [sp.indexToFit], - sp.tilesFitted[sp.indexFitted], - sp.tilesFitted ) ) - { - //System.printString( "East: \n" ); - SubProblem newSP = null; - if(sp.tilesToFit.length == 1) { - newSP = new SubProblem() { !scored, leaf }; - ++counter.counter; - } else { - newSP = new SubProblem() { findingNewFits }; - } - sp.initializeSubProblem( newSP, 3 ); - //System.printString( "match! new a SubProblem\n" ); - } - - if( sp.workingGrid.validFitWest( - sp.tilesToFit [sp.indexToFit], - sp.tilesFitted[sp.indexFitted], - sp.tilesFitted ) ) - { - //System.printString( "West:\n" ); - SubProblem newSP = null; - if(sp.tilesToFit.length == 1) { - newSP = new SubProblem() { !scored, leaf }; - ++counter.counter; - } else { - newSP = new SubProblem() { findingNewFits }; - } - sp.initializeSubProblem( newSP, 4 ); - //System.printString( "match! new a SubProblem\nSpawn finished! Go on find new fits.\n" ); - } - - //System.printString( "Spawn finished! Go on find new fits.\n++++++++++++++++++++++++++++++++++++++\n" ); - - // otherwise perform another iteration of - // the findNewFits task - sp.incrementIndices(); - taskexit( sp{ findingNewFits } ); -} - -task scoreSubProbleam(SubProblem sp{ !scored && leaf }) { - //System.printString("Top of task scoreSubProblem\n"); - sp.scoreWorkingGrid(); - taskexit(sp { scored }); -} - -//check the highest score -task findHighestScore(SubProblem pSp{ !scored && main }, optional SubProblem cSp{ scored && leaf }, GlobalCounter counter{ Init } ) { - //System.printString("Top of task findHighestScore\n"); - --counter.counter; - //System.printString( "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n" ); - //System.printString( "find highest score:\n" + counter.counter + "\n" ); - //System.printString( "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n" ); - if(isavailable(cSp)) { - if(pSp.highScore < cSp.highScore) { - pSp.highScore = cSp.highScore; - } - if((counter.partial == true) || (cSp.partial == true)) { - pSp.partial = true; - } - } else { - pSp.partial = true; - } - if(counter.counter == 0) { - taskexit(pSp{ scored }, cSp{ !leaf }); - } else { - taskexit(cSp{ !leaf }); - } -} - -task printHighestScore(SubProblem sp{ scored && main }) { - //System.printString("Top of task printHighestScore\n"); - // if(isavailable(sp)) { - if(sp.partial == true) { - System.printString ( "Result may not be the best one due to some failure during execution!\n" ); - } - System.printString( "Found highest score: " + sp.highScore + "\n" ); - /* } else { - System.printString( "Fail to process\n" ); - }*/ - taskexit(sp{ !scored }); -} diff --git a/Robust/src/Benchmarks/WebServer/Inventory.java b/Robust/src/Benchmarks/WebServer/Inventory.java deleted file mode 100644 index 74756956..00000000 --- a/Robust/src/Benchmarks/WebServer/Inventory.java +++ /dev/null @@ -1,91 +0,0 @@ -public class Inventory { - // Inventory flags - flag TransInitialize; - - // Transaction variables - int numitems; - HashMap map; - int balance; - - // Constructor - public Inventory(){ - map = new HashMap(); - balance=100000; - } - - public Inventory(int howmany) { - numitems = howmany;// howmany keeps track of the number of items - // in the inventory - map = new HashMap(); - } - - // Add item to a list of inventory - public int additem(String name, int quantity, int price){ - ItemInfo newitem = new ItemInfo(quantity, price); - balance-=quantity*price; - - // Get the item from hash - if (map.containsKey(name) == false) { - map.put(name, newitem); - } else { - ItemInfo i = (ItemInfo) map.get(name); - i.quantity += quantity; - i.price = price; - map.put(name, i); - } - return 0; - } - - // Buy item from a given list of inventory - public int buyitem(String name, int quantity){ - if (map.containsKey(name) == false) { - // System.printString("Error - Item does not exist"); - return -1; - } else { - ItemInfo i = (ItemInfo) map.get(name); - if (i.quantity == 0) { - // System.printString("Error - Item unavailable"); - return -1; - } - if ((i.quantity-quantity) < 0 ) { - // System.printString("Error - Available qty is less: Cannot Buy\n"); - return -1; - } else { - i.quantity -= quantity; - map.put(name, i); - balance+=quantity*i.price; - return i.price; - } - } - return 0; - } - - //Display the inventory list - //Display the inventory list - public synchronized void inventory(Socket s){ - HashMapIterator i = new HashMapIterator(map, 0);// Gets key from the hashmap= name of item - HashMapIterator j = new HashMapIterator(map, 1);//Gets the value from hashmap - int totalvalue=balance; - while (i.hasNext() == true) { - StringBuffer sb = new StringBuffer(""); - Object o = i.next(); - String name = o.toString(); - ItemInfo oo = (ItemInfo) j.next(); - sb.append(name); - sb.append(" "); - Integer q = new Integer(oo.quantity); - sb.append(q.toString()); - sb.append(" "); - Integer p = new Integer(oo.price); - sb.append(p.toString()); - sb.append("\n"); - totalvalue+=oo.quantity*oo.price; - s.write(sb.toString().getBytes()); - } - StringBuffer sb=new StringBuffer(""); - sb.append("Total value: "); - sb.append((new Integer(totalvalue)).toString()); - sb.append("\n"); - s.write(sb.toString().getBytes()); - } -} diff --git a/Robust/src/Benchmarks/WebServer/ItemInfo.java b/Robust/src/Benchmarks/WebServer/ItemInfo.java deleted file mode 100644 index 18a61a59..00000000 --- a/Robust/src/Benchmarks/WebServer/ItemInfo.java +++ /dev/null @@ -1,8 +0,0 @@ -class ItemInfo { - int quantity; - int price; - ItemInfo(int x, int y) { - quantity = x; - price = y; - } -} diff --git a/Robust/src/Benchmarks/WebServer/Logger.java b/Robust/src/Benchmarks/WebServer/Logger.java deleted file mode 100644 index a23cc4fa..00000000 --- a/Robust/src/Benchmarks/WebServer/Logger.java +++ /dev/null @@ -1,29 +0,0 @@ -public class Logger { - //Logger flag - flag Initialize; - FileOutputStream fos; - - - //Constructor - public Logger(){ - fos=new FileOutputStream("request.log");//Open request.log file - } - - //Logs filename as per client requests - public void logrequest(String filename){ - String request = new String("\nNew Request received: "); - fos.write(request.getBytes()); - fos.write(filename.getBytes()); - fos.flush(); - } - - public void logrequest(){ - String request = new String("\nNew Request received: "); - fos.write(request.getBytes()); - fos.flush(); - } - - public void closerequest() { - fos.close(); - } -} diff --git a/Robust/src/Benchmarks/WebServer/WebServerExample.java b/Robust/src/Benchmarks/WebServer/WebServerExample.java deleted file mode 100644 index 664465a5..00000000 --- a/Robust/src/Benchmarks/WebServer/WebServerExample.java +++ /dev/null @@ -1,111 +0,0 @@ -/* Startup object is generated with the initialstate flag set by the - * system to start the computation up */ - -// Create New ServerSocket -task Startup(StartupObject s {initialstate}) { -// System.printString("W> Starting\n"); - ServerSocket ss = new ServerSocket(9000); -// System.printString("W> Creating ServerSocket\n"); - Logger log = new Logger() {Initialize}; - Inventory inventorylist = new Inventory(){TransInitialize}; - taskexit(s {!initialstate}); /* Turns initial state flag off, so this task won't refire */ -} - -//Listen for a request and accept request -task AcceptConnection(ServerSocket ss{SocketPending}) { -// System.printString("W> Waiting for connection...\n"); - WebServerSocket web = new WebServerSocket() {!WritePending, !TransPending, WebInitialize}; - ss.accept(web); -// System.printString("W> Connected... \n"); -} - -// Process the incoming http request -task ProcessRequest(WebServerSocket web{IOPending && WebInitialize}) { -//task ProcessRequest(WebServerSocket web{IOPending}) { - //System.printString("W> Inside ProcessRequest... \n"); - if (web.clientrequest()) { - if(web.checktrans()==false) - // Not special transaction , do normal filesending - taskexit(web {WritePending, LogPending,!WebInitialize}); //Sets the WritePending and LogPending flag true - else - // Invoke special inventory transaction - taskexit(web {TransPending, LogPending,!WebInitialize}); - } -} - -//Do the WriteIO on server socket and send the requested file to Client -task SendFile(WebServerSocket web{WritePending}) { -// System.printString("W> Inside SendFile ... \n"); - web.sendfile(); - web.close(); - taskexit(web {!WritePending}); -} - -// Log the Client request -task LogRequest(WebServerSocket web{LogPending}, Logger log{Initialize}) { -//Task fired when both -// LogPending and Initialize flags are true -// System.printString("L > Inside logrequest\n"); - log.logrequest(web.filename); - taskexit(web {!LogPending}); -} - -//Transaction on Inventory -task Transaction(WebServerSocket web{TransPending}, Inventory inventorylist{TransInitialize}){ //Task for WebServerTransactions -// System.printString("T > Inside Transaction\n"); - // Parse - int op = web.parseTransaction(); - // Check for the kind of operation - if (op == 0 ) { /* Add */ -// System.printString("DEBUG > Calling add transaction\n"); - Integer qty = new Integer(web.parsed[2]); - Integer price = new Integer(web.parsed[3]); - int ret = inventorylist.additem(web.parsed[1], qty.intValue(), price.intValue()); - if (ret == 0) { - web.httpresponse(); - StringBuffer s = new StringBuffer("Added Item "); - s.append(web.parsed[1]); - s.append(" Quantity "); - s.append(web.parsed[2]); - s.append(" Price "); - s.append(web.parsed[3]); - s.append("\n"); - String towrite = new String(s); - web.write(towrite.getBytes()); - } else { - web.httpresponse(); - String s = new String("Error encountered"); - web.write(s.getBytes()); - } - } else if (op == 1) { /* Buy */ -// System.printString("DEBUG > Calling buy transaction\n"); - Integer qty = new Integer(web.parsed[2]); - int ret = inventorylist.buyitem(web.parsed[1], qty.intValue()); - if (ret >= 0) { - web.httpresponse(); - StringBuffer s = new StringBuffer("Bought item "); - s.append(web.parsed[1]); - s.append(" Quantity "); - s.append(web.parsed[2]); - s.append(" Cost "); - Integer cost = new Integer(ret*qty.intValue()); - String c = cost.toString(); - s.append(c); - String towrite = new String(s); - web.write(towrite.getBytes()); - } else { - web.httpresponse(); - String s = new String("Error encountered"); - web.write(s.getBytes()); - } - } else if (op == 2) { /* Inventory */ -// System.printString("DEBUG > Calling inventory transaction\n"); - web.httpresponse(); - inventorylist.inventory(web); - } else { /* Error */ -// System.printString("T > Error - Unknown transaction\n"); - } - //Invoke close operations - web.close(); - taskexit(web {!TransPending}); -} diff --git a/Robust/src/Benchmarks/WebServer/WebServerSocket.java b/Robust/src/Benchmarks/WebServer/WebServerSocket.java deleted file mode 100644 index 8fa20041..00000000 --- a/Robust/src/Benchmarks/WebServer/WebServerSocket.java +++ /dev/null @@ -1,141 +0,0 @@ -public class WebServerSocket extends Socket { - // Websocket flag - flag LogPending; - flag WritePending; - flag TransPending; - flag WebInitialize; - - //Filename requested by the client - String filename; - String[] parsed; - String prefix; - - //Constructor - public WebServerSocket(){ - parsed = new String[4]; - } - - //Send the http header for web browser display - public void httpresponse(){ - StringBuffer header = new StringBuffer("HTTP/1.0 200 OK\n"); - header.append("Content-type: text/html\n"); - header.append("\n\n"); - String temp_str = new String(header); - write(temp_str.getBytes()); - return; - - } - - // Send the html file , read from file one byte at a time - public void sendfile() { - StringBuffer req_file = new StringBuffer("./htmlfiles/"); - req_file.append(filename); - String filepath = new String(req_file); - FileInputStream def_file = new FileInputStream(filepath); - int status = def_file.getfd();//Checks if the file is present in - //current directory - httpresponse(); - if (status == -1){ - StringBuffer response = new StringBuffer("404: not found: ");//Send 404 error if - // file not found - response.append(filename); - String buffer = new String(response); - write(buffer.getBytes()); - def_file.close(); - return; - } - byte buf[] = new byte[16]; - int ret; - - while ((ret = def_file.read(buf)) > 0) {// Read from file and write - // one byte at a time into the socket - byte tosend[] = new byte[ret]; - for (int i = 0; i < ret; i++) { - tosend[i] = buf[i]; - } - write(tosend); - //String str = new String(tosend); - } - def_file.close(); - } - - //Read the client request and extract the filename from it - public boolean clientrequest(){ - byte b1[] = new byte[1024]; - int numbytes=read(b1);//Read client request from web server socket - String curr=(new String(b1)).subString(0, numbytes); - if (prefix!=null) { - StringBuffer sb=new StringBuffer(prefix); - sb.append(curr); - curr=sb.toString(); - } - prefix=curr; - if(prefix.indexOf("\r\n\r\n")>=0) { - - int index = prefix.indexOf('/');//Parse the GET client request to find filename - int end = prefix.indexOf('H'); - filename = prefix.subString((index+1), (end-1)); - return true; - } - return false; - } - - // Parse for the prefix in the client request - // This is helpful to find if the prefix is a special transaction - public boolean checktrans(){ - if (filename.startsWith("trans") == true) { - return true; - } else { - return false; - } - } - - //Parse for the substrings in the filename and use it to obtain the - //kind of operation, name of item, quantity of item, price of item - //e.g. trans_add_car_2_10000 is the filename - //store in the parsed[] string , add,car,2,1000 - public int parseTransaction(){ - int start = filename.indexOf('_'); - String s = filename.subString(start+1); - - if (s.startsWith("add")==true){ - // System.printString("DEBUG > ADD\n"); - int i1 = s.indexOf('_'); - parsed[0] = new String(s.subString(0,i1)); - - int i2 = s.indexOf('_',i1+1); - parsed[1] = new String(s.subString(i1+1,i2)); - - int i3 = s.indexOf('_',i2+1); - parsed[2] = new String(s.subString(i2+1,i3)); - - String s3 = s.subString(i3+1); - parsed[3] = s3; - - return 0; - - } - if (s.startsWith("buy")==true){ - // System.printString("DEBUG > BUY\n"); - int i1 = s.indexOf('_'); - parsed[0] = s.subString(0,i1); - - int i2 = s.indexOf('_', i1+1); - parsed[1] = s.subString(i1+1,i2); - - String s2 = s.subString(i2+1); - parsed[2] = s2; - - parsed[3] = ""; - - return 1; - } - if (s.startsWith("inventory")==true){ - // System.printString("DEBUG > INVENTORY\n"); - return 2; - - } - // Error transaction - return -1; - } -} diff --git a/Robust/src/Benchmarks/WebServer/Workload/batch/difference.sh b/Robust/src/Benchmarks/WebServer/Workload/batch/difference.sh deleted file mode 100755 index 2328bba1..00000000 --- a/Robust/src/Benchmarks/WebServer/Workload/batch/difference.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh - -rm result_inventory -#For every trans_inventory* file remove the lines starting with pre and sort the file -for file in `ls trans_inventory*` -do - echo "Doing $file" - grep -v pre $file > ${file}.nopre - sort -n ${file}.nopre > runs/${file}.sorted -done - -\rm *.nopre -cd runs -let x=0; -#for every sorted file created above diff it with the orginial file called pure/trans_inventory.sorted and print the total success or failures occured -for file in `ls *sorted` -do - echo -n "Diffing $file..."; - diff $file ./pure/trans_inventory.sorted - if [ $? -ne 0 ] - then - let "x+=1"; - else - echo " success "; - fi -done - -echo "RESULT: x is $x"; -echo -n "RESULT: Total files compared is " -ls *sorted | wc -l - -cd .. diff --git a/Robust/src/Benchmarks/WebServer/Workload/batch/pure/trans_inventory.sorted b/Robust/src/Benchmarks/WebServer/Workload/batch/pure/trans_inventory.sorted deleted file mode 100644 index 5cb507b4..00000000 --- a/Robust/src/Benchmarks/WebServer/Workload/batch/pure/trans_inventory.sorted +++ /dev/null @@ -1,7 +0,0 @@ - -book 258 50 -bread 9590 4 -car 39 10000 -coke 2620 5 -pen 601 5 -soap 42 7 diff --git a/Robust/src/Benchmarks/WebServer/Workload/batch/run.sh b/Robust/src/Benchmarks/WebServer/Workload/batch/run.sh deleted file mode 100644 index 60523901..00000000 --- a/Robust/src/Benchmarks/WebServer/Workload/batch/run.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash - -let i=0; #Keeps count of number of times the server is launched - -rm output #Errors and total number of run count are redirected to this file - -#Sets the BRISTLECONE parameter with a certain instruction count, probability and -#number of failures that can be injected -export BRISTLECONE="-initializerandom -injectinstructionfailures 10 0.00001667 1 -debugtask" -rm -rf results -mkdir results -cd results -while [ $i -le 299 ]; # The number of runs -do - ../trans.bin & #Launch server executable in background - sleep 2; - ../Workload/workloaderror 127.0.0.1 2>/dev/null & #Run the first workload - echo $i >> output; - sleep 5; - process=`ps | grep workloaderror | grep -v grep | awk '{print $1}'` - kill -9 $process #Kill the first workload - if [ $? -eq 0 ] #Launch the second worload only if the Failure is injected in the first workload - then - ../Workload/workloadtrans 127.0.0.1 2>/dev/null - else - echo "No Fault Injected" >> output - fi; - let "i+=1"; - ps | grep trans | grep -v grep | awk '{print $1}' | xargs kill -9 #Kill the server - sleep 1; -done diff --git a/Robust/src/Benchmarks/WebServer/Workload/batch/run2.sh b/Robust/src/Benchmarks/WebServer/Workload/batch/run2.sh deleted file mode 100755 index 4da6c32e..00000000 --- a/Robust/src/Benchmarks/WebServer/Workload/batch/run2.sh +++ /dev/null @@ -1,64 +0,0 @@ -#!/bin/bash - -let i=0; #Keeps count of number of times the server is launched - -rm output #Errors and total number of run count are redirected to this file - -#Sets the BRISTLECONE parameter with a certain instruction count, probability and -#number of failures that can be injected -#export BRISTLECONE="-initializerandom -injectinstructionfailures 10 0.00001667 1 -debugtask" -export BRISTLECONE="-initializerandom -injectinstructionfailures 35 0.00001667 50" -rm -rf results -mkdir results -cd results -while [ $i -le 201 ]; # The number of runs - do - mkdir trial$i - cd trial$i - let errorcount=0 - let count=0 - ../../trans.bin &> log & #Launch server executable in background - sleep 2; - ../../Workload/workload 127.0.0.1 2>/dev/null & #Run the first workload - echo $i >> ../output; - while true - do - process=`ps | grep wget | grep -v grep | awk '{print $1}'` - sleep 1 - process2=`ps | grep wget | grep -v grep | awk '{print $1}'` - if [ "$process" != "" ] - then - if [ "$process" = "$process2" ] - then - let "count=1" - kill -9 $process #Kill the first workload - if [ $? -eq 0 ] #Launch the second worload only if the Failure is injected in the first workload - then - let "errorcount+=1" - fi - fi -else - if [ "$process2" != "" ] - then - let "count=1" - else - let "count+=1" - if [ $count == 30 ] - then - break - fi - fi - fi -done -echo Errorcount=$errorcount >> ../output -let "i+=1"; -process=`ps | grep workload | grep -v grep | awk '{print $1}'` -kill -9 $process -process=`ps | grep trans | grep -v grep | awk '{print $1}'` -cat ../../gdbquery | gdb ../../trans.bin $process &> output -kill -1 $process -sleep 1 -kill $process -sleep 1; -cd .. -done diff --git a/Robust/src/Benchmarks/WebServer/Workload/generate.java b/Robust/src/Benchmarks/WebServer/Workload/generate.java deleted file mode 100644 index 95a0bf33..00000000 --- a/Robust/src/Benchmarks/WebServer/Workload/generate.java +++ /dev/null @@ -1,19 +0,0 @@ -public class generate { - - public static void main(String x[]) { - int j=1; - int cost=1; - System.out.println("#!/bin/bash"); - for(int i=0;i<2200;i++) { - int price=cost*50; - int jbuy=j-1; - System.out.println("wget http://$1:9000/trans_add_f"+i+"_"+j+"_"+price); - System.out.println("wget http://$1:9000/trans_buy_f"+i+"_"+jbuy); - if (cost>3) cost=1; else cost++; - if (j>4) j=1; else j++; - } - System.out.println("wget http://$1:9000/trans_inventory"); - } - - -} diff --git a/Robust/src/Benchmarks/WebServer/Workload/workload b/Robust/src/Benchmarks/WebServer/Workload/workload deleted file mode 100755 index 56cd778b..00000000 --- a/Robust/src/Benchmarks/WebServer/Workload/workload +++ /dev/null @@ -1,4402 +0,0 @@ -#!/bin/bash -wget http://$1:9000/trans_add_f0_1_50 -wget http://$1:9000/trans_buy_f0_0 -wget http://$1:9000/trans_add_f1_2_100 -wget http://$1:9000/trans_buy_f1_1 -wget http://$1:9000/trans_add_f2_3_150 -wget http://$1:9000/trans_buy_f2_2 -wget http://$1:9000/trans_add_f3_4_200 -wget http://$1:9000/trans_buy_f3_3 -wget http://$1:9000/trans_add_f4_5_50 -wget http://$1:9000/trans_buy_f4_4 -wget http://$1:9000/trans_add_f5_1_100 -wget http://$1:9000/trans_buy_f5_0 -wget http://$1:9000/trans_add_f6_2_150 -wget http://$1:9000/trans_buy_f6_1 -wget http://$1:9000/trans_add_f7_3_200 -wget http://$1:9000/trans_buy_f7_2 -wget http://$1:9000/trans_add_f8_4_50 -wget http://$1:9000/trans_buy_f8_3 -wget http://$1:9000/trans_add_f9_5_100 -wget http://$1:9000/trans_buy_f9_4 -wget http://$1:9000/trans_add_f10_1_150 -wget http://$1:9000/trans_buy_f10_0 -wget http://$1:9000/trans_add_f11_2_200 -wget http://$1:9000/trans_buy_f11_1 -wget http://$1:9000/trans_add_f12_3_50 -wget http://$1:9000/trans_buy_f12_2 -wget http://$1:9000/trans_add_f13_4_100 -wget http://$1:9000/trans_buy_f13_3 -wget http://$1:9000/trans_add_f14_5_150 -wget http://$1:9000/trans_buy_f14_4 -wget http://$1:9000/trans_add_f15_1_200 -wget http://$1:9000/trans_buy_f15_0 -wget http://$1:9000/trans_add_f16_2_50 -wget http://$1:9000/trans_buy_f16_1 -wget http://$1:9000/trans_add_f17_3_100 -wget http://$1:9000/trans_buy_f17_2 -wget http://$1:9000/trans_add_f18_4_150 -wget http://$1:9000/trans_buy_f18_3 -wget http://$1:9000/trans_add_f19_5_200 -wget http://$1:9000/trans_buy_f19_4 -wget http://$1:9000/trans_add_f20_1_50 -wget http://$1:9000/trans_buy_f20_0 -wget http://$1:9000/trans_add_f21_2_100 -wget http://$1:9000/trans_buy_f21_1 -wget http://$1:9000/trans_add_f22_3_150 -wget http://$1:9000/trans_buy_f22_2 -wget http://$1:9000/trans_add_f23_4_200 -wget http://$1:9000/trans_buy_f23_3 -wget http://$1:9000/trans_add_f24_5_50 -wget http://$1:9000/trans_buy_f24_4 -wget http://$1:9000/trans_add_f25_1_100 -wget http://$1:9000/trans_buy_f25_0 -wget http://$1:9000/trans_add_f26_2_150 -wget http://$1:9000/trans_buy_f26_1 -wget http://$1:9000/trans_add_f27_3_200 -wget http://$1:9000/trans_buy_f27_2 -wget http://$1:9000/trans_add_f28_4_50 -wget http://$1:9000/trans_buy_f28_3 -wget http://$1:9000/trans_add_f29_5_100 -wget http://$1:9000/trans_buy_f29_4 -wget http://$1:9000/trans_add_f30_1_150 -wget http://$1:9000/trans_buy_f30_0 -wget http://$1:9000/trans_add_f31_2_200 -wget http://$1:9000/trans_buy_f31_1 -wget http://$1:9000/trans_add_f32_3_50 -wget http://$1:9000/trans_buy_f32_2 -wget http://$1:9000/trans_add_f33_4_100 -wget http://$1:9000/trans_buy_f33_3 -wget http://$1:9000/trans_add_f34_5_150 -wget http://$1:9000/trans_buy_f34_4 -wget http://$1:9000/trans_add_f35_1_200 -wget http://$1:9000/trans_buy_f35_0 -wget http://$1:9000/trans_add_f36_2_50 -wget http://$1:9000/trans_buy_f36_1 -wget http://$1:9000/trans_add_f37_3_100 -wget http://$1:9000/trans_buy_f37_2 -wget http://$1:9000/trans_add_f38_4_150 -wget http://$1:9000/trans_buy_f38_3 -wget http://$1:9000/trans_add_f39_5_200 -wget http://$1:9000/trans_buy_f39_4 -wget http://$1:9000/trans_add_f40_1_50 -wget http://$1:9000/trans_buy_f40_0 -wget http://$1:9000/trans_add_f41_2_100 -wget http://$1:9000/trans_buy_f41_1 -wget http://$1:9000/trans_add_f42_3_150 -wget http://$1:9000/trans_buy_f42_2 -wget http://$1:9000/trans_add_f43_4_200 -wget http://$1:9000/trans_buy_f43_3 -wget http://$1:9000/trans_add_f44_5_50 -wget http://$1:9000/trans_buy_f44_4 -wget http://$1:9000/trans_add_f45_1_100 -wget http://$1:9000/trans_buy_f45_0 -wget http://$1:9000/trans_add_f46_2_150 -wget http://$1:9000/trans_buy_f46_1 -wget http://$1:9000/trans_add_f47_3_200 -wget http://$1:9000/trans_buy_f47_2 -wget http://$1:9000/trans_add_f48_4_50 -wget http://$1:9000/trans_buy_f48_3 -wget http://$1:9000/trans_add_f49_5_100 -wget http://$1:9000/trans_buy_f49_4 -wget http://$1:9000/trans_add_f50_1_150 -wget http://$1:9000/trans_buy_f50_0 -wget http://$1:9000/trans_add_f51_2_200 -wget http://$1:9000/trans_buy_f51_1 -wget http://$1:9000/trans_add_f52_3_50 -wget http://$1:9000/trans_buy_f52_2 -wget http://$1:9000/trans_add_f53_4_100 -wget http://$1:9000/trans_buy_f53_3 -wget http://$1:9000/trans_add_f54_5_150 -wget http://$1:9000/trans_buy_f54_4 -wget http://$1:9000/trans_add_f55_1_200 -wget http://$1:9000/trans_buy_f55_0 -wget http://$1:9000/trans_add_f56_2_50 -wget http://$1:9000/trans_buy_f56_1 -wget http://$1:9000/trans_add_f57_3_100 -wget http://$1:9000/trans_buy_f57_2 -wget http://$1:9000/trans_add_f58_4_150 -wget http://$1:9000/trans_buy_f58_3 -wget http://$1:9000/trans_add_f59_5_200 -wget http://$1:9000/trans_buy_f59_4 -wget http://$1:9000/trans_add_f60_1_50 -wget http://$1:9000/trans_buy_f60_0 -wget http://$1:9000/trans_add_f61_2_100 -wget http://$1:9000/trans_buy_f61_1 -wget http://$1:9000/trans_add_f62_3_150 -wget http://$1:9000/trans_buy_f62_2 -wget http://$1:9000/trans_add_f63_4_200 -wget http://$1:9000/trans_buy_f63_3 -wget http://$1:9000/trans_add_f64_5_50 -wget http://$1:9000/trans_buy_f64_4 -wget http://$1:9000/trans_add_f65_1_100 -wget http://$1:9000/trans_buy_f65_0 -wget http://$1:9000/trans_add_f66_2_150 -wget http://$1:9000/trans_buy_f66_1 -wget http://$1:9000/trans_add_f67_3_200 -wget http://$1:9000/trans_buy_f67_2 -wget http://$1:9000/trans_add_f68_4_50 -wget http://$1:9000/trans_buy_f68_3 -wget http://$1:9000/trans_add_f69_5_100 -wget http://$1:9000/trans_buy_f69_4 -wget http://$1:9000/trans_add_f70_1_150 -wget http://$1:9000/trans_buy_f70_0 -wget http://$1:9000/trans_add_f71_2_200 -wget http://$1:9000/trans_buy_f71_1 -wget http://$1:9000/trans_add_f72_3_50 -wget http://$1:9000/trans_buy_f72_2 -wget http://$1:9000/trans_add_f73_4_100 -wget http://$1:9000/trans_buy_f73_3 -wget http://$1:9000/trans_add_f74_5_150 -wget http://$1:9000/trans_buy_f74_4 -wget http://$1:9000/trans_add_f75_1_200 -wget http://$1:9000/trans_buy_f75_0 -wget http://$1:9000/trans_add_f76_2_50 -wget http://$1:9000/trans_buy_f76_1 -wget http://$1:9000/trans_add_f77_3_100 -wget http://$1:9000/trans_buy_f77_2 -wget http://$1:9000/trans_add_f78_4_150 -wget http://$1:9000/trans_buy_f78_3 -wget http://$1:9000/trans_add_f79_5_200 -wget http://$1:9000/trans_buy_f79_4 -wget http://$1:9000/trans_add_f80_1_50 -wget http://$1:9000/trans_buy_f80_0 -wget http://$1:9000/trans_add_f81_2_100 -wget http://$1:9000/trans_buy_f81_1 -wget http://$1:9000/trans_add_f82_3_150 -wget http://$1:9000/trans_buy_f82_2 -wget http://$1:9000/trans_add_f83_4_200 -wget http://$1:9000/trans_buy_f83_3 -wget http://$1:9000/trans_add_f84_5_50 -wget http://$1:9000/trans_buy_f84_4 -wget http://$1:9000/trans_add_f85_1_100 -wget http://$1:9000/trans_buy_f85_0 -wget http://$1:9000/trans_add_f86_2_150 -wget http://$1:9000/trans_buy_f86_1 -wget http://$1:9000/trans_add_f87_3_200 -wget http://$1:9000/trans_buy_f87_2 -wget http://$1:9000/trans_add_f88_4_50 -wget http://$1:9000/trans_buy_f88_3 -wget http://$1:9000/trans_add_f89_5_100 -wget http://$1:9000/trans_buy_f89_4 -wget http://$1:9000/trans_add_f90_1_150 -wget http://$1:9000/trans_buy_f90_0 -wget http://$1:9000/trans_add_f91_2_200 -wget http://$1:9000/trans_buy_f91_1 -wget http://$1:9000/trans_add_f92_3_50 -wget http://$1:9000/trans_buy_f92_2 -wget http://$1:9000/trans_add_f93_4_100 -wget http://$1:9000/trans_buy_f93_3 -wget http://$1:9000/trans_add_f94_5_150 -wget http://$1:9000/trans_buy_f94_4 -wget http://$1:9000/trans_add_f95_1_200 -wget http://$1:9000/trans_buy_f95_0 -wget http://$1:9000/trans_add_f96_2_50 -wget http://$1:9000/trans_buy_f96_1 -wget http://$1:9000/trans_add_f97_3_100 -wget http://$1:9000/trans_buy_f97_2 -wget http://$1:9000/trans_add_f98_4_150 -wget http://$1:9000/trans_buy_f98_3 -wget http://$1:9000/trans_add_f99_5_200 -wget http://$1:9000/trans_buy_f99_4 -wget http://$1:9000/trans_add_f100_1_50 -wget http://$1:9000/trans_buy_f100_0 -wget http://$1:9000/trans_add_f101_2_100 -wget http://$1:9000/trans_buy_f101_1 -wget http://$1:9000/trans_add_f102_3_150 -wget http://$1:9000/trans_buy_f102_2 -wget http://$1:9000/trans_add_f103_4_200 -wget http://$1:9000/trans_buy_f103_3 -wget http://$1:9000/trans_add_f104_5_50 -wget http://$1:9000/trans_buy_f104_4 -wget http://$1:9000/trans_add_f105_1_100 -wget http://$1:9000/trans_buy_f105_0 -wget http://$1:9000/trans_add_f106_2_150 -wget http://$1:9000/trans_buy_f106_1 -wget http://$1:9000/trans_add_f107_3_200 -wget http://$1:9000/trans_buy_f107_2 -wget http://$1:9000/trans_add_f108_4_50 -wget http://$1:9000/trans_buy_f108_3 -wget http://$1:9000/trans_add_f109_5_100 -wget http://$1:9000/trans_buy_f109_4 -wget http://$1:9000/trans_add_f110_1_150 -wget http://$1:9000/trans_buy_f110_0 -wget http://$1:9000/trans_add_f111_2_200 -wget http://$1:9000/trans_buy_f111_1 -wget http://$1:9000/trans_add_f112_3_50 -wget http://$1:9000/trans_buy_f112_2 -wget http://$1:9000/trans_add_f113_4_100 -wget http://$1:9000/trans_buy_f113_3 -wget http://$1:9000/trans_add_f114_5_150 -wget http://$1:9000/trans_buy_f114_4 -wget http://$1:9000/trans_add_f115_1_200 -wget http://$1:9000/trans_buy_f115_0 -wget http://$1:9000/trans_add_f116_2_50 -wget http://$1:9000/trans_buy_f116_1 -wget http://$1:9000/trans_add_f117_3_100 -wget http://$1:9000/trans_buy_f117_2 -wget http://$1:9000/trans_add_f118_4_150 -wget http://$1:9000/trans_buy_f118_3 -wget http://$1:9000/trans_add_f119_5_200 -wget http://$1:9000/trans_buy_f119_4 -wget http://$1:9000/trans_add_f120_1_50 -wget http://$1:9000/trans_buy_f120_0 -wget http://$1:9000/trans_add_f121_2_100 -wget http://$1:9000/trans_buy_f121_1 -wget http://$1:9000/trans_add_f122_3_150 -wget http://$1:9000/trans_buy_f122_2 -wget http://$1:9000/trans_add_f123_4_200 -wget http://$1:9000/trans_buy_f123_3 -wget http://$1:9000/trans_add_f124_5_50 -wget http://$1:9000/trans_buy_f124_4 -wget http://$1:9000/trans_add_f125_1_100 -wget http://$1:9000/trans_buy_f125_0 -wget http://$1:9000/trans_add_f126_2_150 -wget http://$1:9000/trans_buy_f126_1 -wget http://$1:9000/trans_add_f127_3_200 -wget http://$1:9000/trans_buy_f127_2 -wget http://$1:9000/trans_add_f128_4_50 -wget http://$1:9000/trans_buy_f128_3 -wget http://$1:9000/trans_add_f129_5_100 -wget http://$1:9000/trans_buy_f129_4 -wget http://$1:9000/trans_add_f130_1_150 -wget http://$1:9000/trans_buy_f130_0 -wget http://$1:9000/trans_add_f131_2_200 -wget http://$1:9000/trans_buy_f131_1 -wget http://$1:9000/trans_add_f132_3_50 -wget http://$1:9000/trans_buy_f132_2 -wget http://$1:9000/trans_add_f133_4_100 -wget http://$1:9000/trans_buy_f133_3 -wget http://$1:9000/trans_add_f134_5_150 -wget http://$1:9000/trans_buy_f134_4 -wget http://$1:9000/trans_add_f135_1_200 -wget http://$1:9000/trans_buy_f135_0 -wget http://$1:9000/trans_add_f136_2_50 -wget http://$1:9000/trans_buy_f136_1 -wget http://$1:9000/trans_add_f137_3_100 -wget http://$1:9000/trans_buy_f137_2 -wget http://$1:9000/trans_add_f138_4_150 -wget http://$1:9000/trans_buy_f138_3 -wget http://$1:9000/trans_add_f139_5_200 -wget http://$1:9000/trans_buy_f139_4 -wget http://$1:9000/trans_add_f140_1_50 -wget http://$1:9000/trans_buy_f140_0 -wget http://$1:9000/trans_add_f141_2_100 -wget http://$1:9000/trans_buy_f141_1 -wget http://$1:9000/trans_add_f142_3_150 -wget http://$1:9000/trans_buy_f142_2 -wget http://$1:9000/trans_add_f143_4_200 -wget http://$1:9000/trans_buy_f143_3 -wget http://$1:9000/trans_add_f144_5_50 -wget http://$1:9000/trans_buy_f144_4 -wget http://$1:9000/trans_add_f145_1_100 -wget http://$1:9000/trans_buy_f145_0 -wget http://$1:9000/trans_add_f146_2_150 -wget http://$1:9000/trans_buy_f146_1 -wget http://$1:9000/trans_add_f147_3_200 -wget http://$1:9000/trans_buy_f147_2 -wget http://$1:9000/trans_add_f148_4_50 -wget http://$1:9000/trans_buy_f148_3 -wget http://$1:9000/trans_add_f149_5_100 -wget http://$1:9000/trans_buy_f149_4 -wget http://$1:9000/trans_add_f150_1_150 -wget http://$1:9000/trans_buy_f150_0 -wget http://$1:9000/trans_add_f151_2_200 -wget http://$1:9000/trans_buy_f151_1 -wget http://$1:9000/trans_add_f152_3_50 -wget http://$1:9000/trans_buy_f152_2 -wget http://$1:9000/trans_add_f153_4_100 -wget http://$1:9000/trans_buy_f153_3 -wget http://$1:9000/trans_add_f154_5_150 -wget http://$1:9000/trans_buy_f154_4 -wget http://$1:9000/trans_add_f155_1_200 -wget http://$1:9000/trans_buy_f155_0 -wget http://$1:9000/trans_add_f156_2_50 -wget http://$1:9000/trans_buy_f156_1 -wget http://$1:9000/trans_add_f157_3_100 -wget http://$1:9000/trans_buy_f157_2 -wget http://$1:9000/trans_add_f158_4_150 -wget http://$1:9000/trans_buy_f158_3 -wget http://$1:9000/trans_add_f159_5_200 -wget http://$1:9000/trans_buy_f159_4 -wget http://$1:9000/trans_add_f160_1_50 -wget http://$1:9000/trans_buy_f160_0 -wget http://$1:9000/trans_add_f161_2_100 -wget http://$1:9000/trans_buy_f161_1 -wget http://$1:9000/trans_add_f162_3_150 -wget http://$1:9000/trans_buy_f162_2 -wget http://$1:9000/trans_add_f163_4_200 -wget http://$1:9000/trans_buy_f163_3 -wget http://$1:9000/trans_add_f164_5_50 -wget http://$1:9000/trans_buy_f164_4 -wget http://$1:9000/trans_add_f165_1_100 -wget http://$1:9000/trans_buy_f165_0 -wget http://$1:9000/trans_add_f166_2_150 -wget http://$1:9000/trans_buy_f166_1 -wget http://$1:9000/trans_add_f167_3_200 -wget http://$1:9000/trans_buy_f167_2 -wget http://$1:9000/trans_add_f168_4_50 -wget http://$1:9000/trans_buy_f168_3 -wget http://$1:9000/trans_add_f169_5_100 -wget http://$1:9000/trans_buy_f169_4 -wget http://$1:9000/trans_add_f170_1_150 -wget http://$1:9000/trans_buy_f170_0 -wget http://$1:9000/trans_add_f171_2_200 -wget http://$1:9000/trans_buy_f171_1 -wget http://$1:9000/trans_add_f172_3_50 -wget http://$1:9000/trans_buy_f172_2 -wget http://$1:9000/trans_add_f173_4_100 -wget http://$1:9000/trans_buy_f173_3 -wget http://$1:9000/trans_add_f174_5_150 -wget http://$1:9000/trans_buy_f174_4 -wget http://$1:9000/trans_add_f175_1_200 -wget http://$1:9000/trans_buy_f175_0 -wget http://$1:9000/trans_add_f176_2_50 -wget http://$1:9000/trans_buy_f176_1 -wget http://$1:9000/trans_add_f177_3_100 -wget http://$1:9000/trans_buy_f177_2 -wget http://$1:9000/trans_add_f178_4_150 -wget http://$1:9000/trans_buy_f178_3 -wget http://$1:9000/trans_add_f179_5_200 -wget http://$1:9000/trans_buy_f179_4 -wget http://$1:9000/trans_add_f180_1_50 -wget http://$1:9000/trans_buy_f180_0 -wget http://$1:9000/trans_add_f181_2_100 -wget http://$1:9000/trans_buy_f181_1 -wget http://$1:9000/trans_add_f182_3_150 -wget http://$1:9000/trans_buy_f182_2 -wget http://$1:9000/trans_add_f183_4_200 -wget http://$1:9000/trans_buy_f183_3 -wget http://$1:9000/trans_add_f184_5_50 -wget http://$1:9000/trans_buy_f184_4 -wget http://$1:9000/trans_add_f185_1_100 -wget http://$1:9000/trans_buy_f185_0 -wget http://$1:9000/trans_add_f186_2_150 -wget http://$1:9000/trans_buy_f186_1 -wget http://$1:9000/trans_add_f187_3_200 -wget http://$1:9000/trans_buy_f187_2 -wget http://$1:9000/trans_add_f188_4_50 -wget http://$1:9000/trans_buy_f188_3 -wget http://$1:9000/trans_add_f189_5_100 -wget http://$1:9000/trans_buy_f189_4 -wget http://$1:9000/trans_add_f190_1_150 -wget http://$1:9000/trans_buy_f190_0 -wget http://$1:9000/trans_add_f191_2_200 -wget http://$1:9000/trans_buy_f191_1 -wget http://$1:9000/trans_add_f192_3_50 -wget http://$1:9000/trans_buy_f192_2 -wget http://$1:9000/trans_add_f193_4_100 -wget http://$1:9000/trans_buy_f193_3 -wget http://$1:9000/trans_add_f194_5_150 -wget http://$1:9000/trans_buy_f194_4 -wget http://$1:9000/trans_add_f195_1_200 -wget http://$1:9000/trans_buy_f195_0 -wget http://$1:9000/trans_add_f196_2_50 -wget http://$1:9000/trans_buy_f196_1 -wget http://$1:9000/trans_add_f197_3_100 -wget http://$1:9000/trans_buy_f197_2 -wget http://$1:9000/trans_add_f198_4_150 -wget http://$1:9000/trans_buy_f198_3 -wget http://$1:9000/trans_add_f199_5_200 -wget http://$1:9000/trans_buy_f199_4 -wget http://$1:9000/trans_add_f200_1_50 -wget http://$1:9000/trans_buy_f200_0 -wget http://$1:9000/trans_add_f201_2_100 -wget http://$1:9000/trans_buy_f201_1 -wget http://$1:9000/trans_add_f202_3_150 -wget http://$1:9000/trans_buy_f202_2 -wget http://$1:9000/trans_add_f203_4_200 -wget http://$1:9000/trans_buy_f203_3 -wget http://$1:9000/trans_add_f204_5_50 -wget http://$1:9000/trans_buy_f204_4 -wget http://$1:9000/trans_add_f205_1_100 -wget http://$1:9000/trans_buy_f205_0 -wget http://$1:9000/trans_add_f206_2_150 -wget http://$1:9000/trans_buy_f206_1 -wget http://$1:9000/trans_add_f207_3_200 -wget http://$1:9000/trans_buy_f207_2 -wget http://$1:9000/trans_add_f208_4_50 -wget http://$1:9000/trans_buy_f208_3 -wget http://$1:9000/trans_add_f209_5_100 -wget http://$1:9000/trans_buy_f209_4 -wget http://$1:9000/trans_add_f210_1_150 -wget http://$1:9000/trans_buy_f210_0 -wget http://$1:9000/trans_add_f211_2_200 -wget http://$1:9000/trans_buy_f211_1 -wget http://$1:9000/trans_add_f212_3_50 -wget http://$1:9000/trans_buy_f212_2 -wget http://$1:9000/trans_add_f213_4_100 -wget http://$1:9000/trans_buy_f213_3 -wget http://$1:9000/trans_add_f214_5_150 -wget http://$1:9000/trans_buy_f214_4 -wget http://$1:9000/trans_add_f215_1_200 -wget http://$1:9000/trans_buy_f215_0 -wget http://$1:9000/trans_add_f216_2_50 -wget http://$1:9000/trans_buy_f216_1 -wget http://$1:9000/trans_add_f217_3_100 -wget http://$1:9000/trans_buy_f217_2 -wget http://$1:9000/trans_add_f218_4_150 -wget http://$1:9000/trans_buy_f218_3 -wget http://$1:9000/trans_add_f219_5_200 -wget http://$1:9000/trans_buy_f219_4 -wget http://$1:9000/trans_add_f220_1_50 -wget http://$1:9000/trans_buy_f220_0 -wget http://$1:9000/trans_add_f221_2_100 -wget http://$1:9000/trans_buy_f221_1 -wget http://$1:9000/trans_add_f222_3_150 -wget http://$1:9000/trans_buy_f222_2 -wget http://$1:9000/trans_add_f223_4_200 -wget http://$1:9000/trans_buy_f223_3 -wget http://$1:9000/trans_add_f224_5_50 -wget http://$1:9000/trans_buy_f224_4 -wget http://$1:9000/trans_add_f225_1_100 -wget http://$1:9000/trans_buy_f225_0 -wget http://$1:9000/trans_add_f226_2_150 -wget http://$1:9000/trans_buy_f226_1 -wget http://$1:9000/trans_add_f227_3_200 -wget http://$1:9000/trans_buy_f227_2 -wget http://$1:9000/trans_add_f228_4_50 -wget http://$1:9000/trans_buy_f228_3 -wget http://$1:9000/trans_add_f229_5_100 -wget http://$1:9000/trans_buy_f229_4 -wget http://$1:9000/trans_add_f230_1_150 -wget http://$1:9000/trans_buy_f230_0 -wget http://$1:9000/trans_add_f231_2_200 -wget http://$1:9000/trans_buy_f231_1 -wget http://$1:9000/trans_add_f232_3_50 -wget http://$1:9000/trans_buy_f232_2 -wget http://$1:9000/trans_add_f233_4_100 -wget http://$1:9000/trans_buy_f233_3 -wget http://$1:9000/trans_add_f234_5_150 -wget http://$1:9000/trans_buy_f234_4 -wget http://$1:9000/trans_add_f235_1_200 -wget http://$1:9000/trans_buy_f235_0 -wget http://$1:9000/trans_add_f236_2_50 -wget http://$1:9000/trans_buy_f236_1 -wget http://$1:9000/trans_add_f237_3_100 -wget http://$1:9000/trans_buy_f237_2 -wget http://$1:9000/trans_add_f238_4_150 -wget http://$1:9000/trans_buy_f238_3 -wget http://$1:9000/trans_add_f239_5_200 -wget http://$1:9000/trans_buy_f239_4 -wget http://$1:9000/trans_add_f240_1_50 -wget http://$1:9000/trans_buy_f240_0 -wget http://$1:9000/trans_add_f241_2_100 -wget http://$1:9000/trans_buy_f241_1 -wget http://$1:9000/trans_add_f242_3_150 -wget http://$1:9000/trans_buy_f242_2 -wget http://$1:9000/trans_add_f243_4_200 -wget http://$1:9000/trans_buy_f243_3 -wget http://$1:9000/trans_add_f244_5_50 -wget http://$1:9000/trans_buy_f244_4 -wget http://$1:9000/trans_add_f245_1_100 -wget http://$1:9000/trans_buy_f245_0 -wget http://$1:9000/trans_add_f246_2_150 -wget http://$1:9000/trans_buy_f246_1 -wget http://$1:9000/trans_add_f247_3_200 -wget http://$1:9000/trans_buy_f247_2 -wget http://$1:9000/trans_add_f248_4_50 -wget http://$1:9000/trans_buy_f248_3 -wget http://$1:9000/trans_add_f249_5_100 -wget http://$1:9000/trans_buy_f249_4 -wget http://$1:9000/trans_add_f250_1_150 -wget http://$1:9000/trans_buy_f250_0 -wget http://$1:9000/trans_add_f251_2_200 -wget http://$1:9000/trans_buy_f251_1 -wget http://$1:9000/trans_add_f252_3_50 -wget http://$1:9000/trans_buy_f252_2 -wget http://$1:9000/trans_add_f253_4_100 -wget http://$1:9000/trans_buy_f253_3 -wget http://$1:9000/trans_add_f254_5_150 -wget http://$1:9000/trans_buy_f254_4 -wget http://$1:9000/trans_add_f255_1_200 -wget http://$1:9000/trans_buy_f255_0 -wget http://$1:9000/trans_add_f256_2_50 -wget http://$1:9000/trans_buy_f256_1 -wget http://$1:9000/trans_add_f257_3_100 -wget http://$1:9000/trans_buy_f257_2 -wget http://$1:9000/trans_add_f258_4_150 -wget http://$1:9000/trans_buy_f258_3 -wget http://$1:9000/trans_add_f259_5_200 -wget http://$1:9000/trans_buy_f259_4 -wget http://$1:9000/trans_add_f260_1_50 -wget http://$1:9000/trans_buy_f260_0 -wget http://$1:9000/trans_add_f261_2_100 -wget http://$1:9000/trans_buy_f261_1 -wget http://$1:9000/trans_add_f262_3_150 -wget http://$1:9000/trans_buy_f262_2 -wget http://$1:9000/trans_add_f263_4_200 -wget http://$1:9000/trans_buy_f263_3 -wget http://$1:9000/trans_add_f264_5_50 -wget http://$1:9000/trans_buy_f264_4 -wget http://$1:9000/trans_add_f265_1_100 -wget http://$1:9000/trans_buy_f265_0 -wget http://$1:9000/trans_add_f266_2_150 -wget http://$1:9000/trans_buy_f266_1 -wget http://$1:9000/trans_add_f267_3_200 -wget http://$1:9000/trans_buy_f267_2 -wget http://$1:9000/trans_add_f268_4_50 -wget http://$1:9000/trans_buy_f268_3 -wget http://$1:9000/trans_add_f269_5_100 -wget http://$1:9000/trans_buy_f269_4 -wget http://$1:9000/trans_add_f270_1_150 -wget http://$1:9000/trans_buy_f270_0 -wget http://$1:9000/trans_add_f271_2_200 -wget http://$1:9000/trans_buy_f271_1 -wget http://$1:9000/trans_add_f272_3_50 -wget http://$1:9000/trans_buy_f272_2 -wget http://$1:9000/trans_add_f273_4_100 -wget http://$1:9000/trans_buy_f273_3 -wget http://$1:9000/trans_add_f274_5_150 -wget http://$1:9000/trans_buy_f274_4 -wget http://$1:9000/trans_add_f275_1_200 -wget http://$1:9000/trans_buy_f275_0 -wget http://$1:9000/trans_add_f276_2_50 -wget http://$1:9000/trans_buy_f276_1 -wget http://$1:9000/trans_add_f277_3_100 -wget http://$1:9000/trans_buy_f277_2 -wget http://$1:9000/trans_add_f278_4_150 -wget http://$1:9000/trans_buy_f278_3 -wget http://$1:9000/trans_add_f279_5_200 -wget http://$1:9000/trans_buy_f279_4 -wget http://$1:9000/trans_add_f280_1_50 -wget http://$1:9000/trans_buy_f280_0 -wget http://$1:9000/trans_add_f281_2_100 -wget http://$1:9000/trans_buy_f281_1 -wget http://$1:9000/trans_add_f282_3_150 -wget http://$1:9000/trans_buy_f282_2 -wget http://$1:9000/trans_add_f283_4_200 -wget http://$1:9000/trans_buy_f283_3 -wget http://$1:9000/trans_add_f284_5_50 -wget http://$1:9000/trans_buy_f284_4 -wget http://$1:9000/trans_add_f285_1_100 -wget http://$1:9000/trans_buy_f285_0 -wget http://$1:9000/trans_add_f286_2_150 -wget http://$1:9000/trans_buy_f286_1 -wget http://$1:9000/trans_add_f287_3_200 -wget http://$1:9000/trans_buy_f287_2 -wget http://$1:9000/trans_add_f288_4_50 -wget http://$1:9000/trans_buy_f288_3 -wget http://$1:9000/trans_add_f289_5_100 -wget http://$1:9000/trans_buy_f289_4 -wget http://$1:9000/trans_add_f290_1_150 -wget http://$1:9000/trans_buy_f290_0 -wget http://$1:9000/trans_add_f291_2_200 -wget http://$1:9000/trans_buy_f291_1 -wget http://$1:9000/trans_add_f292_3_50 -wget http://$1:9000/trans_buy_f292_2 -wget http://$1:9000/trans_add_f293_4_100 -wget http://$1:9000/trans_buy_f293_3 -wget http://$1:9000/trans_add_f294_5_150 -wget http://$1:9000/trans_buy_f294_4 -wget http://$1:9000/trans_add_f295_1_200 -wget http://$1:9000/trans_buy_f295_0 -wget http://$1:9000/trans_add_f296_2_50 -wget http://$1:9000/trans_buy_f296_1 -wget http://$1:9000/trans_add_f297_3_100 -wget http://$1:9000/trans_buy_f297_2 -wget http://$1:9000/trans_add_f298_4_150 -wget http://$1:9000/trans_buy_f298_3 -wget http://$1:9000/trans_add_f299_5_200 -wget http://$1:9000/trans_buy_f299_4 -wget http://$1:9000/trans_add_f300_1_50 -wget http://$1:9000/trans_buy_f300_0 -wget http://$1:9000/trans_add_f301_2_100 -wget http://$1:9000/trans_buy_f301_1 -wget http://$1:9000/trans_add_f302_3_150 -wget http://$1:9000/trans_buy_f302_2 -wget http://$1:9000/trans_add_f303_4_200 -wget http://$1:9000/trans_buy_f303_3 -wget http://$1:9000/trans_add_f304_5_50 -wget http://$1:9000/trans_buy_f304_4 -wget http://$1:9000/trans_add_f305_1_100 -wget http://$1:9000/trans_buy_f305_0 -wget http://$1:9000/trans_add_f306_2_150 -wget http://$1:9000/trans_buy_f306_1 -wget http://$1:9000/trans_add_f307_3_200 -wget http://$1:9000/trans_buy_f307_2 -wget http://$1:9000/trans_add_f308_4_50 -wget http://$1:9000/trans_buy_f308_3 -wget http://$1:9000/trans_add_f309_5_100 -wget http://$1:9000/trans_buy_f309_4 -wget http://$1:9000/trans_add_f310_1_150 -wget http://$1:9000/trans_buy_f310_0 -wget http://$1:9000/trans_add_f311_2_200 -wget http://$1:9000/trans_buy_f311_1 -wget http://$1:9000/trans_add_f312_3_50 -wget http://$1:9000/trans_buy_f312_2 -wget http://$1:9000/trans_add_f313_4_100 -wget http://$1:9000/trans_buy_f313_3 -wget http://$1:9000/trans_add_f314_5_150 -wget http://$1:9000/trans_buy_f314_4 -wget http://$1:9000/trans_add_f315_1_200 -wget http://$1:9000/trans_buy_f315_0 -wget http://$1:9000/trans_add_f316_2_50 -wget http://$1:9000/trans_buy_f316_1 -wget http://$1:9000/trans_add_f317_3_100 -wget http://$1:9000/trans_buy_f317_2 -wget http://$1:9000/trans_add_f318_4_150 -wget http://$1:9000/trans_buy_f318_3 -wget http://$1:9000/trans_add_f319_5_200 -wget http://$1:9000/trans_buy_f319_4 -wget http://$1:9000/trans_add_f320_1_50 -wget http://$1:9000/trans_buy_f320_0 -wget http://$1:9000/trans_add_f321_2_100 -wget http://$1:9000/trans_buy_f321_1 -wget http://$1:9000/trans_add_f322_3_150 -wget http://$1:9000/trans_buy_f322_2 -wget http://$1:9000/trans_add_f323_4_200 -wget http://$1:9000/trans_buy_f323_3 -wget http://$1:9000/trans_add_f324_5_50 -wget http://$1:9000/trans_buy_f324_4 -wget http://$1:9000/trans_add_f325_1_100 -wget http://$1:9000/trans_buy_f325_0 -wget http://$1:9000/trans_add_f326_2_150 -wget http://$1:9000/trans_buy_f326_1 -wget http://$1:9000/trans_add_f327_3_200 -wget http://$1:9000/trans_buy_f327_2 -wget http://$1:9000/trans_add_f328_4_50 -wget http://$1:9000/trans_buy_f328_3 -wget http://$1:9000/trans_add_f329_5_100 -wget http://$1:9000/trans_buy_f329_4 -wget http://$1:9000/trans_add_f330_1_150 -wget http://$1:9000/trans_buy_f330_0 -wget http://$1:9000/trans_add_f331_2_200 -wget http://$1:9000/trans_buy_f331_1 -wget http://$1:9000/trans_add_f332_3_50 -wget http://$1:9000/trans_buy_f332_2 -wget http://$1:9000/trans_add_f333_4_100 -wget http://$1:9000/trans_buy_f333_3 -wget http://$1:9000/trans_add_f334_5_150 -wget http://$1:9000/trans_buy_f334_4 -wget http://$1:9000/trans_add_f335_1_200 -wget http://$1:9000/trans_buy_f335_0 -wget http://$1:9000/trans_add_f336_2_50 -wget http://$1:9000/trans_buy_f336_1 -wget http://$1:9000/trans_add_f337_3_100 -wget http://$1:9000/trans_buy_f337_2 -wget http://$1:9000/trans_add_f338_4_150 -wget http://$1:9000/trans_buy_f338_3 -wget http://$1:9000/trans_add_f339_5_200 -wget http://$1:9000/trans_buy_f339_4 -wget http://$1:9000/trans_add_f340_1_50 -wget http://$1:9000/trans_buy_f340_0 -wget http://$1:9000/trans_add_f341_2_100 -wget http://$1:9000/trans_buy_f341_1 -wget http://$1:9000/trans_add_f342_3_150 -wget http://$1:9000/trans_buy_f342_2 -wget http://$1:9000/trans_add_f343_4_200 -wget http://$1:9000/trans_buy_f343_3 -wget http://$1:9000/trans_add_f344_5_50 -wget http://$1:9000/trans_buy_f344_4 -wget http://$1:9000/trans_add_f345_1_100 -wget http://$1:9000/trans_buy_f345_0 -wget http://$1:9000/trans_add_f346_2_150 -wget http://$1:9000/trans_buy_f346_1 -wget http://$1:9000/trans_add_f347_3_200 -wget http://$1:9000/trans_buy_f347_2 -wget http://$1:9000/trans_add_f348_4_50 -wget http://$1:9000/trans_buy_f348_3 -wget http://$1:9000/trans_add_f349_5_100 -wget http://$1:9000/trans_buy_f349_4 -wget http://$1:9000/trans_add_f350_1_150 -wget http://$1:9000/trans_buy_f350_0 -wget http://$1:9000/trans_add_f351_2_200 -wget http://$1:9000/trans_buy_f351_1 -wget http://$1:9000/trans_add_f352_3_50 -wget http://$1:9000/trans_buy_f352_2 -wget http://$1:9000/trans_add_f353_4_100 -wget http://$1:9000/trans_buy_f353_3 -wget http://$1:9000/trans_add_f354_5_150 -wget http://$1:9000/trans_buy_f354_4 -wget http://$1:9000/trans_add_f355_1_200 -wget http://$1:9000/trans_buy_f355_0 -wget http://$1:9000/trans_add_f356_2_50 -wget http://$1:9000/trans_buy_f356_1 -wget http://$1:9000/trans_add_f357_3_100 -wget http://$1:9000/trans_buy_f357_2 -wget http://$1:9000/trans_add_f358_4_150 -wget http://$1:9000/trans_buy_f358_3 -wget http://$1:9000/trans_add_f359_5_200 -wget http://$1:9000/trans_buy_f359_4 -wget http://$1:9000/trans_add_f360_1_50 -wget http://$1:9000/trans_buy_f360_0 -wget http://$1:9000/trans_add_f361_2_100 -wget http://$1:9000/trans_buy_f361_1 -wget http://$1:9000/trans_add_f362_3_150 -wget http://$1:9000/trans_buy_f362_2 -wget http://$1:9000/trans_add_f363_4_200 -wget http://$1:9000/trans_buy_f363_3 -wget http://$1:9000/trans_add_f364_5_50 -wget http://$1:9000/trans_buy_f364_4 -wget http://$1:9000/trans_add_f365_1_100 -wget http://$1:9000/trans_buy_f365_0 -wget http://$1:9000/trans_add_f366_2_150 -wget http://$1:9000/trans_buy_f366_1 -wget http://$1:9000/trans_add_f367_3_200 -wget http://$1:9000/trans_buy_f367_2 -wget http://$1:9000/trans_add_f368_4_50 -wget http://$1:9000/trans_buy_f368_3 -wget http://$1:9000/trans_add_f369_5_100 -wget http://$1:9000/trans_buy_f369_4 -wget http://$1:9000/trans_add_f370_1_150 -wget http://$1:9000/trans_buy_f370_0 -wget http://$1:9000/trans_add_f371_2_200 -wget http://$1:9000/trans_buy_f371_1 -wget http://$1:9000/trans_add_f372_3_50 -wget http://$1:9000/trans_buy_f372_2 -wget http://$1:9000/trans_add_f373_4_100 -wget http://$1:9000/trans_buy_f373_3 -wget http://$1:9000/trans_add_f374_5_150 -wget http://$1:9000/trans_buy_f374_4 -wget http://$1:9000/trans_add_f375_1_200 -wget http://$1:9000/trans_buy_f375_0 -wget http://$1:9000/trans_add_f376_2_50 -wget http://$1:9000/trans_buy_f376_1 -wget http://$1:9000/trans_add_f377_3_100 -wget http://$1:9000/trans_buy_f377_2 -wget http://$1:9000/trans_add_f378_4_150 -wget http://$1:9000/trans_buy_f378_3 -wget http://$1:9000/trans_add_f379_5_200 -wget http://$1:9000/trans_buy_f379_4 -wget http://$1:9000/trans_add_f380_1_50 -wget http://$1:9000/trans_buy_f380_0 -wget http://$1:9000/trans_add_f381_2_100 -wget http://$1:9000/trans_buy_f381_1 -wget http://$1:9000/trans_add_f382_3_150 -wget http://$1:9000/trans_buy_f382_2 -wget http://$1:9000/trans_add_f383_4_200 -wget http://$1:9000/trans_buy_f383_3 -wget http://$1:9000/trans_add_f384_5_50 -wget http://$1:9000/trans_buy_f384_4 -wget http://$1:9000/trans_add_f385_1_100 -wget http://$1:9000/trans_buy_f385_0 -wget http://$1:9000/trans_add_f386_2_150 -wget http://$1:9000/trans_buy_f386_1 -wget http://$1:9000/trans_add_f387_3_200 -wget http://$1:9000/trans_buy_f387_2 -wget http://$1:9000/trans_add_f388_4_50 -wget http://$1:9000/trans_buy_f388_3 -wget http://$1:9000/trans_add_f389_5_100 -wget http://$1:9000/trans_buy_f389_4 -wget http://$1:9000/trans_add_f390_1_150 -wget http://$1:9000/trans_buy_f390_0 -wget http://$1:9000/trans_add_f391_2_200 -wget http://$1:9000/trans_buy_f391_1 -wget http://$1:9000/trans_add_f392_3_50 -wget http://$1:9000/trans_buy_f392_2 -wget http://$1:9000/trans_add_f393_4_100 -wget http://$1:9000/trans_buy_f393_3 -wget http://$1:9000/trans_add_f394_5_150 -wget http://$1:9000/trans_buy_f394_4 -wget http://$1:9000/trans_add_f395_1_200 -wget http://$1:9000/trans_buy_f395_0 -wget http://$1:9000/trans_add_f396_2_50 -wget http://$1:9000/trans_buy_f396_1 -wget http://$1:9000/trans_add_f397_3_100 -wget http://$1:9000/trans_buy_f397_2 -wget http://$1:9000/trans_add_f398_4_150 -wget http://$1:9000/trans_buy_f398_3 -wget http://$1:9000/trans_add_f399_5_200 -wget http://$1:9000/trans_buy_f399_4 -wget http://$1:9000/trans_add_f400_1_50 -wget http://$1:9000/trans_buy_f400_0 -wget http://$1:9000/trans_add_f401_2_100 -wget http://$1:9000/trans_buy_f401_1 -wget http://$1:9000/trans_add_f402_3_150 -wget http://$1:9000/trans_buy_f402_2 -wget http://$1:9000/trans_add_f403_4_200 -wget http://$1:9000/trans_buy_f403_3 -wget http://$1:9000/trans_add_f404_5_50 -wget http://$1:9000/trans_buy_f404_4 -wget http://$1:9000/trans_add_f405_1_100 -wget http://$1:9000/trans_buy_f405_0 -wget http://$1:9000/trans_add_f406_2_150 -wget http://$1:9000/trans_buy_f406_1 -wget http://$1:9000/trans_add_f407_3_200 -wget http://$1:9000/trans_buy_f407_2 -wget http://$1:9000/trans_add_f408_4_50 -wget http://$1:9000/trans_buy_f408_3 -wget http://$1:9000/trans_add_f409_5_100 -wget http://$1:9000/trans_buy_f409_4 -wget http://$1:9000/trans_add_f410_1_150 -wget http://$1:9000/trans_buy_f410_0 -wget http://$1:9000/trans_add_f411_2_200 -wget http://$1:9000/trans_buy_f411_1 -wget http://$1:9000/trans_add_f412_3_50 -wget http://$1:9000/trans_buy_f412_2 -wget http://$1:9000/trans_add_f413_4_100 -wget http://$1:9000/trans_buy_f413_3 -wget http://$1:9000/trans_add_f414_5_150 -wget http://$1:9000/trans_buy_f414_4 -wget http://$1:9000/trans_add_f415_1_200 -wget http://$1:9000/trans_buy_f415_0 -wget http://$1:9000/trans_add_f416_2_50 -wget http://$1:9000/trans_buy_f416_1 -wget http://$1:9000/trans_add_f417_3_100 -wget http://$1:9000/trans_buy_f417_2 -wget http://$1:9000/trans_add_f418_4_150 -wget http://$1:9000/trans_buy_f418_3 -wget http://$1:9000/trans_add_f419_5_200 -wget http://$1:9000/trans_buy_f419_4 -wget http://$1:9000/trans_add_f420_1_50 -wget http://$1:9000/trans_buy_f420_0 -wget http://$1:9000/trans_add_f421_2_100 -wget http://$1:9000/trans_buy_f421_1 -wget http://$1:9000/trans_add_f422_3_150 -wget http://$1:9000/trans_buy_f422_2 -wget http://$1:9000/trans_add_f423_4_200 -wget http://$1:9000/trans_buy_f423_3 -wget http://$1:9000/trans_add_f424_5_50 -wget http://$1:9000/trans_buy_f424_4 -wget http://$1:9000/trans_add_f425_1_100 -wget http://$1:9000/trans_buy_f425_0 -wget http://$1:9000/trans_add_f426_2_150 -wget http://$1:9000/trans_buy_f426_1 -wget http://$1:9000/trans_add_f427_3_200 -wget http://$1:9000/trans_buy_f427_2 -wget http://$1:9000/trans_add_f428_4_50 -wget http://$1:9000/trans_buy_f428_3 -wget http://$1:9000/trans_add_f429_5_100 -wget http://$1:9000/trans_buy_f429_4 -wget http://$1:9000/trans_add_f430_1_150 -wget http://$1:9000/trans_buy_f430_0 -wget http://$1:9000/trans_add_f431_2_200 -wget http://$1:9000/trans_buy_f431_1 -wget http://$1:9000/trans_add_f432_3_50 -wget http://$1:9000/trans_buy_f432_2 -wget http://$1:9000/trans_add_f433_4_100 -wget http://$1:9000/trans_buy_f433_3 -wget http://$1:9000/trans_add_f434_5_150 -wget http://$1:9000/trans_buy_f434_4 -wget http://$1:9000/trans_add_f435_1_200 -wget http://$1:9000/trans_buy_f435_0 -wget http://$1:9000/trans_add_f436_2_50 -wget http://$1:9000/trans_buy_f436_1 -wget http://$1:9000/trans_add_f437_3_100 -wget http://$1:9000/trans_buy_f437_2 -wget http://$1:9000/trans_add_f438_4_150 -wget http://$1:9000/trans_buy_f438_3 -wget http://$1:9000/trans_add_f439_5_200 -wget http://$1:9000/trans_buy_f439_4 -wget http://$1:9000/trans_add_f440_1_50 -wget http://$1:9000/trans_buy_f440_0 -wget http://$1:9000/trans_add_f441_2_100 -wget http://$1:9000/trans_buy_f441_1 -wget http://$1:9000/trans_add_f442_3_150 -wget http://$1:9000/trans_buy_f442_2 -wget http://$1:9000/trans_add_f443_4_200 -wget http://$1:9000/trans_buy_f443_3 -wget http://$1:9000/trans_add_f444_5_50 -wget http://$1:9000/trans_buy_f444_4 -wget http://$1:9000/trans_add_f445_1_100 -wget http://$1:9000/trans_buy_f445_0 -wget http://$1:9000/trans_add_f446_2_150 -wget http://$1:9000/trans_buy_f446_1 -wget http://$1:9000/trans_add_f447_3_200 -wget http://$1:9000/trans_buy_f447_2 -wget http://$1:9000/trans_add_f448_4_50 -wget http://$1:9000/trans_buy_f448_3 -wget http://$1:9000/trans_add_f449_5_100 -wget http://$1:9000/trans_buy_f449_4 -wget http://$1:9000/trans_add_f450_1_150 -wget http://$1:9000/trans_buy_f450_0 -wget http://$1:9000/trans_add_f451_2_200 -wget http://$1:9000/trans_buy_f451_1 -wget http://$1:9000/trans_add_f452_3_50 -wget http://$1:9000/trans_buy_f452_2 -wget http://$1:9000/trans_add_f453_4_100 -wget http://$1:9000/trans_buy_f453_3 -wget http://$1:9000/trans_add_f454_5_150 -wget http://$1:9000/trans_buy_f454_4 -wget http://$1:9000/trans_add_f455_1_200 -wget http://$1:9000/trans_buy_f455_0 -wget http://$1:9000/trans_add_f456_2_50 -wget http://$1:9000/trans_buy_f456_1 -wget http://$1:9000/trans_add_f457_3_100 -wget http://$1:9000/trans_buy_f457_2 -wget http://$1:9000/trans_add_f458_4_150 -wget http://$1:9000/trans_buy_f458_3 -wget http://$1:9000/trans_add_f459_5_200 -wget http://$1:9000/trans_buy_f459_4 -wget http://$1:9000/trans_add_f460_1_50 -wget http://$1:9000/trans_buy_f460_0 -wget http://$1:9000/trans_add_f461_2_100 -wget http://$1:9000/trans_buy_f461_1 -wget http://$1:9000/trans_add_f462_3_150 -wget http://$1:9000/trans_buy_f462_2 -wget http://$1:9000/trans_add_f463_4_200 -wget http://$1:9000/trans_buy_f463_3 -wget http://$1:9000/trans_add_f464_5_50 -wget http://$1:9000/trans_buy_f464_4 -wget http://$1:9000/trans_add_f465_1_100 -wget http://$1:9000/trans_buy_f465_0 -wget http://$1:9000/trans_add_f466_2_150 -wget http://$1:9000/trans_buy_f466_1 -wget http://$1:9000/trans_add_f467_3_200 -wget http://$1:9000/trans_buy_f467_2 -wget http://$1:9000/trans_add_f468_4_50 -wget http://$1:9000/trans_buy_f468_3 -wget http://$1:9000/trans_add_f469_5_100 -wget http://$1:9000/trans_buy_f469_4 -wget http://$1:9000/trans_add_f470_1_150 -wget http://$1:9000/trans_buy_f470_0 -wget http://$1:9000/trans_add_f471_2_200 -wget http://$1:9000/trans_buy_f471_1 -wget http://$1:9000/trans_add_f472_3_50 -wget http://$1:9000/trans_buy_f472_2 -wget http://$1:9000/trans_add_f473_4_100 -wget http://$1:9000/trans_buy_f473_3 -wget http://$1:9000/trans_add_f474_5_150 -wget http://$1:9000/trans_buy_f474_4 -wget http://$1:9000/trans_add_f475_1_200 -wget http://$1:9000/trans_buy_f475_0 -wget http://$1:9000/trans_add_f476_2_50 -wget http://$1:9000/trans_buy_f476_1 -wget http://$1:9000/trans_add_f477_3_100 -wget http://$1:9000/trans_buy_f477_2 -wget http://$1:9000/trans_add_f478_4_150 -wget http://$1:9000/trans_buy_f478_3 -wget http://$1:9000/trans_add_f479_5_200 -wget http://$1:9000/trans_buy_f479_4 -wget http://$1:9000/trans_add_f480_1_50 -wget http://$1:9000/trans_buy_f480_0 -wget http://$1:9000/trans_add_f481_2_100 -wget http://$1:9000/trans_buy_f481_1 -wget http://$1:9000/trans_add_f482_3_150 -wget http://$1:9000/trans_buy_f482_2 -wget http://$1:9000/trans_add_f483_4_200 -wget http://$1:9000/trans_buy_f483_3 -wget http://$1:9000/trans_add_f484_5_50 -wget http://$1:9000/trans_buy_f484_4 -wget http://$1:9000/trans_add_f485_1_100 -wget http://$1:9000/trans_buy_f485_0 -wget http://$1:9000/trans_add_f486_2_150 -wget http://$1:9000/trans_buy_f486_1 -wget http://$1:9000/trans_add_f487_3_200 -wget http://$1:9000/trans_buy_f487_2 -wget http://$1:9000/trans_add_f488_4_50 -wget http://$1:9000/trans_buy_f488_3 -wget http://$1:9000/trans_add_f489_5_100 -wget http://$1:9000/trans_buy_f489_4 -wget http://$1:9000/trans_add_f490_1_150 -wget http://$1:9000/trans_buy_f490_0 -wget http://$1:9000/trans_add_f491_2_200 -wget http://$1:9000/trans_buy_f491_1 -wget http://$1:9000/trans_add_f492_3_50 -wget http://$1:9000/trans_buy_f492_2 -wget http://$1:9000/trans_add_f493_4_100 -wget http://$1:9000/trans_buy_f493_3 -wget http://$1:9000/trans_add_f494_5_150 -wget http://$1:9000/trans_buy_f494_4 -wget http://$1:9000/trans_add_f495_1_200 -wget http://$1:9000/trans_buy_f495_0 -wget http://$1:9000/trans_add_f496_2_50 -wget http://$1:9000/trans_buy_f496_1 -wget http://$1:9000/trans_add_f497_3_100 -wget http://$1:9000/trans_buy_f497_2 -wget http://$1:9000/trans_add_f498_4_150 -wget http://$1:9000/trans_buy_f498_3 -wget http://$1:9000/trans_add_f499_5_200 -wget http://$1:9000/trans_buy_f499_4 -wget http://$1:9000/trans_add_f500_1_50 -wget http://$1:9000/trans_buy_f500_0 -wget http://$1:9000/trans_add_f501_2_100 -wget http://$1:9000/trans_buy_f501_1 -wget http://$1:9000/trans_add_f502_3_150 -wget http://$1:9000/trans_buy_f502_2 -wget http://$1:9000/trans_add_f503_4_200 -wget http://$1:9000/trans_buy_f503_3 -wget http://$1:9000/trans_add_f504_5_50 -wget http://$1:9000/trans_buy_f504_4 -wget http://$1:9000/trans_add_f505_1_100 -wget http://$1:9000/trans_buy_f505_0 -wget http://$1:9000/trans_add_f506_2_150 -wget http://$1:9000/trans_buy_f506_1 -wget http://$1:9000/trans_add_f507_3_200 -wget http://$1:9000/trans_buy_f507_2 -wget http://$1:9000/trans_add_f508_4_50 -wget http://$1:9000/trans_buy_f508_3 -wget http://$1:9000/trans_add_f509_5_100 -wget http://$1:9000/trans_buy_f509_4 -wget http://$1:9000/trans_add_f510_1_150 -wget http://$1:9000/trans_buy_f510_0 -wget http://$1:9000/trans_add_f511_2_200 -wget http://$1:9000/trans_buy_f511_1 -wget http://$1:9000/trans_add_f512_3_50 -wget http://$1:9000/trans_buy_f512_2 -wget http://$1:9000/trans_add_f513_4_100 -wget http://$1:9000/trans_buy_f513_3 -wget http://$1:9000/trans_add_f514_5_150 -wget http://$1:9000/trans_buy_f514_4 -wget http://$1:9000/trans_add_f515_1_200 -wget http://$1:9000/trans_buy_f515_0 -wget http://$1:9000/trans_add_f516_2_50 -wget http://$1:9000/trans_buy_f516_1 -wget http://$1:9000/trans_add_f517_3_100 -wget http://$1:9000/trans_buy_f517_2 -wget http://$1:9000/trans_add_f518_4_150 -wget http://$1:9000/trans_buy_f518_3 -wget http://$1:9000/trans_add_f519_5_200 -wget http://$1:9000/trans_buy_f519_4 -wget http://$1:9000/trans_add_f520_1_50 -wget http://$1:9000/trans_buy_f520_0 -wget http://$1:9000/trans_add_f521_2_100 -wget http://$1:9000/trans_buy_f521_1 -wget http://$1:9000/trans_add_f522_3_150 -wget http://$1:9000/trans_buy_f522_2 -wget http://$1:9000/trans_add_f523_4_200 -wget http://$1:9000/trans_buy_f523_3 -wget http://$1:9000/trans_add_f524_5_50 -wget http://$1:9000/trans_buy_f524_4 -wget http://$1:9000/trans_add_f525_1_100 -wget http://$1:9000/trans_buy_f525_0 -wget http://$1:9000/trans_add_f526_2_150 -wget http://$1:9000/trans_buy_f526_1 -wget http://$1:9000/trans_add_f527_3_200 -wget http://$1:9000/trans_buy_f527_2 -wget http://$1:9000/trans_add_f528_4_50 -wget http://$1:9000/trans_buy_f528_3 -wget http://$1:9000/trans_add_f529_5_100 -wget http://$1:9000/trans_buy_f529_4 -wget http://$1:9000/trans_add_f530_1_150 -wget http://$1:9000/trans_buy_f530_0 -wget http://$1:9000/trans_add_f531_2_200 -wget http://$1:9000/trans_buy_f531_1 -wget http://$1:9000/trans_add_f532_3_50 -wget http://$1:9000/trans_buy_f532_2 -wget http://$1:9000/trans_add_f533_4_100 -wget http://$1:9000/trans_buy_f533_3 -wget http://$1:9000/trans_add_f534_5_150 -wget http://$1:9000/trans_buy_f534_4 -wget http://$1:9000/trans_add_f535_1_200 -wget http://$1:9000/trans_buy_f535_0 -wget http://$1:9000/trans_add_f536_2_50 -wget http://$1:9000/trans_buy_f536_1 -wget http://$1:9000/trans_add_f537_3_100 -wget http://$1:9000/trans_buy_f537_2 -wget http://$1:9000/trans_add_f538_4_150 -wget http://$1:9000/trans_buy_f538_3 -wget http://$1:9000/trans_add_f539_5_200 -wget http://$1:9000/trans_buy_f539_4 -wget http://$1:9000/trans_add_f540_1_50 -wget http://$1:9000/trans_buy_f540_0 -wget http://$1:9000/trans_add_f541_2_100 -wget http://$1:9000/trans_buy_f541_1 -wget http://$1:9000/trans_add_f542_3_150 -wget http://$1:9000/trans_buy_f542_2 -wget http://$1:9000/trans_add_f543_4_200 -wget http://$1:9000/trans_buy_f543_3 -wget http://$1:9000/trans_add_f544_5_50 -wget http://$1:9000/trans_buy_f544_4 -wget http://$1:9000/trans_add_f545_1_100 -wget http://$1:9000/trans_buy_f545_0 -wget http://$1:9000/trans_add_f546_2_150 -wget http://$1:9000/trans_buy_f546_1 -wget http://$1:9000/trans_add_f547_3_200 -wget http://$1:9000/trans_buy_f547_2 -wget http://$1:9000/trans_add_f548_4_50 -wget http://$1:9000/trans_buy_f548_3 -wget http://$1:9000/trans_add_f549_5_100 -wget http://$1:9000/trans_buy_f549_4 -wget http://$1:9000/trans_add_f550_1_150 -wget http://$1:9000/trans_buy_f550_0 -wget http://$1:9000/trans_add_f551_2_200 -wget http://$1:9000/trans_buy_f551_1 -wget http://$1:9000/trans_add_f552_3_50 -wget http://$1:9000/trans_buy_f552_2 -wget http://$1:9000/trans_add_f553_4_100 -wget http://$1:9000/trans_buy_f553_3 -wget http://$1:9000/trans_add_f554_5_150 -wget http://$1:9000/trans_buy_f554_4 -wget http://$1:9000/trans_add_f555_1_200 -wget http://$1:9000/trans_buy_f555_0 -wget http://$1:9000/trans_add_f556_2_50 -wget http://$1:9000/trans_buy_f556_1 -wget http://$1:9000/trans_add_f557_3_100 -wget http://$1:9000/trans_buy_f557_2 -wget http://$1:9000/trans_add_f558_4_150 -wget http://$1:9000/trans_buy_f558_3 -wget http://$1:9000/trans_add_f559_5_200 -wget http://$1:9000/trans_buy_f559_4 -wget http://$1:9000/trans_add_f560_1_50 -wget http://$1:9000/trans_buy_f560_0 -wget http://$1:9000/trans_add_f561_2_100 -wget http://$1:9000/trans_buy_f561_1 -wget http://$1:9000/trans_add_f562_3_150 -wget http://$1:9000/trans_buy_f562_2 -wget http://$1:9000/trans_add_f563_4_200 -wget http://$1:9000/trans_buy_f563_3 -wget http://$1:9000/trans_add_f564_5_50 -wget http://$1:9000/trans_buy_f564_4 -wget http://$1:9000/trans_add_f565_1_100 -wget http://$1:9000/trans_buy_f565_0 -wget http://$1:9000/trans_add_f566_2_150 -wget http://$1:9000/trans_buy_f566_1 -wget http://$1:9000/trans_add_f567_3_200 -wget http://$1:9000/trans_buy_f567_2 -wget http://$1:9000/trans_add_f568_4_50 -wget http://$1:9000/trans_buy_f568_3 -wget http://$1:9000/trans_add_f569_5_100 -wget http://$1:9000/trans_buy_f569_4 -wget http://$1:9000/trans_add_f570_1_150 -wget http://$1:9000/trans_buy_f570_0 -wget http://$1:9000/trans_add_f571_2_200 -wget http://$1:9000/trans_buy_f571_1 -wget http://$1:9000/trans_add_f572_3_50 -wget http://$1:9000/trans_buy_f572_2 -wget http://$1:9000/trans_add_f573_4_100 -wget http://$1:9000/trans_buy_f573_3 -wget http://$1:9000/trans_add_f574_5_150 -wget http://$1:9000/trans_buy_f574_4 -wget http://$1:9000/trans_add_f575_1_200 -wget http://$1:9000/trans_buy_f575_0 -wget http://$1:9000/trans_add_f576_2_50 -wget http://$1:9000/trans_buy_f576_1 -wget http://$1:9000/trans_add_f577_3_100 -wget http://$1:9000/trans_buy_f577_2 -wget http://$1:9000/trans_add_f578_4_150 -wget http://$1:9000/trans_buy_f578_3 -wget http://$1:9000/trans_add_f579_5_200 -wget http://$1:9000/trans_buy_f579_4 -wget http://$1:9000/trans_add_f580_1_50 -wget http://$1:9000/trans_buy_f580_0 -wget http://$1:9000/trans_add_f581_2_100 -wget http://$1:9000/trans_buy_f581_1 -wget http://$1:9000/trans_add_f582_3_150 -wget http://$1:9000/trans_buy_f582_2 -wget http://$1:9000/trans_add_f583_4_200 -wget http://$1:9000/trans_buy_f583_3 -wget http://$1:9000/trans_add_f584_5_50 -wget http://$1:9000/trans_buy_f584_4 -wget http://$1:9000/trans_add_f585_1_100 -wget http://$1:9000/trans_buy_f585_0 -wget http://$1:9000/trans_add_f586_2_150 -wget http://$1:9000/trans_buy_f586_1 -wget http://$1:9000/trans_add_f587_3_200 -wget http://$1:9000/trans_buy_f587_2 -wget http://$1:9000/trans_add_f588_4_50 -wget http://$1:9000/trans_buy_f588_3 -wget http://$1:9000/trans_add_f589_5_100 -wget http://$1:9000/trans_buy_f589_4 -wget http://$1:9000/trans_add_f590_1_150 -wget http://$1:9000/trans_buy_f590_0 -wget http://$1:9000/trans_add_f591_2_200 -wget http://$1:9000/trans_buy_f591_1 -wget http://$1:9000/trans_add_f592_3_50 -wget http://$1:9000/trans_buy_f592_2 -wget http://$1:9000/trans_add_f593_4_100 -wget http://$1:9000/trans_buy_f593_3 -wget http://$1:9000/trans_add_f594_5_150 -wget http://$1:9000/trans_buy_f594_4 -wget http://$1:9000/trans_add_f595_1_200 -wget http://$1:9000/trans_buy_f595_0 -wget http://$1:9000/trans_add_f596_2_50 -wget http://$1:9000/trans_buy_f596_1 -wget http://$1:9000/trans_add_f597_3_100 -wget http://$1:9000/trans_buy_f597_2 -wget http://$1:9000/trans_add_f598_4_150 -wget http://$1:9000/trans_buy_f598_3 -wget http://$1:9000/trans_add_f599_5_200 -wget http://$1:9000/trans_buy_f599_4 -wget http://$1:9000/trans_add_f600_1_50 -wget http://$1:9000/trans_buy_f600_0 -wget http://$1:9000/trans_add_f601_2_100 -wget http://$1:9000/trans_buy_f601_1 -wget http://$1:9000/trans_add_f602_3_150 -wget http://$1:9000/trans_buy_f602_2 -wget http://$1:9000/trans_add_f603_4_200 -wget http://$1:9000/trans_buy_f603_3 -wget http://$1:9000/trans_add_f604_5_50 -wget http://$1:9000/trans_buy_f604_4 -wget http://$1:9000/trans_add_f605_1_100 -wget http://$1:9000/trans_buy_f605_0 -wget http://$1:9000/trans_add_f606_2_150 -wget http://$1:9000/trans_buy_f606_1 -wget http://$1:9000/trans_add_f607_3_200 -wget http://$1:9000/trans_buy_f607_2 -wget http://$1:9000/trans_add_f608_4_50 -wget http://$1:9000/trans_buy_f608_3 -wget http://$1:9000/trans_add_f609_5_100 -wget http://$1:9000/trans_buy_f609_4 -wget http://$1:9000/trans_add_f610_1_150 -wget http://$1:9000/trans_buy_f610_0 -wget http://$1:9000/trans_add_f611_2_200 -wget http://$1:9000/trans_buy_f611_1 -wget http://$1:9000/trans_add_f612_3_50 -wget http://$1:9000/trans_buy_f612_2 -wget http://$1:9000/trans_add_f613_4_100 -wget http://$1:9000/trans_buy_f613_3 -wget http://$1:9000/trans_add_f614_5_150 -wget http://$1:9000/trans_buy_f614_4 -wget http://$1:9000/trans_add_f615_1_200 -wget http://$1:9000/trans_buy_f615_0 -wget http://$1:9000/trans_add_f616_2_50 -wget http://$1:9000/trans_buy_f616_1 -wget http://$1:9000/trans_add_f617_3_100 -wget http://$1:9000/trans_buy_f617_2 -wget http://$1:9000/trans_add_f618_4_150 -wget http://$1:9000/trans_buy_f618_3 -wget http://$1:9000/trans_add_f619_5_200 -wget http://$1:9000/trans_buy_f619_4 -wget http://$1:9000/trans_add_f620_1_50 -wget http://$1:9000/trans_buy_f620_0 -wget http://$1:9000/trans_add_f621_2_100 -wget http://$1:9000/trans_buy_f621_1 -wget http://$1:9000/trans_add_f622_3_150 -wget http://$1:9000/trans_buy_f622_2 -wget http://$1:9000/trans_add_f623_4_200 -wget http://$1:9000/trans_buy_f623_3 -wget http://$1:9000/trans_add_f624_5_50 -wget http://$1:9000/trans_buy_f624_4 -wget http://$1:9000/trans_add_f625_1_100 -wget http://$1:9000/trans_buy_f625_0 -wget http://$1:9000/trans_add_f626_2_150 -wget http://$1:9000/trans_buy_f626_1 -wget http://$1:9000/trans_add_f627_3_200 -wget http://$1:9000/trans_buy_f627_2 -wget http://$1:9000/trans_add_f628_4_50 -wget http://$1:9000/trans_buy_f628_3 -wget http://$1:9000/trans_add_f629_5_100 -wget http://$1:9000/trans_buy_f629_4 -wget http://$1:9000/trans_add_f630_1_150 -wget http://$1:9000/trans_buy_f630_0 -wget http://$1:9000/trans_add_f631_2_200 -wget http://$1:9000/trans_buy_f631_1 -wget http://$1:9000/trans_add_f632_3_50 -wget http://$1:9000/trans_buy_f632_2 -wget http://$1:9000/trans_add_f633_4_100 -wget http://$1:9000/trans_buy_f633_3 -wget http://$1:9000/trans_add_f634_5_150 -wget http://$1:9000/trans_buy_f634_4 -wget http://$1:9000/trans_add_f635_1_200 -wget http://$1:9000/trans_buy_f635_0 -wget http://$1:9000/trans_add_f636_2_50 -wget http://$1:9000/trans_buy_f636_1 -wget http://$1:9000/trans_add_f637_3_100 -wget http://$1:9000/trans_buy_f637_2 -wget http://$1:9000/trans_add_f638_4_150 -wget http://$1:9000/trans_buy_f638_3 -wget http://$1:9000/trans_add_f639_5_200 -wget http://$1:9000/trans_buy_f639_4 -wget http://$1:9000/trans_add_f640_1_50 -wget http://$1:9000/trans_buy_f640_0 -wget http://$1:9000/trans_add_f641_2_100 -wget http://$1:9000/trans_buy_f641_1 -wget http://$1:9000/trans_add_f642_3_150 -wget http://$1:9000/trans_buy_f642_2 -wget http://$1:9000/trans_add_f643_4_200 -wget http://$1:9000/trans_buy_f643_3 -wget http://$1:9000/trans_add_f644_5_50 -wget http://$1:9000/trans_buy_f644_4 -wget http://$1:9000/trans_add_f645_1_100 -wget http://$1:9000/trans_buy_f645_0 -wget http://$1:9000/trans_add_f646_2_150 -wget http://$1:9000/trans_buy_f646_1 -wget http://$1:9000/trans_add_f647_3_200 -wget http://$1:9000/trans_buy_f647_2 -wget http://$1:9000/trans_add_f648_4_50 -wget http://$1:9000/trans_buy_f648_3 -wget http://$1:9000/trans_add_f649_5_100 -wget http://$1:9000/trans_buy_f649_4 -wget http://$1:9000/trans_add_f650_1_150 -wget http://$1:9000/trans_buy_f650_0 -wget http://$1:9000/trans_add_f651_2_200 -wget http://$1:9000/trans_buy_f651_1 -wget http://$1:9000/trans_add_f652_3_50 -wget http://$1:9000/trans_buy_f652_2 -wget http://$1:9000/trans_add_f653_4_100 -wget http://$1:9000/trans_buy_f653_3 -wget http://$1:9000/trans_add_f654_5_150 -wget http://$1:9000/trans_buy_f654_4 -wget http://$1:9000/trans_add_f655_1_200 -wget http://$1:9000/trans_buy_f655_0 -wget http://$1:9000/trans_add_f656_2_50 -wget http://$1:9000/trans_buy_f656_1 -wget http://$1:9000/trans_add_f657_3_100 -wget http://$1:9000/trans_buy_f657_2 -wget http://$1:9000/trans_add_f658_4_150 -wget http://$1:9000/trans_buy_f658_3 -wget http://$1:9000/trans_add_f659_5_200 -wget http://$1:9000/trans_buy_f659_4 -wget http://$1:9000/trans_add_f660_1_50 -wget http://$1:9000/trans_buy_f660_0 -wget http://$1:9000/trans_add_f661_2_100 -wget http://$1:9000/trans_buy_f661_1 -wget http://$1:9000/trans_add_f662_3_150 -wget http://$1:9000/trans_buy_f662_2 -wget http://$1:9000/trans_add_f663_4_200 -wget http://$1:9000/trans_buy_f663_3 -wget http://$1:9000/trans_add_f664_5_50 -wget http://$1:9000/trans_buy_f664_4 -wget http://$1:9000/trans_add_f665_1_100 -wget http://$1:9000/trans_buy_f665_0 -wget http://$1:9000/trans_add_f666_2_150 -wget http://$1:9000/trans_buy_f666_1 -wget http://$1:9000/trans_add_f667_3_200 -wget http://$1:9000/trans_buy_f667_2 -wget http://$1:9000/trans_add_f668_4_50 -wget http://$1:9000/trans_buy_f668_3 -wget http://$1:9000/trans_add_f669_5_100 -wget http://$1:9000/trans_buy_f669_4 -wget http://$1:9000/trans_add_f670_1_150 -wget http://$1:9000/trans_buy_f670_0 -wget http://$1:9000/trans_add_f671_2_200 -wget http://$1:9000/trans_buy_f671_1 -wget http://$1:9000/trans_add_f672_3_50 -wget http://$1:9000/trans_buy_f672_2 -wget http://$1:9000/trans_add_f673_4_100 -wget http://$1:9000/trans_buy_f673_3 -wget http://$1:9000/trans_add_f674_5_150 -wget http://$1:9000/trans_buy_f674_4 -wget http://$1:9000/trans_add_f675_1_200 -wget http://$1:9000/trans_buy_f675_0 -wget http://$1:9000/trans_add_f676_2_50 -wget http://$1:9000/trans_buy_f676_1 -wget http://$1:9000/trans_add_f677_3_100 -wget http://$1:9000/trans_buy_f677_2 -wget http://$1:9000/trans_add_f678_4_150 -wget http://$1:9000/trans_buy_f678_3 -wget http://$1:9000/trans_add_f679_5_200 -wget http://$1:9000/trans_buy_f679_4 -wget http://$1:9000/trans_add_f680_1_50 -wget http://$1:9000/trans_buy_f680_0 -wget http://$1:9000/trans_add_f681_2_100 -wget http://$1:9000/trans_buy_f681_1 -wget http://$1:9000/trans_add_f682_3_150 -wget http://$1:9000/trans_buy_f682_2 -wget http://$1:9000/trans_add_f683_4_200 -wget http://$1:9000/trans_buy_f683_3 -wget http://$1:9000/trans_add_f684_5_50 -wget http://$1:9000/trans_buy_f684_4 -wget http://$1:9000/trans_add_f685_1_100 -wget http://$1:9000/trans_buy_f685_0 -wget http://$1:9000/trans_add_f686_2_150 -wget http://$1:9000/trans_buy_f686_1 -wget http://$1:9000/trans_add_f687_3_200 -wget http://$1:9000/trans_buy_f687_2 -wget http://$1:9000/trans_add_f688_4_50 -wget http://$1:9000/trans_buy_f688_3 -wget http://$1:9000/trans_add_f689_5_100 -wget http://$1:9000/trans_buy_f689_4 -wget http://$1:9000/trans_add_f690_1_150 -wget http://$1:9000/trans_buy_f690_0 -wget http://$1:9000/trans_add_f691_2_200 -wget http://$1:9000/trans_buy_f691_1 -wget http://$1:9000/trans_add_f692_3_50 -wget http://$1:9000/trans_buy_f692_2 -wget http://$1:9000/trans_add_f693_4_100 -wget http://$1:9000/trans_buy_f693_3 -wget http://$1:9000/trans_add_f694_5_150 -wget http://$1:9000/trans_buy_f694_4 -wget http://$1:9000/trans_add_f695_1_200 -wget http://$1:9000/trans_buy_f695_0 -wget http://$1:9000/trans_add_f696_2_50 -wget http://$1:9000/trans_buy_f696_1 -wget http://$1:9000/trans_add_f697_3_100 -wget http://$1:9000/trans_buy_f697_2 -wget http://$1:9000/trans_add_f698_4_150 -wget http://$1:9000/trans_buy_f698_3 -wget http://$1:9000/trans_add_f699_5_200 -wget http://$1:9000/trans_buy_f699_4 -wget http://$1:9000/trans_add_f700_1_50 -wget http://$1:9000/trans_buy_f700_0 -wget http://$1:9000/trans_add_f701_2_100 -wget http://$1:9000/trans_buy_f701_1 -wget http://$1:9000/trans_add_f702_3_150 -wget http://$1:9000/trans_buy_f702_2 -wget http://$1:9000/trans_add_f703_4_200 -wget http://$1:9000/trans_buy_f703_3 -wget http://$1:9000/trans_add_f704_5_50 -wget http://$1:9000/trans_buy_f704_4 -wget http://$1:9000/trans_add_f705_1_100 -wget http://$1:9000/trans_buy_f705_0 -wget http://$1:9000/trans_add_f706_2_150 -wget http://$1:9000/trans_buy_f706_1 -wget http://$1:9000/trans_add_f707_3_200 -wget http://$1:9000/trans_buy_f707_2 -wget http://$1:9000/trans_add_f708_4_50 -wget http://$1:9000/trans_buy_f708_3 -wget http://$1:9000/trans_add_f709_5_100 -wget http://$1:9000/trans_buy_f709_4 -wget http://$1:9000/trans_add_f710_1_150 -wget http://$1:9000/trans_buy_f710_0 -wget http://$1:9000/trans_add_f711_2_200 -wget http://$1:9000/trans_buy_f711_1 -wget http://$1:9000/trans_add_f712_3_50 -wget http://$1:9000/trans_buy_f712_2 -wget http://$1:9000/trans_add_f713_4_100 -wget http://$1:9000/trans_buy_f713_3 -wget http://$1:9000/trans_add_f714_5_150 -wget http://$1:9000/trans_buy_f714_4 -wget http://$1:9000/trans_add_f715_1_200 -wget http://$1:9000/trans_buy_f715_0 -wget http://$1:9000/trans_add_f716_2_50 -wget http://$1:9000/trans_buy_f716_1 -wget http://$1:9000/trans_add_f717_3_100 -wget http://$1:9000/trans_buy_f717_2 -wget http://$1:9000/trans_add_f718_4_150 -wget http://$1:9000/trans_buy_f718_3 -wget http://$1:9000/trans_add_f719_5_200 -wget http://$1:9000/trans_buy_f719_4 -wget http://$1:9000/trans_add_f720_1_50 -wget http://$1:9000/trans_buy_f720_0 -wget http://$1:9000/trans_add_f721_2_100 -wget http://$1:9000/trans_buy_f721_1 -wget http://$1:9000/trans_add_f722_3_150 -wget http://$1:9000/trans_buy_f722_2 -wget http://$1:9000/trans_add_f723_4_200 -wget http://$1:9000/trans_buy_f723_3 -wget http://$1:9000/trans_add_f724_5_50 -wget http://$1:9000/trans_buy_f724_4 -wget http://$1:9000/trans_add_f725_1_100 -wget http://$1:9000/trans_buy_f725_0 -wget http://$1:9000/trans_add_f726_2_150 -wget http://$1:9000/trans_buy_f726_1 -wget http://$1:9000/trans_add_f727_3_200 -wget http://$1:9000/trans_buy_f727_2 -wget http://$1:9000/trans_add_f728_4_50 -wget http://$1:9000/trans_buy_f728_3 -wget http://$1:9000/trans_add_f729_5_100 -wget http://$1:9000/trans_buy_f729_4 -wget http://$1:9000/trans_add_f730_1_150 -wget http://$1:9000/trans_buy_f730_0 -wget http://$1:9000/trans_add_f731_2_200 -wget http://$1:9000/trans_buy_f731_1 -wget http://$1:9000/trans_add_f732_3_50 -wget http://$1:9000/trans_buy_f732_2 -wget http://$1:9000/trans_add_f733_4_100 -wget http://$1:9000/trans_buy_f733_3 -wget http://$1:9000/trans_add_f734_5_150 -wget http://$1:9000/trans_buy_f734_4 -wget http://$1:9000/trans_add_f735_1_200 -wget http://$1:9000/trans_buy_f735_0 -wget http://$1:9000/trans_add_f736_2_50 -wget http://$1:9000/trans_buy_f736_1 -wget http://$1:9000/trans_add_f737_3_100 -wget http://$1:9000/trans_buy_f737_2 -wget http://$1:9000/trans_add_f738_4_150 -wget http://$1:9000/trans_buy_f738_3 -wget http://$1:9000/trans_add_f739_5_200 -wget http://$1:9000/trans_buy_f739_4 -wget http://$1:9000/trans_add_f740_1_50 -wget http://$1:9000/trans_buy_f740_0 -wget http://$1:9000/trans_add_f741_2_100 -wget http://$1:9000/trans_buy_f741_1 -wget http://$1:9000/trans_add_f742_3_150 -wget http://$1:9000/trans_buy_f742_2 -wget http://$1:9000/trans_add_f743_4_200 -wget http://$1:9000/trans_buy_f743_3 -wget http://$1:9000/trans_add_f744_5_50 -wget http://$1:9000/trans_buy_f744_4 -wget http://$1:9000/trans_add_f745_1_100 -wget http://$1:9000/trans_buy_f745_0 -wget http://$1:9000/trans_add_f746_2_150 -wget http://$1:9000/trans_buy_f746_1 -wget http://$1:9000/trans_add_f747_3_200 -wget http://$1:9000/trans_buy_f747_2 -wget http://$1:9000/trans_add_f748_4_50 -wget http://$1:9000/trans_buy_f748_3 -wget http://$1:9000/trans_add_f749_5_100 -wget http://$1:9000/trans_buy_f749_4 -wget http://$1:9000/trans_add_f750_1_150 -wget http://$1:9000/trans_buy_f750_0 -wget http://$1:9000/trans_add_f751_2_200 -wget http://$1:9000/trans_buy_f751_1 -wget http://$1:9000/trans_add_f752_3_50 -wget http://$1:9000/trans_buy_f752_2 -wget http://$1:9000/trans_add_f753_4_100 -wget http://$1:9000/trans_buy_f753_3 -wget http://$1:9000/trans_add_f754_5_150 -wget http://$1:9000/trans_buy_f754_4 -wget http://$1:9000/trans_add_f755_1_200 -wget http://$1:9000/trans_buy_f755_0 -wget http://$1:9000/trans_add_f756_2_50 -wget http://$1:9000/trans_buy_f756_1 -wget http://$1:9000/trans_add_f757_3_100 -wget http://$1:9000/trans_buy_f757_2 -wget http://$1:9000/trans_add_f758_4_150 -wget http://$1:9000/trans_buy_f758_3 -wget http://$1:9000/trans_add_f759_5_200 -wget http://$1:9000/trans_buy_f759_4 -wget http://$1:9000/trans_add_f760_1_50 -wget http://$1:9000/trans_buy_f760_0 -wget http://$1:9000/trans_add_f761_2_100 -wget http://$1:9000/trans_buy_f761_1 -wget http://$1:9000/trans_add_f762_3_150 -wget http://$1:9000/trans_buy_f762_2 -wget http://$1:9000/trans_add_f763_4_200 -wget http://$1:9000/trans_buy_f763_3 -wget http://$1:9000/trans_add_f764_5_50 -wget http://$1:9000/trans_buy_f764_4 -wget http://$1:9000/trans_add_f765_1_100 -wget http://$1:9000/trans_buy_f765_0 -wget http://$1:9000/trans_add_f766_2_150 -wget http://$1:9000/trans_buy_f766_1 -wget http://$1:9000/trans_add_f767_3_200 -wget http://$1:9000/trans_buy_f767_2 -wget http://$1:9000/trans_add_f768_4_50 -wget http://$1:9000/trans_buy_f768_3 -wget http://$1:9000/trans_add_f769_5_100 -wget http://$1:9000/trans_buy_f769_4 -wget http://$1:9000/trans_add_f770_1_150 -wget http://$1:9000/trans_buy_f770_0 -wget http://$1:9000/trans_add_f771_2_200 -wget http://$1:9000/trans_buy_f771_1 -wget http://$1:9000/trans_add_f772_3_50 -wget http://$1:9000/trans_buy_f772_2 -wget http://$1:9000/trans_add_f773_4_100 -wget http://$1:9000/trans_buy_f773_3 -wget http://$1:9000/trans_add_f774_5_150 -wget http://$1:9000/trans_buy_f774_4 -wget http://$1:9000/trans_add_f775_1_200 -wget http://$1:9000/trans_buy_f775_0 -wget http://$1:9000/trans_add_f776_2_50 -wget http://$1:9000/trans_buy_f776_1 -wget http://$1:9000/trans_add_f777_3_100 -wget http://$1:9000/trans_buy_f777_2 -wget http://$1:9000/trans_add_f778_4_150 -wget http://$1:9000/trans_buy_f778_3 -wget http://$1:9000/trans_add_f779_5_200 -wget http://$1:9000/trans_buy_f779_4 -wget http://$1:9000/trans_add_f780_1_50 -wget http://$1:9000/trans_buy_f780_0 -wget http://$1:9000/trans_add_f781_2_100 -wget http://$1:9000/trans_buy_f781_1 -wget http://$1:9000/trans_add_f782_3_150 -wget http://$1:9000/trans_buy_f782_2 -wget http://$1:9000/trans_add_f783_4_200 -wget http://$1:9000/trans_buy_f783_3 -wget http://$1:9000/trans_add_f784_5_50 -wget http://$1:9000/trans_buy_f784_4 -wget http://$1:9000/trans_add_f785_1_100 -wget http://$1:9000/trans_buy_f785_0 -wget http://$1:9000/trans_add_f786_2_150 -wget http://$1:9000/trans_buy_f786_1 -wget http://$1:9000/trans_add_f787_3_200 -wget http://$1:9000/trans_buy_f787_2 -wget http://$1:9000/trans_add_f788_4_50 -wget http://$1:9000/trans_buy_f788_3 -wget http://$1:9000/trans_add_f789_5_100 -wget http://$1:9000/trans_buy_f789_4 -wget http://$1:9000/trans_add_f790_1_150 -wget http://$1:9000/trans_buy_f790_0 -wget http://$1:9000/trans_add_f791_2_200 -wget http://$1:9000/trans_buy_f791_1 -wget http://$1:9000/trans_add_f792_3_50 -wget http://$1:9000/trans_buy_f792_2 -wget http://$1:9000/trans_add_f793_4_100 -wget http://$1:9000/trans_buy_f793_3 -wget http://$1:9000/trans_add_f794_5_150 -wget http://$1:9000/trans_buy_f794_4 -wget http://$1:9000/trans_add_f795_1_200 -wget http://$1:9000/trans_buy_f795_0 -wget http://$1:9000/trans_add_f796_2_50 -wget http://$1:9000/trans_buy_f796_1 -wget http://$1:9000/trans_add_f797_3_100 -wget http://$1:9000/trans_buy_f797_2 -wget http://$1:9000/trans_add_f798_4_150 -wget http://$1:9000/trans_buy_f798_3 -wget http://$1:9000/trans_add_f799_5_200 -wget http://$1:9000/trans_buy_f799_4 -wget http://$1:9000/trans_add_f800_1_50 -wget http://$1:9000/trans_buy_f800_0 -wget http://$1:9000/trans_add_f801_2_100 -wget http://$1:9000/trans_buy_f801_1 -wget http://$1:9000/trans_add_f802_3_150 -wget http://$1:9000/trans_buy_f802_2 -wget http://$1:9000/trans_add_f803_4_200 -wget http://$1:9000/trans_buy_f803_3 -wget http://$1:9000/trans_add_f804_5_50 -wget http://$1:9000/trans_buy_f804_4 -wget http://$1:9000/trans_add_f805_1_100 -wget http://$1:9000/trans_buy_f805_0 -wget http://$1:9000/trans_add_f806_2_150 -wget http://$1:9000/trans_buy_f806_1 -wget http://$1:9000/trans_add_f807_3_200 -wget http://$1:9000/trans_buy_f807_2 -wget http://$1:9000/trans_add_f808_4_50 -wget http://$1:9000/trans_buy_f808_3 -wget http://$1:9000/trans_add_f809_5_100 -wget http://$1:9000/trans_buy_f809_4 -wget http://$1:9000/trans_add_f810_1_150 -wget http://$1:9000/trans_buy_f810_0 -wget http://$1:9000/trans_add_f811_2_200 -wget http://$1:9000/trans_buy_f811_1 -wget http://$1:9000/trans_add_f812_3_50 -wget http://$1:9000/trans_buy_f812_2 -wget http://$1:9000/trans_add_f813_4_100 -wget http://$1:9000/trans_buy_f813_3 -wget http://$1:9000/trans_add_f814_5_150 -wget http://$1:9000/trans_buy_f814_4 -wget http://$1:9000/trans_add_f815_1_200 -wget http://$1:9000/trans_buy_f815_0 -wget http://$1:9000/trans_add_f816_2_50 -wget http://$1:9000/trans_buy_f816_1 -wget http://$1:9000/trans_add_f817_3_100 -wget http://$1:9000/trans_buy_f817_2 -wget http://$1:9000/trans_add_f818_4_150 -wget http://$1:9000/trans_buy_f818_3 -wget http://$1:9000/trans_add_f819_5_200 -wget http://$1:9000/trans_buy_f819_4 -wget http://$1:9000/trans_add_f820_1_50 -wget http://$1:9000/trans_buy_f820_0 -wget http://$1:9000/trans_add_f821_2_100 -wget http://$1:9000/trans_buy_f821_1 -wget http://$1:9000/trans_add_f822_3_150 -wget http://$1:9000/trans_buy_f822_2 -wget http://$1:9000/trans_add_f823_4_200 -wget http://$1:9000/trans_buy_f823_3 -wget http://$1:9000/trans_add_f824_5_50 -wget http://$1:9000/trans_buy_f824_4 -wget http://$1:9000/trans_add_f825_1_100 -wget http://$1:9000/trans_buy_f825_0 -wget http://$1:9000/trans_add_f826_2_150 -wget http://$1:9000/trans_buy_f826_1 -wget http://$1:9000/trans_add_f827_3_200 -wget http://$1:9000/trans_buy_f827_2 -wget http://$1:9000/trans_add_f828_4_50 -wget http://$1:9000/trans_buy_f828_3 -wget http://$1:9000/trans_add_f829_5_100 -wget http://$1:9000/trans_buy_f829_4 -wget http://$1:9000/trans_add_f830_1_150 -wget http://$1:9000/trans_buy_f830_0 -wget http://$1:9000/trans_add_f831_2_200 -wget http://$1:9000/trans_buy_f831_1 -wget http://$1:9000/trans_add_f832_3_50 -wget http://$1:9000/trans_buy_f832_2 -wget http://$1:9000/trans_add_f833_4_100 -wget http://$1:9000/trans_buy_f833_3 -wget http://$1:9000/trans_add_f834_5_150 -wget http://$1:9000/trans_buy_f834_4 -wget http://$1:9000/trans_add_f835_1_200 -wget http://$1:9000/trans_buy_f835_0 -wget http://$1:9000/trans_add_f836_2_50 -wget http://$1:9000/trans_buy_f836_1 -wget http://$1:9000/trans_add_f837_3_100 -wget http://$1:9000/trans_buy_f837_2 -wget http://$1:9000/trans_add_f838_4_150 -wget http://$1:9000/trans_buy_f838_3 -wget http://$1:9000/trans_add_f839_5_200 -wget http://$1:9000/trans_buy_f839_4 -wget http://$1:9000/trans_add_f840_1_50 -wget http://$1:9000/trans_buy_f840_0 -wget http://$1:9000/trans_add_f841_2_100 -wget http://$1:9000/trans_buy_f841_1 -wget http://$1:9000/trans_add_f842_3_150 -wget http://$1:9000/trans_buy_f842_2 -wget http://$1:9000/trans_add_f843_4_200 -wget http://$1:9000/trans_buy_f843_3 -wget http://$1:9000/trans_add_f844_5_50 -wget http://$1:9000/trans_buy_f844_4 -wget http://$1:9000/trans_add_f845_1_100 -wget http://$1:9000/trans_buy_f845_0 -wget http://$1:9000/trans_add_f846_2_150 -wget http://$1:9000/trans_buy_f846_1 -wget http://$1:9000/trans_add_f847_3_200 -wget http://$1:9000/trans_buy_f847_2 -wget http://$1:9000/trans_add_f848_4_50 -wget http://$1:9000/trans_buy_f848_3 -wget http://$1:9000/trans_add_f849_5_100 -wget http://$1:9000/trans_buy_f849_4 -wget http://$1:9000/trans_add_f850_1_150 -wget http://$1:9000/trans_buy_f850_0 -wget http://$1:9000/trans_add_f851_2_200 -wget http://$1:9000/trans_buy_f851_1 -wget http://$1:9000/trans_add_f852_3_50 -wget http://$1:9000/trans_buy_f852_2 -wget http://$1:9000/trans_add_f853_4_100 -wget http://$1:9000/trans_buy_f853_3 -wget http://$1:9000/trans_add_f854_5_150 -wget http://$1:9000/trans_buy_f854_4 -wget http://$1:9000/trans_add_f855_1_200 -wget http://$1:9000/trans_buy_f855_0 -wget http://$1:9000/trans_add_f856_2_50 -wget http://$1:9000/trans_buy_f856_1 -wget http://$1:9000/trans_add_f857_3_100 -wget http://$1:9000/trans_buy_f857_2 -wget http://$1:9000/trans_add_f858_4_150 -wget http://$1:9000/trans_buy_f858_3 -wget http://$1:9000/trans_add_f859_5_200 -wget http://$1:9000/trans_buy_f859_4 -wget http://$1:9000/trans_add_f860_1_50 -wget http://$1:9000/trans_buy_f860_0 -wget http://$1:9000/trans_add_f861_2_100 -wget http://$1:9000/trans_buy_f861_1 -wget http://$1:9000/trans_add_f862_3_150 -wget http://$1:9000/trans_buy_f862_2 -wget http://$1:9000/trans_add_f863_4_200 -wget http://$1:9000/trans_buy_f863_3 -wget http://$1:9000/trans_add_f864_5_50 -wget http://$1:9000/trans_buy_f864_4 -wget http://$1:9000/trans_add_f865_1_100 -wget http://$1:9000/trans_buy_f865_0 -wget http://$1:9000/trans_add_f866_2_150 -wget http://$1:9000/trans_buy_f866_1 -wget http://$1:9000/trans_add_f867_3_200 -wget http://$1:9000/trans_buy_f867_2 -wget http://$1:9000/trans_add_f868_4_50 -wget http://$1:9000/trans_buy_f868_3 -wget http://$1:9000/trans_add_f869_5_100 -wget http://$1:9000/trans_buy_f869_4 -wget http://$1:9000/trans_add_f870_1_150 -wget http://$1:9000/trans_buy_f870_0 -wget http://$1:9000/trans_add_f871_2_200 -wget http://$1:9000/trans_buy_f871_1 -wget http://$1:9000/trans_add_f872_3_50 -wget http://$1:9000/trans_buy_f872_2 -wget http://$1:9000/trans_add_f873_4_100 -wget http://$1:9000/trans_buy_f873_3 -wget http://$1:9000/trans_add_f874_5_150 -wget http://$1:9000/trans_buy_f874_4 -wget http://$1:9000/trans_add_f875_1_200 -wget http://$1:9000/trans_buy_f875_0 -wget http://$1:9000/trans_add_f876_2_50 -wget http://$1:9000/trans_buy_f876_1 -wget http://$1:9000/trans_add_f877_3_100 -wget http://$1:9000/trans_buy_f877_2 -wget http://$1:9000/trans_add_f878_4_150 -wget http://$1:9000/trans_buy_f878_3 -wget http://$1:9000/trans_add_f879_5_200 -wget http://$1:9000/trans_buy_f879_4 -wget http://$1:9000/trans_add_f880_1_50 -wget http://$1:9000/trans_buy_f880_0 -wget http://$1:9000/trans_add_f881_2_100 -wget http://$1:9000/trans_buy_f881_1 -wget http://$1:9000/trans_add_f882_3_150 -wget http://$1:9000/trans_buy_f882_2 -wget http://$1:9000/trans_add_f883_4_200 -wget http://$1:9000/trans_buy_f883_3 -wget http://$1:9000/trans_add_f884_5_50 -wget http://$1:9000/trans_buy_f884_4 -wget http://$1:9000/trans_add_f885_1_100 -wget http://$1:9000/trans_buy_f885_0 -wget http://$1:9000/trans_add_f886_2_150 -wget http://$1:9000/trans_buy_f886_1 -wget http://$1:9000/trans_add_f887_3_200 -wget http://$1:9000/trans_buy_f887_2 -wget http://$1:9000/trans_add_f888_4_50 -wget http://$1:9000/trans_buy_f888_3 -wget http://$1:9000/trans_add_f889_5_100 -wget http://$1:9000/trans_buy_f889_4 -wget http://$1:9000/trans_add_f890_1_150 -wget http://$1:9000/trans_buy_f890_0 -wget http://$1:9000/trans_add_f891_2_200 -wget http://$1:9000/trans_buy_f891_1 -wget http://$1:9000/trans_add_f892_3_50 -wget http://$1:9000/trans_buy_f892_2 -wget http://$1:9000/trans_add_f893_4_100 -wget http://$1:9000/trans_buy_f893_3 -wget http://$1:9000/trans_add_f894_5_150 -wget http://$1:9000/trans_buy_f894_4 -wget http://$1:9000/trans_add_f895_1_200 -wget http://$1:9000/trans_buy_f895_0 -wget http://$1:9000/trans_add_f896_2_50 -wget http://$1:9000/trans_buy_f896_1 -wget http://$1:9000/trans_add_f897_3_100 -wget http://$1:9000/trans_buy_f897_2 -wget http://$1:9000/trans_add_f898_4_150 -wget http://$1:9000/trans_buy_f898_3 -wget http://$1:9000/trans_add_f899_5_200 -wget http://$1:9000/trans_buy_f899_4 -wget http://$1:9000/trans_add_f900_1_50 -wget http://$1:9000/trans_buy_f900_0 -wget http://$1:9000/trans_add_f901_2_100 -wget http://$1:9000/trans_buy_f901_1 -wget http://$1:9000/trans_add_f902_3_150 -wget http://$1:9000/trans_buy_f902_2 -wget http://$1:9000/trans_add_f903_4_200 -wget http://$1:9000/trans_buy_f903_3 -wget http://$1:9000/trans_add_f904_5_50 -wget http://$1:9000/trans_buy_f904_4 -wget http://$1:9000/trans_add_f905_1_100 -wget http://$1:9000/trans_buy_f905_0 -wget http://$1:9000/trans_add_f906_2_150 -wget http://$1:9000/trans_buy_f906_1 -wget http://$1:9000/trans_add_f907_3_200 -wget http://$1:9000/trans_buy_f907_2 -wget http://$1:9000/trans_add_f908_4_50 -wget http://$1:9000/trans_buy_f908_3 -wget http://$1:9000/trans_add_f909_5_100 -wget http://$1:9000/trans_buy_f909_4 -wget http://$1:9000/trans_add_f910_1_150 -wget http://$1:9000/trans_buy_f910_0 -wget http://$1:9000/trans_add_f911_2_200 -wget http://$1:9000/trans_buy_f911_1 -wget http://$1:9000/trans_add_f912_3_50 -wget http://$1:9000/trans_buy_f912_2 -wget http://$1:9000/trans_add_f913_4_100 -wget http://$1:9000/trans_buy_f913_3 -wget http://$1:9000/trans_add_f914_5_150 -wget http://$1:9000/trans_buy_f914_4 -wget http://$1:9000/trans_add_f915_1_200 -wget http://$1:9000/trans_buy_f915_0 -wget http://$1:9000/trans_add_f916_2_50 -wget http://$1:9000/trans_buy_f916_1 -wget http://$1:9000/trans_add_f917_3_100 -wget http://$1:9000/trans_buy_f917_2 -wget http://$1:9000/trans_add_f918_4_150 -wget http://$1:9000/trans_buy_f918_3 -wget http://$1:9000/trans_add_f919_5_200 -wget http://$1:9000/trans_buy_f919_4 -wget http://$1:9000/trans_add_f920_1_50 -wget http://$1:9000/trans_buy_f920_0 -wget http://$1:9000/trans_add_f921_2_100 -wget http://$1:9000/trans_buy_f921_1 -wget http://$1:9000/trans_add_f922_3_150 -wget http://$1:9000/trans_buy_f922_2 -wget http://$1:9000/trans_add_f923_4_200 -wget http://$1:9000/trans_buy_f923_3 -wget http://$1:9000/trans_add_f924_5_50 -wget http://$1:9000/trans_buy_f924_4 -wget http://$1:9000/trans_add_f925_1_100 -wget http://$1:9000/trans_buy_f925_0 -wget http://$1:9000/trans_add_f926_2_150 -wget http://$1:9000/trans_buy_f926_1 -wget http://$1:9000/trans_add_f927_3_200 -wget http://$1:9000/trans_buy_f927_2 -wget http://$1:9000/trans_add_f928_4_50 -wget http://$1:9000/trans_buy_f928_3 -wget http://$1:9000/trans_add_f929_5_100 -wget http://$1:9000/trans_buy_f929_4 -wget http://$1:9000/trans_add_f930_1_150 -wget http://$1:9000/trans_buy_f930_0 -wget http://$1:9000/trans_add_f931_2_200 -wget http://$1:9000/trans_buy_f931_1 -wget http://$1:9000/trans_add_f932_3_50 -wget http://$1:9000/trans_buy_f932_2 -wget http://$1:9000/trans_add_f933_4_100 -wget http://$1:9000/trans_buy_f933_3 -wget http://$1:9000/trans_add_f934_5_150 -wget http://$1:9000/trans_buy_f934_4 -wget http://$1:9000/trans_add_f935_1_200 -wget http://$1:9000/trans_buy_f935_0 -wget http://$1:9000/trans_add_f936_2_50 -wget http://$1:9000/trans_buy_f936_1 -wget http://$1:9000/trans_add_f937_3_100 -wget http://$1:9000/trans_buy_f937_2 -wget http://$1:9000/trans_add_f938_4_150 -wget http://$1:9000/trans_buy_f938_3 -wget http://$1:9000/trans_add_f939_5_200 -wget http://$1:9000/trans_buy_f939_4 -wget http://$1:9000/trans_add_f940_1_50 -wget http://$1:9000/trans_buy_f940_0 -wget http://$1:9000/trans_add_f941_2_100 -wget http://$1:9000/trans_buy_f941_1 -wget http://$1:9000/trans_add_f942_3_150 -wget http://$1:9000/trans_buy_f942_2 -wget http://$1:9000/trans_add_f943_4_200 -wget http://$1:9000/trans_buy_f943_3 -wget http://$1:9000/trans_add_f944_5_50 -wget http://$1:9000/trans_buy_f944_4 -wget http://$1:9000/trans_add_f945_1_100 -wget http://$1:9000/trans_buy_f945_0 -wget http://$1:9000/trans_add_f946_2_150 -wget http://$1:9000/trans_buy_f946_1 -wget http://$1:9000/trans_add_f947_3_200 -wget http://$1:9000/trans_buy_f947_2 -wget http://$1:9000/trans_add_f948_4_50 -wget http://$1:9000/trans_buy_f948_3 -wget http://$1:9000/trans_add_f949_5_100 -wget http://$1:9000/trans_buy_f949_4 -wget http://$1:9000/trans_add_f950_1_150 -wget http://$1:9000/trans_buy_f950_0 -wget http://$1:9000/trans_add_f951_2_200 -wget http://$1:9000/trans_buy_f951_1 -wget http://$1:9000/trans_add_f952_3_50 -wget http://$1:9000/trans_buy_f952_2 -wget http://$1:9000/trans_add_f953_4_100 -wget http://$1:9000/trans_buy_f953_3 -wget http://$1:9000/trans_add_f954_5_150 -wget http://$1:9000/trans_buy_f954_4 -wget http://$1:9000/trans_add_f955_1_200 -wget http://$1:9000/trans_buy_f955_0 -wget http://$1:9000/trans_add_f956_2_50 -wget http://$1:9000/trans_buy_f956_1 -wget http://$1:9000/trans_add_f957_3_100 -wget http://$1:9000/trans_buy_f957_2 -wget http://$1:9000/trans_add_f958_4_150 -wget http://$1:9000/trans_buy_f958_3 -wget http://$1:9000/trans_add_f959_5_200 -wget http://$1:9000/trans_buy_f959_4 -wget http://$1:9000/trans_add_f960_1_50 -wget http://$1:9000/trans_buy_f960_0 -wget http://$1:9000/trans_add_f961_2_100 -wget http://$1:9000/trans_buy_f961_1 -wget http://$1:9000/trans_add_f962_3_150 -wget http://$1:9000/trans_buy_f962_2 -wget http://$1:9000/trans_add_f963_4_200 -wget http://$1:9000/trans_buy_f963_3 -wget http://$1:9000/trans_add_f964_5_50 -wget http://$1:9000/trans_buy_f964_4 -wget http://$1:9000/trans_add_f965_1_100 -wget http://$1:9000/trans_buy_f965_0 -wget http://$1:9000/trans_add_f966_2_150 -wget http://$1:9000/trans_buy_f966_1 -wget http://$1:9000/trans_add_f967_3_200 -wget http://$1:9000/trans_buy_f967_2 -wget http://$1:9000/trans_add_f968_4_50 -wget http://$1:9000/trans_buy_f968_3 -wget http://$1:9000/trans_add_f969_5_100 -wget http://$1:9000/trans_buy_f969_4 -wget http://$1:9000/trans_add_f970_1_150 -wget http://$1:9000/trans_buy_f970_0 -wget http://$1:9000/trans_add_f971_2_200 -wget http://$1:9000/trans_buy_f971_1 -wget http://$1:9000/trans_add_f972_3_50 -wget http://$1:9000/trans_buy_f972_2 -wget http://$1:9000/trans_add_f973_4_100 -wget http://$1:9000/trans_buy_f973_3 -wget http://$1:9000/trans_add_f974_5_150 -wget http://$1:9000/trans_buy_f974_4 -wget http://$1:9000/trans_add_f975_1_200 -wget http://$1:9000/trans_buy_f975_0 -wget http://$1:9000/trans_add_f976_2_50 -wget http://$1:9000/trans_buy_f976_1 -wget http://$1:9000/trans_add_f977_3_100 -wget http://$1:9000/trans_buy_f977_2 -wget http://$1:9000/trans_add_f978_4_150 -wget http://$1:9000/trans_buy_f978_3 -wget http://$1:9000/trans_add_f979_5_200 -wget http://$1:9000/trans_buy_f979_4 -wget http://$1:9000/trans_add_f980_1_50 -wget http://$1:9000/trans_buy_f980_0 -wget http://$1:9000/trans_add_f981_2_100 -wget http://$1:9000/trans_buy_f981_1 -wget http://$1:9000/trans_add_f982_3_150 -wget http://$1:9000/trans_buy_f982_2 -wget http://$1:9000/trans_add_f983_4_200 -wget http://$1:9000/trans_buy_f983_3 -wget http://$1:9000/trans_add_f984_5_50 -wget http://$1:9000/trans_buy_f984_4 -wget http://$1:9000/trans_add_f985_1_100 -wget http://$1:9000/trans_buy_f985_0 -wget http://$1:9000/trans_add_f986_2_150 -wget http://$1:9000/trans_buy_f986_1 -wget http://$1:9000/trans_add_f987_3_200 -wget http://$1:9000/trans_buy_f987_2 -wget http://$1:9000/trans_add_f988_4_50 -wget http://$1:9000/trans_buy_f988_3 -wget http://$1:9000/trans_add_f989_5_100 -wget http://$1:9000/trans_buy_f989_4 -wget http://$1:9000/trans_add_f990_1_150 -wget http://$1:9000/trans_buy_f990_0 -wget http://$1:9000/trans_add_f991_2_200 -wget http://$1:9000/trans_buy_f991_1 -wget http://$1:9000/trans_add_f992_3_50 -wget http://$1:9000/trans_buy_f992_2 -wget http://$1:9000/trans_add_f993_4_100 -wget http://$1:9000/trans_buy_f993_3 -wget http://$1:9000/trans_add_f994_5_150 -wget http://$1:9000/trans_buy_f994_4 -wget http://$1:9000/trans_add_f995_1_200 -wget http://$1:9000/trans_buy_f995_0 -wget http://$1:9000/trans_add_f996_2_50 -wget http://$1:9000/trans_buy_f996_1 -wget http://$1:9000/trans_add_f997_3_100 -wget http://$1:9000/trans_buy_f997_2 -wget http://$1:9000/trans_add_f998_4_150 -wget http://$1:9000/trans_buy_f998_3 -wget http://$1:9000/trans_add_f999_5_200 -wget http://$1:9000/trans_buy_f999_4 -wget http://$1:9000/trans_add_f1000_1_50 -wget http://$1:9000/trans_buy_f1000_0 -wget http://$1:9000/trans_add_f1001_2_100 -wget http://$1:9000/trans_buy_f1001_1 -wget http://$1:9000/trans_add_f1002_3_150 -wget http://$1:9000/trans_buy_f1002_2 -wget http://$1:9000/trans_add_f1003_4_200 -wget http://$1:9000/trans_buy_f1003_3 -wget http://$1:9000/trans_add_f1004_5_50 -wget http://$1:9000/trans_buy_f1004_4 -wget http://$1:9000/trans_add_f1005_1_100 -wget http://$1:9000/trans_buy_f1005_0 -wget http://$1:9000/trans_add_f1006_2_150 -wget http://$1:9000/trans_buy_f1006_1 -wget http://$1:9000/trans_add_f1007_3_200 -wget http://$1:9000/trans_buy_f1007_2 -wget http://$1:9000/trans_add_f1008_4_50 -wget http://$1:9000/trans_buy_f1008_3 -wget http://$1:9000/trans_add_f1009_5_100 -wget http://$1:9000/trans_buy_f1009_4 -wget http://$1:9000/trans_add_f1010_1_150 -wget http://$1:9000/trans_buy_f1010_0 -wget http://$1:9000/trans_add_f1011_2_200 -wget http://$1:9000/trans_buy_f1011_1 -wget http://$1:9000/trans_add_f1012_3_50 -wget http://$1:9000/trans_buy_f1012_2 -wget http://$1:9000/trans_add_f1013_4_100 -wget http://$1:9000/trans_buy_f1013_3 -wget http://$1:9000/trans_add_f1014_5_150 -wget http://$1:9000/trans_buy_f1014_4 -wget http://$1:9000/trans_add_f1015_1_200 -wget http://$1:9000/trans_buy_f1015_0 -wget http://$1:9000/trans_add_f1016_2_50 -wget http://$1:9000/trans_buy_f1016_1 -wget http://$1:9000/trans_add_f1017_3_100 -wget http://$1:9000/trans_buy_f1017_2 -wget http://$1:9000/trans_add_f1018_4_150 -wget http://$1:9000/trans_buy_f1018_3 -wget http://$1:9000/trans_add_f1019_5_200 -wget http://$1:9000/trans_buy_f1019_4 -wget http://$1:9000/trans_add_f1020_1_50 -wget http://$1:9000/trans_buy_f1020_0 -wget http://$1:9000/trans_add_f1021_2_100 -wget http://$1:9000/trans_buy_f1021_1 -wget http://$1:9000/trans_add_f1022_3_150 -wget http://$1:9000/trans_buy_f1022_2 -wget http://$1:9000/trans_add_f1023_4_200 -wget http://$1:9000/trans_buy_f1023_3 -wget http://$1:9000/trans_add_f1024_5_50 -wget http://$1:9000/trans_buy_f1024_4 -wget http://$1:9000/trans_add_f1025_1_100 -wget http://$1:9000/trans_buy_f1025_0 -wget http://$1:9000/trans_add_f1026_2_150 -wget http://$1:9000/trans_buy_f1026_1 -wget http://$1:9000/trans_add_f1027_3_200 -wget http://$1:9000/trans_buy_f1027_2 -wget http://$1:9000/trans_add_f1028_4_50 -wget http://$1:9000/trans_buy_f1028_3 -wget http://$1:9000/trans_add_f1029_5_100 -wget http://$1:9000/trans_buy_f1029_4 -wget http://$1:9000/trans_add_f1030_1_150 -wget http://$1:9000/trans_buy_f1030_0 -wget http://$1:9000/trans_add_f1031_2_200 -wget http://$1:9000/trans_buy_f1031_1 -wget http://$1:9000/trans_add_f1032_3_50 -wget http://$1:9000/trans_buy_f1032_2 -wget http://$1:9000/trans_add_f1033_4_100 -wget http://$1:9000/trans_buy_f1033_3 -wget http://$1:9000/trans_add_f1034_5_150 -wget http://$1:9000/trans_buy_f1034_4 -wget http://$1:9000/trans_add_f1035_1_200 -wget http://$1:9000/trans_buy_f1035_0 -wget http://$1:9000/trans_add_f1036_2_50 -wget http://$1:9000/trans_buy_f1036_1 -wget http://$1:9000/trans_add_f1037_3_100 -wget http://$1:9000/trans_buy_f1037_2 -wget http://$1:9000/trans_add_f1038_4_150 -wget http://$1:9000/trans_buy_f1038_3 -wget http://$1:9000/trans_add_f1039_5_200 -wget http://$1:9000/trans_buy_f1039_4 -wget http://$1:9000/trans_add_f1040_1_50 -wget http://$1:9000/trans_buy_f1040_0 -wget http://$1:9000/trans_add_f1041_2_100 -wget http://$1:9000/trans_buy_f1041_1 -wget http://$1:9000/trans_add_f1042_3_150 -wget http://$1:9000/trans_buy_f1042_2 -wget http://$1:9000/trans_add_f1043_4_200 -wget http://$1:9000/trans_buy_f1043_3 -wget http://$1:9000/trans_add_f1044_5_50 -wget http://$1:9000/trans_buy_f1044_4 -wget http://$1:9000/trans_add_f1045_1_100 -wget http://$1:9000/trans_buy_f1045_0 -wget http://$1:9000/trans_add_f1046_2_150 -wget http://$1:9000/trans_buy_f1046_1 -wget http://$1:9000/trans_add_f1047_3_200 -wget http://$1:9000/trans_buy_f1047_2 -wget http://$1:9000/trans_add_f1048_4_50 -wget http://$1:9000/trans_buy_f1048_3 -wget http://$1:9000/trans_add_f1049_5_100 -wget http://$1:9000/trans_buy_f1049_4 -wget http://$1:9000/trans_add_f1050_1_150 -wget http://$1:9000/trans_buy_f1050_0 -wget http://$1:9000/trans_add_f1051_2_200 -wget http://$1:9000/trans_buy_f1051_1 -wget http://$1:9000/trans_add_f1052_3_50 -wget http://$1:9000/trans_buy_f1052_2 -wget http://$1:9000/trans_add_f1053_4_100 -wget http://$1:9000/trans_buy_f1053_3 -wget http://$1:9000/trans_add_f1054_5_150 -wget http://$1:9000/trans_buy_f1054_4 -wget http://$1:9000/trans_add_f1055_1_200 -wget http://$1:9000/trans_buy_f1055_0 -wget http://$1:9000/trans_add_f1056_2_50 -wget http://$1:9000/trans_buy_f1056_1 -wget http://$1:9000/trans_add_f1057_3_100 -wget http://$1:9000/trans_buy_f1057_2 -wget http://$1:9000/trans_add_f1058_4_150 -wget http://$1:9000/trans_buy_f1058_3 -wget http://$1:9000/trans_add_f1059_5_200 -wget http://$1:9000/trans_buy_f1059_4 -wget http://$1:9000/trans_add_f1060_1_50 -wget http://$1:9000/trans_buy_f1060_0 -wget http://$1:9000/trans_add_f1061_2_100 -wget http://$1:9000/trans_buy_f1061_1 -wget http://$1:9000/trans_add_f1062_3_150 -wget http://$1:9000/trans_buy_f1062_2 -wget http://$1:9000/trans_add_f1063_4_200 -wget http://$1:9000/trans_buy_f1063_3 -wget http://$1:9000/trans_add_f1064_5_50 -wget http://$1:9000/trans_buy_f1064_4 -wget http://$1:9000/trans_add_f1065_1_100 -wget http://$1:9000/trans_buy_f1065_0 -wget http://$1:9000/trans_add_f1066_2_150 -wget http://$1:9000/trans_buy_f1066_1 -wget http://$1:9000/trans_add_f1067_3_200 -wget http://$1:9000/trans_buy_f1067_2 -wget http://$1:9000/trans_add_f1068_4_50 -wget http://$1:9000/trans_buy_f1068_3 -wget http://$1:9000/trans_add_f1069_5_100 -wget http://$1:9000/trans_buy_f1069_4 -wget http://$1:9000/trans_add_f1070_1_150 -wget http://$1:9000/trans_buy_f1070_0 -wget http://$1:9000/trans_add_f1071_2_200 -wget http://$1:9000/trans_buy_f1071_1 -wget http://$1:9000/trans_add_f1072_3_50 -wget http://$1:9000/trans_buy_f1072_2 -wget http://$1:9000/trans_add_f1073_4_100 -wget http://$1:9000/trans_buy_f1073_3 -wget http://$1:9000/trans_add_f1074_5_150 -wget http://$1:9000/trans_buy_f1074_4 -wget http://$1:9000/trans_add_f1075_1_200 -wget http://$1:9000/trans_buy_f1075_0 -wget http://$1:9000/trans_add_f1076_2_50 -wget http://$1:9000/trans_buy_f1076_1 -wget http://$1:9000/trans_add_f1077_3_100 -wget http://$1:9000/trans_buy_f1077_2 -wget http://$1:9000/trans_add_f1078_4_150 -wget http://$1:9000/trans_buy_f1078_3 -wget http://$1:9000/trans_add_f1079_5_200 -wget http://$1:9000/trans_buy_f1079_4 -wget http://$1:9000/trans_add_f1080_1_50 -wget http://$1:9000/trans_buy_f1080_0 -wget http://$1:9000/trans_add_f1081_2_100 -wget http://$1:9000/trans_buy_f1081_1 -wget http://$1:9000/trans_add_f1082_3_150 -wget http://$1:9000/trans_buy_f1082_2 -wget http://$1:9000/trans_add_f1083_4_200 -wget http://$1:9000/trans_buy_f1083_3 -wget http://$1:9000/trans_add_f1084_5_50 -wget http://$1:9000/trans_buy_f1084_4 -wget http://$1:9000/trans_add_f1085_1_100 -wget http://$1:9000/trans_buy_f1085_0 -wget http://$1:9000/trans_add_f1086_2_150 -wget http://$1:9000/trans_buy_f1086_1 -wget http://$1:9000/trans_add_f1087_3_200 -wget http://$1:9000/trans_buy_f1087_2 -wget http://$1:9000/trans_add_f1088_4_50 -wget http://$1:9000/trans_buy_f1088_3 -wget http://$1:9000/trans_add_f1089_5_100 -wget http://$1:9000/trans_buy_f1089_4 -wget http://$1:9000/trans_add_f1090_1_150 -wget http://$1:9000/trans_buy_f1090_0 -wget http://$1:9000/trans_add_f1091_2_200 -wget http://$1:9000/trans_buy_f1091_1 -wget http://$1:9000/trans_add_f1092_3_50 -wget http://$1:9000/trans_buy_f1092_2 -wget http://$1:9000/trans_add_f1093_4_100 -wget http://$1:9000/trans_buy_f1093_3 -wget http://$1:9000/trans_add_f1094_5_150 -wget http://$1:9000/trans_buy_f1094_4 -wget http://$1:9000/trans_add_f1095_1_200 -wget http://$1:9000/trans_buy_f1095_0 -wget http://$1:9000/trans_add_f1096_2_50 -wget http://$1:9000/trans_buy_f1096_1 -wget http://$1:9000/trans_add_f1097_3_100 -wget http://$1:9000/trans_buy_f1097_2 -wget http://$1:9000/trans_add_f1098_4_150 -wget http://$1:9000/trans_buy_f1098_3 -wget http://$1:9000/trans_add_f1099_5_200 -wget http://$1:9000/trans_buy_f1099_4 -wget http://$1:9000/trans_add_f1100_1_50 -wget http://$1:9000/trans_buy_f1100_0 -wget http://$1:9000/trans_add_f1101_2_100 -wget http://$1:9000/trans_buy_f1101_1 -wget http://$1:9000/trans_add_f1102_3_150 -wget http://$1:9000/trans_buy_f1102_2 -wget http://$1:9000/trans_add_f1103_4_200 -wget http://$1:9000/trans_buy_f1103_3 -wget http://$1:9000/trans_add_f1104_5_50 -wget http://$1:9000/trans_buy_f1104_4 -wget http://$1:9000/trans_add_f1105_1_100 -wget http://$1:9000/trans_buy_f1105_0 -wget http://$1:9000/trans_add_f1106_2_150 -wget http://$1:9000/trans_buy_f1106_1 -wget http://$1:9000/trans_add_f1107_3_200 -wget http://$1:9000/trans_buy_f1107_2 -wget http://$1:9000/trans_add_f1108_4_50 -wget http://$1:9000/trans_buy_f1108_3 -wget http://$1:9000/trans_add_f1109_5_100 -wget http://$1:9000/trans_buy_f1109_4 -wget http://$1:9000/trans_add_f1110_1_150 -wget http://$1:9000/trans_buy_f1110_0 -wget http://$1:9000/trans_add_f1111_2_200 -wget http://$1:9000/trans_buy_f1111_1 -wget http://$1:9000/trans_add_f1112_3_50 -wget http://$1:9000/trans_buy_f1112_2 -wget http://$1:9000/trans_add_f1113_4_100 -wget http://$1:9000/trans_buy_f1113_3 -wget http://$1:9000/trans_add_f1114_5_150 -wget http://$1:9000/trans_buy_f1114_4 -wget http://$1:9000/trans_add_f1115_1_200 -wget http://$1:9000/trans_buy_f1115_0 -wget http://$1:9000/trans_add_f1116_2_50 -wget http://$1:9000/trans_buy_f1116_1 -wget http://$1:9000/trans_add_f1117_3_100 -wget http://$1:9000/trans_buy_f1117_2 -wget http://$1:9000/trans_add_f1118_4_150 -wget http://$1:9000/trans_buy_f1118_3 -wget http://$1:9000/trans_add_f1119_5_200 -wget http://$1:9000/trans_buy_f1119_4 -wget http://$1:9000/trans_add_f1120_1_50 -wget http://$1:9000/trans_buy_f1120_0 -wget http://$1:9000/trans_add_f1121_2_100 -wget http://$1:9000/trans_buy_f1121_1 -wget http://$1:9000/trans_add_f1122_3_150 -wget http://$1:9000/trans_buy_f1122_2 -wget http://$1:9000/trans_add_f1123_4_200 -wget http://$1:9000/trans_buy_f1123_3 -wget http://$1:9000/trans_add_f1124_5_50 -wget http://$1:9000/trans_buy_f1124_4 -wget http://$1:9000/trans_add_f1125_1_100 -wget http://$1:9000/trans_buy_f1125_0 -wget http://$1:9000/trans_add_f1126_2_150 -wget http://$1:9000/trans_buy_f1126_1 -wget http://$1:9000/trans_add_f1127_3_200 -wget http://$1:9000/trans_buy_f1127_2 -wget http://$1:9000/trans_add_f1128_4_50 -wget http://$1:9000/trans_buy_f1128_3 -wget http://$1:9000/trans_add_f1129_5_100 -wget http://$1:9000/trans_buy_f1129_4 -wget http://$1:9000/trans_add_f1130_1_150 -wget http://$1:9000/trans_buy_f1130_0 -wget http://$1:9000/trans_add_f1131_2_200 -wget http://$1:9000/trans_buy_f1131_1 -wget http://$1:9000/trans_add_f1132_3_50 -wget http://$1:9000/trans_buy_f1132_2 -wget http://$1:9000/trans_add_f1133_4_100 -wget http://$1:9000/trans_buy_f1133_3 -wget http://$1:9000/trans_add_f1134_5_150 -wget http://$1:9000/trans_buy_f1134_4 -wget http://$1:9000/trans_add_f1135_1_200 -wget http://$1:9000/trans_buy_f1135_0 -wget http://$1:9000/trans_add_f1136_2_50 -wget http://$1:9000/trans_buy_f1136_1 -wget http://$1:9000/trans_add_f1137_3_100 -wget http://$1:9000/trans_buy_f1137_2 -wget http://$1:9000/trans_add_f1138_4_150 -wget http://$1:9000/trans_buy_f1138_3 -wget http://$1:9000/trans_add_f1139_5_200 -wget http://$1:9000/trans_buy_f1139_4 -wget http://$1:9000/trans_add_f1140_1_50 -wget http://$1:9000/trans_buy_f1140_0 -wget http://$1:9000/trans_add_f1141_2_100 -wget http://$1:9000/trans_buy_f1141_1 -wget http://$1:9000/trans_add_f1142_3_150 -wget http://$1:9000/trans_buy_f1142_2 -wget http://$1:9000/trans_add_f1143_4_200 -wget http://$1:9000/trans_buy_f1143_3 -wget http://$1:9000/trans_add_f1144_5_50 -wget http://$1:9000/trans_buy_f1144_4 -wget http://$1:9000/trans_add_f1145_1_100 -wget http://$1:9000/trans_buy_f1145_0 -wget http://$1:9000/trans_add_f1146_2_150 -wget http://$1:9000/trans_buy_f1146_1 -wget http://$1:9000/trans_add_f1147_3_200 -wget http://$1:9000/trans_buy_f1147_2 -wget http://$1:9000/trans_add_f1148_4_50 -wget http://$1:9000/trans_buy_f1148_3 -wget http://$1:9000/trans_add_f1149_5_100 -wget http://$1:9000/trans_buy_f1149_4 -wget http://$1:9000/trans_add_f1150_1_150 -wget http://$1:9000/trans_buy_f1150_0 -wget http://$1:9000/trans_add_f1151_2_200 -wget http://$1:9000/trans_buy_f1151_1 -wget http://$1:9000/trans_add_f1152_3_50 -wget http://$1:9000/trans_buy_f1152_2 -wget http://$1:9000/trans_add_f1153_4_100 -wget http://$1:9000/trans_buy_f1153_3 -wget http://$1:9000/trans_add_f1154_5_150 -wget http://$1:9000/trans_buy_f1154_4 -wget http://$1:9000/trans_add_f1155_1_200 -wget http://$1:9000/trans_buy_f1155_0 -wget http://$1:9000/trans_add_f1156_2_50 -wget http://$1:9000/trans_buy_f1156_1 -wget http://$1:9000/trans_add_f1157_3_100 -wget http://$1:9000/trans_buy_f1157_2 -wget http://$1:9000/trans_add_f1158_4_150 -wget http://$1:9000/trans_buy_f1158_3 -wget http://$1:9000/trans_add_f1159_5_200 -wget http://$1:9000/trans_buy_f1159_4 -wget http://$1:9000/trans_add_f1160_1_50 -wget http://$1:9000/trans_buy_f1160_0 -wget http://$1:9000/trans_add_f1161_2_100 -wget http://$1:9000/trans_buy_f1161_1 -wget http://$1:9000/trans_add_f1162_3_150 -wget http://$1:9000/trans_buy_f1162_2 -wget http://$1:9000/trans_add_f1163_4_200 -wget http://$1:9000/trans_buy_f1163_3 -wget http://$1:9000/trans_add_f1164_5_50 -wget http://$1:9000/trans_buy_f1164_4 -wget http://$1:9000/trans_add_f1165_1_100 -wget http://$1:9000/trans_buy_f1165_0 -wget http://$1:9000/trans_add_f1166_2_150 -wget http://$1:9000/trans_buy_f1166_1 -wget http://$1:9000/trans_add_f1167_3_200 -wget http://$1:9000/trans_buy_f1167_2 -wget http://$1:9000/trans_add_f1168_4_50 -wget http://$1:9000/trans_buy_f1168_3 -wget http://$1:9000/trans_add_f1169_5_100 -wget http://$1:9000/trans_buy_f1169_4 -wget http://$1:9000/trans_add_f1170_1_150 -wget http://$1:9000/trans_buy_f1170_0 -wget http://$1:9000/trans_add_f1171_2_200 -wget http://$1:9000/trans_buy_f1171_1 -wget http://$1:9000/trans_add_f1172_3_50 -wget http://$1:9000/trans_buy_f1172_2 -wget http://$1:9000/trans_add_f1173_4_100 -wget http://$1:9000/trans_buy_f1173_3 -wget http://$1:9000/trans_add_f1174_5_150 -wget http://$1:9000/trans_buy_f1174_4 -wget http://$1:9000/trans_add_f1175_1_200 -wget http://$1:9000/trans_buy_f1175_0 -wget http://$1:9000/trans_add_f1176_2_50 -wget http://$1:9000/trans_buy_f1176_1 -wget http://$1:9000/trans_add_f1177_3_100 -wget http://$1:9000/trans_buy_f1177_2 -wget http://$1:9000/trans_add_f1178_4_150 -wget http://$1:9000/trans_buy_f1178_3 -wget http://$1:9000/trans_add_f1179_5_200 -wget http://$1:9000/trans_buy_f1179_4 -wget http://$1:9000/trans_add_f1180_1_50 -wget http://$1:9000/trans_buy_f1180_0 -wget http://$1:9000/trans_add_f1181_2_100 -wget http://$1:9000/trans_buy_f1181_1 -wget http://$1:9000/trans_add_f1182_3_150 -wget http://$1:9000/trans_buy_f1182_2 -wget http://$1:9000/trans_add_f1183_4_200 -wget http://$1:9000/trans_buy_f1183_3 -wget http://$1:9000/trans_add_f1184_5_50 -wget http://$1:9000/trans_buy_f1184_4 -wget http://$1:9000/trans_add_f1185_1_100 -wget http://$1:9000/trans_buy_f1185_0 -wget http://$1:9000/trans_add_f1186_2_150 -wget http://$1:9000/trans_buy_f1186_1 -wget http://$1:9000/trans_add_f1187_3_200 -wget http://$1:9000/trans_buy_f1187_2 -wget http://$1:9000/trans_add_f1188_4_50 -wget http://$1:9000/trans_buy_f1188_3 -wget http://$1:9000/trans_add_f1189_5_100 -wget http://$1:9000/trans_buy_f1189_4 -wget http://$1:9000/trans_add_f1190_1_150 -wget http://$1:9000/trans_buy_f1190_0 -wget http://$1:9000/trans_add_f1191_2_200 -wget http://$1:9000/trans_buy_f1191_1 -wget http://$1:9000/trans_add_f1192_3_50 -wget http://$1:9000/trans_buy_f1192_2 -wget http://$1:9000/trans_add_f1193_4_100 -wget http://$1:9000/trans_buy_f1193_3 -wget http://$1:9000/trans_add_f1194_5_150 -wget http://$1:9000/trans_buy_f1194_4 -wget http://$1:9000/trans_add_f1195_1_200 -wget http://$1:9000/trans_buy_f1195_0 -wget http://$1:9000/trans_add_f1196_2_50 -wget http://$1:9000/trans_buy_f1196_1 -wget http://$1:9000/trans_add_f1197_3_100 -wget http://$1:9000/trans_buy_f1197_2 -wget http://$1:9000/trans_add_f1198_4_150 -wget http://$1:9000/trans_buy_f1198_3 -wget http://$1:9000/trans_add_f1199_5_200 -wget http://$1:9000/trans_buy_f1199_4 -wget http://$1:9000/trans_add_f1200_1_50 -wget http://$1:9000/trans_buy_f1200_0 -wget http://$1:9000/trans_add_f1201_2_100 -wget http://$1:9000/trans_buy_f1201_1 -wget http://$1:9000/trans_add_f1202_3_150 -wget http://$1:9000/trans_buy_f1202_2 -wget http://$1:9000/trans_add_f1203_4_200 -wget http://$1:9000/trans_buy_f1203_3 -wget http://$1:9000/trans_add_f1204_5_50 -wget http://$1:9000/trans_buy_f1204_4 -wget http://$1:9000/trans_add_f1205_1_100 -wget http://$1:9000/trans_buy_f1205_0 -wget http://$1:9000/trans_add_f1206_2_150 -wget http://$1:9000/trans_buy_f1206_1 -wget http://$1:9000/trans_add_f1207_3_200 -wget http://$1:9000/trans_buy_f1207_2 -wget http://$1:9000/trans_add_f1208_4_50 -wget http://$1:9000/trans_buy_f1208_3 -wget http://$1:9000/trans_add_f1209_5_100 -wget http://$1:9000/trans_buy_f1209_4 -wget http://$1:9000/trans_add_f1210_1_150 -wget http://$1:9000/trans_buy_f1210_0 -wget http://$1:9000/trans_add_f1211_2_200 -wget http://$1:9000/trans_buy_f1211_1 -wget http://$1:9000/trans_add_f1212_3_50 -wget http://$1:9000/trans_buy_f1212_2 -wget http://$1:9000/trans_add_f1213_4_100 -wget http://$1:9000/trans_buy_f1213_3 -wget http://$1:9000/trans_add_f1214_5_150 -wget http://$1:9000/trans_buy_f1214_4 -wget http://$1:9000/trans_add_f1215_1_200 -wget http://$1:9000/trans_buy_f1215_0 -wget http://$1:9000/trans_add_f1216_2_50 -wget http://$1:9000/trans_buy_f1216_1 -wget http://$1:9000/trans_add_f1217_3_100 -wget http://$1:9000/trans_buy_f1217_2 -wget http://$1:9000/trans_add_f1218_4_150 -wget http://$1:9000/trans_buy_f1218_3 -wget http://$1:9000/trans_add_f1219_5_200 -wget http://$1:9000/trans_buy_f1219_4 -wget http://$1:9000/trans_add_f1220_1_50 -wget http://$1:9000/trans_buy_f1220_0 -wget http://$1:9000/trans_add_f1221_2_100 -wget http://$1:9000/trans_buy_f1221_1 -wget http://$1:9000/trans_add_f1222_3_150 -wget http://$1:9000/trans_buy_f1222_2 -wget http://$1:9000/trans_add_f1223_4_200 -wget http://$1:9000/trans_buy_f1223_3 -wget http://$1:9000/trans_add_f1224_5_50 -wget http://$1:9000/trans_buy_f1224_4 -wget http://$1:9000/trans_add_f1225_1_100 -wget http://$1:9000/trans_buy_f1225_0 -wget http://$1:9000/trans_add_f1226_2_150 -wget http://$1:9000/trans_buy_f1226_1 -wget http://$1:9000/trans_add_f1227_3_200 -wget http://$1:9000/trans_buy_f1227_2 -wget http://$1:9000/trans_add_f1228_4_50 -wget http://$1:9000/trans_buy_f1228_3 -wget http://$1:9000/trans_add_f1229_5_100 -wget http://$1:9000/trans_buy_f1229_4 -wget http://$1:9000/trans_add_f1230_1_150 -wget http://$1:9000/trans_buy_f1230_0 -wget http://$1:9000/trans_add_f1231_2_200 -wget http://$1:9000/trans_buy_f1231_1 -wget http://$1:9000/trans_add_f1232_3_50 -wget http://$1:9000/trans_buy_f1232_2 -wget http://$1:9000/trans_add_f1233_4_100 -wget http://$1:9000/trans_buy_f1233_3 -wget http://$1:9000/trans_add_f1234_5_150 -wget http://$1:9000/trans_buy_f1234_4 -wget http://$1:9000/trans_add_f1235_1_200 -wget http://$1:9000/trans_buy_f1235_0 -wget http://$1:9000/trans_add_f1236_2_50 -wget http://$1:9000/trans_buy_f1236_1 -wget http://$1:9000/trans_add_f1237_3_100 -wget http://$1:9000/trans_buy_f1237_2 -wget http://$1:9000/trans_add_f1238_4_150 -wget http://$1:9000/trans_buy_f1238_3 -wget http://$1:9000/trans_add_f1239_5_200 -wget http://$1:9000/trans_buy_f1239_4 -wget http://$1:9000/trans_add_f1240_1_50 -wget http://$1:9000/trans_buy_f1240_0 -wget http://$1:9000/trans_add_f1241_2_100 -wget http://$1:9000/trans_buy_f1241_1 -wget http://$1:9000/trans_add_f1242_3_150 -wget http://$1:9000/trans_buy_f1242_2 -wget http://$1:9000/trans_add_f1243_4_200 -wget http://$1:9000/trans_buy_f1243_3 -wget http://$1:9000/trans_add_f1244_5_50 -wget http://$1:9000/trans_buy_f1244_4 -wget http://$1:9000/trans_add_f1245_1_100 -wget http://$1:9000/trans_buy_f1245_0 -wget http://$1:9000/trans_add_f1246_2_150 -wget http://$1:9000/trans_buy_f1246_1 -wget http://$1:9000/trans_add_f1247_3_200 -wget http://$1:9000/trans_buy_f1247_2 -wget http://$1:9000/trans_add_f1248_4_50 -wget http://$1:9000/trans_buy_f1248_3 -wget http://$1:9000/trans_add_f1249_5_100 -wget http://$1:9000/trans_buy_f1249_4 -wget http://$1:9000/trans_add_f1250_1_150 -wget http://$1:9000/trans_buy_f1250_0 -wget http://$1:9000/trans_add_f1251_2_200 -wget http://$1:9000/trans_buy_f1251_1 -wget http://$1:9000/trans_add_f1252_3_50 -wget http://$1:9000/trans_buy_f1252_2 -wget http://$1:9000/trans_add_f1253_4_100 -wget http://$1:9000/trans_buy_f1253_3 -wget http://$1:9000/trans_add_f1254_5_150 -wget http://$1:9000/trans_buy_f1254_4 -wget http://$1:9000/trans_add_f1255_1_200 -wget http://$1:9000/trans_buy_f1255_0 -wget http://$1:9000/trans_add_f1256_2_50 -wget http://$1:9000/trans_buy_f1256_1 -wget http://$1:9000/trans_add_f1257_3_100 -wget http://$1:9000/trans_buy_f1257_2 -wget http://$1:9000/trans_add_f1258_4_150 -wget http://$1:9000/trans_buy_f1258_3 -wget http://$1:9000/trans_add_f1259_5_200 -wget http://$1:9000/trans_buy_f1259_4 -wget http://$1:9000/trans_add_f1260_1_50 -wget http://$1:9000/trans_buy_f1260_0 -wget http://$1:9000/trans_add_f1261_2_100 -wget http://$1:9000/trans_buy_f1261_1 -wget http://$1:9000/trans_add_f1262_3_150 -wget http://$1:9000/trans_buy_f1262_2 -wget http://$1:9000/trans_add_f1263_4_200 -wget http://$1:9000/trans_buy_f1263_3 -wget http://$1:9000/trans_add_f1264_5_50 -wget http://$1:9000/trans_buy_f1264_4 -wget http://$1:9000/trans_add_f1265_1_100 -wget http://$1:9000/trans_buy_f1265_0 -wget http://$1:9000/trans_add_f1266_2_150 -wget http://$1:9000/trans_buy_f1266_1 -wget http://$1:9000/trans_add_f1267_3_200 -wget http://$1:9000/trans_buy_f1267_2 -wget http://$1:9000/trans_add_f1268_4_50 -wget http://$1:9000/trans_buy_f1268_3 -wget http://$1:9000/trans_add_f1269_5_100 -wget http://$1:9000/trans_buy_f1269_4 -wget http://$1:9000/trans_add_f1270_1_150 -wget http://$1:9000/trans_buy_f1270_0 -wget http://$1:9000/trans_add_f1271_2_200 -wget http://$1:9000/trans_buy_f1271_1 -wget http://$1:9000/trans_add_f1272_3_50 -wget http://$1:9000/trans_buy_f1272_2 -wget http://$1:9000/trans_add_f1273_4_100 -wget http://$1:9000/trans_buy_f1273_3 -wget http://$1:9000/trans_add_f1274_5_150 -wget http://$1:9000/trans_buy_f1274_4 -wget http://$1:9000/trans_add_f1275_1_200 -wget http://$1:9000/trans_buy_f1275_0 -wget http://$1:9000/trans_add_f1276_2_50 -wget http://$1:9000/trans_buy_f1276_1 -wget http://$1:9000/trans_add_f1277_3_100 -wget http://$1:9000/trans_buy_f1277_2 -wget http://$1:9000/trans_add_f1278_4_150 -wget http://$1:9000/trans_buy_f1278_3 -wget http://$1:9000/trans_add_f1279_5_200 -wget http://$1:9000/trans_buy_f1279_4 -wget http://$1:9000/trans_add_f1280_1_50 -wget http://$1:9000/trans_buy_f1280_0 -wget http://$1:9000/trans_add_f1281_2_100 -wget http://$1:9000/trans_buy_f1281_1 -wget http://$1:9000/trans_add_f1282_3_150 -wget http://$1:9000/trans_buy_f1282_2 -wget http://$1:9000/trans_add_f1283_4_200 -wget http://$1:9000/trans_buy_f1283_3 -wget http://$1:9000/trans_add_f1284_5_50 -wget http://$1:9000/trans_buy_f1284_4 -wget http://$1:9000/trans_add_f1285_1_100 -wget http://$1:9000/trans_buy_f1285_0 -wget http://$1:9000/trans_add_f1286_2_150 -wget http://$1:9000/trans_buy_f1286_1 -wget http://$1:9000/trans_add_f1287_3_200 -wget http://$1:9000/trans_buy_f1287_2 -wget http://$1:9000/trans_add_f1288_4_50 -wget http://$1:9000/trans_buy_f1288_3 -wget http://$1:9000/trans_add_f1289_5_100 -wget http://$1:9000/trans_buy_f1289_4 -wget http://$1:9000/trans_add_f1290_1_150 -wget http://$1:9000/trans_buy_f1290_0 -wget http://$1:9000/trans_add_f1291_2_200 -wget http://$1:9000/trans_buy_f1291_1 -wget http://$1:9000/trans_add_f1292_3_50 -wget http://$1:9000/trans_buy_f1292_2 -wget http://$1:9000/trans_add_f1293_4_100 -wget http://$1:9000/trans_buy_f1293_3 -wget http://$1:9000/trans_add_f1294_5_150 -wget http://$1:9000/trans_buy_f1294_4 -wget http://$1:9000/trans_add_f1295_1_200 -wget http://$1:9000/trans_buy_f1295_0 -wget http://$1:9000/trans_add_f1296_2_50 -wget http://$1:9000/trans_buy_f1296_1 -wget http://$1:9000/trans_add_f1297_3_100 -wget http://$1:9000/trans_buy_f1297_2 -wget http://$1:9000/trans_add_f1298_4_150 -wget http://$1:9000/trans_buy_f1298_3 -wget http://$1:9000/trans_add_f1299_5_200 -wget http://$1:9000/trans_buy_f1299_4 -wget http://$1:9000/trans_add_f1300_1_50 -wget http://$1:9000/trans_buy_f1300_0 -wget http://$1:9000/trans_add_f1301_2_100 -wget http://$1:9000/trans_buy_f1301_1 -wget http://$1:9000/trans_add_f1302_3_150 -wget http://$1:9000/trans_buy_f1302_2 -wget http://$1:9000/trans_add_f1303_4_200 -wget http://$1:9000/trans_buy_f1303_3 -wget http://$1:9000/trans_add_f1304_5_50 -wget http://$1:9000/trans_buy_f1304_4 -wget http://$1:9000/trans_add_f1305_1_100 -wget http://$1:9000/trans_buy_f1305_0 -wget http://$1:9000/trans_add_f1306_2_150 -wget http://$1:9000/trans_buy_f1306_1 -wget http://$1:9000/trans_add_f1307_3_200 -wget http://$1:9000/trans_buy_f1307_2 -wget http://$1:9000/trans_add_f1308_4_50 -wget http://$1:9000/trans_buy_f1308_3 -wget http://$1:9000/trans_add_f1309_5_100 -wget http://$1:9000/trans_buy_f1309_4 -wget http://$1:9000/trans_add_f1310_1_150 -wget http://$1:9000/trans_buy_f1310_0 -wget http://$1:9000/trans_add_f1311_2_200 -wget http://$1:9000/trans_buy_f1311_1 -wget http://$1:9000/trans_add_f1312_3_50 -wget http://$1:9000/trans_buy_f1312_2 -wget http://$1:9000/trans_add_f1313_4_100 -wget http://$1:9000/trans_buy_f1313_3 -wget http://$1:9000/trans_add_f1314_5_150 -wget http://$1:9000/trans_buy_f1314_4 -wget http://$1:9000/trans_add_f1315_1_200 -wget http://$1:9000/trans_buy_f1315_0 -wget http://$1:9000/trans_add_f1316_2_50 -wget http://$1:9000/trans_buy_f1316_1 -wget http://$1:9000/trans_add_f1317_3_100 -wget http://$1:9000/trans_buy_f1317_2 -wget http://$1:9000/trans_add_f1318_4_150 -wget http://$1:9000/trans_buy_f1318_3 -wget http://$1:9000/trans_add_f1319_5_200 -wget http://$1:9000/trans_buy_f1319_4 -wget http://$1:9000/trans_add_f1320_1_50 -wget http://$1:9000/trans_buy_f1320_0 -wget http://$1:9000/trans_add_f1321_2_100 -wget http://$1:9000/trans_buy_f1321_1 -wget http://$1:9000/trans_add_f1322_3_150 -wget http://$1:9000/trans_buy_f1322_2 -wget http://$1:9000/trans_add_f1323_4_200 -wget http://$1:9000/trans_buy_f1323_3 -wget http://$1:9000/trans_add_f1324_5_50 -wget http://$1:9000/trans_buy_f1324_4 -wget http://$1:9000/trans_add_f1325_1_100 -wget http://$1:9000/trans_buy_f1325_0 -wget http://$1:9000/trans_add_f1326_2_150 -wget http://$1:9000/trans_buy_f1326_1 -wget http://$1:9000/trans_add_f1327_3_200 -wget http://$1:9000/trans_buy_f1327_2 -wget http://$1:9000/trans_add_f1328_4_50 -wget http://$1:9000/trans_buy_f1328_3 -wget http://$1:9000/trans_add_f1329_5_100 -wget http://$1:9000/trans_buy_f1329_4 -wget http://$1:9000/trans_add_f1330_1_150 -wget http://$1:9000/trans_buy_f1330_0 -wget http://$1:9000/trans_add_f1331_2_200 -wget http://$1:9000/trans_buy_f1331_1 -wget http://$1:9000/trans_add_f1332_3_50 -wget http://$1:9000/trans_buy_f1332_2 -wget http://$1:9000/trans_add_f1333_4_100 -wget http://$1:9000/trans_buy_f1333_3 -wget http://$1:9000/trans_add_f1334_5_150 -wget http://$1:9000/trans_buy_f1334_4 -wget http://$1:9000/trans_add_f1335_1_200 -wget http://$1:9000/trans_buy_f1335_0 -wget http://$1:9000/trans_add_f1336_2_50 -wget http://$1:9000/trans_buy_f1336_1 -wget http://$1:9000/trans_add_f1337_3_100 -wget http://$1:9000/trans_buy_f1337_2 -wget http://$1:9000/trans_add_f1338_4_150 -wget http://$1:9000/trans_buy_f1338_3 -wget http://$1:9000/trans_add_f1339_5_200 -wget http://$1:9000/trans_buy_f1339_4 -wget http://$1:9000/trans_add_f1340_1_50 -wget http://$1:9000/trans_buy_f1340_0 -wget http://$1:9000/trans_add_f1341_2_100 -wget http://$1:9000/trans_buy_f1341_1 -wget http://$1:9000/trans_add_f1342_3_150 -wget http://$1:9000/trans_buy_f1342_2 -wget http://$1:9000/trans_add_f1343_4_200 -wget http://$1:9000/trans_buy_f1343_3 -wget http://$1:9000/trans_add_f1344_5_50 -wget http://$1:9000/trans_buy_f1344_4 -wget http://$1:9000/trans_add_f1345_1_100 -wget http://$1:9000/trans_buy_f1345_0 -wget http://$1:9000/trans_add_f1346_2_150 -wget http://$1:9000/trans_buy_f1346_1 -wget http://$1:9000/trans_add_f1347_3_200 -wget http://$1:9000/trans_buy_f1347_2 -wget http://$1:9000/trans_add_f1348_4_50 -wget http://$1:9000/trans_buy_f1348_3 -wget http://$1:9000/trans_add_f1349_5_100 -wget http://$1:9000/trans_buy_f1349_4 -wget http://$1:9000/trans_add_f1350_1_150 -wget http://$1:9000/trans_buy_f1350_0 -wget http://$1:9000/trans_add_f1351_2_200 -wget http://$1:9000/trans_buy_f1351_1 -wget http://$1:9000/trans_add_f1352_3_50 -wget http://$1:9000/trans_buy_f1352_2 -wget http://$1:9000/trans_add_f1353_4_100 -wget http://$1:9000/trans_buy_f1353_3 -wget http://$1:9000/trans_add_f1354_5_150 -wget http://$1:9000/trans_buy_f1354_4 -wget http://$1:9000/trans_add_f1355_1_200 -wget http://$1:9000/trans_buy_f1355_0 -wget http://$1:9000/trans_add_f1356_2_50 -wget http://$1:9000/trans_buy_f1356_1 -wget http://$1:9000/trans_add_f1357_3_100 -wget http://$1:9000/trans_buy_f1357_2 -wget http://$1:9000/trans_add_f1358_4_150 -wget http://$1:9000/trans_buy_f1358_3 -wget http://$1:9000/trans_add_f1359_5_200 -wget http://$1:9000/trans_buy_f1359_4 -wget http://$1:9000/trans_add_f1360_1_50 -wget http://$1:9000/trans_buy_f1360_0 -wget http://$1:9000/trans_add_f1361_2_100 -wget http://$1:9000/trans_buy_f1361_1 -wget http://$1:9000/trans_add_f1362_3_150 -wget http://$1:9000/trans_buy_f1362_2 -wget http://$1:9000/trans_add_f1363_4_200 -wget http://$1:9000/trans_buy_f1363_3 -wget http://$1:9000/trans_add_f1364_5_50 -wget http://$1:9000/trans_buy_f1364_4 -wget http://$1:9000/trans_add_f1365_1_100 -wget http://$1:9000/trans_buy_f1365_0 -wget http://$1:9000/trans_add_f1366_2_150 -wget http://$1:9000/trans_buy_f1366_1 -wget http://$1:9000/trans_add_f1367_3_200 -wget http://$1:9000/trans_buy_f1367_2 -wget http://$1:9000/trans_add_f1368_4_50 -wget http://$1:9000/trans_buy_f1368_3 -wget http://$1:9000/trans_add_f1369_5_100 -wget http://$1:9000/trans_buy_f1369_4 -wget http://$1:9000/trans_add_f1370_1_150 -wget http://$1:9000/trans_buy_f1370_0 -wget http://$1:9000/trans_add_f1371_2_200 -wget http://$1:9000/trans_buy_f1371_1 -wget http://$1:9000/trans_add_f1372_3_50 -wget http://$1:9000/trans_buy_f1372_2 -wget http://$1:9000/trans_add_f1373_4_100 -wget http://$1:9000/trans_buy_f1373_3 -wget http://$1:9000/trans_add_f1374_5_150 -wget http://$1:9000/trans_buy_f1374_4 -wget http://$1:9000/trans_add_f1375_1_200 -wget http://$1:9000/trans_buy_f1375_0 -wget http://$1:9000/trans_add_f1376_2_50 -wget http://$1:9000/trans_buy_f1376_1 -wget http://$1:9000/trans_add_f1377_3_100 -wget http://$1:9000/trans_buy_f1377_2 -wget http://$1:9000/trans_add_f1378_4_150 -wget http://$1:9000/trans_buy_f1378_3 -wget http://$1:9000/trans_add_f1379_5_200 -wget http://$1:9000/trans_buy_f1379_4 -wget http://$1:9000/trans_add_f1380_1_50 -wget http://$1:9000/trans_buy_f1380_0 -wget http://$1:9000/trans_add_f1381_2_100 -wget http://$1:9000/trans_buy_f1381_1 -wget http://$1:9000/trans_add_f1382_3_150 -wget http://$1:9000/trans_buy_f1382_2 -wget http://$1:9000/trans_add_f1383_4_200 -wget http://$1:9000/trans_buy_f1383_3 -wget http://$1:9000/trans_add_f1384_5_50 -wget http://$1:9000/trans_buy_f1384_4 -wget http://$1:9000/trans_add_f1385_1_100 -wget http://$1:9000/trans_buy_f1385_0 -wget http://$1:9000/trans_add_f1386_2_150 -wget http://$1:9000/trans_buy_f1386_1 -wget http://$1:9000/trans_add_f1387_3_200 -wget http://$1:9000/trans_buy_f1387_2 -wget http://$1:9000/trans_add_f1388_4_50 -wget http://$1:9000/trans_buy_f1388_3 -wget http://$1:9000/trans_add_f1389_5_100 -wget http://$1:9000/trans_buy_f1389_4 -wget http://$1:9000/trans_add_f1390_1_150 -wget http://$1:9000/trans_buy_f1390_0 -wget http://$1:9000/trans_add_f1391_2_200 -wget http://$1:9000/trans_buy_f1391_1 -wget http://$1:9000/trans_add_f1392_3_50 -wget http://$1:9000/trans_buy_f1392_2 -wget http://$1:9000/trans_add_f1393_4_100 -wget http://$1:9000/trans_buy_f1393_3 -wget http://$1:9000/trans_add_f1394_5_150 -wget http://$1:9000/trans_buy_f1394_4 -wget http://$1:9000/trans_add_f1395_1_200 -wget http://$1:9000/trans_buy_f1395_0 -wget http://$1:9000/trans_add_f1396_2_50 -wget http://$1:9000/trans_buy_f1396_1 -wget http://$1:9000/trans_add_f1397_3_100 -wget http://$1:9000/trans_buy_f1397_2 -wget http://$1:9000/trans_add_f1398_4_150 -wget http://$1:9000/trans_buy_f1398_3 -wget http://$1:9000/trans_add_f1399_5_200 -wget http://$1:9000/trans_buy_f1399_4 -wget http://$1:9000/trans_add_f1400_1_50 -wget http://$1:9000/trans_buy_f1400_0 -wget http://$1:9000/trans_add_f1401_2_100 -wget http://$1:9000/trans_buy_f1401_1 -wget http://$1:9000/trans_add_f1402_3_150 -wget http://$1:9000/trans_buy_f1402_2 -wget http://$1:9000/trans_add_f1403_4_200 -wget http://$1:9000/trans_buy_f1403_3 -wget http://$1:9000/trans_add_f1404_5_50 -wget http://$1:9000/trans_buy_f1404_4 -wget http://$1:9000/trans_add_f1405_1_100 -wget http://$1:9000/trans_buy_f1405_0 -wget http://$1:9000/trans_add_f1406_2_150 -wget http://$1:9000/trans_buy_f1406_1 -wget http://$1:9000/trans_add_f1407_3_200 -wget http://$1:9000/trans_buy_f1407_2 -wget http://$1:9000/trans_add_f1408_4_50 -wget http://$1:9000/trans_buy_f1408_3 -wget http://$1:9000/trans_add_f1409_5_100 -wget http://$1:9000/trans_buy_f1409_4 -wget http://$1:9000/trans_add_f1410_1_150 -wget http://$1:9000/trans_buy_f1410_0 -wget http://$1:9000/trans_add_f1411_2_200 -wget http://$1:9000/trans_buy_f1411_1 -wget http://$1:9000/trans_add_f1412_3_50 -wget http://$1:9000/trans_buy_f1412_2 -wget http://$1:9000/trans_add_f1413_4_100 -wget http://$1:9000/trans_buy_f1413_3 -wget http://$1:9000/trans_add_f1414_5_150 -wget http://$1:9000/trans_buy_f1414_4 -wget http://$1:9000/trans_add_f1415_1_200 -wget http://$1:9000/trans_buy_f1415_0 -wget http://$1:9000/trans_add_f1416_2_50 -wget http://$1:9000/trans_buy_f1416_1 -wget http://$1:9000/trans_add_f1417_3_100 -wget http://$1:9000/trans_buy_f1417_2 -wget http://$1:9000/trans_add_f1418_4_150 -wget http://$1:9000/trans_buy_f1418_3 -wget http://$1:9000/trans_add_f1419_5_200 -wget http://$1:9000/trans_buy_f1419_4 -wget http://$1:9000/trans_add_f1420_1_50 -wget http://$1:9000/trans_buy_f1420_0 -wget http://$1:9000/trans_add_f1421_2_100 -wget http://$1:9000/trans_buy_f1421_1 -wget http://$1:9000/trans_add_f1422_3_150 -wget http://$1:9000/trans_buy_f1422_2 -wget http://$1:9000/trans_add_f1423_4_200 -wget http://$1:9000/trans_buy_f1423_3 -wget http://$1:9000/trans_add_f1424_5_50 -wget http://$1:9000/trans_buy_f1424_4 -wget http://$1:9000/trans_add_f1425_1_100 -wget http://$1:9000/trans_buy_f1425_0 -wget http://$1:9000/trans_add_f1426_2_150 -wget http://$1:9000/trans_buy_f1426_1 -wget http://$1:9000/trans_add_f1427_3_200 -wget http://$1:9000/trans_buy_f1427_2 -wget http://$1:9000/trans_add_f1428_4_50 -wget http://$1:9000/trans_buy_f1428_3 -wget http://$1:9000/trans_add_f1429_5_100 -wget http://$1:9000/trans_buy_f1429_4 -wget http://$1:9000/trans_add_f1430_1_150 -wget http://$1:9000/trans_buy_f1430_0 -wget http://$1:9000/trans_add_f1431_2_200 -wget http://$1:9000/trans_buy_f1431_1 -wget http://$1:9000/trans_add_f1432_3_50 -wget http://$1:9000/trans_buy_f1432_2 -wget http://$1:9000/trans_add_f1433_4_100 -wget http://$1:9000/trans_buy_f1433_3 -wget http://$1:9000/trans_add_f1434_5_150 -wget http://$1:9000/trans_buy_f1434_4 -wget http://$1:9000/trans_add_f1435_1_200 -wget http://$1:9000/trans_buy_f1435_0 -wget http://$1:9000/trans_add_f1436_2_50 -wget http://$1:9000/trans_buy_f1436_1 -wget http://$1:9000/trans_add_f1437_3_100 -wget http://$1:9000/trans_buy_f1437_2 -wget http://$1:9000/trans_add_f1438_4_150 -wget http://$1:9000/trans_buy_f1438_3 -wget http://$1:9000/trans_add_f1439_5_200 -wget http://$1:9000/trans_buy_f1439_4 -wget http://$1:9000/trans_add_f1440_1_50 -wget http://$1:9000/trans_buy_f1440_0 -wget http://$1:9000/trans_add_f1441_2_100 -wget http://$1:9000/trans_buy_f1441_1 -wget http://$1:9000/trans_add_f1442_3_150 -wget http://$1:9000/trans_buy_f1442_2 -wget http://$1:9000/trans_add_f1443_4_200 -wget http://$1:9000/trans_buy_f1443_3 -wget http://$1:9000/trans_add_f1444_5_50 -wget http://$1:9000/trans_buy_f1444_4 -wget http://$1:9000/trans_add_f1445_1_100 -wget http://$1:9000/trans_buy_f1445_0 -wget http://$1:9000/trans_add_f1446_2_150 -wget http://$1:9000/trans_buy_f1446_1 -wget http://$1:9000/trans_add_f1447_3_200 -wget http://$1:9000/trans_buy_f1447_2 -wget http://$1:9000/trans_add_f1448_4_50 -wget http://$1:9000/trans_buy_f1448_3 -wget http://$1:9000/trans_add_f1449_5_100 -wget http://$1:9000/trans_buy_f1449_4 -wget http://$1:9000/trans_add_f1450_1_150 -wget http://$1:9000/trans_buy_f1450_0 -wget http://$1:9000/trans_add_f1451_2_200 -wget http://$1:9000/trans_buy_f1451_1 -wget http://$1:9000/trans_add_f1452_3_50 -wget http://$1:9000/trans_buy_f1452_2 -wget http://$1:9000/trans_add_f1453_4_100 -wget http://$1:9000/trans_buy_f1453_3 -wget http://$1:9000/trans_add_f1454_5_150 -wget http://$1:9000/trans_buy_f1454_4 -wget http://$1:9000/trans_add_f1455_1_200 -wget http://$1:9000/trans_buy_f1455_0 -wget http://$1:9000/trans_add_f1456_2_50 -wget http://$1:9000/trans_buy_f1456_1 -wget http://$1:9000/trans_add_f1457_3_100 -wget http://$1:9000/trans_buy_f1457_2 -wget http://$1:9000/trans_add_f1458_4_150 -wget http://$1:9000/trans_buy_f1458_3 -wget http://$1:9000/trans_add_f1459_5_200 -wget http://$1:9000/trans_buy_f1459_4 -wget http://$1:9000/trans_add_f1460_1_50 -wget http://$1:9000/trans_buy_f1460_0 -wget http://$1:9000/trans_add_f1461_2_100 -wget http://$1:9000/trans_buy_f1461_1 -wget http://$1:9000/trans_add_f1462_3_150 -wget http://$1:9000/trans_buy_f1462_2 -wget http://$1:9000/trans_add_f1463_4_200 -wget http://$1:9000/trans_buy_f1463_3 -wget http://$1:9000/trans_add_f1464_5_50 -wget http://$1:9000/trans_buy_f1464_4 -wget http://$1:9000/trans_add_f1465_1_100 -wget http://$1:9000/trans_buy_f1465_0 -wget http://$1:9000/trans_add_f1466_2_150 -wget http://$1:9000/trans_buy_f1466_1 -wget http://$1:9000/trans_add_f1467_3_200 -wget http://$1:9000/trans_buy_f1467_2 -wget http://$1:9000/trans_add_f1468_4_50 -wget http://$1:9000/trans_buy_f1468_3 -wget http://$1:9000/trans_add_f1469_5_100 -wget http://$1:9000/trans_buy_f1469_4 -wget http://$1:9000/trans_add_f1470_1_150 -wget http://$1:9000/trans_buy_f1470_0 -wget http://$1:9000/trans_add_f1471_2_200 -wget http://$1:9000/trans_buy_f1471_1 -wget http://$1:9000/trans_add_f1472_3_50 -wget http://$1:9000/trans_buy_f1472_2 -wget http://$1:9000/trans_add_f1473_4_100 -wget http://$1:9000/trans_buy_f1473_3 -wget http://$1:9000/trans_add_f1474_5_150 -wget http://$1:9000/trans_buy_f1474_4 -wget http://$1:9000/trans_add_f1475_1_200 -wget http://$1:9000/trans_buy_f1475_0 -wget http://$1:9000/trans_add_f1476_2_50 -wget http://$1:9000/trans_buy_f1476_1 -wget http://$1:9000/trans_add_f1477_3_100 -wget http://$1:9000/trans_buy_f1477_2 -wget http://$1:9000/trans_add_f1478_4_150 -wget http://$1:9000/trans_buy_f1478_3 -wget http://$1:9000/trans_add_f1479_5_200 -wget http://$1:9000/trans_buy_f1479_4 -wget http://$1:9000/trans_add_f1480_1_50 -wget http://$1:9000/trans_buy_f1480_0 -wget http://$1:9000/trans_add_f1481_2_100 -wget http://$1:9000/trans_buy_f1481_1 -wget http://$1:9000/trans_add_f1482_3_150 -wget http://$1:9000/trans_buy_f1482_2 -wget http://$1:9000/trans_add_f1483_4_200 -wget http://$1:9000/trans_buy_f1483_3 -wget http://$1:9000/trans_add_f1484_5_50 -wget http://$1:9000/trans_buy_f1484_4 -wget http://$1:9000/trans_add_f1485_1_100 -wget http://$1:9000/trans_buy_f1485_0 -wget http://$1:9000/trans_add_f1486_2_150 -wget http://$1:9000/trans_buy_f1486_1 -wget http://$1:9000/trans_add_f1487_3_200 -wget http://$1:9000/trans_buy_f1487_2 -wget http://$1:9000/trans_add_f1488_4_50 -wget http://$1:9000/trans_buy_f1488_3 -wget http://$1:9000/trans_add_f1489_5_100 -wget http://$1:9000/trans_buy_f1489_4 -wget http://$1:9000/trans_add_f1490_1_150 -wget http://$1:9000/trans_buy_f1490_0 -wget http://$1:9000/trans_add_f1491_2_200 -wget http://$1:9000/trans_buy_f1491_1 -wget http://$1:9000/trans_add_f1492_3_50 -wget http://$1:9000/trans_buy_f1492_2 -wget http://$1:9000/trans_add_f1493_4_100 -wget http://$1:9000/trans_buy_f1493_3 -wget http://$1:9000/trans_add_f1494_5_150 -wget http://$1:9000/trans_buy_f1494_4 -wget http://$1:9000/trans_add_f1495_1_200 -wget http://$1:9000/trans_buy_f1495_0 -wget http://$1:9000/trans_add_f1496_2_50 -wget http://$1:9000/trans_buy_f1496_1 -wget http://$1:9000/trans_add_f1497_3_100 -wget http://$1:9000/trans_buy_f1497_2 -wget http://$1:9000/trans_add_f1498_4_150 -wget http://$1:9000/trans_buy_f1498_3 -wget http://$1:9000/trans_add_f1499_5_200 -wget http://$1:9000/trans_buy_f1499_4 -wget http://$1:9000/trans_add_f1500_1_50 -wget http://$1:9000/trans_buy_f1500_0 -wget http://$1:9000/trans_add_f1501_2_100 -wget http://$1:9000/trans_buy_f1501_1 -wget http://$1:9000/trans_add_f1502_3_150 -wget http://$1:9000/trans_buy_f1502_2 -wget http://$1:9000/trans_add_f1503_4_200 -wget http://$1:9000/trans_buy_f1503_3 -wget http://$1:9000/trans_add_f1504_5_50 -wget http://$1:9000/trans_buy_f1504_4 -wget http://$1:9000/trans_add_f1505_1_100 -wget http://$1:9000/trans_buy_f1505_0 -wget http://$1:9000/trans_add_f1506_2_150 -wget http://$1:9000/trans_buy_f1506_1 -wget http://$1:9000/trans_add_f1507_3_200 -wget http://$1:9000/trans_buy_f1507_2 -wget http://$1:9000/trans_add_f1508_4_50 -wget http://$1:9000/trans_buy_f1508_3 -wget http://$1:9000/trans_add_f1509_5_100 -wget http://$1:9000/trans_buy_f1509_4 -wget http://$1:9000/trans_add_f1510_1_150 -wget http://$1:9000/trans_buy_f1510_0 -wget http://$1:9000/trans_add_f1511_2_200 -wget http://$1:9000/trans_buy_f1511_1 -wget http://$1:9000/trans_add_f1512_3_50 -wget http://$1:9000/trans_buy_f1512_2 -wget http://$1:9000/trans_add_f1513_4_100 -wget http://$1:9000/trans_buy_f1513_3 -wget http://$1:9000/trans_add_f1514_5_150 -wget http://$1:9000/trans_buy_f1514_4 -wget http://$1:9000/trans_add_f1515_1_200 -wget http://$1:9000/trans_buy_f1515_0 -wget http://$1:9000/trans_add_f1516_2_50 -wget http://$1:9000/trans_buy_f1516_1 -wget http://$1:9000/trans_add_f1517_3_100 -wget http://$1:9000/trans_buy_f1517_2 -wget http://$1:9000/trans_add_f1518_4_150 -wget http://$1:9000/trans_buy_f1518_3 -wget http://$1:9000/trans_add_f1519_5_200 -wget http://$1:9000/trans_buy_f1519_4 -wget http://$1:9000/trans_add_f1520_1_50 -wget http://$1:9000/trans_buy_f1520_0 -wget http://$1:9000/trans_add_f1521_2_100 -wget http://$1:9000/trans_buy_f1521_1 -wget http://$1:9000/trans_add_f1522_3_150 -wget http://$1:9000/trans_buy_f1522_2 -wget http://$1:9000/trans_add_f1523_4_200 -wget http://$1:9000/trans_buy_f1523_3 -wget http://$1:9000/trans_add_f1524_5_50 -wget http://$1:9000/trans_buy_f1524_4 -wget http://$1:9000/trans_add_f1525_1_100 -wget http://$1:9000/trans_buy_f1525_0 -wget http://$1:9000/trans_add_f1526_2_150 -wget http://$1:9000/trans_buy_f1526_1 -wget http://$1:9000/trans_add_f1527_3_200 -wget http://$1:9000/trans_buy_f1527_2 -wget http://$1:9000/trans_add_f1528_4_50 -wget http://$1:9000/trans_buy_f1528_3 -wget http://$1:9000/trans_add_f1529_5_100 -wget http://$1:9000/trans_buy_f1529_4 -wget http://$1:9000/trans_add_f1530_1_150 -wget http://$1:9000/trans_buy_f1530_0 -wget http://$1:9000/trans_add_f1531_2_200 -wget http://$1:9000/trans_buy_f1531_1 -wget http://$1:9000/trans_add_f1532_3_50 -wget http://$1:9000/trans_buy_f1532_2 -wget http://$1:9000/trans_add_f1533_4_100 -wget http://$1:9000/trans_buy_f1533_3 -wget http://$1:9000/trans_add_f1534_5_150 -wget http://$1:9000/trans_buy_f1534_4 -wget http://$1:9000/trans_add_f1535_1_200 -wget http://$1:9000/trans_buy_f1535_0 -wget http://$1:9000/trans_add_f1536_2_50 -wget http://$1:9000/trans_buy_f1536_1 -wget http://$1:9000/trans_add_f1537_3_100 -wget http://$1:9000/trans_buy_f1537_2 -wget http://$1:9000/trans_add_f1538_4_150 -wget http://$1:9000/trans_buy_f1538_3 -wget http://$1:9000/trans_add_f1539_5_200 -wget http://$1:9000/trans_buy_f1539_4 -wget http://$1:9000/trans_add_f1540_1_50 -wget http://$1:9000/trans_buy_f1540_0 -wget http://$1:9000/trans_add_f1541_2_100 -wget http://$1:9000/trans_buy_f1541_1 -wget http://$1:9000/trans_add_f1542_3_150 -wget http://$1:9000/trans_buy_f1542_2 -wget http://$1:9000/trans_add_f1543_4_200 -wget http://$1:9000/trans_buy_f1543_3 -wget http://$1:9000/trans_add_f1544_5_50 -wget http://$1:9000/trans_buy_f1544_4 -wget http://$1:9000/trans_add_f1545_1_100 -wget http://$1:9000/trans_buy_f1545_0 -wget http://$1:9000/trans_add_f1546_2_150 -wget http://$1:9000/trans_buy_f1546_1 -wget http://$1:9000/trans_add_f1547_3_200 -wget http://$1:9000/trans_buy_f1547_2 -wget http://$1:9000/trans_add_f1548_4_50 -wget http://$1:9000/trans_buy_f1548_3 -wget http://$1:9000/trans_add_f1549_5_100 -wget http://$1:9000/trans_buy_f1549_4 -wget http://$1:9000/trans_add_f1550_1_150 -wget http://$1:9000/trans_buy_f1550_0 -wget http://$1:9000/trans_add_f1551_2_200 -wget http://$1:9000/trans_buy_f1551_1 -wget http://$1:9000/trans_add_f1552_3_50 -wget http://$1:9000/trans_buy_f1552_2 -wget http://$1:9000/trans_add_f1553_4_100 -wget http://$1:9000/trans_buy_f1553_3 -wget http://$1:9000/trans_add_f1554_5_150 -wget http://$1:9000/trans_buy_f1554_4 -wget http://$1:9000/trans_add_f1555_1_200 -wget http://$1:9000/trans_buy_f1555_0 -wget http://$1:9000/trans_add_f1556_2_50 -wget http://$1:9000/trans_buy_f1556_1 -wget http://$1:9000/trans_add_f1557_3_100 -wget http://$1:9000/trans_buy_f1557_2 -wget http://$1:9000/trans_add_f1558_4_150 -wget http://$1:9000/trans_buy_f1558_3 -wget http://$1:9000/trans_add_f1559_5_200 -wget http://$1:9000/trans_buy_f1559_4 -wget http://$1:9000/trans_add_f1560_1_50 -wget http://$1:9000/trans_buy_f1560_0 -wget http://$1:9000/trans_add_f1561_2_100 -wget http://$1:9000/trans_buy_f1561_1 -wget http://$1:9000/trans_add_f1562_3_150 -wget http://$1:9000/trans_buy_f1562_2 -wget http://$1:9000/trans_add_f1563_4_200 -wget http://$1:9000/trans_buy_f1563_3 -wget http://$1:9000/trans_add_f1564_5_50 -wget http://$1:9000/trans_buy_f1564_4 -wget http://$1:9000/trans_add_f1565_1_100 -wget http://$1:9000/trans_buy_f1565_0 -wget http://$1:9000/trans_add_f1566_2_150 -wget http://$1:9000/trans_buy_f1566_1 -wget http://$1:9000/trans_add_f1567_3_200 -wget http://$1:9000/trans_buy_f1567_2 -wget http://$1:9000/trans_add_f1568_4_50 -wget http://$1:9000/trans_buy_f1568_3 -wget http://$1:9000/trans_add_f1569_5_100 -wget http://$1:9000/trans_buy_f1569_4 -wget http://$1:9000/trans_add_f1570_1_150 -wget http://$1:9000/trans_buy_f1570_0 -wget http://$1:9000/trans_add_f1571_2_200 -wget http://$1:9000/trans_buy_f1571_1 -wget http://$1:9000/trans_add_f1572_3_50 -wget http://$1:9000/trans_buy_f1572_2 -wget http://$1:9000/trans_add_f1573_4_100 -wget http://$1:9000/trans_buy_f1573_3 -wget http://$1:9000/trans_add_f1574_5_150 -wget http://$1:9000/trans_buy_f1574_4 -wget http://$1:9000/trans_add_f1575_1_200 -wget http://$1:9000/trans_buy_f1575_0 -wget http://$1:9000/trans_add_f1576_2_50 -wget http://$1:9000/trans_buy_f1576_1 -wget http://$1:9000/trans_add_f1577_3_100 -wget http://$1:9000/trans_buy_f1577_2 -wget http://$1:9000/trans_add_f1578_4_150 -wget http://$1:9000/trans_buy_f1578_3 -wget http://$1:9000/trans_add_f1579_5_200 -wget http://$1:9000/trans_buy_f1579_4 -wget http://$1:9000/trans_add_f1580_1_50 -wget http://$1:9000/trans_buy_f1580_0 -wget http://$1:9000/trans_add_f1581_2_100 -wget http://$1:9000/trans_buy_f1581_1 -wget http://$1:9000/trans_add_f1582_3_150 -wget http://$1:9000/trans_buy_f1582_2 -wget http://$1:9000/trans_add_f1583_4_200 -wget http://$1:9000/trans_buy_f1583_3 -wget http://$1:9000/trans_add_f1584_5_50 -wget http://$1:9000/trans_buy_f1584_4 -wget http://$1:9000/trans_add_f1585_1_100 -wget http://$1:9000/trans_buy_f1585_0 -wget http://$1:9000/trans_add_f1586_2_150 -wget http://$1:9000/trans_buy_f1586_1 -wget http://$1:9000/trans_add_f1587_3_200 -wget http://$1:9000/trans_buy_f1587_2 -wget http://$1:9000/trans_add_f1588_4_50 -wget http://$1:9000/trans_buy_f1588_3 -wget http://$1:9000/trans_add_f1589_5_100 -wget http://$1:9000/trans_buy_f1589_4 -wget http://$1:9000/trans_add_f1590_1_150 -wget http://$1:9000/trans_buy_f1590_0 -wget http://$1:9000/trans_add_f1591_2_200 -wget http://$1:9000/trans_buy_f1591_1 -wget http://$1:9000/trans_add_f1592_3_50 -wget http://$1:9000/trans_buy_f1592_2 -wget http://$1:9000/trans_add_f1593_4_100 -wget http://$1:9000/trans_buy_f1593_3 -wget http://$1:9000/trans_add_f1594_5_150 -wget http://$1:9000/trans_buy_f1594_4 -wget http://$1:9000/trans_add_f1595_1_200 -wget http://$1:9000/trans_buy_f1595_0 -wget http://$1:9000/trans_add_f1596_2_50 -wget http://$1:9000/trans_buy_f1596_1 -wget http://$1:9000/trans_add_f1597_3_100 -wget http://$1:9000/trans_buy_f1597_2 -wget http://$1:9000/trans_add_f1598_4_150 -wget http://$1:9000/trans_buy_f1598_3 -wget http://$1:9000/trans_add_f1599_5_200 -wget http://$1:9000/trans_buy_f1599_4 -wget http://$1:9000/trans_add_f1600_1_50 -wget http://$1:9000/trans_buy_f1600_0 -wget http://$1:9000/trans_add_f1601_2_100 -wget http://$1:9000/trans_buy_f1601_1 -wget http://$1:9000/trans_add_f1602_3_150 -wget http://$1:9000/trans_buy_f1602_2 -wget http://$1:9000/trans_add_f1603_4_200 -wget http://$1:9000/trans_buy_f1603_3 -wget http://$1:9000/trans_add_f1604_5_50 -wget http://$1:9000/trans_buy_f1604_4 -wget http://$1:9000/trans_add_f1605_1_100 -wget http://$1:9000/trans_buy_f1605_0 -wget http://$1:9000/trans_add_f1606_2_150 -wget http://$1:9000/trans_buy_f1606_1 -wget http://$1:9000/trans_add_f1607_3_200 -wget http://$1:9000/trans_buy_f1607_2 -wget http://$1:9000/trans_add_f1608_4_50 -wget http://$1:9000/trans_buy_f1608_3 -wget http://$1:9000/trans_add_f1609_5_100 -wget http://$1:9000/trans_buy_f1609_4 -wget http://$1:9000/trans_add_f1610_1_150 -wget http://$1:9000/trans_buy_f1610_0 -wget http://$1:9000/trans_add_f1611_2_200 -wget http://$1:9000/trans_buy_f1611_1 -wget http://$1:9000/trans_add_f1612_3_50 -wget http://$1:9000/trans_buy_f1612_2 -wget http://$1:9000/trans_add_f1613_4_100 -wget http://$1:9000/trans_buy_f1613_3 -wget http://$1:9000/trans_add_f1614_5_150 -wget http://$1:9000/trans_buy_f1614_4 -wget http://$1:9000/trans_add_f1615_1_200 -wget http://$1:9000/trans_buy_f1615_0 -wget http://$1:9000/trans_add_f1616_2_50 -wget http://$1:9000/trans_buy_f1616_1 -wget http://$1:9000/trans_add_f1617_3_100 -wget http://$1:9000/trans_buy_f1617_2 -wget http://$1:9000/trans_add_f1618_4_150 -wget http://$1:9000/trans_buy_f1618_3 -wget http://$1:9000/trans_add_f1619_5_200 -wget http://$1:9000/trans_buy_f1619_4 -wget http://$1:9000/trans_add_f1620_1_50 -wget http://$1:9000/trans_buy_f1620_0 -wget http://$1:9000/trans_add_f1621_2_100 -wget http://$1:9000/trans_buy_f1621_1 -wget http://$1:9000/trans_add_f1622_3_150 -wget http://$1:9000/trans_buy_f1622_2 -wget http://$1:9000/trans_add_f1623_4_200 -wget http://$1:9000/trans_buy_f1623_3 -wget http://$1:9000/trans_add_f1624_5_50 -wget http://$1:9000/trans_buy_f1624_4 -wget http://$1:9000/trans_add_f1625_1_100 -wget http://$1:9000/trans_buy_f1625_0 -wget http://$1:9000/trans_add_f1626_2_150 -wget http://$1:9000/trans_buy_f1626_1 -wget http://$1:9000/trans_add_f1627_3_200 -wget http://$1:9000/trans_buy_f1627_2 -wget http://$1:9000/trans_add_f1628_4_50 -wget http://$1:9000/trans_buy_f1628_3 -wget http://$1:9000/trans_add_f1629_5_100 -wget http://$1:9000/trans_buy_f1629_4 -wget http://$1:9000/trans_add_f1630_1_150 -wget http://$1:9000/trans_buy_f1630_0 -wget http://$1:9000/trans_add_f1631_2_200 -wget http://$1:9000/trans_buy_f1631_1 -wget http://$1:9000/trans_add_f1632_3_50 -wget http://$1:9000/trans_buy_f1632_2 -wget http://$1:9000/trans_add_f1633_4_100 -wget http://$1:9000/trans_buy_f1633_3 -wget http://$1:9000/trans_add_f1634_5_150 -wget http://$1:9000/trans_buy_f1634_4 -wget http://$1:9000/trans_add_f1635_1_200 -wget http://$1:9000/trans_buy_f1635_0 -wget http://$1:9000/trans_add_f1636_2_50 -wget http://$1:9000/trans_buy_f1636_1 -wget http://$1:9000/trans_add_f1637_3_100 -wget http://$1:9000/trans_buy_f1637_2 -wget http://$1:9000/trans_add_f1638_4_150 -wget http://$1:9000/trans_buy_f1638_3 -wget http://$1:9000/trans_add_f1639_5_200 -wget http://$1:9000/trans_buy_f1639_4 -wget http://$1:9000/trans_add_f1640_1_50 -wget http://$1:9000/trans_buy_f1640_0 -wget http://$1:9000/trans_add_f1641_2_100 -wget http://$1:9000/trans_buy_f1641_1 -wget http://$1:9000/trans_add_f1642_3_150 -wget http://$1:9000/trans_buy_f1642_2 -wget http://$1:9000/trans_add_f1643_4_200 -wget http://$1:9000/trans_buy_f1643_3 -wget http://$1:9000/trans_add_f1644_5_50 -wget http://$1:9000/trans_buy_f1644_4 -wget http://$1:9000/trans_add_f1645_1_100 -wget http://$1:9000/trans_buy_f1645_0 -wget http://$1:9000/trans_add_f1646_2_150 -wget http://$1:9000/trans_buy_f1646_1 -wget http://$1:9000/trans_add_f1647_3_200 -wget http://$1:9000/trans_buy_f1647_2 -wget http://$1:9000/trans_add_f1648_4_50 -wget http://$1:9000/trans_buy_f1648_3 -wget http://$1:9000/trans_add_f1649_5_100 -wget http://$1:9000/trans_buy_f1649_4 -wget http://$1:9000/trans_add_f1650_1_150 -wget http://$1:9000/trans_buy_f1650_0 -wget http://$1:9000/trans_add_f1651_2_200 -wget http://$1:9000/trans_buy_f1651_1 -wget http://$1:9000/trans_add_f1652_3_50 -wget http://$1:9000/trans_buy_f1652_2 -wget http://$1:9000/trans_add_f1653_4_100 -wget http://$1:9000/trans_buy_f1653_3 -wget http://$1:9000/trans_add_f1654_5_150 -wget http://$1:9000/trans_buy_f1654_4 -wget http://$1:9000/trans_add_f1655_1_200 -wget http://$1:9000/trans_buy_f1655_0 -wget http://$1:9000/trans_add_f1656_2_50 -wget http://$1:9000/trans_buy_f1656_1 -wget http://$1:9000/trans_add_f1657_3_100 -wget http://$1:9000/trans_buy_f1657_2 -wget http://$1:9000/trans_add_f1658_4_150 -wget http://$1:9000/trans_buy_f1658_3 -wget http://$1:9000/trans_add_f1659_5_200 -wget http://$1:9000/trans_buy_f1659_4 -wget http://$1:9000/trans_add_f1660_1_50 -wget http://$1:9000/trans_buy_f1660_0 -wget http://$1:9000/trans_add_f1661_2_100 -wget http://$1:9000/trans_buy_f1661_1 -wget http://$1:9000/trans_add_f1662_3_150 -wget http://$1:9000/trans_buy_f1662_2 -wget http://$1:9000/trans_add_f1663_4_200 -wget http://$1:9000/trans_buy_f1663_3 -wget http://$1:9000/trans_add_f1664_5_50 -wget http://$1:9000/trans_buy_f1664_4 -wget http://$1:9000/trans_add_f1665_1_100 -wget http://$1:9000/trans_buy_f1665_0 -wget http://$1:9000/trans_add_f1666_2_150 -wget http://$1:9000/trans_buy_f1666_1 -wget http://$1:9000/trans_add_f1667_3_200 -wget http://$1:9000/trans_buy_f1667_2 -wget http://$1:9000/trans_add_f1668_4_50 -wget http://$1:9000/trans_buy_f1668_3 -wget http://$1:9000/trans_add_f1669_5_100 -wget http://$1:9000/trans_buy_f1669_4 -wget http://$1:9000/trans_add_f1670_1_150 -wget http://$1:9000/trans_buy_f1670_0 -wget http://$1:9000/trans_add_f1671_2_200 -wget http://$1:9000/trans_buy_f1671_1 -wget http://$1:9000/trans_add_f1672_3_50 -wget http://$1:9000/trans_buy_f1672_2 -wget http://$1:9000/trans_add_f1673_4_100 -wget http://$1:9000/trans_buy_f1673_3 -wget http://$1:9000/trans_add_f1674_5_150 -wget http://$1:9000/trans_buy_f1674_4 -wget http://$1:9000/trans_add_f1675_1_200 -wget http://$1:9000/trans_buy_f1675_0 -wget http://$1:9000/trans_add_f1676_2_50 -wget http://$1:9000/trans_buy_f1676_1 -wget http://$1:9000/trans_add_f1677_3_100 -wget http://$1:9000/trans_buy_f1677_2 -wget http://$1:9000/trans_add_f1678_4_150 -wget http://$1:9000/trans_buy_f1678_3 -wget http://$1:9000/trans_add_f1679_5_200 -wget http://$1:9000/trans_buy_f1679_4 -wget http://$1:9000/trans_add_f1680_1_50 -wget http://$1:9000/trans_buy_f1680_0 -wget http://$1:9000/trans_add_f1681_2_100 -wget http://$1:9000/trans_buy_f1681_1 -wget http://$1:9000/trans_add_f1682_3_150 -wget http://$1:9000/trans_buy_f1682_2 -wget http://$1:9000/trans_add_f1683_4_200 -wget http://$1:9000/trans_buy_f1683_3 -wget http://$1:9000/trans_add_f1684_5_50 -wget http://$1:9000/trans_buy_f1684_4 -wget http://$1:9000/trans_add_f1685_1_100 -wget http://$1:9000/trans_buy_f1685_0 -wget http://$1:9000/trans_add_f1686_2_150 -wget http://$1:9000/trans_buy_f1686_1 -wget http://$1:9000/trans_add_f1687_3_200 -wget http://$1:9000/trans_buy_f1687_2 -wget http://$1:9000/trans_add_f1688_4_50 -wget http://$1:9000/trans_buy_f1688_3 -wget http://$1:9000/trans_add_f1689_5_100 -wget http://$1:9000/trans_buy_f1689_4 -wget http://$1:9000/trans_add_f1690_1_150 -wget http://$1:9000/trans_buy_f1690_0 -wget http://$1:9000/trans_add_f1691_2_200 -wget http://$1:9000/trans_buy_f1691_1 -wget http://$1:9000/trans_add_f1692_3_50 -wget http://$1:9000/trans_buy_f1692_2 -wget http://$1:9000/trans_add_f1693_4_100 -wget http://$1:9000/trans_buy_f1693_3 -wget http://$1:9000/trans_add_f1694_5_150 -wget http://$1:9000/trans_buy_f1694_4 -wget http://$1:9000/trans_add_f1695_1_200 -wget http://$1:9000/trans_buy_f1695_0 -wget http://$1:9000/trans_add_f1696_2_50 -wget http://$1:9000/trans_buy_f1696_1 -wget http://$1:9000/trans_add_f1697_3_100 -wget http://$1:9000/trans_buy_f1697_2 -wget http://$1:9000/trans_add_f1698_4_150 -wget http://$1:9000/trans_buy_f1698_3 -wget http://$1:9000/trans_add_f1699_5_200 -wget http://$1:9000/trans_buy_f1699_4 -wget http://$1:9000/trans_add_f1700_1_50 -wget http://$1:9000/trans_buy_f1700_0 -wget http://$1:9000/trans_add_f1701_2_100 -wget http://$1:9000/trans_buy_f1701_1 -wget http://$1:9000/trans_add_f1702_3_150 -wget http://$1:9000/trans_buy_f1702_2 -wget http://$1:9000/trans_add_f1703_4_200 -wget http://$1:9000/trans_buy_f1703_3 -wget http://$1:9000/trans_add_f1704_5_50 -wget http://$1:9000/trans_buy_f1704_4 -wget http://$1:9000/trans_add_f1705_1_100 -wget http://$1:9000/trans_buy_f1705_0 -wget http://$1:9000/trans_add_f1706_2_150 -wget http://$1:9000/trans_buy_f1706_1 -wget http://$1:9000/trans_add_f1707_3_200 -wget http://$1:9000/trans_buy_f1707_2 -wget http://$1:9000/trans_add_f1708_4_50 -wget http://$1:9000/trans_buy_f1708_3 -wget http://$1:9000/trans_add_f1709_5_100 -wget http://$1:9000/trans_buy_f1709_4 -wget http://$1:9000/trans_add_f1710_1_150 -wget http://$1:9000/trans_buy_f1710_0 -wget http://$1:9000/trans_add_f1711_2_200 -wget http://$1:9000/trans_buy_f1711_1 -wget http://$1:9000/trans_add_f1712_3_50 -wget http://$1:9000/trans_buy_f1712_2 -wget http://$1:9000/trans_add_f1713_4_100 -wget http://$1:9000/trans_buy_f1713_3 -wget http://$1:9000/trans_add_f1714_5_150 -wget http://$1:9000/trans_buy_f1714_4 -wget http://$1:9000/trans_add_f1715_1_200 -wget http://$1:9000/trans_buy_f1715_0 -wget http://$1:9000/trans_add_f1716_2_50 -wget http://$1:9000/trans_buy_f1716_1 -wget http://$1:9000/trans_add_f1717_3_100 -wget http://$1:9000/trans_buy_f1717_2 -wget http://$1:9000/trans_add_f1718_4_150 -wget http://$1:9000/trans_buy_f1718_3 -wget http://$1:9000/trans_add_f1719_5_200 -wget http://$1:9000/trans_buy_f1719_4 -wget http://$1:9000/trans_add_f1720_1_50 -wget http://$1:9000/trans_buy_f1720_0 -wget http://$1:9000/trans_add_f1721_2_100 -wget http://$1:9000/trans_buy_f1721_1 -wget http://$1:9000/trans_add_f1722_3_150 -wget http://$1:9000/trans_buy_f1722_2 -wget http://$1:9000/trans_add_f1723_4_200 -wget http://$1:9000/trans_buy_f1723_3 -wget http://$1:9000/trans_add_f1724_5_50 -wget http://$1:9000/trans_buy_f1724_4 -wget http://$1:9000/trans_add_f1725_1_100 -wget http://$1:9000/trans_buy_f1725_0 -wget http://$1:9000/trans_add_f1726_2_150 -wget http://$1:9000/trans_buy_f1726_1 -wget http://$1:9000/trans_add_f1727_3_200 -wget http://$1:9000/trans_buy_f1727_2 -wget http://$1:9000/trans_add_f1728_4_50 -wget http://$1:9000/trans_buy_f1728_3 -wget http://$1:9000/trans_add_f1729_5_100 -wget http://$1:9000/trans_buy_f1729_4 -wget http://$1:9000/trans_add_f1730_1_150 -wget http://$1:9000/trans_buy_f1730_0 -wget http://$1:9000/trans_add_f1731_2_200 -wget http://$1:9000/trans_buy_f1731_1 -wget http://$1:9000/trans_add_f1732_3_50 -wget http://$1:9000/trans_buy_f1732_2 -wget http://$1:9000/trans_add_f1733_4_100 -wget http://$1:9000/trans_buy_f1733_3 -wget http://$1:9000/trans_add_f1734_5_150 -wget http://$1:9000/trans_buy_f1734_4 -wget http://$1:9000/trans_add_f1735_1_200 -wget http://$1:9000/trans_buy_f1735_0 -wget http://$1:9000/trans_add_f1736_2_50 -wget http://$1:9000/trans_buy_f1736_1 -wget http://$1:9000/trans_add_f1737_3_100 -wget http://$1:9000/trans_buy_f1737_2 -wget http://$1:9000/trans_add_f1738_4_150 -wget http://$1:9000/trans_buy_f1738_3 -wget http://$1:9000/trans_add_f1739_5_200 -wget http://$1:9000/trans_buy_f1739_4 -wget http://$1:9000/trans_add_f1740_1_50 -wget http://$1:9000/trans_buy_f1740_0 -wget http://$1:9000/trans_add_f1741_2_100 -wget http://$1:9000/trans_buy_f1741_1 -wget http://$1:9000/trans_add_f1742_3_150 -wget http://$1:9000/trans_buy_f1742_2 -wget http://$1:9000/trans_add_f1743_4_200 -wget http://$1:9000/trans_buy_f1743_3 -wget http://$1:9000/trans_add_f1744_5_50 -wget http://$1:9000/trans_buy_f1744_4 -wget http://$1:9000/trans_add_f1745_1_100 -wget http://$1:9000/trans_buy_f1745_0 -wget http://$1:9000/trans_add_f1746_2_150 -wget http://$1:9000/trans_buy_f1746_1 -wget http://$1:9000/trans_add_f1747_3_200 -wget http://$1:9000/trans_buy_f1747_2 -wget http://$1:9000/trans_add_f1748_4_50 -wget http://$1:9000/trans_buy_f1748_3 -wget http://$1:9000/trans_add_f1749_5_100 -wget http://$1:9000/trans_buy_f1749_4 -wget http://$1:9000/trans_add_f1750_1_150 -wget http://$1:9000/trans_buy_f1750_0 -wget http://$1:9000/trans_add_f1751_2_200 -wget http://$1:9000/trans_buy_f1751_1 -wget http://$1:9000/trans_add_f1752_3_50 -wget http://$1:9000/trans_buy_f1752_2 -wget http://$1:9000/trans_add_f1753_4_100 -wget http://$1:9000/trans_buy_f1753_3 -wget http://$1:9000/trans_add_f1754_5_150 -wget http://$1:9000/trans_buy_f1754_4 -wget http://$1:9000/trans_add_f1755_1_200 -wget http://$1:9000/trans_buy_f1755_0 -wget http://$1:9000/trans_add_f1756_2_50 -wget http://$1:9000/trans_buy_f1756_1 -wget http://$1:9000/trans_add_f1757_3_100 -wget http://$1:9000/trans_buy_f1757_2 -wget http://$1:9000/trans_add_f1758_4_150 -wget http://$1:9000/trans_buy_f1758_3 -wget http://$1:9000/trans_add_f1759_5_200 -wget http://$1:9000/trans_buy_f1759_4 -wget http://$1:9000/trans_add_f1760_1_50 -wget http://$1:9000/trans_buy_f1760_0 -wget http://$1:9000/trans_add_f1761_2_100 -wget http://$1:9000/trans_buy_f1761_1 -wget http://$1:9000/trans_add_f1762_3_150 -wget http://$1:9000/trans_buy_f1762_2 -wget http://$1:9000/trans_add_f1763_4_200 -wget http://$1:9000/trans_buy_f1763_3 -wget http://$1:9000/trans_add_f1764_5_50 -wget http://$1:9000/trans_buy_f1764_4 -wget http://$1:9000/trans_add_f1765_1_100 -wget http://$1:9000/trans_buy_f1765_0 -wget http://$1:9000/trans_add_f1766_2_150 -wget http://$1:9000/trans_buy_f1766_1 -wget http://$1:9000/trans_add_f1767_3_200 -wget http://$1:9000/trans_buy_f1767_2 -wget http://$1:9000/trans_add_f1768_4_50 -wget http://$1:9000/trans_buy_f1768_3 -wget http://$1:9000/trans_add_f1769_5_100 -wget http://$1:9000/trans_buy_f1769_4 -wget http://$1:9000/trans_add_f1770_1_150 -wget http://$1:9000/trans_buy_f1770_0 -wget http://$1:9000/trans_add_f1771_2_200 -wget http://$1:9000/trans_buy_f1771_1 -wget http://$1:9000/trans_add_f1772_3_50 -wget http://$1:9000/trans_buy_f1772_2 -wget http://$1:9000/trans_add_f1773_4_100 -wget http://$1:9000/trans_buy_f1773_3 -wget http://$1:9000/trans_add_f1774_5_150 -wget http://$1:9000/trans_buy_f1774_4 -wget http://$1:9000/trans_add_f1775_1_200 -wget http://$1:9000/trans_buy_f1775_0 -wget http://$1:9000/trans_add_f1776_2_50 -wget http://$1:9000/trans_buy_f1776_1 -wget http://$1:9000/trans_add_f1777_3_100 -wget http://$1:9000/trans_buy_f1777_2 -wget http://$1:9000/trans_add_f1778_4_150 -wget http://$1:9000/trans_buy_f1778_3 -wget http://$1:9000/trans_add_f1779_5_200 -wget http://$1:9000/trans_buy_f1779_4 -wget http://$1:9000/trans_add_f1780_1_50 -wget http://$1:9000/trans_buy_f1780_0 -wget http://$1:9000/trans_add_f1781_2_100 -wget http://$1:9000/trans_buy_f1781_1 -wget http://$1:9000/trans_add_f1782_3_150 -wget http://$1:9000/trans_buy_f1782_2 -wget http://$1:9000/trans_add_f1783_4_200 -wget http://$1:9000/trans_buy_f1783_3 -wget http://$1:9000/trans_add_f1784_5_50 -wget http://$1:9000/trans_buy_f1784_4 -wget http://$1:9000/trans_add_f1785_1_100 -wget http://$1:9000/trans_buy_f1785_0 -wget http://$1:9000/trans_add_f1786_2_150 -wget http://$1:9000/trans_buy_f1786_1 -wget http://$1:9000/trans_add_f1787_3_200 -wget http://$1:9000/trans_buy_f1787_2 -wget http://$1:9000/trans_add_f1788_4_50 -wget http://$1:9000/trans_buy_f1788_3 -wget http://$1:9000/trans_add_f1789_5_100 -wget http://$1:9000/trans_buy_f1789_4 -wget http://$1:9000/trans_add_f1790_1_150 -wget http://$1:9000/trans_buy_f1790_0 -wget http://$1:9000/trans_add_f1791_2_200 -wget http://$1:9000/trans_buy_f1791_1 -wget http://$1:9000/trans_add_f1792_3_50 -wget http://$1:9000/trans_buy_f1792_2 -wget http://$1:9000/trans_add_f1793_4_100 -wget http://$1:9000/trans_buy_f1793_3 -wget http://$1:9000/trans_add_f1794_5_150 -wget http://$1:9000/trans_buy_f1794_4 -wget http://$1:9000/trans_add_f1795_1_200 -wget http://$1:9000/trans_buy_f1795_0 -wget http://$1:9000/trans_add_f1796_2_50 -wget http://$1:9000/trans_buy_f1796_1 -wget http://$1:9000/trans_add_f1797_3_100 -wget http://$1:9000/trans_buy_f1797_2 -wget http://$1:9000/trans_add_f1798_4_150 -wget http://$1:9000/trans_buy_f1798_3 -wget http://$1:9000/trans_add_f1799_5_200 -wget http://$1:9000/trans_buy_f1799_4 -wget http://$1:9000/trans_add_f1800_1_50 -wget http://$1:9000/trans_buy_f1800_0 -wget http://$1:9000/trans_add_f1801_2_100 -wget http://$1:9000/trans_buy_f1801_1 -wget http://$1:9000/trans_add_f1802_3_150 -wget http://$1:9000/trans_buy_f1802_2 -wget http://$1:9000/trans_add_f1803_4_200 -wget http://$1:9000/trans_buy_f1803_3 -wget http://$1:9000/trans_add_f1804_5_50 -wget http://$1:9000/trans_buy_f1804_4 -wget http://$1:9000/trans_add_f1805_1_100 -wget http://$1:9000/trans_buy_f1805_0 -wget http://$1:9000/trans_add_f1806_2_150 -wget http://$1:9000/trans_buy_f1806_1 -wget http://$1:9000/trans_add_f1807_3_200 -wget http://$1:9000/trans_buy_f1807_2 -wget http://$1:9000/trans_add_f1808_4_50 -wget http://$1:9000/trans_buy_f1808_3 -wget http://$1:9000/trans_add_f1809_5_100 -wget http://$1:9000/trans_buy_f1809_4 -wget http://$1:9000/trans_add_f1810_1_150 -wget http://$1:9000/trans_buy_f1810_0 -wget http://$1:9000/trans_add_f1811_2_200 -wget http://$1:9000/trans_buy_f1811_1 -wget http://$1:9000/trans_add_f1812_3_50 -wget http://$1:9000/trans_buy_f1812_2 -wget http://$1:9000/trans_add_f1813_4_100 -wget http://$1:9000/trans_buy_f1813_3 -wget http://$1:9000/trans_add_f1814_5_150 -wget http://$1:9000/trans_buy_f1814_4 -wget http://$1:9000/trans_add_f1815_1_200 -wget http://$1:9000/trans_buy_f1815_0 -wget http://$1:9000/trans_add_f1816_2_50 -wget http://$1:9000/trans_buy_f1816_1 -wget http://$1:9000/trans_add_f1817_3_100 -wget http://$1:9000/trans_buy_f1817_2 -wget http://$1:9000/trans_add_f1818_4_150 -wget http://$1:9000/trans_buy_f1818_3 -wget http://$1:9000/trans_add_f1819_5_200 -wget http://$1:9000/trans_buy_f1819_4 -wget http://$1:9000/trans_add_f1820_1_50 -wget http://$1:9000/trans_buy_f1820_0 -wget http://$1:9000/trans_add_f1821_2_100 -wget http://$1:9000/trans_buy_f1821_1 -wget http://$1:9000/trans_add_f1822_3_150 -wget http://$1:9000/trans_buy_f1822_2 -wget http://$1:9000/trans_add_f1823_4_200 -wget http://$1:9000/trans_buy_f1823_3 -wget http://$1:9000/trans_add_f1824_5_50 -wget http://$1:9000/trans_buy_f1824_4 -wget http://$1:9000/trans_add_f1825_1_100 -wget http://$1:9000/trans_buy_f1825_0 -wget http://$1:9000/trans_add_f1826_2_150 -wget http://$1:9000/trans_buy_f1826_1 -wget http://$1:9000/trans_add_f1827_3_200 -wget http://$1:9000/trans_buy_f1827_2 -wget http://$1:9000/trans_add_f1828_4_50 -wget http://$1:9000/trans_buy_f1828_3 -wget http://$1:9000/trans_add_f1829_5_100 -wget http://$1:9000/trans_buy_f1829_4 -wget http://$1:9000/trans_add_f1830_1_150 -wget http://$1:9000/trans_buy_f1830_0 -wget http://$1:9000/trans_add_f1831_2_200 -wget http://$1:9000/trans_buy_f1831_1 -wget http://$1:9000/trans_add_f1832_3_50 -wget http://$1:9000/trans_buy_f1832_2 -wget http://$1:9000/trans_add_f1833_4_100 -wget http://$1:9000/trans_buy_f1833_3 -wget http://$1:9000/trans_add_f1834_5_150 -wget http://$1:9000/trans_buy_f1834_4 -wget http://$1:9000/trans_add_f1835_1_200 -wget http://$1:9000/trans_buy_f1835_0 -wget http://$1:9000/trans_add_f1836_2_50 -wget http://$1:9000/trans_buy_f1836_1 -wget http://$1:9000/trans_add_f1837_3_100 -wget http://$1:9000/trans_buy_f1837_2 -wget http://$1:9000/trans_add_f1838_4_150 -wget http://$1:9000/trans_buy_f1838_3 -wget http://$1:9000/trans_add_f1839_5_200 -wget http://$1:9000/trans_buy_f1839_4 -wget http://$1:9000/trans_add_f1840_1_50 -wget http://$1:9000/trans_buy_f1840_0 -wget http://$1:9000/trans_add_f1841_2_100 -wget http://$1:9000/trans_buy_f1841_1 -wget http://$1:9000/trans_add_f1842_3_150 -wget http://$1:9000/trans_buy_f1842_2 -wget http://$1:9000/trans_add_f1843_4_200 -wget http://$1:9000/trans_buy_f1843_3 -wget http://$1:9000/trans_add_f1844_5_50 -wget http://$1:9000/trans_buy_f1844_4 -wget http://$1:9000/trans_add_f1845_1_100 -wget http://$1:9000/trans_buy_f1845_0 -wget http://$1:9000/trans_add_f1846_2_150 -wget http://$1:9000/trans_buy_f1846_1 -wget http://$1:9000/trans_add_f1847_3_200 -wget http://$1:9000/trans_buy_f1847_2 -wget http://$1:9000/trans_add_f1848_4_50 -wget http://$1:9000/trans_buy_f1848_3 -wget http://$1:9000/trans_add_f1849_5_100 -wget http://$1:9000/trans_buy_f1849_4 -wget http://$1:9000/trans_add_f1850_1_150 -wget http://$1:9000/trans_buy_f1850_0 -wget http://$1:9000/trans_add_f1851_2_200 -wget http://$1:9000/trans_buy_f1851_1 -wget http://$1:9000/trans_add_f1852_3_50 -wget http://$1:9000/trans_buy_f1852_2 -wget http://$1:9000/trans_add_f1853_4_100 -wget http://$1:9000/trans_buy_f1853_3 -wget http://$1:9000/trans_add_f1854_5_150 -wget http://$1:9000/trans_buy_f1854_4 -wget http://$1:9000/trans_add_f1855_1_200 -wget http://$1:9000/trans_buy_f1855_0 -wget http://$1:9000/trans_add_f1856_2_50 -wget http://$1:9000/trans_buy_f1856_1 -wget http://$1:9000/trans_add_f1857_3_100 -wget http://$1:9000/trans_buy_f1857_2 -wget http://$1:9000/trans_add_f1858_4_150 -wget http://$1:9000/trans_buy_f1858_3 -wget http://$1:9000/trans_add_f1859_5_200 -wget http://$1:9000/trans_buy_f1859_4 -wget http://$1:9000/trans_add_f1860_1_50 -wget http://$1:9000/trans_buy_f1860_0 -wget http://$1:9000/trans_add_f1861_2_100 -wget http://$1:9000/trans_buy_f1861_1 -wget http://$1:9000/trans_add_f1862_3_150 -wget http://$1:9000/trans_buy_f1862_2 -wget http://$1:9000/trans_add_f1863_4_200 -wget http://$1:9000/trans_buy_f1863_3 -wget http://$1:9000/trans_add_f1864_5_50 -wget http://$1:9000/trans_buy_f1864_4 -wget http://$1:9000/trans_add_f1865_1_100 -wget http://$1:9000/trans_buy_f1865_0 -wget http://$1:9000/trans_add_f1866_2_150 -wget http://$1:9000/trans_buy_f1866_1 -wget http://$1:9000/trans_add_f1867_3_200 -wget http://$1:9000/trans_buy_f1867_2 -wget http://$1:9000/trans_add_f1868_4_50 -wget http://$1:9000/trans_buy_f1868_3 -wget http://$1:9000/trans_add_f1869_5_100 -wget http://$1:9000/trans_buy_f1869_4 -wget http://$1:9000/trans_add_f1870_1_150 -wget http://$1:9000/trans_buy_f1870_0 -wget http://$1:9000/trans_add_f1871_2_200 -wget http://$1:9000/trans_buy_f1871_1 -wget http://$1:9000/trans_add_f1872_3_50 -wget http://$1:9000/trans_buy_f1872_2 -wget http://$1:9000/trans_add_f1873_4_100 -wget http://$1:9000/trans_buy_f1873_3 -wget http://$1:9000/trans_add_f1874_5_150 -wget http://$1:9000/trans_buy_f1874_4 -wget http://$1:9000/trans_add_f1875_1_200 -wget http://$1:9000/trans_buy_f1875_0 -wget http://$1:9000/trans_add_f1876_2_50 -wget http://$1:9000/trans_buy_f1876_1 -wget http://$1:9000/trans_add_f1877_3_100 -wget http://$1:9000/trans_buy_f1877_2 -wget http://$1:9000/trans_add_f1878_4_150 -wget http://$1:9000/trans_buy_f1878_3 -wget http://$1:9000/trans_add_f1879_5_200 -wget http://$1:9000/trans_buy_f1879_4 -wget http://$1:9000/trans_add_f1880_1_50 -wget http://$1:9000/trans_buy_f1880_0 -wget http://$1:9000/trans_add_f1881_2_100 -wget http://$1:9000/trans_buy_f1881_1 -wget http://$1:9000/trans_add_f1882_3_150 -wget http://$1:9000/trans_buy_f1882_2 -wget http://$1:9000/trans_add_f1883_4_200 -wget http://$1:9000/trans_buy_f1883_3 -wget http://$1:9000/trans_add_f1884_5_50 -wget http://$1:9000/trans_buy_f1884_4 -wget http://$1:9000/trans_add_f1885_1_100 -wget http://$1:9000/trans_buy_f1885_0 -wget http://$1:9000/trans_add_f1886_2_150 -wget http://$1:9000/trans_buy_f1886_1 -wget http://$1:9000/trans_add_f1887_3_200 -wget http://$1:9000/trans_buy_f1887_2 -wget http://$1:9000/trans_add_f1888_4_50 -wget http://$1:9000/trans_buy_f1888_3 -wget http://$1:9000/trans_add_f1889_5_100 -wget http://$1:9000/trans_buy_f1889_4 -wget http://$1:9000/trans_add_f1890_1_150 -wget http://$1:9000/trans_buy_f1890_0 -wget http://$1:9000/trans_add_f1891_2_200 -wget http://$1:9000/trans_buy_f1891_1 -wget http://$1:9000/trans_add_f1892_3_50 -wget http://$1:9000/trans_buy_f1892_2 -wget http://$1:9000/trans_add_f1893_4_100 -wget http://$1:9000/trans_buy_f1893_3 -wget http://$1:9000/trans_add_f1894_5_150 -wget http://$1:9000/trans_buy_f1894_4 -wget http://$1:9000/trans_add_f1895_1_200 -wget http://$1:9000/trans_buy_f1895_0 -wget http://$1:9000/trans_add_f1896_2_50 -wget http://$1:9000/trans_buy_f1896_1 -wget http://$1:9000/trans_add_f1897_3_100 -wget http://$1:9000/trans_buy_f1897_2 -wget http://$1:9000/trans_add_f1898_4_150 -wget http://$1:9000/trans_buy_f1898_3 -wget http://$1:9000/trans_add_f1899_5_200 -wget http://$1:9000/trans_buy_f1899_4 -wget http://$1:9000/trans_add_f1900_1_50 -wget http://$1:9000/trans_buy_f1900_0 -wget http://$1:9000/trans_add_f1901_2_100 -wget http://$1:9000/trans_buy_f1901_1 -wget http://$1:9000/trans_add_f1902_3_150 -wget http://$1:9000/trans_buy_f1902_2 -wget http://$1:9000/trans_add_f1903_4_200 -wget http://$1:9000/trans_buy_f1903_3 -wget http://$1:9000/trans_add_f1904_5_50 -wget http://$1:9000/trans_buy_f1904_4 -wget http://$1:9000/trans_add_f1905_1_100 -wget http://$1:9000/trans_buy_f1905_0 -wget http://$1:9000/trans_add_f1906_2_150 -wget http://$1:9000/trans_buy_f1906_1 -wget http://$1:9000/trans_add_f1907_3_200 -wget http://$1:9000/trans_buy_f1907_2 -wget http://$1:9000/trans_add_f1908_4_50 -wget http://$1:9000/trans_buy_f1908_3 -wget http://$1:9000/trans_add_f1909_5_100 -wget http://$1:9000/trans_buy_f1909_4 -wget http://$1:9000/trans_add_f1910_1_150 -wget http://$1:9000/trans_buy_f1910_0 -wget http://$1:9000/trans_add_f1911_2_200 -wget http://$1:9000/trans_buy_f1911_1 -wget http://$1:9000/trans_add_f1912_3_50 -wget http://$1:9000/trans_buy_f1912_2 -wget http://$1:9000/trans_add_f1913_4_100 -wget http://$1:9000/trans_buy_f1913_3 -wget http://$1:9000/trans_add_f1914_5_150 -wget http://$1:9000/trans_buy_f1914_4 -wget http://$1:9000/trans_add_f1915_1_200 -wget http://$1:9000/trans_buy_f1915_0 -wget http://$1:9000/trans_add_f1916_2_50 -wget http://$1:9000/trans_buy_f1916_1 -wget http://$1:9000/trans_add_f1917_3_100 -wget http://$1:9000/trans_buy_f1917_2 -wget http://$1:9000/trans_add_f1918_4_150 -wget http://$1:9000/trans_buy_f1918_3 -wget http://$1:9000/trans_add_f1919_5_200 -wget http://$1:9000/trans_buy_f1919_4 -wget http://$1:9000/trans_add_f1920_1_50 -wget http://$1:9000/trans_buy_f1920_0 -wget http://$1:9000/trans_add_f1921_2_100 -wget http://$1:9000/trans_buy_f1921_1 -wget http://$1:9000/trans_add_f1922_3_150 -wget http://$1:9000/trans_buy_f1922_2 -wget http://$1:9000/trans_add_f1923_4_200 -wget http://$1:9000/trans_buy_f1923_3 -wget http://$1:9000/trans_add_f1924_5_50 -wget http://$1:9000/trans_buy_f1924_4 -wget http://$1:9000/trans_add_f1925_1_100 -wget http://$1:9000/trans_buy_f1925_0 -wget http://$1:9000/trans_add_f1926_2_150 -wget http://$1:9000/trans_buy_f1926_1 -wget http://$1:9000/trans_add_f1927_3_200 -wget http://$1:9000/trans_buy_f1927_2 -wget http://$1:9000/trans_add_f1928_4_50 -wget http://$1:9000/trans_buy_f1928_3 -wget http://$1:9000/trans_add_f1929_5_100 -wget http://$1:9000/trans_buy_f1929_4 -wget http://$1:9000/trans_add_f1930_1_150 -wget http://$1:9000/trans_buy_f1930_0 -wget http://$1:9000/trans_add_f1931_2_200 -wget http://$1:9000/trans_buy_f1931_1 -wget http://$1:9000/trans_add_f1932_3_50 -wget http://$1:9000/trans_buy_f1932_2 -wget http://$1:9000/trans_add_f1933_4_100 -wget http://$1:9000/trans_buy_f1933_3 -wget http://$1:9000/trans_add_f1934_5_150 -wget http://$1:9000/trans_buy_f1934_4 -wget http://$1:9000/trans_add_f1935_1_200 -wget http://$1:9000/trans_buy_f1935_0 -wget http://$1:9000/trans_add_f1936_2_50 -wget http://$1:9000/trans_buy_f1936_1 -wget http://$1:9000/trans_add_f1937_3_100 -wget http://$1:9000/trans_buy_f1937_2 -wget http://$1:9000/trans_add_f1938_4_150 -wget http://$1:9000/trans_buy_f1938_3 -wget http://$1:9000/trans_add_f1939_5_200 -wget http://$1:9000/trans_buy_f1939_4 -wget http://$1:9000/trans_add_f1940_1_50 -wget http://$1:9000/trans_buy_f1940_0 -wget http://$1:9000/trans_add_f1941_2_100 -wget http://$1:9000/trans_buy_f1941_1 -wget http://$1:9000/trans_add_f1942_3_150 -wget http://$1:9000/trans_buy_f1942_2 -wget http://$1:9000/trans_add_f1943_4_200 -wget http://$1:9000/trans_buy_f1943_3 -wget http://$1:9000/trans_add_f1944_5_50 -wget http://$1:9000/trans_buy_f1944_4 -wget http://$1:9000/trans_add_f1945_1_100 -wget http://$1:9000/trans_buy_f1945_0 -wget http://$1:9000/trans_add_f1946_2_150 -wget http://$1:9000/trans_buy_f1946_1 -wget http://$1:9000/trans_add_f1947_3_200 -wget http://$1:9000/trans_buy_f1947_2 -wget http://$1:9000/trans_add_f1948_4_50 -wget http://$1:9000/trans_buy_f1948_3 -wget http://$1:9000/trans_add_f1949_5_100 -wget http://$1:9000/trans_buy_f1949_4 -wget http://$1:9000/trans_add_f1950_1_150 -wget http://$1:9000/trans_buy_f1950_0 -wget http://$1:9000/trans_add_f1951_2_200 -wget http://$1:9000/trans_buy_f1951_1 -wget http://$1:9000/trans_add_f1952_3_50 -wget http://$1:9000/trans_buy_f1952_2 -wget http://$1:9000/trans_add_f1953_4_100 -wget http://$1:9000/trans_buy_f1953_3 -wget http://$1:9000/trans_add_f1954_5_150 -wget http://$1:9000/trans_buy_f1954_4 -wget http://$1:9000/trans_add_f1955_1_200 -wget http://$1:9000/trans_buy_f1955_0 -wget http://$1:9000/trans_add_f1956_2_50 -wget http://$1:9000/trans_buy_f1956_1 -wget http://$1:9000/trans_add_f1957_3_100 -wget http://$1:9000/trans_buy_f1957_2 -wget http://$1:9000/trans_add_f1958_4_150 -wget http://$1:9000/trans_buy_f1958_3 -wget http://$1:9000/trans_add_f1959_5_200 -wget http://$1:9000/trans_buy_f1959_4 -wget http://$1:9000/trans_add_f1960_1_50 -wget http://$1:9000/trans_buy_f1960_0 -wget http://$1:9000/trans_add_f1961_2_100 -wget http://$1:9000/trans_buy_f1961_1 -wget http://$1:9000/trans_add_f1962_3_150 -wget http://$1:9000/trans_buy_f1962_2 -wget http://$1:9000/trans_add_f1963_4_200 -wget http://$1:9000/trans_buy_f1963_3 -wget http://$1:9000/trans_add_f1964_5_50 -wget http://$1:9000/trans_buy_f1964_4 -wget http://$1:9000/trans_add_f1965_1_100 -wget http://$1:9000/trans_buy_f1965_0 -wget http://$1:9000/trans_add_f1966_2_150 -wget http://$1:9000/trans_buy_f1966_1 -wget http://$1:9000/trans_add_f1967_3_200 -wget http://$1:9000/trans_buy_f1967_2 -wget http://$1:9000/trans_add_f1968_4_50 -wget http://$1:9000/trans_buy_f1968_3 -wget http://$1:9000/trans_add_f1969_5_100 -wget http://$1:9000/trans_buy_f1969_4 -wget http://$1:9000/trans_add_f1970_1_150 -wget http://$1:9000/trans_buy_f1970_0 -wget http://$1:9000/trans_add_f1971_2_200 -wget http://$1:9000/trans_buy_f1971_1 -wget http://$1:9000/trans_add_f1972_3_50 -wget http://$1:9000/trans_buy_f1972_2 -wget http://$1:9000/trans_add_f1973_4_100 -wget http://$1:9000/trans_buy_f1973_3 -wget http://$1:9000/trans_add_f1974_5_150 -wget http://$1:9000/trans_buy_f1974_4 -wget http://$1:9000/trans_add_f1975_1_200 -wget http://$1:9000/trans_buy_f1975_0 -wget http://$1:9000/trans_add_f1976_2_50 -wget http://$1:9000/trans_buy_f1976_1 -wget http://$1:9000/trans_add_f1977_3_100 -wget http://$1:9000/trans_buy_f1977_2 -wget http://$1:9000/trans_add_f1978_4_150 -wget http://$1:9000/trans_buy_f1978_3 -wget http://$1:9000/trans_add_f1979_5_200 -wget http://$1:9000/trans_buy_f1979_4 -wget http://$1:9000/trans_add_f1980_1_50 -wget http://$1:9000/trans_buy_f1980_0 -wget http://$1:9000/trans_add_f1981_2_100 -wget http://$1:9000/trans_buy_f1981_1 -wget http://$1:9000/trans_add_f1982_3_150 -wget http://$1:9000/trans_buy_f1982_2 -wget http://$1:9000/trans_add_f1983_4_200 -wget http://$1:9000/trans_buy_f1983_3 -wget http://$1:9000/trans_add_f1984_5_50 -wget http://$1:9000/trans_buy_f1984_4 -wget http://$1:9000/trans_add_f1985_1_100 -wget http://$1:9000/trans_buy_f1985_0 -wget http://$1:9000/trans_add_f1986_2_150 -wget http://$1:9000/trans_buy_f1986_1 -wget http://$1:9000/trans_add_f1987_3_200 -wget http://$1:9000/trans_buy_f1987_2 -wget http://$1:9000/trans_add_f1988_4_50 -wget http://$1:9000/trans_buy_f1988_3 -wget http://$1:9000/trans_add_f1989_5_100 -wget http://$1:9000/trans_buy_f1989_4 -wget http://$1:9000/trans_add_f1990_1_150 -wget http://$1:9000/trans_buy_f1990_0 -wget http://$1:9000/trans_add_f1991_2_200 -wget http://$1:9000/trans_buy_f1991_1 -wget http://$1:9000/trans_add_f1992_3_50 -wget http://$1:9000/trans_buy_f1992_2 -wget http://$1:9000/trans_add_f1993_4_100 -wget http://$1:9000/trans_buy_f1993_3 -wget http://$1:9000/trans_add_f1994_5_150 -wget http://$1:9000/trans_buy_f1994_4 -wget http://$1:9000/trans_add_f1995_1_200 -wget http://$1:9000/trans_buy_f1995_0 -wget http://$1:9000/trans_add_f1996_2_50 -wget http://$1:9000/trans_buy_f1996_1 -wget http://$1:9000/trans_add_f1997_3_100 -wget http://$1:9000/trans_buy_f1997_2 -wget http://$1:9000/trans_add_f1998_4_150 -wget http://$1:9000/trans_buy_f1998_3 -wget http://$1:9000/trans_add_f1999_5_200 -wget http://$1:9000/trans_buy_f1999_4 -wget http://$1:9000/trans_add_f2000_1_50 -wget http://$1:9000/trans_buy_f2000_0 -wget http://$1:9000/trans_add_f2001_2_100 -wget http://$1:9000/trans_buy_f2001_1 -wget http://$1:9000/trans_add_f2002_3_150 -wget http://$1:9000/trans_buy_f2002_2 -wget http://$1:9000/trans_add_f2003_4_200 -wget http://$1:9000/trans_buy_f2003_3 -wget http://$1:9000/trans_add_f2004_5_50 -wget http://$1:9000/trans_buy_f2004_4 -wget http://$1:9000/trans_add_f2005_1_100 -wget http://$1:9000/trans_buy_f2005_0 -wget http://$1:9000/trans_add_f2006_2_150 -wget http://$1:9000/trans_buy_f2006_1 -wget http://$1:9000/trans_add_f2007_3_200 -wget http://$1:9000/trans_buy_f2007_2 -wget http://$1:9000/trans_add_f2008_4_50 -wget http://$1:9000/trans_buy_f2008_3 -wget http://$1:9000/trans_add_f2009_5_100 -wget http://$1:9000/trans_buy_f2009_4 -wget http://$1:9000/trans_add_f2010_1_150 -wget http://$1:9000/trans_buy_f2010_0 -wget http://$1:9000/trans_add_f2011_2_200 -wget http://$1:9000/trans_buy_f2011_1 -wget http://$1:9000/trans_add_f2012_3_50 -wget http://$1:9000/trans_buy_f2012_2 -wget http://$1:9000/trans_add_f2013_4_100 -wget http://$1:9000/trans_buy_f2013_3 -wget http://$1:9000/trans_add_f2014_5_150 -wget http://$1:9000/trans_buy_f2014_4 -wget http://$1:9000/trans_add_f2015_1_200 -wget http://$1:9000/trans_buy_f2015_0 -wget http://$1:9000/trans_add_f2016_2_50 -wget http://$1:9000/trans_buy_f2016_1 -wget http://$1:9000/trans_add_f2017_3_100 -wget http://$1:9000/trans_buy_f2017_2 -wget http://$1:9000/trans_add_f2018_4_150 -wget http://$1:9000/trans_buy_f2018_3 -wget http://$1:9000/trans_add_f2019_5_200 -wget http://$1:9000/trans_buy_f2019_4 -wget http://$1:9000/trans_add_f2020_1_50 -wget http://$1:9000/trans_buy_f2020_0 -wget http://$1:9000/trans_add_f2021_2_100 -wget http://$1:9000/trans_buy_f2021_1 -wget http://$1:9000/trans_add_f2022_3_150 -wget http://$1:9000/trans_buy_f2022_2 -wget http://$1:9000/trans_add_f2023_4_200 -wget http://$1:9000/trans_buy_f2023_3 -wget http://$1:9000/trans_add_f2024_5_50 -wget http://$1:9000/trans_buy_f2024_4 -wget http://$1:9000/trans_add_f2025_1_100 -wget http://$1:9000/trans_buy_f2025_0 -wget http://$1:9000/trans_add_f2026_2_150 -wget http://$1:9000/trans_buy_f2026_1 -wget http://$1:9000/trans_add_f2027_3_200 -wget http://$1:9000/trans_buy_f2027_2 -wget http://$1:9000/trans_add_f2028_4_50 -wget http://$1:9000/trans_buy_f2028_3 -wget http://$1:9000/trans_add_f2029_5_100 -wget http://$1:9000/trans_buy_f2029_4 -wget http://$1:9000/trans_add_f2030_1_150 -wget http://$1:9000/trans_buy_f2030_0 -wget http://$1:9000/trans_add_f2031_2_200 -wget http://$1:9000/trans_buy_f2031_1 -wget http://$1:9000/trans_add_f2032_3_50 -wget http://$1:9000/trans_buy_f2032_2 -wget http://$1:9000/trans_add_f2033_4_100 -wget http://$1:9000/trans_buy_f2033_3 -wget http://$1:9000/trans_add_f2034_5_150 -wget http://$1:9000/trans_buy_f2034_4 -wget http://$1:9000/trans_add_f2035_1_200 -wget http://$1:9000/trans_buy_f2035_0 -wget http://$1:9000/trans_add_f2036_2_50 -wget http://$1:9000/trans_buy_f2036_1 -wget http://$1:9000/trans_add_f2037_3_100 -wget http://$1:9000/trans_buy_f2037_2 -wget http://$1:9000/trans_add_f2038_4_150 -wget http://$1:9000/trans_buy_f2038_3 -wget http://$1:9000/trans_add_f2039_5_200 -wget http://$1:9000/trans_buy_f2039_4 -wget http://$1:9000/trans_add_f2040_1_50 -wget http://$1:9000/trans_buy_f2040_0 -wget http://$1:9000/trans_add_f2041_2_100 -wget http://$1:9000/trans_buy_f2041_1 -wget http://$1:9000/trans_add_f2042_3_150 -wget http://$1:9000/trans_buy_f2042_2 -wget http://$1:9000/trans_add_f2043_4_200 -wget http://$1:9000/trans_buy_f2043_3 -wget http://$1:9000/trans_add_f2044_5_50 -wget http://$1:9000/trans_buy_f2044_4 -wget http://$1:9000/trans_add_f2045_1_100 -wget http://$1:9000/trans_buy_f2045_0 -wget http://$1:9000/trans_add_f2046_2_150 -wget http://$1:9000/trans_buy_f2046_1 -wget http://$1:9000/trans_add_f2047_3_200 -wget http://$1:9000/trans_buy_f2047_2 -wget http://$1:9000/trans_add_f2048_4_50 -wget http://$1:9000/trans_buy_f2048_3 -wget http://$1:9000/trans_add_f2049_5_100 -wget http://$1:9000/trans_buy_f2049_4 -wget http://$1:9000/trans_add_f2050_1_150 -wget http://$1:9000/trans_buy_f2050_0 -wget http://$1:9000/trans_add_f2051_2_200 -wget http://$1:9000/trans_buy_f2051_1 -wget http://$1:9000/trans_add_f2052_3_50 -wget http://$1:9000/trans_buy_f2052_2 -wget http://$1:9000/trans_add_f2053_4_100 -wget http://$1:9000/trans_buy_f2053_3 -wget http://$1:9000/trans_add_f2054_5_150 -wget http://$1:9000/trans_buy_f2054_4 -wget http://$1:9000/trans_add_f2055_1_200 -wget http://$1:9000/trans_buy_f2055_0 -wget http://$1:9000/trans_add_f2056_2_50 -wget http://$1:9000/trans_buy_f2056_1 -wget http://$1:9000/trans_add_f2057_3_100 -wget http://$1:9000/trans_buy_f2057_2 -wget http://$1:9000/trans_add_f2058_4_150 -wget http://$1:9000/trans_buy_f2058_3 -wget http://$1:9000/trans_add_f2059_5_200 -wget http://$1:9000/trans_buy_f2059_4 -wget http://$1:9000/trans_add_f2060_1_50 -wget http://$1:9000/trans_buy_f2060_0 -wget http://$1:9000/trans_add_f2061_2_100 -wget http://$1:9000/trans_buy_f2061_1 -wget http://$1:9000/trans_add_f2062_3_150 -wget http://$1:9000/trans_buy_f2062_2 -wget http://$1:9000/trans_add_f2063_4_200 -wget http://$1:9000/trans_buy_f2063_3 -wget http://$1:9000/trans_add_f2064_5_50 -wget http://$1:9000/trans_buy_f2064_4 -wget http://$1:9000/trans_add_f2065_1_100 -wget http://$1:9000/trans_buy_f2065_0 -wget http://$1:9000/trans_add_f2066_2_150 -wget http://$1:9000/trans_buy_f2066_1 -wget http://$1:9000/trans_add_f2067_3_200 -wget http://$1:9000/trans_buy_f2067_2 -wget http://$1:9000/trans_add_f2068_4_50 -wget http://$1:9000/trans_buy_f2068_3 -wget http://$1:9000/trans_add_f2069_5_100 -wget http://$1:9000/trans_buy_f2069_4 -wget http://$1:9000/trans_add_f2070_1_150 -wget http://$1:9000/trans_buy_f2070_0 -wget http://$1:9000/trans_add_f2071_2_200 -wget http://$1:9000/trans_buy_f2071_1 -wget http://$1:9000/trans_add_f2072_3_50 -wget http://$1:9000/trans_buy_f2072_2 -wget http://$1:9000/trans_add_f2073_4_100 -wget http://$1:9000/trans_buy_f2073_3 -wget http://$1:9000/trans_add_f2074_5_150 -wget http://$1:9000/trans_buy_f2074_4 -wget http://$1:9000/trans_add_f2075_1_200 -wget http://$1:9000/trans_buy_f2075_0 -wget http://$1:9000/trans_add_f2076_2_50 -wget http://$1:9000/trans_buy_f2076_1 -wget http://$1:9000/trans_add_f2077_3_100 -wget http://$1:9000/trans_buy_f2077_2 -wget http://$1:9000/trans_add_f2078_4_150 -wget http://$1:9000/trans_buy_f2078_3 -wget http://$1:9000/trans_add_f2079_5_200 -wget http://$1:9000/trans_buy_f2079_4 -wget http://$1:9000/trans_add_f2080_1_50 -wget http://$1:9000/trans_buy_f2080_0 -wget http://$1:9000/trans_add_f2081_2_100 -wget http://$1:9000/trans_buy_f2081_1 -wget http://$1:9000/trans_add_f2082_3_150 -wget http://$1:9000/trans_buy_f2082_2 -wget http://$1:9000/trans_add_f2083_4_200 -wget http://$1:9000/trans_buy_f2083_3 -wget http://$1:9000/trans_add_f2084_5_50 -wget http://$1:9000/trans_buy_f2084_4 -wget http://$1:9000/trans_add_f2085_1_100 -wget http://$1:9000/trans_buy_f2085_0 -wget http://$1:9000/trans_add_f2086_2_150 -wget http://$1:9000/trans_buy_f2086_1 -wget http://$1:9000/trans_add_f2087_3_200 -wget http://$1:9000/trans_buy_f2087_2 -wget http://$1:9000/trans_add_f2088_4_50 -wget http://$1:9000/trans_buy_f2088_3 -wget http://$1:9000/trans_add_f2089_5_100 -wget http://$1:9000/trans_buy_f2089_4 -wget http://$1:9000/trans_add_f2090_1_150 -wget http://$1:9000/trans_buy_f2090_0 -wget http://$1:9000/trans_add_f2091_2_200 -wget http://$1:9000/trans_buy_f2091_1 -wget http://$1:9000/trans_add_f2092_3_50 -wget http://$1:9000/trans_buy_f2092_2 -wget http://$1:9000/trans_add_f2093_4_100 -wget http://$1:9000/trans_buy_f2093_3 -wget http://$1:9000/trans_add_f2094_5_150 -wget http://$1:9000/trans_buy_f2094_4 -wget http://$1:9000/trans_add_f2095_1_200 -wget http://$1:9000/trans_buy_f2095_0 -wget http://$1:9000/trans_add_f2096_2_50 -wget http://$1:9000/trans_buy_f2096_1 -wget http://$1:9000/trans_add_f2097_3_100 -wget http://$1:9000/trans_buy_f2097_2 -wget http://$1:9000/trans_add_f2098_4_150 -wget http://$1:9000/trans_buy_f2098_3 -wget http://$1:9000/trans_add_f2099_5_200 -wget http://$1:9000/trans_buy_f2099_4 -wget http://$1:9000/trans_add_f2100_1_50 -wget http://$1:9000/trans_buy_f2100_0 -wget http://$1:9000/trans_add_f2101_2_100 -wget http://$1:9000/trans_buy_f2101_1 -wget http://$1:9000/trans_add_f2102_3_150 -wget http://$1:9000/trans_buy_f2102_2 -wget http://$1:9000/trans_add_f2103_4_200 -wget http://$1:9000/trans_buy_f2103_3 -wget http://$1:9000/trans_add_f2104_5_50 -wget http://$1:9000/trans_buy_f2104_4 -wget http://$1:9000/trans_add_f2105_1_100 -wget http://$1:9000/trans_buy_f2105_0 -wget http://$1:9000/trans_add_f2106_2_150 -wget http://$1:9000/trans_buy_f2106_1 -wget http://$1:9000/trans_add_f2107_3_200 -wget http://$1:9000/trans_buy_f2107_2 -wget http://$1:9000/trans_add_f2108_4_50 -wget http://$1:9000/trans_buy_f2108_3 -wget http://$1:9000/trans_add_f2109_5_100 -wget http://$1:9000/trans_buy_f2109_4 -wget http://$1:9000/trans_add_f2110_1_150 -wget http://$1:9000/trans_buy_f2110_0 -wget http://$1:9000/trans_add_f2111_2_200 -wget http://$1:9000/trans_buy_f2111_1 -wget http://$1:9000/trans_add_f2112_3_50 -wget http://$1:9000/trans_buy_f2112_2 -wget http://$1:9000/trans_add_f2113_4_100 -wget http://$1:9000/trans_buy_f2113_3 -wget http://$1:9000/trans_add_f2114_5_150 -wget http://$1:9000/trans_buy_f2114_4 -wget http://$1:9000/trans_add_f2115_1_200 -wget http://$1:9000/trans_buy_f2115_0 -wget http://$1:9000/trans_add_f2116_2_50 -wget http://$1:9000/trans_buy_f2116_1 -wget http://$1:9000/trans_add_f2117_3_100 -wget http://$1:9000/trans_buy_f2117_2 -wget http://$1:9000/trans_add_f2118_4_150 -wget http://$1:9000/trans_buy_f2118_3 -wget http://$1:9000/trans_add_f2119_5_200 -wget http://$1:9000/trans_buy_f2119_4 -wget http://$1:9000/trans_add_f2120_1_50 -wget http://$1:9000/trans_buy_f2120_0 -wget http://$1:9000/trans_add_f2121_2_100 -wget http://$1:9000/trans_buy_f2121_1 -wget http://$1:9000/trans_add_f2122_3_150 -wget http://$1:9000/trans_buy_f2122_2 -wget http://$1:9000/trans_add_f2123_4_200 -wget http://$1:9000/trans_buy_f2123_3 -wget http://$1:9000/trans_add_f2124_5_50 -wget http://$1:9000/trans_buy_f2124_4 -wget http://$1:9000/trans_add_f2125_1_100 -wget http://$1:9000/trans_buy_f2125_0 -wget http://$1:9000/trans_add_f2126_2_150 -wget http://$1:9000/trans_buy_f2126_1 -wget http://$1:9000/trans_add_f2127_3_200 -wget http://$1:9000/trans_buy_f2127_2 -wget http://$1:9000/trans_add_f2128_4_50 -wget http://$1:9000/trans_buy_f2128_3 -wget http://$1:9000/trans_add_f2129_5_100 -wget http://$1:9000/trans_buy_f2129_4 -wget http://$1:9000/trans_add_f2130_1_150 -wget http://$1:9000/trans_buy_f2130_0 -wget http://$1:9000/trans_add_f2131_2_200 -wget http://$1:9000/trans_buy_f2131_1 -wget http://$1:9000/trans_add_f2132_3_50 -wget http://$1:9000/trans_buy_f2132_2 -wget http://$1:9000/trans_add_f2133_4_100 -wget http://$1:9000/trans_buy_f2133_3 -wget http://$1:9000/trans_add_f2134_5_150 -wget http://$1:9000/trans_buy_f2134_4 -wget http://$1:9000/trans_add_f2135_1_200 -wget http://$1:9000/trans_buy_f2135_0 -wget http://$1:9000/trans_add_f2136_2_50 -wget http://$1:9000/trans_buy_f2136_1 -wget http://$1:9000/trans_add_f2137_3_100 -wget http://$1:9000/trans_buy_f2137_2 -wget http://$1:9000/trans_add_f2138_4_150 -wget http://$1:9000/trans_buy_f2138_3 -wget http://$1:9000/trans_add_f2139_5_200 -wget http://$1:9000/trans_buy_f2139_4 -wget http://$1:9000/trans_add_f2140_1_50 -wget http://$1:9000/trans_buy_f2140_0 -wget http://$1:9000/trans_add_f2141_2_100 -wget http://$1:9000/trans_buy_f2141_1 -wget http://$1:9000/trans_add_f2142_3_150 -wget http://$1:9000/trans_buy_f2142_2 -wget http://$1:9000/trans_add_f2143_4_200 -wget http://$1:9000/trans_buy_f2143_3 -wget http://$1:9000/trans_add_f2144_5_50 -wget http://$1:9000/trans_buy_f2144_4 -wget http://$1:9000/trans_add_f2145_1_100 -wget http://$1:9000/trans_buy_f2145_0 -wget http://$1:9000/trans_add_f2146_2_150 -wget http://$1:9000/trans_buy_f2146_1 -wget http://$1:9000/trans_add_f2147_3_200 -wget http://$1:9000/trans_buy_f2147_2 -wget http://$1:9000/trans_add_f2148_4_50 -wget http://$1:9000/trans_buy_f2148_3 -wget http://$1:9000/trans_add_f2149_5_100 -wget http://$1:9000/trans_buy_f2149_4 -wget http://$1:9000/trans_add_f2150_1_150 -wget http://$1:9000/trans_buy_f2150_0 -wget http://$1:9000/trans_add_f2151_2_200 -wget http://$1:9000/trans_buy_f2151_1 -wget http://$1:9000/trans_add_f2152_3_50 -wget http://$1:9000/trans_buy_f2152_2 -wget http://$1:9000/trans_add_f2153_4_100 -wget http://$1:9000/trans_buy_f2153_3 -wget http://$1:9000/trans_add_f2154_5_150 -wget http://$1:9000/trans_buy_f2154_4 -wget http://$1:9000/trans_add_f2155_1_200 -wget http://$1:9000/trans_buy_f2155_0 -wget http://$1:9000/trans_add_f2156_2_50 -wget http://$1:9000/trans_buy_f2156_1 -wget http://$1:9000/trans_add_f2157_3_100 -wget http://$1:9000/trans_buy_f2157_2 -wget http://$1:9000/trans_add_f2158_4_150 -wget http://$1:9000/trans_buy_f2158_3 -wget http://$1:9000/trans_add_f2159_5_200 -wget http://$1:9000/trans_buy_f2159_4 -wget http://$1:9000/trans_add_f2160_1_50 -wget http://$1:9000/trans_buy_f2160_0 -wget http://$1:9000/trans_add_f2161_2_100 -wget http://$1:9000/trans_buy_f2161_1 -wget http://$1:9000/trans_add_f2162_3_150 -wget http://$1:9000/trans_buy_f2162_2 -wget http://$1:9000/trans_add_f2163_4_200 -wget http://$1:9000/trans_buy_f2163_3 -wget http://$1:9000/trans_add_f2164_5_50 -wget http://$1:9000/trans_buy_f2164_4 -wget http://$1:9000/trans_add_f2165_1_100 -wget http://$1:9000/trans_buy_f2165_0 -wget http://$1:9000/trans_add_f2166_2_150 -wget http://$1:9000/trans_buy_f2166_1 -wget http://$1:9000/trans_add_f2167_3_200 -wget http://$1:9000/trans_buy_f2167_2 -wget http://$1:9000/trans_add_f2168_4_50 -wget http://$1:9000/trans_buy_f2168_3 -wget http://$1:9000/trans_add_f2169_5_100 -wget http://$1:9000/trans_buy_f2169_4 -wget http://$1:9000/trans_add_f2170_1_150 -wget http://$1:9000/trans_buy_f2170_0 -wget http://$1:9000/trans_add_f2171_2_200 -wget http://$1:9000/trans_buy_f2171_1 -wget http://$1:9000/trans_add_f2172_3_50 -wget http://$1:9000/trans_buy_f2172_2 -wget http://$1:9000/trans_add_f2173_4_100 -wget http://$1:9000/trans_buy_f2173_3 -wget http://$1:9000/trans_add_f2174_5_150 -wget http://$1:9000/trans_buy_f2174_4 -wget http://$1:9000/trans_add_f2175_1_200 -wget http://$1:9000/trans_buy_f2175_0 -wget http://$1:9000/trans_add_f2176_2_50 -wget http://$1:9000/trans_buy_f2176_1 -wget http://$1:9000/trans_add_f2177_3_100 -wget http://$1:9000/trans_buy_f2177_2 -wget http://$1:9000/trans_add_f2178_4_150 -wget http://$1:9000/trans_buy_f2178_3 -wget http://$1:9000/trans_add_f2179_5_200 -wget http://$1:9000/trans_buy_f2179_4 -wget http://$1:9000/trans_add_f2180_1_50 -wget http://$1:9000/trans_buy_f2180_0 -wget http://$1:9000/trans_add_f2181_2_100 -wget http://$1:9000/trans_buy_f2181_1 -wget http://$1:9000/trans_add_f2182_3_150 -wget http://$1:9000/trans_buy_f2182_2 -wget http://$1:9000/trans_add_f2183_4_200 -wget http://$1:9000/trans_buy_f2183_3 -wget http://$1:9000/trans_add_f2184_5_50 -wget http://$1:9000/trans_buy_f2184_4 -wget http://$1:9000/trans_add_f2185_1_100 -wget http://$1:9000/trans_buy_f2185_0 -wget http://$1:9000/trans_add_f2186_2_150 -wget http://$1:9000/trans_buy_f2186_1 -wget http://$1:9000/trans_add_f2187_3_200 -wget http://$1:9000/trans_buy_f2187_2 -wget http://$1:9000/trans_add_f2188_4_50 -wget http://$1:9000/trans_buy_f2188_3 -wget http://$1:9000/trans_add_f2189_5_100 -wget http://$1:9000/trans_buy_f2189_4 -wget http://$1:9000/trans_add_f2190_1_150 -wget http://$1:9000/trans_buy_f2190_0 -wget http://$1:9000/trans_add_f2191_2_200 -wget http://$1:9000/trans_buy_f2191_1 -wget http://$1:9000/trans_add_f2192_3_50 -wget http://$1:9000/trans_buy_f2192_2 -wget http://$1:9000/trans_add_f2193_4_100 -wget http://$1:9000/trans_buy_f2193_3 -wget http://$1:9000/trans_add_f2194_5_150 -wget http://$1:9000/trans_buy_f2194_4 -wget http://$1:9000/trans_add_f2195_1_200 -wget http://$1:9000/trans_buy_f2195_0 -wget http://$1:9000/trans_add_f2196_2_50 -wget http://$1:9000/trans_buy_f2196_1 -wget http://$1:9000/trans_add_f2197_3_100 -wget http://$1:9000/trans_buy_f2197_2 -wget http://$1:9000/trans_add_f2198_4_150 -wget http://$1:9000/trans_buy_f2198_3 -wget http://$1:9000/trans_add_f2199_5_200 -wget http://$1:9000/trans_buy_f2199_4 -wget http://$1:9000/trans_inventory diff --git a/Robust/src/Benchmarks/WebServer/Workload/workloaderror b/Robust/src/Benchmarks/WebServer/Workload/workloaderror deleted file mode 100755 index b1c3d407..00000000 --- a/Robust/src/Benchmarks/WebServer/Workload/workloaderror +++ /dev/null @@ -1,101 +0,0 @@ -#!/bin/bash -wget http://$1:9000/trans_add_preroses_15_4 -wget http://$1:9000/trans_add_preroses_15_4 -wget http://$1:9000/trans_add_preperfume_39_50 -wget http://$1:9000/trans_add_predvd_78_19 -wget http://$1:9000/trans_buy_preperfume_9_50 -wget http://$1:9000/trans_buy_predvd_15_19 -wget http://$1:9000/trans_add_preroses_15_4 -wget http://$1:9000/trans_add_preperfume_39_50 -wget http://$1:9000/trans_add_predvd_78_19 -wget http://$1:9000/trans_buy_preperfume_9_50 -wget http://$1:9000/trans_buy_predvd_15_19 -wget http://$1:9000/trans_add_preroses_15_4 -wget http://$1:9000/trans_add_preroses_15_4 -wget http://$1:9000/trans_add_preperfume_39_50 -wget http://$1:9000/trans_add_predvd_78_19 -wget http://$1:9000/trans_buy_preperfume_9_50 -wget http://$1:9000/trans_buy_predvd_15_19 -wget http://$1:9000/trans_add_preroses_15_4 -wget http://$1:9000/trans_add_preroses_15_4 -wget http://$1:9000/trans_add_preroses_15_4 -wget http://$1:9000/trans_add_preroses_15_4 -wget http://$1:9000/trans_add_preperfume_39_50 -wget http://$1:9000/trans_add_preperfume_39_50 -wget http://$1:9000/trans_add_preperfume_39_50 -wget http://$1:9000/trans_add_preperfume_39_50 -wget http://$1:9000/trans_add_preperfume_39_50 -wget http://$1:9000/trans_add_predvd_78_19 -wget http://$1:9000/trans_buy_preperfume_9_50 -wget http://$1:9000/trans_buy_predvd_15_19 -wget http://$1:9000/trans_add_preroses_15_4 -wget http://$1:9000/trans_add_preperfume_39_50 -wget http://$1:9000/trans_add_predvd_78_19 -wget http://$1:9000/trans_buy_preperfume_9_50 -wget http://$1:9000/trans_buy_predvd_15_19 -wget http://$1:9000/trans_add_preroses_15_4 -wget http://$1:9000/trans_add_preroses_15_4 -wget http://$1:9000/trans_add_preperfume_39_50 -wget http://$1:9000/trans_add_predvd_78_19 -wget http://$1:9000/trans_buy_preperfume_9_50 -wget http://$1:9000/trans_buy_predvd_15_19 -wget http://$1:9000/trans_add_preroses_15_4 -wget http://$1:9000/trans_add_preroses_15_4 -wget http://$1:9000/trans_add_preroses_15_4 -wget http://$1:9000/trans_add_preroses_15_4 -wget http://$1:9000/trans_add_predvd_78_19 -wget http://$1:9000/trans_buy_preperfume_9_50 -wget http://$1:9000/trans_buy_predvd_15_19 -wget http://$1:9000/trans_add_preroses_15_4 -wget http://$1:9000/trans_add_preperfume_39_50 -wget http://$1:9000/trans_add_predvd_78_19 -wget http://$1:9000/trans_buy_preperfume_9_50 -wget http://$1:9000/trans_buy_predvd_15_19 -wget http://$1:9000/trans_add_preroses_15_4 -wget http://$1:9000/trans_add_preroses_15_4 -wget http://$1:9000/trans_add_preperfume_39_50 -wget http://$1:9000/trans_add_predvd_78_19 -wget http://$1:9000/trans_buy_preperfume_9_50 -wget http://$1:9000/trans_buy_predvd_15_19 -wget http://$1:9000/trans_add_preroses_15_4 -wget http://$1:9000/trans_add_preroses_15_4 -wget http://$1:9000/trans_add_preroses_15_4 -wget http://$1:9000/trans_add_preroses_15_4 -wget http://$1:9000/trans_add_predvd_78_19 -wget http://$1:9000/trans_buy_preperfume_9_50 -wget http://$1:9000/trans_buy_predvd_15_19 -wget http://$1:9000/trans_add_preroses_15_4 -wget http://$1:9000/trans_add_preperfume_39_50 -wget http://$1:9000/trans_add_predvd_78_19 -wget http://$1:9000/trans_buy_preperfume_9_50 -wget http://$1:9000/trans_buy_predvd_15_19 -wget http://$1:9000/trans_add_preroses_15_4 -wget http://$1:9000/trans_add_preroses_15_4 -wget http://$1:9000/trans_add_preperfume_39_50 -wget http://$1:9000/trans_add_predvd_78_19 -wget http://$1:9000/trans_buy_preperfume_9_50 -wget http://$1:9000/trans_buy_predvd_15_19 -wget http://$1:9000/trans_add_preroses_15_4 -wget http://$1:9000/trans_add_preroses_15_4 -wget http://$1:9000/trans_add_preroses_15_4 -wget http://$1:9000/trans_add_preroses_15_4 -wget http://$1:9000/trans_add_predvd_78_19 -wget http://$1:9000/trans_buy_preperfume_9_50 -wget http://$1:9000/trans_buy_predvd_15_19 -wget http://$1:9000/trans_add_preroses_15_4 -wget http://$1:9000/trans_add_preperfume_39_50 -wget http://$1:9000/trans_add_predvd_78_19 -wget http://$1:9000/trans_buy_preperfume_9_50 -wget http://$1:9000/trans_buy_predvd_15_19 -wget http://$1:9000/trans_add_preroses_15_4 -wget http://$1:9000/trans_add_preroses_15_4 -wget http://$1:9000/trans_add_preperfume_39_50 -wget http://$1:9000/trans_add_predvd_78_19 -wget http://$1:9000/trans_buy_preperfume_9_50 -wget http://$1:9000/trans_buy_predvd_15_19 -wget http://$1:9000/trans_add_preroses_15_4 -wget http://$1:9000/trans_add_preroses_15_4 -wget http://$1:9000/trans_add_preroses_15_4 -wget http://$1:9000/trans_add_preroses_15_4 -wget http://$1:9000/trans_add_predvd_78_19 -wget http://$1:9000/trans_buy_preperfume_9_50 diff --git a/Robust/src/Benchmarks/WebServer/Workload/workloadfile1000 b/Robust/src/Benchmarks/WebServer/Workload/workloadfile1000 deleted file mode 100755 index 29dce06e..00000000 --- a/Robust/src/Benchmarks/WebServer/Workload/workloadfile1000 +++ /dev/null @@ -1,1000 +0,0 @@ -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index3.html -wget http://$1:9000/index2.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index1.html -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index3.html -wget http://$1:9000/index2.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index1.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index3.html -wget http://$1:9000/index2.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index1.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index3.html -wget http://$1:9000/index2.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index1.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index3.html -wget http://$1:9000/index2.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index1.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index3.html -wget http://$1:9000/index2.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index1.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index3.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index1.html -wget http://$1:9000/index1.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index1.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index1.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index1.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index1.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index1.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index1.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.3 -wget http://$1:9000/index1.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.3 -wget http://$1:9000/index1.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index1.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index1.html -wget http://$1:9000/index2.html -wget http://$1:9000/index1.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.3 -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html -wget http://$1:9000/index.html -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index3.html -wget http://$1:9000/index2.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index1.html -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index3.html -wget http://$1:9000/index2.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.1 -wget http://$1:9000/index1.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index3.html -wget http://$1:9000/index2.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index1.html -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index3.html -wget http://$1:9000/index2.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.1 -wget http://$1:9000/index1.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index3.html -wget http://$1:9000/index2.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index1.html -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index3.html -wget http://$1:9000/index2.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index3.html -wget http://$1:9000/index2.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index1.html -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index3.html -wget http://$1:9000/index2.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index3.html -wget http://$1:9000/index2.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index1.html -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index3.html -wget http://$1:9000/index2.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index3.html -wget http://$1:9000/index2.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index1.html -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 diff --git a/Robust/src/Benchmarks/WebServer/Workload/workloadmix1000 b/Robust/src/Benchmarks/WebServer/Workload/workloadmix1000 deleted file mode 100755 index d6d1746f..00000000 --- a/Robust/src/Benchmarks/WebServer/Workload/workloadmix1000 +++ /dev/null @@ -1,1000 +0,0 @@ -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_pen_5_5 -wget http://$1:9000/trans_add_pen_0_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index3.html -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_pen_5_5 -wget http://$1:9000/trans_add_pen_0_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_pen_5_5 -wget http://$1:9000/trans_add_pen_0_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/index2.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_book_2 -wget http://$1:9000/trans_buy_soap_2 -wget http://$1:9000/trans_buy_pen_22 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_car_1 -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.3 -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_pen_5_5 -wget http://$1:9000/trans_add_pen_0_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html -wget http://$1:9000/index.html -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index2.html -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_coke_20_3 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_bread_10000_4 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.3 -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html -wget http://$1:9000/index.html -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index2.html -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_soap_20_7 -wget http://$1:9000/trans_add_car_20_15000 -wget http://$1:9000/trans_add_book_100_50 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.3 -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html -wget http://$1:9000/index.html -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index2.html -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index1.html -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_book_2 -wget http://$1:9000/trans_buy_soap_2 -wget http://$1:9000/trans_buy_pen_22 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_car_1 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_coke_20_3 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_bread_10000_4 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_inventory -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/index.html.3 -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/index.html.3 -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/index.html.3 -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/index.html.3 -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/index.html.3 -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/index.html.3 -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_soap_20_7 -wget http://$1:9000/trans_add_car_20_15000 -wget http://$1:9000/trans_add_book_100_50 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index2.html -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/index3.html -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/index.html.1 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/index.html.2 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/index.html.3 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/index2.html -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/index3.html -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_buy_book_2 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_buy_soap_2 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_buy_pen_22 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_car_1 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_coke_20_3 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_bread_10000_4 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_soap_20_7 -wget http://$1:9000/trans_add_car_20_15000 -wget http://$1:9000/trans_add_book_100_50 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_add_bread_10_4 -wget http://$1:9000/trans_add_bread_1340_4 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_pen_5_5 -wget http://$1:9000/trans_add_pen_0_5 -wget http://$1:9000/trans_add_pen_300_5 -wget http://$1:9000/trans_add_pen_45_5 -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index2.html -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_add_bread_10_4 -wget http://$1:9000/trans_add_bread_1340_4 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/index1.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index3.html -wget http://$1:9000/index2.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index1.html -wget http://$1:9000/index1.html -wget http://$1:9000/index1.html -wget http://$1:9000/index1.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index3.html -wget http://$1:9000/index2.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index3.html -wget http://$1:9000/index2.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index3.html -wget http://$1:9000/index2.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index3.html -wget http://$1:9000/index2.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index1.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index3.html -wget http://$1:9000/index2.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.2 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_pen_5_5 -wget http://$1:9000/trans_add_pen_0_5 -wget http://$1:9000/trans_add_pen_300_5 -wget http://$1:9000/trans_add_pen_45_5 -wget http://$1:9000/index3.html -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index2.html -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_add_bread_10_4 -wget http://$1:9000/trans_add_bread_1340_4 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_pen_5_5 -wget http://$1:9000/trans_add_pen_0_5 -wget http://$1:9000/trans_add_pen_300_5 -wget http://$1:9000/trans_add_pen_45_5 -wget http://$1:9000/index3.html -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_add_bread_10_4 -wget http://$1:9000/trans_add_bread_1340_4 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.3 -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html -wget http://$1:9000/index.html -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index2.html -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_pen_5_5 -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/trans_add_pen_0_5 -wget http://$1:9000/trans_add_pen_300_5 -wget http://$1:9000/trans_add_pen_45_5 -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index3.html -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_pen_5_5 -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_pen_5_5 -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/index3.html -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/index3.html -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/index3.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.3 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/index3.html -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index.html.3 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/index.html.3 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/index3.html -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/index3.html -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/index2.html -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index3.html -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/index3.html -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/index.html -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/index.html -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/index.html.1 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/index.html.2 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/index2.html -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/index3.html -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.3 -wget http://$1:9000/index2.html -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_inventory -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_pen_5_5 -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/index.html -wget http://$1:9000/index1.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index2.html -wget http://$1:9000/index3.html -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_pen_5_5 -wget http://$1:9000/trans_add_pen_0_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_pen_5_5 -wget http://$1:9000/trans_add_pen_0_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_pen_5_5 -wget http://$1:9000/trans_add_pen_0_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_inventory -wget http://$1:9000/index1.html -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index3.html -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/index2.html -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.2 -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.2 -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_pen_5_5 -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_add_pen_0_5 -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/index1.html -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/index2.html -wget http://$1:9000/index.html.1 -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/index.html.2 -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/index3.html -wget http://$1:9000/index2.html -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/index2.html -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.2 -wget http://$1:9000/index.html.2 -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_add_bread_10_4 -wget http://$1:9000/trans_add_bread_1340_4 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_inventory diff --git a/Robust/src/Benchmarks/WebServer/Workload/workloadtrans b/Robust/src/Benchmarks/WebServer/Workload/workloadtrans deleted file mode 100755 index b81da8f1..00000000 --- a/Robust/src/Benchmarks/WebServer/Workload/workloadtrans +++ /dev/null @@ -1,101 +0,0 @@ -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_add_soap_20_7 -wget http://$1:9000/trans_add_car_20_15000 -wget http://$1:9000/trans_add_book_100_50 -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_buy_book_2 -wget http://$1:9000/trans_buy_soap_2 -wget http://$1:9000/trans_buy_pen_22 -wget http://$1:9000/trans_buy_car_1 -wget http://$1:9000/trans_add_coke_20_3 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_bread_10000_4 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_soap_20_7 -wget http://$1:9000/trans_add_car_20_15000 -wget http://$1:9000/trans_add_book_100_50 -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_add_bread_10_4 -wget http://$1:9000/trans_add_bread_1340_4 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_add_pen_5_5 -wget http://$1:9000/trans_add_pen_0_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_pen_300_5 -wget http://$1:9000/trans_add_pen_45_5 -wget http://$1:9000/trans_add_soap_2_7 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_add_soap_42_7 -wget http://$1:9000/trans_buy_soap_888 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_add_pen_5_5 -wget http://$1:9000/trans_add_pen_0_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_inventory diff --git a/Robust/src/Benchmarks/WebServer/Workload/workloadtrans1000 b/Robust/src/Benchmarks/WebServer/Workload/workloadtrans1000 deleted file mode 100755 index dc509b5f..00000000 --- a/Robust/src/Benchmarks/WebServer/Workload/workloadtrans1000 +++ /dev/null @@ -1,980 +0,0 @@ -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_add_soap_20_7 -wget http://$1:9000/trans_add_car_20_15000 -wget http://$1:9000/trans_add_book_100_50 -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_buy_book_2 -wget http://$1:9000/trans_buy_soap_2 -wget http://$1:9000/trans_buy_pen_22 -wget http://$1:9000/trans_buy_car_1 -wget http://$1:9000/trans_add_coke_20_3 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_bread_10000_4 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_soap_20_7 -wget http://$1:9000/trans_add_car_20_15000 -wget http://$1:9000/trans_add_book_100_50 -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_add_bread_10_4 -wget http://$1:9000/trans_add_bread_1340_4 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_pen_5_5 -wget http://$1:9000/trans_add_pen_0_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_pen_300_5 -wget http://$1:9000/trans_add_pen_45_5 -wget http://$1:9000/trans_add_soap_2_7 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_add_soap_42_7 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_soap_888 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_soap_72_7 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_soap_20_7 -wget http://$1:9000/trans_add_car_20_15000 -wget http://$1:9000/trans_add_book_100_50 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_book_2 -wget http://$1:9000/trans_buy_soap_2 -wget http://$1:9000/trans_buy_pen_22 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_car_1 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_coke_20_3 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_bread_10000_4 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_soap_20_7 -wget http://$1:9000/trans_add_car_20_15000 -wget http://$1:9000/trans_add_book_100_50 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_add_bread_10_4 -wget http://$1:9000/trans_add_bread_1340_4 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_pen_5_5 -wget http://$1:9000/trans_add_pen_0_5 -wget http://$1:9000/trans_add_pen_300_5 -wget http://$1:9000/trans_add_pen_45_5 -wget http://$1:9000/trans_add_soap_2_7 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_add_soap_42_7 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_soap_888 -wget http://$1:9000/trans_add_soap_72_7 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_soap_20_7 -wget http://$1:9000/trans_add_car_20_15000 -wget http://$1:9000/trans_add_book_100_50 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_book_2 -wget http://$1:9000/trans_buy_soap_2 -wget http://$1:9000/trans_buy_pen_22 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_car_1 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_20_3 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_bread_10000_4 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_soap_20_7 -wget http://$1:9000/trans_add_car_20_15000 -wget http://$1:9000/trans_add_book_100_50 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_add_bread_10_4 -wget http://$1:9000/trans_add_bread_1340_4 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_pen_5_5 -wget http://$1:9000/trans_add_pen_0_5 -wget http://$1:9000/trans_add_pen_300_5 -wget http://$1:9000/trans_add_pen_45_5 -wget http://$1:9000/trans_add_soap_2_7 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_add_soap_42_7 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_soap_888 -wget http://$1:9000/trans_add_soap_72_7 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_soap_20_7 -wget http://$1:9000/trans_add_car_20_15000 -wget http://$1:9000/trans_add_book_100_50 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_book_2 -wget http://$1:9000/trans_buy_soap_2 -wget http://$1:9000/trans_buy_pen_22 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_car_1 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_coke_20_3 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_bread_10000_4 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_soap_20_7 -wget http://$1:9000/trans_add_car_20_15000 -wget http://$1:9000/trans_add_book_100_50 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_add_bread_10_4 -wget http://$1:9000/trans_add_bread_1340_4 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_pen_5_5 -wget http://$1:9000/trans_add_pen_0_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_pen_300_5 -wget http://$1:9000/trans_add_pen_45_5 -wget http://$1:9000/trans_add_soap_2_7 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_add_soap_42_7 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_soap_888 -wget http://$1:9000/trans_add_soap_72_7 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_soap_20_7 -wget http://$1:9000/trans_add_car_20_15000 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_book_100_50 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_book_2 -wget http://$1:9000/trans_buy_soap_2 -wget http://$1:9000/trans_buy_pen_22 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_car_1 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_coke_20_3 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_bread_10000_4 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_soap_20_7 -wget http://$1:9000/trans_add_car_20_15000 -wget http://$1:9000/trans_add_book_100_50 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_add_bread_10_4 -wget http://$1:9000/trans_add_bread_1340_4 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_pen_5_5 -wget http://$1:9000/trans_add_pen_0_5 -wget http://$1:9000/trans_add_pen_300_5 -wget http://$1:9000/trans_add_pen_45_5 -wget http://$1:9000/trans_add_soap_2_7 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_add_soap_42_7 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_soap_888 -wget http://$1:9000/trans_add_soap_72_7 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_soap_20_7 -wget http://$1:9000/trans_add_car_20_15000 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_book_100_50 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_book_2 -wget http://$1:9000/trans_buy_soap_2 -wget http://$1:9000/trans_buy_pen_22 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_car_1 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_coke_20_3 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_bread_10000_4 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_soap_20_7 -wget http://$1:9000/trans_add_car_20_15000 -wget http://$1:9000/trans_add_book_100_50 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_add_bread_10_4 -wget http://$1:9000/trans_add_bread_1340_4 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_pen_5_5 -wget http://$1:9000/trans_add_pen_0_5 -wget http://$1:9000/trans_add_pen_300_5 -wget http://$1:9000/trans_add_pen_45_5 -wget http://$1:9000/trans_add_soap_2_7 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_add_soap_42_7 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_soap_888 -wget http://$1:9000/trans_add_soap_72_7 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_soap_2_7 -wget http://$1:9000/trans_add_soap_2_7 -wget http://$1:9000/trans_add_soap_2_7 -wget http://$1:9000/trans_buy_soap_2000_7 -wget http://$1:9000/trans_buy_soap_155_7 -wget http://$1:9000/trans_buy_soap_200_7 -wget http://$1:9000/trans_buy_soap_155_7 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_soap_155_7 -wget http://$1:9000/trans_buy_soap_155_7 -wget http://$1:9000/trans_buy_soap_200_7 -wget http://$1:9000/trans_buy_soap_200_7 -wget http://$1:9000/trans_buy_soap_200_7 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_soap_155_7 -wget http://$1:9000/trans_add_soap_2_7 -wget http://$1:9000/trans_buy_soap_200_7 -wget http://$1:9000/trans_buy_soap_155_7 -wget http://$1:9000/trans_buy_soap_200_7 -wget http://$1:9000/trans_add_soap_2_7 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_soap_2_7 -wget http://$1:9000/trans_buy_soap_155_7 -wget http://$1:9000/trans_buy_soap_200_7 -wget http://$1:9000/trans_buy_soap_155_7 -wget http://$1:9000/trans_buy_soap_200_7 -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/trans_add_car_15_10000 -wget http://$1:9000/trans_add_car_15_10000 -wget http://$1:9000/trans_add_car_15_10000 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_car_15_10000 -wget http://$1:9000/trans_add_car_15_10000 -wget http://$1:9000/trans_add_car_15_10000 -wget http://$1:9000/trans_add_car_15_10000 -wget http://$1:9000/trans_add_car_15_10000 -wget http://$1:9000/trans_buy_car_15_10000 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_car_15_10000 -wget http://$1:9000/trans_add_car_15_10000 -wget http://$1:9000/trans_buy_car_15_10000 -wget http://$1:9000/trans_add_car_15_10000 -wget http://$1:9000/trans_buy_car_15_10000 -wget http://$1:9000/trans_add_car_15_10000 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_car_15_10000 -wget http://$1:9000/trans_add_car_15_10000 -wget http://$1:9000/trans_buy_car_15_10000 -wget http://$1:9000/trans_add_car_15_10000 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_car_15_10000 -wget http://$1:9000/trans_add_car_15_10000 -wget http://$1:9000/trans_buy_car_15_10000 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_car_15_10000 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_car_15_10000 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_car_1_10000 -wget http://$1:9000/trans_add_car_15_10000 -wget http://$1:9000/trans_add_car_15_10000 -wget http://$1:9000/trans_add_car_1_10000 -wget http://$1:9000/trans_add_car_1_10000 -wget http://$1:9000/trans_add_car_1_10000 -wget http://$1:9000/trans_add_car_1_10000 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_add_bread_10_4 -wget http://$1:9000/trans_add_bread_1340_4 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_pen_5_5 -wget http://$1:9000/trans_add_pen_0_5 -wget http://$1:9000/trans_add_pen_300_5 -wget http://$1:9000/trans_add_pen_45_5 -wget http://$1:9000/trans_add_soap_2_7 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_add_soap_42_7 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_soap_888 -wget http://$1:9000/trans_add_soap_72_7 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_soap_2_7 -wget http://$1:9000/trans_add_soap_2_7 -wget http://$1:9000/trans_add_soap_2_7 -wget http://$1:9000/trans_buy_soap_2000_7 -wget http://$1:9000/trans_buy_soap_155_7 -wget http://$1:9000/trans_buy_soap_200_7 -wget http://$1:9000/trans_buy_soap_155_7 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_soap_155_7 -wget http://$1:9000/trans_buy_soap_155_7 -wget http://$1:9000/trans_buy_soap_200_7 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_add_bread_10_4 -wget http://$1:9000/trans_add_bread_1340_4 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_pen_5_5 -wget http://$1:9000/trans_add_pen_0_5 -wget http://$1:9000/trans_add_pen_300_5 -wget http://$1:9000/trans_add_pen_45_5 -wget http://$1:9000/trans_add_soap_2_7 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_add_soap_42_7 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_soap_888 -wget http://$1:9000/trans_add_soap_72_7 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_soap_155_7 -wget http://$1:9000/trans_buy_soap_200_7 -wget http://$1:9000/trans_buy_soap_155_7 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_soap_155_7 -wget http://$1:9000/trans_buy_soap_155_7 -wget http://$1:9000/trans_buy_soap_200_7 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_add_bread_10_4 -wget http://$1:9000/trans_add_bread_1340_4 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_bread_220 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_buy_soap_8 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_add_book_10_50 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_soap_20_7 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_soap_888 -wget http://$1:9000/trans_add_soap_72_7 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_pen_11 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_soap_2_7 -wget http://$1:9000/trans_add_soap_2_7 -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_add_car_2_10000 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_car_2_10000 -wget http://$1:9000/trans_add_pen_50_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_add_coke_100_5 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_add_soap_20_7 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_soap_888 -wget http://$1:9000/trans_add_soap_72_7 -wget http://$1:9000/trans_inventory -wget http://$1:9000/trans_buy_pen_11 diff --git a/Robust/src/Benchmarks/WebServer/compileserver b/Robust/src/Benchmarks/WebServer/compileserver deleted file mode 100755 index 8070674f..00000000 --- a/Robust/src/Benchmarks/WebServer/compileserver +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/bash -./buildscripttaskerror trans WebServerSocket.java WebServerExample.java Logger.java ItemInfo.java Inventory.java diff --git a/Robust/src/Benchmarks/WebServer/htmlfiles/index1.html b/Robust/src/Benchmarks/WebServer/htmlfiles/index1.html deleted file mode 100644 index e46085cf..00000000 --- a/Robust/src/Benchmarks/WebServer/htmlfiles/index1.html +++ /dev/null @@ -1,25 +0,0 @@ -Google - -

    Google

    -
    Web    Images    VideoNew!    News    Maps    more » -
     
      Advanced Search
      Preferences
      Language Tools


    Advertising Programs - Business Solutions - About Google

    ©2006 Google

    diff --git a/Robust/src/Benchmarks/WebServer/htmlfiles/index2.html b/Robust/src/Benchmarks/WebServer/htmlfiles/index2.html deleted file mode 100644 index b545ec08..00000000 --- a/Robust/src/Benchmarks/WebServer/htmlfiles/index2.html +++ /dev/null @@ -1,8 +0,0 @@ - - - Test HTML Document - - -

    Testing html file for display on web browser.

    - - diff --git a/Robust/src/Benchmarks/WebServer/htmlfiles/request.log b/Robust/src/Benchmarks/WebServer/htmlfiles/request.log deleted file mode 100755 index 2e982db4..00000000 --- a/Robust/src/Benchmarks/WebServer/htmlfiles/request.log +++ /dev/null @@ -1,16 +0,0 @@ - -New Request received: index2.html -New Request received: favicon.ico -New Request received: index2.html -New Request received: favicon.ico -New Request received: index2.html -New Request received: favicon.ico -New Request received: index2.html -New Request received: favicon.ico -New Request received: index2.html -New Request received: favicon.ico -New Request received: index2.html -New Request received: favicon.ico -New Request received: index2.html -New Request received: favicon.ico -New Request received: index2.html \ No newline at end of file diff --git a/Robust/src/Benchmarks/WebServerJ/Inventory.java b/Robust/src/Benchmarks/WebServerJ/Inventory.java deleted file mode 100644 index 570ac6b8..00000000 --- a/Robust/src/Benchmarks/WebServerJ/Inventory.java +++ /dev/null @@ -1,94 +0,0 @@ -import java.util.*; -import java.net.*; -import java.io.*; - -public class Inventory { - // Transaction variables - int numitems; - HashMap map; - int balance; - - // Constructor - public Inventory(){ - map = new HashMap(); - balance=100000; - } - - public Inventory(int howmany) { - numitems = howmany;// howmany keeps track of the number of items - // in the inventory - map = new HashMap(); - } - - // Add item to a list of inventory - public synchronized void additem(String name, int quantity, int price){ - ItemInfo newitem = new ItemInfo(quantity, price); - balance-=quantity*price; - - // Get the item from hash - if (map.containsKey(name) == false) { - map.put(name, newitem); - } else { - ItemInfo i = (ItemInfo) map.get(name); - i.quantity += quantity; - i.price = price; - map.put(name, i); - } - } - - // Buy item from a given list of inventory - public synchronized int buyitem(String name, int quantity){ - if (map.containsKey(name) == false) { - // System.printString("Error - Item does not exist"); - return -1; - } else { - ItemInfo i = (ItemInfo) map.get(name); - if (i.quantity == 0) { - // System.printString("Error - Item unavailable"); - return -1; - } - if ((i.quantity-quantity) < 0 ) { - // System.printString("Error - Available qty is less: Cannot Buy\n"); - return -1; - } else { - i.quantity -= quantity; - map.put(name, i); - balance+=quantity*i.price; - return i.price; - } - } - } - - //Display the inventory list - public synchronized void inventory(Socket s){ - try { - OutputStream sockout=s.getOutputStream(); - Iterator i = map.keySet().iterator();// Gets key from the hashmap= name of item - Iterator j = map.values().iterator();//Gets the value from hashmap - int totalvalue=balance; - while (i.hasNext() == true) { - StringBuffer sb = new StringBuffer(""); - Object o = i.next(); - String name = o.toString(); - ItemInfo oo = (ItemInfo) j.next(); - sb.append(name); - sb.append(" "); - Integer q = new Integer(oo.quantity); - sb.append(q.toString()); - sb.append(" "); - Integer p = new Integer(oo.price); - sb.append(p.toString()); - sb.append("\n"); - totalvalue+=oo.quantity*oo.price; - sockout.write(sb.toString().getBytes()); - } - StringBuffer sb=new StringBuffer(""); - sb.append("Total value: "); - sb.append((new Integer(totalvalue)).toString()); - sb.append("\n"); - sockout.write(sb.toString().getBytes()); - } catch (Exception e) { - e.printStackTrace(); - } - } -} diff --git a/Robust/src/Benchmarks/WebServerJ/ItemInfo.java b/Robust/src/Benchmarks/WebServerJ/ItemInfo.java deleted file mode 100644 index 18a61a59..00000000 --- a/Robust/src/Benchmarks/WebServerJ/ItemInfo.java +++ /dev/null @@ -1,8 +0,0 @@ -class ItemInfo { - int quantity; - int price; - ItemInfo(int x, int y) { - quantity = x; - price = y; - } -} diff --git a/Robust/src/Benchmarks/WebServerJ/Logger.java b/Robust/src/Benchmarks/WebServerJ/Logger.java deleted file mode 100644 index 558c65f9..00000000 --- a/Robust/src/Benchmarks/WebServerJ/Logger.java +++ /dev/null @@ -1,46 +0,0 @@ -import java.io.*; - -public class Logger { - //Logger flag - FileOutputStream fos; - - - //Constructor - public Logger(){ - try { - fos=new FileOutputStream("request.log");//Open request.log file - } catch (Exception e) { - e.printStackTrace(); - } - } - - //Logs filename as per client requests - public void logrequest(String filename){ - try { - String request = new String("\nNew Request received: "); - fos.write(request.getBytes()); - fos.write(filename.getBytes()); - fos.flush(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - public void logrequest(){ - try { - String request = new String("\nNew Request received: "); - fos.write(request.getBytes()); - fos.flush(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - public void closerequest() { - try { - fos.close(); - } catch (Exception e) { - e.printStackTrace(); - } - } -} diff --git a/Robust/src/Benchmarks/WebServerJ/WebServerExample.java b/Robust/src/Benchmarks/WebServerJ/WebServerExample.java deleted file mode 100644 index c485b18e..00000000 --- a/Robust/src/Benchmarks/WebServerJ/WebServerExample.java +++ /dev/null @@ -1,31 +0,0 @@ -import java.net.*; - -public class WebServerExample { - - public static void main(String arg[]) { - // Create New ServerSocket - // System.printString("W> Starting\n"); - ServerSocket ss=null; - try { - ss= new ServerSocket(9000); - } catch (Exception e){} - // System.printString("W> Creating ServerSocket\n"); - Logger log = new Logger(); - Inventory inventorylist = new Inventory(); - acceptConnection(ss, log, inventorylist); - } - - //Listen for a request and accept request - public static void acceptConnection(ServerSocket ss, Logger log, Inventory inventorylist) { - // System.printString("W> Waiting for connection...\n"); - while(true) { - Socket s=null; - try { - s=ss.accept(); - } catch (Exception e) {} - WebServerThread web = new WebServerThread(s, log, inventorylist); - web.start(); - // System.printString("W> Connected... \n"); - } - } -} diff --git a/Robust/src/Benchmarks/WebServerJ/WebServerThread.java b/Robust/src/Benchmarks/WebServerJ/WebServerThread.java deleted file mode 100644 index 329af8e2..00000000 --- a/Robust/src/Benchmarks/WebServerJ/WebServerThread.java +++ /dev/null @@ -1,275 +0,0 @@ -import java.io.*; -import java.net.*; - -public class WebServerThread extends Thread { - //Filename requested by the client - String filename; - String[] parsed; - String prefix; - Logger log; - Inventory inventorylist; - Socket sock; - InputStream sockin; - OutputStream sockout; - - //Constructor - public WebServerThread(Socket s, Logger log, Inventory inventory){ - parsed = new String[4]; - this.log=log; - this.sock=s; - try { - sockin=s.getInputStream(); - sockout=s.getOutputStream(); - } catch (Exception e) { - e.printStackTrace(); - } - this.inventorylist=inventory; - } - - public void run() { - // Process the incoming http request - while (!clientrequest()) { - } - if(checktrans()==false) { - // Not special transaction , do normal filesending - SendFile(); - LogRequest(); - } else { - // Invoke special inventory transaction - Transaction(); - LogRequest(); - } - } - - //Do the WriteIO on server socket and send the requested file to Client - public void SendFile() { - sendfile(); - try { - sock.close(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - // Log the Client request - public void LogRequest() { - log.logrequest(filename); - } - - //Transaction on Inventory - public void Transaction() { - // Parse - int op = parseTransaction(); - // Check for the kind of operation - if (op == 0 ) { /* Add */ - // System.printString("DEBUG > Calling add transaction\n"); - Integer qty = new Integer(parsed[2]); - Integer price = new Integer(parsed[3]); - inventorylist.additem(parsed[1], qty.intValue(), price.intValue()); - httpresponse(); - StringBuffer s = new StringBuffer("Added Item "); - s.append(parsed[1]); - s.append(" Quantity "); - s.append(parsed[2]); - s.append(" Price "); - s.append(parsed[3]); - s.append("\n"); - String towrite = new String(s); - try { - sockout.write(towrite.getBytes()); - } catch (Exception e) { - e.printStackTrace(); - } - } else if (op == 1) { /* Buy */ - // System.printString("DEBUG > Calling buy transaction\n"); - Integer qty = new Integer(parsed[2]); - int ret = inventorylist.buyitem(parsed[1], qty.intValue()); - if (ret >= 0) { - httpresponse(); - StringBuffer s = new StringBuffer("Bought item "); - s.append(parsed[1]); - s.append(" Quantity "); - s.append(parsed[2]); - s.append(" Cost "); - Integer cost = new Integer(ret*qty.intValue()); - String c = cost.toString(); - s.append(c); - String towrite = new String(s); - try { - sockout.write(towrite.getBytes()); - } catch (Exception e) { - e.printStackTrace(); - } - } else { - httpresponse(); - String s = new String("Error encountered"); - try { - sockout.write(s.getBytes()); - } catch (Exception e) { - e.printStackTrace(); - } - } - } else if (op == 2) { /* Inventory */ - // System.printString("DEBUG > Calling inventory transaction\n"); - httpresponse(); - inventorylist.inventory(sock); - } else { /* Error */ - // System.printString("T > Error - Unknown transaction\n"); - } - //Invoke close operations - try { - sock.close(); - } catch (Exception e) {e.printStackTrace();} - } - - - //Send the http header for web browser display - public void httpresponse(){ - StringBuffer header = new StringBuffer("HTTP/1.0 200 OK\n"); - header.append("Content-type: text/html\n"); - header.append("\n\n"); - String temp_str = new String(header); - try { - sockout.write(temp_str.getBytes()); - } catch (Exception e) { - e.printStackTrace(); - } - return; - - } - - // Send the html file , read from file one byte at a time - public void sendfile() { - StringBuffer req_file = new StringBuffer("./htmlfiles/"); - req_file.append(filename); - String filepath = new String(req_file); - FileInputStream def_file = null; - try { - def_file=new FileInputStream(filepath); - } catch (FileNotFoundException e) { - } - // int status = def_file.getfd();//Checks if the file is present in - //current directory - httpresponse(); - if (def_file == null){ - StringBuffer response = new StringBuffer("404: not found: ");//Send 404 error if - // file not found - response.append(filename); - String buffer = new String(response); - try { - sockout.write(buffer.getBytes()); - } catch (Exception e) { - e.printStackTrace(); - } - try { - def_file.close(); - } catch (Exception e) { - e.printStackTrace(); - } - return; - } - byte buf[] = new byte[16]; - int ret; - - try { - while ((ret = def_file.read(buf)) > 0) {// Read from file and write - // one byte at a time into the socket - byte tosend[] = new byte[ret]; - for (int i = 0; i < ret; i++) { - tosend[i] = buf[i]; - } - sockout.write(tosend); - //String str = new String(tosend); - } - def_file.close(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - //Read the client request and extract the filename from it - public boolean clientrequest(){ - byte b1[] = new byte[1024]; - int numbytes=0; - try { - numbytes=sockin.read(b1);//Read client request from web server socket - } catch (Exception e) { - e.printStackTrace(); - } - String curr=(new String(b1)).substring(0, numbytes); - if (prefix!=null) { - StringBuffer sb=new StringBuffer(prefix); - sb.append(curr); - curr=sb.toString(); - } - prefix=curr; - if(prefix.indexOf("\r\n\r\n")>=0) { - - int index = prefix.indexOf('/');//Parse the GET client request to find filename - int end = prefix.indexOf('H'); - filename = prefix.substring((index+1), (end-1)); - // System.printString("\n"); - return true; - } - return false; - } - - // Parse for the prefix in the client request - // This is helpful to find if the prefix is a special transaction - public boolean checktrans(){ - if (filename.startsWith("trans") == true) { - return true; - } else { - return false; - } - } - - //Parse for the substrings in the filename and use it to obtain the - //kind of operation, name of item, quantity of item, price of item - //e.g. trans_add_car_2_10000 is the filename - //store in the parsed[] string , add,car,2,1000 - public int parseTransaction(){ - int start = filename.indexOf('_'); - String s = filename.substring(start+1); - - if (s.startsWith("add")==true){ - // System.printString("DEBUG > ADD\n"); - int i1 = s.indexOf('_'); - parsed[0] = new String(s.substring(0,i1)); - - int i2 = s.indexOf('_',i1+1); - parsed[1] = new String(s.substring(i1+1,i2)); - - int i3 = s.indexOf('_',i2+1); - parsed[2] = new String(s.substring(i2+1,i3)); - - String s3 = s.substring(i3+1); - parsed[3] = s3; - - return 0; - - } - if (s.startsWith("buy")==true){ - // System.printString("DEBUG > BUY\n"); - int i1 = s.indexOf('_'); - parsed[0] = s.substring(0,i1); - - int i2 = s.indexOf('_', i1+1); - parsed[1] = s.substring(i1+1,i2); - - String s2 = s.substring(i2+1); - parsed[2] = s2; - - parsed[3] = ""; - - return 1; - } - if (s.startsWith("inventory")==true){ - // System.printString("DEBUG > INVENTORY\n"); - return 2; - - } - // Error transaction - return -1; - } -} diff --git a/Robust/src/Benchmarks/WebServerJava/Inventory.java b/Robust/src/Benchmarks/WebServerJava/Inventory.java deleted file mode 100644 index 4c839535..00000000 --- a/Robust/src/Benchmarks/WebServerJava/Inventory.java +++ /dev/null @@ -1,87 +0,0 @@ -public class Inventory { - // Transaction variables - int numitems; - HashMap map; - int balance; - - // Constructor - public Inventory(){ - map = new HashMap(); - balance=100000; - } - - public Inventory(int howmany) { - numitems = howmany;// howmany keeps track of the number of items - // in the inventory - map = new HashMap(); - } - - // Add item to a list of inventory - public synchronized int additem(String name, int quantity, int price){ - ItemInfo newitem = new ItemInfo(quantity, price); - balance-=quantity*price; - - // Get the item from hash - if (map.containsKey(name) == false) { - map.put(name, newitem); - } else { - ItemInfo i = (ItemInfo) map.get(name); - i.quantity += quantity; - i.price = price; - map.put(name, i); - } - return 0; - } - - // Buy item from a given list of inventory - public synchronized int buyitem(String name, int quantity){ - if (map.containsKey(name) == false) { - // System.printString("Error - Item does not exist"); - return -1; - } else { - ItemInfo i = (ItemInfo) map.get(name); - if (i.quantity == 0) { - // System.printString("Error - Item unavailable"); - return -1; - } - if ((i.quantity-quantity) < 0 ) { - // System.printString("Error - Available qty is less: Cannot Buy\n"); - return -1; - } else { - i.quantity -= quantity; - map.put(name, i); - balance+=quantity*i.price; - return i.price; - } - } - return 0; - } - - //Display the inventory list - public synchronized void inventory(Socket s){ - HashMapIterator i = new HashMapIterator(map, 0);// Gets key from the hashmap= name of item - HashMapIterator j = new HashMapIterator(map, 1);//Gets the value from hashmap - int totalvalue=balance; - while (i.hasNext() == true) { - StringBuffer sb = new StringBuffer(""); - Object o = i.next(); - String name = o.toString(); - ItemInfo oo = (ItemInfo) j.next(); - sb.append(name); - sb.append(" "); - Integer q = new Integer(oo.quantity); - sb.append(q.toString()); - sb.append(" "); - Integer p = new Integer(oo.price); - sb.append(p.toString()); - sb.append("\n"); - totalvalue+=oo.quantity*oo.price; - s.write(sb.toString().getBytes()); - } - StringBuffer sb=new StringBuffer(""); - sb.append("Total value: "); - sb.append((new Integer(totalvalue)).toString()); - sb.append("\n"); - s.write(sb.toString().getBytes()); - } -} diff --git a/Robust/src/Benchmarks/WebServerJava/ItemInfo.java b/Robust/src/Benchmarks/WebServerJava/ItemInfo.java deleted file mode 100644 index 18a61a59..00000000 --- a/Robust/src/Benchmarks/WebServerJava/ItemInfo.java +++ /dev/null @@ -1,8 +0,0 @@ -class ItemInfo { - int quantity; - int price; - ItemInfo(int x, int y) { - quantity = x; - price = y; - } -} diff --git a/Robust/src/Benchmarks/WebServerJava/Logger.java b/Robust/src/Benchmarks/WebServerJava/Logger.java deleted file mode 100644 index 9e7d3aba..00000000 --- a/Robust/src/Benchmarks/WebServerJava/Logger.java +++ /dev/null @@ -1,27 +0,0 @@ -public class Logger { - FileOutputStream fos; - - - //Constructor - public Logger(){ - fos=new FileOutputStream("request.log");//Open request.log file - } - - //Logs filename as per client requests - public synchronized void logrequest(String filename){ - String request = new String("\nNew Request received: "); - fos.write(request.getBytes()); - fos.write(filename.getBytes()); - fos.flush(); - } - - public synchronized void logrequest(){ - String request = new String("\nNew Request received: "); - fos.write(request.getBytes()); - fos.flush(); - } - - public void closerequest() { - fos.close(); - } -} diff --git a/Robust/src/Benchmarks/WebServerJava/WebServerExampleJava.java b/Robust/src/Benchmarks/WebServerJava/WebServerExampleJava.java deleted file mode 100644 index 0bb291fc..00000000 --- a/Robust/src/Benchmarks/WebServerJava/WebServerExampleJava.java +++ /dev/null @@ -1,23 +0,0 @@ -public class WebServerExample { - - public static int main(String arg[]) { - // Create New ServerSocket - // System.printString("W> Starting\n"); - ServerSocket ss = new ServerSocket(9000); - // System.printString("W> Creating ServerSocket\n"); - Logger log = new Logger(); - Inventory inventorylist = new Inventory(); - acceptConnection(ss, log, inventorylist); - } - - //Listen for a request and accept request - public static void acceptConnection(ServerSocket ss, Logger log, Inventory inventorylist) { - // System.printString("W> Waiting for connection...\n"); - while(true) { - Socket s=ss.accept(); - WebServerThread web = new WebServerThread(s, log, inventorylist); - web.start(); - // System.printString("W> Connected... \n"); - } - } -} diff --git a/Robust/src/Benchmarks/WebServerJava/WebServerThread.java b/Robust/src/Benchmarks/WebServerJava/WebServerThread.java deleted file mode 100644 index 53782b5a..00000000 --- a/Robust/src/Benchmarks/WebServerJava/WebServerThread.java +++ /dev/null @@ -1,227 +0,0 @@ -public class WebServerThread extends Thread { - //Filename requested by the client - String filename; - String[] parsed; - String prefix; - Logger log; - Inventory inventorylist; - Socket sock; - - //Constructor - public WebServerThread(Socket s, Logger log, Inventory inventory){ - parsed = new String[4]; - this.log=log; - this.sock=s; - this.inventorylist=inventory; - } - - public void run() { - // Process the incoming http request - while (!clientrequest()) { - } - if(checktrans()==false) { - // Not special transaction , do normal filesending - SendFile(); - LogRequest(); - } else { - // Invoke special inventory transaction - Transaction(); - LogRequest(); - } - } - - //Do the WriteIO on server socket and send the requested file to Client - public void SendFile() { - sendfile(); - sock.close(); - } - - // Log the Client request - public void LogRequest() { - log.logrequest(filename); - } - - //Transaction on Inventory - public void Transaction() { - // Parse - int op = parseTransaction(); - // Check for the kind of operation - if (op == 0 ) { /* Add */ - // System.printString("DEBUG > Calling add transaction\n"); - Integer qty = new Integer(parsed[2]); - Integer price = new Integer(parsed[3]); - int ret = inventorylist.additem(parsed[1], qty.intValue(), price.intValue()); - if (ret == 0) { - httpresponse(); - StringBuffer s = new StringBuffer("Added Item "); - s.append(parsed[1]); - s.append(" Quantity "); - s.append(parsed[2]); - s.append(" Price "); - s.append(parsed[3]); - s.append("\n"); - String towrite = new String(s); - sock.write(towrite.getBytes()); - } else { - httpresponse(); - String s = new String("Error encountered"); - sock.write(s.getBytes()); - } - } else if (op == 1) { /* Buy */ - // System.printString("DEBUG > Calling buy transaction\n"); - Integer qty = new Integer(parsed[2]); - int ret = inventorylist.buyitem(parsed[1], qty.intValue()); - if (ret >= 0) { - httpresponse(); - StringBuffer s = new StringBuffer("Bought item "); - s.append(parsed[1]); - s.append(" Quantity "); - s.append(parsed[2]); - s.append(" Cost "); - Integer cost = new Integer(ret*qty.intValue()); - String c = cost.toString(); - s.append(c); - String towrite = new String(s); - sock.write(towrite.getBytes()); - } else { - httpresponse(); - String s = new String("Error encountered"); - sock.write(s.getBytes()); - } - } else if (op == 2) { /* Inventory */ - // System.printString("DEBUG > Calling inventory transaction\n"); - httpresponse(); - inventorylist.inventory(sock); - } else { /* Error */ - // System.printString("T > Error - Unknown transaction\n"); - } - //Invoke close operations - sock.close(); - } - - - //Send the http header for web browser display - public void httpresponse(){ - StringBuffer header = new StringBuffer("HTTP/1.0 200 OK\n"); - header.append("Content-type: text/html\n"); - header.append("\n\n"); - String temp_str = new String(header); - sock.write(temp_str.getBytes()); - return; - - } - - // Send the html file , read from file one byte at a time - public void sendfile() { - StringBuffer req_file = new StringBuffer("./htmlfiles/"); - req_file.append(filename); - String filepath = new String(req_file); - FileInputStream def_file = new FileInputStream(filepath); - int status = def_file.getfd();//Checks if the file is present in - //current directory - httpresponse(); - if (status == -1){ - StringBuffer response = new StringBuffer("404: not found: ");//Send 404 error if - // file not found - response.append(filename); - String buffer = new String(response); - sock.write(buffer.getBytes()); - def_file.close(); - return; - } - byte buf[] = new byte[16]; - int ret; - - while ((ret = def_file.read(buf)) > 0) {// Read from file and write - // one byte at a time into the socket - byte tosend[] = new byte[ret]; - for (int i = 0; i < ret; i++) { - tosend[i] = buf[i]; - } - sock.write(tosend); - //String str = new String(tosend); - } - def_file.close(); - } - - //Read the client request and extract the filename from it - public boolean clientrequest(){ - byte b1[] = new byte[1024]; - int numbytes=sock.read(b1);//Read client request from web server socket - String curr=(new String(b1)).subString(0, numbytes); - if (prefix!=null) { - StringBuffer sb=new StringBuffer(prefix); - sb.append(curr); - curr=sb.toString(); - } - prefix=curr; - if(prefix.indexOf("\r\n\r\n")>=0) { - - int index = prefix.indexOf('/');//Parse the GET client request to find filename - int end = prefix.indexOf('H'); - filename = prefix.subString((index+1), (end-1)); - // System.printString("\n"); - return true; - } - return false; - } - - // Parse for the prefix in the client request - // This is helpful to find if the prefix is a special transaction - public boolean checktrans(){ - if (filename.startsWith("trans") == true) { - return true; - } else { - return false; - } - } - - //Parse for the substrings in the filename and use it to obtain the - //kind of operation, name of item, quantity of item, price of item - //e.g. trans_add_car_2_10000 is the filename - //store in the parsed[] string , add,car,2,1000 - public int parseTransaction(){ - int start = filename.indexOf('_'); - String s = filename.subString(start+1); - - if (s.startsWith("add")==true){ - // System.printString("DEBUG > ADD\n"); - int i1 = s.indexOf('_'); - parsed[0] = new String(s.subString(0,i1)); - - int i2 = s.indexOf('_',i1+1); - parsed[1] = new String(s.subString(i1+1,i2)); - - int i3 = s.indexOf('_',i2+1); - parsed[2] = new String(s.subString(i2+1,i3)); - - String s3 = s.subString(i3+1); - parsed[3] = s3; - - return 0; - - } - if (s.startsWith("buy")==true){ - // System.printString("DEBUG > BUY\n"); - int i1 = s.indexOf('_'); - parsed[0] = s.subString(0,i1); - - int i2 = s.indexOf('_', i1+1); - parsed[1] = s.subString(i1+1,i2); - - String s2 = s.subString(i2+1); - parsed[2] = s2; - - parsed[3] = ""; - - return 1; - } - if (s.startsWith("inventory")==true){ - // System.printString("DEBUG > INVENTORY\n"); - return 2; - - } - // Error transaction - return -1; - } -} diff --git a/Robust/src/Benchmarks/WebServerTag/Inventory.java b/Robust/src/Benchmarks/WebServerTag/Inventory.java deleted file mode 100644 index 74756956..00000000 --- a/Robust/src/Benchmarks/WebServerTag/Inventory.java +++ /dev/null @@ -1,91 +0,0 @@ -public class Inventory { - // Inventory flags - flag TransInitialize; - - // Transaction variables - int numitems; - HashMap map; - int balance; - - // Constructor - public Inventory(){ - map = new HashMap(); - balance=100000; - } - - public Inventory(int howmany) { - numitems = howmany;// howmany keeps track of the number of items - // in the inventory - map = new HashMap(); - } - - // Add item to a list of inventory - public int additem(String name, int quantity, int price){ - ItemInfo newitem = new ItemInfo(quantity, price); - balance-=quantity*price; - - // Get the item from hash - if (map.containsKey(name) == false) { - map.put(name, newitem); - } else { - ItemInfo i = (ItemInfo) map.get(name); - i.quantity += quantity; - i.price = price; - map.put(name, i); - } - return 0; - } - - // Buy item from a given list of inventory - public int buyitem(String name, int quantity){ - if (map.containsKey(name) == false) { - // System.printString("Error - Item does not exist"); - return -1; - } else { - ItemInfo i = (ItemInfo) map.get(name); - if (i.quantity == 0) { - // System.printString("Error - Item unavailable"); - return -1; - } - if ((i.quantity-quantity) < 0 ) { - // System.printString("Error - Available qty is less: Cannot Buy\n"); - return -1; - } else { - i.quantity -= quantity; - map.put(name, i); - balance+=quantity*i.price; - return i.price; - } - } - return 0; - } - - //Display the inventory list - //Display the inventory list - public synchronized void inventory(Socket s){ - HashMapIterator i = new HashMapIterator(map, 0);// Gets key from the hashmap= name of item - HashMapIterator j = new HashMapIterator(map, 1);//Gets the value from hashmap - int totalvalue=balance; - while (i.hasNext() == true) { - StringBuffer sb = new StringBuffer(""); - Object o = i.next(); - String name = o.toString(); - ItemInfo oo = (ItemInfo) j.next(); - sb.append(name); - sb.append(" "); - Integer q = new Integer(oo.quantity); - sb.append(q.toString()); - sb.append(" "); - Integer p = new Integer(oo.price); - sb.append(p.toString()); - sb.append("\n"); - totalvalue+=oo.quantity*oo.price; - s.write(sb.toString().getBytes()); - } - StringBuffer sb=new StringBuffer(""); - sb.append("Total value: "); - sb.append((new Integer(totalvalue)).toString()); - sb.append("\n"); - s.write(sb.toString().getBytes()); - } -} diff --git a/Robust/src/Benchmarks/WebServerTag/ItemInfo.java b/Robust/src/Benchmarks/WebServerTag/ItemInfo.java deleted file mode 100644 index 18a61a59..00000000 --- a/Robust/src/Benchmarks/WebServerTag/ItemInfo.java +++ /dev/null @@ -1,8 +0,0 @@ -class ItemInfo { - int quantity; - int price; - ItemInfo(int x, int y) { - quantity = x; - price = y; - } -} diff --git a/Robust/src/Benchmarks/WebServerTag/Logger.java b/Robust/src/Benchmarks/WebServerTag/Logger.java deleted file mode 100644 index a23cc4fa..00000000 --- a/Robust/src/Benchmarks/WebServerTag/Logger.java +++ /dev/null @@ -1,29 +0,0 @@ -public class Logger { - //Logger flag - flag Initialize; - FileOutputStream fos; - - - //Constructor - public Logger(){ - fos=new FileOutputStream("request.log");//Open request.log file - } - - //Logs filename as per client requests - public void logrequest(String filename){ - String request = new String("\nNew Request received: "); - fos.write(request.getBytes()); - fos.write(filename.getBytes()); - fos.flush(); - } - - public void logrequest(){ - String request = new String("\nNew Request received: "); - fos.write(request.getBytes()); - fos.flush(); - } - - public void closerequest() { - fos.close(); - } -} diff --git a/Robust/src/Benchmarks/WebServerTag/WebServerExample.java b/Robust/src/Benchmarks/WebServerTag/WebServerExample.java deleted file mode 100644 index be86e36a..00000000 --- a/Robust/src/Benchmarks/WebServerTag/WebServerExample.java +++ /dev/null @@ -1,110 +0,0 @@ -/* Startup object is generated with the initialstate flag set by the - * system to start the computation up */ - -// Create New ServerSocket -task Startup(StartupObject s {initialstate}) { -// System.printString("W> Starting\n"); - ServerSocket ss = new ServerSocket(9000); -// System.printString("W> Creating ServerSocket\n"); - Logger log = new Logger() {Initialize}; - Inventory inventorylist = new Inventory(){TransInitialize}; - taskexit(s {!initialstate}); /* Turns initial state flag off, so this task won't refire */ -} - -//Listen for a request and accept request -task AcceptConnection(ServerSocket ss{SocketPending}) { - // System.printString("W> Waiting for connection...\n"); - tag t=new tag(link); - WebServerSocket web = new WebServerSocket() {!WritePending, !TransPending, WebInitialize}{t}; - ss.accept(t); -// System.printString("W> Connected... \n"); -} - -// Process the incoming http request -task ProcessRequest(WebServerSocket web{WebInitialize}{link l}, Socket s{IOPending}{link l}) { - if (web.clientrequest(s)) { - if(web.checktrans()==false) - // Not special transaction , do normal filesending - taskexit(web {WritePending, LogPending,!WebInitialize}); //Sets the WritePending and LogPending flag true - else - // Invoke special inventory transaction - taskexit(web {TransPending, LogPending,!WebInitialize}); - } -} - -//Do the WriteIO on server socket and send the requested file to Client -task SendFile(WebServerSocket web{WritePending}{link l}, Socket s{}{link l}) { -// System.printString("W> Inside SendFile ... \n"); - web.sendfile(s); - s.close(); - taskexit(web {!WritePending}); -} - -// Log the Client request -task LogRequest(WebServerSocket web{LogPending}, Logger log{Initialize}) { -//Task fired when both -// LogPending and Initialize flags are true -// System.printString("L > Inside logrequest\n"); - log.logrequest(web.filename); - taskexit(web {!LogPending}); -} - -//Transaction on Inventory -task Transaction(WebServerSocket web{TransPending}{link l}, Inventory inventorylist{TransInitialize},Socket s{}{link l}){ //Task for WebServerTransactions -// System.printString("T > Inside Transaction\n"); - // Parse - int op = web.parseTransaction(); - // Check for the kind of operation - if (op == 0 ) { /* Add */ -// System.printString("DEBUG > Calling add transaction\n"); - Integer qty = new Integer(web.parsed[2]); - Integer price = new Integer(web.parsed[3]); - int ret = inventorylist.additem(web.parsed[1], qty.intValue(), price.intValue()); - if (ret == 0) { - web.httpresponse(s); - StringBuffer st = new StringBuffer("Added Item "); - st.append(web.parsed[1]); - st.append(" Quantity "); - st.append(web.parsed[2]); - st.append(" Price "); - st.append(web.parsed[3]); - st.append("\n"); - String towrite = new String(st); - s.write(towrite.getBytes()); - } else { - web.httpresponse(s); - String st = new String("Error encountered"); - s.write(st.getBytes()); - } - } else if (op == 1) { /* Buy */ -// System.printString("DEBUG > Calling buy transaction\n"); - Integer qty = new Integer(web.parsed[2]); - int ret = inventorylist.buyitem(web.parsed[1], qty.intValue()); - if (ret >= 0) { - web.httpresponse(s); - StringBuffer st = new StringBuffer("Bought item "); - st.append(web.parsed[1]); - st.append(" Quantity "); - st.append(web.parsed[2]); - st.append(" Cost "); - Integer cost = new Integer(ret*qty.intValue()); - String c = cost.toString(); - st.append(c); - String towrite = new String(st); - s.write(towrite.getBytes()); - } else { - web.httpresponse(s); - String st = new String("Error encountered"); - s.write(st.getBytes()); - } - } else if (op == 2) { /* Inventory */ -// System.printString("DEBUG > Calling inventory transaction\n"); - web.httpresponse(s); - inventorylist.inventory(s); - } else { /* Error */ -// System.printString("T > Error - Unknown transaction\n"); - } - //Invoke close operations - s.close(); - taskexit(web {!TransPending}); -} diff --git a/Robust/src/Benchmarks/WebServerTag/WebServerSocket.java b/Robust/src/Benchmarks/WebServerTag/WebServerSocket.java deleted file mode 100644 index 00d24052..00000000 --- a/Robust/src/Benchmarks/WebServerTag/WebServerSocket.java +++ /dev/null @@ -1,141 +0,0 @@ -public class WebServerSocket { - // Websocket flag - flag LogPending; - flag WritePending; - flag TransPending; - flag WebInitialize; - - //Filename requested by the client - String filename; - String[] parsed; - String prefix; - - //Constructor - public WebServerSocket(){ - parsed = new String[4]; - } - - //Send the http header for web browser display - public void httpresponse(Socket s){ - StringBuffer header = new StringBuffer("HTTP/1.0 200 OK\n"); - header.append("Content-type: text/html\n"); - header.append("\n\n"); - String temp_str = new String(header); - s.write(temp_str.getBytes()); - return; - - } - - // Send the html file , read from file one byte at a time - public void sendfile(Socket s) { - StringBuffer req_file = new StringBuffer("./htmlfiles/"); - req_file.append(filename); - String filepath = new String(req_file); - FileInputStream def_file = new FileInputStream(filepath); - int status = def_file.getfd();//Checks if the file is present in - //current directory - httpresponse(s); - if (status == -1){ - StringBuffer response = new StringBuffer("404: not found: ");//Send 404 error if - // file not found - response.append(filename); - String buffer = new String(response); - s.write(buffer.getBytes()); - def_file.close(); - return; - } - byte buf[] = new byte[16]; - int ret; - - while ((ret = def_file.read(buf)) > 0) {// Read from file and write - // one byte at a time into the socket - byte tosend[] = new byte[ret]; - for (int i = 0; i < ret; i++) { - tosend[i] = buf[i]; - } - s.write(tosend); - //String str = new String(tosend); - } - def_file.close(); - } - - //Read the client request and extract the filename from it - public boolean clientrequest(Socket s){ - byte b1[] = new byte[1024]; - int numbytes=s.read(b1);//Read client request from web server socket - String curr=(new String(b1)).subString(0, numbytes); - if (prefix!=null) { - StringBuffer sb=new StringBuffer(prefix); - sb.append(curr); - curr=sb.toString(); - } - prefix=curr; - if(prefix.indexOf("\r\n\r\n")>=0) { - - int index = prefix.indexOf('/');//Parse the GET client request to find filename - int end = prefix.indexOf('H'); - filename = prefix.subString((index+1), (end-1)); - return true; - } - return false; - } - - // Parse for the prefix in the client request - // This is helpful to find if the prefix is a special transaction - public boolean checktrans(){ - if (filename.startsWith("trans") == true) { - return true; - } else { - return false; - } - } - - //Parse for the substrings in the filename and use it to obtain the - //kind of operation, name of item, quantity of item, price of item - //e.g. trans_add_car_2_10000 is the filename - //store in the parsed[] string , add,car,2,1000 - public int parseTransaction(){ - int start = filename.indexOf('_'); - String s = filename.subString(start+1); - - if (s.startsWith("add")==true){ - // System.printString("DEBUG > ADD\n"); - int i1 = s.indexOf('_'); - parsed[0] = new String(s.subString(0,i1)); - - int i2 = s.indexOf('_',i1+1); - parsed[1] = new String(s.subString(i1+1,i2)); - - int i3 = s.indexOf('_',i2+1); - parsed[2] = new String(s.subString(i2+1,i3)); - - String s3 = s.subString(i3+1); - parsed[3] = s3; - - return 0; - - } - if (s.startsWith("buy")==true){ - // System.printString("DEBUG > BUY\n"); - int i1 = s.indexOf('_'); - parsed[0] = s.subString(0,i1); - - int i2 = s.indexOf('_', i1+1); - parsed[1] = s.subString(i1+1,i2); - - String s2 = s.subString(i2+1); - parsed[2] = s2; - - parsed[3] = ""; - - return 1; - } - if (s.startsWith("inventory")==true){ - // System.printString("DEBUG > INVENTORY\n"); - return 2; - - } - // Error transaction - return -1; - } -} diff --git a/Robust/src/ClassLibrary/Barrier.java b/Robust/src/ClassLibrary/Barrier.java deleted file mode 100644 index 4414cd25..00000000 --- a/Robust/src/ClassLibrary/Barrier.java +++ /dev/null @@ -1,52 +0,0 @@ -public class BarrierServer extends Thread { - int numthreads; - boolean done; - - public BarrierServer(int n) { - numthreads=n; - done=false; - } - - public void run() { - int n; - ServerSocket ss=new ServerSocket(2000); - atomic { - n=numthreads; - done=true; - } - Socket ar[]=new Socket[n]; - for(int i=0;i='0'&&ch<='9') - return ch-'0'; - else if (ch>='a'&&ch<='z') { - int val=(ch-'a')+10; - if (val='A'&&ch<='Z') { - int val=(ch-'A')+10; - if (val(loadFactor*table.length)) { - //Resize the table - resize(); - } - int bin=hash(key); - HashEntry ptr=table[bin]; - while(ptr!=null) { - if (ptr.key.equals(key)) { - Object oldvalue=ptr.value; - ptr.value=value; - return oldvalue; - } - ptr=ptr.next; - } - HashEntry he=new HashEntry(); - he.value=value; - he.key=key; - he.next=table[bin]; - table[bin]=he; - return null; - } -} diff --git a/Robust/src/ClassLibrary/HashMapIterator.java b/Robust/src/ClassLibrary/HashMapIterator.java deleted file mode 100644 index 70e1a405..00000000 --- a/Robust/src/ClassLibrary/HashMapIterator.java +++ /dev/null @@ -1,46 +0,0 @@ -class HashMapIterator { - HashMap map; - int type; - int bin; - HashEntry he; - - public HashMapIterator(HashMap map, int type) { - this.map=map; - this.type=type; - this.bin=0; - this.he=null; - } - - public boolean hasNext() { - if (he!=null&&he.next!=null) - return true; - int i=bin; - while((i0) - h+="."; - h+=(int)address[i]; - } - return h; - } -} diff --git a/Robust/src/ClassLibrary/InputStream.java b/Robust/src/ClassLibrary/InputStream.java deleted file mode 100644 index e3027049..00000000 --- a/Robust/src/ClassLibrary/InputStream.java +++ /dev/null @@ -1,12 +0,0 @@ -public class InputStream { - public int read() { - System.printString("called unimplemented read\n"); - } - public int read(byte[] b) { - System.printString("called unimplemented read(byte[]b)\n"); - } - - public void close() { - System.printString("Called unimplemented close()\n"); - } -} diff --git a/Robust/src/ClassLibrary/Integer.java b/Robust/src/ClassLibrary/Integer.java deleted file mode 100644 index 2358adb7..00000000 --- a/Robust/src/ClassLibrary/Integer.java +++ /dev/null @@ -1,60 +0,0 @@ -public class Integer { - private int value; - - public Integer(int value) { - this.value=value; - } - - public Integer(String str) { - value=Integer.parseInt(str, 10); - } - - public int intValue() { - return value; - } - - public static int parseInt(String str) { - return Integer.parseInt(str, 10); - } - - public static int parseInt(String str, int radix) { - int value=0; - boolean isNeg=false; - int start=0; - byte[] chars=str.getBytes(); - - while(chars[start]==' '||chars[start]=='\t') - start++; - - if (chars[start]=='-') { - isNeg=true; - start++; - } - boolean cont=true; - for(int i=start;cont&&i='0'&&b<='9') - val=b-'0'; - else if (b>='a'&&b<='z') - val=10+b-'a'; - else if (b>='A'&&b<='Z') - val=10+b-'A'; - else { - cont=false; - } - if (cont) { - if (val>=radix) - System.error(); - value=value*radix+val; - } - } - if (isNeg) - value=-value; - return value; - } - - public String toString() { - return String.valueOf(value); - } -} diff --git a/Robust/src/ClassLibrary/Math.java b/Robust/src/ClassLibrary/Math.java deleted file mode 100644 index e9d790a8..00000000 --- a/Robust/src/ClassLibrary/Math.java +++ /dev/null @@ -1,34 +0,0 @@ -public class Math { - //public static final double PI=3.14159265358979323846; - - public static double fabs(double x) { - if (x < 0) { - return -x; - } else { - return x; - } - } - - public static float abs(float a) { - if (a<0) - return -a; - else return a; - } - - public static native double sin(double a); - public static native double cos(double a); - public static native double asin(double a); - public static native double acos(double a); - public static native double tan(double a); - public static native double atan(double a); - public static native double exp(double a); - public static native double sqrt(double a); - public static native double log(double a); - public static native double pow(double a, double b); - - public static native float sinf(float a); - public static native float cosf(float a); - public static native float sqrtf(float a); - public static native double logf(float a); - public static native float powf(float a, float b); -} diff --git a/Robust/src/ClassLibrary/Object.java b/Robust/src/ClassLibrary/Object.java deleted file mode 100644 index e968e17b..00000000 --- a/Robust/src/ClassLibrary/Object.java +++ /dev/null @@ -1,30 +0,0 @@ -public class Object { - public native int nativehashCode(); - private int cachedCode;//first field has to be a primitive - private boolean cachedHash; - - /* DO NOT USE ANY OF THESE - THEY ARE FOR IMPLEMENTING TAGS */ - private Object tags; - - public int hashCode() { - if (!cachedHash) { - cachedCode=nativehashCode(); - cachedHash=true; - } - return cachedCode; - } - - /* DON'T USE THIS METHOD UNLESS NECESSARY */ - /* WE WILL DEPRECATE IT AS SOON AS INSTANCEOF WORKS */ - public native int getType(); - - public String toString() { - return "Object"+hashCode(); - } - - public boolean equals(Object o) { - if (o==this) - return true; - return false; - } -} diff --git a/Robust/src/ClassLibrary/ObjectJava.java b/Robust/src/ClassLibrary/ObjectJava.java deleted file mode 100644 index 59a62f4a..00000000 --- a/Robust/src/ClassLibrary/ObjectJava.java +++ /dev/null @@ -1,33 +0,0 @@ -public class Object { - public int cachedCode; //first field has to be a primitive - public boolean cachedHash; - - public native int nativehashCode(); - private Object nextlockobject; - private Object prevlockobject; - - public int hashCode() { - if (!cachedHash) { - cachedCode=nativehashCode(); - cachedHash=true; - } - return cachedCode; - } - - /* DON'T USE THIS METHOD UNLESS NECESSARY */ - /* WE WILL DEPRECATE IT AS SOON AS INSTANCEOF WORKS */ - public native int getType(); - - public native int MonitorEnter(); - public native int MonitorExit(); - - public String toString() { - return "Object"+hashCode(); - } - - public boolean equals(Object o) { - if (o==this) - return true; - return false; - } -} diff --git a/Robust/src/ClassLibrary/ObjectJavaDSM.java b/Robust/src/ClassLibrary/ObjectJavaDSM.java deleted file mode 100644 index c0e9fc42..00000000 --- a/Robust/src/ClassLibrary/ObjectJavaDSM.java +++ /dev/null @@ -1,30 +0,0 @@ -public class Object { - public int cachedCode; //first field has to be a primitive - public boolean cachedHash; - public Object nextobject; /* Oid */ - public Object localcopy; - - public native int nativehashCode(); - - public int hashCode() { - if (!cachedHash) { - cachedCode=nativehashCode(); - cachedHash=true; - } - return cachedCode; - } - - /* DON'T USE THIS METHOD UNLESS NECESSARY */ - /* WE WILL DEPRECATE IT AS SOON AS INSTANCEOF WORKS */ - public native int getType(); - - public String toString() { - return "Object"+hashCode(); - } - - public boolean equals(Object o) { - if (o==this) - return true; - return false; - } -} diff --git a/Robust/src/ClassLibrary/ObjectJavaNT.java b/Robust/src/ClassLibrary/ObjectJavaNT.java deleted file mode 100644 index 2d768eb6..00000000 --- a/Robust/src/ClassLibrary/ObjectJavaNT.java +++ /dev/null @@ -1,28 +0,0 @@ -public class Object { - public int cachedCode; //first field has to be a primitive - public boolean cachedHash; - - public native int nativehashCode(); - - public int hashCode() { - if (!cachedHash) { - cachedCode=nativehashCode(); - cachedHash=true; - } - return cachedCode; - } - - /* DON'T USE THIS METHOD UNLESS NECESSARY */ - /* WE WILL DEPRECATE IT AS SOON AS INSTANCEOF WORKS */ - public native int getType(); - - public String toString() { - return "Object"+hashCode(); - } - - public boolean equals(Object o) { - if (o==this) - return true; - return false; - } -} diff --git a/Robust/src/ClassLibrary/OutputStream.java b/Robust/src/ClassLibrary/OutputStream.java deleted file mode 100644 index eab22f24..00000000 --- a/Robust/src/ClassLibrary/OutputStream.java +++ /dev/null @@ -1,23 +0,0 @@ -public class OutputStream { - public OutputStream() { - } - - public void write(int ch) { - System.printString("Called unimplemented write(int)\n"); - } - - public void write(byte[] b) { - System.printString("Called unimplemented write(byte[])\n"); - } - - public void write(byte[] b, int off, int len) { - System.printString("Called unimplemented write(byte[],int,int)\n"); - } - - public void flush() { - } - - public void close() { - System.printString("Called unimplemented close()\n"); - } -} diff --git a/Robust/src/ClassLibrary/OutputStreamWriter.java b/Robust/src/ClassLibrary/OutputStreamWriter.java deleted file mode 100644 index 480b78a7..00000000 --- a/Robust/src/ClassLibrary/OutputStreamWriter.java +++ /dev/null @@ -1,14 +0,0 @@ -public class OutputStreamWriter extends Writer { - OutputStream fos; - public OutputStreamWriter(OutputStream fos) { - this.fos=fos; - } - - public void write(String s) { - fos.write(s.getBytes()); - } - - public void flush() { - fos.flush(); - } -} diff --git a/Robust/src/ClassLibrary/ServerSocket.java b/Robust/src/ClassLibrary/ServerSocket.java deleted file mode 100644 index 465ad340..00000000 --- a/Robust/src/ClassLibrary/ServerSocket.java +++ /dev/null @@ -1,37 +0,0 @@ -public class ServerSocket { - /* Socket pending flag */ - external flag SocketPending; - /* File Descriptor */ - int fd; - - private native int createSocket(int port); - - public ServerSocket(int port) { - this.fd=createSocket(port); - } - - public Socket accept() { - Socket s=new Socket(); - int newfd=nativeaccept(s); - s.setFD(newfd); - return s; - } - - public Socket accept(tag td) { - Socket s=new Socket(){}{td}; - int newfd=nativeaccept(s); - s.setFD(newfd); - return s; - } - - /* Lets caller pass in their own Socket object. */ - public void accept(Socket s) { - int newfd=nativeaccept(s); - s.setFD(newfd); - } - - private native int nativeaccept(Socket s); - - public void close(); - -} diff --git a/Robust/src/ClassLibrary/ServerSocketJava.java b/Robust/src/ClassLibrary/ServerSocketJava.java deleted file mode 100644 index 30e9638a..00000000 --- a/Robust/src/ClassLibrary/ServerSocketJava.java +++ /dev/null @@ -1,28 +0,0 @@ -public class ServerSocket { - /* File Descriptor */ - int fd; - - private native int createSocket(int port); - - public ServerSocket(int port) { - this.fd=createSocket(port); - } - - public Socket accept() { - Socket s=new Socket(); - int newfd=nativeaccept(s); - s.setFD(newfd); - return s; - } - - /* Lets caller pass in their own Socket object. */ - public void accept(Socket s) { - int newfd=nativeaccept(s); - s.setFD(newfd); - } - - private native int nativeaccept(Socket s); - - public void close(); - -} diff --git a/Robust/src/ClassLibrary/Signal.java b/Robust/src/ClassLibrary/Signal.java deleted file mode 100644 index 85e88325..00000000 --- a/Robust/src/ClassLibrary/Signal.java +++ /dev/null @@ -1,8 +0,0 @@ -public class Signal { - public Signal() { - } - public native void nativeSigAction(); - public void sigAction() { - nativeSigAction(); - } -} diff --git a/Robust/src/ClassLibrary/Socket.java b/Robust/src/ClassLibrary/Socket.java deleted file mode 100644 index 452e395e..00000000 --- a/Robust/src/ClassLibrary/Socket.java +++ /dev/null @@ -1,71 +0,0 @@ -public class Socket { - /* Data pending flag */ - external flag IOPending; - /* File Descriptor */ - int fd; - private SocketInputStream sin; - private SocketOutputStream sout; - - public Socket() { - sin=new SocketInputStream(this); - sout=new SocketOutputStream(this); - } - - public InputStream getInputStream() { - return sin; - } - - public OutputStream getOutputStream() { - return sout; - } - - public Socket(String host, int port) { - InetAddress address=InetAddress.getByName(host); - fd=nativeBind(address.getAddress(), port); - nativeConnect(fd, address.getAddress(), port); - } - - public Socket(InetAddress address, int port) { - fd=nativeBind(address.getAddress(), port); - nativeConnect(fd, address.getAddress(), port); - } - - public void connect(String host, int port) { - InetAddress address=InetAddress.getByName(host); - fd=nativeBind(address.getAddress(), port); - nativeConnect(fd, address.getAddress(), port); - } - - public void connect(InetAddress address, int port) { - fd=nativeBind(address.getAddress(), port); - nativeConnect(fd, address.getAddress(), port); - } - - public static native int nativeBind(byte[] address, int port); - - public native int nativeConnect(int fd, byte[] address, int port); - - int setFD(int filed) { - fd=filed; - } - - public int read(byte[] b) { - return nativeRead(b); - } - public void write(byte[] b) { - nativeWrite(b, 0, b.length); - } - - public void write(byte[] b, int offset, int len) { - nativeWrite(b, offset, len); - } - - private native void nativeBindFD(int fd); - private native int nativeRead(byte[] b); - private native void nativeWrite(byte[] b, int offset, int len); - private native void nativeClose(); - - public void close() { - nativeClose(); - } -} diff --git a/Robust/src/ClassLibrary/SocketInputStream.java b/Robust/src/ClassLibrary/SocketInputStream.java deleted file mode 100644 index 43e4ed89..00000000 --- a/Robust/src/ClassLibrary/SocketInputStream.java +++ /dev/null @@ -1,22 +0,0 @@ -public class SocketInputStream extends InputStream { - Socket s; - public SocketInputStream(Socket s) { - this.s=s; - } - - public int read() { - byte[] x=new byte[1]; - int len=s.read(x); - if (len<=0) - return -1; - else return x[0]; - } - - public int read(byte[] b) { - return s.read(b); - } - - public void close() { - s.close(); - } -} diff --git a/Robust/src/ClassLibrary/SocketJava.java b/Robust/src/ClassLibrary/SocketJava.java deleted file mode 100644 index c2b85418..00000000 --- a/Robust/src/ClassLibrary/SocketJava.java +++ /dev/null @@ -1,61 +0,0 @@ -public class Socket { - /* File Descriptor */ - int fd; - SocketInputStream sin; - SocketOutputStream sout; - - public Socket() { - sin=new SocketInputStream(this); - sout=new SocketOutputStream(this); - } - - public InputStream getInputStream() { - return sin; - } - - public OutputStream getOutputStream() { - return sout; - } - - public Socket(String host, int port) { - InetAddress address=InetAddress.getByName(host); - fd=nativeBind(address.getAddress(), port); - nativeConnect(fd, address.getAddress(), port); - sin=new SocketInputStream(this); - sout=new SocketOutputStream(this); - } - - public Socket(InetAddress address, int port) { - fd=nativeBind(address.getAddress(), port); - nativeConnect(fd, address.getAddress(), port); - sin=new SocketInputStream(this); - sout=new SocketOutputStream(this); - } - - public static native int nativeBind(byte[] address, int port); - - public static native int nativeConnect(int fd, byte[] address, int port); - - int setFD(int filed) { - fd=filed; - } - - public int read(byte[] b) { - return nativeRead(b); - } - public void write(byte[] b) { - nativeWrite(b, 0, b.length); - } - - public void write(byte[] b, int offset, int len) { - nativeWrite(b, offset, len); - } - - private native int nativeRead(byte[] b); - private native void nativeWrite(byte[] b, int offset, int len); - private native void nativeClose(); - - public void close() { - nativeClose(); - } -} diff --git a/Robust/src/ClassLibrary/SocketOutputStream.java b/Robust/src/ClassLibrary/SocketOutputStream.java deleted file mode 100644 index 4e2a7a69..00000000 --- a/Robust/src/ClassLibrary/SocketOutputStream.java +++ /dev/null @@ -1,24 +0,0 @@ -public class SocketOutputStream extends OutputStream { - Socket s; - public SocketOutputStream(Socket s) { - this.s=s; - } - - public void write(byte[]b) { - s.write(b); - } - - public void write(int ch) { - byte[] b=new byte[1]; - b[0]=(byte)ch; - s.write(b); - } - - public void write(byte[] b, int offset, int len) { - s.write(b, offset, len); - } - - public void close() { - s.close(); - } -} diff --git a/Robust/src/ClassLibrary/StartupObject.java b/Robust/src/ClassLibrary/StartupObject.java deleted file mode 100644 index 14c762a9..00000000 --- a/Robust/src/ClassLibrary/StartupObject.java +++ /dev/null @@ -1,5 +0,0 @@ -public class StartupObject { - flag initialstate; - - String [] parameters; -} diff --git a/Robust/src/ClassLibrary/String.java b/Robust/src/ClassLibrary/String.java deleted file mode 100644 index f1ec9d53..00000000 --- a/Robust/src/ClassLibrary/String.java +++ /dev/null @@ -1,343 +0,0 @@ -public class String { - char value[]; - int count; - int offset; - private int cachedHashcode; - - private String() { - } - - public String(char str[]) { - char charstr[]=new char[str.length]; - for(int i=0;i(str.length-offset)) - length=str.length-offset; - char charstr[]=new char[length]; - for(int i=0;ithis.count||endIndex>this.count||beginIndex>endIndex) { - // FIXME - System.printString("Index error: "+beginIndex+" "+endIndex+" "+count+"\n"+this); - } - str.value=this.value; - str.count=endIndex-beginIndex; - str.offset=this.offset+beginIndex; - return str; - } - - public String subString(int beginIndex) { - return this.subString(beginIndex, this.count); - } - - public int lastindexOf(int ch) { - return this.lastindexOf(ch, count - 1); - } - - public static String concat2(String s1, String s2) { - if (s1==null) - return "null".concat(s2); - else - return s1.concat(s2); - } - - public String concat(String str) { - String newstr=new String(); - newstr.count=this.count+str.count; - char charstr[]=new char[newstr.count]; - newstr.value=charstr; - newstr.offset=0; - for(int i=0;i0;i--) - if (this.charAt(i)==ch) - return i; - return -1; - } - - public String replace(char oldch, char newch) { - char[] buffer=new char[count]; - for(int i=0;i='a'&&x<='z') { - x=(char) ((x-'a')+'A'); - } - buffer[i]=x; - } - return new String(buffer); - } - - public int indexOf(int ch) { - return this.indexOf(ch, 0); - } - - public int indexOf(int ch, int fromIndex) { - for(int i=fromIndex;ifromIndex) - k=fromIndex; - for(;k>=0;k--) { - if (regionMatches(k, str, 0, str.count)) - return k; - } - return -1; - } - - public int lastIndexOf(String str) { - return lastIndexOf(str, count-str.count); - } - - public boolean startsWith(String str) { - return regionMatches(0, str, 0, str.count); - } - - public boolean startsWith(String str, int toffset) { - return regionMatches(toffset, str, 0, str.count); - } - - public boolean regionMatches(int toffset, String other, int ooffset, int len) { - if (toffset<0 || ooffset <0 || (toffset+len)>count || (ooffset+len)>other.count) - return false; - for(int i=0;i='a'&&l<='z') - l=(char)((l-'a')+'A'); - if (r>='a'&&r<='z') - r=(char)((r-'a')+'A'); - if (l!=r) - return false; - } - return true; - } -} diff --git a/Robust/src/ClassLibrary/StringBuffer.java b/Robust/src/ClassLibrary/StringBuffer.java deleted file mode 100644 index f51c7248..00000000 --- a/Robust/src/ClassLibrary/StringBuffer.java +++ /dev/null @@ -1,75 +0,0 @@ -public class StringBuffer { - char value[]; - int count; - // private static final int DEFAULTSIZE=16; - - public StringBuffer(String str) { - value=new char[str.count+16];//16 is DEFAULTSIZE - count=str.count; - for(int i=0;ivalue.length) { - // Need to allocate - char newvalue[]=new char[s.count+count+16]; //16 is DEFAULTSIZE - for(int i=0;ivalue.length) { - // Need to allocate - char newvalue[]=new char[s.count+count+16]; //16 is DEFAULTSIZE - for(int i=0;i=size) { - System.printString("Illegal Vector.elementAt"); - return null; - } - return array[index]; - } - - public void setElementAt(Object obj, int index) { - if (index>=0 && index array.length) { - int newsize; - if (capacityIncrement<=0) - newsize=array.length*2; - else - newsize=array.length+capacityIncrement; - if (newsize=size) - System.printString("Illegal remove"); - for(int i=index;i<(size-1);i++) { - array[i]=array[i+1]; - } - size--; - } -} diff --git a/Robust/src/ClassLibrary/Writer.java b/Robust/src/ClassLibrary/Writer.java deleted file mode 100644 index c1728a2c..00000000 --- a/Robust/src/ClassLibrary/Writer.java +++ /dev/null @@ -1,17 +0,0 @@ -public class Writer { - public void write(String s) { - System.printString("Unimplemented write(String) in Writer\n"); - } - - public void write(String s, int off, int len) { - write(s.substring(off, off+len)); - } - - public void flush() { - System.printString("Unimplemented flush in Writer\n"); - } - - public void close() { - System.printString("Unimplemented close in Writer\n"); - } -} diff --git a/Robust/src/ClassLibrary/gnu/Random.java b/Robust/src/ClassLibrary/gnu/Random.java deleted file mode 100644 index 083da05d..00000000 --- a/Robust/src/ClassLibrary/gnu/Random.java +++ /dev/null @@ -1,421 +0,0 @@ -/* Random.java -- a pseudo-random number generator - Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. - -GNU Classpath is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -General Public License for more details. - -You should have received a copy of the GNU General Public License -along with GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA -02110-1301 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -/** - * This class generates pseudorandom numbers. It uses the same - * algorithm as the original JDK-class, so that your programs behave - * exactly the same way, if started with the same seed. - * - * The algorithm is described in The Art of Computer Programming, - * Volume 2 by Donald Knuth in Section 3.2.1. It is a 48-bit seed, - * linear congruential formula. - * - * If two instances of this class are created with the same seed and - * the same calls to these classes are made, they behave exactly the - * same way. This should be even true for foreign implementations - * (like this), so every port must use the same algorithm as described - * here. - * - * If you want to implement your own pseudorandom algorithm, you - * should extend this class and overload the next() and - * setSeed(long) method. In that case the above - * paragraph doesn't apply to you. - * - * This class shouldn't be used for security sensitive purposes (like - * generating passwords or encryption keys. See SecureRandom - * in package java.security for this purpose. - * - * For simple random doubles between 0.0 and 1.0, you may consider using - * Math.random instead. - * - * @see java.security.SecureRandom - * @see Math#random() - * @author Jochen Hoenicke - * @author Eric Blake (ebb9@email.byu.edu) - * @status updated to 1.4 - */ -public class Random -{ - /** - * True if the next nextGaussian is available. This is used by - * nextGaussian, which generates two gaussian numbers by one call, - * and returns the second on the second call. - * - * @serial whether nextNextGaussian is available - * @see #nextGaussian() - * @see #nextNextGaussian - */ - private boolean haveNextNextGaussian; - - /** - * The next nextGaussian, when available. This is used by nextGaussian, - * which generates two gaussian numbers by one call, and returns the - * second on the second call. - * - * @serial the second gaussian of a pair - * @see #nextGaussian() - * @see #haveNextNextGaussian - */ - private double nextNextGaussian; - - /** - * The seed. This is the number set by setSeed and which is used - * in next. - * - * @serial the internal state of this generator - * @see #next(int) - */ - private long seed; - - - /** - * Creates a new pseudorandom number generator. The seed is initialized - * to the current time, as if by - * setSeed(System.currentTimeMillis());. - * - * @see System#currentTimeMillis() - */ - public Random() - { - setSeed(System.currentTimeMillis()); - } - - /** - * Creates a new pseudorandom number generator, starting with the - * specified seed, using setSeed(seed);. - * - * @param seed the initial seed - */ - public Random(long seed) - { - setSeed(seed); - } - - /** - * Sets the seed for this pseudorandom number generator. As described - * above, two instances of the same random class, starting with the - * same seed, should produce the same results, if the same methods - * are called. The implementation for java.util.Random is: - * -
    public synchronized void setSeed(long seed)
    -{
    -  this.seed = (seed ^ 0x5DEECE66DL) & ((1L << 48) - 1);
    -  haveNextNextGaussian = false;
    -}
    - * - * @param seed the new seed - */ - public synchronized void setSeed(long seed) - { - this.seed = (seed ^ 0x5DEECE66DL) & ((1L << 48) - 1); - haveNextNextGaussian = false; - } - - /** - * Generates the next pseudorandom number. This returns - * an int value whose bits low order bits are - * independent chosen random bits (0 and 1 are equally likely). - * The implementation for java.util.Random is: - * -
    protected synchronized int next(int bits)
    -{
    -  seed = (seed * 0x5DEECE66DL + 0xBL) & ((1L << 48) - 1);
    -  return (int) (seed >>> (48 - bits));
    -}
    - * - * @param bits the number of random bits to generate, in the range 1..32 - * @return the next pseudorandom value - * @since 1.1 - */ - protected synchronized int next(int bits) - { - seed = (seed * 0x5DEECE66DL + 0xBL) & ((1L << 48) - 1); - return (int) (seed >>> (48 - bits)); - } - - /** - * Fills an array of bytes with random numbers. All possible values - * are (approximately) equally likely. - * The JDK documentation gives no implementation, but it seems to be: - * -
    public void nextBytes(byte[] bytes)
    -{
    -  for (int i = 0; i < bytes.length; i += 4)
    -  {
    -    int random = next(32);
    -    for (int j = 0; i + j < bytes.length && j < 4; j++)
    -    {
    -      bytes[i+j] = (byte) (random & 0xff)
    -      random >>= 8;
    -    }
    -  }
    -}
    - * - * @param bytes the byte array that should be filled - * @throws NullPointerException if bytes is null - * @since 1.1 - */ - public void nextBytes(byte[] bytes) - { - int random; - // Do a little bit unrolling of the above algorithm. - int max = bytes.length & ~0x3; - for (int i = 0; i < max; i += 4) - { - random = next(32); - bytes[i] = (byte) random; - bytes[i + 1] = (byte) (random >> 8); - bytes[i + 2] = (byte) (random >> 16); - bytes[i + 3] = (byte) (random >> 24); - } - if (max < bytes.length) - { - random = next(32); - for (int j = max; j < bytes.length; j++) - { - bytes[j] = (byte) random; - random >>= 8; - } - } - } - - /** - * Generates the next pseudorandom number. This returns - * an int value whose 32 bits are independent chosen random bits - * (0 and 1 are equally likely). The implementation for - * java.util.Random is: - * -
    public int nextInt()
    -{
    -  return next(32);
    -}
    - * - * @return the next pseudorandom value - */ - public int nextInt() - { - return next(32); - } - - /** - * Generates the next pseudorandom number. This returns - * a value between 0(inclusive) and n(exclusive), and - * each value has the same likelihodd (1/n). - * (0 and 1 are equally likely). The implementation for - * java.util.Random is: - * -
    -public int nextInt(int n)
    -{
    -  if (n <= 0)
    -    throw new IllegalArgumentException("n must be positive");
    -
    -  if ((n & -n) == n)  // i.e., n is a power of 2
    -    return (int)((n * (long) next(31)) >> 31);
    -
    -  int bits, val;
    -  do
    -  {
    -    bits = next(31);
    -    val = bits % n;
    -  }
    -  while(bits - val + (n-1) < 0);
    -
    -  return val;
    -}
    - * - *

    This algorithm would return every value with exactly the same - * probability, if the next()-method would be a perfect random number - * generator. - * - * The loop at the bottom only accepts a value, if the random - * number was between 0 and the highest number less then 1<<31, - * which is divisible by n. The probability for this is high for small - * n, and the worst case is 1/2 (for n=(1<<30)+1). - * - * The special treatment for n = power of 2, selects the high bits of - * the random number (the loop at the bottom would select the low order - * bits). This is done, because the low order bits of linear congruential - * number generators (like the one used in this class) are known to be - * ``less random'' than the high order bits. - * - * @param n the upper bound - * @throws IllegalArgumentException if the given upper bound is negative - * @return the next pseudorandom value - * @since 1.2 - */ - public int nextInt(int n) - { - if (n <= 0) - System.printString("ERROR: n must be positive\n"); - if ((n & -n) == n) // i.e., n is a power of 2 - return (int) ((n * (long) next(31)) >> 31); - int bits, val; - do - { - bits = next(31); - val = bits % n; - } - while (bits - val + (n - 1) < 0); - return val; - } - - /** - * Generates the next pseudorandom long number. All bits of this - * long are independently chosen and 0 and 1 have equal likelihood. - * The implementation for java.util.Random is: - * -

    public long nextLong()
    -{
    -  return ((long) next(32) << 32) + next(32);
    -}
    - * - * @return the next pseudorandom value - */ - public long nextLong() - { - return ((long) next(32) << 32) + next(32); - } - - /** - * Generates the next pseudorandom boolean. True and false have - * the same probability. The implementation is: - * -
    public boolean nextBoolean()
    -{
    -  return next(1) != 0;
    -}
    - * - * @return the next pseudorandom boolean - * @since 1.2 - */ - public boolean nextBoolean() - { - return next(1) != 0; - } - - /** - * Generates the next pseudorandom float uniformly distributed - * between 0.0f (inclusive) and 1.0f (exclusive). The - * implementation is as follows. - * -
    public float nextFloat()
    -{
    -  return next(24) / ((float)(1 << 24));
    -}
    - * - * @return the next pseudorandom float - */ - public float nextFloat() - { - return next(24) / (float) (1 << 24); - } - - /** - * Generates the next pseudorandom double uniformly distributed - * between 0.0 (inclusive) and 1.0 (exclusive). The - * implementation is as follows. - * -
    public double nextDouble()
    -{
    -  return (((long) next(26) << 27) + next(27)) / (double)(1L << 53);
    -}
    - * - * @return the next pseudorandom double - */ - public double nextDouble() - { - return (((long) next(26) << 27) + next(27)) / (double) (1L << 53); - } - - /** - * Generates the next pseudorandom, Gaussian (normally) distributed - * double value, with mean 0.0 and standard deviation 1.0. - * The algorithm is as follows. - * -
    public synchronized double nextGaussian()
    -{
    -  if (haveNextNextGaussian)
    -  {
    -    haveNextNextGaussian = false;
    -    return nextNextGaussian;
    -  }
    -  else
    -  {
    -    double v1, v2, s;
    -    do
    -    {
    -      v1 = 2 * nextDouble() - 1; // between -1.0 and 1.0
    -      v2 = 2 * nextDouble() - 1; // between -1.0 and 1.0
    -      s = v1 * v1 + v2 * v2;
    -    }
    -    while (s >= 1);
    -
    -    double norm = Math.sqrt(-2 * Math.log(s) / s);
    -    nextNextGaussian = v2 * norm;
    -    haveNextNextGaussian = true;
    -    return v1 * norm;
    -  }
    -}
    - * - *

    This is described in section 3.4.1 of The Art of Computer - * Programming, Volume 2 by Donald Knuth. - * - * @return the next pseudorandom Gaussian distributed double - */ - public synchronized double nextGaussian() - { - if (haveNextNextGaussian) - { - haveNextNextGaussian = false; - return nextNextGaussian; - } - double v1, v2, s; - do - { - v1 = 2 * nextDouble() - 1; // Between -1.0 and 1.0. - v2 = 2 * nextDouble() - 1; // Between -1.0 and 1.0. - s = v1 * v1 + v2 * v2; - } - while (s >= 1); - double norm = Math.sqrt(-2 * Math.log(s) / s); - nextNextGaussian = v2 * norm; - haveNextNextGaussian = true; - return v1 * norm; - } -} diff --git a/Robust/src/IR/AssignOperation.java b/Robust/src/IR/AssignOperation.java deleted file mode 100644 index 121c4d41..00000000 --- a/Robust/src/IR/AssignOperation.java +++ /dev/null @@ -1,131 +0,0 @@ -package IR; - -public class AssignOperation { - public static final int EQ=1; - public static final int MULTEQ=2; - public static final int DIVEQ=3; - public static final int MODEQ=4; - public static final int PLUSEQ=5; - public static final int MINUSEQ=6; - public static final int LSHIFTEQ=7; - public static final int RSHIFTEQ=8; - public static final int URSHIFTEQ=9; - public static final int ANDEQ=10; - public static final int XOREQ=11; - public static final int OREQ=12; - public static final int POSTINC=13; - public static final int POSTDEC=14; - - private int operation; - public AssignOperation(int op) { - this.operation=op; - } - - public AssignOperation(String op) { - this.operation=parseOp(op); - } - - public int getOp() { - return operation; - } - - public Operation getBaseOp() { - switch(operation) { - case EQ: - return null; - case MULTEQ: - return new Operation(Operation.MULT); - case DIVEQ: - return new Operation(Operation.DIV); - case MODEQ: - return new Operation(Operation.MOD); - case PLUSEQ: - return new Operation(Operation.ADD); - case MINUSEQ: - return new Operation(Operation.SUB); - case LSHIFTEQ: - return new Operation(Operation.LEFTSHIFT); - case RSHIFTEQ: - return new Operation(Operation.RIGHTSHIFT); - case URSHIFTEQ: - return new Operation(Operation.URIGHTSHIFT); - case ANDEQ: - return new Operation(Operation.BIT_AND); - case XOREQ: - return new Operation(Operation.BIT_XOR); - case OREQ: - return new Operation(Operation.BIT_OR); - case POSTINC: - return new Operation(Operation.POSTINC); - case POSTDEC: - return new Operation(Operation.POSTDEC); - } - throw new Error(); - } - - public static int parseOp(String st) { - if (st.equals("eq")) - return EQ; - else if (st.equals("multeq")) - return MULTEQ; - else if (st.equals("diveq")) - return DIVEQ; - else if (st.equals("modeq")) - return MODEQ; - else if (st.equals("pluseq")) - return PLUSEQ; - else if (st.equals("minuseq")) - return MINUSEQ; - else if (st.equals("lshifteq")) - return LSHIFTEQ; - else if (st.equals("urshifteq")) - return URSHIFTEQ; - else if (st.equals("rshifteq")) - return RSHIFTEQ; - else if (st.equals("andeq")) - return ANDEQ; - else if (st.equals("xoreq")) - return XOREQ; - else if (st.equals("oreq")) - return OREQ; - else if (st.equals("postinc")) - return POSTINC; - else if (st.equals("postdec")) - return POSTDEC; - else throw new Error(); - } - - public String toString() { - if (operation==EQ) - return "="; - else if (operation==MULTEQ) - return "*="; - else if (operation==DIVEQ) - return "/="; - else if (operation==MODEQ) - return "%="; - else if (operation==PLUSEQ) - return "+="; - else if (operation==MINUSEQ) - return "-="; - else if (operation==LSHIFTEQ) - return "<="; - else if (operation==RSHIFTEQ) - return ">="; - else if (operation==RSHIFTEQ) - return ">>="; - else if (operation==ANDEQ) - return "&="; - else if (operation==XOREQ) - return "^="; - else if (operation==OREQ) - return "|="; - else if (operation==POSTINC) - return "postinc"; - else if (operation==POSTDEC) - return "postdec"; - else throw new Error(); - } - - -} diff --git a/Robust/src/IR/ClassDescriptor.java b/Robust/src/IR/ClassDescriptor.java deleted file mode 100644 index a86ea6af..00000000 --- a/Robust/src/IR/ClassDescriptor.java +++ /dev/null @@ -1,142 +0,0 @@ -package IR; -import java.util.*; -import IR.Tree.*; - -public class ClassDescriptor extends Descriptor { - private static int UIDCount=0; - private final int classid; - String superclass; - ClassDescriptor superdesc; - boolean hasFlags=false; - String packagename; - - Modifiers modifiers; - - SymbolTable fields; - SymbolTable flags; - SymbolTable methods; - - public ClassDescriptor(String classname) { - this("", classname); - } - - public ClassDescriptor(String packagename, String classname) { - super(classname); - superclass=null; - flags=new SymbolTable(); - fields=new SymbolTable(); - methods=new SymbolTable(); - classid=UIDCount++; - this.packagename=packagename; - } - - public int getId() { - return classid; - } - - public Iterator getMethods() { - return methods.getDescriptorsIterator(); - } - - public Iterator getFields() { - return fields.getDescriptorsIterator(); - } - - public Iterator getFlags() { - return flags.getDescriptorsIterator(); - } - - public SymbolTable getFieldTable() { - return fields; - } - - public SymbolTable getFlagTable() { - return flags; - } - - public SymbolTable getMethodTable() { - return methods; - } - - public String getSafeDescriptor() { - return "L"+safename.replace('.','/'); - } - - public String printTree(State state) { - int indent; - String st=modifiers.toString()+"class "+getSymbol(); - if (superclass!=null) - st+="extends "+superclass.toString(); - st+=" {\n"; - indent=TreeNode.INDENT; - boolean printcr=false; - - for(Iterator it=getFlags();it.hasNext();) { - FlagDescriptor fd=(FlagDescriptor)it.next(); - st+=TreeNode.printSpace(indent)+fd.toString()+"\n"; - printcr=true; - } - if (printcr) - st+="\n"; - - printcr=false; - - for(Iterator it=getFields();it.hasNext();) { - FieldDescriptor fd=(FieldDescriptor)it.next(); - st+=TreeNode.printSpace(indent)+fd.toString()+"\n"; - printcr=true; - } - if (printcr) - st+="\n"; - - for(Iterator it=getMethods();it.hasNext();) { - MethodDescriptor md=(MethodDescriptor)it.next(); - st+=TreeNode.printSpace(indent)+md.toString()+" "; - BlockNode bn=state.getMethodBody(md); - st+=bn.printNode(indent)+"\n\n"; - } - st+="}\n"; - return st; - } - - public void addFlag(FlagDescriptor fd) { - if (flags.contains(fd.getSymbol())) - throw new Error(fd.getSymbol()+" already defined"); - hasFlags=true; - flags.add(fd); - } - - public boolean hasFlags() { - return hasFlags||getSuperDesc()!=null&&getSuperDesc().hasFlags(); - } - - public void addField(FieldDescriptor fd) { - if (fields.contains(fd.getSymbol())) - throw new Error(fd.getSymbol()+" already defined"); - fields.add(fd); - } - - public void addMethod(MethodDescriptor md) { - methods.add(md); - } - - public void setModifiers(Modifiers modifiers) { - this.modifiers=modifiers; - } - - public void setSuper(String superclass) { - this.superclass=superclass; - } - - public ClassDescriptor getSuperDesc() { - return superdesc; - } - - public void setSuper(ClassDescriptor scd) { - this.superdesc=scd; - } - - public String getSuper() { - return superclass; - } -} diff --git a/Robust/src/IR/Descriptor.java b/Robust/src/IR/Descriptor.java deleted file mode 100644 index 87d09137..00000000 --- a/Robust/src/IR/Descriptor.java +++ /dev/null @@ -1,46 +0,0 @@ -package IR; - -/** - * Descriptor - * - * represents a symbol in the language (var name, function name, etc). - */ - -public abstract class Descriptor { - - protected String name; - protected String safename; - static int count=0; - int uniqueid; - - public Descriptor(String name) { - this.name = name; - this.safename = "___" + name + "___"; - this.uniqueid=count++; - } - - protected Descriptor(String name, String safename) { - this.name = name; - this.safename = safename; - this.uniqueid=count++; - } - - public String toString() { - return name; - } - - public String getSymbol() { - return name; - } - - public String getSafeSymbol() { - return safename; - } - public int getNum() { - return uniqueid; - } - - public String getCoreSafeSymbol(int num) { - return safename + "core" + num + "___"; - } -} diff --git a/Robust/src/IR/FieldDescriptor.java b/Robust/src/IR/FieldDescriptor.java deleted file mode 100644 index fb67c8fe..00000000 --- a/Robust/src/IR/FieldDescriptor.java +++ /dev/null @@ -1,50 +0,0 @@ -package IR; -import IR.Tree.Modifiers; -import IR.Tree.ExpressionNode; - -/** - * Descriptor - * - * represents a symbol in the language (var name, function name, etc). - */ - -public class FieldDescriptor extends Descriptor { - - public static FieldDescriptor arrayLength=new FieldDescriptor(new Modifiers(Modifiers.PUBLIC|Modifiers.FINAL), new TypeDescriptor(TypeDescriptor.INT), "length", null, false); - - protected Modifiers modifier; - protected TypeDescriptor td; - protected String identifier; - protected ExpressionNode en; - private boolean isglobal; - - public FieldDescriptor(Modifiers m, TypeDescriptor t, String identifier, ExpressionNode e, boolean isglobal) { - super(identifier); - this.modifier=m; - this.td=t; - this.en=e; - this.safename = "___" + name + "___"; - this.uniqueid=count++; - this.isglobal=isglobal; - if (en!=null) throw new Error("Field initializers not implemented"); - } - - public boolean isGlobal() { - return isglobal; - } - - public TypeDescriptor getType() { - return td; - } - - public String toString() { - if (en==null) - return modifier.toString()+td.toString()+" "+getSymbol()+";"; - else - return modifier.toString()+td.toString()+" "+getSymbol()+"="+en.printNode(0)+";"; - } - - public String toStringBrief() { - return td.toString()+" "+getSymbol(); - } -} diff --git a/Robust/src/IR/FlagDescriptor.java b/Robust/src/IR/FlagDescriptor.java deleted file mode 100644 index 4df76913..00000000 --- a/Robust/src/IR/FlagDescriptor.java +++ /dev/null @@ -1,28 +0,0 @@ -package IR; - -/** - * Descriptor - * - * represents a symbol in the language (var name, function name, etc). - */ - -public class FlagDescriptor extends Descriptor { - public final static String InitialFlag="initialstate"; - - public FlagDescriptor(String identifier) { - super(identifier); - } - - private boolean isExternal=false; - public void makeExternal() { - isExternal=true; - } - - public boolean getExternal() { - return isExternal; - } - - public String toString() { - return "Flag "+getSymbol(); - } -} diff --git a/Robust/src/IR/Flat/BuildCode.java b/Robust/src/IR/Flat/BuildCode.java deleted file mode 100644 index 8781ff4e..00000000 --- a/Robust/src/IR/Flat/BuildCode.java +++ /dev/null @@ -1,2836 +0,0 @@ -package IR.Flat; -import IR.Tree.FlagExpressionNode; -import IR.Tree.DNFFlag; -import IR.Tree.DNFFlagAtom; -import IR.Tree.TagExpressionList; -import IR.*; -import java.util.*; -import java.io.*; - -import Util.Relation; -import Analysis.TaskStateAnalysis.FlagState; -import Analysis.TaskStateAnalysis.FlagComparator; -import Analysis.TaskStateAnalysis.OptionalTaskDescriptor; -import Analysis.TaskStateAnalysis.Predicate; -import Analysis.TaskStateAnalysis.SafetyAnalysis; -import Analysis.TaskStateAnalysis.TaskIndex; -import Analysis.Locality.LocalityAnalysis; -import Analysis.Locality.LocalityBinding; -import Analysis.Prefetch.*; - -public class BuildCode { - State state; - Hashtable temptovar; - Hashtable paramstable; - Hashtable tempstable; - Hashtable fieldorder; - Hashtable flagorder; - int tag=0; - String localsprefix="___locals___"; - String paramsprefix="___params___"; - String oidstr="___nextobject___"; - String nextobjstr="___nextobject___"; - String localcopystr="___localcopy___"; - public static boolean GENERATEPRECISEGC=false; - public static String PREFIX=""; - public static String arraytype="ArrayObject"; - public static int flagcount = 0; - Virtual virtualcalls; - TypeUtil typeutil; - protected int maxtaskparams=0; - private int maxcount=0; - ClassDescriptor[] cdarray; - TypeDescriptor[] arraytable; - LocalityAnalysis locality; - Hashtable backuptable; - Hashtable reverttable; - SafetyAnalysis sa; - PrefetchAnalysis pa; - - public BuildCode(State st, Hashtable temptovar, TypeUtil typeutil, SafetyAnalysis sa, PrefetchAnalysis pa) { - this(st, temptovar, typeutil, null, sa, pa); - } - - public BuildCode(State st, Hashtable temptovar, TypeUtil typeutil, LocalityAnalysis locality, PrefetchAnalysis pa) { - this(st, temptovar, typeutil, locality, null, pa); - } - - public BuildCode(State st, Hashtable temptovar, TypeUtil typeutil, LocalityAnalysis locality, SafetyAnalysis sa, PrefetchAnalysis pa) { - this.sa=sa; - this.pa=pa; - state=st; - this.temptovar=temptovar; - paramstable=new Hashtable(); - tempstable=new Hashtable(); - fieldorder=new Hashtable(); - flagorder=new Hashtable(); - this.typeutil=typeutil; - virtualcalls=new Virtual(state,locality); - if (locality!=null) { - this.locality=locality; - this.backuptable=new Hashtable(); - this.reverttable=new Hashtable(); - } - } - - /** The buildCode method outputs C code for all the methods. The Flat - * versions of the methods must already be generated and stored in - * the State object. */ - - public void buildCode() { - /* Create output streams to write to */ - PrintWriter outclassdefs=null; - PrintWriter outstructs=null; - PrintWriter outrepairstructs=null; - PrintWriter outmethodheader=null; - PrintWriter outmethod=null; - PrintWriter outvirtual=null; - PrintWriter outtask=null; - PrintWriter outtaskdefs=null; - PrintWriter outoptionalarrays=null; - PrintWriter optionalheaders=null; - - try { - outstructs=new PrintWriter(new FileOutputStream(PREFIX+"structdefs.h"), true); - outmethodheader=new PrintWriter(new FileOutputStream(PREFIX+"methodheaders.h"), true); - outclassdefs=new PrintWriter(new FileOutputStream(PREFIX+"classdefs.h"), true); - outmethod=new PrintWriter(new FileOutputStream(PREFIX+"methods.c"), true); - outvirtual=new PrintWriter(new FileOutputStream(PREFIX+"virtualtable.h"), true); - if (state.TASK) { - outtask=new PrintWriter(new FileOutputStream(PREFIX+"task.h"), true); - outtaskdefs=new PrintWriter(new FileOutputStream(PREFIX+"taskdefs.c"), true); - if (state.OPTIONAL){ - outoptionalarrays=new PrintWriter(new FileOutputStream(PREFIX+"optionalarrays.c"), true); - optionalheaders=new PrintWriter(new FileOutputStream(PREFIX+"optionalstruct.h"), true); - } - } - if (state.structfile!=null) { - outrepairstructs=new PrintWriter(new FileOutputStream(PREFIX+state.structfile+".struct"), true); - } - } catch (Exception e) { - e.printStackTrace(); - System.exit(-1); - } - - /* Build the virtual dispatch tables */ - buildVirtualTables(outvirtual); - - /* Output includes */ - outmethodheader.println("#ifndef METHODHEADERS_H"); - outmethodheader.println("#define METHODHEADERS_H"); - outmethodheader.println("#include \"structdefs.h\""); - if (state.DSM) - outmethodheader.println("#include \"dstm.h\""); - - /* Output Structures */ - outputStructs(outstructs); - - // Output the C class declarations - // These could mutually reference each other - outputClassDeclarations(outclassdefs); - - // Output function prototypes and structures for parameters - Iterator it=state.getClassSymbolTable().getDescriptorsIterator(); - while(it.hasNext()) { - ClassDescriptor cn=(ClassDescriptor)it.next(); - generateCallStructs(cn, outclassdefs, outstructs, outmethodheader); - } - outclassdefs.close(); - - if (state.TASK) { - /* Map flags to integers */ - /* The runtime keeps track of flags using these integers */ - it=state.getClassSymbolTable().getDescriptorsIterator(); - while(it.hasNext()) { - ClassDescriptor cn=(ClassDescriptor)it.next(); - mapFlags(cn); - } - /* Generate Tasks */ - generateTaskStructs(outstructs, outmethodheader); - - /* Outputs generic task structures if this is a task - program */ - outputTaskTypes(outtask); - } - - /* Build the actual methods */ - outputMethods(outmethod); - - if (state.TASK) { - /* Output code for tasks */ - outputTaskCode(outtaskdefs, outmethod); - outtaskdefs.close(); - /* Record maximum number of task parameters */ - outstructs.println("#define MAXTASKPARAMS "+maxtaskparams); - } else if (state.main!=null) { - /* Generate main method */ - outputMainMethod(outmethod); - } - - /* Generate information for task with optional parameters */ - if (state.TASK&&state.OPTIONAL){ - generateOptionalArrays(outoptionalarrays, optionalheaders, state.getAnalysisResult(), state.getOptionalTaskDescriptors()); - outoptionalarrays.close(); - } - - /* Output structure definitions for repair tool */ - if (state.structfile!=null) { - buildRepairStructs(outrepairstructs); - outrepairstructs.close(); - } - - /* Close files */ - outmethodheader.println("#endif"); - outmethodheader.close(); - outmethod.close(); - outstructs.println("#endif"); - outstructs.close(); - } - - /* This code just generates the main C method for java programs. - * The main C method packs up the arguments into a string array - * and passes it to the java main method. */ - - private void outputMainMethod(PrintWriter outmethod) { - outmethod.println("int main(int argc, const char *argv[]) {"); - outmethod.println(" int i;"); - outmethod.println("#ifdef TRANSSTATS \n"); - outmethod.println("handle();\n"); - outmethod.println("#endif\n"); - if (state.THREAD||state.DSM) { - outmethod.println("initializethreads();"); - } - if (state.DSM) { - outmethod.println("if (dstmStartup(argv[1])) {"); - if (GENERATEPRECISEGC) { - outmethod.println(" struct ArrayObject * stringarray=allocate_newarray(NULL, STRINGARRAYTYPE, argc-2);"); - } else { - outmethod.println(" struct ArrayObject * stringarray=allocate_newarray(STRINGARRAYTYPE, argc-2);"); - } - } else { - if (GENERATEPRECISEGC) { - outmethod.println(" struct ArrayObject * stringarray=allocate_newarray(NULL, STRINGARRAYTYPE, argc-1);"); - } else { - outmethod.println(" struct ArrayObject * stringarray=allocate_newarray(STRINGARRAYTYPE, argc-1);"); - } - } - if (state.DSM) { - outmethod.println(" for(i=2;i___length___)+sizeof(int)))[i-2]=newstring;"); - else - outmethod.println(" ((void **)(((char *)& stringarray->___length___)+sizeof(int)))[i-1]=newstring;"); - outmethod.println(" }"); - - - MethodDescriptor md=typeutil.getMain(); - ClassDescriptor cd=typeutil.getMainClass(); - - outmethod.println(" {"); - if (GENERATEPRECISEGC) { - if (state.DSM) { - outmethod.print(" struct "+cd.getSafeSymbol()+locality.getMain().getSignature()+md.getSafeSymbol()+"_"+md.getSafeMethodDescriptor()+"_params __parameterlist__={"); - } else - outmethod.print(" struct "+cd.getSafeSymbol()+md.getSafeSymbol()+"_"+md.getSafeMethodDescriptor()+"_params __parameterlist__={"); - outmethod.println("1, NULL,"+"stringarray};"); - if (state.DSM) - outmethod.println(" "+cd.getSafeSymbol()+locality.getMain().getSignature()+md.getSafeSymbol()+"_"+md.getSafeMethodDescriptor()+"(& __parameterlist__);"); - else - outmethod.println(" "+cd.getSafeSymbol()+md.getSafeSymbol()+"_"+md.getSafeMethodDescriptor()+"(& __parameterlist__);"); - } else { - if (state.DSM) - outmethod.println(" "+cd.getSafeSymbol()+locality.getMain().getSignature()+md.getSafeSymbol()+"_"+md.getSafeMethodDescriptor()+"(stringarray);"); - else - outmethod.println(" "+cd.getSafeSymbol()+md.getSafeSymbol()+"_"+md.getSafeMethodDescriptor()+"(stringarray);"); - } - outmethod.println(" }"); - - if (state.DSM) { - outmethod.println("}"); - } - - if (state.THREAD||state.DSM) { - outmethod.println("pthread_mutex_lock(&gclistlock);"); - outmethod.println("threadcount--;"); - outmethod.println("pthread_cond_signal(&gccond);"); - outmethod.println("pthread_mutex_unlock(&gclistlock);"); - if (state.THREAD) - outmethod.println("pthread_exit(NULL);"); - } - - outmethod.println("#ifdef TRANSSTATS \n"); - outmethod.println("printf(\"****** Transaction Stats ******\\n\");"); - outmethod.println("printf(\"numTransAbort= %d\\n\", numTransAbort);"); - outmethod.println("printf(\"numTransCommit= %d\\n\", numTransCommit);"); - outmethod.println("printf(\"nchashSearch= %d\\n\", nchashSearch);"); - outmethod.println("printf(\"nmhashSearch= %d\\n\", nmhashSearch);"); - outmethod.println("printf(\"nprehashSearch= %d\\n\", nprehashSearch);"); - outmethod.println("printf(\"nRemoteReadSend= %d\\n\", nRemoteSend);"); - outmethod.println("#endif\n"); - outmethod.println("}"); - - } - - /* This method outputs code for each task. */ - - private void outputTaskCode(PrintWriter outtaskdefs, PrintWriter outmethod) { - /* Compile task based program */ - outtaskdefs.println("#include \"task.h\""); - outtaskdefs.println("#include \"methodheaders.h\""); - Iterator taskit=state.getTaskSymbolTable().getDescriptorsIterator(); - while(taskit.hasNext()) { - TaskDescriptor td=(TaskDescriptor)taskit.next(); - FlatMethod fm=state.getMethodFlat(td); - generateFlatMethod(fm, null, outmethod); - generateTaskDescriptor(outtaskdefs, fm, td); - } - - //Output task descriptors - taskit=state.getTaskSymbolTable().getDescriptorsIterator(); - outtaskdefs.println("struct taskdescriptor * taskarray[]= {"); - boolean first=true; - while(taskit.hasNext()) { - TaskDescriptor td=(TaskDescriptor)taskit.next(); - if (first) - first=false; - else - outtaskdefs.println(","); - outtaskdefs.print("&task_"+td.getSafeSymbol()); - } - outtaskdefs.println("};"); - - outtaskdefs.println("int numtasks="+state.getTaskSymbolTable().getValueSet().size()+";"); - } - - /* This method outputs most of the methods.c file. This includes - * some standard includes and then an array with the sizes of - * objets and array that stores supertype and then the code for - * the Java methods.. */ - - protected void outputMethods(PrintWriter outmethod) { - outmethod.println("#include \"methodheaders.h\""); - outmethod.println("#include \"virtualtable.h\""); - outmethod.println("#include \"runtime.h\""); - if (state.DSM) { - outmethod.println("#include \"addPrefetchEnhance.h\""); - outmethod.println("#include \"localobjects.h\""); - } - if(state.MULTICORE) { - outmethod.println("#include \"task.h\""); - } - if (state.THREAD||state.DSM) - outmethod.println("#include "); - if (state.main!=null) { - outmethod.println("#include "); - } - if (state.CONSCHECK) { - outmethod.println("#include \"checkers.h\""); - } - //Store the sizes of classes & array elements - generateSizeArray(outmethod); - - //Store table of supertypes - generateSuperTypeTable(outmethod); - - //Store the layout of classes - generateLayoutStructs(outmethod); - - /* Generate code for methods */ - if (state.DSM) { - for(Iterator lbit=locality.getLocalityBindings().iterator();lbit.hasNext();) { - LocalityBinding lb=lbit.next(); - MethodDescriptor md=lb.getMethod(); - FlatMethod fm=state.getMethodFlat(md); - if (!md.getModifiers().isNative()) { - generateFlatMethod(fm, lb, outmethod); - } - } - } else { - Iterator classit=state.getClassSymbolTable().getDescriptorsIterator(); - while(classit.hasNext()) { - ClassDescriptor cn=(ClassDescriptor)classit.next(); - Iterator methodit=cn.getMethods(); - while(methodit.hasNext()) { - /* Classify parameters */ - MethodDescriptor md=(MethodDescriptor)methodit.next(); - FlatMethod fm=state.getMethodFlat(md); - if (!md.getModifiers().isNative()) { - generateFlatMethod(fm, null, outmethod); - } - } - } - } - } - - protected void outputStructs(PrintWriter outstructs) { - outstructs.println("#ifndef STRUCTDEFS_H"); - outstructs.println("#define STRUCTDEFS_H"); - outstructs.println("#include \"classdefs.h\""); - - /* Output #defines that the runtime uses to determine type - * numbers for various objects it needs */ - outstructs.println("#define MAXCOUNT "+maxcount); - if (state.DSM) { - LocalityBinding lb=new LocalityBinding(typeutil.getRun(), false); - lb.setGlobalThis(LocalityAnalysis.GLOBAL); - outstructs.println("#define RUNMETHOD "+virtualcalls.getLocalityNumber(lb)); - } - - outstructs.println("#define STRINGARRAYTYPE "+ - (state.getArrayNumber( - (new TypeDescriptor(typeutil.getClass(TypeUtil.StringClass))).makeArray(state))+state.numClasses())); - - outstructs.println("#define OBJECTARRAYTYPE "+ - (state.getArrayNumber( - (new TypeDescriptor(typeutil.getClass(TypeUtil.ObjectClass))).makeArray(state))+state.numClasses())); - - - outstructs.println("#define STRINGTYPE "+typeutil.getClass(TypeUtil.StringClass).getId()); - outstructs.println("#define CHARARRAYTYPE "+ - (state.getArrayNumber((new TypeDescriptor(TypeDescriptor.CHAR)).makeArray(state))+state.numClasses())); - - outstructs.println("#define BYTEARRAYTYPE "+ - (state.getArrayNumber((new TypeDescriptor(TypeDescriptor.BYTE)).makeArray(state))+state.numClasses())); - - outstructs.println("#define BYTEARRAYARRAYTYPE "+ - (state.getArrayNumber((new TypeDescriptor(TypeDescriptor.BYTE)).makeArray(state).makeArray(state))+state.numClasses())); - - outstructs.println("#define NUMCLASSES "+state.numClasses()); - if (state.TASK) { - outstructs.println("#define STARTUPTYPE "+typeutil.getClass(TypeUtil.StartupClass).getId()); - outstructs.println("#define TAGTYPE "+typeutil.getClass(TypeUtil.TagClass).getId()); - outstructs.println("#define TAGARRAYTYPE "+ - (state.getArrayNumber(new TypeDescriptor(typeutil.getClass(TypeUtil.TagClass)).makeArray(state))+state.numClasses())); - } - } - - protected void outputClassDeclarations(PrintWriter outclassdefs) { - if (state.THREAD||state.DSM) - outclassdefs.println("#include "); - if(state.OPTIONAL) - outclassdefs.println("#include \"optionalstruct.h\""); - outclassdefs.println("struct "+arraytype+";"); - /* Start by declaring all structs */ - Iterator it=state.getClassSymbolTable().getDescriptorsIterator(); - while(it.hasNext()) { - ClassDescriptor cn=(ClassDescriptor)it.next(); - outclassdefs.println("struct "+cn.getSafeSymbol()+";"); - } - outclassdefs.println(""); - //Print out definition for array type - outclassdefs.println("struct "+arraytype+" {"); - outclassdefs.println(" int type;"); - if (state.THREAD) { - outclassdefs.println(" pthread_t tid;"); - outclassdefs.println(" void * lockentry;"); - outclassdefs.println(" int lockcount;"); - } - if (state.TASK) { - outclassdefs.println(" int flag;"); - if(!state.MULTICORE) { - outclassdefs.println(" void * flagptr;"); - } else { - outclassdefs.println(" int isolate;"); // indicate if this object is shared or not - outclassdefs.println(" int version;"); - outclassdefs.println(" struct ___Object___ * original;"); - } - if(state.OPTIONAL){ - outclassdefs.println(" int numfses;"); - outclassdefs.println(" int * fses;"); - } - } - printClassStruct(typeutil.getClass(TypeUtil.ObjectClass), outclassdefs); - - outclassdefs.println(" int ___length___;"); - outclassdefs.println("};\n"); - outclassdefs.println("extern int classsize[];"); - outclassdefs.println("extern int hasflags[];"); - outclassdefs.println("extern unsigned int * pointerarray[];"); - outclassdefs.println("extern int supertypes[];"); - } - - /** Prints out definitions for generic task structures */ - - private void outputTaskTypes(PrintWriter outtask) { - outtask.println("#ifndef _TASK_H"); - outtask.println("#define _TASK_H"); - outtask.println("struct parameterdescriptor {"); - outtask.println("int type;"); - outtask.println("int numberterms;"); - outtask.println("int *intarray;"); - outtask.println("void * queue;"); - outtask.println("int numbertags;"); - outtask.println("int *tagarray;"); - outtask.println("};"); - - outtask.println("struct taskdescriptor {"); - outtask.println("void * taskptr;"); - outtask.println("int numParameters;"); - outtask.println(" int numTotal;"); - outtask.println("struct parameterdescriptor **descriptorarray;"); - outtask.println("char * name;"); - outtask.println("};"); - outtask.println("extern struct taskdescriptor * taskarray[];"); - outtask.println("extern numtasks;"); - outtask.println("#endif"); - } - - - private void buildRepairStructs(PrintWriter outrepairstructs) { - Iterator classit=state.getClassSymbolTable().getDescriptorsIterator(); - while(classit.hasNext()) { - ClassDescriptor cn=(ClassDescriptor)classit.next(); - outrepairstructs.println("structure "+cn.getSymbol()+" {"); - outrepairstructs.println(" int __type__;"); - if (state.TASK) { - outrepairstructs.println(" int __flag__;"); - if(!state.MULTICORE) { - outrepairstructs.println(" int __flagptr__;"); - } - } - printRepairStruct(cn, outrepairstructs); - outrepairstructs.println("}\n"); - } - - for(int i=0;imaxcount) - maxcount=virtualcalls.getMethodCount(cd); - } - MethodDescriptor[][] virtualtable=null; - LocalityBinding[][] lbvirtualtable=null; - if (state.DSM) - lbvirtualtable=new LocalityBinding[state.numClasses()+state.numArrays()][maxcount]; - else - virtualtable=new MethodDescriptor[state.numClasses()+state.numArrays()][maxcount]; - - /* Fill in virtual table */ - classit=state.getClassSymbolTable().getDescriptorsIterator(); - while(classit.hasNext()) { - ClassDescriptor cd=(ClassDescriptor)classit.next(); - if (state.DSM) - fillinRow(cd, lbvirtualtable, cd.getId()); - else - fillinRow(cd, virtualtable, cd.getId()); - } - - ClassDescriptor objectcd=typeutil.getClass(TypeUtil.ObjectClass); - Iterator arrayit=state.getArrayIterator(); - while(arrayit.hasNext()) { - TypeDescriptor td=(TypeDescriptor)arrayit.next(); - int id=state.getArrayNumber(td); - if (state.DSM) - fillinRow(objectcd, lbvirtualtable, id+state.numClasses()); - else - fillinRow(objectcd, virtualtable, id+state.numClasses()); - } - - outvirtual.print("void * virtualtable[]={"); - boolean needcomma=false; - for(int i=0;i lbit=locality.getClassBindings(cd).iterator();lbit.hasNext();) { - LocalityBinding lb=lbit.next(); - MethodDescriptor md=lb.getMethod(); - //Is the method static or a constructor - if (md.isStatic()||md.getReturnType()==null) - continue; - int methodnum=virtualcalls.getLocalityNumber(lb); - virtualtable[rownum][methodnum]=lb; - } - } - - - /** Generate array that contains the sizes of class objects. The - * object allocation functions in the runtime use this - * information. */ - - private void generateSizeArray(PrintWriter outclassdefs) { - outclassdefs.print("extern struct prefetchCountStats * evalPrefetch;\n"); - outclassdefs.print("#ifdef TRANSSTATS \n"); - outclassdefs.print("extern int numTransAbort;\n"); - outclassdefs.print("extern int numTransCommit;\n"); - outclassdefs.print("extern int nchashSearch;\n"); - outclassdefs.print("extern int nmhashSearch;\n"); - outclassdefs.print("extern int nprehashSearch;\n"); - outclassdefs.print("extern int nRemoteSend;\n"); - outclassdefs.print("extern void handle();\n"); - outclassdefs.print("#endif\n"); - outclassdefs.print("int numprefetchsites = " + pa.prefetchsiteid + ";\n"); - - outclassdefs.print("int classsize[]={"); - Iterator it=state.getClassSymbolTable().getDescriptorsIterator(); - cdarray=new ClassDescriptor[state.numClasses()]; - while(it.hasNext()) { - ClassDescriptor cd=(ClassDescriptor)it.next(); - cdarray[cd.getId()]=cd; - } - boolean needcomma=false; - for(int i=0;i saveset=lb!=null?locality.getTempSet(lb):null; - ParamsObject objectparams=md!=null?new ParamsObject(md,tag++):new ParamsObject(task, tag++); - - if (lb!=null) - paramstable.put(lb, objectparams); - else if (md!=null) - paramstable.put(md, objectparams); - else - paramstable.put(task, objectparams); - - for(int i=0;i tmpit=backuptable.values().iterator();tmpit.hasNext();) { - TempDescriptor tmp=tmpit.next(); - TypeDescriptor type=tmp.getType(); - if (type.isPtr()&&GENERATEPRECISEGC) - objecttemps.addPtr(tmp); - else - objecttemps.addPrim(tmp); - } - /* Create temp to hold revert table */ - if (lb.getHasAtomic()||lb.isAtomic()) { - TempDescriptor reverttmp=new TempDescriptor("revertlist", typeutil.getClass(TypeUtil.ObjectClass)); - if (GENERATEPRECISEGC) - objecttemps.addPtr(reverttmp); - else - objecttemps.addPrim(reverttmp); - reverttable.put(lb, reverttmp); - } - } - } - - /** This method outputs the following information about classes - * and arrays: - * (1) For classes, what are the locations of pointers. - * (2) For arrays, does the array contain pointers or primitives. - * (3) For classes, does the class contain flags. - */ - - private void generateLayoutStructs(PrintWriter output) { - Iterator it=state.getClassSymbolTable().getDescriptorsIterator(); - while(it.hasNext()) { - ClassDescriptor cn=(ClassDescriptor)it.next(); - output.println("unsigned int "+cn.getSafeSymbol()+"_pointers[]={"); - Iterator allit=cn.getFieldTable().getAllDescriptorsIterator(); - int count=0; - while(allit.hasNext()) { - FieldDescriptor fd=(FieldDescriptor)allit.next(); - TypeDescriptor type=fd.getType(); - if (state.DSM&&fd.isGlobal()) //Don't GC the global objects for now - continue; - if (type.isPtr()) - count++; - } - output.print(count); - allit=cn.getFieldTable().getAllDescriptorsIterator(); - while(allit.hasNext()) { - FieldDescriptor fd=(FieldDescriptor)allit.next(); - TypeDescriptor type=fd.getType(); - if (state.DSM&&fd.isGlobal()) //Don't GC the global objects for now - continue; - if (type.isPtr()) { - output.println(","); - output.print("((unsigned int)&(((struct "+cn.getSafeSymbol() +" *)0)->"+fd.getSafeSymbol()+"))"); - } - } - output.println("};"); - } - output.println("unsigned int * pointerarray[]={"); - boolean needcomma=false; - for(int i=0;imax) - max=number.intValue()+1; - } - } - - Iterator flagit=cn.getFlags(); - while(flagit.hasNext()) { - FlagDescriptor fd=(FlagDescriptor)flagit.next(); - if (sp==null||!sp.getFlagTable().contains(fd.getSymbol())) - flags.put(fd, new Integer(max++)); - } - } - } - - - /** This function outputs (1) structures that parameters are - * passed in (when PRECISE GC is enabled) and (2) function - * prototypes for the methods */ - - protected void generateCallStructs(ClassDescriptor cn, PrintWriter classdefout, PrintWriter output, PrintWriter headersout) { - /* Output class structure */ - classdefout.println("struct "+cn.getSafeSymbol()+" {"); - classdefout.println(" int type;"); - if (state.THREAD) { - classdefout.println(" pthread_t tid;"); - classdefout.println(" void * lockentry;"); - classdefout.println(" int lockcount;"); - } - - if (state.TASK) { - classdefout.println(" int flag;"); - if((!state.MULTICORE) || (cn.getSymbol().equals("TagDescriptor"))) { - classdefout.println(" void * flagptr;"); - } else if (state.MULTICORE){ - classdefout.println(" int isolate;"); // indicate if this object is shared or not - classdefout.println(" int version;"); - classdefout.println(" struct ___Object___ * original;"); - } - if (state.OPTIONAL){ - classdefout.println(" int numfses;"); - classdefout.println(" int * fses;"); - } - } - printClassStruct(cn, classdefout); - classdefout.println("};\n"); - - if (state.DSM) { - /* Cycle through LocalityBindings */ - HashSet nativemethods=new HashSet(); - Set lbset=locality.getClassBindings(cn); - if (lbset!=null) { - for(Iterator lbit=lbset.iterator();lbit.hasNext();) { - LocalityBinding lb=lbit.next(); - MethodDescriptor md=lb.getMethod(); - if (md.getModifiers().isNative()) { - //make sure we only print a native method once - if (nativemethods.contains(md)) { - FlatMethod fm=state.getMethodFlat(md); - generateTempStructs(fm, lb); - continue; - } else - nativemethods.add(md); - } - generateMethod(cn, md, lb, headersout, output); - } - } - for(Iterator methodit=cn.getMethods();methodit.hasNext();) { - MethodDescriptor md=(MethodDescriptor)methodit.next(); - if (md.getModifiers().isNative()&&!nativemethods.contains(md)) { - //Need to build param structure for library code - FlatMethod fm=state.getMethodFlat(md); - generateTempStructs(fm, null); - generateMethodParam(cn, md, null, output); - } - } - - } else - for(Iterator methodit=cn.getMethods();methodit.hasNext();) { - MethodDescriptor md=(MethodDescriptor)methodit.next(); - generateMethod(cn, md, null, headersout, output); - } - } - - private void generateMethodParam(ClassDescriptor cn, MethodDescriptor md, LocalityBinding lb, PrintWriter output) { - /* Output parameter structure */ - if (GENERATEPRECISEGC) { - ParamsObject objectparams=(ParamsObject) paramstable.get(lb!=null?lb:md); - if (state.DSM&&lb!=null) - output.println("struct "+cn.getSafeSymbol()+lb.getSignature()+md.getSafeSymbol()+"_"+md.getSafeMethodDescriptor()+"_params {"); - else - output.println("struct "+cn.getSafeSymbol()+md.getSafeSymbol()+"_"+md.getSafeMethodDescriptor()+"_params {"); - output.println(" int size;"); - output.println(" void * next;"); - for(int i=0;imaxtaskparams) { - maxtaskparams=objectparams.numPointers()+fm.numTags(); - } - } - - /* Output temp structure */ - if (GENERATEPRECISEGC) { - output.println("struct "+task.getSafeSymbol()+"_locals {"); - output.println(" int size;"); - output.println(" void * next;"); - for(int i=0;i nodetolabel=assignLabels(fm); - - /* Check to see if we need to do a GC if this is a - * multi-threaded program...*/ - - if ((state.THREAD||state.DSM)&&GENERATEPRECISEGC) { - if (state.DSM&&lb.isAtomic()) - output.println("checkcollect2(&"+localsprefix+",trans);"); - else - output.println("checkcollect(&"+localsprefix+");"); - } - - /* Do the actual code generation */ - FlatNode current_node=null; - HashSet tovisit=new HashSet(); - HashSet visited=new HashSet(); - tovisit.add(fm.getNext(0)); - while(current_node!=null||!tovisit.isEmpty()) { - if (current_node==null) { - current_node=(FlatNode)tovisit.iterator().next(); - tovisit.remove(current_node); - } - visited.add(current_node); - if (nodetolabel.containsKey(current_node)) - output.println("L"+nodetolabel.get(current_node)+":"); - if (state.INSTRUCTIONFAILURE) { - if (state.THREAD||state.DSM) { - output.println("if ((++instructioncount)>failurecount) {instructioncount=0;injectinstructionfailure();}"); - } - else - output.println("if ((--instructioncount)==0) injectinstructionfailure();"); - } - if (current_node.numNext()==0) { - output.print(" "); - generateFlatNode(fm, lb, current_node, output); - if (current_node.kind()!=FKind.FlatReturnNode) { - output.println(" return;"); - } - current_node=null; - } else if(current_node.numNext()==1) { - output.print(" "); - generateFlatNode(fm, lb, current_node, output); - FlatNode nextnode=current_node.getNext(0); - if (visited.contains(nextnode)) { - output.println("goto L"+nodetolabel.get(nextnode)+";"); - current_node=null; - } else - current_node=nextnode; - } else if (current_node.numNext()==2) { - /* Branch */ - output.print(" "); - generateFlatCondBranch(fm, lb, (FlatCondBranch)current_node, "L"+nodetolabel.get(current_node.getNext(1)), output); - if (!visited.contains(current_node.getNext(1))) - tovisit.add(current_node.getNext(1)); - if (visited.contains(current_node.getNext(0))) { - output.println("goto L"+nodetolabel.get(current_node.getNext(0))+";"); - current_node=null; - } else - current_node=current_node.getNext(0); - } else throw new Error(); - } - output.println("}\n\n"); - } - - /** This method assigns labels to FlatNodes */ - - protected Hashtable assignLabels(FlatMethod fm) { - HashSet tovisit=new HashSet(); - HashSet visited=new HashSet(); - int labelindex=0; - Hashtable nodetolabel=new Hashtable(); - tovisit.add(fm.getNext(0)); - - /*Assign labels first. A node needs a label if the previous - * node has two exits or this node is a join point. */ - - while(!tovisit.isEmpty()) { - FlatNode fn=(FlatNode)tovisit.iterator().next(); - tovisit.remove(fn); - visited.add(fn); - for(int i=0;i0) { - //1) Edge >1 of node - nodetolabel.put(nn,new Integer(labelindex++)); - } - if (!visited.contains(nn)&&!tovisit.contains(nn)) { - tovisit.add(nn); - } else { - //2) Join point - nodetolabel.put(nn,new Integer(labelindex++)); - } - } - } - return nodetolabel; - } - - - /** Generate text string that corresponds to the TempDescriptor td. */ - protected String generateTemp(FlatMethod fm, TempDescriptor td, LocalityBinding lb) { - MethodDescriptor md=fm.getMethod(); - TaskDescriptor task=fm.getTask(); - TempObject objecttemps=(TempObject) tempstable.get(lb!=null?lb:md!=null?md:task); - - if (objecttemps.isLocalPrim(td)||objecttemps.isParamPrim(td)) { - return td.getSafeSymbol(); - } - - if (objecttemps.isLocalPtr(td)) { - return localsprefix+"."+td.getSafeSymbol(); - } - - if (objecttemps.isParamPtr(td)) { - return paramsprefix+"->"+td.getSafeSymbol(); - } - throw new Error(); - } - - protected void generateFlatNode(FlatMethod fm, LocalityBinding lb, FlatNode fn, PrintWriter output) { - switch(fn.kind()) { - case FKind.FlatAtomicEnterNode: - generateFlatAtomicEnterNode(fm, lb, (FlatAtomicEnterNode) fn, output); - return; - case FKind.FlatAtomicExitNode: - generateFlatAtomicExitNode(fm, lb, (FlatAtomicExitNode) fn, output); - return; - case FKind.FlatGlobalConvNode: - generateFlatGlobalConvNode(fm, lb, (FlatGlobalConvNode) fn, output); - return; - case FKind.FlatTagDeclaration: - generateFlatTagDeclaration(fm, lb, (FlatTagDeclaration) fn,output); - return; - case FKind.FlatCall: - generateFlatCall(fm, lb, (FlatCall) fn,output); - return; - case FKind.FlatFieldNode: - generateFlatFieldNode(fm, lb, (FlatFieldNode) fn,output); - return; - case FKind.FlatElementNode: - generateFlatElementNode(fm, lb, (FlatElementNode) fn,output); - return; - case FKind.FlatSetElementNode: - generateFlatSetElementNode(fm, lb, (FlatSetElementNode) fn,output); - return; - case FKind.FlatSetFieldNode: - generateFlatSetFieldNode(fm, lb, (FlatSetFieldNode) fn,output); - return; - case FKind.FlatNew: - generateFlatNew(fm, lb, (FlatNew) fn,output); - return; - case FKind.FlatOpNode: - generateFlatOpNode(fm, lb, (FlatOpNode) fn,output); - return; - case FKind.FlatCastNode: - generateFlatCastNode(fm, lb, (FlatCastNode) fn,output); - return; - case FKind.FlatLiteralNode: - generateFlatLiteralNode(fm, lb, (FlatLiteralNode) fn,output); - return; - case FKind.FlatReturnNode: - generateFlatReturnNode(fm, lb, (FlatReturnNode) fn,output); - return; - case FKind.FlatNop: - output.println("/* nop */"); - return; - case FKind.FlatBackEdge: - if ((state.THREAD||state.DSM)&&GENERATEPRECISEGC) { - if(state.DSM&&locality.getAtomic(lb).get(fn).intValue()>0) { - output.println("checkcollect2(&"+localsprefix+",trans);"); - } else - output.println("checkcollect(&"+localsprefix+");"); - } else - output.println("/* nop */"); - return; - case FKind.FlatCheckNode: - generateFlatCheckNode(fm, lb, (FlatCheckNode) fn, output); - return; - case FKind.FlatFlagActionNode: - generateFlatFlagActionNode(fm, lb, (FlatFlagActionNode) fn, output); - return; - case FKind.FlatPrefetchNode: - generateFlatPrefetchNode(fm,lb, (FlatPrefetchNode) fn, output); - return; - } - throw new Error(); - } - - public void generateFlatPrefetchNode(FlatMethod fm, LocalityBinding lb, FlatPrefetchNode fpn, PrintWriter output) { - if (state.PREFETCH) { - Vector oids = new Vector(); - Vector fieldoffset = new Vector(); - Vector endoffset = new Vector(); - int tuplecount = 0; //Keeps track of number of prefetch tuples that need to be generated - for(Iterator it = fpn.hspp.iterator();it.hasNext();) { - PrefetchPair pp = (PrefetchPair) it.next(); - Integer statusbase = locality.getNodePreTempInfo(lb,fpn).get(pp.base); - /* Find prefetches that can generate oid */ - if(statusbase == LocalityAnalysis.GLOBAL) { - generateTransCode(fm, lb, pp, oids, fieldoffset, endoffset, tuplecount, locality.getAtomic(lb).get(fpn).intValue()>0, false); - tuplecount++; - } else if (statusbase == LocalityAnalysis.LOCAL) { - generateTransCode(fm,lb,pp,oids,fieldoffset,endoffset,tuplecount,false,true); - } else { - continue; - } - } - if (tuplecount==0) - return; - output.println("{"); - output.println("/* prefetch */"); - output.println("/* prefetchid_" + fpn.siteid + " */"); - output.println("void * prefptr;"); - output.println("int tmpindex;"); - - output.println("if((evalPrefetch["+fpn.siteid+"].operMode) || (evalPrefetch["+fpn.siteid+"].retrycount <= 0)) {"); - /*Create C code for oid array */ - output.print(" unsigned int oidarray_[] = {"); - boolean needcomma=false; - for (Iterator it = oids.iterator();it.hasNext();) { - if (needcomma) - output.print(", "); - output.print(it.next()); - needcomma=true; - } - output.println("};"); - - /*Create C code for endoffset values */ - output.print(" unsigned short endoffsetarry_[] = {"); - needcomma=false; - for (Iterator it = endoffset.iterator();it.hasNext();) { - if (needcomma) - output.print(", "); - output.print(it.next()); - needcomma=true; - } - output.println("};"); - - /*Create C code for Field Offset Values */ - output.print(" short fieldarry_[] = {"); - needcomma=false; - for (Iterator it = fieldoffset.iterator();it.hasNext();) { - if (needcomma) - output.print(", "); - output.print(it.next()); - needcomma=true; - } - output.println("};"); - /* make the prefetch call to Runtime */ - output.println(" if(!evalPrefetch["+fpn.siteid+"].operMode) {"); - output.println(" evalPrefetch["+fpn.siteid+"].retrycount = RETRYINTERVAL;"); - output.println(" }"); - output.println(" prefetch("+fpn.siteid+" ,"+tuplecount+", oidarray_, endoffsetarry_, fieldarry_);"); - output.println(" } else {"); - output.println(" evalPrefetch["+fpn.siteid+"].retrycount--;"); - output.println(" }"); - output.println("}"); - } - } - - public void generateTransCode(FlatMethod fm, LocalityBinding lb,PrefetchPair pp, Vector oids, Vector fieldoffset, Vector endoffset, int tuplecount, boolean inside, boolean localbase) { - short offsetcount = 0; - int breakindex=0; - if (inside) { - breakindex=1; - } else if (localbase) { - for(;breakindexpp.desc.size()) //all local - return; - - TypeDescriptor lasttype=pp.base.getType(); - String basestr=generateTemp(fm, pp.base, lb); - String teststr=""; - boolean maybenull=fm.getMethod().isStatic()|| - !pp.base.equals(fm.getParameter(0)); - - for(int i=0;i"+fd.getSafeSymbol(); - } else { - basestr=basestr+"->"+fd.getSafeSymbol(); - maybenull=true; - } - lasttype=fd.getType(); - } else { - IndexDescriptor id=(IndexDescriptor)desc; - indexcheck="((tmpindex="; - for(int j=0;j=0)&&(tmpindex<((struct ArrayObject *)prefptr)->___length___)"; - - if (!teststr.equals("")) - teststr+="&&"; - teststr+="((prefptr="+basestr+")!= NULL) &&"+indexcheck; - basestr="((void **)(((char *) &(((struct ArrayObject *)prefptr)->___length___))+sizeof(int)))[tmpindex]"; - maybenull=true; - lasttype=lasttype.dereference(); - } - } - - String oid; - if (teststr.equals("")) { - oid="((unsigned int)"+basestr+")"; - } else { - oid="((unsigned int)(("+teststr+")?"+basestr+":NULL))"; - } - oids.add(oid); - - for(int i = breakindex; i < pp.desc.size(); i++) { - String newfieldoffset; - Object desc = pp.getDescAt(i); - if(desc instanceof FieldDescriptor) { - FieldDescriptor fd=(FieldDescriptor)desc; - newfieldoffset = new String("(unsigned int)(&(((struct "+ lasttype.getSafeSymbol()+" *)0)->"+ fd.getSafeSymbol()+ "))"); - lasttype=fd.getType(); - } else { - newfieldoffset = ""; - IndexDescriptor id=(IndexDescriptor)desc; - for(int j = 0; j < id.tddesc.size(); j++) { - newfieldoffset += generateTemp(fm, id.getTempDescAt(j), lb) + "+"; - } - newfieldoffset += id.offset.toString(); - lasttype=lasttype.dereference(); - } - fieldoffset.add(newfieldoffset); - } - - int base=(tuplecount>0)?((Short)endoffset.get(tuplecount-1)).intValue():0; - base+=pp.desc.size()-breakindex; - endoffset.add(new Short((short)base)); - } - - - - public void generateFlatGlobalConvNode(FlatMethod fm, LocalityBinding lb, FlatGlobalConvNode fgcn, PrintWriter output) { - if (lb!=fgcn.getLocality()) - return; - /* Have to generate flat globalconv */ - if (fgcn.getMakePtr()) { - output.println(generateTemp(fm, fgcn.getSrc(),lb)+"=(void *)transRead(trans, (unsigned int) "+generateTemp(fm, fgcn.getSrc(),lb)+");"); - } else { - /* Need to convert to OID */ - output.println(generateTemp(fm, fgcn.getSrc(),lb)+"=(void *)COMPOID("+generateTemp(fm, fgcn.getSrc(),lb)+");"); - } - } - - public void generateFlatAtomicEnterNode(FlatMethod fm, LocalityBinding lb, FlatAtomicEnterNode faen, PrintWriter output) { - /* Check to see if we need to generate code for this atomic */ - if (locality.getAtomic(lb).get(faen.getPrev(0)).intValue()>0) - return; - /* Backup the temps. */ - for(Iterator tmpit=locality.getTemps(lb).get(faen).iterator();tmpit.hasNext();) { - TempDescriptor tmp=tmpit.next(); - output.println(generateTemp(fm, backuptable.get(tmp),lb)+"="+generateTemp(fm,tmp,lb)+";"); - } - output.println("goto transstart"+faen.getIdentifier()+";"); - - /******* Print code to retry aborted transaction *******/ - output.println("transretry"+faen.getIdentifier()+":"); - - /* Restore temps */ - for(Iterator tmpit=locality.getTemps(lb).get(faen).iterator();tmpit.hasNext();) { - TempDescriptor tmp=tmpit.next(); - output.println(generateTemp(fm, tmp,lb)+"="+generateTemp(fm,backuptable.get(tmp),lb)+";"); - } - - /********* Need to revert local object store ********/ - String revertptr=generateTemp(fm, reverttable.get(lb),lb); - - output.println("while ("+revertptr+") {"); - output.println("struct ___Object___ * tmpptr;"); - output.println("tmpptr="+revertptr+"->"+nextobjstr+";"); - output.println("REVERT_OBJ("+revertptr+");"); - output.println(revertptr+"=tmpptr;"); - output.println("}"); - - /******* Tell the runtime to start the transaction *******/ - - output.println("transstart"+faen.getIdentifier()+":"); - output.println("trans=transStart();"); - } - - public void generateFlatAtomicExitNode(FlatMethod fm, LocalityBinding lb, FlatAtomicExitNode faen, PrintWriter output) { - /* Check to see if we need to generate code for this atomic */ - if (locality.getAtomic(lb).get(faen).intValue()>0) - return; - //store the revert list before we lose the transaction object - String revertptr=generateTemp(fm, reverttable.get(lb),lb); - output.println(revertptr+"=trans->revertlist;"); - output.println("if (transCommit(trans)) {"); - /* Transaction aborts if it returns true */ - output.println("goto transretry"+faen.getAtomicEnter().getIdentifier()+";"); - output.println("} else {"); - /* Need to commit local object store */ - output.println("while ("+revertptr+") {"); - output.println("struct ___Object___ * tmpptr;"); - output.println("tmpptr="+revertptr+"->"+nextobjstr+";"); - output.println("COMMIT_OBJ("+revertptr+");"); - output.println(revertptr+"=tmpptr;"); - output.println("}"); - output.println("}"); - } - - private void generateFlatCheckNode(FlatMethod fm, LocalityBinding lb, FlatCheckNode fcn, PrintWriter output) { - if (state.CONSCHECK) { - String specname=fcn.getSpec(); - String varname="repairstate___"; - output.println("{"); - output.println("struct "+specname+"_state * "+varname+"=allocate"+specname+"_state();"); - - TempDescriptor[] temps=fcn.getTemps(); - String[] vars=fcn.getVars(); - for(int i=0;i"+vars[i]+"=(unsigned int)"+generateTemp(fm, temps[i],lb)+";"); - } - - output.println("if (doanalysis"+specname+"("+varname+")) {"); - output.println("free"+specname+"_state("+varname+");"); - output.println("} else {"); - output.println("/* Bad invariant */"); - output.println("free"+specname+"_state("+varname+");"); - output.println("abort_task();"); - output.println("}"); - output.println("}"); - } - } - - private void generateFlatCall(FlatMethod fm, LocalityBinding lb, FlatCall fc, PrintWriter output) { - MethodDescriptor md=fc.getMethod(); - ParamsObject objectparams=(ParamsObject)paramstable.get(state.DSM?locality.getBinding(lb, fc):md); - ClassDescriptor cn=md.getClassDesc(); - output.println("{"); - if (GENERATEPRECISEGC) { - if (state.DSM) { - LocalityBinding fclb=locality.getBinding(lb, fc); - output.print(" struct "+cn.getSafeSymbol()+fclb.getSignature()+md.getSafeSymbol()+"_"+md.getSafeMethodDescriptor()+"_params __parameterlist__={"); - } else - output.print(" struct "+cn.getSafeSymbol()+md.getSafeSymbol()+"_"+md.getSafeMethodDescriptor()+"_params __parameterlist__={"); - - output.print(objectparams.numPointers()); - output.print(", & "+localsprefix); - if (md.getThis()!=null) { - output.print(", "); - output.print("(struct "+md.getThis().getType().getSafeSymbol() +" *)"+ generateTemp(fm,fc.getThis(),lb)); - } - if (fc.getThis()!=null&&md.getThis()==null) { - System.out.println("WARNING!!!!!!!!!!!!"); - System.out.println("Source code calls static method"+md+"on an object in "+fm.getMethod()+"!"); - } - - - for(int i=0;itype*"+maxcount+"+"+virtualcalls.getLocalityNumber(fclb)+"])"); - } else - output.print("))virtualtable["+generateTemp(fm,fc.getThis(),lb)+"->type*"+maxcount+"+"+virtualcalls.getMethodNumber(md)+"])"); - } - - output.print("("); - boolean needcomma=false; - if (GENERATEPRECISEGC) { - output.print("&__parameterlist__"); - needcomma=true; - } - - if (state.DSM&&locality.getBinding(lb,fc).isAtomic()&&!fc.getMethod().getModifiers().isNative()) { - if (needcomma) - output.print(","); - output.print("trans"); - needcomma=true; - } - - if (!GENERATEPRECISEGC) { - if (fc.getThis()!=null) { - TypeDescriptor ptd=md.getThis().getType(); - if (needcomma) - output.print(","); - if (ptd.isClass()&&!ptd.isArray()) - output.print("(struct "+ptd.getSafeSymbol()+" *) "); - output.print(generateTemp(fm,fc.getThis(),lb)); - needcomma=true; - } - } - - for(int i=0;i"+field+"="+temp+";"); - //output.println("}"); - //output.println(dst+"=temp;"); - //output.println("}"); - //} else { - output.println(dst+"="+ src +"->"+field+ ";"); - //output.println("if ("+dst+"&0x1) {"); - output.println(dst+"=(void *) transRead(trans, (unsigned int) "+dst+");"); - //output.println(src+"->"+field+"="+src+"->"+field+";"); - //output.println("}"); - //} - } else { - output.println(dst+"="+ src+"->"+field+";"); - } - } else if (status==LocalityAnalysis.LOCAL) { - output.println(generateTemp(fm, ffn.getDst(),lb)+"="+ generateTemp(fm,ffn.getSrc(),lb)+"->"+ ffn.getField().getSafeSymbol()+";"); - } else if (status==LocalityAnalysis.EITHER) { - //Code is reading from a null pointer - output.println("if ("+generateTemp(fm, ffn.getSrc(),lb)+") {"); - output.println("#ifndef RAW"); - output.println("printf(\"BIG ERROR\\n\");exit(-1);}"); - output.println("#endif"); - //This should throw a suitable null pointer error - output.println(generateTemp(fm, ffn.getDst(),lb)+"="+ generateTemp(fm,ffn.getSrc(),lb)+"->"+ ffn.getField().getSafeSymbol()+";"); - } else - throw new Error("Read from non-global/non-local in:"+lb.getExplanation()); - } else - output.println(generateTemp(fm, ffn.getDst(),lb)+"="+ generateTemp(fm,ffn.getSrc(),lb)+"->"+ ffn.getField().getSafeSymbol()+";"); - } - - - private void generateFlatSetFieldNode(FlatMethod fm, LocalityBinding lb, FlatSetFieldNode fsfn, PrintWriter output) { - if (fsfn.getField().getSymbol().equals("length")&&fsfn.getDst().getType().isArray()) - throw new Error("Can't set array length"); - if (state.DSM && locality.getAtomic(lb).get(fsfn).intValue()>0) { - Integer statussrc=locality.getNodePreTempInfo(lb,fsfn).get(fsfn.getSrc()); - Integer statusdst=locality.getNodeTempInfo(lb).get(fsfn).get(fsfn.getDst()); - boolean srcglobal=statussrc==LocalityAnalysis.GLOBAL; - - String src=generateTemp(fm,fsfn.getSrc(),lb); - String dst=generateTemp(fm,fsfn.getDst(),lb); - if (srcglobal) { - output.println("{"); - output.println("int srcoid=(int)"+src+"->"+oidstr+";"); - } - if (statusdst.equals(LocalityAnalysis.GLOBAL)) { - String glbdst=dst; - //mark it dirty - output.println("*((unsigned int *)&("+dst+"->___localcopy___))|=DIRTY;"); - if (srcglobal) { - output.println("*((unsigned int *)&("+glbdst+"->"+ fsfn.getField().getSafeSymbol()+"))=srcoid;"); - } else - output.println(glbdst+"->"+ fsfn.getField().getSafeSymbol()+"="+ src+";"); - } else if (statusdst.equals(LocalityAnalysis.LOCAL)) { - /** Check if we need to copy */ - output.println("if(!"+dst+"->"+localcopystr+") {"); - /* Link object into list */ - String revertptr=generateTemp(fm, reverttable.get(lb),lb); - output.println(revertptr+"=trans->revertlist;"); - if (GENERATEPRECISEGC) - output.println("COPY_OBJ((struct garbagelist *)&"+localsprefix+",(struct ___Object___ *)"+dst+");"); - else - output.println("COPY_OBJ("+dst+");"); - output.println(dst+"->"+nextobjstr+"="+revertptr+";"); - output.println("trans->revertlist=(struct ___Object___ *)"+dst+";"); - output.println("}"); - if (srcglobal) - output.println(dst+"->"+ fsfn.getField().getSafeSymbol()+"=srcoid;"); - else - output.println(dst+"->"+ fsfn.getField().getSafeSymbol()+"="+ src+";"); - } else if (statusdst.equals(LocalityAnalysis.EITHER)) { - //writing to a null...bad - output.println("if ("+dst+") {"); - output.println("#ifndef RAW"); - output.println("printf(\"BIG ERROR 2\\n\");exit(-1);}"); - output.println("#endif"); - if (srcglobal) - output.println(dst+"->"+ fsfn.getField().getSafeSymbol()+"=srcoid;"); - else - output.println(dst+"->"+ fsfn.getField().getSafeSymbol()+"="+ src+";"); - } - if (srcglobal) { - output.println("}"); - } - } else { - output.println(generateTemp(fm, fsfn.getDst(),lb)+"->"+ fsfn.getField().getSafeSymbol()+"="+ generateTemp(fm,fsfn.getSrc(),lb)+";"); - } - } - - private void generateFlatElementNode(FlatMethod fm, LocalityBinding lb, FlatElementNode fen, PrintWriter output) { - TypeDescriptor elementtype=fen.getSrc().getType().dereference(); - String type=""; - - if (elementtype.isArray()||elementtype.isClass()) - type="void *"; - else - type=elementtype.getSafeSymbol()+" "; - - if (fen.needsBoundsCheck()) { - output.println("if ("+generateTemp(fm, fen.getIndex(),lb)+"< 0 || "+generateTemp(fm, fen.getIndex(),lb)+" >= "+generateTemp(fm,fen.getSrc(),lb) + "->___length___)"); - output.println("failedboundschk();"); - } - if (state.DSM) { - Integer status=locality.getNodePreTempInfo(lb,fen).get(fen.getSrc()); - if (status==LocalityAnalysis.GLOBAL) { - String dst=generateTemp(fm, fen.getDst(),lb); - - if (elementtype.isPtr()) { - output.println(dst +"=(("+ type+"*)(((char *) &("+ generateTemp(fm,fen.getSrc(),lb)+"->___length___))+sizeof(int)))["+generateTemp(fm, fen.getIndex(),lb)+"];"); - output.println(dst+"=(void *) transRead(trans, (unsigned int) "+dst+");"); - } else { - output.println(dst +"=(("+ type+"*)(((char *) &("+ generateTemp(fm,fen.getSrc(),lb)+"->___length___))+sizeof(int)))["+generateTemp(fm, fen.getIndex(),lb)+"];"); - } - } else if (status==LocalityAnalysis.LOCAL) { - output.println(generateTemp(fm, fen.getDst(),lb)+"=(("+ type+"*)(((char *) &("+ generateTemp(fm,fen.getSrc(),lb)+"->___length___))+sizeof(int)))["+generateTemp(fm, fen.getIndex(),lb)+"];"); - } else if (status==LocalityAnalysis.EITHER) { - //Code is reading from a null pointer - output.println("if ("+generateTemp(fm, fen.getSrc(),lb)+") {"); - output.println("#ifndef RAW"); - output.println("printf(\"BIG ERROR\\n\");exit(-1);}"); - output.println("#endif"); - //This should throw a suitable null pointer error - output.println(generateTemp(fm, fen.getDst(),lb)+"=(("+ type+"*)(((char *) &("+ generateTemp(fm,fen.getSrc(),lb)+"->___length___))+sizeof(int)))["+generateTemp(fm, fen.getIndex(),lb)+"];"); - } else - throw new Error("Read from non-global/non-local in:"+lb.getExplanation()); - } else { - output.println(generateTemp(fm, fen.getDst(),lb)+"=(("+ type+"*)(((char *) &("+ generateTemp(fm,fen.getSrc(),lb)+"->___length___))+sizeof(int)))["+generateTemp(fm, fen.getIndex(),lb)+"];"); - } - } - - private void generateFlatSetElementNode(FlatMethod fm, LocalityBinding lb, FlatSetElementNode fsen, PrintWriter output) { - //TODO: need dynamic check to make sure this assignment is actually legal - //Because Object[] could actually be something more specific...ie. Integer[] - - TypeDescriptor elementtype=fsen.getDst().getType().dereference(); - String type=""; - - if (elementtype.isArray()||elementtype.isClass()) - type="void *"; - else - type=elementtype.getSafeSymbol()+" "; - - - if (fsen.needsBoundsCheck()) { - output.println("if ("+generateTemp(fm, fsen.getIndex(),lb)+"< 0 || "+generateTemp(fm, fsen.getIndex(),lb)+" >= "+generateTemp(fm,fsen.getDst(),lb) + "->___length___)"); - output.println("failedboundschk();"); - } - - if (state.DSM && locality.getAtomic(lb).get(fsen).intValue()>0) { - Integer statussrc=locality.getNodePreTempInfo(lb,fsen).get(fsen.getSrc()); - Integer statusdst=locality.getNodePreTempInfo(lb,fsen).get(fsen.getDst()); - boolean srcglobal=statussrc==LocalityAnalysis.GLOBAL; - boolean dstglobal=statusdst==LocalityAnalysis.GLOBAL; - boolean dstlocal=statusdst==LocalityAnalysis.LOCAL; - - if (dstglobal) { - output.println("*((unsigned int *)&("+generateTemp(fm,fsen.getDst(),lb)+"->___localcopy___))|=DIRTY;"); - } else if (dstlocal) { - /** Check if we need to copy */ - String dst=generateTemp(fm, fsen.getDst(),lb); - output.println("if(!"+dst+"->"+localcopystr+") {"); - /* Link object into list */ - String revertptr=generateTemp(fm, reverttable.get(lb),lb); - output.println(revertptr+"=trans->revertlist;"); - if (GENERATEPRECISEGC) - output.println("COPY_OBJ((struct garbagelist *)&"+localsprefix+",(struct ___Object___ *)"+dst+");"); - else - output.println("COPY_OBJ("+dst+");"); - output.println(dst+"->"+nextobjstr+"="+revertptr+";"); - output.println("trans->revertlist=(struct ___Object___ *)"+dst+";"); - output.println("}"); - } else throw new Error("Unknown array type"); - if (srcglobal) { - output.println("{"); - String src=generateTemp(fm, fsen.getSrc(), lb); - output.println("int srcoid=(int)"+src+"->"+oidstr+";"); - output.println("((int*)(((char *) &("+ generateTemp(fm,fsen.getDst(),lb)+"->___length___))+sizeof(int)))["+generateTemp(fm, fsen.getIndex(),lb)+"]=srcoid;"); - output.println("}"); - } else { - output.println("(("+type +"*)(((char *) &("+ generateTemp(fm,fsen.getDst(),lb)+"->___length___))+sizeof(int)))["+generateTemp(fm, fsen.getIndex(),lb)+"]="+generateTemp(fm,fsen.getSrc(),lb)+";"); - } - } else - output.println("(("+type +"*)(((char *) &("+ generateTemp(fm,fsen.getDst(),lb)+"->___length___))+sizeof(int)))["+generateTemp(fm, fsen.getIndex(),lb)+"]="+generateTemp(fm,fsen.getSrc(),lb)+";"); - } - - private void generateFlatNew(FlatMethod fm, LocalityBinding lb, FlatNew fn, PrintWriter output) { - if (state.DSM && locality.getAtomic(lb).get(fn).intValue()>0&&!fn.isGlobal()) { - //Stash pointer in case of GC - String revertptr=generateTemp(fm, reverttable.get(lb),lb); - output.println(revertptr+"=trans->revertlist;"); - } - if (fn.getType().isArray()) { - int arrayid=state.getArrayNumber(fn.getType())+state.numClasses(); - if (fn.isGlobal()) { - output.println(generateTemp(fm,fn.getDst(),lb)+"=allocate_newarrayglobal(trans, "+arrayid+", "+generateTemp(fm, fn.getSize(),lb)+");"); - } else if (GENERATEPRECISEGC) { - output.println(generateTemp(fm,fn.getDst(),lb)+"=allocate_newarray(&"+localsprefix+", "+arrayid+", "+generateTemp(fm, fn.getSize(),lb)+");"); - } else { - output.println(generateTemp(fm,fn.getDst(),lb)+"=allocate_newarray("+arrayid+", "+generateTemp(fm, fn.getSize(),lb)+");"); - } - } else { - if (fn.isGlobal()) { - output.println(generateTemp(fm,fn.getDst(),lb)+"=allocate_newglobal(trans, "+fn.getType().getClassDesc().getId()+");"); - } else if (GENERATEPRECISEGC) { - output.println(generateTemp(fm,fn.getDst(),lb)+"=allocate_new(&"+localsprefix+", "+fn.getType().getClassDesc().getId()+");"); - } else { - output.println(generateTemp(fm,fn.getDst(),lb)+"=allocate_new("+fn.getType().getClassDesc().getId()+");"); - } - } - if (state.DSM && locality.getAtomic(lb).get(fn).intValue()>0&&!fn.isGlobal()) { - String revertptr=generateTemp(fm, reverttable.get(lb),lb); - output.println("trans->revertlist="+revertptr+";"); - } - } - - private void generateFlatTagDeclaration(FlatMethod fm, LocalityBinding lb, FlatTagDeclaration fn, PrintWriter output) { - if (GENERATEPRECISEGC) { - output.println(generateTemp(fm,fn.getDst(),lb)+"=allocate_tag(&"+localsprefix+", "+state.getTagId(fn.getType())+");"); - } else { - output.println(generateTemp(fm,fn.getDst(),lb)+"=allocate_tag("+state.getTagId(fn.getType())+");"); - } - } - - private void generateFlatOpNode(FlatMethod fm, LocalityBinding lb, FlatOpNode fon, PrintWriter output) { - if (fon.getRight()!=null) { - if (fon.getOp().getOp()==Operation.URIGHTSHIFT) { - if (fon.getLeft().getType().isLong()) - output.println(generateTemp(fm, fon.getDest(),lb)+" = ((unsigned long long)"+generateTemp(fm, fon.getLeft(),lb)+")>>"+generateTemp(fm,fon.getRight(),lb)+";"); - else - output.println(generateTemp(fm, fon.getDest(),lb)+" = ((unsigned int)"+generateTemp(fm, fon.getLeft(),lb)+")>>"+generateTemp(fm,fon.getRight(),lb)+";"); - - } else - output.println(generateTemp(fm, fon.getDest(),lb)+" = "+generateTemp(fm, fon.getLeft(),lb)+fon.getOp().toString()+generateTemp(fm,fon.getRight(),lb)+";"); - } else if (fon.getOp().getOp()==Operation.ASSIGN) - output.println(generateTemp(fm, fon.getDest(),lb)+" = "+generateTemp(fm, fon.getLeft(),lb)+";"); - else if (fon.getOp().getOp()==Operation.UNARYPLUS) - output.println(generateTemp(fm, fon.getDest(),lb)+" = "+generateTemp(fm, fon.getLeft(),lb)+";"); - else if (fon.getOp().getOp()==Operation.UNARYMINUS) - output.println(generateTemp(fm, fon.getDest(),lb)+" = -"+generateTemp(fm, fon.getLeft(),lb)+";"); - else if (fon.getOp().getOp()==Operation.LOGIC_NOT) - output.println(generateTemp(fm, fon.getDest(),lb)+" = !"+generateTemp(fm, fon.getLeft(),lb)+";"); - else if (fon.getOp().getOp()==Operation.COMP) - output.println(generateTemp(fm, fon.getDest(),lb)+" = ~"+generateTemp(fm, fon.getLeft(),lb)+";"); - else if (fon.getOp().getOp()==Operation.ISAVAILABLE) { - output.println(generateTemp(fm, fon.getDest(),lb)+" = "+generateTemp(fm, fon.getLeft(),lb)+"->fses==NULL;"); - } else - output.println(generateTemp(fm, fon.getDest(),lb)+fon.getOp().toString()+generateTemp(fm, fon.getLeft(),lb)+";"); - } - - private void generateFlatCastNode(FlatMethod fm, LocalityBinding lb, FlatCastNode fcn, PrintWriter output) { - /* TODO: Do type check here */ - if (fcn.getType().isArray()) { - throw new Error(); - } else if (fcn.getType().isClass()) - output.println(generateTemp(fm,fcn.getDst(),lb)+"=(struct "+fcn.getType().getSafeSymbol()+" *)"+generateTemp(fm,fcn.getSrc(),lb)+";"); - else - output.println(generateTemp(fm,fcn.getDst(),lb)+"=("+fcn.getType().getSafeSymbol()+")"+generateTemp(fm,fcn.getSrc(),lb)+";"); - } - - private void generateFlatLiteralNode(FlatMethod fm, LocalityBinding lb, FlatLiteralNode fln, PrintWriter output) { - if (fln.getValue()==null) - output.println(generateTemp(fm, fln.getDst(),lb)+"=0;"); - else if (fln.getType().getSymbol().equals(TypeUtil.StringClass)) { - if (GENERATEPRECISEGC) { - if (state.DSM && locality.getAtomic(lb).get(fln).intValue()>0) { - //Stash pointer in case of GC - String revertptr=generateTemp(fm, reverttable.get(lb),lb); - output.println(revertptr+"=trans->revertlist;"); - } - output.println(generateTemp(fm, fln.getDst(),lb)+"=NewString(&"+localsprefix+", \""+FlatLiteralNode.escapeString((String)fln.getValue())+"\","+((String)fln.getValue()).length()+");"); - if (state.DSM && locality.getAtomic(lb).get(fln).intValue()>0) { - //Stash pointer in case of GC - String revertptr=generateTemp(fm, reverttable.get(lb),lb); - output.println("trans->revertlist="+revertptr+";"); - } - } else { - output.println(generateTemp(fm, fln.getDst(),lb)+"=NewString(\""+FlatLiteralNode.escapeString((String)fln.getValue())+"\","+((String)fln.getValue()).length()+");"); - } - } else if (fln.getType().isBoolean()) { - if (((Boolean)fln.getValue()).booleanValue()) - output.println(generateTemp(fm, fln.getDst(),lb)+"=1;"); - else - output.println(generateTemp(fm, fln.getDst(),lb)+"=0;"); - } else if (fln.getType().isChar()) { - String st=FlatLiteralNode.escapeString(fln.getValue().toString()); - output.println(generateTemp(fm, fln.getDst(),lb)+"='"+st+"';"); - } else if (fln.getType().isLong()) { - output.println(generateTemp(fm, fln.getDst(),lb)+"="+fln.getValue()+"LL;"); - } else - output.println(generateTemp(fm, fln.getDst(),lb)+"="+fln.getValue()+";"); - } - - protected void generateFlatReturnNode(FlatMethod fm, LocalityBinding lb, FlatReturnNode frn, PrintWriter output) { - if (frn.getReturnTemp()!=null) { - if (frn.getReturnTemp().getType().isPtr()) - output.println("return (struct "+fm.getMethod().getReturnType().getSafeSymbol()+"*)"+generateTemp(fm, frn.getReturnTemp(), lb)+";"); - else - output.println("return "+generateTemp(fm, frn.getReturnTemp(), lb)+";"); - } else { - output.println("return;"); - } - } - - protected void generateFlatCondBranch(FlatMethod fm, LocalityBinding lb, FlatCondBranch fcb, String label, PrintWriter output) { - output.println("if (!"+generateTemp(fm, fcb.getTest(),lb)+") goto "+label+";"); - } - - /** This method generates header information for the method or - * task referenced by the Descriptor des. */ - - private void generateHeader(FlatMethod fm, LocalityBinding lb, Descriptor des, PrintWriter output) { - /* Print header */ - ParamsObject objectparams=(ParamsObject)paramstable.get(lb!=null?lb:des); - MethodDescriptor md=null; - TaskDescriptor task=null; - if (des instanceof MethodDescriptor) - md=(MethodDescriptor) des; - else - task=(TaskDescriptor) des; - - ClassDescriptor cn=md!=null?md.getClassDesc():null; - - if (md!=null&&md.getReturnType()!=null) { - if (md.getReturnType().isClass()||md.getReturnType().isArray()) - output.print("struct " + md.getReturnType().getSafeSymbol()+" * "); - else - output.print(md.getReturnType().getSafeSymbol()+" "); - } else - //catch the constructor case - output.print("void "); - if (md!=null) { - if (state.DSM) { - output.print(cn.getSafeSymbol()+lb.getSignature()+md.getSafeSymbol()+"_"+md.getSafeMethodDescriptor()+"("); - } else - output.print(cn.getSafeSymbol()+md.getSafeSymbol()+"_"+md.getSafeMethodDescriptor()+"("); - } else - output.print(task.getSafeSymbol()+"("); - - boolean printcomma=false; - if (GENERATEPRECISEGC) { - if (md!=null) { - if (state.DSM) { - output.print("struct "+cn.getSafeSymbol()+lb.getSignature()+md.getSafeSymbol()+"_"+md.getSafeMethodDescriptor()+"_params * "+paramsprefix); - } else - output.print("struct "+cn.getSafeSymbol()+md.getSafeSymbol()+"_"+md.getSafeMethodDescriptor()+"_params * "+paramsprefix); - } else - output.print("struct "+task.getSafeSymbol()+"_params * "+paramsprefix); - printcomma=true; - } - - if (state.DSM&&lb.isAtomic()) { - if (printcomma) - output.print(", "); - output.print("transrecord_t * trans"); - printcomma=true; - } - - if (md!=null) { - /* Method */ - for(int i=0;imaxtaskparams) - maxtaskparams=objectparams.numPrimitives()+fm.numTags(); - } else output.println(") {"); - } - - public void generateFlatFlagActionNode(FlatMethod fm, LocalityBinding lb, FlatFlagActionNode ffan, PrintWriter output) { - output.println("/* FlatFlagActionNode */"); - - - /* Process tag changes */ - Relation tagsettable=new Relation(); - Relation tagcleartable=new Relation(); - - Iterator tagsit=ffan.getTempTagPairs(); - while (tagsit.hasNext()) { - TempTagPair ttp=(TempTagPair) tagsit.next(); - TempDescriptor objtmp=ttp.getTemp(); - TagDescriptor tag=ttp.getTag(); - TempDescriptor tagtmp=ttp.getTagTemp(); - boolean tagstatus=ffan.getTagChange(ttp); - if (tagstatus) { - tagsettable.put(objtmp, tagtmp); - } else { - tagcleartable.put(objtmp, tagtmp); - } - } - - - Hashtable flagandtable=new Hashtable(); - Hashtable flagortable=new Hashtable(); - - /* Process flag changes */ - Iterator flagsit=ffan.getTempFlagPairs(); - while(flagsit.hasNext()) { - TempFlagPair tfp=(TempFlagPair)flagsit.next(); - TempDescriptor temp=tfp.getTemp(); - Hashtable flagtable=(Hashtable)flagorder.get(temp.getType().getClassDesc()); - FlagDescriptor flag=tfp.getFlag(); - if (flag==null) { - //Newly allocate objects that don't set any flags case - if (flagortable.containsKey(temp)) { - throw new Error(); - } - int mask=0; - flagortable.put(temp,new Integer(mask)); - } else { - int flagid=1<<((Integer)flagtable.get(flag)).intValue(); - boolean flagstatus=ffan.getFlagChange(tfp); - if (flagstatus) { - int mask=0; - if (flagortable.containsKey(temp)) { - mask=((Integer)flagortable.get(temp)).intValue(); - } - mask|=flagid; - flagortable.put(temp,new Integer(mask)); - } else { - int mask=0xFFFFFFFF; - if (flagandtable.containsKey(temp)) { - mask=((Integer)flagandtable.get(temp)).intValue(); - } - mask&=(0xFFFFFFFF^flagid); - flagandtable.put(temp,new Integer(mask)); - } - } - } - - - HashSet flagtagset=new HashSet(); - flagtagset.addAll(flagortable.keySet()); - flagtagset.addAll(flagandtable.keySet()); - flagtagset.addAll(tagsettable.keySet()); - flagtagset.addAll(tagcleartable.keySet()); - - Iterator ftit=flagtagset.iterator(); - while(ftit.hasNext()) { - TempDescriptor temp=(TempDescriptor)ftit.next(); - - - Set tagtmps=tagcleartable.get(temp); - if (tagtmps!=null) { - Iterator tagit=tagtmps.iterator(); - while(tagit.hasNext()) { - TempDescriptor tagtmp=(TempDescriptor)tagit.next(); - if (GENERATEPRECISEGC) - output.println("tagclear(&"+localsprefix+", (struct ___Object___ *)"+generateTemp(fm, temp,lb)+", "+generateTemp(fm,tagtmp,lb)+");"); - else - output.println("tagclear((struct ___Object___ *)"+generateTemp(fm, temp,lb)+", "+generateTemp(fm,tagtmp,lb)+");"); - } - } - - tagtmps=tagsettable.get(temp); - if (tagtmps!=null) { - Iterator tagit=tagtmps.iterator(); - while(tagit.hasNext()) { - TempDescriptor tagtmp=(TempDescriptor)tagit.next(); - if (GENERATEPRECISEGC) - output.println("tagset(&"+localsprefix+", (struct ___Object___ *)"+generateTemp(fm, temp,lb)+", "+generateTemp(fm,tagtmp,lb)+");"); - else - output.println("tagset((struct ___Object___ *)"+generateTemp(fm, temp, lb)+", "+generateTemp(fm,tagtmp, lb)+");"); - } - } - - int ormask=0; - int andmask=0xFFFFFFF; - - if (flagortable.containsKey(temp)) - ormask=((Integer)flagortable.get(temp)).intValue(); - if (flagandtable.containsKey(temp)) - andmask=((Integer)flagandtable.get(temp)).intValue(); - generateFlagOrAnd(ffan, fm, lb, temp, output, ormask, andmask); - generateObjectDistribute(ffan, fm, lb, temp, output); - } - } - - protected void generateFlagOrAnd(FlatFlagActionNode ffan, FlatMethod fm, LocalityBinding lb, TempDescriptor temp, - PrintWriter output, int ormask, int andmask) { - if (ffan.getTaskType()==FlatFlagActionNode.NEWOBJECT) { - output.println("flagorandinit("+generateTemp(fm, temp, lb)+", 0x"+Integer.toHexString(ormask)+", 0x"+Integer.toHexString(andmask)+");"); - } else { - output.println("flagorand("+generateTemp(fm, temp, lb)+", 0x"+Integer.toHexString(ormask)+", 0x"+Integer.toHexString(andmask)+");"); - } - } - - protected void generateObjectDistribute(FlatFlagActionNode ffan, FlatMethod fm, LocalityBinding lb, TempDescriptor temp, PrintWriter output) { - output.println("enqueueObject("+generateTemp(fm, temp, lb)+");"); - } - - void generateOptionalHeader(PrintWriter headers) { - - //GENERATE HEADERS - headers.println("#include \"task.h\"\n\n"); - headers.println("#ifndef _OPTIONAL_STRUCT_"); - headers.println("#define _OPTIONAL_STRUCT_"); - - //STRUCT PREDICATEMEMBER - headers.println("struct predicatemember{"); - headers.println("int type;"); - headers.println("int numdnfterms;"); - headers.println("int * flags;"); - headers.println("int numtags;"); - headers.println("int * tags;\n};\n\n"); - - //STRUCT OPTIONALTASKDESCRIPTOR - headers.println("struct optionaltaskdescriptor{"); - headers.println("struct taskdescriptor * task;"); - headers.println("int index;"); - headers.println("int numenterflags;"); - headers.println("int * enterflags;"); - headers.println("int numpredicatemembers;"); - headers.println("struct predicatemember ** predicatememberarray;"); - headers.println("};\n\n"); - - //STRUCT TASKFAILURE - headers.println("struct taskfailure {"); - headers.println("struct taskdescriptor * task;"); - headers.println("int index;"); - headers.println("int numoptionaltaskdescriptors;"); - headers.println("struct optionaltaskdescriptor ** optionaltaskdescriptorarray;\n};\n\n"); - - //STRUCT FSANALYSISWRAPPER - headers.println("struct fsanalysiswrapper{"); - headers.println("int flags;"); - headers.println("int numtags;"); - headers.println("int * tags;"); - headers.println("int numtaskfailures;"); - headers.println("struct taskfailure ** taskfailurearray;"); - headers.println("int numoptionaltaskdescriptors;"); - headers.println("struct optionaltaskdescriptor ** optionaltaskdescriptorarray;\n};\n\n"); - - //STRUCT CLASSANALYSISWRAPPER - headers.println("struct classanalysiswrapper{"); - headers.println("int type;"); - headers.println("int numotd;"); - headers.println("struct optionaltaskdescriptor ** otdarray;"); - headers.println("int numfsanalysiswrappers;"); - headers.println("struct fsanalysiswrapper ** fsanalysiswrapperarray;\n};"); - - headers.println("extern struct classanalysiswrapper * classanalysiswrapperarray[];"); - - Iterator taskit=state.getTaskSymbolTable().getDescriptorsIterator(); - while(taskit.hasNext()) { - TaskDescriptor td=(TaskDescriptor)taskit.next(); - headers.println("extern struct taskdescriptor task_"+td.getSafeSymbol()+";"); - } - - } - - //CHECK OVER THIS -- THERE COULD BE SOME ERRORS HERE - int generateOptionalPredicate(Predicate predicate, OptionalTaskDescriptor otd, ClassDescriptor cdtemp, PrintWriter output) { - int predicateindex = 0; - //iterate through the classes concerned by the predicate - Set c_vard = predicate.vardescriptors; - Hashtable slotnumber=new Hashtable(); - int current_slot=0; - - for(Iterator vard_it = c_vard.iterator(); vard_it.hasNext();){ - VarDescriptor vard = (VarDescriptor)vard_it.next(); - TypeDescriptor typed = vard.getType(); - - //generate for flags - HashSet fen_hashset = predicate.flags.get(vard.getSymbol()); - output.println("int predicateflags_"+predicateindex+"_OTD"+otd.getuid()+"_"+cdtemp.getSafeSymbol()+"[]={"); - int numberterms=0; - if (fen_hashset!=null){ - for (Iterator fen_it = fen_hashset.iterator(); fen_it.hasNext();){ - FlagExpressionNode fen = (FlagExpressionNode)fen_it.next(); - if (fen!=null) { - DNFFlag dflag=fen.getDNF(); - numberterms+=dflag.size(); - - Hashtable flags=(Hashtable)flagorder.get(typed.getClassDesc()); - - for(int j=0;j>> safeexecution, Hashtable optionaltaskdescriptors) { - generateOptionalHeader(headers); - //GENERATE STRUCTS - output.println("#include \"optionalstruct.h\"\n\n"); - output.println("#include \"stdlib.h\"\n"); - - HashSet processedcd = new HashSet(); - int maxotd=0; - Enumeration e = safeexecution.keys(); - while (e.hasMoreElements()) { - int numotd=0; - //get the class - ClassDescriptor cdtemp=(ClassDescriptor)e.nextElement(); - Hashtable flaginfo=(Hashtable)flagorder.get(cdtemp);//will be used several times - - //Generate the struct of optionals - Collection c_otd = ((Hashtable)optionaltaskdescriptors.get(cdtemp)).values(); - numotd = c_otd.size(); - if(maxotd fsset=new TreeSet(); - //iterate through possible FSes corresponding to - //the state when entering - - for(Iterator fses = otd.enterflagstates.iterator(); fses.hasNext();){ - FlagState fs = (FlagState)fses.next(); - int flagid=0; - for(Iterator flags = fs.getFlags(); flags.hasNext();){ - FlagDescriptor flagd = (FlagDescriptor)flags.next(); - int id=1<<((Integer)flaginfo.get(flagd)).intValue(); - flagid|=id; - } - fsset.add(new Integer(flagid)); - //tag information not needed because tag - //changes are not tolerated. - } - - output.println("int enterflag_OTD"+otd.getuid()+"_"+cdtemp.getSafeSymbol()+"[]={"); - boolean needcomma=false; - for(Iterator it=fsset.iterator();it.hasNext();) { - if(needcomma) - output.print(", "); - output.println(it.next()); - } - - output.println("};\n"); - - - //generate optionaltaskdescriptor that actually - //includes exit fses, predicate and the task - //concerned - output.println("struct optionaltaskdescriptor optionaltaskdescriptor_"+otd.getuid()+"_"+cdtemp.getSafeSymbol()+"={"); - output.println("&task_"+otd.td.getSafeSymbol()+","); - output.println("/*index*/"+otd.getIndex()+","); - output.println("/*number of enter flags*/"+fsset.size()+","); - output.println("enterflag_OTD"+otd.getuid()+"_"+cdtemp.getSafeSymbol()+","); - output.println("/*number of members */"+predicateindex+","); - output.println("predicatememberarray_OTD"+otd.getuid()+"_"+cdtemp.getSafeSymbol()+","); - output.println("};\n"); - } - } else - continue; - // if there are no optionals, there is no need to build the rest of the struct - - output.println("struct optionaltaskdescriptor * otdarray"+cdtemp.getSafeSymbol()+"[]={"); - c_otd = ((Hashtable)optionaltaskdescriptors.get(cdtemp)).values(); - if( !c_otd.isEmpty() ){ - boolean needcomma=false; - for(Iterator otd_it = c_otd.iterator(); otd_it.hasNext();){ - OptionalTaskDescriptor otd = (OptionalTaskDescriptor)otd_it.next(); - if(needcomma) - output.println(","); - needcomma=true; - output.println("&optionaltaskdescriptor_"+otd.getuid()+"_"+cdtemp.getSafeSymbol()); - } - } - output.println("};\n"); - - //get all the possible flagstates reachable by an object - Hashtable hashtbtemp = safeexecution.get(cdtemp); - int fscounter = 0; - TreeSet fsts=new TreeSet(new FlagComparator(flaginfo)); - fsts.addAll(hashtbtemp.keySet()); - for(Iterator fsit=fsts.iterator();fsit.hasNext();) { - FlagState fs = (FlagState)fsit.next(); - fscounter++; - - //get the set of OptionalTaskDescriptors corresponding - HashSet availabletasks = (HashSet)hashtbtemp.get(fs); - //iterate through the OptionalTaskDescriptors and - //store the pointers to the optionals struct (see on - //top) into an array - - output.println("struct optionaltaskdescriptor * optionaltaskdescriptorarray_FS"+fscounter+"_"+cdtemp.getSafeSymbol()+"[] = {"); - for(Iterator mos = ordertd(availabletasks).iterator(); mos.hasNext();){ - OptionalTaskDescriptor mm = mos.next(); - if(!mos.hasNext()) - output.println("&optionaltaskdescriptor_"+mm.getuid()+"_"+cdtemp.getSafeSymbol()); - else - output.println("&optionaltaskdescriptor_"+mm.getuid()+"_"+cdtemp.getSafeSymbol()+","); - } - - output.println("};\n"); - - //process flag information (what the flag after failure is) so we know what optionaltaskdescriptors to choose. - - int flagid=0; - for(Iterator flags = fs.getFlags(); flags.hasNext();){ - FlagDescriptor flagd = (FlagDescriptor)flags.next(); - int id=1<<((Integer)flaginfo.get(flagd)).intValue(); - flagid|=id; - } - - //process tag information - - int tagcounter = 0; - boolean first = true; - Enumeration tag_enum = fs.getTags(); - output.println("int tags_FS"+fscounter+"_"+cdtemp.getSafeSymbol()+"[]={"); - while(tag_enum.hasMoreElements()){ - tagcounter++; - TagDescriptor tagd = (TagDescriptor)tag_enum.nextElement(); - if(first==true) - first = false; - else - output.println(", "); - output.println("/*tagid*/"+state.getTagId(tagd)); - } - output.println("};"); - - Set tiset=sa.getTaskIndex(fs); - for(Iterator itti=tiset.iterator();itti.hasNext();) { - TaskIndex ti=itti.next(); - if (ti.isRuntime()) - continue; - - Set otdset=sa.getOptions(fs, ti); - - output.print("struct optionaltaskdescriptor * optionaltaskfailure_FS"+fscounter+"_"+ti.getTask().getSafeSymbol()+"_"+ti.getIndex()+"_array[] = {"); - boolean needcomma=false; - for(Iterator otdit=ordertd(otdset).iterator();otdit.hasNext();) { - OptionalTaskDescriptor otd=otdit.next(); - if(needcomma) - output.print(", "); - needcomma=true; - output.println("&optionaltaskdescriptor_"+otd.getuid()+"_"+cdtemp.getSafeSymbol()); - } - output.println("};"); - - output.print("struct taskfailure taskfailure_FS"+fscounter+"_"+ti.getTask().getSafeSymbol()+"_"+ti.getIndex()+" = {"); - output.print("&task_"+ti.getTask().getSafeSymbol()+", "); - output.print(ti.getIndex()+", "); - output.print(otdset.size()+", "); - output.print("optionaltaskfailure_FS"+fscounter+"_"+ti.getTask().getSafeSymbol()+"_"+ti.getIndex()+"_array"); - output.println("};"); - } - - tiset=sa.getTaskIndex(fs); - boolean needcomma=false; - int runtimeti=0; - output.println("struct taskfailure * taskfailurearray"+fscounter+"_"+cdtemp.getSafeSymbol()+"[]={"); - for(Iterator itti=tiset.iterator();itti.hasNext();) { - TaskIndex ti=itti.next(); - if (ti.isRuntime()) { - runtimeti++; - continue; - } - if (needcomma) - output.print(", "); - needcomma=true; - output.print("&taskfailure_FS"+fscounter+"_"+ti.getTask().getSafeSymbol()+"_"+ti.getIndex()); - } - output.println("};\n"); - - //Store the result in fsanalysiswrapper - - output.println("struct fsanalysiswrapper fsanalysiswrapper_FS"+fscounter+"_"+cdtemp.getSafeSymbol()+"={"); - output.println("/*flag*/"+flagid+","); - output.println("/* number of tags*/"+tagcounter+","); - output.println("tags_FS"+fscounter+"_"+cdtemp.getSafeSymbol()+","); - output.println("/* numtask failures */"+(tiset.size()-runtimeti)+","); - output.println("taskfailurearray"+fscounter+"_"+cdtemp.getSafeSymbol()+","); - output.println("/* number of optionaltaskdescriptors */"+availabletasks.size()+","); - output.println("optionaltaskdescriptorarray_FS"+fscounter+"_"+cdtemp.getSafeSymbol()); - output.println("};\n"); - - } - - //Build the array of fsanalysiswrappers - output.println("struct fsanalysiswrapper * fsanalysiswrapperarray_"+cdtemp.getSafeSymbol()+"[] = {"); - boolean needcomma=false; - for(int i = 0; i0) - output.print(", "); - if (processedcd.contains(cn)) - output.print("&classanalysiswrapper_"+cn.getSafeSymbol()); - else - output.print("NULL"); - } - output.println("};"); - - output.println("#define MAXOTD "+maxotd); - headers.println("#endif"); - } - - public List ordertd(Set otdset) { - Relation r=new Relation(); - for(Iteratorotdit=otdset.iterator();otdit.hasNext();) { - OptionalTaskDescriptor otd=otdit.next(); - TaskIndex ti=new TaskIndex(otd.td, otd.getIndex()); - r.put(ti, otd); - } - - LinkedList l=new LinkedList(); - for(Iterator it=r.keySet().iterator();it.hasNext();) { - Set s=r.get(it.next()); - for(Iterator it2=s.iterator();it2.hasNext();) { - OptionalTaskDescriptor otd=(OptionalTaskDescriptor)it2.next(); - l.add(otd); - } - } - - return l; - } - - protected void outputTransCode(PrintWriter output) { - } -} - - - - - - diff --git a/Robust/src/IR/Flat/BuildCodeMultiCore.java b/Robust/src/IR/Flat/BuildCodeMultiCore.java deleted file mode 100644 index 2b9691af..00000000 --- a/Robust/src/IR/Flat/BuildCodeMultiCore.java +++ /dev/null @@ -1,1254 +0,0 @@ -package IR.Flat; - -import java.io.FileOutputStream; -import java.io.PrintWriter; -import java.util.HashSet; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.Queue; -import java.util.Vector; - -import Analysis.Locality.LocalityBinding; -import Analysis.Scheduling.Schedule; -import Analysis.TaskStateAnalysis.FEdge; -import Analysis.TaskStateAnalysis.FlagState; -import Analysis.TaskStateAnalysis.SafetyAnalysis; -import Analysis.Prefetch.*; -import IR.ClassDescriptor; -import IR.Descriptor; -import IR.FlagDescriptor; -import IR.MethodDescriptor; -import IR.State; -import IR.TagVarDescriptor; -import IR.TaskDescriptor; -import IR.TypeDescriptor; -import IR.TypeUtil; -import IR.VarDescriptor; -import IR.Tree.DNFFlag; -import IR.Tree.DNFFlagAtom; -import IR.Tree.FlagExpressionNode; -import IR.Tree.TagExpressionList; - -public class BuildCodeMultiCore extends BuildCode { - private Vector scheduling; - int coreNum; - Schedule currentSchedule; - Hashtable[] fsate2qnames; - String objqarrayprefix= "objqueuearray4class"; - String objqueueprefix = "objqueue4parameter_"; - String paramqarrayprefix = "paramqueuearray4task"; - String coreqarrayprefix = "paramqueuearrays_core"; - String taskprefix = "task_"; - String taskarrayprefix = "taskarray_core"; - String otqueueprefix = "___otqueue"; - int startupcorenum; // record the core containing startup task, suppose only one core can hava startup object - - public BuildCodeMultiCore(State st, Hashtable temptovar, TypeUtil typeutil, SafetyAnalysis sa, Vector scheduling, int coreNum, PrefetchAnalysis pa) { - super(st, temptovar, typeutil, sa, pa); - this.scheduling = scheduling; - this.coreNum = coreNum; - this.currentSchedule = null; - this.fsate2qnames = null; - this.startupcorenum = 0; - - // sometimes there are extra cores then needed in scheduling - // TODO - // currently, it is guaranteed that in scheduling, the corenum - // is started from 0 and continuous. - // MAY need modification here in the future when take hardware - // information into account. - if(this.scheduling.size() < this.coreNum) { - this.coreNum = this.scheduling.size(); - } - } - - public void buildCode() { - /* Create output streams to write to */ - PrintWriter outclassdefs=null; - PrintWriter outstructs=null; - PrintWriter outmethodheader=null; - PrintWriter outmethod=null; - PrintWriter outvirtual=null; - PrintWriter outtask=null; - PrintWriter outtaskdefs=null; - //PrintWriter outoptionalarrays=null; - //PrintWriter optionalheaders=null; - - try { - outstructs=new PrintWriter(new FileOutputStream(PREFIX+"structdefs.h"), true); - outmethodheader=new PrintWriter(new FileOutputStream(PREFIX+"methodheaders.h"), true); - outclassdefs=new PrintWriter(new FileOutputStream(PREFIX+"classdefs.h"), true); - outvirtual=new PrintWriter(new FileOutputStream(PREFIX+"virtualtable.h"), true); - outmethod=new PrintWriter(new FileOutputStream(PREFIX+"methods.c"), true); - if (state.TASK) { - outtask=new PrintWriter(new FileOutputStream(PREFIX+"task.h"), true); - outtaskdefs=new PrintWriter(new FileOutputStream(PREFIX+"taskdefs.c"), true); - /* optional - if (state.OPTIONAL){ - outoptionalarrays=new PrintWriter(new FileOutputStream(PREFIX+"optionalarrays.c"), true); - optionalheaders=new PrintWriter(new FileOutputStream(PREFIX+"optionalstruct.h"), true); - } */ - } - /*if (state.structfile!=null) { - outrepairstructs=new PrintWriter(new FileOutputStream(PREFIX+state.structfile+".struct"), true); - }*/ - } catch (Exception e) { - e.printStackTrace(); - System.exit(-1); - } - - /* Build the virtual dispatch tables */ - super.buildVirtualTables(outvirtual); - - /* Output includes */ - outmethodheader.println("#ifndef METHODHEADERS_H"); - outmethodheader.println("#define METHODHEADERS_H"); - outmethodheader.println("#include \"structdefs.h\""); - /*if (state.DSM) - outmethodheader.println("#include \"dstm.h\"");*/ - - /* Output Structures */ - super.outputStructs(outstructs); - - // Output the C class declarations - // These could mutually reference each other - super.outputClassDeclarations(outclassdefs); - - // Output function prototypes and structures for parameters - Iterator it=state.getClassSymbolTable().getDescriptorsIterator(); - int numclasses = 0; - while(it.hasNext()) { - ++numclasses; - ClassDescriptor cn=(ClassDescriptor)it.next(); - super.generateCallStructs(cn, outclassdefs, outstructs, outmethodheader); - } - outclassdefs.close(); - - if (state.TASK) { - /* Map flags to integers */ - /* The runtime keeps track of flags using these integers */ - it=state.getClassSymbolTable().getDescriptorsIterator(); - while(it.hasNext()) { - ClassDescriptor cn=(ClassDescriptor)it.next(); - super.mapFlags(cn); - } - /* Generate Tasks */ - generateTaskStructs(outstructs, outmethodheader); - - /* Outputs generic task structures if this is a task - program */ - outputTaskTypes(outtask); - } - - /* Build the actual methods */ - super.outputMethods(outmethod); - - if (state.TASK) { - Iterator[] taskits = new Iterator[this.coreNum]; - for(int i = 0; i < taskits.length; ++i) { - taskits[i] = null; - } - int[] numtasks = new int[this.coreNum]; - int[][] numqueues = new int[this.coreNum][numclasses]; - /* Output code for tasks */ - for(int i = 0; i < this.scheduling.size(); ++i) { - this.currentSchedule = this.scheduling.elementAt(i); - outputTaskCode(outtaskdefs, outmethod, outtask, taskits, numtasks, numqueues); - } - - // Output task descriptors - boolean comma = false; - outtaskdefs.println("struct parameterwrapper ** objectqueues[][NUMCLASSES] = {"); - boolean needcomma = false; - for(int i = 0; i < numqueues.length ; ++i) { - if(needcomma) { - outtaskdefs.println(","); - } else { - needcomma = true; - } - outtaskdefs.println("/* object queue array for core " + i + "*/"); - outtaskdefs.print("{"); - comma = false; - for(int j = 0; j < numclasses; ++j) { - if(comma) { - outtaskdefs.println(","); - } else { - comma = true; - } - outtaskdefs.print(this.objqarrayprefix + j + "_core" + i); - } - outtaskdefs.print("}"); - } - outtaskdefs.println("};"); - needcomma = false; - outtaskdefs.println("int numqueues[][NUMCLASSES] = {"); - for(int i = 0; i < numqueues.length; ++i) { - if(needcomma) { - outtaskdefs.println(","); - } else { - needcomma = true; - } - int[] tmparray = numqueues[i]; - comma = false; - outtaskdefs.print("{"); - for(int j = 0; j < tmparray.length; ++j) { - if(comma) { - outtaskdefs.print(","); - } else { - comma = true; - } - outtaskdefs.print(tmparray[j]); - } - outtaskdefs.print("}"); - } - outtaskdefs.println("};"); - - /* parameter queue arrays for all the tasks*/ - outtaskdefs.println("struct parameterwrapper *** paramqueues[] = {"); - needcomma = false; - for(int i = 0; i < this.coreNum ; ++i) { - if(needcomma) { - outtaskdefs.println(","); - } else { - needcomma = true; - } - outtaskdefs.println("/* parameter queue array for core " + i + "*/"); - outtaskdefs.print(this.coreqarrayprefix + i); - } - outtaskdefs.println("};"); - - for(int i = 0; i < taskits.length; ++i) { - outtaskdefs.println("struct taskdescriptor * " + this.taskarrayprefix + i + "[]={"); - Iterator taskit = taskits[i]; - if(taskit != null) { - boolean first=true; - while(taskit.hasNext()) { - TaskDescriptor td=(TaskDescriptor)taskit.next(); - if (first) - first=false; - else - outtaskdefs.println(","); - outtaskdefs.print("&" + this.taskprefix +td.getCoreSafeSymbol(i)); - } - } - outtaskdefs.println(); - outtaskdefs.println("};"); - } - outtaskdefs.println("struct taskdescriptor ** taskarray[]= {"); - comma = false; - for(int i = 0; i < taskits.length; ++i) { - if (comma) - outtaskdefs.println(","); - else - comma = true; - outtaskdefs.print(this.taskarrayprefix + i); - } - outtaskdefs.println("};"); - - outtaskdefs.print("int numtasks[]= {"); - comma = false; - for(int i = 0; i < taskits.length; ++i) { - if (comma) - outtaskdefs.print(","); - else - comma=true; - outtaskdefs.print(numtasks[i]); - } - outtaskdefs.println("};"); - outtaskdefs.println("int corenum=0;"); - - outtaskdefs.close(); - outtask.println("#endif"); - outtask.close(); - /* Record maximum number of task parameters */ - outstructs.println("#define MAXTASKPARAMS "+maxtaskparams); - /* Record maximum number of all types, i.e. length of classsize[] */ - outstructs.println("#define NUMTYPES "+(state.numClasses() + state.numArrays())); - /* Record number of cores */ - outstructs.println("#define NUMCORES "+this.coreNum); - /* Record number of core containing startup task */ - outstructs.println("#define STARTUPCORE "+this.startupcorenum); - //outstructs.println("#define STARTUPCORESTR \""+this.startupcorenum+"\""); - } //else if (state.main!=null) { - /* Generate main method */ - // outputMainMethod(outmethod); - //} - - /* Generate information for task with optional parameters */ - /*if (state.TASK&&state.OPTIONAL){ - generateOptionalArrays(outoptionalarrays, optionalheaders, state.getAnalysisResult(), state.getOptionalTaskDescriptors()); - outoptionalarrays.close(); - } */ - - /* Output structure definitions for repair tool */ - /*if (state.structfile!=null) { - buildRepairStructs(outrepairstructs); - outrepairstructs.close(); - }*/ - - /* Close files */ - outmethodheader.println("#endif"); - outmethodheader.close(); - outmethod.close(); - outstructs.println("#endif"); - outstructs.close(); - } - - /** This function outputs (1) structures that parameters are - * passed in (when PRECISE GC is enabled) and (2) function - * prototypes for the tasks */ - - private void generateTaskStructs(PrintWriter output, PrintWriter headersout) { - /* Cycle through tasks */ - for(int i = 0; i < this.scheduling.size(); ++i) { - Schedule tmpschedule = this.scheduling.elementAt(i); - int num = tmpschedule.getCoreNum(); - Iterator taskit = tmpschedule.getTasks().iterator(); - - while(taskit.hasNext()) { - /* Classify parameters */ - TaskDescriptor task=taskit.next(); - FlatMethod fm=state.getMethodFlat(task); - super.generateTempStructs(fm, null); - - ParamsObject objectparams=(ParamsObject) paramstable.get(task); - TempObject objecttemps=(TempObject) tempstable.get(task); - - /* Output parameter structure */ - if (GENERATEPRECISEGC) { - output.println("struct "+task.getCoreSafeSymbol(num)+"_params {"); - output.println(" int size;"); - output.println(" void * next;"); - for(int j=0;jmaxtaskparams) { - maxtaskparams=objectparams.numPointers()+fm.numTags(); - } - } - - /* Output temp structure */ - if (GENERATEPRECISEGC) { - output.println("struct "+task.getCoreSafeSymbol(num)+"_locals {"); - output.println(" int size;"); - output.println(" void * next;"); - for(int j=0;j taskit=this.currentSchedule.getTasks().iterator(); - while(taskit.hasNext()) { - TaskDescriptor td=taskit.next(); - FlatMethod fm=state.getMethodFlat(td); - generateTaskMethod(fm, null, outmethod); - generateTaskDescriptor(outtaskdefs, outtask, fm, td, qnames); - } - - // generate queuearray for this core - int num = this.currentSchedule.getCoreNum(); - boolean comma = false; - for(int i = 0; i < qnames.length; ++i) { - outtaskdefs.println("/* object queue array for class " + i + " on core " + num + "*/"); - outtaskdefs.println("struct parameterwrapper * " + this.objqarrayprefix + i + "_core" + num + "[] = {"); - comma = false; - Vector tmpvector = qnames[i]; - if(tmpvector != null) { - for(int j = 0; j < tmpvector.size(); ++j) { - if(comma) { - outtaskdefs.println(","); - } else { - comma = true; - } - outtaskdefs.print("&" + tmpvector.elementAt(j)); - } - numqueues[num][i] = tmpvector.size(); - } else { - numqueues[num][i] = 0; - } - outtaskdefs.println("};"); - } - - /* All the queues for tasks residing on this core*/ - comma = false; - outtaskdefs.println("/* object queue array for tasks on core " + num + "*/"); - outtaskdefs.println("struct parameterwrapper ** " + this.coreqarrayprefix + num + "[] = {"); - taskit=this.currentSchedule.getTasks().iterator(); - while(taskit.hasNext()) { - if (comma) { - outtaskdefs.println(","); - } else { - comma = true; - } - TaskDescriptor td=taskit.next(); - outtaskdefs.print(this.paramqarrayprefix + td.getCoreSafeSymbol(num)); - } - outtaskdefs.println("};"); - - // record the iterator of tasks on this core - taskit=this.currentSchedule.getTasks().iterator(); - taskits[num] = taskit; - numtasks[num] = this.currentSchedule.getTasks().size(); - } - - /** Prints out definitions for generic task structures */ - private void outputTaskTypes(PrintWriter outtask) { - outtask.println("#ifndef _TASK_H"); - outtask.println("#define _TASK_H"); - outtask.println("#include \"ObjectHash.h\""); - outtask.println("#include \"structdefs.h\""); - outtask.println("#include \"Queue.h\""); - outtask.println("#include "); - outtask.println("#ifdef RAW"); - outtask.println("#include "); - outtask.println("#endif"); - outtask.println(); - outtask.println("struct tagobjectiterator {"); - outtask.println(" int istag; /* 0 if object iterator, 1 if tag iterator */"); - outtask.println(" struct ObjectIterator it; /* Object iterator */"); - outtask.println(" struct ObjectHash * objectset;"); - outtask.println("#ifdef OPTIONAL"); - outtask.println(" int failedstate;"); - outtask.println("#endif"); - outtask.println(" int slot;"); - outtask.println(" int tagobjindex; /* Index for tag or object depending on use */"); - outtask.println(" /*if tag we have an object binding */"); - outtask.println(" int tagid;"); - outtask.println(" int tagobjectslot;"); - outtask.println(" /*if object, we may have one or more tag bindings */"); - outtask.println(" int numtags;"); - outtask.println(" int tagbindings[MAXTASKPARAMS-1]; /* list slots */"); - outtask.println("};"); - outtask.println(); - outtask.println("struct parameterwrapper {"); - outtask.println(" //int type;"); - outtask.println(" struct ObjectHash * objectset;"); - outtask.println(" int numberofterms;"); - outtask.println(" int * intarray;"); - outtask.println(" int numbertags;"); - outtask.println(" int * tagarray;"); - outtask.println(" struct taskdescriptor * task;"); - outtask.println(" int slot;"); - outtask.println(" struct tagobjectiterator iterators[MAXTASKPARAMS-1];"); - outtask.println("};"); - outtask.println(); - outtask.println("extern struct parameterwrapper ** objectqueues[][NUMCLASSES];"); - outtask.println("extern int numqueues[][NUMCLASSES];"); - outtask.println(); - outtask.println("struct parameterdescriptor {"); - outtask.println(" int type;"); - outtask.println(" int numberterms;"); - outtask.println(" int *intarray;"); - outtask.println(" struct parameterwrapper * queue;"); - outtask.println(" int numbertags;"); - outtask.println(" int *tagarray;"); - outtask.println("};"); - outtask.println(); - outtask.println("struct taskdescriptor {"); - outtask.println(" void * taskptr;"); - outtask.println(" int numParameters;"); - outtask.println(" int numTotal;"); - outtask.println(" struct parameterdescriptor **descriptorarray;"); - outtask.println(" char * name;"); - outtask.println("};"); - outtask.println(); - outtask.println("extern struct taskdescriptor ** taskarray[];"); - outtask.println("extern int numtasks[];"); - outtask.println("extern int corenum;"); // define corenum to identify different core - outtask.println("extern struct parameterwrapper *** paramqueues[];"); - outtask.println(); - } - - private void generateObjectTransQueues(PrintWriter output) { - if(this.fsate2qnames == null) { - this.fsate2qnames = new Hashtable[this.coreNum]; - for(int i = 0; i < this.fsate2qnames.length; ++i) { - this.fsate2qnames[i] = null; - } - } - int num = this.currentSchedule.getCoreNum(); - assert(this.fsate2qnames[num] == null); - Hashtable flag2qname = new Hashtable(); - this.fsate2qnames[num] = flag2qname; - Hashtable> targetCoreTbl = this.currentSchedule.getTargetCoreTable(); - if(targetCoreTbl != null) { - Object[] keys = targetCoreTbl.keySet().toArray(); - output.println(); - output.println("/* Object transfer queues for core" + num + ".*/"); - for(int i = 0; i < keys.length; ++i) { - FlagState tmpfstate = (FlagState)keys[i]; - Object[] targetcores = targetCoreTbl.get(tmpfstate).toArray(); - String queuename = this.otqueueprefix + tmpfstate.getClassDescriptor().getCoreSafeSymbol(num) + tmpfstate.getuid() + "___"; - String queueins = queuename + "ins"; - flag2qname.put(tmpfstate, queuename); - output.println("struct " + queuename + " {"); - output.println(" int * cores;"); - output.println(" int index;"); - output.println(" int length;"); - output.println("};"); - output.print("int " + queuename + "cores[] = {"); - for(int j = 0; j < targetcores.length; ++j) { - if(j > 0) { - output.print(", "); - } - output.print(((Integer)targetcores[j]).intValue()); - } - output.println("};"); - output.println("struct " + queuename + " " + queueins + "= {"); - output.println(/*".cores = " + */queuename + "cores,"); - output.println(/*".index = " + */"0,"); - output.println(/*".length = " +*/ targetcores.length + "};"); - } - } - output.println(); - } - - private void generateTaskMethod(FlatMethod fm, LocalityBinding lb, PrintWriter output) { - /*if (State.PRINTFLAT) - System.out.println(fm.printMethod());*/ - TaskDescriptor task=fm.getTask(); - assert(task != null); - int num = this.currentSchedule.getCoreNum(); - - //ParamsObject objectparams=(ParamsObject)paramstable.get(lb!=null?lb:task); - generateTaskHeader(fm, lb, task,output); - TempObject objecttemp=(TempObject) tempstable.get(lb!=null?lb:task); - /*if (state.DSM&&lb.getHasAtomic()) { - output.println("transrecord_t * trans;"); - }*/ - - if (GENERATEPRECISEGC) { - output.print(" struct "+task.getCoreSafeSymbol(num)+"_locals "+localsprefix+"={"); - - output.print(objecttemp.numPointers()+","); - output.print(paramsprefix); - for(int j=0;jflag;"); - } - - /* Assign labels to FlatNode's if necessary.*/ - - Hashtable nodetolabel=super.assignLabels(fm); - - /* Check to see if we need to do a GC if this is a - * multi-threaded program...*/ - - /*if ((state.THREAD||state.DSM)&&GENERATEPRECISEGC) { - if (state.DSM&&lb.isAtomic()) - output.println("checkcollect2(&"+localsprefix+",trans);"); - else - output.println("checkcollect(&"+localsprefix+");"); - }*/ - - /* Create queues to store objects need to be transferred to other cores and their destination*/ - output.println(" struct Queue * totransobjqueue = createQueue();"); - output.println(" struct transObjInfo * tmpObjInfo = NULL;"); - - /* generate print information for RAW version */ - output.println("#ifdef RAW"); - output.println("int tmpsum = 0;"); - output.println("char * taskname = \"" + task.getSymbol() + "\";"); - output.println("int tmplen = " + task.getSymbol().length() + ";"); - output.println("int tmpindex = 1;"); - output.println("for(;tmpindex < tmplen; tmpindex++) {"); - output.println(" tmpsum = tmpsum * 10 + *(taskname + tmpindex) - '0';"); - output.println("}"); - output.println("#ifdef RAWDEBUG"); - output.println("raw_test_pass(0xAAAA);"); - output.println("raw_test_pass_reg(tmpsum);"); - output.println("#endif"); - output.println("#endif"); - - for(int i = 0; i < fm.numParameters(); ++i) { - TempDescriptor temp = fm.getParameter(i); - output.println(" ++" + super.generateTemp(fm, temp, lb)+"->version;"); - } - - /* Do the actual code generation */ - FlatNode current_node=null; - HashSet tovisit=new HashSet(); - HashSet visited=new HashSet(); - tovisit.add(fm.getNext(0)); - while(current_node!=null||!tovisit.isEmpty()) { - if (current_node==null) { - current_node=(FlatNode)tovisit.iterator().next(); - tovisit.remove(current_node); - } - visited.add(current_node); - if (nodetolabel.containsKey(current_node)) - output.println("L"+nodetolabel.get(current_node)+":"); - /*if (state.INSTRUCTIONFAILURE) { - if (state.THREAD||state.DSM) { - output.println("if ((++instructioncount)>failurecount) {instructioncount=0;injectinstructionfailure();}"); - } - else - output.println("if ((--instructioncount)==0) injectinstructionfailure();"); - }*/ - if (current_node.numNext()==0) { - output.print(" "); - super.generateFlatNode(fm, lb, current_node, output); - if (current_node.kind()!=FKind.FlatReturnNode) { - //output.println(" flushAll();"); - output.println("#ifdef RAW"); - output.println("raw_user_interrupts_off();"); - output.println("#ifdef RAWDEBUG"); - output.println("raw_test_pass(0xec00);"); - output.println("#endif"); - output.println("raw_flush_entire_cache();"); - output.println("#ifdef RAWDEBUG"); - output.println("raw_test_pass(0xecff);"); - output.println("#endif"); - output.println("raw_user_interrupts_on();"); - output.println("#endif"); - outputTransCode(output); - output.println(" return;"); - } - current_node=null; - } else if(current_node.numNext()==1) { - output.print(" "); - super.generateFlatNode(fm, lb, current_node, output); - FlatNode nextnode=current_node.getNext(0); - if (visited.contains(nextnode)) { - output.println("goto L"+nodetolabel.get(nextnode)+";"); - current_node=null; - } else - current_node=nextnode; - } else if (current_node.numNext()==2) { - /* Branch */ - output.print(" "); - super.generateFlatCondBranch(fm, lb, (FlatCondBranch)current_node, "L"+nodetolabel.get(current_node.getNext(1)), output); - if (!visited.contains(current_node.getNext(1))) - tovisit.add(current_node.getNext(1)); - if (visited.contains(current_node.getNext(0))) { - output.println("goto L"+nodetolabel.get(current_node.getNext(0))+";"); - current_node=null; - } else - current_node=current_node.getNext(0); - } else throw new Error(); - } - - output.println("}\n\n"); - } - - /** This method outputs TaskDescriptor information */ - private void generateTaskDescriptor(PrintWriter output, PrintWriter outtask, FlatMethod fm, TaskDescriptor task, Vector[] qnames) { - int num = this.currentSchedule.getCoreNum(); - - output.println("/* TaskDescriptor information for task " + task.getSymbol() + " on core " + num + "*/"); - - for (int i=0;imaxtaskparams) - maxtaskparams=objectparams.numPrimitives()+fm.numTags(); - } else output.println(") {"); - } - - protected void generateFlagOrAnd(FlatFlagActionNode ffan, FlatMethod fm, LocalityBinding lb, TempDescriptor temp, - PrintWriter output, int ormask, int andmask) { - if (ffan.getTaskType()==FlatFlagActionNode.NEWOBJECT) { - output.println("flagorandinit("+super.generateTemp(fm, temp, lb)+", 0x"+Integer.toHexString(ormask)+", 0x"+Integer.toHexString(andmask)+");"); - } else { - int num = this.currentSchedule.getCoreNum(); - ClassDescriptor cd = temp.getType().getClassDesc(); - Vector initfstates = ffan.getInitFStates(cd); - for(int i = 0; i < initfstates.size(); ++i) { - FlagState tmpFState = initfstates.elementAt(i); - output.println("{"); - QueueInfo qinfo = outputqueues(tmpFState, num, output, false); - output.println("flagorand("+super.generateTemp(fm, temp, lb)+", 0x"+Integer.toHexString(ormask)+ - ", 0x"+Integer.toHexString(andmask)+", " + qinfo.qname + - ", " + qinfo.length + ");"); - output.println("}"); - } - } - } - - protected void generateObjectDistribute(FlatFlagActionNode ffan, FlatMethod fm, LocalityBinding lb, TempDescriptor temp, - PrintWriter output) { - ClassDescriptor cd = temp.getType().getClassDesc(); - Vector initfstates = null; - Vector[] targetFStates = null; - if (ffan.getTaskType()==FlatFlagActionNode.NEWOBJECT) { - targetFStates = new Vector[1]; - targetFStates[0] = ffan.getTargetFStates4NewObj(cd); - } else { - initfstates = ffan.getInitFStates(cd); - targetFStates = new Vector[initfstates.size()]; - for(int i = 0; i < initfstates.size(); ++i) { - FlagState fs = initfstates.elementAt(i); - targetFStates[i] = ffan.getTargetFStates(fs); - - if(!fs.isSetmask()) { - Hashtable flags=(Hashtable)flagorder.get(cd); - int andmask=0; - int checkmask=0; - Iterator it_flags = fs.getFlags(); - while(it_flags.hasNext()) { - FlagDescriptor fd = (FlagDescriptor)it_flags.next(); - int flagid=1<<((Integer)flags.get(fd)).intValue(); - andmask|=flagid; - checkmask|=flagid; - } - fs.setAndmask(andmask); - fs.setCheckmask(checkmask); - fs.setSetmask(true); - } - } - } - boolean isolate = true; // check if this flagstate can associate to some task with multiple params which can - // reside on multiple cores - if((this.currentSchedule == null) && (fm.getMethod().getClassDesc().getSymbol().equals("ServerSocket"))) { - // ServerSocket object will always reside on current core - for(int j = 0; j < targetFStates.length; ++j) { - if(initfstates != null) { - FlagState fs = initfstates.elementAt(j); - output.println("if(" + generateTempFlagName(fm, temp, lb) + "&(0x" + Integer.toHexString(fs.getAndmask()) - + ")==(0x" + Integer.toHexString(fs.getCheckmask()) + ")) {"); - } - Vector tmpfstates = (Vector)targetFStates[j]; - for(int i = 0; i < tmpfstates.size(); ++i) { - FlagState tmpFState = tmpfstates.elementAt(i); - // TODO - // may have bugs here - output.println("/* reside on this core*"); - output.println("enqueueObject("+super.generateTemp(fm, temp, lb)+", NULL, 0);"); - } - if(initfstates != null) { - output.println("}"); - } - } - return; - } - - int num = this.currentSchedule.getCoreNum(); - Hashtable> targetCoreTbl = this.currentSchedule.getTargetCoreTable(); - for(int j = 0; j < targetFStates.length; ++j) { - FlagState fs = null; - if(initfstates != null) { - fs = initfstates.elementAt(j); - output.println("if((" + generateTempFlagName(fm, temp, lb) + "&(0x" + Integer.toHexString(fs.getAndmask()) - + "))==(0x" + Integer.toHexString(fs.getCheckmask()) + ")) {"); - } - Vector tmpfstates = (Vector)targetFStates[j]; - for(int i = 0; i < tmpfstates.size(); ++i) { - FlagState tmpFState = tmpfstates.elementAt(i); - - if(this.currentSchedule.getAllyCoreTable() == null) { - isolate = true; - } else { - isolate = (this.currentSchedule.getAllyCoreTable().get(tmpFState) == null) || - (this.currentSchedule.getAllyCoreTable().get(tmpFState).size() == 0); - } - if(!isolate) { - // indentify this object as a shared object - // isolate flag is initially set as 1, once this flag is set as 0, it is never reset to 1, i.e. once an object - // is shared, it maybe shared all the time afterwards - output.println("if(" + super.generateTemp(fm, temp, lb) + "->isolate == 1) {"); - output.println(" " + super.generateTemp(fm, temp, lb) + "->isolate = 0;"); - output.println(" " + super.generateTemp(fm, temp, lb) + "->original = (struct ___Object___ *)" + super.generateTemp(fm, temp, lb) + ";"); - output.println("}"); - } - - Vector sendto = new Vector(); - Queue queue = null; - if(targetCoreTbl != null) { - queue = targetCoreTbl.get(tmpFState); - } - if((queue != null) && - ((queue.size() != 1) || - ((queue.size() == 1) && (queue.element().intValue() != num)))) { - // this object may be transferred to other cores - String queuename = (String)this.fsate2qnames[num].get(tmpFState); - String queueins = queuename + "ins"; - - Object[] cores = queue.toArray(); - String index = "0"; - Integer targetcore = (Integer)cores[0]; - if(queue.size() > 1) { - index = queueins + ".index"; - } - if(queue.size() > 1) { - output.println("switch(" + queueins + ".index % " + queueins + ".length) {"); - for(int k = 0; k < cores.length; ++k) { - output.println("case " + k + ":"); - targetcore = (Integer)cores[k]; - if(targetcore.intValue() == num) { - output.println("/* reside on this core*/"); - if(isolate) { - output.println("{"); - QueueInfo qinfo = outputqueues(tmpFState, num, output, true); - output.println("enqueueObject("+super.generateTemp(fm, temp, lb)+", " + qinfo.qname + - ", " + qinfo.length + ");"); - output.println("}"); - } else { - // TODO - // really needed? - output.println("/* possibly needed by multi-parameter tasks on this core*/"); - output.println("enqueueObject("+super.generateTemp(fm, temp, lb)+", NULL, 0);"); - } - } else { - if(!isolate) { - // TODO - // Is it possible to decide the actual queues? - output.println("/* possibly needed by multi-parameter tasks on this core*/"); - output.println("enqueueObject("+super.generateTemp(fm, temp, lb)+", NULL, 0);"); - } - output.println("/* transfer to core " + targetcore.toString() + "*/"); - output.println("{"); - // enqueue this object and its destinations for later process - // all the possible queues - QueueInfo qinfo = null; - FlagState targetFS = this.currentSchedule.getTargetFState(tmpFState); - if(targetFS != null) { - qinfo = outputtransqueues(targetFS, targetcore, output); - } else { - qinfo = outputtransqueues(tmpFState, targetcore, output); - } - output.println("tmpObjInfo = RUNMALLOC(sizeof(struct transObjInfo));"); - output.println("tmpObjInfo->objptr = (void *)" + super.generateTemp(fm, temp, lb) + ";"); - output.println("tmpObjInfo->targetcore = "+targetcore.toString()+";"); - output.println("tmpObjInfo->queues = " + qinfo.qname + ";"); - output.println("tmpObjInfo->length = " + qinfo.length + ";"); - output.println("addNewItem(totransobjqueue, (void*)tmpObjInfo);"); - output.println("}"); - sendto.add(targetcore); - } - output.println("break;"); - } - output.println("}"); - } else { - if(!isolate) { - // TODO - // Is it possible to decide the actual queues? - output.println("/* possibly needed by multi-parameter tasks on this core*/"); - output.println("enqueueObject("+super.generateTemp(fm, temp, lb)+", NULL, 0);"); - } - output.println("/* transfer to core " + targetcore.toString() + "*/"); - output.println("{"); - // enqueue this object and its destinations for later process - // all the possible queues - QueueInfo qinfo = null; - FlagState targetFS = this.currentSchedule.getTargetFState(tmpFState); - if(targetFS != null) { - qinfo = outputtransqueues(targetFS, targetcore, output); - } else { - qinfo = outputtransqueues(tmpFState, targetcore, output); - } - output.println("tmpObjInfo = RUNMALLOC(sizeof(struct transObjInfo));"); - output.println("tmpObjInfo->objptr = (void *)" + super.generateTemp(fm, temp, lb) + ";"); - output.println("tmpObjInfo->targetcore = "+targetcore.toString()+";"); - output.println("tmpObjInfo->queues = " + qinfo.qname + ";"); - output.println("tmpObjInfo->length = " + qinfo.length + ";"); - output.println("addNewItem(totransobjqueue, (void*)tmpObjInfo);"); - output.println("}"); - sendto.add(targetcore); - } - output.println("/* increase index*/"); - output.println("++" + queueins + ".index;"); - } else { - // this object will reside on current core - output.println("/* reside on this core*/"); - if(isolate) { - output.println("{"); - QueueInfo qinfo = outputqueues(tmpFState, num, output, true); - output.println("enqueueObject("+super.generateTemp(fm, temp, lb)+", " + qinfo.qname + - ", " + qinfo.length + ");"); - output.println("}"); - } else { - // TODO - // really needed? - output.println("enqueueObject("+super.generateTemp(fm, temp, lb)+", NULL, 0);"); - } - } - - // codes for multi-params tasks - if(!isolate) { - // flagstate associated with some multi-params tasks - // need to be send to other cores - Vector targetcores = this.currentSchedule.getAllyCores(tmpFState); - output.println("/* send the shared object to possible queues on other cores*/"); - for(int k = 0; k < targetcores.size(); ++k) { - // TODO - // add the information of exactly which queue - if(!sendto.contains(targetcores.elementAt(i))) { - // previously not sended to this target core - // enqueue this object and its destinations for later process - output.println("{"); - // all the possible queues - QueueInfo qinfo = null; - FlagState targetFS = this.currentSchedule.getTargetFState(tmpFState); - if(targetFS != null) { - qinfo = outputtransqueues(targetFS, targetcores.elementAt(i), output); - } else { - qinfo = outputtransqueues(tmpFState, targetcores.elementAt(i), output); - } - output.println("tmpObjInfo = RUNMALLOC(sizeof(struct transObjInfo));"); - output.println("tmpObjInfo->objptr = (void *)" + super.generateTemp(fm, temp, lb) + ";"); - output.println("tmpObjInfo->targetcore = "+targetcores.elementAt(i).toString()+";"); - output.println("tmpObjInfo->queues = " + qinfo.qname + ";"); - output.println("tmpObjInfo->length = " + qinfo.length + ";"); - output.println("addNewItem(totransobjqueue, (void*)tmpObjInfo);"); - output.println("}"); - } - } - } - } - - if(initfstates != null) { - output.println("}"); - } - } - } - - private QueueInfo outputqueues(FlagState tmpFState, int num, PrintWriter output, boolean isEnqueue) { - // queue array - QueueInfo qinfo = new QueueInfo(); - qinfo.qname = "queues_" + tmpFState.getLabel() + "_" + tmpFState.getiuid(); - output.println("struct parameterwrapper * " + qinfo.qname + "[] = {"); - Iterator it_edges = tmpFState.getEdgeVector().iterator(); - Vector residetasks = this.currentSchedule.getTasks(); - Vector tasks = new Vector(); - Vector indexes = new Vector(); - boolean comma = false; - qinfo.length = 0; - while(it_edges.hasNext()) { - FEdge fe = (FEdge)it_edges.next(); - TaskDescriptor td = fe.getTask(); - int paraindex = fe.getIndex(); - if((!isEnqueue) || (isEnqueue && residetasks.contains(td))) { - if((!tasks.contains(td)) || - ((tasks.contains(td)) && (paraindex != indexes.elementAt(tasks.indexOf(td)).intValue()))) { - tasks.addElement(td); - indexes.addElement(paraindex); - if(comma) { - output.println(","); - } else { - comma = true; - } - output.print("&" + this.objqueueprefix + paraindex + "_" + td.getCoreSafeSymbol(num)); - ++qinfo.length; - } - } - } - output.println("};"); - return qinfo; - } - - private QueueInfo outputtransqueues(FlagState tmpFState, int targetcore, PrintWriter output) { - // queue array - QueueInfo qinfo = new QueueInfo(); - qinfo.qname = "queues_" + tmpFState.getLabel() + "_" + tmpFState.getiuid(); - output.println("int " + qinfo.qname + "_clone[] = {"); - Iterator it_edges = tmpFState.getEdgeVector().iterator(); - Vector residetasks = this.scheduling.get(targetcore).getTasks(); - Vector tasks = new Vector(); - Vector indexes = new Vector(); - boolean comma = false; - qinfo.length = 0; - while(it_edges.hasNext()) { - FEdge fe = (FEdge)it_edges.next(); - TaskDescriptor td = fe.getTask(); - int paraindex = fe.getIndex(); - if(residetasks.contains(td)) { - if((!tasks.contains(td)) || - ((tasks.contains(td)) && (paraindex != indexes.elementAt(tasks.indexOf(td)).intValue()))) { - tasks.addElement(td); - indexes.addElement(paraindex); - if(comma) { - output.println(","); - } else { - comma = true; - } - output.print(residetasks.indexOf(td) + ", "); - output.print(paraindex); - ++qinfo.length; - } - } - } - output.println("};"); - output.println("int * " + qinfo.qname + " = RUNMALLOC(sizeof(int) * " + qinfo.length * 2 + ");"); - output.println("memcpy(" + qinfo.qname + ", (int *)" + qinfo.qname + "_clone, sizeof(int) * " + qinfo.length * 2 + ");"); - return qinfo; - } - - private class QueueInfo { - public int length; - public String qname; - } - - private String generateTempFlagName(FlatMethod fm, TempDescriptor td, LocalityBinding lb) { - MethodDescriptor md=fm.getMethod(); - TaskDescriptor task=fm.getTask(); - TempObject objecttemps=(TempObject) tempstable.get(lb!=null?lb:md!=null?md:task); - - if (objecttemps.isLocalPrim(td)||objecttemps.isParamPrim(td)) { - return td.getSafeSymbol() + "_oldflag"; - } - - if (objecttemps.isLocalPtr(td)) { - return localsprefix+"_"+td.getSafeSymbol() + "_oldflag"; - } - - if (objecttemps.isParamPtr(td)) { - return paramsprefix+"_"+td.getSafeSymbol() + "_oldflag"; - } - throw new Error(); - } - - protected void outputTransCode(PrintWriter output) { - output.println("while(0 == isEmpty(totransobjqueue)) {"); - output.println(" struct QueueItem * totransitem = getTail(totransobjqueue);"); - - output.println(" transferObject((struct transObjInfo *)totransitem->objectptr);"); - output.println(" RUNFREE(((struct transObjInfo *)totransitem->objectptr)->queues);"); - output.println(" RUNFREE(totransitem->objectptr);"); - output.println(" removeItem(totransobjqueue, totransitem);"); - output.println("}"); - output.println("freeQueue(totransobjqueue);"); - } - - protected void generateFlatReturnNode(FlatMethod fm, LocalityBinding lb, FlatReturnNode frn, PrintWriter output) { - if (frn.getReturnTemp()!=null) { - if (frn.getReturnTemp().getType().isPtr()) - output.println("return (struct "+fm.getMethod().getReturnType().getSafeSymbol()+"*)"+generateTemp(fm, frn.getReturnTemp(), lb)+";"); - else - output.println("return "+generateTemp(fm, frn.getReturnTemp(), lb)+";"); - } else { - if(fm.getTask() != null) { - //output.println("flushAll();"); - output.println("#ifdef RAW"); - output.println("raw_user_interrupts_off();"); - output.println("#ifdef RAWDEBUG"); - output.println("raw_test_pass(0xec00);"); - output.println("#endif"); - output.println("raw_flush_entire_cache();"); - output.println("#ifdef RAWDEBUG"); - output.println("raw_test_pass(0xecff);"); - output.println("#endif"); - output.println("raw_user_interrupts_on();"); - output.println("#endif"); - outputTransCode(output); - } - output.println("return;"); - } - } -} diff --git a/Robust/src/IR/Flat/BuildFlat.java b/Robust/src/IR/Flat/BuildFlat.java deleted file mode 100644 index a460cc98..00000000 --- a/Robust/src/IR/Flat/BuildFlat.java +++ /dev/null @@ -1,1014 +0,0 @@ -package IR.Flat; -import IR.*; -import IR.Tree.*; -import java.util.*; - -public class BuildFlat { - State state; - Hashtable temptovar; - MethodDescriptor currmd; - TypeUtil typeutil; - - public BuildFlat(State st, TypeUtil typeutil) { - state=st; - temptovar=new Hashtable(); - this.typeutil=typeutil; - } - - public Hashtable getMap() { - return temptovar; - } - - public void buildFlat() { - Iterator it=state.getClassSymbolTable().getDescriptorsIterator(); - while(it.hasNext()) { - ClassDescriptor cn=(ClassDescriptor)it.next(); - flattenClass(cn); - } - - Iterator task_it=state.getTaskSymbolTable().getDescriptorsIterator(); - while(task_it.hasNext()) { - TaskDescriptor td=(TaskDescriptor)task_it.next(); - flattenTask(td); - } - } - - private void flattenTask(TaskDescriptor td) { - BlockNode bn=state.getMethodBody(td); - NodePair np=flattenBlockNode(bn); - FlatNode fn=np.getBegin(); - if (np.getEnd().kind()!=FKind.FlatReturnNode) { - FlatReturnNode rnflat=new FlatReturnNode(null); - np.getEnd().addNext(rnflat); - } - - FlatFlagActionNode ffan=new FlatFlagActionNode(FlatFlagActionNode.PRE); - ffan.addNext(fn); - - FlatMethod fm=new FlatMethod(td); - fm.addNext(ffan); - - Hashtable visitedset=new Hashtable(); - - for(int i=0;i1) { - NodePair np=generateNewArrayLoop(temps, td.dereference(), out_temp, 0, con.isGlobal()); - fn.addNext(np.getBegin()); - return new NodePair(first,np.getEnd()); - } else - return new NodePair(first, fn); - } - } - - private NodePair generateNewArrayLoop(TempDescriptor[] temparray, TypeDescriptor td, TempDescriptor tmp, int i, boolean isglobal) { - TempDescriptor index=TempDescriptor.tempFactory("index",new TypeDescriptor(TypeDescriptor.INT)); - TempDescriptor tmpone=TempDescriptor.tempFactory("index",new TypeDescriptor(TypeDescriptor.INT)); - FlatNop fnop=new FlatNop();//last node - - //index=0 - FlatLiteralNode fln=new FlatLiteralNode(index.getType(),new Integer(0),index); - //tmpone=1 - FlatLiteralNode fln2=new FlatLiteralNode(tmpone.getType(),new Integer(1),tmpone); - - TempDescriptor tmpbool=TempDescriptor.tempFactory("comp",new TypeDescriptor(TypeDescriptor.BOOLEAN)); - - FlatOpNode fcomp=new FlatOpNode(tmpbool,index,temparray[i],new Operation(Operation.LT)); - FlatCondBranch fcb=new FlatCondBranch(tmpbool); - fcb.setTrueProb(State.TRUEPROB); - fcb.setLoop(); - //is index tempflagpairs; - Hashtable temptagpairs; - - int taskexit; - public static final int NEWOBJECT=0; - public static final int PRE=1; - public static final int TASKEXIT=2; - - Hashtable> cd2initfs; - Hashtable> cd2fs4new; - Hashtable> fs2fs; - - - public FlatFlagActionNode(int taskexit) { - tempflagpairs=new Hashtable(); - temptagpairs=new Hashtable(); - this.taskexit=taskexit; - - this.cd2initfs = null; - this.cd2fs4new = null; - this.fs2fs = null; - } - - public int getTaskType() { - return taskexit; - } - - public Vector getInitFStates(ClassDescriptor cd) { - if(this.cd2initfs == null) { - this.cd2initfs = new Hashtable>(); - } - if(this.cd2initfs.get(cd) == null) { - this.cd2initfs.put(cd, new Vector()); - } - return this.cd2initfs.get(cd); - } - - public Vector getTargetFStates4NewObj(ClassDescriptor cd) { - if(this.cd2fs4new == null) { - this.cd2fs4new = new Hashtable>(); - } - if(this.cd2fs4new.get(cd) == null) { - this.cd2fs4new.put(cd, new Vector()); - } - return this.cd2fs4new.get(cd); - } - - public Vector getTargetFStates(FlagState fs) { - if(this.fs2fs == null) { - this.fs2fs = new Hashtable>(); - } - if(this.fs2fs.get(fs) == null) { - this.fs2fs.put(fs, new Vector()); - } - return this.fs2fs.get(fs); - } - - public void addFlagAction(TempDescriptor td, FlagDescriptor fd, boolean status) { - TempFlagPair tfp=new TempFlagPair(td,fd); - if (tempflagpairs.containsKey(tfp)) { - throw new Error("Temp/Flag combination used twice: "+tfp); - } - tempflagpairs.put(tfp, new Boolean(status)); - } - - public void addTagAction(TempDescriptor td, TagDescriptor tagd, TempDescriptor tagt, boolean status) { - TempTagPair ttp=new TempTagPair(td,tagd, tagt); - if (temptagpairs.containsKey(ttp)) { - throw new Error("Temp/Tag combination used twice: "+ttp); - } - temptagpairs.put(ttp, new Boolean(status)); - } - - public int kind() { - return FKind.FlatFlagActionNode; - } - - /** This method returns an iterator over the Temp/Flag pairs. */ - - public Iterator getTempFlagPairs() { - return tempflagpairs.keySet().iterator(); - } - - public Iterator getTempTagPairs() { - return temptagpairs.keySet().iterator(); - } - - public boolean getFlagChange(TempFlagPair tfp) { - return ((Boolean)tempflagpairs.get(tfp)).booleanValue(); - } - - public boolean getTagChange(TempTagPair ttp) { - return ((Boolean)temptagpairs.get(ttp)).booleanValue(); - } - - public TempDescriptor [] readsTemps() { - if (tempflagpairs.size()==0) - return new TempDescriptor [0]; - else { - HashSet temps=new HashSet(); - for(Iterator it=tempflagpairs.keySet().iterator();it.hasNext();) { - TempFlagPair tfp=(TempFlagPair)it.next(); - temps.add(tfp.getTemp()); - } - for(Iterator it=temptagpairs.keySet().iterator();it.hasNext();) { - TempTagPair ttp=(TempTagPair)it.next(); - temps.add(ttp.getTemp()); - temps.add(ttp.getTagTemp()); - } - return (TempDescriptor[]) temps.toArray(new TempDescriptor [temps.size()]); - } - } - - public int getFFANType() - { - throw new Error("Use getTaskType() instead and remove this method"); - } - - public String toString() { - String st="FlatFlagActionNode_"; - for(Iterator it=tempflagpairs.keySet().iterator();it.hasNext();) { - TempFlagPair tfp=(TempFlagPair)it.next(); - st+=getFlagChange(tfp)?"":"!"; - st+=tfp.getTemp()+" "+tfp.getFlag()+","; - } - for(Iterator it=temptagpairs.keySet().iterator();it.hasNext();) { - TempTagPair ttp=(TempTagPair)it.next(); - st+=getTagChange(ttp)?"":"!"; - st+=ttp.getTemp()+" "+ttp.getTag()+"("+ttp.getTagTemp()+"),"; - } - - return st; - } -} diff --git a/Robust/src/IR/Flat/FlatGlobalConvNode.java b/Robust/src/IR/Flat/FlatGlobalConvNode.java deleted file mode 100644 index 0d189446..00000000 --- a/Robust/src/IR/Flat/FlatGlobalConvNode.java +++ /dev/null @@ -1,48 +0,0 @@ -package IR.Flat; -import IR.TypeDescriptor; -import Analysis.Locality.LocalityBinding; - -public class FlatGlobalConvNode extends FlatNode { - TempDescriptor src; - LocalityBinding lb; - boolean makePtr; - - public FlatGlobalConvNode(TempDescriptor src, LocalityBinding lb, boolean makePtr) { - this.src=src; - this.lb=lb; - this.makePtr=makePtr; - } - - public String toString() { - String str = "FlatGlobalConvNode_"+src.toString(); - if (makePtr) - str += "=(PTR)"; - else - str += "=(OID)"; - return str+src.toString()+" "+lb; - } - - public int kind() { - return FKind.FlatGlobalConvNode; - } - - public LocalityBinding getLocality() { - return lb; - } - - public boolean getMakePtr() { - return makePtr; - } - - public TempDescriptor getSrc() { - return src; - } - - public TempDescriptor [] writesTemps() { - return new TempDescriptor[] {src}; - } - - public TempDescriptor [] readsTemps() { - return new TempDescriptor[] {src}; - } -} diff --git a/Robust/src/IR/Flat/FlatLiteralNode.java b/Robust/src/IR/Flat/FlatLiteralNode.java deleted file mode 100644 index 58514317..00000000 --- a/Robust/src/IR/Flat/FlatLiteralNode.java +++ /dev/null @@ -1,57 +0,0 @@ -package IR.Flat; -import IR.TypeDescriptor; - -public class FlatLiteralNode extends FlatNode { - Object value; - TypeDescriptor type; - TempDescriptor dst; - - public FlatLiteralNode(TypeDescriptor type, Object o, TempDescriptor dst) { - this.type=type; - value=o; - this.dst=dst; - } - - public TypeDescriptor getType() { - return type; - } - - public TempDescriptor getDst() { - return dst; - } - - public Object getValue() { - return value; - } - - public String toString() { - String str = "FlatLiteralNode_"+dst; - if (value==null) - str += "=null"; - else - str += "="+escapeString(value.toString()); - return str; - } - protected static String escapeString(String st) { - String new_st=""; - for(int i=0;i getNodeSet() { - HashSet tovisit=new HashSet(); - HashSet visited=new HashSet(); - tovisit.add(this); - while(!tovisit.isEmpty()) { - FlatNode fn=tovisit.iterator().next(); - tovisit.remove(fn); - visited.add(fn); - for(int i=0;i0) { - //1) Edge >1 of node - nodetolabel.put(nn,new Integer(labelindex++)); - } - if (!visited.contains(nn)&&!tovisit.contains(nn)) { - tovisit.add(nn); - } else { - //2) Join point - nodetolabel.put(nn,new Integer(labelindex++)); - } - } - } - - //Do the actual printing - tovisit=new HashSet(); - visited=new HashSet(); - tovisit.add(this); - while(current_node!=null||!tovisit.isEmpty()) { - if (current_node==null) { - current_node=(FlatNode)tovisit.iterator().next(); - tovisit.remove(current_node); - } - visited.add(current_node); - if (nodetolabel.containsKey(current_node)) - st+="L"+nodetolabel.get(current_node)+":\n"; - if (current_node.numNext()==0) { - if (map==null) - st+=" "+current_node.toString()+"\n"; - else - st+=" "+current_node.toString()+"["+map.get(current_node)+"]\n"; - current_node=null; - } else if(current_node.numNext()==1) { - if (map==null) - st+=" "+current_node.toString()+"\n"; - else - st+=" "+current_node.toString()+"["+map.get(current_node)+"]\n"; - FlatNode nextnode=current_node.getNext(0); - if (visited.contains(nextnode)) { - st+="goto L"+nodetolabel.get(nextnode)+"\n"; - current_node=null; - } else - current_node=nextnode; - } else if (current_node.numNext()==2) { - /* Branch */ - st+=" "+((FlatCondBranch)current_node).toString("L"+nodetolabel.get(current_node.getNext(1)))+"\n"; - if (!visited.contains(current_node.getNext(1))) - tovisit.add(current_node.getNext(1)); - if (visited.contains(current_node.getNext(0))) { - st+="goto L"+nodetolabel.get(current_node.getNext(0))+"\n"; - current_node=null; - } else - current_node=current_node.getNext(0); - } else throw new Error(); - } - return st+"}\n"; - } - - public TempDescriptor [] writesTemps() { - return (TempDescriptor[]) parameterTemps.toArray(new TempDescriptor[ parameterTemps.size()]); - } -} diff --git a/Robust/src/IR/Flat/FlatNew.java b/Robust/src/IR/Flat/FlatNew.java deleted file mode 100644 index 48737ecb..00000000 --- a/Robust/src/IR/Flat/FlatNew.java +++ /dev/null @@ -1,61 +0,0 @@ -package IR.Flat; -import IR.TypeDescriptor; - -public class FlatNew extends FlatNode { - TempDescriptor dst; - TypeDescriptor type; - TempDescriptor size; - boolean isglobal; - - public FlatNew(TypeDescriptor type, TempDescriptor dst, boolean isglobal) { - this.type=type; - this.dst=dst; - this.size=null; - this.isglobal=isglobal; - } - - public FlatNew(TypeDescriptor type, TempDescriptor dst, TempDescriptor size, boolean isglobal) { - this.type=type; - this.dst=dst; - this.size=size; - this.isglobal=isglobal; - } - - public boolean isGlobal() { - return isglobal; - } - - public String toString() { - String str = "FlatNew_"+dst.toString()+"= NEW "+type.toString(); - if (size!=null) - str += "["+size.toString()+"]"; - return str; - } - - public int kind() { - return FKind.FlatNew; - } - - public TempDescriptor [] writesTemps() { - return new TempDescriptor[] {dst}; - } - - public TempDescriptor [] readsTemps() { - if (size!=null) - return new TempDescriptor[] {size}; - else - return new TempDescriptor[0]; - } - - public TempDescriptor getDst() { - return dst; - } - - public TempDescriptor getSize() { - return size; - } - - public TypeDescriptor getType() { - return type; - } -} diff --git a/Robust/src/IR/Flat/FlatNode.java b/Robust/src/IR/Flat/FlatNode.java deleted file mode 100644 index 714b894b..00000000 --- a/Robust/src/IR/Flat/FlatNode.java +++ /dev/null @@ -1,57 +0,0 @@ -package IR.Flat; -import java.util.Vector; - -public class FlatNode { - protected Vector next; - protected Vector prev; - - public FlatNode() { - next=new Vector(); - prev=new Vector(); - } - - public String toString() { - throw new Error(this.getClass().getName() + "does not implement toString!"); - } - public int numNext() { - return next.size(); - } - public FlatNode getNext(int i) { - return (FlatNode) next.get(i); - } - - public int numPrev() { - return prev.size(); - } - public FlatNode getPrev(int i) { - return (FlatNode) prev.get(i); - } - - public void addNext(FlatNode n) { - next.add(n); - n.addPrev(this); - } - - /** This function modifies the graph */ - public void setNext(int i, FlatNode n) { - FlatNode old=getNext(i); - next.set(i, n); - old.prev.remove(this); - n.addPrev(this); - } - - protected void addPrev(FlatNode p) { - prev.add(p); - } - public int kind() { - throw new Error(); - } - - public TempDescriptor [] readsTemps() { - return new TempDescriptor[0]; - } - - public TempDescriptor [] writesTemps() { - return new TempDescriptor[0]; - } -} diff --git a/Robust/src/IR/Flat/FlatNop.java b/Robust/src/IR/Flat/FlatNop.java deleted file mode 100644 index 36079fbf..00000000 --- a/Robust/src/IR/Flat/FlatNop.java +++ /dev/null @@ -1,15 +0,0 @@ -package IR.Flat; -import java.util.Vector; - -public class FlatNop extends FlatNode { - public FlatNop() { - } - - public String toString() { - return "nop"; - } - - public int kind() { - return FKind.FlatNop; - } -} diff --git a/Robust/src/IR/Flat/FlatOpNode.java b/Robust/src/IR/Flat/FlatOpNode.java deleted file mode 100644 index 5cd20068..00000000 --- a/Robust/src/IR/Flat/FlatOpNode.java +++ /dev/null @@ -1,59 +0,0 @@ -package IR.Flat; -import java.util.Vector; -import IR.*; - -public class FlatOpNode extends FlatNode { - TempDescriptor dest; - TempDescriptor left; - TempDescriptor right; - Operation op; - - public FlatOpNode(TempDescriptor dest, TempDescriptor left, TempDescriptor right, Operation op) { - this.dest=dest; - this.left=left; - this.right=right; - this.op=op; - } - - public TempDescriptor getDest() { - return dest; - } - - public TempDescriptor getLeft() { - return left; - } - - public TempDescriptor getRight() { - return right; - } - - public Operation getOp() { - return op; - } - - public String toString() { - String str = "FlatOpNode_"+dest.toString(); - if (right!=null) - str += "="+left.toString()+op.toString()+right.toString(); - else if (op.getOp()==Operation.ASSIGN) - str += " = "+left.toString(); - else - str += " "+op.toString() +" "+left.toString(); - return str; - } - - public int kind() { - return FKind.FlatOpNode; - } - - public TempDescriptor [] readsTemps() { - if (right!=null) - return new TempDescriptor [] {left,right}; - else - return new TempDescriptor [] {left}; - } - - public TempDescriptor [] writesTemps() { - return new TempDescriptor [] {dest}; - } -} diff --git a/Robust/src/IR/Flat/FlatPrefetchNode.java b/Robust/src/IR/Flat/FlatPrefetchNode.java deleted file mode 100644 index 4baaf6ad..00000000 --- a/Robust/src/IR/Flat/FlatPrefetchNode.java +++ /dev/null @@ -1,46 +0,0 @@ -package IR.Flat; -import Analysis.Prefetch.*; -import java.util.*; - -public class FlatPrefetchNode extends FlatNode { - public Integer siteid; - HashSet hspp; - - public FlatPrefetchNode() { - hspp = new HashSet(); - siteid = new Integer(1); - } - - public String toString() { - String st="prefetch("; - boolean first=true; - for(Iterator it=hspp.iterator();it.hasNext();) { - PrefetchPair pp=it.next(); - if (!first) - st+=", "; - first=false; - st+=pp; - } - return st+")"; - } - - public int kind() { - return FKind.FlatPrefetchNode; - } - - public void insPrefetchPair(PrefetchPair pp) { - hspp.add(pp); - } - - public void insAllpp(HashSet hspp) { - this.hspp.addAll(hspp); - } - - public HashSet getPrefetchPairs() { - return hspp; - } - - public int getNumPairs() { - return hspp.size(); - } -} diff --git a/Robust/src/IR/Flat/FlatReturnNode.java b/Robust/src/IR/Flat/FlatReturnNode.java deleted file mode 100644 index fb2d3b97..00000000 --- a/Robust/src/IR/Flat/FlatReturnNode.java +++ /dev/null @@ -1,28 +0,0 @@ -package IR.Flat; - -public class FlatReturnNode extends FlatNode { - TempDescriptor tempdesc; - - public FlatReturnNode(TempDescriptor td) { - this.tempdesc=td; - } - - public String toString() { - return "FlatReturnNode_return "+tempdesc; - } - - public int kind() { - return FKind.FlatReturnNode; - } - - public TempDescriptor [] readsTemps() { - if (tempdesc==null) - return new TempDescriptor [0]; - else - return new TempDescriptor [] {tempdesc}; - } - - public TempDescriptor getReturnTemp() { - return tempdesc; - } -} diff --git a/Robust/src/IR/Flat/FlatSetElementNode.java b/Robust/src/IR/Flat/FlatSetElementNode.java deleted file mode 100644 index d7e748e8..00000000 --- a/Robust/src/IR/Flat/FlatSetElementNode.java +++ /dev/null @@ -1,42 +0,0 @@ -package IR.Flat; -import IR.FieldDescriptor; - -public class FlatSetElementNode extends FlatNode { - TempDescriptor src; - TempDescriptor dst; - TempDescriptor index; - - public FlatSetElementNode(TempDescriptor dst, TempDescriptor index, TempDescriptor src) { - this.index=index; - this.src=src; - this.dst=dst; - } - - public boolean needsBoundsCheck() { - return true; - } - - public TempDescriptor getSrc() { - return src; - } - - public TempDescriptor getIndex() { - return index; - } - - public TempDescriptor getDst() { - return dst; - } - - public String toString() { - return "FlatSetElementNode_"+dst.toString()+"["+index.toString()+"]="+src.toString(); - } - - public int kind() { - return FKind.FlatSetElementNode; - } - - public TempDescriptor [] readsTemps() { - return new TempDescriptor [] {src,dst,index}; - } -} diff --git a/Robust/src/IR/Flat/FlatSetFieldNode.java b/Robust/src/IR/Flat/FlatSetFieldNode.java deleted file mode 100644 index e34de29b..00000000 --- a/Robust/src/IR/Flat/FlatSetFieldNode.java +++ /dev/null @@ -1,38 +0,0 @@ -package IR.Flat; -import IR.FieldDescriptor; - -public class FlatSetFieldNode extends FlatNode { - TempDescriptor src; - TempDescriptor dst; - FieldDescriptor field; - - public FlatSetFieldNode(TempDescriptor dst, FieldDescriptor field, TempDescriptor src) { - this.field=field; - this.src=src; - this.dst=dst; - } - - public TempDescriptor getSrc() { - return src; - } - - public TempDescriptor getDst() { - return dst; - } - - public FieldDescriptor getField() { - return field; - } - - public String toString() { - return "FlatSetFieldNode_"+dst.toString()+"."+field.getSymbol()+"="+src.toString(); - } - - public int kind() { - return FKind.FlatSetFieldNode; - } - - public TempDescriptor [] readsTemps() { - return new TempDescriptor [] {src,dst}; - } -} diff --git a/Robust/src/IR/Flat/FlatTagDeclaration.java b/Robust/src/IR/Flat/FlatTagDeclaration.java deleted file mode 100644 index 0e48da4d..00000000 --- a/Robust/src/IR/Flat/FlatTagDeclaration.java +++ /dev/null @@ -1,36 +0,0 @@ -package IR.Flat; -import IR.TagDescriptor; - -public class FlatTagDeclaration extends FlatNode { - TempDescriptor dst; - TagDescriptor type; - - public FlatTagDeclaration(TagDescriptor type, TempDescriptor dst) { - this.type=type; - this.dst=dst; - } - - public String toString() { - return "FlatTagDeclaration_"+dst.toString()+"= new Tag("+type.toString()+")"; - } - - public int kind() { - return FKind.FlatTagDeclaration; - } - - public TempDescriptor [] writesTemps() { - return new TempDescriptor[] {dst}; - } - - public TempDescriptor [] readsTemps() { - return new TempDescriptor[0]; - } - - public TempDescriptor getDst() { - return dst; - } - - public TagDescriptor getType() { - return type; - } -} diff --git a/Robust/src/IR/Flat/NodePair.java b/Robust/src/IR/Flat/NodePair.java deleted file mode 100644 index f9164ffa..00000000 --- a/Robust/src/IR/Flat/NodePair.java +++ /dev/null @@ -1,19 +0,0 @@ -package IR.Flat; - -public class NodePair { - FlatNode begin; - FlatNode end; - - public NodePair(FlatNode begin, FlatNode end) { - this.begin=begin; - this.end=end; - } - - public FlatNode getBegin() { - return begin; - } - - public FlatNode getEnd() { - return end; - } -} diff --git a/Robust/src/IR/Flat/ParamsObject.java b/Robust/src/IR/Flat/ParamsObject.java deleted file mode 100644 index 8133a4a9..00000000 --- a/Robust/src/IR/Flat/ParamsObject.java +++ /dev/null @@ -1,95 +0,0 @@ -package IR.Flat; -import IR.*; -import java.util.*; - -public class ParamsObject { - private Vector pointerparams; - private Vector primitiveparams; - private MethodDescriptor method; - private TaskDescriptor task; - private int tag; - private Hashtable paramtotemp; - private Hashtable temptostore; - private int count; - - public ParamsObject(MethodDescriptor md, int tag) { - pointerparams=new Vector(); - primitiveparams=new Vector(); - paramtotemp=new Hashtable(); - temptostore=new Hashtable(); - this.method=md; - this.tag=tag; - count=0; - } - - public ParamsObject(TaskDescriptor task, int tag) { - pointerparams=new Vector(); - primitiveparams=new Vector(); - paramtotemp=new Hashtable(); - temptostore=new Hashtable(); - this.task=task; - this.tag=tag; - count=0; - } - - public int getUID() { - return tag; - } - - public void addPtr(TempDescriptor t) { - Position p=new Position(true, pointerparams.size()); - pointerparams.add(t); - paramtotemp.put(new Integer(count++), t); - temptostore.put(t,p); - } - - public boolean isParamPtr(TempDescriptor t) { - if (containsTemp(t)) { - ParamsObject.Position p=(ParamsObject.Position)temptostore.get(t); - return p.inStruct; - } - return false; - } - - public boolean isParamPrim(TempDescriptor t) { - if (containsTemp(t)) { - ParamsObject.Position p=(ParamsObject.Position)temptostore.get(t); - return !p.inStruct; - } - return false; - } - - public boolean containsTemp(TempDescriptor t) { - return temptostore.containsKey(t); - } - - public void addPrim(TempDescriptor t) { - Position p=new Position(false, primitiveparams.size()); - primitiveparams.add(t); - paramtotemp.put(new Integer(count++), t); - temptostore.put(t,p); - } - - int numPointers() { - return pointerparams.size(); - } - - TempDescriptor getPointer(int i) { - return (TempDescriptor) pointerparams.get(i); - } - int numPrimitives() { - return primitiveparams.size(); - } - - TempDescriptor getPrimitive(int i) { - return (TempDescriptor) primitiveparams.get(i); - } - static class Position { - boolean inStruct; - int position; - Position(boolean inStruct, int position) { - this.inStruct=inStruct; - this.position=position; - } - } -} diff --git a/Robust/src/IR/Flat/TempDescriptor.java b/Robust/src/IR/Flat/TempDescriptor.java deleted file mode 100644 index 39bb16e0..00000000 --- a/Robust/src/IR/Flat/TempDescriptor.java +++ /dev/null @@ -1,82 +0,0 @@ -package IR.Flat; -import IR.*; - -public class TempDescriptor extends Descriptor { - static int currentid=0; - int id; - // String safename; - TypeDescriptor type; - TagDescriptor tag; - - public TempDescriptor(String name) { - super(name); - id=currentid++; - } - - public TempDescriptor(String name, TypeDescriptor td) { - this(name); - type=td; - } - - public TempDescriptor(String name, ClassDescriptor cd) { - this(name); - type=new TypeDescriptor(cd); - } - - public TempDescriptor(String name, TypeDescriptor type, TagDescriptor td) { - this(name); - this.type=type; - tag=td; - } - - public TempDescriptor createNew() { - if (tag==null) - return new TempDescriptor(name+"_"+currentid, type); - else - return new TempDescriptor(name+"_"+currentid, type, tag); - } - - public static TempDescriptor tempFactory() { - return new TempDescriptor("temp_"+currentid); - } - - public static TempDescriptor tempFactory(String name) { - return new TempDescriptor(name+currentid); - } - - public static TempDescriptor tempFactory(String name, TypeDescriptor td) { - return new TempDescriptor(name+currentid,td); - } - - public static TempDescriptor tempFactory(String name, TypeDescriptor type, TagDescriptor tag) { - return new TempDescriptor(name+currentid,type,tag); - } - - public static TempDescriptor paramtempFactory(String name, TypeDescriptor td) { - return new TempDescriptor(name,td); - } - - public static TempDescriptor paramtempFactory(String name, TypeDescriptor tagtype, TagDescriptor tag) { - return new TempDescriptor(name, tagtype, tag); - } - - public String toString() { - return safename; - } - - public void setType(TypeDescriptor td) { - type=td; - } - - public TypeDescriptor getType() { - return type; - } - - public TagDescriptor getTag() { - return tag; - } - - public void setTag(TagDescriptor tag) { - this.tag=tag; - } -} diff --git a/Robust/src/IR/Flat/TempFlagPair.java b/Robust/src/IR/Flat/TempFlagPair.java deleted file mode 100644 index 21915d2c..00000000 --- a/Robust/src/IR/Flat/TempFlagPair.java +++ /dev/null @@ -1,37 +0,0 @@ -package IR.Flat; -import IR.FlagDescriptor; - -public class TempFlagPair { - FlagDescriptor fd; - TempDescriptor td; - - public TempFlagPair(TempDescriptor td, FlagDescriptor fd) { - this.fd=fd; - this.td=td; - } - public int hashCode() { - if (fd!=null) - return fd.hashCode()^td.hashCode(); - else - return td.hashCode(); - } - - public TempDescriptor getTemp() { - return td; - } - - public FlagDescriptor getFlag() { - return fd; - } - - public boolean equals(Object o) { - if (!(o instanceof TempFlagPair)) - return false; - TempFlagPair tfp=(TempFlagPair)o; - return (tfp.fd==fd)&&(tfp.td==td); - } - - public String toString() { - return "<"+fd+","+td+">"; - } -} diff --git a/Robust/src/IR/Flat/TempObject.java b/Robust/src/IR/Flat/TempObject.java deleted file mode 100644 index f4e95e48..00000000 --- a/Robust/src/IR/Flat/TempObject.java +++ /dev/null @@ -1,104 +0,0 @@ -package IR.Flat; -import IR.*; -import java.util.*; - -public class TempObject { - ParamsObject params; - private Vector pointerparams; - private Vector primitiveparams; - private MethodDescriptor method; - private TaskDescriptor task; - private int tag; - private Hashtable paramtotemp; - private Hashtable temptostore; - private int count; - - public TempObject(ParamsObject p, MethodDescriptor md, int tag) { - params=p; - pointerparams=new Vector(); - primitiveparams=new Vector(); - paramtotemp=new Hashtable(); - temptostore=new Hashtable(); - this.method=md; - this.tag=tag; - count=0; - } - - public TempObject(ParamsObject p, TaskDescriptor task, int tag) { - params=p; - pointerparams=new Vector(); - primitiveparams=new Vector(); - paramtotemp=new Hashtable(); - temptostore=new Hashtable(); - this.task=task; - this.tag=tag; - count=0; - } - - public void addPtr(TempDescriptor t) { - if (!params.containsTemp(t)&&!pointerparams.contains(t)) { - Position p=new Position(true, pointerparams.size()); - pointerparams.add(t); - paramtotemp.put(new Integer(count++), t); - temptostore.put(t,p); - } - } - - public void addPrim(TempDescriptor t) { - if (!params.containsTemp(t)&&!primitiveparams.contains(t)) { - Position p=new Position(false, primitiveparams.size()); - primitiveparams.add(t); - paramtotemp.put(new Integer(count++), t); - temptostore.put(t,p); - } - } - - public boolean isLocalPtr(TempDescriptor t) { - if (!params.containsTemp(t)) { - Position p=(Position)temptostore.get(t); - return p.inStruct; - } - return false; - } - - public boolean isLocalPrim(TempDescriptor t) { - if (!params.containsTemp(t)) { - Position p=(Position)temptostore.get(t); - return !p.inStruct; - } - return false; - } - - public boolean isParamPtr(TempDescriptor t) { - return params.isParamPtr(t); - } - - public boolean isParamPrim(TempDescriptor t) { - return params.isParamPrim(t); - } - - int numPointers() { - return pointerparams.size(); - } - - TempDescriptor getPointer(int i) { - return (TempDescriptor) pointerparams.get(i); - } - - int numPrimitives() { - return primitiveparams.size(); - } - - TempDescriptor getPrimitive(int i) { - return (TempDescriptor) primitiveparams.get(i); - } - - static class Position { - boolean inStruct; - int position; - Position(boolean inStruct, int position) { - this.inStruct=inStruct; - this.position=position; - } - } -} diff --git a/Robust/src/IR/Flat/TempTagPair.java b/Robust/src/IR/Flat/TempTagPair.java deleted file mode 100644 index 2231a000..00000000 --- a/Robust/src/IR/Flat/TempTagPair.java +++ /dev/null @@ -1,48 +0,0 @@ -package IR.Flat; -import IR.TagDescriptor; - -public class TempTagPair { - TagDescriptor tagd; - TempDescriptor td; - TempDescriptor tagt; - - public TempTagPair(TempDescriptor td, TagDescriptor tagd, TempDescriptor tagt) { - this.tagd=tagd; - this.tagt=tagt; - this.td=td; - } - public int hashCode() { - return td.hashCode()^tagt.hashCode(); - } - - public TempDescriptor getTemp() { - return td; - } - - public TagDescriptor getTag() { - return tagd; - } - - public TempDescriptor getTagTemp() { - return tagt; - } - - public boolean equals(Object o) { - if (!(o instanceof TempTagPair)) - return false; - TempTagPair ttp=(TempTagPair)o; - if (ttp.tagt==tagt&&ttp.td==td) { - if (ttp.tagd!=null) { - if (!ttp.tagd.equals(tagd)) - throw new Error(); - } else if (tagd!=null) - throw new Error(); - - return true; - } else return false; - } - - public String toString() { - return "<"+td+","+tagd+","+tagt+">"; - } -} diff --git a/Robust/src/IR/MethodDescriptor.java b/Robust/src/IR/MethodDescriptor.java deleted file mode 100644 index 6091ea5a..00000000 --- a/Robust/src/IR/MethodDescriptor.java +++ /dev/null @@ -1,187 +0,0 @@ -package IR; -import IR.Tree.Modifiers; -import IR.Tree.ExpressionNode; -import java.util.Vector; - -/** - * Descriptor - * - * represents a symbol in the language (var name, function name, etc). - */ - -public class MethodDescriptor extends Descriptor { - - protected Modifiers modifier; - protected TypeDescriptor returntype; - protected String identifier; - protected Vector params; - protected SymbolTable paramtable; - protected ClassDescriptor cd; - protected VarDescriptor thisvd; - protected boolean isglobal; - - public MethodDescriptor(Modifiers m, TypeDescriptor rt, String identifier) { - super(identifier); - this.modifier=m; - this.returntype=rt; - this.identifier=identifier; - this.safename = "___" + name + "___"; - this.uniqueid=count++; - params=new Vector(); - paramtable=new SymbolTable(); - thisvd=null; - } - - public Modifiers getModifiers() { - return modifier; - } - - public boolean matches(MethodDescriptor md) { - /* Check the name */ - if (!identifier.equals(md.identifier)) - return false; - if (numParameters()!=md.numParameters()) - return false; - for(int i=0;i"; - else if (operation==LTE) - return "<="; - else if (operation==GTE) - return ">="; - else if (operation==LEFTSHIFT) - return "<<"; - else if (operation==RIGHTSHIFT) - return ">>"; - else if (operation==URIGHTSHIFT) - return ">>>"; - else if (operation==SUB) - return "-"; - else if (operation==ADD) - return "+"; - else if (operation==MULT) - return "*"; - else if (operation==DIV) - return "/"; - else if (operation==MOD) - return "%"; - else if (operation==UNARYPLUS) - return "unaryplus"; - else if (operation==UNARYMINUS) - return "unaryminus"; - else if (operation==POSTINC) - return "postinc"; - else if (operation==POSTDEC) - return "postdec"; - else if (operation==PREINC) - return "preinc"; - else if (operation==PREDEC) - return "predec"; - else if (operation==ASSIGN) - return "assign"; - else throw new Error(); - } - - -} diff --git a/Robust/src/IR/State.java b/Robust/src/IR/State.java deleted file mode 100644 index 07bbae6e..00000000 --- a/Robust/src/IR/State.java +++ /dev/null @@ -1,188 +0,0 @@ -package IR; -import IR.Tree.*; -import IR.Flat.*; -import IR.*; -import java.util.*; -import Analysis.TaskStateAnalysis.*; - -public class State { - public State() { - this.classes=new SymbolTable(); - this.tasks=new SymbolTable(); - this.treemethodmap=new Hashtable(); - this.flatmethodmap=new Hashtable(); - this.parsetrees=new HashSet(); - this.arraytypes=new HashSet(); - this.arraytonumber=new Hashtable(); - this.tagmap=new Hashtable(); - this.selfloops=new HashSet(); - this.excprefetch=new HashSet(); - } - - public void addParseNode(ParseNode parsetree) { - parsetrees.add(parsetree); - } - - public void storeAnalysisResult(Hashtable>> analysisresults) { - this.analysisresults=analysisresults; - } - - public Hashtable>> getAnalysisResult() { - return analysisresults; - } - - - public void storeOptionalTaskDescriptors(Hashtable> optionaltaskdescriptors){ - this.optionaltaskdescriptors=optionaltaskdescriptors; - } - - public Hashtable> getOptionalTaskDescriptors(){ - return optionaltaskdescriptors; - } - - /** Boolean flag which indicates whether compiler is compiling a task-based - * program. */ - public boolean WEBINTERFACE=false; - public boolean TASK=false; - public boolean DSM=false; - public boolean PREFETCH=false; - public boolean TASKSTATE=false; - public boolean TAGSTATE=false; - public boolean FLATIRGRAPH=false; - public boolean FLATIRGRAPHTASKS=false; - public boolean FLATIRGRAPHUSERMETHODS=false; - public boolean FLATIRGRAPHLIBMETHODS=false; - public boolean MULTICORE=false; - public boolean OWNERSHIP=false; - public boolean OPTIONAL=false; - public boolean RAW=false; - public boolean SCHEDULING=false; - public boolean THREAD=false; - public boolean CONSCHECK=false; - public boolean INSTRUCTIONFAILURE=false; - public static double TRUEPROB=0.8; - public static boolean PRINTFLAT=false; - public int CORENUM = 1; - public String structfile; - public String main; - - public HashSet selfloops; - public HashSet excprefetch; - public SymbolTable classes; - public SymbolTable tasks; - public Set parsetrees; - public Hashtable treemethodmap; - public Hashtable flatmethodmap; - private HashSet arraytypes; - public Hashtable arraytonumber; - private int numclasses=0; - private int numtasks=0; - private int arraycount=0; - - - private Hashtable> optionaltaskdescriptors; - private Hashtable>> analysisresults; - - private Hashtable tagmap; - private int numtags=0; - - public void addArrayType(TypeDescriptor td) { - if (!arraytypes.contains(td)) { - arraytypes.add(td); - arraytonumber.put(td,new Integer(arraycount++)); - } - } - - public Iterator getArrayIterator() { - return arraytypes.iterator(); - } - - public int getTagId(TagDescriptor tag) { - if (tagmap.containsKey(tag)) { - return ((Integer) tagmap.get(tag)).intValue(); - } else { - tagmap.put(tag, new Integer(numtags)); - return numtags++; - } - } - - public int getArrayNumber(TypeDescriptor td) { - return ((Integer)arraytonumber.get(td)).intValue(); - } - - public int numArrays() { - return arraytypes.size(); - } - - public static TypeDescriptor getTypeDescriptor(int t) { - TypeDescriptor td=new TypeDescriptor(t); - return td; - } - - public static TypeDescriptor getTypeDescriptor(NameDescriptor n) { - TypeDescriptor td=new TypeDescriptor(n); - return td; - } - - public void addClass(ClassDescriptor tdn) { - if (classes.contains(tdn.getSymbol())) - throw new Error("Class "+tdn.getSymbol()+" defined twice"); - classes.add(tdn); - numclasses++; - } - - public int numClasses() { - return numclasses; - } - - public BlockNode getMethodBody(MethodDescriptor md) { - return (BlockNode)treemethodmap.get(md); - } - - public BlockNode getMethodBody(TaskDescriptor td) { - return (BlockNode)treemethodmap.get(td); - } - - public SymbolTable getClassSymbolTable() { - return classes; - } - - public SymbolTable getTaskSymbolTable() { - return tasks; - } - - /** Returns Flat IR representation of MethodDescriptor md. */ - - public FlatMethod getMethodFlat(MethodDescriptor md) { - return (FlatMethod)flatmethodmap.get(md); - } - - /** Returns Flat IR representation of TaskDescriptor td. */ - - public FlatMethod getMethodFlat(TaskDescriptor td) { - return (FlatMethod)flatmethodmap.get(td); - } - - public void addTreeCode(MethodDescriptor md, BlockNode bn) { - treemethodmap.put(md,bn); - } - - public void addTreeCode(TaskDescriptor td, BlockNode bn) { - treemethodmap.put(td,bn); - } - - public void addFlatCode(MethodDescriptor md, FlatMethod bn) { - flatmethodmap.put(md,bn); - } - - public void addFlatCode(TaskDescriptor td, FlatMethod bn) { - flatmethodmap.put(td,bn); - } - - public void addTask(TaskDescriptor td) { - if (tasks.contains(td.getSymbol())) - throw new Error("Task "+td.getSymbol()+" defined twice"); - tasks.add(td); - numtasks++; - } -} diff --git a/Robust/src/IR/SymbolTable.java b/Robust/src/IR/SymbolTable.java deleted file mode 100644 index 2c8bd2c5..00000000 --- a/Robust/src/IR/SymbolTable.java +++ /dev/null @@ -1,125 +0,0 @@ -package IR; - -import java.util.*; - -public class SymbolTable { - - private Hashtable table; - private SymbolTable parent; - private HashSet valueset; - - public SymbolTable() { - table = new Hashtable(); - valueset = new HashSet(); - this.parent = null; - } - - public SymbolTable(SymbolTable parent) { - table = new Hashtable(); - this.parent = parent; - } - - public void add(Descriptor d) { - add(d.getSymbol(), d); - } - - public void add(String name, Descriptor d) { - if (!table.containsKey(name)) - table.put(name, new HashSet()); - HashSet hs=(HashSet)table.get(name); - hs.add(d); - valueset.add(d); - } - - public Set getSet(String name) { - return getPSet(name); - } - - private HashSet getPSet(String name) { - HashSet hs=null; - if (parent!=null) - hs=parent.getPSet(name); - else - hs=new HashSet(); - if (table.containsKey(name)) { - hs.addAll((HashSet)table.get(name)); - } - return hs; - } - - public Set getSetFromSameScope(String name) { - return getPSetFromSameScope(name); - } - - private HashSet getPSetFromSameScope(String name) { - if (table.containsKey(name)) { - HashSet hs=(HashSet)table.get(name); - return hs; - } else - return new HashSet(); - } - - public Descriptor get(String name) { - Descriptor d = getFromSameScope(name); - if (d == null && parent != null) { - return parent.get(name); - } else { - return d; - } - } - - public Descriptor getFromSameScope(String name) { - if (table.containsKey(name)) { - HashSet hs=(HashSet) table.get(name); - return (Descriptor) hs.iterator().next(); - } else - return null; - - } - - public Enumeration getNames() { - return table.keys(); - } - - public Iterator getNamesIterator() { - return table.keySet().iterator(); - } - - public Set getValueSet() { - return valueset; - } - - public Iterator getDescriptorsIterator() { - return getValueSet().iterator(); - } - - public Set getAllValueSet() { - HashSet hs=null; - if (parent!=null) - hs=(HashSet) parent.getAllValueSet(); - else - hs=new HashSet(); - hs.addAll(valueset); - return hs; - } - - public Iterator getAllDescriptorsIterator() { - return getAllValueSet().iterator(); - } - - public boolean contains(String name) { - return (get(name) != null); - } - - public SymbolTable getParent() { - return parent; - } - - public void setParent(SymbolTable parent) { - this.parent = parent; - } - - public String toString() { - return "ST: " + table.toString(); - } -} diff --git a/Robust/src/IR/TagDescriptor.java b/Robust/src/IR/TagDescriptor.java deleted file mode 100644 index 48a2e70a..00000000 --- a/Robust/src/IR/TagDescriptor.java +++ /dev/null @@ -1,29 +0,0 @@ -package IR; - -/** - * Descriptor - * - * represents a symbol in the language (var name, function name, etc). - */ - -public class TagDescriptor extends Descriptor { - - public TagDescriptor(String identifier) { - super(identifier); - } - - public boolean equals(Object o) { - if (o instanceof TagDescriptor) { - TagDescriptor t=(TagDescriptor) o; - return getSymbol().equals(t.getSymbol()); - } else return false; - } - - public int hashCode() { - return getSymbol().hashCode(); - } - - public String toString() { - return "Tag "+getSymbol(); - } -} diff --git a/Robust/src/IR/TagVarDescriptor.java b/Robust/src/IR/TagVarDescriptor.java deleted file mode 100644 index a478f447..00000000 --- a/Robust/src/IR/TagVarDescriptor.java +++ /dev/null @@ -1,56 +0,0 @@ -package IR; - -/** - * Descriptor - * - * represents a symbol in the language (var name, function name, etc). - */ - -public class TagVarDescriptor extends Descriptor { - - protected TagDescriptor td; - protected String identifier; - - public TagVarDescriptor(TagDescriptor t, String identifier) { - super(identifier); - this.td=t; - this.identifier=identifier; - this.safename = "___" + name + "___"; - this.uniqueid=count++; - } - - public String getName() { - return identifier; - } - - public TagDescriptor getTag() { - return td; - } - - public TypeDescriptor getType() { - return new TypeDescriptor(TypeDescriptor.TAG); - } - - /* public boolean equals(Object o) { - if (o instanceof TagVarDescriptor) { - TagVarDescriptor tvd=(TagVarDescriptor)o; - if (tvd.identifier.equals(identifier)) { - if (tvd.td!=null) { - if (!tvd.td.equals(td)) - throw new Error(); - } else if (td!=null) - throw new Error(); - return true; - } - } - return false; - } - - public int hashCode() { - return identifier.hashCode(); - }*/ - - public String toString() { - return td.toString()+" "+identifier; - } -} diff --git a/Robust/src/IR/TaskDescriptor.java b/Robust/src/IR/TaskDescriptor.java deleted file mode 100644 index 166f2284..00000000 --- a/Robust/src/IR/TaskDescriptor.java +++ /dev/null @@ -1,113 +0,0 @@ -package IR; -import IR.Tree.FlagExpressionNode; -import IR.Tree.TagExpressionList; -import IR.Tree.FlagEffects; -import java.util.Vector; -import java.util.Hashtable; -import java.util.Iterator; -import IR.Tree.Modifiers; - -/** - * Descriptor - * - */ - -public class TaskDescriptor extends Descriptor { - - protected Hashtable flagstable; - protected Hashtable tagstable; - protected Vector vfe; - protected String identifier; - protected Vector params; - protected Vector optionals; - protected SymbolTable paramtable; - - public TaskDescriptor(String identifier) { - super(identifier); - this.identifier=identifier; - this.uniqueid=count++; - flagstable=new Hashtable(); - tagstable=new Hashtable(); //BUGFIX - added initialization here - params=new Vector(); - optionals = new Vector(); - paramtable=new SymbolTable(); - } - - public void addFlagEffects(Vector vfe) { - this.vfe=vfe; - } - - public Vector getFlagEffects() { - return vfe; - } - - public SymbolTable getParameterTable() { - return paramtable; - } - - public void addParameter(TypeDescriptor type, String paramname, FlagExpressionNode fen, TagExpressionList tel, boolean isoptional) { - if (paramname.equals("this")) - throw new Error("Can't have parameter named this"); - VarDescriptor vd=new VarDescriptor(type, paramname); - params.add(vd); - if (isoptional) optionals.add(vd); - if (fen!=null) - flagstable.put(vd, fen); - if (tel!=null) {//BUGFIX - added null check here...test with any bristlecone program - tagstable.put(vd, tel); - for(int i=0;i0) - str+=","; - str+=getVar(i)+" : "; - str+=getArg(i).printNode(0); - } - return str+")"; - } -} diff --git a/Robust/src/IR/Tree/CreateObjectNode.java b/Robust/src/IR/Tree/CreateObjectNode.java deleted file mode 100644 index 5f19aae2..00000000 --- a/Robust/src/IR/Tree/CreateObjectNode.java +++ /dev/null @@ -1,81 +0,0 @@ -package IR.Tree; -import java.util.Vector; -import IR.TypeDescriptor; -import IR.MethodDescriptor; - -public class CreateObjectNode extends ExpressionNode { - TypeDescriptor td; - Vector argumentlist; - MethodDescriptor md; - FlagEffects fe; - boolean isglobal; - - public CreateObjectNode(TypeDescriptor type, boolean isglobal) { - td=type; - argumentlist=new Vector(); - this.isglobal=isglobal; - } - - public boolean isGlobal() { - return isglobal; - } - - public void addFlagEffects(FlagEffects fe) { - this.fe=fe; - } - - public FlagEffects getFlagEffects() { - return fe; - } - - public void addArgument(ExpressionNode en) { - argumentlist.add(en); - } - - public void setConstructor(MethodDescriptor md) { - this.md=md; - } - - public MethodDescriptor getConstructor() { - return md; - } - - public TypeDescriptor getType() { - return td; - } - - public int numArgs() { - return argumentlist.size(); - } - - public ExpressionNode getArg(int i) { - return (ExpressionNode) argumentlist.get(i); - } - - public String printNode(int indent) { - String st; - boolean isarray=td.isArray(); - if (isarray) - st="new "+td.toString()+"["; - else - st="new "+td.toString()+"("; - for(int i=0;i= 0) { - return line; - } else { - if (parent != null) { - return parent.getLine(); - } else { - return 0; - } - } - } - - public void setParent( ParseNode parent ) { - this.parent = parent; - } - - public ParseNode getParent() { - return parent; - } - - public ParseNode insertChild(ParseNode child) { - if (child == null) { - throw new NullPointerException("Can't add null node to parse tree"); - } - - children.insertElementAt(child, 0); - child.setParent(this); - return child; - } - - public ParseNode insertChild(String newlabel) { - ParseNode child = new ParseNode(newlabel, -1); - return insertChild(child); - } - - public ParseNode addChild( ParseNode child ) { - - if (child == null) { - throw new NullPointerException("Can't add null node to parse tree: "+getLabel()); - } - - children.addElement (child); - child.setParent(this); - return child; - } - - public ParseNode addChild( String newlabel ) { - - ParseNode child = new ParseNode(newlabel, -1); - children.addElement(child); - child.setParent(this); - return child; - } - - public ParseNode addChild (String newlabel, int line) { - ParseNode child = new ParseNode(newlabel, line); - children.addElement(child); - child.setParent(this); - return child; - } - - public ParseNodeVector getChildren() { - return children; - } - - public ParseNode getChild (String label) { - int i; - ParseNode p; - - for (i = 0; i < children.size(); i++) { - p = children.elementAt(i); - if (p.getLabel().equals(label)) { - return p; - } - } - - return null; - } - - public ParseNode getRoot() { - return (parent == null) ? this : parent.getRoot(); - } - - public String getTerminal () { - ParseNode pn = children.elementAt(0); - if (pn == null) { - return null; - } else { - return pn.getLabel(); - } - } - - public ParseNode getFirstChild() { - return children.elementAt(0); - } - - public ParseNodeVector getChildren(String label) { - int i; - ParseNodeVector v = new ParseNodeVector(); - - for (i = 0; i < children.size(); i++) { - ParseNode pn = children.elementAt(i); - if (pn.getLabel().equals(label)) - v.addElement(pn); - } - - return v; - } - - public String getNodeName() { - return label + " - " + getLine(); - } - - public int getNeighborCount() { - return children.size(); - } - - public Object getNeighbor(int index) { - return children.elementAt(index); - } - - public String doIndent(int indent) { - - String output = new String(); - for(int i=0;i\n"; - } else { - output += doIndent(indent) + "<" + label + ">\n"; - indent += 2; - - if (recursive) { - for (int i = 0; i < children.size(); i++) { - Walkable w = (Walkable)children.elementAt(i); - output += w.PPrint(indent, true); - } - } else { - for (int i = 0; i < children.size(); i++) { - Walkable w = (Walkable)children.elementAt(i); - output += doIndent(indent) + "<" + w.getNodeName() + "/>\n"; - } - } - - indent -= 2; - output += doIndent(indent) + "\n"; - } - - return output; - } - -} - diff --git a/Robust/src/IR/Tree/ParseNodeDOTVisitor.java b/Robust/src/IR/Tree/ParseNodeDOTVisitor.java deleted file mode 100644 index e9907284..00000000 --- a/Robust/src/IR/Tree/ParseNodeDOTVisitor.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - - Class: ParseNodeDOTVisitor - Author: Dan Roy - Purpose: Traverses a ParseNode tree and generates a DOT file that represents the parse - tree. - -*/ - -package IR.Tree; - -import java.util.*; - -public class ParseNodeDOTVisitor { - - java.io.PrintWriter output; - int tokennumber; - int color; - - private ParseNodeDOTVisitor(java.io.OutputStream output) { - tokennumber = 0; - color = 0; - this.output = new java.io.PrintWriter(output, true); - } - - private String getNewID(String name) { - tokennumber = tokennumber + 1; - return new String (name+tokennumber); - } - - public static void visit(java.io.OutputStream output, ParseNode root) { - ParseNodeDOTVisitor visitor = new ParseNodeDOTVisitor(output); - visitor.make(root); - } - - private void make(ParseNode root) { - output.println("digraph dotvisitor {"); - output.println("\tsize=\"7, 10\";"); - traverse(root, getNewID("root")); - output.println("}\n"); - } - - private String newColor() { - - - if (color == 0) { - color++; - return new String("red"); - } else if (color == 1) { - color++; - return new String("green"); - } else { - color = 0; - return new String("blue"); - } - } - - private void traverse(ParseNode node, String nodeid) { - output.println("\t" + nodeid + " [label=\"" + node.getLabel() + "\",shape=box];"); - ParseNodeVector children = node.getChildren(); - for (int i = 0; i < children.size(); i++) { - ParseNode child = children.elementAt(i); - String childid = getNewID("node"); - output.println("\t" + nodeid + " -> " + childid + ";"); - if (child.getLabel()=="rule") { - output.println("\tnode [color=" + newColor() + "];"); - } - traverse(child, childid); - } - } -} diff --git a/Robust/src/IR/Tree/ParseNodeVector.java b/Robust/src/IR/Tree/ParseNodeVector.java deleted file mode 100644 index efedcf66..00000000 --- a/Robust/src/IR/Tree/ParseNodeVector.java +++ /dev/null @@ -1,27 +0,0 @@ -package IR.Tree; - -import java.util.Vector; - -public class ParseNodeVector { - private Vector v; - - public ParseNodeVector() { - v = new Vector(); - } - - public void addElement(ParseNode pn) { - v.addElement(pn); - } - - public void insertElementAt(ParseNode pn, int n) { - v.insertElementAt(pn, n); - } - - public ParseNode elementAt(int i) { - return (ParseNode) v.elementAt(i); - } - - public int size() { - return v.size(); - } -} diff --git a/Robust/src/IR/Tree/ReturnNode.java b/Robust/src/IR/Tree/ReturnNode.java deleted file mode 100644 index 780a4cbd..00000000 --- a/Robust/src/IR/Tree/ReturnNode.java +++ /dev/null @@ -1,27 +0,0 @@ -package IR.Tree; - -public class ReturnNode extends BlockStatementNode { - ExpressionNode en; - - public ReturnNode() { - en=null; - } - - public ReturnNode(ExpressionNode en) { - this.en=en; - } - - public ExpressionNode getReturnExpression() { - return en; - } - - public String printNode(int indent) { - if (en==null) - return "return"; - else - return "return "+en.printNode(indent); - } - public int kind() { - return Kind.ReturnNode; - } -} diff --git a/Robust/src/IR/Tree/SemanticCheck.java b/Robust/src/IR/Tree/SemanticCheck.java deleted file mode 100644 index 816ee712..00000000 --- a/Robust/src/IR/Tree/SemanticCheck.java +++ /dev/null @@ -1,978 +0,0 @@ -package IR.Tree; - -import java.util.*; -import IR.*; - -public class SemanticCheck { - State state; - TypeUtil typeutil; - - public SemanticCheck(State state, TypeUtil tu) { - this.state=state; - this.typeutil=tu; - } - - public void semanticCheck() { - SymbolTable classtable=state.getClassSymbolTable(); - Iterator it=classtable.getDescriptorsIterator(); - // Do descriptors first - while(it.hasNext()) { - ClassDescriptor cd=(ClassDescriptor)it.next(); - //System.out.println("Checking class: "+cd); - //Set superclass link up - if (cd.getSuper()!=null) { - cd.setSuper(typeutil.getClass(cd.getSuper())); - // Link together Field, Method, and Flag tables so classes - // inherit these from their superclasses - cd.getFieldTable().setParent(cd.getSuperDesc().getFieldTable()); - cd.getMethodTable().setParent(cd.getSuperDesc().getMethodTable()); - cd.getFlagTable().setParent(cd.getSuperDesc().getFlagTable()); - } - - /* Check to see that fields are well typed */ - for(Iterator field_it=cd.getFields();field_it.hasNext();) { - FieldDescriptor fd=(FieldDescriptor)field_it.next(); - //System.out.println("Checking field: "+fd); - checkField(cd,fd); - } - - for(Iterator method_it=cd.getMethods();method_it.hasNext();) { - MethodDescriptor md=(MethodDescriptor)method_it.next(); - checkMethod(cd,md); - } - } - - it=classtable.getDescriptorsIterator(); - // Do descriptors first - while(it.hasNext()) { - ClassDescriptor cd=(ClassDescriptor)it.next(); - for(Iterator method_it=cd.getMethods();method_it.hasNext();) { - MethodDescriptor md=(MethodDescriptor)method_it.next(); - checkMethodBody(cd,md); - } - } - - for(Iterator task_it=state.getTaskSymbolTable().getDescriptorsIterator();task_it.hasNext();) { - TaskDescriptor td=(TaskDescriptor)task_it.next(); - checkTask(td); - - } - } - - public void checkTypeDescriptor(TypeDescriptor td) { - if (td.isPrimitive()) - return; /* Done */ - else if (td.isClass()) { - String name=td.toString(); - ClassDescriptor field_cd=(ClassDescriptor)state.getClassSymbolTable().get(name); - if (field_cd==null) - throw new Error("Undefined class "+name); - td.setClassDescriptor(field_cd); - return; - } else if (td.isTag()) - return; - else - throw new Error(); - } - - public void checkField(ClassDescriptor cd, FieldDescriptor fd) { - checkTypeDescriptor(fd.getType()); - } - - public void checkConstraintCheck(TaskDescriptor td, SymbolTable nametable, Vector ccs) { - if (ccs==null) - return; /* No constraint checks to check */ - for(int i=0;i=temps.size()) - temps.setSize(i+1); - temps.set(i, tmp); - } - - public TempDescriptor getTemp(int i) { - return (TempDescriptor) temps.get(i); - } - - public String getName(int i) { - return (String) names.get(i); - } - - public String getType(int i) { - return (String) types.get(i); - } -} - diff --git a/Robust/src/IR/Tree/TaskExitNode.java b/Robust/src/IR/Tree/TaskExitNode.java deleted file mode 100644 index c26e0fc2..00000000 --- a/Robust/src/IR/Tree/TaskExitNode.java +++ /dev/null @@ -1,27 +0,0 @@ -package IR.Tree; -import java.util.Vector; - -public class TaskExitNode extends BlockStatementNode { - Vector vfe; - Vector ccs; - public TaskExitNode(Vector vfe, Vector ccs) { - this.vfe=vfe; - this.ccs=ccs; - } - - public String printNode(int indent) { - return "taskexit"; - } - - public Vector getFlagEffects() { - return vfe; - } - - public Vector getChecks() { - return ccs; - } - - public int kind() { - return Kind.TaskExitNode; - } -} diff --git a/Robust/src/IR/Tree/TreeNode.java b/Robust/src/IR/Tree/TreeNode.java deleted file mode 100644 index 35233fc3..00000000 --- a/Robust/src/IR/Tree/TreeNode.java +++ /dev/null @@ -1,18 +0,0 @@ -package IR.Tree; - -public class TreeNode { - public static final int INDENT=2; - - public String printNode(int indent) { - return null; - } - public static String printSpace(int x) { - String sp=""; - for(int i=0;i0) - return false; - if (!getSymbol().equals(TypeUtil.StringClass)) - return false; - return true; - } - - public int hashCode() { - int hashcode=type^arraycount; - if (type==CLASS) - hashcode^=getSymbol().hashCode(); - return hashcode; - } - - public TypeDescriptor makeArray(State state) { - TypeDescriptor td=new TypeDescriptor(getSymbol()); - td.arraycount=arraycount+1; - td.type=type; - td.class_desc=class_desc; - state.addArrayType(td); - return td; - } - - public boolean isArray() { - return (arraycount>0); - } - - public int getArrayCount() { - return arraycount; - } - - public TypeDescriptor dereference() { - TypeDescriptor td=new TypeDescriptor(getSymbol()); - if (arraycount==0) - throw new Error(); - td.arraycount=arraycount-1; - td.type=type; - td.class_desc=class_desc; - return td; - } - - public String getSafeSymbol() { - if (isArray()) - return IR.Flat.BuildCode.arraytype; - else if (isClass()) - return class_desc.getSafeSymbol(); - else if (isByte()) - return "char"; - else if (isChar()) - return "short"; - else if (isShort()) - return "short"; - else if (isInt()) - return "int"; - else if (isBoolean()) //Booleans are ints in C - return "int"; - else if (isLong()) - return "long long"; - else if (isVoid()) - return "void"; - else if (isDouble()) - return "double"; - else if (isFloat()) - return "float"; - else throw new Error("Error Type: "+type); - } - - public String getRepairSymbol() { - if (isArray()) - return IR.Flat.BuildCode.arraytype; - else if (isClass()) - return class_desc.getSymbol(); - else if (isByte()) - return "byte"; - else if (isChar()) - return "short"; - else if (isShort()) - return "short"; - else if (isInt()) - return "int"; - else if (isBoolean()) //Booleans are ints in C - return "int"; - else if (isLong()) - return "long long"; - else if (isVoid()) - return "void"; - else if (isDouble()) - return "double"; - else if (isFloat()) - return "float"; - else throw new Error("Error Type: "+type); - } - - public String getSafeDescriptor() { - //Can't safely use [ in C - if (isArray()) - return "_AR_"+this.dereference().getSafeDescriptor(); - else if (isClass()) - return class_desc.getSafeDescriptor(); - else if (isByte()) - return "B"; - else if (isChar()) - return "C"; - else if (isShort()) - return "S"; - else if (isBoolean()) - return "Z"; - else if (isInt()) - return "I"; - else if (isLong()) - return "J"; - else if (isDouble()) - return "D"; - else if (isFloat()) - return "F"; - else if (isTag()) - return "T"; - else throw new Error(); - } - - public boolean isNumber() { - return (isIntegerType()||isFloat()||isDouble()); - } - - public boolean isByte() { - return type==BYTE; - } - public boolean isNull() { - return type==NULL; - } - public boolean isShort() { - return type==SHORT; - } - public boolean isInt() { - return type==INT; - } - public boolean isLong() { - return type==LONG; - } - public boolean isChar() { - return type==CHAR; - } - public boolean isBoolean() { - return type==BOOLEAN; - } - public boolean isFloat() { - return type==FLOAT; - } - public boolean isDouble() { - return type==DOUBLE; - } - public boolean isVoid() { - return type==VOID; - } - - public boolean isPtr() { - return (isClass()||isNull()||isTag()||isArray()); - } - - public boolean isIntegerType() { - return (isInt()||isLong()||isShort()||isChar()||isByte()); - } - - public void setClassDescriptor(ClassDescriptor cd) { - class_desc=cd; - } - - public boolean isPrimitive() { - return ((type>=BYTE)&&(type<=DOUBLE)); - } - - public boolean isClass() { - return type==CLASS; - } - - public boolean isTag() { - return type==TAG; - } - - public TypeDescriptor(NameDescriptor name) { - super(name.toString()); - this.type=CLASS; - this.class_desc=null; - this.arraycount=0; - } - - public TypeDescriptor(String st) { - super(st); - this.type=CLASS; - this.class_desc=null; - this.arraycount=0; - } - - public ClassDescriptor getClassDesc() { - return class_desc; - } - - public TypeDescriptor(ClassDescriptor cd) { - super(cd.getSymbol()); - this.type=CLASS; - this.class_desc=cd; - this.arraycount=0; - } - - public TypeDescriptor(int t) { - super(decodeInt(t)); - this.type=t; - this.arraycount=0; - } - - public String toString() { - if (type==CLASS) { - return name; - } else - return decodeInt(type); - } - - public String toPrettyString() { - if (type==CLASS) { - String str=name; - for(int i=0;i methodnumber; - Hashtable classmethodcount; - Hashtable localitynumber; - - public int getMethodNumber(MethodDescriptor md) { - return methodnumber.get(md).intValue(); - } - - public int getMethodCount(ClassDescriptor md) { - return classmethodcount.get(md).intValue(); - } - - public int getLocalityNumber(LocalityBinding lb) { - return localitynumber.get(lb).intValue(); - } - - public Virtual(State state, LocalityAnalysis locality) { - this.state=state; - this.locality=locality; - classmethodcount=new Hashtable(); - if (state.DSM) - localitynumber=new Hashtable(); - else - methodnumber=new Hashtable(); - doAnalysis(); - } - - private void doAnalysis() { - Iterator classit=state.getClassSymbolTable().getDescriptorsIterator(); - while(classit.hasNext()) { - ClassDescriptor cd=(ClassDescriptor)classit.next(); - if (state.DSM) - numberLocality(cd); - else - numberMethods(cd); - } - } - - private int numberLocality(ClassDescriptor cd) { - if (classmethodcount.containsKey(cd)) - return classmethodcount.get(cd).intValue(); - ClassDescriptor superdesc=cd.getSuperDesc(); - int start=0; - if (superdesc!=null) - start=numberLocality(superdesc); - - if (locality.getClassBindings(cd)!=null) - for(Iterator lbit=locality.getClassBindings(cd).iterator();lbit.hasNext();) { - LocalityBinding lb=lbit.next(); - MethodDescriptor md=lb.getMethod(); - //Is it a static method or constructor - if (md.isStatic()||md.getReturnType()==null) - continue; - - if (superdesc!=null) { - Set possiblematches=superdesc.getMethodTable().getSet(md.getSymbol()); - boolean foundmatch=false; - for(Iterator matchit=possiblematches.iterator();matchit.hasNext();) { - MethodDescriptor matchmd=(MethodDescriptor)matchit.next(); - if (md.matches(matchmd)) { - Set lbset=locality.getMethodBindings(matchmd); - if (lbset!=null) - for(Iterator suplbit=lbset.iterator();suplbit.hasNext();) { - LocalityBinding suplb=suplbit.next(); - if (lb.contextMatches(suplb)) { - foundmatch=true; - localitynumber.put(lb, localitynumber.get(suplb)); - break; - } - } - break; - } - } - if (!foundmatch) - localitynumber.put(lb, new Integer(start++)); - } else { - localitynumber.put(lb, new Integer(start++)); - } - } - classmethodcount.put(cd, new Integer(start)); - return start; - } - - private int numberMethods(ClassDescriptor cd) { - if (classmethodcount.containsKey(cd)) - return classmethodcount.get(cd).intValue(); - ClassDescriptor superdesc=cd.getSuperDesc(); - int start=0; - if (superdesc!=null) - start=numberMethods(superdesc); - for(Iterator it=cd.getMethods();it.hasNext();) { - MethodDescriptor md=(MethodDescriptor)it.next(); - if (md.isStatic()||md.getReturnType()==null) - continue; - if (superdesc!=null) { - Set possiblematches=superdesc.getMethodTable().getSet(md.getSymbol()); - boolean foundmatch=false; - for(Iterator matchit=possiblematches.iterator();matchit.hasNext();) { - MethodDescriptor matchmd=(MethodDescriptor)matchit.next(); - if (md.matches(matchmd)) { - int num=((Integer)methodnumber.get(matchmd)).intValue(); - methodnumber.put(md, new Integer(num)); - foundmatch=true; - break; - } - } - if (!foundmatch) - methodnumber.put(md, new Integer(start++)); - } else { - methodnumber.put(md, new Integer(start++)); - } - } - classmethodcount.put(cd, new Integer(start)); - return start; - } -} - diff --git a/Robust/src/Interface/HTTPHeader.java b/Robust/src/Interface/HTTPHeader.java deleted file mode 100644 index b862c5fc..00000000 --- a/Robust/src/Interface/HTTPHeader.java +++ /dev/null @@ -1,110 +0,0 @@ -package Interface; -//**************************************************************************** -// Programmer: Duane M. Gran, ragnar@cs.bsu.edu -// Program: JhttpServer -// Date: April 24, 1998 -//**************************************************************************** - - -import java.net.*; -import java.util.*; -import java.io.*; - -//**************************************************************************** -// Class: httpResponse -// Purpose: constructs the header to be returned by the server -//**************************************************************************** - -public class HTTPHeader{ - - // make a hashtable of return codes to messages - static private HashStrings rc = new HashStrings(); - static - { - rc.put("200", "OK"); - rc.put("403", "Fobidden"); - rc.put("404", "Not found"); - rc.put("501", "Method not implemented"); - } - - // hashtable of content type matchings - static private HashStrings ct = new HashStrings(); // p. 817 - static - { - ct.put("txt", "text/plain"); - ct.put("text", "text/plain"); - ct.put("log", "text/plain"); - ct.put("htm", "text/html"); - ct.put("html", "text/html"); - ct.put("gif", "image/gif"); - ct.put("jpg", "image/jpg"); - ct.put("jpeg", "image/jpg"); - ct.put("jpe", "image/jpg"); - ct.put("mpg", "video/mpeg"); - ct.put("mpeg", "video/mpeg"); - ct.put("mpe", "video/mpeg"); - ct.put("qt", "video/quicktime"); - ct.put("mov", "video/quicktime"); - ct.put("au", "audio/basic"); - ct.put("snd", "audio/basic"); - ct.put("wav", "audio/x-wave"); - ct.put("class", "application/octet-stream"); - ct.put("ps", "application/postscript"); - } - -//************************************************************************* -// Constructor: send_header(int, String, int) -// Purpose: Send an HTTP header -//************************************************************************* - - static public void send_header(OutputStream out, int returnCode, - String filename, long fileLength){ - String contentType = getContentTypeFor(filename); - String returnString = (String) rc.get(String.valueOf(returnCode)); - String header; - - header = "HTTP/1.0 " + returnCode + " " + returnString + "\n" + - "Date: " + "1/1/01" + "\n" + // date - "Expires: 1/1/00\n"+ - "Allow: GET\n" + // allowed methods - "MIME-Version: 1.0\n" + // mime version - "Server : SpinWeb Custom HTTP Server\n" + // server type - "Content-Type: " + contentType + "\n" + // type - "Content-Length: "+ fileLength + "\n\n"; // length - try{ - out.write(header.getBytes()); - } - catch(IOException e){ - e.printStackTrace(); // do nothing! - } - } - -//************************************************************************* -// Method: getContentTypeFor(String) -// Purpose: Looks up the content type (MIME) in a hashtable for the given -// file suffix. It removes any anchors (#) in case the string is -// a URL and then operates on the name without path. -//************************************************************************* - - static private String getContentTypeFor(String filename) - { - int position = filename.lastIndexOf('#'); - if (position != -1) - filename = filename.substring(0, position - 1); - - File f = new File(filename); - String name = f.getName(); // name w/o directory - - position = name.lastIndexOf('.'); - - String contentType; - - if (position == -1) // if no extension, txt is assigned by default - contentType = "txt"; - else - contentType = name.substring(position + 1); - - return (String) ct.get(contentType); - } - -} diff --git a/Robust/src/Interface/HTTPResponse.java b/Robust/src/Interface/HTTPResponse.java deleted file mode 100644 index 74c532fe..00000000 --- a/Robust/src/Interface/HTTPResponse.java +++ /dev/null @@ -1,7 +0,0 @@ -package Interface; - - -public class HTTPResponse{ - public int returnCode; - public long sentBytes; -} diff --git a/Robust/src/Interface/HTTPServices.java b/Robust/src/Interface/HTTPServices.java deleted file mode 100644 index 30804fb8..00000000 --- a/Robust/src/Interface/HTTPServices.java +++ /dev/null @@ -1,82 +0,0 @@ -package Interface; -import java.net.*; -import java.io.*; -import java.util.*; - -public class HTTPServices{ - - static private String webRoot = "."; - - static private FileInputStream get_reader(String fileName,HTTPResponse resp) throws IOException{ -// if(fileName.equals("/daytime")){ -// String date_str = (new Date()).toString(); -// resp.sentBytes = date_str.length(); -// return -// new StringReader(date_str); -// } - - if(fileName.equals("/viewlog")) - fileName = LogFile.log_file_name; - else - fileName = webRoot + fileName; - - File f = new File(fileName); - resp.sentBytes = f.length(); - return new FileInputStream(f); - } - - public static void GET_handler(String fileName, OutputStream out, HTTPResponse resp){ - - FileInputStream reader = null; - byte buffer[]; - int size; - - if((reader = HEAD_handler_int(fileName,out,resp)) == null) return; - - buffer = new byte[1024]; - - try{ - while((size = reader.read(buffer,0,buffer.length)) != -1) - out.write(buffer,0,size); - reader.close(); - } - catch(IOException e){ - e.printStackTrace(); - resp.returnCode = 501; // error during transmision - } - - } - - public static void POST_handler(String fileName, OutputStream out, HTTPResponse resp){ - GET_handler(fileName,out, resp); - } - - static private FileInputStream HEAD_handler_int(String fileName, - OutputStream out,HTTPResponse resp){ - FileInputStream reader = null; - - try{ - reader = get_reader(fileName, resp); - resp.returnCode = 200; - } - catch(IOException e){ - resp.returnCode = 404; // file not found - } - - if(resp.returnCode == 200) - HTTPHeader.send_header(out, resp.returnCode, fileName, resp.sentBytes); - else{ - HTTPHeader.send_header(out, resp.returnCode, fileName, 0); - return null; - } - - return reader; - } - - - public static void HEAD_handler(String fileName, - OutputStream out, HTTPResponse resp){ - HEAD_handler_int(fileName,out,resp); - } -} - diff --git a/Robust/src/Interface/HashStrings.java b/Robust/src/Interface/HashStrings.java deleted file mode 100644 index 67065786..00000000 --- a/Robust/src/Interface/HashStrings.java +++ /dev/null @@ -1,39 +0,0 @@ -package Interface; - -class HashStrings { - Pair p[]; // entries in the hash table - int f; // number of full entries - public HashStrings() { p = new Pair[38]; f = 0; } - - public void put(String key, String value) { - int n = p.length; - if (f == n-1) return; // cheese -- a diary product - int i = key.hashCode() % n; - while (p[i] != null) { - if (key.equals(p[i].key)) { - p[i] = new Pair(key, value); - return; - } - i = (i+1) % n; - } - p[i] = new Pair(key, value); - f = f + 1; - } - - public String get(String key) { - int n = p.length; - int i = key.hashCode() % n; - while (p[i] != null) { - if (key.equals(p[i].key)) - return p[i].value; - i = (i+1) % n; - } - return null; - } - -} - -class Pair { - String key, value; - Pair (String key, String value) { this.key = key; this.value = value; } -} diff --git a/Robust/src/Interface/IdentityRelation.java b/Robust/src/Interface/IdentityRelation.java deleted file mode 100644 index 04d28883..00000000 --- a/Robust/src/Interface/IdentityRelation.java +++ /dev/null @@ -1,27 +0,0 @@ -package Interface; -class IdentityRelation{ - String fieldname1; - String fieldname2; - - public IdentityRelation(String fieldname1,String fieldname2) { - this.fieldname1=fieldname1; - this.fieldname2=fieldname2; - } - public String toString() { - return fieldname1+"."+fieldname2; - } - - public int hashCode() { - return fieldname1.hashCode()^fieldname2.hashCode(); - } - - public boolean equals(Object obj) { - if (obj instanceof IdentityRelation) { - IdentityRelation ir=(IdentityRelation) obj; - if (fieldname1.equals(ir.fieldname1)&& - fieldname2.equals(ir.fieldname2)) - return true; - } - return false; - } -} diff --git a/Robust/src/Interface/Imap.java b/Robust/src/Interface/Imap.java deleted file mode 100644 index 33763fd8..00000000 --- a/Robust/src/Interface/Imap.java +++ /dev/null @@ -1,148 +0,0 @@ -package Interface; -import java.net.*; -import java.io.*; -import java.util.*; - -class Imap { - private Rectangle[] rectangles; - private Point[] points; - long THRESHOLD=400; - - public Imap(String filename) { - FileReader fr=null; - try { - fr=new FileReader(filename); - parseFile(fr); - fr.close(); - } catch (IOException e) { - System.out.println(e); - System.exit(-1); - } - } - static class Rectangle { - String label; - int x1,y1,x2,y2; - public Rectangle(String label, int x1,int y1, int x2, int y2) { - this.label=label; - this.x1=x1; - this.y1=y1; - this.x2=x2; - this.y2=y2; - } - } - - String parseclick(int x,int y) { - System.out.println(x+","+y); - for(int i=0;i=y)&& - (r.x2>=x)&&(r.y2<=y)) - return r.label; - } - long mindistance=Long.MAX_VALUE; - int minindex=-1; - for(int i=0;iTHRESHOLD) - return null; - else - return points[minindex].label; - } - - static class Point { - String label; - int x,y; - public Point(String label, int x,int y) { - this.label=label; - this.x=x; - this.y=y; - } - } - - void parseFile(FileReader fr) { - int firstchar=0; - ArrayList rectangles=new ArrayList(); - ArrayList points=new ArrayList(); - while(true) { - try { - firstchar=fr.read(); - } catch (Exception e) { - e.printStackTrace(); - System.exit(-1); - } - /* EOF?*/ - if (firstchar==-1) - break; - switch(firstchar) { - case'b': - case'#': - while(firstchar!='\n') { - try { - firstchar=fr.read(); - } catch (IOException e) { - e.printStackTrace(); - System.exit(-1); - } - } - break; - case'r': - { - nexttoken(fr,false); - String label=nexttoken(fr,false); - String x1=nexttoken(fr,true); - String y1=nexttoken(fr,true); - String x2=nexttoken(fr,true); - String y2=nexttoken(fr,true); - Rectangle r=new Rectangle(label,Integer.parseInt(x1),Integer.parseInt(y1), - Integer.parseInt(x2),Integer.parseInt(y2)); - rectangles.add(r); - } - break; - case'p': - { - nexttoken(fr,false); - String label=nexttoken(fr,false); - String x=nexttoken(fr,true); - String y=nexttoken(fr,true); - Point p=new Point(label,Integer.parseInt(x),Integer.parseInt(y)); - points.add(p); - } - break; - } - } - this.rectangles=(Rectangle[]) rectangles.toArray(new Rectangle[rectangles.size()]); - this.points=(Point[]) points.toArray(new Point[points.size()]); - } - - String nexttoken(java.io.InputStreamReader isr,boolean commas) { - String string=""; - int c=0; - boolean looped=false; - while(true) { - try { - c=isr.read(); - } catch (IOException e) { - e.printStackTrace(); - System.exit(-1); - } - if ((c==' ')||(c=='\n')||(commas&&c==',')) { - if (!looped) { - looped=true; - continue; - } - return string; - } - string=string+new String(new char[]{(char)c}); - looped=true; - } - } - -} - diff --git a/Robust/src/Interface/JhttpServer.java b/Robust/src/Interface/JhttpServer.java deleted file mode 100644 index 9cf67269..00000000 --- a/Robust/src/Interface/JhttpServer.java +++ /dev/null @@ -1,49 +0,0 @@ -package Interface; - -//**************************************************************************** -// Programmer: Duane M. Gran, ragnar@cs.bsu.edu -// Program: JhttpServer -// Date: April 24, 1998 -//**************************************************************************** - -import java.net.*; -import java.io.*; - -public class JhttpServer extends Thread{ - - private ServerSocket server; - private WebInterface webinterface; - -//**************************************************************************** -// Constructor: JhttpServer(int) -//**************************************************************************** - public JhttpServer(int port, WebInterface webinterface) - { - System.out.println("starting..."); - this.webinterface=webinterface; - try{ - System.out.println("creating the port"); - server = new ServerSocket(port); - } - catch (IOException e){ - System.err.println(e); - System.exit(1); - } - } - - private void startWorker(Socket client) throws Exception { - (new JhttpWorker(client,false,webinterface)).start(); - } - - public void run(){ - // infinite loop - while (true){ - try{ - startWorker(server.accept()); - } - catch (Exception e){ - System.err.println(e); - } - } - } -} diff --git a/Robust/src/Interface/JhttpWorker.java b/Robust/src/Interface/JhttpWorker.java deleted file mode 100644 index 4613422f..00000000 --- a/Robust/src/Interface/JhttpWorker.java +++ /dev/null @@ -1,191 +0,0 @@ -package Interface; -//**************************************************************************** -// Programmer: Duane M. Gran, ragnar@cs.bsu.edu -// Program: JhttpServer -// Date: April 24, 1998 -//**************************************************************************** - - -import java.net.*; -import java.io.*; -import java.util.*; - -//**************************************************************************** -// Class: JhttpWorker -// Purpose: Takes an HTTP request and executes it in a separate thread -//**************************************************************************** - -public class JhttpWorker extends Thread{ - public String fileName = null; - public String methodType = null; - public String httpVersion = "http/1.0"; - private Socket client; - public int fileLength, returnCode; - private boolean logging; - private WebInterface webinterface; - - public JhttpWorker(Socket client, boolean logging, WebInterface webinterface) { - this.client=client; - this.logging=logging; - this.webinterface=webinterface; - } - - public void run(){ - HTTPResponse resp = new HTTPResponse(); - - BufferedReader in = null; - OutputStream out = null; - - resp.returnCode = 200; - resp.sentBytes = 0; - - try { - - in = new BufferedReader( - new InputStreamReader( - client.getInputStream())); - - out = client.getOutputStream(); - } - catch(IOException e){ - // I'm not too good at HTTP. Normally, we should put some - // error code here. Anyway, I have assumed that an error - // is equivalent to an unhandled request / method (501) - resp.returnCode = 501; - } - - if(resp.returnCode == 200){ - // call the appropriate hanndler - switch(method(in)){ - - case 0: - if (webinterface.specialRequest(fileName)) { - String newfile=webinterface.handleresponse(fileName, out, resp); - if (newfile!=null) { - HTTPServices.GET_handler(newfile, out, resp); - } - } else - HTTPServices.GET_handler(fileName, out, resp); - break; - case 1: - HTTPServices.HEAD_handler(fileName, out, resp); - break; - case 2: - HTTPServices.POST_handler(fileName, out, resp); - break; - default: - resp.returnCode = 501; //error - } - - try{ - out.flush(); - if (logging) - LogFile.write_log(client,methodType,fileName,httpVersion, - resp.returnCode,resp.sentBytes); - - out.close(); - in.close(); - client.close(); - } - catch(IOException e){ - ; // do nothing - } - } - - // System.out.println(fileName + " is going to finish"); // debug - } - -//***************************************************************************** -// Function: method() -// Purpose: Open an InputStream and parse the request made. -// Note: Regardless of what method is requested, right now it performs a -// GET operation. -// Calls: -// Returns: Boolean value for success or failure -//***************************************************************************** - - private int method(BufferedReader in){ - int ret = -1; - - try{ - String line; - - // read just the first line - line = in.readLine(); - // only spaces used - StringTokenizer tok = new StringTokenizer(line, " "); - if (tok.hasMoreTokens()) // make sure there is a request - { - String str = tok.nextToken(); - - if ( str.equals("GET") ){ - ret = 0; - methodType = "GET"; - } - else if ( str.equals("HEAD") ){ - ret = 1; - methodType = "HEAD"; - } - else if ( str.equals("POST") ){ - ret = 2; - methodType = "POST"; - } - else{ - System.out.println("501 - unsupported request:" +str); - return -1; - } - } - else{ - // System.out.println("Request from browser was empty!"); - return -1; - } - - // get the filename - if (tok.hasMoreTokens()) - { - fileName = tok.nextToken(); - if(fileName.equals("/")) - { - fileName = "/index.html"; - } - } - else - { - // this is weird... why am i taking the first character of - // the filename if there are no more tokens? - // - catch should take care of this - fileName = fileName.substring(1); - } - - // read the http version number - // - right now nothing is done with this information - if (tok.hasMoreTokens()) - { - httpVersion = tok.nextToken(); - } - else - { - httpVersion = "http/1.0"; // default - } - - // read remainder of the browser's header - // - nothing done right now with this info... placeholder - while((line = in.readLine()) != null) - { - StringTokenizer token = new StringTokenizer(line," "); - - // do processing here - if(!token.hasMoreTokens()) - { - break; - } - } - } - catch(Exception e){ - System.err.println(e); - return -1; - } - - return ret; - } -} diff --git a/Robust/src/Interface/LogFile.java b/Robust/src/Interface/LogFile.java deleted file mode 100644 index 667b5489..00000000 --- a/Robust/src/Interface/LogFile.java +++ /dev/null @@ -1,73 +0,0 @@ -package Interface; -//**************************************************************************** -// Programmer: Duane M. Gran, ragnar@cs.bsu.edu -// Program: JhttpServer -// Date: April 24, 1998 -//**************************************************************************** - - - -import java.io.*; -import java.util.*; -import java.text.SimpleDateFormat; -import java.net.*; - -//**************************************************************************** -// Class: logFile -// Purpose: Handle the behavior for logging connections. The methods simply -// add to the private data fields. Has implementation for standard -// output, as well as output to file. -// -// An example log entry looks like: -// -// 1.2.3.4 - - [29/JAN/1998:21:40:30 -06] "GET /file.html HTTP/1.0" 200 472 -// -//**************************************************************************** - -public class LogFile -{ - static public final String log_file_name = "server.log"; - - static public String write_log(Socket s, String Method, String URI, - String Protocol, - int ReturnCode, long BytesSent){ - - // Socket.toString() calls (indirectly) some Hashtable.get - // method - I tool care of it! - - /* - String addr = s.toString(); - String Address = addr.substring(addr.indexOf('/') + 1, - addr.indexOf(',')); - */ - - // SimpleDateFormat sdf = - // new SimpleDateFormat("EEE, dd MMM yyyy HH:mm:ss zzz"); // RFC 1123 - // sdf.setTimeZone(TimeZone.getTimeZone("GMT")); - // String Date = sdf.format(new Date()); - - String Entry = - /* Address + */ " - - [" + // IP address - "Date" + "] \"" + // date - Method + " " + // get, post, head - URI + " " + // filename - Protocol + "\" " + // http/1.? - ReturnCode + " " + // 200-500 - BytesSent + "\n"; // bytes sent - - try{ - BufferedWriter out = new BufferedWriter( - new OutputStreamWriter( - new FileOutputStream(log_file_name, true))); - - out.write(Entry,0,Entry.length()); - out.flush(); - out.close(); - } - catch (IOException e){ - System.err.println("Gicu " + e); - } - - return Entry; - } -} diff --git a/Robust/src/Interface/WebInterface.java b/Robust/src/Interface/WebInterface.java deleted file mode 100644 index 17b71df4..00000000 --- a/Robust/src/Interface/WebInterface.java +++ /dev/null @@ -1,280 +0,0 @@ -package Interface; -import java.io.*; -import Analysis.TaskStateAnalysis.*; -import IR.*; -import java.util.*; -import Util.Namer; - -public class WebInterface { - TaskAnalysis taskanalysis; - TaskGraph taskgraph; - TagAnalysis taganalysis; - State state; - Hashtable flagstatemap; - Hashtable taskgraphmap; - Hashtable sourcenodemap; //to hold the filenames for each of the pages linked to the source nodes. - Hashtable taskmap; // to hold the filenames for each of the pages linked to tasks in the program. - GarbageAnalysis garbageanalysis; - - public WebInterface(State state, TaskAnalysis taskanalysis, TaskGraph taskgraph, GarbageAnalysis garbageanalysis, TagAnalysis taganalysis) { - this.state=state; - this.taskanalysis=taskanalysis; - this.taskgraph=taskgraph; - this.garbageanalysis=garbageanalysis; - this.taganalysis=taganalysis; - - flagstatemap=new Hashtable(); - taskgraphmap=new Hashtable(); - taskmap = new Hashtable(); - sourcenodemap=new Hashtable(); - - for(Iterator it_tasks=state.getTaskSymbolTable().getDescriptorsIterator();it_tasks.hasNext();){ - TaskDescriptor td=(TaskDescriptor)it_tasks.next(); - taskmap.put("/"+td.getSymbol()+".html",td); - } - - for(Iterator it_classes=state.getClassSymbolTable().getDescriptorsIterator();it_classes.hasNext();) { - ClassDescriptor cd=(ClassDescriptor) it_classes.next(); - if(cd.hasFlags()){ - Vector rootnodes=taskanalysis.getRootNodes(cd); - - if(rootnodes!=null) - for(Iterator it_rootnodes=rootnodes.iterator();it_rootnodes.hasNext();){ - FlagState root=(FlagState)it_rootnodes.next(); - Vector cd_nodeid=new Vector(); //Vector is designed to contain only 2 elements: ClassDescriptor,Node label - // Both the values are required to correctly resolve the rootnode. - // Should think of a better way to do this, instead of using a vector(maybe a class) - cd_nodeid.addElement(cd); //adding the ClassDescriptor - cd_nodeid.addElement(root.getLabel()); //adding the Node label - System.out.println(cd+" "+root.getLabel()); - sourcenodemap.put("/"+cd.getSymbol()+"_"+root.getLabel()+".html",cd_nodeid); - } - } - } - } - - public boolean specialRequest(String filename) { - System.out.println(filename); - if (filename.equals("/index.html")) - return true; - if (filename.equals("/UnifiedTaskGraph.html")) - return true; - if (flagstatemap.containsKey(filename)) - return true; - if (taskgraphmap.containsKey(filename)) - return true; - if (taskmap.containsKey(filename)) - return true; - if (sourcenodemap.containsKey(filename)) - return true; - return false; - } - - public String handleresponse(String filename, OutputStream out, HTTPResponse resp) { - if (filename.equals("/index.html")) - return indexpage(out, resp); - if (filename.equals("/UnifiedTaskGraph.html")) - return unifiedTaskGraph(out,resp); - if (flagstatemap.containsKey(filename)) - return flagstate((ClassDescriptor) flagstatemap.get(filename), out, resp); - if (taskgraphmap.containsKey(filename)) - return taskstate((ClassDescriptor) taskgraphmap.get(filename), out, resp); - if (taskmap.containsKey(filename)) - return task((TaskDescriptor)taskmap.get(filename),out,resp); - if (sourcenodemap.containsKey(filename)) - return sourcenode((Vector) sourcenodemap.get(filename), out, resp); - return "NORESP"; - } - - private String task(TaskDescriptor td, OutputStream out, HTTPResponse resp){ - try{ - PrintWriter pw=new PrintWriter(out); - pw.println("

    Task:   "+td.toString()+"


    "); - printTask(td,pw); - - //printing out the classes that are instantiated by this task - pw.println("

    Instantiated Classes:

    "); - Set newstates=taganalysis.getFlagStates(td); - for(Iterator fsit=newstates.iterator();fsit.hasNext();) { - FlagState fsnew=(FlagState) fsit.next(); - ClassDescriptor cd=fsnew.getClassDescriptor(); - pw.println("  "+cd.getSymbol()+"
    "); - pw.println("    "+fsnew.getTextLabel()+"
    "); - } - - pw.flush(); - } catch (Exception e) {e.printStackTrace();System.exit(-1);} - return null; - } - - private String printTask(TaskDescriptor td, PrintWriter pw){ - try{ - - for(int i=0; i < td.numParameters();i++){ - pw.println("FlagState Graph:  "+td.getParamType(i)+"
    "); - pw.println("Task Graph:        " - +td.getParamType(i)+"
    "); - } - pw.flush(); - }catch(Exception e) {e.printStackTrace();System.exit(-1);} - return null; - } - - private String sourcenode(Vector cd_nodeid,OutputStream out, HTTPResponse resp){ - Vector rootnodes=taskanalysis.getRootNodes((ClassDescriptor)cd_nodeid.elementAt(0)); - for(Iterator it_rootnodes=rootnodes.iterator();it_rootnodes.hasNext();){ - FlagState root=(FlagState)it_rootnodes.next(); - if (root.getLabel().equals((String)cd_nodeid.elementAt(1))){ - try{ - PrintWriter pw=new PrintWriter(out); - pw.println("

    Allocating tasks for "+root.getTextLabel()+":


    "); - Vector tasks=root.getAllocatingTasks(); - for(Iterator it_tasks=tasks.iterator();it_tasks.hasNext();){ - TaskDescriptor td=(TaskDescriptor)it_tasks.next(); - pw.println("
    Task:   "+td.toString()+"
    "); - printTask(td,pw); - } - - } catch (Exception e) {e.printStackTrace();System.exit(-1);} - break; - } - - } - return null; - } - - private String flagstate(ClassDescriptor cd, OutputStream out, HTTPResponse resp) { - Set objects=taskanalysis.getFlagStates(cd); - File file=new File(cd.getSymbol()+".dot"); - File mapfile; - String str; - Vector namers=new Vector(); - namers.add(new Namer()); - namers.add(garbageanalysis); - namers.add(new Allocations()); - namers.add(new TaskEdges()); - try { - //Generate jpg - Runtime r=Runtime.getRuntime(); - - FileOutputStream dotstream=new FileOutputStream(file,false); - FlagState.DOTVisitor.visit(dotstream, objects, namers); - dotstream.close(); - Process p=r.exec("dot -Tcmapx -o"+cd.getSymbol()+".map -Tjpg -o"+cd.getSymbol()+".jpg "+cd.getSymbol()+".dot"); - p.waitFor(); - p=r.exec("dot -Tps "+cd.getSymbol()+".dot -o"+cd.getSymbol()+".ps"); - p.waitFor(); - - mapfile=new File(cd.getSymbol()+".map"); - BufferedReader mapbr=new BufferedReader(new FileReader(mapfile)); - PrintWriter pw=new PrintWriter(out); - pw.println("ps
    "); - //pw.println(""); - pw.println(""); - while((str=mapbr.readLine())!=null){ - pw.println(str); - } - - pw.flush(); - } catch (Exception e) {e.printStackTrace();System.exit(-1);} - return null; - } - - private String taskstate(ClassDescriptor cd, OutputStream out, HTTPResponse resp) { - Set objects=taskgraph.getTaskNodes(cd); - File file=new File(cd.getSymbol()+"-t.dot"); - File mapfile; - String str; - Vector namers=new Vector(); - namers.add(new Namer()); - namers.add(new TaskNodeNamer()); - - try { - //Generate jpg - Runtime r=Runtime.getRuntime(); - FileOutputStream dotstream=new FileOutputStream(file,false); - FlagState.DOTVisitor.visit(dotstream, objects,namers); - dotstream.close(); - Process p=r.exec("dot -Tcmapx -o"+cd.getSymbol()+"-t.map -Tjpg -o"+cd.getSymbol()+"-t.jpg "+cd.getSymbol()+"-t.dot"); - p.waitFor(); - p=r.exec("dot -Tps "+cd.getSymbol()+".dot -o"+cd.getSymbol()+"-t.ps"); - - p.waitFor(); - - mapfile=new File(cd.getSymbol()+"-t.map"); - BufferedReader mapbr=new BufferedReader(new FileReader(mapfile)); - PrintWriter pw=new PrintWriter(out); - pw.println("ps
    "); - // pw.println(""); - pw.println(""); - - while((str=mapbr.readLine())!=null){ - pw.println(str); - } - pw.flush(); - } catch (Exception e) {e.printStackTrace();System.exit(-1);} - return null; - } - - /* public void taskgraph( -*/ - - private String indexpage(OutputStream out, HTTPResponse resp) { - - PrintWriter pw=new PrintWriter(out); - for(Iterator it_classes=state.getClassSymbolTable().getDescriptorsIterator();it_classes.hasNext();) { - ClassDescriptor cd=(ClassDescriptor) it_classes.next(); - if (cd.hasFlags()){ - if (taskanalysis.getFlagStates(cd)!=null) { - pw.println(""+ cd.getSymbol() +""); - pw.println("
    "); - flagstatemap.put("/"+cd.getSymbol()+".html", cd); - } - if (taskgraph.getTaskNodes(cd)!=null) { - pw.println("Task Graph "+ cd.getSymbol() +""); - pw.println("
    "); - taskgraphmap.put("/"+cd.getSymbol()+"-t.html", cd); - } - } - } - pw.println("

    Program flow"); - pw.flush(); - return null; - } - - private String unifiedTaskGraph(OutputStream out, HTTPResponse resp){ - Set objects=taskgraph.getAllTaskNodes(); - File file=new File("UnifiedTaskGraph.dot"); - String str; - Vector namers=new Vector(); - namers.add(new Namer()); - namers.add(new TaskNodeNamer()); - - try { - //Generate jpg - Runtime r=Runtime.getRuntime(); - FileOutputStream dotstream=new FileOutputStream(file,false); - FlagState.DOTVisitor.visit(dotstream, objects, namers); - dotstream.close(); - Process p=r.exec("dot -Tjpg -oUnifiedTaskGraph.jpg -Tcmapx -oUnifiedTaskGraph.map UnifiedTaskGraph.dot"); - p.waitFor(); - p=r.exec("dot -Tps UnifiedTaskGraph.dot -oUnifiedTaskGraph.ps"); - - p.waitFor(); - - File mapfile=new File("UnifiedTaskGraph.map"); - BufferedReader mapbr=new BufferedReader(new FileReader(mapfile)); - PrintWriter pw=new PrintWriter(out); - pw.println("ps
    "); - // pw.println(""); - pw.println(""); - - while((str=mapbr.readLine())!=null) - pw.println(str); - - pw.flush(); - } catch (Exception e) {e.printStackTrace();System.exit(-1);} - return null; - } - -} diff --git a/Robust/src/Lex/BooleanLiteral.java b/Robust/src/Lex/BooleanLiteral.java deleted file mode 100644 index f013e641..00000000 --- a/Robust/src/Lex/BooleanLiteral.java +++ /dev/null @@ -1,13 +0,0 @@ -package Lex; - -import java_cup.runtime.Symbol; -import Parse.Sym; - -class BooleanLiteral extends Literal { - Boolean val; - BooleanLiteral(boolean b) { this.val = new Boolean(b); } - - Symbol token() { return new Symbol(Sym.BOOLEAN_LITERAL, val); } - - public String toString() { return "BooleanLiteral <"+val.toString()+">"; } -} diff --git a/Robust/src/Lex/CharacterLiteral.java b/Robust/src/Lex/CharacterLiteral.java deleted file mode 100644 index 87596f80..00000000 --- a/Robust/src/Lex/CharacterLiteral.java +++ /dev/null @@ -1,15 +0,0 @@ -package Lex; - -import java_cup.runtime.Symbol; -import Parse.Sym; - -class CharacterLiteral extends Literal { - Character val; - CharacterLiteral(char c) { this.val = new Character(c); } - - Symbol token() { return new Symbol(Sym.CHARACTER_LITERAL, val); } - - public String toString() { - return "CharacterLiteral <"+Token.escape(val.toString())+">"; - } -} diff --git a/Robust/src/Lex/Comment.java b/Robust/src/Lex/Comment.java deleted file mode 100644 index 6a0aae4b..00000000 --- a/Robust/src/Lex/Comment.java +++ /dev/null @@ -1,26 +0,0 @@ -package Lex; - -abstract class Comment extends InputElement { - private StringBuffer comment = new StringBuffer(); - - String getComment() { return comment.toString(); } - - void appendLine(String more) { // 'more' is '\n' terminated. - int i=0; - - // skip leading white space. - for (; i - * This program is released under the terms of the GPL; see the file - * COPYING for more details. There is NO WARRANTY on this code. - */ - -class FIFO { - java_cup.runtime.Symbol[] backing = new java_cup.runtime.Symbol[10]; - int start=0, end=0; - final Getter getter; - FIFO(Getter getter) { this.getter = getter; } - public boolean isEmpty() { return start==end; } - private boolean isFull() { - return start==end+1 || (start==0 && end==backing.length-1); - } - private int size() { - return ((end= size()) - put(getter.next()); - int index = start+i; - if (index >= backing.length) index -= backing.length; - ASSERT(0<= index && index < backing.length); - return backing[index]; - } - abstract static class Getter { - abstract java_cup.runtime.Symbol next() - throws java.io.IOException; - } - private static void ASSERT(boolean b) { - if (!b) throw new RuntimeException(); - } -} - - diff --git a/Robust/src/Lex/FloatLiteral.java b/Robust/src/Lex/FloatLiteral.java deleted file mode 100644 index 99abf527..00000000 --- a/Robust/src/Lex/FloatLiteral.java +++ /dev/null @@ -1,10 +0,0 @@ -package Lex; - -import java_cup.runtime.Symbol; -import Parse.Sym; - -class FloatLiteral extends NumericLiteral { - FloatLiteral(float f) { this.val = new Float(f); } - - Symbol token() { return new Symbol(Sym.FLOATING_POINT_LITERAL, val); } -} diff --git a/Robust/src/Lex/Identifier.java b/Robust/src/Lex/Identifier.java deleted file mode 100644 index 1dcf0530..00000000 --- a/Robust/src/Lex/Identifier.java +++ /dev/null @@ -1,18 +0,0 @@ -package Lex; - -import java_cup.runtime.Symbol; -import Parse.Sym; - -public class Identifier extends Token { - String identifier; - public Identifier(String identifier) { this.identifier=identifier; } - - public String toString() { return "Identifier <"+identifier+">"; } - - /* Ben Walter correctly pointed out that - * the first released version of this grammar/lexer did not - * return the string value of the identifier in the parser token. - * Should be fixed now. ;-) - */ - Symbol token() { return new Symbol(Sym.IDENTIFIER, identifier); } -} diff --git a/Robust/src/Lex/InputElement.java b/Robust/src/Lex/InputElement.java deleted file mode 100644 index 11858266..00000000 --- a/Robust/src/Lex/InputElement.java +++ /dev/null @@ -1,3 +0,0 @@ -package Lex; - -abstract class InputElement {} diff --git a/Robust/src/Lex/IntegerLiteral.java b/Robust/src/Lex/IntegerLiteral.java deleted file mode 100644 index ba3e4ee3..00000000 --- a/Robust/src/Lex/IntegerLiteral.java +++ /dev/null @@ -1,10 +0,0 @@ -package Lex; - -import java_cup.runtime.Symbol; -import Parse.Sym; - -class IntegerLiteral extends NumericLiteral { - IntegerLiteral(int i) { this.val = new Integer(i); } - - Symbol token() { return new Symbol(Sym.INTEGER_LITERAL, val); } -} diff --git a/Robust/src/Lex/Keyword.java b/Robust/src/Lex/Keyword.java deleted file mode 100644 index f39079a1..00000000 --- a/Robust/src/Lex/Keyword.java +++ /dev/null @@ -1,79 +0,0 @@ -package Lex; - -import java.util.Hashtable; -import java_cup.runtime.Symbol; -import Parse.Sym; - -class Keyword extends Token { - String keyword; - Keyword(String s) { keyword = s; } - - Symbol token() { - Integer i = (Integer) key_table.get(keyword); - return new Symbol(i.intValue()); - } - public String toString() { return "Keyword <"+keyword+">"; } - - static private final Hashtable key_table = new Hashtable(); - static { - key_table.put("abstract", new Integer(Sym.ABSTRACT)); - key_table.put("assert", new Integer(Sym.ASSERT)); - key_table.put("boolean", new Integer(Sym.BOOLEAN)); - key_table.put("break", new Integer(Sym.BREAK)); - key_table.put("byte", new Integer(Sym.BYTE)); - key_table.put("case", new Integer(Sym.CASE)); - key_table.put("catch", new Integer(Sym.CATCH)); - key_table.put("char", new Integer(Sym.CHAR)); - key_table.put("class", new Integer(Sym.CLASS)); - key_table.put("const", new Integer(Sym.CONST)); - key_table.put("continue", new Integer(Sym.CONTINUE)); - key_table.put("default", new Integer(Sym.DEFAULT)); - key_table.put("do", new Integer(Sym.DO)); - key_table.put("double", new Integer(Sym.DOUBLE)); - key_table.put("else", new Integer(Sym.ELSE)); - key_table.put("enum", new Integer(Sym.ENUM)); - key_table.put("extends", new Integer(Sym.EXTENDS)); - key_table.put("final", new Integer(Sym.FINAL)); - key_table.put("finally", new Integer(Sym.FINALLY)); - key_table.put("float", new Integer(Sym.FLOAT)); - key_table.put("for", new Integer(Sym.FOR)); - key_table.put("goto", new Integer(Sym.GOTO)); - key_table.put("if", new Integer(Sym.IF)); - key_table.put("import", new Integer(Sym.IMPORT)); - key_table.put("instanceof", new Integer(Sym.INSTANCEOF)); - key_table.put("int", new Integer(Sym.INT)); - key_table.put("isavailable", new Integer(Sym.ISAVAILABLE)); - key_table.put("long", new Integer(Sym.LONG)); - key_table.put("native", new Integer(Sym.NATIVE)); - key_table.put("new", new Integer(Sym.NEW)); - key_table.put("package", new Integer(Sym.PACKAGE)); - key_table.put("private", new Integer(Sym.PRIVATE)); - key_table.put("protected", new Integer(Sym.PROTECTED)); - key_table.put("public", new Integer(Sym.PUBLIC)); - key_table.put("return", new Integer(Sym.RETURN)); - key_table.put("short", new Integer(Sym.SHORT)); - key_table.put("static", new Integer(Sym.STATIC)); - key_table.put("strictfp", new Integer(Sym.STRICTFP)); - key_table.put("super", new Integer(Sym.SUPER)); - key_table.put("switch", new Integer(Sym.SWITCH)); - key_table.put("synchronized", new Integer(Sym.SYNCHRONIZED)); - key_table.put("this", new Integer(Sym.THIS)); - key_table.put("throw", new Integer(Sym.THROW)); - key_table.put("throws", new Integer(Sym.THROWS)); - key_table.put("transient", new Integer(Sym.TRANSIENT)); - key_table.put("try", new Integer(Sym.TRY)); - key_table.put("void", new Integer(Sym.VOID)); - key_table.put("volatile", new Integer(Sym.VOLATILE)); - key_table.put("while", new Integer(Sym.WHILE)); - //Keywords for failure aware computation - key_table.put("flag", new Integer(Sym.FLAG)); - key_table.put("external", new Integer(Sym.EXTERNAL)); - key_table.put("optional", new Integer(Sym.OPTIONAL)); - key_table.put("tag", new Integer(Sym.TAG)); - key_table.put("task", new Integer(Sym.TASK)); - key_table.put("taskexit", new Integer(Sym.TASKEXIT)); - //Keywords for transactions - key_table.put("atomic", new Integer(Sym.ATOMIC)); - key_table.put("global", new Integer(Sym.GLOBAL)); - } -} diff --git a/Robust/src/Lex/Lexer.java b/Robust/src/Lex/Lexer.java deleted file mode 100644 index 1d7e4610..00000000 --- a/Robust/src/Lex/Lexer.java +++ /dev/null @@ -1,522 +0,0 @@ -package Lex; - -import java.io.Reader; -import java.io.LineNumberReader; -import Parse.Sym; - -/* Java lexer. - * Copyright (C) 2002 C. Scott Ananian - * This program is released under the terms of the GPL; see the file - * COPYING for more details. There is NO WARRANTY on this code. - */ - -public class Lexer { - LineNumberReader reader; - boolean isJava12; - boolean isJava14; - boolean isJava15; - String line = null; - int line_pos = 1; - int line_num = 0; - LineList lineL = new LineList(-line_pos, null); // sentinel for line #0 - - public Lexer(Reader reader) { - this.reader = new LineNumberReader(new EscapedUnicodeReader(reader)); - this.isJava12 = true; - this.isJava14 = true; - } - - public java_cup.runtime.Symbol nextToken() throws java.io.IOException { - java_cup.runtime.Symbol sym = - lookahead==null ? _nextToken() : lookahead.get(); - last = sym; - return sym; - } - private boolean shouldBePLT() throws java.io.IOException { - // look ahead to see if this LT should be changed to a PLT - if (last==null || last.sym!=Sym.IDENTIFIER) - return false; - if (lookahead==null) lookahead = new FIFO(new FIFO.Getter() { - java_cup.runtime.Symbol next() throws java.io.IOException - { return _nextToken(); } - }); - int i=0; - // skip past IDENTIFIER (DOT IDENTIFIER)* - if (lookahead.peek(i++).sym != Sym.IDENTIFIER) - return false; - while (lookahead.peek(i).sym == Sym.DOT) { - i++; - if (lookahead.peek(i++).sym != Sym.IDENTIFIER) - return false; - } - // skip past (LBRACK RBRACK)* - while (lookahead.peek(i).sym == Sym.LBRACK) { - i++; - if (lookahead.peek(i++).sym != Sym.RBRACK) - return false; - } - // now the next sym has to be one of LT GT COMMA EXTENDS IMPLEMENTS - switch(lookahead.peek(i).sym) { - default: - return false; - case Sym.LT: - case Sym.GT: - case Sym.COMMA: - case Sym.EXTENDS: - return true; - } - } - private java_cup.runtime.Symbol last = null; - private FIFO lookahead = null; - public java_cup.runtime.Symbol _nextToken() throws java.io.IOException { - /* tokens are: - * Identifiers/Keywords/true/false/null (start with java letter) - * numeric literal (start with number) - * character literal (start with single quote) - * string (start with double quote) - * separator (parens, braces, brackets, semicolon, comma, period) - * operator (equals, plus, minus, etc) - * whitespace - * comment (start with slash) - */ - InputElement ie; - int startpos, endpos; - do { - startpos = lineL.head + line_pos; - ie = getInputElement(); - if (ie instanceof DocumentationComment) - comment = ((Comment)ie).getComment(); - } while (!(ie instanceof Token)); - endpos = lineL.head + line_pos - 1; - - // System.out.println(ie.toString()); // uncomment to debug lexer. - java_cup.runtime.Symbol sym = ((Token)ie).token(); - // fix up left/right positions. - sym.left = startpos; sym.right = endpos; - // return token. - return sym; - } - public boolean debug_lex() throws java.io.IOException { - InputElement ie = getInputElement(); - System.out.println(ie); - return !(ie instanceof EOF); - } - - String comment; - public String lastComment() { return comment; } - public void clearComment() { comment=""; } - - InputElement getInputElement() throws java.io.IOException { - if (line_num == 0) - nextLine(); - if (line==null) - return new EOF(); - if (line.length()<=line_pos) { // end of line. - nextLine(); - if (line==null) - return new EOF(); - } - - switch (line.charAt(line_pos)) { - - // White space: - case ' ': // ASCII SP - case '\t': // ASCII HT - case '\f': // ASCII FF - case '\n': // LineTerminator - return new WhiteSpace(consume()); - - // EOF character: - case '\020': // ASCII SUB - consume(); - return new EOF(); - - // Comment prefix: - case '/': - return getComment(); - - // else, a Token - default: - return getToken(); - } - } - // May get Token instead of Comment. - InputElement getComment() throws java.io.IOException { - String comment; - // line.charAt(line_pos+0) is '/' - switch (line.charAt(line_pos+1)) { - case '/': // EndOfLineComment - comment = line.substring(line_pos+2); - line_pos = line.length(); - return new EndOfLineComment(comment); - case '*': // TraditionalComment or DocumentationComment - line_pos += 2; - if (line.charAt(line_pos)=='*') { // DocumentationComment - return snarfComment(new DocumentationComment()); - } else { // TraditionalComment - return snarfComment(new TraditionalComment()); - } - default: // it's a token, not a comment. - return getToken(); - } - } - - Comment snarfComment(Comment c) throws java.io.IOException { - StringBuffer text=new StringBuffer(); - while(true) { // Grab CommentTail - while (line.charAt(line_pos)!='*') { // Add NotStar to comment. - int star_pos = line.indexOf('*', line_pos); - if (star_pos<0) { - text.append(line.substring(line_pos)); - c.appendLine(text.toString()); text.setLength(0); - line_pos = line.length(); - nextLine(); - if (line==null) - throw new Error("Unterminated comment at end of file."); - } else { - text.append(line.substring(line_pos, star_pos)); - line_pos=star_pos; - } - } - // At this point, line.charAt(line_pos)=='*' - // Grab CommentTailStar starting at line_pos+1. - if (line.charAt(line_pos+1)=='/') { // safe because line ends with '\n' - c.appendLine(text.toString()); line_pos+=2; return c; - } - text.append(line.charAt(line_pos++)); // add the '*' - } - } - - Token getToken() { - // Tokens are: Identifiers, Keywords, Literals, Separators, Operators. - switch (line.charAt(line_pos)) { - // Separators: (period is a special case) - case '(': - case ')': - case '{': - case '}': - case '[': - case ']': - case ';': - case ',': - return new Separator(consume()); - - // Operators: - case '=': - case '>': - case '<': - case '!': - case '~': - case '?': - case ':': - case '&': - case '|': - case '+': - case '-': - case '*': - case '/': - case '^': - case '%': - return getOperator(); - case '\'': - return getCharLiteral(); - case '\"': - return getStringLiteral(); - - // a period is a special case: - case '.': - if (Character.digit(line.charAt(line_pos+1),10)!=-1) - return getNumericLiteral(); - else if (isJava15 && - line.charAt(line_pos+1)=='.' && - line.charAt(line_pos+2)=='.') { - consume(); consume(); consume(); - return new Separator('\u2026'); // unicode ellipsis character. - } else return new Separator(consume()); - default: - break; - } - if (Character.isJavaIdentifierStart(line.charAt(line_pos))) - return getIdentifier(); - if (Character.isDigit(line.charAt(line_pos))) - return getNumericLiteral(); - throw new Error("Illegal character on line "+line_num); - } - - static final String[] keywords = new String[] { - "abstract", "assert", "atomic", "boolean", "break", "byte", "case", "catch", "char", - "class", "const", "continue", "default", "do", "double", "else", "enum", - "extends", "external", "final", "finally", - "flag", //keyword for failure aware computation - "float", "for", "global", "goto", "if", - "implements", "import", "instanceof", "int", "interface", "isavailable", - "long", - "native", "new", "optional", "package", "private", "protected", "public", - "return", "short", "static", "strictfp", "super", "switch", "synchronized", - "tag", "task", "taskexit", //keywords for failure aware computation - "this", "throw", "throws", "transient", "try", "void", - "volatile", "while"}; - Token getIdentifier() { - // Get id string. - StringBuffer sb = new StringBuffer().append(consume()); - - if (!Character.isJavaIdentifierStart(sb.charAt(0))) - throw new Error("Invalid Java Identifier on line "+line_num); - while (Character.isJavaIdentifierPart(line.charAt(line_pos))) - sb.append(consume()); - String s = sb.toString(); - // Now check against boolean literals and null literal. - if (s.equals("null")) return new NullLiteral(); - if (s.equals("true")) return new BooleanLiteral(true); - if (s.equals("false")) return new BooleanLiteral(false); - // Check against keywords. - // pre-java 1.5 compatibility: - if (!isJava15 && s.equals("enum")) return new Identifier(s); - // pre-java 1.4 compatibility: - if (!isJava14 && s.equals("assert")) return new Identifier(s); - // pre-java 1.2 compatibility: - if (!isJava12 && s.equals("strictfp")) return new Identifier(s); - // use binary search. - for (int l=0, r=keywords.length; r > l; ) { - int x = (l+r)/2, cmp = s.compareTo(keywords[x]); - if (cmp < 0) r=x; else l=x+1; - if (cmp== 0) return new Keyword(s); - } - // not a keyword. - return new Identifier(s); - } - NumericLiteral getNumericLiteral() { - int i; - // leading decimal indicates float. - if (line.charAt(line_pos)=='.') - return getFloatingPointLiteral(); - // 0x indicates Hex. - if (line.charAt(line_pos)=='0' && - (line.charAt(line_pos+1)=='x' || - line.charAt(line_pos+1)=='X')) { - line_pos+=2; return getIntegerLiteral(/*base*/16); - } - // otherwise scan to first non-numeric - for (i=line_pos; Character.digit(line.charAt(i),10)!=-1; ) - i++; - switch(line.charAt(i)) { // discriminate based on first non-numeric - case '.': - case 'f': - case 'F': - case 'd': - case 'D': - case 'e': - case 'E': - return getFloatingPointLiteral(); - case 'L': - case 'l': - default: - if (line.charAt(line_pos)=='0') - return getIntegerLiteral(/*base*/8); - return getIntegerLiteral(/*base*/10); - } - } - NumericLiteral getIntegerLiteral(int radix) { - long val=0; - while (Character.digit(line.charAt(line_pos),radix)!=-1) - val = (val*radix) + Character.digit(consume(),radix); - if (line.charAt(line_pos) == 'l' || - line.charAt(line_pos) == 'L') { - consume(); - return new LongLiteral(val); - } - // we compare MAX_VALUE against val/2 to allow constants like - // 0xFFFF0000 to get past the test. (unsigned long->signed int) - if ((val/2) > Integer.MAX_VALUE || - val < Integer.MIN_VALUE) - throw new Error("Constant does not fit in integer on line "+line_num); - return new IntegerLiteral((int)val); - } - NumericLiteral getFloatingPointLiteral() { - String rep = getDigits(); - if (line.charAt(line_pos)=='.') - rep+=consume() + getDigits(); - if (line.charAt(line_pos)=='e' || - line.charAt(line_pos)=='E') { - rep+=consume(); - if (line.charAt(line_pos)=='+' || - line.charAt(line_pos)=='-') - rep+=consume(); - rep+=getDigits(); - } - try { - switch (line.charAt(line_pos)) { - case 'f': - case 'F': - consume(); - return new FloatLiteral(Float.valueOf(rep).floatValue()); - case 'd': - case 'D': - consume(); - /* falls through */ - default: - return new DoubleLiteral(Double.valueOf(rep).doubleValue()); - } - } catch (NumberFormatException e) { - throw new Error("Illegal floating-point on line "+line_num+": "+e); - } - } - String getDigits() { - StringBuffer sb = new StringBuffer(); - while (Character.digit(line.charAt(line_pos),10)!=-1) - sb.append(consume()); - return sb.toString(); - } - - Operator getOperator() { - char first = consume(); - char second= line.charAt(line_pos); - - switch(first) { - // single-character operators. - case '~': - case '?': - case ':': - return new Operator(new String(new char[] {first})); - // doubled operators - case '+': - case '-': - case '&': - case '|': - if (first==second) - return new Operator(new String(new char[] {first, consume()})); - default: - break; - } - // Check for trailing '=' - if (second=='=') - return new Operator(new String(new char[] {first, consume()})); - - // Special-case '<<', '>>' and '>>>' - if ((first=='<' && second=='<') || // << - (first=='>' && second=='>')) { // >> - String op = new String(new char[] {first, consume()}); - if (first=='>' && line.charAt(line_pos)=='>') // >>> - op += consume(); - if (line.charAt(line_pos)=='=') // <<=, >>=, >>>= - op += consume(); - return new Operator(op); - } - - // Otherwise return single operator. - return new Operator(new String(new char[] {first})); - } - - CharacterLiteral getCharLiteral() { - char firstquote = consume(); - char val; - switch (line.charAt(line_pos)) { - case '\\': - val = getEscapeSequence(); - break; - case '\'': - throw new Error("Invalid character literal on line "+line_num); - case '\n': - throw new Error("Invalid character literal on line "+line_num); - default: - val = consume(); - break; - } - char secondquote = consume(); - if (firstquote != '\'' || secondquote != '\'') - throw new Error("Invalid character literal on line "+line_num); - return new CharacterLiteral(val); - } - StringLiteral getStringLiteral() { - char openquote = consume(); - StringBuffer val = new StringBuffer(); - while (line.charAt(line_pos)!='\"') { - switch(line.charAt(line_pos)) { - case '\\': - val.append(getEscapeSequence()); - break; - case '\n': - throw new Error("Invalid string literal on line " + line_num); - default: - val.append(consume()); - break; - } - } - char closequote = consume(); - if (openquote != '\"' || closequote != '\"') - throw new Error("Invalid string literal on line " + line_num); - - return new StringLiteral(val.toString().intern()); - } - - char getEscapeSequence() { - if (consume() != '\\') - throw new Error("Invalid escape sequence on line " + line_num); - switch(line.charAt(line_pos)) { - case 'b': - consume(); return '\b'; - case 't': - consume(); return '\t'; - case 'n': - consume(); return '\n'; - case 'f': - consume(); return '\f'; - case 'r': - consume(); return '\r'; - case '\"': - consume(); return '\"'; - case '\'': - consume(); return '\''; - case '\\': - consume(); return '\\'; - case '0': - case '1': - case '2': - case '3': - return (char) getOctal(3); - case '4': - case '5': - case '6': - case '7': - return (char) getOctal(2); - default: - throw new Error("Invalid escape sequence on line " + line_num); - } - } - int getOctal(int maxlength) { - int i, val=0; - for (i=0; i0xFF)) // impossible. - throw new Error("Invalid octal escape sequence in line " + line_num); - return val; - } - - char consume() { return line.charAt(line_pos++); } - void nextLine() throws java.io.IOException { - line=reader.readLine(); - if (line!=null) line=line+'\n'; - lineL = new LineList(lineL.head+line_pos, lineL); // for error reporting - line_pos=0; - line_num++; - } - - // Deal with error messages. - public void errorMsg(String msg, java_cup.runtime.Symbol info) { - int n=line_num, c=info.left-lineL.head; - for (LineList p = lineL; p!=null; p=p.tail, n--) - if (p.head<=info.left) { c=info.left-p.head; break; } - System.err.println(msg+" at line "+n); - num_errors++; - } - private int num_errors = 0; - public int numErrors() { return num_errors; } - - class LineList { - int head; - LineList tail; - LineList(int head, LineList tail) { this.head = head; this.tail = tail; } - } -} diff --git a/Robust/src/Lex/Literal.java b/Robust/src/Lex/Literal.java deleted file mode 100644 index e9a50cfe..00000000 --- a/Robust/src/Lex/Literal.java +++ /dev/null @@ -1,3 +0,0 @@ -package Lex; - -abstract class Literal extends Token { } diff --git a/Robust/src/Lex/LongLiteral.java b/Robust/src/Lex/LongLiteral.java deleted file mode 100644 index 25090aef..00000000 --- a/Robust/src/Lex/LongLiteral.java +++ /dev/null @@ -1,10 +0,0 @@ -package Lex; - -import java_cup.runtime.Symbol; -import Parse.Sym; - -class LongLiteral extends NumericLiteral { - LongLiteral(long l) { this.val = new Long(l); } - - Symbol token() { return new Symbol(Sym.INTEGER_LITERAL, val); } -} diff --git a/Robust/src/Lex/NullLiteral.java b/Robust/src/Lex/NullLiteral.java deleted file mode 100644 index 20e69994..00000000 --- a/Robust/src/Lex/NullLiteral.java +++ /dev/null @@ -1,12 +0,0 @@ -package Lex; - -import java_cup.runtime.Symbol; -import Parse.Sym; - -class NullLiteral extends Literal { - NullLiteral() { } - - Symbol token() { return new Symbol(Sym.NULL_LITERAL); } - - public String toString() { return "NullLiteral "; } -} diff --git a/Robust/src/Lex/NumericLiteral.java b/Robust/src/Lex/NumericLiteral.java deleted file mode 100644 index f67a135a..00000000 --- a/Robust/src/Lex/NumericLiteral.java +++ /dev/null @@ -1,7 +0,0 @@ -package Lex; - -abstract class NumericLiteral extends Literal { - Number val; - - public String toString() { return "NumericLiteral <"+val.toString()+">"; } -} diff --git a/Robust/src/Lex/Operator.java b/Robust/src/Lex/Operator.java deleted file mode 100644 index e1b26daf..00000000 --- a/Robust/src/Lex/Operator.java +++ /dev/null @@ -1,58 +0,0 @@ -package Lex; - -import java.util.Hashtable; -import java_cup.runtime.Symbol; -import Parse.Sym; - -class Operator extends Token { - String which; - Operator(String which) { this.which = which; } - - public String toString() { return "Operator <"+which+">"; } - - Symbol token() { - Integer i = (Integer) op_table.get(which); - return new Symbol(i.intValue()); - } - - static private final Hashtable op_table = new Hashtable(); - static { - op_table.put("=", new Integer(Sym.EQ)); - op_table.put(">", new Integer(Sym.GT)); - op_table.put("<", new Integer(Sym.LT)); - op_table.put("!", new Integer(Sym.NOT)); - op_table.put("~", new Integer(Sym.COMP)); - op_table.put("?", new Integer(Sym.QUESTION)); - op_table.put(":", new Integer(Sym.COLON)); - op_table.put("==", new Integer(Sym.EQEQ)); - op_table.put("<=", new Integer(Sym.LTEQ)); - op_table.put(">=", new Integer(Sym.GTEQ)); - op_table.put("!=", new Integer(Sym.NOTEQ)); - op_table.put("&&", new Integer(Sym.ANDAND)); - op_table.put("||", new Integer(Sym.OROR)); - op_table.put("++", new Integer(Sym.PLUSPLUS)); - op_table.put("--", new Integer(Sym.MINUSMINUS)); - op_table.put("+", new Integer(Sym.PLUS)); - op_table.put("-", new Integer(Sym.MINUS)); - op_table.put("*", new Integer(Sym.MULT)); - op_table.put("/", new Integer(Sym.DIV)); - op_table.put("&", new Integer(Sym.AND)); - op_table.put("|", new Integer(Sym.OR)); - op_table.put("^", new Integer(Sym.XOR)); - op_table.put("%", new Integer(Sym.MOD)); - op_table.put("<<", new Integer(Sym.LSHIFT)); - op_table.put(">>", new Integer(Sym.RSHIFT)); - op_table.put(">>>", new Integer(Sym.URSHIFT)); - op_table.put("+=", new Integer(Sym.PLUSEQ)); - op_table.put("-=", new Integer(Sym.MINUSEQ)); - op_table.put("*=", new Integer(Sym.MULTEQ)); - op_table.put("/=", new Integer(Sym.DIVEQ)); - op_table.put("&=", new Integer(Sym.ANDEQ)); - op_table.put("|=", new Integer(Sym.OREQ)); - op_table.put("^=", new Integer(Sym.XOREQ)); - op_table.put("%=", new Integer(Sym.MODEQ)); - op_table.put("<<=", new Integer(Sym.LSHIFTEQ)); - op_table.put(">>=", new Integer(Sym.RSHIFTEQ)); - op_table.put(">>>=", new Integer(Sym.URSHIFTEQ)); - } -} diff --git a/Robust/src/Lex/Separator.java b/Robust/src/Lex/Separator.java deleted file mode 100644 index 6a553bfd..00000000 --- a/Robust/src/Lex/Separator.java +++ /dev/null @@ -1,30 +0,0 @@ -package Lex; - -import java_cup.runtime.Symbol; -import Parse.Sym; - -class Separator extends Token { - char which; - Separator(char which) { this.which = which; } - - Symbol token() { - switch(which) { - case '(': return new Symbol(Sym.LPAREN); - case ')': return new Symbol(Sym.RPAREN); - case '{': return new Symbol(Sym.LBRACE); - case '}': return new Symbol(Sym.RBRACE); - case '[': return new Symbol(Sym.LBRACK); - case ']': return new Symbol(Sym.RBRACK); - case ';': return new Symbol(Sym.SEMICOLON); - case ',': return new Symbol(Sym.COMMA); - case '.': return new Symbol(Sym.DOT); - case '\u2026': return new Symbol(Sym.ELLIPSIS); - default: - throw new Error("Invalid separator."); - } - } - - public String toString() { - return "Separator <"+which+">"; - } -} diff --git a/Robust/src/Lex/StringLiteral.java b/Robust/src/Lex/StringLiteral.java deleted file mode 100644 index c4830203..00000000 --- a/Robust/src/Lex/StringLiteral.java +++ /dev/null @@ -1,15 +0,0 @@ -package Lex; - -import java_cup.runtime.Symbol; -import Parse.Sym; - -class StringLiteral extends Literal { - String val; - StringLiteral(String s) { this.val = s; } - - Symbol token() { return new Symbol(Sym.STRING_LITERAL, val); } - - public String toString() { - return "StringLiteral <"+Token.escape(val)+">"; - } -} diff --git a/Robust/src/Lex/Token.java b/Robust/src/Lex/Token.java deleted file mode 100644 index ec3a578d..00000000 --- a/Robust/src/Lex/Token.java +++ /dev/null @@ -1,21 +0,0 @@ -package Lex; - -abstract class Token extends InputElement { - abstract java_cup.runtime.Symbol token(); - - protected static String escape(String s) { - StringBuffer sb = new StringBuffer(); - for (int i=0; i"; - } -} diff --git a/Robust/src/Main/Main.java b/Robust/src/Main/Main.java deleted file mode 100644 index e218d333..00000000 --- a/Robust/src/Main/Main.java +++ /dev/null @@ -1,488 +0,0 @@ -package Main; - -import java.io.FileOutputStream; -import java.io.InputStream; -import java.io.PrintStream; -import java.io.Reader; -import java.io.BufferedReader; -import java.io.FileReader; -import java.io.FileInputStream; -import java.util.Iterator; -import java.util.Vector; - -import IR.Tree.ParseNode; -import IR.Tree.BuildIR; -import IR.Tree.SemanticCheck; -import IR.Flat.BuildCodeMultiCore; -import IR.Flat.BuildFlat; -import IR.Flat.BuildCode; -import IR.ClassDescriptor; -import IR.State; -import IR.TaskDescriptor; -import IR.TypeUtil; -import Analysis.Scheduling.Schedule; -import Analysis.Scheduling.ScheduleAnalysis; -import Analysis.Scheduling.ScheduleEdge; -import Analysis.Scheduling.ScheduleNode; -import Analysis.Scheduling.ScheduleSimulator; -import Analysis.TaskStateAnalysis.TaskAnalysis; -import Analysis.TaskStateAnalysis.TaskTagAnalysis; -import Analysis.TaskStateAnalysis.TaskGraph; -import Analysis.CallGraph.CallGraph; -import Analysis.TaskStateAnalysis.FEdge; -import Analysis.TaskStateAnalysis.FlagState; -import Analysis.TaskStateAnalysis.TagAnalysis; -import Analysis.TaskStateAnalysis.GarbageAnalysis; -import Analysis.TaskStateAnalysis.ExecutionGraph; -import Analysis.TaskStateAnalysis.SafetyAnalysis; -import Analysis.Locality.LocalityAnalysis; -import Analysis.Locality.GenerateConversions; -import Analysis.Prefetch.PrefetchAnalysis; -import Analysis.FlatIRGraph.FlatIRGraph; -import Analysis.OwnershipAnalysis.OwnershipAnalysis; -import Interface.*; - -public class Main { - - /** Main method for the compiler. */ - - public static void main(String args[]) throws Exception { - String ClassLibraryPrefix="./ClassLibrary/"; - State state=new State(); - - for(int i=0;i -- probability of true branch"); - System.out.println("-printflat -- print out flat representation"); - System.out.println("-instructionfailures -- insert code for instruction level failures"); - System.out.println("-taskstate -- do task state analysis"); - System.out.println("-flatirtasks -- create dot files for flat IR graphs of tasks"); - System.out.println("-flatirusermethods -- create dot files for flat IR graphs of user methods"); - System.out.println("-flatirlibmethods -- create dot files for flat IR graphs of library class methods"); - System.out.println(" note: -flatirusermethods or -flatirlibmethods currently generate all class method flat IR graphs"); - System.out.println("-ownership -- do ownership analysis"); - System.out.println("-optional -- enable optional arguments"); - System.out.println("-webinterface -- enable web interface"); - System.out.println("-help -- print out help"); - System.exit(0); - } else { - readSourceFile(state, args[i]); - } - } - - - readSourceFile(state, ClassLibraryPrefix+"System.java"); - readSourceFile(state, ClassLibraryPrefix+"String.java"); - readSourceFile(state, ClassLibraryPrefix+"HashSet.java"); - readSourceFile(state, ClassLibraryPrefix+"HashMap.java"); - readSourceFile(state, ClassLibraryPrefix+"HashMapIterator.java"); - readSourceFile(state, ClassLibraryPrefix+"HashEntry.java"); - readSourceFile(state, ClassLibraryPrefix+"Integer.java"); - readSourceFile(state, ClassLibraryPrefix+"StringBuffer.java"); - //if(!state.RAW) { - readSourceFile(state, ClassLibraryPrefix+"FileInputStream.java"); - readSourceFile(state, ClassLibraryPrefix+"InputStream.java"); - readSourceFile(state, ClassLibraryPrefix+"OutputStream.java"); - readSourceFile(state, ClassLibraryPrefix+"FileOutputStream.java"); - readSourceFile(state, ClassLibraryPrefix+"File.java"); - readSourceFile(state, ClassLibraryPrefix+"InetAddress.java"); - readSourceFile(state, ClassLibraryPrefix+"SocketInputStream.java"); - readSourceFile(state, ClassLibraryPrefix+"SocketOutputStream.java"); - //} - readSourceFile(state, ClassLibraryPrefix+"Math.java"); - readSourceFile(state, ClassLibraryPrefix+"gnu/Random.java"); - readSourceFile(state, ClassLibraryPrefix+"Vector.java"); - readSourceFile(state, ClassLibraryPrefix+"Enumeration.java"); - - if (state.TASK) { - readSourceFile(state, ClassLibraryPrefix+"Object.java"); - readSourceFile(state, ClassLibraryPrefix+"TagDescriptor.java"); - } else if (state.DSM) { - readSourceFile(state, ClassLibraryPrefix+"ThreadDSM.java"); - readSourceFile(state, ClassLibraryPrefix+"ObjectJavaDSM.java"); - readSourceFile(state, ClassLibraryPrefix+"Barrier.java"); - } else { - if (state.THREAD) { - readSourceFile(state, ClassLibraryPrefix+"Thread.java"); - readSourceFile(state, ClassLibraryPrefix+"ObjectJava.java"); - } else - readSourceFile(state, ClassLibraryPrefix+"ObjectJavaNT.java"); - } - - if (state.TASK) { - readSourceFile(state, ClassLibraryPrefix+"StartupObject.java"); - readSourceFile(state, ClassLibraryPrefix+"Socket.java"); - readSourceFile(state, ClassLibraryPrefix+"ServerSocket.java"); - } else { - readSourceFile(state, ClassLibraryPrefix+"SocketJava.java"); - readSourceFile(state, ClassLibraryPrefix+"ServerSocketJava.java"); - } - - BuildIR bir=new BuildIR(state); - bir.buildtree(); - - TypeUtil tu=new TypeUtil(state); - - SemanticCheck sc=new SemanticCheck(state,tu); - sc.semanticCheck(); - tu.createFullTable(); - - BuildFlat bf=new BuildFlat(state,tu); - bf.buildFlat(); - SafetyAnalysis sa=null; - PrefetchAnalysis pa=null; - - if (state.TAGSTATE) { - CallGraph callgraph=new CallGraph(state); - TagAnalysis taganalysis=new TagAnalysis(state, callgraph); - TaskTagAnalysis tta=new TaskTagAnalysis(state, taganalysis); - } - - if (state.TASKSTATE) { - CallGraph callgraph=new CallGraph(state); - TagAnalysis taganalysis=new TagAnalysis(state, callgraph); - TaskAnalysis ta=new TaskAnalysis(state, taganalysis); - ta.taskAnalysis(); - TaskGraph tg=new TaskGraph(state, ta); - tg.createDOTfiles(); - - if (state.OPTIONAL) { - ExecutionGraph et=new ExecutionGraph(state, ta); - et.createExecutionGraph(); - sa = new SafetyAnalysis(et.getExecutionGraph(), state, ta); - sa.doAnalysis(); - state.storeAnalysisResult(sa.getResult()); - state.storeOptionalTaskDescriptors(sa.getOptionalTaskDescriptors()); - } - - if (state.WEBINTERFACE) { - GarbageAnalysis ga=new GarbageAnalysis(state, ta); - WebInterface wi=new WebInterface(state, ta, tg, ga, taganalysis); - JhttpServer serve=new JhttpServer(8000,wi); - serve.run(); - } - - if (state.SCHEDULING) { - // Save the current standard input, output, and error streams - // for later restoration. - PrintStream origOut = System.out; - - // Create a new output stream for the standard output. - PrintStream stdout = null; - try { - stdout = new PrintStream (new FileOutputStream("SimulatorResult.out")); - } catch (Exception e) { - // Sigh. Couldn't open the file. - System.out.println ("Redirect: Unable to open output file!"); - System.exit (1); - } - - // Print stuff to the original output and error streams. - // On most systems all of this will end up on your console when you - // run this application. - //origOut.println ("\nRedirect: Round #1"); - //System.out.println ("Test output via 'System.out'."); - //origOut.println ("Test output via 'origOut' reference."); - - // Set the System out and err streams to use our replacements. - System.setOut(stdout); - - // Print stuff to the original output and error streams. - // The stuff printed through the 'origOut' and 'origErr' references - // should go to the console on most systems while the messages - // printed through the 'System.out' and 'System.err' will end up in - // the files we created for them. - //origOut.println ("\nRedirect: Round #2"); - //System.out.println ("Test output via 'SimulatorResult.out'."); - //origOut.println ("Test output via 'origOut' reference."); - - // for test - // Randomly set the newRate and probability of FEdges - java.util.Random r=new java.util.Random(); - int tint = 0; - for(Iterator it_classes=state.getClassSymbolTable().getDescriptorsIterator();it_classes.hasNext();) { - ClassDescriptor cd=(ClassDescriptor) it_classes.next(); - if(cd.hasFlags()){ - Vector rootnodes=ta.getRootNodes(cd); - if(rootnodes!=null) - for(Iterator it_rootnodes=rootnodes.iterator();it_rootnodes.hasNext();){ - FlagState root=(FlagState)it_rootnodes.next(); - Vector allocatingTasks = root.getAllocatingTasks(); - if(allocatingTasks != null) { - for(int k = 0; k < allocatingTasks.size(); k++) { - TaskDescriptor td = (TaskDescriptor)allocatingTasks.elementAt(k); - Vector fev = (Vector)ta.getFEdgesFromTD(td); - int numEdges = fev.size(); - int total = 100; - for(int j = 0; j < numEdges; j++) { - FEdge pfe = fev.elementAt(j); - if(numEdges - j == 1) { - pfe.setProbability(total); - } else { - if((total != 0) && (total != 1)){ - do { - tint = r.nextInt()%total; - } while(tint <= 0); - } - pfe.setProbability(tint); - total -= tint; - } - /*do { - tint = r.nextInt()%10; - } while(tint <= 0);*/ - //int newRate = tint; - //int newRate = (j+1)%2+1; - int newRate = 1; - String cdname = cd.getSymbol(); - if((cdname.equals("SeriesRunner")) || - (cdname.equals("MDRunner"))) { - newRate = 16; - } else if(cdname.equals("SentenceParser")) { - newRate = 4; - } /*else if(cdname.equals("ReduceWorker")) { - newRate = 3; - }*/ - /*do { - tint = r.nextInt()%100; - } while(tint <= 0); - int probability = tint;*/ - int probability = 100; - pfe.addNewObjInfo(cd, newRate, probability); - } - } - } - } - - Iterator it_flags = ta.getFlagStates(cd).iterator(); - while(it_flags.hasNext()) { - FlagState fs = (FlagState)it_flags.next(); - Iterator it_edges = fs.edges(); - while(it_edges.hasNext()) { - /*do { - tint = r.nextInt()%10; - } while(tint <= 0);*/ - tint = 3; - ((FEdge)it_edges.next()).setExeTime(tint); - } - } - } - } - - // generate multiple schedulings - ScheduleAnalysis scheduleAnalysis = new ScheduleAnalysis(state, ta); - scheduleAnalysis.preSchedule(); - scheduleAnalysis.scheduleAnalysis(); - //scheduleAnalysis.setCoreNum(scheduleAnalysis.getSEdges4Test().size()); - scheduleAnalysis.setCoreNum(state.CORENUM); - scheduleAnalysis.schedule(); - - //simulate these schedulings - ScheduleSimulator scheduleSimulator = new ScheduleSimulator(scheduleAnalysis.getCoreNum(), state, ta); - Iterator it_scheduling = scheduleAnalysis.getSchedulingsIter(); - int index = 0; - Vector selectedScheduling = new Vector(); - int processTime = Integer.MAX_VALUE; - while(it_scheduling.hasNext()) { - Vector scheduling = (Vector)it_scheduling.next(); - scheduleSimulator.setScheduling(scheduling); - int tmpTime = scheduleSimulator.process(); - if(tmpTime < processTime) { - selectedScheduling.clear(); - selectedScheduling.add(index); - processTime = tmpTime; - } else if(tmpTime == processTime) { - selectedScheduling.add(index); - } - index++; - } - System.out.print("Selected schedulings with least exectution time " + processTime + ": \n\t"); - for(int i = 0; i < selectedScheduling.size(); i++) { - System.out.print((selectedScheduling.elementAt(i) + 1) + ", "); - } - System.out.println(); - - /*ScheduleSimulator scheduleSimulator = new ScheduleSimulator(4, state, ta); - Vector scheduling = new Vector(); - for(int i = 0; i < 4; i++) { - Schedule schedule = new Schedule(i); - scheduling.add(schedule); - } - Iterator it_tasks = state.getTaskSymbolTable().getAllDescriptorsIterator(); - while(it_tasks.hasNext()) { - TaskDescriptor td = (TaskDescriptor)it_tasks.next(); - if(td.getSymbol().equals("t10")) { - scheduling.elementAt(1).addTask(td); - } else { - scheduling.elementAt(0).addTask(td); - } - } - ClassDescriptor cd = (ClassDescriptor)state.getClassSymbolTable().get("E"); - scheduling.elementAt(0).addTargetCore(cd, 1); - scheduleSimulator.setScheduling(scheduling); - scheduleSimulator.process(); - - Vector scheduling1 = new Vector(); - for(int i = 0; i < 4; i++) { - Schedule schedule = new Schedule(i); - scheduling1.add(schedule); - } - Iterator it_tasks1 = state.getTaskSymbolTable().getAllDescriptorsIterator(); - while(it_tasks1.hasNext()) { - TaskDescriptor td = (TaskDescriptor)it_tasks1.next(); - scheduling1.elementAt(0).addTask(td); - } - scheduleSimulator.setScheduling(scheduling1); - scheduleSimulator.process();*/ - - // Close the streams. - try { - stdout.close (); - System.setOut(origOut); - } catch (Exception e) { - origOut.println ("Redirect: Unable to close files!"); - } - - if(state.MULTICORE) { - //it_scheduling = scheduleAnalysis.getSchedulingsIter(); - //Vector scheduling = (Vector)it_scheduling.next(); - Vector scheduling = scheduleAnalysis.getSchedulings().elementAt(selectedScheduling.elementAt(0)); - BuildCodeMultiCore bcm=new BuildCodeMultiCore(state, bf.getMap(), tu, sa, scheduling, scheduleAnalysis.getCoreNum(), pa); - bcm.buildCode(); - } - } - - } - - if(!state.MULTICORE) { - if (state.DSM) { - CallGraph callgraph=new CallGraph(state); - if (state.PREFETCH) { - //speed up prefetch generation using locality analysis results - LocalityAnalysis la=new LocalityAnalysis(state, callgraph, tu); - pa=new PrefetchAnalysis(state, callgraph, tu, la); - } - - LocalityAnalysis la=new LocalityAnalysis(state, callgraph, tu); - GenerateConversions gc=new GenerateConversions(la, state); - BuildCode bc=new BuildCode(state, bf.getMap(), tu, la, pa); - bc.buildCode(); - } else { - BuildCode bc=new BuildCode(state, bf.getMap(), tu, sa, pa); - bc.buildCode(); - } - } - - if (state.FLATIRGRAPH) { - FlatIRGraph firg = new FlatIRGraph(state, - state.FLATIRGRAPHTASKS, - state.FLATIRGRAPHUSERMETHODS, - state.FLATIRGRAPHLIBMETHODS); - } - - if (state.OWNERSHIP) { - CallGraph callGraph = new CallGraph( state ); - int allocationDepth = 3; - OwnershipAnalysis oa = - new OwnershipAnalysis( state, callGraph, allocationDepth ); - //This was breaking the compile - // oa.writeAllAliases( "identifiedAliases.txt" ); - } - - System.exit(0); - } - - /** Reads in a source file and adds the parse tree to the state object. */ - - private static void readSourceFile(State state, String sourcefile) throws Exception { - Reader fr = new BufferedReader(new FileReader(sourcefile)); - Lex.Lexer l = new Lex.Lexer(fr); - java_cup.runtime.lr_parser g; - g = new Parse.Parser(l); - ParseNode p=null; - try { - p=(ParseNode) g./*debug_*/parse().value; - } catch (Exception e) { - System.err.println("Error parsing file:"+sourcefile); - e.printStackTrace(); - System.exit(-1); - } - state.addParseNode(p); - if (l.numErrors()!=0) { - System.out.println("Error parsing "+sourcefile); - System.exit(l.numErrors()); - } - } -} diff --git a/Robust/src/Makefile b/Robust/src/Makefile deleted file mode 100644 index 2ec41852..00000000 --- a/Robust/src/Makefile +++ /dev/null @@ -1,138 +0,0 @@ -CLASSFILES=Main/Main.class Lex/BooleanLiteral.class \ -Lex/CharacterLiteral.class Lex/Comment.class \ -Lex/DocumentationComment.class Lex/DoubleLiteral.class Lex/EOF.class \ -Lex/EndOfLineComment.class Lex/EscapedUnicodeReader.class \ -Lex/FIFO.class Lex/FloatLiteral.class Lex/Identifier.class \ -Lex/InputElement.class Lex/IntegerLiteral.class Lex/Keyword.class \ -Lex/Lexer.class Lex/Literal.class Lex/LongLiteral.class \ -Lex/NullLiteral.class Lex/NumericLiteral.class Lex/Operator.class \ -Lex/Separator.class Lex/StringLiteral.class Lex/Token.class \ -Lex/TraditionalComment.class Lex/WhiteSpace.class \ -IR/AssignOperation.class IR/ClassDescriptor.class IR/Descriptor.class \ -IR/FieldDescriptor.class IR/FlagDescriptor.class \ -IR/MethodDescriptor.class IR/NameDescriptor.class IR/Operation.class \ -IR/State.class IR/SymbolTable.class IR/TagDescriptor.class \ -IR/TagVarDescriptor.class IR/TaskDescriptor.class \ -IR/TypeDescriptor.class IR/TypeUtil.class IR/VarDescriptor.class \ -IR/Virtual.class IR/Flat/BuildCode.class IR/Flat/BuildFlat.class \ -IR/Flat/FKind.class IR/Flat/FlatAtomicEnterNode.class \ -IR/Flat/FlatAtomicExitNode.class IR/Flat/FlatBackEdge.class \ -IR/Flat/FlatCall.class IR/Flat/FlatCastNode.class \ -IR/Flat/FlatCheckNode.class IR/Flat/FlatCondBranch.class \ -IR/Flat/FlatElementNode.class IR/Flat/FlatFieldNode.class \ -IR/Flat/FlatFlagActionNode.class IR/Flat/FlatGlobalConvNode.class \ -IR/Flat/FlatLiteralNode.class IR/Flat/FlatMethod.class \ -IR/Flat/FlatNew.class IR/Flat/FlatNode.class IR/Flat/FlatNop.class \ -IR/Flat/FlatOpNode.class IR/Flat/FlatReturnNode.class \ -IR/Flat/FlatSetElementNode.class IR/Flat/FlatSetFieldNode.class \ -IR/Flat/FlatTagDeclaration.class IR/Flat/NodePair.class \ -IR/Flat/FlatPrefetchNode.class \ -IR/Flat/ParamsObject.class IR/Flat/TempDescriptor.class \ -IR/Flat/TempFlagPair.class IR/Flat/TempObject.class \ -IR/Flat/TempTagPair.class IR/Tree/ArrayAccessNode.class \ -IR/Tree/AssignmentNode.class IR/Tree/AtomicNode.class \ -IR/Tree/BlockExpressionNode.class IR/Tree/BlockNode.class \ -IR/Tree/BlockStatementNode.class IR/Tree/BuildIR.class \ -IR/Tree/CastNode.class IR/Tree/ConstraintCheck.class \ -IR/Tree/CreateObjectNode.class IR/Tree/DNFFlag.class \ -IR/Tree/DNFFlagAtom.class IR/Tree/DeclarationNode.class \ -IR/Tree/ExpressionNode.class IR/Tree/FieldAccessNode.class \ -IR/Tree/FlagEffect.class IR/Tree/FlagEffects.class \ -IR/Tree/FlagExpressionNode.class IR/Tree/FlagNode.class \ -IR/Tree/FlagOpNode.class IR/Tree/IfStatementNode.class \ -IR/Tree/Kind.class IR/Tree/LiteralNode.class IR/Tree/LoopNode.class \ -IR/Tree/MethodInvokeNode.class IR/Tree/Modifiers.class \ -IR/Tree/NameNode.class IR/Tree/OpNode.class IR/Tree/ParseNode.class \ -IR/Tree/ParseNodeDOTVisitor.class IR/Tree/ParseNodeVector.class \ -IR/Tree/ReturnNode.class IR/Tree/SemanticCheck.class \ -IR/Tree/SubBlockNode.class IR/Tree/TagDeclarationNode.class \ -IR/Tree/TagEffect.class IR/Tree/TagExpressionList.class \ -IR/Tree/TaskExitNode.class IR/Tree/TreeNode.class \ -IR/Tree/Walkable.class Analysis/CallGraph/CallGraph.class \ -Analysis/Locality/GenerateConversions.class \ -Analysis/Locality/LocalityAnalysis.class \ -Analysis/Locality/LocalityBinding.class \ -Analysis/Locality/TempNodePair.class \ -Analysis/TaskStateAnalysis/Allocations.class \ -Analysis/TaskStateAnalysis/EGEdge.class \ -Analysis/TaskStateAnalysis/EGTaskNode.class \ -Analysis/TaskStateAnalysis/ExecutionGraph.class \ -Analysis/TaskStateAnalysis/FEdge.class \ -Analysis/TaskStateAnalysis/FlagState.class \ -Analysis/TaskStateAnalysis/GarbageAnalysis.class \ -Analysis/TaskStateAnalysis/OptionalTaskDescriptor.class \ -Analysis/TaskStateAnalysis/Predicate.class \ -Analysis/TaskStateAnalysis/SafetyAnalysis.class \ -Analysis/TaskStateAnalysis/TEdge.class \ -Analysis/TaskStateAnalysis/TagAnalysis.class \ -Analysis/TaskStateAnalysis/TagBinding.class \ -Analysis/TaskStateAnalysis/TaskAnalysis.class \ -Analysis/TaskStateAnalysis/TaskEdges.class \ -Analysis/TaskStateAnalysis/TaskGraph.class \ -Analysis/TaskStateAnalysis/TaskNode.class \ -Analysis/TaskStateAnalysis/FlagComparator.class \ -Analysis/TaskStateAnalysis/TaskNodeNamer.class Util/Edge.class \ -Analysis/FlatIRGraph/FlatIRGraph.class \ -Analysis/OwnershipAnalysis/OwnershipAnalysis.class \ -Analysis/OwnershipAnalysis/OwnershipGraph.class \ -Analysis/OwnershipAnalysis/OwnershipNode.class \ -Analysis/OwnershipAnalysis/LabelNode.class \ -Analysis/OwnershipAnalysis/HeapRegionNode.class \ -Analysis/OwnershipAnalysis/ReferenceEdgeProperties.class \ -Analysis/OwnershipAnalysis/AllocationSite.class \ -Analysis/OwnershipAnalysis/TokenTuple.class \ -Analysis/OwnershipAnalysis/TokenTupleSet.class \ -Analysis/OwnershipAnalysis/ReachabilitySet.class \ -Analysis/OwnershipAnalysis/ChangeTuple.class \ -Analysis/OwnershipAnalysis/ChangeTupleSet.class \ -Analysis/OwnershipAnalysis/Canonical.class \ -Util/GraphNode.class Util/Namer.class Util/Relation.class \ -Interface/HTTPHeader.class Interface/HTTPResponse.class \ -Interface/HTTPServices.class Interface/HashStrings.class \ -Interface/JhttpServer.class Interface/JhttpWorker.class \ -Interface/LogFile.class Interface/Pair.class \ -Interface/WebInterface.class Analysis/Prefetch/PrefetchAnalysis.class \ -Analysis/Prefetch/PrefetchPair.class Analysis/Prefetch/PairMap.class \ -Analysis/Prefetch/IndexDescriptor.class \ -Analysis/Scheduling/ClassNode.class \ -Analysis/Scheduling/ScheduleAnalysis.class \ -Analysis/Scheduling/ScheduleEdge.class \ -Analysis/Scheduling/ScheduleNode.class \ -Analysis/Scheduling/CoreSimulator.class \ -Analysis/Scheduling/FIFORSchedule.class \ -Analysis/Scheduling/ObjectSimulator.class \ -Analysis/Scheduling/RuntimeSchedule.class \ -Analysis/Scheduling/Schedule.class \ -Analysis/Scheduling/ScheduleSimulator.class \ -Analysis/Scheduling/SchedulingUtil.class \ -Analysis/Scheduling/TaskSimulator.class \ -Analysis/Scheduling/TransTaskSimulator.class - - - -all: compiler javadoc - -compiler: Parse/Sym.class Parse/Parser.class $(CLASSFILES) - -wc: - wc Interface/*.java Analysis/*/*.java IR/*.java IR/*/*.java Lex/*.java Util/*.java ClassLibrary/*.java - -wcrun: - wc Runtime/*.[c,h] - -Parse/Parser.java Parse/Sym.java: Parse/java14.cup - cd Parse && \ - java -cp ../../cup:$(CLASSPATH) java_cup.Main -parser Parser -symbols Sym < java14.cup - -%.class: %.java - javac -cp ../cup:.:$(CLASSPATH) $< - -javadoc: - mkdir javadoc - javadoc -classpath ../cup:.:$(CLASSPATH) -sourcepath . -private -d javadoc Lex Util IR IR.Tree IR.Flat Analysis Analysis.CallGraph Analysis.Flag Analysis.TaskStateAnalysis Analysis.Locality Analysis.Prefetch Main Analysis.OwnershipAnalysis Analysis.Scheduling - -clean: - rm -f IR/*.class IR/Tree/*.class Main/*.class Lex/*.class Parse/*.class Parse/Sym.java Parse/Parser.java IR/Flat/*.class classdefs.h methodheaders.h methods.c structdefs.h virtualtable.h task.h taskdefs.c taskdefs.h Analysis/*.class Analysis/Flag/*.class Analysis/CallGraph/*.class Analysis/TaskStateAnalysis/*.class Interface/*.class Util/*.class Analysis/Locality/*.class Analysis/Prefetch/*.class Analysis/FlatIRGraph/*.class Analysis/OwnershipAnalysis/*.class Analysis/Scheduling/*.class - -cleandoc: - rm -rf javadoc diff --git a/Robust/src/Makefile.raw.1 b/Robust/src/Makefile.raw.1 deleted file mode 100644 index 153d672a..00000000 --- a/Robust/src/Makefile.raw.1 +++ /dev/null @@ -1,19 +0,0 @@ -TOPDIR=/home/jzhou/starsearch -include $(TOPDIR)/Makefile.include - -RGCCFLAGS += -O2 -RGCCFLAGS += ${RAWRGCCFLAGS} - -SIM-CYCLES = 10000 - -ATTRIBUTES += HWIC - -TILE_PATTERN = 4x1 - -OBJECT_FILES_COMMON = multicoretask.o multicoreruntime.o Queue.o file.o math.o object.o \ - GenericHashtable.o SimpleHash.o ObjectHash.o socket.o checkpoint.o\ - taskdefs.o methods.o mem.o raw_dataCache.o raw_interrupt.o - -# this is for a multi-tile test -include $(COMMONDIR)/Makefile.all - diff --git a/Robust/src/Makefile.raw.2 b/Robust/src/Makefile.raw.2 deleted file mode 100644 index 1094a2c0..00000000 --- a/Robust/src/Makefile.raw.2 +++ /dev/null @@ -1,19 +0,0 @@ -TOPDIR=/home/jzhou/starsearch -include $(TOPDIR)/Makefile.include - -RGCCFLAGS += -O2 -RGCCFLAGS += ${RAWRGCCFLAGS} - -SIM-CYCLES = 10000 - -ATTRIBUTES += HWIC - -TILE_PATTERN = 4x2 - -OBJECT_FILES_COMMON = multicoretask.o multicoreruntime.o Queue.o file.o math.o object.o \ - GenericHashtable.o SimpleHash.o ObjectHash.o socket.o checkpoint.o\ - taskdefs.o methods.o mem.o raw_dataCache.o raw_interrupt2.o - -# this is for a multi-tile test -include $(COMMONDIR)/Makefile.all - diff --git a/Robust/src/Makefile.raw.4 b/Robust/src/Makefile.raw.4 deleted file mode 100644 index f0749b01..00000000 --- a/Robust/src/Makefile.raw.4 +++ /dev/null @@ -1,19 +0,0 @@ -TOPDIR=/home/jzhou/starsearch -include $(TOPDIR)/Makefile.include - -RGCCFLAGS += -O2 -RGCCFLAGS += ${RAWRGCCFLAGS} - -SIM-CYCLES = 10000 - -ATTRIBUTES += HWIC - -TILE_PATTERN = 4x4 - -OBJECT_FILES_COMMON = multicoretask.o multicoreruntime.o Queue.o file.o math.o object.o \ - GenericHashtable.o SimpleHash.o ObjectHash.o socket.o checkpoint.o\ - taskdefs.o methods.o mem.o raw_dataCache.o raw_interrupt4.o - -# this is for a multi-tile test -include $(COMMONDIR)/Makefile.all - diff --git a/Robust/src/Makefile.raw.i.1 b/Robust/src/Makefile.raw.i.1 deleted file mode 100644 index 5c80e08e..00000000 --- a/Robust/src/Makefile.raw.i.1 +++ /dev/null @@ -1,19 +0,0 @@ -TOPDIR=/home/jzhou/starsearch -include $(TOPDIR)/Makefile.include - -RGCCFLAGS += -O2 -RGCCFLAGS += ${RAWRGCCFLAGS} - -SIM-CYCLES = 10000 - -ATTRIBUTES += HWIC - -TILE_PATTERN = 4x1 - -OBJECT_FILES_COMMON = multicoretask.o multicoreruntime.o Queue.o file.o math.o object.o \ - GenericHashtable.o SimpleHash.o ObjectHash.o socket.o checkpoint.o\ - taskdefs.o methods.o mem.o raw_dataCache.o raw_interrupt.o - -# this is for a multi-tile test -include $(COMMONDIR)/Makefile.all - diff --git a/Robust/src/Makefile.raw.i.2 b/Robust/src/Makefile.raw.i.2 deleted file mode 100644 index 1094a2c0..00000000 --- a/Robust/src/Makefile.raw.i.2 +++ /dev/null @@ -1,19 +0,0 @@ -TOPDIR=/home/jzhou/starsearch -include $(TOPDIR)/Makefile.include - -RGCCFLAGS += -O2 -RGCCFLAGS += ${RAWRGCCFLAGS} - -SIM-CYCLES = 10000 - -ATTRIBUTES += HWIC - -TILE_PATTERN = 4x2 - -OBJECT_FILES_COMMON = multicoretask.o multicoreruntime.o Queue.o file.o math.o object.o \ - GenericHashtable.o SimpleHash.o ObjectHash.o socket.o checkpoint.o\ - taskdefs.o methods.o mem.o raw_dataCache.o raw_interrupt2.o - -# this is for a multi-tile test -include $(COMMONDIR)/Makefile.all - diff --git a/Robust/src/Makefile.raw.i.4 b/Robust/src/Makefile.raw.i.4 deleted file mode 100644 index f0749b01..00000000 --- a/Robust/src/Makefile.raw.i.4 +++ /dev/null @@ -1,19 +0,0 @@ -TOPDIR=/home/jzhou/starsearch -include $(TOPDIR)/Makefile.include - -RGCCFLAGS += -O2 -RGCCFLAGS += ${RAWRGCCFLAGS} - -SIM-CYCLES = 10000 - -ATTRIBUTES += HWIC - -TILE_PATTERN = 4x4 - -OBJECT_FILES_COMMON = multicoretask.o multicoreruntime.o Queue.o file.o math.o object.o \ - GenericHashtable.o SimpleHash.o ObjectHash.o socket.o checkpoint.o\ - taskdefs.o methods.o mem.o raw_dataCache.o raw_interrupt4.o - -# this is for a multi-tile test -include $(COMMONDIR)/Makefile.all - diff --git a/Robust/src/Parse/java14.cup b/Robust/src/Parse/java14.cup deleted file mode 100644 index 85d18b58..00000000 --- a/Robust/src/Parse/java14.cup +++ /dev/null @@ -1,1843 +0,0 @@ -package Parse; - -import java_cup.runtime.*; -import Lex.Lexer; -import IR.Tree.*; - -/* Java 1.4 parser for CUP. - * Copyright (C) 2002-2003 C. Scott Ananian - * This program is released under the terms of the GPL; see the file - * COPYING for more details. There is NO WARRANTY on this code. - */ - -/* -JDK 1.4 Features added: - assertion statement. - statement_without_trailing_substatement ::= ... - | assert_statement ; - assert_statement ::= - ASSERT expression SEMICOLON - | ASSERT expression COLON expression SEMICOLON - ; -*/ -parser code {: - Lexer lexer; - - public Parser(Lexer l) { - this(); - lexer=l; - } - - public void syntax_error(java_cup.runtime.Symbol current) { - report_error("Syntax error (" + current.sym + ")", current); - } - public void report_error(String message, java_cup.runtime.Symbol info) { - lexer.errorMsg(message, info); - } -:}; - -scan with {: return lexer.nextToken(); :}; - -terminal BOOLEAN; // primitive_type -terminal BYTE, SHORT, INT, LONG, CHAR; // integral_type -terminal FLOAT, DOUBLE; // floating_point_type -terminal LBRACK, RBRACK; // array_type -terminal java.lang.String IDENTIFIER; // name -terminal DOT; // qualified_name -terminal SEMICOLON, MULT, COMMA, LBRACE, RBRACE, EQ, LPAREN, RPAREN, COLON; -terminal PACKAGE; // package_declaration -terminal IMPORT; // import_declaration -terminal PUBLIC, PROTECTED, PRIVATE; // modifier -terminal STATIC; // modifier -terminal ABSTRACT, FINAL, NATIVE, SYNCHRONIZED, TRANSIENT, VOLATILE; -terminal CLASS; // class_declaration -terminal EXTENDS; // super -//terminal IMPLEMENTS; // interfaces -terminal VOID; // method_header -terminal THROWS; // throws -terminal THIS, SUPER; // explicit_constructor_invocation -//terminal INTERFACE; // interface_declaration -terminal IF, ELSE; // if_then_statement, if_then_else_statement -terminal SWITCH; // switch_statement -terminal CASE, DEFAULT; // switch_label -terminal DO, WHILE; // while_statement, do_statement -terminal FOR; // for_statement -terminal BREAK; // break_statement -terminal CONTINUE; // continue_statement -terminal RETURN; // return_statement -terminal THROW; // throw_statement -terminal TRY; // try_statement -terminal CATCH; // catch_clause -terminal FINALLY; // finally -terminal NEW; // class_instance_creation_expression -terminal PLUSPLUS; // postincrement_expression -terminal MINUSMINUS; // postdecrement_expression -terminal PLUS, MINUS, COMP, NOT, DIV, MOD; -terminal LSHIFT, RSHIFT, URSHIFT; // shift_expression -terminal LT, GT, LTEQ, GTEQ, INSTANCEOF; // relational_expression -terminal EQEQ, NOTEQ; // equality_expression -terminal AND; // and_expression -terminal XOR; // exclusive_or_expression -terminal OR; // inclusive_or_expression -terminal ANDAND; // conditional_and_expression -terminal OROR; // conditional_or_expression -terminal QUESTION; // conditional_expression -terminal MULTEQ, DIVEQ, MODEQ, PLUSEQ, MINUSEQ; // assignment_operator -terminal LSHIFTEQ, RSHIFTEQ, URSHIFTEQ; // assignment_operator -terminal ANDEQ, XOREQ, OREQ; // assignment_operator - -terminal java.lang.Number INTEGER_LITERAL; -terminal java.lang.Number FLOATING_POINT_LITERAL; -terminal java.lang.Boolean BOOLEAN_LITERAL; -terminal java.lang.Character CHARACTER_LITERAL; -terminal java.lang.String STRING_LITERAL; -terminal NULL_LITERAL; - -// Reserved but unused: -terminal CONST, GOTO; -// strictfp keyword, new in Java 1.2 -terminal STRICTFP; -// assert keyword, new in Java 1.4 -terminal ASSERT; // assert_statement -// lexer compatibility with Java 1.5 -terminal ELLIPSIS; -terminal ENUM; - - -// 19.2) The Syntactic Grammar -non terminal ParseNode goal; -// 19.3) Lexical Structure -non terminal ParseNode literal; -// 19.4) Types, Values, and Variables -non terminal ParseNode type, primitive_type, numeric_type; -non terminal ParseNode integral_type, floating_point_type; -non terminal ParseNode reference_type; -non terminal ParseNode class_or_interface_type; -non terminal ParseNode class_type; -//non terminal ParseNode interface_type; -non terminal ParseNode array_type; -// 19.5) Names -non terminal ParseNode name, simple_name, qualified_name; -// 19.6) Packages -non terminal ParseNode compilation_unit; -non terminal ParseNode package_declaration_opt, package_declaration; -non terminal ParseNode import_declarations_opt, import_declarations; -non terminal ParseNode type_declarations_opt, type_declarations; -non terminal ParseNode import_declaration; -non terminal ParseNode single_type_import_declaration; -non terminal ParseNode type_import_on_demand_declaration; -non terminal ParseNode type_declaration; -// 19.7) Productions used only in the LALR(1) grammar -non terminal ParseNode modifiers_opt, modifiers, modifier; -// 19.8.1) Class Declaration -non terminal ParseNode class_declaration, super, super_opt; -//non terminal interfaces, interfaces_opt, interface_type_list; -non terminal ParseNode class_body; -non terminal ParseNode class_body_declarations, class_body_declarations_opt; -non terminal ParseNode class_body_declaration, class_member_declaration; -// 19.8.2) Field Declarations -non terminal ParseNode field_declaration, variable_declarators, variable_declarator; -non terminal ParseNode variable_declarator_id; -non terminal ParseNode variable_initializer; -// 19.8.3) Method Declarations -non terminal ParseNode method_declaration, method_header, method_declarator; -non terminal ParseNode formal_parameter_list_opt, formal_parameter_list; -non terminal ParseNode formal_parameter; -//non terminal ParseNode throws_opt; -//non terminal ParseNode throws; -//non terminal ParseNode class_type_list; -non terminal ParseNode method_body; -// 19.8.4) Static Initializers -//non terminal ParseNode static_initializer; -// 19.8.5) Constructor Declarations -non terminal ParseNode constructor_declaration, constructor_declarator; -non terminal ParseNode constructor_body; -non terminal ParseNode explicit_constructor_invocation; -// 19.9.1) Interface Declarations -//non terminal ParseNode interface_declaration; -//non terminal ParseNode extends_interfaces_opt, extends_interfaces; -//non terminal ParseNode interface_body; -//non terminal ParseNode interface_member_declarations_opt, interface_member_declarations; -//non terminal ParseNode interface_member_declaration, constant_declaration; -//non terminal ParseNode abstract_method_declaration; -// 19.10) Arrays -//non terminal ParseNode array_initializer; -//non terminal ParseNode variable_initializers; -// 19.11) Blocks and Statements -non terminal ParseNode block; -non terminal ParseNode block_statements_opt, block_statements, block_statement; -non terminal ParseNode local_variable_declaration_statement, local_variable_declaration; -non terminal ParseNode statement, statement_no_short_if; -non terminal ParseNode statement_without_trailing_substatement; -non terminal ParseNode empty_statement; -//non terminal ParseNode labeled_statement, labeled_statement_no_short_if; -non terminal ParseNode expression_statement, statement_expression; -non terminal ParseNode if_then_statement; -non terminal ParseNode if_then_else_statement, if_then_else_statement_no_short_if; -//non terminal ParseNode switch_statement, switch_block; -//non terminal ParseNode switch_block_statement_groups; -//non terminal ParseNode switch_block_statement_group; -//non terminal ParseNode switch_labels, switch_label; -non terminal ParseNode while_statement, while_statement_no_short_if; -non terminal ParseNode do_statement; -non terminal ParseNode for_statement, for_statement_no_short_if; -non terminal ParseNode for_init_opt, for_init; -non terminal ParseNode for_update_opt, for_update; -non terminal ParseNode statement_expression_list; -//non terminal ParseNode identifier_opt; -non terminal ParseNode break_statement, continue_statement; -non terminal ParseNode return_statement; -//non terminal ParseNode throw_statement; -//non terminal ParseNode synchronized_statement, try_statement; -//non terminal ParseNode catches_opt; -//non terminal ParseNode catches, catch_clause; -//non terminal ParseNode finally; -//non terminal ParseNode assert_statement; -// 19.12) Expressions -non terminal ParseNode primary, primary_no_new_array; -non terminal ParseNode class_instance_creation_expression; -non terminal ParseNode cons_argument_list_opt, cons_argument_list; -non terminal ParseNode argument_list_opt, argument_list; -//non terminal ParseNode array_creation_init; -non terminal ParseNode array_creation_uninit; -non terminal ParseNode dim_exprs, dim_expr; -non terminal Integer dims_opt, dims; -non terminal ParseNode field_access, method_invocation; -non terminal ParseNode array_access; -non terminal ParseNode postfix_expression; -non terminal ParseNode postincrement_expression, postdecrement_expression; -non terminal ParseNode unary_expression, unary_expression_not_plus_minus; -non terminal ParseNode preincrement_expression, predecrement_expression; -non terminal ParseNode cast_expression; -non terminal ParseNode multiplicative_expression, additive_expression; -non terminal ParseNode shift_expression, relational_expression, equality_expression; -non terminal ParseNode and_expression, exclusive_or_expression, inclusive_or_expression; -non terminal ParseNode conditional_and_expression, conditional_or_expression; -non terminal ParseNode conditional_expression; -non terminal ParseNode assignment_expression; -non terminal ParseNode assignment; -non terminal ParseNode assignment_operator; -non terminal ParseNode expression_opt, expression; -//non terminal ParseNode constant_expression; -//failure aware computation keywords -terminal FLAG; -terminal OPTIONAL; -terminal ISAVAILABLE; -terminal EXTERNAL; -terminal TAG; -terminal TASK; -terminal TASKEXIT; -non terminal ParseNode flag_declaration; -non terminal ParseNode task_declaration; -non terminal ParseNode task_parameter_list; -non terminal ParseNode task_parameter; -non terminal ParseNode flag_expression; -non terminal ParseNode flag_andexpression; -non terminal ParseNode flag_notexpression; -non terminal ParseNode task_exitstatement; -non terminal ParseNode flag_effects_opt; -non terminal ParseNode flag_effects; -non terminal ParseNode flag_effect; -non terminal ParseNode flag_list; -non terminal ParseNode flag_list_opt; -non terminal ParseNode flag_change; - -non terminal ParseNode cons_checks_opt; -non terminal ParseNode cons_checks; -non terminal ParseNode cons_check; - -non terminal ParseNode tag_variable_declaration_statement; -non terminal ParseNode tag_expression_list; -non terminal ParseNode tag_expression; -non terminal ParseNode tag_list; -non terminal ParseNode tag_list_opt; -non terminal ParseNode tag_change; - -//distributed transaction keywords -terminal ATOMIC; -terminal GLOBAL; -non terminal ParseNode atomic_statement; - - -start with goal; - - -// Task declarations -task_declaration ::= - TASK IDENTIFIER:id LPAREN task_parameter_list:tpl RPAREN - flag_effects_opt:feo - method_body:body - {: - ParseNode pn=new ParseNode("task_declaration"); - pn.addChild("name").addChild(id); - pn.addChild(tpl); - pn.addChild(feo); - pn.addChild("body").addChild(body); - RESULT=pn; - :}; - -task_parameter_list ::= - task_parameter:fp {: - ParseNode pn=new ParseNode("task_parameter_list"); - pn.addChild(fp); - RESULT=pn; - :} - | task_parameter_list:fpl COMMA task_parameter:fp {: - fpl.addChild(fp); - RESULT=fpl; - :} - ; - -task_parameter ::= - type:type variable_declarator_id:name LBRACE flag_expression:exp RBRACE {: - ParseNode pn=new ParseNode("task_parameter"); - pn.addChild(type); - pn.addChild(name); - pn.addChild("flag").addChild(exp); - RESULT=pn; - :} - | type:type variable_declarator_id:name LBRACE flag_expression:exp RBRACE LBRACE tag_expression_list:texp RBRACE {: - ParseNode pn=new ParseNode("task_parameter"); - pn.addChild(type); - pn.addChild(name); - pn.addChild("flag").addChild(exp); - pn.addChild("tag").addChild(texp); - RESULT=pn; - :} - | type:type variable_declarator_id:name LBRACE RBRACE LBRACE tag_expression_list:texp RBRACE {: - ParseNode pn=new ParseNode("task_parameter"); - pn.addChild(type); - pn.addChild(name); - pn.addChild("tag").addChild(texp); - RESULT=pn; - :} - | OPTIONAL task_parameter:fp {: - ParseNode pn=new ParseNode("task_parameter"); - pn.addChild("optional").addChild(fp); - RESULT=pn; - :} - - ; - -tag_expression_list ::= tag_expression:te {: - ParseNode pn=new ParseNode("tag_expression_list"); - pn.addChild(te); - RESULT=pn; - :} - | tag_expression_list:tel COMMA tag_expression:te {: - tel.addChild(te); - RESULT=tel; - :} - ; - -tag_expression ::= IDENTIFIER:type IDENTIFIER:id {: - ParseNode pn=new ParseNode("tag_expression"); - pn.addChild("type").addChild(type); - pn.addChild("single").addChild(id); - RESULT=pn; - :} - ; - -tag_list_opt ::= LBRACE tag_list:fl RBRACE {:RESULT=fl;:} - | LBRACE RBRACE {: RESULT = new ParseNode("empty"); :} - | {: RESULT = new ParseNode("empty"); :} - ; - -tag_list ::= tag_change:fc {: - ParseNode pn=new ParseNode("tag_list"); - pn.addChild(fc); - RESULT=pn; - :} - | tag_list:fl COMMA tag_change:fc {: - fl.addChild(fc); - RESULT=fl; - :}; - -tag_change ::= IDENTIFIER:id {: - RESULT=new ParseNode("name").addChild(id).getRoot(); - :} - | NOT IDENTIFIER:id {: - RESULT=new ParseNode("not").addChild("name").addChild(id).getRoot(); - :}; - -flag_expression ::= - flag_andexpression:exp {: - RESULT=exp; - :} - | flag_expression:exp1 OROR flag_andexpression:exp2 {: - ParseNode pn=new ParseNode("or"); - pn.addChild(exp1); - pn.addChild(exp2); - RESULT=pn; - :} - ; - -flag_andexpression ::= - flag_notexpression:exp {: RESULT=exp; :} - | flag_notexpression:exp1 ANDAND flag_andexpression:exp2 {: - ParseNode pn=new ParseNode("and"); - pn.addChild(exp1); - pn.addChild(exp2); - RESULT=pn; - :} - ; - -flag_notexpression ::= - NOT flag_notexpression:exp {: - ParseNode pn=new ParseNode("not"); - pn.addChild(exp); - RESULT=pn; - :} - | LPAREN flag_expression:exp RPAREN {: - RESULT=exp; - :} - | IDENTIFIER:id {: - ParseNode pn=new ParseNode("name"); - pn.addChild(id); - RESULT=pn; - :} - ; - -task_exitstatement ::= TASKEXIT flag_effects_opt:opt cons_checks_opt:cco SEMICOLON {: - RESULT=(new ParseNode("taskexit")).addChild(opt).getRoot().addChild(cco).getRoot(); - :}; - -cons_checks_opt ::= ASSERT LPAREN cons_checks:cc RPAREN {: RESULT=cc; :} - | {: RESULT = new ParseNode("empty"); :} - ; - -cons_checks ::= cons_check:cc {: - ParseNode pn=new ParseNode("cons_checks"); - pn.addChild(cc); - RESULT=pn; - :} - | cons_checks:ccs COMMA cons_check:cc {: - ccs.addChild(cc); - RESULT=ccs; - :}; - -cons_check ::= IDENTIFIER:name LPAREN cons_argument_list_opt:args RPAREN {: - ParseNode pn=new ParseNode("cons_check"); - pn.addChild("name").addChild("identifier").addChild(name); - pn.addChild(args); - RESULT=pn; - :}; - -flag_effects_opt ::= LPAREN flag_effects:fe RPAREN {:RESULT=fe;:} - | {: RESULT = new ParseNode("empty"); :} - ; - -flag_effects ::= flag_effect:fe {: - ParseNode pn=new ParseNode("flag_effects_list"); - pn.addChild(fe); - RESULT=pn; - :} - | flag_effects:fes COMMA flag_effect:fe {: - fes.addChild(fe); - RESULT=fes; - :}; - -flag_effect ::= IDENTIFIER:id LBRACE flag_list:fl RBRACE tag_list_opt:tlo {: - ParseNode pn=new ParseNode("flag_effect"); - pn.addChild("name").addChild(id); - pn.addChild(fl); - pn.addChild(tlo); - RESULT=pn; - :} - | IDENTIFIER:id LBRACE RBRACE LBRACE tag_list:tl RBRACE {: - ParseNode pn=new ParseNode("flag_effect"); - pn.addChild("name").addChild(id); - pn.addChild(tl); - RESULT=pn; - :}; - -flag_list_opt ::= LBRACE flag_list:fl RBRACE {:RESULT=fl;:} - | LBRACE RBRACE {: RESULT = new ParseNode("empty"); :} - | - {: RESULT = new ParseNode("empty"); :} - ; - -flag_list ::= flag_change:fc {: - ParseNode pn=new ParseNode("flag_list"); - pn.addChild(fc); - RESULT=pn; - :} - | flag_list:fl COMMA flag_change:fc {: - fl.addChild(fc); - RESULT=fl; - :}; - -flag_change ::= IDENTIFIER:id {: - RESULT=new ParseNode("name").addChild(id).getRoot(); - :} | - NOT IDENTIFIER:id {: - RESULT=new ParseNode("not").addChild("name").addChild(id).getRoot(); - :}; - -// 19.2) The Syntactic Grammar -goal ::= compilation_unit:cu - {: - RESULT = cu; - :} - ; - -// 19.3) Lexical Structure. - - -literal ::= INTEGER_LITERAL:integer_lit - {: - ParseNode pn=new ParseNode("literal"); - pn.addChild("integer").setLiteral(integer_lit); - RESULT=pn; - :} - | FLOATING_POINT_LITERAL:float_lit - {: - ParseNode pn=new ParseNode("literal"); - pn.addChild("float").setLiteral(float_lit); - RESULT=pn; - :} - | BOOLEAN_LITERAL:boolean_lit - {: - ParseNode pn=new ParseNode("literal"); - pn.addChild("boolean").setLiteral(boolean_lit); - RESULT=pn; - :} - | CHARACTER_LITERAL:char_lit - {: - ParseNode pn=new ParseNode("literal"); - pn.addChild("char").setLiteral(char_lit); - RESULT=pn; - :} - | STRING_LITERAL:string_lit - {: - ParseNode pn=new ParseNode("literal"); - pn.addChild("string").setLiteral(string_lit); - RESULT=pn; - :} - | NULL_LITERAL - {: - RESULT=(new ParseNode("literal")).addChild("null").getRoot(); - :} - ; - -// 19.4) Types, Values, and Variables -type ::= primitive_type:type {: RESULT=type; :} - | reference_type:type {: RESULT=type; :} - ; - -primitive_type ::= - numeric_type:type {: RESULT=type; :} - | BOOLEAN {: RESULT=(new ParseNode("type")).addChild("boolean").getRoot(); :} - ; -numeric_type::= integral_type:type {: RESULT=type; :} - | floating_point_type:type {: RESULT=type; :} - ; -integral_type ::= - BYTE {: RESULT=(new ParseNode("type")).addChild("byte").getRoot(); :} - | SHORT {: RESULT=(new ParseNode("type")).addChild("short").getRoot(); :} - | INT {: RESULT=(new ParseNode("type")).addChild("int").getRoot(); :} - | LONG {: RESULT=(new ParseNode("type")).addChild("long").getRoot(); :} - | CHAR {: RESULT=(new ParseNode("type")).addChild("char").getRoot(); :} - ; -floating_point_type ::= - FLOAT {: RESULT=(new ParseNode("type")).addChild("float").getRoot(); :} - | DOUBLE {: RESULT=(new ParseNode("type")).addChild("double").getRoot(); :} - ; - -reference_type ::= - class_or_interface_type:type {: RESULT=type; :} - | array_type:type {: RESULT=type; :} - ; -class_or_interface_type ::= name:name {: - RESULT=(new ParseNode("type")).addChild("class").addChild(name).getRoot(); - :}; - -class_type ::= class_or_interface_type:type {: RESULT=type; :}; -//interface_type ::= class_or_interface_type; - -array_type ::= primitive_type:prim dims:dims {: - ParseNode pn=(new ParseNode("type")).addChild("array"); - pn.addChild("basetype").addChild(prim); - pn.addChild("dims").setLiteral(dims); - RESULT=pn.getRoot(); - :} - | name:name dims:dims {: - ParseNode pn=(new ParseNode("type")).addChild("array"); - pn.addChild("basetype").addChild("type").addChild("class").addChild(name); - pn.addChild("dims").setLiteral(dims); - RESULT=pn.getRoot(); - :} - ; - -// 19.5) Names -name ::= simple_name:name {: RESULT=name; :} - | qualified_name:name {: RESULT=name; :} - ; -simple_name ::= IDENTIFIER:id {: - RESULT=(new ParseNode("name")).addChild("identifier").addChild(id).getRoot(); - :} - ; -qualified_name ::= name:name DOT IDENTIFIER:id {: - ParseNode pn=new ParseNode("name"); - pn.addChild("base").addChild(name); - pn.addChild("identifier").addChild(id); - RESULT=pn; - :} - ; - -// 19.6) Packages -compilation_unit ::= - package_declaration_opt:pdo - import_declarations_opt:ido - type_declarations_opt:tdo {: - ParseNode pn=new ParseNode("compilation_unit"); - pn.addChild(tdo); - pn.addChild("packages").addChild(pdo); - pn.addChild("imports").addChild(ido); - RESULT=pn; - :} - ; -package_declaration_opt ::= package_declaration:pdo {: - RESULT=pdo; - :} | - {: RESULT=new ParseNode("empty"); :} -; - -import_declarations_opt ::= import_declarations:ido {: - RESULT=ido; - :} | - {: RESULT=new ParseNode("empty"); :} -; -type_declarations_opt ::= type_declarations:tds {: - RESULT=tds; - :} | - {: RESULT=new ParseNode("empty"); :} - ; - -import_declarations ::= - import_declaration:id {: - ParseNode pn=new ParseNode("import_decls_list"); - pn.addChild(id); - RESULT=pn; - :} - | import_declarations:ids import_declaration:id {: - ids.addChild(id); - RESULT=ids; - :} - ; - -type_declarations ::= - type_declaration:td {: - ParseNode pn=new ParseNode("type_declaration_list"); - pn.addChild(td); - RESULT=pn; - :} - | type_declarations:tds type_declaration:td {: - tds.addChild(td); - RESULT=tds; - :} - ; - -package_declaration ::= - PACKAGE name:name SEMICOLON {: - ParseNode pn=new ParseNode("package"); - pn.addChild(name); - RESULT=pn; - :} - ; -import_declaration ::= - single_type_import_declaration:sid {: RESULT=sid; :} - | type_import_on_demand_declaration:iod {: RESULT=iod; :} - ; -single_type_import_declaration ::= - IMPORT name:name SEMICOLON {: - ParseNode pn=new ParseNode("import_single"); - pn.addChild(name); - RESULT=pn; -:} - ; -type_import_on_demand_declaration ::= - IMPORT name:name DOT MULT SEMICOLON {: - ParseNode pn=new ParseNode("import_ondemand"); - pn.addChild(name); - RESULT=pn; - :} - ; - -type_declaration ::= - class_declaration:cd - {: - RESULT=cd; - :} - | task_declaration:td - {: - RESULT=td; - :} -// | interface_declaration - | SEMICOLON {: RESULT=new ParseNode("empty"); :} - ; - -// 19.7) Productions used only in the LALR(1) grammar -modifiers_opt::= - {: RESULT=new ParseNode("empty"); :} - | modifiers:mo {: - RESULT=mo; - :} - ; -modifiers ::= modifier:mo {: - ParseNode pn=new ParseNode("modifier_list"); - pn.addChild(mo); - RESULT=pn; - :} - | modifiers:mos modifier:mo {: - mos.addChild(mo); - RESULT=mos; - :} - ; -modifier ::= - PUBLIC {: RESULT=new ParseNode("public"); :}| - PROTECTED {: RESULT=new ParseNode("protected"); :}| - PRIVATE {: RESULT=new ParseNode("private"); :}| - STATIC {: RESULT=new ParseNode("static"); :} | -// ABSTRACT | - FINAL {: RESULT=new ParseNode("final"); :}| - NATIVE {: RESULT=new ParseNode("native"); :} | - SYNCHRONIZED {: RESULT=new ParseNode("synchronized"); :} | - ATOMIC {: RESULT=new ParseNode("atomic"); :} -// TRANSIENT | -// VOLATILE | -// STRICTFP // note that semantic analysis must check that the - // context of the modifier allows strictfp. - ; - -// 19.8) Classes - -// 19.8.1) Class Declaration: -class_declaration ::= - modifiers_opt:mo CLASS IDENTIFIER:id super_opt:so //interfaces_opt -class_body:body - {: - ParseNode pn=new ParseNode("class_declaration"); - pn.addChild("modifiers").addChild(mo); - pn.addChild("name").addChild(id); - pn.addChild("super").addChild(so); - pn.addChild("classbody").addChild(body); - RESULT=pn; - :} - ; -super ::= EXTENDS class_type:classtype {: - RESULT=classtype; - :} - ; -super_opt ::= - {: RESULT=new ParseNode("empty"); :} - | super:su {: - RESULT=su; - :} - ; - -//interfaces ::= IMPLEMENTS interface_type_list -// ; -//interfaces_opt::= -// | interfaces -// ; -//interface_type_list ::= -// interface_type -// | interface_type_list COMMA interface_type -// ; - -class_body ::= LBRACE class_body_declarations_opt:cbdo RBRACE {: RESULT=cbdo; :} - ; - -class_body_declarations_opt ::= - {: RESULT=new ParseNode("empty"); :} - | class_body_declarations:cbd {: RESULT=cbd; :}; - -class_body_declarations ::= - class_body_declaration:cbd {: - ParseNode pn=new ParseNode("class_body_declaration_list"); - pn.addChild(cbd); - RESULT=pn; - :} - | class_body_declarations:cbds class_body_declaration:cbd {: - cbds.addChild(cbd); - RESULT=cbds; - :} - ; - -class_body_declaration ::= - class_member_declaration:member {: - RESULT=(new ParseNode("member")).addChild(member).getRoot(); - :} -// | static_initializer - | constructor_declaration:constructor {: - RESULT=(new ParseNode("constructor")).addChild(constructor).getRoot(); - :} - | block:block {: - RESULT=(new ParseNode("block")).addChild(block).getRoot(); -:} - ; -class_member_declaration ::= - //failure aware computation - flag_declaration:flag {: - RESULT=(new ParseNode("flag")).addChild(flag).getRoot(); - :} - | - field_declaration:field {: - RESULT=(new ParseNode("field")).addChild(field).getRoot(); - :} - | method_declaration:method {: - RESULT=(new ParseNode("method")).addChild(method).getRoot(); - :} - /* repeat the prod for 'class_declaration' here: */ -// | modifiers_opt CLASS IDENTIFIER super_opt class_body -// | interface_declaration - | SEMICOLON {: RESULT=new ParseNode("empty"); :} - ; - -//Failure aware computation -flag_declaration ::= - FLAG IDENTIFIER:id SEMICOLON {: - ParseNode pn=new ParseNode("flag_declaration"); - pn.addChild("name").addChild(id); - RESULT=pn; - :} | - EXTERNAL FLAG IDENTIFIER:id SEMICOLON {: - ParseNode pn=new ParseNode("flag_declaration"); - pn.addChild("name").addChild(id); - pn.addChild("external"); - RESULT=pn; - :} - ; - -// 19.8.2) Field Declarations -field_declaration ::= - modifiers_opt:mo type:type variable_declarators:var SEMICOLON {: - ParseNode pn=new ParseNode("field_declaration"); - pn.addChild("modifier").addChild(mo); - pn.addChild("type").addChild(type); - pn.addChild("variables").addChild(var); - RESULT=pn; - :} | - modifiers_opt:mo GLOBAL type:type variable_declarators:var SEMICOLON {: - ParseNode pn=new ParseNode("field_declaration"); - pn.addChild("modifier").addChild(mo); - pn.addChild("type").addChild(type); - pn.addChild("variables").addChild(var); - pn.addChild("global"); - RESULT=pn; - :} - ; - -variable_declarators ::= - variable_declarator:vd {: - ParseNode pn=new ParseNode("variable_declarators_list"); - pn.addChild(vd); - RESULT=pn; - :} - | variable_declarators:vds COMMA variable_declarator:vd {: - vds.addChild(vd); - RESULT=vds; - :} - ; -variable_declarator ::= - variable_declarator_id:id {: - ParseNode pn=new ParseNode("variable_declarator"); - pn.addChild(id); - RESULT=pn; - :} - | variable_declarator_id:id EQ variable_initializer:init {: - ParseNode pn=new ParseNode("variable_declarator"); - pn.addChild(id); - pn.addChild("initializer").addChild(init); - RESULT=pn; - :} - ; -variable_declarator_id ::= - IDENTIFIER:id {: - RESULT=(new ParseNode("single")).addChild(id).getRoot();:} - | variable_declarator_id:id LBRACK RBRACK {: - RESULT=(new ParseNode("array")).addChild(id).getRoot();:} - ; -variable_initializer ::= - expression:exp {: RESULT=exp; :} -// | array_initializer - ; - -// 19.8.3) Method Declarations -method_declaration ::= - method_header:header method_body:body {: - ParseNode pn=new ParseNode("method_declaration"); - pn.addChild(header); - pn.addChild("body").addChild(body); - RESULT=pn; - :} - ; -method_header ::= - modifiers_opt:mo type:type method_declarator:decl //throws_opt - {: - ParseNode pn=new ParseNode("method_header"); - pn.addChild("modifiers").addChild(mo); - pn.addChild("returntype").addChild(type); - pn.addChild(decl); - RESULT=pn; - :} - | modifiers_opt:mo VOID method_declarator:decl //throws_opt - {: - ParseNode pn=new ParseNode("method_header"); - pn.addChild("modifiers").addChild(mo); - pn.addChild(decl); - RESULT=pn; - :} - ; -method_declarator ::= - IDENTIFIER:id LPAREN formal_parameter_list_opt:params RPAREN {: - ParseNode pn=new ParseNode("method_declarator"); - pn.addChild("name").addChild(id); - pn.addChild("parameters").addChild(params); - RESULT=pn; - :} -// | method_declarator LBRACK RBRACK // deprecated -// be careful; the above production also allows 'void foo() []' - ; -formal_parameter_list_opt ::= - {: RESULT=new ParseNode("empty"); :} - | formal_parameter_list:fpl {: - RESULT=fpl; - :} - ; -formal_parameter_list ::= - formal_parameter:fp {: - ParseNode pn=new ParseNode("formal_parameter_list"); - pn.addChild(fp); - RESULT=pn; - :} - | formal_parameter_list:fpl COMMA formal_parameter:fp {: - fpl.addChild(fp); - RESULT=fpl; - :} - ; -formal_parameter ::= - type:type variable_declarator_id:name {: - ParseNode pn=new ParseNode("formal_parameter"); - pn.addChild(type); - pn.addChild(name); - RESULT=pn; - :} - | - TAG variable_declarator_id:name {: - ParseNode pn=new ParseNode("tag_parameter"); - pn.addChild(name); - RESULT=pn; - :} -// | FINAL type variable_declarator_id - ; -//throws_opt ::= -// | throws -// ; -//throws ::= THROWS class_type_list -// ; -//class_type_list ::= -// class_type -// | class_type_list COMMA class_type -// ; -method_body ::= block:block {: - RESULT=block; - :} - | SEMICOLON {: RESULT=new ParseNode("empty"); :} - ; - -// 19.8.4) Static Initializers -//static_initializer ::= -// STATIC block -// ; - -// 19.8.5) Constructor Declarations -constructor_declaration ::= - modifiers_opt:mo constructor_declarator:cd -//throws_opt - constructor_body:body {: - ParseNode pn=new ParseNode("constructor_declaration"); - pn.addChild("modifiers").addChild(mo); - pn.addChild(cd); - pn.addChild("body").addChild(body); - RESULT=pn; - :} | - modifiers_opt:mo GLOBAL constructor_declarator:cd -//throws_opt - constructor_body:body {: - ParseNode pn=new ParseNode("constructor_declaration"); - pn.addChild("global"); - pn.addChild("modifiers").addChild(mo); - pn.addChild(cd); - pn.addChild("body").addChild(body); - RESULT=pn; - :} - ; -constructor_declarator ::= - simple_name:name LPAREN formal_parameter_list_opt:fplo RPAREN {: - ParseNode pn=new ParseNode("constructor_declarator"); - pn.addChild(name); - pn.addChild("parameters").addChild(fplo); - RESULT=pn; - :} - ; -constructor_body ::= - LBRACE explicit_constructor_invocation:eci block_statements:bs RBRACE {: - ParseNode pn=new ParseNode("constructor_body"); - pn.addChild(eci); - pn.addChild(bs); - RESULT=pn; - :} | - LBRACE explicit_constructor_invocation:eci RBRACE {: - ParseNode pn=new ParseNode("constructor_body"); - pn.addChild(eci); - RESULT=pn; - :} | - LBRACE block_statements:block RBRACE {: - ParseNode pn=new ParseNode("constructor_body"); - pn.addChild(block); - RESULT=pn; - :} - | LBRACE RBRACE {: RESULT=new ParseNode("empty"); :} - ; -explicit_constructor_invocation ::= -// THIS LPAREN argument_list_opt RPAREN SEMICOLON -// | -SUPER LPAREN argument_list_opt:alo RPAREN SEMICOLON {: - ParseNode pn=new ParseNode("superinvoke"); - pn.addChild(alo); - RESULT=pn; -:} -// | primary DOT THIS LPAREN argument_list_opt RPAREN SEMICOLON -// | primary DOT SUPER LPAREN argument_list_opt RPAREN SEMICOLON - ; - -// 19.9) Interfaces - -// 19.9.1) Interface Declarations -//interface_declaration ::= -// modifiers_opt INTERFACE IDENTIFIER extends_interfaces_opt -// interface_body -// ; -//extends_interfaces_opt ::= -// | extends_interfaces -// ; -//extends_interfaces ::= -// EXTENDS interface_type -// | extends_interfaces COMMA interface_type -// ; -//interface_body ::= -// LBRACE interface_member_declarations_opt RBRACE -// ; -//interface_member_declarations_opt ::= -// | interface_member_declarations -// ; -//interface_member_declarations ::= -// interface_member_declaration -// | interface_member_declarations interface_member_declaration -// ; -//interface_member_declaration ::= -// constant_declaration -// | abstract_method_declaration -// | class_declaration -// | interface_declaration -// | SEMICOLON -// ; -//constant_declaration ::= -// field_declaration -// // need to semantically check that modifiers of field declaration -// // include only PUBLIC, STATIC, or FINAL. Other modifiers are -// // disallowed. -// ; -//abstract_method_declaration ::= -// method_header SEMICOLON -// ; - - -// 19.10) Arrays -//array_initializer ::= -// LBRACE variable_initializers COMMA RBRACE -// | LBRACE variable_initializers RBRACE -// | LBRACE COMMA RBRACE -// | LBRACE RBRACE -// ; -//variable_initializers ::= -// variable_initializer -// | variable_initializers COMMA variable_initializer -// ; - -// 19.11) Blocks and Statements -block ::= LBRACE block_statements_opt:bso RBRACE {: - RESULT=bso; - :} - ; -block_statements_opt ::= - {: RESULT=new ParseNode("empty"); :} - | block_statements:bs {: - RESULT=bs; - :} - ; -block_statements ::= - block_statement:bs {: - ParseNode pn=new ParseNode("block_statement_list"); - pn.addChild(bs); - RESULT=pn; - :} - | block_statements:bss block_statement:bs {: - bss.addChild(bs); - RESULT=bss; - :} - ; -block_statement ::= - tag_variable_declaration_statement:tvds {: - RESULT=tvds; - :} - | local_variable_declaration_statement:lvds {: - RESULT=lvds; - :} - | statement:statement {: - RESULT=statement; - :} -// | class_declaration -// | interface_declaration - ; -tag_variable_declaration_statement ::= - TAG IDENTIFIER:id EQ NEW TAG LPAREN IDENTIFIER:type RPAREN SEMICOLON {: - ParseNode pn=new ParseNode("tag_declaration"); - pn.addChild("single").addChild(id); - pn.addChild("type").addChild(type); - RESULT=pn; - :} - ; -local_variable_declaration_statement ::= - local_variable_declaration:lvd SEMICOLON {: - RESULT=lvd; - :} - ; -local_variable_declaration ::= - type:type variable_declarators:var {: - ParseNode pn=new ParseNode("local_variable_declaration"); - pn.addChild(type); - pn.addChild(var); - RESULT=pn; -:} -// | FINAL type variable_declarators - ; -statement ::= statement_without_trailing_substatement:st {: - RESULT=st; - :} -// | labeled_statement:st {: RESULT=st; :} - | if_then_statement:st {: RESULT=st; :} - | if_then_else_statement:st {: RESULT=st; :} - | while_statement:st {: RESULT=st; :} - | for_statement:st {: RESULT=st; :} - ; -statement_no_short_if ::= - statement_without_trailing_substatement:st {: RESULT=st; :} -// | labeled_statement_no_short_if:st {: RESULT=st; :} - | if_then_else_statement_no_short_if:st {: RESULT=st; :} - | while_statement_no_short_if:st {: RESULT=st; :} - | for_statement_no_short_if:st {: RESULT=st; :} - ; -statement_without_trailing_substatement ::= - block:st {: RESULT=st; :} - | empty_statement:st {: RESULT=st; :} - | expression_statement:st {: RESULT=st; :} -// | switch_statement - | do_statement:dos {:RESULT=dos; :} - | break_statement:st {: RESULT=st; :} - | continue_statement:st {: RESULT=st; :} - | return_statement:st {: RESULT=st; :} - | task_exitstatement:st {: RESULT=st; :} - | atomic_statement:st {: RESULT=st; :} -// | synchronized_statement -// | throw_statement -// | try_statement -// | assert_statement - ; -empty_statement ::= - SEMICOLON {: RESULT=new ParseNode("nop"); :} - ; -//labeled_statement ::= -// IDENTIFIER COLON statement -// ; -//labeled_statement_no_short_if ::= -// IDENTIFIER COLON statement_no_short_if -// ; -expression_statement ::= - statement_expression:se SEMICOLON {: - ParseNode pn=new ParseNode("expression"); - pn.addChild(se); - RESULT=pn; :} - ; -statement_expression ::= - assignment:st {: RESULT=st; :} - | preincrement_expression:st {: RESULT=st; :} - | predecrement_expression:st {: RESULT=st; :} - | postincrement_expression:st {: RESULT=st; :} - | postdecrement_expression:st {: RESULT=st; :} - | method_invocation:st {: RESULT=st; :} - | class_instance_creation_expression:st {: RESULT=st; :} - ; -if_then_statement ::= - IF LPAREN expression:exp RPAREN statement:st {: - ParseNode pn=new ParseNode("ifstatement"); - pn.addChild("condition").addChild(exp); - pn.addChild("statement").addChild(st); - RESULT=pn; - :} - ; -if_then_else_statement ::= - IF LPAREN expression:exp RPAREN statement_no_short_if:st - ELSE statement:else_st {: - ParseNode pn=new ParseNode("ifstatement"); - pn.addChild("condition").addChild(exp); - pn.addChild("statement").addChild(st); - pn.addChild("else_statement").addChild(else_st); - RESULT=pn; - :} - ; -if_then_else_statement_no_short_if ::= - IF LPAREN expression:exp RPAREN statement_no_short_if:st - ELSE statement_no_short_if:else_st {: - ParseNode pn=new ParseNode("ifstatement"); - pn.addChild("condition").addChild(exp); - pn.addChild("statement").addChild(st); - pn.addChild("else_statement").addChild(else_st); - RESULT=pn; - :} - ; -//switch_statement ::= -// SWITCH LPAREN expression RPAREN switch_block -// ; -//switch_block ::= -// LBRACE switch_block_statement_groups switch_labels RBRACE -// | LBRACE switch_block_statement_groups RBRACE -// | LBRACE switch_labels RBRACE -// | LBRACE RBRACE -// ; -//switch_block_statement_groups ::= -// switch_block_statement_group -// | switch_block_statement_groups switch_block_statement_group -// ; -//switch_block_statement_group ::= -// switch_labels block_statements -// ; -//switch_labels ::= -// switch_label -// | switch_labels switch_label -// ; -//switch_label ::= -// CASE constant_expression COLON -// | DEFAULT COLON -// ; - -while_statement ::= - WHILE LPAREN expression:exp RPAREN statement:st {: - ParseNode pn=new ParseNode("whilestatement"); - pn.addChild("condition").addChild(exp); - pn.addChild("statement").addChild(st); - RESULT=pn; - :} - ; -while_statement_no_short_if ::= - WHILE LPAREN expression:exp RPAREN statement_no_short_if:st {: - ParseNode pn=new ParseNode("whilestatement"); - pn.addChild("condition").addChild(exp); - pn.addChild("statement").addChild(st); - RESULT=pn; - :} - ; -do_statement ::= - DO statement:st WHILE LPAREN expression:exp RPAREN SEMICOLON {: - ParseNode pn=new ParseNode("dowhilestatement"); - pn.addChild("condition").addChild(exp); - pn.addChild("statement").addChild(st); - RESULT=pn; - :} - ; -for_statement ::= - FOR LPAREN for_init_opt:init SEMICOLON expression_opt:exp SEMICOLON - for_update_opt:update RPAREN statement:st {: - ParseNode pn=new ParseNode("forstatement"); - pn.addChild("initializer").addChild(init); - pn.addChild("condition").addChild(exp); - pn.addChild("update").addChild(update); - pn.addChild("statement").addChild(st); - RESULT=pn; - :} - ; -for_statement_no_short_if ::= - FOR LPAREN for_init_opt:init SEMICOLON expression_opt:exp SEMICOLON - for_update_opt:update RPAREN statement_no_short_if:st {: - ParseNode pn=new ParseNode("forstatement"); - pn.addChild("initializer").addChild(init); - pn.addChild("condition").addChild(exp); - pn.addChild("update").addChild(update); - pn.addChild("statement").addChild(st); - RESULT=pn; - :} - ; -for_init_opt ::= - {: RESULT=new ParseNode("empty"); :} - | for_init:init {: RESULT=init; :} - ; -for_init ::= statement_expression_list:list {: RESULT=list; :} - | local_variable_declaration:decl {: RESULT=decl; :} - ; -for_update_opt ::= - {: RESULT=new ParseNode("empty"); :} - | for_update:update {: RESULT=update; :} - ; -for_update ::= statement_expression_list:list {: RESULT=list; :} - ; -statement_expression_list ::= - statement_expression:expr {: - RESULT=(new ParseNode("statement_expression_list")).addChild(expr).getRoot(); - :} - | statement_expression_list:list COMMA statement_expression:expr {: - list.addChild(expr); - RESULT=list; - :} - ; - -//identifier_opt ::= -// | IDENTIFIER -// ; - -break_statement ::= - BREAK -//identifier_opt -SEMICOLON {: RESULT=new ParseNode("break"); :} - ; - -continue_statement ::= - CONTINUE -//identifier_opt -SEMICOLON -{: RESULT=new ParseNode("continue"); :} - ; -return_statement ::= - RETURN expression_opt:exp SEMICOLON {: - RESULT=(new ParseNode("return")).addChild(exp).getRoot(); :} - ; -//throw_statement ::= -// THROW expression SEMICOLON -// ; -//synchronized_statement ::= -// SYNCHRONIZED LPAREN expression RPAREN block -// ; -atomic_statement ::= - ATOMIC block:blk {: - RESULT=(new ParseNode("atomic")).addChild(blk).getRoot(); - :} - ; -//try_statement ::= -// TRY block catches -// | TRY block catches_opt finally -// ; -//catches_opt ::= -// | catches -// ; -//catches ::= catch_clause -// | catches catch_clause -// ; -//catch_clause ::= -// CATCH LPAREN formal_parameter RPAREN block -// ; -//finally ::= FINALLY block -// ; -//assert_statement ::= -// ASSERT expression SEMICOLON -// | ASSERT expression COLON expression SEMICOLON -// ; - -// 19.12) Expressions -primary ::= primary_no_new_array:st {: - RESULT=st; :} -// | array_creation_init:st {: -// RESULT=st; -// :} - | array_creation_uninit:st {: - RESULT=st; - :} - ; -primary_no_new_array ::= - literal:lit {: RESULT=lit; :} - | THIS {: RESULT=new ParseNode("this"); :} - | LPAREN expression:exp RPAREN {: RESULT=exp; :} - | class_instance_creation_expression:exp {: RESULT=exp; :} - | field_access:exp {: RESULT=exp; :} - | method_invocation:exp {: RESULT=exp; :} - | array_access:exp {: RESULT=exp; :} - | ISAVAILABLE LPAREN IDENTIFIER:id RPAREN {: - ParseNode pn=new ParseNode("isavailable"); - pn.addChild(id); - RESULT=pn; - :} -// | primitive_type DOT CLASS -// | VOID DOT CLASS -// | array_type DOT CLASS -// | name DOT CLASS -// | name DOT THIS - ; -class_instance_creation_expression ::= - NEW class_or_interface_type:type LPAREN argument_list_opt:args RPAREN flag_list_opt:feo {: - ParseNode pn=new ParseNode("createobject"); - pn.addChild(type); - pn.addChild(args); - pn.addChild(feo); - RESULT=pn; - :} - //Global object - | GLOBAL NEW class_or_interface_type:type LPAREN argument_list_opt:args RPAREN flag_list_opt:feo {: - ParseNode pn=new ParseNode("createobject"); - pn.addChild(type); - pn.addChild(args); - pn.addChild(feo); - pn.addChild("global"); - RESULT=pn; - :} - | NEW class_or_interface_type:type LPAREN argument_list_opt:args RPAREN LBRACE RBRACE LBRACE tag_list:tl RBRACE {: - ParseNode pn=new ParseNode("createobject"); - pn.addChild(type); - pn.addChild(args); - pn.addChild(tl); - RESULT=pn; - :} - | NEW class_or_interface_type:type LPAREN argument_list_opt:args RPAREN LBRACE flag_list:fl RBRACE LBRACE tag_list:tl RBRACE {: - ParseNode pn=new ParseNode("createobject"); - pn.addChild(type); - pn.addChild(args); - pn.addChild(fl); - pn.addChild(tl); - RESULT=pn; - :} - -// | NEW class_or_interface_type LPAREN argument_list_opt RPAREN class_body -// | primary DOT NEW IDENTIFIER -// LPAREN argument_list_opt RPAREN {: -// -// :} -// | primary DOT NEW IDENTIFIER -// LPAREN argument_list_opt RPAREN class_body -// | name DOT NEW IDENTIFIER -// LPAREN argument_list_opt RPAREN -// | name DOT NEW IDENTIFIER -// LPAREN argument_list_opt RPAREN class_body - ; -cons_argument_list_opt ::= - {: RESULT=new ParseNode("empty"); :} - | cons_argument_list:args {: RESULT=args; :} - ; - -cons_argument_list ::= - IDENTIFIER:id COLON expression:exp {: - ParseNode pn=new ParseNode("cons_argument_list"); - ParseNode pnarg=pn.addChild("binding"); - pnarg.addChild("var").addChild(id); - pnarg.addChild("exp").addChild(exp); - RESULT=pn; - :} - | argument_list:list COMMA IDENTIFIER:id COLON expression:exp {: - ParseNode pnarg=new ParseNode("binding"); - pnarg.addChild("var").addChild(id); - pnarg.addChild("exp").addChild(exp); - list.addChild(pnarg); - RESULT=list; - :} - ; - -argument_list_opt ::= - {: RESULT=new ParseNode("empty"); :} - | argument_list:args {: RESULT=args; :} - ; - -argument_list ::= - expression:exp {: - ParseNode pn=new ParseNode("argument_list"); - pn.addChild(exp); - RESULT=pn; - :} - | argument_list:list COMMA expression:exp {: - list.addChild(exp); - RESULT=list; - :} - ; -array_creation_uninit ::= - NEW primitive_type:type dim_exprs:dimexpr dims_opt:dims {: - ParseNode pn=new ParseNode("createarray"); - pn.addChild(type); - pn.addChild(dimexpr); - pn.addChild("dims_opt").setLiteral(dims); - RESULT=pn; - :} - | NEW class_or_interface_type:type dim_exprs:dimexpr dims_opt:dims {: - ParseNode pn=new ParseNode("createarray"); - pn.addChild(type); - pn.addChild(dimexpr); - pn.addChild("dims_opt").setLiteral(dims); - RESULT=pn; - :} - | GLOBAL NEW primitive_type:type dim_exprs:dimexpr dims_opt:dims {: - ParseNode pn=new ParseNode("createarray"); - pn.addChild(type); - pn.addChild(dimexpr); - pn.addChild("dims_opt").setLiteral(dims); - pn.addChild("global"); - RESULT=pn; - :} - | GLOBAL NEW class_or_interface_type:type dim_exprs:dimexpr dims_opt:dims {: - ParseNode pn=new ParseNode("createarray"); - pn.addChild(type); - pn.addChild(dimexpr); - pn.addChild("dims_opt").setLiteral(dims); - pn.addChild("global"); - RESULT=pn; - :} - ; -//array_creation_init ::= -// NEW primitive_type dims array_initializer -// | NEW class_or_interface_type dims array_initializer -// ; -dim_exprs ::= dim_expr:exp {: - ParseNode pn=new ParseNode("dim_exprs"); - pn.addChild(exp); - RESULT=pn; :} - | dim_exprs:base dim_expr:exp {: - base.addChild(exp); - RESULT=base; - :} - ; -dim_expr ::= LBRACK expression:exp RBRACK {: RESULT=exp; :} - ; -dims_opt ::= {: RESULT=new Integer(0); :} - | dims:dims {: RESULT = dims; :} - ; - -dims ::= LBRACK RBRACK {: RESULT=new Integer(1); :} - | dims:dims LBRACK RBRACK {: RESULT=new Integer(dims.intValue()+1); :} - ; - -field_access ::= - primary:base DOT IDENTIFIER:id {: - ParseNode pn=new ParseNode("fieldaccess"); - pn.addChild("base").addChild(base); - pn.addChild("field").addChild(id); - RESULT=pn; -:} -// | SUPER DOT IDENTIFIER -// | name DOT SUPER DOT IDENTIFIER - ; -method_invocation ::= - name:name LPAREN argument_list_opt:args RPAREN {: - ParseNode pn=new ParseNode("methodinvoke1"); - pn.addChild(name); - pn.addChild(args); - RESULT=pn; - :} - | primary:base DOT IDENTIFIER:name LPAREN argument_list_opt:args RPAREN {: - ParseNode pn=new ParseNode("methodinvoke2"); - pn.addChild("base").addChild(base); - pn.addChild("id").addChild(name); - pn.addChild(args); - RESULT=pn; - :} - | SUPER DOT IDENTIFIER:id LPAREN argument_list_opt:args RPAREN {: - ParseNode name=new ParseNode("name"); - name.addChild("base").addChild("name").addChild("identifier").addChild("super"); - name.addChild("identifier").addChild(id); - ParseNode pn=new ParseNode("methodinvoke1"); - pn.addChild(name); - pn.addChild(args); - RESULT=pn; - :} -// | name DOT SUPER DOT IDENTIFIER LPAREN argument_list_opt RPAREN - ; -array_access ::= - name:name LBRACK expression:exp RBRACK {: - ParseNode pn=new ParseNode("arrayaccess"); - pn.addChild("base").addChild(name); - pn.addChild("index").addChild(exp); - RESULT=pn; - :} - | primary_no_new_array:base LBRACK expression:exp RBRACK {: - ParseNode pn=new ParseNode("arrayaccess"); - pn.addChild("base").addChild(base); - pn.addChild("index").addChild(exp); - RESULT=pn; - :} -// | array_creation_init:init LBRACK expression:exp RBRACK {: -// ParseNode pn=new ParseNode("arrayaccess"); -// pn.addChild("init").addChild(init); -// pn.addChild("index").addChild(exp); -// RESULT=pn; -// :} - ; -postfix_expression ::= - primary:exp {: - RESULT=exp; :} - | name:exp {: RESULT=exp; :} - | postincrement_expression:exp {: RESULT=exp; :} - | postdecrement_expression:exp {: RESULT=exp; :} - ; -postincrement_expression ::= - postfix_expression:exp PLUSPLUS - {: RESULT=(new ParseNode("postinc")).addChild(exp).getRoot(); :} - ; -postdecrement_expression ::= - postfix_expression:exp MINUSMINUS - {: RESULT=(new ParseNode("postdec")).addChild(exp).getRoot(); :} - ; -unary_expression ::= - preincrement_expression:exp {: RESULT=exp; :} - | predecrement_expression:exp {: RESULT=exp; :} - | PLUS unary_expression:exp - {: RESULT=(new ParseNode("unaryplus")).addChild(exp).getRoot(); :} - | MINUS unary_expression:exp - {: RESULT=(new ParseNode("unaryminus")).addChild(exp).getRoot(); :} - | unary_expression_not_plus_minus:exp {: - RESULT=exp; :} - ; -preincrement_expression ::= - PLUSPLUS unary_expression:exp - {: RESULT=(new ParseNode("preinc")).addChild(exp).getRoot(); :} - ; -predecrement_expression ::= - MINUSMINUS unary_expression:exp - {: RESULT=(new ParseNode("predec")).addChild(exp).getRoot(); :} - ; -unary_expression_not_plus_minus ::= - postfix_expression:exp {: - RESULT=exp; :} - | COMP unary_expression:exp - {: RESULT=(new ParseNode("comp")).addChild(exp).getRoot(); :} - | NOT unary_expression:exp - {: RESULT=(new ParseNode("not")).addChild(exp).getRoot(); :} - | cast_expression:exp {: RESULT=exp; :} - ; -cast_expression ::= - LPAREN primitive_type:type - //dims_opt - RPAREN unary_expression:exp {: - ParseNode pn=new ParseNode("cast1"); - pn.addChild("type").addChild(type); - pn.addChild("exp").addChild(exp); - RESULT=pn; - :} - | LPAREN expression:type RPAREN unary_expression_not_plus_minus:exp {: - ParseNode pn=new ParseNode("cast2"); - pn.addChild("type").addChild(type); - pn.addChild("exp").addChild(exp); - RESULT=pn; - - :} -// | LPAREN name dims RPAREN unary_expression_not_plus_minus - ; -multiplicative_expression ::= - unary_expression:exp {: - RESULT=exp; :} - | multiplicative_expression:exp1 MULT unary_expression:exp2 {: - ParseNode pn=new ParseNode("mult"); - pn.addChild(exp1); - pn.addChild(exp2); - RESULT=pn; - :} - | multiplicative_expression:exp1 DIV unary_expression:exp2 {: - ParseNode pn=new ParseNode("div"); - pn.addChild(exp1); - pn.addChild(exp2); - RESULT=pn; - :} - | multiplicative_expression:exp1 MOD unary_expression:exp2 {: - ParseNode pn=new ParseNode("mod"); - pn.addChild(exp1); - pn.addChild(exp2); - RESULT=pn; - :} - ; -additive_expression ::= - multiplicative_expression:exp {: - RESULT=exp; :} - | additive_expression:exp1 PLUS multiplicative_expression:exp2 {: - ParseNode pn=new ParseNode("add"); - pn.addChild(exp1); - pn.addChild(exp2); - RESULT=pn; - :} - | additive_expression:exp1 MINUS multiplicative_expression:exp2 {: - ParseNode pn=new ParseNode("sub"); - pn.addChild(exp1); - pn.addChild(exp2); - RESULT=pn; - :} - ; -shift_expression ::= - additive_expression:exp {: - RESULT=exp; :} - | shift_expression:exp1 LSHIFT additive_expression:exp2 {: - ParseNode pn=new ParseNode("leftshift"); - pn.addChild(exp1); - pn.addChild(exp2); - RESULT=pn; - :} - | shift_expression:exp1 RSHIFT additive_expression:exp2 {: - ParseNode pn=new ParseNode("rightshift"); - pn.addChild(exp1); - pn.addChild(exp2); - RESULT=pn; - :} - | shift_expression:exp1 URSHIFT additive_expression:exp2 {: - ParseNode pn=new ParseNode("urightshift"); - pn.addChild(exp1); - pn.addChild(exp2); - RESULT=pn; - :} - ; -relational_expression ::= - shift_expression:exp {: - RESULT=exp; :} - | relational_expression:exp1 LT shift_expression:exp2 {: - ParseNode pn=new ParseNode("comp_lt"); - pn.addChild(exp1); - pn.addChild(exp2); - RESULT=pn; - :} - | relational_expression:exp1 GT shift_expression:exp2 {: - ParseNode pn=new ParseNode("comp_gt"); - pn.addChild(exp1); - pn.addChild(exp2); - RESULT=pn; - :} - | relational_expression:exp1 LTEQ shift_expression:exp2 {: - ParseNode pn=new ParseNode("comp_lte"); - pn.addChild(exp1); - pn.addChild(exp2); - RESULT=pn; - :} - | relational_expression:exp1 GTEQ shift_expression:exp2 {: - ParseNode pn=new ParseNode("comp_gte"); - pn.addChild(exp1); - pn.addChild(exp2); - RESULT=pn; - :} -// | relational_expression INSTANCEOF reference_type - ; - -equality_expression ::= - relational_expression:exp {: - RESULT=exp; :} - | equality_expression:exp1 EQEQ relational_expression:exp2 {: - ParseNode pn=new ParseNode("equal"); - pn.addChild(exp1); - pn.addChild(exp2); - RESULT=pn; - :} - | equality_expression:exp1 NOTEQ relational_expression:exp2 {: - ParseNode pn=new ParseNode("not_equal"); - pn.addChild(exp1); - pn.addChild(exp2); - RESULT=pn; - :} - ; -and_expression ::= - equality_expression:exp {: - RESULT=exp; :} - | and_expression:exp1 AND equality_expression:exp2 {: - ParseNode pn=new ParseNode("bitwise_and"); - pn.addChild(exp1); - pn.addChild(exp2); - RESULT=pn; - :} - ; -exclusive_or_expression ::= - and_expression:expr {: - RESULT=expr; - :} - | exclusive_or_expression:exp1 XOR and_expression:exp2 {: - ParseNode pn=new ParseNode("bitwise_xor"); - pn.addChild(exp1); - pn.addChild(exp2); - RESULT=pn; -:} - ; -inclusive_or_expression ::= - exclusive_or_expression:exclor {: - RESULT=exclor; :} - | inclusive_or_expression:exp1 OR exclusive_or_expression:exp2 {: - ParseNode pn=new ParseNode("bitwise_or"); - pn.addChild(exp1); - pn.addChild(exp2); - RESULT=pn; - :} - ; -conditional_and_expression ::= - inclusive_or_expression:inclor {: - RESULT=inclor; :} - | conditional_and_expression:exp1 ANDAND inclusive_or_expression:exp2 {: - ParseNode pn=new ParseNode("logical_and"); - pn.addChild(exp1); - pn.addChild(exp2); - RESULT=pn; - :} - ; -conditional_or_expression ::= - conditional_and_expression:condand {: - RESULT=condand; :} - | conditional_or_expression:exp1 OROR conditional_and_expression:exp2 {: - ParseNode pn=new ParseNode("logical_or"); - pn.addChild(exp1); - pn.addChild(exp2); - RESULT=pn; - :} - ; -conditional_expression ::= - conditional_or_expression:condor {: - RESULT=condor; :} -// | conditional_or_expression QUESTION expression -// COLON conditional_expression - ; -assignment_expression ::= - conditional_expression:expr {: - RESULT=expr; :} | - assignment:assign {: - RESULT=assign; :} - ; -// semantic check necessary here to ensure a valid left-hand side. -// allowing a parenthesized variable here on the lhs was introduced in -// JLS 2; thanks to Eric Blake for pointing this out. -assignment ::= postfix_expression:lvalue assignment_operator:op assignment_expression:rvalue {: - ParseNode pn=new ParseNode("assignment"); - pn.addChild("op").addChild(op); - ParseNode pnargs=pn.addChild("args"); - pnargs.addChild(lvalue); - pnargs.addChild(rvalue); - RESULT=pn; - :} - ; -assignment_operator ::= - EQ {: RESULT=new ParseNode("eq"); :} - | MULTEQ {: RESULT=new ParseNode("multeq"); :} - | DIVEQ {: RESULT=new ParseNode("diveq"); :} - | MODEQ {: RESULT=new ParseNode("modeq"); :} - | PLUSEQ {: RESULT=new ParseNode("pluseq"); :} - | MINUSEQ {: RESULT=new ParseNode("minuseq"); :} - | LSHIFTEQ {: RESULT=new ParseNode("lshifteq"); :} - | RSHIFTEQ {: RESULT=new ParseNode("rshifteq"); :} - | URSHIFTEQ {: RESULT=new ParseNode("urshifteq"); :} - | ANDEQ {: RESULT=new ParseNode("andeq"); :} - | XOREQ {: RESULT=new ParseNode("xoreq"); :} - | OREQ {: RESULT=new ParseNode("oreq"); :} - ; -expression_opt ::= - {: RESULT=new ParseNode("empty"); :} - | expression:exp {: - RESULT=exp; :} - ; -expression ::= assignment_expression:exp {: - RESULT=exp; :} - ; -//constant_expression ::= -// expression -// ; diff --git a/Robust/src/README b/Robust/src/README deleted file mode 100644 index b623359c..00000000 --- a/Robust/src/README +++ /dev/null @@ -1,2 +0,0 @@ -See the wiki page at http://demsky.eecs.uci.edu/compiler/ - diff --git a/Robust/src/RepairTest/TaskExample.java b/Robust/src/RepairTest/TaskExample.java deleted file mode 100644 index f34922be..00000000 --- a/Robust/src/RepairTest/TaskExample.java +++ /dev/null @@ -1,48 +0,0 @@ -class Example { - flag needoperation; - flag needprinting; - public Example() {} - - - int operation; - int x; - int y; - int z; -} - -/* Startup object is generated with the initialstate flag set by the - * system to start the computation up */ - -task Startup(StartupObject s {initialstate}) { - for(int i=0;i<10;i++) { - Example e=new Example() {needoperation}; - e.x=i; - e.y=2; - e.operation=i%2; - } - - taskexit(s {!initialstate}); /* Turns initial state flag off, so this task won't refire */ -} - -/* Fails for x=1 */ - -task DoOperation(Example e{needoperation}) { - e.z=10*e.y/(e.x-1); - - if (e.operation==0) - /* Print the result */ - taskexit(e {!needoperation, needprinting}) assert (Example(e : e)); - else - /* Don't print the result */ - taskexit(e {!needoperation}) assert (Example(e : e)); -} - -/* Note that we can write arbitrary boolean expressions for flag - * expressions. For example, needprinting && ! needoperation would - * also be a legal flag expression */ - -task DoPrint(Example e{needprinting}) { - System.printInt(e.z); - System.printString("\n"); - taskexit(e {!needprinting}); -} diff --git a/Robust/src/RepairTest/specs/Example/Example.constraints b/Robust/src/RepairTest/specs/Example/Example.constraints deleted file mode 100755 index e7f6d25c..00000000 --- a/Robust/src/RepairTest/specs/Example/Example.constraints +++ /dev/null @@ -1 +0,0 @@ -[forall e in Example], e.X > 0; \ No newline at end of file diff --git a/Robust/src/RepairTest/specs/Example/Example.label b/Robust/src/RepairTest/specs/Example/Example.label deleted file mode 100644 index d9a35afd..00000000 --- a/Robust/src/RepairTest/specs/Example/Example.label +++ /dev/null @@ -1 +0,0 @@ -Example * e; \ No newline at end of file diff --git a/Robust/src/RepairTest/specs/Example/Example.model b/Robust/src/RepairTest/specs/Example/Example.model deleted file mode 100755 index f6b2b86d..00000000 --- a/Robust/src/RepairTest/specs/Example/Example.model +++ /dev/null @@ -1,4 +0,0 @@ -[], true => e in Example; -[forall l in Example], true => in X; -[forall l in Example], true => in Y; -[forall l in Example], true => in Z; diff --git a/Robust/src/RepairTest/specs/Example/Example.space b/Robust/src/RepairTest/specs/Example/Example.space deleted file mode 100755 index 41bdc3b9..00000000 --- a/Robust/src/RepairTest/specs/Example/Example.space +++ /dev/null @@ -1,6 +0,0 @@ -// Space Definition Language File - -set Example(Example); -X: Example -> int; -Y: Example -> int; -Z: Example -> int; diff --git a/Robust/src/RepairTest/specs/Example2/Example2.constraints b/Robust/src/RepairTest/specs/Example2/Example2.constraints deleted file mode 100755 index e7f6d25c..00000000 --- a/Robust/src/RepairTest/specs/Example2/Example2.constraints +++ /dev/null @@ -1 +0,0 @@ -[forall e in Example], e.X > 0; \ No newline at end of file diff --git a/Robust/src/RepairTest/specs/Example2/Example2.label b/Robust/src/RepairTest/specs/Example2/Example2.label deleted file mode 100644 index d9a35afd..00000000 --- a/Robust/src/RepairTest/specs/Example2/Example2.label +++ /dev/null @@ -1 +0,0 @@ -Example * e; \ No newline at end of file diff --git a/Robust/src/RepairTest/specs/Example2/Example2.model b/Robust/src/RepairTest/specs/Example2/Example2.model deleted file mode 100755 index f6b2b86d..00000000 --- a/Robust/src/RepairTest/specs/Example2/Example2.model +++ /dev/null @@ -1,4 +0,0 @@ -[], true => e in Example; -[forall l in Example], true => in X; -[forall l in Example], true => in Y; -[forall l in Example], true => in Z; diff --git a/Robust/src/RepairTest/specs/Example2/Example2.space b/Robust/src/RepairTest/specs/Example2/Example2.space deleted file mode 100755 index 41bdc3b9..00000000 --- a/Robust/src/RepairTest/specs/Example2/Example2.space +++ /dev/null @@ -1,6 +0,0 @@ -// Space Definition Language File - -set Example(Example); -X: Example -> int; -Y: Example -> int; -Z: Example -> int; diff --git a/Robust/src/Runtime/DSTM/docs/commitnotes b/Robust/src/Runtime/DSTM/docs/commitnotes deleted file mode 100644 index ee0c5503..00000000 --- a/Robust/src/Runtime/DSTM/docs/commitnotes +++ /dev/null @@ -1,77 +0,0 @@ -Per object possibilities: - -1) Lock acquired, version id matches - -2) No lock, but version id matches - -3) Version id doesn't match - -4) Not here - -Participant responses to coordinator - -A) DISAGREE (if we ever see at least 1 #3) - -B) AGREE (all #1) - -C) AGREE BUT MISSING OBJECTS (mixture of #1 and #4 - no #2 or #3) - -return list of oid's for missing objects (need to build list) - -D) SOFT ABORT (need #2, could have #1, #4, can't have #3) - make sure -there are no #3's - -Coordinator: - -I) ABORT (Any A's) (rerun computation, clear out transaction records, etc...) - -II) COMMIT (All B's) - do local commit, free storage - -III) ABORT BUT RETRY COMMIT (don't rerun computation) (Need D, can -have B's, can have C', no A's) - -IV) ABORT BUT RETRY COMMIT WITH RELOCATING (don't rerun computation, -but relookup all missing objects) (Need C, can have B's, no A's, no -D's) - -Other machine involved in transaction: - -I) COMMIT - commit object into store, send ACK to coordinator - -II) ABORT - unlock objects, free transaction resources, send ACK to coordinator - -III) Coordinator unreachable: - - 1) Elect leader out of reachable nodes (choose smallest reachable mid) - - 2) leader queries everyone for what they've heard -(ABORT/COMMIT/nothing) - - 3) If anyone has heard commit from original leader, all commit - - 4) If anyone has heard abort from original leader, all abort - - 5) Otherwise leader does following: - - for each mid in group send SUSPICIOUS_ABORT() - - receive acknowledgements from mid's - - for each mid in group send TRUST_ONLY(nodes that send -acknowledgements) - - In case 5, machines become suspicious of all current machines -not on the list. When first contacting (or being contacted by a -machine isn't in the list, it is suspicious of all current machines -except the leader). The machine won't talk to a machine it is -suspicious of until it can verify that the other machines made the -same decision on all "suspicious" transactions. - -COORDINATOR: - -Once it has received ACK's from all other machines in transaction: - -1) It sends a recycle transaction id message (they don't need to -remember the ABORT/COMMIT result of that id anymore) - -2) After sending all these messages and receiving ack's, it marks it -local copy of transaction id recyclable diff --git a/Robust/src/Runtime/DSTM/docs/messages b/Robust/src/Runtime/DSTM/docs/messages deleted file mode 100644 index 993a16e8..00000000 --- a/Robust/src/Runtime/DSTM/docs/messages +++ /dev/null @@ -1,72 +0,0 @@ -control = 1 byte, number of objects = 2 bytes - -Client messages: - tuples for read objects, modified objects -OBJECT_FOUND - control, sizeof object, object ->OBJECT_NOT_FOUND - control ->OBJECTS_FOUND - control, number of objects, objects ->OBJECTS_NOT_FOUND - control, number of objects, oids ->TRANS_AGREE - control ->TRANS_DISAGREE - control ->TRANS_AGREE_BUT_MISSING_OBJECTS - control, number of objects, objects ->TRANS_SOFT_ABORT - control, control bit identifying is missing objects present of not, number of objects, objects ->TRANS_SUCCESSFUL - control - -possible conversations (conversation means a tcp connection is maintained throughout): - -OBJECT_FOUND - -OBJECT_NOT_FOUND - -OBJECTS_FOUND - -OBJECTS_NOT_FOUND - -(some objects found, others not) -OBJECTS_NOT_FOUND ->OBJECTS_FOUND - -OBJECT_FOUND - -OBJECT_NOT_FOUND - -OBJECTS_FOUND - -OBJECTS_NOT_FOUND - -(some objects found, others not) -OBJECTS_NOT_FOUND ->OBJECTS_FOUND - -TRANS_DISAGREE -TRANS_AGREE -TRANS_AGREE -TRANS_SUCCESSFUL - diff --git a/Robust/src/Runtime/DSTM/docs/prefetch b/Robust/src/Runtime/DSTM/docs/prefetch deleted file mode 100644 index 3fa9baf7..00000000 --- a/Robust/src/Runtime/DSTM/docs/prefetch +++ /dev/null @@ -1,7 +0,0 @@ -1. Start with flat representation - -*** 2. Analyze representation to figure out where to insert prefetches - -3. Use analysis results to insert prefetch nodes into the flat representation - -4. Modify BuildCode to generate C code from our new flatprefetchnodes \ No newline at end of file diff --git a/Robust/src/Runtime/DSTM/docs/prefetchnotes b/Robust/src/Runtime/DSTM/docs/prefetchnotes deleted file mode 100644 index 1c90595f..00000000 --- a/Robust/src/Runtime/DSTM/docs/prefetchnotes +++ /dev/null @@ -1,61 +0,0 @@ -Q: Why prefetching? - -Possible prefech calls -a) for array fields -b) for pointer fields -c) for typecasted oid's - -e.g. -==== -x.y.z -x.y.r -x.y.r.t -x[i].z -((Integer) x).z - -control = 1 byte, oid = 4 bytes, new oid = 4 bytes, depth = 1/ 2 bytes, name/type = 2 bytes, offset = 2 bytes, index = 2 bytes, typecastcheck = 2 bytes, - - new oid = The oid found at the Participant side that can be sent to Coordinator sending prefetch message - -Assumptions -=========== - -1. Assume a max object size - Q: Why? -2. - -Procedure: -1. Compiler identifies which oids and oids.offset field to prefetch(analysing the C code) -and supplies that information to the Coordinator machine wanting to commit transaction. - Q: How does compiler convey this to a machine? (Design compiler interface) - -2. Machine distinguishes and classifies tuples as "shared" or "unique" - e.g. while prefetching x.y.z and a.y.z if variable x == a then considered shared else unique - also consider the case of x.y.z and a.y.z.t where x == a ( Then prefetch only a.y.z.t) -3. If not available in local machine, look up location table and make piles to send - prefetch control messages to all the Particpant machines from which prefetch is required. -4. Iteratively look up the data field of the objects at the Particpant side to find objects - and send them across to Coordinator. -5. Coordinator takes inventory and finds out the location of the objs not found yet. - Q: How to implement if some objects are not found through prefetch? - -Coordinator messages: - -rec; - unsigned int size = rec->lookupTable->size; - chashlistnode_t *ptr = rec->lookupTable->table; - int i; - for(i = 0; i < size; i++) { - chashlistnode_t *curr = &ptr[i]; //for each entry in the cache lookupTable - while(curr != NULL) { - if(curr->key == 0) - break; - objheader_t *header1, *header2; - if((header1 = mhashSearch(curr->key)) == NULL && ((header2 = prehashSearch(curr->key)) != NULL)) { - /* Not found in local machine's object store and found in prefetch cache */ - /* Remove from prefetch cache */ - prehashRemove(curr->key); - } - curr = curr->next; - } - } -} - -/* This function updates the prefetch cache with - * entires from the transaction cache when a - * transaction commits - * Return -1 on error else returns 0 */ -int updatePrefetchCache(thread_data_array_t* tdata) { - int retval; - char oidType; - oidType = 'R'; - if((retval = copyToCache(tdata->buffer->f.numread, (unsigned int *)(tdata->buffer->objread), tdata, oidType)) != 0) { - printf("%s(): Error in copying objects read at %s, %d\n", __func__, __FILE__, __LINE__); - return -1; - } - oidType = 'M'; - if((retval = copyToCache(tdata->buffer->f.nummod, tdata->buffer->oidmod, tdata, oidType)) != 0) { - printf("%s(): Error in copying objects read at %s, %d\n", __func__, __FILE__, __LINE__); - return -1; - } - return 0; -} - -int copyToCache(int numoid, unsigned int *oidarray, thread_data_array_t *tdata, char oidType) { - int i; - for (i = 0; i < numoid; i++) { - unsigned int oid; - if(oidType == 'R') { - char * objread = (char *) oidarray; - oid = *((unsigned int *)(objread+(sizeof(unsigned int)+ - sizeof(unsigned short))*i)); - } else { - oid = oidarray[i]; - } - pthread_mutex_lock(&prefetchcache_mutex); - objheader_t * header; - if((header = (objheader_t *) chashSearch(tdata->rec->lookupTable, oid)) == NULL) { - printf("%s() obj %x is no longer in transaction cache at %s , %d\n", __func__, oid,__FILE__, __LINE__); - fflush(stdout); - return -1; - } - //copy into prefetch cache - int size; - GETSIZE(size, header); - objheader_t * newAddr; - if((newAddr = prefetchobjstrAlloc(size + sizeof(objheader_t))) == NULL) { - printf("%s(): Error in getting memory from prefetch cache at %s, %d\n", __func__, - __FILE__, __LINE__); - pthread_mutex_unlock(&prefetchcache_mutex); - return -1; - } - pthread_mutex_unlock(&prefetchcache_mutex); - memcpy(newAddr, header, size+sizeof(objheader_t)); - //Increment version for every modified object - if(oidType == 'M') { - newAddr->version += 1; - newAddr->notifylist = NULL; - } - //make an entry in prefetch lookup hashtable - void *oldptr; - if((oldptr = prehashSearch(oid)) != NULL) { - prehashRemove(oid); - prehashInsert(oid, newAddr); - } else { - prehashInsert(oid, newAddr); - } - } //end of for - return 0; -} diff --git a/Robust/src/Runtime/DSTM/interface/addPrefetchEnhance.h b/Robust/src/Runtime/DSTM/interface/addPrefetchEnhance.h deleted file mode 100644 index a335c0ac..00000000 --- a/Robust/src/Runtime/DSTM/interface/addPrefetchEnhance.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef _ADDPREFETCHENHANCE_H_ -#define _ADDPREFETCHENHANCE_H_ - -#include "dstm.h" -#include "mlookup.h" -#include "gCollect.h" - -typedef struct prefetchCountStats { - int retrycount; /* keeps track of when to retry and check if we can turn on this prefetch site */ - int uselesscount; /* keeps track of how long was the prefetching at site useles */ - char operMode; /* 1 = on , 0 = off */ - int callcount; -} pfcstats_t; - -pfcstats_t *initPrefetchStats(); -int getRetryCount(int siteid); -int getUselessCount(int siteid); -char getOperationMode(int); -void handleDynPrefetching(int, int, int); -void cleanPCache(thread_data_array_t *tdata); -int updatePrefetchCache(thread_data_array_t *); -int copyToCache(int , unsigned int *, thread_data_array_t *, char ); - -#endif diff --git a/Robust/src/Runtime/DSTM/interface/addUdpEnhance.c b/Robust/src/Runtime/DSTM/interface/addUdpEnhance.c deleted file mode 100644 index aa8eeb82..00000000 --- a/Robust/src/Runtime/DSTM/interface/addUdpEnhance.c +++ /dev/null @@ -1,210 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include "addUdpEnhance.h" -#include "prelookup.h" - -/************************ - * Global Variables * - ***********************/ -int udpSockFd; -extern unsigned int myIpAddr; - -int createUdpSocket() { - int sockfd; - struct sockaddr_in clientaddr; - const int on = 1; - - if((sockfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0) { - perror("socket creation failed"); - return -1; - } - if((setsockopt(sockfd, SOL_SOCKET, SO_BROADCAST, &on, sizeof(on))) < 0) { - perror("setsockopt - SOL_SOCKET"); - return -1; - } - return sockfd; -} - -int udpInit() { - int sockfd; - int setsockflag = 1; - struct sockaddr_in servaddr; - - //Create Global Udp Socket - if((udpSockFd = createUdpSocket()) < 0) { - printf("Error in socket\n"); - } - - sockfd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); - if(sockfd < 0) { - perror("socket"); - exit(1); - } - - if(setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &setsockflag, sizeof(setsockflag)) < 0) { - perror("socket"); - exit(1); - } - -#ifdef MAC - if(setsockopt(sockfd, SOL_SOCKET, SO_REUSEADDR, &setsockflag, sizeof(setsockflag)) < 0) { - perror("socket"); - exit(1); - } -#endif - - bzero(&servaddr, sizeof(servaddr)); - servaddr.sin_family = AF_INET; - servaddr.sin_port = htons(UDP_PORT); - servaddr.sin_addr.s_addr = htonl(INADDR_ANY); - - if(bind(sockfd, (struct sockaddr *)&servaddr, sizeof(servaddr)) < 0) { - perror("bind"); - exit(1); - } - - return sockfd; -} - -/* Function that listens for udp broadcast messages */ -void *udpListenBroadcast(void *sockfd) { - pthread_t thread_udpBroadcast; - struct sockaddr_in servaddr; - socklen_t socklen = sizeof(struct sockaddr); - char readBuffer[MAX_SIZE]; - int retval; - - printf("Listening on port %d, fd = %d\n", UDP_PORT, (int)sockfd); - - memset(readBuffer, 0, MAX_SIZE); - while(1) { - int bytesRcvd = recvfrom((int)sockfd, readBuffer, sizeof(readBuffer), 0, (struct sockaddr *)&servaddr, &socklen); - if(bytesRcvd == -1) { - printf("DEBUG-> Recv Error! \n"); - break; - } - short status = *((short *) &readBuffer[0]); - switch (status) { - case INVALIDATE_OBJS: - if((retval = invalidateFromPrefetchCache(readBuffer))!= 0) { - printf("Error: In invalidateFromPrefetchCache() at %s, %d\n", __FILE__, __LINE__); - break; - } - break; - default: - printf("Error: Cannot regcognize the status in file %s, at line %d\n", __FILE__, __LINE__); - } - } - - /* Close connection */ - if(close((int)sockfd) == -1) - perror("close"); - pthread_exit(NULL); -} - -/* Function that invalidate objects that - * have been currently modified - * returns -1 on error and 0 on success */ -int invalidateObj(thread_data_array_t *tdata) { - struct sockaddr_in clientaddr; - int retval; - - bzero(&clientaddr, sizeof(clientaddr)); - clientaddr.sin_family = AF_INET; - clientaddr.sin_port = htons(UDP_PORT); - clientaddr.sin_addr.s_addr = INADDR_BROADCAST; - int maxObjsPerMsg = (MAX_SIZE - 2*sizeof(unsigned int))/sizeof(unsigned int); - if(tdata->buffer->f.nummod < maxObjsPerMsg) { - /* send single udp msg */ - int iteration = 0; - if((retval = sendUdpMsg(tdata, &clientaddr, iteration)) < 0) { - printf("%s() error in sending udp message at %s, %d\n", __func__, __FILE__, __LINE__); - return -1; - } - } else { - /* Split into several udp msgs */ - int maxUdpMsg = tdata->buffer->f.nummod/maxObjsPerMsg; - if (tdata->buffer->f.nummod%maxObjsPerMsg) maxUdpMsg++; - int i; - for(i = 1; i <= maxUdpMsg; i++) { - if((retval = sendUdpMsg(tdata, &clientaddr, i)) < 0) { - printf("%s() error in sending udp message at %s, %d\n", __func__, __FILE__, __LINE__); - return -1; - } - } - } - return 0; -} - -/* Function sends a udp broadcast, also distinguishes - * msg size to be sent based on the iteration flag - * returns -1 on error and 0 on success */ -int sendUdpMsg(thread_data_array_t *tdata, struct sockaddr_in *clientaddr, int iteration) { - char writeBuffer[MAX_SIZE]; - int maxObjsPerMsg = (MAX_SIZE - 2*sizeof(unsigned int))/sizeof(unsigned int); - int offset = 0; - *((short *)&writeBuffer[0]) = INVALIDATE_OBJS; //control msg - offset += sizeof(short); - *((unsigned int *)(writeBuffer+offset)) = myIpAddr; //mid sending invalidation - offset += sizeof(unsigned int); - if(iteration == 0) { // iteration flag == zero, send single udp msg - *((short *) (writeBuffer+offset)) = (short) (sizeof(unsigned int) * (tdata->buffer->f.nummod)); //sizeof msg - offset += sizeof(short); - int i; - for(i = 0; i < tdata->buffer->f.nummod; i++) { - *((unsigned int *) (writeBuffer+offset)) = tdata->buffer->oidmod[i]; //copy objects - offset += sizeof(unsigned int); - } - } else { // iteration flag > zero, send multiple udp msg - int numObj; - if((tdata->buffer->f.nummod - (iteration * maxObjsPerMsg)) > 0) - numObj = maxObjsPerMsg; - else - numObj = tdata->buffer->f.nummod - ((iteration - 1)*maxObjsPerMsg); - *((short *) (writeBuffer+offset)) = (short) (sizeof(unsigned int) * numObj); - offset += sizeof(short); - int index = (iteration - 1) * maxObjsPerMsg; - int i; - for(i = 0; i < numObj; i++) { - *((unsigned int *) (writeBuffer+offset)) = tdata->buffer->oidmod[index+i]; - offset += sizeof(unsigned int); - } - } - int n; - if((n = sendto(udpSockFd, (const void *) writeBuffer, sizeof(writeBuffer), 0, (const struct sockaddr *)clientaddr, sizeof(struct sockaddr_in))) < 0) { - perror("sendto error- "); - printf("DEBUG-> sendto error: errorno %d\n", errno); - return -1; - } - return 0; -} - -/* Function searches given oid in prefetch cache and invalidates obj from cache - * returns -1 on error and 0 on success */ -int invalidateFromPrefetchCache(char *buffer) { - int offset = sizeof(short); - /* Read mid from msg */ - unsigned int mid = *((unsigned int *)(buffer+offset)); - offset += sizeof(unsigned int); - //Invalidate only if broadcast if from different machine - if(mid != myIpAddr) { - /* Read objects sent */ - int numObjsRecv = *((short *)(buffer+offset)) / sizeof(unsigned int); - int i; - for(i = 0; i < numObjsRecv; i++) { - unsigned int oid; - oid = *((unsigned int *)(buffer+offset)); - objheader_t *header; - /* Lookup Objects in prefetch cache and remove them */ - if((header = prehashSearch(oid)) != NULL) { - prehashRemove(oid); - } - offset += sizeof(unsigned int); - } - } - return 0; -} diff --git a/Robust/src/Runtime/DSTM/interface/addUdpEnhance.h b/Robust/src/Runtime/DSTM/interface/addUdpEnhance.h deleted file mode 100644 index f68e5ca0..00000000 --- a/Robust/src/Runtime/DSTM/interface/addUdpEnhance.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef _ADDUDPENHANCE_H -#define _ADDUDPENHANCE_H - -#include "dstm.h" - - -/******************************* - * Udp Message structures - ******************************/ -#define INVALIDATE_OBJS 101 - -/************************* - * Global constants - ************************/ -#define MAX_SIZE 2000 - -/******************************** - * Function Prototypes - *******************************/ -int createUdpSocket(); -int udpInit(); -void *udpListenBroadcast(void *); -int invalidateObj(thread_data_array_t *); -int invalidateFromPrefetchCache(char *); -int sendUdpMsg(thread_data_array_t *, struct sockaddr_in *, int); -#endif diff --git a/Robust/src/Runtime/DSTM/interface/clookup.c b/Robust/src/Runtime/DSTM/interface/clookup.c deleted file mode 100644 index 4d834071..00000000 --- a/Robust/src/Runtime/DSTM/interface/clookup.c +++ /dev/null @@ -1,202 +0,0 @@ -#include "clookup.h" -#define INLINE inline __attribute__((always_inline)) - -chashtable_t *chashCreate(unsigned int size, float loadfactor) { - chashtable_t *ctable; - chashlistnode_t *nodes; - int i; - - if((ctable = calloc(1, sizeof(chashtable_t))) == NULL) { - printf("Calloc error %s %d\n", __FILE__, __LINE__); - return NULL; - } - - // Allocate space for the hash table - if((nodes = calloc(size, sizeof(chashlistnode_t))) == NULL) { - printf("Calloc error %s %d\n", __FILE__, __LINE__); - free(ctable); - return NULL; - } - - ctable->table = nodes; - ctable->size = size; - ctable->mask = (size << 1)-1; - ctable->numelements = 0; // Initial number of elements in the hash - ctable->loadfactor = loadfactor; - - return ctable; -} - -//Finds the right bin in the hash table -static INLINE unsigned int chashFunction(chashtable_t *table, unsigned int key) { - return ( key & (table->mask))>>1;//throw away low order bit -} - -//Store objects and their pointers into hash -unsigned int chashInsert(chashtable_t *table, unsigned int key, void *val) { - unsigned int newsize; - int index; - chashlistnode_t *ptr, *node; - - if(table->numelements > (table->loadfactor * table->size)) { - //Resize - newsize = table->size << 1; - chashResize(table,newsize); - } - - ptr = table->table; - table->numelements++; - index = chashFunction(table, key); -#ifdef DEBUG - printf("chashInsert(): DEBUG -> index = %d, key = %d, val = %x\n", index, key, val); -#endif - if(ptr[index].next == NULL && ptr[index].key == 0) { // Insert at the first position in the hashtable - ptr[index].key = key; - ptr[index].val = val; - } else { // Insert in the beginning of linked list - if ((node = calloc(1, sizeof(chashlistnode_t))) == NULL) { - printf("Calloc error %s, %d\n", __FILE__, __LINE__); - return 1; - } - node->key = key; - node->val = val; - node->next = ptr[index].next; - ptr[index].next = node; - } - return 0; -} - -// Search for an address for a given oid -INLINE void * chashSearch(chashtable_t *table, unsigned int key) { - //REMOVE HASH FUNCTION CALL TO MAKE SURE IT IS INLINED HERE - chashlistnode_t *node = &table->table[(key & table->mask)>>1]; - - while(node != NULL) { - if(node->key == key) { - return node->val; - } - node = node->next; - } - return NULL; -} - -unsigned int chashRemove(chashtable_t *table, unsigned int key) { - int index; - chashlistnode_t *curr, *prev; - chashlistnode_t *ptr, *node; - - ptr = table->table; - index = chashFunction(table,key); - curr = &ptr[index]; - - for (; curr != NULL; curr = curr->next) { - if (curr->key == key) { // Find a match in the hash table - table->numelements--; // Decrement the number of elements in the global hashtable - if ((curr == &ptr[index]) && (curr->next == NULL)) { // Delete the first item inside the hashtable with no linked list of chashlistnode_t - curr->key = 0; - curr->val = NULL; - } else if ((curr == &ptr[index]) && (curr->next != NULL)) { //Delete the first item with a linked list of chashlistnode_t connected - curr->key = curr->next->key; - curr->val = curr->next->val; - node = curr->next; - curr->next = curr->next->next; - free(node); - } else { // Regular delete from linked listed - prev->next = curr->next; - free(curr); - } - return 0; - } - prev = curr; - } - return 1; -} - -unsigned int chashResize(chashtable_t *table, unsigned int newsize) { - chashlistnode_t *node, *ptr, *curr, *next; // curr and next keep track of the current and the next chashlistnodes in a linked list - unsigned int oldsize; - int isfirst; // Keeps track of the first element in the chashlistnode_t for each bin in hashtable - int i,index; - chashlistnode_t *newnode; - - ptr = table->table; - oldsize = table->size; - - if((node = calloc(newsize, sizeof(chashlistnode_t))) == NULL) { - printf("Calloc error %s %d\n", __FILE__, __LINE__); - return 1; - } - - table->table = node; //Update the global hashtable upon resize() - table->size = newsize; - table->mask = (newsize << 1)-1; - table->numelements = 0; - - for(i = 0; i < oldsize; i++) { //Outer loop for each bin in hash table - curr = &ptr[i]; - isfirst = 1; - while (curr != NULL) { //Inner loop to go through linked lists - if (curr->key == 0) { //Exit inner loop if there the first element for a given bin/index is NULL - break; //key = val =0 for element if not present within the hash table - } - next = curr->next; - - index = chashFunction(table, curr->key); -#ifdef DEBUG - printf("DEBUG(resize) -> index = %d, key = %d, val = %x\n", index, curr->key, curr->val); -#endif - // Insert into the new table - if(table->table[index].next == NULL && table->table[index].key == 0) { - table->table[index].key = curr->key; - table->table[index].val = curr->val; - table->numelements++; - }else { - if((newnode = calloc(1, sizeof(chashlistnode_t))) == NULL) { - printf("Calloc error %s, %d\n", __FILE__, __LINE__); - return 1; - } - newnode->key = curr->key; - newnode->val = curr->val; - newnode->next = table->table[index].next; - table->table[index].next = newnode; - table->numelements++; - } - - //free the linked list of chashlistnode_t if not the first element in the hash table - if (isfirst != 1) { - free(curr); - } - - isfirst = 0; - curr = next; - } - } - - free(ptr); //Free the memory of the old hash table - return 0; -} - -//Delete the entire hash table -void chashDelete(chashtable_t *ctable) { - int i, isFirst; - chashlistnode_t *ptr, *curr, *next; - ptr = ctable->table; - - for(i=0 ; isize ; i++) { - curr = &ptr[i]; - isFirst = 1 ; - while(curr != NULL) { - next = curr->next; - if(isFirst != 1) { - free(curr); - } - isFirst = 0; - curr = next; - } - } - - free(ptr); - ptr = NULL; - free(ctable); - ctable = NULL; -} diff --git a/Robust/src/Runtime/DSTM/interface/clookup.h b/Robust/src/Runtime/DSTM/interface/clookup.h deleted file mode 100644 index 475a66f0..00000000 --- a/Robust/src/Runtime/DSTM/interface/clookup.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef _CLOOKUP_H_ -#define _CLOOKUP_H_ - -#include -#include - -#define CLOADFACTOR 0.25 -#define CHASH_SIZE 1024 - -typedef struct chashlistnode { - unsigned int key; - void *val; //this can be cast to another type or used to point to a larger structure - struct chashlistnode *next; -} chashlistnode_t; - -typedef struct chashtable { - chashlistnode_t *table; // points to beginning of hash table - unsigned int size; - unsigned int mask; - unsigned int numelements; - float loadfactor; -} chashtable_t; - -/* Prototypes for hash*/ -chashtable_t *chashCreate(unsigned int size, float loadfactor); -static unsigned int chashFunction(chashtable_t *table, unsigned int key); -unsigned int chashInsert(chashtable_t *table, unsigned int key, void *val); -void *chashSearch(chashtable_t *table, unsigned int key); //returns val, NULL if not found -unsigned int chashRemove(chashtable_t *table, unsigned int key); //returns -1 if not found -unsigned int chashResize(chashtable_t *table, unsigned int newsize); -void chashDelete(chashtable_t *table); -/* end hash */ - -#endif - diff --git a/Robust/src/Runtime/DSTM/interface/dht.c b/Robust/src/Runtime/DSTM/interface/dht.c deleted file mode 100644 index cccbcfcd..00000000 --- a/Robust/src/Runtime/DSTM/interface/dht.c +++ /dev/null @@ -1,1750 +0,0 @@ -/******************************************************************************* -* dht.c -* -* High-performance Distributed Hash Table for finding the location of objects -* in a Distributed Shared Transactional Memory system. -* -* Creator: Erik Rubow -* -* TODO: -* 1) Instead of having dhtInsertMult, dhtSearchMult, etc. call their single-key -* counterparts repeatedly, define some new messages to handle it more -* efficiently. -* 2) Improve the efficiency of functions that work with hostArray, hostReplied, -* and blockOwnerArray. -* 3) Currently a join or leave causes a rebuild of the entire hash table. -* Implement more graceful join and leave procedures. -* 4) Fine tune timeout values for performance, possibly implement a backoff -* algorithm to prevent overloading the network. -* 5) Whatever else I'm forgetting -* -*******************************************************************************/ -/******************************************************************************* -* Includes -*******************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "dht.h" -#include "clookup.h" //this works for now, do we need anything better? -#include "mlookup.h" - -/******************************************************************************* -* Local Defines, Structs -*******************************************************************************/ - -#define MAX_MSG_SIZE 1500 -#define UDP_PORT 2157 -#define INIT_HOST_ALLOC 3 -#define INIT_NUM_BLOCKS 16 -#define DEFAULT_INTERFACE "eth0" -#define TIMEOUT_PERIOD 100 -#define INSERT_TIMEOUT_MS 500 -#define INSERT_RETRIES 50 -#define REMOVE_TIMEOUT_MS 500 -#define REMOVE_RETRIES 50 -#define SEARCH_TIMEOUT_MS 500 -#define SEARCH_RETRIES 50 - -//message types -//make sure this matches msg_types global var -enum -{ - INSERT_CMD, - INSERT_RES, - REMOVE_CMD, - REMOVE_RES, - SEARCH_CMD, - SEARCH_RES, - WHO_IS_LEADER_CMD, - WHO_IS_LEADER_RES, - JOIN_REQ, - JOIN_RES, - LEAVE_REQ, - LEAVE_RES, - DHT_UPDATE_CMD, - DHT_UPDATE_RES, - ELECT_LEADER_CMD, - ELECT_LEADER_RES, - CONGRATS_CMD, - REBUILD_REQ, - REBUILD_CMD, - FILL_DHT_CMD, - FILL_DHT_RES, - RESUME_NORMAL_CMD, - RESUME_NORMAL_RES, - NUM_MSG_TYPES -}; - -//states -//make sure this matches state_names, timeout_vals, and retry_vals global vars -enum -{ - INIT1_STATE, - INIT2_STATE, - NORMAL_STATE, - LEAD_NORMAL1_STATE, - LEAD_NORMAL2_STATE, - ELECT1_STATE, - ELECT2_STATE, - REBUILD0_STATE, - REBUILD1_STATE, - REBUILD2_STATE, - REBUILD3_STATE, - REBUILD4_STATE, - REBUILD5_STATE, - LEAD_REBUILD1_STATE, - LEAD_REBUILD2_STATE, - LEAD_REBUILD3_STATE, - LEAD_REBUILD4_STATE, - EXIT1_STATE, - EXIT2_STATE, - NUM_STATES -}; - -//status codes -enum -{ - OPERATION_OK, - KEY_NOT_FOUND, - NOT_KEY_OWNER, - NOT_LEADER, - INTERNAL_ERROR -}; - -struct hostData -{ - unsigned int ipAddr; - unsigned int maxKeyCapacity; -}; - -/******************************************************************************* -* Local Function Prototypes -*******************************************************************************/ - -int msgSizeOk(unsigned char *msg, unsigned int size); -unsigned short read2(unsigned char *msg); -unsigned int read4(unsigned char *msg); -void write2(unsigned char *ptr, unsigned short tmp); -void write4(unsigned char *ptr, unsigned int tmp); -unsigned int getMyIpAddr(const char *interfaceStr); -int udpSend(unsigned char *msg, unsigned int size, unsigned int destIp); -int udpSendAll(unsigned char *msg, unsigned int size); -unsigned int hash(unsigned int x); -unsigned int getKeyOwner(unsigned int key); -void setState(unsigned int newState); -void makeAssignments(); -int addHost(struct hostData newHost); -int removeHost(unsigned int ipAddr); -void removeUnresponsiveHosts(); -int checkReplied(unsigned int ipAddr); -int allReplied(); -void writeHostList(); -void dhtLog(const char *format, ...); -void *fillTask(); -void *udpListen(); - -/******************************************************************************* -* Global Variables -*******************************************************************************/ - -//make sure this matches enumeration above -const char *msg_types[NUM_MSG_TYPES] = -{ - "INSERT_CMD", - "INSERT_RES", - "REMOVE_CMD", - "REMOVE_RES", - "SEARCH_CMD", - "SEARCH_RES", - "WHO_IS_LEADER_CMD", - "WHO_IS_LEADER_RES", - "JOIN_REQ", - "JOIN_RES", - "LEAVE_REQ", - "LEAVE_RES", - "DHT_UPDATE_CMD", - "DHT_UPDATE_RES", - "ELECT_LEADER_CMD", - "ELECT_LEADER_RES", - "CONGRATS_CMD", - "REBUILD_REQ", - "REBUILD_CMD", - "FILL_DHT_CMD", - "FILL_DHT_RES", - "RESUME_NORMAL_CMD", - "RESUME_NORMAL_RES" -}; - -const char *state_names[NUM_STATES] = -{ - "INIT1_STATE", - "INIT2_STATE", - "NORMAL_STATE", - "LEAD_NORMAL1_STATE", - "LEAD_NORMAL2_STATE", - "ELECT1_STATE", - "ELECT2_STATE", - "REBUILD0_STATE", - "REBUILD1_STATE", - "REBUILD2_STATE", - "REBUILD3_STATE", - "REBUILD4_STATE", - "REBUILD5_STATE", - "LEAD_REBUILD1_STATE", - "LEAD_REBUILD2_STATE", - "LEAD_REBUILD3_STATE", - "LEAD_REBUILD4_STATE", - "EXIT1_STATE", - "EXIT2_STATE", -}; - -//note: { 0, 0 } means no timeout -struct timeval timeout_vals[NUM_STATES] = -{ - { 0, 500000 }, //INIT1_STATE - { 0, 500000 }, //INIT2_STATE - { 0, 0 }, //NORMAL_STATE - { 0, 0 }, //LEAD_NORMAL1_STATE - { 3, 0 }, //LEAD_NORMAL2_STATE - { 1, 0 }, //ELECT1_STATE - { 1, 0 }, //ELECT2_STATE - { 0, 500000 }, //REBUILD0_STATE - { 0, 500000 }, //REBUILD1_STATE - { 10, 0 }, //REBUILD2_STATE - { 10, 0 }, //REBUILD3_STATE - { 10, 0 }, //REBUILD4_STATE - { 1, 0 }, //REBUILD5_STATE - { 1, 0 }, //LEAD_REBUILD1_STATE - { 1, 0 }, //LEAD_REBUILD2_STATE - { 10, 0 }, //LEAD_REBUILD3_STATE - { 10, 0 }, //LEAD_REBUILD4_STATE - { 0, 500000 }, //EXIT1_STATE - { 0, 0 } //EXIT2_STATE -}; - -int retry_vals[NUM_STATES] = -{ - 100, //INIT1_STATE - 10, //INIT2_STATE - 0, //NORMAL_STATE - 0, //LEAD_NORMAL1_STATE - 0, //LEAD_NORMAL2_STATE - 10, //ELECT1_STATE - 10, //ELECT2_STATE - 10, //REBUILD0_STATE - 10, //REBUILD1_STATE - 0, //REBUILD2_STATE - 0, //REBUILD3_STATE - 0, //REBUILD4_STATE - 10, //REBUILD5_STATE - 10, //LEAD_REBUILD1_STATE - 10, //LEAD_REBUILD2_STATE - 10, //LEAD_REBUILD3_STATE - 10, //LEAD_REBUILD4_STATE - 10, //EXIT1_STATE - 0 //EXIT2_STATE -}; - -FILE *logfile; -struct hostData myHostData; -pthread_t threadUdpListen; -pthread_t threadFillTask; -//status of fillTask: 0 = ready to run, 1 = running, 2 = completed, 3 = error -int fillStatus; -struct pollfd udpPollSock; -unsigned int state; -unsigned int seed; -unsigned int leader; -unsigned int electionOriginator; -unsigned int electionParent; -unsigned int hostArraySize = 0; -struct hostData *hostArray = NULL; -unsigned int numBlocks = 0; -unsigned short *blockOwnerArray = NULL; -unsigned char *hostReplied = NULL; -pthread_mutex_t stateMutex; -pthread_cond_t stateCond; -chashtable_t *myHashTable; -unsigned int numHosts; -struct timeval timer; -int timerSet; -int timeoutCntr; - -/******************************************************************************* -* Interface Function Definitions -*******************************************************************************/ - -void dhtInit(unsigned int seedIpAddr, unsigned int maxKeyCapacity) -{ - struct in_addr tmpAddr; - char filename[23] = "dht-"; - struct sockaddr_in myAddr; - struct sockaddr_in seedAddr; - socklen_t socklen = sizeof(struct sockaddr_in); - char initMsg; - - tmpAddr.s_addr = htonl(getMyIpAddr(DEFAULT_INTERFACE)); - strcat(filename, inet_ntoa(tmpAddr)); - strcat(filename, ".log"); - printf("log file: %s\n", filename); - - logfile = fopen(filename, "w"); - dhtLog("dhtInit(): inializing...\n"); - - myHostData.ipAddr = getMyIpAddr(DEFAULT_INTERFACE); - myHostData.maxKeyCapacity = maxKeyCapacity; - - seed = seedIpAddr; - leader = 0; - electionOriginator = 0; - electionParent = 0; - hostArraySize = INIT_HOST_ALLOC; - hostArray = calloc(hostArraySize, sizeof(struct hostData)); - hostReplied = calloc(hostArraySize, sizeof(unsigned char)); - hostArray[0] = myHostData; - numHosts = 1; - numBlocks = INIT_NUM_BLOCKS; - blockOwnerArray = calloc(numBlocks, sizeof(unsigned short)); - pthread_mutex_init(&stateMutex, NULL); - pthread_cond_init(&stateCond, NULL); - myHashTable = chashCreate(HASH_SIZE, LOADFACTOR); - - udpPollSock.fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); - if (udpPollSock.fd < 0) - perror("dhtInit():socket()"); - - udpPollSock.events = POLLIN; - - bzero(&myAddr, socklen); - myAddr.sin_family = AF_INET; - myAddr.sin_addr.s_addr = htonl(INADDR_ANY); - myAddr.sin_port = htons(UDP_PORT); - - if (bind(udpPollSock.fd, (struct sockaddr *)&myAddr, socklen) < 0) - perror("dhtInit():bind()"); - - if (seed == 0) - { - dhtLog("I am the leader\n"); - leader = myHostData.ipAddr; - setState(LEAD_NORMAL1_STATE); - } - else - { - initMsg = WHO_IS_LEADER_CMD; - udpSend(&initMsg, 1, seed); - setState(INIT1_STATE); - } - - if (pthread_create(&threadUdpListen, NULL, udpListen, NULL) != 0) - dhtLog("dhtInit() - ERROR creating threadUdpListen\n"); - - return; -} - -void dhtExit() -{ //TODO: do this gracefully, wait for response from leader, etc. - char msg; - - msg = LEAVE_REQ; - udpSend(&msg, 1, leader); - dhtLog("dhtExit(): cleaning up...\n"); - pthread_cancel(threadUdpListen); - close(udpPollSock.fd); - free(hostArray); - free(hostReplied); - free(blockOwnerArray); - fclose(logfile); - - return; -} - -int dhtInsert(unsigned int key, unsigned int val) -{ - struct sockaddr_in toAddr; - struct sockaddr_in fromAddr; - socklen_t socklen = sizeof(struct sockaddr_in); - struct pollfd pollsock; - char inBuffer[2]; - char outBuffer[9]; - ssize_t bytesRcvd; - int i; - int retval; - int status = -1; - - bzero((char *)&toAddr, socklen); - toAddr.sin_family = AF_INET; - toAddr.sin_port = htons(UDP_PORT); - - while (status != OPERATION_OK) - { - pthread_mutex_lock(&stateMutex); - while (!(state == NORMAL_STATE || state == LEAD_NORMAL1_STATE - || state == LEAD_NORMAL2_STATE || state == REBUILD4_STATE - || state == LEAD_REBUILD3_STATE)) - pthread_cond_wait(&stateCond, &stateMutex); - toAddr.sin_addr.s_addr = htonl(getKeyOwner(key)); - pthread_mutex_unlock(&stateMutex); - - if ((pollsock.fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) - { - perror("dhtInsert():socket()"); - return -1; - } - pollsock.events = POLLIN; - - outBuffer[0] = INSERT_CMD; - write4(&outBuffer[1], key); - write4(&outBuffer[5], val); - - for (i = 0; i < INSERT_RETRIES; i++) - { - if (sendto(pollsock.fd, outBuffer, 9, 0, (struct sockaddr *)&toAddr, - socklen) < 0) - { - perror("dhtInsert():sendto()"); - break; - } - retval = poll(&pollsock, 1, INSERT_TIMEOUT_MS); - if (retval < 0) - { - perror("dhtInsert():poll()"); - break; - } - if (retval > 0) - { - bytesRcvd = recvfrom(pollsock.fd, inBuffer, 2, 0, - (struct sockaddr *)&fromAddr, &socklen); - if (fromAddr.sin_addr.s_addr == toAddr.sin_addr.s_addr - && fromAddr.sin_port == toAddr.sin_port - && bytesRcvd == 2 && inBuffer[0] == INSERT_RES) - { - status = inBuffer[1]; //status from remote host - break; - } - } - } - if (status != OPERATION_OK) - { - pthread_mutex_lock(&stateMutex); - setState(REBUILD0_STATE); - outBuffer[0] = REBUILD_REQ; - udpSend(outBuffer, 1, leader); - pthread_mutex_unlock(&stateMutex); - } - } - - close(pollsock.fd); - - return status; -} - -int dhtInsertMult(unsigned int numKeys, unsigned int *keys, unsigned int *vals) -{ - int status; - int i; - - status = 0; - for (i = 0; i < numKeys; i++) - { - if (dhtInsert(keys[i], vals[i]) != 0) - status = -1; - } - return status; -} - -int dhtRemove(unsigned int key) -{ - struct sockaddr_in toAddr; - struct sockaddr_in fromAddr; - socklen_t socklen = sizeof(struct sockaddr_in); - struct pollfd pollsock; - char inBuffer[2]; - char outBuffer[5]; - ssize_t bytesRcvd; - int i; - int retval; - int status = -1; - - bzero((char *)&toAddr, socklen); - toAddr.sin_family = AF_INET; - toAddr.sin_port = htons(UDP_PORT); - - while (!(status == OPERATION_OK || status == KEY_NOT_FOUND)) - { - pthread_mutex_lock(&stateMutex); - while (!(state == NORMAL_STATE || state == LEAD_NORMAL1_STATE - || state == LEAD_NORMAL2_STATE)) - pthread_cond_wait(&stateCond, &stateMutex); - toAddr.sin_addr.s_addr = htonl(getKeyOwner(key)); - pthread_mutex_unlock(&stateMutex); - - if ((pollsock.fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) - { - perror("dhtRemove():socket()"); - return -1; - } - pollsock.events = POLLIN; - - outBuffer[0] = REMOVE_CMD; - write4(&outBuffer[1], key); - - for (i = 0; i < REMOVE_RETRIES; i++) - { - if (sendto(pollsock.fd, outBuffer, 5, 0, (struct sockaddr *)&toAddr, - socklen) < 0) - { - perror("dhtRemove():sendto()"); - break; - } - retval = poll(&pollsock, 1, REMOVE_TIMEOUT_MS); - if (retval < 0) - { - perror("dhtRemove():poll()"); - break; - } - if (retval > 0) - { - bytesRcvd = recvfrom(pollsock.fd, inBuffer, 2, 0, - (struct sockaddr *)&fromAddr, &socklen); - if (fromAddr.sin_addr.s_addr == toAddr.sin_addr.s_addr - && fromAddr.sin_port == toAddr.sin_port - && bytesRcvd == 2 && inBuffer[0] == REMOVE_RES) - { - status = inBuffer[1]; //status from remote host - break; - } - } - } - if (!(status == OPERATION_OK || status == KEY_NOT_FOUND)) - { - pthread_mutex_lock(&stateMutex); - setState(REBUILD0_STATE); - outBuffer[0] = REBUILD_REQ; - udpSend(outBuffer, 1, leader); - pthread_mutex_unlock(&stateMutex); - } - } - - close(pollsock.fd); - - return status; -} - -int dhtRemoveMult(unsigned int numKeys, unsigned int *keys) -{ - int status; - int i; - - status = 0; - for (i = 0; i < numKeys; i++) - { - if (dhtRemove(keys[i]) != 0) - status = -1; - } - return status; -} - -int dhtSearch(unsigned int key, unsigned int *val) -{ - struct sockaddr_in toAddr; - struct sockaddr_in fromAddr; - socklen_t socklen = sizeof(struct sockaddr_in); - struct pollfd pollsock; - char inBuffer[6]; - char outBuffer[5]; - ssize_t bytesRcvd; - int i; - int retval; - int status = -1; - - bzero((char *)&toAddr, socklen); - toAddr.sin_family = AF_INET; - toAddr.sin_port = htons(UDP_PORT); - - while (!(status == OPERATION_OK || status == KEY_NOT_FOUND)) - { - pthread_mutex_lock(&stateMutex); - while (numBlocks == 0) - pthread_cond_wait(&stateCond, &stateMutex); - toAddr.sin_addr.s_addr = htonl(getKeyOwner(key)); - pthread_mutex_unlock(&stateMutex); - - if ((pollsock.fd = socket(AF_INET, SOCK_DGRAM, 0)) < 0) - { - perror("dhtSearch():socket()"); - return -1; - } - pollsock.events = POLLIN; - - outBuffer[0] = SEARCH_CMD; - write4(&outBuffer[1], key); - - for (i = 0; i < SEARCH_RETRIES; i++) - { - if (sendto(pollsock.fd, outBuffer, 5, 0, (struct sockaddr *)&toAddr, - socklen) < 0) - { - perror("dhtSearch():sendto()"); - break; - } - retval = poll(&pollsock, 1, SEARCH_TIMEOUT_MS); - if (retval < 0) - { - perror("dhtSearch():poll()"); - break; - } - if (retval > 0) - { - bytesRcvd = recvfrom(pollsock.fd, inBuffer, 6, 0, - (struct sockaddr *)&fromAddr, &socklen); - if (fromAddr.sin_addr.s_addr == toAddr.sin_addr.s_addr - && fromAddr.sin_port == toAddr.sin_port - && bytesRcvd == 6 && inBuffer[0] == SEARCH_RES) - { - status = inBuffer[1]; //status from remote host - *val = read4(&inBuffer[2]); - break; - } - } - } - if (!(status == OPERATION_OK || status == KEY_NOT_FOUND)) - { - pthread_mutex_lock(&stateMutex); - setState(REBUILD0_STATE); - outBuffer[0] = REBUILD_REQ; - udpSend(outBuffer, 1, leader); - pthread_mutex_unlock(&stateMutex); - } - } - - close(pollsock.fd); - - return status; -} - -int dhtSearchMult(unsigned int numKeys, unsigned int *keys, unsigned int *vals) -{ - int i; - int status = 0; - for (i = 0; i < numKeys; i++) - { - if (dhtSearch(keys[i], &vals[i]) != 0) - status = -1; - } - return status; -} - -/******************************************************************************* -* Local Function Definitions -*******************************************************************************/ - -int msgSizeOk(unsigned char *msg, unsigned int size) -{ - unsigned short tmpNumHosts; - unsigned short tmpNumBlocks; - - if (size < 1) - return 1; - - switch (msg[0]) - { - case WHO_IS_LEADER_CMD: - case LEAVE_REQ: - case LEAVE_RES: - case DHT_UPDATE_RES: - case REBUILD_REQ: - case REBUILD_CMD: - case FILL_DHT_CMD: - case FILL_DHT_RES: - case RESUME_NORMAL_CMD: - case RESUME_NORMAL_RES: - return (size == 1); - case INSERT_RES: - case REMOVE_RES: - case JOIN_RES: - return (size == 2); - case REMOVE_CMD: - case SEARCH_CMD: - case WHO_IS_LEADER_RES: - case JOIN_REQ: - case ELECT_LEADER_CMD: - return (size == 5); - case SEARCH_RES: - return (size == 6); - case INSERT_CMD: - return (size == 9); - case DHT_UPDATE_CMD: - if (size < 5) - return 1; - tmpNumHosts = read2(&msg[1]); - tmpNumBlocks = read2(&msg[3]); - return (size == (5+sizeof(struct hostData)*tmpNumHosts+2*tmpNumBlocks)); - case ELECT_LEADER_RES: - if (size < 2) - return 1; - if (msg[1] == 0xFF) - return (size == 2); - if (size < 4) - return 1; - tmpNumHosts = read2(&msg[2]); - return (size == (4 + sizeof(struct hostData) * tmpNumHosts)); - case CONGRATS_CMD: - if (size < 3) - return 1; - tmpNumHosts = read2(&msg[1]); - return (size == (3 + sizeof(struct hostData) * tmpNumHosts)); - default: - return 1; - } -} - -unsigned short read2(unsigned char *ptr) -{ - unsigned short tmp = (ptr[1] << 8) | ptr[0]; - return tmp; -} - -unsigned int read4(unsigned char *ptr) -{ - unsigned int tmp = (ptr[3] << 24) | (ptr[2] << 16) | (ptr[1] << 8) | ptr[0]; - return tmp; -} - -void write2(unsigned char *ptr, unsigned short tmp) -{ - ptr[1] = (tmp >> 8) & 0xFF; - ptr[0] = tmp & 0xFF; - return; -} - -void write4(unsigned char *ptr, unsigned int tmp) -{ - ptr[3] = (tmp >> 24) & 0xFF; - ptr[2] = (tmp >> 16) & 0xFF; - ptr[1] = (tmp >> 8) & 0xFF; - ptr[0] = tmp & 0xFF; - return; -} - -unsigned int getMyIpAddr(const char *interfaceStr) -{ - int sock; - struct ifreq interfaceInfo; - struct sockaddr_in *myAddr = (struct sockaddr_in *)&interfaceInfo.ifr_addr; - - memset(&interfaceInfo, 0, sizeof(struct ifreq)); - - if((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) - { - perror("getMyIpAddr():socket()"); - return 1; - } - - strcpy(interfaceInfo.ifr_name, interfaceStr); - myAddr->sin_family = AF_INET; - - if(ioctl(sock, SIOCGIFADDR, &interfaceInfo) != 0) - { - perror("getMyIpAddr():ioctl()"); - return 1; - } - - return ntohl(myAddr->sin_addr.s_addr); -} - -int udpSend(unsigned char *msg, unsigned int size, unsigned int destIp) -{ - struct sockaddr_in peerAddr; - socklen_t socklen = sizeof(struct sockaddr_in); - - bzero(&peerAddr, socklen); - peerAddr.sin_family = AF_INET; - peerAddr.sin_addr.s_addr = htonl(destIp); - peerAddr.sin_port = htons(UDP_PORT); - - if (size >= 1) - { - if (msg[0] < NUM_MSG_TYPES) - dhtLog("udpSend(): sending %s to %s, %d bytes\n", msg_types[msg[0]], - inet_ntoa(peerAddr.sin_addr), size); - else - dhtLog("udpSend(): sending unknown message to %s, %d bytes\n", - inet_ntoa(peerAddr.sin_addr), size); - } - - if (sendto(udpPollSock.fd, (void *)msg, size, 0, (struct sockaddr *)&peerAddr, - socklen) < 0) - { - perror("udpSend():sendto()"); - return -1; - } - - return 0; -} - -int udpSendAll(unsigned char *msg, unsigned int size) -{ - int i; - int status = 0; - for (i = 0; i < numHosts; i++) - { - if ((hostReplied[i] == 0) && (hostArray[i].ipAddr != myHostData.ipAddr)) - { - if (udpSend(msg, size, hostArray[i].ipAddr) != 0) - status = -1; - } - } - return status; -} - -//note: make sure this is only executed in a valid state, where numBlocks != 0 -unsigned int hash(unsigned int x) -{ - return (x % numBlocks); -} - -//note: make sure this is only executed in a valid state, where these arrays -// are allocated and the index mappings are consistent -unsigned int getKeyOwner(unsigned int key) -{ - return hostArray[blockOwnerArray[hash(key)]].ipAddr; -} - -//sets state and timer, if applicable -void setState(unsigned int newState) -{ - struct timeval now; - int i; - - gettimeofday(&now, NULL); - - if (newState >= NUM_STATES) - { - dhtLog("setState(): ERROR: invalid state %d\n", newState); - } - else - { - if (timeout_vals[newState].tv_sec == 0 - && timeout_vals[newState].tv_usec == 0) - { //no timer - timerSet = 0; - } - else - { - timeradd(&now, &timeout_vals[newState], &timer); - timerSet = 1; - } - timeoutCntr = 0; - state = newState; - //TODO: only do this for states that require it - for (i = 0; i < numHosts; i++) - hostReplied[i] = 0; - - dhtLog("setState(): state set to %s\n", state_names[state]); - } - - return; -} - -//TODO: improve these simple and inefficient functions -int checkReplied(unsigned int ipAddr) -{ - int i; - - i = findHost(ipAddr); - - if (i == -1) - return -1; - - hostReplied[i] = 1; - - return 0; -} - -int allReplied() -{ - int i; - - for (i = 0; i < numHosts; i++) - if ((hostReplied[i] == 0) && (hostArray[i].ipAddr != myHostData.ipAddr)) - return 0; - - return 1; -} - -int findHost(unsigned int ipAddr) -{ - int i; - - for (i = 0; i < numHosts; i++) - if (hostArray[i].ipAddr == ipAddr) - return i; //found, return index - - return -1; //not found -} - -int removeHost(unsigned int ipAddr) -{ - int i, j; - - i = findHost(ipAddr); - - if (i == -1) - return -1; - - for (j = 0; j < numBlocks; j++) - { - if (blockOwnerArray[j] == i) - blockOwnerArray[j] = 0; //TODO: is this what I want to have happen? - else if (blockOwnerArray[j] > i) - blockOwnerArray[j]--; - } - - for (; i < numHosts - 1; i++) - { - hostArray[i] = hostArray[i+1]; - hostReplied[i] = hostReplied[i+1]; - } - numHosts--; - - return 0; -} - -void removeUnresponsiveHosts() -{ - int i; - - for (i = 0; i < numHosts; i++) - { - if (!hostReplied[i] && hostArray[i].ipAddr != myHostData.ipAddr) - removeHost(hostArray[i].ipAddr); - } -} - -int addHost(struct hostData newHost) -{ - struct hostData *newHostArray; - unsigned char *newHostReplied; - int i; - int j; - - for (i = 0; i < numHosts; i++) - { - if (hostArray[i].ipAddr == newHost.ipAddr) - { - hostArray[i] = newHost; - hostReplied[i] = 0; - return 0; - } - else if (hostArray[i].ipAddr > newHost.ipAddr) - { - if (numHosts == hostArraySize) - { - newHostArray = calloc(2 * hostArraySize, sizeof(struct hostData)); - newHostReplied = calloc(2 * hostArraySize, sizeof(unsigned char)); - memcpy(newHostArray, hostArray, (i * sizeof(struct hostData))); - memcpy(newHostReplied, hostReplied, (i * sizeof(unsigned char))); - newHostArray[i] = newHost; - newHostReplied[i] = 0; - memcpy(&newHostArray[i+1], &hostArray[i], ((numHosts - i) * - sizeof(struct hostData))); - memcpy(&newHostReplied[i+1], &hostReplied[i], ((numHosts - i) * - sizeof(unsigned char))); - free(hostArray); - free(hostReplied); - hostArray = newHostArray; - hostReplied = newHostReplied; - hostArraySize = 2 * hostArraySize; - } - else - { - for (j = numHosts; j > i; j--) - { - hostArray[j] = hostArray[j-1]; - hostReplied[j] = hostReplied[j-1]; - } - hostArray[i] = newHost; - hostReplied[i] = 0; - } - for(j = 0; j < numBlocks; j++) - { - if (blockOwnerArray[j] >= i) - blockOwnerArray[j]++; - } - numHosts++; - return 1; - } - } - - //nothing greater, add to end - if (numHosts == hostArraySize) - { - newHostArray = calloc(2 * hostArraySize, sizeof(struct hostData)); - newHostReplied = calloc(2 * hostArraySize, sizeof(unsigned char)); - memcpy(newHostArray, hostArray, (numHosts * sizeof(struct hostData))); - memcpy(newHostReplied, hostReplied, (numHosts * sizeof(unsigned char))); - free(hostArray); - free(hostReplied); - hostArray = newHostArray; - hostReplied = newHostReplied; - hostArraySize = 2 * hostArraySize; - } - - hostArray[numHosts] = newHost; - hostReplied[numHosts] = 0; - numHosts++; - return 1; -} - -void makeAssignments() -{ - int i; - - if (numBlocks < numHosts) - { - free(blockOwnerArray); - while (numBlocks < numHosts) - numBlocks *= 2; - blockOwnerArray = calloc(numBlocks, sizeof(unsigned short)); - } - - for (i = 0; i < numBlocks; i++) - blockOwnerArray[i] = i % numHosts; - - return; -} - -void writeHostList() -{ - int i; - struct in_addr tmpAddr; - - fprintf(logfile, "numHosts = %d\n", numHosts); - for (i = 0; i < numHosts; i++) - { - tmpAddr.s_addr = htonl(hostArray[i].ipAddr); - fprintf(logfile, "%d) %s, %d\n", i, inet_ntoa(tmpAddr), - hostArray[i].maxKeyCapacity); - } - return; -} - -void dhtLog(const char *format, ...) -{ - va_list args; -// struct timeval now; - -// if (gettimeofday(&now, NULL) < 0) -// { perror("dhtLog():gettimeofday()"); } - va_start(args, format); -// if (fprintf(logfile, "%d.%06d:", now.tv_sec, now.tv_usec) < 0) -// { perror("dhtLog():fprintf()"); } - if (vfprintf(logfile, format, args) < 0) - { perror("dhtLog():vfprintf()"); } - if (fflush(logfile) == EOF) - { perror("dhtLog():fflush()"); } - va_end(args); - - return; -} - -void *fillTask() -{ - unsigned int *vals; - unsigned int *keys; - unsigned int numKeys; - int i; - - vals = mhashGetKeys(&numKeys); //note: key of mhash is val of dht - keys = calloc(numKeys, sizeof(unsigned int)); - - for (i = 0; i < numKeys; i++) - keys[i] = myHostData.ipAddr; - - if (dhtInsertMult(numKeys, keys, vals) == 0) - fillStatus = 2; - else - fillStatus = 3; - - pthread_exit(NULL); -} - -void *udpListen() -{ - ssize_t bytesRcvd; - struct sockaddr_in peerAddr; - unsigned int peerIp; - socklen_t socklen = sizeof(struct sockaddr_in); - unsigned char inBuffer[MAX_MSG_SIZE]; - unsigned char outBuffer[MAX_MSG_SIZE]; - int pollret; - struct timeval now; - struct in_addr tmpAddr; - struct hostData tmpHost; - unsigned int tmpKey; - unsigned int tmpVal; - struct hostData *hostDataPtr; - unsigned short *uShortPtr; - unsigned int tmpUInt; - unsigned int tmpUShort; - int i; - unsigned int oldState; - - dhtLog("udpListen(): linstening on port %d...\n", UDP_PORT); - - while (1) - { - pollret = poll(&udpPollSock, 1, TIMEOUT_PERIOD); - pthread_mutex_lock(&stateMutex); - oldState = state; - if (pollret < 0) - { - perror("udpListen():poll()"); - } - else if (pollret > 0) - { - bytesRcvd = recvfrom(udpPollSock.fd, inBuffer, MAX_MSG_SIZE, 0, - (struct sockaddr *)&peerAddr, &socklen); - if (bytesRcvd < 1) - { - dhtLog("udpListen(): ERROR: bytesRcvd = %d\n", bytesRcvd); - } - else if (inBuffer[0] >= NUM_MSG_TYPES) - { - dhtLog("udpListen(): ERROR: unknown msg type = %d\n", inBuffer[0]); - } - else if (!msgSizeOk(inBuffer, bytesRcvd)) - { - dhtLog("udpListen(): ERROR: msg size not ok: type = %s\n, size = %d\n", - msg_types[inBuffer[0]], bytesRcvd); - } - else if (state == EXIT2_STATE) - { - //do nothing - } - else if (state == INIT1_STATE) - { //after initialization with seed, do not proceed until seed replies - dhtLog("udpListen(): received %s from %s, %d bytes\n", - msg_types[inBuffer[0]], inet_ntoa(peerAddr.sin_addr), bytesRcvd); - for (i = 0; i < bytesRcvd; i++) - dhtLog(" %x", inBuffer[i]); - dhtLog("\n"); - peerIp = ntohl(peerAddr.sin_addr.s_addr); - if (peerIp == seed && inBuffer[0] == WHO_IS_LEADER_RES) - { - tmpHost.ipAddr = peerIp; - tmpHost.maxKeyCapacity = 0; - addHost(tmpHost); - writeHostList(); - leader = read4(&inBuffer[1]); - tmpAddr.s_addr = htonl(leader); - dhtLog("leader = %s\n", inet_ntoa(tmpAddr)); - if (leader != 0) - { - setState(INIT2_STATE); - outBuffer[0] = JOIN_REQ; - write4(&outBuffer[1], myHostData.maxKeyCapacity); - udpSend(outBuffer, 5, leader); - } - else - { - electionOriginator = myHostData.ipAddr; - setState(ELECT1_STATE); - outBuffer[0] = ELECT_LEADER_CMD; - write4(&outBuffer[1], myHostData.ipAddr); //originator = me - udpSendAll(outBuffer, 5); - } - } - } - else - { - dhtLog("udpListen(): received %s from %s, %d bytes\n", - msg_types[inBuffer[0]], inet_ntoa(peerAddr.sin_addr), bytesRcvd); - for (i = 0; i < bytesRcvd; i++) - dhtLog(" %x", inBuffer[i]); - dhtLog("\n"); - peerIp = ntohl(peerAddr.sin_addr.s_addr); - switch (inBuffer[0]) - { - case INSERT_CMD: - if (state == NORMAL_STATE || state == LEAD_NORMAL1_STATE - || state == LEAD_NORMAL2_STATE || state == REBUILD4_STATE - || state == REBUILD5_STATE || state == LEAD_REBUILD3_STATE) - { - tmpKey = read4(&inBuffer[1]); - tmpVal = read4(&inBuffer[5]); - outBuffer[0] = INSERT_RES; - if (getKeyOwner(tmpKey) == myHostData.ipAddr) - { - if (chashInsert(myHashTable, tmpKey, (void *)tmpVal) == 0) - outBuffer[1] = OPERATION_OK; - else - outBuffer[1] = INTERNAL_ERROR; - } - else - { - outBuffer[1] = NOT_KEY_OWNER; - } - //reply to client socket - sendto(udpPollSock.fd, outBuffer, 2, 0, - (struct sockaddr *)&peerAddr, socklen); - } - break; - case REMOVE_CMD: - if (state == NORMAL_STATE || state == LEAD_NORMAL1_STATE - || state == LEAD_NORMAL2_STATE) - { - tmpKey = read4(&inBuffer[1]); - outBuffer[0] = REMOVE_RES; - if (getKeyOwner(tmpKey) == myHostData.ipAddr) - { - if (chashRemove(myHashTable, tmpKey) == 0) - outBuffer[1] = OPERATION_OK; - else - outBuffer[1] = KEY_NOT_FOUND; - } - else - { - outBuffer[1] = NOT_KEY_OWNER; - } - //reply to client socket - sendto(udpPollSock.fd, outBuffer, 2, 0, - (struct sockaddr *)&peerAddr, socklen); - } - break; - case SEARCH_CMD: - if (state == NORMAL_STATE || state == LEAD_NORMAL1_STATE - || state == LEAD_NORMAL2_STATE) - { - tmpKey = read4(&inBuffer[1]); - outBuffer[0] = SEARCH_RES; - if (getKeyOwner(tmpKey) == myHostData.ipAddr) - { - if ((tmpVal = (unsigned int)chashSearch(myHashTable, tmpKey)) != 0) - { - outBuffer[1] = OPERATION_OK; - write4(&outBuffer[2], tmpVal); - } - else - { - outBuffer[1] = KEY_NOT_FOUND; - write4(&outBuffer[2], 0); - } - } - else - { - outBuffer[1] = NOT_KEY_OWNER; - write4(&outBuffer[2], 0); - } - //reply to client socket - sendto(udpPollSock.fd, outBuffer, 6, 0, - (struct sockaddr *)&peerAddr, socklen); - } - break; - case WHO_IS_LEADER_CMD: - tmpHost.ipAddr = peerIp; - tmpHost.maxKeyCapacity = 0; - addHost(tmpHost); - writeHostList(); - outBuffer[0] = WHO_IS_LEADER_RES; - //leader == 0 means I don't know who it is - write4(&outBuffer[1], leader); - udpSend(outBuffer, 5, peerIp); - break; - case JOIN_REQ: - if (state == LEAD_NORMAL1_STATE || state == LEAD_NORMAL2_STATE) - { - tmpHost.ipAddr = peerIp; - tmpHost.maxKeyCapacity = read4(&inBuffer[1]); - addHost(tmpHost); - writeHostList(); - if (state == LEAD_NORMAL1_STATE) - setState(LEAD_NORMAL2_STATE); - outBuffer[0] = JOIN_RES; - outBuffer[1] = 0; //status, success - udpSend(outBuffer, 2, peerIp); - } - else if (state == LEAD_REBUILD1_STATE) - { - //note: I don't need to addHost(). - checkReplied(peerIp); - outBuffer[0] = JOIN_RES; - outBuffer[1] = 0; //status, success - udpSend(outBuffer, 2, peerIp); - if (allReplied()) - { - makeAssignments(); - setState(LEAD_REBUILD2_STATE); - outBuffer[0] = DHT_UPDATE_CMD; - write2(&outBuffer[1], numHosts); - write2(&outBuffer[3], numBlocks); - memcpy(&outBuffer[5], hostArray, numHosts*sizeof(struct hostData)); - memcpy(&outBuffer[5+numHosts*sizeof(struct hostData)], - blockOwnerArray, numBlocks*2); - udpSendAll(outBuffer, 5 + sizeof(struct hostData) * numHosts - + 2 * numBlocks); - } - } - break; - case JOIN_RES: - if (state == REBUILD1_STATE) - { - setState(REBUILD2_STATE); - } - else if (state == INIT2_STATE) - { - setState(NORMAL_STATE); - } - break; - case LEAVE_REQ: - if (state == LEAD_NORMAL1_STATE || state == LEAD_NORMAL2_STATE) - { //TODO: make this graceful, instead of just rebuilding - removeHost(peerIp); - if (state != LEAD_NORMAL2_STATE) - setState(LEAD_NORMAL2_STATE); - } - break; - case DHT_UPDATE_CMD: - if (state == REBUILD2_STATE && peerIp == leader) - { - free(hostArray); - free(blockOwnerArray); - numHosts = read2(&inBuffer[1]); - numBlocks = read2(&inBuffer[3]); - while (hostArraySize < numHosts) - hostArraySize *= 2; - hostArray = calloc(hostArraySize, sizeof(struct hostData)); - blockOwnerArray = calloc(numBlocks, 2); - memcpy(hostArray, &inBuffer[5], numHosts*sizeof(struct hostData)); - memcpy(blockOwnerArray, &inBuffer[5+numHosts*sizeof(struct hostData)], numBlocks*2); - writeHostList(); - setState(REBUILD3_STATE); - outBuffer[0] = DHT_UPDATE_RES; - udpSend(outBuffer, 1, peerIp); - } - break; - case DHT_UPDATE_RES: - if (state == LEAD_REBUILD2_STATE) - { - checkReplied(peerIp); - if (allReplied()) - { - setState(LEAD_REBUILD3_STATE); - outBuffer[0] = FILL_DHT_CMD; - udpSendAll(outBuffer, 1); - if (fillStatus != 0) - dhtLog("udpListen(): ERROR: fillTask already running\n"); - fillStatus = 1; - if (pthread_create(&threadFillTask, NULL, fillTask, NULL) != 0) - dhtLog("udpListen(): ERROR creating threadFillTask\n"); - } - } - break; - case ELECT_LEADER_CMD: - tmpUInt = read4(&inBuffer[1]); - if ((state == ELECT1_STATE || state == ELECT2_STATE) - && tmpUInt >= electionOriginator) - { //already participating in a higher-priority election - outBuffer[0] = ELECT_LEADER_RES; - outBuffer[1] = 0xFF; - udpSend(outBuffer, 2, peerIp); - } - else - { //join election - electionOriginator = tmpUInt; - electionParent = peerIp; - setState(ELECT1_STATE); - outBuffer[0] = ELECT_LEADER_CMD; - write4(&outBuffer[1], electionOriginator); - //don't bother forwarding the message to originator or parent - checkReplied(electionOriginator); - checkReplied(electionParent); - if (allReplied()) - { //in case that is everybody I know of - setState(ELECT2_STATE); - outBuffer[0] = ELECT_LEADER_RES; - outBuffer[1] = 0; - write2(&outBuffer[2], numHosts); - memcpy(&outBuffer[4], hostArray, sizeof(struct hostData) - * numHosts); - udpSend(outBuffer, 4 + sizeof(struct hostData) * numHosts, - electionParent); - } - else - { - udpSendAll(outBuffer, 5); - } - } - break; - case ELECT_LEADER_RES: - if (state == ELECT1_STATE) - { - checkReplied(peerIp); - if (inBuffer[1] != 0xFF) - { - tmpUShort = read2(&inBuffer[2]); - hostDataPtr = (struct hostData *)&inBuffer[4]; - for (i = 0; i < tmpUShort; i++) - addHost(hostDataPtr[i]); - writeHostList(); - } - if (allReplied()) - { - setState(ELECT2_STATE); - if (electionOriginator == myHostData.ipAddr) - { - leader = hostArray[0].ipAddr; - if (leader == myHostData.ipAddr) - { //I am the leader - dhtLog("I am the leader!\n"); - setState(LEAD_REBUILD1_STATE); - outBuffer[0] = REBUILD_CMD; - udpSendAll(outBuffer, 1); - } - else - { //notify leader - outBuffer[0] = CONGRATS_CMD; - write2(&outBuffer[1], numHosts); - hostDataPtr = (struct hostData *)&outBuffer[3]; - for (i = 0; i < numHosts; i++) - hostDataPtr[i] = hostArray[i]; - udpSend(outBuffer, 3 + sizeof(struct hostData) * numHosts, - leader); - } - } - else - { - outBuffer[0] = ELECT_LEADER_RES; - outBuffer[1] = 0; - write2(&outBuffer[2], numHosts); - hostDataPtr = (struct hostData *)&outBuffer[4]; - for (i = 0; i < numHosts; i++) - hostDataPtr[i] = hostArray[i]; - udpSend(outBuffer, 4 + sizeof(struct hostData) * numHosts, - electionParent); - } - } - } - break; - case CONGRATS_CMD: - if (state == ELECT2_STATE) - { //I am the leader - leader = myHostData.ipAddr; - dhtLog("I am the leader!\n"); - tmpUShort = read2(&inBuffer[1]); - hostDataPtr = (struct hostData *)&inBuffer[3]; - for (i = 0; i < tmpUShort; i++) - addHost(hostDataPtr[i]); - writeHostList(); - setState(LEAD_REBUILD1_STATE); - outBuffer[0] = REBUILD_CMD; - udpSendAll(outBuffer, 1); - } - break; - case REBUILD_REQ: - if (state == LEAD_NORMAL1_STATE || state == LEAD_NORMAL2_STATE) - { - setState(LEAD_REBUILD1_STATE); - outBuffer[0] = REBUILD_CMD; - udpSendAll(outBuffer, 1); - } - break; - case REBUILD_CMD: - leader = peerIp; //consider this a declaration of authority - setState(REBUILD1_STATE); - outBuffer[0] = JOIN_REQ; - write4(&outBuffer[1], myHostData.maxKeyCapacity); - udpSend(outBuffer, 5, leader); - break; - case FILL_DHT_CMD: - if (state == REBUILD3_STATE && peerIp == leader) - { - setState(REBUILD4_STATE); - if (fillStatus != 0) - dhtLog("udpListen(): ERROR: fillTask already running\n"); - fillStatus = 1; - if (pthread_create(&threadFillTask, NULL, fillTask, NULL) != 0) - dhtLog("udpListen(): ERROR creating threadFillTask\n"); - } - break; - case FILL_DHT_RES: - if (state == LEAD_REBUILD3_STATE) - { - checkReplied(peerIp); - if (allReplied() && fillStatus == 2) - { - fillStatus = 0; - setState(LEAD_REBUILD4_STATE); - outBuffer[0] = RESUME_NORMAL_CMD; - udpSendAll(outBuffer, 1); - } - } - break; - case RESUME_NORMAL_CMD: - if (state == REBUILD5_STATE && peerIp == leader) - { - setState(NORMAL_STATE); - outBuffer[0] = RESUME_NORMAL_RES; - udpSend(outBuffer, 1, leader); - } - break; - case RESUME_NORMAL_RES: - if (state == LEAD_REBUILD4_STATE) - { - checkReplied(peerIp); - if (allReplied()) - { - setState(LEAD_NORMAL1_STATE); - } - } - break; - } - } - } - if (state == REBUILD4_STATE) - { - switch (fillStatus) - { - case 0: dhtLog("udpListen(): ERROR: fillStatus=0 in REBUILD4_STATE\n"); - break; - case 1: //do nothing - break; - case 2: //done filling the dht, notify leader - fillStatus = 0; - setState(REBUILD5_STATE); - outBuffer[0] = FILL_DHT_RES; - udpSend(outBuffer, 1, leader); - break; - case 3: //error encountered -> restart rebuild - fillStatus = 0; - setState(REBUILD0_STATE); - outBuffer[0] = REBUILD_REQ; - udpSend(outBuffer, 1, leader); - break; - } - } - if (state == LEAD_REBUILD3_STATE) - { - switch (fillStatus) - { - case 0: dhtLog("udpListen(): ERROR: fillStatus=0 in LEAD_REBUILD3_STATE\n"); - break; - case 1: //do nothing - break; - case 2: //I'm done, now is everybody else also done? - if (allReplied()) - { - fillStatus = 0; - setState(LEAD_REBUILD4_STATE); - outBuffer[0] = RESUME_NORMAL_CMD; - udpSendAll(outBuffer, 1); - } - break; - case 3: //error encountered -> restart rebuild - fillStatus = 0; - setState(LEAD_REBUILD1_STATE); - outBuffer[0] = REBUILD_CMD; - udpSendAll(outBuffer, 1); - break; - } - } - if (timerSet) - { - gettimeofday(&now, NULL); - if (timercmp(&now, &timer, >)) - { - if (timeoutCntr < retry_vals[state]) - { - timeoutCntr++; - timeradd(&now, &timeout_vals[state], &timer); - dhtLog("udpListen(): retry: %d\n", timeoutCntr); - switch (state) - { - case INIT1_STATE: - outBuffer[0] = WHO_IS_LEADER_CMD; - udpSend(outBuffer, 1, seed); - break; - case INIT2_STATE: - outBuffer[0] = JOIN_REQ; - write4(&outBuffer[1], myHostData.maxKeyCapacity); - udpSend(outBuffer, 5, leader); - break; - case ELECT1_STATE: - outBuffer[0] = ELECT_LEADER_CMD; - write4(&outBuffer[1], electionOriginator); - udpSendAll(outBuffer, 5); - break; - case ELECT2_STATE: - if (electionOriginator == myHostData.ipAddr) - { //retry notify leader - outBuffer[0] = CONGRATS_CMD; - write2(&outBuffer[1], numHosts); - memcpy(&outBuffer[3], hostArray, sizeof(struct hostData) - * numHosts); - udpSend(outBuffer, 3 + sizeof(struct hostData) * numHosts, - leader); - } - else - { - outBuffer[0] = ELECT_LEADER_RES; - outBuffer[1] = 0; - write2(&outBuffer[2], numHosts); - memcpy(&outBuffer[4], hostArray, sizeof(struct hostData) - * numHosts); - udpSend(outBuffer, 4 + sizeof(struct hostData) * numHosts, - electionParent); - } - break; - case REBUILD0_STATE: - outBuffer[0] = REBUILD_REQ; - udpSend(outBuffer, 1, leader); - break; - case REBUILD1_STATE: - outBuffer[0] = JOIN_REQ; - write4(&outBuffer[1], myHostData.maxKeyCapacity); - udpSend(outBuffer, 5, leader); - break; - case REBUILD5_STATE: - outBuffer[0] = FILL_DHT_RES; - udpSend(outBuffer, 1, leader); - break; - case LEAD_REBUILD1_STATE: - outBuffer[0] = REBUILD_CMD; - udpSendAll(outBuffer, 1); - break; - case LEAD_REBUILD2_STATE: - outBuffer[0] = DHT_UPDATE_CMD; - write2(&outBuffer[1], numHosts); - write2(&outBuffer[3], numBlocks); - memcpy(&outBuffer[5], hostArray, numHosts - * sizeof(struct hostData)); - memcpy(&outBuffer[5+numHosts*sizeof(struct hostData)], - blockOwnerArray, numBlocks*2); - udpSendAll(outBuffer, 5 + sizeof(struct hostData) * numHosts - + 2 * numBlocks); - break; - case LEAD_REBUILD3_STATE: - outBuffer[0] = FILL_DHT_CMD; - udpSendAll(outBuffer, 1); - break; - case LEAD_REBUILD4_STATE: - outBuffer[0] = RESUME_NORMAL_CMD; - udpSendAll(outBuffer, 1); - break; - case EXIT1_STATE: //TODO... - break; - case NORMAL_STATE: - case LEAD_NORMAL1_STATE: - case LEAD_NORMAL2_STATE: - case REBUILD2_STATE: - case REBUILD3_STATE: - case REBUILD4_STATE: - case EXIT2_STATE: //we shouldn't get here - break; - } - } - else - { - dhtLog("udpListen(): timed out in state %s after %d retries\n", - state_names[state], timeoutCntr); - switch (state) - { - case INIT1_STATE: - setState(EXIT2_STATE); - break; - case LEAD_NORMAL2_STATE: - setState(LEAD_REBUILD1_STATE); - outBuffer[0] = REBUILD_CMD; - udpSendAll(outBuffer, 1); - break; - case ELECT1_STATE: - dhtLog("removing unresponsive hosts, before:\n"); - writeHostList(); - removeUnresponsiveHosts(); - dhtLog("after\n"); - writeHostList(); - setState(ELECT2_STATE); - if (electionOriginator == myHostData.ipAddr) - { - leader = hostArray[0].ipAddr; - if (leader == myHostData.ipAddr) - { //I am the leader - dhtLog("I am the leader!\n"); - setState(LEAD_REBUILD1_STATE); - outBuffer[0] = REBUILD_CMD; - udpSendAll(outBuffer, 1); - } - else - { //notify leader - outBuffer[0] = CONGRATS_CMD; - write2(&outBuffer[1], numHosts); - memcpy(&outBuffer[3], hostArray, sizeof(struct hostData) - * numHosts); - udpSend(outBuffer, 3 + sizeof(struct hostData) * numHosts, - leader); - } - } - else - { - outBuffer[0] = ELECT_LEADER_RES; - outBuffer[1] = 0; - write2(&outBuffer[2], numHosts); - memcpy(&outBuffer[4], hostArray, sizeof(struct hostData) - * numHosts); - udpSend(outBuffer, 4 + sizeof(struct hostData) * numHosts, - electionParent); - } - break; - case INIT2_STATE: - case ELECT2_STATE: - case REBUILD0_STATE: - case REBUILD1_STATE: - case REBUILD2_STATE: - case REBUILD3_STATE: - case REBUILD4_STATE: - case REBUILD5_STATE: - case LEAD_REBUILD1_STATE: - case LEAD_REBUILD2_STATE: - case LEAD_REBUILD3_STATE: - case LEAD_REBUILD4_STATE: - //start election - electionOriginator = myHostData.ipAddr; - setState(ELECT1_STATE); - outBuffer[0] = ELECT_LEADER_CMD; - write4(&outBuffer[1], myHostData.ipAddr); //originator = me - udpSendAll(outBuffer, 5); - break; - case EXIT1_STATE: - setState(EXIT2_STATE); - break; - case NORMAL_STATE: - case LEAD_NORMAL1_STATE: - case EXIT2_STATE: //we shouldn't get here - break; - } - } - } - } - if (state != oldState) - pthread_cond_broadcast(&stateCond); - pthread_mutex_unlock(&stateMutex); - } -} - diff --git a/Robust/src/Runtime/DSTM/interface/dht.h b/Robust/src/Runtime/DSTM/interface/dht.h deleted file mode 100644 index 344ab530..00000000 --- a/Robust/src/Runtime/DSTM/interface/dht.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef _DHT_H -#define _DHT_H - -#include - -/******************************************************************************* -* Local Structs -*******************************************************************************/ - -#define DHT_NO_KEY_LIMIT 0xFFFFFFFF - -/******************************************************************************* -* Interface Function Prototypes -*******************************************************************************/ - -//called by host which joins (or starts) the system -void dhtInit(unsigned int seedIp, unsigned int maxKeyCapaciy); -//exit system, cleanup -void dhtExit(); - -//called by whoever performs the creation, move, deletion - -//returns 0 if successful, -1 if an error occurred -int dhtInsert(unsigned int key, unsigned int val); -//simultaneously inserts the key-val pairs in the given arrays -int dhtInsertMult(unsigned int numKeys, unsigned int *keys, unsigned int *vals); -//returns 0 if successful, -1 if an error occurred -int dhtRemove(unsigned int key); -//simultaneously delete the keys in the given array -int dhtRemoveMult(unsigned int numKeys, unsigned int *keys); -//returns 0 if successful and copies val into *val, -// 1 if key not found, -1 if an error occurred -int dhtSearch(unsigned int key, unsigned int *val); -//simultaneously search for the vals that correspond to the given keys. -// result is placed in vals[] -int dhtSearchMult(unsigned int numKeys, unsigned int *keys, unsigned int *vals); -#endif - diff --git a/Robust/src/Runtime/DSTM/interface/dsmdebug.h b/Robust/src/Runtime/DSTM/interface/dsmdebug.h deleted file mode 100644 index e0d0a06b..00000000 --- a/Robust/src/Runtime/DSTM/interface/dsmdebug.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef _DSMDEBUG_H_ -#define _DSMDEBUG_H_ - -#define TABORT1(s) {printf("%s\n", s); fflush(stdout);} -#define TABORT2(s, msg) {printf("%s(): %s\n", s, msg); fflush(stdout);} -#define TABORT3(func, s, msg, d) {printf("%s(): %s: for %s = %d\n", func, s, msg, d); fflush(stdout);} -#define TABORT4(s, d) {printf("%s = %d\n", s, d); fflush(stdout);} -#define TABORT5(func, msg1 , msg2, val1, val2) {printf("%s(): %s = %x, %s = %d\n", func, msg1, val1, msg2, val2); fflush(stdout);} -#define TABORT6(a, b, c, val1, val2) {printf("%s = %x, %s for %s = %x\n", a, val1, b, c, val2); fflush(stdout);} -#define TABORT7(func, a, b, c, val1, val2) {printf("%s(): %s for %s =%d, %s = %x\n", func, a, b, val1, c, val2); fflush(stdout);} -#define TABORT8(func, s, d) {printf("%s(): %s = %d\n", func, s, d); fflush(stdout);} -#define TABORT9(func, a, b, c, d, val1, val2, val3) {printf("%s(): %s for %s =%x, %s = %d, %s = %x\n", func, a, b, val1, c, val2, d, val3); fflush(stdout);} - - -#endif diff --git a/Robust/src/Runtime/DSTM/interface/dstm.c b/Robust/src/Runtime/DSTM/interface/dstm.c deleted file mode 100644 index a7a8cf40..00000000 --- a/Robust/src/Runtime/DSTM/interface/dstm.c +++ /dev/null @@ -1,9 +0,0 @@ -#include "dstm.h" - -extern int classsize[]; - -/* BEGIN object header */ - - -/* END object header */ - diff --git a/Robust/src/Runtime/DSTM/interface/dstm.h b/Robust/src/Runtime/DSTM/interface/dstm.h deleted file mode 100644 index df979d74..00000000 --- a/Robust/src/Runtime/DSTM/interface/dstm.h +++ /dev/null @@ -1,304 +0,0 @@ -#ifndef _DSTM_H_ -#define _DSTM_H_ - -#ifdef MAC -#define MSG_NOSIGNAL 0 -#endif - -/*********************************************************** - * Macros - **********************************************************/ -#define GET_SITEID(x) ((int *)(x)) -#define GET_NTUPLES(x) ((int *)(x + sizeof(int))) -#define GET_PTR_OID(x) ((unsigned int *)(x + 2*sizeof(int))) -#define GET_PTR_EOFF(x,n) ((short *)(x + 2*sizeof(int) + (n*sizeof(unsigned int)))) -#define GET_PTR_ARRYFLD(x,n) ((short *)(x + 2*sizeof(int) + (n*sizeof(unsigned int)) + (n*sizeof(short)))) -#define ENDEBUG(s) { printf("Inside %s()\n", s); fflush(stdout);} -#define EXDEBUG(s) {printf("Outside %s()\n", s); fflush(stdout);} -/***************************************** - * Coordinator Messages - ***************************************/ -#define READ_REQUEST 1 -#define READ_MULT_REQUEST 2 -#define MOVE_REQUEST 3 -#define MOVE_MULT_REQUEST 4 -#define TRANS_REQUEST 5 -#define TRANS_ABORT 6 -#define TRANS_COMMIT 7 -#define TRANS_PREFETCH 8 -#define TRANS_ABORT_BUT_RETRY_COMMIT_WITH_RELOCATING 9 - -/********************************* - * Participant Messages - *******************************/ -#define OBJECT_FOUND 10 -#define OBJECT_NOT_FOUND 11 -#define OBJECTS_FOUND 12 -#define OBJECTS_NOT_FOUND 13 -#define TRANS_AGREE 17 -#define TRANS_DISAGREE 18 -#define TRANS_AGREE_BUT_MISSING_OBJECTS 19 -#define TRANS_SOFT_ABORT 20 -#define TRANS_SUCESSFUL 21 -#define TRANS_PREFETCH_RESPONSE 22 -#define START_REMOTE_THREAD 23 -#define THREAD_NOTIFY_REQUEST 24 -#define THREAD_NOTIFY_RESPONSE 25 -#define TRANS_UNSUCESSFUL 26 -#define CLOSE_CONNECTION 27 - -//Max number of objects -#define MAX_OBJECTS 20 -#define DEFAULT_OBJ_STORE_SIZE 1048510 //1MB -//Transaction id per machine -#define TID_LEN 20 -#define LISTEN_PORT 2156 -#define UDP_PORT 2158 -//Prefetch tuning paramters -#define RETRYINTERVAL 7 //N -#define SHUTDOWNINTERVAL 4 //M - -#include -#include -#include -#include -#include "clookup.h" -#include "queue.h" -#include "mcpileq.h" -#include "threadnotify.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "sockpool.h" -#include -#include "plookup.h" -#include "dsmdebug.h" - -//bit designations for status field of objheader -#define DIRTY 0x01 -#define NEW 0x02 -#define LOCK 0x04 -#define LOCAL 0x08 - -/*******Global statistics *********/ -extern int numprefetchsites; - -#ifdef COMPILER - -#include "structdefs.h" - -typedef struct objheader { - threadlist_t *notifylist; - unsigned short version; - unsigned short rcount; -} objheader_t; - -#define OID(x)\ - (*((unsigned int *)&((struct ___Object___ *)((unsigned int) x + sizeof(objheader_t)))->___nextobject___)) - -#define COMPOID(x)\ - (*((unsigned int *)&((struct ___Object___ *) x)->___nextobject___)) - -#define STATUS(x)\ - *((unsigned int *) &(((struct ___Object___ *)((unsigned int) x + sizeof(objheader_t)))->___localcopy___)) - -#define STATUSPTR(x)\ - ((unsigned int *) &(((struct ___Object___ *)((unsigned int) x + sizeof(objheader_t)))->___localcopy___)) - -#define TYPE(x)\ - ((struct ___Object___ *)((unsigned int) x + sizeof(objheader_t)))->type - -#define GETSIZE(size, x) {\ - int type=TYPE(x);\ - if (type___length___+sizeof(struct ArrayObject);\ - }\ -} - -#else - -typedef struct objheader { - threadlist_t *notifylist; - unsigned int oid; - unsigned short type; - unsigned short version; - unsigned short rcount; - char status; -} objheader_t; - -#define OID(x) x->oid -#define TYPE(x) x->type -#define STATUS(x) x->status -#define STATUSPTR(x) &x->status -#define GETSIZE(size, x) size=classsize[TYPE(x)] -#endif - -typedef struct objstr { - unsigned int size; //this many bytes are allocated after this header - void *top; - struct objstr *next; -} objstr_t; - -typedef struct oidmidpair { - unsigned int oid; - unsigned int mid; -} oidmidpair_t; - -typedef struct transrecord { - objstr_t *cache; - chashtable_t *lookupTable; -#ifdef COMPILER - struct ___Object___ * revertlist; -#endif -} transrecord_t; - -// Structure is a shared structure that keeps track of responses from the participants -typedef struct thread_response { - char rcv_status; -} thread_response_t; - -// Structure that holds fixed data to be sent along with TRANS_REQUEST -typedef struct fixed_data { - char control; /* control message */ - char trans_id[TID_LEN]; /* transaction id */ - int mcount; /* participant count */ - unsigned int numread; /* no of objects read */ - unsigned int nummod; /* no of objects modified */ - unsigned int numcreated; /* no of objects created */ - int sum_bytes; /* total bytes of modified objects in a transaction */ -} fixed_data_t; - -/* Structure that holds trans request information for each participant */ -typedef struct trans_req_data { - fixed_data_t f; /* Holds first few fixed bytes of data sent during TRANS_REQUEST protcol*/ - unsigned int *listmid; /* Pointer to array holding list of participants */ - char *objread; /* Pointer to array holding oid and version number of objects that are only read */ - unsigned int *oidmod; /* Pointer to array holding oids of objects that are modified */ - unsigned int *oidcreated; /* Pointer to array holding oids of objects that are newly created */ -} trans_req_data_t; - -/* Structure that holds information of objects that are not found in the participant - * and objs locked within a transaction during commit process */ -typedef struct trans_commit_data{ - unsigned int *objlocked; /* Pointer to array holding oids of objects locked inside a transaction */ - unsigned int *objnotfound; /* Pointer to array holding oids of objects not found on the participant machine */ - unsigned int *objvernotmatch; /* Pointer to array holding oids whose version doesn't match on the participant machine */ - void *modptr; /* Pointer to the address in the mainobject store of the participant that holds all modified objects */ - int numlocked; /* no of objects locked */ - int numnotfound; /* no of objects not found */ - int numvernotmatch; /* no of objects whose version doesn't match */ -} trans_commit_data_t; - - -#define PRINT_TID(PTR) printf("DEBUG -> %x %d\n", PTR->mid, PTR->thread_id); -/* Structure for passing multiple arguments to a thread - * spawned to process each transaction on a machine */ -typedef struct thread_data_array { - int thread_id; - int mid; - trans_req_data_t *buffer; /* Holds trans request information sent to a participant, based on threadid */ - thread_response_t *recvmsg; /* Shared datastructure to keep track of the participants response to a trans request */ - pthread_cond_t *threshold; /* Condition var to waking up a thread */ - pthread_mutex_t *lock; /* Lock for counting participants response */ - int *count; /* Variable to count responses from all participants to the TRANS_REQUEST protocol */ - char *replyctrl; /* Shared ctrl message that stores the reply to be sent to participants, filled by decideResponse() */ - char *replyretry; /* Shared variable that keep track if coordinator needs retry */ - transrecord_t *rec; /* To send modified objects */ -} thread_data_array_t; - - -//Structure for passing arguments to the local m/c thread -typedef struct local_thread_data_array { - thread_data_array_t *tdata; /* Holds all the arguments send to a thread that is spawned when transaction commits */ - trans_commit_data_t *transinfo; /* Holds information of objects locked and not found in the participant */ -} local_thread_data_array_t; - -//Structure to store mid and socketid information -typedef struct midSocketInfo { - unsigned int mid; /* To communicate with mid use sockid in this data structure */ - int sockid; -} midSocketInfo_t; - -/* Initialize main object store and lookup tables, start server thread. */ -int dstmInit(void); -void send_data(int fd, void *buf, int buflen); -void recv_data(int fd, void *buf, int buflen); -int recv_data_errorcode(int fd, void *buf, int buflen); - -/* Prototypes for object header */ -unsigned int getNewOID(void); -/* end object header */ - -/* Prototypes for object store */ -objstr_t *objstrCreate(unsigned int size); //size in bytes -void objstrDelete(objstr_t *store); //traverse and free entire list -void *objstrAlloc(objstr_t *store, unsigned int size); //size in bytes -void clearObjStore(); // TODO:currently only clears the prefetch cache object store -/* end object store */ - -/* Prototypes for server portion */ -void *dstmListen(void *); -int startlistening(); -void *dstmAccept(void *); -int readClientReq(trans_commit_data_t *, int); -int processClientReq(fixed_data_t *, trans_commit_data_t *,unsigned int *, char *, void *, unsigned int *, int); -char handleTransReq(fixed_data_t *, trans_commit_data_t *, unsigned int *, char *, void *, int); -char decideCtrlMessage(fixed_data_t *, trans_commit_data_t *, int *, int *, int *, int *, int *, void *, unsigned int *, unsigned int *, int); -int transCommitProcess(void *, unsigned int *, unsigned int *, int, int, int); -void processReqNotify(unsigned int numoid, unsigned int *oid, unsigned short *version, unsigned int mid, unsigned int threadid); -/* end server portion */ - -/* Prototypes for transactions */ -/* Function called at beginning. Passes in the first parameter. */ -/* Returns 1 if this thread should run the main process */ - -int dstmStartup(const char *); -void transInit(); -int processConfigFile(); -void addHost(unsigned int); -void mapObjMethod(unsigned short); - -void randomdelay(); -transrecord_t *transStart(); -objheader_t *transRead(transrecord_t *, unsigned int); -objheader_t *transCreateObj(transrecord_t *, unsigned int); //returns oid header -int transCommit(transrecord_t *record); //return 0 if successful -void *transRequest(void *); //the C routine that the thread will execute when TRANS_REQUEST begins -void decideResponse(thread_data_array_t *);// Coordinator decides what response to send to the participant -char sendResponse(thread_data_array_t *, int); //Sends control message back to Participants -void *getRemoteObj(transrecord_t *, unsigned int, unsigned int);// returns object header from main object store after object is copied into it from remote machine -void *handleLocalReq(void *);//handles Local requests -int transComProcess(local_thread_data_array_t *); -int transAbortProcess(local_thread_data_array_t *); -void transAbort(transrecord_t *trans); -void sendPrefetchResponse(int sd, char *control, char *sendbuffer, int *size); -void prefetch(int, int, unsigned int *, unsigned short *, short*); -void *transPrefetch(void *); -void *mcqProcess(void *); -prefetchpile_t *foundLocal(char *);// returns node with prefetch elements(oids, offsets) -int lookupObject(unsigned int * oid, short offset); -int transPrefetchProcess(transrecord_t *, int **, short); -void sendPrefetchReq(prefetchpile_t*, int); -void sendPrefetchReqnew(prefetchpile_t*, int); -int getPrefetchResponse(int); -unsigned short getObjType(unsigned int oid); -int startRemoteThread(unsigned int oid, unsigned int mid); -plistnode_t *pInsert(plistnode_t *pile, objheader_t *headeraddr, unsigned int mid, int num_objs); - -/* Sends notification request for thread join, if sucessful returns 0 else returns -1 */ -int reqNotify(unsigned int *oidarry, unsigned short *versionarry, unsigned int numoid); -void threadNotify(unsigned int oid, unsigned short version, unsigned int tid); -int notifyAll(threadlist_t **head, unsigned int oid, unsigned int version); - -/* end transactions */ -#endif diff --git a/Robust/src/Runtime/DSTM/interface/dstmserver.c b/Robust/src/Runtime/DSTM/interface/dstmserver.c deleted file mode 100644 index 0928321c..00000000 --- a/Robust/src/Runtime/DSTM/interface/dstmserver.c +++ /dev/null @@ -1,819 +0,0 @@ -/* Coordinator => Machine that initiates the transaction request call for commiting a transaction - * Participant => Machines that host the objects involved in a transaction commit */ - -#include -#include "dstm.h" -#include "mlookup.h" -#include "llookup.h" -#include "threadnotify.h" -#ifdef COMPILER -#include "thread.h" -#endif - -#define BACKLOG 10 //max pending connections -#define RECEIVE_BUFFER_SIZE 2048 - -extern int classsize[]; -extern int numHostsInSystem; -extern pthread_mutex_t notifymutex; - -objstr_t *mainobjstore; -pthread_mutex_t mainobjstore_mutex; -pthread_mutex_t lockObjHeader; -pthread_mutexattr_t mainobjstore_mutex_attr; /* Attribute for lock to make it a recursive lock */ - -sockPoolHashTable_t *transPResponseSocketPool; - -/* This function initializes the main objects store and creates the - * global machine and location lookup table */ - -int dstmInit(void) -{ - mainobjstore = objstrCreate(DEFAULT_OBJ_STORE_SIZE); - /* Initialize attribute for mutex */ - pthread_mutexattr_init(&mainobjstore_mutex_attr); - pthread_mutexattr_settype(&mainobjstore_mutex_attr, PTHREAD_MUTEX_RECURSIVE_NP); - pthread_mutex_init(&mainobjstore_mutex, &mainobjstore_mutex_attr); - pthread_mutex_init(&lockObjHeader,NULL); - if (mhashCreate(HASH_SIZE, LOADFACTOR)) - return 1; //failure - - if (lhashCreate(HASH_SIZE, LOADFACTOR)) - return 1; //failure - - if (notifyhashCreate(N_HASH_SIZE, N_LOADFACTOR)) - return 1; //failure - - //Initialize socket pool - if((transPResponseSocketPool = createSockPool(transPResponseSocketPool, 2*numHostsInSystem+1)) == NULL) { - printf("Error in creating new socket pool at %s line %d\n", __FILE__, __LINE__); - return 0; - } - - return 0; -} - - -int startlistening() { - int listenfd; - struct sockaddr_in my_addr; - socklen_t addrlength = sizeof(struct sockaddr); - int setsockflag=1; - - listenfd = socket(AF_INET, SOCK_STREAM, 0); - if (listenfd == -1) { - perror("socket"); - exit(1); - } - - if (setsockopt(listenfd, SOL_SOCKET, SO_REUSEADDR, &setsockflag, sizeof (setsockflag)) < 0) { - perror("socket"); - exit(1); - } -#ifdef MAC - if (setsockopt(listenfd, SOL_SOCKET, SO_NOSIGPIPE, &setsockflag, sizeof (setsockflag)) < 0) { - perror("socket"); - exit(1); - } -#endif - - my_addr.sin_family = AF_INET; - my_addr.sin_port = htons(LISTEN_PORT); - my_addr.sin_addr.s_addr = INADDR_ANY; - memset(&(my_addr.sin_zero), '\0', 8); - - if (bind(listenfd, (struct sockaddr *)&my_addr, addrlength) == -1) { - perror("bind"); - exit(1); - } - - if (listen(listenfd, BACKLOG) == -1) { - perror("listen"); - exit(1); - } - return listenfd; -} - -/* This function starts the thread to listen on a socket - * for tranaction calls */ -void *dstmListen(void *lfd) { - int listenfd=(int)lfd; - int acceptfd; - struct sockaddr_in client_addr; - socklen_t addrlength = sizeof(struct sockaddr); - pthread_t thread_dstm_accept; - - printf("Listening on port %d, fd = %d\n", LISTEN_PORT, listenfd); - while(1) { - int retval; - int flag=1; - acceptfd = accept(listenfd, (struct sockaddr *)&client_addr, &addrlength); - setsockopt(acceptfd, IPPROTO_TCP, TCP_NODELAY, (char *) &flag, sizeof(flag)); - do { - retval=pthread_create(&thread_dstm_accept, NULL, dstmAccept, (void *)acceptfd); - } while(retval!=0); - pthread_detach(thread_dstm_accept); - } -} -/* This function accepts a new connection request, decodes the control message in the connection - * and accordingly calls other functions to process new requests */ -void *dstmAccept(void *acceptfd) { - int val, retval, size, sum, sockid; - unsigned int oid; - char *buffer; - char control,ctrl; - char *ptr; - void *srcObj; - objheader_t *h; - trans_commit_data_t transinfo; - unsigned short objType, *versionarry, version; - unsigned int *oidarry, numoid, mid, threadid; - - /* Receive control messages from other machines */ - while(1) { - int ret=recv_data_errorcode((int)acceptfd, &control, sizeof(char)); - if (ret==0) - break; - if (ret==-1) { - printf("DEBUG -> RECV Error!.. retrying\n"); - break; - } - switch(control) { - case READ_REQUEST: - /* Read oid requested and search if available */ - recv_data((int)acceptfd, &oid, sizeof(unsigned int)); - if((srcObj = mhashSearch(oid)) == NULL) { - printf("Error: Object 0x%x is not found in Main Object Store %s, %d\n", oid, __FILE__, __LINE__); - break; - } - h = (objheader_t *) srcObj; - GETSIZE(size, h); - size += sizeof(objheader_t); - sockid = (int) acceptfd; - if (h == NULL) { - ctrl = OBJECT_NOT_FOUND; - send_data(sockid, &ctrl, sizeof(char)); - } else { - // Type - char msg[]={OBJECT_FOUND, 0, 0, 0, 0}; - *((int *)&msg[1])=size; - send_data(sockid, &msg, sizeof(msg)); - send_data(sockid, h, size); - } - break; - - case READ_MULT_REQUEST: - break; - - case MOVE_REQUEST: - break; - - case MOVE_MULT_REQUEST: - break; - - case TRANS_REQUEST: - /* Read transaction request */ - transinfo.objlocked = NULL; - transinfo.objnotfound = NULL; - transinfo.modptr = NULL; - transinfo.numlocked = 0; - transinfo.numnotfound = 0; - if((val = readClientReq(&transinfo, (int)acceptfd)) != 0) { - printf("Error: In readClientReq() %s, %d\n", __FILE__, __LINE__); - pthread_exit(NULL); - } - break; - case TRANS_PREFETCH: - if((val = prefetchReq((int)acceptfd)) != 0) { - printf("Error: In prefetchReq() %s, %d\n", __FILE__, __LINE__); - break; - } - break; - case TRANS_PREFETCH_RESPONSE: - if((val = getPrefetchResponse((int) acceptfd)) != 0) { - printf("Error: In getPrefetchResponse() %s, %d\n", __FILE__, __LINE__); - break; - } - break; - case START_REMOTE_THREAD: - recv_data((int)acceptfd, &oid, sizeof(unsigned int)); - objType = getObjType(oid); - startDSMthread(oid, objType); - break; - - case THREAD_NOTIFY_REQUEST: - recv_data((int)acceptfd, &numoid, sizeof(unsigned int)); - size = (sizeof(unsigned int) + sizeof(unsigned short)) * numoid + 2 * sizeof(unsigned int); - if((buffer = calloc(1,size)) == NULL) { - printf("%s() Calloc error at %s, %d\n", __func__, __FILE__, __LINE__); - pthread_exit(NULL); - } - - recv_data((int)acceptfd, buffer, size); - - oidarry = calloc(numoid, sizeof(unsigned int)); - memcpy(oidarry, buffer, sizeof(unsigned int) * numoid); - size = sizeof(unsigned int) * numoid; - versionarry = calloc(numoid, sizeof(unsigned short)); - memcpy(versionarry, buffer+size, sizeof(unsigned short) * numoid); - size += sizeof(unsigned short) * numoid; - mid = *((unsigned int *)(buffer+size)); - size += sizeof(unsigned int); - threadid = *((unsigned int *)(buffer+size)); - processReqNotify(numoid, oidarry, versionarry, mid, threadid); - free(buffer); - - break; - - case THREAD_NOTIFY_RESPONSE: - size = sizeof(unsigned short) + 2 * sizeof(unsigned int); - if((buffer = calloc(1,size)) == NULL) { - printf("%s() Calloc error at %s, %d\n", __func__, __FILE__, __LINE__); - pthread_exit(NULL); - } - - recv_data((int)acceptfd, buffer, size); - - oid = *((unsigned int *)buffer); - size = sizeof(unsigned int); - version = *((unsigned short *)(buffer+size)); - size += sizeof(unsigned short); - threadid = *((unsigned int *)(buffer+size)); - threadNotify(oid,version,threadid); - free(buffer); - break; - - case CLOSE_CONNECTION: - goto closeconnection; - - default: - printf("Error: dstmAccept() Unknown opcode %d at %s, %d\n", control, __FILE__, __LINE__); - } - } - -closeconnection: - /* Close connection */ - if (close((int)acceptfd) == -1) - perror("close"); - pthread_exit(NULL); -} - -/* This function reads the information available in a transaction request - * and makes a function call to process the request */ -int readClientReq(trans_commit_data_t *transinfo, int acceptfd) { - char *ptr; - void *modptr; - unsigned int *oidmod, oid; - fixed_data_t fixed; - objheader_t *headaddr; - int sum, i, size, n, val; - - oidmod = NULL; - - /* Read fixed_data_t data structure */ - size = sizeof(fixed) - 1; - ptr = (char *)&fixed;; - fixed.control = TRANS_REQUEST; - recv_data((int)acceptfd, ptr+1, size); - - /* Read list of mids */ - int mcount = fixed.mcount; - size = mcount * sizeof(unsigned int); - unsigned int listmid[mcount]; - ptr = (char *) listmid; - recv_data((int)acceptfd, ptr, size); - - /* Read oid and version tuples for those objects that are not modified in the transaction */ - int numread = fixed.numread; - size = numread * (sizeof(unsigned int) + sizeof(unsigned short)); - char objread[size]; - if(numread != 0) { //If pile contains more than one object to be read, - // keep reading all objects - recv_data((int)acceptfd, objread, size); - } - - /* Read modified objects */ - if(fixed.nummod != 0) { - if ((modptr = calloc(1, fixed.sum_bytes)) == NULL) { - printf("calloc error for modified objects %s, %d\n", __FILE__, __LINE__); - return 1; - } - size = fixed.sum_bytes; - recv_data((int)acceptfd, modptr, size); - } - - /* Create an array of oids for modified objects */ - oidmod = (unsigned int *) calloc(fixed.nummod, sizeof(unsigned int)); - if (oidmod == NULL) - { - printf("calloc error %s, %d\n", __FILE__, __LINE__); - return 1; - } - ptr = (char *) modptr; - for(i = 0 ; i < fixed.nummod; i++) { - int tmpsize; - headaddr = (objheader_t *) ptr; - oid = OID(headaddr); - oidmod[i] = oid; - GETSIZE(tmpsize, headaddr); - ptr += sizeof(objheader_t) + tmpsize; - } - - /*Process the information read */ - if((val = processClientReq(&fixed, transinfo, listmid, objread, modptr, oidmod, acceptfd)) != 0) { - printf("Error: In processClientReq() %s, %d\n", __FILE__, __LINE__); - /* Free resources */ - if(oidmod != NULL) { - free(oidmod); - } - return 1; - } - - /* Free resources */ - if(oidmod != NULL) { - free(oidmod); - } - - return 0; -} - -/* This function processes the Coordinator's transaction request using "handleTransReq" - * function and sends a reply to the co-ordinator. - * Following this it also receives a new control message from the co-ordinator and processes this message*/ -int processClientReq(fixed_data_t *fixed, trans_commit_data_t *transinfo, - unsigned int *listmid, char *objread, void *modptr, unsigned int *oidmod, int acceptfd) { - char control, sendctrl, retval; - objheader_t *tmp_header; - void *header; - int i = 0, val; - - /* Send reply to the Coordinator */ - if((retval = handleTransReq(fixed, transinfo, listmid, objread, modptr,acceptfd)) == 0 ) { - printf("Error: In handleTransReq() %s, %d\n", __FILE__, __LINE__); - return 1; - } - - recv_data((int)acceptfd, &control, sizeof(char)); - - /* Process the new control message */ - switch(control) { - case TRANS_ABORT: - if (fixed->nummod > 0) - free(modptr); - /* Unlock objects that was locked due to this transaction */ - for(i = 0; i< transinfo->numlocked; i++) { - if((header = mhashSearch(transinfo->objlocked[i])) == NULL) { - printf("mhashSearch returns NULL at %s, %d\n", __FILE__, __LINE__);// find the header address - return 1; - } - UnLock(STATUSPTR(header)); - } - - /* Send ack to Coordinator */ - sendctrl = TRANS_UNSUCESSFUL; - send_data((int)acceptfd, &sendctrl, sizeof(char)); - break; - - case TRANS_COMMIT: - /* Invoke the transCommit process() */ - if((val = transCommitProcess(modptr, oidmod, transinfo->objlocked, fixed->nummod, transinfo->numlocked, (int)acceptfd)) != 0) { - printf("Error: In transCommitProcess() %s, %d\n", __FILE__, __LINE__); - /* Free memory */ - if (transinfo->objlocked != NULL) { - free(transinfo->objlocked); - } - if (transinfo->objnotfound != NULL) { - free(transinfo->objnotfound); - } - return 1; - } - break; - - case TRANS_ABORT_BUT_RETRY_COMMIT_WITH_RELOCATING: - break; - default: - printf("Error: No response to TRANS_AGREE OR DISAGREE protocol %s, %d\n", __FILE__, __LINE__); - //TODO Use fixed.trans_id TID since Client may have died - break; - } - - /* Free memory */ - if (transinfo->objlocked != NULL) { - free(transinfo->objlocked); - } - if (transinfo->objnotfound != NULL) { - free(transinfo->objnotfound); - } - return 0; -} - -/* This function increments counters while running a voting decision on all objects involved - * in TRANS_REQUEST and If a TRANS_DISAGREE sends the response immediately back to the coordinator */ -char handleTransReq(fixed_data_t *fixed, trans_commit_data_t *transinfo, unsigned int *listmid, char *objread, void *modptr, int acceptfd) { - int val, i = 0, j; - unsigned short version; - char control = 0, *ptr; - unsigned int oid; - unsigned int *oidnotfound, *oidlocked, *oidvernotmatch; - void *mobj; - objheader_t *headptr; - - /* Counters and arrays to formulate decision on control message to be sent */ - oidnotfound = (unsigned int *) calloc(fixed->numread + fixed->nummod, sizeof(unsigned int)); - oidlocked = (unsigned int *) calloc(fixed->numread + fixed->nummod, sizeof(unsigned int)); - oidvernotmatch = (unsigned int *) calloc(fixed->numread + fixed->nummod, sizeof(unsigned int)); - int objnotfound = 0, objlocked = 0, objvernotmatch = 0; - int v_nomatch = 0, v_matchlock = 0, v_matchnolock = 0; - int numBytes = 0; - /* modptr points to the beginning of the object store - * created at the Pariticipant. - * Object store holds the modified objects involved in the transaction request */ - ptr = (char *) modptr; - - /* Process each oid in the machine pile/ group per thread */ - for (i = 0; i < fixed->numread + fixed->nummod; i++) { - if (i < fixed->numread) {//Objs only read and not modified - int incr = sizeof(unsigned int) + sizeof(unsigned short);// Offset that points to next position in the objread array - incr *= i; - oid = *((unsigned int *)(objread + incr)); - incr += sizeof(unsigned int); - version = *((unsigned short *)(objread + incr)); - } else {//Objs modified - int tmpsize; - headptr = (objheader_t *) ptr; - oid = OID(headptr); - version = headptr->version; - GETSIZE(tmpsize, headptr); - ptr += sizeof(objheader_t) + tmpsize; - } - - /* Check if object is still present in the machine since the beginning of TRANS_REQUEST */ - - if ((mobj = mhashSearch(oid)) == NULL) {/* Obj not found */ - /* Save the oids not found and number of oids not found for later use */ - oidnotfound[objnotfound] = oid; - objnotfound++; - } else { /* If Obj found in machine (i.e. has not moved) */ - /* Check if Obj is locked by any previous transaction */ - if (test_and_set(STATUSPTR(mobj))) { - //don't have lock - if (version == ((objheader_t *)mobj)->version) { /* If locked then match versions */ - v_matchlock++; - } else {/* If versions don't match ...HARD ABORT */ - v_nomatch++; - oidvernotmatch[objvernotmatch] = oid; - objvernotmatch++; - int size; - GETSIZE(size, mobj); - size += sizeof(objheader_t); - numBytes += size; - /* Send TRANS_DISAGREE to Coordinator */ - control = TRANS_DISAGREE; -#ifdef CHECKTA - char b[] = "version mismatch"; - char c[] = "object type"; - TABORT3(__func__, b, c, TYPE(mobj)); -#endif - - } - } else {/* If Obj is not locked then lock object */ - /* Save all object oids that are locked on this machine during this transaction request call */ - oidlocked[objlocked] = OID(((objheader_t *)mobj)); - objlocked++; - if (version == ((objheader_t *)mobj)->version) { /* Check if versions match */ - v_matchnolock++; - } else { /* If versions don't match ...HARD ABORT */ - v_nomatch++; - oidvernotmatch[objvernotmatch] = oid; - objvernotmatch++; - int size; - GETSIZE(size, mobj); - size += sizeof(objheader_t); - numBytes += size; - control = TRANS_DISAGREE; - -#ifdef CHECKTA - char b[] = "version mismatch"; - char c[] = "object type"; - TABORT3(__func__, b, c, TYPE(mobj)); -#endif - } - } - } - } - - /* send TRANS_DISAGREE and objs*/ - if(v_nomatch > 0) { - char *objs = calloc(1, numBytes); - int j, offset = 0; - for(j = 0; j 0) { - for(j = 0; j < objlocked; j++) { - if((headptr = mhashSearch(oidlocked[j])) == NULL) { - printf("mhashSearch returns NULL at %s, %d\n", __FILE__, __LINE__); - return 0; - } - UnLock(STATUSPTR(headptr)); - } - free(oidlocked); - } - send_data(acceptfd, &control, sizeof(char)); - send_data(acceptfd, &numBytes, sizeof(int)); - send_data(acceptfd, objs, numBytes); - transinfo->objvernotmatch = oidvernotmatch; - transinfo->numvernotmatch = objvernotmatch; - free(objs); - free(transinfo->objvernotmatch); - return control; - } - - /* Decide what control message to send to Coordinator */ - if ((control = decideCtrlMessage(fixed, transinfo, &v_matchnolock, &v_matchlock, &v_nomatch, &objnotfound, &objlocked, - modptr, oidnotfound, oidlocked, acceptfd)) == 0) { - printf("Error: In decideCtrlMessage() %s, %d\n", __FILE__, __LINE__); - return 0; - } - - return control; -} -/* This function decides what control message such as TRANS_AGREE, TRANS_DISAGREE or TRANS_SOFT_ABORT - * to send to Coordinator based on the votes of oids involved in the transaction */ -char decideCtrlMessage(fixed_data_t *fixed, trans_commit_data_t *transinfo, int *v_matchnolock, int *v_matchlock, - int *v_nomatch, int *objnotfound, int *objlocked, void *modptr, - unsigned int *oidnotfound, unsigned int *oidlocked, int acceptfd) { - int val; - char control = 0; - - /* Condition to send TRANS_AGREE */ - if(*(v_matchnolock) == fixed->numread + fixed->nummod) { - control = TRANS_AGREE; - /* Send control message */ - send_data(acceptfd, &control, sizeof(char)); - } - /* Condition to send TRANS_SOFT_ABORT */ - if((*(v_matchlock) > 0 && *(v_nomatch) == 0) || (*(objnotfound) > 0 && *(v_nomatch) == 0)) { - control = TRANS_SOFT_ABORT; - - /* Send control message */ - send_data(acceptfd, &control, sizeof(char)); - - /* FIXME how to send objs Send number of oids not found and the missing oids if objects are missing in the machine */ - if(*(objnotfound) != 0) { - int msg[1]; - msg[0] = *(objnotfound); - send_data(acceptfd, &msg, sizeof(int)); - int size = sizeof(unsigned int)* *(objnotfound); - send_data(acceptfd, oidnotfound, size); - } - } - - /* Fill out the trans_commit_data_t data structure. This is required for a trans commit process - * if Participant receives a TRANS_COMMIT */ - transinfo->objlocked = oidlocked; - transinfo->objnotfound = oidnotfound; - transinfo->modptr = modptr; - transinfo->numlocked = *(objlocked); - transinfo->numnotfound = *(objnotfound); - - return control; -} - -/* This function processes all modified objects involved in a TRANS_COMMIT and updates pointer - * addresses in lookup table and also changes version number - * Sends an ACK back to Coordinator */ -int transCommitProcess(void *modptr, unsigned int *oidmod, unsigned int *oidlocked, int nummod, int numlocked, int acceptfd) { - objheader_t *header; - objheader_t *newheader; - int i = 0, offset = 0; - char control; - int tmpsize; - - /* Process each modified object saved in the mainobject store */ - for(i = 0; i < nummod; i++) { - if((header = (objheader_t *) mhashSearch(oidmod[i])) == NULL) { - printf("Error: mhashsearch returns NULL at %s, %d\n", __FILE__, __LINE__); - return 1; - } - GETSIZE(tmpsize,header); - memcpy((char*)header + sizeof(objheader_t), ((char *)modptr + sizeof(objheader_t) + offset), tmpsize); - header->version += 1; - /* If threads are waiting on this object to be updated, notify them */ - if(header->notifylist != NULL) { - notifyAll(&header->notifylist, OID(header), header->version); - } - offset += sizeof(objheader_t) + tmpsize; - } - - if (nummod > 0) - free(modptr); - - /* Unlock locked objects */ - for(i = 0; i < numlocked; i++) { - if((header = (objheader_t *) mhashSearch(oidlocked[i])) == NULL) { - printf("Error: mhashsearch returns NULL at %s, %d\n", __FILE__, __LINE__); - return 1; - } - UnLock(STATUSPTR(header)); - } - //TODO Update location lookup table - - /* Send ack to coordinator */ - control = TRANS_SUCESSFUL; - send_data((int)acceptfd, &control, sizeof(char)); - return 0; -} - -/* This function recevies the oid and offset tuples from the Coordinator's prefetch call. - * Looks for the objects to be prefetched in the main object store. - * If objects are not found then record those and if objects are found - * then use offset values to prefetch references to other objects */ - -int prefetchReq(int acceptfd) { - int i, size, objsize, numoffset = 0; - int length; - char *recvbuffer, control; - unsigned int oid, mid=-1; - objheader_t *header; - oidmidpair_t oidmid; - int sd = -1; - - while(1) { - recv_data((int)acceptfd, &numoffset, sizeof(int)); - if(numoffset == -1) - break; - recv_data((int)acceptfd, &oidmid, 2*sizeof(unsigned int)); - oid = oidmid.oid; - if (mid != oidmid.mid) { - if (mid!=-1) { - freeSockWithLock(transPResponseSocketPool, mid, sd); - } - mid=oidmid.mid; - sd = getSockWithLock(transPResponseSocketPool, mid); - } - short offsetarry[numoffset]; - recv_data((int) acceptfd, offsetarry, numoffset*sizeof(short)); - - /*Process each oid */ - if ((header = mhashSearch(oid)) == NULL) {/* Obj not found */ - /* Save the oids not found in buffer for later use */ - size = sizeof(int) + sizeof(char) + sizeof(unsigned int) ; - char sendbuffer[size]; - *((int *) sendbuffer) = size; - *((char *)(sendbuffer + sizeof(int))) = OBJECT_NOT_FOUND; - *((unsigned int *)(sendbuffer + sizeof(int) + sizeof(char))) = oid; - control = TRANS_PREFETCH_RESPONSE; - sendPrefetchResponse(sd, &control, sendbuffer, &size); - } else { /* Object Found */ - int incr = 0; - GETSIZE(objsize, header); - size = sizeof(int) + sizeof(char) + sizeof(unsigned int) + sizeof(objheader_t) + objsize; - char sendbuffer[size]; - *((int *) (sendbuffer + incr)) = size; - incr += sizeof(int); - *((char *)(sendbuffer + incr)) = OBJECT_FOUND; - incr += sizeof(char); - *((unsigned int *)(sendbuffer+incr)) = oid; - incr += sizeof(unsigned int); - memcpy(sendbuffer + incr, header, objsize + sizeof(objheader_t)); - - control = TRANS_PREFETCH_RESPONSE; - sendPrefetchResponse(sd, &control, sendbuffer, &size); - - /* Calculate the oid corresponding to the offset value */ - for(i = 0 ; i< numoffset ; i++) { - /* Check for arrays */ - if(TYPE(header) > NUMCLASSES) { - int elementsize = classsize[TYPE(header)]; - struct ArrayObject *ao = (struct ArrayObject *) (((char *)header) + sizeof(objheader_t)); - unsigned short length = ao->___length___; - /* Check if array out of bounds */ - if(offsetarry[i]< 0 || offsetarry[i] >= length) { - break; - } - oid = *((unsigned int *)(((char *)header) + sizeof(objheader_t) + sizeof(struct ArrayObject) + (elementsize*offsetarry[i]))); - } else { - oid = *((unsigned int *)(((char *)header) + sizeof(objheader_t) + offsetarry[i])); - } - - /* Don't continue if we hit a NULL pointer */ - if (oid==0) - break; - - if((header = mhashSearch(oid)) == NULL) { - size = sizeof(int) + sizeof(char) + sizeof(unsigned int) ; - char sendbuffer[size]; - *((int *) sendbuffer) = size; - *((char *)(sendbuffer + sizeof(int))) = OBJECT_NOT_FOUND; - *((unsigned int *)(sendbuffer + sizeof(int) + sizeof(char))) = oid; - - control = TRANS_PREFETCH_RESPONSE; - sendPrefetchResponse(sd, &control, sendbuffer, &size); - break; - } else {/* Obj Found */ - int incr = 0; - GETSIZE(objsize, header); - size = sizeof(int) + sizeof(char) + sizeof(unsigned int) + sizeof(objheader_t) + objsize; - char sendbuffer[size]; - *((int *) (sendbuffer + incr)) = size; - incr += sizeof(int); - *((char *)(sendbuffer + incr)) = OBJECT_FOUND; - incr += sizeof(char); - *((unsigned int *)(sendbuffer+incr)) = oid; - incr += sizeof(unsigned int); - memcpy(sendbuffer + incr, header, objsize + sizeof(objheader_t)); - - control = TRANS_PREFETCH_RESPONSE; - sendPrefetchResponse(sd, &control, sendbuffer, &size); - } - } - } - } - //Release socket - if (mid!=-1) - freeSockWithLock(transPResponseSocketPool, mid, sd); - - return 0; -} - -void sendPrefetchResponse(int sd, char *control, char *sendbuffer, int *size) { - send_data(sd, control, sizeof(char)); - /* Send the buffer with its size */ - int length = *(size); - send_data(sd, sendbuffer, length); -} - -void processReqNotify(unsigned int numoid, unsigned int *oidarry, unsigned short *versionarry, unsigned int mid, unsigned int threadid) { - objheader_t *header; - unsigned int oid; - unsigned short newversion; - char msg[1+ 2 * sizeof(unsigned int) + sizeof(unsigned short)]; - int sd; - struct sockaddr_in remoteAddr; - int bytesSent; - int size; - int i = 0; - - while(i < numoid) { - oid = *(oidarry + i); - if((header = (objheader_t *) mhashSearch(oid)) == NULL) { - printf("Error: mhashsearch returns NULL at %s, %d\n", __FILE__, __LINE__); - return; - } else { - /* Check to see if versions are same */ - checkversion: - if (test_and_set(STATUSPTR(header))==0) { - //have lock - newversion = header->version; - if(newversion == *(versionarry + i)) { - //Add to the notify list - if((header->notifylist = insNode(header->notifylist, threadid, mid)) == NULL) { - printf("Error: Obj notify list points to NULL %s, %d\n", __FILE__, __LINE__); - return; - } - UnLock(STATUSPTR(header)); - } else { - UnLock(STATUSPTR(header)); - if ((sd = socket(AF_INET, SOCK_STREAM, 0)) < 0){ - perror("processReqNotify():socket()"); - return; - } - bzero(&remoteAddr, sizeof(remoteAddr)); - remoteAddr.sin_family = AF_INET; - remoteAddr.sin_port = htons(LISTEN_PORT); - remoteAddr.sin_addr.s_addr = htonl(mid); - - if (connect(sd, (struct sockaddr *)&remoteAddr, sizeof(remoteAddr)) < 0){ - printf("Error: processReqNotify():error %d connecting to %s:%d\n", errno, - inet_ntoa(remoteAddr.sin_addr), LISTEN_PORT); - close(sd); - return; - } else { - //Send Update notification - msg[0] = THREAD_NOTIFY_RESPONSE; - *((unsigned int *)&msg[1]) = oid; - size = sizeof(unsigned int); - *((unsigned short *)(&msg[1]+size)) = newversion; - size += sizeof(unsigned short); - *((unsigned int *)(&msg[1]+size)) = threadid; - size = 1+ 2*sizeof(unsigned int) + sizeof(unsigned short); - send_data(sd, msg, size); - } - close(sd); - } - } else { - randomdelay(); - goto checkversion; - } - } - i++; - } - free(oidarry); - free(versionarry); -} diff --git a/Robust/src/Runtime/DSTM/interface/gCollect.c b/Robust/src/Runtime/DSTM/interface/gCollect.c deleted file mode 100644 index 9e5e08c6..00000000 --- a/Robust/src/Runtime/DSTM/interface/gCollect.c +++ /dev/null @@ -1,175 +0,0 @@ -#include "gCollect.h" -#include "prelookup.h" - -extern objstr_t *prefetchcache; //Global Prefetch cache -extern pthread_mutex_t prefetchcache_mutex; //Mutex to lock Prefetch Cache -extern prehashtable_t pflookup; //Global prefetch cache lookup table -prefetchNodeInfo_t *pNodeInfo; //Global prefetch holding metadata - -void initializePCache() { - pNodeInfo = calloc(1, sizeof(prefetchNodeInfo_t)); //Not freed yet - pNodeInfo->oldptr = prefetchcache; - pNodeInfo->newptr = NULL; - pNodeInfo->num_old_objstr = 1; //for prefetch cache allocated by objstralloc in trans.c file - pNodeInfo->maxsize = DEFAULT_OBJ_STORE_SIZE; -} - -void *prefetchobjstrAlloc(unsigned int size) { - void * ptr = NULL; - if(pNodeInfo->num_old_objstr <= PREFETCH_FLUSH_COUNT_THRESHOLD) { - //regular allocation - if((ptr = normalPrefetchAlloc(prefetchcache, size)) == NULL) { - printf("Error: %s() prefetch cache alloc error %s, %d\n", __func__, __FILE__, __LINE__); - return NULL; - } - return ptr; - } else { - // Iterate through available blocks to see if size can be allocated - if((ptr = lookUpFreeSpace(pNodeInfo->newptr, pNodeInfo->oldptr, size)) != NULL) { - return ptr; - } else { //allocate new block if size not available - if(size >= pNodeInfo->maxsize) { - if((ptr = allocateNew(size)) == NULL) { - printf("Error: %s() Calloc error %s %d\n", __func__, __FILE__, __LINE__); - return NULL; - } - return ptr; - } else { //If size less then reclaim old blocks - clearNBlocks(pNodeInfo->oldptr, pNodeInfo->newptr); - //update oldptr and newptr - updatePtrs(); - //look for free space if available in the free blocks - if((ptr = lookUpFreeSpace(pNodeInfo->newptr, pNodeInfo->oldptr, size)) != NULL) { - return ptr; - } else { - if((ptr = allocateNew(size)) == NULL) { - printf("Error: %s() Calloc error %s %d\n", __func__, __FILE__, __LINE__); - return NULL; - } - return ptr; - } - } - } - } -} - -void *normalPrefetchAlloc(objstr_t *store, unsigned int size) { - void *tmp; - while (1) { - if(((unsigned int)store->top - (((unsigned int)store) + sizeof(objstr_t)) + size) <= store->size) { //store not full - tmp = store->top; - store->top += size; - return tmp; - } - //store full - if(store->next == NULL) { - //end of list, all full - if(size > DEFAULT_OBJ_STORE_SIZE) { - //in case of large objects - if((store->next = (objstr_t *) calloc(1,(sizeof(objstr_t) + size))) == NULL) { - printf("%s() Calloc error at line %d, %s\n", __func__, __LINE__, __FILE__); - return NULL; - } - store = store->next; - store->size = size; - } else { - if((store->next = (objstr_t *) calloc(1, (sizeof(objstr_t) + DEFAULT_OBJ_STORE_SIZE))) == NULL) { - printf("%s() Calloc error at line %d, %s\n", __func__, __LINE__, __FILE__); - return NULL; - } - store = store->next; - store->size = DEFAULT_OBJ_STORE_SIZE; - } - //Update maxsize of objstr blocks, num of blocks and newptr - pNodeInfo->num_old_objstr++; - if(pNodeInfo->num_old_objstr <= PREFETCH_FLUSH_COUNT_THRESHOLD/2) - pNodeInfo->newptr = store; - if(pNodeInfo->maxsize < size) - pNodeInfo->maxsize = size; - store->top = (void *)(((unsigned int)store) + sizeof(objstr_t) + size); - return (void *)(((unsigned int)store) + sizeof(objstr_t)); - } else { - store = store->next; - } - } -} - -void *lookUpFreeSpace(void *startAddr, void *endAddr, int size) { - objstr_t *ptr; - void *tmp; - ptr = (objstr_t *) (startAddr); - while(ptr != NULL && ((unsigned long int)ptr!= (unsigned long int)endAddr)) { - if(((unsigned int)ptr->top - (((unsigned int)ptr) + sizeof(objstr_t)) + size) <= ptr->size) { //store not full - tmp = ptr->top; - ptr->top += size; - return tmp; - } - ptr = ptr->next; - } - return NULL; -} - -void clearNBlocks(void *oldaddr, void * newaddr) { - int count = 0; - objstr_t *tmp = (objstr_t *) oldaddr; - pthread_mutex_lock(&pflookup.lock); - while(((unsigned int) tmp != (unsigned int)newaddr) && (tmp != NULL)) { - void * begin = (void *)tmp+sizeof(objstr_t); - void * end = (void *)tmp+sizeof(objstr_t)+tmp->size; - tmp->top = (void *)tmp+sizeof(objstr_t); - clearPLookUpTable(begin, end); - //TODO only for testing purpose, remove later - memset(tmp->top, 0, tmp->size); - tmp = tmp->next; - } - pthread_mutex_unlock(&pflookup.lock); -} - -void clearPLookUpTable(void *begin, void *end) { - unsigned long int tmpbegin; - unsigned long int tmpend; - tmpbegin = (unsigned long int) begin; - tmpend = (unsigned long int) end; - int i, j; - prehashlistnode_t *ptr = pflookup.table; - for(i = 0; inext) { - if(((unsigned long int)(curr->val) >= tmpbegin) && ((unsigned long int)(curr->val) < tmpend)) { - unsigned int oid = curr->key; - objheader_t *objheader; - if((objheader = prehashSearch(oid)) != NULL) { - prehashRemove(oid); -#ifdef CHECKTA - printf("%s() clearing Look up table for oid = %x\n", __func__, oid); -#endif - } - } - } - } -} - -void updatePtrs() { - void *ptr; - ptr = pNodeInfo->oldptr; - pNodeInfo->oldptr = pNodeInfo->newptr; - pNodeInfo->newptr = ptr; -} - -void *allocateNew(unsigned int size) { - objstr_t *tmp; - if((tmp = (objstr_t *) calloc(1, (sizeof(objstr_t) +size))) == NULL) { - printf("Error: %s() Calloc error %s %d\n", __func__, __FILE__, __LINE__); - return NULL; - } - tmp->size = size; - tmp->top = (void *)(((unsigned int)tmp) + sizeof(objstr_t) + size); - //Insert newly allocated block into linked list of prefetch cache - tmp->next = ((objstr_t *)(pNodeInfo->newptr))->next; - ((objstr_t *)(pNodeInfo->newptr))->next = tmp; - pNodeInfo->num_old_objstr++; - // Update maxsize of prefetch objstr blocks - if(pNodeInfo->maxsize < tmp->size) - pNodeInfo->maxsize = tmp->size; - return (void *)(((unsigned int)tmp) + sizeof(objstr_t)); -} diff --git a/Robust/src/Runtime/DSTM/interface/gCollect.h b/Robust/src/Runtime/DSTM/interface/gCollect.h deleted file mode 100644 index 3bf6a71c..00000000 --- a/Robust/src/Runtime/DSTM/interface/gCollect.h +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef _GCOLLECT_H -#define _GCOLLECT_H - -#include "dstm.h" - -/*********************************** - ****** Global constants ********** - **********************************/ -#define PREFETCH_FLUSH_COUNT_THRESHOLD 30 - -/********************************* - ********* Global variables ****** - ********************************/ -typedef struct prefetchNodeInfo { - void *oldptr; - void *newptr; - int num_old_objstr; - int maxsize; -} prefetchNodeInfo_t; - -/******************************** - ******** Functions ************ - *******************************/ -void *prefetchobjstrAlloc(unsigned int size); -void *normalPrefetchAlloc(objstr_t *, unsigned int); -void initializePCache(); -void *lookUpFreeSpace(void *, void *, int); -void clearNBlocks(void *, void *); -void clearPLookUpTable(void *, void *); -void updatePtrs(); -void *allocateNew(unsigned int size); -#endif diff --git a/Robust/src/Runtime/DSTM/interface/ip.c b/Robust/src/Runtime/DSTM/interface/ip.c deleted file mode 100644 index 9c97347e..00000000 --- a/Robust/src/Runtime/DSTM/interface/ip.c +++ /dev/null @@ -1,104 +0,0 @@ -#include -#include -#include "ip.h" -#include -#include -#include -#include -#include -#include -#include - -#define LISTEN_PORT 2156 - -unsigned int iptoMid(char *addr) { - ip_t i; - unsigned int mid; - - sscanf(addr, "%d.%d.%d.%d", &i.a, &i.b, &i.c, &i.d); - mid = (i.a << 24) | (i.b << 16) | (i.c << 8) | i.d; - fflush(stdout); - return mid; -} - -void midtoIP(unsigned int mid, char *ptr) { - ip_t i; - - i.a = (mid & 0xff000000) >> 24; - i.b = (mid & 0x00ff0000) >> 16; - i.c = (mid & 0x0000ff00) >> 8; - i.d = mid & 0x000000ff; - sprintf(ptr, "%d.%d.%d.%d", i.a, i.b, i.c, i.d); -#ifdef DEBUG - printf("DEBUG-> midtoIP() mid = %d.%d.%d.%d\n", i.a, i.b, i.c, i.d); -#endif - return; -} - -int checkServer(int mid, char *machineip) { - int tmpsd; - struct sockaddr_in serv_addr; - char m[20]; - - strncpy(m, machineip, strlen(machineip)); - // Foreach machine you want to transact with - // check if its up and running - if ((tmpsd = socket(AF_INET, SOCK_STREAM, 0)) < 0) { - perror(""); - return(-1); - } - bzero((char*) &serv_addr, sizeof(serv_addr)); - serv_addr.sin_family = AF_INET; - serv_addr.sin_port = htons(LISTEN_PORT); - midtoIP(mid, m); - m[15] = '\0'; - serv_addr.sin_addr.s_addr = inet_addr(m); - while (connect(tmpsd, (struct sockaddr *) &serv_addr, sizeof(struct sockaddr)) < 0) { - sleep(1); - } - close(tmpsd); - return 0; -} - -unsigned int getMyIpAddr(const char *interfaceStr) -{ - int sock; - struct ifreq interfaceInfo; - struct sockaddr_in *myAddr = (struct sockaddr_in *)&interfaceInfo.ifr_addr; - - memset(&interfaceInfo, 0, sizeof(struct ifreq)); - - if((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) - { - perror("getMyIpAddr():socket()"); - return 1; - } - - strcpy(interfaceInfo.ifr_name, interfaceStr); - myAddr->sin_family = AF_INET; - - if(ioctl(sock, SIOCGIFADDR, &interfaceInfo) != 0) - { - perror("getMyIpAddr():ioctl()"); - return 1; - } - - close(sock); - - return ntohl(myAddr->sin_addr.s_addr); -} - -/* -main() { - unsigned int mid; - ip_t i; - char ip[16]; - - memset(ip, 0, 16); - mid = iptoMid("192.10.0.1"); - printf("mid = %x\n", mid); - midtoIP(mid, ip); - ip[15] = '\0'; - printf("%s\n",ip); -} -*/ diff --git a/Robust/src/Runtime/DSTM/interface/ip.h b/Robust/src/Runtime/DSTM/interface/ip.h deleted file mode 100644 index 29db799c..00000000 --- a/Robust/src/Runtime/DSTM/interface/ip.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef _ip_h_ -#define _ip_h_ - -typedef struct ip { - short a; - short b; - short c; - short d; -}ip_t; - -unsigned int iptoMid(char *); -void midtoIP(unsigned int, char *); -int checkServer(int, char *); -unsigned int getMyIpAddr(const char *interfaceStr); - -#endif diff --git a/Robust/src/Runtime/DSTM/interface/llookup.c b/Robust/src/Runtime/DSTM/interface/llookup.c deleted file mode 100644 index 30760978..00000000 --- a/Robust/src/Runtime/DSTM/interface/llookup.c +++ /dev/null @@ -1,228 +0,0 @@ -/************************************************************************************************ - IMP NOTE: - All llookup hash function prototypes returns 0 on sucess and 1 otherwise - llookup hash is an array of lhashlistnode_t - oid = mid = 0 in a given lhashlistnode_t for each bin in the hash table ONLY if the entry is empty => - the OID's can be any unsigned int except 0 - - Uses pthreads. compile using -lpthread option -***************************************************************************************************/ -#include "llookup.h" - -#ifdef SIMPLE_LLOOKUP - -extern unsigned int *hostIpAddrs; -extern unsigned int oidsPerBlock; - -unsigned int lhashCreate(unsigned int size, float loadfactor) -{ - return 0; -} - -unsigned int lhashInsert(unsigned int oid, unsigned int mid) -{ - return 0; -} - -unsigned int lhashSearch(unsigned int oid) -{ - if (oidsPerBlock == 0) - return hostIpAddrs[0]; - else - return hostIpAddrs[oid / oidsPerBlock]; -} - -unsigned int lhashRemove(unsigned int oid) -{ - return 0; -} - -#else - -lhashtable_t llookup; //Global Hash table - -// Creates a hash table with size and an array of lhashlistnode_t -unsigned int lhashCreate(unsigned int size, float loadfactor) { - lhashlistnode_t *nodes; - int i; - - // Allocate space for the hash table - if((nodes = calloc(size, sizeof(lhashlistnode_t))) == NULL) { - printf("Calloc error %s %d\n", __FILE__, __LINE__); - return 1; - } - - llookup.table = nodes; - llookup.size = size; - llookup.numelements = 0; // Initial number of elements in the hash - llookup.loadfactor = loadfactor; - //Initialize the pthread_mutex variable - pthread_mutex_init(&llookup.locktable, NULL); - return 0; -} - -// Assign to oids to bins inside hash table -unsigned int lhashFunction(unsigned int oid) { - return( oid % (llookup.size)); -} - -// Insert oid and mid mapping into the hash table -unsigned int lhashInsert(unsigned int oid, unsigned int mid) { - unsigned int newsize; - int index; - lhashlistnode_t *ptr, *node; - - if (llookup.numelements > (llookup.loadfactor * llookup.size)) { - //Resize Table - newsize = 2 * llookup.size + 1; - pthread_mutex_lock(&llookup.locktable); - lhashResize(newsize); - pthread_mutex_unlock(&llookup.locktable); - } - - ptr = llookup.table; - llookup.numelements++; - - index = lhashFunction(oid); -#ifdef DEBUG - printf("DEBUG(insert) oid = %d, mid =%d, index =%d\n",oid,mid, index); -#endif - pthread_mutex_lock(&llookup.locktable); - if(ptr[index].next == NULL && ptr[index].oid == 0) { // Insert at the first position in the hashtable - ptr[index].oid = oid; - ptr[index].mid = mid; - } else { // Insert in the linked list - if ((node = calloc(1, sizeof(lhashlistnode_t))) == NULL) { - printf("Calloc error %s, %d\n", __FILE__, __LINE__); - pthread_mutex_unlock(&llookup.locktable); - return 1; - } - node->oid = oid; - node->mid = mid; - node->next = ptr[index].next; - ptr[index].next = node; - } - - pthread_mutex_unlock(&llookup.locktable); - return 0; -} - -// Return mid for a given oid in the hash table -unsigned int lhashSearch(unsigned int oid) { - int index; - lhashlistnode_t *ptr, *node; - - ptr = llookup.table; // Address of the beginning of hash table - index = lhashFunction(oid); - node = &ptr[index]; - pthread_mutex_lock(&llookup.locktable); - while(node != NULL) { - if(node->oid == oid) { - pthread_mutex_unlock(&llookup.locktable); - return node->mid; - } - node = node->next; - } - pthread_mutex_unlock(&llookup.locktable); - return 0; -} - -// Remove an entry from the hash table -unsigned int lhashRemove(unsigned int oid) { - int index; - lhashlistnode_t *curr, *prev; - lhashlistnode_t *ptr, *node; - - ptr = llookup.table; - index = lhashFunction(oid); - curr = &ptr[index]; - - pthread_mutex_lock(&llookup.locktable); - for (; curr != NULL; curr = curr->next) { - if (curr->oid == oid) { // Find a match in the hash table - llookup.numelements--; // Decrement the number of elements in the global hashtable - if ((curr == &ptr[index]) && (curr->next == NULL)) { // Delete the first item inside the hashtable with no linked list of lhashlistnode_t - curr->oid = 0; - curr->mid = 0; - } else if ((curr == &ptr[index]) && (curr->next != NULL)) { //Delete the first item with a linked list of lhashlistnode_t connected - curr->oid = curr->next->oid; - curr->mid = curr->next->mid; - node = curr->next; - curr->next = curr->next->next; - free(node); - } else { // Regular delete from linked listed - prev->next = curr->next; - free(curr); - } - pthread_mutex_unlock(&llookup.locktable); - return 0; - } - prev = curr; - } - pthread_mutex_unlock(&llookup.locktable); - return 1; -} - -// Resize table -unsigned int lhashResize(unsigned int newsize) { - lhashlistnode_t *node, *ptr, *curr, *next; // curr and next keep track of the current and the next lhashlistnodes in a linked list - unsigned int oldsize; - int isfirst; // Keeps track of the first element in the lhashlistnode_t for each bin in hashtable - int i,index; - lhashlistnode_t *newnode; - - ptr = llookup.table; - oldsize = llookup.size; - - if((node = calloc(newsize, sizeof(lhashlistnode_t))) == NULL) { - printf("Calloc error %s %d\n", __FILE__, __LINE__); - return 1; - } - - llookup.table = node; //Update the global hashtable upon resize() - llookup.size = newsize; - llookup.numelements = 0; - - for(i = 0; i < oldsize; i++) { //Outer loop for each bin in hash table - curr = &ptr[i]; - isfirst = 1; - while (curr != NULL) { //Inner loop to go through linked lists - if (curr->oid == 0) { //Exit inner loop if there the first element for a given bin/index is NULL - break; //oid = mid =0 for element if not present within the hash table - } - next = curr->next; - index = lhashFunction(curr->oid); - // Insert into the new table - if(llookup.table[index].next == NULL && llookup.table[index].oid == 0) { - llookup.table[index].oid = curr->oid; - llookup.table[index].mid = curr->mid; - llookup.numelements++; - }else { - if((newnode = calloc(1, sizeof(lhashlistnode_t))) == NULL) { - printf("Calloc error %s, %d\n", __FILE__, __LINE__); - return 1; - } - newnode->oid = curr->oid; - newnode->mid = curr->mid; - newnode->next = llookup.table[index].next; - llookup.table[index].next = newnode; - llookup.numelements++; - } - - //free the linked list of lhashlistnode_t if not the first element in the hash table - if (isfirst != 1) { - free(curr); - } - - isfirst = 0; - curr = next; - - } - } - - free(ptr); //Free the memory of the old hash table - return 0; -} - -#endif - diff --git a/Robust/src/Runtime/DSTM/interface/llookup.h b/Robust/src/Runtime/DSTM/interface/llookup.h deleted file mode 100644 index 29c0d304..00000000 --- a/Robust/src/Runtime/DSTM/interface/llookup.h +++ /dev/null @@ -1,40 +0,0 @@ -#ifndef _LLOOKUP_H_ -#define _LLOOKUP_H_ - -#include -#include -#include - -#define SIMPLE_LLOOKUP - -#define LOADFACTOR 0.5 -#define HASH_SIZE 100 - -typedef struct lhashlistnode { - unsigned int oid; - unsigned int mid; - struct lhashlistnode *next; -} lhashlistnode_t; - -typedef struct lhashtable { - lhashlistnode_t *table; // points to beginning of hash table - unsigned int size; - unsigned int numelements; - float loadfactor; - pthread_mutex_t locktable; -} lhashtable_t; - -//returns 0 for success and 1 for failure -unsigned int lhashCreate(unsigned int size, float loadfactor); -//returns 0 for success and 1 for failure -unsigned int lhashInsert(unsigned int oid, unsigned int mid); -//returns mid, 0 if not found -unsigned int lhashSearch(unsigned int oid); -//returns 0 for success and 1 for failure -unsigned int lhashRemove(unsigned int oid); - -//helper functions -unsigned int lhashResize(unsigned int newsize); -unsigned int lhashFunction(unsigned int oid); - -#endif diff --git a/Robust/src/Runtime/DSTM/interface/localobjects.c b/Robust/src/Runtime/DSTM/interface/localobjects.c deleted file mode 100644 index 1c2ee006..00000000 --- a/Robust/src/Runtime/DSTM/interface/localobjects.c +++ /dev/null @@ -1,63 +0,0 @@ -#include "localobjects.h" -#include - -void REVERT_OBJ(struct ___Object___ * obj) { - int type=((int *)obj)[0]; - struct ___Object___ * copyobj=obj->___localcopy___; - if (type___length___; - int size=sizeof(struct ArrayObject)+length*elementsize; - memcpy(obj, copyobj, size); - } -} - -#ifdef PRECISE_GC -void COPY_OBJ(struct garbagelist * gl, struct ___Object___ *obj) { -#else -void COPY_OBJ(struct ___Object___ *obj) { -#endif - int type=((int *)obj)[0]; - if (type___localcopy___=newobj; -#else - memcpy(newobj, obj, size); - obj->___localcopy___=newobj; -#endif - } else { - /* We have an array */ - struct ArrayObject *ao=(struct ArrayObject *)obj; - int elementsize=classsize[type]; - int length=ao->___length___; - int size=sizeof(struct ArrayObject)+length*elementsize; -#ifdef PRECISE_GC - int ptrarray[]={1, (int) gl, (int) obj}; - struct ___Object___ * newobj=mygcmalloc((struct garbagelist *)ptrarray, size); -#else - struct ___Object___ * newobj=FREEMALLOC(size); -#endif -#ifdef PRECISE_GC - memcpy(newobj, (struct ___Object___ *) ptrarray[2], size); - ((struct ___Object___*)ptrarray[2])->___localcopy___=newobj; -#else - memcpy(newobj, obj, size); - obj->___localcopy___=newobj; -#endif - } -} diff --git a/Robust/src/Runtime/DSTM/interface/localobjects.h b/Robust/src/Runtime/DSTM/interface/localobjects.h deleted file mode 100644 index 6b69ee87..00000000 --- a/Robust/src/Runtime/DSTM/interface/localobjects.h +++ /dev/null @@ -1,14 +0,0 @@ -#ifndef LOCALOBJECT_H -#define LOCALOBJECT_H -#include "structdefs.h" -#include "garbage.h" -void REVERT_OBJ(struct ___Object___ *); -#define COMMIT_OBJ(obj) obj->___localcopy___=NULL;\ - obj->___nextobject___=NULL - -#ifdef PRECISE_GC -void COPY_OBJ(struct garbagelist * gl, struct ___Object___ *obj); -#else -void COPY_OBJ(struct ___Object___ *obj); -#endif -#endif diff --git a/Robust/src/Runtime/DSTM/interface/machinepile.c b/Robust/src/Runtime/DSTM/interface/machinepile.c deleted file mode 100644 index 10b5aed8..00000000 --- a/Robust/src/Runtime/DSTM/interface/machinepile.c +++ /dev/null @@ -1,80 +0,0 @@ -#include "machinepile.h" - -void insertPile(int mid, unsigned int oid, short numoffset, short *offset, prefetchpile_t **head) { - prefetchpile_t *ptr; - objpile_t *objnode; - unsigned int *oidarray; - objpile_t **tmp; - - //Loop through the machines - for(;1;head=&((*head)->next)) { - int tmid; - if ((*head)==NULL||(tmid=(*head)->mid)>mid) { - prefetchpile_t * tmp = (prefetchpile_t *) malloc(sizeof(prefetchpile_t)); - tmp->mid = mid; - objnode = malloc(sizeof(objpile_t)); - objnode->offset = offset; - objnode->oid = oid; - objnode->numoffset = numoffset; - objnode->next = NULL; - tmp->objpiles = objnode; - tmp->next = *head; - *head=tmp; - return; - } - - //keep looking - if (tmid < mid) - continue; - - //found mid list - for(tmp=&((*head)->objpiles);1;tmp=&((*tmp)->next)) { - int toid; - int matchstatus; - - if ((*tmp)==NULL||((toid=(*tmp)->oid)>oid)) { - objnode = (objpile_t *) malloc(sizeof(objpile_t)); - objnode->offset = offset; - objnode->oid = oid; - objnode->numoffset = numoffset; - objnode->next = *tmp; - *tmp = objnode; - return; - } - if (toid < oid) - continue; - - /* Fill objpiles DS */ - int i; - int onumoffset=(*tmp)->numoffset; - short * ooffset=(*tmp)->offset; - - for(i=0;ionumoffset) { - //We've matched, let's just extend the current prefetch - (*tmp)->numoffset=numoffset; - (*tmp)->offset=offset; - return; - } - if (ooffset[i]offset[i]) { - //Place item before the current one - objnode = (objpile_t *) malloc(sizeof(objpile_t)); - objnode->offset = offset; - objnode->oid = oid; - objnode->numoffset = numoffset; - objnode->next = *tmp; - *tmp = objnode; - return; - } - } - //if we get to the end, we're already covered by this prefetch - return; - oidloop: - ; - } - } - - -} diff --git a/Robust/src/Runtime/DSTM/interface/machinepile.h b/Robust/src/Runtime/DSTM/interface/machinepile.h deleted file mode 100644 index c32a02a8..00000000 --- a/Robust/src/Runtime/DSTM/interface/machinepile.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef _MACHINEPILE_H_ -#define _MACHINEPILE_H_ - -#include "mcpileq.h" -#include -#include - -void insertPile(int, unsigned int, short, short *, prefetchpile_t **); - -#endif diff --git a/Robust/src/Runtime/DSTM/interface/main.c b/Robust/src/Runtime/DSTM/interface/main.c deleted file mode 100644 index 3a6f44f7..00000000 --- a/Robust/src/Runtime/DSTM/interface/main.c +++ /dev/null @@ -1,25 +0,0 @@ -#include -#include -#include -#include "dstm.h" - -#define size 1000000 - - -obj_addr_table_t mlut; -int classsize[]={sizeof(int),sizeof(char),sizeof(short), sizeof(void *)}; - -int main() { - int i; - - dstm_init(); - create_objstr(size); - createHash(&mlut, HASH_SIZE, 0.75); - - for(i=0; i< 4 ; i++) { - createObject(i); - } - - createObject(3); - return 0; -} diff --git a/Robust/src/Runtime/DSTM/interface/mcpileq.c b/Robust/src/Runtime/DSTM/interface/mcpileq.c deleted file mode 100644 index bb58ecef..00000000 --- a/Robust/src/Runtime/DSTM/interface/mcpileq.c +++ /dev/null @@ -1,71 +0,0 @@ -#include "mcpileq.h" - -mcpileq_t mcqueue; //Global queue - -void mcpileqInit(void) { - /* Initialize machine queue that containing prefetch oids and offset values sorted by remote machineid */ - mcqueue.front = mcqueue.rear = NULL; - //Intiliaze and set machile pile queue's mutex attribute - pthread_mutexattr_init(&mcqueue.qlockattr); - pthread_mutexattr_settype(&mcqueue.qlockattr, PTHREAD_MUTEX_RECURSIVE_NP); - pthread_mutex_init(&mcqueue.qlock,&mcqueue.qlockattr); - pthread_cond_init(&mcqueue.qcond, NULL); -} - -/* Insert to the rear of machine pile queue */ -void mcpileenqueue(prefetchpile_t *node, prefetchpile_t *tail) { - if(mcqueue.front == NULL) { - mcqueue.front = node; - mcqueue.rear = tail; - } else { - mcqueue.rear->next = node; - mcqueue.rear = tail; - } -} - -/* Return the node pointed to by the front ptr of the queue */ -prefetchpile_t *mcpiledequeue(void) { - prefetchpile_t *retnode=mcqueue.front; - if(retnode == NULL) { - printf("Machine pile queue empty: Underflow %s %d\n", __FILE__, __LINE__); - return NULL; - } - mcqueue.front = retnode->next; - if (mcqueue.front == NULL) - mcqueue.rear = NULL; - retnode->next = NULL; - - return retnode; -} - -void mcpiledisplay() { - int mid; - - prefetchpile_t *tmp = mcqueue.front; - while(tmp != NULL) { - printf("Remote machine id = %d\n", tmp->mid); - tmp = tmp->next; - } -} - -/* Delete prefetchpile_t and everything it points to */ -void mcdealloc(prefetchpile_t *node) { - prefetchpile_t *prefetchpile_ptr; - prefetchpile_t *prefetchpile_next_ptr; - objpile_t *objpile_ptr; - objpile_t *objpile_next_ptr; - - prefetchpile_ptr = node; - - while (prefetchpile_ptr != NULL) { - prefetchpile_next_ptr = prefetchpile_ptr; - while(prefetchpile_ptr->objpiles != NULL) { - //offsets aren't owned by us, so we don't free them. - objpile_ptr = prefetchpile_ptr->objpiles; - prefetchpile_ptr->objpiles = objpile_ptr->next; - free(objpile_ptr); - } - prefetchpile_ptr = prefetchpile_next_ptr->next; - free(prefetchpile_next_ptr); - } -} diff --git a/Robust/src/Runtime/DSTM/interface/mcpileq.h b/Robust/src/Runtime/DSTM/interface/mcpileq.h deleted file mode 100644 index f32c7b69..00000000 --- a/Robust/src/Runtime/DSTM/interface/mcpileq.h +++ /dev/null @@ -1,37 +0,0 @@ -#ifndef _MCPILEQ_H_ -#define _MCPILEQ_H_ - -#include -#include -#include -#include - -//Structure to make machine groups when prefetching -typedef struct objpile { - unsigned int oid; - short numoffset; - short *offset; - struct objpile *next; -} objpile_t; - -//Structure for prefetching tuples generated by the compiler -typedef struct prefetchpile { - unsigned int mid; - objpile_t *objpiles; - struct prefetchpile *next; -} prefetchpile_t; - -typedef struct mcpileq { - prefetchpile_t *front, *rear; - pthread_mutex_t qlock; - pthread_mutexattr_t qlockattr; - pthread_cond_t qcond; -} mcpileq_t; - -void mcpileqInit(void); -void mcpileenqueue(prefetchpile_t *, prefetchpile_t *); -prefetchpile_t *mcpiledequeue(void); -void mcpiledisplay(); -void mcdealloc(prefetchpile_t *); - -#endif diff --git a/Robust/src/Runtime/DSTM/interface/mlookup.c b/Robust/src/Runtime/DSTM/interface/mlookup.c deleted file mode 100644 index 9000b80e..00000000 --- a/Robust/src/Runtime/DSTM/interface/mlookup.c +++ /dev/null @@ -1,218 +0,0 @@ -#include "mlookup.h" - -mhashtable_t mlookup; //Global hash table - -// Creates a machine lookup table with size =" size" -unsigned int mhashCreate(unsigned int size, float loadfactor) { - mhashlistnode_t *nodes; - // Allocate space for the hash table - if((nodes = calloc(size, sizeof(mhashlistnode_t))) == NULL) { - printf("Calloc error %s %d\n", __FILE__, __LINE__); - return 1; - } - - mlookup.table = nodes; - mlookup.size = size; - mlookup.numelements = 0; // Initial number of elements in the hash - mlookup.loadfactor = loadfactor; - //Initialize the pthread_mutex variable - pthread_mutex_init(&mlookup.locktable, NULL); - return 0; -} - -// Assign to keys to bins inside hash table -unsigned int mhashFunction(unsigned int key) { - return( key % (mlookup.size)); -} - -// Insert value and key mapping into the hash table -unsigned int mhashInsert(unsigned int key, void *val) { - unsigned int newsize; - int index; - mhashlistnode_t *ptr, *node; - - if (mlookup.numelements > (mlookup.loadfactor * mlookup.size)) { - //Resize Table - newsize = 2 * mlookup.size + 1; - pthread_mutex_lock(&mlookup.locktable); - mhashResize(newsize); - pthread_mutex_unlock(&mlookup.locktable); - } - ptr = mlookup.table; - mlookup.numelements++; - -#ifdef DEBUG - printf("DEBUG -> index = %d, key = %d, val = %x\n", index, key, val); -#endif - pthread_mutex_lock(&mlookup.locktable); - index = mhashFunction(key); - if(ptr[index].next == NULL && ptr[index].key == 0) { // Insert at the first position in the hashtable - ptr[index].key = key; - ptr[index].val = val; - } else { // Insert in the beginning of linked list - if ((node = calloc(1, sizeof(mhashlistnode_t))) == NULL) { - printf("Calloc error %s, %d\n", __FILE__, __LINE__); - pthread_mutex_unlock(&mlookup.locktable); - return 1; - } - node->key = key; - node->val = val; - node->next = ptr[index].next; - ptr[index].next = node; - } - pthread_mutex_unlock(&mlookup.locktable); - return 0; -} - -// Return val for a given key in the hash table -void *mhashSearch(unsigned int key) { - int index; - mhashlistnode_t *ptr, *node; - - pthread_mutex_lock(&mlookup.locktable); - ptr = mlookup.table; // Address of the beginning of hash table - index = mhashFunction(key); - node = &ptr[index]; - while(node != NULL) { - if(node->key == key) { - pthread_mutex_unlock(&mlookup.locktable); - return node->val; - } - node = node->next; - } - pthread_mutex_unlock(&mlookup.locktable); - return NULL; -} - -// Remove an entry from the hash table -unsigned int mhashRemove(unsigned int key) { - int index; - mhashlistnode_t *curr, *prev; - mhashlistnode_t *ptr, *node; - - pthread_mutex_lock(&mlookup.locktable); - ptr = mlookup.table; - index = mhashFunction(key); - curr = &ptr[index]; - for (; curr != NULL; curr = curr->next) { - if (curr->key == key) { // Find a match in the hash table - mlookup.numelements--; // Decrement the number of elements in the global hashtable - if ((curr == &ptr[index]) && (curr->next == NULL)) { // Delete the first item inside the hashtable with no linked list of mhashlistnode_t - curr->key = 0; - curr->val = NULL; - } else if ((curr == &ptr[index]) && (curr->next != NULL)) { //Delete the first item with a linked list of mhashlistnode_t connected - curr->key = curr->next->key; - curr->val = curr->next->val; - node = curr->next; - curr->next = curr->next->next; - free(node); - } else { // Regular delete from linked listed - prev->next = curr->next; - free(curr); - } - pthread_mutex_unlock(&mlookup.locktable); - return 0; - } - prev = curr; - } - pthread_mutex_unlock(&mlookup.locktable); - return 1; -} - -// Resize table -unsigned int mhashResize(unsigned int newsize) { - mhashlistnode_t *node, *ptr, *curr, *next; // curr and next keep track of the current and the next mhashlistnodes in a linked list - unsigned int oldsize; - int isfirst; // Keeps track of the first element in the mhashlistnode_t for each bin in hashtable - int i,index; - mhashlistnode_t *newnode; - - ptr = mlookup.table; - oldsize = mlookup.size; - - if((node = calloc(newsize, sizeof(mhashlistnode_t))) == NULL) { - printf("Calloc error %s %d\n", __FILE__, __LINE__); - return 1; - } - - mlookup.table = node; //Update the global hashtable upon resize() - mlookup.size = newsize; - mlookup.numelements = 0; - - for(i = 0; i < oldsize; i++) { //Outer loop for each bin in hash table - curr = &ptr[i]; - isfirst = 1; - while (curr != NULL) { //Inner loop to go through linked lists - if (curr->key == 0) { //Exit inner loop if there the first element for a given bin/index is NULL - break; //key = val =0 for element if not present within the hash table - } - next = curr->next; - - index = mhashFunction(curr->key); -#ifdef DEBUG - printf("DEBUG(resize) -> index = %d, key = %d, val = %x\n", index, curr->key, curr->val); -#endif - // Insert into the new table - if(mlookup.table[index].next == NULL && mlookup.table[index].key == 0) { - mlookup.table[index].key = curr->key; - mlookup.table[index].val = curr->val; - mlookup.numelements++; - }else { - if((newnode = calloc(1, sizeof(mhashlistnode_t))) == NULL) { - printf("Calloc error %s, %d\n", __FILE__, __LINE__); - return 1; - } - newnode->key = curr->key; - newnode->val = curr->val; - newnode->next = mlookup.table[index].next; - mlookup.table[index].next = newnode; - mlookup.numelements++; - } - - //free the linked list of mhashlistnode_t if not the first element in the hash table - if (isfirst != 1) { - free(curr); - } - - isfirst = 0; - curr = next; - - } - } - - free(ptr); //Free the memory of the old hash table - return 0; -} - -unsigned int *mhashGetKeys(unsigned int *numKeys) -{ - unsigned int *keys; - int i, keyindex; - mhashlistnode_t *curr; - - pthread_mutex_lock(&mlookup.locktable); - - *numKeys = mlookup.numelements; - keys = calloc(*numKeys, sizeof(unsigned int)); - - keyindex = 0; - for (i = 0; i < mlookup.size; i++) - { - if (mlookup.table[i].key != 0) - { - curr = &mlookup.table[i]; - while (curr != NULL) - { - keys[keyindex++] = curr->key; - curr = curr->next; - } - } - } - - if (keyindex != *numKeys) - printf("mhashGetKeys(): WARNING: incorrect mlookup.numelements value!\n"); - - pthread_mutex_unlock(&mlookup.locktable); - return keys; -} - diff --git a/Robust/src/Runtime/DSTM/interface/mlookup.h b/Robust/src/Runtime/DSTM/interface/mlookup.h deleted file mode 100644 index aec88798..00000000 --- a/Robust/src/Runtime/DSTM/interface/mlookup.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef _MLOOKUP_H_ -#define _MLOOKUP_H_ - -#include -#include -#include - -#define LOADFACTOR 0.5 -#define HASH_SIZE 100 - -typedef struct mhashlistnode { - unsigned int key; - void *val; //this can be cast to another type or used to point to a larger structure - struct mhashlistnode *next; -} mhashlistnode_t; - -typedef struct mhashtable { - mhashlistnode_t *table; // points to beginning of hash table - unsigned int size; - unsigned int numelements; - float loadfactor; - pthread_mutex_t locktable; -} mhashtable_t; - -unsigned int mhashCreate(unsigned int size, float loadfactor); -unsigned int mhashFunction(unsigned int key); -unsigned mhashInsert(unsigned int key, void *val); -void *mhashSearch(unsigned int key); //returns val, NULL if not found -unsigned int mhashRemove(unsigned int key); //returns -1 if not found -unsigned int mhashResize(unsigned int newsize); -unsigned int *mhashGetKeys(unsigned int *numKeys); -void mhashPrint(); - -#endif - diff --git a/Robust/src/Runtime/DSTM/interface/objstr.c b/Robust/src/Runtime/DSTM/interface/objstr.c deleted file mode 100644 index 32bf38de..00000000 --- a/Robust/src/Runtime/DSTM/interface/objstr.c +++ /dev/null @@ -1,58 +0,0 @@ -#include "dstm.h" - -objstr_t *objstrCreate(unsigned int size) { - objstr_t *tmp; - if((tmp = calloc(1, (sizeof(objstr_t) + size))) == NULL) { - printf("%s() Calloc error at line %d, %s\n", __func__, __LINE__, __FILE__); - return NULL; - } - tmp->size = size; - tmp->next = NULL; - tmp->top = tmp + 1; //points to end of objstr_t structure! - return tmp; -} - -//free entire list, starting at store -void objstrDelete(objstr_t *store) { - objstr_t *tmp; - while (store != NULL) { - tmp = store->next; - free(store); - store = tmp; - } - return; -} - -void *objstrAlloc(objstr_t *store, unsigned int size) { - void *tmp; - while (1) { - if (((unsigned int)store->top - (((unsigned int)store) + sizeof(objstr_t)) + size) <= store->size) { //store not full - tmp = store->top; - store->top += size; - return tmp; - } - //store full - if (store->next == NULL) { - //end of list, all full - if (size > DEFAULT_OBJ_STORE_SIZE) { - //in case of large objects - if((store->next = (objstr_t *)calloc(1,(sizeof(objstr_t) + size))) == NULL) { - printf("%s() Calloc error at line %d, %s\n", __func__, __LINE__, __FILE__); - return NULL; - } - store = store->next; - store->size = size; - } else { - if((store->next = calloc(1,(sizeof(objstr_t) + DEFAULT_OBJ_STORE_SIZE))) == NULL) { - printf("%s() Calloc error at line %d, %s\n", __func__, __LINE__, __FILE__); - return NULL; - } - store = store->next; - store->size = DEFAULT_OBJ_STORE_SIZE; - } - store->top = (void *)(((unsigned int)store) + sizeof(objstr_t) + size); - return (void *)(((unsigned int)store) + sizeof(objstr_t)); - } else - store = store->next; - } -} diff --git a/Robust/src/Runtime/DSTM/interface/plookup.c b/Robust/src/Runtime/DSTM/interface/plookup.c deleted file mode 100644 index 683f11d4..00000000 --- a/Robust/src/Runtime/DSTM/interface/plookup.c +++ /dev/null @@ -1,81 +0,0 @@ -#include "plookup.h" -extern int classsize[]; - -//NOTE: "pile" ptr points to the head of the linked list of the machine pile data structures - -/* This function creates a new pile data structure to hold - * obj ids of objects modified or read inside a transaction, - * no of objects read and no of objects modified - * that belong to a single machine */ - -plistnode_t *pCreate(int objects) { - plistnode_t *pile; - - //Create main structure - if((pile = calloc(1, sizeof(plistnode_t))) == NULL) { - printf("Calloc error %s %d\n", __FILE__, __LINE__); - return NULL; - } - if ((pile->oidmod = calloc(objects, sizeof(unsigned int))) == NULL) { - printf("Calloc error %s %d\n", __FILE__, __LINE__); - free(pile); - return NULL; - } - if ((pile->oidcreated = calloc(objects, sizeof(unsigned int))) == NULL) { - printf("Calloc error %s %d\n", __FILE__, __LINE__); - free(pile); - free(pile->oidmod); - return NULL; - } - if ((pile->objread = calloc(objects, sizeof(unsigned int) + sizeof(short))) == NULL) { - printf("Calloc error %s %d\n", __FILE__, __LINE__); - free(pile); - free(pile->oidmod); - free(pile->oidcreated); - return NULL; - } - - pile->nummod = pile->numread = pile->numcreated = pile->sum_bytes = pile->mid = 0; - pile->next = NULL; - return pile; -} - -//Count the number of machine piles -int pCount(plistnode_t *pile) { - plistnode_t *tmp; - int pcount = 0; - tmp = pile; - while(tmp != NULL) { - pcount++; - tmp = tmp->next; - } - return pcount; -} - -//Make a list of mid's for each machine group -int pListMid(plistnode_t *pile, unsigned int *list) { - int i = 0; - plistnode_t *tmp; - tmp = pile; - while (tmp != NULL) { - list[i] = tmp->mid; - i++; - tmp = tmp->next; - } - return 0; -} - -//Delete the entire pile -void pDelete(plistnode_t *pile) { - plistnode_t *next, *tmp; - tmp = pile; - while(tmp != NULL) { - next = tmp->next; - free(tmp->oidmod); - free(tmp->oidcreated); - free(tmp->objread); - free(tmp); - tmp = next; - } - return; -} diff --git a/Robust/src/Runtime/DSTM/interface/plookup.h b/Robust/src/Runtime/DSTM/interface/plookup.h deleted file mode 100644 index 4d15b4a7..00000000 --- a/Robust/src/Runtime/DSTM/interface/plookup.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef _PLOOKUP_H_ -#define _PLOOKUP_H_ - -#include -#include - -/* This structure is created using a transaction record. - * It is filled out with pile information necessary for - * participants involved in a transaction. */ -typedef struct plistnode { - unsigned int mid; - unsigned int numread; /* no of objects modified */ - unsigned int nummod; /* no of objects read */ - unsigned int numcreated; /* no of objects created */ - int sum_bytes; /* total bytes of objects modified */ - char *objread; /* Pointer to array containing oids of objects read and their version numbers*/ - unsigned int *oidmod; /* Pointer to array containing oids of modified objects */ - unsigned int *oidcreated; /* Pointer to array containing oids of newly created objects */ - struct plistnode *next; -} plistnode_t; - -plistnode_t *pCreate(int); -int pCount(plistnode_t *pile); -int pListMid(plistnode_t *pile, unsigned int *list); -void pDelete(plistnode_t *pile); - -#endif - diff --git a/Robust/src/Runtime/DSTM/interface/prelookup.c b/Robust/src/Runtime/DSTM/interface/prelookup.c deleted file mode 100644 index 7e81d5f3..00000000 --- a/Robust/src/Runtime/DSTM/interface/prelookup.c +++ /dev/null @@ -1,224 +0,0 @@ -/* LOCK THE ENTIRE HASH TABLE */ -#include "prelookup.h" -extern objstr_t *prefetchcache; - -prehashtable_t pflookup; //Global prefetch cache table - -unsigned int prehashCreate(unsigned int size, float loadfactor) { - prehashlistnode_t *nodes; - int i; - - // Allocate space for the hash table - if((nodes = calloc(size, sizeof(prehashlistnode_t))) == NULL) { - printf("Calloc error %s %d\n", __FILE__, __LINE__); - return 1; - } - pflookup.hack=NULL; - pflookup.hack2=NULL; - pflookup.table = nodes; - pflookup.size = size; - pflookup.numelements = 0; // Initial number of elements in the hash - pflookup.loadfactor = loadfactor; - - //Intiliaze and set prefetch table mutex attribute - pthread_mutexattr_init(&pflookup.prefetchmutexattr); - //NOTE:PTHREAD_MUTEX_RECURSIVE is currently inside a #if_def UNIX98 in the pthread.h file - //Therefore use PTHREAD_MUTEX_RECURSIVE_NP instead - pthread_mutexattr_settype(&pflookup.prefetchmutexattr, PTHREAD_MUTEX_RECURSIVE_NP); - - //Initialize mutex var - pthread_mutex_init(&pflookup.lock, &pflookup.prefetchmutexattr); - //pthread_mutex_init(&pflookup.lock, NULL); - pthread_cond_init(&pflookup.cond, NULL); - return 0; -} - -//Assign keys to bins inside hash table -unsigned int prehashFunction(unsigned int key) { - return ( key % (pflookup.size)); -} - -//Store oids and their pointers into hash -unsigned int prehashInsert(unsigned int key, void *val) { - unsigned int newsize; - int index; - prehashlistnode_t *ptr, *node; - - if(pflookup.numelements > (pflookup.loadfactor * pflookup.size)) { - //Resize - newsize = 2 * pflookup.size + 1; - pthread_mutex_lock(&pflookup.lock); - prehashResize(newsize); - pthread_mutex_unlock(&pflookup.lock); - } - - ptr = pflookup.table; - pflookup.numelements++; - - pthread_mutex_lock(&pflookup.lock); - index = prehashFunction(key); - if(ptr[index].next == NULL && ptr[index].key == 0) { // Insert at the first position in the hashtable - ptr[index].key = key; - ptr[index].val = val; - } else { // Insert in the beginning of linked list - if ((node = calloc(1, sizeof(prehashlistnode_t))) == NULL) { - printf("Calloc error %s, %d\n", __FILE__, __LINE__); - pthread_mutex_unlock(&pflookup.lock); - return 1; - } - node->key = key; - node->val = val ; - node->next = ptr[index].next; - ptr[index].next = node; - } - pthread_mutex_unlock(&pflookup.lock); - return 0; -} - -// Search for an address for a given oid -void *prehashSearch(unsigned int key) { - int index; - prehashlistnode_t *ptr, *node; - - pthread_mutex_lock(&pflookup.lock); - ptr = pflookup.table; - index = prehashFunction(key); - node = &ptr[index]; - while(node != NULL) { - if(node->key == key) { - pthread_mutex_unlock(&pflookup.lock); - return node->val; - } - node = node->next; - } - pthread_mutex_unlock(&pflookup.lock); - return NULL; -} - -unsigned int prehashRemove(unsigned int key) { - int index; - prehashlistnode_t *curr, *prev; - prehashlistnode_t *ptr, *node; - - pthread_mutex_lock(&pflookup.lock); - ptr = pflookup.table; - index = prehashFunction(key); - curr = &ptr[index]; - - for (; curr != NULL; curr = curr->next) { - if (curr->key == key) { // Find a match in the hash table - pflookup.numelements--; // Decrement the number of elements in the global hashtable - if ((curr == &ptr[index]) && (curr->next == NULL)) { // Delete the first item inside the hashtable with no linked list of prehashlistnode_t - curr->key = 0; - curr->val = NULL; - } else if ((curr == &ptr[index]) && (curr->next != NULL)) { //Delete the first item with a linked list of prehashlistnode_t connected - curr->key = curr->next->key; - curr->val = curr->next->val; - node = curr->next; - curr->next = curr->next->next; - free(node); - } else { // Regular delete from linked listed - prev->next = curr->next; - free(curr); - } - pthread_mutex_unlock(&pflookup.lock); - return 0; - } - prev = curr; - } - pthread_mutex_unlock(&pflookup.lock); - return 1; -} - -unsigned int prehashResize(unsigned int newsize) { - prehashlistnode_t *node, *ptr, *curr, *next; // curr and next keep track of the current and the next chashlistnodes in a linked list - unsigned int oldsize; - int isfirst; // Keeps track of the first element in the prehashlistnode_t for each bin in hashtable - int i,index; - prehashlistnode_t *newnode; - - ptr = pflookup.table; - oldsize = pflookup.size; - - if((node = calloc(newsize, sizeof(prehashlistnode_t))) == NULL) { - printf("Calloc error %s %d\n", __FILE__, __LINE__); - return 1; - } - - pflookup.table = node; //Update the global hashtable upon resize() - pflookup.size = newsize; - pflookup.numelements = 0; - - for(i = 0; i < oldsize; i++) { //Outer loop for each bin in hash table - curr = &ptr[i]; - isfirst = 1; - while (curr != NULL) { //Inner loop to go through linked lists - if (curr->key == 0) { //Exit inner loop if there the first element for a given bin/index is NULL - break; //key = val =0 for element if not present within the hash table - } - next = curr->next; - index = prehashFunction(curr->key); - // Insert into the new table - if(pflookup.table[index].next == NULL && pflookup.table[index].key == 0) { - pflookup.table[index].key = curr->key; - pflookup.table[index].val = curr->val; - pflookup.numelements++; - }else { - if((newnode = calloc(1, sizeof(prehashlistnode_t))) == NULL) { - printf("Calloc error %s, %d\n", __FILE__, __LINE__); - return 1; - } - newnode->key = curr->key; - newnode->val = curr->val; - newnode->next = pflookup.table[index].next; - pflookup.table[index].next = newnode; - pflookup.numelements++; - } - - //free the linked list of prehashlistnode_t if not the first element in the hash table - if (isfirst != 1) { - free(curr); - } - - isfirst = 0; - curr = next; - } - } - - free(ptr); //Free the memory of the old hash table - return 0; -} - -//Note: This is based on the implementation of the inserting a key in the first position of the hashtable -void prehashClear() { - int i, isFirstBin; - prehashlistnode_t *ptr, *prev, *curr; - - objstr_t *oldcache=prefetchcache; - prefetchcache=objstrCreate(prefetchcache->size); - - pthread_mutex_lock(&pflookup.lock); - ptr = pflookup.table; - for(i = 0; i < pflookup.size; i++) { - prev = &ptr[i]; - isFirstBin = 1; - while(prev->next != NULL) { - isFirstBin = 0; - curr = prev->next; - prev->next = curr->next; - free(curr); - } - if(isFirstBin == 1) { - prev->key = 0; - prev->next = NULL; - } - } - pthread_mutex_unlock(&pflookup.lock); - - if (pflookup.hack2!=NULL) { - objstrDelete(pflookup.hack2); - } - pflookup.hack2=pflookup.hack; - pflookup.hack=oldcache; -} - diff --git a/Robust/src/Runtime/DSTM/interface/prelookup.h b/Robust/src/Runtime/DSTM/interface/prelookup.h deleted file mode 100644 index 8b4c30be..00000000 --- a/Robust/src/Runtime/DSTM/interface/prelookup.h +++ /dev/null @@ -1,43 +0,0 @@ -#ifndef _PRELOOKUP_H_ -#define _PRELOOKUP_H_ - -#include -#include -#include -#include "dstm.h" - -#define LOADFACTOR 0.5 -#define HASH_SIZE 100 - -typedef struct prehashlistnode { - unsigned int key; - void *val; //this can be cast to another type or used to point to a larger structure - struct prehashlistnode *next; -} prehashlistnode_t; - -struct objstr; - -typedef struct prehashtable { - prehashlistnode_t *table; // points to beginning of hash table - unsigned int size; - unsigned int numelements; - float loadfactor; - pthread_mutex_t lock; - pthread_mutexattr_t prefetchmutexattr; - pthread_cond_t cond; - struct objstr *hack2; - struct objstr *hack; -} prehashtable_t; - -/* Prototypes for hash*/ -unsigned int prehashCreate(unsigned int size, float loadfactor); -unsigned int prehashFunction(unsigned int key); -unsigned int prehashInsert(unsigned int key, void *val); -void *prehashSearch(unsigned int key); //returns val, NULL if not found -unsigned int prehashRemove(unsigned int key); //returns -1 if not found -unsigned int prehashResize(unsigned int newsize); -void prehashClear(); -/* end hash */ - -#endif - diff --git a/Robust/src/Runtime/DSTM/interface/queue.c b/Robust/src/Runtime/DSTM/interface/queue.c deleted file mode 100644 index 507cf658..00000000 --- a/Robust/src/Runtime/DSTM/interface/queue.c +++ /dev/null @@ -1,85 +0,0 @@ -#include "queue.h" - -volatile int headoffset, tailoffset; -char * memory; -pthread_mutex_t qlock; -pthread_mutexattr_t qlockattr; -pthread_cond_t qcond; - - -#define QSIZE 1000000 //1 MB - -void queueInit(void) { - /* Intitialize primary queue */ - headoffset=0; - tailoffset=0; - memory=malloc(QSIZE+sizeof(int));//leave space for -1 - pthread_mutexattr_init(&qlockattr); - pthread_mutexattr_settype(&qlockattr, PTHREAD_MUTEX_RECURSIVE_NP); - pthread_mutex_init(&qlock, &qlockattr); - pthread_cond_init(&qcond, NULL); -} - -void * getmemory(int size) { - int tmpoffset=headoffset+size+sizeof(int); - if (tmpoffset>QSIZE) { - //Wait for tail to go past end - tmpoffset=size+sizeof(int); - if (headoffsetQSIZE) { - headoffset=size+sizeof(int); - } else - headoffset=tmpoffset; - pthread_cond_signal(&qcond);//wake the other thread up -} - -void * gettail() { - while(tailoffset==headoffset) { - //Sleep - pthread_mutex_lock(&qlock); - if (tailoffset==headoffset) - pthread_cond_wait(&qcond, &qlock); - pthread_mutex_unlock(&qlock); - } - if (*((int *)(memory+tailoffset))==-1) { - tailoffset=0;//do loop - } - - return memory+tailoffset+sizeof(int); -} - -void inctail() { - int tmpoffset=tailoffset+*((int *)(memory+tailoffset)); - if (tmpoffset>QSIZE) - tailoffset=0; - else - tailoffset=tmpoffset; -} - -void predealloc() { - free(memory); -} - diff --git a/Robust/src/Runtime/DSTM/interface/queue.h b/Robust/src/Runtime/DSTM/interface/queue.h deleted file mode 100644 index fffeed15..00000000 --- a/Robust/src/Runtime/DSTM/interface/queue.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef _QUEUE_H_ -#define _QUEUE_H_ - -#include -#include -#include -#include -#include "dstm.h" - -void queueInit(void); -void * getmemory(int size); -void movehead(int size); -void * gettail(); -void inctail(); -void predealloc(); -#endif diff --git a/Robust/src/Runtime/DSTM/interface/signal.c b/Robust/src/Runtime/DSTM/interface/signal.c deleted file mode 100644 index 942c8320..00000000 --- a/Robust/src/Runtime/DSTM/interface/signal.c +++ /dev/null @@ -1,45 +0,0 @@ -#include "dstm.h" -#include "addPrefetchEnhance.h" -#include - -extern int numTransAbort; -extern int numTransCommit; -extern int nchashSearch; -extern int nmhashSearch; -extern int nprehashSearch; -extern int nRemoteSend; -extern int numprefetchsites; -void handle(); -extern pfcstats_t *evalPrefetch; - -void transStatsHandler(int sig, siginfo_t* info, void *context) { -#ifdef TRANSSTATS - printf("****** Transaction Stats ******\n"); - printf("numTransAbort = %d\n", numTransAbort); - printf("numTransCommit = %d\n", numTransCommit); - printf("nchashSearch = %d\n", nchashSearch); - printf("nmhashSearch = %d\n", nmhashSearch); - printf("nprehashSearch = %d\n", nprehashSearch); - printf("nRemoteReadSend = %d\n", nRemoteSend); - int i; - //TODO Remove later - /* - for(i=0; i - -#if defined(__i386__) -inline int test_and_set(volatile unsigned int *addr) { - int oldval; - /* Note: the "xchg" instruction does not need a "lock" prefix */ - __asm__ __volatile__("xchgl %0, %1" - : "=r"(oldval), "=m"(*(addr)) - : "0"(1), "m"(*(addr))); - return oldval; -} -inline void UnLock(volatile unsigned int *addr) { - int oldval; - /* Note: the "xchg" instruction does not need a "lock" prefix */ - __asm__ __volatile__("xchgl %0, %1" - : "=r"(oldval), "=m"(*(addr)) - : "0"(0), "m"(*(addr))); -} -#elif -# error need implementation of test_and_set -#endif - -#define MAXSPINS 100 - -inline void Lock(volatile unsigned int *s) { - while(test_and_set(s)) { - int i=0; - while(*s) { - if (i++>MAXSPINS) { - sched_yield(); - i=0; - } - } - } -} - -sockPoolHashTable_t *createSockPool(sockPoolHashTable_t * sockhash, unsigned int size) { - if((sockhash = calloc(1, sizeof(sockPoolHashTable_t))) == NULL) { - printf("Calloc error at %s line %d\n", __FILE__, __LINE__); - return NULL; - } - - socknode_t **nodelist; - if ((nodelist = calloc(size, sizeof(socknode_t *))) < 0) { - printf("Calloc error at %s line %d\n", __FILE__, __LINE__); - free(sockhash); - return NULL; - } - - sockhash->table = nodelist; - sockhash->inuse = NULL; - sockhash->size = size; - sockhash->mylock=0; - - return sockhash; -} - -int createNewSocket(unsigned int mid) { - int sd; - int flag=1; - if((sd = socket(AF_INET, SOCK_STREAM, 0)) < 0) { - printf("%s() Error: In creating socket at %s, %d\n", __func__, __FILE__, __LINE__); - return -1; - } - setsockopt(sd, IPPROTO_TCP, TCP_NODELAY, (char *) &flag, sizeof(flag)); - struct sockaddr_in remoteAddr; - bzero(&remoteAddr, sizeof(remoteAddr)); - remoteAddr.sin_family = AF_INET; - remoteAddr.sin_port = htons(LISTEN_PORT); - remoteAddr.sin_addr.s_addr = htonl(mid); - if(connect(sd, (struct sockaddr *)&remoteAddr, sizeof(remoteAddr)) < 0) { - perror("socket connect: "); - printf("%s(): Error %d connecting to %s:%d\n", __func__, errno, inet_ntoa(remoteAddr.sin_addr), LISTEN_PORT); - close(sd); - return -1; - } - return sd; -} - -int getSockWithLock(sockPoolHashTable_t *sockhash, unsigned int mid) { - socknode_t **ptr; - int key = mid%(sockhash->size); - int sd; - - Lock(&sockhash->mylock); - ptr=&(sockhash->table[key]); - - while(*ptr!=NULL) { - if (mid == (*ptr)->mid) { - socknode_t *tmp=*ptr; - sd = tmp->sd; - *ptr=tmp->next; - tmp->next=sockhash->inuse; - sockhash->inuse=tmp; - UnLock(&sockhash->mylock); - return sd; - } - ptr=&((*ptr)->next); - } - UnLock(&sockhash->mylock); - if((sd = createNewSocket(mid)) != -1) { - socknode_t *inusenode = calloc(1, sizeof(socknode_t)); - inusenode->sd = sd; - inusenode->mid = mid; - insToListWithLock(sockhash, inusenode); - return sd; - } else { - return -1; - } -} - -int getSock(sockPoolHashTable_t *sockhash, unsigned int mid) { - socknode_t **ptr; - int key = mid%(sockhash->size); - int sd; - - ptr=&(sockhash->table[key]); - - while(*ptr!=NULL) { - if (mid == (*ptr)->mid) { - socknode_t *tmp=*ptr; - sd = tmp->sd; - *ptr=tmp->next; - tmp->next=sockhash->inuse; - sockhash->inuse=tmp; - return sd; - } - ptr=&((*ptr)->next); - } - if((sd = createNewSocket(mid)) != -1) { - socknode_t *inusenode = calloc(1, sizeof(socknode_t)); - inusenode->next=sockhash->inuse; - sockhash->inuse=inusenode; - return sd; - } else { - return -1; - } -} - -int getSock2(sockPoolHashTable_t *sockhash, unsigned int mid) { - socknode_t **ptr; - int key = mid%(sockhash->size); - int sd; - - ptr=&(sockhash->table[key]); - - while(*ptr!=NULL) { - if (mid == (*ptr)->mid) { - return (*ptr)->sd; - } - ptr=&((*ptr)->next); - } - if((sd = createNewSocket(mid)) != -1) { - *ptr=calloc(1, sizeof(socknode_t)); - (*ptr)->mid=mid; - (*ptr)->sd=sd; - return sd; - } else { - return -1; - } -} - -/*socket pool with multiple TR threads asking to connect to same machine */ -int getSock2WithLock(sockPoolHashTable_t *sockhash, unsigned int mid) { - socknode_t **ptr; - int key = mid%(sockhash->size); - int sd; - - Lock(&sockhash->mylock); - ptr=&(sockhash->table[key]); - while(*ptr!=NULL) { - if (mid == (*ptr)->mid) { - UnLock(&sockhash->mylock); - return (*ptr)->sd; - } - ptr=&((*ptr)->next); - } - UnLock(&sockhash->mylock); - if((sd = createNewSocket(mid)) != -1) { - socknode_t *inusenode = calloc(1, sizeof(socknode_t)); - inusenode->sd = sd; - inusenode->mid = mid; - addSockWithLock(sockhash, inusenode); - return sd; - } else { - return -1; - } -} - -void addSockWithLock(sockPoolHashTable_t *sockhash, socknode_t *ptr) { - int key = ptr->mid%(sockhash->size); - Lock(&sockhash->mylock); - ptr->next = sockhash->table[key]; - sockhash->table[key] = ptr; - UnLock(&sockhash->mylock); -} - -void insToListWithLock(sockPoolHashTable_t *sockhash, socknode_t *inusenode) { - Lock(&sockhash->mylock); - inusenode->next = sockhash->inuse; - sockhash->inuse = inusenode; - UnLock(&sockhash->mylock); -} - -void freeSock(sockPoolHashTable_t *sockhash, unsigned int mid, int sd) { - int key = mid%(sockhash->size); - socknode_t *ptr = sockhash->inuse; - sockhash->inuse = ptr->next; - ptr->mid = mid; - ptr->sd = sd; - ptr->next = sockhash->table[key]; - sockhash->table[key] = ptr; -} - -void freeSockWithLock(sockPoolHashTable_t *sockhash, unsigned int mid, int sd) { - int key = mid%(sockhash->size); - socknode_t *ptr; - Lock(&sockhash->mylock); - ptr = sockhash->inuse; - sockhash->inuse = ptr->next; - ptr->mid = mid; - ptr->sd = sd; - ptr->next = sockhash->table[key]; - sockhash->table[key] = ptr; - UnLock(&sockhash->mylock); -} - -#if 0 -/ ***************************************/ -* Array Implementation for socket resuse -* ***************************************/ - -int num_machines; - -sock_pool_t *initSockPool(unsigned int *mid, int machines) { - sock_pool_t *sockpool; - num_machines = machines; - if ((sockpool = calloc(num_machines, sizeof(sock_pool_t))) < 0) { - printf("%s(), Calloc error at %s, line %d\n", __func__, __FILE__, __LINE__); - return NULL; - } - int i; - for (i = 0; i < num_machines; i++) { - if ((sockpool[i].sd = calloc(MAX_CONN_PER_MACHINE, sizeof(int))) < 0) { - printf("%s(), Calloc error at %s, line %d\n", __func__, __FILE__, __LINE__); - return NULL; - } - if ((sockpool[i].inuse = calloc(MAX_CONN_PER_MACHINE, sizeof(char))) < 0) { - printf("%s(), Calloc error at %s, line %d\n", __func__, __FILE__, __LINE__); - return NULL; - } - sockpool[i].mid = mid[i]; - int j; - for(j = 0; j < MAX_CONN_PER_MACHINE; j++) { - sockpool[i].sd[j] = -1; - } - } - - return sockpool; -} - -int getSock(sock_pool_t *sockpool, unsigned int mid) { - int i; - for (i = 0; i < num_machines; i++) { - if (sockpool[i].mid == mid) { - int j; - for (j = 0; j < MAX_CONN_PER_MACHINE; j++) { - if (sockpool[i].sd[j] != -1 && (sockpool[i].inuse[j] == 0)) { - sockpool[i].inuse[j] = 1; - return sockpool[i].sd[j]; - } - if (sockpool[i].sd[j] == -1) { - //Open Connection - int sd; - if((sd = socket(AF_INET, SOCK_STREAM, 0)) < 0) { - printf("%s() Error: In creating socket at %s, %d\n", __func__, __FILE__, __LINE__); - return -1; - } - struct sockaddr_in remoteAddr; - bzero(&remoteAddr, sizeof(remoteAddr)); - remoteAddr.sin_family = AF_INET; - remoteAddr.sin_port = htons(LISTEN_PORT); - remoteAddr.sin_addr.s_addr = htonl(mid); - - if(connect(sd, (struct sockaddr *)&remoteAddr, sizeof(remoteAddr)) < 0) { - printf("%s(): Error %d connecting to %s:%d\n", __func__, errno, inet_ntoa(remoteAddr.sin_addr), LISTEN_PORT); - close(sd); - return -1; - } - sockpool[i].sd[j] = sd; - sockpool[i].inuse[j] = 1; - return sockpool[i].sd[j]; - } - } - printf("%s()->Error: Less number of MAX_CONN_PER_MACHINE\n", __func__); - return -1; - } - } - printf("%s()-> Error: Machine id not found\n", __func__); - - return -1; -} - -int freeSock(sock_pool_t *sockpool, int sd) { - int i; - for (i = 0; i < num_machines; i++) { - int j; - for (j = 0; j < MAX_CONN_PER_MACHINE; j++) { - if (sockpool[i].sd[j] == sd) { - sockpool[i].inuse[j] = 0; - return 0; - } - } - } - printf("%s() Error: Illegal socket descriptor %d\n", __func__, sd); - - return -1; -} - -#endif diff --git a/Robust/src/Runtime/DSTM/interface/sockpool.h b/Robust/src/Runtime/DSTM/interface/sockpool.h deleted file mode 100644 index 8a9a64aa..00000000 --- a/Robust/src/Runtime/DSTM/interface/sockpool.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef _SOCKPOOL_H_ -#define _SOCKPOOL_H_ - -#include "dstm.h" -#include "ip.h" - -int test_and_set(volatile unsigned int *addr); -void UnLock(volatile unsigned int *addr); - -typedef struct socknode { - int sd; - unsigned int mid; - struct socknode *next; -} socknode_t; - -typedef struct sockPoolHashTable { - socknode_t **table; - socknode_t *inuse; - unsigned int size; - volatile unsigned int mylock; -} sockPoolHashTable_t; - -void addSockWithLock(sockPoolHashTable_t *sockhash, socknode_t *ptr); -sockPoolHashTable_t *createSockPool(sockPoolHashTable_t *, unsigned int); -int getSock(sockPoolHashTable_t *, unsigned int); -int getSock2(sockPoolHashTable_t *, unsigned int); -int getSock2WithLock(sockPoolHashTable_t *h, unsigned int); -int getSockWithLock(sockPoolHashTable_t *, unsigned int); -void freeSock(sockPoolHashTable_t *, unsigned int, int); -void freeSockWithLock(sockPoolHashTable_t *, unsigned int, int); -void insToList(sockPoolHashTable_t *, socknode_t *); -void insToListWithLock(sockPoolHashTable_t *, socknode_t *); -int createNewSocket(unsigned int); - -#if 0 -/************************************************ - * Array Implementation data structures - ***********************************************/ -#define MAX_CONN_PER_MACHINE 10 -typedef struct sock_pool { - unsigned int mid; - int *sd; - char *inuse; -} sock_pool_t; - -sock_pool_t *initSockPool(unsigned int *, int); -int getSock(sock_pool_t *, unsigned int); -int freeSock(sock_pool_t *, int); -#endif - -#endif diff --git a/Robust/src/Runtime/DSTM/interface/tests/testclient.c b/Robust/src/Runtime/DSTM/interface/tests/testclient.c deleted file mode 100644 index 66ad94d8..00000000 --- a/Robust/src/Runtime/DSTM/interface/tests/testclient.c +++ /dev/null @@ -1,817 +0,0 @@ -#include -#include -#include "dstm.h" -#include "llookup.h" -#include "ip.h" - -#define LISTEN_PORT 2156 - -extern objstr_t *mainobjstore; -typedef struct testobj1 { - int x; - char z; -} testobj1_t; - -typedef struct testobj2 { - char z[10]; - char c; - testobj1_t *y; -} testobj2_t; - -typedef struct testobj3 { - short p; - testobj1_t *q; - testobj2_t *r; -} testobj3_t; - -typedef struct testobj4 { - int b; - void *q; - testobj3_t *a; -} testobj4_t; - -typedef struct testobj5 { - testobj4_t *a; -} testobj5_t; - - -int classsize[]={sizeof(int),sizeof(char),sizeof(short), sizeof(void *), sizeof(testobj1_t), - sizeof(testobj2_t), sizeof(testobj3_t), sizeof(testobj4_t), sizeof(testobj5_t)}; - -unsigned int createObjects(transrecord_t *record) { - objheader_t *header, *tmp; - unsigned int size, mid; - int i = 0; - for(i = 20 ; i< 23; i++) { - size = sizeof(objheader_t) + classsize[i-20] ; - tmp = (objheader_t *)objstrAlloc(record->cache, size); - tmp->oid = i; - tmp->type = (i-20); - tmp->version = 1; - tmp->rcount = 0; //? not sure how to handle this yet - tmp->status = 0; - tmp->status |= NEW; - chashInsert(record->lookupTable, tmp->oid, tmp); - header = (objheader_t *) objstrAlloc(mainobjstore, size); - memcpy(header, tmp, size); - mhashInsert(header->oid, header); - mid = iptoMid("128.200.9.27");//machine d-2 - printf("DEBUG -> createObjects mid is %x\n", mid); - lhashInsert(header->oid, mid); - } - // printf("Insert oid = %d at address %x\n",tmp->oid, tmp); - size = sizeof(objheader_t) + classsize[0] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - header->oid = 30; - header->type = 0; - header->version = 1; - header->rcount = 0; //? not sure how to handle this yet - header->status = 0; - header->status |= NEW; - mhashInsert(header->oid, header); - mid = iptoMid("128.200.9.27"); - lhashInsert(header->oid, mid); - size = sizeof(objheader_t) + classsize[1] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - header->oid = 28; - header->type = 1; - header->version = 1; - header->rcount = 0; //? not sure how to handle this yet - header->status = 0; - header->status |= LOCK; - mhashInsert(header->oid, header); - mid = iptoMid("128.200.9.27"); - lhashInsert(header->oid, mid); - size = sizeof(objheader_t) + classsize[2] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - header->oid = 29; - header->type = 2; - header->version = 1; - header->rcount = 0; //? not sure how to handle this yet - header->status = 0; - header->status |= LOCK; - mhashInsert(header->oid, header); - mid = iptoMid("128.200.9.27"); - lhashInsert(header->oid, mid); - return 0; -} - -int main() -{ -// test2(); -// test3(); -// test4(); - test5(); -// test5a(); -// test2a(); -// test2b(); -// test7(); - -} - -int test1(void) { - - transrecord_t *record; - objheader_t *h1,*h2,*h3,*h4,*h5, *h6; - - dstmInit(); - record = transStart(); - printf("DEBUG -> Init done\n"); - h1 = transRead(record, 1); - printf("oid = %d\tsize = %d\n", h1->oid,classsize[h1->type]); - h3 = transRead(record, 3); - printf("oid = %d\tsize = %d\n", h3->oid,classsize[h3->type]); - h4 = transRead(record, 4); - printf("oid = %d\tsize = %d\n", h4->oid,classsize[h4->type]); - h2 = transRead(record, 2); - printf("oid = %d\tsize = %d\n", h2->oid,classsize[h2->type]); - h4 = transRead(record, 4); - printf("oid = %d\tsize = %d\n", h4->oid,classsize[h4->type]); - h3 = transRead(record, 3); - printf("oid = %d\tsize = %d\n", h3->oid,classsize[h3->type]); - h5 = transRead(record, 5); - printf("oid = %d\tsize = %d\n", h5->oid,classsize[h5->type]); -// getRemoteObj(&record, 0,1); -} - -int test2(void) { - - transrecord_t *record; - objheader_t *h1,*h2,*h3,*h4,*h5, *h6; - - dstmInit(); - record = transStart(); - - lhashInsert(1,1); - lhashInsert(2,1); - lhashInsert(3,1); - lhashInsert(4,1); - lhashInsert(5,1); - lhashInsert(6,1); - printf("DEBUG -> Init done\n"); - h1 = transRead(record, 1); - lhashInsert(h1->oid, 1); - h2 = transRead(record, 2); - lhashInsert(h2->oid, 1); - h3 = transRead(record, 3); - lhashInsert(h3->oid, 1); - h4 = transRead(record, 4); - lhashInsert(h4->oid, 1); -// h4->status |= DIRTY; - h5 = transRead(record, 5); - lhashInsert(h5->oid, 1); - h6 = transRead(record, 6); - lhashInsert(h6->oid, 1); -// h6->status |= DIRTY; - - transCommit(record); - - return 0; -} - -//Read objects when objects are found in remote location -int test2a(void) { - unsigned int val, mid; - transrecord_t *myTrans; - unsigned int size; - objheader_t *header, *h1, *h2; - pthread_t thread_Listen; - pthread_attr_t attr; - - dstmInit(); - pthread_attr_init(&attr); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); - - //Create and Insert Oid 20 - size = sizeof(objheader_t) + classsize[2] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - header->oid = 20; - header->type = 2; - header->version = 1; - header->rcount = 0; //? not sure how to handle this yet - header->status = 0; - header->status |= NEW; - mhashInsert(header->oid, header); - mid = iptoMid("128.200.9.27"); - lhashInsert(header->oid, mid); - - //Create and Insert Oid 21 - size = sizeof(objheader_t) + classsize[1] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - header->oid = 21; - header->type = 1; - header->version = 1; - header->rcount = 0; //? not sure how to handle this yet - header->status = 0; - header->status |= NEW; - mhashInsert(header->oid, header); - mid = iptoMid("128.200.9.27"); - lhashInsert(header->oid, mid); - - //Create and Insert Oid 22 - size = sizeof(objheader_t) + classsize[3] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - header->oid = 22; - header->type = 3; - header->version = 1; - header->rcount = 0; //? not sure how to handle this yet - header->status = 0; - header->status |= NEW; - mhashInsert(header->oid, header); - mid = iptoMid("128.200.9.27"); - lhashInsert(header->oid, mid); - - //Inserting into lhashtable - mid = iptoMid("128.200.9.26"); //d-1.eecs.uci.edu - lhashInsert(31, mid); - lhashInsert(32, mid); - - mid = iptoMid("128.200.9.10"); //demsky.eecs.uci.edu - //Inserting into lhashtable - lhashInsert(1, mid); - lhashInsert(2, mid); - lhashInsert(3, mid); - lhashInsert(4, mid); - - pthread_create(&thread_Listen, &attr, dstmListen, NULL); - - //Check if machine demsky is up and running - checkServer(mid, "128.200.9.10"); - mid = iptoMid("128.200.9.26"); - //Check if machine d-1 is up and running - checkServer(mid, "128.200.9.26"); - - // Start Transaction - myTrans = transStart(); - - sleep(2); - //read object 1 - if((h1 = transRead(myTrans, 1)) == NULL){ - printf("Object not found\n"); - } - //read object 2 - if((h2 = transRead(myTrans, 2)) == NULL) { - printf("Object not found\n"); - } - - pthread_join(thread_Listen, NULL); - return 0; -} - -//Read objects that are both remote and local and are available on machines -int test2b(void) { - - unsigned int val, mid; - transrecord_t *myTrans; - unsigned int size; - objheader_t *header, *h1, *h2, *h3, *h4; - pthread_t thread_Listen; - pthread_attr_t attr; - - dstmInit(); - pthread_attr_init(&attr); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); - - //Create and Insert Oid 20 - size = sizeof(objheader_t) + classsize[2] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - header->oid = 20; - header->type = 2; - header->version = 1; - header->rcount = 0; //? not sure how to handle this yet - header->status = 0; - header->status |= NEW; - mhashInsert(header->oid, header); - mid = iptoMid("128.200.9.27"); - lhashInsert(header->oid, mid); - - //Create and Insert Oid 21 - size = sizeof(objheader_t) + classsize[1] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - header->oid = 21; - header->type = 1; - header->version = 1; - header->rcount = 0; //? not sure how to handle this yet - header->status = 0; - header->status |= NEW; - mhashInsert(header->oid, header); - mid = iptoMid("128.200.9.27"); - lhashInsert(header->oid, mid); - - //Create and Insert Oid 22 - size = sizeof(objheader_t) + classsize[3] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - header->oid = 22; - header->type = 3; - header->version = 1; - header->rcount = 0; //? not sure how to handle this yet - header->status = 0; - header->status |= NEW; - mhashInsert(header->oid, header); - mid = iptoMid("128.200.9.27"); - lhashInsert(header->oid, mid); - - //Inserting into lhashtable - mid = iptoMid("128.200.9.26"); //d-1.eecs.uci.edu - lhashInsert(31, mid); - lhashInsert(32, mid); - lhashInsert(33, mid); - - mid = iptoMid("128.200.9.10"); //demsky.eecs.uci.edu - //Inserting into lhashtable - lhashInsert(1, mid); - lhashInsert(2, mid); - lhashInsert(3, mid); - lhashInsert(4, mid); - - pthread_create(&thread_Listen, &attr, dstmListen, NULL); - - //Check if machine demsky is up and running - checkServer(mid, "128.200.9.10"); - mid = iptoMid("128.200.9.26"); - //Check if machine d-1 is up and running - checkServer(mid, "128.200.9.26"); - - // Start Transaction - myTrans = transStart(); - - //sleep(2); - //read object 1 (found on demksy) - if((h1 = transRead(myTrans, 1)) == NULL){ - printf("Object not found\n"); - } - //read object 2 (found on demsky) - if((h2 = transRead(myTrans, 2)) == NULL) { - printf("Object not found\n"); - } - - //read object 21 (found on local) - if((h3 = transRead(myTrans, 21)) == NULL) { - printf("Object not found\n"); - } - - //read object 32 (found on d-1) - if((h4 = transRead(myTrans, 32)) == NULL) { - printf("Object not found\n"); - } - - pthread_join(thread_Listen, NULL); - return 0; - -} - - -//Read objects when objects are not found in any participant -int test3(void){ - transrecord_t *record; - objheader_t *h1,*h2; - - dstmInit(); - record = transStart(); - printf("DEBUG -> Init done\n"); - //read object 11 - if((h1 = transRead(record, 11)) == NULL){ - printf("Object not found\n"); - } - //read object 12 - if((h2 = transRead(record, 12)) == NULL) { - printf("Object not found\n"); - } - transCommit(record); - - return 0; -} - -//Read objects when some objects are found and other objects not found in any participant -int test4(void) { - transrecord_t *record; - objheader_t *h1,*h2, *h3, *h4; - - dstmInit(); - record = transStart(); - printf("DEBUG -> Init done\n"); - //read object 1 - if((h1 = transRead(record, 1)) == NULL){ - printf("Object not found\n"); - } - //read object 2 - if((h2 = transRead(record, 2)) == NULL) { - printf("Object not found\n"); - } - //read object 11 - if((h3 = transRead(record, 11)) == NULL) { - printf("Object not found\n"); - } - //read object 13 - if((h4 = transRead(record, 13)) == NULL) { - printf("Object not found\n"); - } - if((h1 != NULL) && (h2 != NULL) && (h3 != NULL) && h4 !=NULL) { - transCommit(record); - }else { - printf("Cannot complete this transaction\n"); - } - - return 0; -} - -//Commit for transaction objects when the objs are part of other -//transactions running simultaneously -int test5(void) { - unsigned int val, mid; - transrecord_t *myTrans; - unsigned int size; - objheader_t *header, *h1, *h2, *h3, *h4, *h5, *h6; - pthread_t thread_Listen; - pthread_attr_t attr; - - dstmInit(); - pthread_attr_init(&attr); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); - - //Create and Insert Oid 20 - size = sizeof(objheader_t) + classsize[2] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - header->oid = 20; - header->type = 2; - header->version = 1; - header->rcount = 0; //? not sure how to handle this yet - header->status = 0; - header->status |= NEW; - mhashInsert(header->oid, header); - mid = iptoMid("128.200.9.27"); - lhashInsert(header->oid, mid); - - //Create and Insert Oid 21 - size = sizeof(objheader_t) + classsize[1] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - header->oid = 21; - header->type = 1; - header->version = 1; - header->rcount = 0; //? not sure how to handle this yet - header->status = 0; - header->status |= NEW; - mhashInsert(header->oid, header); - mid = iptoMid("128.200.9.27"); - lhashInsert(header->oid, mid); - - //Create and Insert Oid 22 - size = sizeof(objheader_t) + classsize[3] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - header->oid = 22; - header->type = 3; - header->version = 1; - header->rcount = 0; //? not sure how to handle this yet - header->status = 0; - header->status |= NEW; - mhashInsert(header->oid, header); - mid = iptoMid("128.200.9.27"); - lhashInsert(header->oid, mid); - - //Inserting into lhashtable - mid = iptoMid("128.200.9.26"); //d-1.eecs.uci.edu - lhashInsert(31, mid); - lhashInsert(32, mid); - lhashInsert(33, mid); - - mid = iptoMid("128.200.9.10"); //demsky.eecs.uci.edu - //Inserting into lhashtable - lhashInsert(1, mid); - lhashInsert(2, mid); - lhashInsert(3, mid); - lhashInsert(4, mid); - - pthread_create(&thread_Listen, &attr, dstmListen, NULL); - - //Check if machine demsky is up and running - checkServer(mid, "128.200.9.10"); - mid = iptoMid("128.200.9.26"); - //Check if machine d-1 is up and running - checkServer(mid, "128.200.9.26"); - - // Start Transaction - myTrans = transStart(); - - //read object 1 (found on demksy) - if((h1 = transRead(myTrans, 1)) == NULL){ - printf("Object not found\n"); - } - //read object 31 (found on d-1) - if((h2 = transRead(myTrans, 31)) == NULL) { - printf("Object not found\n"); - } - - //read object 22 (found locally) - if((h3 = transRead(myTrans, 22)) == NULL) { - printf("Object not found\n"); - } - - //read object 2 (found on demsky) - if((h4 = transRead(myTrans, 2)) == NULL) { - printf("Object not found\n"); - } - - //read object 21 (found locally) - if((h5 = transRead(myTrans, 21)) == NULL) { - printf("Object not found\n"); - } - - //read object 32 (found on d-2) - if((h6 = transRead(myTrans, 32)) == NULL) { - printf("Object not found\n"); - } - - //Commit transaction - if((h1 != NULL) && (h2 != NULL) && (h3 != NULL) && (h4 !=NULL) && (h5 != NULL) && (h6 != NULL)) - transCommit(myTrans); - else - printf("Cannot complete this transaction \n"); - - pthread_join(thread_Listen, NULL); - return 0; -} -int test5a(void) { - unsigned int val, mid; - transrecord_t *myTrans; - unsigned int size; - objheader_t *header, *h1, *h2, *h3; - pthread_t thread_Listen; - pthread_attr_t attr; - - dstmInit(); - pthread_attr_init(&attr); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); - - //Create and Insert Oid 20 - size = sizeof(objheader_t) + classsize[2] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - header->oid = 20; - header->type = 2; - header->version = 1; - header->rcount = 0; //? not sure how to handle this yet - header->status = 0; - header->status |= NEW; - mhashInsert(header->oid, header); - mid = iptoMid("128.200.9.27"); - lhashInsert(header->oid, mid); - - //Create and Insert Oid 21 - size = sizeof(objheader_t) + classsize[1] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - header->oid = 21; - header->type = 1; - header->version = 1; - header->rcount = 0; //? not sure how to handle this yet - header->status = 0; - header->status |= NEW; - mhashInsert(header->oid, header); - mid = iptoMid("128.200.9.27"); - lhashInsert(header->oid, mid); - - //Create and Insert Oid 22 - size = sizeof(objheader_t) + classsize[3] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - header->oid = 22; - header->type = 3; - header->version = 1; - header->rcount = 0; //? not sure how to handle this yet - header->status = 0; - header->status |= NEW; - mhashInsert(header->oid, header); - mid = iptoMid("128.200.9.27"); - lhashInsert(header->oid, mid); - - //Inserting into lhashtable - mid = iptoMid("128.200.9.26"); //d-1.eecs.uci.edu - lhashInsert(31, mid); - lhashInsert(32, mid); - lhashInsert(33, mid); - - mid = iptoMid("128.200.9.10"); //demsky.eecs.uci.edu - //Inserting into lhashtable - lhashInsert(1, mid); - lhashInsert(2, mid); - lhashInsert(3, mid); - lhashInsert(4, mid); - - pthread_create(&thread_Listen, &attr, dstmListen, NULL); - - //Check if machine demsky is up and running - checkServer(mid, "128.200.9.10"); - mid = iptoMid("128.200.9.26"); - //Check if machine d-1 is up and running - checkServer(mid, "128.200.9.26"); - - // Start Transaction - myTrans = transStart(); - - //read object 1 (found on demksy) - if((h1 = transRead(myTrans, 1)) == NULL){ - printf("Object not found\n"); - } - //read object 31 (found on d-1) - if((h2 = transRead(myTrans, 32)) == NULL) { - printf("Object not found\n"); - } - - //read object 22 (found locally) - if((h3 = transRead(myTrans, 22)) == NULL) { - printf("Object not found\n"); - } - - //Commit transaction - if((h1 != NULL) && (h2 != NULL) && (h3 != NULL)) - transCommit(myTrans); - else - printf("Cannot complete this transaction \n"); - - pthread_join(thread_Listen, NULL); - return 0; -} - -int test6(void) { - transrecord_t *record; - objheader_t *header; - unsigned int size, mid; - pthread_t thread_Listen; - pthread_attr_t attr; - objheader_t *h1,*h2, *h3, *h4, *h5, *h6; - int tmpsd; - - dstmInit(); - pthread_attr_init(&attr); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); - //pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); - - record = transStart(); - //printf("DEBUG -> Init done\n"); - mid = iptoMid("128.200.9.10");// Machine demsky.eecs.uci.edu - lhashInsert(1,mid); - lhashInsert(2,mid); - lhashInsert(3,mid); - lhashInsert(4,mid); - lhashInsert(5,mid); - lhashInsert(6,mid); - - mid = iptoMid("128.200.9.26");// Machine demsky.eecs.uci.edu - lhashInsert(31,mid); - lhashInsert(32,mid); - lhashInsert(33,mid); - - pthread_create(&thread_Listen, &attr, dstmListen, NULL); - - checkServer(mid, "128.200.9.26"); - mid = iptoMid("128.200.9.10"); - checkServer(mid, "128.200.9.10"); - - //Create and Insert Oid 20 - size = sizeof(objheader_t) + classsize[2] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - header->oid = 20; - header->type = 2; - header->version = 1; - header->rcount = 0; //? not sure how to handle this yet - header->status = 0; - header->status |= NEW; - mhashInsert(header->oid, header); - mid = iptoMid("128.200.9.27"); - lhashInsert(header->oid, mid); - - //Create and Insert Oid 21 - size = sizeof(objheader_t) + classsize[1] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - header->oid = 21; - header->type = 1; - header->version = 1; - header->rcount = 0; //? not sure how to handle this yet - header->status = 0; - header->status |= NEW; - mhashInsert(header->oid, header); - mid = iptoMid("128.200.9.27"); - lhashInsert(header->oid, mid); - sleep(3); - //read object 1 //from demsky - if((h1 = transRead(record, 1)) == NULL){ - printf("Object not found\n"); - } - //read object 2 - if((h2 = transRead(record, 2)) == NULL) { - printf("Object not found\n"); - } - //read object 31 //Found in d-1 - if((h2 = transRead(record, 31)) == NULL) { - printf("Object not found\n"); - } - //read object 32 //Found in d-1 - if((h2 = transRead(record, 32)) == NULL) { - printf("Object not found\n"); - } - //read object 20(present in local machine) - if((h3 = transRead(record, 20)) == NULL) { - printf("Object not found\n"); - } - //read object 21(present in local machine) - if((h4 = transRead(record, 21)) == NULL) { - printf("Object not found\n"); - } - transCommit(record); - pthread_join(thread_Listen, NULL); - return 0; -} -//Commit transactions on local and remote objects that are NOT a part of -//any other transaction -int test7(void) { - unsigned int val, mid; - transrecord_t *myTrans; - unsigned int size; - objheader_t *header, *h1, *h2, *h3; - pthread_t thread_Listen; - pthread_attr_t attr; - - dstmInit(); - pthread_attr_init(&attr); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); - - //Create and Insert Oid 20 - size = sizeof(objheader_t) + classsize[2] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - header->oid = 20; - header->type = 2; - header->version = 1; - header->rcount = 0; //? not sure how to handle this yet - header->status = 0; - header->status |= NEW; - mhashInsert(header->oid, header); - mid = iptoMid("128.200.9.27"); - lhashInsert(header->oid, mid); - - //Create and Insert Oid 21 - size = sizeof(objheader_t) + classsize[1] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - header->oid = 21; - header->type = 1; - header->version = 1; - header->rcount = 0; //? not sure how to handle this yet - header->status = 0; - header->status |= NEW; - mhashInsert(header->oid, header); - mid = iptoMid("128.200.9.27"); - lhashInsert(header->oid, mid); - - //Create and Insert Oid 22 - size = sizeof(objheader_t) + classsize[3] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - header->oid = 22; - header->type = 3; - header->version = 1; - header->rcount = 0; //? not sure how to handle this yet - header->status = 0; - header->status |= NEW; - mhashInsert(header->oid, header); - mid = iptoMid("128.200.9.27"); - lhashInsert(header->oid, mid); - - //Inserting into lhashtable - mid = iptoMid("128.200.9.26"); //d-1.eecs.uci.edu - lhashInsert(31, mid); - lhashInsert(32, mid); - lhashInsert(33, mid); - - mid = iptoMid("128.200.9.10"); //demsky.eecs.uci.edu - //Inserting into lhashtable - lhashInsert(1, mid); - lhashInsert(2, mid); - lhashInsert(3, mid); - lhashInsert(4, mid); - - pthread_create(&thread_Listen, &attr, dstmListen, NULL); - - //Check if machine demsky is up and running - checkServer(mid, "128.200.9.10"); - mid = iptoMid("128.200.9.26"); - //Check if machine d-1 is up and running - checkServer(mid, "128.200.9.26"); - - // Start Transaction - myTrans = transStart(); - - //read object 3 (found on demksy) - if((h1 = transRead(myTrans, 3)) == NULL){ - printf("Object not found\n"); - } - //read object 32 (found on d-1) - if((h2 = transRead(myTrans, 32)) == NULL) { - printf("Object not found\n"); - } - - //read object 22 (found locally) - if((h3 = transRead(myTrans, 22)) == NULL) { - printf("Object not found\n"); - } - - //Commit transaction - transCommit(myTrans); - - pthread_join(thread_Listen, NULL); - return 0; -} diff --git a/Robust/src/Runtime/DSTM/interface/tests/testclookup.c b/Robust/src/Runtime/DSTM/interface/tests/testclookup.c deleted file mode 100644 index e89074b7..00000000 --- a/Robust/src/Runtime/DSTM/interface/tests/testclookup.c +++ /dev/null @@ -1,58 +0,0 @@ -#include -#include "clookup.h" - -main() -{ - int i; - void *val; - chashtable_t *ctable; - - if (( ctable = chashCreate(1000, 0.40)) == NULL) { - printf("chashCreate error\n"); //creates hashtable - } - - for (i = 1; i <= 2000; i++) { // Checks the insert() and resize() - if (chashInsert(ctable, 10*i, &i) == 1) - printf("chashInsert error\n"); - } - - i = chashRemove(ctable, 10);//Delete first element in the hashtable - if(i == 1) - printf("chashRemove error "); - - for (i = 1; i <= 2000; i++) { // Check if it can search for all keys in hash table - val = chashSearch(ctable, 10*i); - if (val != &i) - printf("chashSearch error - val = %d\n", val); - else - printf("chashSearch key = %d val = %x\n",10*i, val); - } - - i = chashRemove(ctable, 30); - if(i == 1) - printf("chashRemove error\n "); - i = chashRemove(ctable, 40); - if(i == 1) - printf("chashRemove error\n "); - i = chashRemove(ctable, 80); - if(i == 1) - printf("chashRemove error\n "); - i = chashRemove(ctable, 100); - if(i == 1) - printf("chashRemove error\n "); - i = chashRemove(ctable, 90); - if(i == 1) - printf("chashRemove error\n "); - - for (i = 1; i <= 2000; i++) { //Prints all left over elements inside hash after deletion and prints error if element not found in hash - val = chashSearch(ctable, 10*i); - if (val != &i) - printf("chashSearch error - val = %d\n", val); - else - printf("chashSearch key = %d val = %x\n",10*i, val); - } - - printf("The total number of elements in table : %d\n", ctable->numelements); - - chashDelete(ctable); -} diff --git a/Robust/src/Runtime/DSTM/interface/tests/testd-3.c b/Robust/src/Runtime/DSTM/interface/tests/testd-3.c deleted file mode 100644 index 9566b00f..00000000 --- a/Robust/src/Runtime/DSTM/interface/tests/testd-3.c +++ /dev/null @@ -1,657 +0,0 @@ -#include -#include -#include "dstm.h" -#include "llookup.h" -#include "ip.h" - -#define LISTEN_PORT 2156 - -extern objstr_t *mainobjstore; - -int classsize[]={sizeof(int),sizeof(char),sizeof(short), sizeof(void *)}; - -int main() -{ -// test2(); -// test3(); -// test4(); - test5(); -// test5a(); -// test2a(); -// test2b(); -// test7(); - -} - -int test1(void) { - - transrecord_t *record; - objheader_t *h1,*h2,*h3,*h4,*h5, *h6; - - dstmInit(); - record = transStart(); - printf("DEBUG -> Init done\n"); - h1 = transRead(record, 1); - printf("oid = %d\tsize = %d\n", OID(h1),classsize[h1->type]); - h3 = transRead(record, 3); - printf("oid = %d\tsize = %d\n", OID(h3),classsize[h3->type]); - h4 = transRead(record, 4); - printf("oid = %d\tsize = %d\n", OID(h4),classsize[h4->type]); - h2 = transRead(record, 2); - printf("oid = %d\tsize = %d\n", OID(h2),classsize[h2->type]); - h4 = transRead(record, 4); - printf("oid = %d\tsize = %d\n", OID(h4),classsize[h4->type]); - h3 = transRead(record, 3); - printf("oid = %d\tsize = %d\n", OID(h3),classsize[h3->type]); - h5 = transRead(record, 5); - printf("oid = %d\tsize = %d\n", OID(h5),classsize[h5->type]); -} - -int test2(void) { - - transrecord_t *record; - objheader_t *h1,*h2,*h3,*h4,*h5, *h6; - - dstmInit(); - record = transStart(); - - lhashInsert(1,1); - lhashInsert(2,1); - lhashInsert(3,1); - lhashInsert(4,1); - lhashInsert(5,1); - lhashInsert(6,1); - printf("DEBUG -> Init done\n"); - h1 = transRead(record, 1); - lhashInsert(OID(h1), 1); - h2 = transRead(record, 2); - lhashInsert(OID(h2), 1); - h3 = transRead(record, 3); - lhashInsert(OID(h3), 1); - h4 = transRead(record, 4); - lhashInsert(OID(h4), 1); - h5 = transRead(record, 5); - lhashInsert(OID(h5), 1); - h6 = transRead(record, 6); - lhashInsert(OID(h6), 1); - - transCommit(record); - - return 0; -} - -//Read objects when objects are found in remote location -int test2a(void) { - unsigned int val, mid; - transrecord_t *myTrans; - unsigned int size; - objheader_t *header, *h1, *h2; - pthread_t thread_Listen; - pthread_attr_t attr; - - dstmInit(); - pthread_attr_init(&attr); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); - - //Create and Insert Oid 20 - size = sizeof(objheader_t) + classsize[2] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - OID(header) = 20; - header->type = 2; - header->version = 1; - header->rcount = 0; //? not sure how to handle this yet - header->status = 0; - header->status |= NEW; - mhashInsert(OID(header), header); - mid = iptoMid("128.200.9.29"); - lhashInsert(OID(header), mid); - - //Create and Insert Oid 21 - size = sizeof(objheader_t) + classsize[1] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - OID(header) = 21; - header->type = 1; - header->version = 1; - header->rcount = 0; //? not sure how to handle this yet - header->status = 0; - header->status |= NEW; - mhashInsert(OID(header), header); - mid = iptoMid("128.200.9.29"); - lhashInsert(OID(header), mid); - - //Create and Insert Oid 22 - size = sizeof(objheader_t) + classsize[3] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - OID(header) = 22; - header->type = 3; - header->version = 1; - header->rcount = 0; //? not sure how to handle this yet - header->status = 0; - header->status |= NEW; - mhashInsert(OID(header), header); - mid = iptoMid("128.200.9.29"); - lhashInsert(OID(header), mid); - - //Inserting into lhashtable - mid = iptoMid("128.195.175.69"); //dw-1.eecs.uci.edu - lhashInsert(31, mid); - lhashInsert(32, mid); - - mid = iptoMid("128.200.9.10"); //demsky.eecs.uci.edu - //Inserting into lhashtable - lhashInsert(1, mid); - lhashInsert(2, mid); - lhashInsert(3, mid); - lhashInsert(4, mid); - - pthread_create(&thread_Listen, &attr, dstmListen, NULL); - - //Check if machine demsky is up and running - checkServer(mid, "128.200.9.10"); - mid = iptoMid("128.195.175.69"); - //Check if machine dw-1 is up and running - checkServer(mid, "128.195.175.69"); - - // Start Transaction - myTrans = transStart(); - - //read object 1 - if((h1 = transRead(myTrans, 1)) == NULL){ - printf("Object not found\n"); - } - //read object 2 - if((h2 = transRead(myTrans, 2)) == NULL) { - printf("Object not found\n"); - } - - pthread_join(thread_Listen, NULL); - return 0; -} - -//Read objects that are both remote and local and are available on machines -int test2b(void) { - - unsigned int val, mid; - transrecord_t *myTrans; - unsigned int size; - objheader_t *header, *h1, *h2, *h3, *h4; - pthread_t thread_Listen; - pthread_attr_t attr; - - dstmInit(); - pthread_attr_init(&attr); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); - - //Create and Insert Oid 20 - size = sizeof(objheader_t) + classsize[2] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - OID(header) = 20; - header->type = 2; - header->version = 1; - header->rcount = 0; //? not sure how to handle this yet - header->status = 0; - header->status |= NEW; - mhashInsert(OID(header), header); - mid = iptoMid("128.200.9.29"); - lhashInsert(OID(header), mid); - - //Create and Insert Oid 21 - size = sizeof(objheader_t) + classsize[1] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - OID(header) = 21; - header->type = 1; - header->version = 1; - header->rcount = 0; //? not sure how to handle this yet - header->status = 0; - header->status |= NEW; - mhashInsert(OID(header), header); - mid = iptoMid("128.200.9.29"); - lhashInsert(OID(header), mid); - - //Create and Insert Oid 22 - size = sizeof(objheader_t) + classsize[3] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - OID(header) = 22; - header->type = 3; - header->version = 1; - header->rcount = 0; //? not sure how to handle this yet - header->status = 0; - header->status |= NEW; - mhashInsert(OID(header), header); - mid = iptoMid("128.200.9.29"); - lhashInsert(OID(header), mid); - - //Inserting into lhashtable - mid = iptoMid("128.195.175.69"); //dw-1.eecs.uci.edu - lhashInsert(31, mid); - lhashInsert(32, mid); - lhashInsert(33, mid); - - mid = iptoMid("128.200.9.10"); //demsky.eecs.uci.edu - //Inserting into lhashtable - lhashInsert(1, mid); - lhashInsert(2, mid); - lhashInsert(3, mid); - lhashInsert(4, mid); - - pthread_create(&thread_Listen, &attr, dstmListen, NULL); - - //Check if machine demsky is up and running - checkServer(mid, "128.200.9.10"); - mid = iptoMid("128.195.175.69"); - //Check if machine dw-1 is up and running - checkServer(mid, "128.195.175.69"); - - // Start Transaction - myTrans = transStart(); - - //read object 1 (found on demksy) - if((h1 = transRead(myTrans, 1)) == NULL){ - printf("Object not found\n"); - } - //read object 2 (found on demsky) - if((h2 = transRead(myTrans, 2)) == NULL) { - printf("Object not found\n"); - } - - //read object 21 (found on local) - if((h3 = transRead(myTrans, 21)) == NULL) { - printf("Object not found\n"); - } - - //read object 32 (found on dw-1) - if((h4 = transRead(myTrans, 32)) == NULL) { - printf("Object not found\n"); - } - - pthread_join(thread_Listen, NULL); - return 0; - -} - - -//Read objects when objects are not found in any participant -int test3(void){ - transrecord_t *record; - objheader_t *h1,*h2; - - dstmInit(); - record = transStart(); - printf("DEBUG -> Init done\n"); - //read object 11 - if((h1 = transRead(record, 11)) == NULL){ - printf("Object not found\n"); - } - //read object 12 - if((h2 = transRead(record, 12)) == NULL) { - printf("Object not found\n"); - } - transCommit(record); - - return 0; -} - -//Read objects when some objects are found and other objects not found in any participant -int test4(void) { - transrecord_t *record; - objheader_t *h1,*h2, *h3, *h4; - - dstmInit(); - record = transStart(); - printf("DEBUG -> Init done\n"); - //read object 1 - if((h1 = transRead(record, 1)) == NULL){ - printf("Object not found\n"); - } - //read object 2 - if((h2 = transRead(record, 2)) == NULL) { - printf("Object not found\n"); - } - //read object 11 - if((h3 = transRead(record, 11)) == NULL) { - printf("Object not found\n"); - } - //read object 13 - if((h4 = transRead(record, 13)) == NULL) { - printf("Object not found\n"); - } - if((h1 != NULL) && (h2 != NULL) && (h3 != NULL) && h4 !=NULL) { - transCommit(record); - }else { - printf("Cannot complete this transaction\n"); - } - - return 0; -} - -//Commit for transaction objects when the objs are part of other -//transactions running simultaneously -int test5(void) { - unsigned int val, mid; - transrecord_t *myTrans; - unsigned int size; - objheader_t *header, *h1, *h2, *h3, *h4, *h5, *h6; - pthread_t thread_Listen; - pthread_attr_t attr; - - dstmInit(); - pthread_attr_init(&attr); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); - - //Create and Insert Oid 20 - size = sizeof(objheader_t) + classsize[2] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - OID(header) = 20; - header->type = 2; - header->version = 1; - header->rcount = 0; //? not sure how to handle this yet - header->status = 0; - header->status |= NEW; - mhashInsert(OID(header), header); - mid = iptoMid("128.200.9.29"); - lhashInsert(OID(header), mid); - - //Create and Insert Oid 21 - size = sizeof(objheader_t) + classsize[1] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - OID(header) = 21; - header->type = 1; - header->version = 1; - header->rcount = 0; //? not sure how to handle this yet - header->status = 0; - header->status |= NEW; - mhashInsert(OID(header), header); - mid = iptoMid("128.200.9.29"); - lhashInsert(OID(header), mid); - - //Create and Insert Oid 22 - size = sizeof(objheader_t) + classsize[3] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - OID(header) = 22; - header->type = 3; - header->version = 1; - header->rcount = 0; //? not sure how to handle this yet - header->status = 0; - header->status |= NEW; - mhashInsert(OID(header), header); - mid = iptoMid("128.200.9.29"); - lhashInsert(OID(header), mid); - - //Inserting into lhashtable - mid = iptoMid("128.195.175.69"); //dw-1.eecs.uci.edu - lhashInsert(31, mid); - lhashInsert(32, mid); - lhashInsert(33, mid); - - mid = iptoMid("128.200.9.10"); //demsky.eecs.uci.edu - //Inserting into lhashtable - lhashInsert(1, mid); - lhashInsert(2, mid); - lhashInsert(3, mid); - lhashInsert(4, mid); - - pthread_create(&thread_Listen, &attr, dstmListen, NULL); - //Check if machine demsky is up and running - checkServer(mid, "128.200.9.10"); - mid = iptoMid("128.195.175.69"); - //Check if machine dw-1 is up and running - checkServer(mid, "128.195.175.69"); - - // Start Transaction - myTrans = transStart(); - - //read object 1 (found on demksy) - if((h1 = transRead(myTrans, 1)) == NULL){ - printf("Object not found\n"); - } - //read object 2 (found on demksy) - if((h2 = transRead(myTrans,2)) == NULL){ - printf("Object not found\n"); - } - //read object 22 (found locally ) - if((h3 = transRead(myTrans, 22)) == NULL) { - printf("Object not found\n"); - } - - //Commit transaction - transCommit(myTrans); - - pthread_join(thread_Listen, NULL); - return 0; -} -int test5a(void) { - unsigned int val, mid; - transrecord_t *myTrans; - unsigned int size; - objheader_t *header, *h1, *h2, *h3; - pthread_t thread_Listen; - pthread_attr_t attr; - - dstmInit(); - pthread_attr_init(&attr); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); - - //Create and Insert Oid 20 - size = sizeof(objheader_t) + classsize[2] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - OID(header) = 20; - header->type = 2; - header->version = 1; - header->rcount = 0; //? not sure how to handle this yet - header->status = 0; - header->status |= NEW; - mhashInsert(OID(header), header); - mid = iptoMid("128.200.9.29"); - lhashInsert(OID(header), mid); - - //Create and Insert Oid 21 - size = sizeof(objheader_t) + classsize[1] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - OID(header) = 21; - header->type = 1; - //read object 31 (found on dw-1) - if((h2 = transRead(myTrans, 31)) == NULL) { - printf("Object not found\n"); - } - - //Commit transaction - transCommit(myTrans); - - pthread_join(thread_Listen, NULL); - return 0; -} -int test5b(void) { - unsigned int val, mid; - transrecord_t *myTrans; - unsigned int size; - objheader_t *header, *h1, *h2, *h3; - pthread_t thread_Listen; - pthread_attr_t attr; - - dstmInit(); - pthread_attr_init(&attr); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); - - //Create and Insert Oid 20 - size = sizeof(objheader_t) + classsize[2] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - OID(header) = 20; - header->type = 2; - header->version = 1; - header->rcount = 0; //? not sure how to handle this yet - header->status = 0; - header->status |= NEW; - mhashInsert(OID(header), header); - mid = iptoMid("128.200.9.29"); - lhashInsert(OID(header), mid); - - //Create and Insert Oid 21 - size = sizeof(objheader_t) + classsize[1] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - OID(header) = 21; - header->type = 1; - header->version = 1; - header->rcount = 0; //? not sure how to handle this yet - header->status = 0; - header->status |= NEW; - mhashInsert(OID(header), header); - mid = iptoMid("128.200.9.29"); - lhashInsert(OID(header), mid); - - //Create and Insert Oid 22 - size = sizeof(objheader_t) + classsize[3] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - OID(header) = 22; - header->type = 3; - header->version = 1; - header->rcount = 0; //? not sure how to handle this yet - header->status = 0; - header->status |= NEW; - mhashInsert(OID(header), header); - mid = iptoMid("128.200.9.29"); - lhashInsert(OID(header), mid); - - //Inserting into lhashtable - mid = iptoMid("128.195.175.69"); //dw-1.eecs.uci.edu - lhashInsert(31, mid); - lhashInsert(32, mid); - lhashInsert(33, mid); - - mid = iptoMid("128.200.9.10"); //demsky.eecs.uci.edu - //Inserting into lhashtable - lhashInsert(1, mid); - lhashInsert(2, mid); - lhashInsert(3, mid); - lhashInsert(4, mid); - - pthread_create(&thread_Listen, &attr, dstmListen, NULL); - - //Check if machine demsky is up and running - checkServer(mid, "128.200.9.10"); - mid = iptoMid("128.195.175.69"); - //Check if machine dw-1 is up and running - checkServer(mid, "128.195.175.69"); - - // Start Transaction - myTrans = transStart(); - - //read object 1 (found on demksy) - if((h1 = transRead(myTrans, 1)) == NULL){ - printf("Object not found\n"); - } - //read object 31 (found on dw-1) - if((h2 = transRead(myTrans, 31)) == NULL) { - printf("Object not found\n"); - } - - //read object 22 (found locally) - if((h3 = transRead(myTrans, 22)) == NULL) { - printf("Object not found\n"); - } - - //Commit transaction - if((h1 != NULL) && (h2 != NULL) && (h3 != NULL)) - transCommit(myTrans); - else - printf("Cannot complete this transaction \n"); - - pthread_join(thread_Listen, NULL); - return 0; -} -//Commit transactions on local and remote objects that are NOT a part of -//any other transaction -int test7(void) { - unsigned int val, mid; - transrecord_t *myTrans; - unsigned int size; - objheader_t *header, *h1, *h2, *h3; - pthread_t thread_Listen; - pthread_attr_t attr; - - dstmInit(); - pthread_attr_init(&attr); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); - - //Create and Insert Oid 20 - size = sizeof(objheader_t) + classsize[2] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - OID(header) = 20; - header->type = 2; - header->version = 1; - header->rcount = 0; //? not sure how to handle this yet - header->status = 0; - header->status |= NEW; - mhashInsert(OID(header), header); - mid = iptoMid("128.200.9.29"); - lhashInsert(OID(header), mid); - - //Create and Insert Oid 21 - size = sizeof(objheader_t) + classsize[1] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - OID(header) = 21; - header->type = 1; - header->version = 1; - header->rcount = 0; //? not sure how to handle this yet - header->status = 0; - header->status |= NEW; - mhashInsert(OID(header), header); - mid = iptoMid("128.200.9.29"); - lhashInsert(OID(header), mid); - - //Create and Insert Oid 22 - size = sizeof(objheader_t) + classsize[3] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - OID(header) = 22; - header->type = 3; - header->version = 1; - header->rcount = 0; //? not sure how to handle this yet - header->status = 0; - header->status |= NEW; - mhashInsert(OID(header), header); - mid = iptoMid("128.200.9.29"); - lhashInsert(OID(header), mid); - - //Inserting into lhashtable - mid = iptoMid("128.195.175.69"); //dw-1.eecs.uci.edu - lhashInsert(31, mid); - lhashInsert(32, mid); - lhashInsert(33, mid); - - mid = iptoMid("128.200.9.10"); //demsky.eecs.uci.edu - //Inserting into lhashtable - lhashInsert(1, mid); - lhashInsert(2, mid); - lhashInsert(3, mid); - lhashInsert(4, mid); - - pthread_create(&thread_Listen, &attr, dstmListen, NULL); - - //Check if machine demsky is up and running - checkServer(mid, "128.200.9.10"); - mid = iptoMid("128.195.175.69"); - //Check if machine dw-1 is up and running - checkServer(mid, "128.195.175.69"); - - // Start Transaction - myTrans = transStart(); - - //read object 3 (found on demksy) - if((h1 = transRead(myTrans, 3)) == NULL){ - printf("Object not found\n"); - } - //read object 32 (found on dw-1) - if((h2 = transRead(myTrans, 32)) == NULL) { - printf("Object not found\n"); - } - - //read object 22 (found locally) - if((h3 = transRead(myTrans, 22)) == NULL) { - printf("Object not found\n"); - } - - //Commit transaction - transCommit(myTrans); - - pthread_join(thread_Listen, NULL); - return 0; -} diff --git a/Robust/src/Runtime/DSTM/interface/tests/testd-4.c b/Robust/src/Runtime/DSTM/interface/tests/testd-4.c deleted file mode 100644 index 26dba3a9..00000000 --- a/Robust/src/Runtime/DSTM/interface/tests/testd-4.c +++ /dev/null @@ -1,344 +0,0 @@ -#include -#include "dstm.h" - -extern objstr_t *mainobjstore; -int classsize[]={sizeof(int),sizeof(char),sizeof(short), sizeof(void *)}; - -int main() -{ - test1(); -// test2(); -// test3(); -// test4(); -} - -void init_obj(objheader_t *h, unsigned int oid, unsigned short type, \ - unsigned short version,\ - unsigned short rcount, char status) { - h->oid = oid; - h->type = type; - h->version = version; - h->rcount = rcount; - h->status |= status; - return; -} - -//Test case to create objects and do nothing else -int test1() { - unsigned int val, mid; - unsigned int size; - transrecord_t *myTrans; - objheader_t *header; - pthread_t thread_Listen; - pthread_attr_t attr; - - dstmInit(); - pthread_attr_init(&attr); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); - - //Create and Insert Oid 31 - size = sizeof(objheader_t) + classsize[2] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - init_obj(header, 31, 2, 1, 0, NEW); - mhashInsert(header->oid, header); - mid = iptoMid("128.195.175.69"); - lhashInsert(header->oid, mid); - - //Create and Insert Oid 32 - size = sizeof(objheader_t) + classsize[1] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - init_obj(header, 32, 1, 1, 0, NEW); - mhashInsert(header->oid, header); - mid = iptoMid("128.195.175.69"); - lhashInsert(header->oid, mid); - - //Create and Insert Oid 33 - size = sizeof(objheader_t) + classsize[0] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - init_obj(header, 33, 0, 1, 0, NEW); - mhashInsert(header->oid, header); - mid = iptoMid("128.195.175.69"); - lhashInsert(header->oid, mid); - - //Inserting into lhashtable into d-3.eecs - mid = iptoMid("128.200.9.29"); //d-3.eecs.uci.edu - lhashInsert(20, mid); - lhashInsert(21, mid); - lhashInsert(22, mid); - - mid = iptoMid("128.200.9.10"); //demsky.eecs.uci.edu - //Inserting into lhashtable of demsky.eecs - lhashInsert(1, mid); - lhashInsert(2, mid); - lhashInsert(3, mid); - lhashInsert(4, mid); - - pthread_create(&thread_Listen, &attr, dstmListen, NULL); - //Check if machine demsky is up and running - checkServer(mid, "128.200.9.10"); - mid = iptoMid("128.200.9.29"); - //Check if machine d-3 is up and running - checkServer(mid, "128.200.9.29"); - - pthread_join(thread_Listen, NULL); - - return 0; -} - -//Read objects from remote and local machines ; NOTE objects are all available -int test2() { - - unsigned int val, mid; - unsigned int size; - transrecord_t *myTrans; - objheader_t *header, *h1, *h2, *h3, *h4; - pthread_t thread_Listen; - pthread_attr_t attr; - - dstmInit(); - pthread_attr_init(&attr); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); - - //Create and Insert Oid 31 - size = sizeof(objheader_t) + classsize[2] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - init_obj(header, 31, 2, 1, 0, NEW); - mhashInsert(header->oid, header); - mid = iptoMid("128.195.175.69"); - lhashInsert(header->oid, mid); - - //Create and Insert Oid 32 - size = sizeof(objheader_t) + classsize[1] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - init_obj(header, 32, 1, 1, 0, NEW); - mhashInsert(header->oid, header); - mid = iptoMid("128.195.175.69"); - lhashInsert(header->oid, mid); - - //Create and Insert Oid 33 - size = sizeof(objheader_t) + classsize[0] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - init_obj(header, 33, 0, 1, 0, NEW); - mhashInsert(header->oid, header); - mid = iptoMid("128.195.175.69"); - lhashInsert(header->oid, mid); - - //Inserting into lhashtable into d-3.eecs - mid = iptoMid("128.200.9.29"); //d-3.eecs.uci.edu - lhashInsert(20, mid); - lhashInsert(21, mid); - lhashInsert(22, mid); - - mid = iptoMid("128.200.9.10"); //demsky.eecs.uci.edu - //Inserting into lhashtable of demsky.eecs - lhashInsert(1, mid); - lhashInsert(2, mid); - lhashInsert(3, mid); - lhashInsert(4, mid); - - pthread_create(&thread_Listen, &attr, dstmListen, NULL); - - //Check if machine demsky is up and running - checkServer(mid, "128.200.9.10"); - mid = iptoMid("128.200.9.29"); - //Check if machine d-2 is up and running - checkServer(mid, "128.200.9.29"); - - // Start Transaction - myTrans = transStart(); - - //read object 1 (found on demksy) - if((h1 = transRead(myTrans, 1)) == NULL){ - printf("Object not found\n"); - } - - //read object 33 (found on local) - if((h2 = transRead(myTrans, 33)) == NULL){ - printf("Object not found\n"); - } - - //read object 21 (found on d-3) - if((h3 = transRead(myTrans, 21)) == NULL){ - printf("Object not found\n"); - } - - //read object 32 (found on local) - if((h4 = transRead(myTrans, 32)) == NULL){ - printf("Object not found\n"); - } - - pthread_join(thread_Listen, NULL); - - return 0; -} - -int test3() { - - unsigned int val, mid; - unsigned int size; - transrecord_t *myTrans; - objheader_t *header, *h1, *h2, *h3; - pthread_t thread_Listen; - pthread_attr_t attr; - - dstmInit(); - pthread_attr_init(&attr); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); - - //Create and Insert Oid 31 - size = sizeof(objheader_t) + classsize[2] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - init_obj(header, 31, 2, 1, 0, NEW); - mhashInsert(header->oid, header); - mid = iptoMid("128.195.175.69"); - lhashInsert(header->oid, mid); - - //Create and Insert Oid 32 - size = sizeof(objheader_t) + classsize[1] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - init_obj(header, 32, 1, 1, 0, NEW); - mhashInsert(header->oid, header); - mid = iptoMid("128.195.175.69"); - lhashInsert(header->oid, mid); - - //Create and Insert Oid 33 - size = sizeof(objheader_t) + classsize[0] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - init_obj(header, 33, 0, 1, 0, NEW); - mhashInsert(header->oid, header); - mid = iptoMid("128.195.175.69"); - lhashInsert(header->oid, mid); - - //Inserting into lhashtable into d-3.eecs - mid = iptoMid("128.200.9.29"); //d-3.eecs.uci.edu - lhashInsert(20, mid); - lhashInsert(21, mid); - lhashInsert(22, mid); - - mid = iptoMid("128.200.9.10"); //demsky.eecs.uci.edu - //Inserting into lhashtable of demsky.eecs - lhashInsert(1, mid); - lhashInsert(2, mid); - lhashInsert(3, mid); - lhashInsert(4, mid); - - pthread_create(&thread_Listen, &attr, dstmListen, NULL); - - //Check if machine demsky is up and running - checkServer(mid, "128.200.9.10"); - mid = iptoMid("128.200.9.29"); - //Check if machine d-3 is up and running - checkServer(mid, "128.200.9.29"); - - // Start Transaction - myTrans = transStart(); - - //read object 4 (found on demksy) - if((h1 = transRead(myTrans, 4)) == NULL){ - printf("Object not found\n"); - } - //read object 33 (found on local) - if((h2 = transRead(myTrans, 33)) == NULL){ - printf("Object not found\n"); - } - //read object 20 (found on d-3) - if((h3 = transRead(myTrans, 20)) == NULL){ - printf("Object not found\n"); - } - - //Commit transaction - transCommit(myTrans); - - pthread_join(thread_Listen, NULL); - - return 0; -} -//Commit transaction for some objects that are available and some that are -//not available anywhere -int test4() { - unsigned int val, mid; - unsigned int size; - transrecord_t *myTrans; - objheader_t *header, *h1, *h2, *h3, *h4; - pthread_t thread_Listen; - pthread_attr_t attr; - - dstmInit(); - pthread_attr_init(&attr); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); - - //Create and Insert Oid 31 - size = sizeof(objheader_t) + classsize[2] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - init_obj(header, 31, 2, 1, 0, NEW); - mhashInsert(header->oid, header); - mid = iptoMid("128.195.175.69"); - lhashInsert(header->oid, mid); - - //Create and Insert Oid 32 - size = sizeof(objheader_t) + classsize[1] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - init_obj(header, 32, 1, 1, 0, NEW); - mhashInsert(header->oid, header); - mid = iptoMid("128.195.175.69"); - lhashInsert(header->oid, mid); - - //Create and Insert Oid 33 - size = sizeof(objheader_t) + classsize[0] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - init_obj(header, 33, 0, 1, 0, NEW); - mhashInsert(header->oid, header); - mid = iptoMid("128.195.175.69"); - lhashInsert(header->oid, mid); - - //Inserting into lhashtable into d-3.eecs - mid = iptoMid("128.200.9.29"); //d-3.eecs.uci.edu - lhashInsert(20, mid); - lhashInsert(21, mid); - lhashInsert(22, mid); - - mid = iptoMid("128.200.9.10"); //demsky.eecs.uci.edu - //Inserting into lhashtable of demsky.eecs - lhashInsert(1, mid); - lhashInsert(2, mid); - lhashInsert(3, mid); - lhashInsert(4, mid); - - pthread_create(&thread_Listen, &attr, dstmListen, NULL); - - //Check if machine demsky is up and running - checkServer(mid, "128.200.9.10"); - mid = iptoMid("128.200.9.29"); - //Check if machine d-2 is up and running - checkServer(mid, "128.200.9.29"); - - // Start Transaction - myTrans = transStart(); - - //read object 4 (found on demksy) - if((h1 = transRead(myTrans, 4)) == NULL){ - printf("Object not found\n"); - } - //read object 33 (found on local) - if((h2 = transRead(myTrans, 33)) == NULL){ - printf("Object not found\n"); - } - //read object 24 (found nowhere) - if((h3 = transRead(myTrans, 24)) == NULL){ - printf("Object not found\n"); - } - //read object 50 (found nowhere) - if((h4 = transRead(myTrans, 50)) == NULL){ - printf("Object not found\n"); - } - - //Commit transaction - if((h1 != NULL) && (h2 != NULL) && (h3 != NULL) && (h4 !=NULL)) - transCommit(myTrans); - else - printf("Cannot complete this transaction\n"); - - pthread_join(thread_Listen, NULL); - return 0; - -} diff --git a/Robust/src/Runtime/DSTM/interface/tests/testdht.c b/Robust/src/Runtime/DSTM/interface/tests/testdht.c deleted file mode 100644 index acc86a0e..00000000 --- a/Robust/src/Runtime/DSTM/interface/tests/testdht.c +++ /dev/null @@ -1,159 +0,0 @@ -#include -#include "dht.h" -#include "clookup.h" - -#define NUM_ITEMS 100000 - -int main() -{ - unsigned int key; - unsigned int val; - unsigned int vals[NUM_ITEMS]; - int retval; - int error; - chashtable_t *localHash; - - dhtInit(0x80C3AF45, DHT_NO_KEY_LIMIT); - - localHash = chashCreate(HASH_SIZE, LOADFACTOR); - srandom(time(0)); - - for (key = 1; key < NUM_ITEMS; key++) - { - vals[key] = random(); - } - - sleep(5); - - printf("testing dhtInsert() and dhtSearch()\n"); - - for (key = 0; key < NUM_ITEMS; key++) - { - dhtInsert(key, vals[key]); - } - - error = 0; - for (key = 1; key < NUM_ITEMS; key++) - { - retval = dhtSearch(key, &val); - if (retval == 1) - { - printf("item not found: key = %d, expected val = %d\n", key, vals[key]); - error = 1; - } - else if (retval == -1) - { - printf("internal error: key = %d, expected val = %d\n", key, vals[key]); - error = 1; - } - else if (retval == 0) - { - if (vals[key] != val) - { - printf("unexpected value: key = %d, expected val = %d, val = %d\n", key, vals[key], val); - error = 1; - } - } - } - if (!error) - printf("test completed successfully\n"); - else - printf("one or more errors occurred\n"); - - printf("(this currently fails if key = 0 OR val = 0, due to underlying hash table)\n"); - printf("testing underlying hash table (clookup.h)\n"); - - for (key = 1; key < NUM_ITEMS; key++) - { - chashInsert(localHash, key, (void *)vals[key]); - } - - error = 0; - for (key = 1; key < NUM_ITEMS; key++) - { - val = (unsigned int)chashSearch(localHash, key); - if ((void *)val == NULL) - { - printf("item not found: key = %d, expected val = %d\n", key, vals[key]); - error = 1; - } - else - { - if (vals[key] != val) - { - printf("unexpected value: key = %d, expected val = %d, val = %d\n", key, vals[key], val); - error = 1; - } - } - for (key = NUM_ITEMS; key < NUM_ITEMS + 20; key++) - { - val = (unsigned int)chashSearch(localHash, key); - if ((void *)val != NULL) - { - printf("error: returned value for key that wasn't inserted: key = %d, val = %d\n", key, val); - error = 1; - } - } - } - - if (!error) - printf("test completed successfully\n"); - else - printf("one or more errors occurred\n"); - - printf("testing dhtRemove(), removing half of the keys, and verifying that the other half is still there\n"); - - for (key = 0; key < NUM_ITEMS / 2; key++) - { - dhtRemove(key); - } - error = 0; - for (key = 0; key < NUM_ITEMS / 2; key++) - { - retval = dhtSearch(key, &val); - if (retval == 0) - { - printf("error: found removed item: key = %d, val = %d\n", key, val); - error = 1; - } - else if (retval == -1) - { - printf("internal error: key = %d, val = %d\n", key, val); - error = 1; - } - } - for (key = NUM_ITEMS / 2; key < NUM_ITEMS; key++) - { - retval = dhtSearch(key, &val); - if (retval == 1) - { - printf("item not found: key = %d, expected val = %d\n", key, vals[key]); - error = 1; - } - else if (retval == -1) - { - printf("internal error: key = %d, expected val = %d\n", key, vals[key]); - error = 1; - } - else if (retval == 0) - { - if (vals[key] != val) - { - printf("unexpected value: key = %d, expected val = %d, val = %d\n", key, vals[key], val); - error = 1; - } - } - } - - if (!error) - printf("test completed successfully\n"); - else - printf("one or more errors occurred\n"); - - sleep(5); - - dhtExit(); - - return 0; -} - diff --git a/Robust/src/Runtime/DSTM/interface/tests/testllookup.c b/Robust/src/Runtime/DSTM/interface/tests/testllookup.c deleted file mode 100644 index 6013ab02..00000000 --- a/Robust/src/Runtime/DSTM/interface/tests/testllookup.c +++ /dev/null @@ -1,43 +0,0 @@ -#include -#include "llookup.h" -extern lhashtable_t llookup; - -main() -{ - int i, mid; - - if (lhashCreate(10, 0.20) == 1) { - printf("lhashCreate error\n"); //creates hashtable - } - for (i = 1; i <= 7; i++) { // Checks the insert() and resize() - if (lhashInsert(10*i, i) == 1) - printf("lhashInsert error\n"); - } - - i = lhashRemove(10);//Delete first element in the hashtable - if(i == 1) - printf("lhashRemove error "); - - for (i = 1; i <=7; i++) { // Check if it can search for all oids in hash table - mid = lhashSearch(10*i); - if (mid != i) - printf("lhashSearch error - mid = %d\n", mid); - else - printf("lhashSearch oid = %d mid = %d\n",10*i, mid); - } - - i = lhashRemove(60); - if(i == 1) - printf("lhashRemove error "); - - for (i = 1; i <= 7; i++) { //Prints all left over elements inside hash after deletion and prints error if element not found in hash - mid = lhashSearch(10*i); - if (mid != i) - printf("lhashSearch error - mid = %d\n", mid); - else - printf("lhashSearch oid = %d mid = %d\n",10*i, mid); - } - - printf(" The total number of elements in table : %d\n", llookup.numelements); - -} diff --git a/Robust/src/Runtime/DSTM/interface/tests/testmlookup.c b/Robust/src/Runtime/DSTM/interface/tests/testmlookup.c deleted file mode 100644 index 3df89344..00000000 --- a/Robust/src/Runtime/DSTM/interface/tests/testmlookup.c +++ /dev/null @@ -1,45 +0,0 @@ -#include -#include "mlookup.h" -extern mhashtable_t mlookup; - -main() -{ - int i; - void *val; - val = NULL; - - if (mhashCreate(10, 0.20) == 1) { - printf("mhashCreate error\n"); //creates hashtable - } - for (i = 1; i <= 7; i++) { // Checks the insert() and resize() - if (mhashInsert(10*i, &i) == 1) - printf("mhashInsert error\n"); - } - - i = mhashRemove(60);//Delete first element in the hashtable - if(i == 1) - printf("mhashRemove error "); - - for (i = 1; i <=7; i++) { // Check if it can search for all oids in hash table - val = mhashSearch(10*i); - if (val != &i) - printf("mhashSearch error - val = %d\n", val); - else - printf("mhashSearch oid = %d val = %x\n",10*i, val); - } - - i = mhashRemove(30); - if(i == 1) - printf("mhashRemove error "); - - for (i = 1; i <= 7; i++) { //Prints all left over elements inside hash after deletion and prints error if element not found in hash - val = mhashSearch(10*i); - if (val != &i) - printf("mhashSearch error - val = %d\n", val); - else - printf("mhashSearch oid = %d val = %x\n",10*i, val); - } - - printf("The total number of elements in table : %d\n", mlookup.numelements); - -} diff --git a/Robust/src/Runtime/DSTM/interface/tests/testobjstr.c b/Robust/src/Runtime/DSTM/interface/tests/testobjstr.c deleted file mode 100644 index 6929c56e..00000000 --- a/Robust/src/Runtime/DSTM/interface/tests/testobjstr.c +++ /dev/null @@ -1,32 +0,0 @@ -#include "dstm.h" - -#define NUMITEMS 1000000 //uses four object stores - -int main(void) -{ - objstr_t *myObjStr = objstrCreate(1048510); - int i; - int *j[NUMITEMS]; - int data[NUMITEMS]; - int fail = 0; - - for (i = 0; i < NUMITEMS; i++) - { - j[i] = objstrAlloc(myObjStr, sizeof(int)); - *j[i] = data[i] = i; - } - for (i = 0; i < NUMITEMS; i++) - { - if (data[i] != *j[i]) - fail = 1; - } - - if (fail) - printf("test failed\n"); - else - printf("test succeeded\n"); - - objstrDelete(myObjStr); - return 0; -} - diff --git a/Robust/src/Runtime/DSTM/interface/tests/testserver.c b/Robust/src/Runtime/DSTM/interface/tests/testserver.c deleted file mode 100644 index 84b1abfe..00000000 --- a/Robust/src/Runtime/DSTM/interface/tests/testserver.c +++ /dev/null @@ -1,469 +0,0 @@ -#include -#include "dstm.h" -#include -#include -#include -#include "ip.h" - -extern objstr_t *mainobjstore; -typedef struct testobj1 { - int x; - char z; -} testobj1_t; - -typedef struct testobj2 { - char z[10]; - char c; - testobj1_t *y; -} testobj2_t; - -typedef struct testobj3 { - short p; - testobj1_t *q; - testobj2_t *r; -} testobj3_t; - -typedef struct testobj4 { - int b; - void *q; - testobj3_t *a; -} testobj4_t; - -typedef struct testobj5 { - testobj4_t *a; -} testobj5_t; - - -int classsize[]={sizeof(int),sizeof(char),sizeof(short), sizeof(void *), sizeof(testobj1_t), - sizeof(testobj2_t), sizeof(testobj3_t), sizeof(testobj4_t), sizeof(testobj5_t)}; - - -//int classsize[]={sizeof(int),sizeof(char),sizeof(short), sizeof(void *)}; - -int test1(void); -int test2(void); -int test3(void); - -unsigned int createObjects(transrecord_t *record, unsigned short type) { - objheader_t *header, *tmp; - struct sockaddr_in antelope; - unsigned int size, mid; - size = sizeof(objheader_t) + classsize[type] ; - //Inserts in chashtable - header = transCreateObj(record, type); - tmp = (objheader_t *) objstrAlloc(mainobjstore, size); - memcpy(tmp, header, size); - mhashInsert(tmp->oid, tmp); - mid = iptoMid("128.200.9.10"); - lhashInsert(tmp->oid, mid); - //Lock oid 3 object -// if(tmp->oid == 3) -// tmp->status |= LOCK; - return 0; -} - -void init_obj(objheader_t *h, unsigned int oid, unsigned short type, \ - unsigned short version,\ - unsigned short rcount, char status) { - h->oid = oid; - h->type = type; - h->version = version; - h->rcount = rcount; - h->status |= status; - return; -} - - -int main() -{ -// test1(); -// test3(); - test4(); -} - -int test1() -{ - unsigned int val; - transrecord_t *myTrans; - pthread_t thread_Listen; - - dstmInit(); - pthread_create(&thread_Listen, NULL, dstmListen, NULL); - // Start Transaction - myTrans = transStart(); - - printf("Creating Transaction\n"); - //Create Object1 - if((val = createObjects(myTrans, 0)) != 0) { - printf("Error transCreateObj1"); - } - //Create Object2 - if((val = createObjects(myTrans, 1)) != 0) { - printf("Error transCreateObj2"); - } - //Create Object3 - if((val = createObjects(myTrans, 2)) != 0) { - printf("Error transCreateObj3"); - } - //Create Object4 - if((val = createObjects(myTrans, 3)) != 0) { - printf("Error transCreateObj4"); - } - //Create Object5 - if((val = createObjects(myTrans, 0)) != 0) { - printf("Error transCreateObj5"); - } - //Create Object6 - if((val = createObjects(myTrans, 1)) != 0) { - printf("Error transCreateObj6"); - } - pthread_join(thread_Listen, NULL); - return 0; -} - -int test2() { - - unsigned int val, mid; - transrecord_t *myTrans; - pthread_t thread_Listen; - - dstmInit(); - mid = iptoMid("128.200.9.27"); //d-2.eecs.uci.edu - //Inserting into lhashtable - lhashInsert(20, mid); - lhashInsert(21, mid); - lhashInsert(22, mid); - lhashInsert(23, mid); - lhashInsert(30, mid); - lhashInsert(28, mid); - lhashInsert(29, mid); - pthread_create(&thread_Listen, NULL, dstmListen, NULL); - // Start Transaction - myTrans = transStart(); - - printf("Creating Transaction\n"); - //Create Object1 - if((val = createObjects(myTrans, 0)) != 0) { - printf("Error transCreateObj1"); - } - //Create Object2 - if((val = createObjects(myTrans, 1)) != 0) { - printf("Error transCreateObj2"); - } - //Create Object3 - if((val = createObjects(myTrans, 2)) != 0) { - printf("Error transCreateObj3"); - } - //Create Object4 - if((val = createObjects(myTrans, 3)) != 0) { - printf("Error transCreateObj4"); - } - //Create Object5 - if((val = createObjects(myTrans, 0)) != 0) { - printf("Error transCreateObj5"); - } - //Create Object6 - if((val = createObjects(myTrans, 1)) != 0) { - printf("Error transCreateObj6"); - } - pthread_join(thread_Listen, NULL); -} -//Commit transaction with all locally available objects -int test3() { - unsigned int val, mid; - transrecord_t *myTrans; - unsigned int size; - objheader_t *header; - pthread_t thread_Listen; - pthread_attr_t attr; - objheader_t *h1, *h2, *h3;//h1,h2,h3 from local - - dstmInit(); - pthread_attr_init(&attr); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); - - // Create and Insert Oid 1 - size = sizeof(objheader_t) + classsize[0] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - init_obj(header, 1, 0, 1, 0, NEW); - mhashInsert(header->oid, header); - mid = iptoMid("128.200.9.10"); - lhashInsert(header->oid, mid); - - // Create and Insert Oid 2 - size = sizeof(objheader_t) + classsize[1] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - init_obj(header, 2, 1, 1, 0, NEW); - mhashInsert(header->oid, header); - mid = iptoMid("128.200.9.10"); - lhashInsert(header->oid, mid); - - - // Create and Insert Oid 3 - size = sizeof(objheader_t) + classsize[2] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - init_obj(header, 3, 2, 1, 0, NEW); - mhashInsert(header->oid, header); - mid = iptoMid("128.200.9.10"); - lhashInsert(header->oid, mid); - - // Create and Insert Oid 4 - size = sizeof(objheader_t) + classsize[3] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - init_obj(header, 4, 3, 1, 0, NEW); - mhashInsert(header->oid, header); - mid = iptoMid("128.200.9.10"); - lhashInsert(header->oid, mid); - - //Inserting into lhashtable - mid = iptoMid("128.195.175.70"); //dw-2.eecs.uci.edu - lhashInsert(20, mid); - lhashInsert(21, mid); - lhashInsert(22, mid); - - mid = iptoMid("128.195.175.69"); //dw-1.eecs.uci.edu - //Inserting into lhashtable - lhashInsert(31, mid); - lhashInsert(32, mid); - lhashInsert(33, mid); - pthread_create(&thread_Listen, &attr, dstmListen, NULL); - - //Check if machine dw-1 is up and running - checkServer(mid, "128.195.175.69"); - mid = iptoMid("128.195.175.70"); - //Check if machine dw-2 is up and running - checkServer(mid, "128.195.175.70"); - - // Start Transaction - myTrans = transStart(); - - //read object 1(present in local machine) - if((h1 = transRead(myTrans, 1)) == NULL){ - printf("Object not found\n"); - } - //read object 2present in local machine) - if((h2 = transRead(myTrans, 2)) == NULL) { - printf("Object not found\n"); - } - //read object 3(present in local machine) - if((h3 = transRead(myTrans, 3)) == NULL) { - printf("Object not found\n"); - } - - // Commit transaction - transCommit(myTrans); - - pthread_join(thread_Listen, NULL); - - return 0; -} - -//Commit transaction with few locally available objects and other objects from machine d-1 -// and d-2 -int test4() { - - unsigned int val, mid; - transrecord_t *myTrans; - unsigned int size; - objheader_t *header; - pthread_t thread_Listen; - pthread_attr_t attr; - objheader_t *h1, *h2, *h3, *h4;//h1,h2 from local ; h3 from d-1 , h-4 from d-2 - - dstmInit(); - transInit(); - pthread_attr_init(&attr); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); - - // Create and Insert Oid 1 - size = sizeof(objheader_t) + classsize[0] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - init_obj(header, 1, 0, 1, 0, NEW); - mhashInsert(header->oid, header); - mid = iptoMid("128.200.9.10"); - lhashInsert(header->oid, mid); - - // Create and Insert Oid 2 - size = sizeof(objheader_t) + classsize[1] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - init_obj(header, 2, 1, 1, 0, NEW); - mhashInsert(header->oid, header); - mid = iptoMid("128.200.9.10"); - lhashInsert(header->oid, mid); - - - // Create and Insert Oid 3 - size = sizeof(objheader_t) + classsize[2] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - init_obj(header, 3, 2, 1, 0, NEW); - mhashInsert(header->oid, header); - mid = iptoMid("128.200.9.10"); - lhashInsert(header->oid, mid); - - // Create and Insert Oid 4 - size = sizeof(objheader_t) + classsize[3] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - init_obj(header, 4, 3, 1, 0, NEW); - mhashInsert(header->oid, header); - mid = iptoMid("128.200.9.10"); - lhashInsert(header->oid, mid); - - //Inserting into lhashtable - mid = iptoMid("128.195.175.70"); //dw-2.eecs.uci.edu - lhashInsert(20, mid); - lhashInsert(21, mid); - lhashInsert(22, mid); - - mid = iptoMid("128.195.175.69"); //dw-1.eecs.uci.edu - //Inserting into lhashtable - lhashInsert(31, mid); - lhashInsert(32, mid); - lhashInsert(33, mid); - - pthread_create(&thread_Listen, &attr, dstmListen, NULL); - //Check if machine dw-1 is up and running - checkServer(mid, "128.195.175.69"); - mid = iptoMid("128.195.175.70"); - //Check if machine dw-2 is up and running - checkServer(mid, "128.195.175.70"); - - // Start Transaction - myTrans = transStart(); - - //read object 1(present in local machine) - if((h1 = transRead(myTrans, 2)) == NULL){ - printf("Object not found\n"); - } - - //read object 2present in local machine) - if((h2 = transRead(myTrans, 1)) == NULL) { - printf("Object not found\n"); - } - //read object 31(present in dw-1 machine) - if((h3 = transRead(myTrans, 31)) == NULL) { - printf("Object not found\n"); - } - //read object 21(present in dw-2 machine) - if((h4 = transRead(myTrans, 21)) == NULL) { - printf("Object not found\n"); - } - - // Commit transaction - transCommit(myTrans); - - pthread_join(thread_Listen, NULL); - - return 0; -} -int test5() { - - unsigned int val, mid; - transrecord_t *myTrans; - unsigned int size; - objheader_t *header; - pthread_t thread_Listen; - pthread_attr_t attr; - objheader_t *h1, *h2, *h3, *h4, *h5; - - dstmInit(); - pthread_attr_init(&attr); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); - - mid = iptoMid("128.200.9.27"); //d-2.eecs.uci.edu - //Inserting into lhashtable - lhashInsert(20, mid); - lhashInsert(21, mid); - lhashInsert(22, mid); - - mid = iptoMid("128.200.9.26"); //d-1.eecs.uci.edu - //Inserting into lhashtable - lhashInsert(31, mid); - lhashInsert(32, mid); - lhashInsert(33, mid); - pthread_create(&thread_Listen, &attr, dstmListen, NULL); - - printf("DEBUG -> mid = %d\n", mid); - checkServer(mid, "128.200.9.26"); - mid = iptoMid("128.200.9.27"); - printf("DEBUG -> mid = %d\n", mid); - checkServer(mid, "128.200.9.27"); - - // Start Transaction - myTrans = transStart(); - - // Create and Insert Oid 1 - size = sizeof(objheader_t) + classsize[0] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - init_obj(header, 1, 0, 1, 0, NEW); - mhashInsert(header->oid, header); - mid = iptoMid("128.200.9.10"); - lhashInsert(header->oid, mid); - - // Create and Insert Oid 2 - size = sizeof(objheader_t) + classsize[1] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - init_obj(header, 2, 1, 1, 0, NEW); - mhashInsert(header->oid, header); - mid = iptoMid("128.200.9.10"); - lhashInsert(header->oid, mid); - - - // Create and Insert Oid 3 - size = sizeof(objheader_t) + classsize[2] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - init_obj(header, 3, 2, 1, 0, NEW); - mhashInsert(header->oid, header); - mid = iptoMid("128.200.9.10"); - lhashInsert(header->oid, mid); - - // Create and Insert Oid 4 - size = sizeof(objheader_t) + classsize[3] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - init_obj(header, 4, 3, 1, 0, NEW); - mhashInsert(header->oid, header); - mid = iptoMid("128.200.9.10"); - lhashInsert(header->oid, mid); - - // Create and Insert Oid 5 - size = sizeof(objheader_t) + classsize[0] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - init_obj(header, 5, 0, 1, 0, NEW); - mhashInsert(header->oid, header); - mid = iptoMid("128.200.9.10"); - lhashInsert(header->oid, mid); - - // Create and Insert Oid 6 - size = sizeof(objheader_t) + classsize[1] ; - header = (objheader_t *) objstrAlloc(mainobjstore, size); - init_obj(header, 6, 1, 1, 0, NEW); - mhashInsert(header->oid, header); - mid = iptoMid("128.200.9.10"); - lhashInsert(header->oid, mid); - - //read object 1(present in local machine) - if((h1 = transRead(myTrans, 1)) == NULL){ - printf("Object not found\n"); - } - //read object 2present in local machine) - if((h2 = transRead(myTrans, 2)) == NULL) { - printf("Object not found\n"); - } - //read object 3(present in local machine) - if((h3 = transRead(myTrans, 3)) == NULL) { - printf("Object not found\n"); - } - //read object 31 (present in d-1. eecs) - if((h4 = transRead(myTrans, 31)) == NULL) { - printf("Object not found\n"); - } - //read object 20 (present in d-2. eecs) - if((h5 = transRead(myTrans, 20)) == NULL) { - printf("Object not found\n"); - } - - transCommit(myTrans); - - pthread_join(thread_Listen, NULL); - - return 0; -} diff --git a/Robust/src/Runtime/DSTM/interface/threadnotify.c b/Robust/src/Runtime/DSTM/interface/threadnotify.c deleted file mode 100644 index 9ff506e4..00000000 --- a/Robust/src/Runtime/DSTM/interface/threadnotify.c +++ /dev/null @@ -1,220 +0,0 @@ -#include "threadnotify.h" - -notifyhashtable_t nlookup; //Global hash table - -/* This function creates a new node in the linked list of threads waiting - * for an update notification from a particular object. - * This takes in the head of the linked list and inserts the new node to it */ -threadlist_t *insNode(threadlist_t *head, unsigned int threadid, unsigned int mid) { - threadlist_t *ptr; - if(head == NULL) { - head = malloc(sizeof(threadlist_t)); - head->threadid = threadid; - head->mid = mid; - head->next = NULL; - } else { - ptr = malloc(sizeof(threadlist_t)); - ptr->threadid = threadid; - ptr->mid = mid; - ptr->next = head; - head = ptr; - } - return head; -} - -/* This function displays the linked list of threads waiting on update notification - * from an object */ -void display(threadlist_t *head) { - threadlist_t *ptr; - if(head == NULL) { - printf("No thread is waiting\n"); - return; - } else { - while(head != NULL) { - ptr = head; - printf("The threadid waiting is = %d\n", ptr->threadid); - printf("The mid on which thread present = %d\n", ptr->mid); - head = ptr->next; - } - } -} - -/* This function creates a new hash table that stores a mapping between the threadid and - * a pointer to the thread notify data */ -unsigned int notifyhashCreate(unsigned int size, float loadfactor) { - notifylistnode_t *nodes = calloc(size, sizeof(notifylistnode_t)); - nlookup.table = nodes; - nlookup.size = size; - nlookup.numelements = 0; // Initial number of elements in the hash - nlookup.loadfactor = loadfactor; - //Initialize the pthread_mutex variable - pthread_mutex_init(&nlookup.locktable, NULL); - return 0; -} - -// Assign to tids to bins inside hash table -unsigned int notifyhashFunction(unsigned int tid) { - return( tid % (nlookup.size)); -} - -// Insert pointer to the notify data and threadid mapping into the hash table -unsigned int notifyhashInsert(unsigned int tid, notifydata_t *ndata) { - unsigned int newsize; - int index; - notifylistnode_t *ptr, *node, *tmp; - int isFound = 0; - - if (nlookup.numelements > (nlookup.loadfactor * nlookup.size)) { - //Resize Table - newsize = 2 * nlookup.size + 1; - pthread_mutex_lock(&nlookup.locktable); - notifyhashResize(newsize); - pthread_mutex_unlock(&nlookup.locktable); - } - ptr = nlookup.table; - index = notifyhashFunction(tid); - pthread_mutex_lock(&nlookup.locktable); - if(ptr[index].next == NULL && ptr[index].threadid == 0) { - // Insert at the first position in the hashtable - ptr[index].threadid = tid; - ptr[index].ndata = ndata; - } else { - tmp = &ptr[index]; - while(tmp != NULL) { - if(tmp->threadid == tid) { - isFound = 1; - tmp->ndata = ndata; - } - tmp = tmp->next; - } - if(!isFound) { - if ((node = calloc(1, sizeof(notifylistnode_t))) == NULL) { - printf("Calloc error %s, %d\n", __FILE__, __LINE__); - pthread_mutex_unlock(&nlookup.locktable); - return 1; - } - node->threadid = tid; - node->ndata = ndata; - node->next = ptr[index].next; - ptr[index].next = node; - } - } - pthread_mutex_unlock(&nlookup.locktable); - - return 0; -} - -// Return pointer to thread notify data for a given threadid in the hash table -notifydata_t *notifyhashSearch(unsigned int tid) { - // Address of the beginning of hash table - notifylistnode_t *ptr = nlookup.table; - int index = notifyhashFunction(tid); - pthread_mutex_lock(&nlookup.locktable); - notifylistnode_t * node = &ptr[index]; - while(node != NULL) { - if(node->threadid == tid) { - pthread_mutex_unlock(&nlookup.locktable); - return node->ndata; - } - node = node->next; - } - pthread_mutex_unlock(&nlookup.locktable); - return NULL; -} - -// Remove an entry from the hash table -unsigned int notifyhashRemove(unsigned int tid) { - notifylistnode_t *curr, *prev, *node; - - notifylistnode_t *ptr = nlookup.table; - int index = notifyhashFunction(tid); - - pthread_mutex_lock(&nlookup.locktable); - for (curr = &ptr[index]; curr != NULL; curr = curr->next) { - if (curr->threadid == tid) { // Find a match in the hash table - nlookup.numelements--; // Decrement the number of elements in the global hashtable - if ((curr == &ptr[index]) && (curr->next == NULL)) { // Delete the first item inside the hashtable with no linked list of notifylistnode_t - curr->threadid = 0; - curr->ndata = NULL; - } else if ((curr == &ptr[index]) && (curr->next != NULL)) { //Delete the first bin item with a linked list of notifylistnode_t connected - curr->threadid = curr->next->threadid; - curr->ndata = curr->next->ndata; - node = curr->next; - curr->next = curr->next->next; - free(node); - } else { // Regular delete from linked listed - prev->next = curr->next; - free(curr); - } - pthread_mutex_unlock(&nlookup.locktable); - return 0; - } - prev = curr; - } - pthread_mutex_unlock(&nlookup.locktable); - return 1; -} - -// Resize table -unsigned int notifyhashResize(unsigned int newsize) { - notifylistnode_t *node, *ptr, *curr, *next; // curr and next keep track of the current and the next notifyhashlistnodes in a linked list - unsigned int oldsize; - int isfirst; // Keeps track of the first element in the notifylistnode_t for each bin in hashtable - int i,index; - notifylistnode_t *newnode; - - ptr = nlookup.table; - oldsize = nlookup.size; - - if((node = calloc(newsize, sizeof(notifylistnode_t))) == NULL) { - printf("Calloc error %s %d\n", __FILE__, __LINE__); - return 1; - } - - nlookup.table = node; //Update the global hashtable upon resize() - nlookup.size = newsize; - nlookup.numelements = 0; - - for(i = 0; i < oldsize; i++) { //Outer loop for each bin in hash table - curr = &ptr[i]; - isfirst = 1; - while (curr != NULL) { //Inner loop to go through linked lists - if (curr->threadid == 0) { //Exit inner loop if there the first element for a given bin/index is NULL - break; //threadid = threadcond =0 for element if not present within the hash table - } - next = curr->next; - index = notifyhashFunction(curr->threadid); -#ifdef DEBUG - printf("DEBUG(resize) -> index = %d, threadid = %d\n", index, curr->threadid); -#endif - // Insert into the new table - if(nlookup.table[index].next == NULL && nlookup.table[index].threadid == 0) { - nlookup.table[index].threadid = curr->threadid; - nlookup.table[index].ndata = curr->ndata; - nlookup.numelements++; - }else { - if((newnode = calloc(1, sizeof(notifylistnode_t))) == NULL) { - printf("Calloc error %s, %d\n", __FILE__, __LINE__); - return 1; - } - newnode->threadid = curr->threadid; - newnode->ndata = curr->ndata; - newnode->next = nlookup.table[index].next; - nlookup.table[index].next = newnode; - nlookup.numelements++; - } - - //free the linked list of notifylistnode_t if not the first element in the hash table - if (isfirst != 1) { - free(curr); - } - - isfirst = 0; - curr = next; - } - } - - free(ptr); //Free the memory of the old hash table - ptr = NULL; - return 0; -} diff --git a/Robust/src/Runtime/DSTM/interface/threadnotify.h b/Robust/src/Runtime/DSTM/interface/threadnotify.h deleted file mode 100644 index 7ed1c7a0..00000000 --- a/Robust/src/Runtime/DSTM/interface/threadnotify.h +++ /dev/null @@ -1,52 +0,0 @@ -#ifndef _THREADNOTIFY_H_ -#define _THREADNOTIFY_H_ - -#include -#include -#include - -#define N_LOADFACTOR 0.5 -#define N_HASH_SIZE 20 - -//Structure to notify object of which other objects/threads are waiting on it -typedef struct threadlist { - unsigned int threadid; - unsigned int mid; - struct threadlist *next; -} threadlist_t; - -//Structure for objects involved in wait-notify call -typedef struct notifydata { - unsigned int numoid; /* Number of oids on which we are waiting for updated notification */ - unsigned int threadid; /* The threadid that is waiting for update notification response*/ - unsigned int *oidarry; /* Pointer to array of oids that this threadid is waiting on*/ - unsigned short *versionarry;/* Pointer to array of versions of the oids that we are waiting on */ - pthread_cond_t threadcond; /* Cond variable associated with each threadid that needs to be signaled*/ - pthread_mutex_t threadnotify; -}notifydata_t; - -typedef struct notifylistnode { - unsigned int threadid; - notifydata_t *ndata; - struct notifylistnode *next; -} notifylistnode_t; - -typedef struct notifyhashtable { - notifylistnode_t *table; //Points to beginning of hash table - unsigned int size; - unsigned int numelements; - float loadfactor; - pthread_mutex_t locktable; //Lock for the hashtable -} notifyhashtable_t; - -threadlist_t *insNode(threadlist_t *head, unsigned int threadid, unsigned int mid); //Inserts nodes for one object that - //needs to send notification to threads waiting on it -void display(threadlist_t *head);// Displays linked list of nodes for one object -unsigned int notifyhashCreate(unsigned int size, float loadfactor); //returns 1 if hashtable creation is not successful -unsigned int notifyhashFunction(unsigned int tid); //returns index in the hash table -unsigned int notifyhashInsert(unsigned int tid, notifydata_t *ndata); //returns 1 if insert not successful -notifydata_t *notifyhashSearch(unsigned int tid); //returns pointer to notify data, NULL if not found -unsigned int notifyhashRemove(unsigned int tid); //returns 1 if not successful -unsigned int notifyhashResize(unsigned int newsize); - -#endif diff --git a/Robust/src/Runtime/DSTM/interface/trans.c b/Robust/src/Runtime/DSTM/interface/trans.c deleted file mode 100644 index c0dfe4e5..00000000 --- a/Robust/src/Runtime/DSTM/interface/trans.c +++ /dev/null @@ -1,1873 +0,0 @@ -#include "dstm.h" -#include "ip.h" -#include "machinepile.h" -#include "mlookup.h" -#include "llookup.h" -#include "plookup.h" -#include "prelookup.h" -#include "threadnotify.h" -#include "queue.h" -#include "addUdpEnhance.h" -#include "addPrefetchEnhance.h" -#include "gCollect.h" -#ifdef COMPILER -#include "thread.h" -#endif - -#define NUM_THREADS 1 -#define PREFETCH_CACHE_SIZE 1048576 //1MB -#define CONFIG_FILENAME "dstm.conf" - -/* Global Variables */ -extern int classsize[]; -pfcstats_t *evalPrefetch; -objstr_t *prefetchcache; //Global Prefetch cache -pthread_mutex_t prefetchcache_mutex;// Mutex to lock Prefetch Cache -pthread_mutexattr_t prefetchcache_mutex_attr; /* Attribute for lock to make it a recursive lock */ -extern pthread_mutex_t mainobjstore_mutex;// Mutex to lock main Object store -extern prehashtable_t pflookup; //Global Prefetch cache's lookup table -pthread_t wthreads[NUM_THREADS]; //Worker threads for working on the prefetch queue -pthread_t tPrefetch; /* Primary Prefetch thread that processes the prefetch queue */ -extern objstr_t *mainobjstore; -unsigned int myIpAddr; -unsigned int *hostIpAddrs; -int sizeOfHostArray; -int numHostsInSystem; -int myIndexInHostArray; -unsigned int oidsPerBlock; -unsigned int oidMin; -unsigned int oidMax; - -sockPoolHashTable_t *transReadSockPool; -sockPoolHashTable_t *transPrefetchSockPool; -sockPoolHashTable_t *transRequestSockPool; -pthread_mutex_t notifymutex; -pthread_mutex_t atomicObjLock; - -/*********************************** - * Global Variables for statistics - **********************************/ -int numTransCommit = 0; -int numTransAbort = 0; -int nchashSearch = 0; -int nmhashSearch = 0; -int nprehashSearch = 0; -int nRemoteSend = 0; - -void printhex(unsigned char *, int); -plistnode_t *createPiles(transrecord_t *); - -/******************************* - * Send and Recv function calls - *******************************/ -void send_data(int fd , void *buf, int buflen) { - char *buffer = (char *)(buf); - int size = buflen; - int numbytes; - while (size > 0) { - numbytes = send(fd, buffer, size, MSG_NOSIGNAL); - if (numbytes == -1) { - perror("send"); - return; - } - buffer += numbytes; - size -= numbytes; - } -} - -void recv_data(int fd , void *buf, int buflen) { - char *buffer = (char *)(buf); - int size = buflen; - int numbytes; - while (size > 0) { - numbytes = recv(fd, buffer, size, 0); - if (numbytes == -1) { - perror("recv"); - return; - } - buffer += numbytes; - size -= numbytes; - } -} - -int recv_data_errorcode(int fd , void *buf, int buflen) { - char *buffer = (char *)(buf); - int size = buflen; - int numbytes; - while (size > 0) { - numbytes = recv(fd, buffer, size, 0); - if (numbytes==0) - return 0; - if (numbytes == -1) { - perror("recv"); - return -1; - } - buffer += numbytes; - size -= numbytes; - } - return 1; -} - -void printhex(unsigned char *ptr, int numBytes) { - int i; - for (i = 0; i < numBytes; i++) { - if (ptr[i] < 16) - printf("0%x ", ptr[i]); - else - printf("%x ", ptr[i]); - } - printf("\n"); - return; -} - -inline int arrayLength(int *array) { - int i; - for(i=0 ;array[i] != -1; i++) - ; - return i; -} - -inline int findmax(int *array, int arraylength) { - int max, i; - max = array[0]; - for(i = 0; i < arraylength; i++){ - if(array[i] > max) { - max = array[i]; - } - } - return max; -} - -/* This function is a prefetch call generated by the compiler that - * populates the shared primary prefetch queue*/ -void prefetch(int siteid, int ntuples, unsigned int *oids, unsigned short *endoffsets, short *arrayfields) { - /* Allocate for the queue node*/ - int qnodesize = 2*sizeof(int) + ntuples * (sizeof(unsigned short) + sizeof(unsigned int)) + endoffsets[ntuples - 1] * sizeof(short); - int len; - char * node= getmemory(qnodesize); - int top=endoffsets[ntuples-1]; - - if (node==NULL) - return; - /* Set queue node values */ - - /* TODO: Remove this after testing */ - evalPrefetch[siteid].callcount++; - - *((int *)(node))=siteid; - *((int *)(node + sizeof(int))) = ntuples; - len = 2*sizeof(int); - memcpy(node+len, oids, ntuples*sizeof(unsigned int)); - memcpy(node+len+ntuples*sizeof(unsigned int), endoffsets, ntuples*sizeof(unsigned short)); - memcpy(node+len+ntuples*(sizeof(unsigned int)+sizeof(short)), arrayfields, top*sizeof(short)); - - /* Lock and insert into primary prefetch queue */ - movehead(qnodesize); -} - -/* This function starts up the transaction runtime. */ -int dstmStartup(const char * option) { - pthread_t thread_Listen, udp_thread_Listen; - pthread_attr_t attr; - int master=option!=NULL && strcmp(option, "master")==0; - int fd; - int udpfd; - - if (processConfigFile() != 0) - return 0; //TODO: return error value, cause main program to exit -#ifdef COMPILER - if (!master) - threadcount--; -#endif - -#ifdef TRANSSTATS - printf("Trans stats is on\n"); - fflush(stdout); -#endif - - //Initialize socket pool - transReadSockPool = createSockPool(transReadSockPool, 2*numHostsInSystem+1); - transPrefetchSockPool = createSockPool(transPrefetchSockPool, 2*numHostsInSystem+1); - transRequestSockPool = createSockPool(transRequestSockPool, 2*numHostsInSystem+1); - - dstmInit(); - transInit(); - - fd=startlistening(); - udpfd = udpInit(); - pthread_attr_init(&attr); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); - pthread_create(&udp_thread_Listen, &attr, udpListenBroadcast, (void*)udpfd); - if (master) { - pthread_create(&thread_Listen, &attr, dstmListen, (void*)fd); - return 1; - } else { - dstmListen((void *)fd); - return 0; - } -} - -//TODO Use this later -void *pCacheAlloc(objstr_t *store, unsigned int size) { - void *tmp; - objstr_t *ptr; - ptr = store; - int success = 0; - - while(ptr->next != NULL) { - /* check if store is empty */ - if(((unsigned int)ptr->top - (unsigned int)ptr - sizeof(objstr_t) + size) <= ptr->size) { - tmp = ptr->top; - ptr->top += size; - success = 1; - return tmp; - } else { - ptr = ptr-> next; - } - } - - if(success == 0) { - return NULL; - } -} - -/* This function initiates the prefetch thread A queue is shared - * between the main thread of execution and the prefetch thread to - * process the prefetch call Call from compiler populates the shared - * queue with prefetch requests while prefetch thread processes the - * prefetch requests */ - -void transInit() { - int t, rc; - int retval; - //Create and initialize prefetch cache structure - prefetchcache = objstrCreate(PREFETCH_CACHE_SIZE); - initializePCache(); - if((evalPrefetch = initPrefetchStats()) == NULL) { - printf("%s() Error allocating memory at %s, %d\n", __func__, __FILE__, __LINE__); - exit(0); - } - - /* Initialize attributes for mutex */ - pthread_mutexattr_init(&prefetchcache_mutex_attr); - pthread_mutexattr_settype(&prefetchcache_mutex_attr, PTHREAD_MUTEX_RECURSIVE_NP); - - pthread_mutex_init(&prefetchcache_mutex, &prefetchcache_mutex_attr); - - pthread_mutex_init(¬ifymutex, NULL); - pthread_mutex_init(&atomicObjLock, NULL); - //Create prefetch cache lookup table - if(prehashCreate(HASH_SIZE, LOADFACTOR)) { - printf("ERROR\n"); - return; //Failure - } - - //Initialize primary shared queue - queueInit(); - //Initialize machine pile w/prefetch oids and offsets shared queue - mcpileqInit(); - - //Create the primary prefetch thread - do { - retval=pthread_create(&tPrefetch, NULL, transPrefetch, NULL); - } while(retval!=0); - pthread_detach(tPrefetch); -} - -/* This function stops the threads spawned */ -void transExit() { - int t; - pthread_cancel(tPrefetch); - for(t = 0; t < NUM_THREADS; t++) - pthread_cancel(wthreads[t]); - - return; -} - -/* This functions inserts randowm wait delays in the order of msec - * Mostly used when transaction commits retry*/ -void randomdelay() { - struct timespec req; - time_t t; - - t = time(NULL); - req.tv_sec = 0; - req.tv_nsec = (long)(1000000 + (t%10000000)); //1-11 msec - nanosleep(&req, NULL); - return; -} - -/* This function initializes things required in the transaction start*/ -transrecord_t *transStart() { - transrecord_t *tmp; - if((tmp = calloc(1, sizeof(transrecord_t))) == NULL){ - printf("%s() Calloc error at line %d, %s\n", __func__, __LINE__, __FILE__); - return NULL; - } - tmp->cache = objstrCreate(1048576); - tmp->lookupTable = chashCreate(CHASH_SIZE, CLOADFACTOR); -#ifdef COMPILER - tmp->revertlist=NULL; -#endif - return tmp; -} - -/* This function finds the location of the objects involved in a transaction - * and returns the pointer to the object if found in a remote location */ -objheader_t *transRead(transrecord_t *record, unsigned int oid) { - unsigned int machinenumber; - objheader_t *tmp, *objheader; - objheader_t *objcopy; - int size; - void *buf; - - if(oid == 0) { - return NULL; - } - - if((objheader = chashSearch(record->lookupTable, oid)) != NULL){ -#ifdef TRANSSTATS - nchashSearch++; -#endif - /* Search local transaction cache */ -#ifdef COMPILER - return &objheader[1]; -#else - return objheader; -#endif - } else if ((objheader = (objheader_t *) mhashSearch(oid)) != NULL) { -#ifdef TRANSSTATS - nmhashSearch++; -#endif - /* Look up in machine lookup table and copy into cache*/ - GETSIZE(size, objheader); - size += sizeof(objheader_t); - objcopy = (objheader_t *) objstrAlloc(record->cache, size); - memcpy(objcopy, objheader, size); - /* Insert into cache's lookup table */ - STATUS(objcopy)=0; - chashInsert(record->lookupTable, OID(objheader), objcopy); -#ifdef COMPILER - return &objcopy[1]; -#else - return objcopy; -#endif - } else if((tmp = (objheader_t *) prehashSearch(oid)) != NULL) { -#ifdef TRANSSTATS - nprehashSearch++; -#endif -#ifdef CHECKTA - printf("Prefetch cache read, oid = %x, oidtype =%d\n", oid, TYPE(tmp)); - fflush(stdout); -#endif - /* Look up in prefetch cache */ - GETSIZE(size, tmp); - size+=sizeof(objheader_t); - objcopy = (objheader_t *) objstrAlloc(record->cache, size); - memcpy(objcopy, tmp, size); - /* Insert into cache's lookup table */ - chashInsert(record->lookupTable, OID(tmp), objcopy); -#ifdef COMPILER - return &objcopy[1]; -#else - return objcopy; -#endif - } else { - /* Get the object from the remote location */ - if((machinenumber = lhashSearch(oid)) == 0) { - printf("Error: %s() No machine found for oid =% %s,%dx\n",__func__, machinenumber, __FILE__, __LINE__); - return NULL; - } - objcopy = getRemoteObj(record, machinenumber, oid); - - if(objcopy == NULL) { - printf("Error: Object not found in Remote location %s, %d\n", __FILE__, __LINE__); - return NULL; - } else { -#ifdef TRANSSTATS - nRemoteSend++; -#endif -#ifdef CHECKTA - printf("Remote read, oid = %x, oidtype =%d\n", oid, TYPE(objcopy)); - fflush(stdout); -#endif - STATUS(objcopy)=0; -#ifdef COMPILER - return &objcopy[1]; -#else - return objcopy; -#endif - } - } -} - -/* This function creates objects in the transaction record */ -objheader_t *transCreateObj(transrecord_t *record, unsigned int size) { - objheader_t *tmp = (objheader_t *) objstrAlloc(record->cache, (sizeof(objheader_t) + size)); - OID(tmp) = getNewOID(); - tmp->version = 1; - tmp->rcount = 1; - STATUS(tmp) = NEW; - chashInsert(record->lookupTable, OID(tmp), tmp); - -#ifdef COMPILER - return &tmp[1]; //want space after object header -#else - return tmp; -#endif -} - -/* This function creates machine piles based on all machines involved in a - * transaction commit request */ -plistnode_t *createPiles(transrecord_t *record) { - int i; - plistnode_t *pile = NULL; - unsigned int machinenum; - objheader_t *headeraddr; - chashlistnode_t * ptr = record->lookupTable->table; - /* Represents number of bins in the chash table */ - unsigned int size = record->lookupTable->size; - - for(i = 0; i < size ; i++) { - chashlistnode_t * curr = &ptr[i]; - /* Inner loop to traverse the linked list of the cache lookupTable */ - while(curr != NULL) { - //if the first bin in hash table is empty - if(curr->key == 0) - break; - - if ((headeraddr = (objheader_t *) chashSearch(record->lookupTable, curr->key)) == NULL) { - printf("Error: No such oid %s, %d\n", __FILE__, __LINE__); - return NULL; - } - - //Get machine location for object id (and whether local or not) - if (STATUS(headeraddr) & NEW || (mhashSearch(curr->key) != NULL)) { - machinenum = myIpAddr; - } else if ((machinenum = lhashSearch(curr->key)) == 0) { - printf("Error: No such machine %s, %d\n", __FILE__, __LINE__); - return NULL; - } - - //Make machine groups - pile = pInsert(pile, headeraddr, machinenum, record->lookupTable->numelements); - curr = curr->next; - } - } - return pile; -} - -/* This function initiates the transaction commit process - * Spawns threads for each of the new connections with Participants - * and creates new piles by calling the createPiles(), - * Sends a transrequest() to each remote machines for objects found remotely - * and calls handleLocalReq() to process objects found locally */ -int transCommit(transrecord_t *record) { - unsigned int tot_bytes_mod, *listmid; - plistnode_t *pile, *pile_ptr; - int i, j, rc, val; - int pilecount, offset, threadnum, trecvcount; - char control; - char transid[TID_LEN]; - trans_req_data_t *tosend; - trans_commit_data_t transinfo; - static int newtid = 0; - char treplyctrl, treplyretry; /* keeps track of the common response that needs to be sent */ - thread_data_array_t *thread_data_array; - local_thread_data_array_t *ltdata; - int firsttime=1; - - do { - treplyctrl=0; - trecvcount = 0; - threadnum = 0; - treplyretry = 0; - thread_data_array = NULL; - ltdata = NULL; - - /* Look through all the objects in the transaction record and make piles - * for each machine involved in the transaction*/ - if (firsttime) - pile_ptr = pile = createPiles(record); - else - pile=pile_ptr; - firsttime=0; - - /* Create the packet to be sent in TRANS_REQUEST */ - - /* Count the number of participants */ - pilecount = pCount(pile); - - /* Create a list of machine ids(Participants) involved in transaction */ - listmid = calloc(pilecount, sizeof(unsigned int)); - pListMid(pile, listmid); - - - /* Initialize thread variables, - * Spawn a thread for each Participant involved in a transaction */ - pthread_t thread[pilecount]; - pthread_attr_t attr; - pthread_cond_t tcond; - pthread_mutex_t tlock; - pthread_mutex_t tlshrd; - - thread_data_array = (thread_data_array_t *) calloc(pilecount, sizeof(thread_data_array_t)); - ltdata = calloc(1, sizeof(local_thread_data_array_t)); - - thread_response_t rcvd_control_msg[pilecount]; /* Shared thread array that keeps track of responses of participants */ - - /* Initialize and set thread detach attribute */ - pthread_attr_init(&attr); - pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE); - pthread_mutex_init(&tlock, NULL); - pthread_cond_init(&tcond, NULL); - - /* Process each machine pile */ - while(pile != NULL) { - //Create transaction id - newtid++; - tosend = calloc(1, sizeof(trans_req_data_t)); - tosend->f.control = TRANS_REQUEST; - sprintf(tosend->f.trans_id, "%x_%d", pile->mid, newtid); - tosend->f.mcount = pilecount; - tosend->f.numread = pile->numread; - tosend->f.nummod = pile->nummod; - tosend->f.numcreated = pile->numcreated; - tosend->f.sum_bytes = pile->sum_bytes; - tosend->listmid = listmid; - tosend->objread = pile->objread; - tosend->oidmod = pile->oidmod; - tosend->oidcreated = pile->oidcreated; - thread_data_array[threadnum].thread_id = threadnum; - thread_data_array[threadnum].mid = pile->mid; - thread_data_array[threadnum].buffer = tosend; - thread_data_array[threadnum].recvmsg = rcvd_control_msg; - thread_data_array[threadnum].threshold = &tcond; - thread_data_array[threadnum].lock = &tlock; - thread_data_array[threadnum].count = &trecvcount; - thread_data_array[threadnum].replyctrl = &treplyctrl; - thread_data_array[threadnum].replyretry = &treplyretry; - thread_data_array[threadnum].rec = record; - /* If local do not create any extra connection */ - if(pile->mid != myIpAddr) { /* Not local */ - do { - rc = pthread_create(&thread[threadnum], &attr, transRequest, (void *) &thread_data_array[threadnum]); - } while(rc!=0); - if(rc) { - perror("Error in pthread create\n"); - pthread_cond_destroy(&tcond); - pthread_mutex_destroy(&tlock); - pDelete(pile_ptr); - free(listmid); - for (i = 0; i < threadnum; i++) - free(thread_data_array[i].buffer); - free(thread_data_array); - free(ltdata); - return 1; - } - } else { /*Local*/ - ltdata->tdata = &thread_data_array[threadnum]; - ltdata->transinfo = &transinfo; - do { - val = pthread_create(&thread[threadnum], &attr, handleLocalReq, (void *) ltdata); - } while(val!=0); - if(val) { - perror("Error in pthread create\n"); - pthread_cond_destroy(&tcond); - pthread_mutex_destroy(&tlock); - pDelete(pile_ptr); - free(listmid); - for (i = 0; i < threadnum; i++) - free(thread_data_array[i].buffer); - free(thread_data_array); - free(ltdata); - return 1; - } - } - - threadnum++; - pile = pile->next; - } - /* Free attribute and wait for the other threads */ - pthread_attr_destroy(&attr); - - for (i = 0; i < threadnum; i++) { - rc = pthread_join(thread[i], NULL); - if(rc) - { - printf("Error: return code from pthread_join() is %d\n", rc); - pthread_cond_destroy(&tcond); - pthread_mutex_destroy(&tlock); - pDelete(pile_ptr); - free(listmid); - for (j = i; j < threadnum; j++) { - free(thread_data_array[j].buffer); - } - return 1; - } - free(thread_data_array[i].buffer); - } - - /* Free resources */ - pthread_cond_destroy(&tcond); - pthread_mutex_destroy(&tlock); - free(listmid); - - if (!treplyretry) - pDelete(pile_ptr); - - /* wait a random amount of time before retrying to commit transaction*/ - if(treplyretry) { - free(thread_data_array); - free(ltdata); - randomdelay(); - } - - /* Retry trans commit procedure during soft_abort case */ - } while (treplyretry); - - if(treplyctrl == TRANS_ABORT) { -#ifdef TRANSSTATS - numTransAbort++; -#endif -#ifdef CHECKTA - char a[] = "Aborting"; - TABORT1(a); -#endif - /* Free Resources */ - objstrDelete(record->cache); - chashDelete(record->lookupTable); - free(record); - free(thread_data_array); - free(ltdata); - return TRANS_ABORT; - } else if(treplyctrl == TRANS_COMMIT) { -#ifdef TRANSSTATS - numTransCommit++; -#endif -#ifdef CHECKTA - char a[] = "Commiting"; - TABORT1(a); -#endif - /* Free Resources */ - objstrDelete(record->cache); - chashDelete(record->lookupTable); - free(record); - free(thread_data_array); - free(ltdata); - return 0; - } else { - //TODO Add other cases - printf("Error: in %s() THIS SHOULD NOT HAPPEN.....EXIT PROGRAM\n", __func__); - exit(-1); - } - return 0; -} - -/* This function sends information involved in the transaction request - * to participants and accepts a response from particpants. - * It calls decideresponse() to decide on what control message - * to send next to participants and sends the message using sendResponse()*/ -void *transRequest(void *threadarg) { - int sd, i, n; - struct sockaddr_in serv_addr; - thread_data_array_t *tdata; - objheader_t *headeraddr; - char control, recvcontrol; - char machineip[16], retval; - - tdata = (thread_data_array_t *) threadarg; - - if((sd = getSock2WithLock(transRequestSockPool, tdata->mid)) < 0) { - printf("transRequest(): socket create error\n"); - pthread_exit(NULL); - } - - /* Send bytes of data with TRANS_REQUEST control message */ - send_data(sd, &(tdata->buffer->f), sizeof(fixed_data_t)); - - /* Send list of machines involved in the transaction */ - { - int size=sizeof(unsigned int)*tdata->buffer->f.mcount; - send_data(sd, tdata->buffer->listmid, size); - } - - /* Send oids and version number tuples for objects that are read */ - { - int size=(sizeof(unsigned int)+sizeof(unsigned short))*tdata->buffer->f.numread; - send_data(sd, tdata->buffer->objread, size); - } - - /* Send objects that are modified */ - for(i = 0; i < tdata->buffer->f.nummod ; i++) { - int size; - if((headeraddr = chashSearch(tdata->rec->lookupTable, tdata->buffer->oidmod[i])) == NULL) { - printf("%s() Error: No such oid %s, %d\n", __func__, __FILE__, __LINE__); - pthread_exit(NULL); - } - GETSIZE(size,headeraddr); - size+=sizeof(objheader_t); - send_data(sd, headeraddr, size); - } - - /* Read control message from Participant */ - recv_data(sd, &control, sizeof(char)); - /* Recv Objects if participant sends TRANS_DISAGREE */ - if(control == TRANS_DISAGREE) { - int length; - recv_data(sd, &length, sizeof(int)); - void *newAddr; - pthread_mutex_lock(&prefetchcache_mutex); - if ((newAddr = prefetchobjstrAlloc((unsigned int)length)) == NULL) { - printf("Error: %s() objstrAlloc error for copying into prefetch cache %s, %d\n", __func__, __FILE__, __LINE__); - pthread_exit(NULL); - } - pthread_mutex_unlock(&prefetchcache_mutex); - recv_data(sd, newAddr, length); - int offset = 0; - while(length != 0) { - unsigned int oidToPrefetch; - objheader_t * header; - header = (objheader_t *) (((char *)newAddr) + offset); - oidToPrefetch = OID(header); -#ifdef CHECKTA - printf("Trans disagree for oid = %x: ", OID(header)); - char a[] = "object type"; - TABORT8(__func__, a, TYPE(header)); -#endif - int size = 0; - GETSIZE(size, header); - size += sizeof(objheader_t); - //make an entry in prefetch hash table - void *oldptr; - if((oldptr = prehashSearch(oidToPrefetch)) != NULL) { - prehashRemove(oidToPrefetch); - prehashInsert(oidToPrefetch, header); - } else { - prehashInsert(oidToPrefetch, header); - } - length = length - size; - offset += size; - } - } - - recvcontrol = control; - /* Update common data structure and increment count */ - tdata->recvmsg[tdata->thread_id].rcv_status = recvcontrol; - - /* Lock and update count */ - /* Thread sleeps until all messages from pariticipants are received by coordinator */ - pthread_mutex_lock(tdata->lock); - - (*(tdata->count))++; /* keeps track of no of messages received by the coordinator */ - - /* Wake up the threads and invoke decideResponse (once) */ - if(*(tdata->count) == tdata->buffer->f.mcount) { - decideResponse(tdata); - pthread_cond_broadcast(tdata->threshold); - } else { - pthread_cond_wait(tdata->threshold, tdata->lock); - } - pthread_mutex_unlock(tdata->lock); - - /* clear objects from prefetch cache */ - /* - if(*(tdata->replyctrl) == TRANS_ABORT) { - int i; - for(i=0; ibuffer->f.nummod; i++) { - unsigned int oid = tdata->buffer->oidmod[i]; - objheader_t *header; - if((header = prehashSearch(oid)) != NULL) { - prehashRemove(oid); - } - } - for(i=0; ibuffer->f.numread; i++) { - char *objread = tdata->buffer->objread; - unsigned int oid = *((unsigned int *)(objread+(sizeof(unsigned int) + - sizeof(unsigned short))*i)); - objheader_t *header; - if((header = prehashSearch(oid)) != NULL) { - prehashRemove(oid); - } - } - } - */ - - if(*(tdata->replyctrl) == TRANS_COMMIT) { - int retval; - /* Update prefetch cache */ - if((retval = updatePrefetchCache(tdata)) != 0) { - printf("Error: %s() in updating prefetch cache %s, %d\n", __func__, __FILE__, __LINE__); - return; - } - - /* Invalidate objects in other machine cache */ - if(tdata->buffer->f.nummod > 0) { - if((retval = invalidateObj(tdata)) != 0) { - printf("Error: %s() in invalidating Objects %s, %d\n", __func__, __FILE__, __LINE__); - return; - } - } - } - - /* Send the final response such as TRANS_COMMIT or TRANS_ABORT - * to all participants in their respective socket */ - if (sendResponse(tdata, sd) == 0) { - printf("sendResponse returned error %s,%d\n", __FILE__, __LINE__); - pthread_exit(NULL); - } - - recv_data((int)sd, &control, sizeof(char)); - - if(control == TRANS_UNSUCESSFUL) { - //printf("DEBUG-> TRANS_ABORTED\n"); - } else if(control == TRANS_SUCESSFUL) { - //printf("DEBUG-> TRANS_SUCCESSFUL\n"); - } else { - //printf("DEBUG-> Error: Incorrect Transaction End Message %d\n", control); - } - pthread_exit(NULL); -} - -/* This function decides the reponse that needs to be sent to - * all Participant machines after the TRANS_REQUEST protocol */ -void decideResponse(thread_data_array_t *tdata) { - char control; - int i, transagree = 0, transdisagree = 0, transsoftabort = 0; /* Counters to formulate decision of what - message to send */ - - for (i = 0 ; i < tdata->buffer->f.mcount; i++) { - control = tdata->recvmsg[i].rcv_status; /* tdata: keeps track of all participant responses - written onto the shared array */ - switch(control) { - default: - printf("Participant sent unknown message in %s, %d\n", __FILE__, __LINE__); - /* treat as disagree, pass thru */ - case TRANS_DISAGREE: - transdisagree++; - break; - - case TRANS_AGREE: - transagree++; - break; - - case TRANS_SOFT_ABORT: - transsoftabort++; - break; - } - } - - if(transdisagree > 0) { - /* Send Abort */ - *(tdata->replyctrl) = TRANS_ABORT; - *(tdata->replyretry) = 0; - /* clear objects from prefetch cache */ - cleanPCache(tdata); - } else if(transagree == tdata->buffer->f.mcount){ - /* Send Commit */ - *(tdata->replyctrl) = TRANS_COMMIT; - *(tdata->replyretry) = 0; - } else { - /* Send Abort in soft abort case followed by retry commiting transaction again*/ - *(tdata->replyctrl) = TRANS_ABORT; - *(tdata->replyretry) = 1; - } - return; -} - -/* This function sends the final response to remote machines per - * thread in their respective socket id It returns a char that is only - * needed to check the correctness of execution of this function - * inside transRequest()*/ - -char sendResponse(thread_data_array_t *tdata, int sd) { - int n, size, sum, oidcount = 0, control; - char *ptr, retval = 0; - unsigned int *oidnotfound; - - control = *(tdata->replyctrl); - send_data(sd, &control, sizeof(char)); - - //TODO read missing objects during object migration - /* If response is a soft abort due to missing objects at the - Participant's side */ - - /* If the decided response is TRANS_ABORT */ - if(*(tdata->replyctrl) == TRANS_ABORT) { - retval = TRANS_ABORT; - } else if(*(tdata->replyctrl) == TRANS_COMMIT) { - /* If the decided response is TRANS_COMMIT */ - retval = TRANS_COMMIT; - } - - return retval; -} - -/* This function opens a connection, places an object read request to - * the remote machine, reads the control message and object if - * available and copies the object and its header to the local - * cache. */ - -void *getRemoteObj(transrecord_t *record, unsigned int mnum, unsigned int oid) { - int size, val; - struct sockaddr_in serv_addr; - char machineip[16]; - char control; - objheader_t *h; - void *objcopy = NULL; - - int sd = getSock2(transReadSockPool, mnum); - char readrequest[sizeof(char)+sizeof(unsigned int)]; - readrequest[0] = READ_REQUEST; - *((unsigned int *)(&readrequest[1])) = oid; - send_data(sd, readrequest, sizeof(readrequest)); - - /* Read response from the Participant */ - recv_data(sd, &control, sizeof(char)); - - if (control==OBJECT_NOT_FOUND) { - objcopy = NULL; - } else { - /* Read object if found into local cache */ - recv_data(sd, &size, sizeof(int)); - objcopy = objstrAlloc(record->cache, size); - recv_data(sd, objcopy, size); - /* Insert into cache's lookup table */ - chashInsert(record->lookupTable, oid, objcopy); - } - - return objcopy; -} - -/* This function handles the local objects involved in a transaction - * commiting process. It also makes a decision if this local machine - * sends AGREE or DISAGREE or SOFT_ABORT to coordinator. Note - * Coordinator = local machine It wakes up the other threads from - * remote participants that are waiting for the coordinator's decision - * and based on common agreement it either commits or aborts the - * transaction. It also frees the memory resources */ - -void *handleLocalReq(void *threadarg) { - unsigned int *oidnotfound = NULL, *oidlocked = NULL; - local_thread_data_array_t *localtdata; - int numoidnotfound = 0, numoidlocked = 0; - int v_nomatch = 0, v_matchlock = 0, v_matchnolock = 0; - int numread, i; - unsigned int oid; - unsigned short version; - void *mobj; - objheader_t *headptr; - - localtdata = (local_thread_data_array_t *) threadarg; - - /* Counters and arrays to formulate decision on control message to be sent */ - oidnotfound = (unsigned int *) calloc((localtdata->tdata->buffer->f.numread + localtdata->tdata->buffer->f.nummod), sizeof(unsigned int)); - oidlocked = (unsigned int *) calloc((localtdata->tdata->buffer->f.numread + localtdata->tdata->buffer->f.nummod), sizeof(unsigned int)); - - numread = localtdata->tdata->buffer->f.numread; - /* Process each oid in the machine pile/ group per thread */ - for (i = 0; i < localtdata->tdata->buffer->f.numread + localtdata->tdata->buffer->f.nummod; i++) { - if (i < localtdata->tdata->buffer->f.numread) { - int incr = sizeof(unsigned int) + sizeof(unsigned short);// Offset that points to next position in the objread array - incr *= i; - oid = *((unsigned int *)(((char *)localtdata->tdata->buffer->objread) + incr)); - version = *((unsigned short *)(((char *)localtdata->tdata->buffer->objread) + incr + sizeof(unsigned int))); - } else { // Objects Modified - int tmpsize; - headptr = (objheader_t *) chashSearch(localtdata->tdata->rec->lookupTable, localtdata->tdata->buffer->oidmod[i-numread]); - if (headptr == NULL) { - printf("Error: handleLocalReq() returning NULL, no such oid %s, %d\n", __FILE__, __LINE__); - return NULL; - } - oid = OID(headptr); - version = headptr->version; - } - /* Check if object is still present in the machine since the beginning of TRANS_REQUEST */ - - /* Save the oids not found and number of oids not found for later use */ - if ((mobj = mhashSearch(oid)) == NULL) { /* Obj not found */ - /* Save the oids not found and number of oids not found for later use */ - oidnotfound[numoidnotfound] = oid; - numoidnotfound++; - } else { /* If Obj found in machine (i.e. has not moved) */ - /* Check if Obj is locked by any previous transaction */ - if (test_and_set(STATUSPTR(mobj))) { - if (version == ((objheader_t *)mobj)->version) { /* If locked then match versions */ - v_matchlock++; - } else {/* If versions don't match ...HARD ABORT */ - v_nomatch++; - /* Send TRANS_DISAGREE to Coordinator */ - localtdata->tdata->recvmsg[localtdata->tdata->thread_id].rcv_status = TRANS_DISAGREE; -#ifdef CHECKTA - printf("Trans disagree for oid = %x: ", OID(mobj)); - char a[] = "object type"; - TABORT8(__func__, a, TYPE(mobj)); -#endif - -#ifdef CHECKTA - //char a[] = "mid"; - //char b[] = "version mismatch"; - //char c[] = "object type"; - //char d[] = "oid"; - //TABORT9(__func__, b, a, c, d, localtdata->tdata->mid, TYPE(mobj), OID(mobj)); -#endif - break; - } - } else { - //we're locked - /* Save all object oids that are locked on this machine during this transaction request call */ - oidlocked[numoidlocked] = OID(((objheader_t *)mobj)); - numoidlocked++; - if (version == ((objheader_t *)mobj)->version) { /* Check if versions match */ - v_matchnolock++; - } else { /* If versions don't match ...HARD ABORT */ - v_nomatch++; - /* Send TRANS_DISAGREE to Coordinator */ - localtdata->tdata->recvmsg[localtdata->tdata->thread_id].rcv_status = TRANS_DISAGREE; -#ifdef CHECKTA - printf("Trans disagree for oid = %x: ", OID(mobj)); - char a[] = "object type"; - TABORT8(__func__, a, TYPE(mobj)); -#endif -#ifdef CHECKTA - //char a[] = "mid"; - //char b[] = "version mismatch"; - //char c[] = "object type"; - //char d[] = "oid"; - //TABORT9(__func__, b, a, c, d, localtdata->tdata->mid, TYPE(mobj), OID(mobj)); -#endif - break; - } - } - } - } // End for - /* Condition to send TRANS_AGREE */ - if(v_matchnolock == localtdata->tdata->buffer->f.numread + localtdata->tdata->buffer->f.nummod) { - localtdata->tdata->recvmsg[localtdata->tdata->thread_id].rcv_status = TRANS_AGREE; - } - /* Condition to send TRANS_SOFT_ABORT */ - if((v_matchlock > 0 && v_nomatch == 0) || (numoidnotfound > 0 && v_nomatch == 0)) { -#ifdef CHECKTA - //char a[] = "mid"; - //char b[] = "version mismatch"; - //char c[] = "object type"; - //TABORT7(__func__, b, a, c, localtdata->tdata->mid, TYPE(mobj)); - printf("%s() Soft abort\n", __func__); -#endif - localtdata->tdata->recvmsg[localtdata->tdata->thread_id].rcv_status = TRANS_SOFT_ABORT; - } - - /* Fill out the trans_commit_data_t data structure. This is required for a trans commit process - * if Participant receives a TRANS_COMMIT */ - localtdata->transinfo->objlocked = oidlocked; - localtdata->transinfo->objnotfound = oidnotfound; - localtdata->transinfo->modptr = NULL; - localtdata->transinfo->numlocked = numoidlocked; - localtdata->transinfo->numnotfound = numoidnotfound; - /* Lock and update count */ - //Thread sleeps until all messages from pariticipants are received by coordinator - pthread_mutex_lock(localtdata->tdata->lock); - (*(localtdata->tdata->count))++; /* keeps track of no of messages received by the coordinator */ - - /* Wake up the threads and invoke decideResponse (once) */ - if(*(localtdata->tdata->count) == localtdata->tdata->buffer->f.mcount) { - decideResponse(localtdata->tdata); - pthread_cond_broadcast(localtdata->tdata->threshold); - } else { - pthread_cond_wait(localtdata->tdata->threshold, localtdata->tdata->lock); - } - pthread_mutex_unlock(localtdata->tdata->lock); - if(*(localtdata->tdata->replyctrl) == TRANS_ABORT){ - if(transAbortProcess(localtdata) != 0) { - printf("Error in transAbortProcess() %s,%d\n", __FILE__, __LINE__); - fflush(stdout); - pthread_exit(NULL); - } - } else if(*(localtdata->tdata->replyctrl) == TRANS_COMMIT) { - /* Invalidate objects in other machine cache */ - if(localtdata->tdata->buffer->f.nummod > 0) { - int retval; - if((retval = invalidateObj(localtdata->tdata)) != 0) { - printf("Error: %s() in invalidating Objects %s, %d\n", __func__, __FILE__, __LINE__); - return; - } - } - if(transComProcess(localtdata) != 0) { - printf("Error in transComProcess() %s,%d\n", __FILE__, __LINE__); - fflush(stdout); - pthread_exit(NULL); - } - } - /* Free memory */ - if (localtdata->transinfo->objlocked != NULL) { - free(localtdata->transinfo->objlocked); - } - if (localtdata->transinfo->objnotfound != NULL) { - free(localtdata->transinfo->objnotfound); - } - pthread_exit(NULL); -} - -/* This function completes the ABORT process if the transaction is aborting */ -int transAbortProcess(local_thread_data_array_t *localtdata) { - int i, numlocked; - unsigned int *objlocked; - void *header; - - numlocked = localtdata->transinfo->numlocked; - objlocked = localtdata->transinfo->objlocked; - - for (i = 0; i < numlocked; i++) { - if((header = mhashSearch(objlocked[i])) == NULL) { - printf("mhashsearch returns NULL at %s, %d\n", __FILE__, __LINE__); - return 1; - } - UnLock(STATUSPTR(header)); - } - - return 0; -} - -/*This function completes the COMMIT process if the transaction is commiting*/ -int transComProcess(local_thread_data_array_t *localtdata) { - objheader_t *header, *tcptr; - int i, nummod, tmpsize, numcreated, numlocked; - unsigned int *oidmod, *oidcreated, *oidlocked; - void *ptrcreate; - - nummod = localtdata->tdata->buffer->f.nummod; - oidmod = localtdata->tdata->buffer->oidmod; - numcreated = localtdata->tdata->buffer->f.numcreated; - oidcreated = localtdata->tdata->buffer->oidcreated; - numlocked = localtdata->transinfo->numlocked; - oidlocked = localtdata->transinfo->objlocked; - - for (i = 0; i < nummod; i++) { - if((header = (objheader_t *) mhashSearch(oidmod[i])) == NULL) { - printf("Error: transComProcess() mhashsearch returns NULL at %s, %d\n", __FILE__, __LINE__); - return 1; - } - /* Copy from transaction cache -> main object store */ - if ((tcptr = ((objheader_t *) chashSearch(localtdata->tdata->rec->lookupTable, oidmod[i]))) == NULL) { - printf("Error: transComProcess() chashSearch returned NULL at %s, %d\n", __FILE__, __LINE__); - return 1; - } - GETSIZE(tmpsize, header); - char *tmptcptr = (char *) tcptr; - memcpy((char*)header+sizeof(objheader_t), (char *)tmptcptr+ sizeof(objheader_t), tmpsize); - header->version += 1; - if(header->notifylist != NULL) { - notifyAll(&header->notifylist, OID(header), header->version); - } - } - /* If object is newly created inside transaction then commit it */ - for (i = 0; i < numcreated; i++) { - if ((header = ((objheader_t *) chashSearch(localtdata->tdata->rec->lookupTable, oidcreated[i]))) == NULL) { - printf("Error: transComProcess() chashSearch returned NULL for oid = %x at %s, %d\n", oidcreated[i], __FILE__, __LINE__); - return 1; - } - GETSIZE(tmpsize, header); - tmpsize += sizeof(objheader_t); - pthread_mutex_lock(&mainobjstore_mutex); - if ((ptrcreate = objstrAlloc(mainobjstore, tmpsize)) == NULL) { - printf("Error: transComProcess() failed objstrAlloc %s, %d\n", __FILE__, __LINE__); - pthread_mutex_unlock(&mainobjstore_mutex); - return 1; - } - pthread_mutex_unlock(&mainobjstore_mutex); - memcpy(ptrcreate, header, tmpsize); - mhashInsert(oidcreated[i], ptrcreate); - lhashInsert(oidcreated[i], myIpAddr); - } - /* Unlock locked objects */ - for(i = 0; i < numlocked; i++) { - if((header = (objheader_t *) mhashSearch(oidlocked[i])) == NULL) { - printf("mhashsearch returns NULL at %s, %d\n", __FILE__, __LINE__); - return 1; - } - UnLock(STATUSPTR(header)); - } - - return 0; -} - -prefetchpile_t *foundLocal(char *ptr) { - int siteid = *(GET_SITEID(ptr)); - int ntuples = *(GET_NTUPLES(ptr)); - unsigned int * oidarray = GET_PTR_OID(ptr); - unsigned short * endoffsets = GET_PTR_EOFF(ptr, ntuples); - short * arryfields = GET_PTR_ARRYFLD(ptr, ntuples); - prefetchpile_t * head=NULL; - int numLocal = 0; - - int i; - for(i=0;i NUMCLASSES) { - int elementsize = classsize[TYPE(header)]; - struct ArrayObject *ao = (struct ArrayObject *) (((char *)header) + sizeof(objheader_t)); - int length = ao->___length___; - /* Check if array out of bounds */ - if(offset < 0 || offset >= length) { - //if yes treat the object as found - (*oid)=0; - return 1; - } - (*oid) = *((unsigned int *)(((char *)ao) + sizeof(struct ArrayObject) + (elementsize*offset))); - return 1; - } else { - (*oid) = *((unsigned int *)(((char *)header) + sizeof(objheader_t) + offset)); - return 1; - } -} - - -/* This function is called by the thread calling transPrefetch */ -void *transPrefetch(void *t) { - while(1) { - /* lock mutex of primary prefetch queue */ - void *node=gettail(); - /* Check if the tuples are found locally, if yes then reduce them further*/ - /* and group requests by remote machine ids by calling the makePreGroups() */ - prefetchpile_t *pilehead = foundLocal(node); - - if (pilehead!=NULL) { - // Get sock from shared pool - int sd = getSock2(transPrefetchSockPool, pilehead->mid); - - /* Send Prefetch Request */ - prefetchpile_t *ptr = pilehead; - while(ptr != NULL) { - sendPrefetchReq(ptr, sd); - ptr = ptr->next; - } - - /* Release socket */ - // freeSock(transPrefetchSockPool, pilehead->mid, sd); - - /* Deallocated pilehead */ - mcdealloc(pilehead); - } - // Deallocate the prefetch queue pile node - inctail(); - } -} - -void sendPrefetchReqnew(prefetchpile_t *mcpilenode, int sd) { - objpile_t *tmp; - - int size=sizeof(char)+sizeof(int); - for(tmp=mcpilenode->objpiles;tmp!=NULL;tmp=tmp->next) { - size += sizeof(int) + sizeof(unsigned int) + sizeof(unsigned int) + ((tmp->numoffset) * sizeof(short)); - } - - char buft[size]; - char *buf=buft; - *buf=TRANS_PREFETCH; - buf+=sizeof(char); - - for(tmp=mcpilenode->objpiles;tmp!=NULL;tmp=tmp->next) { - int len = sizeof(int) + sizeof(unsigned int) + sizeof(unsigned int) + ((tmp->numoffset) * sizeof(short)); - *((int*)buf)=len; - buf+=sizeof(int); - *((unsigned int *)buf)=tmp->oid; - buf+=sizeof(unsigned int); - *((unsigned int *)(buf)) = myIpAddr; - buf+=sizeof(unsigned int); - memcpy(buf, tmp->offset, tmp->numoffset*sizeof(short)); - buf+=tmp->numoffset*sizeof(short); - } - *((int *)buf)=-1; - send_data(sd, buft, size); - return; -} - -void sendPrefetchReq(prefetchpile_t *mcpilenode, int sd) { - int len, endpair; - char control; - objpile_t *tmp; - - /* Send TRANS_PREFETCH control message */ - control = TRANS_PREFETCH; - send_data(sd, &control, sizeof(char)); - - /* Send Oids and offsets in pairs */ - tmp = mcpilenode->objpiles; - while(tmp != NULL) { - len = sizeof(int) + sizeof(unsigned int) + sizeof(unsigned int) + ((tmp->numoffset) * sizeof(short)); - char oidnoffset[len]; - char *buf=oidnoffset; - *((int*)buf) = tmp->numoffset; - buf+=sizeof(int); - *((unsigned int *)buf) = tmp->oid; - buf+=sizeof(unsigned int); - *((unsigned int *)buf) = myIpAddr; - buf += sizeof(unsigned int); - memcpy(buf, tmp->offset, (tmp->numoffset)*sizeof(short)); - send_data(sd, oidnoffset, len); - tmp = tmp->next; - } - - /* Send a special char -1 to represent the end of sending oids + offset pair to remote machine */ - endpair = -1; - send_data(sd, &endpair, sizeof(int)); - - return; -} - -int getPrefetchResponse(int sd) { - int length = 0, size = 0; - char control; - unsigned int oid; - void *modptr, *oldptr; - - recv_data((int)sd, &length, sizeof(int)); - size = length - sizeof(int); - char recvbuffer[size]; - - recv_data((int)sd, recvbuffer, size); - control = *((char *) recvbuffer); - if(control == OBJECT_FOUND) { - oid = *((unsigned int *)(recvbuffer + sizeof(char))); - size = size - (sizeof(char) + sizeof(unsigned int)); - pthread_mutex_lock(&prefetchcache_mutex); - if ((modptr = prefetchobjstrAlloc(size)) == NULL) { - printf("Error: objstrAlloc error for copying into prefetch cache %s, %d\n", __FILE__, __LINE__); - pthread_mutex_unlock(&prefetchcache_mutex); - return -1; - } - pthread_mutex_unlock(&prefetchcache_mutex); - memcpy(modptr, recvbuffer + sizeof(char) + sizeof(unsigned int), size); - STATUS(modptr)=0; - - /* Insert the oid and its address into the prefetch hash lookup table */ - /* Do a version comparison if the oid exists */ - if((oldptr = prehashSearch(oid)) != NULL) { - /* If older version then update with new object ptr */ - if(((objheader_t *)oldptr)->version <= ((objheader_t *)modptr)->version) { - prehashRemove(oid); - prehashInsert(oid, modptr); - } - } else {/* Else add the object ptr to hash table*/ - prehashInsert(oid, modptr); - } - /* Lock the Prefetch Cache look up table*/ - pthread_mutex_lock(&pflookup.lock); - /* Broadcast signal on prefetch cache condition variable */ - pthread_cond_broadcast(&pflookup.cond); - /* Unlock the Prefetch Cache look up table*/ - pthread_mutex_unlock(&pflookup.lock); - } else if(control == OBJECT_NOT_FOUND) { - oid = *((unsigned int *)(recvbuffer + sizeof(char))); - /* TODO: For each object not found query DHT for new location and retrieve the object */ - /* Throw an error */ - //printf("OBJECT %x NOT FOUND.... THIS SHOULD NOT HAPPEN...TERMINATE PROGRAM\n", oid); - // exit(-1); - } else { - printf("Error: in decoding the control value %d, %s, %d\n",control, __FILE__, __LINE__); - } - - return 0; -} - -unsigned short getObjType(unsigned int oid) { - objheader_t *objheader; - unsigned short numoffset[] ={0}; - short fieldoffset[] ={}; - - if ((objheader = (objheader_t *) mhashSearch(oid)) == NULL) { - if ((objheader = (objheader_t *) prehashSearch(oid)) == NULL) { - unsigned int mid = lhashSearch(oid); - int sd = getSock2(transReadSockPool, mid); - char remotereadrequest[sizeof(char)+sizeof(unsigned int)]; - remotereadrequest[0] = READ_REQUEST; - *((unsigned int *)(&remotereadrequest[1])) = oid; - send_data(sd, remotereadrequest, sizeof(remotereadrequest)); - - /* Read response from the Participant */ - char control; - recv_data(sd, &control, sizeof(char)); - - if (control==OBJECT_NOT_FOUND) { - printf("Error: in %s() THIS SHOULD NOT HAPPEN.....EXIT PROGRAM\n", __func__); - fflush(stdout); - exit(-1); - } else { - /* Read object if found into local cache */ - int size; - recv_data(sd, &size, sizeof(int)); - pthread_mutex_lock(&prefetchcache_mutex); - if ((objheader = prefetchobjstrAlloc(size)) == NULL) { - printf("Error: %s() objstrAlloc error for copying into prefetch cache %s, %d\n", __func__, __FILE__, __LINE__); - pthread_exit(NULL); - } - pthread_mutex_unlock(&prefetchcache_mutex); - recv_data(sd, objheader, size); - prehashInsert(oid, objheader); - } - } - } - return TYPE(objheader); -} - -int startRemoteThread(unsigned int oid, unsigned int mid) -{ - int sock; - struct sockaddr_in remoteAddr; - char msg[1 + sizeof(unsigned int)]; - int bytesSent; - int status; - - if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) - { - perror("startRemoteThread():socket()"); - return -1; - } - - bzero(&remoteAddr, sizeof(remoteAddr)); - remoteAddr.sin_family = AF_INET; - remoteAddr.sin_port = htons(LISTEN_PORT); - remoteAddr.sin_addr.s_addr = htonl(mid); - - if (connect(sock, (struct sockaddr *)&remoteAddr, sizeof(remoteAddr)) < 0) - { - printf("startRemoteThread():error %d connecting to %s:%d\n", errno, - inet_ntoa(remoteAddr.sin_addr), LISTEN_PORT); - status = -1; - } - else - { - msg[0] = START_REMOTE_THREAD; - *((unsigned int *) &msg[1]) = oid; - send_data(sock, msg, 1 + sizeof(unsigned int)); - } - - close(sock); - return status; -} - -//TODO: when reusing oids, make sure they are not already in use! -static unsigned int id = 0xFFFFFFFF; -unsigned int getNewOID(void) { - id += 2; - if (id > oidMax || id < oidMin) - { - id = (oidMin | 1); - } - return id; -} - -int processConfigFile() -{ - FILE *configFile; - const int maxLineLength = 200; - char lineBuffer[maxLineLength]; - char *token; - const char *delimiters = " \t\n"; - char *commentBegin; - in_addr_t tmpAddr; - - configFile = fopen(CONFIG_FILENAME, "r"); - if (configFile == NULL) - { - printf("error opening %s:\n", CONFIG_FILENAME); - perror(""); - return -1; - } - - numHostsInSystem = 0; - sizeOfHostArray = 8; - hostIpAddrs = calloc(sizeOfHostArray, sizeof(unsigned int)); - - while(fgets(lineBuffer, maxLineLength, configFile) != NULL) - { - commentBegin = strchr(lineBuffer, '#'); - if (commentBegin != NULL) - *commentBegin = '\0'; - token = strtok(lineBuffer, delimiters); - while (token != NULL) - { - tmpAddr = inet_addr(token); - if ((int)tmpAddr == -1) - { - printf("error in %s: bad token:%s\n", CONFIG_FILENAME, token); - fclose(configFile); - return -1; - } - else - addHost(htonl(tmpAddr)); - token = strtok(NULL, delimiters); - } - } - - fclose(configFile); - - if (numHostsInSystem < 1) - { - printf("error in %s: no IP Adresses found\n", CONFIG_FILENAME); - return -1; - } -#ifdef MAC - myIpAddr = getMyIpAddr("en1"); -#else - myIpAddr = getMyIpAddr("eth0"); -#endif - myIndexInHostArray = findHost(myIpAddr); - if (myIndexInHostArray == -1) - { - printf("error in %s: IP Address of eth0 not found\n", CONFIG_FILENAME); - return -1; - } - oidsPerBlock = (0xFFFFFFFF / numHostsInSystem) + 1; - oidMin = oidsPerBlock * myIndexInHostArray; - if (myIndexInHostArray == numHostsInSystem - 1) - oidMax = 0xFFFFFFFF; - else - oidMax = oidsPerBlock * (myIndexInHostArray + 1) - 1; - - return 0; -} - -void addHost(unsigned int hostIp) -{ - unsigned int *tmpArray; - - if (findHost(hostIp) != -1) - return; - - if (numHostsInSystem == sizeOfHostArray) - { - tmpArray = calloc(sizeOfHostArray * 2, sizeof(unsigned int)); - memcpy(tmpArray, hostIpAddrs, sizeof(unsigned int) * numHostsInSystem); - free(hostIpAddrs); - hostIpAddrs = tmpArray; - } - - hostIpAddrs[numHostsInSystem++] = hostIp; - - return; -} - -int findHost(unsigned int hostIp) -{ - int i; - for (i = 0; i < numHostsInSystem; i++) - if (hostIpAddrs[i] == hostIp) - return i; - - //not found - return -1; -} - -/* This function sends notification request per thread waiting on object(s) whose version - * changes */ -int reqNotify(unsigned int *oidarry, unsigned short *versionarry, unsigned int numoid) { - int sock,i; - objheader_t *objheader; - struct sockaddr_in remoteAddr; - char msg[1 + numoid * (sizeof(unsigned short) + sizeof(unsigned int)) + 3 * sizeof(unsigned int)]; - char *ptr; - int bytesSent; - int status, size; - unsigned short version; - unsigned int oid,mid; - static unsigned int threadid = 0; - pthread_mutex_t threadnotify = PTHREAD_MUTEX_INITIALIZER; //Lock and condition var for threadjoin and notification - pthread_cond_t threadcond = PTHREAD_COND_INITIALIZER; - notifydata_t *ndata; - - oid = oidarry[0]; - if((mid = lhashSearch(oid)) == 0) { - printf("Error: %s() No such machine found for oid =%x\n",__func__, oid); - return; - } - - if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0){ - perror("reqNotify():socket()"); - return -1; - } - - bzero(&remoteAddr, sizeof(remoteAddr)); - remoteAddr.sin_family = AF_INET; - remoteAddr.sin_port = htons(LISTEN_PORT); - remoteAddr.sin_addr.s_addr = htonl(mid); - - /* Generate unique threadid */ - threadid++; - - /* Save threadid, numoid, oidarray, versionarray, pthread_cond_variable for later processing */ - if((ndata = calloc(1, sizeof(notifydata_t))) == NULL) { - printf("Calloc Error %s, %d\n", __FILE__, __LINE__); - return -1; - } - ndata->numoid = numoid; - ndata->threadid = threadid; - ndata->oidarry = oidarry; - ndata->versionarry = versionarry; - ndata->threadcond = threadcond; - ndata->threadnotify = threadnotify; - if((status = notifyhashInsert(threadid, ndata)) != 0) { - printf("reqNotify(): Insert into notify hash table not successful %s, %d\n", __FILE__, __LINE__); - free(ndata); - return -1; - } - - /* Send number of oids, oidarry, version array, machine id and threadid */ - if (connect(sock, (struct sockaddr *)&remoteAddr, sizeof(remoteAddr)) < 0){ - printf("reqNotify():error %d connecting to %s:%d\n", errno, - inet_ntoa(remoteAddr.sin_addr), LISTEN_PORT); - free(ndata); - return -1; - } else { - msg[0] = THREAD_NOTIFY_REQUEST; - *((unsigned int *)(&msg[1])) = numoid; - /* Send array of oids */ - size = sizeof(unsigned int); - { - i = 0; - while(i < numoid) { - oid = oidarry[i]; - *((unsigned int *)(&msg[1] + size)) = oid; - size += sizeof(unsigned int); - i++; - } - } - - /* Send array of version */ - { - i = 0; - while(i < numoid) { - version = versionarry[i]; - *((unsigned short *)(&msg[1] + size)) = version; - size += sizeof(unsigned short); - i++; - } - } - - *((unsigned int *)(&msg[1] + size)) = myIpAddr; - size += sizeof(unsigned int); - *((unsigned int *)(&msg[1] + size)) = threadid; - pthread_mutex_lock(&(ndata->threadnotify)); - size = 1 + numoid * (sizeof(unsigned int) + sizeof(unsigned short)) + 3 * sizeof(unsigned int); - send_data(sock, msg, size); - pthread_cond_wait(&(ndata->threadcond), &(ndata->threadnotify)); - pthread_mutex_unlock(&(ndata->threadnotify)); - } - - pthread_cond_destroy(&threadcond); - pthread_mutex_destroy(&threadnotify); - free(ndata); - close(sock); - return status; -} - -void threadNotify(unsigned int oid, unsigned short version, unsigned int tid) { - notifydata_t *ndata; - int i, objIsFound = 0, index; - void *ptr; - - //Look up the tid and call the corresponding pthread_cond_signal - if((ndata = notifyhashSearch(tid)) == NULL) { - printf("threadnotify(): No such threadid is present %s, %d\n", __FILE__, __LINE__); - return; - } else { - for(i = 0; i < ndata->numoid; i++) { - if(ndata->oidarry[i] == oid){ - objIsFound = 1; - index = i; - } - } - if(objIsFound == 0){ - printf("threadNotify(): Oid not found %s, %d\n", __FILE__, __LINE__); - return; - } else { - if(version <= ndata->versionarry[index]){ - printf("threadNotify(): New version %d has not changed since last version for oid = %d, %s, %d\n", version, oid, __FILE__, __LINE__); - return; - } else { - /* Clear from prefetch cache and free thread related data structure */ - if((ptr = prehashSearch(oid)) != NULL) { - prehashRemove(oid); - } - pthread_cond_signal(&(ndata->threadcond)); - } - } - } - return; -} - -int notifyAll(threadlist_t **head, unsigned int oid, unsigned int version) { - threadlist_t *ptr; - unsigned int mid; - struct sockaddr_in remoteAddr; - char msg[1 + sizeof(unsigned short) + 2*sizeof(unsigned int)]; - int sock, status, size, bytesSent; - - while(*head != NULL) { - ptr = *head; - mid = ptr->mid; - //create a socket connection to that machine - if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0){ - perror("notifyAll():socket()"); - return -1; - } - - bzero(&remoteAddr, sizeof(remoteAddr)); - remoteAddr.sin_family = AF_INET; - remoteAddr.sin_port = htons(LISTEN_PORT); - remoteAddr.sin_addr.s_addr = htonl(mid); - //send Thread Notify response and threadid to that machine - if (connect(sock, (struct sockaddr *)&remoteAddr, sizeof(remoteAddr)) < 0){ - printf("notifyAll():error %d connecting to %s:%d\n", errno, - inet_ntoa(remoteAddr.sin_addr), LISTEN_PORT); - fflush(stdout); - status = -1; - } else { - bzero(msg, (1+sizeof(unsigned short) + 2*sizeof(unsigned int))); - msg[0] = THREAD_NOTIFY_RESPONSE; - *((unsigned int *)&msg[1]) = oid; - size = sizeof(unsigned int); - *((unsigned short *)(&msg[1]+ size)) = version; - size+= sizeof(unsigned short); - *((unsigned int *)(&msg[1]+ size)) = ptr->threadid; - - size = 1 + 2*sizeof(unsigned int) + sizeof(unsigned short); - send_data(sock, msg, size); - } - //close socket - close(sock); - // Update head - *head = ptr->next; - free(ptr); - } - return status; -} - -void transAbort(transrecord_t *trans) { - objstrDelete(trans->cache); - chashDelete(trans->lookupTable); - free(trans); -} - -/* This function inserts necessary information into - * a machine pile data structure */ -plistnode_t *pInsert(plistnode_t *pile, objheader_t *headeraddr, unsigned int mid, int num_objs) { - plistnode_t *ptr, *tmp; - int found = 0, offset = 0; - - tmp = pile; - //Add oid into a machine that is already present in the pile linked list structure - while(tmp != NULL) { - if (tmp->mid == mid) { - int tmpsize; - - if (STATUS(headeraddr) & NEW) { - tmp->oidcreated[tmp->numcreated] = OID(headeraddr); - tmp->numcreated++; - GETSIZE(tmpsize, headeraddr); - tmp->sum_bytes += sizeof(objheader_t) + tmpsize; - }else if (STATUS(headeraddr) & DIRTY) { - tmp->oidmod[tmp->nummod] = OID(headeraddr); - tmp->nummod++; - GETSIZE(tmpsize, headeraddr); - tmp->sum_bytes += sizeof(objheader_t) + tmpsize; - } else { - offset = (sizeof(unsigned int) + sizeof(short)) * tmp->numread; - *((unsigned int *)(((char *)tmp->objread) + offset))=OID(headeraddr); - offset += sizeof(unsigned int); - *((short *)(((char *)tmp->objread) + offset)) = headeraddr->version; - tmp->numread ++; - } - found = 1; - break; - } - tmp = tmp->next; - } - //Add oid for any new machine - if (!found) { - int tmpsize; - if((ptr = pCreate(num_objs)) == NULL) { - return NULL; - } - ptr->mid = mid; - if (STATUS(headeraddr) & NEW) { - ptr->oidcreated[ptr->numcreated] = OID(headeraddr); - ptr->numcreated ++; - GETSIZE(tmpsize, headeraddr); - ptr->sum_bytes += sizeof(objheader_t) + tmpsize; - } else if (STATUS(headeraddr) & DIRTY) { - ptr->oidmod[ptr->nummod] = OID(headeraddr); - ptr->nummod ++; - GETSIZE(tmpsize, headeraddr); - ptr->sum_bytes += sizeof(objheader_t) + tmpsize; - } else { - *((unsigned int *)ptr->objread)=OID(headeraddr); - offset = sizeof(unsigned int); - *((short *)(((char *)ptr->objread) + offset)) = headeraddr->version; - ptr->numread ++; - } - ptr->next = pile; - pile = ptr; - } - - /* Clear Flags */ - STATUS(headeraddr) =0; - - return pile; -} diff --git a/Robust/src/Runtime/GenericHashtable.c b/Robust/src/Runtime/GenericHashtable.c deleted file mode 100755 index 7528b01e..00000000 --- a/Robust/src/Runtime/GenericHashtable.c +++ /dev/null @@ -1,307 +0,0 @@ -#ifdef RAW -#include -#else -#include -#endif -#include -#include -#include -#include -#include - -#include "GenericHashtable.h" -#include "mem.h" -#ifdef DMALLOC -#include "dmalloc.h" -#endif - -void * getfirstkey(struct genhashtable *ht) { - if(ht->list == NULL) { - return NULL; - } - return ht->list->src; -} - -int genputtable(struct genhashtable *ht, void * key, void * object) { - unsigned int bin=genhashfunction(ht,key); - struct genpointerlist * newptrlist=(struct genpointerlist *) RUNMALLOC(sizeof(struct genpointerlist)); - newptrlist->src=key; - newptrlist->object=object; - newptrlist->next=ht->bins[bin]; - newptrlist->inext=NULL; - /* maintain linked list of ht entries for iteration*/ - if (ht->last==NULL) { - ht->last=newptrlist; - ht->list=newptrlist; - newptrlist->iprev=NULL; - } else { - ht->last->inext=newptrlist; - newptrlist->iprev=ht->last; - ht->last=newptrlist; - } - ht->bins[bin]=newptrlist; - ht->counter++; - if(ht->counter>ht->currentsize&&ht->currentsize!=INT_MAX) { - /* Expand hashtable */ - long newcurrentsize=(ht->currentsize<(INT_MAX/2))?ht->currentsize*2:INT_MAX; - long oldcurrentsize=ht->currentsize; - struct genpointerlist **newbins=(struct genpointerlist **) RUNMALLOC(sizeof (struct genpointerlist *)*newcurrentsize); - struct genpointerlist **oldbins=ht->bins; - long j,i; - for(j=0;jcurrentsize=newcurrentsize; - for(i=0;isrc); - struct genpointerlist *nextptr=tmpptr->next; - tmpptr->next=newbins[hashcode]; - newbins[hashcode]=tmpptr; - tmpptr=nextptr; - } - } - ht->bins=newbins; - RUNFREE(oldbins); - } - return 1; -} - -#ifdef RAW -int genputtable_I(struct genhashtable *ht, void * key, void * object) { - unsigned int bin=genhashfunction(ht,key); - struct genpointerlist * newptrlist=(struct genpointerlist *) RUNMALLOC_I(sizeof(struct genpointerlist)); - newptrlist->src=key; - newptrlist->object=object; - newptrlist->next=ht->bins[bin]; - newptrlist->inext=NULL; - /* maintain linked list of ht entries for iteration*/ - if (ht->last==NULL) { - ht->last=newptrlist; - ht->list=newptrlist; - newptrlist->iprev=NULL; - } else { - ht->last->inext=newptrlist; - newptrlist->iprev=ht->last; - ht->last=newptrlist; - } - ht->bins[bin]=newptrlist; - ht->counter++; - if(ht->counter>ht->currentsize&&ht->currentsize!=INT_MAX) { - /* Expand hashtable */ - long newcurrentsize=(ht->currentsize<(INT_MAX/2))?ht->currentsize*2:INT_MAX; - long oldcurrentsize=ht->currentsize; - struct genpointerlist **newbins=(struct genpointerlist **) RUNMALLOC_I(sizeof (struct genpointerlist *)*newcurrentsize); - struct genpointerlist **oldbins=ht->bins; - long j,i; - for(j=0;jcurrentsize=newcurrentsize; - for(i=0;isrc); - struct genpointerlist *nextptr=tmpptr->next; - tmpptr->next=newbins[hashcode]; - newbins[hashcode]=tmpptr; - tmpptr=nextptr; - } - } - ht->bins=newbins; - RUNFREE(oldbins); - } - return 1; -} -#endif - -int hashsize(struct genhashtable *ht) { - return ht->counter; -} - -void genrehash(struct genhashtable * ht) { - struct genpointerlist **newbins=(struct genpointerlist **) RUNMALLOC(sizeof (struct genpointerlist *)*ht->currentsize); - struct genpointerlist **oldbins=ht->bins; - long j,i; - - for(i=0;icurrentsize;i++) { - struct genpointerlist * tmpptr=oldbins[i]; - while(tmpptr!=NULL) { - unsigned int hashcode=genhashfunction(ht, tmpptr->src); - struct genpointerlist *nextptr=tmpptr->next; - tmpptr->next=newbins[hashcode]; - newbins[hashcode]=tmpptr; - tmpptr=nextptr; - } - } - ht->bins=newbins; - RUNFREE(oldbins); -} - -void * gengettable(struct genhashtable *ht, void * key) { - struct genpointerlist * ptr=ht->bins[genhashfunction(ht,key)]; - while(ptr!=NULL) { - if (((ht->comp_function==NULL)&&(ptr->src==key))||((ht->comp_function!=NULL)&&(*ht->comp_function)(ptr->src,key))) - return ptr->object; - ptr=ptr->next; - } -#ifndef RAW - printf("XXXXXXXXX: COULDN'T FIND ENTRY FOR KEY %p\n",key); -#endif - return NULL; -} - -void * getnext(struct genhashtable *ht, void * key) { - struct genpointerlist * ptr=ht->bins[genhashfunction(ht,key)]; - while(ptr!=NULL) { - if (((ht->comp_function==NULL)&&(ptr->src==key))||((ht->comp_function!=NULL)&&(*ht->comp_function)(ptr->src,key))) - if (ptr->inext!=NULL) { - return ptr->inext->src; - } else - return NULL; - ptr=ptr->next; - } -#ifndef RAW - printf("XXXXXXXXX: COULDN'T FIND ENTRY FOR KEY %p...\n Likely concurrent removal--bad user!!!\n",key); -#endif - return NULL; -} - -int gencontains(struct genhashtable *ht, void * key) { - struct genpointerlist * ptr=ht->bins[genhashfunction(ht,key)]; - //printf("In gencontains2\n");fflush(NULL); - while(ptr!=NULL) { - if (((ht->comp_function==NULL)&&(ptr->src==key))||((ht->comp_function!=NULL)&&(*ht->comp_function)(ptr->src,key))) - return 1; - ptr=ptr->next; - } - return 0; -} - - -void genfreekey(struct genhashtable *ht, void * key) { - struct genpointerlist * ptr=ht->bins[genhashfunction(ht,key)]; - - if (((ht->comp_function==NULL)&&(ptr->src==key))||((ht->comp_function!=NULL)&&(*ht->comp_function)(ptr->src,key))) { - ht->bins[genhashfunction(ht,key)]=ptr->next; - - if (ptr==ht->last) - ht->last=ptr->iprev; - - if (ptr==ht->list) - ht->list=ptr->inext; - - if (ptr->iprev!=NULL) - ptr->iprev->inext=ptr->inext; - if (ptr->inext!=NULL) - ptr->inext->iprev=ptr->iprev; - - RUNFREE(ptr); - ht->counter--; - return; - } - while(ptr->next!=NULL) { - if (((ht->comp_function==NULL)&&(ptr->next->src==key))||((ht->comp_function!=NULL)&&(*ht->comp_function)(ptr->next->src,key))) { - struct genpointerlist *tmpptr=ptr->next; - ptr->next=tmpptr->next; - if (tmpptr==ht->list) - ht->list=tmpptr->inext; - if (tmpptr==ht->last) - ht->last=tmpptr->iprev; - if (tmpptr->iprev!=NULL) - tmpptr->iprev->inext=tmpptr->inext; - if (tmpptr->inext!=NULL) - tmpptr->inext->iprev=tmpptr->iprev; - RUNFREE(tmpptr); - ht->counter--; - return; - } - ptr=ptr->next; - } -#ifndef RAW - printf("XXXXXXXXX: COULDN'T FIND ENTRY FOR KEY %p\n",key); -#endif -} - -unsigned int genhashfunction(struct genhashtable *ht, void * key) { - if (ht->hash_function==NULL) - return ((long unsigned int)key) % ht->currentsize; - else - return ((*ht->hash_function)(key)) % ht->currentsize; -} - -struct genhashtable * genallocatehashtable(unsigned int (*hash_function)(void *),int (*comp_function)(void *, void *)) { - struct genhashtable *ght; - struct genpointerlist **gpl; - int i; - -#ifdef RAWDEBUG - raw_test_pass(0xf000); -#endif - - gpl=(struct genpointerlist **) RUNMALLOC(sizeof(struct genpointerlist *)*geninitialnumbins); -#ifdef RAWDEBUG - raw_test_pass(0xf001); -#endif - for(i=0;ihash_function=hash_function; - ght->comp_function=comp_function; - ght->currentsize=geninitialnumbins; - ght->bins=gpl; - ght->counter=0; - ght->list=NULL; - ght->last=NULL; -#ifdef RAWDEBUG - raw_test_pass(0xf004); -#endif - return ght; -} - -void genfreehashtable(struct genhashtable * ht) { - int i; - for (i=0;icurrentsize;i++) { - if (ht->bins[i]!=NULL) { - struct genpointerlist *genptr=ht->bins[i]; - while(genptr!=NULL) { - struct genpointerlist *tmpptr=genptr->next; - RUNFREE(genptr); - genptr=tmpptr; - } - } - } - RUNFREE(ht->bins); - RUNFREE(ht); -} - -struct geniterator * gengetiterator(struct genhashtable *ht) { - struct geniterator *gi=(struct geniterator*)RUNMALLOC(sizeof(struct geniterator)); - gi->ptr=ht->list; - return gi; -} - -void * gennext(struct geniterator *it) { - struct genpointerlist *curr=it->ptr; - if (curr==NULL) - return NULL; - if (it->finished&&(curr->inext==NULL)) - return NULL; - if (it->finished) { - it->ptr=curr->inext; - return it->ptr->src; - } - if(curr->inext!=NULL) - it->ptr=curr->inext; - else - it->finished=1; /* change offsetting scheme */ - return curr->src; -} - -void genfreeiterator(struct geniterator *it) { - RUNFREE(it); -} diff --git a/Robust/src/Runtime/GenericHashtable.h b/Robust/src/Runtime/GenericHashtable.h deleted file mode 100755 index 832a8bd2..00000000 --- a/Robust/src/Runtime/GenericHashtable.h +++ /dev/null @@ -1,55 +0,0 @@ -// implements a generic hash table - -#ifndef GENHASHTABLE -#define GENHASHTABLE -#define geninitialnumbins 10 -#define bool int - -struct genhashtable { - unsigned int (*hash_function)(void *); - int (*comp_function)(void *,void *); - struct genpointerlist ** bins; - long counter; - int currentsize; - struct genpointerlist *list; - struct genpointerlist *last; -}; - - -struct genpointerlist { - void * src; - void * object; - struct genpointerlist * next; - - struct genpointerlist * inext; - struct genpointerlist * iprev; -}; - - -struct geniterator { - struct genpointerlist * ptr; - bool finished; -}; - -struct genhashtable * genallocatehashtable(unsigned int (*hash_function)(void *),int (*comp_function)(void *,void *)); -void * getfirstkey(struct genhashtable *ht); -void genfreehashtable(struct genhashtable * ht); -void genrehash(struct genhashtable * ht); -void * getnext(struct genhashtable *,void *); -int genputtable(struct genhashtable *, void *, void *); -#ifdef RAW -int genputtable_I(struct genhashtable *, void *, void *); -#endif -void * gengettable(struct genhashtable *, void *); -int gencontains(struct genhashtable *, void *); -unsigned int genhashfunction(struct genhashtable *,void *); - -int hashsize(struct genhashtable * ht); -void genfreekey(struct genhashtable *ht, void *); -struct geniterator * gengetiterator(struct genhashtable *ht); -void * gennext(struct geniterator *it); -void genfreeiterator(struct geniterator *it); -#endif - - - diff --git a/Robust/src/Runtime/ObjectHash.c b/Robust/src/Runtime/ObjectHash.c deleted file mode 100755 index affbc128..00000000 --- a/Robust/src/Runtime/ObjectHash.c +++ /dev/null @@ -1,342 +0,0 @@ -#include "ObjectHash.h" -#ifdef RAW -#include -#else -#include -#endif -#ifdef DMALLOC -#include "dmalloc.h" -#endif - -/* SIMPLE HASH ********************************************************/ -struct ObjectIterator* ObjectHashcreateiterator(struct ObjectHash * thisvar) { - return allocateObjectIterator(thisvar->listhead); -} - -void ObjectHashiterator(struct ObjectHash *thisvar, struct ObjectIterator * it) { - it->cur=thisvar->listhead; -} - -struct ObjectHash * noargallocateObjectHash() { - return allocateObjectHash(100); -} - -struct ObjectHash * allocateObjectHash(int size) { - struct ObjectHash *thisvar;//=(struct ObjectHash *)RUNMALLOC(sizeof(struct ObjectHash)); - if (size <= 0) { -#ifdef RAW - raw_test_done(0xc001); -#else - printf("Negative Hashtable size Exception\n"); - exit(-1); -#endif - } - thisvar=(struct ObjectHash *)RUNMALLOC(sizeof(struct ObjectHash)); - thisvar->size = size; - thisvar->bucket = (struct ObjectNode **) RUNMALLOC(sizeof(struct ObjectNode *)*size); - /* Set allocation blocks*/ - thisvar->listhead=NULL; - thisvar->listtail=NULL; - /*Set data counts*/ - thisvar->numelements = 0; - return thisvar; -} - -void freeObjectHash(struct ObjectHash *thisvar) { - struct ObjectNode *ptr=thisvar->listhead; - RUNFREE(thisvar->bucket); - while(ptr) { - struct ObjectNode *next=ptr->lnext; - RUNFREE(ptr); - ptr=next; - } - RUNFREE(thisvar); -} - -inline int ObjectHashcountset(struct ObjectHash * thisvar) { - return thisvar->numelements; -} - -int ObjectHashfirstkey(struct ObjectHash *thisvar) { - struct ObjectNode *ptr=thisvar->listhead; - return ptr->key; -} - -int ObjectHashremove(struct ObjectHash *thisvar, int key) { - unsigned int hashkey = (unsigned int)key % thisvar->size; - - struct ObjectNode **ptr = &thisvar->bucket[hashkey]; - int i; - - while (*ptr) { - if ((*ptr)->key == key) { - struct ObjectNode *toremove=*ptr; - *ptr=(*ptr)->next; - - if (toremove->lprev!=NULL) { - toremove->lprev->lnext=toremove->lnext; - } else { - thisvar->listhead=toremove->lnext; - } - if (toremove->lnext!=NULL) { - toremove->lnext->lprev=toremove->lprev; - } else { - thisvar->listtail=toremove->lprev; - } - RUNFREE(toremove); - - thisvar->numelements--; - return 1; - } - ptr = &((*ptr)->next); - } - - return 0; -} - -void ObjectHashrehash(struct ObjectHash * thisvar) { - int newsize=thisvar->size; - struct ObjectNode ** newbucket = (struct ObjectNode **) RUNMALLOC(sizeof(struct ObjectNode *)*newsize); - int i; - for(i=thisvar->size-1;i>=0;i--) { - struct ObjectNode *ptr; - for(ptr=thisvar->bucket[i];ptr!=NULL;) { - struct ObjectNode * nextptr=ptr->next; - unsigned int newhashkey=(unsigned int)ptr->key % newsize; - ptr->next=newbucket[newhashkey]; - newbucket[newhashkey]=ptr; - ptr=nextptr; - } - } - thisvar->size=newsize; - RUNFREE(thisvar->bucket); - thisvar->bucket=newbucket; -} - -int ObjectHashadd(struct ObjectHash * thisvar,int key, int data, int data2, int data3, int data4) { - /* Rehash code */ - unsigned int hashkey; - struct ObjectNode **ptr; - - if (thisvar->numelements>=thisvar->size) { - int newsize=2*thisvar->size+1; - struct ObjectNode ** newbucket = (struct ObjectNode **) RUNMALLOC(sizeof(struct ObjectNode *)*newsize); - int i; - for(i=thisvar->size-1;i>=0;i--) { - struct ObjectNode *ptr; - for(ptr=thisvar->bucket[i];ptr!=NULL;) { - struct ObjectNode * nextptr=ptr->next; - unsigned int newhashkey=(unsigned int)ptr->key % newsize; - ptr->next=newbucket[newhashkey]; - newbucket[newhashkey]=ptr; - ptr=nextptr; - } - } - thisvar->size=newsize; - RUNFREE(thisvar->bucket); - thisvar->bucket=newbucket; - } - - hashkey = (unsigned int)key % thisvar->size; - ptr = &thisvar->bucket[hashkey]; - - { - struct ObjectNode *node=RUNMALLOC(sizeof(struct ObjectNode)); - node->data=data; - node->data2=data2; - node->data3=data3; - node->data4=data4; - node->key=key; - node->next=(*ptr); - *ptr=node; - if (thisvar->listhead==NULL) { - thisvar->listhead=node; - thisvar->listtail=node; - node->lnext=NULL; - node->lprev=NULL; - } else { - node->lprev=NULL; - node->lnext=thisvar->listhead; - thisvar->listhead->lprev=node; - thisvar->listhead=node; - } - } - - thisvar->numelements++; - return 1; -} - -#ifdef RAW -int ObjectHashadd_I(struct ObjectHash * thisvar,int key, int data, int data2, int data3, int data4) { - /* Rehash code */ - unsigned int hashkey; - struct ObjectNode **ptr; - - if (thisvar->numelements>=thisvar->size) { - int newsize=2*thisvar->size+1; - struct ObjectNode ** newbucket = (struct ObjectNode **) RUNMALLOC_I(sizeof(struct ObjectNode *)*newsize); - int i; - for(i=thisvar->size-1;i>=0;i--) { - struct ObjectNode *ptr; - for(ptr=thisvar->bucket[i];ptr!=NULL;) { - struct ObjectNode * nextptr=ptr->next; - unsigned int newhashkey=(unsigned int)ptr->key % newsize; - ptr->next=newbucket[newhashkey]; - newbucket[newhashkey]=ptr; - ptr=nextptr; - } - } - thisvar->size=newsize; - RUNFREE(thisvar->bucket); - thisvar->bucket=newbucket; - } - - hashkey = (unsigned int)key % thisvar->size; - ptr = &thisvar->bucket[hashkey]; - - { - struct ObjectNode *node=RUNMALLOC_I(sizeof(struct ObjectNode)); - node->data=data; - node->data2=data2; - node->data3=data3; - node->data4=data4; - node->key=key; - node->next=(*ptr); - *ptr=node; - if (thisvar->listhead==NULL) { - thisvar->listhead=node; - thisvar->listtail=node; - node->lnext=NULL; - node->lprev=NULL; - } else { - node->lprev=NULL; - node->lnext=thisvar->listhead; - thisvar->listhead->lprev=node; - thisvar->listhead=node; - } - } - - thisvar->numelements++; - return 1; -} -#endif - -bool ObjectHashcontainskey(struct ObjectHash *thisvar,int key) { - unsigned int hashkey = (unsigned int)key % thisvar->size; - - struct ObjectNode *ptr = thisvar->bucket[hashkey]; - while (ptr) { - if (ptr->key == key) { - /* we already have thisvar object - stored in the hash so just return */ - return true; - } - ptr = ptr->next; - } - return false; -} - -bool ObjectHashcontainskeydata(struct ObjectHash *thisvar, int key, int data) { - unsigned int hashkey = (unsigned int)key % thisvar->size; - - struct ObjectNode *ptr = thisvar->bucket[hashkey]; - while (ptr) { - if (ptr->key == key && ptr->data == data) { - /* we already have thisvar object - stored in the hash so just return*/ - return true; - } - ptr = ptr->next; - } - return false; -} - -int ObjectHashcount(struct ObjectHash *thisvar,int key) { - unsigned int hashkey = (unsigned int)key % thisvar->size; - int count = 0; - - struct ObjectNode *ptr = thisvar->bucket[hashkey]; - while (ptr) { - if (ptr->key == key) { - count++; - } - ptr = ptr->next; - } - return count; -} - -int ObjectHashget(struct ObjectHash *thisvar, int key, int *data, int *data2, int *data3, int *data4) { - unsigned int hashkey = (unsigned int)key % thisvar->size; - - struct ObjectNode *ptr = thisvar->bucket[hashkey]; - while (ptr) { - if (ptr->key == key) { - *data = ptr->data; - *data2 = ptr->data2; - *data3 = ptr->data3; - *data4 = ptr->data4; - return 1; /* success */ - } - ptr = ptr->next; - } - - return 0; /* failure */ -} - -int ObjectHashupdate(struct ObjectHash *thisvar, int key, int data, int data2, int data3, int data4) { - unsigned int hashkey = (unsigned int)key % thisvar->size; - - struct ObjectNode *ptr = thisvar->bucket[hashkey]; - while (ptr) { - if (ptr->key == key) { - ptr->data=data; - ptr->data2=data2; - ptr->data3=data3; - ptr->data4=data4; - return 1; /* success */ - } - ptr = ptr->next; - } - return 0; /* failure */ -} - - -inline struct ObjectIterator * noargallocateObjectIterator() { - return (struct ObjectIterator*)RUNMALLOC(sizeof(struct ObjectIterator)); -} - -inline struct ObjectIterator * allocateObjectIterator(struct ObjectNode *start) { - struct ObjectIterator *thisvar=(struct ObjectIterator*)RUNMALLOC(sizeof(struct ObjectIterator)); - thisvar->cur = start; - return thisvar; -} - -inline int ObjhasNext(struct ObjectIterator *thisvar) { - return (thisvar->cur!=NULL); -} - -inline int Objnext(struct ObjectIterator *thisvar) { - int curr=thisvar->cur->data; - thisvar->cur=thisvar->cur->lnext; - return curr; -} - -inline int Objkey(struct ObjectIterator *thisvar) { - return thisvar->cur->key; -} - -inline int Objdata(struct ObjectIterator *thisvar) { - return thisvar->cur->data; -} - -inline int Objdata2(struct ObjectIterator *thisvar) { - return thisvar->cur->data2; -} - -inline int Objdata3(struct ObjectIterator *thisvar) { - return thisvar->cur->data3; -} - -inline int Objdata4(struct ObjectIterator *thisvar) { - return thisvar->cur->data4; -} diff --git a/Robust/src/Runtime/ObjectHash.h b/Robust/src/Runtime/ObjectHash.h deleted file mode 100755 index b3a565bd..00000000 --- a/Robust/src/Runtime/ObjectHash.h +++ /dev/null @@ -1,83 +0,0 @@ -#ifndef OBJECTHASH_H -#define OBJECTHASH_H - -#ifndef bool -#define bool int -#endif - -#ifndef true -#define true 1 -#endif - -#ifndef false -#define false 0 -#endif - -#include "mem.h" - -/* ObjectHash *********************************************************/ - -struct ObjectHash * noargallocateObjectHash(); -struct ObjectHash * allocateObjectHash(int size); -void ObjectHashaddChild(struct ObjectHash *thisvar, struct ObjectHash * child); -void freeObjectHash(struct ObjectHash *); - -void ObjectHashrehash(struct ObjectHash * thisvar); -int ObjectHashadd(struct ObjectHash *, int key, int data, int data2, int data3, int data4); -#ifdef RAW -int ObjectHashadd_I(struct ObjectHash *, int key, int data, int data2, int data3, int data4); -#endif -int ObjectHashremove(struct ObjectHash *,int key); -bool ObjectHashcontainskey(struct ObjectHash *,int key); -bool ObjectHashcontainskeydata(struct ObjectHash *,int key, int data); -int ObjectHashget(struct ObjectHash *,int key, int* data, int* data2, int * data3, int* data4); -void ObjectHashaddParent(struct ObjectHash *,struct ObjectHash* parent); -int ObjectHashfirstkey(struct ObjectHash *); -struct ObjectIterator* ObjectHashcreateiterator(struct ObjectHash *); -void ObjectHashiterator(struct ObjectHash *, struct ObjectIterator * it); -int ObjectHashcount(struct ObjectHash *, int key); - -struct ObjectHash { - int numelements; - int size; - struct ObjectNode **bucket; - struct ObjectNode *listhead; - struct ObjectNode *listtail; -}; - -inline int ObjectHashcountset(struct ObjectHash * thisvar); - -/* ObjectIterator *****************************************************/ - -struct ObjectNode { - struct ObjectNode *next; - struct ObjectNode *lnext; - struct ObjectNode *lprev; - int key; - int data; - int data2; - int data3; - int data4; -}; - -struct ObjectIterator { - struct ObjectNode *cur; -}; - -inline struct ObjectIterator * noargallocateObjectIterator(); - -inline struct ObjectIterator * allocateObjectIterator(struct ObjectNode *start); - -inline int ObjhasNext(struct ObjectIterator *thisvar); - -inline int Objnext(struct ObjectIterator *thisvar); - -inline int Objkey(struct ObjectIterator *thisvar); - -inline int Objdata(struct ObjectIterator *thisvar); -inline int Objdata2(struct ObjectIterator *thisvar); -inline int Objdata3(struct ObjectIterator *thisvar); -inline int Objdata4(struct ObjectIterator *thisvar); - - -#endif diff --git a/Robust/src/Runtime/Queue.c b/Robust/src/Runtime/Queue.c deleted file mode 100644 index 90743065..00000000 --- a/Robust/src/Runtime/Queue.c +++ /dev/null @@ -1,84 +0,0 @@ -#include "mem.h" -#include "Queue.h" -#ifdef DMALLOC -#include "dmalloc.h" -#endif - -struct Queue * createQueue() { - struct Queue * queue = (struct Queue *)RUNMALLOC(sizeof(struct Queue)); - queue->head = NULL; - queue->tail = NULL; - return queue; -} - -void freeQueue(struct Queue * q) { - RUNFREE(q); -} - -int isEmpty(struct Queue *queue) { - return queue->head==NULL; -} - -struct QueueItem * addNewItem(struct Queue * queue, void * ptr) { - struct QueueItem * item=RUNMALLOC(sizeof(struct QueueItem)); - item->objectptr=ptr; - item->queue=queue; - if (queue->head==NULL) { - queue->head=item; - queue->tail=item; - } else { - item->next=queue->head; - queue->head->prev=item; - queue->head=item; - } - return item; -} - -#ifdef RAW -struct QueueItem * addNewItem_I(struct Queue * queue, void * ptr) { - struct QueueItem * item=RUNMALLOC_I(sizeof(struct QueueItem)); - item->objectptr=ptr; - item->queue=queue; - if (queue->head==NULL) { - queue->head=item; - queue->tail=item; - } else { - item->next=queue->head; - queue->head->prev=item; - queue->head=item; - } - return item; -} -#endif - -struct QueueItem * findItem(struct Queue * queue, void *ptr) { - struct QueueItem * item=queue->head; - while(item!=NULL) { - if (item->objectptr==ptr) - return item; - item=item->next; - } - return NULL; -} - -void removeItem(struct Queue * queue, struct QueueItem * item) { - struct QueueItem * prev=item->prev; - struct QueueItem * next=item->next; - if (queue->head==item) - queue->head=next; - else - prev->next=next; - if (queue->tail==item) - queue->tail=prev; - else - next->prev=prev; - RUNFREE(item); -} - -struct QueueItem * getTail(struct Queue * queue) { - return queue->tail; -} - -struct QueueItem * getNext(struct QueueItem * qi) { - return qi->next; -} diff --git a/Robust/src/Runtime/Queue.h b/Robust/src/Runtime/Queue.h deleted file mode 100644 index 033478bf..00000000 --- a/Robust/src/Runtime/Queue.h +++ /dev/null @@ -1,28 +0,0 @@ -#ifndef QUEUE_H -#define QUEUE_H - -struct Queue { - struct QueueItem * head; - struct QueueItem * tail; -}; - -struct QueueItem { - void * objectptr; - struct Queue * queue; - struct QueueItem * next; - struct QueueItem * prev; -}; - -void freeQueue(struct Queue * q); -struct Queue * createQueue(); -struct QueueItem * addNewItem(struct Queue * queue, void * ptr); -#ifdef RAW -struct QueueItem * addNewItem_I(struct Queue * queue, void * ptr); -#endif -struct QueueItem * findItem(struct Queue * queue, void * ptr); -void removeItem(struct Queue * queue, struct QueueItem * item); -int isEmpty(struct Queue *queue); -struct QueueItem * getTail(struct Queue * queue); - - -#endif diff --git a/Robust/src/Runtime/SimpleHash.c b/Robust/src/Runtime/SimpleHash.c deleted file mode 100755 index 92fe695f..00000000 --- a/Robust/src/Runtime/SimpleHash.c +++ /dev/null @@ -1,365 +0,0 @@ -#include "SimpleHash.h" -#ifdef RAW -#include -#else -#include -#endif -#ifdef DMALLOC -#include "dmalloc.h" -#endif - -/* SIMPLE HASH ********************************************************/ -struct RuntimeIterator* RuntimeHashcreateiterator(struct RuntimeHash * thisvar) { - return allocateRuntimeIterator(thisvar->listhead); -} - -void RuntimeHashiterator(struct RuntimeHash *thisvar, struct RuntimeIterator * it) { - it->cur=thisvar->listhead; -} - -struct RuntimeHash * noargallocateRuntimeHash() { - return allocateRuntimeHash(100); -} - -struct RuntimeHash * allocateRuntimeHash(int size) { - struct RuntimeHash *thisvar;//=(struct RuntimeHash *)RUNMALLOC(sizeof(struct RuntimeHash)); - if (size <= 0) { -#ifdef RAW - raw_test_done(0xb001); -#else - printf("Negative Hashtable size Exception\n"); - exit(-1); -#endif - } - thisvar=(struct RuntimeHash *)RUNMALLOC(sizeof(struct RuntimeHash)); - thisvar->size = size; - thisvar->bucket = (struct RuntimeNode **) RUNMALLOC(sizeof(struct RuntimeNode *)*size); - /* Set allocation blocks*/ - thisvar->listhead=NULL; - thisvar->listtail=NULL; - /*Set data counts*/ - thisvar->numelements = 0; - return thisvar; -} - -void freeRuntimeHash(struct RuntimeHash *thisvar) { - struct RuntimeNode *ptr=thisvar->listhead; - RUNFREE(thisvar->bucket); - while(ptr) { - struct RuntimeNode *next=ptr->lnext; - RUNFREE(ptr); - ptr=next; - } - RUNFREE(thisvar); -} - -inline int RuntimeHashcountset(struct RuntimeHash * thisvar) { - return thisvar->numelements; -} - -int RuntimeHashfirstkey(struct RuntimeHash *thisvar) { - struct RuntimeNode *ptr=thisvar->listhead; - return ptr->key; -} - -int RuntimeHashremovekey(struct RuntimeHash *thisvar, int key) { - unsigned int hashkey = (unsigned int)key % thisvar->size; - - struct RuntimeNode **ptr = &thisvar->bucket[hashkey]; - int i; - - while (*ptr) { - if ((*ptr)->key == key) { - struct RuntimeNode *toremove=*ptr; - *ptr=(*ptr)->next; - - if (toremove->lprev!=NULL) { - toremove->lprev->lnext=toremove->lnext; - } else { - thisvar->listhead=toremove->lnext; - } - if (toremove->lnext!=NULL) { - toremove->lnext->lprev=toremove->lprev; - } else{ - thisvar->listtail=toremove->lprev; - } - RUNFREE(toremove); - - thisvar->numelements--; - return 1; - } - ptr = &((*ptr)->next); - } - - return 0; -} - -int RuntimeHashremove(struct RuntimeHash *thisvar, int key, int data) { - unsigned int hashkey = (unsigned int)key % thisvar->size; - - struct RuntimeNode **ptr = &thisvar->bucket[hashkey]; - int i; - - while (*ptr) { - if ((*ptr)->key == key && (*ptr)->data == data) { - struct RuntimeNode *toremove=*ptr; - *ptr=(*ptr)->next; - - if (toremove->lprev!=NULL) { - toremove->lprev->lnext=toremove->lnext; - } else { - thisvar->listhead=toremove->lnext; - } - if (toremove->lnext!=NULL) { - toremove->lnext->lprev=toremove->lprev; - } else { - thisvar->listtail=toremove->lprev; - } - RUNFREE(toremove); - - thisvar->numelements--; - return 1; - } - ptr = &((*ptr)->next); - } - - return 0; -} - -void RuntimeHashrehash(struct RuntimeHash * thisvar) { - int newsize=thisvar->size; - struct RuntimeNode ** newbucket = (struct RuntimeNode **) RUNMALLOC(sizeof(struct RuntimeNode *)*newsize); - int i; - for(i=thisvar->size-1;i>=0;i--) { - struct RuntimeNode *ptr; - for(ptr=thisvar->bucket[i];ptr!=NULL;) { - struct RuntimeNode * nextptr=ptr->next; - unsigned int newhashkey=(unsigned int)ptr->key % newsize; - ptr->next=newbucket[newhashkey]; - newbucket[newhashkey]=ptr; - ptr=nextptr; - } - } - thisvar->size=newsize; - RUNFREE(thisvar->bucket); - thisvar->bucket=newbucket; -} - -int RuntimeHashadd(struct RuntimeHash * thisvar,int key, int data) { - /* Rehash code */ - unsigned int hashkey; - struct RuntimeNode **ptr; - - if (thisvar->numelements>=thisvar->size) { - int newsize=2*thisvar->size+1; - struct RuntimeNode ** newbucket = (struct RuntimeNode **) RUNMALLOC(sizeof(struct RuntimeNode *)*newsize); - int i; - for(i=thisvar->size-1;i>=0;i--) { - struct RuntimeNode *ptr; - for(ptr=thisvar->bucket[i];ptr!=NULL;) { - struct RuntimeNode * nextptr=ptr->next; - unsigned int newhashkey=(unsigned int)ptr->key % newsize; - ptr->next=newbucket[newhashkey]; - newbucket[newhashkey]=ptr; - ptr=nextptr; - } - } - thisvar->size=newsize; - RUNFREE(thisvar->bucket); - thisvar->bucket=newbucket; - } - - hashkey = (unsigned int)key % thisvar->size; - ptr = &thisvar->bucket[hashkey]; - - /* check that thisvar key/object pair isn't already here */ - /* TBD can be optimized for set v. relation */ - - while (*ptr) { - if ((*ptr)->key == key && (*ptr)->data == data) { - return 0; - } - ptr = &((*ptr)->next); - } - - { - struct RuntimeNode *node=RUNMALLOC(sizeof(struct RuntimeNode)); - node->data=data; - node->key=key; - node->next=(*ptr); - *ptr=node; - if (thisvar->listhead==NULL) { - thisvar->listhead=node; - thisvar->listtail=node; - node->lnext=NULL; - node->lprev=NULL; - } else { - node->lprev=NULL; - node->lnext=thisvar->listhead; - thisvar->listhead->lprev=node; - thisvar->listhead=node; - } - } - - thisvar->numelements++; - return 1; -} - -#ifdef RAW -int RuntimeHashadd_I(struct RuntimeHash * thisvar,int key, int data) { - /* Rehash code */ - unsigned int hashkey; - struct RuntimeNode **ptr; - - if (thisvar->numelements>=thisvar->size) { - int newsize=2*thisvar->size+1; - struct RuntimeNode ** newbucket = (struct RuntimeNode **) RUNMALLOC_I(sizeof(struct RuntimeNode *)*newsize); - int i; - for(i=thisvar->size-1;i>=0;i--) { - struct RuntimeNode *ptr; - for(ptr=thisvar->bucket[i];ptr!=NULL;) { - struct RuntimeNode * nextptr=ptr->next; - unsigned int newhashkey=(unsigned int)ptr->key % newsize; - ptr->next=newbucket[newhashkey]; - newbucket[newhashkey]=ptr; - ptr=nextptr; - } - } - thisvar->size=newsize; - RUNFREE(thisvar->bucket); - thisvar->bucket=newbucket; - } - - hashkey = (unsigned int)key % thisvar->size; - ptr = &thisvar->bucket[hashkey]; - - /* check that thisvar key/object pair isn't already here */ - /* TBD can be optimized for set v. relation */ - - while (*ptr) { - if ((*ptr)->key == key && (*ptr)->data == data) { - return 0; - } - ptr = &((*ptr)->next); - } - - { - struct RuntimeNode *node=RUNMALLOC_I(sizeof(struct RuntimeNode)); - node->data=data; - node->key=key; - node->next=(*ptr); - *ptr=node; - if (thisvar->listhead==NULL) { - thisvar->listhead=node; - thisvar->listtail=node; - node->lnext=NULL; - node->lprev=NULL; - } else { - node->lprev=NULL; - node->lnext=thisvar->listhead; - thisvar->listhead->lprev=node; - thisvar->listhead=node; - } - } - - thisvar->numelements++; - return 1; -} -#endif - -bool RuntimeHashcontainskey(struct RuntimeHash *thisvar,int key) { - unsigned int hashkey = (unsigned int)key % thisvar->size; - - struct RuntimeNode *ptr = thisvar->bucket[hashkey]; - while (ptr) { - if (ptr->key == key) { - /* we already have thisvar object - stored in the hash so just return */ - return true; - } - ptr = ptr->next; - } - return false; -} - -bool RuntimeHashcontainskeydata(struct RuntimeHash *thisvar, int key, int data) { - unsigned int hashkey = (unsigned int)key % thisvar->size; - - struct RuntimeNode *ptr = thisvar->bucket[hashkey]; - while (ptr) { - if (ptr->key == key && ptr->data == data) { - /* we already have thisvar object - stored in the hash so just return*/ - return true; - } - ptr = ptr->next; - } - return false; -} - -int RuntimeHashcount(struct RuntimeHash *thisvar,int key) { - unsigned int hashkey = (unsigned int)key % thisvar->size; - int count = 0; - - struct RuntimeNode *ptr = thisvar->bucket[hashkey]; - while (ptr) { - if (ptr->key == key) { - count++; - } - ptr = ptr->next; - } - return count; -} - -struct RuntimeHash * RuntimeHashimageSet(struct RuntimeHash *thisvar, int key) { - struct RuntimeHash * newset=allocateRuntimeHash(2*RuntimeHashcount(thisvar,key)+4); - unsigned int hashkey = (unsigned int)key % thisvar->size; - - struct RuntimeNode *ptr = thisvar->bucket[hashkey]; - while (ptr) { - if (ptr->key == key) { - RuntimeHashadd(newset,ptr->data,ptr->data); - } - ptr = ptr->next; - } - return newset; -} - -int RuntimeHashget(struct RuntimeHash *thisvar, int key, int *data) { - unsigned int hashkey = (unsigned int)key % thisvar->size; - - struct RuntimeNode *ptr = thisvar->bucket[hashkey]; - while (ptr) { - if (ptr->key == key) { - *data = ptr->data; - return 1; /* success */ - } - ptr = ptr->next; - } - - return 0; /* failure */ -} - -inline struct RuntimeIterator * noargallocateRuntimeIterator() { - return (struct RuntimeIterator*)RUNMALLOC(sizeof(struct RuntimeIterator)); -} - -inline struct RuntimeIterator * allocateRuntimeIterator(struct RuntimeNode *start) { - struct RuntimeIterator *thisvar=(struct RuntimeIterator*)RUNMALLOC(sizeof(struct RuntimeIterator)); - thisvar->cur = start; - return thisvar; -} - -inline int RunhasNext(struct RuntimeIterator *thisvar) { - return (thisvar->cur!=NULL); -} - -inline int Runnext(struct RuntimeIterator *thisvar) { - int curr=thisvar->cur->data; - thisvar->cur=thisvar->cur->lnext; - return curr; -} - -inline int Runkey(struct RuntimeIterator *thisvar) { - return thisvar->cur->key; -} diff --git a/Robust/src/Runtime/SimpleHash.h b/Robust/src/Runtime/SimpleHash.h deleted file mode 100755 index e777d541..00000000 --- a/Robust/src/Runtime/SimpleHash.h +++ /dev/null @@ -1,80 +0,0 @@ -#ifndef SIMPLEHASH_H -#define SIMPLEHASH_H - -#ifndef bool -#define bool int -#endif - -#ifndef true -#define true 1 -#endif - -#ifndef false -#define false 0 -#endif - -#include "mem.h" - -/* SimpleHash *********************************************************/ - -struct RuntimeHash * noargallocateRuntimeHash(); -struct RuntimeHash * allocateRuntimeHash(int size); -void RuntimeHashaddChild(struct RuntimeHash *thisvar, struct RuntimeHash * child); -void freeRuntimeHash(struct RuntimeHash *); - -void RuntimeHashrehash(struct RuntimeHash * thisvar); -int RuntimeHashadd(struct RuntimeHash *, int key, int data); -#ifdef RAW -int RuntimeHashadd_I(struct RuntimeHash *, int key, int data); -#endif -int RuntimeHashremovekey(struct RuntimeHash *,int key); -int RuntimeHashremove(struct RuntimeHash *,int key, int data); -bool RuntimeHashcontainskey(struct RuntimeHash *,int key); -bool RuntimeHashcontainskeydata(struct RuntimeHash *,int key, int data); -int RuntimeHashget(struct RuntimeHash *,int key, int* data); -void RuntimeHashaddParent(struct RuntimeHash *,struct RuntimeHash* parent); -int RuntimeHashfirstkey(struct RuntimeHash *); -struct RuntimeIterator* RuntimeHashcreateiterator(struct RuntimeHash *); -void RuntimeHashiterator(struct RuntimeHash *, struct RuntimeIterator * it); -int RuntimeHashcount(struct RuntimeHash *, int key); -struct RuntimeHash * RuntimeHashimageSet(struct RuntimeHash *, int key); - -struct RuntimeHash { - int numelements; - int size; - struct RuntimeNode **bucket; - struct RuntimeNode *listhead; - struct RuntimeNode *listtail; -}; - -inline int RuntimeHashcountset(struct RuntimeHash * thisvar); - -/* RuntimeHashException *************************************************/ - - -/* RuntimeIterator *****************************************************/ -#define ARRAYSIZE 100 - -struct RuntimeNode { - struct RuntimeNode *next; - struct RuntimeNode *lnext; - struct RuntimeNode *lprev; - int data; - int key; -}; - -struct RuntimeIterator { - struct RuntimeNode *cur; -}; - -inline struct RuntimeIterator * noargallocateRuntimeIterator(); - -inline struct RuntimeIterator * allocateRuntimeIterator(struct RuntimeNode *start); - -inline int RunhasNext(struct RuntimeIterator *thisvar); - -inline int Runnext(struct RuntimeIterator *thisvar); - -inline int Runkey(struct RuntimeIterator *thisvar); - -#endif diff --git a/Robust/src/Runtime/callconventions b/Robust/src/Runtime/callconventions deleted file mode 100644 index 6eb59c74..00000000 --- a/Robust/src/Runtime/callconventions +++ /dev/null @@ -1,10 +0,0 @@ -All calling conventions for native methods are #defines - -We support two types of garbage collectors -1. Precise Garbage Collector -2. Conservative Garbage Collector - -CALLXX => CALL, no of additional parameters other than the name, no of parameters for garbage collection -for e.g. -CALL11(x, y, y) -call, 1= number of parameters i.e. y, 1= No of parameters to be garbage collected i.e. y diff --git a/Robust/src/Runtime/checkpoint.c b/Robust/src/Runtime/checkpoint.c deleted file mode 100644 index dd3be84d..00000000 --- a/Robust/src/Runtime/checkpoint.c +++ /dev/null @@ -1,352 +0,0 @@ -#include "checkpoint.h" -#include "runtime.h" -#include "structdefs.h" -#include -#ifdef DMALLOC -#include "dmalloc.h" -#endif -extern void * curr_heapbase; -extern void * curr_heapptr; -extern void * curr_heapgcpoint; -extern void * curr_heaptop; - -extern void * to_heapbase; -extern void * to_heapptr; -extern void * to_heaptop; - - -#define MALLOCSIZE 20*1024 - -struct malloclist { - struct malloclist *next; - int size; -#ifdef RAW - char * space; -#else - char space[]; -#endif -}; - -struct malloclist * top=NULL; -int offset=0; - -void * cpmalloc(int size) { - int endoffset=offset+size; - int tmpoffset=0; - if (top==NULL||endoffset>top->size) { - int basesize=MALLOCSIZE; - struct malloclist *tmp; - if (size>basesize) - basesize=size; - tmp=RUNMALLOC(sizeof(struct malloclist)+basesize); - tmp->next=top; - top=tmp; - top->size=basesize; - offset=0; - } - tmpoffset=offset; - offset+=size; - return &top->space[tmpoffset]; -} - -void freemalloc() { - while(top!=NULL) { - struct malloclist *next=top->next; - RUNFREE(top); - top=next; - } -} - -void checkvalid(void * ptr) { - if (ptr>=curr_heapbase&&ptr<=curr_heaptop) { -#ifndef RAW - printf("Valid\n"); -#endif - } -} - -void validitycheck(struct RuntimeHash *forward, struct RuntimeHash *reverse) { - struct RuntimeIterator rit; - RuntimeHashiterator(forward, &rit); - while(RunhasNext(&rit)) { - struct ___Object___ * data=(struct ___Object___*) Runnext(&rit); - int type=data->type; - unsigned int * pointer=pointerarray[type]; - int size; - int i; - if (pointer!=0&&((int)pointer)!=1) { - size=pointer[0]; - for(i=1;i<=size;i++) { - int offset=pointer[i]; - void * ptr=*(void **) (((int) data) + offset); - if (ptr!=NULL&&!RuntimeHashcontainskey(reverse, (int) ptr)) { -#ifndef RAW - printf("Bad\n"); -#endif - } - checkvalid(ptr); - } - } - } - - RuntimeHashiterator(reverse, &rit); - while(RunhasNext(&rit)) { - struct ___Object___ * data=(struct ___Object___*) Runkey(&rit); - int type=0; - unsigned int * pointer=NULL; - int size; - int i; - Runnext(&rit); - type=data->type; - pointer=pointerarray[type]; - if (pointer!=0&&((int)pointer)!=1) { - size=pointer[0]; - for(i=1;i<=size;i++) { - int offset=pointer[i]; - void * ptr=*(void **) (((int) data) + offset); - if (ptr!=NULL&&!RuntimeHashcontainskey(reverse, (int) ptr)) { -#ifndef RAW - printf("Bad2\n"); -#endif - } - checkvalid(ptr); - } - } - } - } - - - -void ** makecheckpoint(int numparams, void ** srcpointer, struct RuntimeHash * forward, struct RuntimeHash * reverse) { -#ifdef PRECISE_GC - void **newarray=cpmalloc(sizeof(void *)*numparams); -#else - void **newarray=RUNMALLOC(sizeof(void *)*numparams); -#endif - struct RuntimeHash *todo=allocateRuntimeHash(100); - int i; - - for(i=0;iflagptr; - if (objptr!=NULL) { - if (!RuntimeHashcontainskey(forward, (int) objptr)) { - void *copy=createcopy(objptr); - RuntimeHashadd(forward, (int) objptr, (int) copy); - RuntimeHashadd(reverse, (int) copy, (int) objptr); - RuntimeHashadd(todo, (int) objptr, (int) objptr); - ((struct ___TagDescriptor___*)cpy)->flagptr=copy; - } else { - RuntimeHashget(forward, (int) objptr, (int *) &(((struct ___TagDescriptor___*) cpy)->flagptr)); - } - } - } else -#endif - if (pointer==0) { - /* Array of primitives */ - /* Do nothing */ - } else if (((int)pointer)==1) { - /* Array of pointers */ - struct ArrayObject *ao=(struct ArrayObject *) ptr; - struct ArrayObject *ao_cpy=(struct ArrayObject *) cpy; - int length=ao->___length___; - int i; - for(i=0;i___length___)+sizeof(int)))[i]; - if (objptr==NULL) { - ((void **)(((char *)& ao_cpy->___length___)+sizeof(int)))[i]=NULL; - } else if (RuntimeHashcontainskey(forward, (int) objptr)) - RuntimeHashget(forward,(int) objptr,(int *) &((void **)(((char *)& ao_cpy->___length___)+sizeof(int)))[i]); - else { - void * copy=createcopy(objptr); - RuntimeHashadd(forward, (int) objptr, (int)copy); - RuntimeHashadd(reverse, (int) copy, (int) objptr); - RuntimeHashadd(todo, (int) objptr, (int) objptr); - ((void **)(((char *)& ao_cpy->___length___)+sizeof(int)))[i]=copy; - } - } - } else { - int size=pointer[0]; - int i; - for(i=1;i<=size;i++) { - int offset=pointer[i]; - void * objptr=*((void **)(((int)ptr)+offset)); - if (objptr==NULL) { - *((void **) (((int)cpy)+offset))=NULL; - } else if (RuntimeHashcontainskey(forward, (int) objptr)) - RuntimeHashget(forward, (int) objptr, (int *) &(((char *)cpy)[offset])); - else { - void * copy=createcopy(objptr); - RuntimeHashadd(forward, (int) objptr, (int) copy); - RuntimeHashadd(reverse, (int) copy, (int) objptr); - RuntimeHashadd(todo, (int) objptr, (int) objptr); - *((void **) (((int)cpy)+offset))=copy; - } - } - } - } - } - freeRuntimeHash(todo); - return newarray; -} - -void * createcopy(void * orig) { - if (orig==0) - return 0; - else { - int type=((int *)orig)[0]; - if (type___length___; - int size=sizeof(struct ArrayObject)+length*elementsize; -#ifdef PRECISE_GC - void *newobj=cpmalloc(size); -#else - void *newobj=RUNMALLOC(size); -#endif - memcpy(newobj, orig, size); - return newobj; - } - } -} - -void restorecheckpoint(int numparams, void ** original, void ** checkpoint, struct RuntimeHash *forward, struct RuntimeHash * reverse) { - struct RuntimeHash *todo=allocateRuntimeHash(100); - struct RuntimeHash *visited=allocateRuntimeHash(100); - int i; - - for(i=0;iflagptr; - memcpy(cpy, ptr, size); - if (objptr!=NULL) { - if (!RuntimeHashcontainskey(visited, (int) objptr)) { - RuntimeHashadd(visited, (int) objptr, (int) objptr); - RuntimeHashadd(todo, (int) objptr, (int) objptr); - } - RuntimeHashget(reverse, (int) objptr, (int *) & (((struct ___TagDescriptor___ *)cpy)->flagptr)); - } - } else -#endif - if (pointer==0) { - /* Array of primitives */ - struct ArrayObject *ao=(struct ArrayObject *) ptr; - int length=ao->___length___; - int cpysize=sizeof(struct ArrayObject)+length*size; - memcpy(cpy, ptr, cpysize); - } else if ((int)pointer==1) { - /* Array of pointers */ - struct ArrayObject *ao=(struct ArrayObject *) ptr; - struct ArrayObject *ao_cpy=(struct ArrayObject *) cpy; - int length=ao->___length___; - int i; - int cpysize=sizeof(struct ArrayObject)+length*size; - memcpy(ao_cpy, ao, cpysize); - - for(i=0;i___length___)+sizeof(int)))[i]; - if (objptr==NULL) - ((void **)(((char *)& ao_cpy->___length___)+sizeof(int)))[i]=NULL; - else { - if (!RuntimeHashcontainskey(visited, (int) objptr)) { - RuntimeHashadd(visited, (int) objptr, (int) objptr); - RuntimeHashadd(todo, (int) objptr, (int) objptr); - } - RuntimeHashget(reverse, (int) objptr, (int *) &((void **)(((char *)& ao_cpy->___length___)+sizeof(int)))[i]); - } - } - } else { - int numptr=pointer[0]; - int i; - void *flagptr; - int oldflag; - int currflag; - if (hasflags[type]) { - flagptr=(void *) (((int *)cpy)[2]); - oldflag=(((int *)cpy)[1]); - currflag=(((int *)ptr)[1]); - } - memcpy(cpy, ptr, size); - for(i=1;i<=numptr;i++) { - int offset=pointer[i]; - void * objptr=*((void **)(((int)ptr)+offset)); - if (objptr==NULL) - *((void **) (((int)cpy)+offset))=NULL; - else { - if (!RuntimeHashcontainskey(visited, (int) objptr)) { - RuntimeHashadd(visited, (int) objptr, (int) objptr); - RuntimeHashadd(todo, (int) objptr, (int) objptr); - } - RuntimeHashget(reverse, (int) objptr, (int *) &(((char *)cpy)[offset])); - } - } - if (hasflags[type]) { - (((void **)cpy)[2])=flagptr; - if (currflag!=oldflag) { - flagorandinit(cpy, 0, 0xFFFFFFFF); -#ifdef MULTICORE - enqueueObject(cpy, NULL,0); //TODO -#else - enqueueObject(cpy); -#endif - } - } - } - } - } - freeRuntimeHash(todo); - freeRuntimeHash(visited); -} diff --git a/Robust/src/Runtime/checkpoint.h b/Robust/src/Runtime/checkpoint.h deleted file mode 100644 index 9f600953..00000000 --- a/Robust/src/Runtime/checkpoint.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef CHECKPOINT_H -#define CHECKPOINT_H -#include "SimpleHash.h" - -void ** makecheckpoint(int numparams, void ** pointerarray, struct RuntimeHash * forward, struct RuntimeHash * reverse); - -void restorecheckpoint(int numparams, void ** original, void ** checkpoint, struct RuntimeHash *forward, struct RuntimeHash * reverse); - -void * createcopy(void * orig); -void freemalloc(); -#endif diff --git a/Robust/src/Runtime/file.c b/Robust/src/Runtime/file.c deleted file mode 100644 index 6a13701d..00000000 --- a/Robust/src/Runtime/file.c +++ /dev/null @@ -1,71 +0,0 @@ -#include -#include -#include -//#ifndef RAW -//#include -//#endif -#include -#include "structdefs.h" -#include "mem.h" -#include "runtime.h" - -void CALL34(___FileOutputStream______nativeWrite____I__AR_B_I_I, int fd, int off, int len, int fd, struct ArrayObject * ___array___, int off, int len) { - char * string= (((char *)& VAR(___array___)->___length___)+sizeof(int)); - int status=write(fd, &string[off], len); -} - -void CALL11(___FileOutputStream______nativeClose____I, int fd, int fd) { - close(fd); -} - -void CALL11(___FileOutputStream______nativeFlush____I, int fd, int fd) { - // not supported in RAW version -#ifndef RAW - fsync(fd); -#endif -} - -int CALL01(___FileOutputStream______nativeOpen_____AR_B, struct ArrayObject * ___filename___) { - int length=VAR(___filename___)->___length___; - char* filename= (((char *)& VAR(___filename___)->___length___)+sizeof(int)); - int fd=open(filename, O_WRONLY|O_CREAT|O_TRUNC, S_IRWXU); - return fd; -} - -int CALL01(___FileOutputStream______nativeAppend_____AR_B, struct ArrayObject * ___filename___) { - int length=VAR(___filename___)->___length___; - char* filename= (((char *)& VAR(___filename___)->___length___)+sizeof(int)); - int fd=open(filename, O_WRONLY|O_CREAT|O_APPEND, S_IRWXU); - return fd; -} - -int CALL01(___FileInputStream______nativeOpen_____AR_B, struct ArrayObject * ___filename___) { - int length=VAR(___filename___)->___length___; - char* filename= (((char *)& VAR(___filename___)->___length___)+sizeof(int)); - int fd=open(filename, O_RDONLY, 0); - return fd; -} - -void CALL11(___FileInputStream______nativeClose____I, int fd, int fd) { - close(fd); -} - -int CALL23(___FileInputStream______nativeRead____I__AR_B_I, int fd, int numBytes, int fd, struct ArrayObject * ___array___, int numBytes) { - int toread=VAR(___array___)->___length___; - char* string= (((char *)& VAR(___array___)->___length___)+sizeof(int)); - int status; - - if (numBytes___length___; - char* filename= (((char *)& VAR(___pathname___)->___length___)+sizeof(int)); - struct stat st; - stat(filename, &st); - return st.st_size; -} diff --git a/Robust/src/Runtime/garbage.c b/Robust/src/Runtime/garbage.c deleted file mode 100644 index beb67c86..00000000 --- a/Robust/src/Runtime/garbage.c +++ /dev/null @@ -1,592 +0,0 @@ -#include "garbage.h" -#include "runtime.h" -#include "structdefs.h" -#include "Queue.h" -#include "SimpleHash.h" -#include "GenericHashtable.h" -#include -#if defined(THREADS) || defined(DSTM) -#include "thread.h" -#endif - -#ifdef DMALLOC -#include "dmalloc.h" -#endif -#ifdef DSTM -#include "dstm.h" -#endif - -#define NUMPTRS 100 - -#define INITIALHEAPSIZE 10*1024 -#define GCPOINT(x) ((int)((x)*0.9)) -/* This define takes in how full the heap is initially and returns a new heap size to use */ -#define HEAPSIZE(x,y) (((int)((x)/0.6))+y) - -#ifdef TASK -extern struct genhashtable * activetasks; -#ifndef MULTICORE -extern struct parameterwrapper * objectqueues[NUMCLASSES]; -#endif -extern struct genhashtable * failedtasks; -extern struct taskparamdescriptor *currtpd; -extern struct RuntimeHash *forward; -extern struct RuntimeHash *reverse; -extern struct RuntimeHash *fdtoobject; -#endif - -#if defined(THREADS) || defined(DSTM) -int needtocollect=0; -struct listitem * list=NULL; -int listcount=0; -#endif - -//Need to check if pointers are transaction pointers -#ifdef DSTM -#define ENQUEUE(orig, dst) \ -if ((!(((unsigned int)orig)&0x1))) {\ -if (orig>=curr_heapbase&&orignext=tmp; - head=tmp; - headindex=0; - } - head->ptrs[headindex++]=ptr; -} - -void * dequeue() { - if (tailindex==NUMPTRS) { - struct pointerblock *tmp=tail; - tail=tail->next; - tailindex=0; - if (spare!=NULL) - free(tmp); - else - spare=tmp; - } - return tail->ptrs[tailindex++]; -} - -int moreItems() { - if ((head==tail)&&(tailindex==headindex)) - return 0; - return 1; -} - -#ifdef TASK -struct pointerblock *taghead=NULL; -int tagindex=0; - -void enqueuetag(struct ___TagDescriptor___ *ptr) { - if (tagindex==NUMPTRS) { - struct pointerblock * tmp=malloc(sizeof(struct pointerblock)); - tmp->next=taghead; - taghead=tmp; - tagindex=0; - } - taghead->ptrs[tagindex++]=ptr; -} -#endif - - -void collect(struct garbagelist * stackptr) { -#if defined(THREADS)||defined(DSTM) - needtocollect=1; - pthread_mutex_lock(&gclistlock); - while(1) { - if ((listcount+1)==threadcount) { - break; /* Have all other threads stopped */ - } - pthread_cond_wait(&gccond, &gclistlock); - } -#endif - - if (head==NULL) { - headindex=0; - tailindex=0; - head=tail=malloc(sizeof(struct pointerblock)); - } - -#ifdef TASK - if (taghead==NULL) { - tagindex=0; - taghead=malloc(sizeof(struct pointerblock)); - taghead->next=NULL; - } -#endif - - /* Check current stack */ -#if defined(THREADS)||defined(DSTM) - { - struct listitem *listptr=list; - while(1) { -#endif - - while(stackptr!=NULL) { - int i; - for(i=0;isize;i++) { - void * orig=stackptr->array[i]; - ENQUEUE(orig, stackptr->array[i]); - } - stackptr=stackptr->next; - } -#if defined(THREADS)||defined(DSTM) - /* Go to next thread */ - if (listptr!=NULL) { - void * orig=listptr->locklist; - ENQUEUE(orig, listptr->locklist); - stackptr=listptr->stackptr; - listptr=listptr->next; - } else - break; - } - } -#endif - -#ifdef TASK - { - /* Update objectsets */ - int i; - for(i=0;iobjectset; - struct ObjectNode * ptr=set->listhead; - while(ptr!=NULL) { - void *orig=(void *)ptr->key; - ENQUEUE(orig, *((void **)(&ptr->key))); - ptr=ptr->lnext; - } - ObjectHashrehash(set); /* Rehash the table */ - p=p->next; - } -#endif - } - } - - if (forward!=NULL) { - struct RuntimeNode * ptr=forward->listhead; - while(ptr!=NULL) { - void * orig=(void *)ptr->key; - ENQUEUE(orig, *((void **)(&ptr->key))); - ptr=ptr->lnext; - } - RuntimeHashrehash(forward); /* Rehash the table */ - } - - if (reverse!=NULL) { - struct RuntimeNode * ptr=reverse->listhead; - while(ptr!=NULL) { - void *orig=(void *)ptr->data; - ENQUEUE(orig, *((void**)(&ptr->data))); - ptr=ptr->lnext; - } - } - - { - struct RuntimeNode * ptr=fdtoobject->listhead; - while(ptr!=NULL) { - void *orig=(void *)ptr->data; - ENQUEUE(orig, *((void**)(&ptr->data))); - ptr=ptr->lnext; - } - } - - { - /* Update current task descriptor */ - int i; - for(i=0;inumParameters;i++) { - void *orig=currtpd->parameterArray[i]; - ENQUEUE(orig, currtpd->parameterArray[i]); - } - - } - - /* Update active tasks */ - { - struct genpointerlist * ptr=activetasks->list; - while(ptr!=NULL) { - struct taskparamdescriptor *tpd=ptr->src; - int i; - for(i=0;inumParameters;i++) { - void * orig=tpd->parameterArray[i]; - ENQUEUE(orig, tpd->parameterArray[i]); - } - ptr=ptr->inext; - } - genrehash(activetasks); - } - - /* Update failed tasks */ - { - struct genpointerlist * ptr=failedtasks->list; - while(ptr!=NULL) { - struct taskparamdescriptor *tpd=ptr->src; - int i; - for(i=0;inumParameters;i++) { - void * orig=tpd->parameterArray[i]; - ENQUEUE(orig, tpd->parameterArray[i]); - } - ptr=ptr->inext; - } - genrehash(failedtasks); - } -#endif - - while(moreItems()) { - void * ptr=dequeue(); - void *cpy=((void **)ptr)[1]; - int type=((int *)cpy)[0]; - unsigned int * pointer; -#ifdef TASK - if(type==TAGTYPE) { - /* Enqueue Tag */ - /* Nothing is inside */ - enqueuetag(ptr); - continue; - } -#endif - pointer=pointerarray[type]; - if (pointer==0) { - /* Array of primitives */ - /* Do nothing */ -#ifdef DSTM - struct ArrayObject *ao=(struct ArrayObject *) ptr; - struct ArrayObject *ao_cpy=(struct ArrayObject *) cpy; - ENQUEUE((void *)ao->___nextobject___, *((void **)&ao_cpy->___nextobject___)); - ENQUEUE((void *)ao->___localcopy___, *((void **)&ao_cpy->___localcopy___)); -#endif - } else if (((int)pointer)==1) { - /* Array of pointers */ - struct ArrayObject *ao=(struct ArrayObject *) ptr; - struct ArrayObject *ao_cpy=(struct ArrayObject *) cpy; -#ifdef DSTM - ENQUEUE((void *)ao->___nextobject___, *((void **)&ao_cpy->___nextobject___)); - ENQUEUE((void *)ao->___localcopy___, *((void **)&ao_cpy->___localcopy___)); -#endif - int length=ao->___length___; - int i; - for(i=0;i___length___)+sizeof(int)))[i]; - ENQUEUE(objptr, ((void **)(((char *)& ao_cpy->___length___)+sizeof(int)))[i]); - } - } else { - int size=pointer[0]; - int i; - for(i=1;i<=size;i++) { - unsigned int offset=pointer[i]; - void * objptr=*((void **)(((int)ptr)+offset)); - ENQUEUE(objptr, *((void **) (((int)cpy)+offset))); - } - } - } -#ifdef TASK - fixtags(); -#endif - -#if defined(THREADS)||defined(DSTM) - needtocollect=0; - pthread_mutex_unlock(&gclistlock); -#endif -} - -#ifdef TASK - -/* Fix up the references from tags. This can't be done earlier, - because we don't want tags to keep objects alive */ -void fixtags() { - while(taghead!=NULL) { - int i; - struct pointerblock *tmp=taghead->next; - for(i=0;iptrs[i]; - struct ___Object___ *obj=tagd->flagptr; - struct ___TagDescriptor___ *copy=((struct ___TagDescriptor___**)tagd)[1]; - if (obj==NULL) { - /* Zero object case */ - } else if (obj->type==-1) { - /* Single object case */ - copy->flagptr=((struct ___Object___**)obj)[1]; - } else if (obj->type==OBJECTARRAYTYPE) { - /* Array case */ - struct ArrayObject *ao=(struct ArrayObject *) obj; - int livecount=0; - int j; - int k=0; - struct ArrayObject *aonew; - - /* Count live objects */ - for(j=0;j___cachedCode___;j++) { - struct ___Object___ * tobj=ARRAYGET(ao, struct ___Object___ *, j); - if (tobj->type==-1) - livecount++; - } - - livecount=((livecount-1)/OBJECTARRAYINTERVAL+1)*OBJECTARRAYINTERVAL; - aonew=(struct ArrayObject *) tomalloc(sizeof(struct ArrayObject)+sizeof(struct ___Object___*)*livecount); - memcpy(aonew, ao, sizeof(struct ArrayObject)); - aonew->type=OBJECTARRAYTYPE; - aonew->___length___=livecount; - copy->flagptr=aonew; - for(j=0;j___cachedCode___;j++) { - struct ___Object___ * tobj=ARRAYGET(ao, struct ___Object___ *, j); - if (tobj->type==-1) { - struct ___Object___ * tobjcpy=((struct ___Object___**)tobj)[1]; - ARRAYSET(aonew, struct ___Object___*, k++,tobjcpy); - } - } - aonew->___cachedCode___=k; - for(;kflagptr=NULL; - } - } - free(taghead); - taghead=tmp; - tagindex=NUMPTRS; - } -} -#endif - -void * tomalloc(int size) { - void * ptr=to_heapptr; - if ((size%4)!=0) - size+=(4-(size%4)); - to_heapptr+=size; - return ptr; -} - -#if defined(THREADS)||defined(DSTM) -void checkcollect(void * ptr) { - if (needtocollect) { - struct listitem * tmp=stopforgc((struct garbagelist *)ptr); - pthread_mutex_lock(&gclock); // Wait for GC - restartaftergc(tmp); - pthread_mutex_unlock(&gclock); - - } -} - -#ifdef DSTM -void checkcollect2(void * ptr, transrecord_t *trans) { - if (needtocollect) { - int ptrarray[]={1, (int)ptr, (int) trans->revertlist}; - struct listitem * tmp=stopforgc((struct garbagelist *)ptrarray); - pthread_mutex_lock(&gclock); // Wait for GC - restartaftergc(tmp); - pthread_mutex_unlock(&gclock); - trans->revertlist=(struct ___Object___*)ptrarray[2]; - } -} -#endif - - -struct listitem * stopforgc(struct garbagelist * ptr) { - struct listitem * litem=malloc(sizeof(struct listitem)); - litem->stackptr=ptr; - litem->locklist=pthread_getspecific(threadlocks); - litem->prev=NULL; - pthread_mutex_lock(&gclistlock); - litem->next=list; - if(list!=NULL) - list->prev=litem; - list=litem; - listcount++; - pthread_cond_signal(&gccond); - pthread_mutex_unlock(&gclistlock); - return litem; -} - -void restartaftergc(struct listitem * litem) { - pthread_mutex_lock(&gclistlock); - pthread_setspecific(threadlocks, litem->locklist); - if (litem->prev==NULL) { - list=litem->next; - } else { - litem->prev->next=litem->next; - } - if (litem->next!=NULL) { - litem->next->prev=litem->prev; - } - listcount--; - pthread_mutex_unlock(&gclistlock); - free(litem); -} -#endif - -void * mygcmalloc(struct garbagelist * stackptr, int size) { - void *ptr; -#if defined(THREADS)||defined(DSTM) - if (pthread_mutex_trylock(&gclock)!=0) { - struct listitem *tmp=stopforgc(stackptr); - pthread_mutex_lock(&gclock); - restartaftergc(tmp); - } -#endif - ptr=curr_heapptr; - if ((size%4)!=0) - size+=(4-(size%4)); - curr_heapptr+=size; - if (curr_heapptr>curr_heapgcpoint) { - if (curr_heapbase==0) { - /* Need to allocate base heap */ - curr_heapbase=malloc(INITIALHEAPSIZE); - bzero(curr_heapbase, INITIALHEAPSIZE); - curr_heaptop=curr_heapbase+INITIALHEAPSIZE; - curr_heapgcpoint=((char *) curr_heapbase)+GCPOINT(INITIALHEAPSIZE); - curr_heapptr=curr_heapbase+size; - - to_heapbase=malloc(INITIALHEAPSIZE); - to_heaptop=to_heapbase+INITIALHEAPSIZE; - to_heapptr=to_heapbase; - ptr=curr_heapbase; -#if defined(THREADS)||defined(DSTM) - pthread_mutex_unlock(&gclock); -#endif - return ptr; - } - - /* Grow the to heap if necessary */ - { - int curr_heapsize=curr_heaptop-curr_heapbase; - int to_heapsize=to_heaptop-to_heapbase; - int last_heapsize=0; - if (lastgcsize>0) { - last_heapsize=HEAPSIZE(lastgcsize, size); - if ((last_heapsize%4)!=0) - last_heapsize+=(4-(last_heapsize%4)); - } - if (curr_heapsize>last_heapsize) - last_heapsize=curr_heapsize; - if (last_heapsize>to_heapsize) { - free(to_heapbase); - to_heapbase=malloc(last_heapsize); - to_heaptop=to_heapbase+last_heapsize; - to_heapptr=to_heapbase; - } - } - - /* Do our collection */ - collect(stackptr); - - /* Update stat on previous gc size */ - lastgcsize=(to_heapptr-to_heapbase)+size; - - /* Flip to/curr heaps */ - { - void * tmp=to_heapbase; - to_heapbase=curr_heapbase; - curr_heapbase=tmp; - - tmp=to_heaptop; - to_heaptop=curr_heaptop; - curr_heaptop=tmp; - - tmp=to_heapptr; - curr_heapptr=to_heapptr+size; - curr_heapgcpoint=((char *) curr_heapbase)+GCPOINT(curr_heaptop-curr_heapbase); - to_heapptr=to_heapbase; - - /* Not enough room :(, redo gc */ - if (curr_heapptr>curr_heapgcpoint) { -#if defined(THREADS)||defined(DSTM) - pthread_mutex_unlock(&gclock); -#endif - return mygcmalloc(stackptr, size); - } - - bzero(tmp, curr_heaptop-tmp); -#if defined(THREADS)||defined(DSTM) - pthread_mutex_unlock(&gclock); -#endif - return tmp; - } - } else { -#if defined(THREADS)||defined(DSTM) - pthread_mutex_unlock(&gclock); -#endif - return ptr; - } -} - - -int gc_createcopy(void * orig, void ** copy_ptr) { - if (orig==0) { - *copy_ptr=NULL; - return 0; - } else { - int type=((int *)orig)[0]; - if (type==-1) { - *copy_ptr=((void **)orig)[1]; - return 0; - } if (type___length___; - int size=sizeof(struct ArrayObject)+length*elementsize; - void *newobj=tomalloc(size); - memcpy(newobj, orig, size); - ((int *)orig)[0]=-1; - ((void **)orig)[1]=newobj; - *copy_ptr=newobj; - return 1; - } - } -} diff --git a/Robust/src/Runtime/garbage.h b/Robust/src/Runtime/garbage.h deleted file mode 100644 index 5a65de65..00000000 --- a/Robust/src/Runtime/garbage.h +++ /dev/null @@ -1,29 +0,0 @@ -#ifndef GARBAGE_H -#define GARBAGE_H -struct garbagelist { - int size; - struct garbagelist *next; - void * array[]; -}; - -struct listitem { - struct listitem * prev; - struct listitem * next; - struct garbagelist * stackptr; - struct ___Object___ * locklist; -}; - -#ifdef TASK -void fixtags(); -#endif - -#if defined(THREADS)||defined(DSTM) -void checkcollect(void * ptr); -struct listitem * stopforgc(struct garbagelist * ptr); -void restartaftergc(struct listitem * litem); -#endif -void * tomalloc(int size); -void collect(struct garbagelist *stackptr); -int gc_createcopy(void * orig, void **); -void * mygcmalloc(struct garbagelist * ptr, int size); -#endif diff --git a/Robust/src/Runtime/math.c b/Robust/src/Runtime/math.c deleted file mode 100644 index 7a54d283..00000000 --- a/Robust/src/Runtime/math.c +++ /dev/null @@ -1,63 +0,0 @@ -#include "runtime.h" -#include "math.h" -#include "structdefs.h" - -double CALL11(___Math______cos____D, double ___a___, double ___a___) { - return cos(___a___); -} - -double CALL11(___Math______sin____D, double ___a___, double ___a___) { - return sin(___a___); -} - -double CALL11(___Math______tan____D, double ___a___, double ___a___) { - return tan(___a___); -} - -double CALL11(___Math______acos____D, double ___a___, double ___a___) { - return acos(___a___); -} - -double CALL11(___Math______asin____D, double ___a___, double ___a___) { - return asin(___a___); -} - -double CALL11(___Math______atan____D, double ___a___, double ___a___) { - return atan(___a___); -} - -double CALL11(___Math______log____D, double ___a___, double ___a___) { - return log(___a___); -} - -double CALL11(___Math______exp____D, double ___a___, double ___a___) { - return exp(___a___); -} - -double CALL11(___Math______sqrt____D, double ___a___, double ___a___) { - return sqrt(___a___); -} - -double CALL22(___Math______pow____D_D, double ___a___, double ___b___, double ___a___, double ___b___) { - return pow(___a___,___b___); -} - -float CALL11(___Math______cosf____F, float ___a___, float ___a___) { - return cosf(___a___); -} - -float CALL11(___Math______sinf____F, float ___a___, float ___a___) { - return sinf(___a___); -} - -float CALL11(___Math______sqrtf____F, float ___a___, float ___a___) { - return sqrtf(___a___); -} - -float CALL11(___Math______logf____F, float ___a___, float ___a___) { - return logf(___a___); -} - -float CALL22(___Math______powf____F_F, float ___a___, float ___b___, float ___a___, float ___b___) { - return powf(___a___,___b___); -} diff --git a/Robust/src/Runtime/mem.c b/Robust/src/Runtime/mem.c deleted file mode 100644 index 3c1f8d5a..00000000 --- a/Robust/src/Runtime/mem.c +++ /dev/null @@ -1,58 +0,0 @@ -#include "mem.h" - -#ifdef RAW -#include "runtime.h" -#include - -/*void * m_calloc(int m, int size) { - void * p = malloc(m*size); - int i = 0; - for(i = 0; i < size; ++i) { - *(char *)(p+i) = 0; - } - return p; -}*/ - -void * mycalloc(int m, int size) { - void * p = NULL; - int isize = 2*kCacheLineSize-4+(size-1)&(~kCacheLineMask); -#ifdef RAWDEBUG - raw_test_pass(0xdd00); -#endif -#ifdef INTERRUPT - // shut down interrupt - raw_user_interrupts_off(); -#endif - p = calloc(m, isize); - //p = m_calloc(m, isize); -#ifdef RAWDEBUG - raw_test_pass_reg(p); - raw_test_pass_reg((kCacheLineSize+((int)p-1)&(~kCacheLineMask))); -#endif -#ifdef INTERRUPT - // re-open interruption - raw_user_interrupts_on(); -#endif - return (void *)(kCacheLineSize+((int)p-1)&(~kCacheLineMask)); -} - -void * mycalloc_i(int m, int size) { - void * p = NULL; - int isize = 2*kCacheLineSize-4+(size-1)&(~kCacheLineMask); -#ifdef RAWDEBUG - raw_test_pass(0xdd00); -#endif - p = calloc(m, isize); - //p = m_calloc(m, isize); -#ifdef RAWDEBUG - raw_test_pass_reg(p); - raw_test_pass_reg((kCacheLineSize+((int)p-1)&(~kCacheLineMask))); -#endif - return (void *)(kCacheLineSize+((int)p-1)&(~kCacheLineMask)); -} - -void myfree(void * ptr) { - return; -} - -#endif diff --git a/Robust/src/Runtime/mem.h b/Robust/src/Runtime/mem.h deleted file mode 100644 index fa82a2c3..00000000 --- a/Robust/src/Runtime/mem.h +++ /dev/null @@ -1,36 +0,0 @@ -#ifndef MEMH -#define MEMH -#include -#ifndef RAW -#include -#endif - -#ifdef BOEHM_GC -#include "gc.h" -#define FREEMALLOC(x) GC_malloc(x) -#define RUNMALLOC(x) GC_malloc(x) -#define RUNFREE(x) -#else -#ifdef PRECISE_GC -#include "garbage.h" -#define RUNMALLOC(x) calloc(1,x) -#define RUNFREE(x) free(x) -#else -#ifdef RAW -void * mycalloc(int m, int size); -void * mycalloc_i(int m, int size); -void myfree(void * ptr); -#define FREEMALLOC(x) mycalloc(1,x) -#define RUNMALLOC(x) mycalloc(1,x) // handle interruption inside -#define RUNMALLOC_I(x) mycalloc_i(1,x) // with interruption blocked beforehand -#define RUNFREE(x) myfree(x); -//#define PTR(x) (32+(x-1)&~31) -#else -#define FREEMALLOC(x) calloc(1,x) -#define RUNMALLOC(x) calloc(1,x) -#define RUNFREE(x) free(x) -//#define PTR(x) (x) -#endif -#endif -#endif -#endif diff --git a/Robust/src/Runtime/multicoreruntime.c b/Robust/src/Runtime/multicoreruntime.c deleted file mode 100644 index a65f8c08..00000000 --- a/Robust/src/Runtime/multicoreruntime.c +++ /dev/null @@ -1,245 +0,0 @@ -#include "runtime.h" -#include "structdefs.h" -#include -#include "mem.h" -#include -#include -#include -#ifndef RAW -#include -#endif -//#include "option.h" - -extern int classsize[]; -jmp_buf error_handler; -int instructioncount; - -char *options; -int injectfailures=0; -float failurechance=0; -int debugtask=0; -int injectinstructionfailures; -int failurecount; -float instfailurechance=0; -int numfailures; -int instaccum=0; -#ifdef DMALLOC -#include "dmalloc.h" -#endif - -#ifdef RAW -void initializeexithandler() {} -#else -void exithandler(int sig, siginfo_t *info, void * uap) { -#ifdef DEBUG - printf("exit in exithandler\n"); -#endif - exit(0); -} - -void initializeexithandler() { - struct sigaction sig; - sig.sa_sigaction=&exithandler; - sig.sa_flags=SA_SIGINFO; - sigemptyset(&sig.sa_mask); - sigaction(SIGUSR2, &sig, 0); -} -#endif - -/* This function inject failures */ - -void injectinstructionfailure() { -#ifdef RAW - // not supported in RAW version - return; -#else -#ifdef TASK - if (injectinstructionfailures) { - if (numfailures==0) - return; - instructioncount=failurecount; - instaccum+=failurecount; - if ((((double)random())/RAND_MAX)0) - numfailures--; - printf("FAILURE!!! %d\n",numfailures); - longjmp(error_handler,11); - } - } -#else -#ifdef THREADS - if (injectinstructionfailures) { - if (numfailures==0) - return; - instaccum+=failurecount; - if ((((double)random())/RAND_MAX)0) - numfailures--; - printf("FAILURE!!! %d\n",numfailures); - threadexit(); - } - } -#endif -#endif -#endif -} - -void CALL11(___System______exit____I,int ___status___, int ___status___) { -#ifdef DEBUG - printf("exit in CALL11\n"); -#endif -#ifdef RAW - raw_test_done(___status___); -#else - exit(___status___); -#endif -} - -void CALL11(___System______printI____I,int ___status___, int ___status___) { -#ifdef DEBUG - printf("printI in CALL11\n"); -#endif -#ifdef RAW - raw_test_pass(0x1111); - raw_test_pass_reg(___status___); -#else - printf("%d\n", ___status___); -#endif -} - -long CALL00(___System______currentTimeMillis____) { -#ifdef RAW - // not supported in RAW version - return -1; -#else - struct timeval tv; long long retval; - gettimeofday(&tv, NULL); - retval = tv.tv_sec; /* seconds */ - retval*=1000; /* milliseconds */ - retval+= (tv.tv_usec/1000); /* adjust milliseconds & add them in */ - return retval; -#endif -} - -void CALL01(___System______printString____L___String___,struct ___String___ * ___s___) { -#ifdef RAW -#else - struct ArrayObject * chararray=VAR(___s___)->___value___; - int i; - int offset=VAR(___s___)->___offset___; - for(i=0;i___count___;i++) { - short sc=((short *)(((char *)& chararray->___length___)+sizeof(int)))[i+offset]; - putchar(sc); - } -#endif -} - -/* Object allocation function */ - -#ifdef PRECISE_GC -void * allocate_new(void * ptr, int type) { - struct ___Object___ * v=(struct ___Object___ *) mygcmalloc((struct garbagelist *) ptr, classsize[type]); - v->type=type; - v->isolate = 1; - v->version = 0; -#ifdef THREADS - v->tid=0; - v->lockentry=0; - v->lockcount=0; -#endif - return v; -} - -/* Array allocation function */ - -struct ArrayObject * allocate_newarray(void * ptr, int type, int length) { - struct ArrayObject * v=mygcmalloc((struct garbagelist *) ptr, sizeof(struct ArrayObject)+length*classsize[type]); - v->type=type; - v->isolate = 1; - v->version = 0; - if (length<0) { -#ifndef RAW - printf("ERROR: negative array\n"); -#endif - return NULL; - } - v->___length___=length; -#ifdef THREADS - v->tid=0; - v->lockentry=0; - v->lockcount=0; -#endif - return v; -} - -#else -void * allocate_new(int type) { - struct ___Object___ * v=FREEMALLOC(classsize[type]); - v->type=type; - v->isolate = 1; - v->version = 0; - return v; -} - -/* Array allocation function */ - -struct ArrayObject * allocate_newarray(int type, int length) { - struct ArrayObject * v=FREEMALLOC(sizeof(struct ArrayObject)+length*classsize[type]); - v->type=type; - v->isolate = 1; - v->version = 0; - v->___length___=length; - return v; -} -#endif - - -/* Converts C character arrays into Java strings */ -#ifdef PRECISE_GC -struct ___String___ * NewString(void * ptr, const char *str,int length) { -#else -struct ___String___ * NewString(const char *str,int length) { -#endif - int i; -#ifdef PRECISE_GC - struct ArrayObject * chararray=allocate_newarray((struct garbagelist *)ptr, CHARARRAYTYPE, length); - int ptrarray[]={1, (int) ptr, (int) chararray}; - struct ___String___ * strobj=allocate_new((struct garbagelist *) &ptrarray, STRINGTYPE); - chararray=(struct ArrayObject *) ptrarray[2]; -#else - struct ArrayObject * chararray=allocate_newarray(CHARARRAYTYPE, length); - struct ___String___ * strobj=allocate_new(STRINGTYPE); -#endif - strobj->___value___=chararray; - strobj->___count___=length; - strobj->___offset___=0; - - for(i=0;i___length___)+sizeof(int)))[i]=(short)str[i]; } - return strobj; -} - -/* Generated code calls this if we fail a bounds check */ - -void failedboundschk() { -#ifndef TASK - printf("Array out of bounds\n"); -#ifdef THREADS - threadexit(); -#else - exit(-1); -#endif -#else - longjmp(error_handler,2); -#endif -} - -/* Abort task call */ -void abort_task() { -#ifdef TASK - longjmp(error_handler,4); -#else - printf("Aborting\n"); - exit(-1); -#endif -} diff --git a/Robust/src/Runtime/multicoretask.c b/Robust/src/Runtime/multicoretask.c deleted file mode 100644 index 01516953..00000000 --- a/Robust/src/Runtime/multicoretask.c +++ /dev/null @@ -1,3443 +0,0 @@ -#ifdef TASK -#include "runtime.h" -#ifndef RAW -#include "structdefs.h" -#include "mem.h" -#include "checkpoint.h" -#include "Queue.h" -#include "SimpleHash.h" -#include "GenericHashtable.h" -#include -#include -#include -#include -#include -#include -#include -#endif -#ifdef RAW -#include -#include -//#include -#elif defined THREADSIMULATE -// use POSIX message queue -// for each core, its message queue named as -// /msgqueue_corenum -#include -#include -#endif -/* -extern int injectfailures; -extern float failurechance; -*/ -extern int debugtask; -extern int instaccum; - -#ifdef RAW -#define TOTALCORE raw_get_num_tiles() -#endif - -#ifdef CONSCHECK -#include "instrument.h" -#endif - -struct genhashtable * activetasks; -struct genhashtable * failedtasks; -struct taskparamdescriptor * currtpd; -#ifndef RAW -struct RuntimeHash * forward; -struct RuntimeHash * reverse; -#endif - -int corestatus[NUMCORES]; // records status of each core - // 1: running tasks - // 0: stall -int numsendobjs[NUMCORES]; // records how many objects a core has sent out -int numreceiveobjs[NUMCORES]; // records how many objects a core has received -#ifdef RAW -struct RuntimeHash locktable; -static struct RuntimeHash* locktbl = &locktable; -void * curr_heapbase=0; -void * curr_heaptop=0; -int self_numsendobjs; -int self_numreceiveobjs; -int lockobj; -int lockresult; -bool lockflag; -#ifndef INTERRUPT -bool reside; -#endif -struct Queue objqueue; -int msgdata[30]; -int msgtype; -int msgdataindex; -int msglength; -void calCoords(int core_num, int* coordY, int* coordX); -#elif defined THREADSIMULATE -static struct RuntimeHash* locktbl; -struct thread_data { - int corenum; - int argc; - char** argv; - int numsendobjs; - int numreceiveobjs; -}; -struct thread_data thread_data_array[NUMCORES]; -mqd_t mqd[NUMCORES]; -static pthread_key_t key; -static pthread_rwlock_t rwlock_tbl; -static pthread_rwlock_t rwlock_init; - -void run(void * arg); -#endif - -bool transStallMsg(int targetcore); -void transTerminateMsg(int targetcore); -int receiveObject(); -bool getreadlock(void* ptr); -void releasereadlock(void* ptr); -#ifdef RAW -bool getreadlock_I(void* ptr); -void releasereadlock_I(void* ptr); -#endif -bool getwritelock(void* ptr); -void releasewritelock(void* ptr); - -#ifdef RAW -void begin() { -#else -int main(int argc, char **argv) { -#endif -#ifdef RAW - int i = 0; - int argc = 1; - char ** argv = NULL; - bool sendStall = false; - bool isfirst = true; - bool tocontinue = false; - struct QueueItem * objitem = NULL; - struct transObjInfo * objInfo = NULL; - int grount = 0; - bool allStall = true; - int sumsendobj = 0; - -#ifdef RAWDEBUG - raw_test_pass(0xee01); -#endif - corenum = raw_get_abs_pos_x() + 4 * raw_get_abs_pos_y(); - - // initialize the arrays - if(STARTUPCORE == corenum) { - // startup core to initialize corestatus[] - for(i = 0; i < NUMCORES; ++i) { - corestatus[i] = 1; - numsendobjs[i] = 0; // assume all variables in RAW are local variables! MAY BE WRONG!!! - numreceiveobjs[i] = 0; - } - } - self_numsendobjs = 0; - self_numreceiveobjs = 0; - for(i = 0; i < 30; ++i) { - msgdata[i] = -1; - } - //msgdata = NULL; - msgtype = -1; - msgdataindex = 0; - msglength = 30; -#ifdef RAWDEBUG - raw_test_pass(0xee02); -#endif - - // create the lock table, lockresult table and obj queue - locktable.size = 20; - locktable.bucket = (struct RuntimeNode **) RUNMALLOC_I(sizeof(struct RuntimeNode *)*20); - /* Set allocation blocks*/ - locktable.listhead=NULL; - locktable.listtail=NULL; - /*Set data counts*/ - locktable.numelements = 0; - lockobj = 0; - lockresult = 0; - lockflag = false; -#ifndef INTERRUPT - reside = false; -#endif - objqueue.head = NULL; - objqueue.tail = NULL; -#ifdef RAWDEBUG - raw_test_pass(0xee03); -#endif - -#ifdef INTERRUPT - if (corenum < NUMCORES) { - // set up interrupts - setup_ints(); - //setup_interrupts(); - //start_gdn_avail_ints(recvMsg); - raw_user_interrupts_on(); -#ifdef RAWDEBUG - raw_test_pass(0xee04); -#endif - } -#endif - -#elif defined THREADSIMULATE - errno = 0; - int tids[NUMCORES]; - int rc[NUMCORES]; - pthread_t threads[NUMCORES]; - int i = 0; - - // initialize three arrays and msg queue array - char * pathhead = "/msgqueue_"; - int targetlen = strlen(pathhead); - for(i = 0; i < NUMCORES; ++i) { - corestatus[i] = 1; - numsendobjs[i] = 0; - numreceiveobjs[i] = 0; - - char corenumstr[3]; - int sourcelen = 0; - if(i < 10) { - corenumstr[0] = i + '0'; - corenumstr[1] = '\0'; - sourcelen = 1; - } else if(i < 100) { - corenumstr[1] = i %10 + '0'; - corenumstr[0] = (i / 10) + '0'; - corenumstr[2] = '\0'; - sourcelen = 2; - } else { - printf("Error: i >= 100\n"); - fflush(stdout); - exit(-1); - } - char path[targetlen + sourcelen + 1]; - strcpy(path, pathhead); - strncat(path, corenumstr, sourcelen); - int oflags = O_RDONLY|O_CREAT|O_NONBLOCK; - int omodes = S_IRWXU|S_IRWXG|S_IRWXO; - mq_unlink(path); - mqd[i]= mq_open(path, oflags, omodes, NULL); - if(mqd[i] == -1) { - printf("[Main] mq_open %s fails: %d, error: %s\n", path, mqd[i], strerror(errno)); - exit(-1); - } else { - printf("[Main] mq_open %s returns: %d\n", path, mqd[i]); - } - } - - // create the key - pthread_key_create(&key, NULL); - - // create the lock table and initialize its mutex - locktbl = allocateRuntimeHash(20); - int rc_locktbl = pthread_rwlock_init(&rwlock_tbl, NULL); - printf("[Main] initialize the rwlock for lock table: %d error: \n", rc_locktbl, strerror(rc_locktbl)); - - for(i = 0; i < NUMCORES; ++i) { - thread_data_array[i].corenum = i; - thread_data_array[i].argc = argc; - thread_data_array[i].argv = argv; - thread_data_array[i].numsendobjs = 0; - thread_data_array[i].numreceiveobjs = 0; - printf("[main] creating thread %d\n", i); - rc[i] = pthread_create(&threads[i], NULL, run, (void *)&thread_data_array[i]); - if (rc[i]){ - printf("[main] ERROR; return code from pthread_create() is %d\n", rc[i]); - fflush(stdout); - exit(-1); - } - } - - //pthread_exit(NULL); - while(true) {} -} - -void run(void* arg) { - struct thread_data * my_tdata = (struct thread_data *)arg; - pthread_setspecific(key, (void *)my_tdata->corenum); - int argc = my_tdata->argc; - char** argv = my_tdata->argv; - printf("[run, %d] Thread %d runs: %x\n", my_tdata->corenum, my_tdata->corenum, (int)pthread_self()); - fflush(stdout); - -#endif - -#ifdef BOEHM_GC - GC_init(); // Initialize the garbage collector -#endif -#ifdef CONSCHECK - initializemmap(); -#endif -#ifndef RAW - processOptions(); -#endif - initializeexithandler(); -#ifdef RAWDEBUG - raw_test_pass(0xee05); -#endif - /* Create table for failed tasks */ -#ifdef RAW - if(corenum > NUMCORES - 1) { - failedtasks = NULL; - activetasks = NULL; - while(true) { - receiveObject(); - } - } else { -#ifdef RAWDEBUG - raw_test_pass(0xee06); -#endif -#endif - /*failedtasks=genallocatehashtable((unsigned int (*)(void *)) &hashCodetpd, - (int (*)(void *,void *)) &comparetpd);*/ - failedtasks = NULL; -#ifdef RAWDEBUG - raw_test_pass(0xee07); -#endif - /* Create queue of active tasks */ - activetasks=genallocatehashtable((unsigned int (*)(void *)) &hashCodetpd, - (int (*)(void *,void *)) &comparetpd); -#ifdef RAWDEBUG - raw_test_pass(0xee08); -#endif - - /* Process task information */ - processtasks(); -#ifdef RAWDEBUG - raw_test_pass(0xee09); -#endif - - if(STARTUPCORE == corenum) { - /* Create startup object */ - createstartupobject(argc, argv); - } -#ifdef RAWDEBUG - raw_test_pass(0xee0a); -#endif - -#ifdef RAW -#ifdef RAWDEBUG - raw_test_pass(0xee0b); -#endif - - while(true) { -/*#ifndef INTERRUPT - while(receiveObject() != -1) { - } -#endif*/ - - // check if there are new active tasks can be executed - executetasks(); - -#ifndef INTERRUPT - while(receiveObject() != -1) { - } -#endif - -#ifdef RAWDEBUG - raw_test_pass(0xee0c); -#endif - - // check if there are some pending objects, if yes, enqueue them and executetasks again - tocontinue = false; -#ifdef RAWDEBUG - raw_test_pass(0xee0d); -#endif - while(!isEmpty(&objqueue)) { - void * obj = NULL; -#ifdef INTERRUPT - raw_user_interrupts_off(); -#endif -#ifdef RAWDEBUG - raw_test_pass(0xeee1); -#endif - sendStall = false; - tocontinue = true; - objitem = getTail(&objqueue); - //obj = objitem->objectptr; - objInfo = (struct transObjInfo *)objitem->objectptr; - obj = objInfo->objptr; -#ifdef RAWDEBUG - raw_test_pass_reg((int)obj); -#endif - // grab lock and flush the obj - getreadlock_I(obj); - while(!lockflag) { - receiveObject(); - } - grount = lockresult; -#ifdef RAWDEBUG - raw_test_pass_reg(grount); -#endif - - lockresult = 0; - lockobj = 0; - lockflag = false; -#ifndef INTERRUPT - reside = false; -#endif - - if(grount == 1) { - int k = 0; - raw_invalidate_cache_range(obj, classsize[((struct ___Object___ *)obj)->type]); - // flush the obj - /*for(k = 0; k < classsize[((struct ___Object___ *)obj)->type]; ++k) { - invalidateAddr(obj + k); - }*/ - // enqueue the object - for(k = 0; k < objInfo->length; ++k) { - int taskindex = objInfo->queues[2 * k]; - int paramindex = objInfo->queues[2 * k + 1]; - struct parameterwrapper ** queues = &(paramqueues[corenum][taskindex][paramindex]); -#ifdef RAWDEBUG - raw_test_pass_reg(taskindex); - raw_test_pass_reg(paramindex); -#endif - enqueueObject_I(obj, queues, 1); - } - removeItem(&objqueue, objitem); - releasereadlock_I(obj); - RUNFREE(objInfo->queues); - RUNFREE(objInfo); - /*enqueueObject_I(obj, NULL, 0); - removeItem(&objqueue, objitem); - releasereadlock_I(obj);*/ - } else { - // can not get lock - // put it at the end of the queue - // and try to execute active tasks already enqueued first - removeItem(&objqueue, objitem); - addNewItem_I(&objqueue, objInfo); -#ifdef INTERRUPT - raw_user_interrupts_on(); -#endif - break; - } -#ifdef INTERRUPT - raw_user_interrupts_on(); -#endif -#ifdef RAWDEBUG - raw_test_pass(0xee0e); -#endif - } -#ifdef RAWDEBUG - raw_test_pass(0xee0f); -#endif - - if(!tocontinue) { - // check if stop - if(STARTUPCORE == corenum) { - if(isfirst) { -#ifdef RAWDEBUG - raw_test_pass(0xee10); -#endif - isfirst = false; - } -#ifdef INTERRUPT - raw_user_interrupts_off(); -#endif - corestatus[corenum] = 0; - numsendobjs[corenum] = self_numsendobjs; - numreceiveobjs[corenum] = self_numreceiveobjs; - // check the status of all cores - allStall = true; -#ifdef RAWDEBUG - raw_test_pass_reg(NUMCORES); -#endif - for(i = 0; i < NUMCORES; ++i) { -#ifdef RAWDEBUG - raw_test_pass(0xe000 + corestatus[i]); -#endif - if(corestatus[i] != 0) { - allStall = false; - break; - } - } - if(allStall) { - // check if the sum of send objs and receive obj are the same - // yes->terminate - // no->go on executing - sumsendobj = 0; - for(i = 0; i < NUMCORES; ++i) { - sumsendobj += numsendobjs[i]; -#ifdef RAWDEBUG - raw_test_pass(0xf000 + numsendobjs[i]); -#endif - } - for(i = 0; i < NUMCORES; ++i) { - sumsendobj -= numreceiveobjs[i]; -#ifdef RAWDEBUG - raw_test_pass(0xf000 + numreceiveobjs[i]); -#endif - } - if(0 == sumsendobj) { - // terminate -#ifdef RAWDEBUG - raw_test_pass(0xee11); -#endif - raw_test_pass(raw_get_cycle()); - raw_test_done(1); // All done. - } - } -#ifdef INTERRUPT - raw_user_interrupts_on(); -#endif - } else { - if(!sendStall) { -#ifdef RAWDEBUG - raw_test_pass(0xee12); -#endif - if(isfirst) { - // wait for some time - int halt = 10000; -#ifdef RAWDEBUG - raw_test_pass(0xee13); -#endif - while(halt--){} - isfirst = false; -#ifdef RAWDEBUG - raw_test_pass(0xee14); -#endif - } else { - // send StallMsg to startup core -#ifdef RAWDEBUG - raw_test_pass(0xee15); -#endif - sendStall = transStallMsg(STARTUPCORE); - isfirst = true; - } - } else { - isfirst = true; -#ifdef RAWDEBUG - raw_test_pass(0xee16); -#endif - } - } - } - } - } -#elif defined THREADSIMULATE - /* Start executing the tasks */ - executetasks(); - - int i = 0; - // check if there are new objects coming - bool sendStall = false; - - int numofcore = pthread_getspecific(key); - while(true) { - switch(receiveObject()) { - case 0: { - printf("[run, %d] receive an object\n", numofcore); - sendStall = false; - // received an object - // check if there are new active tasks can be executed - executetasks(); - break; - } - case 1: { - //printf("[run, %d] no msg\n", numofcore); - // no msg received - if(STARTUPCORE == numofcore) { - corestatus[numofcore] = 0; - // check the status of all cores - bool allStall = true; - for(i = 0; i < NUMCORES; ++i) { - if(corestatus[i] != 0) { - allStall = false; - break; - } - } - if(allStall) { - // check if the sum of send objs and receive obj are the same - // yes->terminate - // no->go on executing - int sumsendobj = 0; - for(i = 0; i < NUMCORES; ++i) { - sumsendobj += numsendobjs[i]; - } - for(i = 0; i < NUMCORES; ++i) { - sumsendobj -= numreceiveobjs[i]; - } - if(0 == sumsendobj) { - // terminate - - // release all locks - int rc_tbl = pthread_rwlock_wrlock(&rwlock_tbl); - printf("[run, %d] getting the write lock for locktbl: %d error: \n", numofcore, rc_tbl, strerror(rc_tbl)); - struct RuntimeIterator* it_lock = RuntimeHashcreateiterator(locktbl); - while(0 != RunhasNext(it_lock)) { - int key = Runkey(it_lock); - pthread_rwlock_t* rwlock_obj = (pthread_rwlock_t*)Runnext(it_lock); - int rc_des = pthread_rwlock_destroy(rwlock_obj); - printf("[run, %d] destroy the rwlock for object: %d error: \n", numofcore, key, strerror(rc_des)); - RUNFREE(rwlock_obj); - } - freeRuntimeHash(locktbl); - locktbl = NULL; - RUNFREE(it_lock); - - // destroy all message queues - char * pathhead = "/msgqueue_"; - int targetlen = strlen(pathhead); - for(i = 0; i < NUMCORES; ++i) { - char corenumstr[3]; - int sourcelen = 0; - if(i < 10) { - corenumstr[0] = i + '0'; - corenumstr[1] = '\0'; - sourcelen = 1; - } else if(i < 100) { - corenumstr[1] = i %10 + '0'; - corenumstr[0] = (i / 10) + '0'; - corenumstr[2] = '\0'; - sourcelen = 2; - } else { - printf("Error: i >= 100\n"); - fflush(stdout); - exit(-1); - } - char path[targetlen + sourcelen + 1]; - strcpy(path, pathhead); - strncat(path, corenumstr, sourcelen); - mq_unlink(path); - } - - printf("[run, %d] terminate!\n", numofcore); - fflush(stdout); - exit(0); - } - } - } else { - if(!sendStall) { - // send StallMsg to startup core - sendStall = transStallMsg(STARTUPCORE); - } - } - break; - } - case 2: { - printf("[run, %d] receive a stall msg\n", numofcore); - // receive a Stall Msg, do nothing - assert(STARTUPCORE == numofcore); // only startup core can receive such msg - sendStall = false; - break; - } - /* case 3: { - printf("[run, %d] receive a terminate msg\n", numofcore); - // receive a terminate Msg - assert(STARTUPCORE != corenum); // only non-startup core can receive such msg - mq_close(mqd[corenum]); - fflush(stdout); - exit(0); - break; - }*/ - default: { - printf("[run, %d] Error: invalid message type.\n", numofcore); - fflush(stdout); - exit(-1); - break; - } - } - } -#endif -} - -void createstartupobject(int argc, char ** argv) { - int i; - - /* Allocate startup object */ -#ifdef PRECISE_GC - struct ___StartupObject___ *startupobject=(struct ___StartupObject___*) allocate_new(NULL, STARTUPTYPE); - struct ArrayObject * stringarray=allocate_newarray(NULL, STRINGARRAYTYPE, argc-1); -#else - struct ___StartupObject___ *startupobject=(struct ___StartupObject___*) allocate_new(STARTUPTYPE); - struct ArrayObject * stringarray=allocate_newarray(STRINGARRAYTYPE, argc-1); -#endif - /* Build array of strings */ - startupobject->___parameters___=stringarray; - for(i=1;i___length___)+sizeof(int)))[i-1]=newstring; - } - - startupobject->isolate = 1; - startupobject->version = 0; - - /* Set initialized flag for startup object */ - flagorandinit(startupobject,1,0xFFFFFFFF); - enqueueObject(startupobject, NULL, 0); -#ifdef RAW - //flushAll(); - raw_flush_entire_cache(); -#endif -} - -int hashCodetpd(struct taskparamdescriptor *ftd) { - int hash=(int)ftd->task; - int i; - for(i=0;inumParameters;i++){ - hash^=(int)ftd->parameterArray[i]; - } - return hash; -} - -int comparetpd(struct taskparamdescriptor *ftd1, struct taskparamdescriptor *ftd2) { - int i; - if (ftd1->task!=ftd2->task) - return 0; - for(i=0;inumParameters;i++) - if(ftd1->parameterArray[i]!=ftd2->parameterArray[i]) - return 0; - return 1; -} - -/* This function sets a tag. */ -#ifdef PRECISE_GC -void tagset(void *ptr, struct ___Object___ * obj, struct ___TagDescriptor___ * tagd) { -#else -void tagset(struct ___Object___ * obj, struct ___TagDescriptor___ * tagd) { -#endif - struct ArrayObject * ao=NULL; - struct ___Object___ * tagptr=obj->___tags___; -#ifdef RAWDEBUG - raw_test_pass(0xebb0); -#endif - if (tagptr==NULL) { -#ifdef RAWDEBUG - raw_test_pass(0xebb1); -#endif - obj->___tags___=(struct ___Object___ *)tagd; - } else { - /* Have to check if it is already set */ - if (tagptr->type==TAGTYPE) { - struct ___TagDescriptor___ * td=(struct ___TagDescriptor___ *) tagptr; -#ifdef RAWDEBUG - raw_test_pass(0xebb2); -#endif - if (td==tagd) { -#ifdef RAWDEBUG - raw_test_pass(0xebb3); -#endif - return; - } -#ifdef PRECISE_GC - int ptrarray[]={2, (int) ptr, (int) obj, (int)tagd}; - struct ArrayObject * ao=allocate_newarray(&ptrarray,TAGARRAYTYPE,TAGARRAYINTERVAL); - obj=(struct ___Object___ *)ptrarray[2]; - tagd=(struct ___TagDescriptor___ *)ptrarray[3]; - td=(struct ___TagDescriptor___ *) obj->___tags___; -#else -#ifdef RAWDEBUG - raw_test_pass(0xebb4); -#endif - ao=allocate_newarray(TAGARRAYTYPE,TAGARRAYINTERVAL); -#endif -#ifdef RAWDEBUG - raw_test_pass(0xebb5); -#endif - ARRAYSET(ao, struct ___TagDescriptor___ *, 0, td); - ARRAYSET(ao, struct ___TagDescriptor___ *, 1, tagd); - obj->___tags___=(struct ___Object___ *) ao; - ao->___cachedCode___=2; -#ifdef RAWDEBUG - raw_test_pass(0xebb6); -#endif - } else { - /* Array Case */ - int i; - struct ArrayObject *ao=(struct ArrayObject *) tagptr; -#ifdef RAWDEBUG - raw_test_pass(0xebb7); -#endif - for(i=0;i___cachedCode___;i++) { - struct ___TagDescriptor___ * td=ARRAYGET(ao, struct ___TagDescriptor___*, i); -#ifdef RAWDEBUG - raw_test_pass(0xebb8); -#endif - if (td==tagd) { -#ifdef RAWDEBUG - raw_test_pass(0xebb9); -#endif - return; - } - } - if (ao->___cachedCode______length___) { -#ifdef RAWDEBUG - raw_test_pass(0xebba); -#endif - ARRAYSET(ao, struct ___TagDescriptor___ *, ao->___cachedCode___, tagd); - ao->___cachedCode___++; -#ifdef RAWDEBUG - raw_test_pass(0xebbb); -#endif - } else { -#ifdef PRECISE_GC - int ptrarray[]={2,(int) ptr, (int) obj, (int) tagd}; - struct ArrayObject * aonew=allocate_newarray(&ptrarray,TAGARRAYTYPE,TAGARRAYINTERVAL+ao->___length___); - obj=(struct ___Object___ *)ptrarray[2]; - tagd=(struct ___TagDescriptor___ *) ptrarray[3]; - ao=(struct ArrayObject *)obj->___tags___; -#else - struct ArrayObject * aonew=allocate_newarray(TAGARRAYTYPE,TAGARRAYINTERVAL+ao->___length___); -#endif -#ifdef RAWDEBUG - raw_test_pass(0xebbc); -#endif - aonew->___cachedCode___=ao->___length___+1; - for(i=0;i___length___;i++) { -#ifdef RAWDEBUG - raw_test_pass(0xebbd); -#endif - ARRAYSET(aonew, struct ___TagDescriptor___*, i, ARRAYGET(ao, struct ___TagDescriptor___*, i)); - } -#ifdef RAWDEBUG - raw_test_pass(0xebbe); -#endif - ARRAYSET(aonew, struct ___TagDescriptor___ *, ao->___length___, tagd); -#ifdef RAWDEBUG - raw_test_pass(0xebbf); -#endif - } - } - } - - { - struct ___Object___ * tagset=tagd->flagptr; -#ifdef RAWDEBUG - raw_test_pass(0xb008); -#endif - if(tagset==NULL) { -#ifdef RAWDEBUG - raw_test_pass(0xb009); -#endif - tagd->flagptr=obj; - } else if (tagset->type!=OBJECTARRAYTYPE) { -#ifdef PRECISE_GC - int ptrarray[]={2, (int) ptr, (int) obj, (int)tagd}; - struct ArrayObject * ao=allocate_newarray(&ptrarray,OBJECTARRAYTYPE,OBJECTARRAYINTERVAL); - obj=(struct ___Object___ *)ptrarray[2]; - tagd=(struct ___TagDescriptor___ *)ptrarray[3]; -#else - struct ArrayObject * ao=allocate_newarray(OBJECTARRAYTYPE,OBJECTARRAYINTERVAL); -#endif - ARRAYSET(ao, struct ___Object___ *, 0, tagd->flagptr); - ARRAYSET(ao, struct ___Object___ *, 1, obj); - ao->___cachedCode___=2; - tagd->flagptr=(struct ___Object___ *)ao; -#ifdef RAWDEBUG - raw_test_pass(0xb00a); -#endif - } else { - struct ArrayObject *ao=(struct ArrayObject *) tagset; - if (ao->___cachedCode______length___) { -#ifdef RAWDEBUG - raw_test_pass(0xb00b); -#endif - ARRAYSET(ao, struct ___Object___*, ao->___cachedCode___++, obj); - } else { - int i; -#ifdef PRECISE_GC - int ptrarray[]={2, (int) ptr, (int) obj, (int)tagd}; - struct ArrayObject * aonew=allocate_newarray(&ptrarray,OBJECTARRAYTYPE,OBJECTARRAYINTERVAL+ao->___length___); - obj=(struct ___Object___ *)ptrarray[2]; - tagd=(struct ___TagDescriptor___ *)ptrarray[3]; - ao=(struct ArrayObject *)tagd->flagptr; -#else - struct ArrayObject * aonew=allocate_newarray(OBJECTARRAYTYPE,OBJECTARRAYINTERVAL); -#endif - aonew->___cachedCode___=ao->___cachedCode___+1; - for(i=0;i___length___;i++) { - ARRAYSET(aonew, struct ___Object___*, i, ARRAYGET(ao, struct ___Object___*, i)); - } - ARRAYSET(aonew, struct ___Object___ *, ao->___cachedCode___, obj); - tagd->flagptr=(struct ___Object___ *) aonew; -#ifdef RAWDEBUG - raw_test_pass(0xb00c); -#endif - } - } - } -} - -/* This function clears a tag. */ -#ifdef PRECISE_GC -void tagclear(void *ptr, struct ___Object___ * obj, struct ___TagDescriptor___ * tagd) { -#else -void tagclear(struct ___Object___ * obj, struct ___TagDescriptor___ * tagd) { -#endif - /* We'll assume that tag is alway there. - Need to statically check for this of course. */ - struct ___Object___ * tagptr=obj->___tags___; - - if (tagptr->type==TAGTYPE) { - if ((struct ___TagDescriptor___ *)tagptr==tagd) - obj->___tags___=NULL; - else -#ifndef RAW - printf("ERROR 1 in tagclear\n"); -#endif - ; - } else { - struct ArrayObject *ao=(struct ArrayObject *) tagptr; - int i; - for(i=0;i___cachedCode___;i++) { - struct ___TagDescriptor___ * td=ARRAYGET(ao, struct ___TagDescriptor___ *, i); - if (td==tagd) { - ao->___cachedCode___--; - if (i___cachedCode___) - ARRAYSET(ao, struct ___TagDescriptor___ *, i, ARRAYGET(ao, struct ___TagDescriptor___ *, ao->___cachedCode___)); - ARRAYSET(ao, struct ___TagDescriptor___ *, ao->___cachedCode___, NULL); - if (ao->___cachedCode___==0) - obj->___tags___=NULL; - goto PROCESSCLEAR; - } - } -#ifndef RAW - printf("ERROR 2 in tagclear\n"); -#endif - ; - } - PROCESSCLEAR: - { - struct ___Object___ *tagset=tagd->flagptr; - if (tagset->type!=OBJECTARRAYTYPE) { - if (tagset==obj) - tagd->flagptr=NULL; - else -#ifndef RAW - printf("ERROR 3 in tagclear\n"); -#endif - ; - } else { - struct ArrayObject *ao=(struct ArrayObject *) tagset; - int i; - for(i=0;i___cachedCode___;i++) { - struct ___Object___ * tobj=ARRAYGET(ao, struct ___Object___ *, i); - if (tobj==obj) { - ao->___cachedCode___--; - if (i___cachedCode___) - ARRAYSET(ao, struct ___Object___ *, i, ARRAYGET(ao, struct ___Object___ *, ao->___cachedCode___)); - ARRAYSET(ao, struct ___Object___ *, ao->___cachedCode___, NULL); - if (ao->___cachedCode___==0) - tagd->flagptr=NULL; - goto ENDCLEAR; - } - } -#ifndef RAW - printf("ERROR 4 in tagclear\n"); -#endif - } - } - ENDCLEAR: - return; -} - -/* This function allocates a new tag. */ -#ifdef PRECISE_GC -struct ___TagDescriptor___ * allocate_tag(void *ptr, int index) { - struct ___TagDescriptor___ * v=(struct ___TagDescriptor___ *) mygcmalloc((struct garbagelist *) ptr, classsize[TAGTYPE]); -#else -struct ___TagDescriptor___ * allocate_tag(int index) { - struct ___TagDescriptor___ * v=FREEMALLOC(classsize[TAGTYPE]); -#endif - v->type=TAGTYPE; - v->flag=index; - return v; -} - - - -/* This function updates the flag for object ptr. It or's the flag - with the or mask and and's it with the andmask. */ - -void flagbody(struct ___Object___ *ptr, int flag, struct parameterwrapper ** queues, int length, bool isnew); - - int flagcomp(const int *val1, const int *val2) { - return (*val1)-(*val2); - } - -void flagorand(void * ptr, int ormask, int andmask, struct parameterwrapper ** queues, int length) { - { - int oldflag=((int *)ptr)[1]; - int flag=ormask|oldflag; - flag&=andmask; -#ifdef RAWDEBUG - raw_test_pass_reg((int)ptr); - raw_test_pass(0xaa000000 + oldflag); - raw_test_pass(0xaa000000 + flag); -#endif - flagbody(ptr, flag, queues, length, false); - } -} - -bool intflagorand(void * ptr, int ormask, int andmask) { - { - int oldflag=((int *)ptr)[1]; - int flag=ormask|oldflag; - flag&=andmask; - if (flag==oldflag) /* Don't do anything */ - return false; - else { - flagbody(ptr, flag, NULL, 0, false); - return true; - } - } -} - -void flagorandinit(void * ptr, int ormask, int andmask) { - int oldflag=((int *)ptr)[1]; - int flag=ormask|oldflag; - flag&=andmask; -#ifdef RAWDEBUG - raw_test_pass(0xaa100000 + oldflag); - raw_test_pass(0xaa100000 + flag); -#endif - flagbody(ptr,flag,NULL,0,true); -} - -void flagbody(struct ___Object___ *ptr, int flag, struct parameterwrapper ** vqueues, int vlength, bool isnew) { - struct parameterwrapper * flagptr = NULL; - int i = 0; - struct parameterwrapper ** queues = vqueues; - int length = vlength; - int next; - int UNUSED, UNUSED2; - int * enterflags = NULL; - if((!isnew) && (queues == NULL)) { -#ifdef THREADSIMULATE - int numofcore = pthread_getspecific(key); - queues = objectqueues[numofcore][ptr->type]; - length = numqueues[numofcore][ptr->type]; -#else -#ifdef RAW - if(corenum < NUMCORES) { -#endif - queues = objectqueues[corenum][ptr->type]; - length = numqueues[corenum][ptr->type]; -#ifdef RAW - } else { - return; - } -#endif -#endif - } - ptr->flag=flag; -#ifdef RAWDEBUG - raw_test_pass(0xbb000000 + ptr->flag); -#endif - - /*Remove object from all queues */ - for(i = 0; i < length; ++i) { - flagptr = queues[i]; - ObjectHashget(flagptr->objectset, (int) ptr, (int *) &next, (int *) &enterflags, &UNUSED, &UNUSED2); - ObjectHashremove(flagptr->objectset, (int)ptr); - if (enterflags!=NULL) - RUNFREE(enterflags); - } - } - - void enqueueObject(void * vptr, struct parameterwrapper ** vqueues, int vlength) { - struct ___Object___ *ptr = (struct ___Object___ *)vptr; - - { - struct QueueItem *tmpptr; - struct parameterwrapper * parameter=NULL; - int j; - int i; - struct parameterwrapper * prevptr=NULL; - struct ___Object___ *tagptr=NULL; - struct parameterwrapper ** queues = vqueues; - int length = vlength; -#ifdef RAW - if(corenum > NUMCORES - 1) { - return; - } -#endif - if(queues == NULL) { -#ifdef THREADSIMULATE - int numofcore = pthread_getspecific(key); - queues = objectqueues[numofcore][ptr->type]; - length = numqueues[numofcore][ptr->type]; -#else - queues = objectqueues[corenum][ptr->type]; - length = numqueues[corenum][ptr->type]; -#endif - } - tagptr=ptr->___tags___; - - /* Outer loop iterates through all parameter queues an object of - this type could be in. */ - for(j = 0; j < length; ++j) { - parameter = queues[j]; - /* Check tags */ - if (parameter->numbertags>0) { - if (tagptr==NULL) - goto nextloop;//that means the object has no tag but that param needs tag - else if(tagptr->type==TAGTYPE) {//one tag - struct ___TagDescriptor___ * tag=(struct ___TagDescriptor___*) tagptr; - for(i=0;inumbertags;i++) { - //slotid is parameter->tagarray[2*i]; - int tagid=parameter->tagarray[2*i+1]; - if (tagid!=tagptr->flag) - goto nextloop; /*We don't have this tag */ - } - } else {//multiple tags - struct ArrayObject * ao=(struct ArrayObject *) tagptr; - for(i=0;inumbertags;i++) { - //slotid is parameter->tagarray[2*i]; - int tagid=parameter->tagarray[2*i+1]; - int j; - for(j=0;j___cachedCode___;j++) { - if (tagid==ARRAYGET(ao, struct ___TagDescriptor___*, j)->flag) - goto foundtag; - } - goto nextloop; - foundtag: - ; - } - } - } - - /* Check flags */ - for(i=0;inumberofterms;i++) { - int andmask=parameter->intarray[i*2]; - int checkmask=parameter->intarray[i*2+1]; - if ((ptr->flag&andmask)==checkmask) { -#ifdef RAWDEBUG - raw_test_pass(0xcc000000 + andmask); - raw_test_pass_reg((int)ptr); - raw_test_pass(0xcc000000 + ptr->flag); - raw_test_pass(0xcc000000 + checkmask); -#endif - enqueuetasks(parameter, prevptr, ptr, NULL, 0); - prevptr=parameter; - break; - } - } - nextloop: - ; - } - } -} - -#ifdef RAW -void enqueueObject_I(void * vptr, struct parameterwrapper ** vqueues, int vlength) { - struct ___Object___ *ptr = (struct ___Object___ *)vptr; - - { - struct QueueItem *tmpptr; - struct parameterwrapper * parameter=NULL; - int j; - int i; - struct parameterwrapper * prevptr=NULL; - struct ___Object___ *tagptr=NULL; - struct parameterwrapper ** queues = vqueues; - int length = vlength; -#ifdef RAW - if(corenum > NUMCORES - 1) { - return; - } -#endif - if(queues == NULL) { -#ifdef THREADSIMULATE - int numofcore = pthread_getspecific(key); - queues = objectqueues[numofcore][ptr->type]; - length = numqueues[numofcore][ptr->type]; -#else - queues = objectqueues[corenum][ptr->type]; - length = numqueues[corenum][ptr->type]; -#endif - } -#ifdef RAWDEBUG - raw_test_pass(0xeaa1); - raw_test_pass_reg(queues); - raw_test_pass_reg(length); -#endif - tagptr=ptr->___tags___; - - /* Outer loop iterates through all parameter queues an object of - this type could be in. */ - for(j = 0; j < length; ++j) { - parameter = queues[j]; - /* Check tags */ - if (parameter->numbertags>0) { -#ifdef RAWDEBUG - raw_test_pass(0xeaa2); - raw_test_pass_reg(tagptr); -#endif - if (tagptr==NULL) - goto nextloop;//that means the object has no tag but that param needs tag - else if(tagptr->type==TAGTYPE) {//one tag - struct ___TagDescriptor___ * tag=(struct ___TagDescriptor___*) tagptr; -#ifdef RAWDEBUG - raw_test_pass(0xeaa3); -#endif - for(i=0;inumbertags;i++) { - //slotid is parameter->tagarray[2*i]; - int tagid=parameter->tagarray[2*i+1]; - if (tagid!=tagptr->flag) { -#ifdef RAWDEBUG - raw_test_pass(0xeaa4); -#endif - goto nextloop; /*We don't have this tag */ - } - } - } else {//multiple tags - struct ArrayObject * ao=(struct ArrayObject *) tagptr; -#ifdef RAWDEBUG - raw_test_pass(0xeaa5); -#endif - for(i=0;inumbertags;i++) { - //slotid is parameter->tagarray[2*i]; - int tagid=parameter->tagarray[2*i+1]; - int j; - for(j=0;j___cachedCode___;j++) { - if (tagid==ARRAYGET(ao, struct ___TagDescriptor___*, j)->flag) { - goto foundtag; - } - } -#ifdef RAWDEBUG - raw_test_pass(0xeaa6); -#endif - goto nextloop; - foundtag: - ; - } - } - } - - /* Check flags */ - for(i=0;inumberofterms;i++) { - int andmask=parameter->intarray[i*2]; - int checkmask=parameter->intarray[i*2+1]; -#ifdef RAWDEBUG - raw_test_pass(0xeaa7); - raw_test_pass(0xcc000000 + andmask); - raw_test_pass_reg(ptr); - raw_test_pass(0xcc000000 + ptr->flag); - raw_test_pass(0xcc000000 + checkmask); -#endif - if ((ptr->flag&andmask)==checkmask) { -#ifdef RAWDEBUG - raw_test_pass(0xeaa8); -#endif - enqueuetasks_I(parameter, prevptr, ptr, NULL, 0); - prevptr=parameter; - break; - } - } - nextloop: - ; - } - } -} - -// helper function to compute the coordinates of a core from the core number -void calCoords(int core_num, int* coordY, int* coordX) { - *coordX = core_num % 4; - *coordY = core_num / 4; -} -#endif - -/* Message format for RAW version: - * type + Msgbody - * type: 0 -- transfer object - * 1 -- transfer stall msg - * 2 -- lock request - * 3 -- lock grount - * 4 -- lock deny - * 5 -- lock release - * - * ObjMsg: 0 + size of msg + obj's address + (task index + param index)+ - * StallMsg: 1 + corenum + sendobjs + receiveobjs (size is always 4 * sizeof(int)) - * LockMsg: 2 + lock type + obj pointer + request core (size is always 4 * sizeof(int)) - * 3/4/5 + lock type + obj pointer (size is always 3 * sizeof(int)) - * lock type: 0 -- read; 1 -- write - */ - -// transfer an object to targetcore -// format: object -void transferObject(struct transObjInfo * transObj) { - void * obj = transObj->objptr; - int type=((int *)obj)[0]; - int size=classsize[type]; - int targetcore = transObj->targetcore; - //assert(type < NUMCLASSES); // can only transfer normal object - -#ifdef RAW - unsigned msgHdr; - int self_y, self_x, target_y, target_x; - //int isshared = 0; - // for 32 bit machine, the size of fixed part is always 3 words - //int msgsize = sizeof(int) * 2 + sizeof(void *); - int msgsize = 3 + transObj->length * 2; - int i = 0; - - struct ___Object___ * newobj = (struct ___Object___ *)obj; - /*if(0 == newobj->isolate) { - isshared = 1; - }*/ - - calCoords(corenum, &self_y, &self_x); - calCoords(targetcore, &target_y, &target_x); - // Build the message header - msgHdr = construct_dyn_hdr(0, msgsize, 0, // msgsize word sent. - self_y, self_x, - target_y, target_x); - gdn_send(msgHdr); // Send the message header to EAST to handle fab(n - 1). -#ifdef RAWDEBUG - raw_test_pass(0xbbbb); - raw_test_pass(0xb000 + targetcore); // targetcore -#endif - gdn_send(0); -#ifdef RAWDEBUG - raw_test_pass(0); -#endif - gdn_send(msgsize); -#ifdef RAWDEBUG - raw_test_pass_reg(msgsize); -#endif - gdn_send(obj); -#ifdef RAWDEBUG - raw_test_pass_reg(obj); -#endif - for(i = 0; i < transObj->length; ++i) { - int taskindex = transObj->queues[2*i]; - int paramindex = transObj->queues[2*i+1]; - gdn_send(taskindex); -#ifdef RAWDEBUG - raw_test_pass_reg(taskindex); -#endif - gdn_send(paramindex); -#ifdef RAWDEBUG - raw_test_pass_reg(paramindex); -#endif - } -#ifdef RAWDEBUG - raw_test_pass(0xffff); -#endif - ++(self_numsendobjs); -#elif defined THREADSIMULATE - int numofcore = pthread_getspecific(key); - - // use POSIX message queue to transfer objects between cores - mqd_t mqdnum; - char corenumstr[3]; - int sourcelen = 0; - if(targetcore < 10) { - corenumstr[0] = targetcore + '0'; - corenumstr[1] = '\0'; - sourcelen = 1; - } else if(targetcore < 100) { - corenumstr[1] = targetcore % 10 + '0'; - corenumstr[0] = (targetcore / 10) + '0'; - corenumstr[2] = '\0'; - sourcelen = 2; - } else { - printf("Error: targetcore >= 100\n"); - fflush(stdout); - exit(-1); - } - char * pathhead = "/msgqueue_"; - int targetlen = strlen(pathhead); - char path[targetlen + sourcelen + 1]; - strcpy(path, pathhead); - strncat(path, corenumstr, sourcelen); - int oflags = O_WRONLY|O_NONBLOCK; - int omodes = S_IRWXU|S_IRWXG|S_IRWXO; - mqdnum = mq_open(path, oflags, omodes, NULL); - if(mqdnum==-1) { - printf("[transferObject, %d] mq_open %s fail: %d, error: %s\n", numofcore, path, mqdnum, strerror(errno)); - fflush(stdout); - exit(-1); - } - /*struct ___Object___ * newobj = (struct ___Object___ *)obj; - if(0 == newobj->isolate) { - newobj = RUNMALLOC(size); - memcpy(newobj, obj, size); - newobj->original=obj; - }*/ - struct transObjInfo * tmptransObj = RUNMALLOC(sizeof(struct transObjInfo)); - memcpy(tmptransObj, transObj, sizeof(struct transObjInfo)); - int * tmpqueue = RUNMALLOC(sizeof(int)*2*tmptransObj->length); - memcpy(tmpqueue, tmptransObj->queues, sizeof(int)*2*tmptransObj->length); - tmptransObj->queues = tmpqueue; - struct ___Object___ * newobj = RUNMALLOC(sizeof(struct ___Object___)); - newobj->type = ((struct ___Object___ *)obj)->type; - newobj->original = (struct ___Object___ *)tmptransObj; - int ret; - do { - ret=mq_send(mqdnum, (void *)newobj, sizeof(struct ___Object___), 0); // send the object into the queue - if(ret != 0) { - printf("[transferObject, %d] mq_send to %s returned: %d, error: %s\n", numofcore, path, ret, strerror(errno)); - } - }while(ret!=0); - RUNFREE(newobj); - if(numofcore == STARTUPCORE) { - ++numsendobjs[numofcore]; - } else { - ++(thread_data_array[numofcore].numsendobjs); - } - printf("[transferObject, %d] mq_send to %s returned: $%x\n", numofcore, path, ret); -#endif -} - -// send terminate message to targetcore -// format: -1 -bool transStallMsg(int targetcore) { -#ifdef RAW - unsigned msgHdr; - int self_y, self_x, target_y, target_x; - // for 32 bit machine, the size is always 4 words - //int msgsize = sizeof(int) * 4; - int msgsize = 4; - - calCoords(corenum, &self_y, &self_x); - calCoords(targetcore, &target_y, &target_x); - // Build the message header - msgHdr = construct_dyn_hdr(0, msgsize, 0, // msgsize word sent. - self_y, self_x, - target_y, target_x); - gdn_send(msgHdr); // Send the message header to EAST to handle fab(n - 1). -#ifdef RAWDEBUG - raw_test_pass(0xbbbb); - raw_test_pass(0xb000 + targetcore); // targetcore -#endif - gdn_send(1); -#ifdef RAWDEBUG - raw_test_pass(1); -#endif - gdn_send(corenum); -#ifdef RAWDEBUG - raw_test_pass_reg(corenum); -#endif - gdn_send(self_numsendobjs); -#ifdef RAWDEBUG - raw_test_pass_reg(self_numsendobjs); -#endif - gdn_send(self_numreceiveobjs); -#ifdef RAWDEBUG - raw_test_pass_reg(self_numreceiveobjs); - raw_test_pass(0xffff); -#endif - return true; -#elif defined THREADSIMULATE - struct ___Object___ *newobj = RUNMALLOC(sizeof(struct ___Object___)); - // use the first four int field to hold msgtype/corenum/sendobj/receiveobj - newobj->type = -1; - int numofcore = pthread_getspecific(key); - newobj->flag = numofcore; - newobj->___cachedHash___ = thread_data_array[numofcore].numsendobjs; - newobj->___cachedCode___ = thread_data_array[numofcore].numreceiveobjs; - - // use POSIX message queue to send stall msg to startup core - assert(targetcore == STARTUPCORE); - mqd_t mqdnum; - char corenumstr[3]; - int sourcelen = 0; - if(targetcore < 10) { - corenumstr[0] = targetcore + '0'; - corenumstr[1] = '\0'; - sourcelen = 1; - } else if(targetcore < 100) { - corenumstr[1] = targetcore % 10 + '0'; - corenumstr[0] = (targetcore / 10) + '0'; - corenumstr[2] = '\0'; - sourcelen = 2; - } else { - printf("Error: targetcore >= 100\n"); - fflush(stdout); - exit(-1); - } - char * pathhead = "/msgqueue_"; - int targetlen = strlen(pathhead); - char path[targetlen + sourcelen + 1]; - strcpy(path, pathhead); - strncat(path, corenumstr, sourcelen); - int oflags = O_WRONLY|O_NONBLOCK; - int omodes = S_IRWXU|S_IRWXG|S_IRWXO; - mqdnum = mq_open(path, oflags, omodes, NULL); - if(mqdnum==-1) { - printf("[transStallMsg, %d] mq_open %s fail: %d, error: %s\n", numofcore, path, mqdnum, strerror(errno)); - fflush(stdout); - exit(-1); - } - int ret; - ret=mq_send(mqdnum, (void *)newobj, sizeof(struct ___Object___), 0); // send the object into the queue - if(ret != 0) { - printf("[transStallMsg, %d] mq_send to %s returned: %d, error: %s\n", numofcore, path, ret, strerror(errno)); - RUNFREE(newobj); - return false; - } else { - printf("[transStallMsg, %d] mq_send to %s returned: $%x\n", numofcore, path, ret); - printf(" to %s index: %d, sendobjs: %d, receiveobjs: %d\n", path, newobj->flag, newobj->___cachedHash___, newobj->___cachedCode___); - RUNFREE(newobj); - return true; - } -#endif -} - -// receive object transferred from other cores -// or the terminate message from other cores -// NOTICE: following format is for threadsimulate version only -// RAW version please see previous description -// format: type + object -// type: -1--stall msg -// !-1--object -// return value: 0--received an object -// 1--received nothing -// 2--received a Stall Msg -// 3--received a lock Msg -// RAW version: -1 -- received nothing -// otherwise -- received msg type -int receiveObject() { -#ifdef RAW - bool deny = false; - unsigned msgHdr; - int self_y, self_x, target_y, target_x; - int targetcore = 0; - if(gdn_input_avail() == 0) { -#ifdef RAWDEBUG - if(corenum < NUMCORES) { - raw_test_pass(0xd001); - } -#endif - return -1; - } -msg: -#ifdef RAWDEBUG - raw_test_pass(0xcccc); -#endif - while((gdn_input_avail() != 0) && (msgdataindex < msglength)) { - msgdata[msgdataindex] = gdn_receive(); - if(msgdataindex == 0) { - if(msgdata[0] > 2) { - msglength = 3; - } else if(msgdata[0] > 0) { - msglength = 4; - } - } else if((msgdataindex == 1) && (msgdata[0] == 0)) { - msglength = msgdata[msgdataindex]; - } -#ifdef RAWDEBUG - raw_test_pass_reg(msgdata[msgdataindex]); -#endif - msgdataindex++; - - /*if(msgdataindex == 0) { - // type - msgtype = gdn_receive(); - if(msgtype > 2) { - msglength = 3; - } else { - msglength = 4; - } - if(msgtype != 0) { - msgdata = (int *)RUNMALLOC_I(msglength * sizeof(int)); - msgdata[msgdataindex] = msgtype; - } -#ifdef RAWDEBUG - raw_test_pass_reg(msgtype); -#endif - } else if((msgdataindex == 1) && (msgtype == 0)) { - // object transfer msg - msglength = gdn_receive(); - msgdata = (int *)RUNMALLOC_I(msglength * sizeof(int)); - msgdata[0] = msgtype; - msgdata[msgdataindex] = msglength; -#ifdef RAWDEBUG - raw_test_pass_reg(msgdata[msgdataindex]); -#endif - } else { - msgdata[msgdataindex] = gdn_receive(); -#ifdef RAWDEBUG - raw_test_pass_reg(msgdata[msgdataindex]); -#endif - } - msgdataindex++;*/ - } -#ifdef RAWDEBUG - raw_test_pass(0xffff); -#endif - if(msgdataindex == msglength) { - // received a whole msg - int type, data1, data2; // will receive at least 3 words including type - type = msgdata[0]; - data1 = msgdata[1]; - data2 = msgdata[2]; - switch(type) { - case 0: { - // receive a object transfer msg - struct transObjInfo * transObj = RUNMALLOC_I(sizeof(struct transObjInfo)); - int k = 0; - if(corenum > NUMCORES - 1) { - raw_test_done(0xa00a); - } - // store the object and its corresponding queue info, enqueue it later - transObj->objptr = (void *)data2; // data1 is now size of the msg - transObj->length = (msglength - 3) / 2; - transObj->queues = RUNMALLOC_I(sizeof(int)*(msglength - 3)); - for(k = 0; k < transObj->length; ++k) { - transObj->queues[2*k] = msgdata[3+2*k]; -#ifdef RAWDEBUG - raw_test_pass_reg(transObj->queues[2*k]); -#endif - transObj->queues[2*k+1] = msgdata[3+2*k+1]; -#ifdef RAWDEBUG - raw_test_pass_reg(transObj->queues[2*k+1]); -#endif - } - //memcpy(transObj->queues, msgdata[3], sizeof(int)*(msglength - 3)); - addNewItem_I(&objqueue, (void *)transObj); - ++(self_numreceiveobjs); -#ifdef RAWDEBUG - raw_test_pass(0xe881); -#endif - /* - addNewItem_I(&objqueue, (void *)data2); - ++(self_numreceiveobjs); -#ifdef RAWDEBUG - raw_test_pass(0xe881); -#endif - */ - break; - } - case 1: { - // receive a stall msg - if(corenum != STARTUPCORE) { - // non startup core can not receive stall msg - // return -1 - raw_test_done(0xa001); - } - if(data1 < NUMCORES) { -#ifdef RAWDEBUG - raw_test_pass(0xe882); -#endif - corestatus[data1] = 0; - numsendobjs[data1] = data2; - numreceiveobjs[data1] = msgdata[3]; - } - break; - } - case 2: { - // receive lock request msg - // for 32 bit machine, the size is always 3 words - //int msgsize = sizeof(int) * 3; - int msgsize = 3; - // lock request msg, handle it right now - // check to see if there is a lock exist in locktbl for the required obj - int data3 = msgdata[3]; - deny = false; - if(!RuntimeHashcontainskey(locktbl, data2)) { - // no locks for this object - // first time to operate on this shared object - // create a lock for it - // the lock is an integer: 0 -- stall, >0 -- read lock, -1 -- write lock -#ifdef RAWDEBUG - raw_test_pass(0xe883); -#endif - if(data1 == 0) { - RuntimeHashadd_I(locktbl, data2, 1); - } else { - RuntimeHashadd_I(locktbl, data2, -1); - } - } else { - int rwlock_obj = 0; -#ifdef RAWDEBUG - raw_test_pass(0xe884); -#endif - RuntimeHashget(locktbl, data2, &rwlock_obj); -#ifdef RAWDEBUG - raw_test_pass_reg(rwlock_obj); -#endif - if(0 == rwlock_obj) { - if(data1 == 0) { - rwlock_obj = 1; - } else { - rwlock_obj = -1; - } - RuntimeHashremovekey(locktbl, data2); - RuntimeHashadd_I(locktbl, data2, rwlock_obj); - } else if((rwlock_obj > 0) && (data1 == 0)) { - // read lock request and there are only read locks - rwlock_obj++; - RuntimeHashremovekey(locktbl, data2); - RuntimeHashadd_I(locktbl, data2, rwlock_obj); - } else { - deny = true; - } -#ifdef RAWDEBUG - raw_test_pass_reg(rwlock_obj); -#endif - } - targetcore = data3; - calCoords(corenum, &self_y, &self_x); - calCoords(targetcore, &target_y, &target_x); - // Build the message header - msgHdr = construct_dyn_hdr(0, msgsize, 0, // msgsize word sent. - self_y, self_x, - target_y, target_x); - gdn_send(msgHdr); // Send the message header to EAST to handle fab(n - 1). -#ifdef RAWDEBUG - raw_test_pass(0xbbbb); - raw_test_pass(0xb000 + targetcore); // targetcore -#endif - if(deny == true) { - // deny the lock request - gdn_send(4); // lock request -#ifdef RAWDEBUG - raw_test_pass(4); -#endif - } else { - // grount the lock request - gdn_send(3); // lock request -#ifdef RAWDEBUG - raw_test_pass(3); -#endif - } - gdn_send(data1); // lock type -#ifdef RAWDEBUG - raw_test_pass_reg(data1); -#endif - gdn_send(data2); // lock target -#ifdef RAWDEBUG - raw_test_pass_reg(data2); - raw_test_pass(0xffff); -#endif - break; - } - case 3: { - // receive lock grount msg - if(corenum > NUMCORES - 1) { - raw_test_done(0xa00b); - } - if(lockobj == data2) { - lockresult = 1; - lockflag = true; -#ifndef INTERRUPT - reside = false; -#endif - } else { - // conflicts on lockresults - raw_test_done(0xa002); - } - break; - } - case 4: { - // receive lock grount/deny msg - if(corenum > NUMCORES - 1) { - raw_test_done(0xa00c); - } - if(lockobj == data2) { - lockresult = 0; - lockflag = true; -#ifndef INTERRUPT - reside = false; -#endif - } else { - // conflicts on lockresults - raw_test_done(0xa003); - } - break; - } - case 5: { - // receive lock release msg - if(!RuntimeHashcontainskey(locktbl, data2)) { - // no locks for this object, something is wrong - raw_test_done(0xa004); - } else { - int rwlock_obj = 0; - RuntimeHashget(locktbl, data2, &rwlock_obj); -#ifdef RAWDEBUG - raw_test_pass(0xe885); - raw_test_pass_reg(rwlock_obj); -#endif - if(data1 == 0) { - rwlock_obj--; - } else { - rwlock_obj++; - } - RuntimeHashremovekey(locktbl, data2); - RuntimeHashadd_I(locktbl, data2, rwlock_obj); -#ifdef RAWDEBUG - raw_test_pass_reg(rwlock_obj); -#endif - } - break; - } - default: - break; - } - //RUNFREE(msgdata); - //msgdata = NULL; - for(msgdataindex--;msgdataindex > 0; --msgdataindex) { - msgdata[msgdataindex] = -1; - } - msgtype = -1; - //msgdataindex = 0; - msglength = 30; -#ifdef RAWDEBUG - raw_test_pass(0xe886); -#endif - if(gdn_input_avail() != 0) { - goto msg; - } - return type; - } else { - // not a whole msg -#ifdef RAWDEBUG - raw_test_pass(0xe887); -#endif - return -2; - } -#elif defined THREADSIMULATE - int numofcore = pthread_getspecific(key); - // use POSIX message queue to transfer object - int msglen = 0; - struct mq_attr mqattr; - mq_getattr(mqd[numofcore], &mqattr); - void * msgptr =RUNMALLOC(mqattr.mq_msgsize); - msglen=mq_receive(mqd[numofcore], msgptr, mqattr.mq_msgsize, NULL); // receive the object into the queue - if(-1 == msglen) { - // no msg - free(msgptr); - return 1; - } - //printf("msg: %s\n",msgptr); - if(((int*)msgptr)[0] == -1) { - // StallMsg - struct ___Object___ * tmpptr = (struct ___Object___ *)msgptr; - int index = tmpptr->flag; - corestatus[index] = 0; - numsendobjs[index] = tmpptr->___cachedHash___; - numreceiveobjs[index] = tmpptr->___cachedCode___; - printf(" index: %d, sendobjs: %d, reveiveobjs: %d\n", index, numsendobjs[index], numreceiveobjs[index]); - free(msgptr); - return 2; - } /*else if(((int*)msgptr)[0] == -2) { - // terminate msg - return 3; - } */else { - // an object - if(numofcore == STARTUPCORE) { - ++(numreceiveobjs[numofcore]); - } else { - ++(thread_data_array[numofcore].numreceiveobjs); - } - struct ___Object___ * tmpptr = (struct ___Object___ *)msgptr; - struct transObjInfo * transObj = (struct transObjInfo *)tmpptr->original; - tmpptr = (struct ___Object___ *)(transObj->objptr); - int type = tmpptr->type; - int size=classsize[type]; - struct ___Object___ * newobj=RUNMALLOC(size); - memcpy(newobj, tmpptr, size); - if(0 == newobj->isolate) { - newobj->original=tmpptr; - } - RUNFREE(msgptr); - tmpptr = NULL; - int k = 0; - for(k = 0; k < transObj->length; ++k) { - int taskindex = transObj->queues[2 * k]; - int paramindex = transObj->queues[2 * k + 1]; - struct parameterwrapper ** queues = &(paramqueues[numofcore][taskindex][paramindex]); - enqueueObject(newobj, queues, 1); - } - RUNFREE(transObj->queues); - RUNFREE(transObj); - return 0; - } -#endif -} - -bool getreadlock(void * ptr) { -#ifdef RAW - unsigned msgHdr; - int self_y, self_x, target_y, target_x; - int targetcore = ((int)ptr >> 5) % TOTALCORE; - // for 32 bit machine, the size is always 4 words - //int msgsize = sizeof(int) * 4; - int msgsize = 4; - - lockobj = (int)ptr; - lockflag = false; -#ifndef INTERRUPT - reside = false; -#endif - lockresult = 0; - - if(targetcore == corenum) { - // reside on this core - bool deny = false; -#ifdef INTERRUPT - raw_user_interrupts_off(); -#endif - if(!RuntimeHashcontainskey(locktbl, (int)ptr)) { - // no locks for this object - // first time to operate on this shared object - // create a lock for it - // the lock is an integer: 0 -- stall, >0 -- read lock, -1 -- write lock - RuntimeHashadd_I(locktbl, (int)ptr, 1); - } else { - int rwlock_obj = 0; - RuntimeHashget(locktbl, (int)ptr, &rwlock_obj); - if(-1 != rwlock_obj) { - rwlock_obj++; - RuntimeHashremovekey(locktbl, (int)ptr); - RuntimeHashadd_I(locktbl, (int)ptr, rwlock_obj); - } else { - deny = true; - } - } -#ifdef INTERRUPT - raw_user_interrupts_on(); -#endif - if(lockobj == (int)ptr) { - if(deny) { - lockresult = 0; - } else { - lockresult = 1; - } - lockflag = true; -#ifndef INTERRUPT - reside = true; -#endif - } else { - // conflicts on lockresults - raw_test_done(0xa005); - } - return true; - } - - calCoords(corenum, &self_y, &self_x); - calCoords(targetcore, &target_y, &target_x); - // Build the message header - msgHdr = construct_dyn_hdr(0, msgsize, 0, // msgsize word sent. - self_y, self_x, - target_y, target_x); - gdn_send(msgHdr); // Send the message header to EAST to handle fab(n - 1). -#ifdef RAWDEBUG - raw_test_pass(0xbbbb); - raw_test_pass(0xb000 + targetcore); // targetcore -#endif - gdn_send(2); // lock request - #ifdef RAWDEBUG - raw_test_pass(2); -#endif - gdn_send(0); // read lock -#ifdef RAWDEBUG - raw_test_pass(0); -#endif - gdn_send(ptr); -#ifdef RAWDEBUG - raw_test_pass_reg(ptr); -#endif - gdn_send(corenum); -#ifdef RAWDEBUG - raw_test_pass_reg(corenum); - raw_test_pass(0xffff); -#endif - return true; -#elif defined THREADSIMULATE - int numofcore = pthread_getspecific(key); - - int rc = pthread_rwlock_tryrdlock(&rwlock_tbl); - printf("[getreadlock, %d] getting the read lock for locktbl: %d error: \n", numofcore, rc, strerror(rc)); - if(0 != rc) { - return false; - } - if(!RuntimeHashcontainskey(locktbl, (int)ptr)) { - // no locks for this object - // first time to operate on this shared object - // create a lock for it - rc = pthread_rwlock_unlock(&rwlock_tbl); - printf("[getreadlock, %d] release the read lock for locktbl: %d error: \n", numofcore, rc, strerror(rc)); - pthread_rwlock_t* rwlock = (pthread_rwlock_t *)RUNMALLOC(sizeof(pthread_rwlock_t)); - memcpy(rwlock, &rwlock_init, sizeof(pthread_rwlock_t)); - rc = pthread_rwlock_init(rwlock, NULL); - printf("[getreadlock, %d] initialize the rwlock for object %d: %d error: \n", numofcore, (int)ptr, rc, strerror(rc)); - rc = pthread_rwlock_trywrlock(&rwlock_tbl); - printf("[getreadlock, %d] getting the write lock for locktbl: %d error: \n", numofcore, rc, strerror(rc)); - if(0 != rc) { - RUNFREE(rwlock); - return false; - } else { - if(!RuntimeHashcontainskey(locktbl, (int)ptr)) { - // check again - RuntimeHashadd(locktbl, (int)ptr, (int)rwlock); - } else { - RUNFREE(rwlock); - RuntimeHashget(locktbl, (int)ptr, (int*)&rwlock); - } - rc = pthread_rwlock_unlock(&rwlock_tbl); - printf("[getreadlock, %d] release the write lock for locktbl: %d error: \n", numofcore, rc, strerror(rc)); - } - rc = pthread_rwlock_tryrdlock(rwlock); - printf("[getreadlock, %d] getting read lock for object %d: %d error: \n", numofcore, (int)ptr, rc, strerror(rc)); - if(0 != rc) { - return false; - } else { - return true; - } - } else { - pthread_rwlock_t* rwlock_obj = NULL; - RuntimeHashget(locktbl, (int)ptr, (int*)&rwlock_obj); - rc = pthread_rwlock_unlock(&rwlock_tbl); - printf("[getreadlock, %d] release the read lock for locktbl: %d error: \n", numofcore, rc, strerror(rc)); - int rc_obj = pthread_rwlock_tryrdlock(rwlock_obj); - printf("[getreadlock, %d] getting read lock for object %d: %d error: \n", numofcore, (int)ptr, rc_obj, strerror(rc_obj)); - if(0 != rc_obj) { - return false; - } else { - return true; - } - } -#endif -} - -void releasereadlock(void * ptr) { -#ifdef RAW - unsigned msgHdr; - int self_y, self_x, target_y, target_x; - int targetcore = ((int)ptr >> 5) % TOTALCORE; - // for 32 bit machine, the size is always 3 words - //int msgsize = sizeof(int) * 3; - int msgsize = 3; - - if(targetcore == corenum) { -#ifdef INTERRUPT - raw_user_interrupts_off(); -#endif - // reside on this core - if(!RuntimeHashcontainskey(locktbl, (int)ptr)) { - // no locks for this object, something is wrong - raw_test_done(0xa006); - } else { - int rwlock_obj = 0; - RuntimeHashget(locktbl, (int)ptr, &rwlock_obj); - rwlock_obj--; - RuntimeHashremovekey(locktbl, (int)ptr); - RuntimeHashadd_I(locktbl, (int)ptr, rwlock_obj); - } -#ifdef INTERRUPT - raw_user_interrupts_on(); -#endif - return; - } - - calCoords(corenum, &self_y, &self_x); - calCoords(targetcore, &target_y, &target_x); - // Build the message header - msgHdr = construct_dyn_hdr(0, msgsize, 0, // msgsize word sent. - self_y, self_x, - target_y, target_x); - gdn_send(msgHdr); // Send the message header to EAST to handle fab(n - 1). -#ifdef RAWDEBUG - raw_test_pass(0xbbbb); - raw_test_pass(0xb000 + targetcore); // targetcore -#endif - gdn_send(5); // lock release -#ifdef RAWDEBUG - raw_test_pass(5); -#endif - gdn_send(0); // read lock -#ifdef RAWDEBUG - raw_test_pass(0); -#endif - gdn_send(ptr); -#ifdef RAWDEBUG - raw_test_pass_reg(ptr); - raw_test_pass(0xffff); -#endif -#elif defined THREADSIMULATE - int numofcore = pthread_getspecific(key); - int rc = pthread_rwlock_rdlock(&rwlock_tbl); - printf("[releasereadlock, %d] getting the read lock for locktbl: %d error: \n", numofcore, rc, strerror(rc)); - if(!RuntimeHashcontainskey(locktbl, (int)ptr)) { - printf("[releasereadlock, %d] Error: try to release a lock without previously grab it\n", numofcore); - exit(-1); - } - pthread_rwlock_t* rwlock_obj = NULL; - RuntimeHashget(locktbl, (int)ptr, (int*)&rwlock_obj); - int rc_obj = pthread_rwlock_unlock(rwlock_obj); - printf("[releasereadlock, %d] unlocked object %d: %d error: \n", numofcore, (int)ptr, rc_obj, strerror(rc_obj)); - rc = pthread_rwlock_unlock(&rwlock_tbl); - printf("[releasereadlock, %d] release the read lock for locktbl: %d error: \n", numofcore, rc, strerror(rc)); -#endif -} - -#ifdef RAW -bool getreadlock_I(void * ptr) { - unsigned msgHdr; - int self_y, self_x, target_y, target_x; - int targetcore = ((int)ptr >> 5) % TOTALCORE; - // for 32 bit machine, the size is always 4 words - //int msgsize = sizeof(int) * 4; - int msgsize = 4; - - lockobj = (int)ptr; - lockflag = false; -#ifndef INTERRUPT - reside = false; -#endif - lockresult = 0; - - if(targetcore == corenum) { - // reside on this core - bool deny = false; - if(!RuntimeHashcontainskey(locktbl, (int)ptr)) { - // no locks for this object - // first time to operate on this shared object - // create a lock for it - // the lock is an integer: 0 -- stall, >0 -- read lock, -1 -- write lock - RuntimeHashadd_I(locktbl, (int)ptr, 1); - } else { - int rwlock_obj = 0; - RuntimeHashget(locktbl, (int)ptr, &rwlock_obj); - if(-1 != rwlock_obj) { - rwlock_obj++; - RuntimeHashremovekey(locktbl, (int)ptr); - RuntimeHashadd_I(locktbl, (int)ptr, rwlock_obj); - } else { - deny = true; - } - } - if(lockobj == (int)ptr) { - if(deny) { - lockresult = 0; - } else { - lockresult = 1; - } - lockflag = true; -#ifndef INTERRUPT - reside = true; -#endif - } else { - // conflicts on lockresults - raw_test_done(0xa005); - } - return true; - } - - calCoords(corenum, &self_y, &self_x); - calCoords(targetcore, &target_y, &target_x); - // Build the message header - msgHdr = construct_dyn_hdr(0, msgsize, 0, // msgsize word sent. - self_y, self_x, - target_y, target_x); - gdn_send(msgHdr); // Send the message header to EAST to handle fab(n - 1). -#ifdef RAWDEBUG - raw_test_pass(0xbbbb); - raw_test_pass(0xb000 + targetcore); // targetcore -#endif - gdn_send(2); // lock request -#ifdef RAWDEBUG - raw_test_pass(2); -#endif - gdn_send(0); // read lock -#ifdef RAWDEBUG - raw_test_pass(0); -#endif - gdn_send(ptr); -#ifdef RAWDEBUG - raw_test_pass_reg(ptr); -#endif - gdn_send(corenum); -#ifdef RAWDEBUG - raw_test_pass_reg(corenum); - raw_test_pass(0xffff); -#endif - return true; -} - -void releasereadlock_I(void * ptr) { - unsigned msgHdr; - int self_y, self_x, target_y, target_x; - int targetcore = ((int)ptr >> 5) % TOTALCORE; - // for 32 bit machine, the size is always 3 words - //int msgsize = sizeof(int) * 3; - int msgsize = 3; - - if(targetcore == corenum) { - // reside on this core - if(!RuntimeHashcontainskey(locktbl, (int)ptr)) { - // no locks for this object, something is wrong - raw_test_done(0xa006); - } else { - int rwlock_obj = 0; - RuntimeHashget(locktbl, (int)ptr, &rwlock_obj); - rwlock_obj--; - RuntimeHashremovekey(locktbl, (int)ptr); - RuntimeHashadd_I(locktbl, (int)ptr, rwlock_obj); - } - return; - } - - calCoords(corenum, &self_y, &self_x); - calCoords(targetcore, &target_y, &target_x); - // Build the message header - msgHdr = construct_dyn_hdr(0, msgsize, 0, // msgsize word sent. - self_y, self_x, - target_y, target_x); - gdn_send(msgHdr); // Send the message header to EAST to handle fab(n - 1). -#ifdef RAWDEBUG - raw_test_pass(0xbbbb); - raw_test_pass(0xb000 + targetcore); // targetcore -#endif - gdn_send(5); // lock release -#ifdef RAWDEBUG - raw_test_pass(5); -#endif - gdn_send(0); // read lock -#ifdef RAWDEBUG - raw_test_pass(0); -#endif - gdn_send(ptr); -#ifdef RAWDEBUG - raw_test_pass_reg(ptr); - raw_test_pass(0xffff); -#endif -} -#endif - -// not reentrant -bool getwritelock(void * ptr) { -#ifdef RAW - unsigned msgHdr; - int self_y, self_x, target_y, target_x; - int targetcore = ((int)ptr >> 5) % TOTALCORE; - // for 32 bit machine, the size is always 4 words - //int msgsize = sizeof(int) * 4; - int msgsize= 4; - int tc = TOTALCORE; -#ifdef INTERRUPT - //raw_user_interrupts_off(); -#endif - //targetcore = ((int)ptr) % tc; -#ifdef INTERRUPT - //raw_user_interrupts_on(); -#endif - -#ifdef RAWDEBUG - raw_test_pass(0xe551); - raw_test_pass_reg(ptr); - raw_test_pass_reg(targetcore); - raw_test_pass_reg(tc); -#endif - - lockobj = (int)ptr; - lockflag = false; -#ifndef INTERRUPT - reside = false; -#endif - lockresult = 0; - - if(targetcore == corenum) { - // reside on this core - bool deny = false; -#ifdef INTERRUPT - raw_user_interrupts_off(); -#endif - if(!RuntimeHashcontainskey(locktbl, (int)ptr)) { - // no locks for this object - // first time to operate on this shared object - // create a lock for it - // the lock is an integer: 0 -- stall, >0 -- read lock, -1 -- write lock -#ifdef RAWDEBUG - raw_test_pass(0xe552); -#endif - RuntimeHashadd_I(locktbl, (int)ptr, -1); - } else { - int rwlock_obj = 0; - RuntimeHashget(locktbl, (int)ptr, &rwlock_obj); -#ifdef RAWDEBUG - raw_test_pass(0xe553); - raw_test_pass_reg(rwlock_obj); -#endif - if(0 == rwlock_obj) { - rwlock_obj = -1; - RuntimeHashremovekey(locktbl, (int)ptr); - RuntimeHashadd_I(locktbl, (int)ptr, rwlock_obj); - } else { - deny = true; - } - } -#ifdef INTERRUPT - raw_user_interrupts_on(); -#endif -#ifdef RAWDEBUG - raw_test_pass(0xe554); - raw_test_pass_reg(lockresult); -#endif - if(lockobj == (int)ptr) { - if(deny) { - lockresult = 0; -#ifdef RAWDEBUG - raw_test_pass(0); -#endif - } else { - lockresult = 1; -#ifdef RAWDEBUG - raw_test_pass(1); -#endif - } - lockflag = true; -#ifndef INTERRUPT - reside = true; -#endif - } else { - // conflicts on lockresults - raw_test_done(0xa007); - } - return true; - } - -#ifdef RAWDEBUG - raw_test_pass(0xe555); -#endif - calCoords(corenum, &self_y, &self_x); - calCoords(targetcore, &target_y, &target_x); - // Build the message header - msgHdr = construct_dyn_hdr(0, msgsize, 0, // msgsize word sent. - self_y, self_x, - target_y, target_x); - gdn_send(msgHdr); // Send the message header to EAST to handle fab(n - 1). -#ifdef RAWDEBUG - raw_test_pass(0xbbbb); - raw_test_pass(0xb000 + targetcore); // targetcore -#endif - gdn_send(2); // lock request -#ifdef RAWDEBUG - raw_test_pass(2); -#endif - gdn_send(1); // write lock -#ifdef RAWDEBUG - raw_test_pass(1); -#endif - gdn_send(ptr); -#ifdef RAWDEBUG - raw_test_pass_reg(ptr); -#endif - gdn_send(corenum); -#ifdef RAWDEBUG - raw_test_pass_reg(corenum); - raw_test_pass(0xffff); -#endif - return true; -#elif defined THREADSIMULATE - int numofcore = pthread_getspecific(key); - - int rc = pthread_rwlock_tryrdlock(&rwlock_tbl); - printf("[getwritelock, %d] getting the read lock for locktbl: %d error: \n", numofcore, rc, strerror(rc)); - if(0 != rc) { - return false; - } - if(!RuntimeHashcontainskey(locktbl, (int)ptr)) { - // no locks for this object - // first time to operate on this shared object - // create a lock for it - rc = pthread_rwlock_unlock(&rwlock_tbl); - printf("[getwritelock, %d] release the read lock for locktbl: %d error: \n", numofcore, rc, strerror(rc)); - pthread_rwlock_t* rwlock = (pthread_rwlock_t *)RUNMALLOC(sizeof(pthread_rwlock_t)); - memcpy(rwlock, &rwlock_init, sizeof(pthread_rwlock_t)); - rc = pthread_rwlock_init(rwlock, NULL); - printf("[getwritelock, %d] initialize the rwlock for object %d: %d error: \n", numofcore, (int)ptr, rc, strerror(rc)); - rc = pthread_rwlock_trywrlock(&rwlock_tbl); - printf("[getwritelock, %d] getting the write lock for locktbl: %d error: \n", numofcore, rc, strerror(rc)); - if(0 != rc) { - pthread_rwlock_destroy(rwlock); - RUNFREE(rwlock); - return false; - } else { - if(!RuntimeHashcontainskey(locktbl, (int)ptr)) { - // check again - RuntimeHashadd(locktbl, (int)ptr, (int)rwlock); - } else { - pthread_rwlock_destroy(rwlock); - RUNFREE(rwlock); - RuntimeHashget(locktbl, (int)ptr, (int*)&rwlock); - } - rc = pthread_rwlock_unlock(&rwlock_tbl); - printf("[getwritelock, %d] release the write lock for locktbl: %d error: \n", numofcore, rc, strerror(rc)); - } - rc = pthread_rwlock_trywrlock(rwlock); - printf("[getwritelock, %d] getting write lock for object %d: %d error: \n", numofcore, (int)ptr, rc, strerror(rc)); - if(0 != rc) { - return false; - } else { - return true; - } - } else { - pthread_rwlock_t* rwlock_obj = NULL; - RuntimeHashget(locktbl, (int)ptr, (int*)&rwlock_obj); - rc = pthread_rwlock_unlock(&rwlock_tbl); - printf("[getwritelock, %d] release the read lock for locktbl: %d error: \n", numofcore, rc, strerror(rc)); - int rc_obj = pthread_rwlock_trywrlock(rwlock_obj); - printf("[getwritelock, %d] getting write lock for object %d: %d error: \n", numofcore, (int)ptr, rc_obj, strerror(rc_obj)); - if(0 != rc_obj) { - return false; - } else { - return true; - } - } - -#endif -} - -void releasewritelock(void * ptr) { -#ifdef RAW - unsigned msgHdr; - int self_y, self_x, target_y, target_x; - int targetcore = ((int)ptr >> 5) % TOTALCORE; - // for 32 bit machine, the size is always 3 words - //int msgsize = sizeof(int) * 3; - int msgsize = 3; - - if(targetcore == corenum) { -#ifdef INTERRUPT - raw_user_interrupts_off(); -#endif - // reside on this core - if(!RuntimeHashcontainskey(locktbl, (int)ptr)) { - // no locks for this object, something is wrong - raw_test_done(0xa008); - } else { - int rwlock_obj = 0; -#ifdef RAWDEBUG - raw_test_pass(0xe662); -#endif - RuntimeHashget(locktbl, (int)ptr, &rwlock_obj); -#ifdef RAWDEBUG - raw_test_pass_reg(rwlock_obj); -#endif - rwlock_obj++; - RuntimeHashremovekey(locktbl, (int)ptr); - RuntimeHashadd_I(locktbl, (int)ptr, rwlock_obj); -#ifdef RAWDEBUG - raw_test_pass_reg(rwlock_obj); -#endif - } -#ifdef INTERRUPT - raw_user_interrupts_on(); -#endif - return; - } - -#ifdef RAWDEBUG - raw_test_pass(0xe663); -#endif - calCoords(corenum, &self_y, &self_x); - calCoords(targetcore, &target_y, &target_x); - // Build the message header - msgHdr = construct_dyn_hdr(0, msgsize, 0, // msgsize word sent. - self_y, self_x, - target_y, target_x); - gdn_send(msgHdr); // Send the message header to EAST to handle fab(n - 1). -#ifdef RAWDEBUG - raw_test_pass(0xbbbb); - raw_test_pass(0xb000 + targetcore); -#endif - gdn_send(5); // lock release - #ifdef RAWDEBUG - raw_test_pass(5); -#endif - gdn_send(1); // write lock -#ifdef RAWDEBUG - raw_test_pass(1); -#endif - gdn_send(ptr); -#ifdef RAWDEBUG - raw_test_pass_reg(ptr); - raw_test_pass(0xffff); -#endif -#elif defined THREADSIMULATE - int numofcore = pthread_getspecific(key); - int rc = pthread_rwlock_rdlock(&rwlock_tbl); - printf("[releasewritelock, %d] getting the read lock for locktbl: %d error: \n", numofcore, rc, strerror(rc)); - if(!RuntimeHashcontainskey(locktbl, (int)ptr)) { - printf("[releasewritelock, %d] Error: try to release a lock without previously grab it\n", numofcore); - exit(-1); - } - pthread_rwlock_t* rwlock_obj = NULL; - RuntimeHashget(locktbl, (int)ptr, (int*)&rwlock_obj); - int rc_obj = pthread_rwlock_unlock(rwlock_obj); - printf("[releasewritelock, %d] unlocked object %d: %d error:\n", numofcore, (int)ptr, rc_obj, strerror(rc_obj)); - rc = pthread_rwlock_unlock(&rwlock_tbl); - printf("[releasewritelock, %d] release the read lock for locktbl: %d error: \n", numofcore, rc, strerror(rc)); -#endif -} - -int enqueuetasks(struct parameterwrapper *parameter, struct parameterwrapper *prevptr, struct ___Object___ *ptr, int * enterflags, int numenterflags) { - void * taskpointerarray[MAXTASKPARAMS]; - int j; - int numparams=parameter->task->numParameters; - int numiterators=parameter->task->numTotal-1; - int retval=1; - int addnormal=1; - int adderror=1; - - struct taskdescriptor * task=parameter->task; - - ObjectHashadd(parameter->objectset, (int) ptr, 0, (int) enterflags, numenterflags, enterflags==NULL);//this add the object to parameterwrapper - - /* Add enqueued object to parameter vector */ - taskpointerarray[parameter->slot]=ptr; - - /* Reset iterators */ - for(j=0;jiterators[j]); - } - - /* Find initial state */ - for(j=0;jiterators[j], taskpointerarray OPTARG(failed))) - toiNext(¶meter->iterators[j], taskpointerarray OPTARG(failed)); - else if (j>0) { - /* Need to backtrack */ - toiReset(¶meter->iterators[j]); - j--; - goto backtrackinit; - } else { - /* Nothing to enqueue */ - return retval; - } - } - - - while(1) { - /* Enqueue current state */ - int launch = 0; - struct taskparamdescriptor *tpd=RUNMALLOC(sizeof(struct taskparamdescriptor)); - tpd->task=task; - tpd->numParameters=numiterators+1; - tpd->parameterArray=RUNMALLOC(sizeof(void *)*(numiterators+1)); - for(j=0;j<=numiterators;j++){ - tpd->parameterArray[j]=taskpointerarray[j];//store the actual parameters - } - /* Enqueue task */ - if ((/*!gencontains(failedtasks, tpd)&&*/!gencontains(activetasks,tpd))) { - genputtable(activetasks, tpd, tpd); - } else { - RUNFREE(tpd->parameterArray); - RUNFREE(tpd); - } - - /* This loop iterates to the next parameter combination */ - if (numiterators==0) - return retval; - - for(j=numiterators-1; jiterators[j], taskpointerarray OPTARG(failed))) - toiNext(¶meter->iterators[j], taskpointerarray OPTARG(failed)); - else if (j>0) { - /* Need to backtrack */ - toiReset(¶meter->iterators[j]); - j--; - goto backtrackinc; - } else { - /* Nothing more to enqueue */ - return retval; - } - } - } - return retval; -} - -#ifdef RAW -int enqueuetasks_I(struct parameterwrapper *parameter, struct parameterwrapper *prevptr, struct ___Object___ *ptr, int * enterflags, int numenterflags) { - void * taskpointerarray[MAXTASKPARAMS]; - int j; - int numparams=parameter->task->numParameters; - int numiterators=parameter->task->numTotal-1; - int retval=1; - int addnormal=1; - int adderror=1; - - struct taskdescriptor * task=parameter->task; - - ObjectHashadd_I(parameter->objectset, (int) ptr, 0, (int) enterflags, numenterflags, enterflags==NULL);//this add the object to parameterwrapper - - /* Add enqueued object to parameter vector */ - taskpointerarray[parameter->slot]=ptr; - - /* Reset iterators */ - for(j=0;jiterators[j]); - } - - /* Find initial state */ - for(j=0;jiterators[j], taskpointerarray OPTARG(failed))) - toiNext(¶meter->iterators[j], taskpointerarray OPTARG(failed)); - else if (j>0) { - /* Need to backtrack */ - toiReset(¶meter->iterators[j]); - j--; - goto backtrackinit; - } else { - /* Nothing to enqueue */ - return retval; - } - } - - while(1) { - /* Enqueue current state */ - int launch = 0; - struct taskparamdescriptor *tpd=RUNMALLOC_I(sizeof(struct taskparamdescriptor)); - tpd->task=task; - tpd->numParameters=numiterators+1; - tpd->parameterArray=RUNMALLOC_I(sizeof(void *)*(numiterators+1)); - for(j=0;j<=numiterators;j++){ - tpd->parameterArray[j]=taskpointerarray[j];//store the actual parameters - } - /* Enqueue task */ - if ((/*!gencontains(failedtasks, tpd)&&*/!gencontains(activetasks,tpd))) { - genputtable_I(activetasks, tpd, tpd); - } else { - RUNFREE(tpd->parameterArray); - RUNFREE(tpd); - } - - /* This loop iterates to the next parameter combination */ - if (numiterators==0) - return retval; - - for(j=numiterators-1; jiterators[j], taskpointerarray OPTARG(failed))) - toiNext(¶meter->iterators[j], taskpointerarray OPTARG(failed)); - else if (j>0) { - /* Need to backtrack */ - toiReset(¶meter->iterators[j]); - j--; - goto backtrackinc; - } else { - /* Nothing more to enqueue */ - return retval; - } - } - } - return retval; -} -#endif - -/* Handler for signals. The signals catch null pointer errors and - arithmatic errors. */ -#ifndef RAW -void myhandler(int sig, siginfo_t *info, void *uap) { - sigset_t toclear; -#ifdef DEBUG - printf("sig=%d\n",sig); - printf("signal\n"); -#endif - sigemptyset(&toclear); - sigaddset(&toclear, sig); - sigprocmask(SIG_UNBLOCK, &toclear,NULL); - longjmp(error_handler,1); -} -#endif - -fd_set readfds; -int maxreadfd; -struct RuntimeHash *fdtoobject; - -void addreadfd(int fd) { - if (fd>=maxreadfd) - maxreadfd=fd+1; - FD_SET(fd, &readfds); -} - -void removereadfd(int fd) { - FD_CLR(fd, &readfds); - if (maxreadfd==(fd+1)) { - maxreadfd--; - while(maxreadfd>0&&!FD_ISSET(maxreadfd-1, &readfds)) - maxreadfd--; - } -} - -#ifdef PRECISE_GC -#define OFFSET 2 -#else -#define OFFSET 0 -#endif - -void executetasks() { - void * taskpointerarray[MAXTASKPARAMS+OFFSET]; - int numparams=0; - int numtotal=0; - struct ___Object___ * tmpparam = NULL; - struct parameterdescriptor * pd=NULL; - struct parameterwrapper *pw=NULL; - int j = 0; - int x = 0; - bool lock = true; - -#ifdef RAW - int grount = 0; - int andmask=0; - int checkmask=0; -#ifdef RAWDEBUG - raw_test_pass(0xe991); -#endif -#endif - -#ifndef RAW - /* Set up signal handlers */ - struct sigaction sig; - sig.sa_sigaction=&myhandler; - sig.sa_flags=SA_SIGINFO; - sigemptyset(&sig.sa_mask); - - /* Catch bus errors, segmentation faults, and floating point exceptions*/ - sigaction(SIGBUS,&sig,0); - sigaction(SIGSEGV,&sig,0); - sigaction(SIGFPE,&sig,0); - sigaction(SIGPIPE,&sig,0); -#endif - -#ifndef RAW - /* Zero fd set */ - FD_ZERO(&readfds); -#endif - maxreadfd=0; -#ifndef RAW - fdtoobject=allocateRuntimeHash(100); -#endif - -#ifndef RAW - /* Map first block of memory to protected, anonymous page */ - mmap(0, 0x1000, 0, MAP_SHARED|MAP_FIXED|MAP_ANON, -1, 0); -#endif - - newtask: - while((hashsize(activetasks)>0)||(maxreadfd>0)) { - -#ifdef RAW -#ifdef RAWDEBUG - raw_test_pass(0xe992); -#endif -#else - /* Check if any filedescriptors have IO pending */ - if (maxreadfd>0) { - int i; - struct timeval timeout={0,0}; - fd_set tmpreadfds; - int numselect; - tmpreadfds=readfds; - numselect=select(maxreadfd, &tmpreadfds, NULL, NULL, &timeout); - if (numselect>0) { - /* Process ready fd's */ - int fd; - for(fd=0;fd0) { - int i; - currtpd=(struct taskparamdescriptor *) getfirstkey(activetasks); - genfreekey(activetasks, currtpd); - - /* Check if this task has failed, allow a task that contains optional objects to fire */ - /*if (gencontains(failedtasks, currtpd)) { - // Free up task parameter descriptor - RUNFREE(currtpd->parameterArray); - RUNFREE(currtpd); - goto newtask; - }*/ - numparams=currtpd->task->numParameters; - numtotal=currtpd->task->numTotal; - -#ifdef THREADSIMULATE - int isolateflags[numparams]; -#endif - /* Make sure that the parameters are still in the queues */ - for(i=0;iparameterArray[i]; -#ifdef RAW -#ifdef RAWDEBUG - raw_test_pass(0xe993); -#endif - - if(((struct ___Object___ *)parameter)->type == STARTUPTYPE) { - lock = false; - taskpointerarray[i+OFFSET]=parameter; - goto execute; - } - lock = true; - // require locks for this parameter if it is not a startup object - getwritelock(parameter); - grount = 0; - -#ifdef INTERRUPT - raw_user_interrupts_off(); -#endif - while(!lockflag) { - receiveObject(); - } -#ifndef INTERRUPT - if(reside) { - while(receiveObject() != -1) { - } - } -#endif - grount = lockresult; - - lockresult = 0; - lockobj = 0; - lockflag = false; -#ifndef INTERRUPT - reside = false; -#endif -#ifdef INTERRUPT - raw_user_interrupts_on(); -#endif - - if(grount == 0) { -#ifdef RAWDEBUG - raw_test_pass(0xe994); -#endif - // can not get the lock, try later - for(j = 0; j < i; ++j) { - releasewritelock(taskpointerarray[j+OFFSET]); - } - genputtable(activetasks, currtpd, currtpd); - if(hashsize(activetasks) == 1) { - // only one task right now, wait a little while before next try - int halt = 10000; - while(halt--){} - } - goto newtask; - } - // flush the object - { - raw_invalidate_cache_range((int)parameter, classsize[((struct ___Object___ *)parameter)->type]); - /*int tmp = 0; - for(tmp = 0; tmp < classsize[((struct ___Object___ *)parameter)->type]; ++tmp) { - invalidateAddr(parameter + tmp); - }*/ - } -#endif - tmpparam = (struct ___Object___ *)parameter; -#ifdef THREADSIMULATE - if(((struct ___Object___ *)parameter)->type == STARTUPTYPE) { - lock = false; - taskpointerarray[i+OFFSET]=parameter; - goto execute; - } - lock = true; - if(0 == tmpparam->isolate) { - isolateflags[i] = 0; - // shared object, need to flush with current value - //if(!getreadlock(tmpparam->original)) { - // // fail to get read lock of the original object, try this task later - if(!getwritelock(tmpparam->original)) { - // fail to get write lock, release all obtained locks and try this task later - int j = 0; - for(j = 0; j < i; ++j) { - if(0 == isolateflags[j]) { - releasewritelock(((struct ___Object___ *)taskpointerarray[j+OFFSET])->original); - } - } - genputtable(activetasks, currtpd, currtpd); - goto newtask; - } - if(tmpparam->version != tmpparam->original->version) { - // some task on another core has changed this object - // flush this object - //memcpy(tmpparam, tmpparam->original, classsize[tmpparam->type]); - // release all obtained locks - int j = 0; - for(j = 0; j < i; ++j) { - if(0 == isolateflags[j]) { - releasewritelock(((struct ___Object___ *)taskpointerarray[j+OFFSET])->original); - } - } - releasewritelock(tmpparam->original); - - // dequeue this object - int numofcore = pthread_getspecific(key); - struct parameterwrapper ** queues = objectqueues[numofcore][tmpparam->type]; - int length = numqueues[numofcore][tmpparam->type]; - for(j = 0; j < length; ++j) { - struct parameterwrapper * pw = queues[j]; - if(ObjectHashcontainskey(pw->objectset, (int)tmpparam)) { - int next; - int UNUSED, UNUSED2; - int * enterflags; - ObjectHashget(pw->objectset, (int) tmpparam, (int *) &next, (int *) &enterflags, &UNUSED, &UNUSED2); - ObjectHashremove(pw->objectset, (int)tmpparam); - if (enterflags!=NULL) - free(enterflags); - } - } - // try to enqueue it again to check if it feeds other tasks; - //enqueueObject(tmpparam, NULL, 0); - // Free up task parameter descriptor - RUNFREE(currtpd->parameterArray); - RUNFREE(currtpd); - goto newtask; - } - } else { - isolateflags[i] = 1; - } -#endif - pd=currtpd->task->descriptorarray[i]; - pw=(struct parameterwrapper *) pd->queue; - /* Check that object is still in queue */ - { - if (!ObjectHashcontainskey(pw->objectset, (int) parameter)) { -#ifdef RAWDEBUG - raw_test_pass(0xe995); -#endif - // release grabbed locks - for(j = 0; j < i; ++j) { - releasewritelock(taskpointerarray[j+OFFSET]); - } - releasewritelock(parameter); - RUNFREE(currtpd->parameterArray); - RUNFREE(currtpd); - goto newtask; - } - } -#ifdef RAW - /* Check if the object's flags still meets requirements */ - { - int tmpi = 0; - bool ismet = false; - for(tmpi = 0; tmpi < pw->numberofterms; ++tmpi) { - andmask=pw->intarray[tmpi*2]; - checkmask=pw->intarray[tmpi*2+1]; -#ifdef RAWDEBUG - raw_test_pass(0xdd000000 + andmask); - raw_test_pass_reg((int)parameter); - raw_test_pass(0xdd000000 + ((struct ___Object___ *)parameter)->flag); - raw_test_pass(0xdd000000 + checkmask); -#endif - if((((struct ___Object___ *)parameter)->flag&andmask)==checkmask) { - ismet = true; - break; - } - } - if (!ismet) { - // flags are never suitable - // remove this obj from the queue - int next; - int UNUSED, UNUSED2; - int * enterflags; -#ifdef RAWDEBUG - raw_test_pass(0xe996); -#endif - ObjectHashget(pw->objectset, (int) parameter, (int *) &next, (int *) &enterflags, &UNUSED, &UNUSED2); - ObjectHashremove(pw->objectset, (int)parameter); - if (enterflags!=NULL) - free(enterflags); - // release grabbed locks - for(j = 0; j < i; ++j) { - releasewritelock(taskpointerarray[j+OFFSET]); - } - releasewritelock(parameter); - RUNFREE(currtpd->parameterArray); - RUNFREE(currtpd); - goto newtask; - } - } -#endif - parameterpresent: - ; - /* Check that object still has necessary tags */ - for(j=0;jnumbertags;j++) { - int slotid=pd->tagarray[2*j]+numparams; - struct ___TagDescriptor___ *tagd=currtpd->parameterArray[slotid]; - if (!containstag(parameter, tagd)) { -#ifdef RAWDEBUG - raw_test_pass(0xe997); -#endif - RUNFREE(currtpd->parameterArray); - RUNFREE(currtpd); - goto newtask; - } - } - - taskpointerarray[i+OFFSET]=parameter; - } - /* Copy the tags */ - for(;iparameterArray[i]; - } - -#ifdef THREADSIMULATE - for(i = 0; i < numparams; ++i) { - if(0 == isolateflags[i]) { - struct ___Object___ * tmpparam = (struct ___Object___ *)taskpointerarray[i+OFFSET]; - if(tmpparam != tmpparam->original) { - taskpointerarray[i+OFFSET] = tmpparam->original; - } - } - } -#endif - - { -#if 0 -#ifndef RAW - /* Checkpoint the state */ - forward=allocateRuntimeHash(100); - reverse=allocateRuntimeHash(100); - //void ** checkpoint=makecheckpoint(currtpd->task->numParameters, currtpd->parameterArray, forward, reverse); -#endif -#endif - if (x=setjmp(error_handler)) { - int counter; - /* Recover */ -#ifndef RAW -#ifdef DEBUG - printf("Fatal Error=%d, Recovering!\n",x); -#endif -#endif - /* - genputtable(failedtasks,currtpd,currtpd); - //restorecheckpoint(currtpd->task->numParameters, currtpd->parameterArray, checkpoint, forward, reverse); - - freeRuntimeHash(forward); - freeRuntimeHash(reverse); - freemalloc(); - forward=NULL; - reverse=NULL; - */ - //fflush(stdout); -#ifdef RAW -#ifdef RAWDEBUG - raw_test_pass_reg(x); -#endif - raw_test_done(0xa009); -#else - exit(-1); -#endif - } else { - /*if (injectfailures) { - if ((((double)random())/RAND_MAX)task->name); - longjmp(error_handler,10); - } - }*/ - /* Actually call task */ -#ifdef PRECISE_GC - ((int *)taskpointerarray)[0]=currtpd->numParameters; - taskpointerarray[1]=NULL; -#endif -execute: - if(debugtask){ -#ifndef RAW - printf("ENTER %s count=%d\n",currtpd->task->name, (instaccum-instructioncount)); -#endif - ((void (*) (void **)) currtpd->task->taskptr)(taskpointerarray); -#ifndef RAW - printf("EXIT %s count=%d\n",currtpd->task->name, (instaccum-instructioncount)); -#endif - } else { - ((void (*) (void **)) currtpd->task->taskptr)(taskpointerarray); - } -#ifdef RAWDEBUG - raw_test_pass(0xe998); - raw_test_pass_reg(lock); - #endif - - if(lock) { -#ifdef RAW - for(i = 0; i < numparams; ++i) { - int j = 0; - struct ___Object___ * tmpparam = (struct ___Object___ *)taskpointerarray[i+OFFSET]; -#ifdef RAWDEBUG - raw_test_pass(0xe999); - raw_test_pass(0xdd100000 + tmpparam->flag); -#endif - releasewritelock(tmpparam); - } -#elif defined THREADSIMULATE - for(i = 0; i < numparams; ++i) { - if(0 == isolateflags[i]) { - struct ___Object___ * tmpparam = (struct ___Object___ *)taskpointerarray[i+OFFSET]; - releasewritelock(tmpparam); - } - } -#endif - } - -#if 0 -#ifndef RAW - freeRuntimeHash(forward); - freeRuntimeHash(reverse); -#endif -#endif - freemalloc(); - // Free up task parameter descriptor - RUNFREE(currtpd->parameterArray); - RUNFREE(currtpd); -#if 0 -#ifndef RAW - forward=NULL; - reverse=NULL; -#endif -#endif -#ifdef RAWDEBUG - raw_test_pass(0xe99a); - raw_test_pass_reg(lock); - #endif - - } - } - } - } -#ifdef RAWDEBUG - raw_test_pass(0xe999); -#endif -} - -/* This function processes an objects tags */ -void processtags(struct parameterdescriptor *pd, int index, struct parameterwrapper *parameter, int * iteratorcount, int *statusarray, int numparams) { - int i; - - for(i=0;inumbertags;i++) { - int slotid=pd->tagarray[2*i]; - int tagid=pd->tagarray[2*i+1]; - - if (statusarray[slotid+numparams]==0) { - parameter->iterators[*iteratorcount].istag=1; - parameter->iterators[*iteratorcount].tagid=tagid; - parameter->iterators[*iteratorcount].slot=slotid+numparams; - parameter->iterators[*iteratorcount].tagobjectslot=index; - statusarray[slotid+numparams]=1; - (*iteratorcount)++; - } - } -} - - -void processobject(struct parameterwrapper *parameter, int index, struct parameterdescriptor *pd, int *iteratorcount, int * statusarray, int numparams) { - int i; - int tagcount=0; - struct ObjectHash * objectset=((struct parameterwrapper *)pd->queue)->objectset; - - parameter->iterators[*iteratorcount].istag=0; - parameter->iterators[*iteratorcount].slot=index; - parameter->iterators[*iteratorcount].objectset=objectset; - statusarray[index]=1; - - for(i=0;inumbertags;i++) { - int slotid=pd->tagarray[2*i]; - int tagid=pd->tagarray[2*i+1]; - if (statusarray[slotid+numparams]!=0) { - /* This tag has already been enqueued, use it to narrow search */ - parameter->iterators[*iteratorcount].tagbindings[tagcount]=slotid+numparams; - tagcount++; - } - } - parameter->iterators[*iteratorcount].numtags=tagcount; - - (*iteratorcount)++; -} - -/* This function builds the iterators for a task & parameter */ - -void builditerators(struct taskdescriptor * task, int index, struct parameterwrapper * parameter) { - int statusarray[MAXTASKPARAMS]; - int i; - int numparams=task->numParameters; - int iteratorcount=0; - for(i=0;idescriptorarray[index], index, parameter, & iteratorcount, statusarray, numparams); - - while(1) { - loopstart: - /* Check for objects with existing tags */ - for(i=0;idescriptorarray[i]; - int j; - for(j=0;jnumbertags;j++) { - int slotid=pd->tagarray[2*j]; - if(statusarray[slotid+numparams]!=0) { - processobject(parameter, i, pd, &iteratorcount, statusarray, numparams); - processtags(pd, i, parameter, &iteratorcount, statusarray, numparams); - goto loopstart; - } - } - } - } - - /* Next do objects w/ unbound tags*/ - - for(i=0;idescriptorarray[i]; - if (pd->numbertags>0) { - processobject(parameter, i, pd, &iteratorcount, statusarray, numparams); - processtags(pd, i, parameter, &iteratorcount, statusarray, numparams); - goto loopstart; - } - } - } - - /* Nothing with a tag enqueued */ - - for(i=0;idescriptorarray[i]; - processobject(parameter, i, pd, &iteratorcount, statusarray, numparams); - processtags(pd, i, parameter, &iteratorcount, statusarray, numparams); - goto loopstart; - } - } - - /* Nothing left */ - return; - } -} - - void printdebug() { - int i; - int j; -#ifdef THREADSIMULATE - int numofcore = pthread_getspecific(key); - for(i=0;i NUMCORES - 1) { - return; - } -#endif - for(i=0;iname); -#endif - for(j=0;jnumParameters;j++) { - struct parameterdescriptor *param=task->descriptorarray[j]; - struct parameterwrapper *parameter=param->queue; - struct ObjectHash * set=parameter->objectset; - struct ObjectIterator objit; -#ifndef RAW - printf(" Parameter %d\n", j); -#endif - ObjectHashiterator(set, &objit); - while(ObjhasNext(&objit)) { - struct ___Object___ * obj=(struct ___Object___ *)Objkey(&objit); - struct ___Object___ * tagptr=obj->___tags___; - int nonfailed=Objdata4(&objit); - int numflags=Objdata3(&objit); - int flags=Objdata2(&objit); - Objnext(&objit); -#ifndef RAW - printf(" Contains %lx\n", obj); - printf(" flag=%d\n", obj->flag); -#endif - if (tagptr==NULL) { - } else if (tagptr->type==TAGTYPE) { -#ifndef RAW - printf(" tag=%lx\n",tagptr); -#endif - ; - } else { - int tagindex=0; - struct ArrayObject *ao=(struct ArrayObject *)tagptr; - for(;tagindex___cachedCode___;tagindex++) { -#ifndef RAW - printf(" tag=%lx\n",ARRAYGET(ao, struct ___TagDescriptor___*, tagindex)); -#endif - } - } - } - } - } - } - - -/* This function processes the task information to create queues for - each parameter type. */ - -void processtasks() { - int i; -#ifdef RAW - if(corenum > NUMCORES - 1) { - return; - } -#endif -#ifdef THREADSIMULATE - int numofcore = pthread_getspecific(key); - for(i=0;inumParameters;j++) { - struct parameterdescriptor *param=task->descriptorarray[j]; - struct parameterwrapper *parameter=param->queue; - parameter->objectset=allocateObjectHash(10); - parameter->task=task; - } - - /* Build iterators for parameters */ - for(j=0;jnumParameters;j++) { - struct parameterdescriptor *param=task->descriptorarray[j]; - struct parameterwrapper *parameter=param->queue; - builditerators(task, j, parameter); - } - } -} - -void toiReset(struct tagobjectiterator * it) { - if (it->istag) { - it->tagobjindex=0; - } else if (it->numtags>0) { - it->tagobjindex=0; - } else { - ObjectHashiterator(it->objectset, &it->it); - } -} - -int toiHasNext(struct tagobjectiterator *it, void ** objectarray OPTARG(int * failed)) { - if (it->istag) { - /* Iterate tag */ - /* Get object with tags */ - struct ___Object___ *obj=objectarray[it->tagobjectslot]; - struct ___Object___ *tagptr=obj->___tags___; - if (tagptr->type==TAGTYPE) { - if ((it->tagobjindex==0)&& /* First object */ - (it->tagid==((struct ___TagDescriptor___ *)tagptr)->flag)) /* Right tag type */ - return 1; - else - return 0; - } else { - struct ArrayObject *ao=(struct ArrayObject *) tagptr; - int tagindex=it->tagobjindex; - for(;tagindex___cachedCode___;tagindex++) { - struct ___TagDescriptor___ *td=ARRAYGET(ao, struct ___TagDescriptor___ *, tagindex); - if (td->flag==it->tagid) { - it->tagobjindex=tagindex; /* Found right type of tag */ - return 1; - } - } - return 0; - } - } else if (it->numtags>0) { - /* Use tags to locate appropriate objects */ - struct ___TagDescriptor___ *tag=objectarray[it->tagbindings[0]]; - struct ___Object___ *objptr=tag->flagptr; - int i; - if (objptr->type!=OBJECTARRAYTYPE) { - if (it->tagobjindex>0) - return 0; - if (!ObjectHashcontainskey(it->objectset, (int) objptr)) - return 0; - for(i=1;inumtags;i++) { - struct ___TagDescriptor___ *tag2=objectarray[it->tagbindings[i]]; - if (!containstag(objptr,tag2)) - return 0; - } - return 1; - } else { - struct ArrayObject *ao=(struct ArrayObject *) objptr; - int tagindex; - int i; - for(tagindex=it->tagobjindex;tagindex___cachedCode___;tagindex++) { - struct ___Object___ *objptr=ARRAYGET(ao, struct ___Object___*, tagindex); - if (!ObjectHashcontainskey(it->objectset, (int) objptr)) - continue; - for(i=1;inumtags;i++) { - struct ___TagDescriptor___ *tag2=objectarray[it->tagbindings[i]]; - if (!containstag(objptr,tag2)) - goto nexttag; - } - it->tagobjindex=tagindex; - return 1; - nexttag: - ; - } - it->tagobjindex=tagindex; - return 0; - } - } else { - return ObjhasNext(&it->it); - } -} - -int containstag(struct ___Object___ *ptr, struct ___TagDescriptor___ *tag) { - int j; - struct ___Object___ * objptr=tag->flagptr; - if (objptr->type==OBJECTARRAYTYPE) { - struct ArrayObject *ao=(struct ArrayObject *)objptr; - for(j=0;j___cachedCode___;j++) { - if (ptr==ARRAYGET(ao, struct ___Object___*, j)) - return 1; - } - return 0; - } else - return objptr==ptr; -} - -void toiNext(struct tagobjectiterator *it , void ** objectarray OPTARG(int * failed)) { - /* hasNext has all of the intelligence */ - if(it->istag) { - /* Iterate tag */ - /* Get object with tags */ - struct ___Object___ *obj=objectarray[it->tagobjectslot]; - struct ___Object___ *tagptr=obj->___tags___; - if (tagptr->type==TAGTYPE) { - it->tagobjindex++; - objectarray[it->slot]=tagptr; - } else { - struct ArrayObject *ao=(struct ArrayObject *) tagptr; - objectarray[it->slot]=ARRAYGET(ao, struct ___TagDescriptor___ *, it->tagobjindex++); - } - } else if (it->numtags>0) { - /* Use tags to locate appropriate objects */ - struct ___TagDescriptor___ *tag=objectarray[it->tagbindings[0]]; - struct ___Object___ *objptr=tag->flagptr; - if (objptr->type!=OBJECTARRAYTYPE) { - it->tagobjindex++; - objectarray[it->slot]=objptr; - } else { - struct ArrayObject *ao=(struct ArrayObject *) objptr; - objectarray[it->slot]=ARRAYGET(ao, struct ___Object___ *, it->tagobjindex++); - } - } else { - /* Iterate object */ - objectarray[it->slot]=(void *)Objkey(&it->it); - Objnext(&it->it); - } -} -#endif diff --git a/Robust/src/Runtime/object.c b/Robust/src/Runtime/object.c deleted file mode 100644 index 0bff6175..00000000 --- a/Robust/src/Runtime/object.c +++ /dev/null @@ -1,85 +0,0 @@ -#include "object.h" -#ifdef RAW -#include -#else -#include "stdio.h" -#endif -#include "stdlib.h" - -#ifdef THREADS -#include "thread.h" -#endif - -int CALL01(___Object______nativehashCode____, struct ___Object___ * ___this___) { - return (int) VAR(___this___); -} - -int CALL01(___Object______getType____, struct ___Object___ * ___this___) { - return ((int *)VAR(___this___))[0]; -} - -#ifdef THREADS -int CALL01(___Object______MonitorEnter____, struct ___Object___ * ___this___) { - pthread_t self=pthread_self(); - if (self==VAR(___this___)->tid) { - VAR(___this___)->lockcount++; - } else { -#ifdef PRECISE_GC - struct listitem *tmp=stopforgc((struct garbagelist *)___params___); -#endif - pthread_mutex_lock(&objlock); -#ifdef PRECISE_GC - restartaftergc(tmp); -#endif - while(1) { - if (VAR(___this___)->tid==0) { - VAR(___this___)->___prevlockobject___=NULL; - VAR(___this___)->___nextlockobject___=(struct ___Object___ *)pthread_getspecific(threadlocks); - if (VAR(___this___)->___nextlockobject___!=NULL) - VAR(___this___)->___nextlockobject___->___prevlockobject___=VAR(___this___); - pthread_setspecific(threadlocks, VAR(___this___)); - VAR(___this___)->lockcount=1; - VAR(___this___)->tid=self; - pthread_mutex_unlock(&objlock); - break; - } - { -#ifdef PRECISE_GC - struct listitem *tmp=stopforgc((struct garbagelist *)___params___); -#endif - pthread_cond_wait(&objcond, &objlock); -#ifdef PRECISE_GC - restartaftergc(tmp); -#endif - } - } - } -} - -int CALL01(___Object______MonitorExit____, struct ___Object___ * ___this___) { - pthread_t self=pthread_self(); - if (self==VAR(___this___)->tid) { - VAR(___this___)->lockcount--; - if (VAR(___this___)->lockcount==0) { - if (VAR(___this___)->___prevlockobject___==NULL) { - pthread_setspecific(threadlocks, VAR(___this___)->___nextlockobject___); - } else - VAR(___this___)->___prevlockobject___->___nextlockobject___=VAR(___this___)->___nextlockobject___; - if (VAR(___this___)->___nextlockobject___!=NULL) - VAR(___this___)->___nextlockobject___->___prevlockobject___=VAR(___this___)->___prevlockobject___; - VAR(___this___)->lockentry=NULL; - VAR(___this___)->tid=0; - } - pthread_mutex_lock(&objlock); - pthread_cond_broadcast(&objcond); - pthread_mutex_unlock(&objlock); - } else { -#ifdef RAW - raw_test_done(-1); -#else - printf("ERROR...UNLOCKING LOCK WE DON'T HAVE\n"); - exit(-1); -#endif - } -} -#endif diff --git a/Robust/src/Runtime/object.h b/Robust/src/Runtime/object.h deleted file mode 100644 index f0d95d57..00000000 --- a/Robust/src/Runtime/object.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef OBJECT_H -#define OBJECT_H -#include "runtime.h" -#include "structdefs.h" - -int CALL01(___Object______nativehashCode____, struct ___Object___ * ___this___);int CALL01(___Object______getType____, struct ___Object___ * ___this___); -#ifdef THREADS -int CALL01(___Object______MonitorEnter____, struct ___Object___ * ___this___); -int CALL01(___Object______MonitorExit____, struct ___Object___ * ___this___); -#endif -#endif diff --git a/Robust/src/Runtime/option.c b/Robust/src/Runtime/option.c deleted file mode 100644 index acb5079c..00000000 --- a/Robust/src/Runtime/option.c +++ /dev/null @@ -1,80 +0,0 @@ -#include "option.h" -#include -#include -#include -#include "runtime.h" -#include - -extern char *options; -extern int injectfailures; -extern float failurechance; -extern int debugtask; -extern int injectinstructionfailures; -extern int failurecount; -extern float instfailurechance; -extern int numfailures; -extern int instaccum; -extern char ** environ; - -void processOptions() { - int i; - options=NULL; - for(i=0;environ[i]!=0;i++) { - if (strncmp(environ[i],"BRISTLECONE=",12)==0) { - options=environ[i]+12; - break; - } - } - - while(options!=NULL) { - if (strncmp(options,"-injectfailures",sizeof("-injectfailures")-1)==0) { - options=strchr(options,' '); - if (options!=NULL) options++; - if (options==NULL) - break; - sscanf(options, "%f", &failurechance); - injectfailures=1; - printf("Injecting errors with chance=%f\n",failurechance); - options=strchr(options,' '); - if (options!=NULL) options++; - } else if (strncmp(options,"-injectinstructionfailures",sizeof("-injectinstructionfailures")-1)==0) { - options=strchr(options,' '); - if (options!=NULL) options++; - if (options==NULL) - break; - sscanf(options, "%d", &failurecount); - options=strchr(options,' '); - if (options!=NULL) options++; - if (options==NULL) - break; - - sscanf(options, "%f", &instfailurechance); - options=strchr(options,' '); - if (options!=NULL) options++; - if (options==NULL) - break; - - sscanf(options, "%d", &numfailures); - options=strchr(options,' '); - if (options!=NULL) options++; - - instaccum=failurecount; - instructioncount=failurecount; - injectinstructionfailures=1; - printf("Number of failures=%d\n",numfailures); - printf("Injecting errors with count=%d\n",failurecount); - printf("Injecting errors with chance=%f\n",instfailurechance); - } else if (strncmp(options, "-debugtask",sizeof("-debugtask")-1)==0) { - options=strchr(options,' '); - if (options!=NULL) options++; - debugtask=1; - printf("Debug task option on.\n"); - } else if (strncmp(options, "-initializerandom", sizeof("-initializerandom")-1)==0) { - options=strchr(options,' '); - if (options!=NULL) options++; - printf("Initializing random number generator.\n"); - srandom(time(NULL)); - } else - break; - } -} diff --git a/Robust/src/Runtime/option.h b/Robust/src/Runtime/option.h deleted file mode 100644 index f9cd7ac7..00000000 --- a/Robust/src/Runtime/option.h +++ /dev/null @@ -1,4 +0,0 @@ -#ifdef OPTION_H -#define OPTION_H -void processOptions(); -#endif diff --git a/Robust/src/Runtime/raw_dataCache.s b/Robust/src/Runtime/raw_dataCache.s deleted file mode 100644 index 566bf221..00000000 --- a/Robust/src/Runtime/raw_dataCache.s +++ /dev/null @@ -1,40 +0,0 @@ -.text -.global flushAddr -.global invalidateAddr -.global flushCacheline -.global invalidateCacheline - -flushAddr: -# arguments come in on $4 and $5 -# $4 has the address -# $5 has the length, eventually - - afl $4, 0 - jr $31 - - -invalidateAddr: -# arguments come in on $4 and $5 -# $4 has the address -# $5 has the length, eventually - - ainv $4, 0 - jr $31 - - -flushCacheline: -# arguments come in on $4 -# $4 has the base tag address - - tagfl $4 - jr $31 - -invalidateCacheline: -# arguments come in on $4 -# $4 has the base tag address - - tagsw $0, $4 -# mtsri PASS, 0x1111 -# mtsr PASS, $8 -# ainv $8, 0 - jr $31 diff --git a/Robust/src/Runtime/raw_interrupt.s b/Robust/src/Runtime/raw_interrupt.s deleted file mode 100644 index 0cc4a308..00000000 --- a/Robust/src/Runtime/raw_interrupt.s +++ /dev/null @@ -1,121 +0,0 @@ -#include - -.text - .align 2 - .globl setup_ints - .ent setup_ints -setup_ints: - # set up dynamic network - uintoff - intoff - - # set gdn_cfg - xor $8,$8,$8 - aui $8,$8,(3<<11)|(0 <<6)|(0 <<1) - ori $8, (0 <<12)|(2<<9) - mtsr GDN_CFG,$8 -# mtsr PASS,$8 - - # set exception vector - la $3, interrupt_table -# mtsri PASS, 0xaaa -# mtsr PASS, $3 - mtsr EX_BASE_ADDR, $3 - - # set EX_MASK - mfsr $8,EX_MASK - ori $8,$8,0x20 # 1 << kVEC_GDN_AVAIL - mtsr EX_MASK,$8 - - inton - uinton - jr $31 - .end setup_ints - -.macro empty_vec fail_code - mtsri FAIL, \fail_code -1: b 1b - nop - nop -.endm - -interrupt_table: - -vec_gdn_refill: - empty_vec 0x2300 -vec_gdn_complete: - empty_vec 0x2301 -vec_trace: - empty_vec 0x2302 -vec_extern: - empty_vec 0x2303 -vec_timer: - empty_vec 0x2304 -vec_gdn_avail: -# mtsri PASS, 0xef00 - uintoff - - addiu $sp,$sp,-104 - sw $31,0x64($sp) - sw $30,0x60($sp) - sw $23,0x5c($sp) - sw $22,0x58($sp) - sw $21,0x54($sp) - sw $20,0x50($sp) - sw $19,0x4c($sp) - sw $18,0x48($sp) - sw $17,0x44($sp) - sw $16,0x40($sp) - sw $15,0x3c($sp) - sw $14,0x38($sp) - sw $13,0x34($sp) - sw $12,0x30($sp) - sw $11,0x2c($sp) - sw $10,0x28($sp) - sw $9,0x24($sp) - sw $8,0x20($sp) - sw $7,0x1c($sp) - sw $6,0x18($sp) - sw $5,0x14($sp) - sw $4,0x10($sp) - sw $3,0xc($sp) - sw $2,0x8($sp) - .set noat - sw $1,0x4($sp) - .set at - - jal receiveObject - - lw $31,0x64($sp) - lw $30,0x60($sp) - lw $23,0x5c($sp) - lw $22,0x58($sp) - lw $21,0x54($sp) - lw $20,0x50($sp) - lw $19,0x4c($sp) - lw $18,0x48($sp) - lw $17,0x44($sp) - lw $16,0x40($sp) - lw $15,0x3c($sp) - lw $14,0x38($sp) - lw $13,0x34($sp) - lw $12,0x30($sp) - lw $11,0x2c($sp) - lw $10,0x28($sp) - lw $9,0x24($sp) - lw $8,0x20($sp) - lw $7,0x1c($sp) - lw $6,0x18($sp) - lw $5,0x14($sp) - lw $4,0x10($sp) - lw $3,0xc($sp) - lw $2,0x8($sp) - .set noat - lw $1,0x4($sp) - .set at - addiu $sp,$sp,104 - -# mtsri PASS, 0xefff - dret -vec_event_counters: - empty_vec 0x2306 diff --git a/Robust/src/Runtime/raw_interrupt2.s b/Robust/src/Runtime/raw_interrupt2.s deleted file mode 100644 index 27c6af13..00000000 --- a/Robust/src/Runtime/raw_interrupt2.s +++ /dev/null @@ -1,122 +0,0 @@ -#include - - .text - .align 2 - .globl setup_ints - .ent setup_ints -setup_ints: - # set up dynamic network - uintoff - intoff - - # set gdn_cfg - xor $8,$8,$8 - aui $8,$8,(3<<11)|(1 <<6)|(0 <<1) - ori $8, (0 <<12)|(2<<9) - mtsr GDN_CFG,$8 -# mtsr PASS,$8 - - # set exception vector - la $3, interrupt_table -# mtsri PASS, 0xaaa -# mtsr PASS, $3 - mtsr EX_BASE_ADDR, $3 - - # set EX_MASK - mfsr $8,EX_MASK - ori $8,$8,0x20 # 1 << kVEC_GDN_AVAIL - mtsr EX_MASK,$8 - - inton - uinton - jr $31 - .end setup_ints - -.macro empty_vec fail_code - mtsri FAIL, \fail_code -1: b 1b - nop - nop -.endm - -interrupt_table: - -vec_gdn_refill: - empty_vec 0x2300 -vec_gdn_complete: - empty_vec 0x2301 -vec_trace: - empty_vec 0x2302 -vec_extern: - empty_vec 0x2303 -vec_timer: - empty_vec 0x2304 -vec_gdn_avail: -# mtsri PASS, 0xef00 - uintoff - - addiu $sp,$sp,-104 - sw $31,0x64($sp) - sw $30,0x60($sp) - sw $23,0x5c($sp) - sw $22,0x58($sp) - sw $21,0x54($sp) - sw $20,0x50($sp) - sw $19,0x4c($sp) - sw $18,0x48($sp) - sw $17,0x44($sp) - sw $16,0x40($sp) - sw $15,0x3c($sp) - sw $14,0x38($sp) - sw $13,0x34($sp) - sw $12,0x30($sp) - sw $11,0x2c($sp) - sw $10,0x28($sp) - sw $9,0x24($sp) - sw $8,0x20($sp) - sw $7,0x1c($sp) - sw $6,0x18($sp) - sw $5,0x14($sp) - sw $4,0x10($sp) - sw $3,0xc($sp) - sw $2,0x8($sp) - .set noat - sw $1,0x4($sp) - .set at - - jal receiveObject - - lw $31,0x64($sp) - lw $30,0x60($sp) - lw $23,0x5c($sp) - lw $22,0x58($sp) - lw $21,0x54($sp) - lw $20,0x50($sp) - lw $19,0x4c($sp) - lw $18,0x48($sp) - lw $17,0x44($sp) - lw $16,0x40($sp) - lw $15,0x3c($sp) - lw $14,0x38($sp) - lw $13,0x34($sp) - lw $12,0x30($sp) - lw $11,0x2c($sp) - lw $10,0x28($sp) - lw $9,0x24($sp) - lw $8,0x20($sp) - lw $7,0x1c($sp) - lw $6,0x18($sp) - lw $5,0x14($sp) - lw $4,0x10($sp) - lw $3,0xc($sp) - lw $2,0x8($sp) - .set noat - lw $1,0x4($sp) - .set at - addiu $sp,$sp,104 - -# mtsri PASS, 0xefff - dret -vec_event_counters: - empty_vec 0x2306 - diff --git a/Robust/src/Runtime/raw_interrupt4.s b/Robust/src/Runtime/raw_interrupt4.s deleted file mode 100644 index e579fab1..00000000 --- a/Robust/src/Runtime/raw_interrupt4.s +++ /dev/null @@ -1,122 +0,0 @@ -#include - - .text - .align 2 - .globl setup_ints - .ent setup_ints -setup_ints: - # set up dynamic network - uintoff - intoff - - # set gdn_cfg - xor $8,$8,$8 - aui $8,$8,(3<<11)|(3 <<6)|(0 <<1) - ori $8, (0 <<12)|(2<<9) - mtsr GDN_CFG,$8 -# mtsr PASS,$8 - - # set exception vector - la $3, interrupt_table -# mtsri PASS, 0xaaa -# mtsr PASS, $3 - mtsr EX_BASE_ADDR, $3 - - # set EX_MASK - mfsr $8,EX_MASK - ori $8,$8,0x20 # 1 << kVEC_GDN_AVAIL - mtsr EX_MASK,$8 - - inton - uinton - jr $31 - .end setup_ints - -.macro empty_vec fail_code - mtsri FAIL, \fail_code -1: b 1b - nop - nop -.endm - -interrupt_table: - -vec_gdn_refill: - empty_vec 0x2300 -vec_gdn_complete: - empty_vec 0x2301 -vec_trace: - empty_vec 0x2302 -vec_extern: - empty_vec 0x2303 -vec_timer: - empty_vec 0x2304 -vec_gdn_avail: -# mtsri PASS, 0xef00 - uintoff - - addiu $sp,$sp,-104 - sw $31,0x64($sp) - sw $30,0x60($sp) - sw $23,0x5c($sp) - sw $22,0x58($sp) - sw $21,0x54($sp) - sw $20,0x50($sp) - sw $19,0x4c($sp) - sw $18,0x48($sp) - sw $17,0x44($sp) - sw $16,0x40($sp) - sw $15,0x3c($sp) - sw $14,0x38($sp) - sw $13,0x34($sp) - sw $12,0x30($sp) - sw $11,0x2c($sp) - sw $10,0x28($sp) - sw $9,0x24($sp) - sw $8,0x20($sp) - sw $7,0x1c($sp) - sw $6,0x18($sp) - sw $5,0x14($sp) - sw $4,0x10($sp) - sw $3,0xc($sp) - sw $2,0x8($sp) - .set noat - sw $1,0x4($sp) - .set at - - jal receiveObject - - lw $31,0x64($sp) - lw $30,0x60($sp) - lw $23,0x5c($sp) - lw $22,0x58($sp) - lw $21,0x54($sp) - lw $20,0x50($sp) - lw $19,0x4c($sp) - lw $18,0x48($sp) - lw $17,0x44($sp) - lw $16,0x40($sp) - lw $15,0x3c($sp) - lw $14,0x38($sp) - lw $13,0x34($sp) - lw $12,0x30($sp) - lw $11,0x2c($sp) - lw $10,0x28($sp) - lw $9,0x24($sp) - lw $8,0x20($sp) - lw $7,0x1c($sp) - lw $6,0x18($sp) - lw $5,0x14($sp) - lw $4,0x10($sp) - lw $3,0xc($sp) - lw $2,0x8($sp) - .set noat - lw $1,0x4($sp) - .set at - addiu $sp,$sp,104 - -# mtsri PASS, 0xefff - dret -vec_event_counters: - empty_vec 0x2306 - diff --git a/Robust/src/Runtime/runtime.c b/Robust/src/Runtime/runtime.c deleted file mode 100644 index 0f84c36a..00000000 --- a/Robust/src/Runtime/runtime.c +++ /dev/null @@ -1,252 +0,0 @@ -#include "runtime.h" -#include "structdefs.h" -#include -#include "mem.h" -#include -#include -#include -#include "option.h" -#ifdef DSTM -#include "dstm.h" -#include "prelookup.h" -#endif - -extern int classsize[]; -jmp_buf error_handler; -int instructioncount; - -char *options; -int injectfailures=0; -float failurechance=0; -int debugtask=0; -int injectinstructionfailures; -int failurecount; -float instfailurechance=0; -int numfailures; -int instaccum=0; -#ifdef DMALLOC -#include "dmalloc.h" -#endif - -void exithandler(int sig, siginfo_t *info, void * uap) { - exit(0); -} - -void initializeexithandler() { - struct sigaction sig; - sig.sa_sigaction=&exithandler; - sig.sa_flags=SA_SIGINFO; - sigemptyset(&sig.sa_mask); - sigaction(SIGUSR2, &sig, 0); -} - - -/* This function inject failures */ - -void injectinstructionfailure() { -#ifdef TASK - if (injectinstructionfailures) { - if (numfailures==0) - return; - instructioncount=failurecount; - instaccum+=failurecount; - if ((((double)random())/RAND_MAX)0) - numfailures--; - printf("FAILURE!!! %d\n",numfailures); - longjmp(error_handler,11); - } - } -#else -#ifdef THREADS - if (injectinstructionfailures) { - if (numfailures==0) - return; - instaccum+=failurecount; - if ((((double)random())/RAND_MAX)0) - numfailures--; - printf("FAILURE!!! %d\n",numfailures); - threadexit(); - } - } -#endif -#endif -} - -void CALL11(___System______exit____I,int ___status___, int ___status___) { - exit(___status___); -} - -void CALL11(___System______printI____I,int ___status___, int ___status___) { - printf("%d\n",___status___); -} - -long CALL00(___System______currentTimeMillis____) { - struct timeval tv; long long retval; - gettimeofday(&tv, NULL); - retval = tv.tv_sec; /* seconds */ - retval*=1000; /* milliseconds */ - retval+= (tv.tv_usec/1000); /* adjust milliseconds & add them in */ - return retval; -} - -void CALL01(___System______printString____L___String___,struct ___String___ * ___s___) { - struct ArrayObject * chararray=VAR(___s___)->___value___; - int i; - int offset=VAR(___s___)->___offset___; - for(i=0;i___count___;i++) { - short sc=((short *)(((char *)& chararray->___length___)+sizeof(int)))[i+offset]; - putchar(sc); - } -} - -#ifdef DSTM -void CALL00(___System______clearPrefetchCache____) { - prehashClear(); -} -#endif - -/* Object allocation function */ - -#ifdef DSTM -void * allocate_newglobal(transrecord_t *trans, int type) { - struct ___Object___ * v=(struct ___Object___ *) transCreateObj(trans, classsize[type]); - v->type=type; -#ifdef THREADS - v->tid=0; - v->lockentry=0; - v->lockcount=0; -#endif - return v; -} - -/* Array allocation function */ - -struct ArrayObject * allocate_newarrayglobal(transrecord_t *trans, int type, int length) { - struct ArrayObject * v=(struct ArrayObject *)transCreateObj(trans, sizeof(struct ArrayObject)+length*classsize[type]); - if (length<0) { - printf("ERROR: negative array\n"); - return NULL; - } - v->type=type; - v->___length___=length; -#ifdef THREADS - v->tid=0; - v->lockentry=0; - v->lockcount=0; -#endif - return v; -} -#endif - - -#ifdef PRECISE_GC -void * allocate_new(void * ptr, int type) { - struct ___Object___ * v=(struct ___Object___ *) mygcmalloc((struct garbagelist *) ptr, classsize[type]); - v->type=type; -#ifdef THREADS - v->tid=0; - v->lockentry=0; - v->lockcount=0; -#endif -#ifdef OPTIONAL - v->fses=0; -#endif - return v; -} - -/* Array allocation function */ - -struct ArrayObject * allocate_newarray(void * ptr, int type, int length) { - struct ArrayObject * v=mygcmalloc((struct garbagelist *) ptr, sizeof(struct ArrayObject)+length*classsize[type]); - v->type=type; - if (length<0) { - printf("ERROR: negative array\n"); - return NULL; - } - v->___length___=length; -#ifdef THREADS - v->tid=0; - v->lockentry=0; - v->lockcount=0; -#endif -#ifdef OPTIONAL - v->fses=0; -#endif - return v; -} - -#else -void * allocate_new(int type) { - struct ___Object___ * v=FREEMALLOC(classsize[type]); - v->type=type; -#ifdef OPTIONAL - v->fses=0; -#endif - return v; -} - -/* Array allocation function */ - -struct ArrayObject * allocate_newarray(int type, int length) { - struct ArrayObject * v=FREEMALLOC(sizeof(struct ArrayObject)+length*classsize[type]); - v->type=type; - v->___length___=length; -#ifdef OPTIONAL - v->fses=0; -#endif - return v; -} -#endif - - -/* Converts C character arrays into Java strings */ -#ifdef PRECISE_GC -struct ___String___ * NewString(void * ptr, const char *str,int length) { -#else -struct ___String___ * NewString(const char *str,int length) { -#endif - int i; -#ifdef PRECISE_GC - struct ArrayObject * chararray=allocate_newarray((struct garbagelist *)ptr, CHARARRAYTYPE, length); - int ptrarray[]={1, (int) ptr, (int) chararray}; - struct ___String___ * strobj=allocate_new((struct garbagelist *) &ptrarray, STRINGTYPE); - chararray=(struct ArrayObject *) ptrarray[2]; -#else - struct ArrayObject * chararray=allocate_newarray(CHARARRAYTYPE, length); - struct ___String___ * strobj=allocate_new(STRINGTYPE); -#endif - strobj->___value___=chararray; - strobj->___count___=length; - strobj->___offset___=0; - - for(i=0;i___length___)+sizeof(int)))[i]=(short)str[i]; } - return strobj; -} - -/* Generated code calls this if we fail a bounds check */ - -void failedboundschk() { -#ifndef TASK - printf("Array out of bounds\n"); -#ifdef THREADS - threadexit(); -#else - exit(-1); -#endif -#else - longjmp(error_handler,2); -#endif -} - -/* Abort task call */ -void abort_task() { -#ifdef TASK - longjmp(error_handler,4); -#else - printf("Aborting\n"); - exit(-1); -#endif -} diff --git a/Robust/src/Runtime/runtime.h b/Robust/src/Runtime/runtime.h deleted file mode 100644 index fdad772e..00000000 --- a/Robust/src/Runtime/runtime.h +++ /dev/null @@ -1,189 +0,0 @@ -#ifndef RUNTIME -#define RUNTIME -#include -extern jmp_buf error_handler; -extern int instructioncount; -extern int failurecount; -#ifdef DSTM -#include "dstm.h" -#endif - -extern void * curr_heapbase; -extern void * curr_heaptop; - -#define TAGARRAYINTERVAL 10 -#define OBJECTARRAYINTERVAL 10 - -#define ARRAYSET(array, type, index, value) \ -((type *)(&(& array->___length___)[1]))[index]=value - -#define ARRAYGET(array, type, index) \ -((type *)(&(& array->___length___)[1]))[index] - -#ifdef OPTIONAL -#define OPTARG(x) , x -#else -#define OPTARG(x) -#endif - -#ifdef DSTM -void * allocate_newglobal(transrecord_t *, int type); -struct ArrayObject * allocate_newarrayglobal(transrecord_t *, int type, int length); -#endif - -#ifdef PRECISE_GC -#include "garbage.h" -void * allocate_new(void *, int type); -struct ArrayObject * allocate_newarray(void *, int type, int length); -struct ___String___ * NewString(void *, const char *str,int length); -struct ___TagDescriptor___ * allocate_tag(void *ptr, int index); -#else -void * allocate_new(int type); -struct ArrayObject * allocate_newarray(int type, int length); -struct ___String___ * NewString(const char *str,int length); -struct ___TagDescriptor___ * allocate_tag(int index); -#endif - - - -void initializeexithandler(); -void failedboundschk(); -void failednullptr(); -void abort_task(); -void injectinstructionfailure(); -void createstartupobject(); - -#ifdef PRECISE_GC -#define VAR(name) ___params___->name -#define CALL00(name) name(struct name ## _params * ___params___) -#define CALL01(name, alt) name(struct name ## _params * ___params___) -#define CALL02(name, alt1, alt2) name(struct name ## _params * ___params___) -#define CALL11(name,rest, alt) name(struct name ## _params * ___params___, rest) -#define CALL12(name,rest, alt1, alt2) name(struct name ## _params * ___params___, rest) -#define CALL22(name, rest, rest2, alt1, alt2) name(struct name ## _params * ___params___, rest, rest2) -#define CALL23(name, rest, rest2, alt1, alt2, alt3) name(struct name ## _params * ___params___, rest, rest2) -#define CALL24(name, rest, rest2, alt1, alt2, alt3, alt4) name(struct name ## _params * ___params___, rest, rest2) -#define CALL34(name, rest, rest2, rest3, alt1, alt2, alt3, alt4) name(struct name ## _params * ___params___, rest, rest2, rest3) -#else -#define VAR(name) name -#define CALL00(name) name() -#define CALL01(name, alt) name(alt) -#define CALL02(name, alt1, alt2) name(alt1, alt2) -#define CALL11(name,rest, alt) name(alt) -#define CALL12(name,rest, alt1, alt2) name(alt1, alt2) -#define CALL22(name, rest, rest2, alt1, alt2) name(alt1, alt2) -#define CALL23(name, rest, rest2, alt1, alt2, alt3) name(alt1, alt2, alt3) -#define CALL24(name, rest, rest2, alt1, alt2, alt3, alt4) name(alt1, alt2, alt3, alt4) -#define CALL34(name, rest, rest2, rest3, alt1, alt2, alt3, alt4) name(alt1, alt2, alt3, alt4) -#endif - -#ifdef TASK -#include "SimpleHash.h" -#ifndef MULTICORE -#include "ObjectHash.h" -#include "structdefs.h" -#endif -#include "task.h" -#ifdef OPTIONAL -#include "optionalstruct.h" -#endif - -#ifdef OPTIONAL -struct failedtasklist { - struct taskdescriptor *task; - int index; - int numflags; - int *flags; - struct failedtasklist *next; -}; -#endif - -#ifdef MULTICORE -struct transObjInfo { - void * objptr; - int targetcore; - int * queues; - int length; -}; -#endif - -#ifdef RAW -//struct RuntimeHash * ptbl = NULL; -#endif - -#ifdef MULTICORE -void flagorand(void * ptr, int ormask, int andmask, struct parameterwrapper ** queues, int length); -void flagorandinit(void * ptr, int ormask, int andmask); -void enqueueObject(void * ptr, struct parameterwrapper ** queues, int length); -#ifdef RAW -void enqueueObject_I(void * ptr, struct parameterwrapper ** queues, int length); -#endif -#else -void flagorand(void * ptr, int ormask, int andmask); -void flagorandinit(void * ptr, int ormask, int andmask); -void enqueueObject(void * ptr); -#endif -void executetasks(); -void processtasks(); - -#ifdef MULTICORE -void transferObject(struct transObjInfo * transObj); -#endif - -#ifndef MULTICORE -struct tagobjectiterator { - int istag; /* 0 if object iterator, 1 if tag iterator */ - struct ObjectIterator it; /* Object iterator */ - struct ObjectHash * objectset; -#ifdef OPTIONAL - int failedstate; -#endif - int slot; - int tagobjindex; /* Index for tag or object depending on use */ - /*if tag we have an object binding */ - int tagid; - int tagobjectslot; - /*if object, we may have one or more tag bindings */ - int numtags; - int tagbindings[MAXTASKPARAMS-1]; /* list slots */ -}; - -struct parameterwrapper { - struct parameterwrapper *next; - struct ObjectHash * objectset; - int numberofterms; - int * intarray; - int numbertags; - int * tagarray; - struct taskdescriptor * task; - int slot; - struct tagobjectiterator iterators[MAXTASKPARAMS-1]; -}; -#endif - -struct taskparamdescriptor { - struct taskdescriptor * task; - int numParameters; - void ** parameterArray; -#ifdef OPTIONAL - int * failed; -#endif -}; - -int hashCodetpd(struct taskparamdescriptor *); -int comparetpd(struct taskparamdescriptor *, struct taskparamdescriptor *); - -void toiReset(struct tagobjectiterator * it); -int toiHasNext(struct tagobjectiterator *it, void ** objectarray OPTARG(int * failed)); -void toiNext(struct tagobjectiterator *it , void ** objectarray OPTARG(int * failed)); -void processobject(struct parameterwrapper *parameter, int index, struct parameterdescriptor *pd, int *iteratorcount, int * statusarray, int numparams); -void processtags(struct parameterdescriptor *pd, int index, struct parameterwrapper *parameter, int * iteratorcount, int *statusarray, int numparams); -void builditerators(struct taskdescriptor * task, int index, struct parameterwrapper * parameter); -int enqueuetasks(struct parameterwrapper *parameter, struct parameterwrapper *prevptr, struct ___Object___ *ptr, int * enterflags, int numenterflags); -#ifdef RAW -int enqueuetasks_I(struct parameterwrapper *parameter, struct parameterwrapper *prevptr, struct ___Object___ *ptr, int * enterflags, int numenterflags); -#endif - -#endif - -#endif diff --git a/Robust/src/Runtime/signal.c b/Robust/src/Runtime/signal.c deleted file mode 100644 index 99684765..00000000 --- a/Robust/src/Runtime/signal.c +++ /dev/null @@ -1,27 +0,0 @@ -#include "runtime.h" -#include -#include -#include - -extern int numTransAbort; -extern int numTransCommit; - - -void transStatsHandler(int sig, siginfo_t* info, void *context) { -#ifdef TRANSSTATS - printf("numTransCommit = %d\n", numTransCommit); - printf("numTransAbort = %d\n", numTransAbort); - exit(0); -#endif -} - -void CALL00(___Signal______nativeSigAction____) { -#ifdef TRANSSTATS - struct sigaction siga; - siga.sa_handler = NULL; - siga.sa_flags = SA_SIGINFO; - siga.sa_sigaction = &transStatsHandler; - sigemptyset(&siga.sa_mask); - sigaction(SIGUSR1, &siga, 0); -#endif -} diff --git a/Robust/src/Runtime/socket.c b/Robust/src/Runtime/socket.c deleted file mode 100644 index bb84411d..00000000 --- a/Robust/src/Runtime/socket.c +++ /dev/null @@ -1,430 +0,0 @@ -#include "runtime.h" -#include "structdefs.h" -#include -#ifndef RAW -#include -#include -#include -#include -#endif -#include -#include "SimpleHash.h" -#include "GenericHashtable.h" - -struct RuntimeHash *fdtoobject; - -int CALL24(___Socket______nativeConnect____I__AR_B_I, int ___fd___, int ___port___, struct ___Socket___ * ___this___, int ___fd___, struct ArrayObject * ___address___ ,int ___port___) { -#ifdef RAW - // not supported in RAW version - return -1; -#else - struct sockaddr_in sin; - int rc; - - bzero(&sin, sizeof(sin)); - sin.sin_family= AF_INET; - sin.sin_port=htons(___port___); - sin.sin_addr.s_addr=htonl(*(int *)(((char *)&VAR(___address___)->___length___)+sizeof(int))); -#if defined(THREADS)||defined(DSTM) -#ifdef PRECISE_GC - struct listitem *tmp=stopforgc((struct garbagelist *)___params___); -#endif -#endif - do { - rc = connect(___fd___, (struct sockaddr *) &sin, sizeof(sin)); - } while (rc<0 && errno==EINTR); /* repeat if interrupted */ -#if defined(THREADS)||defined(DSTM) -#ifdef PRECISE_GC - restartaftergc(tmp); -#endif -#endif - - - if (rc<0) goto error; - -#ifdef TASK - //Make non-blocking - fcntl(___fd___, F_SETFD, 1); - fcntl(___fd___, F_SETFL, fcntl(___fd___, F_GETFL)|O_NONBLOCK); - RuntimeHashadd(fdtoobject, ___fd___, (int) VAR(___this___)); - addreadfd(___fd___); -#endif - - return 0; - - error: - close(___fd___); - return -1; -#endif -} - -#ifdef TASK -int CALL12(___Socket______nativeBindFD____I, int ___fd___, struct ___Socket___ * ___this___, int ___fd___) { - if (RuntimeHashcontainskey(fdtoobject, ___fd___)) - RuntimeHashremovekey(fdtoobject, ___fd___); - RuntimeHashadd(fdtoobject, ___fd___, (int) VAR(___this___)); - addreadfd(___fd___); -} -#endif - - -int CALL12(___Socket______nativeBind_____AR_B_I, int ___port___, struct ArrayObject * ___address___, int ___port___) { -#ifdef RAW - // not supported in RAW version - return -1; -#else - int fd; - int rc; - socklen_t sa_size; - struct sockaddr_in sin; - bzero(&sin, sizeof(sin)); - sin.sin_family= AF_INET; - sin.sin_port=0; - sin.sin_addr.s_addr=INADDR_ANY; - - fd=socket(AF_INET, SOCK_STREAM, 0); - if (fd<0) { -#ifdef DEBUG - perror(NULL); - printf("createSocket error in nativeBind\n"); -#endif -#ifdef TASK - longjmp(error_handler,12); -#else -#ifdef THREADS - threadexit(); -#else - exit(-1); -#endif -#endif - } - - rc = bind(fd, (struct sockaddr *) &sin, sizeof(sin)); - if (rc<0) goto error; - - sa_size = sizeof(sin); - rc = getsockname(fd, (struct sockaddr *) &sin, &sa_size); - if (rc<0) goto error; - - return fd; - - error: - close(fd); -#ifdef DEBUG - perror(NULL); - printf("createSocket error #2 in nativeBind\n"); -#endif -#ifdef TASK - longjmp(error_handler,13); -#else -#ifdef THREADS - threadexit(); -#else - exit(-1); -#endif -#endif -#endif -} - -struct ArrayObject * CALL01(___InetAddress______getHostByName_____AR_B, struct ArrayObject * ___hostname___) { -#ifdef RAW - // not supported in RAW version - return NULL; -#else -//struct ArrayObject * CALL01(___InetAddress______getHostByName_____AR_B, struct ___ArrayObject___ * ___hostname___) { - int length=VAR(___hostname___)->___length___; - int i,j,n; - char * str=malloc(length+1); - struct hostent *h; - struct ArrayObject * arraybytearray; - - for(i=0;i___length___)+sizeof(int))[i]; - } - str[length]=0; - h=gethostbyname(str); - free(str); - - for (n=0; h->h_addr_list[n]; n++) /* do nothing */ ; - -#ifdef PRECISE_GC - arraybytearray=allocate_newarray(___params___,BYTEARRAYARRAYTYPE,n); -#else - arraybytearray=allocate_newarray(BYTEARRAYARRAYTYPE,n); -#endif - for(i=0;ih_length); - arraybytearray=(struct ArrayObject *) ptrarray[2]; - } -#else - bytearray=allocate_newarray(BYTEARRAYTYPE,h->h_length); -#endif - ((void **)&((&arraybytearray->___length___)[1]))[i]=bytearray; - { - int ha=ntohl(*(int *)h->h_addr_list[i]); - (&bytearray->___length___)[1]=ha; - } - } - - return arraybytearray; -#endif -} - - -int CALL12(___ServerSocket______createSocket____I, int port, struct ___ServerSocket___ * ___this___, int port) { -#ifdef RAW - // not supported in RAW version - return -1; -#else - int fd; - - int n=1; - struct sockaddr_in sin; - - bzero(&sin, sizeof(sin)); - sin.sin_family = AF_INET; - sin.sin_port = htons (port); - sin.sin_addr.s_addr = htonl (INADDR_ANY); - fd=socket(AF_INET, SOCK_STREAM, 0); - if (fd<0) { -#ifdef DEBUG - perror(NULL); - printf("createSocket error #1\n"); -#endif -#ifdef TASK - longjmp(error_handler,5); -#else -#ifdef THREADS - threadexit(); -#else - exit(-1); -#endif -#endif - } - - if (setsockopt (fd, SOL_SOCKET, SO_REUSEADDR, (char *)&n, sizeof (n)) < 0) { - close(fd); -#ifdef DEBUG - perror(""); - printf("createSocket error #2\n"); -#endif -#ifdef TASK - longjmp(error_handler,6); -#else -#ifdef THREADS - threadexit(); -#else - exit(-1); -#endif -#endif - } - -#ifdef MAC - if (setsockopt(fd, SOL_SOCKET, SO_NOSIGPIPE, &n, sizeof (n)) < 0) { - perror("socket"); - exit(-1); - } -#endif - -#ifdef TASK - fcntl(fd, F_SETFD, 1); - fcntl(fd, F_SETFL, fcntl(fd, F_GETFL)|O_NONBLOCK); -#endif - - /* bind to port */ - if (bind(fd, (struct sockaddr *) &sin, sizeof(sin))<0) { - close(fd); -#ifdef DEBUG - perror(""); - printf("createSocket error #3\n"); -#endif -#ifdef TASK - longjmp(error_handler,7); -#else -#ifdef THREADS - threadexit(); -#else - exit(-1); -#endif -#endif - } - - /* listen */ - if (listen(fd, 5)<0) { - close (fd); -#ifdef DEBUG - perror(""); - printf("createSocket error #4\n"); -#endif -#ifdef TASK - longjmp(error_handler,8); -#else -#ifdef THREADS - threadexit(); -#else - exit(-1); -#endif -#endif - } - - /* Store the fd/socket object mapping */ -#ifdef TASK - RuntimeHashadd(fdtoobject, fd, (int) VAR(___this___)); - addreadfd(fd); -#endif - return fd; -#endif -} - -int CALL02(___ServerSocket______nativeaccept____L___Socket___,struct ___ServerSocket___ * ___this___, struct ___Socket___ * ___s___) { -#ifdef RAW - // not supported in RAW version - return -1; -#else - struct sockaddr_in sin; - unsigned int sinlen=sizeof(sin); - int fd=VAR(___this___)->___fd___; - int newfd; -#if defined(THREADS)||defined(DSTM) -#ifdef PRECISE_GC - struct listitem *tmp=stopforgc((struct garbagelist *)___params___); -#endif -#endif - newfd=accept(fd, (struct sockaddr *)&sin, &sinlen); -#if defined(THREADS)||defined(DSTM) -#ifdef PRECISE_GC - restartaftergc(tmp); -#endif -#endif - if (newfd<0) { -#ifdef DEBUG - perror(NULL); - printf("acceptSocket error #1\n"); -#endif -#ifdef TASK - longjmp(error_handler,9); -#else -#ifdef THREADS - threadexit(); -#else - exit(-1); -#endif -#endif - } -#ifdef TASK - fcntl(newfd, F_SETFL, fcntl(fd, F_GETFL)|O_NONBLOCK); - RuntimeHashadd(fdtoobject, newfd, (int) VAR(___s___)); - addreadfd(newfd); -#ifdef MULTICORE - flagorand(VAR(___this___),0,0xFFFFFFFE,NULL,0); - enqueueObject(VAR(___this___), NULL, 0); - //flagorand(VAR(___this___),0,0xFFFFFFFE,objq4socketobj[corenum],numqueues4socketobj[corenum]); - //enqueueObject(VAR(___this___), objq4socketobj[corenum], numqueues4socketobj[corenum]); -#else - flagorand(VAR(___this___),0,0xFFFFFFFE); - enqueueObject(VAR(___this___)); -#endif -#endif - return newfd; -#endif -} - -void CALL24(___Socket______nativeWrite_____AR_B_I_I, int offset, int length, struct ___Socket___ * ___this___, struct ArrayObject * ___b___, int offset, int length) { - int fd=VAR(___this___)->___fd___; - char * charstr=((char *)& VAR(___b___)->___length___)+sizeof(int)+offset; - while(1) { - int offset=0; - int bytewritten; - while(length>0) { - bytewritten=write(fd, &charstr[offset], length); - if (bytewritten==-1&&errno!=EAGAIN) - break; - length-=bytewritten; - offset+=bytewritten; - } - - if (length!=0) { -#ifndef RAW - perror("ERROR IN NATIVEWRITE"); - printf("error=%d remaining bytes %d\n",errno, length); -#endif - } - break; - } -} - -int CALL02(___Socket______nativeRead_____AR_B, struct ___Socket___ * ___this___, struct ArrayObject * ___b___) { - int fd=VAR(___this___)->___fd___; - int length=VAR(___b___)->___length___; - - char * charstr=malloc(length); - -#if defined(THREADS)||defined(DSTM) -#ifdef PRECISE_GC - struct listitem *tmp=stopforgc((struct garbagelist *)___params___); -#endif -#endif - int byteread=-1; - - // printf("Doing read on %d\n",fd); - do { - byteread=read(fd, charstr, length); - } while(byteread==-1&&errno==EINTR); -#if defined(THREADS)||defined(DSTM) -#ifdef PRECISE_GC - restartaftergc(tmp); -#endif -#endif - - { - int i; - for(i=0;i___length___)+sizeof(int))[i]=charstr[i]; - } - free(charstr); - } - - - if (byteread<0) { -#ifndef RAW - printf("ERROR IN NATIVEREAD\n"); - perror(""); -#endif - } -#ifdef TASK -#ifdef MULTICORE - flagorand(VAR(___this___),0,0xFFFFFFFE,NULL,0); - enqueueObject(VAR(___this___), NULL, 0); - //flagorand(VAR(___this___),0,0xFFFFFFFE,objq4socketobj[corenum],numqueues4socketobj[corenum]); - //enqueueObject(VAR(___this___),objq4socketobj[corenum],numqueues4socketobj[corenum]); -#else - flagorand(VAR(___this___),0,0xFFFFFFFE); - enqueueObject(VAR(___this___)); -#endif -#endif - return byteread; -} - -void CALL01(___Socket______nativeClose____, struct ___Socket___ * ___this___) { - int fd=VAR(___this___)->___fd___; - int data; -#ifdef TASK - RuntimeHashget(fdtoobject, fd, &data); - RuntimeHashremove(fdtoobject, fd, data); - removereadfd(fd); -#ifdef MULTICORE - flagorand(VAR(___this___),0,0xFFFFFFFE,NULL,0); - enqueueObject(VAR(___this___), NULL, 0); - //flagorand(VAR(___this___),0,0xFFFFFFFE,objq4socketobj[corenum],numqueues4socketobj[corenum]); - //enqueueObject(VAR(___this___),objq4socketobj[corenum],numqueues4socketobj[corenum]); -#else - flagorand(VAR(___this___),0,0xFFFFFFFE); - enqueueObject(VAR(___this___)); -#endif -#endif - close(fd); -} diff --git a/Robust/src/Runtime/task.c b/Robust/src/Runtime/task.c deleted file mode 100644 index 57bcbf07..00000000 --- a/Robust/src/Runtime/task.c +++ /dev/null @@ -1,1667 +0,0 @@ -#ifdef TASK -#include "runtime.h" -#include "structdefs.h" -#include "mem.h" -#include "checkpoint.h" -#include "Queue.h" -#include "SimpleHash.h" -#include "GenericHashtable.h" -#include -#include -#include -#include -#include - -extern int injectfailures; -extern float failurechance; -extern int debugtask; -extern int instaccum; - -#ifdef CONSCHECK -#include "instrument.h" -#endif - -struct genhashtable * activetasks; -struct parameterwrapper * objectqueues[NUMCLASSES]; -struct genhashtable * failedtasks; -struct taskparamdescriptor * currtpd; -struct RuntimeHash * forward; -struct RuntimeHash * reverse; - -int main(int argc, char **argv) { -#ifdef BOEHM_GC - GC_init(); // Initialize the garbage collector -#endif -#ifdef CONSCHECK - initializemmap(); -#endif - processOptions(); - initializeexithandler(); - /* Create table for failed tasks */ - failedtasks=genallocatehashtable((unsigned int (*)(void *)) &hashCodetpd, - (int (*)(void *,void *)) &comparetpd); - /* Create queue of active tasks */ - activetasks=genallocatehashtable((unsigned int (*)(void *)) &hashCodetpd, - (int (*)(void *,void *)) &comparetpd); - - /* Process task information */ - processtasks(); - - /* Create startup object */ - createstartupobject(argc, argv); - - /* Start executing the tasks */ - executetasks(); -} - -void createstartupobject(int argc, char ** argv) { - int i; - - /* Allocate startup object */ -#ifdef PRECISE_GC - struct ___StartupObject___ *startupobject=(struct ___StartupObject___*) allocate_new(NULL, STARTUPTYPE); - struct ArrayObject * stringarray=allocate_newarray(NULL, STRINGARRAYTYPE, argc-1); -#else - struct ___StartupObject___ *startupobject=(struct ___StartupObject___*) allocate_new(STARTUPTYPE); - struct ArrayObject * stringarray=allocate_newarray(STRINGARRAYTYPE, argc-1); -#endif - /* Build array of strings */ - startupobject->___parameters___=stringarray; - for(i=1;i___length___)+sizeof(int)))[i-1]=newstring; - } - - /* Set initialized flag for startup object */ - flagorand(startupobject,1,0xFFFFFFFF); - enqueueObject(startupobject); -} - -int hashCodetpd(struct taskparamdescriptor *ftd) { - int hash=(int)ftd->task; - int i; - for(i=0;inumParameters;i++){ - hash^=(int)ftd->parameterArray[i]; - } - return hash; -} - -int comparetpd(struct taskparamdescriptor *ftd1, struct taskparamdescriptor *ftd2) { - int i; - if (ftd1->task!=ftd2->task) - return 0; - for(i=0;inumParameters;i++) - if(ftd1->parameterArray[i]!=ftd2->parameterArray[i]) - return 0; -#ifdef OPTIONAL - for(i=0;inumParameters;i++) { - if(ftd1->failed[i]!=ftd2->failed[i]) - return 0; - } -#endif - return 1; -} - -/* This function sets a tag. */ -#ifdef PRECISE_GC -void tagset(void *ptr, struct ___Object___ * obj, struct ___TagDescriptor___ * tagd) { -#else -void tagset(struct ___Object___ * obj, struct ___TagDescriptor___ * tagd) { -#endif - struct ___Object___ * tagptr=obj->___tags___; - if (tagptr==NULL) { - obj->___tags___=(struct ___Object___ *)tagd; - } else { - /* Have to check if it is already set */ - if (tagptr->type==TAGTYPE) { - struct ___TagDescriptor___ * td=(struct ___TagDescriptor___ *) tagptr; - if (td==tagd) - return; -#ifdef PRECISE_GC - int ptrarray[]={2, (int) ptr, (int) obj, (int)tagd}; - struct ArrayObject * ao=allocate_newarray(&ptrarray,TAGARRAYTYPE,TAGARRAYINTERVAL); - obj=(struct ___Object___ *)ptrarray[2]; - tagd=(struct ___TagDescriptor___ *)ptrarray[3]; - td=(struct ___TagDescriptor___ *) obj->___tags___; -#else - struct ArrayObject * ao=allocate_newarray(TAGARRAYTYPE,TAGARRAYINTERVAL); -#endif - ARRAYSET(ao, struct ___TagDescriptor___ *, 0, td); - ARRAYSET(ao, struct ___TagDescriptor___ *, 1, tagd); - obj->___tags___=(struct ___Object___ *) ao; - ao->___cachedCode___=2; - } else { - /* Array Case */ - int i; - struct ArrayObject *ao=(struct ArrayObject *) tagptr; - for(i=0;i___cachedCode___;i++) { - struct ___TagDescriptor___ * td=ARRAYGET(ao, struct ___TagDescriptor___*, i); - if (td==tagd) - return; - } - if (ao->___cachedCode______length___) { - ARRAYSET(ao, struct ___TagDescriptor___ *, ao->___cachedCode___, tagd); - ao->___cachedCode___++; - } else { -#ifdef PRECISE_GC - int ptrarray[]={2,(int) ptr, (int) obj, (int) tagd}; - struct ArrayObject * aonew=allocate_newarray(&ptrarray,TAGARRAYTYPE,TAGARRAYINTERVAL+ao->___length___); - obj=(struct ___Object___ *)ptrarray[2]; - tagd=(struct ___TagDescriptor___ *) ptrarray[3]; - ao=(struct ArrayObject *)obj->___tags___; -#else - struct ArrayObject * aonew=allocate_newarray(TAGARRAYTYPE,TAGARRAYINTERVAL+ao->___length___); -#endif - aonew->___cachedCode___=ao->___length___+1; - for(i=0;i___length___;i++) { - ARRAYSET(aonew, struct ___TagDescriptor___*, i, ARRAYGET(ao, struct ___TagDescriptor___*, i)); - } - ARRAYSET(aonew, struct ___TagDescriptor___ *, ao->___length___, tagd); - } - } - } - - { - struct ___Object___ * tagset=tagd->flagptr; - if(tagset==NULL) { - tagd->flagptr=obj; - } else if (tagset->type!=OBJECTARRAYTYPE) { -#ifdef PRECISE_GC - int ptrarray[]={2, (int) ptr, (int) obj, (int)tagd}; - struct ArrayObject * ao=allocate_newarray(&ptrarray,OBJECTARRAYTYPE,OBJECTARRAYINTERVAL); - obj=(struct ___Object___ *)ptrarray[2]; - tagd=(struct ___TagDescriptor___ *)ptrarray[3]; -#else - struct ArrayObject * ao=allocate_newarray(OBJECTARRAYTYPE,OBJECTARRAYINTERVAL); -#endif - ARRAYSET(ao, struct ___Object___ *, 0, tagd->flagptr); - ARRAYSET(ao, struct ___Object___ *, 1, obj); - ao->___cachedCode___=2; - tagd->flagptr=(struct ___Object___ *)ao; - } else { - struct ArrayObject *ao=(struct ArrayObject *) tagset; - if (ao->___cachedCode______length___) { - ARRAYSET(ao, struct ___Object___*, ao->___cachedCode___++, obj); - } else { - int i; -#ifdef PRECISE_GC - int ptrarray[]={2, (int) ptr, (int) obj, (int)tagd}; - struct ArrayObject * aonew=allocate_newarray(&ptrarray,OBJECTARRAYTYPE,OBJECTARRAYINTERVAL+ao->___length___); - obj=(struct ___Object___ *)ptrarray[2]; - tagd=(struct ___TagDescriptor___ *)ptrarray[3]; - ao=(struct ArrayObject *)tagd->flagptr; -#else - struct ArrayObject * aonew=allocate_newarray(OBJECTARRAYTYPE,OBJECTARRAYINTERVAL); -#endif - aonew->___cachedCode___=ao->___cachedCode___+1; - for(i=0;i___length___;i++) { - ARRAYSET(aonew, struct ___Object___*, i, ARRAYGET(ao, struct ___Object___*, i)); - } - ARRAYSET(aonew, struct ___Object___ *, ao->___cachedCode___, obj); - tagd->flagptr=(struct ___Object___ *) aonew; - } - } - } -} - -/* This function clears a tag. */ -#ifdef PRECISE_GC -void tagclear(void *ptr, struct ___Object___ * obj, struct ___TagDescriptor___ * tagd) { -#else -void tagclear(struct ___Object___ * obj, struct ___TagDescriptor___ * tagd) { -#endif - /* We'll assume that tag is alway there. - Need to statically check for this of course. */ - struct ___Object___ * tagptr=obj->___tags___; - - if (tagptr->type==TAGTYPE) { - if ((struct ___TagDescriptor___ *)tagptr==tagd) - obj->___tags___=NULL; - else - printf("ERROR 1 in tagclear\n"); - } else { - struct ArrayObject *ao=(struct ArrayObject *) tagptr; - int i; - for(i=0;i___cachedCode___;i++) { - struct ___TagDescriptor___ * td=ARRAYGET(ao, struct ___TagDescriptor___ *, i); - if (td==tagd) { - ao->___cachedCode___--; - if (i___cachedCode___) - ARRAYSET(ao, struct ___TagDescriptor___ *, i, ARRAYGET(ao, struct ___TagDescriptor___ *, ao->___cachedCode___)); - ARRAYSET(ao, struct ___TagDescriptor___ *, ao->___cachedCode___, NULL); - if (ao->___cachedCode___==0) - obj->___tags___=NULL; - goto PROCESSCLEAR; - } - } - printf("ERROR 2 in tagclear\n"); - } - PROCESSCLEAR: - { - struct ___Object___ *tagset=tagd->flagptr; - if (tagset->type!=OBJECTARRAYTYPE) { - if (tagset==obj) - tagd->flagptr=NULL; - else - printf("ERROR 3 in tagclear\n"); - } else { - struct ArrayObject *ao=(struct ArrayObject *) tagset; - int i; - for(i=0;i___cachedCode___;i++) { - struct ___Object___ * tobj=ARRAYGET(ao, struct ___Object___ *, i); - if (tobj==obj) { - ao->___cachedCode___--; - if (i___cachedCode___) - ARRAYSET(ao, struct ___Object___ *, i, ARRAYGET(ao, struct ___Object___ *, ao->___cachedCode___)); - ARRAYSET(ao, struct ___Object___ *, ao->___cachedCode___, NULL); - if (ao->___cachedCode___==0) - tagd->flagptr=NULL; - goto ENDCLEAR; - } - } - printf("ERROR 4 in tagclear\n"); - } - } - ENDCLEAR: - return; -} - -/* This function allocates a new tag. */ -#ifdef PRECISE_GC -struct ___TagDescriptor___ * allocate_tag(void *ptr, int index) { - struct ___TagDescriptor___ * v=(struct ___TagDescriptor___ *) mygcmalloc((struct garbagelist *) ptr, classsize[TAGTYPE]); -#else -struct ___TagDescriptor___ * allocate_tag(int index) { - struct ___TagDescriptor___ * v=FREEMALLOC(classsize[TAGTYPE]); -#endif - v->type=TAGTYPE; - v->flag=index; - return v; -} - - - -/* This function updates the flag for object ptr. It or's the flag - with the or mask and and's it with the andmask. */ - -void flagbody(struct ___Object___ *ptr, int flag); -#ifdef OPTIONAL -void enqueueoptional(struct ___Object___ * currobj, int numfailedfses, int * failedfses, struct taskdescriptor * task, int index); -#endif - - int flagcomp(const int *val1, const int *val2) { - return (*val1)-(*val2); - } - -void flagorand(void * ptr, int ormask, int andmask) { -#ifdef OPTIONAL - struct ___Object___ * obj = (struct ___Object___ *)ptr; - if(obj->numfses){/*store the information about fses*/ - int flag, i, j,counter, offset=0; - for(i=0;inumfses;i++) { - int oldoffset; - counter=obj->fses[offset++]; - oldoffset=offset; - for(j=0;jfses[offset]; - obj->fses[offset++]=(flag|ormask)&andmask; - } - qsort(&obj->fses[oldoffset], sizeof(int), counter, (int (*)(const void *, const void *)) &flagcomp); - } - enqueueoptional(obj, 0, NULL, NULL, 0); - } - else -#endif - { - int oldflag=((int *)ptr)[1]; - int flag=ormask|oldflag; - flag&=andmask; - flagbody(ptr, flag); - } -} - -bool intflagorand(void * ptr, int ormask, int andmask) { -#ifdef OPTIONAL - struct ___Object___ * obj = (struct ___Object___ *)ptr; - if(obj->numfses) {/*store the information about fses*/ - int flag, i, j,counter, offset=0; - for(i=0;inumfses;i++) { - int oldoffset; - counter=obj->fses[offset++]; - oldoffset=offset; - for(j=0;jfses[offset]; - obj->fses[offset++]=(flag|ormask)&andmask; - } - qsort(&obj->fses[oldoffset], sizeof(int), counter, (int (*)(const void *, const void *)) &flagcomp); - } - enqueueoptional(obj, 0, NULL, NULL, 0); - } - else -#endif - { - int oldflag=((int *)ptr)[1]; - int flag=ormask|oldflag; - flag&=andmask; - if (flag==oldflag) /* Don't do anything */ - return false; - else { - flagbody(ptr, flag); - return true; - } - } -} - -void flagorandinit(void * ptr, int ormask, int andmask) { - int oldflag=((int *)ptr)[1]; - int flag=ormask|oldflag; - flag&=andmask; - flagbody(ptr,flag); -} - -void flagbody(struct ___Object___ *ptr, int flag) { - struct parameterwrapper *flagptr=(struct parameterwrapper *)ptr->flagptr; - ptr->flag=flag; - - /*Remove object from all queues */ - while(flagptr!=NULL) { - struct parameterwrapper *next; - int UNUSED, UNUSED2; - int * enterflags; - ObjectHashget(flagptr->objectset, (int) ptr, (int *) &next, (int *) &enterflags, &UNUSED, &UNUSED2); - ObjectHashremove(flagptr->objectset, (int)ptr); - if (enterflags!=NULL) - free(enterflags); - flagptr=next; - } - } - - void enqueueObject(void *vptr) { - struct ___Object___ *ptr = (struct ___Object___ *)vptr; - - { - struct QueueItem *tmpptr; - struct parameterwrapper * parameter=objectqueues[ptr->type]; - int i; - struct parameterwrapper * prevptr=NULL; - struct ___Object___ *tagptr=ptr->___tags___; - - /* Outer loop iterates through all parameter queues an object of - this type could be in. */ - - while(parameter!=NULL) { - /* Check tags */ - if (parameter->numbertags>0) { - if (tagptr==NULL) - goto nextloop;//that means the object has no tag but that param needs tag - else if(tagptr->type==TAGTYPE) {//one tag - struct ___TagDescriptor___ * tag=(struct ___TagDescriptor___*) tagptr; - for(i=0;inumbertags;i++) { - //slotid is parameter->tagarray[2*i]; - int tagid=parameter->tagarray[2*i+1]; - if (tagid!=tagptr->flag) - goto nextloop; /*We don't have this tag */ - } - } else {//multiple tags - struct ArrayObject * ao=(struct ArrayObject *) tagptr; - for(i=0;inumbertags;i++) { - //slotid is parameter->tagarray[2*i]; - int tagid=parameter->tagarray[2*i+1]; - int j; - for(j=0;j___cachedCode___;j++) { - if (tagid==ARRAYGET(ao, struct ___TagDescriptor___*, j)->flag) - goto foundtag; - } - goto nextloop; - foundtag: - ; - } - } - } - - /* Check flags */ - for(i=0;inumberofterms;i++) { - int andmask=parameter->intarray[i*2]; - int checkmask=parameter->intarray[i*2+1]; - if ((ptr->flag&andmask)==checkmask) { - enqueuetasks(parameter, prevptr, ptr, NULL, 0); - prevptr=parameter; - break; - } - } - nextloop: - parameter=parameter->next; - } - ptr->flagptr=prevptr; - } -} - -#ifdef OPTIONAL - -int checktags(struct ___Object___ * currobj, struct fsanalysiswrapper * fswrapper) { - /* Check Tags */ - struct ___Object___ * tagptr = currobj->___tags___; - if(fswrapper->numtags>0){ - if (tagptr==NULL) - return 0; //that means the object has no tag but that param - //needs tag - else if(tagptr->type==TAGTYPE) {//one tag - if(fswrapper->numtags!=1) - return 0; //we don't have the right number of tags - struct ___TagDescriptor___ * tag=(struct ___TagDescriptor___*) tagptr; - if (fswrapper->tags[0]!=tagptr->flag) - return 0; - } else { //multiple tags - struct ArrayObject * ao=(struct ArrayObject *) tagptr; - int tag_counter=0; - int foundtag=0; - - if(ao->___length___!=fswrapper->numtags) - return 0;//we don't have the right number of tags - for(tag_counter=0;tag_counternumtags;tag_counter++) { - int tagid=fswrapper->tags[tag_counter]; - int j; - for(j=0;j___cachedCode___;j++) { - if (tagid==ARRAYGET(ao, struct ___TagDescriptor___*, tag_counter)->flag) - return 1; - } - return 0; - } - } - } - return 1; -} - -int getlength(int *flist, int len) { - int count=0; - int i; - for(i=0;inumflags;i++) { - int len=ftl->flags[offset++]; - int offsetmerge=0; - for(j=0;jnumflags;j++) { - int lenmerge=ftlmerge->flags[offsetmerge++]; - length+=1+domerge(&ftl->flags[offset],len,&ftlmerge->flags[offsetmerge],lenmerge, NULL); - offsetmerge+=lenmerge; - } - offset+=len; - } - mergedlist=RUNMALLOC(sizeof(int)*length); - - offset=0; - length=0; - for(i=0;inumflags;i++) { - int len=ftl->flags[offset++]; - int offsetmerge=0; - for(j=0;jnumflags;j++) { - int lenmerge=ftlmerge->flags[offsetmerge++]; - int size=domerge(&ftl->flags[offset],len,&ftlmerge->flags[offsetmerge],lenmerge,&mergedlist[length+1]); - mergedlist[length]=size; - length+=size+1; - } - } - RUNFREE(ftl->flags); - ftl->flags=mergedlist; - ftl->numflags*=ftlmerge->numflags; -} - -void mergefailedlists(struct failedtasklist **andlist, struct failedtasklist *list) { - struct failedtasklist *tmpptr; - while((*andlist)!=NULL) { - struct failedtasklist *searchftl=list; - while(searchftl!=NULL) { - if ((*andlist)->task==searchftl->task&& - (*andlist)->index==searchftl->index) { - mergeitems(*andlist, searchftl); - break; - } - searchftl=searchftl->next; - } - if (searchftl==NULL) { - //didn't find andlist - tmpptr=*andlist; - *andlist=(*andlist)->next;//splice item out of list - RUNFREE(tmpptr->flags); //free the item - RUNFREE(tmpptr); - } else { - andlist=&((*andlist)->next); //iterate to next item - } - } - //free the list we're searching - while(list!=NULL) { - tmpptr=list->next; - RUNFREE(list->flags); - RUNFREE(list); - list=tmpptr; - } -} - -struct failedtasklist * processfailstate(struct classanalysiswrapper * classwrapper, struct taskdescriptor *task, int index, struct ___Object___ * currobj, int flagstate) { - struct failedtasklist *list=NULL; - int i,h; - struct fsanalysiswrapper *fswrapper=NULL; - for(h=0;hnumfsanalysiswrappers;h++) { - struct fsanalysiswrapper * tmp=classwrapper->fsanalysiswrapperarray[h]; - if (tmp->flags==flagstate&&checktags(currobj, tmp)) { - //we only match exactly here - fswrapper=tmp; - break; - } - } - if (fswrapper==NULL) - return list; - for(i=0;inumtaskfailures;i++) { - int j; - struct taskfailure * taskfail=fswrapper->taskfailurearray[i]; - if (taskfail->task==task&&taskfail->index==index) { - int start=0; - while(startnumoptionaltaskdescriptors) { - struct taskdescriptor *currtask=NULL; - struct failedtasklist *tmpftl; - int currindex; - int totallength=0; - int *enterflags; - int numenterflags, offset; - struct parameterwrapper *pw; - for(j=start;jnumoptionaltaskdescriptors;j++) { - struct optionaltaskdescriptor *otd=taskfail->optionaltaskdescriptorarray[j]; - if(currtask==NULL) { - currtask=otd->task; - currindex=otd->index; - } else if (currtask!=otd->task||currindex!=otd->index) - break; - totallength+=otd->numenterflags; - } - pw=currtask->descriptorarray[currindex]->queue; - enterflags=RUNMALLOC(totallength*sizeof(int)); - numenterflags=j-start; - offset=0; - for(start;startoptionaltaskdescriptorarray[start]; - enterflags[offset++]=otd->numenterflags; - memcpy(&enterflags[offset], otd->enterflags, otd->numenterflags*sizeof(int)); - offset+=otd->numenterflags; - } - tmpftl=RUNMALLOC(sizeof(struct failedtasklist)); - tmpftl->next=list; - tmpftl->task=currtask; - tmpftl->numflags=numenterflags; - tmpftl->flags=enterflags; - list=tmpftl; - } - } - } - return list; -} - -struct failedtasklist * processnormfailstate(struct classanalysiswrapper * classwrapper, struct ___Object___ * currobj, int flagstate) { - struct failedtasklist *list=NULL; - int i,h; - int start=0; - struct fsanalysiswrapper *fswrapper=NULL; - for(h=0;hnumfsanalysiswrappers;h++) { - struct fsanalysiswrapper * tmp=classwrapper->fsanalysiswrapperarray[h]; - if (tmp->flags==flagstate&&checktags(currobj, tmp)) { - //we only match exactly here - fswrapper=tmp; - break; - } - } - if(fswrapper==NULL) - return NULL; - - while(startnumoptionaltaskdescriptors) { - struct taskdescriptor *currtask=NULL; - struct failedtasklist *tmpftl; - int j; - int currindex; - int totallength=0; - int *enterflags; - int numenterflags, offset; - struct parameterwrapper *pw; - for(j=start;jnumoptionaltaskdescriptors;j++) { - struct optionaltaskdescriptor *otd=fswrapper->optionaltaskdescriptorarray[j]; - if(currtask==NULL) { - currtask=otd->task; - currindex=otd->index; - } else if (currtask!=otd->task||currindex!=otd->index) - break; - totallength+=otd->numenterflags; - } - pw=currtask->descriptorarray[currindex]->queue; - enterflags=RUNMALLOC(totallength*sizeof(int)); - numenterflags=j-start; - offset=0; - for(start;startoptionaltaskdescriptorarray[start]; - enterflags[offset++]=otd->numenterflags; - memcpy(&enterflags[offset], otd->enterflags, otd->numenterflags*sizeof(int)); - offset+=otd->numenterflags; - } - tmpftl=RUNMALLOC(sizeof(struct failedtasklist)); - tmpftl->next=list; - tmpftl->task=currtask; - tmpftl->numflags=numenterflags; - tmpftl->flags=enterflags; - list=tmpftl; - } - return list; -} - - - -void enqueuelist(struct ___Object___ * currobj, struct failedtasklist * andlist) { - while(andlist!=NULL) { - struct failedtasklist *tmp=andlist; - struct parameterwrapper *pw=andlist->task->descriptorarray[andlist->index]->queue; - struct parmaeterwrapper *next; - int * flags; - int numflags; - int isnonfailed; - - if (enqueuetasks(pw, currobj->flagptr, currobj, tmp->flags, tmp->numflags)) - currobj->flagptr=pw; - - andlist=andlist->next; - RUNFREE(tmp); - } -} - -void enqueueoptional(struct ___Object___ * currobj, int numfailedfses, int * failedfses, struct taskdescriptor * task, int index) { - struct classanalysiswrapper * classwrapper=NULL; - - /*test what optionaltaskdescriptors are available, find the class - corresponding*/ - if (classanalysiswrapperarray[currobj->type]!=NULL) { - classwrapper = classanalysiswrapperarray[currobj->type]; - } else - return; - - if(task!=NULL) { - /* We have a failure */ - if (failedfses==NULL) { - /* Failed in normal state */ - /*first time the method is invoked*/ - int i,h; - struct fsanalysiswrapper *fswrapper=NULL; - - for(h=0;hnumfsanalysiswrappers;h++) { - struct fsanalysiswrapper * tmp=classwrapper->fsanalysiswrapperarray[h]; - if (tmp->flags==currobj->flag&&checktags(currobj, tmp)) { - //we only match exactly here - fswrapper=tmp; - break; - } - } - if(fswrapper==NULL) //nothing to do in this state - return; - for(i=0;inumtaskfailures;i++) { - int j; - struct taskfailure * taskfail=fswrapper->taskfailurearray[i]; - if (taskfail->task==task&&taskfail->index==index) { - int start=0; - while(startnumoptionaltaskdescriptors) { - struct taskdescriptor *currtask=NULL; - int currindex; - int totallength=0; - int *enterflags; - int numenterflags, offset; - struct parameterwrapper *pw; - for(j=start;jnumoptionaltaskdescriptors;j++) { - struct optionaltaskdescriptor *otd=taskfail->optionaltaskdescriptorarray[j]; - if(currtask==NULL) { - currtask=otd->task; - currindex=otd->index; - } else if (currtask!=otd->task||currindex!=otd->index) - break; - totallength+=otd->numenterflags;//1 is to store the lengths - } - pw=currtask->descriptorarray[currindex]->queue; - enterflags=RUNMALLOC((totallength+numenterflags)*sizeof(int)); - numenterflags=j-start; - - offset=0; - for(start;startoptionaltaskdescriptorarray[start]; - enterflags[offset++]=otd->numenterflags; - memcpy(&enterflags[offset], otd->enterflags, otd->numenterflags*sizeof(int)); - offset+=otd->numenterflags; - } - //Enqueue this one - if (enqueuetasks(pw, currobj->flagptr, currobj, enterflags, numenterflags)) - currobj->flagptr=pw; - } - } - } - } else { - /* Failed in failed state */ - int i; - int offset=0; - for(i=0;iflagptr; - - /*Remove object from all queues */ - while(flagptr!=NULL) { - struct parameterwrapper *next; - int UNUSED, UNUSED2; - int * enterflags; - ObjectHashget(flagptr->objectset, (int) currobj, (int *) &next, (int *) &enterflags, &UNUSED, &UNUSED2); - ObjectHashremove(flagptr->objectset, (int)currobj); - if (enterflags!=NULL) - free(enterflags); - flagptr=next; - } - - /* Failed in failed state */ - int i; - int offset=0; - for(i=0;inumfses;i++) { - int numfses=currobj->fses[offset++]; - int j; - struct failedtasklist *andlist=NULL; - for(j=0;jfses[offset++]; - struct failedtasklist *currlist=processnormfailstate(classwrapper, currobj, flagstate); - if (andlist==NULL) - andlist=currlist; - else - mergefailedlists(&andlist, currlist); - } - enqueuelist(currobj, andlist); - } - } -} - - -#endif - -int enqueuetasks(struct parameterwrapper *parameter, struct parameterwrapper *prevptr, struct ___Object___ *ptr, int * enterflags, int numenterflags) { - void * taskpointerarray[MAXTASKPARAMS]; -#ifdef OPTIONAL - int failed[MAXTASKPARAMS]; -#endif - int j; - int numparams=parameter->task->numParameters; - int numiterators=parameter->task->numTotal-1; - int retval=1; - int addnormal=1; - int adderror=1; - - struct taskdescriptor * task=parameter->task; - -#ifdef OPTIONAL - if (ObjectHashcontainskey(parameter->objectset, (int) ptr)) { - /* The object is already here...or it with the existing item */ - int * oldflags; - int oldnumflags; - int oldptr; - int oldstatus; - int *mergedflags; - ObjectHashget(parameter->objectset, (int) ptr, & oldptr, (int *) &oldflags, &oldnumflags, &oldstatus); - mergedflags=domergeor(oldflags, oldnumflags, enterflags, numenterflags); - ObjectHashupdate(parameter->objectset, (int) ptr, oldptr, mergedflags, oldnumflags+numenterflags, oldstatus||(enterflags==NULL)); - - RUNFREE(oldflags); - RUNFREE(enterflags); - - //only add if truly needed - if (oldstatus) - addnormal=0; - if (oldnumflags>0) - adderror=0; - - retval=0; - } else { -#endif - ObjectHashadd(parameter->objectset, (int) ptr, (int) prevptr, (int) enterflags, numenterflags, enterflags==NULL);//this add the object to parameterwrapper -#ifdef OPTIONAL - } -#endif - - /* Add enqueued object to parameter vector */ - taskpointerarray[parameter->slot]=ptr; -#ifdef OPTIONAL - failed[parameter->slot]=(enterflags!=NULL); -#endif - - /* Reset iterators */ - for(j=0;jiterators[j]); - } - - /* Find initial state */ - for(j=0;jiterators[j], taskpointerarray OPTARG(failed))){ - toiNext(¶meter->iterators[j], taskpointerarray OPTARG(failed)); - } - else if (j>0) { - /* Need to backtrack */ - toiReset(¶meter->iterators[j]); - j--; - goto backtrackinit; - } else { - /* Nothing to enqueue */ - return retval; - } - } - - - while(1) { - /* Enqueue current state */ - int launch = 0; - struct taskparamdescriptor *tpd=RUNMALLOC(sizeof(struct taskparamdescriptor)); - tpd->task=task; - tpd->numParameters=numiterators+1; - tpd->parameterArray=RUNMALLOC(sizeof(void *)*(numiterators+1)); -#ifdef OPTIONAL - tpd->failed=RUNMALLOC(sizeof(int)*(numiterators+1)); -#endif - for(j=0;j<=numiterators;j++){ - tpd->parameterArray[j]=taskpointerarray[j];//store the actual parameters -#ifdef OPTIONAL - tpd->failed[j]=failed[j]; - if (failed[j]!=0&&failed[j]!=1) { - printf("BAD\n"); - } -#endif - } - /* Enqueue task */ - if ((!gencontains(failedtasks, tpd)&&!gencontains(activetasks,tpd))) { - genputtable(activetasks, tpd, tpd); - } else { - RUNFREE(tpd->parameterArray); -#ifdef OPTIONAL - RUNFREE(tpd->failed); -#endif - RUNFREE(tpd); - } - - /* This loop iterates to the next parameter combination */ - if (numiterators==0) - return retval; - - for(j=numiterators-1; jiterators[j], taskpointerarray OPTARG(failed))){ - toiNext(¶meter->iterators[j], taskpointerarray OPTARG(failed)); - } - else if (j>0) { - /* Need to backtrack */ - toiReset(¶meter->iterators[j]); - j--; - goto backtrackinc; - } else { - /* Nothing more to enqueue */ - return retval; - } - } - } - return retval; -} - -/* Handler for signals. The signals catch null pointer errors and - arithmatic errors. */ - -void myhandler(int sig, siginfo_t *info, void *uap) { - sigset_t toclear; -#ifdef DEBUG - printf("sig=%d\n",sig); - printf("signal\n"); -#endif - sigemptyset(&toclear); - sigaddset(&toclear, sig); - sigprocmask(SIG_UNBLOCK, &toclear,NULL); - longjmp(error_handler,1); -} - -fd_set readfds; -int maxreadfd; -struct RuntimeHash *fdtoobject; - -void addreadfd(int fd) { - if (fd>=maxreadfd) - maxreadfd=fd+1; - FD_SET(fd, &readfds); -} - -void removereadfd(int fd) { - FD_CLR(fd, &readfds); - if (maxreadfd==(fd+1)) { - maxreadfd--; - while(maxreadfd>0&&!FD_ISSET(maxreadfd-1, &readfds)) - maxreadfd--; - } -} - -#ifdef PRECISE_GC -#define OFFSET 2 -#else -#define OFFSET 0 -#endif - -#ifdef OPTIONAL - int * fsescopy(int *src, int len) { - int *dst; - if (src==NULL) - return NULL; - dst=RUNMALLOC(len*sizeof(int)); - memcpy(dst, src, len*sizeof(int)); - return dst; - } -#endif - -void executetasks() { - void * taskpointerarray[MAXTASKPARAMS+OFFSET]; -#ifdef OPTIONAL - int * fsesarray[MAXTASKPARAMS]; - int * oldfsesarray[MAXTASKPARAMS]; - int numfsesarray[MAXTASKPARAMS]; -#endif - - /* Set up signal handlers */ - struct sigaction sig; - sig.sa_sigaction=&myhandler; - sig.sa_flags=SA_SIGINFO; - sigemptyset(&sig.sa_mask); - - /* Catch bus errors, segmentation faults, and floating point exceptions*/ - sigaction(SIGBUS,&sig,0); - sigaction(SIGSEGV,&sig,0); - sigaction(SIGFPE,&sig,0); - sigaction(SIGPIPE,&sig,0); - - /* Zero fd set */ - FD_ZERO(&readfds); - maxreadfd=0; - fdtoobject=allocateRuntimeHash(100); - - /* Map first block of memory to protected, anonymous page */ - mmap(0, 0x1000, 0, MAP_SHARED|MAP_FIXED|MAP_ANON, -1, 0); - - newtask: - while((hashsize(activetasks)>0)||(maxreadfd>0)) { - - /* Check if any filedescriptors have IO pending */ - if (maxreadfd>0) { - int i; - struct timeval timeout={0,0}; - fd_set tmpreadfds; - int numselect; - tmpreadfds=readfds; - numselect=select(maxreadfd, &tmpreadfds, NULL, NULL, &timeout); - if (numselect>0) { - /* Process ready fd's */ - int fd; - for(fd=0;fd0) { - int i; - currtpd=(struct taskparamdescriptor *) getfirstkey(activetasks); - genfreekey(activetasks, currtpd); - - /* Check if this task has failed, allow a task that contains optional objects to fire */ - if (gencontains(failedtasks, currtpd)) { - // Free up task parameter descriptor - RUNFREE(currtpd->parameterArray); -#ifdef OPTIONAL - RUNFREE(currtpd->failed); -#endif - RUNFREE(currtpd); - goto newtask; - } - int numparams=currtpd->task->numParameters; - int numtotal=currtpd->task->numTotal; - - /* Make sure that the parameters are still in the queues */ - for(i=0;iparameterArray[i]; - struct parameterdescriptor * pd=currtpd->task->descriptorarray[i]; - struct parameterwrapper *pw=(struct parameterwrapper *) pd->queue; - int j; - /* Check that object is still in queue */ -#ifdef OPTIONAL - { - int UNUSED, UNUSED2; - int *flags; - int numflags, isnonfailed; - int failed=currtpd->failed[i]; - if (!ObjectHashget(pw->objectset, (int) parameter, &UNUSED, (int *) &flags, &numflags, &isnonfailed)) { - RUNFREE(currtpd->parameterArray); - RUNFREE(currtpd->failed); - RUNFREE(currtpd); - goto newtask; - } else { - if (failed&&(flags!=NULL)) { - //Failed parameter - fsesarray[i]=flags; - numfsesarray[i]=numflags; - } else if (!failed && isnonfailed) { - //Non-failed parameter - fsesarray[i]=NULL; - numfsesarray[i]=0; - } else { - RUNFREE(currtpd->parameterArray); - RUNFREE(currtpd->failed); - RUNFREE(currtpd); - goto newtask; - } - } - } -#else - { - if (!ObjectHashcontainskey(pw->objectset, (int) parameter)) { - RUNFREE(currtpd->parameterArray); - RUNFREE(currtpd); - goto newtask; - } - } -#endif - parameterpresent: - ; - /* Check that object still has necessary tags */ - for(j=0;jnumbertags;j++) { - int slotid=pd->tagarray[2*j]+numparams; - struct ___TagDescriptor___ *tagd=currtpd->parameterArray[slotid]; - if (!containstag(parameter, tagd)) { - RUNFREE(currtpd->parameterArray); -#ifdef OPTIONAL - RUNFREE(currtpd->failed); -#endif - RUNFREE(currtpd); - goto newtask; - } - } - - taskpointerarray[i+OFFSET]=parameter; - } - /* Copy the tags */ - for(;iparameterArray[i]; - } - - { - /* Checkpoint the state */ - forward=allocateRuntimeHash(100); - reverse=allocateRuntimeHash(100); - void ** checkpoint=makecheckpoint(currtpd->task->numParameters, currtpd->parameterArray, forward, reverse); - int x; - if (x=setjmp(error_handler)) { - int counter; - /* Recover */ -#ifdef DEBUG - printf("Fatal Error=%d, Recovering!\n",x); -#endif - genputtable(failedtasks,currtpd,currtpd); - restorecheckpoint(currtpd->task->numParameters, currtpd->parameterArray, checkpoint, forward, reverse); - -#ifdef OPTIONAL - for(counter=0; countertask->numParameters; counter++){ - //enqueue as failed - enqueueoptional(currtpd->parameterArray[counter], numfsesarray[counter], fsesarray[counter], currtpd->task, counter); - - //free fses copies - if (fsesarray[counter]!=NULL) - RUNFREE(fsesarray[counter]); - } -#endif - freeRuntimeHash(forward); - freeRuntimeHash(reverse); - freemalloc(); - forward=NULL; - reverse=NULL; - } else { - if (injectfailures) { - if ((((double)random())/RAND_MAX)task->name); - longjmp(error_handler,10); - } - } - /* Actually call task */ -#ifdef PRECISE_GC - ((int *)taskpointerarray)[0]=currtpd->numParameters; - taskpointerarray[1]=NULL; -#endif -#ifdef OPTIONAL - //get the task flags set - for(i=0;ifses; - fsesarray[i]=fsescopy(fsesarray[i], numfsesarray[i]); - ((struct ___Object___ *)taskpointerarray[i+OFFSET])->fses=fsesarray[i]; - } -#endif - if(debugtask){ - printf("ENTER %s count=%d\n",currtpd->task->name, (instaccum-instructioncount)); - ((void (*) (void **)) currtpd->task->taskptr)(taskpointerarray); - printf("EXIT %s count=%d\n",currtpd->task->name, (instaccum-instructioncount)); - } else - ((void (*) (void **)) currtpd->task->taskptr)(taskpointerarray); - -#ifdef OPTIONAL - for(i=0;iparameterArray); -#ifdef OPTIONAL - RUNFREE(currtpd->failed); -#endif - RUNFREE(currtpd); - forward=NULL; - reverse=NULL; - } - } - } - } -} - -/* This function processes an objects tags */ -void processtags(struct parameterdescriptor *pd, int index, struct parameterwrapper *parameter, int * iteratorcount, int *statusarray, int numparams) { - int i; - - for(i=0;inumbertags;i++) { - int slotid=pd->tagarray[2*i]; - int tagid=pd->tagarray[2*i+1]; - - if (statusarray[slotid+numparams]==0) { - parameter->iterators[*iteratorcount].istag=1; - parameter->iterators[*iteratorcount].tagid=tagid; - parameter->iterators[*iteratorcount].slot=slotid+numparams; - parameter->iterators[*iteratorcount].tagobjectslot=index; - statusarray[slotid+numparams]=1; - (*iteratorcount)++; - } - } -} - - -void processobject(struct parameterwrapper *parameter, int index, struct parameterdescriptor *pd, int *iteratorcount, int * statusarray, int numparams) { - int i; - int tagcount=0; - struct ObjectHash * objectset=((struct parameterwrapper *)pd->queue)->objectset; - - parameter->iterators[*iteratorcount].istag=0; - parameter->iterators[*iteratorcount].slot=index; - parameter->iterators[*iteratorcount].objectset=objectset; - statusarray[index]=1; - - for(i=0;inumbertags;i++) { - int slotid=pd->tagarray[2*i]; - int tagid=pd->tagarray[2*i+1]; - if (statusarray[slotid+numparams]!=0) { - /* This tag has already been enqueued, use it to narrow search */ - parameter->iterators[*iteratorcount].tagbindings[tagcount]=slotid+numparams; - tagcount++; - } - } - parameter->iterators[*iteratorcount].numtags=tagcount; - - (*iteratorcount)++; -} - -/* This function builds the iterators for a task & parameter */ - -void builditerators(struct taskdescriptor * task, int index, struct parameterwrapper * parameter) { - int statusarray[MAXTASKPARAMS]; - int i; - int numparams=task->numParameters; - int iteratorcount=0; - for(i=0;idescriptorarray[index], index, parameter, & iteratorcount, statusarray, numparams); - - while(1) { - loopstart: - /* Check for objects with existing tags */ - for(i=0;idescriptorarray[i]; - int j; - for(j=0;jnumbertags;j++) { - int slotid=pd->tagarray[2*j]; - if(statusarray[slotid+numparams]!=0) { - processobject(parameter, i, pd, &iteratorcount, statusarray, numparams); - processtags(pd, i, parameter, &iteratorcount, statusarray, numparams); - goto loopstart; - } - } - } - } - - /* Next do objects w/ unbound tags*/ - - for(i=0;idescriptorarray[i]; - if (pd->numbertags>0) { - processobject(parameter, i, pd, &iteratorcount, statusarray, numparams); - processtags(pd, i, parameter, &iteratorcount, statusarray, numparams); - goto loopstart; - } - } - } - - /* Nothing with a tag enqueued */ - - for(i=0;idescriptorarray[i]; - processobject(parameter, i, pd, &iteratorcount, statusarray, numparams); - processtags(pd, i, parameter, &iteratorcount, statusarray, numparams); - goto loopstart; - } - } - - /* Nothing left */ - return; - } -} - - void printdebug() { - int i; - int j; - for(i=0;iname); - for(j=0;jnumParameters;j++) { - struct parameterdescriptor *param=task->descriptorarray[j]; - struct parameterwrapper *parameter=param->queue; - struct ObjectHash * set=parameter->objectset; - struct ObjectIterator objit; - printf(" Parameter %d\n", j); - ObjectHashiterator(set, &objit); - while(ObjhasNext(&objit)) { - struct ___Object___ * obj=(struct ___Object___ *)Objkey(&objit); - struct ___Object___ * tagptr=obj->___tags___; - int nonfailed=Objdata4(&objit); - int numflags=Objdata3(&objit); - int flags=Objdata2(&objit); - Objnext(&objit); - printf(" Contains %lx\n", obj); - printf(" flag=%d\n", obj->flag); -#ifdef OPTIONAL - printf(" flagsstored=%x\n",flags); - printf(" numflags=%d\n", numflags); - printf(" nonfailed=%d\n",nonfailed); -#endif - if (tagptr==NULL) { - } else if (tagptr->type==TAGTYPE) { - printf(" tag=%lx\n",tagptr); - } else { - int tagindex=0; - struct ArrayObject *ao=(struct ArrayObject *)tagptr; - for(;tagindex___cachedCode___;tagindex++) { - printf(" tag=%lx\n",ARRAYGET(ao, struct ___TagDescriptor___*, tagindex)); - } - } - } - } - } - } - - -/* This function processes the task information to create queues for - each parameter type. */ - -void processtasks() { - int i; - for(i=0;inumParameters;j++) { - struct parameterdescriptor *param=task->descriptorarray[j]; - struct parameterwrapper * parameter=RUNMALLOC(sizeof(struct parameterwrapper)); - struct parameterwrapper ** ptr=&objectqueues[param->type]; - - param->queue=parameter; - parameter->objectset=allocateObjectHash(10); - parameter->numberofterms=param->numberterms; - parameter->intarray=param->intarray; - parameter->numbertags=param->numbertags; - parameter->tagarray=param->tagarray; - parameter->task=task; - parameter->slot=j; - /* Link new queue in */ - while((*ptr)!=NULL) - ptr=&((*ptr)->next); - (*ptr)=parameter; - } - - /* Build iterators for parameters */ - for(j=0;jnumParameters;j++) { - struct parameterdescriptor *param=task->descriptorarray[j]; - struct parameterwrapper *parameter=param->queue; - builditerators(task, j, parameter); - } - } -} - -void toiReset(struct tagobjectiterator * it) { - if (it->istag) { - it->tagobjindex=0; - } else if (it->numtags>0) { - it->tagobjindex=0; -#ifdef OPTIONAL - it->failedstate=0; -#endif - } else { - ObjectHashiterator(it->objectset, &it->it); -#ifdef OPTIONAL - it->failedstate=0; -#endif - } -} - -int toiHasNext(struct tagobjectiterator *it, void ** objectarray OPTARG(int * failed)) { - if (it->istag) { - /* Iterate tag */ - /* Get object with tags */ - struct ___Object___ *obj=objectarray[it->tagobjectslot]; - struct ___Object___ *tagptr=obj->___tags___; - if (tagptr->type==TAGTYPE) { - if ((it->tagobjindex==0)&& /* First object */ - (it->tagid==((struct ___TagDescriptor___ *)tagptr)->flag)) /* Right tag type */ - return 1; - else - return 0; - } else { - struct ArrayObject *ao=(struct ArrayObject *) tagptr; - int tagindex=it->tagobjindex; - for(;tagindex___cachedCode___;tagindex++) { - struct ___TagDescriptor___ *td=ARRAYGET(ao, struct ___TagDescriptor___ *, tagindex); - if (td->flag==it->tagid) { - it->tagobjindex=tagindex; /* Found right type of tag */ - return 1; - } - } - return 0; - } - } else if (it->numtags>0) { - /* Use tags to locate appropriate objects */ - struct ___TagDescriptor___ *tag=objectarray[it->tagbindings[0]]; - struct ___Object___ *objptr=tag->flagptr; - int i; - if (objptr->type!=OBJECTARRAYTYPE) { - if (it->tagobjindex>0) - return 0; - if (!ObjectHashcontainskey(it->objectset, (int) objptr)) - return 0; - for(i=1;inumtags;i++) { - struct ___TagDescriptor___ *tag2=objectarray[it->tagbindings[i]]; - if (!containstag(objptr,tag2)) - return 0; - } -#ifdef OPTIONAL - if (it->failedstate==1) { - int UNUSED, UNUSED2; - int * flags; - int isnonfailed; - ObjectHashget(it->objectset, (int) objptr, &UNUSED, (int *) &flags, &UNUSED2, &isnonfailed); - if (flags!=NULL) { - return 1; - } else { - it->tagobjindex++; - it->failedstate=0; - return 0; - } - } else { - int UNUSED, UNUSED2; - int * flags; - int isnonfailed; - ObjectHashget(it->objectset, (int) objptr, &UNUSED, (int *) &flags, &UNUSED2, &isnonfailed); - if (!isnonfailed) { - it->failedstate=1; - } - return 1; - } -#endif - return 1; - } else { - struct ArrayObject *ao=(struct ArrayObject *) objptr; - int tagindex; - int i; -#ifdef OPTIONAL - if (it->failedstate==1) { - int UNUSED, UNUSED2; - int * flags; - int isnonfailed; - struct ___Object___ *objptr=ARRAYGET(ao, struct ___Object___*, it->tagobjindex); - ObjectHashget(it->objectset, (int) objptr, &UNUSED, (int *) &flags, &UNUSED2, &isnonfailed); - if (flags!=NULL) { - return 1; - } else { - it->failedstate=0; - it->tagobjindex++; - } - } -#endif - for(tagindex=it->tagobjindex;tagindex___cachedCode___;tagindex++) { - struct ___Object___ *objptr=ARRAYGET(ao, struct ___Object___*, tagindex); - if (!ObjectHashcontainskey(it->objectset, (int) objptr)) - continue; - for(i=1;inumtags;i++) { - struct ___TagDescriptor___ *tag2=objectarray[it->tagbindings[i]]; - if (!containstag(objptr,tag2)) - goto nexttag; - } -#ifdef OPTIONAL - { - int UNUSED, UNUSED2; - int flags, isnonfailed; - struct ___Object___ *objptr=ARRAYGET(ao, struct ___Object___*, tagindex); - ObjectHashget(it->objectset, (int) objptr, &UNUSED, &flags, &UNUSED2, &isnonfailed); - if (!isnonfailed) { - it->failedstate=1; - } - } -#endif - it->tagobjindex=tagindex; - return 1; - nexttag: - ; - } - it->tagobjindex=tagindex; - return 0; - } - } else { -#ifdef OPTIONAL - if (it->failedstate==1) { - if (Objdata2(&it->it)) - return 1; - else { - it->failedstate=0; - Objnext(&it->it); - } - } - if (ObjhasNext(&it->it)) { - if (!Objdata4(&it->it)) { - //failed state only - it->failedstate=1; - } - return 1; - } else - return 0; -#else - return ObjhasNext(&it->it); -#endif - } -} - -int containstag(struct ___Object___ *ptr, struct ___TagDescriptor___ *tag) { - int j; - struct ___Object___ * objptr=tag->flagptr; - if (objptr->type==OBJECTARRAYTYPE) { - struct ArrayObject *ao=(struct ArrayObject *)objptr; - for(j=0;j___cachedCode___;j++) { - if (ptr==ARRAYGET(ao, struct ___Object___*, j)) - return 1; - } - return 0; - } else - return objptr==ptr; -} - -void toiNext(struct tagobjectiterator *it , void ** objectarray OPTARG(int * failed)) { - /* hasNext has all of the intelligence */ - if(it->istag) { - /* Iterate tag */ - /* Get object with tags */ - struct ___Object___ *obj=objectarray[it->tagobjectslot]; - struct ___Object___ *tagptr=obj->___tags___; -#ifdef OPTIONAL - failed[it->slot]=0; //have to set it to something -#endif - if (tagptr->type==TAGTYPE) { - it->tagobjindex++; - objectarray[it->slot]=tagptr; - } else { - struct ArrayObject *ao=(struct ArrayObject *) tagptr; - objectarray[it->slot]=ARRAYGET(ao, struct ___TagDescriptor___ *, it->tagobjindex++); - } - } else if (it->numtags>0) { - /* Use tags to locate appropriate objects */ - struct ___TagDescriptor___ *tag=objectarray[it->tagbindings[0]]; - struct ___Object___ *objptr=tag->flagptr; - if (objptr->type!=OBJECTARRAYTYPE) { -#ifdef OPTIONAL - failed[it->slot]=it->failedstate; - objectarray[it->slot]=objptr; - if (it->failedstate==0) { - it->failedstate=1; - } else { - it->failedstate=0; - it->tagobjindex++; - } -#else - it->tagobjindex++; - objectarray[it->slot]=objptr; -#endif - } else { - struct ArrayObject *ao=(struct ArrayObject *) objptr; -#ifdef OPTIONAL - failed[it->slot]=it->failedstate; - objectarray[it->slot]=ARRAYGET(ao, struct ___Object___ *, it->tagobjindex); - if (it->failedstate==0) { - it->failedstate=1; - } else { - it->failedstate=0; - it->tagobjindex++; - } -#else - objectarray[it->slot]=ARRAYGET(ao, struct ___Object___ *, it->tagobjindex++); -#endif - } - } else { - /* Iterate object */ - void * tmpp = (void *) Objkey(&it->it); - objectarray[it->slot]=tmpp; -#ifdef OPTIONAL - failed[it->slot]=it->failedstate; - if (it->failedstate==0) { - it->failedstate=1; - } else { - it->failedstate=0; - Objnext(&it->it); - } -#else - Objnext(&it->it); -#endif - } -} -#endif diff --git a/Robust/src/Runtime/thread.c b/Robust/src/Runtime/thread.c deleted file mode 100644 index f7855d71..00000000 --- a/Robust/src/Runtime/thread.c +++ /dev/null @@ -1,302 +0,0 @@ -#include "runtime.h" -#include -#include -#include -#include -#include "thread.h" -#include "option.h" -#include -#include -#include - -#ifndef RAW -#include -#endif -int threadcount; -pthread_mutex_t gclock; -pthread_mutex_t gclistlock; -pthread_cond_t gccond; -pthread_mutex_t objlock; -pthread_cond_t objcond; - -pthread_mutex_t joinlock; -pthread_cond_t joincond; -pthread_key_t threadlocks; -pthread_mutex_t threadnotifylock; -pthread_cond_t threadnotifycond; -pthread_key_t oidval; - -void threadexit() { - objheader_t* ptr; - void *value; - transrecord_t * trans; - unsigned int oidvalue; - -#ifdef THREADS - struct ___Object___ *ll=pthread_getspecific(threadlocks); - while(ll!=NULL) { - struct ___Object___ *llnext=ll->___nextlockobject___; - ll->___nextlockobject___=NULL; - ll->___prevlockobject___=NULL; - ll->lockcount=0; - ll->tid=0; //unlock it - ll=llnext; - } - pthread_mutex_lock(&objlock);//wake everyone up - pthread_cond_broadcast(&objcond); - pthread_mutex_unlock(&objlock); -#endif - pthread_mutex_lock(&gclistlock); - threadcount--; - pthread_cond_signal(&gccond); - pthread_mutex_unlock(&gclistlock); -#ifdef DSTM - /* Add transaction to check if thread finished for join operation */ - value = pthread_getspecific(oidval); - oidvalue = *((unsigned int *)value); - goto transstart; -transstart: - { - transrecord_t * trans = transStart(); - ptr = transRead(trans, oidvalue); - struct ___Thread___ *p = (struct ___Thread___ *) ptr; - p->___threadDone___ = 1; - *((unsigned int *)&((struct ___Object___ *) p)->___localcopy___) |=DIRTY; - if(transCommit(trans) != 0) { - goto transstart; - } - } -#endif - pthread_exit(NULL); -} - -void threadhandler(int sig, siginfo_t *info, void *uap) { -#ifdef DEBUG - printf("sig=%d\n",sig); - printf("signal\n"); -#endif - threadexit(); -} - -void initializethreads() { - struct sigaction sig; - threadcount=1; - pthread_mutex_init(&gclock, NULL); - pthread_mutex_init(&gclistlock, NULL); - pthread_cond_init(&gccond, NULL); - pthread_mutex_init(&objlock,NULL); - pthread_cond_init(&objcond,NULL); - pthread_mutex_init(&joinlock,NULL); - pthread_cond_init(&joincond,NULL); - pthread_key_create(&threadlocks, NULL); - processOptions(); - initializeexithandler(); - - sig.sa_sigaction=&threadhandler; - sig.sa_flags=SA_SIGINFO; - sigemptyset(&sig.sa_mask); - - /* Catch bus errors, segmentation faults, and floating point exceptions*/ - sigaction(SIGBUS,&sig,0); - sigaction(SIGSEGV,&sig,0); - sigaction(SIGFPE,&sig,0); - signal(SIGPIPE, SIG_IGN); -} - -#ifdef THREADS -void initthread(struct ___Thread___ * ___this___) { -#ifdef PRECISE_GC - int p[]={1, (int) NULL, (int) ___this___}; - ___Thread______staticStart____L___Thread___((struct ___Thread______staticStart____L___Thread____params *)p); - ___this___=(struct ___Thread___ *) p[2]; -#else - ___Thread______staticStart____L___Thread___(___this___); -#endif - ___this___->___finished___=1; - pthread_mutex_lock(&joinlock); - pthread_cond_signal(&joincond); - pthread_mutex_unlock(&joinlock); - - pthread_mutex_lock(&gclistlock); - threadcount--; - pthread_cond_signal(&gccond); - pthread_mutex_unlock(&gclistlock); -} -#endif - -void CALL11(___Thread______sleep____J, long long ___millis___, long long ___millis___) { -#ifdef THREADS -#ifdef PRECISE_GC - struct listitem *tmp=stopforgc((struct garbagelist *)___params___); -#endif -#endif - usleep(___millis___); -#ifdef THREADS -#ifdef PRECISE_GC - restartaftergc(tmp); -#endif -#endif -} - -#if defined(DSTM)|| defined(THREADS) -void CALL00(___Thread______yield____) { - pthread_yield(); -} -#endif - -#ifdef DSTM -/* Add thread join capability */ -void CALL01(___Thread______join____, struct ___Thread___ * ___this___) { - unsigned int *oidarray; - unsigned short *versionarray, version; - transrecord_t *trans; - objheader_t *ptr; - /* Add transaction to check if thread finished for join operation */ - goto transstart; -transstart: - trans = transStart(); - ptr = transRead(trans, (unsigned int) VAR(___this___)); - struct ___Thread___ *p = (struct ___Thread___ *) ptr; -#ifdef THREADJOINDEBUG - printf("Start join process for Oid = %x\n", (unsigned int) VAR(___this___)); -#endif - if(p->___threadDone___ == 1) { -#ifdef THREADJOINDEBUG - printf("Thread oid = %x is done\n", (unsigned int) VAR(___this___)); -#endif - transAbort(trans); - return; - } else { - - version = (ptr-1)->version; - if((oidarray = calloc(1, sizeof(unsigned int))) == NULL) { - printf("Calloc error %s, %d\n", __FILE__, __LINE__); - return; - } - - oidarray[0] = (unsigned int) VAR(___this___); - - if((versionarray = calloc(1, sizeof(unsigned short))) == NULL) { - printf("Calloc error %s, %d\n", __FILE__, __LINE__); - free(oidarray); - return; - } - versionarray[0] = version; - /* Request Notification */ -#ifdef PRECISE_GC - struct listitem *tmp=stopforgc((struct garbagelist *)___params___); -#endif - reqNotify(oidarray, versionarray, 1); -#ifdef PRECISE_GC - restartaftergc(tmp); -#endif - free(oidarray); - free(versionarray); - transAbort(trans); - goto transstart; - } - return; -} -#endif - -#ifdef THREADS -void CALL01(___Thread______nativeJoin____, struct ___Thread___ * ___this___) { - pthread_mutex_lock(&joinlock); - while(!VAR(___this___)->___finished___) - pthread_cond_wait(&joincond, &joinlock); - pthread_mutex_unlock(&joinlock); -} - -void CALL01(___Thread______nativeCreate____, struct ___Thread___ * ___this___) { - pthread_t thread; - int retval; - pthread_attr_t nattr; - - pthread_mutex_lock(&gclistlock); - threadcount++; - pthread_mutex_unlock(&gclistlock); - pthread_attr_init(&nattr); - pthread_attr_setdetachstate(&nattr, PTHREAD_CREATE_DETACHED); - - do { - retval=pthread_create(&thread, &nattr, (void * (*)(void *)) &initthread, VAR(___this___)); - if (retval!=0) - usleep(1); - } while(retval!=0); - /* This next statement will likely not work on many machines */ - - pthread_attr_destroy(&nattr); -} -#endif - -#ifdef DSTM -void CALL12(___Thread______start____I, int ___mid___, struct ___Thread___ * ___this___, int ___mid___) { - startRemoteThread((unsigned int)VAR(___this___), ___mid___); -} -#endif - -#ifdef DSTM -void globalDestructor(void *value) { - free(value); - pthread_setspecific(oidval, NULL); -} - -void initDSMthread(int *ptr) { - objheader_t *tmp; - transrecord_t * trans; - void *threadData; - int oid=ptr[0]; - int type=ptr[1]; - free(ptr); -#ifdef PRECISE_GC - int p[]={1, 0 /* NULL */, oid}; - ((void (*)(void *))virtualtable[type*MAXCOUNT+RUNMETHOD])(p); -#else - ((void (*)(void *))virtualtable[type*MAXCOUNT+RUNMETHOD])(oid); -#endif - threadData = calloc(1, sizeof(unsigned int)); - *((unsigned int *) threadData) = oid; - pthread_setspecific(oidval, threadData); - pthread_mutex_lock(&gclistlock); - threadcount--; - pthread_cond_signal(&gccond); - pthread_mutex_unlock(&gclistlock); - /* Add transaction to check if thread finished for join operation */ - goto transstart; -transstart: - { - transrecord_t * trans = transStart(); - tmp = transRead(trans, (unsigned int) oid); - ((struct ___Thread___ *)tmp)->___threadDone___ = 1; - *((unsigned int *)&((struct ___Object___ *) tmp)->___localcopy___) |=DIRTY; - if(transCommit(trans)!= 0) { - goto transstart; - } - } - pthread_exit(NULL); -} - -void startDSMthread(int oid, int objType) { - pthread_t thread; - int retval; - pthread_attr_t nattr; - - pthread_mutex_lock(&gclistlock); - threadcount++; - pthread_mutex_unlock(&gclistlock); - pthread_attr_init(&nattr); - pthread_attr_setdetachstate(&nattr, PTHREAD_CREATE_DETACHED); - int * ptr=malloc(sizeof(int)*2); - ptr[0]=oid; - ptr[1]=objType; - pthread_key_create(&oidval, globalDestructor); - do { - retval=pthread_create(&thread, &nattr, (void * (*)(void *)) &initDSMthread, ptr); - if (retval!=0) - usleep(1); - } while(retval!=0); - - pthread_attr_destroy(&nattr); -} - -#endif diff --git a/Robust/src/Runtime/thread.h b/Robust/src/Runtime/thread.h deleted file mode 100644 index e5388ab5..00000000 --- a/Robust/src/Runtime/thread.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef THREAD_H -#define THREAD_H -#include "methodheaders.h" -#include - -extern int threadcount; -extern pthread_mutex_t gclock; -extern pthread_mutex_t gclistlock; -extern pthread_cond_t gccond; -extern pthread_mutex_t objlock; -extern pthread_cond_t objcond; -extern pthread_key_t threadlocks; -#ifdef THREADS -void initthread(struct ___Thread___ * ___this___); -#endif -#ifdef DSTM -void initDSMthread(int *ptr); -void startDSMthread(int oid, int objType); -extern void * virtualtable[]; -#endif - -struct locklist { - struct locklist * next; - struct locklist * prev; - struct ___Object___ * object; -}; -#endif diff --git a/Robust/src/TODO b/Robust/src/TODO deleted file mode 100644 index e7649ce6..00000000 --- a/Robust/src/TODO +++ /dev/null @@ -1,2 +0,0 @@ -1) Make typecasts really work -2) Logical xor's \ No newline at end of file diff --git a/Robust/src/Tests/Array.java b/Robust/src/Tests/Array.java deleted file mode 100644 index 28b32f3e..00000000 --- a/Robust/src/Tests/Array.java +++ /dev/null @@ -1,12 +0,0 @@ -public class Array { - int a; - public static void main(String[] st) { - int a[]=new int[10]; - int i=2; - a[i]=4; - System.printInt(a[2]); - System.printString("\n"); - System.printInt(a.length); - System.printString("\n"); - } -} diff --git a/Robust/src/Tests/Array2.java b/Robust/src/Tests/Array2.java deleted file mode 100644 index f7b69d47..00000000 --- a/Robust/src/Tests/Array2.java +++ /dev/null @@ -1,19 +0,0 @@ -public class Array2 { - int a; - public static void main(String str[]) { - int a[][]=new int[10][20]; - for(int i=0;i<10;i++) { - for(int j=0;j<20;j++) { - a[i][j]=i*100+j; - } - } - - for(int i=0;i<10;i++) { - for(int j=0;j<20;j++) { - System.printInt(a[i][j]); - System.printString(" "); - } - System.printString("\n"); - } - } -} diff --git a/Robust/src/Tests/Atomic.java b/Robust/src/Tests/Atomic.java deleted file mode 100644 index 62b67227..00000000 --- a/Robust/src/Tests/Atomic.java +++ /dev/null @@ -1,15 +0,0 @@ -public class Atomic { - int a; - public static void main(String[] st) { - Integer z; - atomic { - z=global new Integer(3); - } - int q=test(z); - System.printInt(q); - System.printString("\n"); - } - public static atomic int test(Integer y) { - return y.intValue(); - } -} diff --git a/Robust/src/Tests/Atomic2.java b/Robust/src/Tests/Atomic2.java deleted file mode 100644 index c96ef202..00000000 --- a/Robust/src/Tests/Atomic2.java +++ /dev/null @@ -1,36 +0,0 @@ -public class Atomic2 extends Thread { - public Atomic2() { - } - int count; - public static void main(String[] st) { - //int mid = (128<<24)|(200<<16)|(9<<8)|26; - int mid = (128<<24)|(195<<16)|(175<<8)|70; - Atomic2 t =null; - atomic { - t= global new Atomic2(); - t.count=0; - } - System.printString("Starting\n"); - t.start(mid); - System.printString("Finished\n"); - //this is ugly... - while(true) { - atomic { - t.count++; - } - } - } - - public int run() { - while(true) { - int tmpcount; - atomic { - tmpcount=count; - } - System.printString("Current count="); - System.printInt(tmpcount); - System.printString("\n"); - } - } -} - diff --git a/Robust/src/Tests/Atomic3.java b/Robust/src/Tests/Atomic3.java deleted file mode 100644 index f17fb650..00000000 --- a/Robust/src/Tests/Atomic3.java +++ /dev/null @@ -1,76 +0,0 @@ -public class Atomic3 extends Thread { - public Atomic3() { - } - Tree root; - Integer count; - public static void main(String[] st) { - int mid = (128<<24)|(195<<16)|(175<<8)|70; - int b; - Atomic3 at3 = null; - Integer y,z; - atomic { - at3 = global new Atomic3(); - z = global new Integer(300); - at3.root = global new Tree(); - at3.root.insert(z); - b = at3.root.value.intValue(); - } - System.printString("b is "); - System.printInt(b); - System.printString("\n"); - atomic{ - at3.root.item = 2445; - y = global new Integer(400); - at3.root.value = y; - b = at3.root.value.intValue(); - } - System.printString("b is "); - System.printInt(b); - System.printString("\n"); - System.printString("Starting\n"); - at3.start(mid); - System.printString("Finished\n"); - while(true) { - ; - } - } - - public int run() { - int a; - atomic { - a = root.value.intValue(); - } - System.printString("a is "); - System.printInt(a); - System.printString("\n"); - } -} - -public class Tree { - public Integer value; - public int item; - public Tree left; - public Tree right; - - public Tree() { - } - - public Tree(Integer item) { - value = item; - left = null; - right = null; - } - - public Tree(Integer item , Tree l, Tree r) { - value = item; - left =l; - right = r; - } - - public Tree insert(Integer a) { - value = a; - left = null; - right = null; - return this; - } -} diff --git a/Robust/src/Tests/Atomic4.java b/Robust/src/Tests/Atomic4.java deleted file mode 100644 index 3034dc33..00000000 --- a/Robust/src/Tests/Atomic4.java +++ /dev/null @@ -1,92 +0,0 @@ -public class Atomic4 extends Thread { - public People[] team; - public Atomic4() { - } - public static void main(String[] st) { - int mid = (128<<24)|(195<<16)|(175<<8)|70; - int b = 0,c = 0; - - Integer age; - Atomic4 at4 = null; - - atomic { - at4 = global new Atomic4(); - at4.team = global new People[2]; - at4.team[0] = global new People(); - at4.team[1] = global new People(); - } - atomic { - age = global new Integer(35); - at4.team[0].age = age; - b = at4.team[0].getAge(); - } - atomic { - age = global new Integer(70); - at4.team[1].age = age; - c = at4.team[1].getAge(); - } - System.printInt(b); - System.printString("\n"); - System.printInt(c); - System.printString("\n"); - System.printString("Starting\n"); - at4.start(mid); - System.printString("Finished\n"); - while(true) { - ; - } - } - - public int run() { - int ag; - boolean old = false; - atomic { - ag = team[1].getAge(); - //ag = team[0].getAge(); - if(ag > 65) - old = true; - } - if(old){ - System.printString("Gets Pension"); - System.printString("\n"); - } else { - System.printString("Gets No Pension"); - System.printString("\n"); - } - } -} - -public class People { - String name; - Integer age; - - public People() { - } - - public People(String name, Integer age) { - this.name = name; - this.age = age; - } - - public void setName(String n) { - name = n; - } - - public void setAge(Integer a) { - age = a; - } - - public String getName() { - return name; - } - - public int getAge() { - return age.intValue(); - } - - public boolean isSenior() { - if(this.getAge() > 65) - return true; - return false; - } -} diff --git a/Robust/src/Tests/Atomic5.java b/Robust/src/Tests/Atomic5.java deleted file mode 100644 index 34274447..00000000 --- a/Robust/src/Tests/Atomic5.java +++ /dev/null @@ -1,102 +0,0 @@ -/* This test case tests the thread joining for a threadDSM library */ -public class Atomic5 extends Thread { - public People[] team; - public Atomic5() { - } - public static void main(String[] st) { - int mid = (128<<24)|(195<<16)|(175<<8)|70; - int b = 0,c = 0; - int i; - - Integer age; - Atomic5 tmp; - Atomic5[] at5; - - atomic { - at5 = global new Atomic5[4]; - } - atomic { - for(i = 0; i < 4; i++) { - at5[i] = global new Atomic5(); - at5[i].team = global new People[2]; - at5[i].team[0] = global new People(); - at5[i].team[1] = global new People(); - age = global new Integer(35); - at5[i].team[0].age = age; - at5[i].team[1].age = age; - } - b = at5[1].team[0].getAge(); - } - System.printInt(b); - System.printString("\n"); - atomic { - age = global new Integer(70); - at5[1].team[1].age = age; - c = at5[1].team[1].getAge(); - //at5[20].team[1].age = age; - } - System.printInt(c); - System.printString("\n"); - System.printString("Starting\n"); - for(i = 0 ; i< 4; i++) { - atomic { - tmp = at5[i]; - } - tmp.start(mid); - } - for(i = 0; i< 4; i++) { - atomic { - tmp = at5[i]; - } - tmp.join(); - } - System.printString("Finished\n"); - /* - while(true) { - ; - } - */ - } - - public void run() { - int ag; - boolean old = false; - atomic { - ag = team[1].getAge(); - if(ag > 65) - old = true; - } - if(old){ - System.printString("Gets Pension"); - System.printString("\n"); - } else { - System.printString("Gets No Pension"); - System.printString("\n"); - } - } -} - -public class People { - Integer age; - - public People() { - } - - public People(Integer age) { - this.age = age; - } - - public void setAge(Integer a) { - age = a; - } - - public int getAge() { - return age.intValue(); - } - - public boolean isSenior() { - if(this.getAge() > 65) - return true; - return false; - } -} diff --git a/Robust/src/Tests/BoundsFail.java b/Robust/src/Tests/BoundsFail.java deleted file mode 100644 index 6aff4f2a..00000000 --- a/Robust/src/Tests/BoundsFail.java +++ /dev/null @@ -1,7 +0,0 @@ -public class BoundsFail { - int a; - public static void main(String str[]) { - int a[]=new int[10]; - a[-1]=2; - } -} diff --git a/Robust/src/Tests/BoundsFail2.java b/Robust/src/Tests/BoundsFail2.java deleted file mode 100644 index abe327ca..00000000 --- a/Robust/src/Tests/BoundsFail2.java +++ /dev/null @@ -1,7 +0,0 @@ -public class BoundsFail2 { - int a; - public static void main(String str[]) { - int a[]=new int[10]; - a[10]=2; - } -} diff --git a/Robust/src/Tests/BoundsFail3.java b/Robust/src/Tests/BoundsFail3.java deleted file mode 100644 index c6949e2f..00000000 --- a/Robust/src/Tests/BoundsFail3.java +++ /dev/null @@ -1,7 +0,0 @@ -public class BoundsFail3 { - int a; - public static void main(String str[]) { - int a[]=new int[10]; - int b=a[-1]; - } -} diff --git a/Robust/src/Tests/BoundsFail4.java b/Robust/src/Tests/BoundsFail4.java deleted file mode 100644 index 3eae8e26..00000000 --- a/Robust/src/Tests/BoundsFail4.java +++ /dev/null @@ -1,7 +0,0 @@ -public class BoundsFail4 { - int a; - public static void main(String str[]) { - int a[]=new int[10]; - int b=a[10]; - } -} diff --git a/Robust/src/Tests/CallGraph/makefile b/Robust/src/Tests/CallGraph/makefile deleted file mode 100644 index 6c6a6fdc..00000000 --- a/Robust/src/Tests/CallGraph/makefile +++ /dev/null @@ -1,26 +0,0 @@ -PROGRAM=testCallGraph - -SOURCE_FILES=testCallGraph.java - -BUILDSCRIPT=~/research/Robust/src/buildscript -BSFLAGS= -recover -taskstate -webinterface -ownership - -all: $(PROGRAM).bin - -view: PNGs - eog *.png & - -PNGs: DOTs - d2p *.dot - -DOTs: $(PROGRAM).bin - -$(PROGRAM).bin: $(SOURCE_FILES) - $(BUILDSCRIPT) $(BSFLAGS) -o $(PROGRAM) $(SOURCE_FILES) - -clean: - rm -f $(PROGRAM).bin - rm -fr tmpbuilddirectory - rm -f *~ - rm -f *.dot - rm -f *.png diff --git a/Robust/src/Tests/CallGraph/reduceDotFile b/Robust/src/Tests/CallGraph/reduceDotFile deleted file mode 100755 index 14dfdb97..00000000 --- a/Robust/src/Tests/CallGraph/reduceDotFile +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -echo 'Removing all entries in call graph dot files without' -echo 'the prefix CGTest...' - -for dfile in `ls *.dot` -do - -# we definitely want the first line of -# the dot file, so just send it to the -# temporary file -sed -n '1,1 p' <$dfile >$dfile.temp - -# now take only the directed edge statements -# from the dot file that have the pattern CGtest -sed -n '/CGTest/ p' <$dfile >>$dfile.temp - -# then throw the closing bracket at the end -echo '}' >>$dfile.temp - -# and then clobber the old file -mv $dfile.temp $dfile -done - diff --git a/Robust/src/Tests/CallGraph/testCallGraph.java b/Robust/src/Tests/CallGraph/testCallGraph.java deleted file mode 100644 index fe8c632e..00000000 --- a/Robust/src/Tests/CallGraph/testCallGraph.java +++ /dev/null @@ -1,44 +0,0 @@ -public class CGTestParam { - flag w; - int a, b; - public CGTestParam() { a = 0; b = 0; } - public void CGTestFoo() {} - public void CGTestBar() {} -} - -public class CGTestParamChild1 extends CGTestParam { - flag x; - public CGTestParamChild1() {} - public void CGTestBar() {} -} - -public class CGTestParamChild2 extends CGTestParam { - flag y; - public CGTestParamChild2() {} - public void CGTestFoo() {} - public void CGTestBar() {} -} - -task Startup( StartupObject s{ initialstate } ) { - CGTestParam p = new CGTestParam(){!w}; - taskexit( s{ !initialstate } ); -} - -task CGTestTask1( CGTestParam p{!w} ) { - p.CGTestFoo(); - CGTestParamChild1 p1 = new CGTestParamChild1(){!x}; - CGTestParamChild2 p2 = new CGTestParamChild2(){!y}; - taskexit( p{w} ); -} - -task CGTestTask2( CGTestParamChild1 p{!x} ) { - p.CGTestFoo(); - p.CGTestBar(); - taskexit( p{x} ); -} - -task CGTestTask3( CGTestParamChild2 p{!y} ) { - p.CGTestFoo(); - p.CGTestBar(); - taskexit( p{y} ); -} diff --git a/Robust/src/Tests/CommandLineTest.java b/Robust/src/Tests/CommandLineTest.java deleted file mode 100644 index b828b76e..00000000 --- a/Robust/src/Tests/CommandLineTest.java +++ /dev/null @@ -1,8 +0,0 @@ -class CommandLineTest { - public static void main(String str[]) { - for(int i=0;i 12000) { - return 10000; - } else { - return 5000; - } - } -} - -public class Account { - String name; - Integer accountid; - Item balance; - public Account() { - } - public Integer getBalance() { - return balance.i; - } -} - -public class Item { - Integer i; - public Item() { - } -} diff --git a/Robust/src/Tests/Prefetch/QuickSort.java b/Robust/src/Tests/Prefetch/QuickSort.java deleted file mode 100644 index 82fc4c9b..00000000 --- a/Robust/src/Tests/Prefetch/QuickSort.java +++ /dev/null @@ -1,83 +0,0 @@ -public class QuickSort { - public QuickSort() { - } - - public void quick_srt(int array[],int low, int n){ - int lo = low; - int hi = n; - if (lo >= n) { - return; - } - int mid = array[(lo + hi) / 2]; - while (lo < hi) { - while (lo mid) { - hi--; - } - if (lo < hi) { - int T = array[lo]; - array[lo] = array[hi]; - array[hi] = T; - } - } - if (hi < lo) { - int T = hi; - hi = lo; - lo = T; - } - quick_srt(array, low, lo); - if(lo == low) { - low = lo+1; - } - else { - low = lo; - } - quick_srt(array, low, n); - } - - public static void main(String[] args) { - int i; - int j; - QArray myArray[] = new QArray[2]; - for(i = 0; i<2; i++) { - myArray[i] = new QArray(); - } - QuickSort qsort = new QuickSort(); - System.printString("Values Before sorting\n"); - for(i = 0; i<2; i++){ - for(j = 0; j<10; j++){ - System.printInt(myArray[i].mya[j]); - System.printString("\t"); - } - System.printString("\n"); - } - for(i = 0; i<2; i++){ - qsort.quick_srt(myArray[i].mya, 0, 9); - } - System.printString("Values After sorting\n"); - for(i = 0; i<2; i++){ - for(j = 0; j<10; j++){ - System.printInt(myArray[i].mya[j]); - System.printString("\t"); - } - System.printString("\n"); - } - System.printString("\n"); - } -} - -public class QArray { - public int mya[]; - public QArray() { - mya = new int[10]; - mya[0] = 65; - mya[1] = 26; - mya[2] = 5; - mya[3] = 49; - for(int i = 4; i<9; i++) - mya[i] = 10*i; - mya[9] = 72; - } -} diff --git a/Robust/src/Tests/ReadFile.java b/Robust/src/Tests/ReadFile.java deleted file mode 100644 index ff282ecf..00000000 --- a/Robust/src/Tests/ReadFile.java +++ /dev/null @@ -1,12 +0,0 @@ -public class ReadFile { - public static void main(String []str) { - String filename="testfile000"; - FileInputStream fis=new FileInputStream(filename); - byte x[]=new byte[9]; - fis.read(x); - fis.close(); - String st=new String(x); - System.printString(st); - } - -} diff --git a/Robust/src/Tests/ServerExample.java b/Robust/src/Tests/ServerExample.java deleted file mode 100644 index 82b52ceb..00000000 --- a/Robust/src/Tests/ServerExample.java +++ /dev/null @@ -1,27 +0,0 @@ -/* Startup object is generated with the initialstate flag set by the - * system to start the computation up */ - -task Startup(StartupObject s {initialstate}) { - System.printString("Starting\n"); - ServerSocket ss=new ServerSocket(8000); - System.printString("Creating ServerSocket\n"); - taskexit(s {!initialstate}); /* Turns initial state flag off, so this task won't refire */ -} - -task AcceptConnection(ServerSocket ss{SocketPending}) { - Socket s=ss.accept(); - System.printString("Creating Socket\n"); -} - -task IncomingIO(Socket s{IOPending}) { - byte[] b=new byte[10]; - int length=s.read(b); - byte[] b2=new byte[length]; - int i; - for(i=0;i/dev/null -$ARG1.bin $@ &> output/$ARG1.output -diff output/$ARG1.output output/$ARG1.output.goal -rm $ARG1.bin diff --git a/Robust/src/Tests/output/Array.output.goal b/Robust/src/Tests/output/Array.output.goal deleted file mode 100644 index e2a306d0..00000000 --- a/Robust/src/Tests/output/Array.output.goal +++ /dev/null @@ -1,2 +0,0 @@ -4 -10 diff --git a/Robust/src/Tests/output/Array2.output.goal b/Robust/src/Tests/output/Array2.output.goal deleted file mode 100644 index 3ddbfa74..00000000 --- a/Robust/src/Tests/output/Array2.output.goal +++ /dev/null @@ -1,10 +0,0 @@ -0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 -100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 -200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 -300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 -400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 -500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 -600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 -700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 -800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 -900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 diff --git a/Robust/src/Tests/output/BoundsFail.output.goal b/Robust/src/Tests/output/BoundsFail.output.goal deleted file mode 100644 index 693b0912..00000000 --- a/Robust/src/Tests/output/BoundsFail.output.goal +++ /dev/null @@ -1 +0,0 @@ -Array out of bounds diff --git a/Robust/src/Tests/output/BoundsFail2.output.goal b/Robust/src/Tests/output/BoundsFail2.output.goal deleted file mode 100644 index 693b0912..00000000 --- a/Robust/src/Tests/output/BoundsFail2.output.goal +++ /dev/null @@ -1 +0,0 @@ -Array out of bounds diff --git a/Robust/src/Tests/output/BoundsFail3.output.goal b/Robust/src/Tests/output/BoundsFail3.output.goal deleted file mode 100644 index 693b0912..00000000 --- a/Robust/src/Tests/output/BoundsFail3.output.goal +++ /dev/null @@ -1 +0,0 @@ -Array out of bounds diff --git a/Robust/src/Tests/output/BoundsFail4.output.goal b/Robust/src/Tests/output/BoundsFail4.output.goal deleted file mode 100644 index 693b0912..00000000 --- a/Robust/src/Tests/output/BoundsFail4.output.goal +++ /dev/null @@ -1 +0,0 @@ -Array out of bounds diff --git a/Robust/src/Tests/output/CommandLineTest.output.goal b/Robust/src/Tests/output/CommandLineTest.output.goal deleted file mode 100644 index d0e08a8d..00000000 --- a/Robust/src/Tests/output/CommandLineTest.output.goal +++ /dev/null @@ -1,2 +0,0 @@ -hello -hi diff --git a/Robust/src/Tests/output/FileLength.output.goal b/Robust/src/Tests/output/FileLength.output.goal deleted file mode 100644 index f11c82a4..00000000 --- a/Robust/src/Tests/output/FileLength.output.goal +++ /dev/null @@ -1 +0,0 @@ -9 \ No newline at end of file diff --git a/Robust/src/Tests/output/IncTest.output.goal b/Robust/src/Tests/output/IncTest.output.goal deleted file mode 100644 index 22769ee9..00000000 --- a/Robust/src/Tests/output/IncTest.output.goal +++ /dev/null @@ -1,41 +0,0 @@ -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 ----------------- -0 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -0 -0 -0 -0 -0 -0 -0 -0 -0 diff --git a/Robust/src/Tests/output/IntegerTest.output.goal b/Robust/src/Tests/output/IntegerTest.output.goal deleted file mode 100644 index 101e0aec..00000000 --- a/Robust/src/Tests/output/IntegerTest.output.goal +++ /dev/null @@ -1,2 +0,0 @@ -312 --34 diff --git a/Robust/src/Tests/output/ReadFile.output.goal b/Robust/src/Tests/output/ReadFile.output.goal deleted file mode 100644 index 107d5f91..00000000 --- a/Robust/src/Tests/output/ReadFile.output.goal +++ /dev/null @@ -1 +0,0 @@ -adsasdasd \ No newline at end of file diff --git a/Robust/src/Tests/output/StringBufferTest.output.goal b/Robust/src/Tests/output/StringBufferTest.output.goal deleted file mode 100644 index 2df7ebc3..00000000 --- a/Robust/src/Tests/output/StringBufferTest.output.goal +++ /dev/null @@ -1 +0,0 @@ -hello worldhello world \ No newline at end of file diff --git a/Robust/src/Tests/output/StringTest.output.goal b/Robust/src/Tests/output/StringTest.output.goal deleted file mode 100644 index 39ff83e3..00000000 --- a/Robust/src/Tests/output/StringTest.output.goal +++ /dev/null @@ -1,5 +0,0 @@ -hello world -1 -6 -lo world -lo diff --git a/Robust/src/Tests/output/Test.output.goal b/Robust/src/Tests/output/Test.output.goal deleted file mode 100644 index 22e99001..00000000 --- a/Robust/src/Tests/output/Test.output.goal +++ /dev/null @@ -1,1228 +0,0 @@ -3 -5 -7 -11 -13 -17 -19 -23 -29 -31 -37 -41 -43 -47 -53 -59 -61 -67 -71 -73 -79 -83 -89 -97 -101 -103 -107 -109 -113 -127 -131 -137 -139 -149 -151 -157 -163 -167 -173 -179 -181 -191 -193 -197 -199 -211 -223 -227 -229 -233 -239 -241 -251 -257 -263 -269 -271 -277 -281 -283 -293 -307 -311 -313 -317 -331 -337 -347 -349 -353 -359 -367 -373 -379 -383 -389 -397 -401 -409 -419 -421 -431 -433 -439 -443 -449 -457 -461 -463 -467 -479 -487 -491 -499 -503 -509 -521 -523 -541 -547 -557 -563 -569 -571 -577 -587 -593 -599 -601 -607 -613 -617 -619 -631 -641 -643 -647 -653 -659 -661 -673 -677 -683 -691 -701 -709 -719 -727 -733 -739 -743 -751 -757 -761 -769 -773 -787 -797 -809 -811 -821 -823 -827 -829 -839 -853 -857 -859 -863 -877 -881 -883 -887 -907 -911 -919 -929 -937 -941 -947 -953 -967 -971 -977 -983 -991 -997 -1009 -1013 -1019 -1021 -1031 -1033 -1039 -1049 -1051 -1061 -1063 -1069 -1087 -1091 -1093 -1097 -1103 -1109 -1117 -1123 -1129 -1151 -1153 -1163 -1171 -1181 -1187 -1193 -1201 -1213 -1217 -1223 -1229 -1231 -1237 -1249 -1259 -1277 -1279 -1283 -1289 -1291 -1297 -1301 -1303 -1307 -1319 -1321 -1327 -1361 -1367 -1373 -1381 -1399 -1409 -1423 -1427 -1429 -1433 -1439 -1447 -1451 -1453 -1459 -1471 -1481 -1483 -1487 -1489 -1493 -1499 -1511 -1523 -1531 -1543 -1549 -1553 -1559 -1567 -1571 -1579 -1583 -1597 -1601 -1607 -1609 -1613 -1619 -1621 -1627 -1637 -1657 -1663 -1667 -1669 -1693 -1697 -1699 -1709 -1721 -1723 -1733 -1741 -1747 -1753 -1759 -1777 -1783 -1787 -1789 -1801 -1811 -1823 -1831 -1847 -1861 -1867 -1871 -1873 -1877 -1879 -1889 -1901 -1907 -1913 -1931 -1933 -1949 -1951 -1973 -1979 -1987 -1993 -1997 -1999 -2003 -2011 -2017 -2027 -2029 -2039 -2053 -2063 -2069 -2081 -2083 -2087 -2089 -2099 -2111 -2113 -2129 -2131 -2137 -2141 -2143 -2153 -2161 -2179 -2203 -2207 -2213 -2221 -2237 -2239 -2243 -2251 -2267 -2269 -2273 -2281 -2287 -2293 -2297 -2309 -2311 -2333 -2339 -2341 -2347 -2351 -2357 -2371 -2377 -2381 -2383 -2389 -2393 -2399 -2411 -2417 -2423 -2437 -2441 -2447 -2459 -2467 -2473 -2477 -2503 -2521 -2531 -2539 -2543 -2549 -2551 -2557 -2579 -2591 -2593 -2609 -2617 -2621 -2633 -2647 -2657 -2659 -2663 -2671 -2677 -2683 -2687 -2689 -2693 -2699 -2707 -2711 -2713 -2719 -2729 -2731 -2741 -2749 -2753 -2767 -2777 -2789 -2791 -2797 -2801 -2803 -2819 -2833 -2837 -2843 -2851 -2857 -2861 -2879 -2887 -2897 -2903 -2909 -2917 -2927 -2939 -2953 -2957 -2963 -2969 -2971 -2999 -3001 -3011 -3019 -3023 -3037 -3041 -3049 -3061 -3067 -3079 -3083 -3089 -3109 -3119 -3121 -3137 -3163 -3167 -3169 -3181 -3187 -3191 -3203 -3209 -3217 -3221 -3229 -3251 -3253 -3257 -3259 -3271 -3299 -3301 -3307 -3313 -3319 -3323 -3329 -3331 -3343 -3347 -3359 -3361 -3371 -3373 -3389 -3391 -3407 -3413 -3433 -3449 -3457 -3461 -3463 -3467 -3469 -3491 -3499 -3511 -3517 -3527 -3529 -3533 -3539 -3541 -3547 -3557 -3559 -3571 -3581 -3583 -3593 -3607 -3613 -3617 -3623 -3631 -3637 -3643 -3659 -3671 -3673 -3677 -3691 -3697 -3701 -3709 -3719 -3727 -3733 -3739 -3761 -3767 -3769 -3779 -3793 -3797 -3803 -3821 -3823 -3833 -3847 -3851 -3853 -3863 -3877 -3881 -3889 -3907 -3911 -3917 -3919 -3923 -3929 -3931 -3943 -3947 -3967 -3989 -4001 -4003 -4007 -4013 -4019 -4021 -4027 -4049 -4051 -4057 -4073 -4079 -4091 -4093 -4099 -4111 -4127 -4129 -4133 -4139 -4153 -4157 -4159 -4177 -4201 -4211 -4217 -4219 -4229 -4231 -4241 -4243 -4253 -4259 -4261 -4271 -4273 -4283 -4289 -4297 -4327 -4337 -4339 -4349 -4357 -4363 -4373 -4391 -4397 -4409 -4421 -4423 -4441 -4447 -4451 -4457 -4463 -4481 -4483 -4493 -4507 -4513 -4517 -4519 -4523 -4547 -4549 -4561 -4567 -4583 -4591 -4597 -4603 -4621 -4637 -4639 -4643 -4649 -4651 -4657 -4663 -4673 -4679 -4691 -4703 -4721 -4723 -4729 -4733 -4751 -4759 -4783 -4787 -4789 -4793 -4799 -4801 -4813 -4817 -4831 -4861 -4871 -4877 -4889 -4903 -4909 -4919 -4931 -4933 -4937 -4943 -4951 -4957 -4967 -4969 -4973 -4987 -4993 -4999 -5003 -5009 -5011 -5021 -5023 -5039 -5051 -5059 -5077 -5081 -5087 -5099 -5101 -5107 -5113 -5119 -5147 -5153 -5167 -5171 -5179 -5189 -5197 -5209 -5227 -5231 -5233 -5237 -5261 -5273 -5279 -5281 -5297 -5303 -5309 -5323 -5333 -5347 -5351 -5381 -5387 -5393 -5399 -5407 -5413 -5417 -5419 -5431 -5437 -5441 -5443 -5449 -5471 -5477 -5479 -5483 -5501 -5503 -5507 -5519 -5521 -5527 -5531 -5557 -5563 -5569 -5573 -5581 -5591 -5623 -5639 -5641 -5647 -5651 -5653 -5657 -5659 -5669 -5683 -5689 -5693 -5701 -5711 -5717 -5737 -5741 -5743 -5749 -5779 -5783 -5791 -5801 -5807 -5813 -5821 -5827 -5839 -5843 -5849 -5851 -5857 -5861 -5867 -5869 -5879 -5881 -5897 -5903 -5923 -5927 -5939 -5953 -5981 -5987 -6007 -6011 -6029 -6037 -6043 -6047 -6053 -6067 -6073 -6079 -6089 -6091 -6101 -6113 -6121 -6131 -6133 -6143 -6151 -6163 -6173 -6197 -6199 -6203 -6211 -6217 -6221 -6229 -6247 -6257 -6263 -6269 -6271 -6277 -6287 -6299 -6301 -6311 -6317 -6323 -6329 -6337 -6343 -6353 -6359 -6361 -6367 -6373 -6379 -6389 -6397 -6421 -6427 -6449 -6451 -6469 -6473 -6481 -6491 -6521 -6529 -6547 -6551 -6553 -6563 -6569 -6571 -6577 -6581 -6599 -6607 -6619 -6637 -6653 -6659 -6661 -6673 -6679 -6689 -6691 -6701 -6703 -6709 -6719 -6733 -6737 -6761 -6763 -6779 -6781 -6791 -6793 -6803 -6823 -6827 -6829 -6833 -6841 -6857 -6863 -6869 -6871 -6883 -6899 -6907 -6911 -6917 -6947 -6949 -6959 -6961 -6967 -6971 -6977 -6983 -6991 -6997 -7001 -7013 -7019 -7027 -7039 -7043 -7057 -7069 -7079 -7103 -7109 -7121 -7127 -7129 -7151 -7159 -7177 -7187 -7193 -7207 -7211 -7213 -7219 -7229 -7237 -7243 -7247 -7253 -7283 -7297 -7307 -7309 -7321 -7331 -7333 -7349 -7351 -7369 -7393 -7411 -7417 -7433 -7451 -7457 -7459 -7477 -7481 -7487 -7489 -7499 -7507 -7517 -7523 -7529 -7537 -7541 -7547 -7549 -7559 -7561 -7573 -7577 -7583 -7589 -7591 -7603 -7607 -7621 -7639 -7643 -7649 -7669 -7673 -7681 -7687 -7691 -7699 -7703 -7717 -7723 -7727 -7741 -7753 -7757 -7759 -7789 -7793 -7817 -7823 -7829 -7841 -7853 -7867 -7873 -7877 -7879 -7883 -7901 -7907 -7919 -7927 -7933 -7937 -7949 -7951 -7963 -7993 -8009 -8011 -8017 -8039 -8053 -8059 -8069 -8081 -8087 -8089 -8093 -8101 -8111 -8117 -8123 -8147 -8161 -8167 -8171 -8179 -8191 -8209 -8219 -8221 -8231 -8233 -8237 -8243 -8263 -8269 -8273 -8287 -8291 -8293 -8297 -8311 -8317 -8329 -8353 -8363 -8369 -8377 -8387 -8389 -8419 -8423 -8429 -8431 -8443 -8447 -8461 -8467 -8501 -8513 -8521 -8527 -8537 -8539 -8543 -8563 -8573 -8581 -8597 -8599 -8609 -8623 -8627 -8629 -8641 -8647 -8663 -8669 -8677 -8681 -8689 -8693 -8699 -8707 -8713 -8719 -8731 -8737 -8741 -8747 -8753 -8761 -8779 -8783 -8803 -8807 -8819 -8821 -8831 -8837 -8839 -8849 -8861 -8863 -8867 -8887 -8893 -8923 -8929 -8933 -8941 -8951 -8963 -8969 -8971 -8999 -9001 -9007 -9011 -9013 -9029 -9041 -9043 -9049 -9059 -9067 -9091 -9103 -9109 -9127 -9133 -9137 -9151 -9157 -9161 -9173 -9181 -9187 -9199 -9203 -9209 -9221 -9227 -9239 -9241 -9257 -9277 -9281 -9283 -9293 -9311 -9319 -9323 -9337 -9341 -9343 -9349 -9371 -9377 -9391 -9397 -9403 -9413 -9419 -9421 -9431 -9433 -9437 -9439 -9461 -9463 -9467 -9473 -9479 -9491 -9497 -9511 -9521 -9533 -9539 -9547 -9551 -9587 -9601 -9613 -9619 -9623 -9629 -9631 -9643 -9649 -9661 -9677 -9679 -9689 -9697 -9719 -9721 -9733 -9739 -9743 -9749 -9767 -9769 -9781 -9787 -9791 -9803 -9811 -9817 -9829 -9833 -9839 -9851 -9857 -9859 -9871 -9883 -9887 -9901 -9907 -9923 -9929 -9931 -9941 -9949 -9967 -9973 diff --git a/Robust/src/Tests/output/WriteFile.output.goal b/Robust/src/Tests/output/WriteFile.output.goal deleted file mode 100644 index e69de29b..00000000 diff --git a/Robust/src/Tests/output/virtualcalltest.output.goal b/Robust/src/Tests/output/virtualcalltest.output.goal deleted file mode 100644 index e69de29b..00000000 diff --git a/Robust/src/Tests/remotethreadtest.java b/Robust/src/Tests/remotethreadtest.java deleted file mode 100644 index 40faa027..00000000 --- a/Robust/src/Tests/remotethreadtest.java +++ /dev/null @@ -1,22 +0,0 @@ -public class RemoteThread extends Thread { - public RemoteThread() { - } - - public static void main(String[] st) { - int mid = (128<<24)|(200<<16)|(9<<8)|26; - RemoteThread t =null; - atomic { - t= global new RemoteThread(); - } - System.printString("Starting\n"); - t.start(mid); - System.printString("Finished\n"); - //this is ugly... - while(true) ; - } - - public int run() { - System.printString("Remote machine\n"); - } -} - diff --git a/Robust/src/Tests/virtualcalltest.java b/Robust/src/Tests/virtualcalltest.java deleted file mode 100644 index 1b034ad2..00000000 --- a/Robust/src/Tests/virtualcalltest.java +++ /dev/null @@ -1,47 +0,0 @@ -class A { - A() { - ; - } - - void foo(int x) { - System.printInt(x); - System.printString("\n"); - } -} - - -class B extends A { - B() { - ; - } - - void foo(int x) { - } -} - - -class C extends A { - C() { - ; - } - - void foo(int x) { - } -} - -public class virtualcalltest { - public static void main(String str[]) { - - A a=null; - B b=new B(); - C c=new C(); - for(int i=0;i<1000000;i++) { - if (i%2==0) - a=b; - else - a=c; - - a.foo(20); - } - } -} diff --git a/Robust/src/Util/Edge.java b/Robust/src/Util/Edge.java deleted file mode 100644 index 8b13b03d..00000000 --- a/Robust/src/Util/Edge.java +++ /dev/null @@ -1,72 +0,0 @@ -package Util; - -/* Edge *****************/ - -public class Edge { - protected GraphNode target; - protected GraphNode source; - - protected String dotnodeparams = new String(); - - public Edge(GraphNode target) { - this.target = target; - } - - public String getLabel() { - return ""; - } - - public void setSource(GraphNode s) { - this.source=s; - } - - public GraphNode getSource() { - return source; - } - - public GraphNode getTarget() { - return target; - } - - public void setDotNodeParameters(String param) { - if (param == null) { - throw new NullPointerException(); - } - if (dotnodeparams.length() > 0) { - dotnodeparams += "," + param; - } else { - dotnodeparams = param; - } - } - - public static final EdgeStatus UNVISITED = new EdgeStatus("UNVISITED"); - public static final EdgeStatus PROCESSING = new EdgeStatus("PROCESSING"); - public static final EdgeStatus FINISHED = new EdgeStatus("FINISHED"); - - public static class EdgeStatus { - private static String name; - private EdgeStatus(String name) { this.name = name; } - public String toString() { return name; } - } - - int discoverytime = -1; - int finishingtime = -1; /* used for searches */ - EdgeStatus status = UNVISITED; - - void reset() { - discoverytime = -1; - finishingtime = -1; - status = UNVISITED; - } - - void discover(int time) { - discoverytime = time; - status = PROCESSING; - } - - void finish(int time) { - assert status == PROCESSING; - finishingtime = time; - status = FINISHED; - } -} diff --git a/Robust/src/Util/GraphNode.java b/Robust/src/Util/GraphNode.java deleted file mode 100755 index 0028af76..00000000 --- a/Robust/src/Util/GraphNode.java +++ /dev/null @@ -1,541 +0,0 @@ -package Util; - -import java.util.*; -import java.io.*; - -public class GraphNode { - /* NodeStatus enumeration pattern ***********/ - - public static final NodeStatus UNVISITED = new NodeStatus("UNVISITED"); - public static final NodeStatus PROCESSING = new NodeStatus("PROCESSING"); - public static final NodeStatus FINISHED = new NodeStatus("FINISHED"); - - public static class NodeStatus { - private static String name; - private NodeStatus(String name) { this.name = name; } - public String toString() { return name; } - } - - int discoverytime = -1; - int finishingtime = -1; /* used for searches */ - - protected Vector edges = new Vector(); - protected Vector inedges = new Vector(); - - NodeStatus status = UNVISITED; - String dotnodeparams = new String(); - public boolean merge=false; - - public void setMerge() { - merge=true; - } - - public static void computeclosure(Collection nodes, Collection removed) { - Stack tovisit=new Stack(); - tovisit.addAll(nodes); - while(!tovisit.isEmpty()) { - GraphNode gn=(GraphNode)tovisit.pop(); - for(Iterator it=gn.edges();it.hasNext();) { - Edge edge=(Edge)it.next(); - GraphNode target=edge.getTarget(); - if (!nodes.contains(target)) { - if ((removed==null)|| - (!removed.contains(target))) { - nodes.add(target); - tovisit.push(target); - } - } - } - } - } - - public static void boundedcomputeclosure(Collection nodes, Collection removed,int depth) { - Stack tovisit=new Stack(); - Stack newvisit=new Stack(); - tovisit.addAll(nodes); - for(int i=0;i 0) { - dotnodeparams += "," + param; - } else { - dotnodeparams = param; - } - } - - public void setStatus(NodeStatus status) { - if (status == null) { - throw new NullPointerException(); - } - this.status = status; - } - - public String getLabel() { - return ""; - } - - public String getTextLabel() { - return ""; - } - - public String getName(){ - return ""; - } - - public NodeStatus getStatus() { - return this.status; - } - - public int numedges() { - return edges.size(); - } - - public int numinedges() { - return inedges.size(); - } - - public Edge getedge(int i) { - return (Edge) edges.get(i); - } - - public Edge getinedge(int i) { - return (Edge) inedges.get(i); - } - - public Vector getEdgeVector() { - return edges; - } - - public Vector getInedgeVector() { - return inedges; - } - - public Iterator edges() { - return edges.iterator(); - } - - public Iterator inedges() { - return inedges.iterator(); - } - - public void addEdge(Edge newedge) { - newedge.setSource(this); - edges.addElement(newedge); - GraphNode tonode=newedge.getTarget(); - tonode.inedges.addElement(newedge); - } - - public boolean containsEdge(Edge e) { - return edges.contains(e); - } - - public void addEdge(Vector v) { - for (Iterator it = v.iterator(); it.hasNext();) - addEdge((Edge)it.next()); - } - - public void removeEdge(Edge edge) { - edges.remove(edge); - } - - public void removeInedge(Edge edge) { - inedges.remove(edge); - } - - public void removeAllEdges() { - edges.removeAllElements(); - } - - public void removeAllInedges() { - inedges.removeAllElements(); - } - void reset() { - discoverytime = -1; - finishingtime = -1; - status = UNVISITED; - } - - void resetscc() { - status = UNVISITED; - } - - void discover(int time) { - discoverytime = time; - status = PROCESSING; - } - - void finish(int time) { - assert status == PROCESSING; - finishingtime = time; - status = FINISHED; - } - - /** Returns finishing time for dfs */ - - public int getFinishingTime() { - return finishingtime; - } - - - public static class DOTVisitor { - - java.io.PrintWriter output; - int tokennumber; - int color; - Vector namers; - - private DOTVisitor(java.io.OutputStream output, Vector namers) { - tokennumber = 0; - color = 0; - this.output = new java.io.PrintWriter(output, true); - this.namers=namers; - } - - private String getNewID(String name) { - tokennumber = tokennumber + 1; - return new String (name+tokennumber); - } - - Collection nodes; - - - public static void visit(java.io.OutputStream output, Collection nodes, Vector namers) { - DOTVisitor visitor = new DOTVisitor(output, namers); - visitor.nodes = nodes; - visitor.make(); - } - - public static void visit(java.io.OutputStream output, Collection nodes) { - Vector v=new Vector(); - v.add(new Namer()); - DOTVisitor visitor = new DOTVisitor(output, v); - visitor.nodes = nodes; - visitor.make(); - } - - private void make() { - output.println("digraph dotvisitor {"); - /* output.println("\tpage=\"8.5,11\";"); - output.println("\tnslimit=1000.0;"); - output.println("\tnslimit1=1000.0;"); - output.println("\tmclimit=1000.0;"); - output.println("\tremincross=true;");*/ - output.println("\tnode [fontsize=10,height=\"0.1\", width=\"0.1\"];"); - output.println("\tedge [fontsize=6];"); - traverse(); - output.println("}\n"); - } - - - - private void traverse() { - Set cycleset=GraphNode.findcycles(nodes); - - Iterator it = nodes.iterator(); - while (it.hasNext()) { - GraphNode gn = (GraphNode) it.next(); - Iterator edges = gn.edges(); - String label = ""; - String dotnodeparams=""; - - for(int i=0;i " + node2.getLabel() + " [" + "label=\"" + edgelabel + "\"" + edgedotnodeparams + "];"); - } - } - } - } - } - - Set nonmerge(GraphNode gn) { - HashSet newset=new HashSet(); - HashSet toprocess=new HashSet(); - toprocess.add(gn); - while(!toprocess.isEmpty()) { - GraphNode gn2=(GraphNode)toprocess.iterator().next(); - toprocess.remove(gn2); - if (!gn2.merge) - newset.add(gn2); - else { - Iterator edges = gn2.edges(); - while (edges.hasNext()) { - Edge edge = (Edge) edges.next(); - GraphNode node = edge.getTarget(); - if (!newset.contains(node)&&nodes.contains(node)) - toprocess.add(node); - } - } - } - return newset; - } - - } - - /** This function returns the set of nodes involved in cycles. - * It only considers cycles containing nodes in the set 'nodes'. - */ - public static Set findcycles(Collection nodes) { - HashSet cycleset=new HashSet(); - SCC scc=DFS.computeSCC(nodes); - if (!scc.hasCycles()) - return cycleset; - for(int i=0;i1) - return true; - Object [] array=s.toArray(); - GraphNode gn=(GraphNode)array[0]; - for(Iterator it=gn.edges();it.hasNext();) { - Edge e=(Edge)it.next(); - if (e.getTarget()==gn) - return true; /* Self Cycle */ - } - return false; - } - } - - /** - * DFS encapsulates the depth first search algorithm - */ - public static class DFS { - - int time = 0; - int sccindex = 0; - Collection nodes; - Vector finishingorder=null; - Vector finishingorder_edge = null; - int edgetime = 0; - HashMap sccmap; - HashMap sccmaprev; - - private DFS(Collection nodes) { - this.nodes = nodes; - } - /** Calculates the strong connected components for the graph composed - * of the set of nodes 'nodes'*/ - public static SCC computeSCC(Collection nodes) { - if (nodes==null) { - throw new NullPointerException(); - } - DFS dfs=new DFS(nodes); - dfs.sccmap=new HashMap(); - dfs.sccmaprev=new HashMap(); - dfs.finishingorder=new Vector(); - boolean acyclic=dfs.go(); - for (Iterator it = nodes.iterator();it.hasNext();) { - GraphNode gn = (GraphNode) it.next(); - gn.resetscc(); - } - for(int i=dfs.finishingorder.size()-1;i>=0;i--) { - GraphNode gn=(GraphNode)dfs.finishingorder.get(i); - if (gn.getStatus() == UNVISITED) { - dfs.dfsprev(gn); - dfs.sccindex++; /* Increment scc index */ - } - } - return new SCC(acyclic,dfs.sccmap,dfs.sccmaprev,dfs.sccindex); - } - - void dfsprev(GraphNode gn) { - if (gn.getStatus()==FINISHED||!nodes.contains(gn)) - return; - gn.setStatus(FINISHED); - Integer i=new Integer(sccindex); - if (!sccmap.containsKey(i)) - sccmap.put(i,new HashSet()); - ((Set)sccmap.get(i)).add(gn); - sccmaprev.put(gn,i); - for(Iterator edgeit=gn.inedges();edgeit.hasNext();) { - Edge e=(Edge)edgeit.next(); - GraphNode gn2=e.getSource(); - dfsprev(gn2); - } - } - - public static boolean depthFirstSearch(Collection nodes) { - if (nodes == null) { - throw new NullPointerException(); - } - - DFS dfs = new DFS(nodes); - return dfs.go(); - } - - private boolean go() { - Iterator i; - time = 0; - edgetime = 0; - boolean acyclic=true; - i = nodes.iterator(); - while (i.hasNext()) { - GraphNode gn = (GraphNode) i.next(); - gn.reset(); - } - - i = nodes.iterator(); - while (i.hasNext()) { - GraphNode gn = (GraphNode) i.next(); - assert gn.getStatus() != PROCESSING; - if (gn.getStatus() == UNVISITED) { - if (!dfs(gn)) - acyclic=false; - } - } - return acyclic; - } - - private boolean dfs(GraphNode gn) { - boolean acyclic=true; - gn.discover(time++); - Iterator edges = gn.edges(); - - while (edges.hasNext()) { - Edge edge = (Edge) edges.next(); - edge.discover(edgetime++); - GraphNode node = edge.getTarget(); - if (!nodes.contains(node)) /* Skip nodes which aren't in the set */ { - if(finishingorder_edge != null) - finishingorder_edge.add(edge); - edge.finish(edgetime++); - continue; - } - if (node.getStatus() == UNVISITED) { - if (!dfs(node)) - acyclic=false; - } else if (node.getStatus()==PROCESSING) { - acyclic=false; - } - if(finishingorder_edge != null) - finishingorder_edge.add(edge); - edge.finish(edgetime++); - } - if (finishingorder!=null) - finishingorder.add(gn); - gn.finish(time++); - return acyclic; - } - - public static Vector topology(Collection nodes, Vector finishingorder_edge) { - if (nodes==null) { - throw new NullPointerException(); - } - DFS dfs=new DFS(nodes); - dfs.finishingorder=new Vector(); - if(finishingorder_edge != null) { - dfs.finishingorder_edge = new Vector(); - } - boolean acyclic=dfs.go(); - Vector topology = new Vector(); - for(int i=dfs.finishingorder.size()-1;i>=0;i--) { - GraphNode gn=(GraphNode)dfs.finishingorder.get(i); - topology.add(gn); - } - if(finishingorder_edge != null) { - for(int i=dfs.finishingorder_edge.size()-1;i>=0;i--) { - Edge gn=(Edge)dfs.finishingorder_edge.get(i); - finishingorder_edge.add(gn); - } - } - return topology; - } - } /* end DFS */ - -} diff --git a/Robust/src/Util/Namer.java b/Robust/src/Util/Namer.java deleted file mode 100644 index 1e8d3c38..00000000 --- a/Robust/src/Util/Namer.java +++ /dev/null @@ -1,21 +0,0 @@ -package Util; - -public class Namer { - public Namer() {} - - public String nodeLabel(GraphNode gn) { - return gn.getTextLabel(); - } - - public String nodeOption(GraphNode gn) { - return gn.dotnodeparams; - } - - public String edgeLabel(Edge e) { - return e.getLabel(); - } - - public String edgeOption(Edge e) { - return e.dotnodeparams; - } -} diff --git a/Robust/src/Util/Relation.java b/Robust/src/Util/Relation.java deleted file mode 100644 index eea6f68a..00000000 --- a/Robust/src/Util/Relation.java +++ /dev/null @@ -1,45 +0,0 @@ -package Util; -import java.util.*; - - -public class Relation { - private Hashtable table; - int size; - - public Relation() { - table=new Hashtable(); - size=0; - } - - public int size() { - return size; - } - - public boolean containsKey(Object o) { - return table.containsKey(o); - } - - public Set keySet() { - return table.keySet(); - } - - public synchronized boolean put(Object key, Object value) { - HashSet s; - if (table.containsKey(key)) { - s=(HashSet) table.get(key); - } else { - s=new HashSet(); - table.put(key,s); - } - if (!s.contains(value)) { - size++; - s.add(value); - return true; - } else - return false; - } - - public Set get(Object key) { - return (Set)table.get(key); - } -} diff --git a/Robust/src/buildscript b/Robust/src/buildscript deleted file mode 100755 index a9bea668..00000000 --- a/Robust/src/buildscript +++ /dev/null @@ -1,406 +0,0 @@ -#!/bin/bash - -printhelp() { -echo -robustroot set up the ROBUSTROOT to directory other than default one -echo -dsm distributed shared memory -echo -trueprob double - probabiltiy of true branch -echo -mac distributed shared memory mac support -echo -check generate check code -echo -dmalloc link in dmalloc -echo -recover compile task code -echo -specdir directory -echo -printflat print out flat representation -echo -selfloop task - this task cannot self loop forever -echo "-excprefetch methoddescriptor - exclude prefetches for this method (specified as class.method)" -echo -taskstate do task state analysis -echo -tagstate do tag state analysis -echo -scheduling do task scheduling -echo -multicore generate multi-core version binary -echo "-numcore set the number of cores (should be used together with -multicore), defaultly set as 1" -echo "-raw generate raw version binary (should be used together with -multicore)" -echo "-interrupt generate raw version binary with interruption (should be used togethere with -raw)" -echo "-rawconfig config raw simulator as 4xn (should be used together with -raw)" -echo -threadsimulate generate multi-thread simulate version binary -echo -optional enable optional -echo -debug generate debug symbols -echo -prefetch do prefetch analysis -echo -transstats generates transaction stats on commits and aborts -echo -webinterface enable web interface -echo -runtimedebug printout runtime debug messages -echo "-thread use support for multiple threads" -echo "-optimize call gcc with -O9 (optimize)" -echo "-nooptimize call gcc with -O0 (do not optimize)" -echo -curdir directory -echo -mainclass class with main method -echo -o binary -echo -nojava do not run bristlecone compiler -echo -instructionfailures inject code for instructionfailures -echo -profile build with profile options -echo "-enable-assertions execute assert statements during compilation" -echo -help help -} - -ROBUSTROOT=~/research/Robust/src -DSMRUNTIME=$ROBUSTROOT/Runtime/DSTM/interface/ -REPAIRROOT=~/research/Repair/RepairCompiler/ -CURDIR=`pwd` -DSMFLAG=false -NOJAVA=false -CHECKFLAG=false -RECOVERFLAG=false -MULTICOREFLAG=false -TRANSSTATSFLAG=false -RAWFLAG=false -RAWCONFIG='' -RAWDEBUGFLAG=false -INTERRUPTFLAG=false -THREADSIMULATEFLAG=false; -USEDMALLOC=false -THREADFLAG=false -SPECDIR=`pwd` -SRCFILES='' -EXTRAOPTIONS='' -MAINFILE='a' -JAVAFORWARDOPTS='' -JAVAOPTS='' -OPTIONALFLAG=false - -if [[ -z $1 ]] -then -printhelp -exit -fi - -while [[ -n $1 ]] -do -if [[ $1 = '-help' ]] -then -printhelp -exit -elif [[ $1 = '-robustroot' ]] -then -ROBUSTROOT="$2" -shift -elif [[ $1 = '-nojava' ]] -then -NOJAVA=true -elif [[ $1 = '-o' ]] -then -MAINFILE="$2" -shift -elif [[ $1 = '-mainclass' ]] -then -JAVAOPTS="$JAVAOPTS -mainclass $2" -shift -elif [[ $1 = '-selfloop' ]] -then -JAVAOPTS="$JAVAOPTS -selfloop $2" -shift -elif [[ $1 = '-excprefetch' ]] -then -JAVAOPTS="$JAVAOPTS -excprefetch $2" -shift -elif [[ $1 = '-dsm' ]] -then -JAVAOPTS="$JAVAOPTS -dsm" -DSMFLAG=true -elif [[ $1 = '-prefetch' ]] -then -JAVAOPTS="$JAVAOPTS -prefetch" -elif [[ $1 = '-transstats' ]] -then -TRANSSTATSFLAG=true -elif [[ $1 = '-printflat' ]] -then -JAVAOPTS="$JAVAOPTS -printflat" -elif [[ $1 = '-trueprob' ]] -then -JAVAOPTS="$JAVAOPTS -trueprob $2" -shift -elif [[ $1 = '-mac' ]] -then -EXTRAOPTIONS="$EXTRAOPTIONS -DMAC" -elif [[ $1 = '-profile' ]] -then -EXTRAOPTIONS="$EXTRAOPTIONS -pg" -elif [[ $1 = '-taskstate' ]] -then -JAVAOPTS="$JAVAOPTS -taskstate" -elif [[ $1 = '-tagstate' ]] -then -JAVAOPTS="$JAVAOPTS -tagstate" -elif [[ $1 = '-scheduling' ]] -then -JAVAOPTS="$JAVAOPTS -scheduling" -elif [[ $1 = '-multicore' ]] -then -MULTICOREFLAG=true -JAVAOPTS="$JAVAOPTS -multicore" -elif [[ $1 = '-numcore' ]] -then -JAVAOPTS="$JAVAOPTS -numcore $2" -shift -elif [[ $1 = '-raw' ]] -then -RAWFLAG=true -JAVAOPTS="$JAVAOPTS -raw" -elif [[ $1 = '-rawconfig' ]] -then -RAWCONFIG="$2" -shift -elif [[ $1 = '-interrupt' ]] -then -INTERRUPTFLAG=true -elif [[ $1 = '-threadsimulate' ]] -then -THREADSIMULATEFLAG=true -elif [[ $1 = '-optional' ]] -then -JAVAOPTS="$JAVAOPTS -optional" -OPTIONALFLAG=true -elif [[ $1 = '-dmalloc' ]] -then -USEDMALLOC=true -elif [[ $1 = '-recover' ]] -then -RECOVERFLAG=true -JAVAOPTS="$JAVAOPTS -task" -elif [[ $1 = '-webinterface' ]] -then -JAVAOPTS="$JAVAOPTS -webinterface" -elif [[ $1 = '-instructionfailures' ]] -then -JAVAOPTS="$JAVAOPTS -instructionfailures" -elif [[ $1 = '-check' ]] -then -CHECKFLAG=true -JAVAOPTS="$JAVAOPTS -conscheck" -elif [[ $1 = '-enable-assertions' ]] -then -JAVAFORWARDOPTS="$JAVAFORWARDOPTS -ea" -elif [[ $1 = '-specdir' ]] -then -cd $2 -SPECDIR=`pwd` -cd $CURDIR -shift -elif [[ $1 = '-debug' ]] -then -RAWDEBUGFLAG=true -EXTRAOPTIONS="$EXTRAOPTIONS -g" -elif [[ $1 = '-runtimedebug' ]] -then -#EXTRAOPTIONS="$EXTRAOPTIONS -DDEBUG" -EXTRAOPTIONS="$EXTRAOPTIONS -DCHECKTB" -elif [[ $1 = '-nooptimize' ]] -then -EXTRAOPTIONS="$EXTRAOPTIONS -O0" -elif [[ $1 = '-optimize' ]] -then -EXTRAOPTIONS="$EXTRAOPTIONS -O9" -elif [[ $1 = '-thread' ]] -then -JAVAOPTS="$JAVAOPTS -thread" -EXTRAOPTIONS="$EXTRAOPTIONS -DTHREADS -lpthread" -THREADFLAG=true -elif [[ $1 = '-curdir' ]] -then -CURDIR=$2 -shift -else -SRCFILES="$SRCFILES $1" -fi -shift -done - -BUILDDIR="$CURDIR/tmpbuilddirectory" - -cd $1 -cd $CURDIR -shift - -mkdir $BUILDDIR - -if $CHECKFLAG #Generate structure files for repair tool -then -JAVAOPTS="$JAVAOPTS -struct structfile" -fi - -# Build bristlecone/java sources - -if $MULTICOREFLAG -then -if ! java $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \ -$ROBUSTROOT/ClassLibrary/ -dir $BUILDDIR \ -$JAVAOPTS $SRCFILES -then exit $? -fi -else -#if ! java -Xms5m -Xmx100m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \ -if ! $NOJAVA -then -if ! java -Xms5m -Xmx100m $JAVAFORWARDOPTS -classpath $ROBUSTROOT/../cup/:$ROBUSTROOT Main.Main -classlibrary \ -$ROBUSTROOT/ClassLibrary/ -dir $BUILDDIR -precise \ -$JAVAOPTS $SRCFILES -then exit $? -fi -fi -fi - -# Build all of the consistency specs - -if $CHECKFLAG # CHECKFLAG -then -cd $SPECDIR -mkdir $BUILDDIR/specdir -cp $REPAIRROOT/MCC/CRuntime/* $BUILDDIR/specdir - -echo > $BUILDDIR/specs - -# compile specs into C code -for i in * # iterate over all directories -do -if [[ "$i" != "CVS" ]] # CVSDIR CHECK -then -cd $SPECDIR/$i -cat $BUILDDIR/structfile.struct $i.label > $i.struct -java -cp $REPAIRROOT/:. MCC.Compiler -name $i -checkonly $i -cp size.[c,h] $BUILDDIR/specdir -cp $i.c $i\_aux.[c,h] $BUILDDIR/specdir -echo $i >> $BUILDDIR/specs -fi # CVSDIR CHECK -done # iterate over all directories - -#compile C code - -cd $BUILDDIR/specdir -./buildrobust -echo > $BUILDDIR/checkers.h -for i in `cat $BUILDDIR/specs` -do -gcc -O0 -g -fbounds-check -c $i\_aux.c -echo \#include \"specdir\/$i\_aux.h\" >> $BUILDDIR/checkers.h -done -fi # CHECKFLAG - -#build and link everything - -if $RAWFLAG -then # RAWFLAG -RAWDIR="$CURDIR/raw" -MAKEFILE="../Makefile.raw" -mkdir $RAWDIR -cd $RAWDIR -make clean -rm ./* - -export RAWRGCCFLAGS="-DTASK -DMULTICORE -DRAW" - -if $RAWDEBUGFLAG -then #debug version -RAWRGCCFLAGS="${RAWRGCCFLAGS} -DRAWDEBUG" -fi - -if $INTERRUPTFLAG -then #INTERRUPT version -MAKEFILE="$MAKEFILE.i" -RAWRGCCFLAGS="${RAWRGCCFLAGS} -DINTERRUPT" -fi #INTERRUPT version - -MAKEFILE="$MAKEFILE.$RAWCONFIG" - -cp $MAKEFILE ./Makefile -cp ../Runtime/*.c ./ -cp ../Runtime/*.h ./ -cp ../Runtime/*.S ./ -cp ../Runtime/*.s ./ -cp ../tmpbuilddirectory/*.c ./ -cp ../tmpbuilddirectory/*.h ./ - -make - -else #!RAWFLAG -cd $CURDIR - -INCLUDES="$INCLUDES -I$ROBUSTROOT/Runtime -I. -IRuntime/include \ --I$BUILDDIR" - -if $MULTICOREFLAG -then -RUNTIMEFILE="$ROBUSTROOT/Runtime/multicoreruntime.c $ROBUSTROOT/Runtime/multicoretask.c" -else -RUNTIMEFILE="$ROBUSTROOT/Runtime/runtime.c $ROBUSTROOT/Runtime/task.c" -fi - -FILES="$RUNTIMEFILE \ -$ROBUSTROOT/Runtime/file.c $ROBUSTROOT/Runtime/Queue.c \ -$ROBUSTROOT/Runtime/SimpleHash.c $ROBUSTROOT/Runtime/option.c \ -$ROBUSTROOT/Runtime/ObjectHash.c \ -$ROBUSTROOT/Runtime/garbage.c $ROBUSTROOT/Runtime/socket.c \ -$ROBUSTROOT/Runtime/math.c \ -$ROBUSTROOT/Runtime/GenericHashtable.c $ROBUSTROOT/Runtime/object.c" - -if $DSMFLAG -then -EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DCOMPILER -DDSTM -I$DSMRUNTIME" -if $TRANSSTATSFLAG -then -EXTRAOPTIONS="$EXTRAOPTIONS -lpthread -DTRANSSTATS -DCOMPILER -DDSTM -I$DSMRUNTIME" -fi -FILES="$FILES $DSMRUNTIME/trans.c $DSMRUNTIME/mcpileq.c $DSMRUNTIME/objstr.c $DSMRUNTIME/dstm.c $DSMRUNTIME/mlookup.c $DSMRUNTIME/clookup.c $DSMRUNTIME/llookup.c $DSMRUNTIME/threadnotify.c $DSMRUNTIME/dstmserver.c $DSMRUNTIME/plookup.c $DSMRUNTIME/ip.c $DSMRUNTIME/queue.c $DSMRUNTIME/prelookup.c $DSMRUNTIME/machinepile.c $DSMRUNTIME/localobjects.c $ROBUSTROOT/Runtime/thread.c $DSMRUNTIME/sockpool.c $DSMRUNTIME/addUdpEnhance.c $DSMRUNTIME/signal.c $DSMRUNTIME/gCollect.c $DSMRUNTIME/addPrefetchEnhance.c" -fi - -if $RECOVERFLAG -then -EXTRAOPTIONS="$EXTRAOPTIONS -DTASK" -if $MULTICOREFLAG -then -EXTRAOPTIONS="$EXTRAOPTIONS -DMULTICORE" -fi -FILES="$FILES tmpbuilddirectory/taskdefs.c $ROBUSTROOT/Runtime/checkpoint.c" -if $RAWFLAG -then -EXTRAOPTIONS="$EXTRAOPTIONS -DRAW" -fi -if $THREADSIMULATEFLAG -then -# -lpthread for pthread functions, -lrt for message queue functions -EXTRAOPTIONS="$EXTRAOPTIONS -DTHREADSIMULATE -lpthread -lrt" -fi -fi - -if $OPTIONALFLAG -then -EXTRAOPTIONS="$EXTRAOPTIONS -DOPTIONAL" -FILES="$FILES tmpbuilddirectory/optionalarrays.c" -fi - -if $THREADFLAG -then -FILES="$FILES $ROBUSTROOT/Runtime/thread.c" -fi - -if $CHECKFLAG -then -EXTRAOPTIONS="$EXTRAOPTIONS -DCONSCHECK $BUILDDIR/specdir/*.o" -INCLUDES="$INCLUDES -I$BUILDDIR/specdir" -fi - -if $USEDMALLOC -then -EXTRAOPTIONS="$EXTRAOPTIONS -ldmalloc -DDMALLOC" -fi - -if $MULTICOREFLAG -then -gcc $INCLUDES $EXTRAOPTIONS \ -tmpbuilddirectory/methods.c $FILES -lm -o $MAINFILE.bin -else -gcc $INCLUDES $EXTRAOPTIONS -DPRECISE_GC \ -tmpbuilddirectory/methods.c $FILES -lm -o $MAINFILE.bin -fi - -fi #!RAWFLAG - -exit - diff --git a/Robust/src/buildscripttask b/Robust/src/buildscripttask deleted file mode 100755 index fb2b4065..00000000 --- a/Robust/src/buildscripttask +++ /dev/null @@ -1,4 +0,0 @@ -#!/bin/bash -echo THIS FILE IS DEPRECATED. DO NOT USE IT. -./buildscript -recover -o $@ - diff --git a/Robust/src/buildscripttaskerror b/Robust/src/buildscripttaskerror deleted file mode 100755 index a4f0459e..00000000 --- a/Robust/src/buildscripttaskerror +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -echo THIS FILE IS DEPRECATED. DO NOT USE IT. -./buildscript -recover -debug -instructionfailures -o $@ diff --git a/Robust/src/designnotes b/Robust/src/designnotes deleted file mode 100644 index 404809f2..00000000 --- a/Robust/src/designnotes +++ /dev/null @@ -1,118 +0,0 @@ -Objects have: -Collection of Flags - Flags have type/name associated with them - Are either present or not present - -Assumptions: -Task parameters can't be modified - -How do we handle new object allocation? -Idea #1: Set flags at allocation - Only allow flag setting at exit for parameters - -Non parameter variables: -1) Type must contain flags -2) Apply flag additions to all states - -Tags operations: -create_tag operation(type) - -tag name=new tag(type); - -associate_with_tag operation(object, tag) - -Dispatch: -after flag status, allow tag status... -each tag state is of the form: Type(name) - -Other approach: -Tag sets: {x, y, z, ... in R - -Allow additions/removals of tuples in taskexit: -remove from R -add to R - -Allow addition of new tuples in object allocation -add to R ------------------------------------------------------------------------------- - - - - -Collection of Tags - Tags have type/name associated with them - Also have UID associated with them - Two basic types: - Ordered: Initial/Next / Preserves Sequencing - Non-ordered: New / Groups items together - ----------------------------------------------------------------------- -Tasks: -Have list of parameters w/ flag/tag specifications -Flag/Tag transitions at task exit ------------------------------------------------------------------------ -Problems: -How do we efficiently do task dispatch? - -Idea: -Flags - efficiently -Build static state transition diagram : explore full space for now -Then for each state transition we consider: -1) What task activations have we added -2) What task activations have we removed -Collapse state transition diagram to - - -Tags - search once we match a flag - - - -Input: -trigger role specification for tasks: -role mutator operation: -role definition: - -Generate: -Role transition diagram - - -Initial features: -methods -structs -type system - -Language features: -Single Inheritance -Virtual methods -Objects - -object metastate: -1. flags: flag role1 -2. tags: tag tag1 - -tag operations: -tag tag1=new tag; -tag tag2=incrementtag(tag tag1); -tag tag3=no tag; - -metastate operations: - -task foo(type1 o1{role1||role2}, type2 o2{role3}) { - - exit(o1{role1'=false},o2{role3'=false},onew{role4=true}); -} ----------------------------------------------------------------- ----------------------------------------------------------------- - -Initial design: ----------------------------------------------------------------- - -Provide runtime with: -1) List of tasks - a) Task names - b) Parameter types - c) Flag settings - -2) List of flags for each type - -3) Flag transition calls diff --git a/Robust/src/docs/schedulerdesign b/Robust/src/docs/schedulerdesign deleted file mode 100644 index deed8f48..00000000 --- a/Robust/src/docs/schedulerdesign +++ /dev/null @@ -1,32 +0,0 @@ -Basic design of scheduler: - -activetask: Queue of active tasks -failedtasks: Hashtable of failed task/parameter combinations -objectqueues: For each class we have a list of parameterwrapper objects - -1. ObjectQueues - -Each parameterwrapper object is a set of objects that can serve as a -specific parameter for a specific task. This set is stored in the -hashtable referenced by the objectset field. A reference to the -relevant taskdescriptor is stored in the task field. - -Each parameterwrapper object has an array of ints: intarray This array -contains numberofterms pairs of integere: i*2 and i*2+1. The first -integer in a pair contains an "and" mask of the flags that the task -cares about. The second integer in the pair contains the flag -settings. If the flag of an object matches any of these masks, then -the object should be placed in the object set. - -1.1 Objectsets - -Each objectset is implemented using a hashtable. If an object is in -the objectset, the objectset hashtable maps that object to either NULL -or the next objectset the object is a member of. - -1.2 - -Each object with a flag contains a flagptr field ((struct RuntimeHash -*) ptr)[2]. This field points to the first objectset hashtable that -the object is a member of. - diff --git a/Robust/src/docs/tagimplementation b/Robust/src/docs/tagimplementation deleted file mode 100644 index 3b15ab45..00000000 --- a/Robust/src/docs/tagimplementation +++ /dev/null @@ -1,20 +0,0 @@ -Example: -task test(Baz a {}{tag Foo x}, Bar b {}{tag Foo x, Tag Far y}) { -} - -Idea: Each parameter with a tag has its own queue and a hashtable that -is indexed by the tag - -When adding the object to the queue, the runtime: - -1) cycles through each tag of the appropriate type in that object and -index into the other queues for that tag - -2) if multiple objects have that tag, have to search each possible -one... - -3) if the parameter is specified to have a second tag, search through -each possible second tag - -Each flag object has tag pointer - it can either point to a tag object -or a list of tags... -- 2.34.1