This commit is contained in:
Carlos Galindo 2019-12-14 15:27:01 +01:00
parent f6c407e074
commit 6e2ab8afd1
8 changed files with 488 additions and 23 deletions

4
.gitmodules vendored
View File

@ -1,3 +1,3 @@
[submodule "theme"]
path = theme
[submodule "beamertheme-bjeldbak"]
path = beamertheme-bjeldbak
url = https://github.com/martinbmadsen/beamertheme-bjeldbak.git

View File

@ -1,13 +1,13 @@
all: beamer.pdf
all: slides.pdf
pdf: beamer.pdf
pdf: slides.pdf
images:
$(MAKE) -C figs
beamer.pdf: beamer.tex images
pdflatex -synctex=1 -interaction=nonstopmode beamer.tex
pdflatex -synctex=1 -interaction=nonstopmode beamer.tex
slides.pdf: slides.tex images
pdflatex -synctex=1 -interaction=nonstopmode slides.tex
pdflatex -synctex=1 -interaction=nonstopmode slides.tex
clean:
rm -f *.toc *.aux *.bbl *.blg *.fls *.out *.log *.synctex.gz

View File

@ -1,15 +0,0 @@
\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{graphicx}
\title{Fragmentación de programas con excepciones}
\date{Dec 16th, 2019}
\author{Carlos S. Galindo Jiménez}
\begin{document}
\maketitle
\end{document}

22
figs/problem1.dot Normal file
View File

@ -0,0 +1,22 @@
digraph pdf {
entry [label="enter f()",style=filled];
entry -> {while; D};
while [label="while (X)",style=filled];
C [style="bold,filled"]
"if (Y)" [style=filled]
"if (Z)" [style=filled]
while -> {"if (Y)" C};
break2 [style=filled]
break1 [style=filled]
"if (Y)" -> {"if (Z)"};
"if (Z)" -> {A break1};
break1 -> B;
break1 -> break2;
break2 -> {C while};
{rank=same; A break1 B break2}
{rank=same; "if (Z)" C}
{rank=same; while D}
{edge [style=invis];
A -> break1 -> B -> break2;
}
}

29
figs/problem2.dot Normal file
View File

@ -0,0 +1,29 @@
digraph g {
"f()" [shape=box, rank=min, style = filled];
// Rank adjustment
{ node [style=filled]
{ rank = same; "int a = 1"; "while (a > 0)"; }
"if (a > 10)"; break;
}
{ rank = same; "print(a)"; "a++"; }
{ rank = max; "a++"; "print(a)"; }
"a++" [style="filled,bold"];
// Control flow
"f()" -> "while (a > 0)";
"f()" -> "int a = 1";
"while (a > 0)" -> "if (a > 10)";
"if (a > 10)" -> "break";
"break" -> "print(a)";
"break" -> "a++";
"break" -> "while (a > 0)";
// Data flow
{ edge [color = red];
"int a = 1" -> "while (a > 0)";
"int a = 1" -> "if (a > 10)";
"int a = 1" -> "print(a)";
"a++" -> "a++";
"a++" -> "while (a > 0)";
"a++" -> "if (a > 10)";
"a++" -> "print(a)" [constraint = true];
}
}

40
figs/problem3.dot Normal file
View File

@ -0,0 +1,40 @@
digraph g {
enter [style = filled];
mxin [label = "x = x_in", style = filled];
try [style = filled];
x_in [label = "x_in = x", style = filled];
f [label = "f()", style = filled];
nr [label = "normal return"];
x_out_nr [label = "x = x_out"];
er [label = "error return"];
catch [label = "catch (Exception e)"];
x_out_catch [label = "x = x_out"];
log [label = "log(\"error\")"];
x_0 [label = "x = 0", style = filled];
x_in2 [label = "x_in = x", style = filled];
f2 [label = "f()", style = filled];
nr2 [label = "normal return"];
er2 [label = "error return"];
ee [label = "error exit"];
x_out_nr2 [label = "x = x_out"];
x_out_ee [label = "x = x_out"];
enter -> {mxin try};
try -> f -> {x_in nr er}
nr -> x_out_nr
er -> catch -> {x_out_catch log}
enter -> {x_0 f2}
f2 -> {x_in2 nr2 er2}
nr2 -> x_out_nr2
er2 -> ee -> x_out_ee;
{edge [color = red, constraint = false];
mxin -> x_in;
x_0 -> x_in2;
}
{edge [color = blue, constraint = false];
x_in -> {x_out_nr x_out_catch}
x_in2 -> {x_out_nr2 x_out_ee}
}
}

