changeset 2:771136eae970

proofread
author Kaito Tokumori <e105711@ie.u-ryukyu.ac.jp>
date Mon, 22 Jun 2015 19:44:08 +0900
parents 97e85476344e
children c50a033e6635
files cfopm.pdf cfopm.tex
diffstat 2 files changed, 32 insertions(+), 40 deletions(-) [+]
line wrap: on
line diff
Binary file cfopm.pdf has changed
--- a/cfopm.tex	Tue Jun 02 18:30:29 2015 +0900
+++ b/cfopm.tex	Mon Jun 22 19:44:08 2015 +0900
@@ -80,11 +80,8 @@
 % As a general rule, do not put math, special symbols or citations
 % in the abstract
 \begin{abstract}
-A programming paradigm which use data segments and
-code segments is proposed. CbC is a lower language of C for this paradigm. 
-CbC has standalone compiler and GCC version.
-In this study, we add an implement CbC compiler on LLVM/clang-3.7. 
-The detail of implementation and evaluation are shown.
+  The proposed programming paradigm uses data segments and code segments. This paradigm uses Continuation based C (CbC), which is an extension and subset of C.
+  CbC has a standalone compiler and the GNU Compiler Collection (GCC). This study details and evaluates the implementation of a CbC compiler for LLVM and Clang 3.7. 
 \end{abstract}
 
 % no keywords
@@ -103,25 +100,21 @@
 \IEEEpeerreviewmaketitle
 
 \section{A Practical Continuation based Language}
-We proposed units of program named code segment and data segment.
-Code segment is a unit of calculation which has no state.
-Data segment is a set of typed data.
-Code segments are connected to data segments with a context, which is a meta data segment.
-After an execution of a code segment and its context, next code segments (Continuation) is executed.
+The proposed units of programming are named code segments and data segments. 
+Code segments are units of calculation which have no state. 
+Data segments are sets of typed data.
+Code segments are connected to data segments by a meta data segment called a context. 
+After the execution of a code segment and its context, the next code segment (continuation) is executed.
 
-We had developed a programming language ``Continuation based C (CbC)'' \cite{DBLP:journals/corr/abs-1109-4048}.
-Hearafter we call it CbC, which supports code segments.
-CbC is compatible with the C language and it has continuation as a goto statement.
+Continuation based C (CbC) \cite{DBLP:journals/corr/abs-1109-4048}, hereafter referred to as CbC, is an extension and subset of C which supports code segments. It is compatible with C and has continuation as a goto statement. 
 
-Code segments and data segments are low level enough to represent computation details,
-and it is architecture independent.
-It can be used as an architecture independent assembler.
+Code segments and data segments are low level enough to represent computational details,
+and are architecture independent. They can be used as architecture independent assemblers. 
 
 CbC has standalone compiler and GCC version. Here we report new partial implementation of CbC compiler based on LLVM and Clang 3.7.
 
-First we show the CbC language overview.
 \section{Continuation based C}
-CbC's basic programing unit is a code segment. It is not a subroutine, but it looks like a function, because it has input and output. These interfaces should be data segments and we are currently designing data segments part. 
+CbC's basic programming unit is the code segment. These are not subroutines, but they look like functions because they take input and produce output. Both input and output should be data segments. Table \ref{src:example} details the definition of the data segment. 
 
 \begin{table}[html]
 \begin{lstlisting}
@@ -142,7 +135,8 @@
 \label{src:example}
 \end{table}
 
-In this example, a code segment {\bf f} has input datasegment {\bf allocate} (Allocate is a data segment identifier) and sends output it to a code segment {\bf g}. CbC compiler generates data segment definition automatically so we do not have to write it. There is no return from code segment {\bf g}, {\bf g} should call another continuation using {\bf goto}. Code segments has one input data segment and several output data segment, and their dependency is proved by data segments.
+In this example, the code segment {\bf f} takes the input data segment {\bf allocate} (allocate is the data segments identifier) and sends f's outuput to the code segment {\bf g}. The Cbc compiler generates the data segment definition automatically, so writing it is unnecessary. There is no return from code segment {\bf g}. {\bf G} should call another continuation using {\bf goto}. Code segments have one input data segment and several output data segments, and their dependency is proved by the data segments.
+
 \begin{figure}[htp]
   \begin{center}
     \scalebox{0.5}{\includegraphics{fig/csds.pdf}}
