Mercurial > hg > Papers > 2011 > nobu-prosym
diff Paper/memo.txt @ 35:6e50f1c7f914
add some pdf files
author | Nobuyasu Oshiro <dimolto@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 22 Nov 2011 03:51:28 +0900 |
parents | b97cc8bbc20a |
children |
line wrap: on
line diff
--- a/Paper/memo.txt Mon Nov 21 21:30:17 2011 +0900 +++ b/Paper/memo.txt Tue Nov 22 03:51:28 2011 +0900 @@ -1,3 +1,13 @@ +\begin{figure} +\begin{footnotesize} +\lstinputlisting[language=c]{source/factorial.cbc} +\caption{階上を計算する CbC プログラムの例} +\label{fig:factorial} +\end{footnotesize} +\end{figure} + + + \begin{figure}[h] \begin{minipage}[b]{.45\textwidth} \begin{lstlisting}[caption=CbCコード例,label=code:CbC-example] @@ -51,3 +61,142 @@ \label{tab:speed-mc-vs-gcc-4.6} \end{table} + +\begin{figure}[h] +%\begin{footnotesize} + \begin{minipage}[b]{.45\textwidth} + \begin{lstlisting}[caption=スタックの上書きが起こる継続の例,label=code:cs_prog] +__code cs_a(int a, int b) { + goto cs_b(b, a) +} + \end{lstlisting} + \end{minipage} + \hfill +%\end{footnotesize} +\end{figure} + +\begin{verbatim} +__code c1(__code ret(int,void *),void *env) { + goto ret(1,env); +} + +int main() { + goto c1(__return, __environment); +} +\end{verbatim} + +\begin{figure}[h] +\begin{footnotesize} + \begin{minipage}[b]{.45\textwidth} + \begin{lstlisting}[caption=環境付き継続を行うコード,label=code:_ret_val] +__label__ _cbc_exit0; +static int retval; + void _cbc_internal_return(int retval_, + void *_envp){ + retval = retval_; + goto _cbc_exit0; +} +if (0) { + _cbc_exit0: + return retval; + } +_cbc_internal_return; + \end{lstlisting} + \end{minipage} + \hfill +\end{footnotesize} +\end{figure} + + +\begin{figure}[h] + \begin{minipage}[b]{.45\textwidth} + \begin{lstlisting}[caption=typedefrecの例,label=code:typedefrec] +typedefrec void *funcA(int, funcA); + +typedefrec struct { + NODE left; + NODE right; +} *NODE; + \end{lstlisting} + \end{minipage} + \hfill +\end{figure} + + + + +また,比較を行うプログラムは最適化(-O0 オプション)を行わないものと, +速度最適化(-O2 -fomit-frame-pointer)を行うものの2つ, +それと -m32 オプションと -m64 オプションをつけたものそれぞれで行う. + +表\ref{tab:speed-mc-vs-gcc-nonopt}が最適化無し, +表\ref{tab:speed-mc-vs-gcc-opt}が速度最適化有りとなる. + + +\begin{table}[htpb] + \centering + \small + \begin{tabular}{|c|c|c|c|} \hline + CPU/OS &GCC-4.4& GCC-4.6 &Micro-C \\ \hline +% x86/Linux & 7.378 & 0.833 & 2.923 \\ \hline + x86/Linux & 7.378 & & 2.923 \\ \hline +% x86\_64/OS X(-m32)& 5.951 & 0.507 & 2.871\\ \hline + x86\_64/OS X(-m32)& 5.951 & & 2.871\\ \hline +% x86\_64/OS X & 6.420 & 0.621 & \\ \hline + x86\_64/OS X(-m64) & 6.420 & & \\ \hline + \end{tabular} + \caption{アーキテクチャ毎のGCCとmicro-cの速度比較(単位: 秒)(最適化無し)} + \label{tab:speed-mc-vs-gcc-nonopt} +\end{table} + + + +\section{評価} +今回実装を行った GCC-4.6 ベースのコンパイラを GCC-4.4 ベース, +Micro-C コンパイラとそれぞれ比較を行った. +比較を行うのはクイックソートのプログラムである. +%クイックソートは再帰的にプログラムされる為 CbC に向いている +%プログラムだと言える. +クイックソートは再帰的なプログラムな為スタック操作が行われる為テストに向いている. +比較を行うのは以下のアーキテクチャと OS になる. + +%\begin{description} +\begin{itemize} + \item x86/Linux + \item x86/OS X +\end{itemize} +%\end{description} + + +\begin{table}[htpb] + \centering + \small + \begin{tabular}{|c|c|c|c|} \hline + CPU/OS &GCC-4.4& GCC-4.6 &Micro-C \\ \hline + x86/Linux & 3.253 & 2.906 & 2.71 \\ \hline + x86\_64/OS X(-m32)& 2.726 & 2.418 & 2.857\\ \hline + x86\_64/OS X(-m64) & 1.390 & 1.509 & \\ \hline + \end{tabular} + \caption{アーキテクチャ毎のGCCとmicro-cの速度比較(単位: 秒)(速度最適化)} + \label{tab:speed-mc-vs-gcc-opt} +\end{table} + +GCC-4.6 バージョンの最適化無しは, 末尾最適化が強制的に行われる為 +除外している. +最適化有りと無しの比較が 4.6 でも行えないのは残念だが, 最適化の効果はでている +ように思われる.GCC-4.4 では最適化により 2 倍以上の性能がでている. +また 64bit 版の最適化有りは 32bit 版に比べてどちらも 1.6 倍以上の速度がでている +のが確認できた. +Micro-C と比較では GCC の 32bit 版が若干早く, 64bit 版は 2 倍の差がでているのが +確認できた. + + + + + + + + + + +