390
slides.tex Normal file
View File

@ -0,0 +1,390 @@
% !TEX encoding = UTF-8
% !TEX spellcheck = en_GB
\documentclass[aspectratio=169,compress]{beamer}
\usepackage{pgfpages}
\usepackage{listings}
\usepackage[utf8]{inputenc}
\usepackage[spanish,english]{babel}
\usepackage{graphicx}
\newcommand{\bluebold}[1]{\textbf{\textcolor{blue}{#1}}}
% \usepackage{dot2texi}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows}
% \usetheme{beamertheme-bjeldbak/bjeldbak}
\setbeamertemplate{note page}[plain]
% \setbeameroption{show notes on second screen=right}
\usetheme{-bjeldbak/beamerthemebjeldbak}
% \usetheme{Madrid}
% \usecolortheme{whale}
% \title[Program slicing with exceptions]{Fragmentación de programas con excepciones}
\title{Program slicing with exception handling}
\date{Dec 18th, 2019}
\author[C. Galindo]{Carlos S. Galindo Jiménez}
\institute[UPV]{
Universidad Politécnica de Valencia
}
\begin{document}
\input{listings-config}
\maketitle
\begin{frame}
\frametitle{TODO}
\begin{itemize}
\item Proposal no, solution o proposed solution.
\end{itemize}
\end{frame}
\begin{frame}
\frametitle{Table of Contents}
\tableofcontents
\end{frame}
% \begin{frame}{Index}
% \note{some other notes}
% \begin{itemize}
% \item Example of program slicing (w/o graphs)
% \item Usages of slicing
% \item Thesis' goal: program slicing in presence of exceptions
% \item Example of difference between complete/correct with Venn diagram
% \item Exception handling in Java, and minor mention to other languages
% \item Example of a SDG
% \item Unconditional control flow: add pseudo-predicates and example
% \item Exceptions: throw treatment and example, try-catch and example
% \item Problem 1, generalization and solution
% \item Problem 2, generalization and solution
% \item Problem 3, generalization and solution
% \end{itemize}
% \end{frame}
\section{Introduction}
\subsection{Program slicing}
\begin{frame}[containsverbatim]{Program slicing}
\begin{minipage}{0.5\linewidth}
% Highlight using this, only useful line by line
% https://tex.stackexchange.com/questions/8851/how-can-i-highlight-some-lines-from-source-code#8860
\begin{lstlisting}
void f(int x) {
int sum = 0;
int prod = 0;
while (x > 0) {
sum += x;
prod *= x;
x--;
}
log("sum: " + sum);
log("prod: " + prod);
}
\end{lstlisting}
\end{minipage}
\begin{minipage}{0.49\linewidth}
\begin{lstlisting}
void f(int x) {
int prod = 0;
while (x > 0) {
prod *= x;
x--;
}
log("prod: " + prod);
}
\end{lstlisting}
\end{minipage}
{\hfill Example adapted from [Tip 95].}
\end{frame}
\begin{frame}{Program slicing}{Applications}
\begin{itemize}
\item Debugging
\item Program specialization
\item Software maintenance
\item Code obfuscation
\item Dead code removal
\item Program parallelization
\end{itemize}
\end{frame}
\begin{frame}{Program slicing}{Metrics}
\begin{itemize}
\item \textbf{Completeness.} The slice includes all instructions that are necessary.
\item \textbf{Correctness.} The slice excludes all instructions that are not necessary.
\end{itemize}
If we have a program (complete but not correct) and its slice (complete and correct) we can show examples of (correct but not complete?) and (nor complete nor correct)---This is a graphics placeholder.
\end{frame}
% \subsection{Goals}
% \begin{frame}{Objectives}
% TODO; remove, this is the toc
% \begin{itemize}
% \item Analyse the state-of-the-art
% \item Analyse exception handling in program slicing
% \item Find problems with the state-of-the-art and propose solutions
% \end{itemize}
% \end{frame}
\subsection{Exception handling}
\begin{frame}[containsverbatim]{Exception handling systems}{Java}
\begin{minipage}{0.49\linewidth}
\begin{lstlisting}
try {
f();
} catch (Exception e) {
log("caught exception");
} catch (Throwable e) {
log("caught throwable");
}
\end{lstlisting}
\end{minipage}
\begin{minipage}{0.49\linewidth}
\begin{lstlisting}
void f() throws Exception {
switch(x) {
case A:
log("no error");
break;
case B:
throw new Exception();
default:
throw new Throwable();
}
}
\end{lstlisting}
\end{minipage}
\end{frame}
\begin{frame}{Exception handling systems}{Java}
Sources of exceptions:
\begin{itemize}
\item Array creation, array access, division, cast\dots
\item Method calls.
\item Field or method access on \texttt{null} variable.
\item Any instruction at any time.
\end{itemize}
This should be removed.
\end{frame}
\begin{frame}{Exception handling systems}{Other programming languages}
\begin{table}
\begin{minipage}{0.6\linewidth}
\centering
\begin{tabular}{r | r }
\textbf{Language} & $\%$ usage \\ \hline
JavaScript & 69.7 \\ \hline
HTML/CSS & 63.1 \\ \hline
SQL & 56.5 \\ \hline
Python & 39.4 \\ \hline
Java & 39.2 \\ \hline
\textbf<2->{\textcolor<2->{blue}{Bash/Shell}}/PowerShell & 37.9 \\ \hline
C\# & 31.9 \\ \hline
PHP & 25.8 \\ \hline
TypeScript & 23.5 \\ \hline
C++ & 20.4 \\ \hline
\end{tabular}
\end{minipage}
\begin{minipage}{0.39\linewidth}
\begin{tabular}{r | r }
\textbf{Language} & $\%$ usage \\ \hline
\textbf<3->{\textcolor<3->{blue}{C}} & 17.3 \\ \hline
Ruby & 8.9 \\ \hline
\textbf<4->{\textcolor<4->{blue}{Go}} & 8.8 \\ \hline
Swift & 6.8 \\ \hline
Kotlin & 6.6 \\ \hline
R & 5.6 \\ \hline
\textbf<5->{\textcolor<5->{blue}{VBA}} & 5.5 \\ \hline
Objective-C & 5.2 \\ \hline
\textbf<6->{\textcolor<6->{blue}{Assembly}} & 5.0 \\ \hline
\end{tabular}
\end{minipage}
% The caption has a weird structure due to the fact that there's a footnote
% inside of it.
\caption[Commonly used programming languages]{The most commonly used
programming languages by professional developers (Data from StackOverflow's 2019 Developer Survey)}
\label{tab:popular-languages}
\end{table}
\end{frame}
\begin{frame}{Program slicing}{The system dependence graph}
\begin{enumerate}
\item Código a un lado
\item Aparecen nodos que corresponden a statements
\item Aparecen arcos (control y data o por pasos).
\item Añadir in-out
\item No añadir la llamada
\end{enumerate}
\centering
\includegraphics[width=0.9\linewidth]{figs/parameter-passing}
\end{frame}
\begin{frame}{Program slicing}{Slicing the SDG}
\centering
\includegraphics[width=0.9\linewidth]{figs/parameter-passing}
\end{frame}
\section{Problems and proposals}
\subsection{Problem 1: incorrect slices with nested unconditional jumps}
% TODO añadir nombres a los problemas
\begin{frame}[containsverbatim]{Problem 1}{The subsumption correctness error}
\begin{minipage}{0.39\linewidth}
\begin{lstlisting}
public void f() {
while (X) {
if (Y) {
if (Z) {
A;
break;
}
B;
break;
}
C;
}
D;
}
\end{lstlisting}
\end{minipage}
\begin{minipage}{0.59\linewidth}
\includegraphics[width=0.8\linewidth]{figs/problem1}
\end{minipage}
\end{frame}
\begin{frame}{Problem 1: proposed solution}{The subsumption correctness error}
TODO: show graph here, label the edges caused by each jump and then remove some.
\end{frame}
\subsection{Problem 2: incorrect weak slices}
\begin{frame}[containsverbatim]{Problem 2}{Unnecessary instructions in weak slicing}
\begin{minipage}{0.33\linewidth}
\begin{lstlisting}
void g() {
int x = 0;
while (x > 0) {
if (x > 10)
break;
x++;
}
log(x);
}
\end{lstlisting}
\end{minipage}
\begin{minipage}{0.66\linewidth}
\centering
\includegraphics[width=0.6\linewidth]{figs/problem2}
\end{minipage}
\end{frame}
\begin{frame}{Problem 2: proposed solution}{Unnecessary instructions in weak slicing}
TODO: animate the multi-pass solution.
\begin{enumerate}
\item Remove all forward-jumping unconditional jump's nodes.
\item Traverse the graph.
\item Re-add all nodes that fulfil the condition of having something selected after them.
\item Goto 2.
\end{enumerate}
\end{frame}
\subsection{Problem 3: incomplete \texttt{catch} treatment}
\begin{frame}[containsverbatim]{Problem 3}{The lack of dependencies of \texttt{catch} statements}
\begin{minipage}{0.29\linewidth}
\begin{lstlisting}
void main() throws Exception {
try {
f();
} catch (Exception e) {
log("error");
}
x = 0;
f();
}
\end{lstlisting}
\end{minipage}
\begin{minipage}{0.7\linewidth}
\includegraphics[width=\linewidth]{figs/problem3}
\end{minipage}
\end{frame}
\begin{frame}{Problem 3: proposed solution}{The lack of dependencies of \texttt{catch} statements}
TODO: animate the conversion to the new dependencies and a slice.
\begin{enumerate}
\item Organize \texttt{catch} statements in a tree.
\item Add a path to the exit on the root.
\item Maybe reference parallelism with the treatment of unconditional statements.
\end{enumerate}
\end{frame}
\section{Conclusions}
\begin{frame}{Conclusions}
\begin{itemize}
\item Program slicing: a powerful technique, not yet complete for commonly used programming languages.
\item Any proposal exchanges efficiency for completeness/correctness.
\item Complete is required, correct is nice.
\item Unconditional jumps are complete: let's correct them.
\item Results
\begin{itemize}
\item 3 problems and proposed solutions.
\item NOMBRE PAPER, submitted to BLA BLA.
\item OTHER WORK, to be submitted to BLA BLA.
\end{itemize}
\end{itemize}
\end{frame}
\begin{frame}{Future work}
\begin{itemize}
\item Improve correctness of \texttt{try-catch}.
\item Implement into existing software tools, benchmark against state of the art.
\item Adapt to other variants of program slicing.
\item Redefine control dependence: Danicic TODO (nº cita) tried, \textit{execution dependence} vs. \textit{presence dependence}.
\end{itemize}
\end{frame}
\begin{frame}{The End}
\end{frame}
\appendix
% \section*{Extra slides}
\begin{frame}[noframenumbering]{Related work}
Change to state of the art and move to introduction
\begin{itemize}
\item SinH98 and SinH99 introduce the field slicing + exceptions
\item AllH03 improves the existing techniques
\item HorwitzRB88 introduces the current handling of unconditional jumps
\item JoC04 presents an alternative way to compute the CFG, but does not demonstrate the effects for program slicing.
\item JiaZSJ06 propose a solution in C++, ... TODO
\item PraMB11 also work in C++, no notable improvement TODO
\item JieS11 introduces OO + Exception SDG, but treats exceptions similar to Horwitz, leaving the original problems unresolved.
\end{itemize}
\end{frame}
\begin{frame}[noframenumbering]{Program slicing}{Strong and weak slices}
Slide with definitions + examples (code and table w/ sequences).
\end{frame}
\end{document}

1
theme

@ -1 +0,0 @@
Subproject commit e2cea55a3837e29f92324b2f18d98482474b99e1