@@ -151,7 +145,7 @@
   \label{fig:csds}
 \end{figure}
 
-In CbC, we can go to a code segment from a C function and we can call C functions in a code segment. So we don't have to shift completely from C to CbC. The later one is straight forward, but the former one needs further extensions.
+Shifting completely, from C to CbC is  unnecessary as in CbC we can go to code segments from C functions and call C functions in code segments   The latter is straightforward but the former needs further extensions.
 
 \begin{table}[html]
 \begin{lstlisting}
@@ -168,10 +162,10 @@
 \label{src:example}
 \end{table}
 
-In this hello world example, the environment of {\bf main}() and its continuation is kept in a variable {\bf \_\_environment}. The environment and the continuation can be get using {\bf \_\_environment} and {\bf \_\_return}.Arbitrary mixture of code segments and functions are allowed. The continuation of {\bf goto} statement never returns to original function, but it goes to caller of original function. In this case, it returns result 0 to the operating system. This cotinuation is called {\bf goto with environment}.
+In this hello world example, the environment of {\bf main}() and its continuation is kept in the variable {\bf \_\_environment}. The environment and the continuation can be accessed using {\bf \_\_environment} and {\bf \_\_return}.The arbitrary mixing of code segments and functions is allowed. The continuation of a {\bf goto} statement never returns to the original function, but goes to the caller or the original function. In that case, it returns the result 0 to the operating system. This continuation is called {\bf goto with environment}. 
 
 \section{LLVM and Clang}
-The LLVM Project is a collection of modular and reusable compiler and toolchain technologies, and the LLVM Core libraries provide a modern source and target independent optimizer, along with code generation support for many popular CPUs. Clang is an LLVM native C/C++/Objective-C compiler. Figure \ref{fig:structure} is Clang and LLVM's compile flow.
+The LLVM Project is a collection of modular and reusable compilers and toolchain technologies, and the LLVM Core libraries provide a modern source and target independent optimizer, along with code generation support for many popular CPUs. Clang is an LLVM native C/C++/Objective-C compiler. Figure \ref{fig:structure} shows Clang and LLVM's compilation flow.
 
 \begin{figure}[htp]
   \begin{center}
@@ -181,10 +175,10 @@
   \label{fig:structure}
 \end{figure}
 
-LLVM has a intermediate representation which called LLVM IR\cite{LLVMIR}. Importantly, we do not modify it so we do not have to modifiy optimize part.
+LLVM has an intermediate representation which is called LLVM IR\cite{LLVMIR}. This part remains unmodified so that the optimization part does not need to be modified.
 
 \section{Implementation in LLVM and Clang}
-So how to implement CbC compiler in LLVM and Clang. Here we show our idea.
+The CbC compiler is implemented in LLVM and Clang using the following ideas. 
 
 \begin{itemize}
 \item Code segments are implemented by C functions.
@@ -192,21 +186,19 @@
 \item Goto with environment is implemented by setjmp and longjmp.
 \end{itemize}
 
-{\bf \_\_code} is implemented as a new type keyword in LLVM and Clang. You may think {\bf \_\_code} is an attribute of a function, which means that the function can call in tail call elimination only.
-Because of this implementation, we can actually call code segment as a C function call.
+{\bf \_\_code} is implemented as a new type keyword in LLVM and Clang. {\bf \_\_code} is similar to an attribute of a function, which means that the function can only be called in tail call elimination. Because of this implementation, code segments can actually be called as C function calls.
 
-Forcing tail call require many conditions. For example, there should be no statement after tail call, caller and callee's calling convention have to be the same and type is cc10, cc11 or fastcc, callee's return value type have to be the same as caller's it, add tail call elimination pass, and so on.
+Forcing a tail call requires many conditions be met. For example, there should not be a statement after a tail call, the caller and callee's calling conventions must be the same and their types should be cc10, cc11 or fastcc and  the callee's return value type has to be the same as the caller's.
 
