├── .gitignore ├── Cargo.toml ├── LICENSE ├── README.md ├── doc ├── MasterThesis │ ├── Icons │ │ ├── UNI-Logo_Siegel_4c_115mm.pdf │ │ ├── background.pdf │ │ └── background_bcor.pdf │ ├── WissTemplate.cls │ ├── chapters │ │ ├── abstract.tex │ │ ├── approach.tex │ │ ├── cites.md │ │ ├── conclusion.tex │ │ ├── futureWork.tex │ │ ├── introduction.tex │ │ ├── notes.md │ │ ├── relatedWork.tex │ │ ├── result.tex │ │ └── titlepage.tex │ ├── listings-rust.sty │ ├── literature.bib │ ├── main.pdf │ ├── main.tex │ ├── pictures │ │ └── lola_output.png │ └── presentation │ │ ├── notes.md │ │ ├── presentation.pdf │ │ ├── presentation.tex │ │ └── unirostock │ │ ├── UNI-Logo_Siegel_4c_115mm.pdf │ │ ├── UNI-Logo_Siegel_4c_115mm.ps │ │ ├── beamercolorthemeRostock.sty │ │ ├── beamerfontthemeRostock.sty │ │ ├── beamerinnerthemeRostock.sty │ │ ├── beamerouterthemeRostock.sty │ │ ├── beamerthemeRostock.sty │ │ ├── title-auf.eps │ │ ├── title-auf.pdf │ │ ├── title-ief.eps │ │ ├── title-ief.pdf │ │ ├── title-inf.eps │ │ ├── title-inf.pdf │ │ ├── title-juf.eps │ │ ├── title-juf.pdf │ │ ├── title-mef.eps │ │ ├── title-mef.pdf │ │ ├── title-mnf.eps │ │ ├── title-mnf.pdf │ │ ├── title-msf.eps │ │ ├── title-msf.pdf │ │ ├── title-phf.eps │ │ ├── title-phf.pdf │ │ ├── title-thf.eps │ │ ├── title-thf.pdf │ │ ├── title-uni.eps │ │ ├── title-uni.pdf │ │ ├── title-wsf.eps │ │ └── title-wsf.pdf └── diagrams │ ├── BasicBlock.graphml │ ├── BasicBlock.png │ ├── BasickBlock.asciio │ ├── BasickBlock.txt │ ├── Function.graphml │ ├── Function.png │ ├── FunctionCallNet.graphml │ ├── FunctionCallNet.png │ ├── FunctionCallNetPruned.graphml │ ├── FunctionCallNetPruned.png │ ├── StatementsNet.graphml │ ├── StatementsNet.png │ ├── SwitchInt.graphml │ ├── SwitchInt.png │ ├── TerminatorsNet.graphml │ ├── TerminatorsNet.png │ ├── basic_blocks.graphml │ ├── basic_blocks.png │ ├── basic_program.graphml │ ├── basic_program.png │ ├── basic_program_new.graphml │ ├── basic_program_new.png │ ├── function_and_empty_program.graphml │ ├── function_and_empty_program.png │ ├── local.graphml │ ├── local.png │ ├── memoryAccess.graphml │ ├── memoryAccess.png │ ├── mutexNet.graphml │ ├── mutexNet.png │ ├── netExamples.graphml │ └── netExamples.png ├── rust-toolchain ├── scripts ├── analyze.py ├── lola.py └── run.py ├── src ├── init.rs ├── main.rs ├── petri_net │ ├── basic_block.rs │ ├── function.rs │ ├── intrinsics.rs │ ├── mod.rs │ ├── tests.rs │ ├── trait_impls.rs │ └── unique_functions.rs └── translator.rs └── tests ├── sample_programs ├── dining_philosophers.rs ├── function_call.rs ├── match.rs ├── minimal_deadlock.rs ├── minimal_nondeadlock.rs ├── minimal_program.rs ├── promoted.rs └── switch_int.rs └── test_programs.rs /.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by Cargo 2 | # will have compiled files and executables 3 | /target/ 4 | 5 | # Remove Cargo.lock from gitignore if creating an executable, leave it for libraries 6 | # More information here https://doc.rust-lang.org/cargo/guide/cargo-toml-vs-cargo-lock.html 7 | Cargo.lock 8 | 9 | # These are backup files generated by rustfmt 10 | **/*.rs.bk 11 | 12 | 13 | #Added by cargo 14 | # 15 | #already existing elements are commented out 16 | 17 | /target 18 | #**/*.rs.bk 19 | 20 | #latex 21 | *.aux 22 | *.out 23 | *.fls 24 | *.nlo 25 | *.gz 26 | *.toc 27 | *latexmk 28 | *.bbl 29 | *.blg 30 | *.log 31 | *.nav 32 | *.snm 33 | 34 | # specific 35 | .vscode/* 36 | *.pyc 37 | net.* 38 | pnml/pnml2lola/* 39 | neighbors.* 40 | 41 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "granite" 3 | version = "0.1.0" 4 | authors = ["\"tom\" <\"tom.meyer89@gmail.com\">"] 5 | edition = "2018" 6 | 7 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 8 | 9 | [dependencies] 10 | env_logger = "0.6.1" 11 | log = "0.4" 12 | xml-rs = "0.8" 13 | indexed_vec = "1.1.2" 14 | petri_to_star = { git = "https://github.com/Skasselbard/PetriToStar"} 15 | # petri_to_star = { path = "../PetriToStar"} 16 | clap = "2.33.0" 17 | 18 | [dev-dependencies] 19 | assert_cmd = "0.10" 20 | predicates = "1" -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Granite 2 | Find Deadlocks in Rust with Petri-Net Model checking. 3 | This project was startet as part of my masters thesis "[A Petri-Net Semantics for Rust](https://github.com/Skasselbard/Granite/blob/master/doc/MasterThesis/main.pdf)". 4 | 5 | - used rust nightly can be found in the [rust-toolchain file](https://doc.rust-lang.org/nightly/edition-guide/rust-2018/rustup-for-managing-rust-versions.html#managing-versions) 6 | - rustc-dev component is needed ``rustup toolchain install [nightly-x-y-z] --component rustc-dev`` 7 | - also the linker has to know about the lib folder from the sysroot fiting the toolchain. 8 | - some useful scripts can be found in the script folder. This includes: 9 | - an install script for the model checker LoLa 10 | - a run script that can translate programs from ``./tests/sample_programs`` 11 | - and a script that can analyse the output 12 | 13 | -------------------------------------------------------------------------------- /doc/MasterThesis/Icons/UNI-Logo_Siegel_4c_115mm.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skasselbard/Granite/fc87aad59869b641db7bdf0b506d8db1885fb046/doc/MasterThesis/Icons/UNI-Logo_Siegel_4c_115mm.pdf -------------------------------------------------------------------------------- /doc/MasterThesis/Icons/background.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skasselbard/Granite/fc87aad59869b641db7bdf0b506d8db1885fb046/doc/MasterThesis/Icons/background.pdf -------------------------------------------------------------------------------- /doc/MasterThesis/Icons/background_bcor.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skasselbard/Granite/fc87aad59869b641db7bdf0b506d8db1885fb046/doc/MasterThesis/Icons/background_bcor.pdf -------------------------------------------------------------------------------- /doc/MasterThesis/WissTemplate.cls: -------------------------------------------------------------------------------- 1 | \ProvidesClass{WissTemplate} 2 | \DeclareOption{ngerman}{ 3 | \PassOptionsToPackage{\CurrentOption}{babel} 4 | } 5 | \DeclareOption{english}{ 6 | \PassOptionsToPackage{\CurrentOption}{babel} 7 | } 8 | \DeclareOption{BCOR}{ 9 | \newcommand{\BCOR}{} 10 | } 11 | \DeclareOption*{\PassOptionsToClass{\CurrentOption}{scrbook}} 12 | \ProcessOptions\relax 13 | \LoadClass[12pt,a4paper,headsepline,bibliography=totoc,listof=totoc,oneside,fleqn,numbers=noenddot]{scrbook} 14 | 15 | 16 | 17 | \RequirePackage[utf8]{inputenc} 18 | %\usepackage[T1]{fontenc} 19 | \RequirePackage{lmodern} 20 | \RequirePackage{babel}%german 21 | %\usepackage[english]{babel}%english 22 | \RequirePackage{amsmath,amssymb,amsthm} 23 | \RequirePackage{graphicx} 24 | \RequirePackage{xcolor} %für Farbe 25 | \RequirePackage{empheq} %für Kästen um Formel ohne die Nummerierung mit im Rahmen zu haben ansonsten Paket framed angucken 26 | \RequirePackage{eurosym} 27 | \RequirePackage{listings} %Für code-Listings 28 | \RequirePackage{pbox} 29 | %\usepackage[]{algorithm2e} %Pseudocode 30 | \RequirePackage{algpseudocode} 31 | \RequirePackage[section]{algorithm} 32 | \RequirePackage{tikz} %Zum "malen" in latex 33 | \floatname{algorithm}{Algorithmus} 34 | %PDF Lesezeichen 35 | \RequirePackage[ 36 | bookmarksopen=true, 37 | colorlinks=true, 38 | linkcolor=black, 39 | anchorcolor=black, 40 | citecolor=black, 41 | filecolor=black, 42 | menucolor=black, 43 | urlcolor=black, 44 | plainpages=false, 45 | hypertexnames=false]{hyperref} 46 | 47 | \RequirePackage[automark]{scrpage2} 48 | \RequirePackage{nomencl} %Abkürzungen 49 | 50 | \RequirePackage{wallpaper} 51 | \RequirePackage{tcolorbox} 52 | \RequirePackage{layouts} 53 | \RequirePackage{tocloft} 54 | %Z Notation (see: http://fmt.cs.utwente.nl/courses/fmse/software/refcard.pdf for reference) 55 | %\usepackage{zed-csp} 56 | %für \llangle (doppeltes \langle) 57 | %\usepackage{MnSymbol} 58 | 59 | \RequirePackage{subcaption} %Mehrere Abbildungen in einer Abbildung 60 | \RequirePackage{blindtext} %lorem ipsum 61 | \RequirePackage{booktabs} %schönere Tabellen 62 | \RequirePackage{multirow} %Mehrere Zeilen einer Tabelle zusammenführen 63 | 64 | \newtheoremstyle{mydefinitionstyle}{}{}{\itshape}{}{\bfseries}{:}{ }{\thmname{#1}\thmnumber{ #2}\thmnote{ (#3)}} %Für Definitionen 65 | \newtheoremstyle{myexamplestyle}{}{}{}{}{\bfseries}{:}{ }{\thmname{#1}\thmnumber{ #2}\thmnote{ (#3)}} %Für Beispiele 66 | 67 | \theoremstyle{mydefinitionstyle} 68 | \newtheorem{definition}{Definition}[section] 69 | \theoremstyle{myexamplestyle} 70 | 71 | \iflanguage{english}{ 72 | \newtheorem{exmp}{Example}[section] 73 | } 74 | { 75 | \newtheorem{exmp}{Beispiel}[section] 76 | } 77 | 78 | \iflanguage{german}{ 79 | \renewcommand{\algorithmicrequire}{\textbf{Eingabe:}} 80 | \renewcommand{\algorithmicensure}{\textbf{Ausgabe:}} 81 | } 82 | %\renewcommand\thetheorem{\thechapter.\thesection.\arabic{exmp}} 83 | % BINDUNGSKOOREKTUR 84 | %\newcommand{\BCOR}{} %Für Bindungskorrektur auskommentieren 85 | \ifdefined\BCOR 86 | %Bindungskorrektur von ca. 1cm bei Hardcoverbindung 87 | \RequirePackage[left=1.233in,right=0.833in,top=0.97in,bottom=1.75in, includehead]{geometry} 88 | \else 89 | %Keine Bindungskorrektur 90 | \RequirePackage[left=1.033in,right=1.033in,top=0.97in,bottom=1.75in, includehead]{geometry} 91 | \fi 92 | % % % % % % % % % % % % % % 93 | % 94 | % NEW COMMANDS 95 | % 96 | % % % % % % % % % % % % % % 97 | 98 | 99 | \newcommand{\ol}{\overline} 100 | \newcommand{\name}{VORNAME NACHNAME} %Name für Titelseite und Erklärung 101 | \newcommand{\strasse}{STRASSE} 102 | \newcommand{\stadt}{PLZ ORT} 103 | \newcommand{\matrikel}{Matrikel-Nr.: 123456789} 104 | \newcommand{\course}{Informationstechnologie / Technische Informatik} 105 | \newcommand{\betreuer}{Prof. Dr.-Ing. Max Mustermann} 106 | \newcommand{\Titel}{Template für eine Studienarbeit} 107 | \newcommand{\Type}{Masterarbeit} %Bachelorarbeit, Projektarbeit, Literaturarbeit, etc. 108 | 109 | \newcommand{\bigand}{\bigwedge} 110 | \newcommand{\bigor}{\bigvee} 111 | \newcommand{\engl}[1]{{(engl. \textit{#1})}} 112 | % % % % % % % % % % % % % % 113 | % 114 | % SETTINGS 115 | % 116 | % % % % % % % % % % % % % % 117 | 118 | \let\abk\nomenclature 119 | % Deutsche Überschrift 120 | \iflanguage{english}{ 121 | \renewcommand{\nomname}{List of Abbreviations} 122 | } 123 | { 124 | \renewcommand{\nomname}{Abkürzungsverzeichnis} 125 | } 126 | % Abstand zw. Abkürzung und Bedeutung 127 | \setlength{\nomlabelwidth}{.30\textwidth} 128 | % Punkte zw. Abkürzung und Erklärung 129 | \renewcommand{\nomlabel}[1]{#1 \dotfill} 130 | \setlength{\nomitemsep}{-\parsep} 131 | \makenomenclature 132 | 133 | \setlength{\cftfigindent}{0em} 134 | \setlength{\cfttabindent}{0em} 135 | 136 | \captionsetup[subfigure]{labelformat=simple} 137 | \renewcommand\thesubfigure{(\alph{subfigure})} %Subfigures vernünftig in crossreferenzen anzeigen 138 | 139 | %GRAFIK PFAD 140 | %Pfade für Grafiken, mehrere Pfade können hinzugefügt werden 141 | \graphicspath{{./Figures/}} 142 | 143 | %listing settings 144 | \definecolor{mygreen}{rgb}{0,0.56,0} 145 | \definecolor{mygray}{rgb}{0.5,0.5,0.5} 146 | \definecolor{mymauve}{rgb}{0.58,0,0.82} 147 | 148 | \lstset{ % 149 | backgroundcolor=\color{white}, % choose the background color; you must add \usepackage{color} or \usepackage{xcolor} 150 | basicstyle=\footnotesize, % the size of the fonts that are used for the code 151 | breakatwhitespace=false, % sets if automatic breaks should only happen at whitespace 152 | breaklines=true, % sets automatic line breaking 153 | captionpos=b, % sets the caption-position to bottom 154 | commentstyle=\color{mygreen}, % comment style 155 | deletekeywords={...}, % if you want to delete keywords from the given language 156 | escapeinside={\%*}{*)}, % if you want to add LaTeX within your code 157 | extendedchars=true, % lets you use non-ASCII characters; for 8-bits encodings only, does not work with UTF-8 158 | frame=single, % adds a frame around the code 159 | keepspaces=true, % keeps spaces in text, useful for keeping indentation of code (possibly needs columns=flexible) 160 | keywordstyle=\bfseries\color{mymauve}, % keyword style 161 | language=Java, % the language of the code 162 | otherkeywords={String}, % if you want to add more keywords to the set 163 | numbers=left, % where to put the line-numbers; possible values are (none, left, right) 164 | numbersep=5pt, % how far the line-numbers are from the code 165 | numberstyle=\tiny\color{mygray}, % the style that is used for the line-numbers 166 | rulecolor=\color{black}, % if not set, the frame-color may be changed on line-breaks within not-black text (e.g. comments (green here)) 167 | showspaces=false, % show spaces everywhere adding particular underscores; it overrides 'showstringspaces' 168 | showstringspaces=false, % underline spaces within strings only 169 | showtabs=false, % show tabs within strings adding particular underscores 170 | stepnumber=2, % the step between two line-numbers. If it's 1, each line will be numbered 171 | stringstyle=\color{blue}, % string literal style 172 | tabsize=2, % sets default tabsize to 2 spaces 173 | identifierstyle=\color{blue}, 174 | title=\lstname % show the filename of files included with \lstinputlisting; also try caption instead of title 175 | } 176 | 177 | %Das ist das Uniblau 178 | \definecolor{uniblau}{HTML}{004A99} 179 | 180 | %tcolorbox 181 | \tcbuselibrary{skins} 182 | 183 | \setkomafont{captionlabel}{\usekomafont{descriptionlabel}} 184 | \setkomafont{disposition}{\color{uniblau}\bfseries\sffamily} 185 | 186 | \setcounter{secnumdepth}{3} %Nummerierungstiefe 187 | \setcounter{tocdepth}{2} %Anzeige im Table of contents 188 | 189 | \hypersetup{ 190 | pdftitle = {\Titel}, 191 | pdfauthor = {\name, \matrikel}, 192 | pdfsubject = {\Type betreut von \betreuer} 193 | } 194 | 195 | \clearscrheadfoot % alten Standardkram raus 196 | \ohead[\pagemark]{\pagemark} % oben rechts Seitenzahl laut Richtlinie 197 | \ihead{\headmark} % automatischen Kapitelnamen rein 198 | 199 | \pagestyle{scrheadings} -------------------------------------------------------------------------------- /doc/MasterThesis/chapters/abstract.tex: -------------------------------------------------------------------------------- 1 | % !TEX root = ../main.tex 2 | % TODO: Schau dir nochmal ein paar Paper abstracts an. 3 | % Du solltest vorher noch einen Satz zur Motivation schreiben. 4 | \section*{Eine Petrinetzsemantik für Rust} 5 | Es wird ein allgemeiner Ansatz gezeigt Rustprogramme in ein Petrinetzmodel zu überführen. 6 | Die Übersetzung eines Beispielprogramms wird als Eingabe in einem Model-Checker verwendet, um ein Deadlock zu finden, der durch mehrfaches blockieren eines Mutex verursacht wird. 7 | Ein Prototyp der Übersetzung ist in der Lage den Deadlock im Beispielprogramm zu finden und einen Zeugenpfad zu generieren. 8 | Anschließend werden einige Vorschläge zur Verbesserung der gezeigten Übersetzung diskutiert. 9 | 10 | \section*{A Petri-Net semantics for Rust} 11 | We show a general approach to translate a Rust program into a Petri-Net model. 12 | An example program is used as input for a model checker to find a contained deadlock. 13 | The deadlock is caused by locking a mutex multiple times. 14 | A prototype of our concept is able to find the deadlock from the example program and produces a witness path to the corresponding part of the translation. 15 | In the last part of this work we discuss how our approach can be improved further. 16 | 17 | \vfill 18 | 19 | \begin{tabular}{ll} 20 | \bfseries Betreuer: & \parbox[t]{10cm}{\betreuer }\vspace{5mm} \\ 21 | \bfseries Tag der Ausgabe: & 27.09.2019 \\ 22 | \bfseries Tag der Abgabe: & 13.03.2020 \\ 23 | \end{tabular} 24 | -------------------------------------------------------------------------------- /doc/MasterThesis/chapters/cites.md: -------------------------------------------------------------------------------- 1 | # Matsakis:2014:RL:2692956.2663188 2 | - Furthermore, Rust’s type system goes beyond that of the vast majority of safe languages in that it statically rules out data races (which are a of undefined behavior for concurrent programs in many languages like C++ or Rust), as well as common programming pitfalls like iterator invalidation 3 | - In its simplest form, the idea of ownership is that, although multiple aliases to a resource may exist simultaneously, performing certain actions on the resource (such as reading and writing a memory location) should require a "right" or "capability" that is uniquely "owned" by one alias at any point during the execution of the program. 4 | - [rust ownership] is enforceable automatically and eliminates a wide range of common low-level programming errors, such as "use after free", data races, and iterator invalidation. 5 | - Race conditions can only arise from an unrestricted combination 6 | of aliasing and mutation on the same location. In fact, it turns out that ruling out mutation of 7 | aliased data also prevents other errors commonplace in low-level pointer-manipulating programs, 8 | like use-after-free or double-free. -------------------------------------------------------------------------------- /doc/MasterThesis/chapters/conclusion.tex: -------------------------------------------------------------------------------- 1 | % !TEX root = ../main.tex 2 | \chapter{Related work} 3 | Rusts design principles strongly include memory safety and other safety properties. 4 | And there is an effort in the language community to formalize and proof these properties. 5 | A core part of Rusts memory management was modeled in a formalism named Patina by Reed\cite{reed2015patina} in 2015. 6 | Patinas statements satisfy memory safety properties like initialization before use or aliasing bounds for mutable memory. 7 | $\lambda_{Rust}$ by Jung et al.\cite{Jung:2017:RSF:3177123.3158154} extends safety statements to unsafe code (where the Rust borrow checker does not enforce its strong rules) and was verified to hold the formulated safety guarantees. 8 | Recently Jung et al. published another approach to minimize undefined behavior (where compiled code can be unpredictable due to different compiler implementations) in unsafe code. 9 | These are important approaches to proof the guarantees that the language claims to give. 10 | However, guarantees outside these boundaries have to be verified by other means. 11 | Besides regular methods like unit and integration tests there is a model checking effort by Toman et al. \cite{toman2015crust} to give further memory safety guarantees especially on unsafe code. 12 | 13 | Despite Petri-Net models are seemingly not used for verification of traditional programming languages, there was some effort to model general concurrent programs with the Basic Petri Net Programming Notation B(PN)$^2$ by Best et al. \cite{Best1993BPN2A}. 14 | They used multilabled nets (M-nets)\cite{best1995class}, a class of high-level Petri-Nets for their approach. 15 | Fleischhack et al. extended B(PN)$^2$ with procedures -- including recursion\cite{fleischhack1997petri}. 16 | There is also research on Petri-Net semantics for description languages like the commonly used Specification and Description Language (SDL)\cite{fleischhack1998compositional} (also based on M-nets) or the Business Process Execution Language for Web Services (BPEL)\cite{stahl2005petri}\cite{lohmann2007feature}. 17 | Both are used to verify properties of processes that are formulated in their description language. 18 | Also, the $\pi$-calculus is backed by a Petri-Net semantics\cite{busi1995petri} based on low-level Petri-Nets with inhibitor arcs (inhibitor arcs require the connected preplace to be empty to activate a transition). 19 | 20 | \chapter{Conclusion} 21 | \label{conclusion} 22 | The main goal of this work was finding a mapping from Rust programs to Petri-Nets. 23 | A translated net then was intended to be used in a model checker to find deadlocks. 24 | 25 | To reach that goal we searched for a suitable representation for Rust programs and developed a set of rules to translate that representation into Petri-Nets. 26 | We did this for the basic components and constructed a complete model out of that components. 27 | Because some important flow related information -- like blocking execution -- is hard to detect with our approach, we also added an emulation for Rust mutex locks. 28 | And finally we tested if a simple test program can be translated and verified with a model checker to find the expected deadlock. 29 | 30 | An analysis of our translation showed that our data model is very abstract and probably can be further improved. 31 | However, the model of program flow seems to be close to the execution semantics of Rust programs. 32 | Our test showed the expected behavior, but complex programs where not tested because the implementation does not cover all necessary features. 33 | Yet, the general approach seems to be applicable and can be refined further to deal with complex scenarios. 34 | -------------------------------------------------------------------------------- /doc/MasterThesis/chapters/futureWork.tex: -------------------------------------------------------------------------------- 1 | % !TEX root = ../main.tex 2 | \chapter{Future Work} 3 | \label{future} 4 | Although our approach produces Petri-Nets that are close to the Rust semantics, there is a lot of space to improve. 5 | First, necessary flow related properties have to be modeled or emulated. 6 | On the one hand a mechanism for splitting execution flow has to be integrated. 7 | Primarily that means appropriate handling of threads, most likely by emulating the functionality of spawning and joining them. 8 | In a Petri-Net that maps simply to a transition that produces a token on two separate places or consuming from two places respectively. 9 | On the other hand, the model for guarding critical sections has to be refined further. 10 | While the Petri-Net representation here is simple, a sound concept for the Rust side has to be found. 11 | Emulation of mutexes probably already catches a lot of scenarios but others can be found where this not suffice. 12 | For example low-level \textit{no\_std} environments where the mutexes from the standard library cannot be used. 13 | Additionally, the current implementation actively marks locals to distinguish between mutex instances while this probably can be inferred. 14 | 15 | The currently used data model can be improved as well. 16 | Data that moves between locals or moves into or out of structures is currently modeled independently for every local, which, in turn, masks its semantic connection. 17 | The movement might be modeled in a Petri-Net by separating the data from the local state. 18 | A move then indicates that the previous local cannot access the data anymore, quite similar to the Rust ownership model. 19 | If this can be done close to the Rust semantics, it might already fix the problem with marking mutexes. 20 | 21 | Given a solid model with a reasonable control flow emulation, more complex scenarios should be tested. 22 | This could include artificial ones like Dijkstras dining philosophers \cite{dijkstra1971hierarchical} or real life programs. 23 | Larger test cases would be critical to decide if the verification process is efficient enough to be used in authentic use cases. 24 | Test analysis would also improve from more sophisticated verification results. 25 | Currently, the witness path is only a chain of transition ids. 26 | But the MIR stores source-file-location-information that could be linked with the corresponding Petri-Net nodes. 27 | It is likely that this information can be used to map the witness path to the original program source code. 28 | This would improve usability a lot. 29 | 30 | Furthermore, a graph representation of the MIR might help in the development process for MIR generation. 31 | For example the missing storage statements we talked about in chapter \ref{results} left the initialized and dead place unconnected in the Petri-Net (which was excluded from the image). 32 | This is a graph property that can be verified and might indicate a bug. 33 | If more graph properties should be met by the MIR graph, they could be included into a test case to improve the compiler development process. 34 | 35 | And finally, lifting the model to high-level Petri-Nets could be a solution to some intrinsic shortcomings (like the recursion restriction) and open the door to data dependent verification properties. 36 | -------------------------------------------------------------------------------- /doc/MasterThesis/chapters/introduction.tex: -------------------------------------------------------------------------------- 1 | % !TEX root = ../main.tex 2 | \chapter{Introduction} 3 | \label{introduction} 4 | 5 | Here is a simple Rust\cite{klabnik2018rust} program that stops execution before it can terminate successfully: 6 | 7 | \lstset{language=Rust,caption={A deadlock!},label=deadlock_program, frame=none, stepnumber=5, backgroundcolor=\color{verylightgray}} 8 | \begin{lstlisting} 9 | use std::sync::{Arc, Mutex}; 10 | 11 | pub fn main() { 12 | let data = Arc::new(Mutex::new(0)); 13 | let _d1 = data.lock(); 14 | let _d2 = data.lock(); 15 | } 16 | \end{lstlisting} 17 | The reason is a deadlock caused by locking a mutex twice without releasing it in the meantime. 18 | Rust is a language that is highly concerned with memory safety and concurrency\cite{Matsakis:2014:RL:2692956.2663188} but the detection of deadlocks is explicitly excluded from the design\cite[Chapter 8.1]{nomicon}(for good reasons). 19 | Nevertheless, it could be invaluable to detect such a situation automatically. 20 | A proven method to do so is model checking\cite{baier2008principles} there we check a model of our program against certain properties. 21 | 22 | In this work we will: 23 | \begin{itemize} 24 | \item develop a Petri-Net\cite{petri1962kommunikation} semantics for Rust programs to serve as a model in chapter \ref{approach} (especially chapter \ref{app_trans}) , 25 | \item find a mutex semantics for our model in chapter \ref{emulation} 26 | \item detect the deadlock from listing \ref{deadlock_program} with a model checker in chapter \ref{results}, 27 | \item investigate the result and the shortcomings of our approach in chapter \ref{eval} 28 | \item and show a list of improvements that could lift our approach to be usable in realistic use cases in chapter \ref{future} 29 | \end{itemize} 30 | But first, we take a look on some important concepts in the next chapter. -------------------------------------------------------------------------------- /doc/MasterThesis/chapters/notes.md: -------------------------------------------------------------------------------- 1 | - landing pads: https://releases.llvm.org/7.0.0/docs/ExceptionHandling.html https://releases.llvm.org/7.0.0/docs/LangRef.html#i-landingpad 2 | - unwinding: https://doc.rust-lang.org/nomicon/unwinding.html 3 | - promoted: constants extracted from a function and lifted to static scope - https://rust-lang.github.io/rustc-guide/appendix/glossary.html?highlight=static#appendix-c-glossary 4 | - APALACHE TLA+ Model Checking https://blog.acolyer.org/2019/11/29/tla-model-checking-made-symbolic/ 5 | 6 | 7 | - deadlocks can be masked by unwinds 8 | - especially by arc around mutex 9 | - need unwind detection e.g: 10 | - remember unwind paths 11 | - check finishing transition to be a return (etc.) 12 | 13 | 14 | # Outline 15 | 16 | ## Abstract 17 | ## Introduction 18 | - motivation (maybe after rust) 19 | - what is rust 20 | - what are the important features 21 | - what is verification 22 | - difference to testing 23 | - different approaches (BDDs etc.) 24 | - use cases (parallel is good for petri nets) 25 | - what are deadlocks 26 | - synchronisation 27 | - mutex/semaphore 28 | - threads 29 | - dining philosophers 30 | - how can they be introduced in rust 31 | - rust and deadlocks -> considered safe code 32 | 33 | ## Approach 34 | - concrete approach of verification 35 | - typical: language -> formalism 36 | - petri nets 37 | - tools -> LoLa 38 | 39 | ## Related Work 40 | - other verification implementations 41 | - (verification by language?) 42 | - functional programming invariants? 43 | - prolog invariants? 44 | - languages with verification methods in its design? 45 | - c verification 46 | - valgrind? 47 | - rust verification 48 | - petri net verification 49 | - bpel 50 | 51 | ## Translation 52 | - a rustc introduction 53 | - petri net formalism and format (high level? edge descriptions) 54 | - mapping of rust features in petri nets -> where can we use rust features to improve the translation 55 | - at what layer the translation takes place and why (@mir) 56 | - explain mir 57 | - control-flow graphs 58 | - how to traverse 59 | - single elements 60 | - model of mutex/semaphore 61 | - a possible fitting petri net 62 | - how to deal with function calls 63 | - which parts can or must be excluded from translation 64 | - pre main 65 | - panics 66 | - missing mir parts 67 | - external libraries 68 | - intrinsics and platform specific behavior 69 | - std implementations 70 | - part between std::mutex and pthread mutex 71 | - joining the translations 72 | - joining basic elements 73 | - joining basic blocks 74 | - joining function calls 75 | - recursion limits 76 | - caching translations 77 | - lola integration (format of a petri net) 78 | - PNML 79 | 80 | ## Verification run with results? 81 | - expected deadlocks (expected program termination) 82 | - fitting formulas 83 | - exkurs in temporal logic 84 | - structure of results 85 | - examples 86 | - minimal deadlock 87 | - fixed minimal deadlock 88 | - deadlock with multiple threads 89 | - dining philosophers? 90 | - data dependent deadlock 91 | - maybe a real world example 92 | - some distributed system? 93 | - mqtt? 94 | - multiagent system? 95 | 96 | ## Conclusion 97 | 98 | ## Future Work -------------------------------------------------------------------------------- /doc/MasterThesis/chapters/result.tex: -------------------------------------------------------------------------------- 1 | \chapter{Test procedure} 2 | \label{results} 3 | After developing a translation concept, it is time to use it in practice. 4 | In this chapter we will discuss how to develop the deadlock property we want to check and the results of our verification run. 5 | Furthermore, we examine the used net representations and the test programs that were used in the development process. 6 | 7 | \section{Petri-Net Representation} 8 | \label{app_petri} 9 | Implementing a basic graph structure to represent our Petri-Net is not very difficult. 10 | But to be compatible with a Model checker we have to use some interface or a standard that 11 | defines a commonly known structure. 12 | Luckily there exists an XML-based standard for Petri-Nets called \textbf{Petri Net Markup Language}\cite{pnml}\cite{kindler2006petri} or \textbf{PNML}. 13 | However, LoLA -- the model checker that we actually used -- defines it own representation. 14 | And a third representation that comes in handy for visualization and debugging is \textbf{DOT}\cite{koutsofios1996drawing}, a simple language for graph definitions. 15 | All languages are comparable in their core idea. 16 | They all list nodes (places, transitions) and arcs of the graph. 17 | Additionally, the Petri-Net representations encode information for token count and arc weight. 18 | Since all the three representation serve their own purpose, they were all integrated as target representation in our prototype. 19 | 20 | \section{Model Checking} 21 | \label{app_mc} 22 | To test and inspect our results we have the choice between different tools. 23 | An inspiration of performant tools like TAPAAL\cite{tapaal}, ITS-tools\cite{its-tools} or LoLA\cite{lola}\cite{schmidt2000lola} can be found in the results of the `Model Checking Contest'\cite{mcc}. 24 | However, for a proof of concept it is not very important which model checker is used, since we will verify small test programs; 25 | Performance is not the biggest concern at this time. 26 | This is why LoLA was chosen by personal preference for this work. 27 | 28 | Having a model checker and a Rust program that is translated to a Petri-Net, the last thing we need is a property to check for. 29 | We want to search for deadlocks in the source program. 30 | That means that the program execution is blocked unexpectedly and no operation can be executed. 31 | This translates nicely to a dead Petri-Net where no transition is enabled and the net reached a final state. 32 | We have to be careful though: there are states where the Petri-Net is expectedly dead; 33 | Program termination is by definition a state there execution stops. 34 | This means that if we reach either the \textit{program end} or the \textit{panic end} place, our net is expected to be dead. 35 | To check for an unexpected deadlock we need to make sure that our termination places are not marked: $program\_end = 0\ \&\ panic = 0$. 36 | Additionally, the net has to be dead. 37 | In LoLA this is expressed with the keyword $DEADLOCK$. 38 | So the state we want to discover would be $\Phi=DEADLOCK\ \& (program\_end = 0\ \&\ panic = 0)$. 39 | The final part we have to consider is the temporal aspect. 40 | To specify that our state property holds eventually and to find an applicable path, we can use the operators $EF\varphi$ in combination. 41 | Its semantic is that the given property is satisfied in any of the successive paths at some point (or state). 42 | So our final formula would look like this: 43 | $$\Phi = EF(DEADLOCK\ \& (program\_end = 0\ \&\ panic = 0))$$ 44 | 45 | \section{Test Programs} 46 | \label{app_test} 47 | If we want to get some confidence in our translation process we have to see if it behaves as expected. 48 | Initially, the basic functionality should be tested against the simplest programs to fail early. 49 | And what could be simpler than the empty program from listing \ref{empty-program}? 50 | Beside giving a good starting point for a testable implementation, the fact that all terminating programs have a deadlock should also get obvious here at the latest! 51 | 52 | Other programs that can strengthen the confidence in the translation process include some important language features, like our simple function call from listing \ref{function_call_program} or an endless program (which actually is completely deadlock free): 53 | \lstset{language=Rust,caption={An endless program},label=endless-program, frame=none, stepnumber=5, backgroundcolor=\color{verylightgray}} 54 | 55 | \begin{lstlisting} 56 | pub fn main() -> ! { 57 | loop {} 58 | } 59 | \end{lstlisting} 60 | However, non of these programs are significant for what we really want to achieve: deadlock detection. 61 | For this, we use our very first example program from listing \ref{deadlock_program}. 62 | If our Petri-Net model is worth something the model checker should detect a deadlock for this program and none if we remove the last line (lock the mutex only once). 63 | 64 | \section{Translation target} 65 | \begin{figure} 66 | \centering 67 | \includegraphics[width=0.9\textwidth]{../diagrams/FunctionCallNet.png} 68 | \caption{Translated Petri-Net} 69 | \label{function_call_net} 70 | \end{figure} 71 | In figure \ref{function_call_net} we can see the generated net for the function call program from listing \ref{function_call_program} (since this is small enough to show and big enough to not be trivial). 72 | This is the true data that was produced for the dot target, so we cannot immediately see the virtual boundaries for statements basic blocks and functions. 73 | To make the structure more clear the nodes where rearranged so that the called function is on the left and the main function on the right. 74 | The initialized places of the locals where renamed to show their MIR name (locals are scoped by functions so their names are not unique). 75 | 76 | We can see a path from program start to program end; 77 | The panic place is unconnected because the program cannot panic. 78 | Local life cycles are also visible as a single edged path from marked uninitialized place to unmarked dead places. 79 | In contrast, variable manipulation always has parallel incoming and outgoing edges. 80 | On a closer look we can see that local $\_3$ of the called function has no storage live or storage dead statements. 81 | This is actually a correct representation of the MIR graph: 82 | for some reason the storage statements are not generated for some lvalues (in this case the lvalue from checked multiplications). 83 | If this is expected behavior is not known at the time of writing; 84 | A bug report\footnote{https://github.com/rust-lang/rust/issues/67400} has yet to be solved. 85 | Unfortunately this behavior introduces an unintended deadlock into our translation since depending transitions can only fire if the initialized places where previously marked. 86 | To use the net for verification we have to work around this issue until it is fixed (or until the cause is modeled correctly). 87 | To be able to continue testing, simply all \textit{initialized} places where marked as well. 88 | This way the involved transitions can fire, but only if the previous statement produced a token on the connecting place (the program counter place). 89 | But now, an additional token will remain on all other initialized places even after the storage dead transition fired. 90 | However, execution flow, again, will not be affected because of the program counter places. 91 | 92 | A second detail that the net shows is that the function call transition is implicit; 93 | The last statement of the main functions first basic block (\textit{StorageLive(\_3)}), is directly connected to the first statement of the callees first basic block (\textit{Assign(\_3, \_1)}). 94 | This is an implementation detail of the translator. 95 | Since our model currently always inlines function calls (it generates a separate net for every call), these are entirely sequential. 96 | That means a missing transition does not harm. 97 | If previously translated functions shall be reused though, this issue needs rework. 98 | But to be able to skip inlining we need high level semantics anyway. 99 | 100 | An additional issue that can come to attention is the missing cleanup path of the assert terminator. 101 | This is the path that would lead to a panic. 102 | Logically the assert is inserted because the preceding checked multiplication can overflow, which is undefined behavior and by default should panic in Rust semantics. 103 | This particular program cannot fail at this point, since the involved variables are constant and small enough to be multiplied. 104 | If this is the reason why the panic path is not generated (or optimized away) in the MIR representation however, shall be a question for the Rust compiler team. 105 | 106 | \section{Verification results} 107 | \begin{figure} 108 | \centering 109 | \includegraphics[width=1\textwidth]{./pictures/lola_output.png} 110 | \caption{LoLA output} 111 | \label{lola_output} 112 | \end{figure} 113 | Of course we want to use our translation further for verification. 114 | Using our formula on the deadlock program from listing \ref{deadlock_program}, LoLA does find a deadlock and can produce a witness path as shown in figure \ref{lola_output}. 115 | In contrast, if we remove the last line of the program, no deadlock is detected. 116 | Following the witness path in the deadlock case, does indeed lead to the transitions that are involved in the mutex emulation (the mutex place is empty causing involved transitions to be dead). 117 | Earlier tests have also shown that the mutex emulation discussed in chapter \ref{emulation} is necessary to produce deadlocks. 118 | Without the information on where and how execution should be blocked, the translation process cannot infer this behavior. 119 | This is a general problem for blocking behavior by external cause. 120 | 121 | At this point it might be adequate to add that active waiting (looping until a guard has an expected value) is not a deadlock and also would not be detected with this approach. 122 | However, it is likely that another formula can be found, to verify that leaving the waiting section is always possible. 123 | But again this most likely would require to consider the values that variables can hold and therefore high-level semantics. 124 | 125 | \chapter{Evaluation} 126 | \label{eval} 127 | The results show that our basic approach can be used to verify some basic properties. 128 | And even though the state of the translation is nowhere near productive use there are some lessons learned that we can discuss. 129 | \section{The Model} 130 | The main draw back that followed us for the entire process is the abstraction of data in low-level Petri-Nets. 131 | Advantages of the low-level model are not only the reduced complexity and higher verification performance, it can also produce stricter assertions. 132 | Additionally, our particular model most likely can exploit a Petri-Net property called safety: 133 | if we overlook the workaround for compensating the missing storage-statements, the token count on every place cannot exceed a maximum of one. 134 | One obvious use for that property is the state encoding for every place, which can be done with a single bit this way. 135 | This might be helpful for very large programs with lots of places. 136 | 137 | The greatest disadvantage of low level Petri-Nets is the reduced expressiveness of data. 138 | While flow related properties are easy to model with simple tokens, as soon as we enter the realm of data related properties, we have to make compromises. 139 | The approach we took models every interaction with data, but we cannot facilitate their set of possible values for verification tasks. 140 | Another problem is that no moving data is modeled. 141 | If a previously initialized local moves into another local (like a field of a struct), we completely loose this information in our translation. 142 | Although, we can probably exploit Rusts strict borrow checking and aliasing rules to model a much closer relation between data, 143 | both locals are generated independently with their own places and life cycle. 144 | An improvement for a move of a value from one local to another (which is encoded in MIR with a keyword), could be to connect the places with a transition right away. 145 | 146 | Another disadvantage of our current model is function inlining. 147 | If a program calls the same function at different places, a separate instance will be inserted at every call site. 148 | This not only makes the net larger, it catches the translation process in an endless loop in recursive functions. 149 | 150 | A solution for most of these problems might be high-level Petri-Nets where we can model data verbosely. 151 | With them we could properly model data and detach function calls from the call site. 152 | Only the cost for verification performance remains unknown at the moment. 153 | Some problems, on the other hand, cannot be solved this way. 154 | For example, program parts that are not represented by MIR (like foreign functions and compiler intrinsics) cannot be translated and have to be emulated. 155 | Also, information on blocking behavior is needed to model deadlocks appropriately. 156 | For mutexes we again worked around this issue with emulation. 157 | Additional blocking functionality (like waiting threads) have to be emulated separately. 158 | 159 | \section{Verification} 160 | The ability to discover deadlocks is already a useful property for model checking. 161 | But our model is not restricted to this single property. 162 | An easy addition is to check if the panic state is reachable. 163 | Unfortunately virtually every program with a realistic size can panic. 164 | So this property is of limited use unless variable data can be respected. 165 | However, more complex properties could deal with conditional reachability. 166 | For example if a function can be reached from a particular program state. 167 | Or if every execution of a program eventually visits a function or statement. 168 | But then again, our statements would be much stronger if we could consider data values. 169 | -------------------------------------------------------------------------------- /doc/MasterThesis/chapters/titlepage.tex: -------------------------------------------------------------------------------- 1 | \hypersetup{ 2 | pdftitle = {\Titel}, 3 | pdfauthor = {\name, \matrikel}, 4 | pdfsubject = {\Type betreut von \betreuer} 5 | } 6 | 7 | \begin{titlepage} 8 | \newlength{\BCORoffset} 9 | \ifdefined\BCOR 10 | \setlength{\BCORoffset}{0.5cm} 11 | \else 12 | \setlength{\BCORoffset}{0cm} 13 | \fi 14 | \linespread{1.2} % 1,5facher Zeilenabstand 15 | \begin{tikzpicture}[remember picture,overlay, anchor = west] 16 | 17 | \coordinate (d) at ([yshift=-6cm, xshift=-2cm+\BCORoffset] current page.north east); 18 | \coordinate (c) at ([yshift=-6cm, xshift=2cm+\BCORoffset] current page.north west); 19 | \coordinate (b) at ([yshift=2.25cm, xshift=-2cm+\BCORoffset] current page.south east); 20 | \coordinate (a) at ([yshift=2.25cm, xshift=2cm+\BCORoffset] current page.south west); 21 | \coordinate (middle) at ([yshift=-6cm, xshift=\paperwidth/2+\BCORoffset] current page.north west); 22 | \draw[line width=2,rounded corners=10pt,uniblau] (a) -- (c) -- (d) -- (b); 23 | 24 | \node[anchor=west,inner sep=0,outer sep=0] (logo) at ([yshift=-3cm, xshift=2cm+\BCORoffset] current page.north west) { 25 | \includegraphics[width=115mm]{Icons/UNI-Logo_Siegel_4c_115mm} 26 | }; 27 | 28 | \node[fill=uniblau,draw=uniblau,line width=2,anchor=north,minimum height=2.25cm, minimum width=\paperwidth-4cm,text=white,font=\small,text width=\paperwidth-4.5cm] (names) 29 | at ([yshift=2.25cm,xshift=\BCORoffset]current page.south) { 30 | UNIVERSITÄT ROSTOCK \textbar \ FAKULTÄT FÜR INFORMATIK UND ELEKTROTECHNIK\\ 31 | Lehrstuhl für Theoretische Informatik\\ 32 | Albert-Einstein-Straße 22, 18059 Rostock \textbar \ Tel: +49 381 498 7641 33 | }; 34 | 35 | \node[font=\Huge\bfseries,anchor=center,] (typenode) at ([yshift=-3cm] middle) {\Type}; 36 | 37 | \node[font=\LARGE\bfseries,anchor=center,] (titelnode) at ([yshift=-2.5cm] typenode) {\Titel}; 38 | 39 | \node[font=\large,anchor=center,text width=\paperwidth-4.5cm,align=center] (authornode) at ([yshift=-3.5cm] titelnode) { 40 | \textsc{Vorgelegt von}:\\ \bfseries\name\\\mdseries \textsc{\matrikel} 41 | }; 42 | 43 | \node[font=\large,anchor=center,text width=\paperwidth-4.5cm,align=center] (abgabenode) at ([yshift=-4.5cm] authornode) { 44 | \textsc{Eingereicht am:}\\ 13. März 2020 45 | }; 46 | 47 | \node[font=\large,anchor=center,text width=\paperwidth-4.5cm,align=center] (supervisornode) at ([yshift=-4.0cm] abgabenode) { 48 | \textsc{Betreuer:}\\\betreuer 49 | }; 50 | \end{tikzpicture} 51 | \end{titlepage} 52 | \restoregeometry 53 | -------------------------------------------------------------------------------- /doc/MasterThesis/listings-rust.sty: -------------------------------------------------------------------------------- 1 | 2 | \NeedsTeXFormat{LaTeX2e}[1994/06/01] 3 | \ProvidesPackage{listings-rust}[2018/01/23 Custom Package] 4 | 5 | \RequirePackage{color} 6 | \RequirePackage{listings} 7 | 8 | \lstdefinelanguage{Rust}{% 9 | sensitive% 10 | , morecomment=[l]{//}% 11 | , morecomment=[s]{/*}{*/}% 12 | , moredelim=[s][{\itshape\color[rgb]{0,0,0.75}}]{\#[}{]}% 13 | , morestring=[b]{"}% 14 | , alsodigit={}% 15 | , alsoother={}% 16 | , alsoletter={!}% 17 | % 18 | % 19 | % [1] reserve keywords 20 | % [2] traits 21 | % [3] primitive types 22 | % [4] type and value constructors 23 | % [5] identifier 24 | % 25 | , morekeywords={break, continue, else, for, if, in, loop, match, return, while} % control flow keywords 26 | , morekeywords={as, const, let, move, mut, ref, static} % in the context of variables 27 | , morekeywords={dyn, enum, fn, impl, Self, self, struct, trait, type, union, use, where} % in the context of declarations 28 | , morekeywords={crate, extern, mod, pub, super} % in the context of modularisation 29 | , morekeywords={unsafe} % markers 30 | , morekeywords={abstract, alignof, become, box, do, final, macro, offsetof, override, priv, proc, pure, sizeof, typeof, unsized, virtual, yield} % reserved identifiers 31 | % 32 | % grep 'pub trait [A-Za-z][A-Za-z0-9]*' -r . | sed 's/^.*pub trait \([A-Za-z][A-Za-z0-9]*\).*/\1/g' | sort -u | tr '\n' ',' | sed 's/^\(.*\),$/{\1}\n/g' | sed 's/,/, /g' 33 | , morekeywords=[2]{Add, AddAssign, Any, AsciiExt, AsInner, AsInnerMut, AsMut, AsRawFd, AsRawHandle, AsRawSocket, AsRef, Binary, BitAnd, BitAndAssign, Bitor, BitOr, BitOrAssign, BitXor, BitXorAssign, Borrow, BorrowMut, Boxed, BoxPlace, BufRead, BuildHasher, CastInto, CharExt, Clone, CoerceUnsized, CommandExt, Copy, Debug, DecodableFloat, Default, Deref, DerefMut, DirBuilderExt, DirEntryExt, Display, Div, DivAssign, DoubleEndedIterator, DoubleEndedSearcher, Drop, EnvKey, Eq, Error, ExactSizeIterator, ExitStatusExt, Extend, FileExt, FileTypeExt, Float, Fn, FnBox, FnMut, FnOnce, Freeze, From, FromInner, FromIterator, FromRawFd, FromRawHandle, FromRawSocket, FromStr, FullOps, FusedIterator, Generator, Hash, Hasher, Index, IndexMut, InPlace, Int, Into, IntoCow, IntoInner, IntoIterator, IntoRawFd, IntoRawHandle, IntoRawSocket, IsMinusOne, IsZero, Iterator, JoinHandleExt, LargeInt, LowerExp, LowerHex, MetadataExt, Mul, MulAssign, Neg, Not, Octal, OpenOptionsExt, Ord, OsStrExt, OsStringExt, Packet, PartialEq, PartialOrd, Pattern, PermissionsExt, Place, Placer, Pointer, Product, Put, RangeArgument, RawFloat, Read, Rem, RemAssign, Seek, Shl, ShlAssign, Shr, ShrAssign, Sized, SliceConcatExt, SliceExt, SliceIndex, Stats, Step, StrExt, Sub, SubAssign, Sum, Sync, TDynBenchFn, Terminal, Termination, ToOwned, ToSocketAddrs, ToString, Try, TryFrom, TryInto, UnicodeStr, Unsize, UpperExp, UpperHex, WideInt, Write} 34 | , morekeywords=[2]{Send} % additional traits 35 | % 36 | , morekeywords=[3]{bool, char, f32, f64, i8, i16, i32, i64, isize, str, u8, u16, u32, u64, unit, usize, i128, u128} % primitive types 37 | % 38 | , morekeywords=[4]{Err, false, None, Ok, Some, true} % prelude value constructors 39 | % grep 'pub \(type\|struct\|enum\) [A-Za-z][A-Za-z0-9]*' -r . | sed 's/^.*pub \(type\|struct\|enum\) \([A-Za-z][A-Za-z0-9]*\).*/\2/g' | sort -u | tr '\n' ',' | sed 's/^\(.*\),$/{\1}\n/g' | sed 's/,/, /g' 40 | , morekeywords=[3]{AccessError, Adddf3, AddI128, AddoI128, AddoU128, ADDRESS, ADDRESS64, addrinfo, ADDRINFOA, AddrParseError, Addsf3, AddU128, advice, aiocb, Alignment, AllocErr, AnonPipe, Answer, Arc, Args, ArgsInnerDebug, ArgsOs, Argument, Arguments, ArgumentV1, Ashldi3, Ashlti3, Ashrdi3, Ashrti3, AssertParamIsClone, AssertParamIsCopy, AssertParamIsEq, AssertUnwindSafe, AtomicBool, AtomicPtr, Attr, auxtype, auxv, BackPlace, BacktraceContext, Barrier, BarrierWaitResult, Bencher, BenchMode, BenchSamples, BinaryHeap, BinaryHeapPlace, blkcnt, blkcnt64, blksize, BOOL, boolean, BOOLEAN, BoolTrie, BorrowError, BorrowMutError, Bound, Box, bpf, BTreeMap, BTreeSet, Bucket, BucketState, Buf, BufReader, BufWriter, Builder, BuildHasherDefault, BY, BYTE, Bytes, CannotReallocInPlace, cc, Cell, Chain, CHAR, CharIndices, CharPredicateSearcher, Chars, CharSearcher, CharsError, CharSliceSearcher, CharTryFromError, Child, ChildPipes, ChildStderr, ChildStdin, ChildStdio, ChildStdout, Chunks, ChunksMut, ciovec, clock, clockid, Cloned, cmsgcred, cmsghdr, CodePoint, Color, ColorConfig, Command, CommandEnv, Component, Components, CONDITION, condvar, Condvar, CONSOLE, CONTEXT, Count, Cow, cpu, CRITICAL, CStr, CString, CStringArray, Cursor, Cycle, CycleIter, daddr, DebugList, DebugMap, DebugSet, DebugStruct, DebugTuple, Decimal, Decoded, DecodeUtf16, DecodeUtf16Error, DecodeUtf8, DefaultEnvKey, DefaultHasher, dev, device, Difference, Digit32, DIR, DirBuilder, dircookie, dirent, dirent64, DirEntry, Discriminant, DISPATCHER, Display, Divdf3, Divdi3, Divmoddi4, Divmodsi4, Divsf3, Divsi3, Divti3, dl, Dl, Dlmalloc, Dns, DnsAnswer, DnsQuery, dqblk, Drain, DrainFilter, Dtor, Duration, DwarfReader, DWORD, DWORDLONG, DynamicLibrary, Edge, EHAction, EHContext, Elf32, Elf64, Empty, EmptyBucket, EncodeUtf16, EncodeWide, Entry, EntryPlace, Enumerate, Env, epoll, errno, Error, ErrorKind, EscapeDebug, EscapeDefault, EscapeUnicode, event, Event, eventrwflags, eventtype, ExactChunks, ExactChunksMut, EXCEPTION, Excess, ExchangeHeapSingleton, exit, exitcode, ExitStatus, Failure, fd, fdflags, fdsflags, fdstat, ff, fflags, File, FILE, FileAttr, filedelta, FileDesc, FilePermissions, filesize, filestat, FILETIME, filetype, FileType, Filter, FilterMap, Fixdfdi, Fixdfsi, Fixdfti, Fixsfdi, Fixsfsi, Fixsfti, Fixunsdfdi, Fixunsdfsi, Fixunsdfti, Fixunssfdi, Fixunssfsi, Fixunssfti, Flag, FlatMap, Floatdidf, FLOATING, Floatsidf, Floatsisf, Floattidf, Floattisf, Floatundidf, Floatunsidf, Floatunsisf, Floatuntidf, Floatuntisf, flock, ForceResult, FormatSpec, Formatted, Formatter, Fp, FpCategory, fpos, fpos64, fpreg, fpregset, FPUControlWord, Frame, FromBytesWithNulError, FromUtf16Error, FromUtf8Error, FrontPlace, fsblkcnt, fsfilcnt, fsflags, fsid, fstore, fsword, FullBucket, FullBucketMut, FullDecoded, Fuse, GapThenFull, GeneratorState, gid, glob, glob64, GlobalDlmalloc, greg, group, GROUP, Guard, GUID, Handle, HANDLE, Handler, HashMap, HashSet, Heap, HINSTANCE, HMODULE, hostent, HRESULT, id, idtype, if, ifaddrs, IMAGEHLP, Immut, in, in6, Incoming, Infallible, Initializer, ino, ino64, inode, input, InsertResult, Inspect, Instant, int16, int32, int64, int8, integer, IntermediateBox, Internal, Intersection, intmax, IntoInnerError, IntoIter, IntoStringError, intptr, InvalidSequence, iovec, ip, IpAddr, ipc, Ipv4Addr, ipv6, Ipv6Addr, Ipv6MulticastScope, Iter, IterMut, itimerspec, itimerval, jail, JoinHandle, JoinPathsError, KDHELP64, kevent, kevent64, key, Key, Keys, KV, l4, LARGE, lastlog, launchpad, Layout, Lazy, lconv, Leaf, LeafOrInternal, Lines, LinesAny, LineWriter, linger, linkcount, LinkedList, load, locale, LocalKey, LocalKeyState, Location, lock, LockResult, loff, LONG, lookup, lookupflags, LookupHost, LPBOOL, LPBY, LPBYTE, LPCSTR, LPCVOID, LPCWSTR, LPDWORD, LPFILETIME, LPHANDLE, LPOVERLAPPED, LPPROCESS, LPPROGRESS, LPSECURITY, LPSTARTUPINFO, LPSTR, LPVOID, LPWCH, LPWIN32, LPWSADATA, LPWSAPROTOCOL, LPWSTR, Lshrdi3, Lshrti3, lwpid, M128A, mach, major, Map, mcontext, Metadata, Metric, MetricMap, mflags, minor, mmsghdr, Moddi3, mode, Modsi3, Modti3, MonitorMsg, MOUNT, mprot, mq, mqd, msflags, msghdr, msginfo, msglen, msgqnum, msqid, Muldf3, Mulodi4, Mulosi4, Muloti4, Mulsf3, Multi3, Mut, Mutex, MutexGuard, MyCollection, n16, NamePadding, NativeLibBoilerplate, nfds, nl, nlink, NodeRef, NoneError, NonNull, NonZero, nthreads, NulError, OccupiedEntry, off, off64, oflags, Once, OnceState, OpenOptions, Option, Options, OptRes, Ordering, OsStr, OsString, Output, OVERLAPPED, Owned, Packet, PanicInfo, Param, ParseBoolError, ParseCharError, ParseError, ParseFloatError, ParseIntError, ParseResult, Part, passwd, Path, PathBuf, PCONDITION, PCONSOLE, Peekable, PeekMut, Permissions, PhantomData, pid, Pipes, PlaceBack, PlaceFront, PLARGE, PoisonError, pollfd, PopResult, port, Position, Powidf2, Powisf2, Prefix, PrefixComponent, PrintFormat, proc, Process, PROCESS, processentry, protoent, PSRWLOCK, pthread, ptr, ptrdiff, PVECTORED, Queue, radvisory, RandomState, Range, RangeFrom, RangeFull, RangeInclusive, RangeMut, RangeTo, RangeToInclusive, RawBucket, RawFd, RawHandle, RawPthread, RawSocket, RawTable, RawVec, Rc, ReadDir, Receiver, recv, RecvError, RecvTimeoutError, ReentrantMutex, ReentrantMutexGuard, Ref, RefCell, RefMut, REPARSE, Repeat, Result, Rev, Reverse, riflags, rights, rlim, rlim64, rlimit, rlimit64, roflags, Root, RSplit, RSplitMut, RSplitN, RSplitNMut, RUNTIME, rusage, RwLock, RWLock, RwLockReadGuard, RwLockWriteGuard, sa, SafeHash, Scan, sched, scope, sdflags, SearchResult, SearchStep, SECURITY, SeekFrom, segment, Select, SelectionResult, sem, sembuf, send, Sender, SendError, servent, sf, Shared, shmatt, shmid, ShortReader, ShouldPanic, Shutdown, siflags, sigaction, SigAction, sigevent, sighandler, siginfo, Sign, signal, signalfd, SignalToken, sigset, sigval, Sink, SipHasher, SipHasher13, SipHasher24, size, SIZE, Skip, SkipWhile, Slice, SmallBoolTrie, sockaddr, SOCKADDR, sockcred, Socket, SOCKET, SocketAddr, SocketAddrV4, SocketAddrV6, socklen, speed, Splice, Split, SplitMut, SplitN, SplitNMut, SplitPaths, SplitWhitespace, spwd, SRWLOCK, ssize, stack, STACKFRAME64, StartResult, STARTUPINFO, stat, Stat, stat64, statfs, statfs64, StaticKey, statvfs, StatVfs, statvfs64, Stderr, StderrLock, StderrTerminal, Stdin, StdinLock, Stdio, StdioPipes, Stdout, StdoutLock, StdoutTerminal, StepBy, String, StripPrefixError, StrSearcher, subclockflags, Subdf3, SubI128, SuboI128, SuboU128, subrwflags, subscription, Subsf3, SubU128, Summary, suseconds, SYMBOL, SYMBOLIC, SymmetricDifference, SyncSender, sysinfo, System, SystemTime, SystemTimeError, Take, TakeWhile, tcb, tcflag, TcpListener, TcpStream, TempDir, TermInfo, TerminfoTerminal, termios, termios2, TestDesc, TestDescAndFn, TestEvent, TestFn, TestName, TestOpts, TestResult, Thread, threadattr, threadentry, ThreadId, tid, time, time64, timespec, TimeSpec, timestamp, timeval, timeval32, timezone, tm, tms, ToLowercase, ToUppercase, TraitObject, TryFromIntError, TryFromSliceError, TryIter, TryLockError, TryLockResult, TryRecvError, TrySendError, TypeId, U64x2, ucontext, ucred, Udivdi3, Udivmoddi4, Udivmodsi4, Udivmodti4, Udivsi3, Udivti3, UdpSocket, uid, UINT, uint16, uint32, uint64, uint8, uintmax, uintptr, ulflags, ULONG, ULONGLONG, Umoddi3, Umodsi3, Umodti3, UnicodeVersion, Union, Unique, UnixDatagram, UnixListener, UnixStream, Unpacked, UnsafeCell, UNWIND, UpgradeResult, useconds, user, userdata, USHORT, Utf16Encoder, Utf8Error, Utf8Lossy, Utf8LossyChunk, Utf8LossyChunksIter, utimbuf, utmp, utmpx, utsname, uuid, VacantEntry, Values, ValuesMut, VarError, Variables, Vars, VarsOs, Vec, VecDeque, vm, Void, WaitTimeoutResult, WaitToken, wchar, WCHAR, Weak, whence, WIN32, WinConsole, Windows, WindowsEnvKey, winsize, WORD, Wrapping, wrlen, WSADATA, WSAPROTOCOL, WSAPROTOCOLCHAIN, Wtf8, Wtf8Buf, Wtf8CodePoints, xsw, xucred, Zip, zx} 41 | % 42 | , morekeywords=[5]{assert!, assert_eq!, assert_ne!, cfg!, column!, compile_error!, concat!, concat_idents!, debug_assert!, debug_assert_eq!, debug_assert_ne!, env!, eprint!, eprintln!, file!, format!, format_args!, include!, include_bytes!, include_str!, line!, module_path!, option_env!, panic!, print!, println!, select!, stringify!, thread_local!, try!, unimplemented!, unreachable!, vec!, write!, writeln!} % prelude macros 43 | }% 44 | 45 | \lstdefinestyle{colouredRust}% 46 | { basicstyle=\ttfamily% 47 | , identifierstyle=% 48 | , commentstyle=\color[gray]{0.4}% 49 | , stringstyle=\color[rgb]{0, 0, 0.5}% 50 | , keywordstyle=\bfseries% reserved keywords 51 | , keywordstyle=[2]\color[rgb]{0.75, 0, 0}% traits 52 | , keywordstyle=[3]\color[rgb]{0, 0.5, 0}% primitive types 53 | , keywordstyle=[4]\color[rgb]{0, 0.5, 0}% type and value constructors 54 | , keywordstyle=[5]\color[rgb]{0, 0, 0.75}% macros 55 | , columns=spaceflexible% 56 | , keepspaces=true% 57 | , showspaces=false% 58 | , showtabs=false% 59 | , showstringspaces=true% 60 | }% 61 | 62 | \lstdefinestyle{boxed}{ 63 | style=colouredRust% 64 | , numbers=left% 65 | , firstnumber=auto% 66 | , numberblanklines=true% 67 | , frame=trbL% 68 | , numberstyle=\tiny% 69 | , frame=leftline% 70 | , numbersep=7pt% 71 | , framesep=5pt% 72 | , framerule=10pt% 73 | , xleftmargin=15pt% 74 | , backgroundcolor=\color[gray]{0.97}% 75 | , rulecolor=\color[gray]{0.90}% 76 | } -------------------------------------------------------------------------------- /doc/MasterThesis/main.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skasselbard/Granite/fc87aad59869b641db7bdf0b506d8db1885fb046/doc/MasterThesis/main.pdf -------------------------------------------------------------------------------- /doc/MasterThesis/main.tex: -------------------------------------------------------------------------------- 1 | \documentclass[english, 2 | %BCOR%Bindungskorrektur, 3 | ]{WissTemplate} 4 | %\PassOptionsToPackage{usenames,dvipsnames}{xcolor} 5 | \usepackage{ 6 | datetime, 7 | ulem, 8 | tikz, %grafiken generieren 9 | varwidth, %anpassen von seitengrößen 10 | enumitem, 11 | longtable, 12 | pgfplots, %diagramme 13 | caption, %tabbellen beschreibungen 14 | url, 15 | listings, %code blöcke 16 | listings-rust, % add rust support (local file) 17 | hyperref %links 18 | } 19 | 20 | \usetikzlibrary{positioning,shapes,shadows,arrows, arrows.meta, calc, 21 | automata, petri %petri netze 22 | } 23 | %\usepackage[a4paper,left=27mm,right=27mm, top=1cm, bottom=2cm]{geometry} 24 | 25 | \renewcommand{\name}{Tom Meyer} 26 | \renewcommand{\strasse}{Thomas-Müntzer-Platz 64} 27 | \renewcommand{\stadt}{18057 Rostock} 28 | \renewcommand{\matrikel}{Matrikel-Nr.: 8200839} 29 | \renewcommand{\course}{Informatik} 30 | \renewcommand{\betreuer}{Prof. Dr. Karsten Wolf} 31 | \renewcommand{\Titel}{Eine Petrinetzsemantik für Rust} 32 | \renewcommand{\Type}{Masterarbeit } %Bachelorarbeit, Projektarbeit, Literaturarbeit, etc. 33 | 34 | \definecolor{verylightgray}{rgb}{0.95,0.95,0.95} 35 | \tolerance=1000 36 | \hyphenpenalty=1000 37 | 38 | \begin{document} 39 | 40 | \include{chapters/titlepage} 41 | \frontmatter 42 | \include{chapters/abstract} 43 | \tableofcontents 44 | \newpage 45 | \markright{\nomname} 46 | \printnomenclature 47 | %\addcontentsline{toc}{chapter}{\nomname} 48 | % Abbildungsverzeichnis 49 | %\newpage 50 | %\addcontentsline{toc}{chapter}{\listfigurename} 51 | %\addcontentsline{toc}{chapter}{Abbildungsverzeichnis} 52 | %\listoffigures 53 | %\newpage 54 | % Tabellenverzeichnis 55 | %\addcontentsline{toc}{chapter}{\listtablename} 56 | %\listoftables 57 | \mainmatter 58 | 59 | \include{chapters/introduction} 60 | \include{chapters/relatedWork} 61 | \include{chapters/approach} 62 | \include{chapters/result} 63 | \include{chapters/conclusion} 64 | \include{chapters/futureWork} 65 | \bibliography{IEEEabrv,literature} 66 | \bibliographystyle{IEEEtran} 67 | 68 | %% Zum Abschluss die Eidesstattliche Versicherung 69 | \newpage 70 | \thispagestyle{empty} 71 | \label{EidesstattlicheVersicherung} 72 | \vspace*{8cm}% Abstand zum oberen Seitenrand 73 | {\parindent 0pt 74 | \textbf{\Huge{Eidesstattliche Versicherung}}\vspace{10mm}\\ 75 | Hiermit versichere ich, dass ich die vorliegende Arbeit selbstständig verfasst und keine anderen als die angegebenen Quellen und Hilfsmittel benutzt habe, alle Ausführungen, die anderen Schriften wörtlich oder sinngemäß entnommen wurden, kenntlich gemacht sind und die Arbeit in gleicher oder ähnlicher Fassung noch nicht Bestandteil einer Studien- oder Prüfungsleistung war. 76 | \\[2cm]} 77 | Rostock, 13. März 2020 78 | \\[3cm] 79 | \rule{6cm}{0.5pt}\\ 80 | \parbox[l][1cm][c]{6cm}{\hfill\name\hfill\vbox{}} 81 | 82 | \end{document} 83 | -------------------------------------------------------------------------------- /doc/MasterThesis/pictures/lola_output.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skasselbard/Granite/fc87aad59869b641db7bdf0b506d8db1885fb046/doc/MasterThesis/pictures/lola_output.png -------------------------------------------------------------------------------- /doc/MasterThesis/presentation/notes.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skasselbard/Granite/fc87aad59869b641db7bdf0b506d8db1885fb046/doc/MasterThesis/presentation/notes.md -------------------------------------------------------------------------------- /doc/MasterThesis/presentation/presentation.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skasselbard/Granite/fc87aad59869b641db7bdf0b506d8db1885fb046/doc/MasterThesis/presentation/presentation.pdf -------------------------------------------------------------------------------- /doc/MasterThesis/presentation/presentation.tex: -------------------------------------------------------------------------------- 1 | 2 | \documentclass[10pt]{beamer} % die 10pt sollten festgelegt bleiben, da dies die Groesse der Mathematikschrift etc. beeinflusst 3 | 4 | \usepackage[ngerman]{babel} % deutsche Bezeichnungen und Trennung etc 5 | \usepackage{hyperref, tikz, pgfplots} % interne Hyperlinks 6 | \usepackage[utf8]{inputenc} 7 | 8 | \usepackage[ief,footuni, headframelogo]{./unirostock/beamerthemeRostock} 9 | 10 | %TODO:Deckblattanordnung überarbeiten 11 | \title{} 12 | \subtitle{Master Verteidigung} 13 | \author{\textsc{Tom Meyer}} 14 | \date{} 15 | \institute{Universität Rostock, Institut für Informatik} 16 | %\titlegraphic{\begin{center}Platz f\"ur ein Logo\\und anderes\end{ce 17 | \footinstitute{Fakultät für Informatik und Elektrotechnik, Institut für Informatik} 18 | % eigenes Logo oben rechts hinzufuegen (bitte auf vernuenftiges Format achten - ein zu hohes Logo verschiebt das Layout) 19 | %\renewcommand{\mylogo}{\includegraphics[width=18.5mm]{institutslogo}} 20 | 21 | \begin{document} 22 | 23 | \begin{frame}% Titelseite 24 | \titlepage 25 | \end{frame} 26 | 27 | \begin{frame}{Struktur der Vortrages}{Damit der H\"orer auch ein wenig durchsieht} 28 | \tableofcontents[pausesections] 29 | \end{frame} 30 | 31 | \begin{frame}{Motivation} 32 | \end{frame} 33 | 34 | \begin{frame}{Background} 35 | \end{frame} 36 | 37 | \begin{frame}{Zusammenfassung} 38 | 39 | \end{frame} 40 | 41 | \begin{frame}{Auswertung} 42 | 43 | \end{frame} 44 | 45 | 46 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 47 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 48 | \section{Einige Beispielfolien} 49 | 50 | 51 | %%%%%%%%%%%% Beispielfolie aus dem BeamerUsersguide %%%%%%%%%%%%%%%%%%% 52 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 53 | \subsection{Beispiel aus beamerusersguide.pdf} 54 | \begin{frame} 55 | \frametitle{There Is No Largest Prime Number} 56 | \framesubtitle{The proof uses \textit{reductio ad absurdum}.} 57 | \begin{theorem} 58 | There is no largest prime number. 59 | \end{theorem} 60 | \begin{proof} 61 | \begin{enumerate} 62 | \item<1-| alert@1> Suppose $p$ were the largest prime number. 63 | \item<2-> Let $q$ be the product of the first $p$ numbers. 64 | \item<3-> Then $q+1$ is not divisible by any of them. 65 | \item<1-> Thus $q+1$ is also prime and greater than $p$.\qedhere 66 | \end{enumerate} 67 | \end{proof} 68 | \end{frame} 69 | 70 | 71 | 72 | \end{document} 73 | 74 | -------------------------------------------------------------------------------- /doc/MasterThesis/presentation/unirostock/UNI-Logo_Siegel_4c_115mm.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skasselbard/Granite/fc87aad59869b641db7bdf0b506d8db1885fb046/doc/MasterThesis/presentation/unirostock/UNI-Logo_Siegel_4c_115mm.pdf -------------------------------------------------------------------------------- /doc/MasterThesis/presentation/unirostock/beamercolorthemeRostock.sty: -------------------------------------------------------------------------------- 1 | %% 2 | %% This is file 'beamercolorthemeRostock.sty' 3 | %% 4 | %% by Mathias Winkel 5 | %% 6 | %% Problems, bugs and comments to 7 | %% mathias.winkel2@uni-rostock.de 8 | %% 9 | 10 | 11 | \ProvidesPackage{./unirostock/beamercolorthemeRostock} 12 | 13 | %%%%%%%% Farboptionen und Standard-Titelbild fuer die einzelnen Bereiche %%%%%%%% 14 | 15 | 16 | \DeclareOptionBeamer{uni}{\definecolor{colorscheme}{cmyk}{1.00, 0.75, 0.00, 0.00}% 17 | \definecolor{colorschemeinv}{rgb}{1.00, 1.00, 1.00}% 18 | \def\@titleimage{./unirostock/title-uni}} 19 | \DeclareOptionBeamer{inf}{\definecolor{colorscheme}{cmyk}{0.40, 0.00, 1.00, 0.00}% 20 | \definecolor{colorschemeinv}{rgb}{1.00, 1.00, 1.00}% 21 | \def\@titleimage{./unirostock/title-inf}} 22 | \DeclareOptionBeamer{msf}{\definecolor{colorscheme}{cmyk}{1.00, 0.30, 0.00, 0.00}% 23 | \definecolor{colorschemeinv}{rgb}{1.00, 1.00, 1.00}% 24 | \def\@titleimage{./unirostock/title-msf}} 25 | \DeclareOptionBeamer{ief}{\definecolor{colorscheme}{cmyk}{0.90, 0.30, 0.00, 0.00}% 26 | \definecolor{colorschemeinv}{rgb}{1.00, 1.00, 1.00}% 27 | \def\@titleimage{./unirostock/title-ief}} 28 | \DeclareOptionBeamer{mnf}{\definecolor{colorscheme}{cmyk}{0.00, 1.00, 1.00, 0.40}% 29 | \definecolor{colorschemeinv}{rgb}{1.00, 1.00, 1.00}% 30 | \def\@titleimage{./unirostock/title-mnf}} 31 | \DeclareOptionBeamer{mef}{\definecolor{colorscheme}{cmyk}{0.45, 1.00, 0.50, 0.20}% 32 | \definecolor{colorschemeinv}{rgb}{1.00, 1.00, 1.00}% 33 | \def\@titleimage{./unirostock/title-mef}} 34 | \DeclareOptionBeamer{juf}{\definecolor{colorscheme}{cmyk}{0.00, 1.00, 0.80, 0.00}% 35 | \definecolor{colorschemeinv}{rgb}{1.00, 1.00, 1.00}% 36 | \def\@titleimage{./unirostock/title-juf}} 37 | \DeclareOptionBeamer{wsf}{\definecolor{colorscheme}{cmyk}{0.10, 0.00, 0.00, 0.40}% 38 | \definecolor{colorschemeinv}{rgb}{1.00, 1.00, 1.00}% 39 | \def\@titleimage{./unirostock/title-wsf}} 40 | \DeclareOptionBeamer{auf}{\definecolor{colorscheme}{cmyk}{1.00, 0.00, 1.00, 0.50}% 41 | \definecolor{colorschemeinv}{rgb}{1.00, 1.00, 1.00}% 42 | \def\@titleimage{./unirostock/title-auf}} 43 | \DeclareOptionBeamer{thf}{\definecolor{colorscheme}{cmyk}{0.15, 0.90, 1.00, 0.05}% 44 | \definecolor{colorschemeinv}{rgb}{1.00, 1.00, 1.00}% 45 | \def\@titleimage{./unirostock/title-thf}} 46 | \DeclareOptionBeamer{phf}{\definecolor{colorscheme}{cmyk}{0.80, 1.00, 0.00, 0.00}% 47 | \definecolor{colorschemeinv}{rgb}{1.00, 1.00, 1.00}% 48 | \def\@titleimage{./unirostock/title-phf}} 49 | 50 | \ExecuteOptionsBeamer{uni} 51 | \ProcessOptionsBeamer\relax 52 | 53 | 54 | \mode 55 | 56 | 57 | % Farben 58 | \setbeamercolor*{palette primary}{fg=colorscheme} 59 | \setbeamercolor*{palette primary inverted}{bg=colorscheme, fg=colorschemeinv} 60 | \setbeamercolor*{palette secondary}{fg=colorscheme!60!white, bg=colorschemeinv} 61 | \setbeamercolor*{palette secondary inverted}{bg=colorscheme!60!white, fg=colorscheme} 62 | \setbeamercolor*{palette tertiary}{fg=colorscheme!20!white, bg=colorschemeinv} 63 | \setbeamercolor*{palette tertiary inverted}{bg=colorscheme!20!white, fg=colorschemeinv} 64 | \setbeamercolor*{palette quaternary}{fg=white,bg=black} 65 | 66 | \setbeamercolor*{author in head/foot}{parent=palette primary inverted} 67 | \setbeamercolor*{frametitle}{parent=palette primary} 68 | \setbeamercolor*{structure}{parent=palette primary} 69 | \setbeamercolor*{section in toc}{parent=structure} 70 | \setbeamercolor*{section in toc shaded}{parent=section in toc} 71 | \setbeamercolor*{subsection in toc}{} 72 | \setbeamercolor*{subsection in toc shaded}{parent=subsection in toc} 73 | \setbeamercolor*{title}{fg=black} 74 | \setbeamercolor*{author}{parent=title} 75 | \setbeamercolor*{institute}{parent=title} 76 | \setbeamercolor*{titlegraphic}{parent=title} 77 | \setbeamercolor*{headtitle}{parent=palette primary} 78 | \setbeamercolor*{alerted text}{parent=palette primary} 79 | 80 | % Farben fuer Bloecke 81 | \setbeamercolor{block title}{parent=palette primary inverted} 82 | \setbeamercolor{block title alerted}{parent=palette primary inverted} 83 | \setbeamercolor{block title example}{parent=normal text, bg=palette secondary.fg} 84 | 85 | \setbeamercolor{block body}{parent=normal text} 86 | \setbeamercolor{block body alerted}{parent=palette tertiary inverted, fg=normal text.fg} 87 | \setbeamercolor{block body example}{parent=normal text} 88 | 89 | 90 | % Farben fuer Tabellen (muessen einmal aktiviert werden) 91 | \usebeamercolor{palette primary} 92 | \usebeamercolor{palette secondary} 93 | \usebeamercolor{palette tertiary} 94 | \usebeamercolor{palette quaternary} 95 | \def\zfA{\rowcolor{palette primary.fg}} 96 | \def\zfB{\rowcolor{palette secondary.fg}} 97 | \def\zfC{\rowcolor{palette tertiary.fg}} 98 | \def\zfD{\rowcolor{palette quaternary.fg}} 99 | 100 | % Farben fuer Abdeckung / schrittweises Aufdecken 101 | \setbeamercovered{transparent} 102 | 103 | 104 | 105 | \mode 106 | -------------------------------------------------------------------------------- /doc/MasterThesis/presentation/unirostock/beamerfontthemeRostock.sty: -------------------------------------------------------------------------------- 1 | %% 2 | %% This is file 'beamerfontthemeRostock.sty' 3 | %% 4 | %% by Mathias Winkel 5 | %% 6 | %% Problems, bugs and comments to 7 | %% mathias.winkel2@uni-rostock.de 8 | %% 9 | 10 | 11 | \ProvidesPackage{./unirostock/beamerfontthemeRostock} 12 | 13 | \mode 14 | 15 | 16 | % Schriftarten 17 | \setbeamerfont*{title}{family*=pag,series*=m,shape*=n,size*={29\pt}{34.3\pt}} 18 | \setbeamerfont*{subtitle}{parent={frametitle}} 19 | \setbeamerfont*{frametitle}{family*=pag,series*=m,shape*=n,size*={22\pt}{26\pt}} 20 | \setbeamerfont*{date in head/foot}{family*=pag,series*=m,shape*=n,size*={8\pt}{8.5\pt}} 21 | \setbeamerfont*{university in head/foot}{family*=pag,series*=b,shape*=n,size*={8\pt}{8.5\pt}} 22 | \setbeamerfont*{institute in head/foot}{family*=pag,series*=m,shape*=n,size*={8\pt}{8.5\pt}} 23 | \setbeamerfont*{author in head/foot}{parent=date in head/foot} 24 | \setbeamerfont*{title in head/foot}{family*=pag,series*=b,shape*=n,size*={8\pt}{8.5\pt}} 25 | \setbeamerfont*{subsection in head/foot}{parent=date in head/foot} 26 | \setbeamerfont*{section in head/foot}{family*=pag,series*=b,shape*=n,size*={8\pt}{8.5\pt}} 27 | \setbeamerfont*{author}{family*=pag,series*=b,shape*=n,size*={18\pt}{22\pt}} 28 | \setbeamerfont*{institute}{family*=pag,series*=m,shape*=n,size*={18\pt}{22\pt}} 29 | \setbeamerfont*{titlegraphic}{family*=pag,series*=m,shape*=n,size*={18\pt}{22\pt}} 30 | \setbeamerfont*{paragraphtitle}{family*=phv,series*=b,shape*=n,size*={18\pt}{22\pt}} 31 | \setbeamerfont*{normal text}{family*=phv,series*=mc,shape*=n,size*={18\pt}{22\pt}} 32 | \setbeamerfont*{headtitle}{family*=pag,series*=m,shape*=n,size*={18\pt}{22\pt}} 33 | 34 | % globale Schriftart 35 | \renewcommand{\encodingdefault}{T1} 36 | \renewcommand{\familydefault}{phv} 37 | \renewcommand{\seriesdefault}{mc} 38 | \renewcommand{\shapedefault}{n} 39 | \fontsize{18\pt}{22\pt} 40 | \normalfont 41 | \selectfont 42 | 43 | 44 | \mode 45 | -------------------------------------------------------------------------------- /doc/MasterThesis/presentation/unirostock/beamerinnerthemeRostock.sty: -------------------------------------------------------------------------------- 1 | %% 2 | %% This is file 'beamerinnerthemeRostock.sty' 3 | %% 4 | %% by Mathias Winkel 5 | %% 6 | %% Problems, bugs and comments to 7 | %% mathias.winkel2@uni-rostock.de 8 | %% 9 | 10 | 11 | \ProvidesPackage{./unirostock/beamerinnerthemeRostock} 12 | 13 | % Zaehler zur Einstellung des Fusszeilenmodus 14 | \newcount\he@dmode \he@dmode0 15 | \DeclareOptionBeamer{headlogo}{\def\he@dmode{0}} 16 | \DeclareOptionBeamer{headtitle}{\def\he@dmode{1}} 17 | \DeclareOptionBeamer{headframetitle}{\def\he@dmode{2}} 18 | \DeclareOptionBeamer{headframesubtitle}{\def\he@dmode{3}} 19 | 20 | \ProcessOptionsBeamer\relax 21 | 22 | \mode 23 | 24 | 25 | % abgerundete Bl�cke ohne Schatten 26 | \setbeamertemplate{blocks}[rounded][shadow=true] 27 | 28 | 29 | % Navigationssymbole ausblenden 30 | \setbeamertemplate{navigation symbols}{} 31 | 32 | 33 | % parskip in der TOC auf 0 setzen 34 | \let\oldt@bleofcontents\tableofcontents 35 | \let\oldp@rskip\parskip 36 | \renewcommand\tableofcontents[1][]{\vskip 1em\parskip\z@ \oldt@bleofcontents[#1] \parskip\oldp@rskip} 37 | 38 | 39 | % Titelseite 40 | \defbeamertemplate*{title page}{unirostock}[1][] 41 | { 42 | \vspace*{-24.27635\mm}\hspace*{-28.282\mm} 43 | \newlength\@imgshift \@imgshift-147.5\mm \advance\@imgshift by \baselineskip 44 | \raisebox{\@imgshift}{\makebox[0pt][l]{\ifx\@titleimage\@empty\else\includegraphics[width=245\mm,height=147.5\mm]{\@titleimage} \fi}}% 45 | \raisebox{8.47635\mm}{\hspace*{-0.72\mm}\makebox[0pt][l]{ 46 | \begin{pgfpicture} 47 | % Weisser Rand 48 | \usebeamercolor{palette secondary} 49 | \color{bg} 50 | \pgfsetlinewidth{0\pt} 51 | \pgfpathmoveto{\pgfpoint{0.0\mm}{0.0\mm}} 52 | \pgfpathlineto{\pgfpoint{236\mm}{0.0\mm}} 53 | \pgfpatharc{90}{0}{8\mm} 54 | \pgfpathlineto{\pgfpoint{244\mm}{-155.5\mm}} 55 | \pgfpathlineto{\pgfpoint{254\mm}{-155.5\mm}} 56 | \pgfpathlineto{\pgfpoint{254\mm}{ 7.3\mm}} 57 | \pgfpathlineto{\pgfpoint{0.0\mm}{ 7.3\mm}} 58 | \pgfpathclose 59 | \pgfusepath{fill} 60 | % Blauer Rahmen 61 | \pgfsetlinewidth{0.5\pt}% 62 | \usebeamercolor{palette primary}% 63 | \color{fg}% 64 | \pgfpathmoveto{\pgfpoint{0.0\mm}{0.0\mm}}% 65 | \pgfpathlineto{\pgfpoint{236\mm}{0.0\mm}}% 66 | \pgfpatharc{90}{0}{8\mm}% 67 | \pgfpathlineto{\pgfpoint{244\mm}{-155.5\mm}}% 68 | \pgfusepath{stroke}% 69 | \pgfsetbaseline{0\mm} 70 | \end{pgfpicture} 71 | }} 72 | \hfill 73 | \begin{minipage}[t]{\textwidth} 74 | \newdimen\@temp \@temp15\mm \advance\@temp by -\baselineskip \vskip \@temp 75 | \hskip 0.2\textwidth 76 | \begin{minipage}[t]{0.8\textwidth} 77 | \begin{beamercolorbox}[sep=0.2ex,left,rounded=true,wd=\textwidth]{title} 78 | \usebeamerfont{title}\inserttitle\par% 79 | \ifx\insertsubtitle\@empty% 80 | \else% 81 | \vskip0.25em% 82 | {\usebeamerfont{subtitle}\usebeamercolor[fg]{subtitle}\insertsubtitle\par}% 83 | \fi% 84 | \end{beamercolorbox}% 85 | \vskip1em\par 86 | \begin{beamercolorbox}[sep=0.2ex,left,rounded=true]{author} 87 | \usebeamerfont{author}\insertauthor 88 | \end{beamercolorbox} 89 | \begin{beamercolorbox}[sep=0.2ex,left,rounded=true]{institute} 90 | \usebeamerfont{institute}\insertinstitute 91 | \end{beamercolorbox} 92 | \begin{beamercolorbox}[sep=0.2ex,left,rounded=true]{titlegraphic} 93 | \inserttitlegraphic\par 94 | \end{beamercolorbox} 95 | \end{minipage} 96 | \end{minipage}\par\vbox{} 97 | } 98 | 99 | 100 | % Frametitle 101 | \defbeamertemplate*{frametitle}{unirostock} 102 | { 103 | \vskip-1.5ex% 104 | \ifnum\he@dmode<3 105 | \begin{beamercolorbox}[sep=0.2ex,dp=0.3ex,left,wd=210.5\mm,rounded=true]{frametitle}% 106 | \ifnum\he@dmode<2\usebeamerfont{frametitle}\strut\insertframetitle\strut\par\else\vskip-1ex\fi% 107 | {% 108 | \ifx\insertframesubtitle\@empty\else% 109 | {\usebeamerfont{framesubtitle}\usebeamercolor[fg]{framesubtitle}\insertframesubtitle\strut\par}% 110 | \fi% 111 | }% 112 | \vskip-1ex% 113 | \end{beamercolorbox}% 114 | \else\vskip-1ex\fi 115 | } 116 | 117 | 118 | 119 | % Aufzaehlungen etc 120 | % Itemize items 121 | \defbeamertemplate*{itemize item}{unirostock}{\hbox{\Large\textbullet}} 122 | \defbeamertemplate*{itemize subitem}{unirostock}{\hbox{\textbullet}} 123 | \defbeamertemplate*{itemize subsubitem}{unirostock}{\small\raise0.5pt\hbox{--}} 124 | % % Enumerate items 125 | % \defbeamertemplateparent{enumerate items}{enumerate item,enumerate subitem,enumerate subsubitem,enumerate mini}{} 126 | % \defbeamertemplate*{enumerate item}{default}{\insertenumlabel.} 127 | % \defbeamertemplate*{enumerate subitem}{default}{\insertenumlabel.\insertsubenumlabel} 128 | % \defbeamertemplate*{enumerate subsubitem}{default}{\insertenumlabel.\insertsubenumlabel.\insertsubsubenumlabel} 129 | % \defbeamertemplate*{enumerate mini template}{default}{\insertenumlabel} 130 | 131 | 132 | 133 | \mode 134 | -------------------------------------------------------------------------------- /doc/MasterThesis/presentation/unirostock/beamerouterthemeRostock.sty: -------------------------------------------------------------------------------- 1 | %% 2 | %% This is file 'beamerouterthemeRostock.sty' 3 | %% 4 | %% by Mathias Winkel 5 | %% 6 | %% Problems, bugs and comments to 7 | %% mathias.winkel2@uni-rostock.de 8 | %% 9 | 10 | 11 | \ProvidesPackage{./unirostock/beamerouterthemeRostock} 12 | 13 | \mode 14 | 15 | % Zaehler zur Einstellung des Fusszeilenmodus 16 | \newcount\f@@tmode \f@@tmode0 17 | \DeclareOptionBeamer{footuni}{\def\f@@tmode{0}} 18 | \DeclareOptionBeamer{foottitle}{\def\f@@tmode{1}} 19 | \DeclareOptionBeamer{footheadings}{\def\f@@tmode{2}} 20 | \DeclareOptionBeamer{footuniheadings}{\def\f@@tmode{3}} 21 | 22 | % Zaehler zur Einstellung des Fusszeilenmodus 23 | \newcount\he@dmode \he@dmode0 24 | \DeclareOptionBeamer{headlogo}{\def\he@dmode{0}} 25 | \DeclareOptionBeamer{headtitle}{\def\he@dmode{1}} 26 | \DeclareOptionBeamer{headframetitle}{\def\he@dmode{2}} 27 | \DeclareOptionBeamer{headframesubtitle}{\def\he@dmode{3}} 28 | 29 | \ProcessOptionsBeamer\relax 30 | 31 | 32 | 33 | % Seitenraender 34 | \setbeamersize{text margin left=26\mm,text margin right=17.5\mm} 35 | 36 | 37 | % Mehr Freiheit bei der Fusszeile ermoeglichen 38 | % Selbst definierte Makros 39 | \newcommand{\mylogo}{} 40 | \def\titleimage#1{\edef\@titleimage{#1}} % \titleimage{bildname.xyz} - Dateinamen fuer das Titelbild festlegen 41 | \def\@copyright{\textcopyright~\the\year} 42 | \def\@university{Universit\"at Rostock} 43 | \def\@institute{Fakult\"at f\"ur Blindtext- und Blindtextwissenschaften} 44 | \def\@footauthor{\insertshortauthor} 45 | \def\@foottitle{\insertshorttitle} 46 | \def\footinstitute#1{\def\@institute{#1}} % Umstellung des Institutsnamens in der Fusszeile mit \footinstitute{bla} 47 | \def\paragraph#1{\par\textbf{#1}\par} 48 | 49 | \def\ifUnDefinedCs#1{\expandafter\ifx\csname#1\endcsname\relax} 50 | 51 | 52 | % Kopfzeile: UniLogo 53 | \defbeamertemplate*{headline}{unirostock}% 54 | { 55 | \vskip 9.4\mm \hskip 13\mm \begin{tabular}{lr} 56 | \includegraphics[width=89\mm]{./unirostock/UNI-Logo_Siegel_4c_115mm} & 57 | \begin{minipage}[b][11.0\mm][b]{130\mm} 58 | \ifUnDefinedCs{inserttitle}\def\inserttitle{}\fi% 59 | \ifUnDefinedCs{insertframetitle}\def\insertframetitle{}\fi% 60 | \ifUnDefinedCs{insertframesubtitle}\def\insertframesubtitle{}\fi% 61 | \raggedleft 62 | \ifcase\he@dmode % Logo-Kopfzeile 63 | \mylogo 64 | \or % Vortragstitel-Kopfzeile 65 | \usebeamerfont{headtitle}\usebeamercolor[fg]{headtitle}\strut\inserttitle\strut 66 | \or % Frametitle-Kopfzeile 67 | \usebeamerfont{frametitle}\usebeamercolor[fg]{frametitle}\strut\insertframetitle\strut 68 | \or % Frametitle-Kopfzeile 69 | \usebeamerfont{frametitle}\usebeamercolor[fg]{frametitle}\strut\insertframetitle\strut\par 70 | \usebeamerfont{framesubtitle}\usebeamercolor[fg]{framesubtitle}\strut\insertframesubtitle\strut 71 | \fi 72 | \end{minipage} 73 | \end{tabular}% 74 | \vskip 7.3\mm %Schritt bis zum bunten Rahmen 75 | \vskip 15.0\mm % Rand innerhalb des bunten Rahmens 76 | } 77 | 78 | 79 | % Hintergrund: blauer Rahmen 80 | \defbeamertemplate*{background}{unirostock} 81 | { 82 | \begin{pgfpicture}% 83 | % Blauer Rahmen 84 | \pgfsetlinewidth{0.5\pt}% 85 | \usebeamercolor{palette primary}% 86 | \color{fg}% 87 | \pgfpathmoveto{\pgfpoint{0.0\mm}{0.0\mm}}% 88 | \pgfpathlineto{\pgfpoint{236\mm}{0.0\mm}}% 89 | \pgfpatharc{90}{0}{8\mm}% 90 | \pgfpathlineto{\pgfpoint{244\mm}{-155.5\mm}}% 91 | \pgfusepath{stroke}% 92 | \pgfsetbaseline{35.0\mm} 93 | \end{pgfpicture}% 94 | } 95 | 96 | % Fusszeile 97 | \defbeamertemplate*{footline}{unirostock}% 98 | { 99 | \vspace*{5.17635\mm} % Rand oberhalb der Fusszeile 100 | \leavevmode% 101 | \hbox{% % 244\mm zzgl. der Liniendicke (0.5\pt) 102 | \begin{beamercolorbox}[wd=244.17635\mm,ht=5\mm,dp=3\mm,left]{author in head/foot}% 103 | \hspace*{26\mm}% 104 | \usebeamerfont{date in head/foot}\insertshortdate{}% 105 | \hskip 2ex minus 1ex% 106 | \ifcase\f@@tmode % Uni-Fusszeile 107 | \@copyright% 108 | \hskip 2ex minus 1ex% 109 | \usebeamerfont{university in head/foot}\MakeUppercase{\@university}% 110 | \ifx\@institute\@empty\else 111 | \ | \ % 112 | \usebeamerfont{institute in head/foot}\MakeUppercase{\@institute}% 113 | \fi% 114 | \or % Title-Fusszeile 115 | \hskip 2ex minus 1ex% 116 | \usebeamerfont{title in head/foot}\MakeUppercase{\insertshorttitle} 117 | \ | \ % 118 | \usebeamerfont{author in head/foot}\MakeUppercase{\insertshortauthor}% 119 | \or %Headings-Fusszeile 120 | \hskip 2ex minus 1ex% 121 | \usebeamerfont{section in head/foot}\insertsectionhead 122 | \ifx\insertsubsectionhead\@empty\else{\ | \ }\fi% 123 | \usebeamerfont{subsection in head/foot}\insertsubsectionhead 124 | \or %Headings-Fusszeile incl. Author und Uni 125 | \hskip 1ex minus 2ex% 126 | \usebeamerfont{author in head/foot}\MakeUppercase{\insertshortauthor} 127 | \usebeamerfont{author in head/foot}{\ (\@university)} 128 | \hskip 4ex minus 1ex% 129 | \usebeamerfont{section in head/foot}\insertsectionhead 130 | \ifx\insertsubsectionhead\@empty\else{\ | \ }\fi% 131 | \usebeamerfont{subsection in head/foot}\insertsubsectionhead 132 | \fi 133 | \hskip 0pt plus 1filll % rechtsbuendige Ausrichtung fuer die Foliennummer 134 | \insertframenumber{} / \inserttotalframenumber\hspace*{2ex} 135 | \end{beamercolorbox}}% 136 | \vskip0pt% 137 | } 138 | 139 | 140 | 141 | 142 | \mode 143 | -------------------------------------------------------------------------------- /doc/MasterThesis/presentation/unirostock/beamerthemeRostock.sty: -------------------------------------------------------------------------------- 1 | %% 2 | %% This is file 'beamerthemeRostock.sty' 3 | %% 4 | %% by Mathias Winkel 5 | %% 6 | %% Problems, bugs and comments to 7 | %% mathias.winkel2@uni-rostock.de 8 | %% 9 | 10 | 11 | \ProvidesPackage{./unirostock/beamerthemeRostock} 12 | 13 | 14 | % Definition der Lanegeneinheit \mm, die zwischen den Papierformaten in der Vorlage und der Beamer-Class skaliert 15 | % 1\mm (Vorlage) = 0.504mm (Beamer), da das Beamer-papierformat ca. halb so gross ist wie die Vorlage 16 | \newlength\mm \mm0.503937007mm 17 | \newlength\pt \pt0.503937007pt 18 | 19 | % externe Packages 20 | \RequirePackage{colortbl} 21 | \RequirePackage{parskip} 22 | \RequirePackage{calc} 23 | 24 | \mode 25 | 26 | 27 | %%%%%%%% Weiterreichen der Optionen an color- und inner-theme %%%%%%%% 28 | \DeclareOptionBeamer{uni}{\def\c@loroption{uni}} 29 | \DeclareOptionBeamer{inf}{\def\c@loroption{inf}} 30 | \DeclareOptionBeamer{msf}{\def\c@loroption{msf}} 31 | \DeclareOptionBeamer{ief}{\def\c@loroption{ief}} 32 | \DeclareOptionBeamer{mnf}{\def\c@loroption{mnf}} 33 | \DeclareOptionBeamer{mef}{\def\c@loroption{mef}} 34 | \DeclareOptionBeamer{juf}{\def\c@loroption{juf}} 35 | \DeclareOptionBeamer{wsf}{\def\c@loroption{wsf}} 36 | \DeclareOptionBeamer{auf}{\def\c@loroption{auf}} 37 | \DeclareOptionBeamer{thf}{\def\c@loroption{thf}} 38 | \DeclareOptionBeamer{phf}{\def\c@loroption{phf}} 39 | \DeclareOptionBeamer{footuni}{\def\f@@t{footuni}} 40 | \DeclareOptionBeamer{foottitle}{\def\f@@t{foottitle}} 41 | \DeclareOptionBeamer{footheadings}{\def\f@@t{footheadings}} 42 | \DeclareOptionBeamer{footuniheadings}{\def\f@@t{footuniheadings}} 43 | \DeclareOptionBeamer{headlogo}{\def\he@d{headlogo}} 44 | \DeclareOptionBeamer{headtitle}{\def\he@d{headtitle}} 45 | \DeclareOptionBeamer{headframetitle}{\def\he@d{headframetitle}} 46 | \DeclareOptionBeamer{headframesubtitle}{\def\he@d{headframesubtitle}} 47 | \ExecuteOptionsBeamer{uni, footuni, headlogo} 48 | \ProcessOptionsBeamer\relax 49 | 50 | 51 | % Packages zum CD 52 | \RequirePackage{./unirostock/beamerfontthemeRostock} 53 | \RequirePackage[\f@@t, \he@d]{./unirostock/beamerouterthemeRostock} 54 | \RequirePackage[\he@d]{./unirostock/beamerinnerthemeRostock} 55 | \RequirePackage[\c@loroption]{./unirostock/beamercolorthemeRostock} 56 | 57 | 58 | % Templates setzen 59 | \setbeamertemplate{headline}[unirostock] 60 | \setbeamertemplate{footline}[unirostock] 61 | \setbeamertemplate{title page}[unirostock] 62 | \setbeamertemplate{frametitle}[unirostock] 63 | \setbeamertemplate{background}[unirostock] 64 | \setbeamertemplate{itemize item}[unirostock] 65 | \setbeamertemplate{itemize subitem}[unirostock] 66 | \setbeamertemplate{itemize subsubitem}[unirostock] 67 | 68 | 69 | \mode 70 | 71 | -------------------------------------------------------------------------------- /doc/MasterThesis/presentation/unirostock/title-auf.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skasselbard/Granite/fc87aad59869b641db7bdf0b506d8db1885fb046/doc/MasterThesis/presentation/unirostock/title-auf.pdf -------------------------------------------------------------------------------- /doc/MasterThesis/presentation/unirostock/title-ief.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skasselbard/Granite/fc87aad59869b641db7bdf0b506d8db1885fb046/doc/MasterThesis/presentation/unirostock/title-ief.pdf -------------------------------------------------------------------------------- /doc/MasterThesis/presentation/unirostock/title-inf.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skasselbard/Granite/fc87aad59869b641db7bdf0b506d8db1885fb046/doc/MasterThesis/presentation/unirostock/title-inf.pdf -------------------------------------------------------------------------------- /doc/MasterThesis/presentation/unirostock/title-juf.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skasselbard/Granite/fc87aad59869b641db7bdf0b506d8db1885fb046/doc/MasterThesis/presentation/unirostock/title-juf.pdf -------------------------------------------------------------------------------- /doc/MasterThesis/presentation/unirostock/title-mef.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skasselbard/Granite/fc87aad59869b641db7bdf0b506d8db1885fb046/doc/MasterThesis/presentation/unirostock/title-mef.pdf -------------------------------------------------------------------------------- /doc/MasterThesis/presentation/unirostock/title-mnf.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skasselbard/Granite/fc87aad59869b641db7bdf0b506d8db1885fb046/doc/MasterThesis/presentation/unirostock/title-mnf.pdf -------------------------------------------------------------------------------- /doc/MasterThesis/presentation/unirostock/title-msf.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skasselbard/Granite/fc87aad59869b641db7bdf0b506d8db1885fb046/doc/MasterThesis/presentation/unirostock/title-msf.pdf -------------------------------------------------------------------------------- /doc/MasterThesis/presentation/unirostock/title-phf.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skasselbard/Granite/fc87aad59869b641db7bdf0b506d8db1885fb046/doc/MasterThesis/presentation/unirostock/title-phf.pdf -------------------------------------------------------------------------------- /doc/MasterThesis/presentation/unirostock/title-thf.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skasselbard/Granite/fc87aad59869b641db7bdf0b506d8db1885fb046/doc/MasterThesis/presentation/unirostock/title-thf.pdf -------------------------------------------------------------------------------- /doc/MasterThesis/presentation/unirostock/title-uni.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skasselbard/Granite/fc87aad59869b641db7bdf0b506d8db1885fb046/doc/MasterThesis/presentation/unirostock/title-uni.pdf -------------------------------------------------------------------------------- /doc/MasterThesis/presentation/unirostock/title-wsf.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skasselbard/Granite/fc87aad59869b641db7bdf0b506d8db1885fb046/doc/MasterThesis/presentation/unirostock/title-wsf.pdf -------------------------------------------------------------------------------- /doc/diagrams/BasicBlock.graphml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | true 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | {"version":"2.0.0","theme":{"name":"light","version":"1.0.0"}} 64 | 65 | 66 | 67 | 68 | 69 | statement 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | statement 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | statement 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | terminator 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | BasicBlock 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | BB3 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | -------------------------------------------------------------------------------- /doc/diagrams/BasicBlock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skasselbard/Granite/fc87aad59869b641db7bdf0b506d8db1885fb046/doc/diagrams/BasicBlock.png -------------------------------------------------------------------------------- /doc/diagrams/BasickBlock.asciio: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skasselbard/Granite/fc87aad59869b641db7bdf0b506d8db1885fb046/doc/diagrams/BasickBlock.asciio -------------------------------------------------------------------------------- /doc/diagrams/BasickBlock.txt: -------------------------------------------------------------------------------- 1 | .-----. 2 | .-( start )------------------------------------------. 3 | | '-----' BasicBlock | 4 | | | | 5 | | v .-----------------------. | 6 | | .---. .-----. Statements | | 7 | | | |---------->( start ) | | 8 | | '---' '-----' | | 9 | | | | | | 10 | | v | | | 11 | | .-------. | | | 12 | |( working ) | | | 13 | | '-------' | | | 14 | | | | | | 15 | | v | | | 16 | | .---. .---. | | 17 | | | |<-----------( end ) | | 18 | | '---' '---' | | 19 | | | '-----------------------' | 20 | | v | 21 | | .------. | 22 | |( choice )----------------------------------. | 23 | | '------' | | | | | 24 | | -. | | | | | 25 | |.-----|----------|-------|-------|----------|-----. | 26 | || | | Termi|ator | | | | 27 | || | | | | | | | 28 | || v v v v v | | 29 | || .-----. .-. .-. .-. .-----. | | 30 | ''-( end_1 )----( )---( )---( )----( end_N )-'-' 31 | '-----' '-' '-' '-' '-----' 32 | -------------------------------------------------------------------------------- /doc/diagrams/Function.graphml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | true 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | {"version":"2.0.0","theme":{"name":"light","version":"1.0.0"},"layout":"layout-bpmn","config":{"noObf_layoutOrientation":"LEFT_TO_RIGHT","noObf_scope":"ALL_ELEMENTS","noObf_laneInsets":10,"noObf_nodeToNodeDistance":40,"noObf_minimumEdgeLength":20,"noObf_compactMessageFlowLayering":false,"noObf_startNodesFirst":true}} 52 | 53 | 54 | 55 | 56 | 57 | Function 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | ... 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | -------------------------------------------------------------------------------- /doc/diagrams/Function.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skasselbard/Granite/fc87aad59869b641db7bdf0b506d8db1885fb046/doc/diagrams/Function.png -------------------------------------------------------------------------------- /doc/diagrams/FunctionCallNet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skasselbard/Granite/fc87aad59869b641db7bdf0b506d8db1885fb046/doc/diagrams/FunctionCallNet.png -------------------------------------------------------------------------------- /doc/diagrams/FunctionCallNetPruned.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skasselbard/Granite/fc87aad59869b641db7bdf0b506d8db1885fb046/doc/diagrams/FunctionCallNetPruned.png -------------------------------------------------------------------------------- /doc/diagrams/StatementsNet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skasselbard/Granite/fc87aad59869b641db7bdf0b506d8db1885fb046/doc/diagrams/StatementsNet.png -------------------------------------------------------------------------------- /doc/diagrams/SwitchInt.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skasselbard/Granite/fc87aad59869b641db7bdf0b506d8db1885fb046/doc/diagrams/SwitchInt.png -------------------------------------------------------------------------------- /doc/diagrams/TerminatorsNet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skasselbard/Granite/fc87aad59869b641db7bdf0b506d8db1885fb046/doc/diagrams/TerminatorsNet.png -------------------------------------------------------------------------------- /doc/diagrams/basic_blocks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skasselbard/Granite/fc87aad59869b641db7bdf0b506d8db1885fb046/doc/diagrams/basic_blocks.png -------------------------------------------------------------------------------- /doc/diagrams/basic_program.graphml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | true 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | {"version":"2.0.0","layout":"layout-bpmn","config":{"noObf_layoutOrientation":"LEFT_TO_RIGHT","noObf_scope":"ALL_ELEMENTS","noObf_laneInsets":10,"noObf_nodeToNodeDistance":40,"noObf_minimumEdgeLength":20,"noObf_compactMessageFlowLayering":false,"noObf_startNodesFirst":true},"theme":{"name":"light","version":"1.0.0"}} 68 | 69 | 70 | 71 | 72 | 73 | function() 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | Program 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | main() 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | return 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | Program 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | -------------------------------------------------------------------------------- /doc/diagrams/basic_program.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skasselbard/Granite/fc87aad59869b641db7bdf0b506d8db1885fb046/doc/diagrams/basic_program.png -------------------------------------------------------------------------------- /doc/diagrams/basic_program_new.graphml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | true 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | {"version":"2.0.0","theme":{"name":"light","version":"1.0.0"}} 58 | 59 | 60 | 61 | 62 | 63 | Program 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | -------------------------------------------------------------------------------- /doc/diagrams/basic_program_new.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skasselbard/Granite/fc87aad59869b641db7bdf0b506d8db1885fb046/doc/diagrams/basic_program_new.png -------------------------------------------------------------------------------- /doc/diagrams/function_and_empty_program.graphml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | true 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | {"version":"2.0.0","theme":{"name":"light","version":"1.0.0"}} 67 | 68 | 69 | 70 | 71 | 72 | function() 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | main() 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | return 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | -------------------------------------------------------------------------------- /doc/diagrams/function_and_empty_program.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skasselbard/Granite/fc87aad59869b641db7bdf0b506d8db1885fb046/doc/diagrams/function_and_empty_program.png -------------------------------------------------------------------------------- /doc/diagrams/local.graphml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | true 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | {"version":"2.0.0","theme":{"name":"light","version":"1.0.0"}} 67 | 68 | 69 | 70 | 71 | 72 | Local 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | initialized 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | dead 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | uninitialized 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | -------------------------------------------------------------------------------- /doc/diagrams/local.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skasselbard/Granite/fc87aad59869b641db7bdf0b506d8db1885fb046/doc/diagrams/local.png -------------------------------------------------------------------------------- /doc/diagrams/memoryAccess.graphml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | true 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | {"version":"2.0.0","theme":{"name":"light","version":"1.0.0"}} 60 | 61 | 62 | 63 | 64 | 65 | read/write 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | memory 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | -------------------------------------------------------------------------------- /doc/diagrams/memoryAccess.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skasselbard/Granite/fc87aad59869b641db7bdf0b506d8db1885fb046/doc/diagrams/memoryAccess.png -------------------------------------------------------------------------------- /doc/diagrams/mutexNet.graphml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | true 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | {"version":"2.0.0","theme":{"name":"light","version":"1.0.0"}} 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | -------------------------------------------------------------------------------- /doc/diagrams/mutexNet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skasselbard/Granite/fc87aad59869b641db7bdf0b506d8db1885fb046/doc/diagrams/mutexNet.png -------------------------------------------------------------------------------- /doc/diagrams/netExamples.graphml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | true 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | {"version":"2.0.0","theme":{"name":"light","version":"1.0.0"}} 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 263 | 264 | 265 | 266 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | -------------------------------------------------------------------------------- /doc/diagrams/netExamples.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Skasselbard/Granite/fc87aad59869b641db7bdf0b506d8db1885fb046/doc/diagrams/netExamples.png -------------------------------------------------------------------------------- /rust-toolchain: -------------------------------------------------------------------------------- 1 | nightly-2020-01-07 2 | #nightly -------------------------------------------------------------------------------- /scripts/analyze.py: -------------------------------------------------------------------------------- 1 | import subprocess 2 | import lola 3 | import argparse 4 | import re 5 | from graphviz import Source as dot 6 | import os 7 | 8 | def exec_lola(formula): 9 | net = "net.lola" 10 | lola.cd_root() 11 | subprocess.call(["./target/lola/lola-2.0/src/lola", net, formula, "-p"]) 12 | 13 | def general_deadlock(): 14 | # p_2 marks program termination 15 | #exec_lola('--formula=AG(EF(p_2 = 1))') 16 | exec_lola('--formula=EF (DEADLOCK AND (p_2 = 0 AND p_0 = 0))') 17 | 18 | def unconditional_deadlock(): 19 | exec_lola('--formula=EF DEADLOCK') 20 | 21 | def can_panic(): 22 | # p_0 marks panic or unwind. Implies p_2 23 | exec_lola('--formula=EF p_0 > 0') 24 | 25 | def neighbors(nodes): 26 | #nodes_regex = [node + "\W" for node in nodes] 27 | neighbors = [] 28 | # search all given nodes 29 | for node in nodes: 30 | matches = [] 31 | # search all lines for the current node 32 | for line in open('./net.dot', 'r'): 33 | if re.search(node + "\W", line): 34 | matches.append(line) 35 | # search for the arc definitions in the previously matched lines 36 | for match in matches: 37 | if re.search("->", match): 38 | match = match.replace("\n", "") 39 | match = match.replace(";", "") 40 | match = match.replace(node, "") 41 | match = match.replace("->", "") 42 | match = match.replace(" ", "") 43 | neighbors.append(match) 44 | # match all lines that contain nodes and neighbors 45 | lines = ["digraph petrinet {"] 46 | # join initial nodes and neighbors saparated by a '|'. Also add a \W to every element 47 | regex = "|".join([e + "\W" for e in nodes + neighbors]) 48 | for line in open('./net.dot', 'r'): 49 | if re.search(regex, line): 50 | lines.append(line) 51 | lines.append("}") 52 | print("".join(lines)) 53 | file=open('neighbors.dot','w') 54 | file.writelines(lines) 55 | file.close() 56 | visualize('neighbors.dot') 57 | 58 | def visualize(file): 59 | dot.from_file(file).render(view=True, format="png") 60 | 61 | if __name__ == "__main__": 62 | parser = argparse.ArgumentParser(description="analyze the output generated by granite") 63 | parser.add_argument('-d', '--deadlock',action="store_true", help="Default search for deadlocks. Successful and unsuccessful termination is not concidered as a deadlock") 64 | parser.add_argument('-u', '--unconditional-deadlock',action="store_true", help="Search for every deadlock. Even program termination is concidered a deadlock") 65 | parser.add_argument('-p', '--panic',action="store_true", help="Check if it is possible to reach a panic state") 66 | parser.add_argument('-n', '--neighbors', nargs="*", help="Generates a subnet with the given nodes and all its neighbors and visualizes it.") 67 | parser.add_argument('-v', '--visualize', action="store_true", help="visualize the graph in graphviz. Doesn't terminate (in time) for larger graphs") 68 | 69 | args = parser.parse_args() 70 | 71 | if args.deadlock: 72 | general_deadlock() 73 | if args.unconditional_deadlock: 74 | unconditional_deadlock() 75 | if args.panic: 76 | can_panic() 77 | if args.neighbors: 78 | neighbors(args.neighbors) 79 | if args.visualize: 80 | visualize("net.dot") -------------------------------------------------------------------------------- /scripts/lola.py: -------------------------------------------------------------------------------- 1 | #!/bin/python3 2 | 3 | import os 4 | import sys 5 | import os.path 6 | import tarfile 7 | import requests 8 | import subprocess 9 | #https://stackoverflow.com/questions/16694907/download-large-file-in-python-with-requests/16696317#16696317 10 | def download_file(url, path): 11 | local_filename = path 12 | # NOTE the stream=True parameter below 13 | with requests.get(url, stream=True) as r: 14 | r.raise_for_status() 15 | with open(local_filename, 'wb') as f: 16 | for chunk in r.iter_content(chunk_size=8192): 17 | if chunk: # filter out keep-alive new chunks 18 | f.write(chunk) 19 | # f.flush() 20 | return local_filename 21 | 22 | # Search cargo toml to root the project 23 | # https://stackoverflow.com/questions/37427683/python-search-for-a-file-in-current-directory-and-all-its-parents 24 | def cd_root(): 25 | file_name = "Cargo.toml" 26 | cur_dir = os.getcwd() 27 | while True: 28 | file_list = os.listdir(cur_dir) 29 | parent_dir = os.path.dirname(cur_dir) 30 | if file_name in file_list: 31 | os.chdir(cur_dir) 32 | break 33 | else: 34 | if cur_dir == parent_dir: #if dir is root dir 35 | print("Cannot find project root") 36 | sys.exit() 37 | break 38 | else: 39 | cur_dir = parent_dir 40 | 41 | def main(): 42 | cd_root() 43 | # download lola to target directory 44 | lola = "http://service-technology.org/files/lola/lola-2.0.tar.gz" 45 | lola_path = "./target/lola" 46 | try: 47 | os.mkdir(lola_path) 48 | except FileExistsError: 49 | pass 50 | target = lola_path+"/lola-2.0.tar.gz" 51 | download_file(lola, target) 52 | tar = tarfile.open(target) 53 | tar.extractall(lola_path) 54 | tar.close() 55 | os.remove(target) 56 | 57 | os.chdir(lola_path+"/lola-2.0") 58 | subprocess.call([os.getcwd() + "/configure"]) 59 | subprocess.call(["make"]) 60 | 61 | 62 | if __name__ == "__main__": 63 | main() -------------------------------------------------------------------------------- /scripts/run.py: -------------------------------------------------------------------------------- 1 | import subprocess 2 | import argparse 3 | import os 4 | 5 | def run(filename): 6 | sysroot = subprocess.getoutput("rustc --print sysroot") 7 | env = os.environ.copy() 8 | env["LD_LIBRARY_PATH"] = sysroot + "/lib" 9 | subprocess.call([ 10 | os.getcwd() + "/target/debug/granite", 11 | os.getcwd() + "/tests/sample_programs/" + filename, 12 | "--", 13 | "--mir_dump", 14 | "--format", 15 | "pnml", 16 | "lola", 17 | "dot" 18 | ], env=env) 19 | 20 | if __name__ == "__main__": 21 | parser = argparse.ArgumentParser(description="Script to run granite with the correct configuration") 22 | parser.add_argument('-r', '--run', help="run granite on a file from tests/sample_programs") 23 | 24 | args = parser.parse_args() 25 | 26 | if args.run: 27 | run(args.run) -------------------------------------------------------------------------------- /src/init.rs: -------------------------------------------------------------------------------- 1 | // inspired by and based on miri: https://github.com/rust-lang/miri/blob/master/src/bin/miri.rs 2 | 3 | use std::env; 4 | use std::str::FromStr; 5 | 6 | pub fn init_early_loggers() { 7 | env_logger::init(); 8 | if env::var("RUSTC_LOG").is_ok() { 9 | rustc_driver::init_rustc_env_logger(); 10 | } 11 | } 12 | 13 | pub fn init_late_loggers() { 14 | // We initialize loggers right before we start evaluation. We overwrite the `RUSTC_LOG` 15 | // env var if it is not set, control it based on `RUST_LOG`. 16 | if let Ok(var) = env::var("RUST_LOG") { 17 | if env::var("RUSTC_LOG").is_err() { 18 | if log::Level::from_str(&var).is_ok() { 19 | env::set_var( 20 | "RUSTC_LOG", 21 | &format!("rustc::mir::interpret={0},rustc_mir::interpret={0}", var), 22 | ); 23 | } else { 24 | env::set_var("RUSTC_LOG", &var); 25 | } 26 | rustc_driver::init_rustc_env_logger(); 27 | } 28 | } 29 | } 30 | 31 | /// Returns the "default sysroot" that we will use if no `--sysroot` flag is set. 32 | /// Should be a compile-time constant. 33 | fn compile_time_sysroot() -> Option { 34 | if option_env!("RUSTC_STAGE").is_some() { 35 | // This is being built as part of rustc, and gets shipped with rustup. 36 | // We can rely on the sysroot computation in librustc. 37 | return None; 38 | } 39 | // For builds outside rustc, we need to ensure that we got a sysroot 40 | // that gets used as a default. The sysroot computation in librustc would 41 | // end up somewhere in the build dir. 42 | // Taken from PR . 43 | let home = option_env!("RUSTUP_HOME").or(option_env!("MULTIRUST_HOME")); 44 | let toolchain = option_env!("RUSTUP_TOOLCHAIN").or(option_env!("MULTIRUST_TOOLCHAIN")); 45 | Some(match (home, toolchain) { 46 | (Some(home), Some(toolchain)) => format!("{}/toolchains/{}", home, toolchain), 47 | _ => option_env!("RUST_SYSROOT") 48 | .expect("To build without rustup, set the `RUST_SYSROOT` env var at build time") 49 | .to_owned(), 50 | }) 51 | } 52 | 53 | pub fn parse_arguments() -> (Vec, Vec) { 54 | // Parse our arguments and split them across `rustc` and `fairum`. 55 | let mut rustc_args = vec![]; 56 | let mut granite_args = vec![]; 57 | let mut after_dashdash = false; 58 | for arg in std::env::args() { 59 | if rustc_args.is_empty() { 60 | // Very first arg: for `rustc`. 61 | rustc_args.push(arg); 62 | } else if after_dashdash { 63 | // Everything that comes after are our args. 64 | granite_args.push(arg); 65 | } else { 66 | match arg.as_str() { 67 | "--" => { 68 | after_dashdash = true; 69 | } 70 | _ => { 71 | rustc_args.push(arg); 72 | } 73 | } 74 | } 75 | } 76 | (rustc_args, granite_args) 77 | } 78 | 79 | pub fn check_sysroot(rustc_args: &mut Vec) { 80 | // Determine sysroot if needed. Make sure we always call `compile_time_sysroot` 81 | // as that also does some sanity-checks of the environment we were built in. 82 | if let Some(sysroot) = compile_time_sysroot() { 83 | let sysroot_flag = "--sysroot"; 84 | if !rustc_args.iter().any(|e| e == sysroot_flag) { 85 | // We need to overwrite the default that librustc would compute. 86 | rustc_args.push(sysroot_flag.to_owned()); 87 | rustc_args.push(sysroot); 88 | } 89 | } 90 | } 91 | -------------------------------------------------------------------------------- /src/main.rs: -------------------------------------------------------------------------------- 1 | #![feature(rustc_private)] 2 | #![deny(rust_2018_idioms)] 3 | #![feature(option_expect_none)] 4 | #![feature(box_patterns)] 5 | 6 | #[macro_use] 7 | extern crate log; 8 | 9 | #[macro_use] 10 | extern crate rustc; 11 | extern crate rustc_driver; 12 | extern crate rustc_hir; 13 | extern crate rustc_index; 14 | extern crate rustc_interface; 15 | extern crate rustc_mir; 16 | 17 | mod init; 18 | mod petri_net; 19 | mod translator; 20 | 21 | use crate::translator::Translator; 22 | use clap::{Arg, ArgMatches}; 23 | use rustc_driver::Compilation; 24 | use rustc_hir::def_id::LOCAL_CRATE; 25 | use rustc_interface::interface; 26 | use rustc_interface::Queries; 27 | 28 | struct PetriConfig<'a> { 29 | arguments: ArgMatches<'a>, 30 | } 31 | 32 | impl<'a> rustc_driver::Callbacks for PetriConfig<'a> { 33 | fn after_analysis<'tcx>( 34 | &mut self, 35 | compiler: &interface::Compiler, 36 | queries: &'tcx Queries<'tcx>, 37 | ) -> Compilation { 38 | init::init_late_loggers(); 39 | compiler.session().abort_if_errors(); 40 | 41 | queries.global_ctxt().unwrap().peek_mut().enter(|tcx| { 42 | let (entry_def_id, _) = tcx.entry_fn(LOCAL_CRATE).expect("no main function found!"); 43 | let mir_dump = match self.arguments.values_of("mir_dump") { 44 | Some(path) => Some(out_file("mir")), 45 | None => None, 46 | }; 47 | let mut pass = Translator::new(tcx, mir_dump).expect("Unable to create translator"); 48 | let net = pass.petrify(entry_def_id).expect("translation failed"); 49 | for format in self 50 | .arguments 51 | .values_of("output_format") 52 | .expect("no output format given") 53 | { 54 | let mut file = out_file(format); 55 | if format == "pnml" { 56 | info!("generating pnml"); 57 | net.to_pnml(&mut file).expect("write error"); 58 | } 59 | if format == "lola" { 60 | info!("generating lola"); 61 | net.to_lola(&mut file).expect("write error"); 62 | } 63 | if format == "dot" { 64 | info!("generating dot"); 65 | net.to_dot(&mut file).expect("write error"); 66 | } 67 | } 68 | }); 69 | 70 | compiler.session().abort_if_errors(); 71 | 72 | Compilation::Stop 73 | } 74 | } 75 | pub fn main() { 76 | init::init_early_loggers(); 77 | let matches = clap::App::new("granite") 78 | .version("0.1") 79 | .author("Tom Meyer ") 80 | .about("Translate rust programs into petri nets") 81 | .arg( 82 | Arg::with_name("output_format") 83 | .long("format") 84 | .value_name("FORMAT") 85 | .help("Defines the output standard for the generated petri net") 86 | .possible_values(&["pnml", "lola", "dot"]) 87 | .multiple(true) 88 | .default_value("pnml"), 89 | ) 90 | .arg( 91 | Arg::with_name("mir_dump") 92 | .long("mir_dump") 93 | .help("Dumps pretty printed mir into the given file") 94 | .required(false), 95 | ); 96 | let (mut rustc_args, mut granite_args) = init::parse_arguments(); 97 | init::check_sysroot(&mut rustc_args); 98 | 99 | // clap needs an executable path (or at least the first argument is ignored in parsing) 100 | granite_args.insert(0, rustc_args.first().unwrap().into()); 101 | let mut config = PetriConfig { 102 | arguments: matches.get_matches_from(granite_args), 103 | }; 104 | let result = rustc_driver::catch_fatal_errors(move || { 105 | rustc_driver::run_compiler(&rustc_args, &mut config, None, None) 106 | }) 107 | .and_then(|result| result); 108 | std::process::exit(result.is_err() as i32); 109 | } 110 | 111 | fn out_file(format: &str) -> std::fs::File { 112 | match std::fs::File::create(format!("net.{}", format)) { 113 | Ok(file) => file, 114 | Err(err) => { 115 | panic!("Unable to create file: {}", err); 116 | } 117 | } 118 | } 119 | -------------------------------------------------------------------------------- /src/petri_net/basic_block.rs: -------------------------------------------------------------------------------- 1 | use crate::petri_net::function::{op_to_data_node, place_to_data_node, VirtualMemory}; 2 | use petri_to_star::{NodeRef, PetriNet, Result}; 3 | use rustc::mir; 4 | use std::clone::Clone; 5 | 6 | #[derive(Debug)] 7 | pub struct BasicBlock { 8 | start_place: NodeRef, 9 | end_place: NodeRef, 10 | pub statements: Vec, 11 | } 12 | 13 | #[derive(Clone, Debug)] 14 | pub struct Statement { 15 | start_place: NodeRef, 16 | stmt_transition: NodeRef, 17 | } 18 | 19 | impl BasicBlock { 20 | pub fn new<'net>(net: &'net mut PetriNet, start_place: NodeRef) -> Result { 21 | let end_place = net.add_place(); 22 | let statements = Vec::new(); 23 | Ok(BasicBlock { 24 | start_place, 25 | end_place, 26 | statements, 27 | }) 28 | } 29 | 30 | pub fn add_statement<'net>( 31 | &mut self, 32 | net: &'net mut PetriNet, 33 | statement: &mir::Statement<'_>, 34 | virt_memory: &VirtualMemory, 35 | ) -> Result<()> { 36 | // if its the first statement, it shares the first place with the basic block 37 | // otherwise the end place of the last statement is the start place of the new one 38 | let start_place = { 39 | if let Some(statement) = self.statements.last() { 40 | let place = net.add_place(); 41 | net.add_arc(statement.stmt_transition, place)?; 42 | place 43 | } else { 44 | self.start_place() 45 | } 46 | }; 47 | 48 | self.statements 49 | .push(Statement::new(net, start_place, statement, virt_memory)?); 50 | Ok(()) 51 | } 52 | 53 | pub fn finish_statement_block(&self, net: &mut PetriNet) -> Result<()> { 54 | if let Some(statement) = self.statements.last() { 55 | net.add_arc(statement.stmt_transition, self.end_place)?; 56 | } else { 57 | // if there is only a terminator (no statement) we have to connect start and end place of the block 58 | let t = net.add_transition(); 59 | t.name(net, "NOP".into())?; 60 | net.add_arc(self.start_place, t)?; 61 | net.add_arc(t, self.end_place)?; 62 | } 63 | Ok(()) 64 | } 65 | 66 | pub fn start_place(&self) -> NodeRef { 67 | self.start_place 68 | } 69 | pub fn end_place(&self) -> NodeRef { 70 | self.end_place 71 | } 72 | } 73 | 74 | impl Statement { 75 | pub fn new<'net>( 76 | net: &'net mut PetriNet, 77 | start_place: NodeRef, 78 | statement: &mir::Statement<'_>, 79 | virt_memory: &VirtualMemory, 80 | ) -> Result { 81 | // the statement transition is its important part 82 | // it "executes" the effect of the statement 83 | let stmt_transition = net.add_transition(); 84 | stmt_transition.name(net, format!("{:?}", statement.kind))?; 85 | //stmt_transition.name(net, ""); 86 | net.add_arc(start_place, stmt_transition)?; 87 | let stmt = Statement { 88 | start_place: start_place.clone(), 89 | stmt_transition, 90 | }; 91 | stmt.build(net, statement, virt_memory)?; 92 | Ok(stmt) 93 | } 94 | pub fn start_place(&self) -> &NodeRef { 95 | &self.start_place 96 | } 97 | 98 | fn build<'net>( 99 | &self, 100 | net: &'net mut PetriNet, 101 | statement: &mir::Statement<'_>, 102 | virt_memory: &VirtualMemory, 103 | ) -> Result<()> { 104 | use mir::StatementKind; 105 | match &statement.kind { 106 | StatementKind::Assign(box (lvalue, rvalue)) => { 107 | self.build_assign(net, virt_memory, lvalue, rvalue)? 108 | } 109 | StatementKind::StorageLive(local) => { 110 | let local = virt_memory.get_local(&local).expect("local not found"); 111 | net.add_arc( 112 | local.prenatal_place.expect("no uninitialized place"), 113 | self.stmt_transition, 114 | )?; 115 | net.add_arc(self.stmt_transition, local.live_place)?; 116 | } 117 | StatementKind::StorageDead(local) => { 118 | let local = virt_memory.get_local(&local).expect("local not found"); 119 | net.add_arc(local.live_place, self.stmt_transition)?; 120 | net.add_arc( 121 | self.stmt_transition, 122 | local.dead_place.expect("no dead place"), 123 | )?; 124 | } 125 | StatementKind::SetDiscriminant { place, .. } => { 126 | let place_node = place_to_data_node(place, virt_memory); 127 | net.add_arc(place_node, self.stmt_transition)?; 128 | net.add_arc(self.stmt_transition, place_node)?; 129 | } 130 | StatementKind::FakeRead(_, _) 131 | | StatementKind::InlineAsm(_) 132 | | StatementKind::Retag(_, _) 133 | | StatementKind::AscribeUserType(box (_, _), _) => { 134 | panic!("statementKind not supported: {:?}", statement.kind) 135 | } 136 | StatementKind::Nop => {} 137 | } 138 | Ok(()) 139 | } 140 | 141 | fn build_assign<'net>( 142 | &self, 143 | net: &'net mut PetriNet, 144 | virt_memory: &VirtualMemory, 145 | lvalue: &mir::Place<'_>, 146 | rvalue: &mir::Rvalue<'_>, 147 | ) -> Result<()> { 148 | use mir::Rvalue; 149 | let llocal = place_to_data_node(lvalue, virt_memory); 150 | add_node_to_statement(net, llocal, self.stmt_transition)?; 151 | match rvalue { 152 | Rvalue::Use(ref operand) 153 | | Rvalue::Repeat(ref operand, _) 154 | | Rvalue::UnaryOp(_, ref operand) => { 155 | let op_place = op_to_data_node(operand, virt_memory); 156 | add_node_to_statement(net, op_place, self.stmt_transition)?; 157 | } 158 | Rvalue::Ref(_, _, ref place) | Rvalue::Len(ref place) => { 159 | let place_local = place_to_data_node(place, virt_memory); 160 | add_node_to_statement(net, place_local, self.stmt_transition)?; 161 | } 162 | Rvalue::Cast(ref _kind, ref operand, ref _typ) => { 163 | let op_place = op_to_data_node(operand, virt_memory); 164 | add_node_to_statement(net, op_place, self.stmt_transition)?; 165 | } 166 | Rvalue::BinaryOp(ref _operator, ref loperand, ref roperand) 167 | | Rvalue::CheckedBinaryOp(ref _operator, ref loperand, ref roperand) => { 168 | let lop_place = op_to_data_node(loperand, virt_memory); 169 | let rop_place = op_to_data_node(roperand, virt_memory); 170 | add_node_to_statement(net, lop_place, self.stmt_transition)?; 171 | add_node_to_statement(net, rop_place, self.stmt_transition)?; 172 | } 173 | Rvalue::NullaryOp(ref operator, ref _typ) => match operator { 174 | // these are essentially a lookup of the type size in the static space 175 | mir::NullOp::SizeOf | mir::NullOp::Box => { 176 | net.add_arc(virt_memory.get_constant(), self.stmt_transition)?; 177 | net.add_arc(self.stmt_transition, virt_memory.get_constant())?; 178 | } 179 | }, 180 | Rvalue::Discriminant(ref place) => { 181 | let op_place = place_to_data_node(place, virt_memory); 182 | add_node_to_statement(net, op_place, self.stmt_transition)?; 183 | } 184 | Rvalue::Aggregate(ref _kind, ref operands) => { 185 | //FIXME: does the kind matter? 186 | for operand in operands { 187 | let op_place = op_to_data_node(operand, virt_memory); 188 | add_node_to_statement(net, op_place, self.stmt_transition)?; 189 | } 190 | } 191 | Rvalue::AddressOf(_, place) => { 192 | let place_local = place_to_data_node(place, virt_memory); 193 | add_node_to_statement(net, place_local, self.stmt_transition)?; 194 | } 195 | } 196 | Ok(()) 197 | } 198 | } 199 | 200 | fn add_node_to_statement( 201 | net: &mut PetriNet, 202 | place_node: NodeRef, 203 | statement_transition: NodeRef, 204 | ) -> Result<()> { 205 | net.add_arc(place_node, statement_transition)?; 206 | net.add_arc(statement_transition, place_node)?; 207 | Ok(()) 208 | } 209 | -------------------------------------------------------------------------------- /src/petri_net/intrinsics.rs: -------------------------------------------------------------------------------- 1 | use petri_to_star::{NodeRef, PetriNet, Result}; 2 | 3 | pub(crate) fn generic_foreign( 4 | net: &mut PetriNet, 5 | arg_nodes: &Vec, 6 | source_node: NodeRef, 7 | destination_node: NodeRef, // local var that holds the return value 8 | destination_block_start: NodeRef, // start of bb to continue 9 | cleanup_node: Option, // start of fail case bb 10 | name: String, 11 | ) -> Result<()> { 12 | //flow 13 | let t = net.add_transition(); 14 | t.name(net, name.clone())?; 15 | net.add_arc(source_node, t)?; 16 | net.add_arc(t, destination_block_start)?; 17 | // extra unwind transition 18 | if let Some(node) = cleanup_node { 19 | let t_unwind = net.add_transition(); 20 | t_unwind.name(net, format!("unwind_{}", name))?; 21 | net.add_arc(source_node, t_unwind)?; 22 | net.add_arc(t_unwind, node)?; 23 | } 24 | //vars 25 | net.add_arc(destination_node, t)?; 26 | net.add_arc(t, destination_node)?; 27 | for node in arg_nodes { 28 | net.add_arc(*node, t)?; 29 | net.add_arc(t, *node)?; 30 | } 31 | Ok(()) 32 | } 33 | -------------------------------------------------------------------------------- /src/petri_net/mod.rs: -------------------------------------------------------------------------------- 1 | pub mod basic_block; 2 | pub mod function; 3 | mod intrinsics; 4 | mod tests; 5 | mod trait_impls; 6 | pub mod unique_functions; 7 | -------------------------------------------------------------------------------- /src/petri_net/tests.rs: -------------------------------------------------------------------------------- 1 | #[test] 2 | fn a_test() {} 3 | -------------------------------------------------------------------------------- /src/petri_net/trait_impls.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /src/petri_net/unique_functions.rs: -------------------------------------------------------------------------------- 1 | use log::warn; 2 | use petri_to_star::{NodeRef, PetriNet, PlaceRef, Result}; 3 | use std::collections::{HashMap, HashSet}; 4 | use std::convert::TryFrom; 5 | 6 | use super::function::{Function, Local}; 7 | 8 | #[derive(Debug)] 9 | pub struct MutexList { 10 | list: Vec, 11 | links: HashMap, 12 | guards: HashMap, 13 | } 14 | 15 | #[derive(Debug, Clone, Copy, Hash, Eq, PartialEq)] 16 | pub struct MutexRef { 17 | index: usize, 18 | } 19 | 20 | #[derive(Debug)] 21 | pub struct Mutex { 22 | uninitialized: NodeRef, 23 | unlocked: NodeRef, 24 | locked: NodeRef, 25 | dead: NodeRef, 26 | } 27 | 28 | impl MutexRef { 29 | pub fn uninitialized(&self, list: &MutexList) -> NodeRef { 30 | list.list 31 | .get(self.index) 32 | .expect("mutex not found") 33 | .uninitialized 34 | } 35 | pub fn unlocked(&self, list: &MutexList) -> NodeRef { 36 | list.list.get(self.index).expect("mutex not found").unlocked 37 | } 38 | pub fn locked(&self, list: &MutexList) -> NodeRef { 39 | list.list.get(self.index).expect("mutex not found").locked 40 | } 41 | pub fn dead(&self, list: &MutexList) -> NodeRef { 42 | list.list.get(self.index).expect("mutex not found").dead 43 | } 44 | } 45 | 46 | impl MutexList { 47 | pub fn new() -> Self { 48 | Self { 49 | list: Vec::new(), 50 | links: HashMap::new(), 51 | guards: HashMap::new(), 52 | } 53 | } 54 | 55 | pub fn get_linked(&mut self, local: Local) -> Option<&MutexRef> { 56 | self.links.get(&local) 57 | } 58 | 59 | pub fn add(&mut self, net: &mut PetriNet) -> Result { 60 | let index = self.list.len(); 61 | let uninitialized = net.add_place(); 62 | uninitialized.name(net, format!("Mutex_{} uninitialized", index))?; 63 | PlaceRef::try_from(uninitialized)?.marking(net, 1)?; 64 | let locked = net.add_place(); 65 | locked.name(net, format!("Mutex_{} locked", index))?; 66 | let unlocked = net.add_place(); 67 | unlocked.name(net, format!("Mutex_{} unlocked", index))?; 68 | let dead = net.add_place(); 69 | dead.name(net, format!("Mutex_{} dead", index))?; 70 | self.list.push(Mutex { 71 | uninitialized, 72 | unlocked, 73 | locked, 74 | dead, 75 | }); 76 | Ok(MutexRef { index }) 77 | } 78 | 79 | pub fn add_guard(&mut self, guard: Local, mutex: MutexRef) { 80 | self.guards.insert(guard, mutex); 81 | } 82 | 83 | pub fn is_linked(&self, local: Local) -> Option<&MutexRef> { 84 | self.links.get(&local) 85 | } 86 | 87 | pub fn link(&mut self, local: Local, mutex: MutexRef) { 88 | match self.links.insert(local, mutex) { 89 | None => {} 90 | Some(old_mutex) => { 91 | if old_mutex != mutex { 92 | warn!("Local '{:?}' was already linked to mutex '{:?}'. The old value will be overridden with mutex '{:?}'", local, old_mutex, mutex) 93 | } 94 | } 95 | }; 96 | } 97 | } 98 | -------------------------------------------------------------------------------- /tests/sample_programs/dining_philosophers.rs: -------------------------------------------------------------------------------- 1 | use std::sync::{Arc, Mutex}; 2 | use std::{thread, time}; 3 | 4 | struct Philosopher { 5 | left_fork: Arc>, 6 | right_fork: Arc>, 7 | } 8 | 9 | struct Fork; 10 | 11 | impl Philosopher { 12 | pub fn run(&self, dinner_count: usize) { 13 | for _ in 0..dinner_count { 14 | let lf; 15 | while true { 16 | let result = self.left_fork.lock(); 17 | if result.is_ok() { 18 | lf = result.unwrap(); 19 | break; 20 | } 21 | } 22 | { 23 | let rf; 24 | while true { 25 | let result = self.right_fork.lock(); 26 | if result.is_ok() { 27 | rf = result.unwrap(); 28 | break; 29 | } 30 | } 31 | thread::sleep(time::Duration::from_millis(100)); 32 | } // right fork put down 33 | } // left fork put dow 34 | } 35 | } 36 | 37 | fn main() { 38 | let mut forks = Vec::new(); 39 | let mut philosophers = Vec::new(); 40 | for _ in 0..5 { 41 | let fork = Arc::new(Mutex::new(Fork {})); 42 | forks.push(fork.clone()); 43 | } 44 | for index in 0..5 { 45 | let left_fork = forks.get(index).unwrap().clone(); 46 | let right_fork = forks.get((index + 1) % 5).unwrap().clone(); 47 | philosophers.push(Philosopher { 48 | left_fork, 49 | right_fork, 50 | }); 51 | } 52 | for philosopher in philosophers { 53 | thread::spawn(move || philosopher.run(10)) 54 | .join() 55 | .expect("thread::spawn failed"); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /tests/sample_programs/function_call.rs: -------------------------------------------------------------------------------- 1 | pub fn main() { 2 | let mut x = 5; 3 | x = call(x); 4 | } 5 | 6 | fn call(i: usize) -> usize { 7 | // generates an assert terminator 8 | i * 2 9 | } 10 | -------------------------------------------------------------------------------- /tests/sample_programs/match.rs: -------------------------------------------------------------------------------- 1 | use std::env; 2 | 3 | fn main() { 4 | let x = match env::args().len() { 5 | 1 => 1, 6 | 2 => 2, 7 | 3 => 3, 8 | _ => 42, 9 | }; 10 | } 11 | -------------------------------------------------------------------------------- /tests/sample_programs/minimal_deadlock.rs: -------------------------------------------------------------------------------- 1 | //https://stackoverflow.com/a/55959254 2 | use std::sync::{Arc, Mutex}; 3 | 4 | pub fn main() { 5 | let data = Arc::new(Mutex::new(0)); 6 | let _d1 = data.lock(); 7 | let _d2 = data.lock(); // cannot lock, since d1 is still active 8 | } 9 | -------------------------------------------------------------------------------- /tests/sample_programs/minimal_nondeadlock.rs: -------------------------------------------------------------------------------- 1 | pub fn main() -> ! { 2 | loop {} 3 | } 4 | -------------------------------------------------------------------------------- /tests/sample_programs/minimal_program.rs: -------------------------------------------------------------------------------- 1 | pub fn main() {} 2 | -------------------------------------------------------------------------------- /tests/sample_programs/promoted.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | let x: &'static u32 = &42; 3 | } 4 | -------------------------------------------------------------------------------- /tests/sample_programs/switch_int.rs: -------------------------------------------------------------------------------- 1 | pub fn main() { 2 | let mut x = 5; 3 | let y = match x { 4 | 1 => 1, 5 | 2 => 2, 6 | _ => 5, 7 | }; 8 | } 9 | -------------------------------------------------------------------------------- /tests/test_programs.rs: -------------------------------------------------------------------------------- 1 | // build on https://rust-lang-nursery.github.io/cli-wg/tutorial/testing.html#testing-cli-applications-by-running-them 2 | use assert_cmd::prelude::*; // Add methods on commands 3 | // use predicates::prelude::*; 4 | use std::process::Command; // Run programs // Used for writing assertions 5 | 6 | fn test_program(path: &str) -> Result<(), Box> { 7 | let mut cmd = Command::main_binary()?; 8 | cmd.arg(path); 9 | cmd.env("RUST_BACKTRACE", "1"); 10 | cmd.env("RUST_LOG", "trace"); 11 | // has to point to the toolchain declared in ``rust-toolchain`` file 12 | cmd.env( 13 | "LD_LIBRARY_PATH", 14 | "/home/tom/.rustup/toolchains/nightly-2020-01-07-x86_64-unknown-linux-gnu/lib", 15 | ); 16 | 17 | let result = cmd.assert().success(); 18 | // run 'cargo test -- --nocapture' to see the actual output 19 | let output = result.get_output(); 20 | if output.status.success() { 21 | println!("{}", String::from_utf8_lossy(&output.stdout)); 22 | }; 23 | Ok(()) 24 | } 25 | 26 | #[test] 27 | fn minimal_program_test() { 28 | test_program("tests/sample_programs/minimal_program.rs").unwrap(); 29 | } 30 | 31 | #[test] 32 | fn minimal_nondeadlock_test() { 33 | test_program("tests/sample_programs/minimal_nondeadlock.rs").unwrap(); 34 | } 35 | 36 | #[test] 37 | fn minimal_deadlock_test() { 38 | test_program("tests/sample_programs/minimal_deadlock.rs").unwrap(); 39 | } 40 | 41 | #[test] 42 | fn function_call_test() { 43 | test_program("tests/sample_programs/function_call.rs").unwrap(); 44 | } 45 | --------------------------------------------------------------------------------