tfm-slides/slides.tex
Carlos Galindo 6e2ab8afd1 update
2019-12-14 15:27:01 +01:00

390 lines
No EOL
12 KiB
TeX

% !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}