-All code segment has the void return type and we do not allow to write statement after continuation, so type problem and after statement problem is solved.
-
-Tail call elimination pass is enabled in {\bf BackendUtil.cpp}. In the clang, when optimize level is two or more, tail call elimination pass is enabled. We modify it to enable anytime and if optimize level is one or less, tail call elimination pass work for only code segment.
+All code segments have the void return type and writing statements after continuation is not allowed. As a result, type problems and after statement problems are solved.
 
-Next, we solve a calling convention problem. We select fastcc for code segment's calling convention. In the clang, calling convention is managed by CGFunctionInfo class and its infomations are set in {\bf CGCall.cpp}. We modify here to set fastcc to code segments.
+Tail call elimination passes are enabled in {\bf BackendUtil.cpp}. In Clang, when the optimization level is two or more, tail call elimination passing is enable. Here it has been modified to be enabled anytime, however if the optimization level is one or less, tail call elimination passes only work for code segments. 
+A calling convention problem was also solved. fastcc was selected for a code segment's calling convention. In Clang, calling conventions are managed by the CGFunctionInfo class and its information is set in {\bf CGCall.ccp}, which is where cod segments calling conventions were set to fastcc. 
 
-Goto with environment is implemented by code rearranging. If the {\bf \_\_environment} or {\bf \_\_return} is declared, CbC compiler rearrange code for goto with environment. We use setjmp and longjmp for it. Setjmp save environment before continuation, and longjmp restore it.
+Goto with environment is implemented by code rearranging. If the {\bf \_\_environment} or {\bf \_\_return} is declared, the CbC compiler rearranges the code for goto with environment. Setjmp and longjmp are used to do this. setjmp to save the environment before continuation and longjmp to restore it. 
 
 \section{Result}
-Here is our benchmark program.
+Table \ref{src:example} shows the benchmark program.
 
 \begin{table}[html]
 \begin{lstlisting}
@@ -229,10 +221,9 @@
 \label{src:example}
 \end{table}
 
-It is written in C and CbC and there are several optimization is possible.
-When argument is 1, use CbC continuation. When argument is 2 or 3, optimization is enabled.
-
-Here we show benchmark result (TABLE \ref{result}).
+It is written in C and CbC and there are several optimizations possible.
+When the argument is 1, CbC continuation is used. When the argument is 2 or 3, optimization is enabled.
+The benchmark results are shown in TABLE \ref{result}.
 
 \begin{table}[htpb]
   \centering
@@ -247,12 +238,13 @@
   \label{result}
 \end{table} 
 
-LLVM and clang compiler is faster than Micro-C when optimization is enabled. It mean LLVM's optimization is powerful and useful. LLVM and clang compiler is slower than GCC but GCC cannot compile safety without optimization. It means LLVM can compile more reliability than GCC.
+LLVM and Clang compilers are faster than Micro-C when optimization is enabled. This means LLVM's optimization is powerful and useful. The LLVM and Clang complier is slower than GCC, but GCC cannot compile safely without optimization. This means LLVM can compile more reliably than GCC.
 
 \section{Conclusion}
-We have designed and implemented Continuation based language for practical use. We have partial implementation of CbC using LLVM and Clang 3.7. CbC can use LLVM's optimization. We did not modify LLVM IR to implement CbC compiler.
+This Continuation based language has been designed and implemented for practical use. CbC has been partially implemented using LLVM and Clang 3.7.
+CbC can use LLVM's optimization. LLVM IR was not modified to implement CbC's compiler.
 
-In future, we design and implement data segment and meta code segment, meta data segment for meta computation.
+In the future, data segments, meta code segments and meta data segments for meta computation will be designed and implemented. 
 \nocite{opac-b1092711, LLVMIR, LLVM, clang}
 \bibliographystyle{IEEEtran}
 \bibliography{IEEEabrv,reference}